@malloy-publisher/sdk 0.0.230 → 0.0.232
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 +1 -1
- package/dist/{ServerProvider-Tnt9y4B6.es.js → ServerProvider-DMk_BDrm.es.js} +4 -4
- package/dist/client/api.d.ts +60 -5
- package/dist/client/configuration.d.ts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/{core-Dp3q5Ieu.es.js → core-CK68iv6w.es.js} +1 -1
- package/dist/{core-DPpebaY3.cjs.js → core-DeaXfVr8.cjs.js} +1 -1
- package/dist/{index-oNBVlY2N.es.js → index-3Ctefu0u.es.js} +21 -13
- package/dist/{index-ClhlT2co.cjs.js → index-D0RRMPyp.cjs.js} +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +2 -2
- package/package.json +7 -7
- package/src/components/Package/Package.tsx +13 -1
package/README.md
CHANGED
|
@@ -322,7 +322,7 @@ const resourceUri = encodeResourceUri({
|
|
|
322
322
|
|
|
323
323
|
- Models list (`.malloy` files)
|
|
324
324
|
- Notebooks list (`.malloynb` files)
|
|
325
|
-
- Embedded databases (`.parquet` files)
|
|
325
|
+
- Embedded databases (`.parquet`, `.csv`, and `.xlsx` files)
|
|
326
326
|
- Connection configuration
|
|
327
327
|
- Package README
|
|
328
328
|
|
|
@@ -1255,7 +1255,7 @@ class Ca extends I {
|
|
|
1255
1255
|
const be = function(l) {
|
|
1256
1256
|
return {
|
|
1257
1257
|
/**
|
|
1258
|
-
* Retrieves a list of all embedded databases within the specified package. These are typically DuckDB
|
|
1258
|
+
* Retrieves a list of all embedded databases within the specified package. These are typically local data files read by DuckDB in place (.parquet, .csv, and .xlsx) that provide local data storage for the package. Each database entry includes metadata about the database structure and content.
|
|
1259
1259
|
* @summary List embedded databases
|
|
1260
1260
|
* @param {string} environmentName Name of the environment
|
|
1261
1261
|
* @param {string} packageName Name of the package
|
|
@@ -1281,7 +1281,7 @@ const be = function(l) {
|
|
|
1281
1281
|
const n = be(l);
|
|
1282
1282
|
return {
|
|
1283
1283
|
/**
|
|
1284
|
-
* Retrieves a list of all embedded databases within the specified package. These are typically DuckDB
|
|
1284
|
+
* Retrieves a list of all embedded databases within the specified package. These are typically local data files read by DuckDB in place (.parquet, .csv, and .xlsx) that provide local data storage for the package. Each database entry includes metadata about the database structure and content.
|
|
1285
1285
|
* @summary List embedded databases
|
|
1286
1286
|
* @param {string} environmentName Name of the environment
|
|
1287
1287
|
* @param {string} packageName Name of the package
|
|
@@ -1298,7 +1298,7 @@ const be = function(l) {
|
|
|
1298
1298
|
const r = X(l);
|
|
1299
1299
|
return {
|
|
1300
1300
|
/**
|
|
1301
|
-
* Retrieves a list of all embedded databases within the specified package. These are typically DuckDB
|
|
1301
|
+
* Retrieves a list of all embedded databases within the specified package. These are typically local data files read by DuckDB in place (.parquet, .csv, and .xlsx) that provide local data storage for the package. Each database entry includes metadata about the database structure and content.
|
|
1302
1302
|
* @summary List embedded databases
|
|
1303
1303
|
* @param {string} environmentName Name of the environment
|
|
1304
1304
|
* @param {string} packageName Name of the package
|
|
@@ -1313,7 +1313,7 @@ const be = function(l) {
|
|
|
1313
1313
|
};
|
|
1314
1314
|
class ve extends I {
|
|
1315
1315
|
/**
|
|
1316
|
-
* Retrieves a list of all embedded databases within the specified package. These are typically DuckDB
|
|
1316
|
+
* Retrieves a list of all embedded databases within the specified package. These are typically local data files read by DuckDB in place (.parquet, .csv, and .xlsx) that provide local data storage for the package. Each database entry includes metadata about the database structure and content.
|
|
1317
1317
|
* @summary List embedded databases
|
|
1318
1318
|
* @param {string} environmentName Name of the environment
|
|
1319
1319
|
* @param {string} packageName Name of the package
|
package/dist/client/api.d.ts
CHANGED
|
@@ -223,6 +223,12 @@ export interface BuildInstruction {
|
|
|
223
223
|
* @memberof BuildInstruction
|
|
224
224
|
*/
|
|
225
225
|
'realization': Realization;
|
|
226
|
+
/**
|
|
227
|
+
* Optional name of a registered DuckDB/DuckLake connection to materialize INTO (the `storage=` authoring axis). Absent means build into the persist source\'s own warehouse — the default, unchanged (colocated) path. When present, the build runs a native per-engine query-passthrough CTAS on a build-scoped session for this connection (the source computes; only results cross), and the manifest records the destination connection + captured schema so the source can later be served cross-dialect from the destination. The name resolves generically against registered connections; any managed-tier alias is resolved by the host upstream and never reaches the publisher.
|
|
228
|
+
* @type {string}
|
|
229
|
+
* @memberof BuildInstruction
|
|
230
|
+
*/
|
|
231
|
+
'destination'?: string;
|
|
226
232
|
}
|
|
227
233
|
/**
|
|
228
234
|
* Build input. Per-source instructions assigned by the caller.
|
|
@@ -784,6 +790,12 @@ export interface Database {
|
|
|
784
790
|
* @memberof Database
|
|
785
791
|
*/
|
|
786
792
|
'type'?: DatabaseTypeEnum;
|
|
793
|
+
/**
|
|
794
|
+
* Error message if the data file could not be read. When set, `info` is absent: the file is listed so the failure is visible, but its schema and row count could not be probed.
|
|
795
|
+
* @type {string}
|
|
796
|
+
* @memberof Database
|
|
797
|
+
*/
|
|
798
|
+
'error'?: string;
|
|
787
799
|
}
|
|
788
800
|
export declare const DatabaseTypeEnum: {
|
|
789
801
|
readonly Embedded: "embedded";
|
|
@@ -1197,11 +1209,23 @@ export interface ManifestEntry {
|
|
|
1197
1209
|
*/
|
|
1198
1210
|
'physicalTableName': string;
|
|
1199
1211
|
/**
|
|
1200
|
-
*
|
|
1212
|
+
* The persist source\'s own connection (the source warehouse). For a `storage=`-materialized entry this is where the data is READ FROM; the physical table lives in `storageConnectionName`.
|
|
1201
1213
|
* @type {string}
|
|
1202
1214
|
* @memberof ManifestEntry
|
|
1203
1215
|
*/
|
|
1204
1216
|
'connectionName'?: string;
|
|
1217
|
+
/**
|
|
1218
|
+
* When the source was materialized into a `storage=` destination, the name of the registered DuckDB/DuckLake connection the physical table physically lives in (distinct from `connectionName`, the source warehouse). Absent for the default in-warehouse path, where the table lives in `connectionName`. The serve path resolves and reads the table on this connection.
|
|
1219
|
+
* @type {string}
|
|
1220
|
+
* @memberof ManifestEntry
|
|
1221
|
+
*/
|
|
1222
|
+
'storageConnectionName'?: string;
|
|
1223
|
+
/**
|
|
1224
|
+
* The authoritative column schema of the materialized table, captured from the destination engine AFTER the build (a `DESCRIBE` of the landed table), for `storage=` entries only. The serve-time virtual-source transform declares exactly this schema — the compiler does not type-check a virtual source\'s declared columns, so a wrong or pre-build-approximated schema would surface as a serve-time execution error, which is why the post-build capture is authoritative.
|
|
1225
|
+
* @type {Array<Column>}
|
|
1226
|
+
* @memberof ManifestEntry
|
|
1227
|
+
*/
|
|
1228
|
+
'schema'?: Array<Column>;
|
|
1205
1229
|
/**
|
|
1206
1230
|
*
|
|
1207
1231
|
* @type {Realization}
|
|
@@ -1649,6 +1673,12 @@ export interface Package {
|
|
|
1649
1673
|
* @memberof Package
|
|
1650
1674
|
*/
|
|
1651
1675
|
'boundManifestUri'?: string | null;
|
|
1676
|
+
/**
|
|
1677
|
+
* Server-computed, read-only: sources currently bound to serve from a `storage=` destination via the virtual-source transform (distinct from the same-connection manifest binding above — a storage source is read cross-connection from its destination, not substituted in the manifest). Present only when at least one source is bound. Whether a query actually routes to these tables additionally depends on `PERSIST_STORAGE_MODE=on`; under `off`/`write-only` the bindings may be present but the serve path still runs live (see `warnings`).
|
|
1678
|
+
* @type {Array<PackageStorageServeBindingsInner>}
|
|
1679
|
+
* @memberof Package
|
|
1680
|
+
*/
|
|
1681
|
+
'storageServeBindings'?: Array<PackageStorageServeBindingsInner>;
|
|
1652
1682
|
/**
|
|
1653
1683
|
*
|
|
1654
1684
|
* @type {BuildPlan}
|
|
@@ -1691,6 +1721,31 @@ export interface PackageMaterializationConfig {
|
|
|
1691
1721
|
*/
|
|
1692
1722
|
'freshness'?: Freshness | null;
|
|
1693
1723
|
}
|
|
1724
|
+
/**
|
|
1725
|
+
*
|
|
1726
|
+
* @export
|
|
1727
|
+
* @interface PackageStorageServeBindingsInner
|
|
1728
|
+
*/
|
|
1729
|
+
export interface PackageStorageServeBindingsInner {
|
|
1730
|
+
/**
|
|
1731
|
+
* The materialized source served from storage.
|
|
1732
|
+
* @type {string}
|
|
1733
|
+
* @memberof PackageStorageServeBindingsInner
|
|
1734
|
+
*/
|
|
1735
|
+
'sourceName'?: string;
|
|
1736
|
+
/**
|
|
1737
|
+
* The registered DuckDB/DuckLake connection the physical table lives in.
|
|
1738
|
+
* @type {string}
|
|
1739
|
+
* @memberof PackageStorageServeBindingsInner
|
|
1740
|
+
*/
|
|
1741
|
+
'storageConnectionName'?: string;
|
|
1742
|
+
/**
|
|
1743
|
+
* The physical table the source is served from.
|
|
1744
|
+
* @type {string}
|
|
1745
|
+
* @memberof PackageStorageServeBindingsInner
|
|
1746
|
+
*/
|
|
1747
|
+
'tablePath'?: string;
|
|
1748
|
+
}
|
|
1694
1749
|
/**
|
|
1695
1750
|
*
|
|
1696
1751
|
* @export
|
|
@@ -3750,7 +3805,7 @@ export declare class ConnectionsTestApi extends BaseAPI {
|
|
|
3750
3805
|
*/
|
|
3751
3806
|
export declare const DatabasesApiAxiosParamCreator: (configuration?: Configuration) => {
|
|
3752
3807
|
/**
|
|
3753
|
-
* Retrieves a list of all embedded databases within the specified package. These are typically DuckDB
|
|
3808
|
+
* Retrieves a list of all embedded databases within the specified package. These are typically local data files read by DuckDB in place (.parquet, .csv, and .xlsx) that provide local data storage for the package. Each database entry includes metadata about the database structure and content.
|
|
3754
3809
|
* @summary List embedded databases
|
|
3755
3810
|
* @param {string} environmentName Name of the environment
|
|
3756
3811
|
* @param {string} packageName Name of the package
|
|
@@ -3766,7 +3821,7 @@ export declare const DatabasesApiAxiosParamCreator: (configuration?: Configurati
|
|
|
3766
3821
|
*/
|
|
3767
3822
|
export declare const DatabasesApiFp: (configuration?: Configuration) => {
|
|
3768
3823
|
/**
|
|
3769
|
-
* Retrieves a list of all embedded databases within the specified package. These are typically DuckDB
|
|
3824
|
+
* Retrieves a list of all embedded databases within the specified package. These are typically local data files read by DuckDB in place (.parquet, .csv, and .xlsx) that provide local data storage for the package. Each database entry includes metadata about the database structure and content.
|
|
3770
3825
|
* @summary List embedded databases
|
|
3771
3826
|
* @param {string} environmentName Name of the environment
|
|
3772
3827
|
* @param {string} packageName Name of the package
|
|
@@ -3782,7 +3837,7 @@ export declare const DatabasesApiFp: (configuration?: Configuration) => {
|
|
|
3782
3837
|
*/
|
|
3783
3838
|
export declare const DatabasesApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
|
|
3784
3839
|
/**
|
|
3785
|
-
* Retrieves a list of all embedded databases within the specified package. These are typically DuckDB
|
|
3840
|
+
* Retrieves a list of all embedded databases within the specified package. These are typically local data files read by DuckDB in place (.parquet, .csv, and .xlsx) that provide local data storage for the package. Each database entry includes metadata about the database structure and content.
|
|
3786
3841
|
* @summary List embedded databases
|
|
3787
3842
|
* @param {string} environmentName Name of the environment
|
|
3788
3843
|
* @param {string} packageName Name of the package
|
|
@@ -3800,7 +3855,7 @@ export declare const DatabasesApiFactory: (configuration?: Configuration, basePa
|
|
|
3800
3855
|
*/
|
|
3801
3856
|
export declare class DatabasesApi extends BaseAPI {
|
|
3802
3857
|
/**
|
|
3803
|
-
* Retrieves a list of all embedded databases within the specified package. These are typically DuckDB
|
|
3858
|
+
* Retrieves a list of all embedded databases within the specified package. These are typically local data files read by DuckDB in place (.parquet, .csv, and .xlsx) that provide local data storage for the package. Each database entry includes metadata about the database structure and content.
|
|
3804
3859
|
* @summary List embedded databases
|
|
3805
3860
|
* @param {string} environmentName Name of the environment
|
|
3806
3861
|
* @param {string} packageName Name of the package
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Malloy Publisher - Semantic Model Serving API
|
|
3
|
-
* The Malloy Publisher - Semantic Model Serving API provides comprehensive access to Malloy packages and their associated resources. A Malloy package is a directory containing Malloy models (.malloy files), Malloy notebooks (.malloynb files), and embedded databases (.parquet files) with a malloy-publisher.json manifest at the package\'s root directory. ## Key Features - **Environment Management**: Create and manage environments with their associated packages and connections - **Package Lifecycle**: Full CRUD operations for Malloy packages and their versions - **Model & Notebook Access**: Retrieve and execute Malloy models and notebooks - **Connection Management**: Secure database connection configuration and testing - **Query Execution**: Execute queries against models and retrieve results - **Watch Mode**: Real-time file watching for development workflows ## Resource Hierarchy The API follows a hierarchical resource structure: ``` Environments ├── Connections └── Packages ├── Models ├── Notebooks └── Databases ``` For examples, see the Malloy samples packages (https://github.com/malloydata/malloy-samples) repository.
|
|
3
|
+
* The Malloy Publisher - Semantic Model Serving API provides comprehensive access to Malloy packages and their associated resources. A Malloy package is a directory containing Malloy models (.malloy files), Malloy notebooks (.malloynb files), and embedded databases (.parquet, .csv, and .xlsx files) with a malloy-publisher.json manifest at the package\'s root directory. ## Key Features - **Environment Management**: Create and manage environments with their associated packages and connections - **Package Lifecycle**: Full CRUD operations for Malloy packages and their versions - **Model & Notebook Access**: Retrieve and execute Malloy models and notebooks - **Connection Management**: Secure database connection configuration and testing - **Query Execution**: Execute queries against models and retrieve results - **Watch Mode**: Real-time file watching for development workflows ## Resource Hierarchy The API follows a hierarchical resource structure: ``` Environments ├── Connections └── Packages ├── Models ├── Notebooks └── Databases ``` For examples, see the Malloy samples packages (https://github.com/malloydata/malloy-samples) repository.
|
|
4
4
|
*
|
|
5
5
|
* The version of the OpenAPI document: v0
|
|
6
6
|
*
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Malloy Publisher - Semantic Model Serving API
|
|
3
|
-
* The Malloy Publisher - Semantic Model Serving API provides comprehensive access to Malloy packages and their associated resources. A Malloy package is a directory containing Malloy models (.malloy files), Malloy notebooks (.malloynb files), and embedded databases (.parquet files) with a malloy-publisher.json manifest at the package\'s root directory. ## Key Features - **Environment Management**: Create and manage environments with their associated packages and connections - **Package Lifecycle**: Full CRUD operations for Malloy packages and their versions - **Model & Notebook Access**: Retrieve and execute Malloy models and notebooks - **Connection Management**: Secure database connection configuration and testing - **Query Execution**: Execute queries against models and retrieve results - **Watch Mode**: Real-time file watching for development workflows ## Resource Hierarchy The API follows a hierarchical resource structure: ``` Environments ├── Connections └── Packages ├── Models ├── Notebooks └── Databases ``` For examples, see the Malloy samples packages (https://github.com/malloydata/malloy-samples) repository.
|
|
3
|
+
* The Malloy Publisher - Semantic Model Serving API provides comprehensive access to Malloy packages and their associated resources. A Malloy package is a directory containing Malloy models (.malloy files), Malloy notebooks (.malloynb files), and embedded databases (.parquet, .csv, and .xlsx files) with a malloy-publisher.json manifest at the package\'s root directory. ## Key Features - **Environment Management**: Create and manage environments with their associated packages and connections - **Package Lifecycle**: Full CRUD operations for Malloy packages and their versions - **Model & Notebook Access**: Retrieve and execute Malloy models and notebooks - **Connection Management**: Secure database connection configuration and testing - **Query Execution**: Execute queries against models and retrieve results - **Watch Mode**: Real-time file watching for development workflows ## Resource Hierarchy The API follows a hierarchical resource structure: ``` Environments ├── Connections └── Packages ├── Models ├── Notebooks └── Databases ``` For examples, see the Malloy samples packages (https://github.com/malloydata/malloy-samples) repository.
|
|
4
4
|
*
|
|
5
5
|
* The version of the OpenAPI document: v0
|
|
6
6
|
*
|
package/dist/client/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as e, a as o, C as i, b as t, aj as n, d as r, e as p, c as A, s as c, p as m, r as u, q as l, x as P, t as C, w as E, v as F, D as y, E as b, y as g, B as M, z as k, J as S, G as d, I as h, H as x, a2 as T, F as v, f as z, L as D, M as N, V as f, h as W, U as R, K as B, Q, O as j, Z as I, W as L, Y as O, X as q, i as w, N as G, a1 as H, _ as J, a0 as K, $ as U, k as V, j as X, P as Y, l as Z, a6 as _, a3 as $, a5 as aa, a4 as sa, m as ea, aa as oa, a7 as ia, a9 as ta, a8 as na, n as ra, ae as pa, ab as Aa, ad as ca, ac as ma, R as ua, S as la, o as Pa, T as Ca, ai as Ea, af as Fa, ah as ya, ag as ba, g as ga, u as Ma } from "../ServerProvider-
|
|
1
|
+
import { A as e, a as o, C as i, b as t, aj as n, d as r, e as p, c as A, s as c, p as m, r as u, q as l, x as P, t as C, w as E, v as F, D as y, E as b, y as g, B as M, z as k, J as S, G as d, I as h, H as x, a2 as T, F as v, f as z, L as D, M as N, V as f, h as W, U as R, K as B, Q, O as j, Z as I, W as L, Y as O, X as q, i as w, N as G, a1 as H, _ as J, a0 as K, $ as U, k as V, j as X, P as Y, l as Z, a6 as _, a3 as $, a5 as aa, a4 as sa, m as ea, aa as oa, a7 as ia, a9 as ta, a8 as na, n as ra, ae as pa, ab as Aa, ad as ca, ac as ma, R as ua, S as la, o as Pa, T as Ca, ai as Ea, af as Fa, ah as ya, ag as ba, g as ga, u as Ma } from "../ServerProvider-DMk_BDrm.es.js";
|
|
2
2
|
export {
|
|
3
3
|
e as AttachedDatabaseTypeEnum,
|
|
4
4
|
o as AzureConnectionAuthTypeEnum,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createOnigurumaEngine as vt, getDefaultWasmLoader as Pr, loadWasm as Or } from "./engine-oniguruma-C4vnmooL.es.js";
|
|
2
|
-
import { w as At, s as wn, f as Mr, a as Fr, b as Br, c as Dt, z as jr, h as Dr, d as Ur } from "./index-
|
|
2
|
+
import { w as At, s as wn, f as Mr, a as Fr, b as Br, c as Dt, z as jr, h as Dr, d as Ur } from "./index-3Ctefu0u.es.js";
|
|
3
3
|
let V = class extends Error {
|
|
4
4
|
constructor(e) {
|
|
5
5
|
super(e), this.name = "ShikiError";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const me=require("./engine-oniguruma-BkproSVE.cjs.js"),P=require("./index-ClhlT2co.cjs.js");let q=class extends Error{constructor(e){super(e),this.name="ShikiError"}},$e=!1,In=!1;function zr(t=!0,e=!1){$e=t,In=e}function B(t,e=3){if($e&&!(typeof $e=="number"&&e>$e)){if(In)throw new Error(`[SHIKI DEPRECATE]: ${t}`);console.trace(`[SHIKI DEPRECATE]: ${t}`)}}function Vr(t){return Tt(t)}function Tt(t){return Array.isArray(t)?Kr(t):t instanceof RegExp?t:typeof t=="object"?Qr(t):t}function Kr(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=Tt(t[n]);return e}function Qr(t){let e={};for(let n in t)e[n]=Tt(t[n]);return e}function Nn(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function xn(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?xn(t.substring(0,t.length-1)):t.substr(~e+1)}var st=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Re=class{static hasCaptures(t){return t===null?!1:(st.lastIndex=0,st.test(t))}static replaceCaptures(t,e,n){return t.replace(st,(r,s,a,i)=>{let o=n[parseInt(s||a,10)];if(o){let c=e.substring(o.start,o.end);for(;c[0]===".";)c=c.substring(1);switch(i){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function Tn(t,e){return t<e?-1:t>e?1:0}function $n(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let a=Tn(t[s],e[s]);if(a!==0)return a}return 0}return n-r}function Qt(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function Gn(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Ln=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},Oe=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Zr(t),e)}static createFromParsedTheme(t,e){return es(t,e)}_cachedMatchRoot=new Ln(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,r=this._cachedMatchRoot.get(e).find(s=>Jr(t.parent,s.parentScopes));return r?new Pn(r.fontStyle,r.foreground,r.background):null}},at=class Ge{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new Ge(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new Ge(n,e[r]);return n}push(e){return new Ge(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function Jr(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}for(;t&&!Xr(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Xr(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var Pn=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Zr(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let s=0,a=e.length;s<a;s++){let i=e[s];if(!i.settings)continue;let o;if(typeof i.scope=="string"){let h=i.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),o=h.split(",")}else Array.isArray(i.scope)?o=i.scope:o=[""];let c=-1;if(typeof i.settings.fontStyle=="string"){c=0;let h=i.settings.fontStyle.split(" ");for(let g=0,f=h.length;g<f;g++)switch(h[g]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let l=null;typeof i.settings.foreground=="string"&&Qt(i.settings.foreground)&&(l=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Qt(i.settings.background)&&(u=i.settings.background);for(let h=0,g=o.length;h<g;h++){let p=o[h].trim().split(" "),b=p[p.length-1],m=null;p.length>1&&(m=p.slice(0,p.length-1),m.reverse()),n[r++]=new Yr(b,m,s,c,l,u)}}return n}var Yr=class{constructor(t,e,n,r,s,a){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=a}},H=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(H||{});function es(t,e){t.sort((c,l)=>{let u=Tn(c.scope,l.scope);return u!==0||(u=$n(c.parentScopes,l.parentScopes),u!==0)?u:c.index-l.index});let n=0,r="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let c=t.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(s=c.background)}let a=new ts(e),i=new Pn(n,a.getId(r),a.getId(s)),o=new rs(new Ct(0,null,-1,0,0),[]);for(let c=0,l=t.length;c<l;c++){let u=t[c];o.insert(0,u.scope,u.parentScopes,u.fontStyle,a.getId(u.foreground),a.getId(u.background))}return new Oe(a,i,o)}var ts=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},ns=Object.freeze([]),Ct=class On{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,a){this.scopeDepth=e,this.parentScopes=n||ns,this.fontStyle=r,this.foreground=s,this.background=a}clone(){return new On(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},rs=class _t{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=n.parentScopes.length);){const a=n.parentScopes[s].length-e.parentScopes[r].length;if(a!==0)return a;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,a;if(r===-1?(s=e,a=""):(s=e.substring(0,r),a=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(a)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(_t._cmpBySpecificity),n}insert(e,n,r,s,a,i){if(n===""){this._doInsertHere(e,r,s,a,i);return}let o=n.indexOf("."),c,l;o===-1?(c=n,l=""):(c=n.substring(0,o),l=n.substring(o+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new _t(this._mainRule.clone(),Ct.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(e+1,l,r,s,a,i)}_doInsertHere(e,n,r,s,a){if(n===null){this._mainRule.acceptOverwrite(e,r,s,a);return}for(let i=0,o=this._rulesWithParentScopes.length;i<o;i++){let c=this._rulesWithParentScopes[i];if($n(c.parentScopes,n)===0){c.acceptOverwrite(e,r,s,a);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),a===0&&(a=this._mainRule.background),this._rulesWithParentScopes.push(new Ct(e,n,r,s,a))}},ne=class M{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=M.getLanguageId(e),r=M.getTokenType(e),s=M.getFontStyle(e),a=M.getForeground(e),i=M.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:a,background:i})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,s,a,i,o){let c=M.getLanguageId(e),l=M.getTokenType(e),u=M.containsBalancedBrackets(e)?1:0,h=M.getFontStyle(e),g=M.getForeground(e),f=M.getBackground(e);return n!==0&&(c=n),r!==8&&(l=r),s!==null&&(u=s?1:0),a!==-1&&(h=a),i!==0&&(g=i),o!==0&&(f=o),(c<<0|l<<8|u<<10|h<<11|g<<15|f<<24)>>>0}};function Me(t,e){const n=[],r=ss(t);let s=r.next();for(;s!==null;){let c=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=i();if(n.push({matcher:l,priority:c}),s!==",")break;s=r.next()}return n;function a(){if(s==="-"){s=r.next();const c=a();return l=>!!c&&!c(l)}if(s==="("){s=r.next();const c=o();return s===")"&&(s=r.next()),c}if(Jt(s)){const c=[];do c.push(s),s=r.next();while(Jt(s));return l=>e(c,l)}return null}function i(){const c=[];let l=a();for(;l;)c.push(l),l=a();return u=>c.every(h=>h(u))}function o(){const c=[];let l=i();for(;l&&(c.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=i()}return u=>c.some(h=>h(u))}}function Jt(t){return!!t&&!!t.match(/[\w\.:]+/)}function ss(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function Mn(t){typeof t.dispose=="function"&&t.dispose()}var Ce=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},as=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},is=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},os=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ce(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new is;for(const n of t)cs(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Ce){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function cs(t,e,n,r){const s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const a=n.lookup(e);t instanceof Ce?Le({baseGrammar:a,selfGrammar:s},r):yt(t.ruleName,{baseGrammar:a,selfGrammar:s,repository:s.repository},r);const i=n.injections(t.scopeName);if(i)for(const o of i)r.add(new Ce(o))}function yt(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];Fe([r],e,n)}}function Le(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&Fe(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&Fe(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Fe(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Nn({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&Fe(r.patterns,{...e,repository:s},n);const a=r.include;if(!a)continue;const i=Fn(a);switch(i.kind){case 0:Le({...e,selfGrammar:e.baseGrammar},n);break;case 1:Le(e,n);break;case 2:yt(i.ruleName,{...e,repository:s},n);break;case 3:case 4:const o=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(o){const c={baseGrammar:e.baseGrammar,selfGrammar:o,repository:s};i.kind===4?yt(i.ruleName,c,n):Le(c,n)}else i.kind===4?n.add(new as(i.scopeName,i.ruleName)):n.add(new Ce(i.scopeName));break}}}var ls=class{kind=0},us=class{kind=1},hs=class{constructor(t){this.ruleName=t}kind=2},fs=class{constructor(t){this.scopeName=t}kind=3},ps=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function Fn(t){if(t==="$base")return new ls;if(t==="$self")return new us;const e=t.indexOf("#");if(e===-1)return new fs(t);if(e===0)return new hs(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new ps(n,r)}}var gs=/\\(\d+)/,Xt=/\\(\d+)/g,ds=-1,Bn=-2;var ke=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=Re.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Re.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${xn(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:Re.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Re.replaceCaptures(this._contentName,t,e)}},ms=class extends ke{retokenizeCapturedWithRuleId;constructor(t,e,n,r,s){super(t,e,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,r){throw new Error("Not supported!")}},Cs=class extends ke{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null),this._match=new _e(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ye,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Zt=class extends ke{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ye,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},bt=class extends ke{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,a,i,o,c,l){super(t,e,n,r),this._begin=new _e(s,this.id),this.beginCaptures=a,this._end=new _e(i||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=o,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ye;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},Be=class extends ke{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,a,i,o,c){super(t,e,n,r),this._begin=new _e(s,this.id),this.beginCaptures=a,this.whileCaptures=o,this._while=new _e(i,Bn),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ye;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new ye,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||""),this._cachedCompiledWhilePatterns}},jn=class T{static createCaptureRule(e,n,r,s,a){return e.registerRule(i=>new ms(n,i,r,s,a))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new Cs(e.$vscodeTextmateLocation,e.id,e.name,e.match,T._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=Nn({},r,e.repository));let a=e.patterns;return typeof a>"u"&&e.include&&(a=[{include:e.include}]),new Zt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,T._compilePatterns(a,n,r))}return e.while?new Be(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,T._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,T._compileCaptures(e.whileCaptures||e.captures,n,r),T._compilePatterns(e.patterns,n,r)):new bt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,T._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,T._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,T._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let a=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const o=parseInt(i,10);o>a&&(a=o)}for(let i=0;i<=a;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const o=parseInt(i,10);let c=0;e[i].patterns&&(c=T.getCompiledRuleId(e[i],n,r)),s[o]=T.createCaptureRule(n,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,c)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let a=0,i=e.length;a<i;a++){const o=e[a];let c=-1;if(o.include){const l=Fn(o.include);switch(l.kind){case 0:case 1:c=T.getCompiledRuleId(r[o.include],n,r);break;case 2:let u=r[l.ruleName];u&&(c=T.getCompiledRuleId(u,n,r));break;case 3:case 4:const h=l.scopeName,g=l.kind===4?l.ruleName:null,f=n.getExternalGrammar(h,r);if(f)if(g){let p=f.repository[g];p&&(c=T.getCompiledRuleId(p,n,f.repository))}else c=T.getCompiledRuleId(f.repository.$self,n,f.repository);break}}else c=T.getCompiledRuleId(o,n,r);if(c!==-1){const l=n.getRule(c);let u=!1;if((l instanceof Zt||l instanceof bt||l instanceof Be)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},_e=class Dn{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const r=e.length;let s=0,a=[],i=!1;for(let o=0;o<r;o++)if(e.charAt(o)==="\\"&&o+1<r){const l=e.charAt(o+1);l==="z"?(a.push(e.substring(s,o)),a.push("$(?!\\n)(?<!\\n)"),s=o+2):(l==="A"||l==="G")&&(i=!0),o++}this.hasAnchor=i,s===0?this.source=e:(a.push(e.substring(s,r)),this.source=a.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=gs.test(this.source):this.hasBackReferences=!1}clone(){return new Dn(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>e.substring(s.start,s.end));return Xt.lastIndex=0,this.source.replace(Xt,(s,a)=>Gn(r[parseInt(a,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],r=[],s=[],a,i,o,c;for(a=0,i=this.source.length;a<i;a++)o=this.source.charAt(a),e[a]=o,n[a]=o,r[a]=o,s[a]=o,o==="\\"&&a+1<i&&(c=this.source.charAt(a+1),c==="A"?(e[a+1]="",n[a+1]="",r[a+1]="A",s[a+1]="A"):c==="G"?(e[a+1]="",n[a+1]="G",r[a+1]="",s[a+1]="G"):(e[a+1]=c,n[a+1]=c,r[a+1]=c,s[a+1]=c),a++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},ye=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new Yt(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let r=this._items.map(s=>s.resolveAnchors(e,n));return new Yt(t,r,this._items.map(s=>s.ruleId))}},Yt=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const me=require("./engine-oniguruma-BkproSVE.cjs.js"),P=require("./index-D0RRMPyp.cjs.js");let q=class extends Error{constructor(e){super(e),this.name="ShikiError"}},$e=!1,In=!1;function zr(t=!0,e=!1){$e=t,In=e}function B(t,e=3){if($e&&!(typeof $e=="number"&&e>$e)){if(In)throw new Error(`[SHIKI DEPRECATE]: ${t}`);console.trace(`[SHIKI DEPRECATE]: ${t}`)}}function Vr(t){return Tt(t)}function Tt(t){return Array.isArray(t)?Kr(t):t instanceof RegExp?t:typeof t=="object"?Qr(t):t}function Kr(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=Tt(t[n]);return e}function Qr(t){let e={};for(let n in t)e[n]=Tt(t[n]);return e}function Nn(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function xn(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?xn(t.substring(0,t.length-1)):t.substr(~e+1)}var st=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Re=class{static hasCaptures(t){return t===null?!1:(st.lastIndex=0,st.test(t))}static replaceCaptures(t,e,n){return t.replace(st,(r,s,a,i)=>{let o=n[parseInt(s||a,10)];if(o){let c=e.substring(o.start,o.end);for(;c[0]===".";)c=c.substring(1);switch(i){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function Tn(t,e){return t<e?-1:t>e?1:0}function $n(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let a=Tn(t[s],e[s]);if(a!==0)return a}return 0}return n-r}function Qt(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function Gn(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Ln=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},Oe=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Zr(t),e)}static createFromParsedTheme(t,e){return es(t,e)}_cachedMatchRoot=new Ln(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,r=this._cachedMatchRoot.get(e).find(s=>Jr(t.parent,s.parentScopes));return r?new Pn(r.fontStyle,r.foreground,r.background):null}},at=class Ge{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new Ge(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new Ge(n,e[r]);return n}push(e){return new Ge(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function Jr(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}for(;t&&!Xr(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Xr(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var Pn=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Zr(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let s=0,a=e.length;s<a;s++){let i=e[s];if(!i.settings)continue;let o;if(typeof i.scope=="string"){let h=i.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),o=h.split(",")}else Array.isArray(i.scope)?o=i.scope:o=[""];let c=-1;if(typeof i.settings.fontStyle=="string"){c=0;let h=i.settings.fontStyle.split(" ");for(let g=0,f=h.length;g<f;g++)switch(h[g]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let l=null;typeof i.settings.foreground=="string"&&Qt(i.settings.foreground)&&(l=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Qt(i.settings.background)&&(u=i.settings.background);for(let h=0,g=o.length;h<g;h++){let p=o[h].trim().split(" "),b=p[p.length-1],m=null;p.length>1&&(m=p.slice(0,p.length-1),m.reverse()),n[r++]=new Yr(b,m,s,c,l,u)}}return n}var Yr=class{constructor(t,e,n,r,s,a){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=a}},H=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(H||{});function es(t,e){t.sort((c,l)=>{let u=Tn(c.scope,l.scope);return u!==0||(u=$n(c.parentScopes,l.parentScopes),u!==0)?u:c.index-l.index});let n=0,r="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let c=t.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(s=c.background)}let a=new ts(e),i=new Pn(n,a.getId(r),a.getId(s)),o=new rs(new Ct(0,null,-1,0,0),[]);for(let c=0,l=t.length;c<l;c++){let u=t[c];o.insert(0,u.scope,u.parentScopes,u.fontStyle,a.getId(u.foreground),a.getId(u.background))}return new Oe(a,i,o)}var ts=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},ns=Object.freeze([]),Ct=class On{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,a){this.scopeDepth=e,this.parentScopes=n||ns,this.fontStyle=r,this.foreground=s,this.background=a}clone(){return new On(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},rs=class _t{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=n.parentScopes.length);){const a=n.parentScopes[s].length-e.parentScopes[r].length;if(a!==0)return a;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,a;if(r===-1?(s=e,a=""):(s=e.substring(0,r),a=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(a)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(_t._cmpBySpecificity),n}insert(e,n,r,s,a,i){if(n===""){this._doInsertHere(e,r,s,a,i);return}let o=n.indexOf("."),c,l;o===-1?(c=n,l=""):(c=n.substring(0,o),l=n.substring(o+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new _t(this._mainRule.clone(),Ct.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(e+1,l,r,s,a,i)}_doInsertHere(e,n,r,s,a){if(n===null){this._mainRule.acceptOverwrite(e,r,s,a);return}for(let i=0,o=this._rulesWithParentScopes.length;i<o;i++){let c=this._rulesWithParentScopes[i];if($n(c.parentScopes,n)===0){c.acceptOverwrite(e,r,s,a);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),a===0&&(a=this._mainRule.background),this._rulesWithParentScopes.push(new Ct(e,n,r,s,a))}},ne=class M{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=M.getLanguageId(e),r=M.getTokenType(e),s=M.getFontStyle(e),a=M.getForeground(e),i=M.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:a,background:i})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,s,a,i,o){let c=M.getLanguageId(e),l=M.getTokenType(e),u=M.containsBalancedBrackets(e)?1:0,h=M.getFontStyle(e),g=M.getForeground(e),f=M.getBackground(e);return n!==0&&(c=n),r!==8&&(l=r),s!==null&&(u=s?1:0),a!==-1&&(h=a),i!==0&&(g=i),o!==0&&(f=o),(c<<0|l<<8|u<<10|h<<11|g<<15|f<<24)>>>0}};function Me(t,e){const n=[],r=ss(t);let s=r.next();for(;s!==null;){let c=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=i();if(n.push({matcher:l,priority:c}),s!==",")break;s=r.next()}return n;function a(){if(s==="-"){s=r.next();const c=a();return l=>!!c&&!c(l)}if(s==="("){s=r.next();const c=o();return s===")"&&(s=r.next()),c}if(Jt(s)){const c=[];do c.push(s),s=r.next();while(Jt(s));return l=>e(c,l)}return null}function i(){const c=[];let l=a();for(;l;)c.push(l),l=a();return u=>c.every(h=>h(u))}function o(){const c=[];let l=i();for(;l&&(c.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=i()}return u=>c.some(h=>h(u))}}function Jt(t){return!!t&&!!t.match(/[\w\.:]+/)}function ss(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function Mn(t){typeof t.dispose=="function"&&t.dispose()}var Ce=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},as=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},is=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},os=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ce(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new is;for(const n of t)cs(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Ce){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function cs(t,e,n,r){const s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const a=n.lookup(e);t instanceof Ce?Le({baseGrammar:a,selfGrammar:s},r):yt(t.ruleName,{baseGrammar:a,selfGrammar:s,repository:s.repository},r);const i=n.injections(t.scopeName);if(i)for(const o of i)r.add(new Ce(o))}function yt(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];Fe([r],e,n)}}function Le(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&Fe(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&Fe(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Fe(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Nn({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&Fe(r.patterns,{...e,repository:s},n);const a=r.include;if(!a)continue;const i=Fn(a);switch(i.kind){case 0:Le({...e,selfGrammar:e.baseGrammar},n);break;case 1:Le(e,n);break;case 2:yt(i.ruleName,{...e,repository:s},n);break;case 3:case 4:const o=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(o){const c={baseGrammar:e.baseGrammar,selfGrammar:o,repository:s};i.kind===4?yt(i.ruleName,c,n):Le(c,n)}else i.kind===4?n.add(new as(i.scopeName,i.ruleName)):n.add(new Ce(i.scopeName));break}}}var ls=class{kind=0},us=class{kind=1},hs=class{constructor(t){this.ruleName=t}kind=2},fs=class{constructor(t){this.scopeName=t}kind=3},ps=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function Fn(t){if(t==="$base")return new ls;if(t==="$self")return new us;const e=t.indexOf("#");if(e===-1)return new fs(t);if(e===0)return new hs(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new ps(n,r)}}var gs=/\\(\d+)/,Xt=/\\(\d+)/g,ds=-1,Bn=-2;var ke=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=Re.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Re.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${xn(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:Re.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Re.replaceCaptures(this._contentName,t,e)}},ms=class extends ke{retokenizeCapturedWithRuleId;constructor(t,e,n,r,s){super(t,e,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,r){throw new Error("Not supported!")}},Cs=class extends ke{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null),this._match=new _e(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ye,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Zt=class extends ke{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ye,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},bt=class extends ke{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,a,i,o,c,l){super(t,e,n,r),this._begin=new _e(s,this.id),this.beginCaptures=a,this._end=new _e(i||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=o,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ye;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},Be=class extends ke{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,a,i,o,c){super(t,e,n,r),this._begin=new _e(s,this.id),this.beginCaptures=a,this.whileCaptures=o,this._while=new _e(i,Bn),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ye;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new ye,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||""),this._cachedCompiledWhilePatterns}},jn=class T{static createCaptureRule(e,n,r,s,a){return e.registerRule(i=>new ms(n,i,r,s,a))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new Cs(e.$vscodeTextmateLocation,e.id,e.name,e.match,T._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=Nn({},r,e.repository));let a=e.patterns;return typeof a>"u"&&e.include&&(a=[{include:e.include}]),new Zt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,T._compilePatterns(a,n,r))}return e.while?new Be(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,T._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,T._compileCaptures(e.whileCaptures||e.captures,n,r),T._compilePatterns(e.patterns,n,r)):new bt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,T._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,T._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,T._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let a=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const o=parseInt(i,10);o>a&&(a=o)}for(let i=0;i<=a;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const o=parseInt(i,10);let c=0;e[i].patterns&&(c=T.getCompiledRuleId(e[i],n,r)),s[o]=T.createCaptureRule(n,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,c)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let a=0,i=e.length;a<i;a++){const o=e[a];let c=-1;if(o.include){const l=Fn(o.include);switch(l.kind){case 0:case 1:c=T.getCompiledRuleId(r[o.include],n,r);break;case 2:let u=r[l.ruleName];u&&(c=T.getCompiledRuleId(u,n,r));break;case 3:case 4:const h=l.scopeName,g=l.kind===4?l.ruleName:null,f=n.getExternalGrammar(h,r);if(f)if(g){let p=f.repository[g];p&&(c=T.getCompiledRuleId(p,n,f.repository))}else c=T.getCompiledRuleId(f.repository.$self,n,f.repository);break}}else c=T.getCompiledRuleId(o,n,r);if(c!==-1){const l=n.getRule(c);let u=!1;if((l instanceof Zt||l instanceof bt||l instanceof Be)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},_e=class Dn{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const r=e.length;let s=0,a=[],i=!1;for(let o=0;o<r;o++)if(e.charAt(o)==="\\"&&o+1<r){const l=e.charAt(o+1);l==="z"?(a.push(e.substring(s,o)),a.push("$(?!\\n)(?<!\\n)"),s=o+2):(l==="A"||l==="G")&&(i=!0),o++}this.hasAnchor=i,s===0?this.source=e:(a.push(e.substring(s,r)),this.source=a.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=gs.test(this.source):this.hasBackReferences=!1}clone(){return new Dn(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>e.substring(s.start,s.end));return Xt.lastIndex=0,this.source.replace(Xt,(s,a)=>Gn(r[parseInt(a,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],r=[],s=[],a,i,o,c;for(a=0,i=this.source.length;a<i;a++)o=this.source.charAt(a),e[a]=o,n[a]=o,r[a]=o,s[a]=o,o==="\\"&&a+1<i&&(c=this.source.charAt(a+1),c==="A"?(e[a+1]="",n[a+1]="",r[a+1]="A",s[a+1]="A"):c==="G"?(e[a+1]="",n[a+1]="G",r[a+1]="",s[a+1]="G"):(e[a+1]=c,n[a+1]=c,r[a+1]=c,s[a+1]=c),a++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},ye=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new Yt(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let r=this._items.map(s=>s.resolveAnchors(e,n));return new Yt(t,r,this._items.map(s=>s.ruleId))}},Yt=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
2
2
|
`)}findNextMatchSync(t,e,n){const r=this.scanner.findNextMatchSync(t,e,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},it=class{constructor(t,e){this.languageId=t,this.tokenType=e}},_s=class wt{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new it(e,8),this._embeddedLanguagesMatcher=new ys(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?wt._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new it(0,0);_getBasicScopeAttributes=new Ln(e=>{const n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new it(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(wt.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},ys=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,r])=>Gn(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}};typeof process<"u"&&process.env.VSCODE_TEXTMATE_DEBUG;var en=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function Un(t,e,n,r,s,a,i,o){const c=e.content.length;let l=!1,u=-1;if(i){const f=bs(t,e,n,r,s,a);s=f.stack,r=f.linePos,n=f.isFirstLine,u=f.anchorPosition}const h=Date.now();for(;!l;){if(o!==0&&Date.now()-h>o)return new en(s,!0);g()}return new en(s,!1);function g(){const f=ws(t,e,n,r,s,u);if(!f){a.produce(s,c),l=!0;return}const p=f.captureIndices,b=f.matchedRuleId,m=p&&p.length>0?p[0].end>r:!1;if(b===ds){const w=s.getRule(t);a.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),pe(t,e,n,s,a,w.endCaptures,p),a.produce(s,p[0].end);const C=s;if(s=s.parent,u=C.getAnchorPos(),!m&&C.getEnterPos()===r){s=C,a.produce(s,c),l=!0;return}}else{const w=t.getRule(b);a.produce(s,p[0].start);const C=s,S=w.getName(e.content,p),N=s.contentNameScopesList.pushAttributed(S,t);if(s=s.push(b,r,u,p[0].end===c,null,N,N),w instanceof bt){const A=w;pe(t,e,n,s,a,A.beginCaptures,p),a.produce(s,p[0].end),u=p[0].end;const D=A.getContentName(e.content,p),L=N.pushAttributed(D,t);if(s=s.withContentNameScopesList(L),A.endHasBackReferences&&(s=s.withEndRule(A.getEndWithResolvedBackReferences(e.content,p))),!m&&C.hasSameRuleAs(s)){s=s.pop(),a.produce(s,c),l=!0;return}}else if(w instanceof Be){const A=w;pe(t,e,n,s,a,A.beginCaptures,p),a.produce(s,p[0].end),u=p[0].end;const D=A.getContentName(e.content,p),L=N.pushAttributed(D,t);if(s=s.withContentNameScopesList(L),A.whileHasBackReferences&&(s=s.withEndRule(A.getWhileWithResolvedBackReferences(e.content,p))),!m&&C.hasSameRuleAs(s)){s=s.pop(),a.produce(s,c),l=!0;return}}else if(pe(t,e,n,s,a,w.captures,p),a.produce(s,p[0].end),s=s.pop(),!m){s=s.safePop(),a.produce(s,c),l=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function bs(t,e,n,r,s,a){let i=s.beginRuleCapturedEOL?0:-1;const o=[];for(let c=s;c;c=c.pop()){const l=c.getRule(t);l instanceof Be&&o.push({rule:l,stack:c})}for(let c=o.pop();c;c=o.pop()){const{ruleScanner:l,findOptions:u}=vs(c.rule,t,c.stack.endRule,n,r===i),h=l.findNextMatchSync(e,r,u);if(h){if(h.ruleId!==Bn){s=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(a.produce(c.stack,h.captureIndices[0].start),pe(t,e,n,c.stack,a,c.rule.whileCaptures,h.captureIndices),a.produce(c.stack,h.captureIndices[0].end),i=h.captureIndices[0].end,h.captureIndices[0].end>r&&(r=h.captureIndices[0].end,n=!1))}else{s=c.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:i,isFirstLine:n}}function ws(t,e,n,r,s,a){const i=Ss(t,e,n,r,s,a),o=t.getInjections();if(o.length===0)return i;const c=ks(o,t,e,n,r,s,a);if(!c)return i;if(!i)return c;const l=i.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:i}function Ss(t,e,n,r,s,a){const i=s.getRule(t),{ruleScanner:o,findOptions:c}=Wn(i,t,s.endRule,n,r===a),l=o.findNextMatchSync(e,r,c);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function ks(t,e,n,r,s,a,i){let o=Number.MAX_VALUE,c=null,l,u=0;const h=a.contentNameScopesList.getScopeNames();for(let g=0,f=t.length;g<f;g++){const p=t[g];if(!p.matcher(h))continue;const b=e.getRule(p.ruleId),{ruleScanner:m,findOptions:w}=Wn(b,e,null,r,s===i),C=m.findNextMatchSync(n,s,w);if(!C)continue;const S=C.captureIndices[0].start;if(!(S>=o)&&(o=S,c=C.captureIndices,l=C.ruleId,u=p.priority,o===s))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Wn(t,e,n,r,s){return{ruleScanner:t.compileAG(e,n,r,s),findOptions:0}}function vs(t,e,n,r,s){return{ruleScanner:t.compileWhileAG(e,n,r,s),findOptions:0}}function pe(t,e,n,r,s,a,i){if(a.length===0)return;const o=e.content,c=Math.min(a.length,i.length),l=[],u=i[0].end;for(let h=0;h<c;h++){const g=a[h];if(g===null)continue;const f=i[h];if(f.length===0)continue;if(f.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=f.start;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?s.produceFromScopes(l[l.length-1].scopes,f.start):s.produce(r,f.start),g.retokenizeCapturedWithRuleId){const b=g.getName(o,i),m=r.contentNameScopesList.pushAttributed(b,t),w=g.getContentName(o,i),C=m.pushAttributed(w,t),S=r.push(g.retokenizeCapturedWithRuleId,f.start,-1,!1,null,m,C),N=t.createOnigString(o.substring(0,f.end));Un(t,N,n&&f.start===0,f.start,S,s,!1,0),Mn(N);continue}const p=g.getName(o,i);if(p!==null){const m=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(p,t);l.push(new As(m,f.end))}}for(;l.length>0;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var As=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function Es(t,e,n,r,s,a,i,o){return new Is(t,e,n,r,s,a,i,o)}function tn(t,e,n,r,s){const a=Me(e,je),i=jn.getCompiledRuleId(n,r,s.repository);for(const o of a)t.push({debugSelector:e,matcher:o.matcher,ruleId:i,grammar:s,priority:o.priority})}function je(t,e){if(e.length<t.length)return!1;let n=0;return t.every(r=>{for(let s=n;s<e.length;s++)if(Rs(e[s],r))return n=s+1,!0;return!1})}function Rs(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var Is=class{constructor(t,e,n,r,s,a,i,o){if(this._rootScopeName=t,this.balancedBracketSelectors=a,this._onigLib=o,this._basicScopeAttributesProvider=new _s(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=nn(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const c of Object.keys(s)){const l=Me(c,je);for(const u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[c]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],n=this._rootScopeName,r=t.lookup(n);if(r){const s=r.injections;if(s)for(let i in s)tn(e,i,s[i],this,r);const a=this._grammarRepository.injections(n);a&&a.forEach(i=>{const o=this.getExternalGrammar(i);if(o){const c=o.injectionSelector;c&&tn(e,c,o,this,o)}})}return e.sort((s,a)=>s.priority-a.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=nn(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){const r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){this._rootId===-1&&(this._rootId=jn.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===St.NULL){s=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=ne.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),g=this.getRule(this._rootId).getName(null,null);let f;g?f=ge.createRootAndLookUpScopeName(g,h,this):f=ge.createRoot("unknown",h),e=new St(null,this._rootId,-1,-1,!1,null,f,f)}else s=!1,e.reset();t=t+`
|
|
3
3
|
`;const a=this.createOnigString(t),i=a.content.length,o=new xs(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Un(this,a,s,0,e,o,!0,r);return Mn(a),{lineLength:i,lineTokens:o,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function nn(t,e){return t=Vr(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var ge=class U{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,s=e?.scopePath??null;for(const a of n)s=at.push(s,a.scopeNames),r=new U(r,s,a.encodedTokenAttributes);return r}static createRoot(e,n){return new U(null,new at(null,e),n)}static createRootAndLookUpScopeName(e,n,r){const s=r.getMetadataForScope(e),a=new at(null,e),i=r.themeProvider.themeMatch(a),o=U.mergeAttributes(n,s,i);return new U(null,a,o)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return U.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,r){let s=-1,a=0,i=0;return r!==null&&(s=r.fontStyle,a=r.foregroundId,i=r.backgroundId),ne.set(e,n.languageId,n.tokenType,null,s,a,i)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return U._pushAttributed(this,e,n);const r=e.split(/ /g);let s=this;for(const a of r)s=U._pushAttributed(s,a,n);return s}static _pushAttributed(e,n,r){const s=r.getMetadataForScope(n),a=e.scopePath.push(n),i=r.themeProvider.themeMatch(a),o=U.mergeAttributes(e.tokenAttributes,s,i);return new U(e,a,o)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?n.reverse():void 0}},St=class ee{constructor(e,n,r,s,a,i,o,c){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=a,this.endRule=i,this.nameScopesList=o,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new ee(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:ee._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?ge.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){ee._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,s,a,i,o){return new ee(this,e,n,r,s,a,i,o)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new ee(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){const r=ge.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new ee(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,ge.fromExtension(r,n.contentNameScopesList))}},Ns=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Me(n,je).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>Me(n,je).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},xs=class{constructor(t,e,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let r=t?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const a=t?.getScopeNames()??[];for(const i of this._tokenTypeOverrides)i.matcher(a)&&(r=ne.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(a))}if(s&&(r=ne.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=e;return}const n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},Ts=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,r,s){if(!this._grammars.has(t)){let a=this._rawGrammars.get(t);if(!a)return null;this._grammars.set(t,Es(t,a,e,n,r,s,this,this._onigLib))}return this._grammars.get(t)}},$s=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Ts(Oe.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(Oe.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,r){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,n,r){return this._loadGrammar(e,n,r.embeddedLanguages,r.tokenTypes,new Ns(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,r,s,a){const i=new os(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(o=>this._loadSingleGrammar(o.scopeName)),i.processQueue();return this._grammarForScopeName(e,n,r,s,a)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(e,n=[],r=0,s=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,r,s)}_grammarForScopeName(e,n=0,r=null,s=null,a=null){return this._syncRegistry.grammarForScopeName(e,n,r,s,a)}},kt=St.NULL;const Gs=/["&'<>`]/g,Ls=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ps=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Os=/[|\\{}()[\]^$+*?.]/g,rn=new WeakMap;function Ms(t,e){if(t=t.replace(e.subset?Fs(e.subset):Gs,r),e.subset||e.escapeOnly)return t;return t.replace(Ls,n).replace(Ps,r);function n(s,a,i){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(a+2),e)}function r(s,a,i){return e.format(s.charCodeAt(0),i.charCodeAt(a+1),e)}}function Fs(t){let e=rn.get(t);return e||(e=Bs(t),rn.set(t,e)),e}function Bs(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Os,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const js=/[\dA-Fa-f]/;function Ds(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!js.test(String.fromCharCode(e))?r:r+";"}const Us=/\d/;function Ws(t,e,n){const r="&#"+String(t);return n&&e&&!Us.test(String.fromCharCode(e))?r:r+";"}const Hs=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],ot={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},qs=["cent","copy","divide","gt","lt","not","para","times"],Hn={}.hasOwnProperty,vt={};let Ie;for(Ie in ot)Hn.call(ot,Ie)&&(vt[ot[Ie]]=Ie);const zs=/[^\dA-Za-z]/;function Vs(t,e,n,r){const s=String.fromCharCode(t);if(Hn.call(vt,s)){const a=vt[s],i="&"+a;return n&&Hs.includes(a)&&!qs.includes(a)&&(!r||e&&e!==61&&zs.test(String.fromCharCode(e)))?i:i+";"}return""}function Ks(t,e,n){let r=Ds(t,e,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=Vs(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const a=Ws(t,e,n.omitOptionalSemicolons);a.length<r.length&&(r=a)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function oe(t,e){return Ms(t,Object.assign({format:Ks},e))}const Qs=/^>|^->|<!--|-->|--!>|<!-$/g,Js=[">"],Xs=["<",">"];function Zs(t,e,n,r){return r.settings.bogusComments?"<?"+oe(t.value,Object.assign({},r.settings.characterReferences,{subset:Js}))+">":"<!--"+t.value.replace(Qs,s)+"-->";function s(a){return oe(a,Object.assign({},r.settings.characterReferences,{subset:Xs}))}}function Ys(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const I=zn(1),qn=zn(-1),ea=[];function zn(t){return e;function e(n,r,s){const a=n?n.children:ea;let i=(r||0)+t,o=a[i];if(!s)for(;o&&P.whitespace(o);)i+=t,o=a[i];return o}}const ta={}.hasOwnProperty;function Vn(t){return e;function e(n,r,s){return ta.call(t,n.tagName)&&t[n.tagName](n,r,s)}}const $t=Vn({body:ra,caption:ct,colgroup:ct,dd:oa,dt:ia,head:ct,html:na,li:aa,optgroup:ca,option:la,p:sa,rp:sn,rt:sn,tbody:ha,td:an,tfoot:fa,th:an,thead:ua,tr:pa});function ct(t,e,n){const r=I(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&P.whitespace(r.value.charAt(0)))}function na(t,e,n){const r=I(n,e);return!r||r.type!=="comment"}function ra(t,e,n){const r=I(n,e);return!r||r.type!=="comment"}function sa(t,e,n){const r=I(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function aa(t,e,n){const r=I(n,e);return!r||r.type==="element"&&r.tagName==="li"}function ia(t,e,n){const r=I(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function oa(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function sn(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function ca(t,e,n){const r=I(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function la(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function ua(t,e,n){const r=I(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function ha(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function fa(t,e,n){return!I(n,e)}function pa(t,e,n){const r=I(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function an(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const ga=Vn({body:Ca,colgroup:_a,head:ma,html:da,tbody:ya});function da(t){const e=I(t,-1);return!e||e.type!=="comment"}function ma(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function Ca(t){const e=I(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&P.whitespace(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function _a(t,e,n){const r=qn(n,e),s=I(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&$t(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function ya(t,e,n){const r=qn(n,e),s=I(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&$t(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Ne={name:[[`
|
|
4
4
|
\f\r &/=>`.split(""),`
|
|
@@ -3,7 +3,7 @@ import { Box as Ae, CircularProgress as Qb, Typography as ke, Button as Ht, Tool
|
|
|
3
3
|
import * as O from "react";
|
|
4
4
|
import Fe, { useEffect as sn, useImperativeHandle as ey, useContext as Ka, Fragment as ty, useMemo as Ft, useRef as In, useReducer as tS, useState as Ye, Suspense as Fp, lazy as nS, createContext as rS, isValidElement as _u, cloneElement as Bu, Children as oS, useCallback as yr, useLayoutEffect as iS } from "react";
|
|
5
5
|
import { useQuery as aS, useMutation as sS, useQueryClient as Vo } from "@tanstack/react-query";
|
|
6
|
-
import { u as _t, g as ny, ak as _p, al as lS, am as ry, an as Uc, ao as cc, ap as oy, h as jn, aq as Er, P as yu, V as iy, ar as ay, as as sy, at as ly, c as n0, A as uy, au as Ro, av as cy, aw as Hf, ax as $u, ay as uS, az as cS, aA as dS, aB as fS } from "./ServerProvider-
|
|
6
|
+
import { u as _t, g as ny, ak as _p, al as lS, am as ry, an as Uc, ao as cc, ap as oy, h as jn, aq as Er, P as yu, V as iy, ar as ay, as as sy, at as ly, c as n0, A as uy, au as Ro, av as cy, aw as Hf, ax as $u, ay as uS, az as cS, aA as dS, aB as fS } from "./ServerProvider-DMk_BDrm.es.js";
|
|
7
7
|
import dc from "markdown-to-jsx";
|
|
8
8
|
import { Warning as pS, Add as dy, Launch as hS, Delete as Vc, MoreVert as Wc, Edit as Bp, AddCircleRounded as mS } from "@mui/icons-material";
|
|
9
9
|
import { unstable_createGetCssVar as gS, createSpacing as bS, useTheme as yS, GlobalStyles as ES, unstable_memoTheme as CS, createStack as vS, Stack as xS, Box as fy, keyframes as Hl, css as py, createBox as TS, shouldForwardProp as hy, alpha as Gn } from "@mui/system";
|
|
@@ -23678,7 +23678,7 @@ function A8() {
|
|
|
23678
23678
|
{ default: i },
|
|
23679
23679
|
{ default: a }
|
|
23680
23680
|
] = await Promise.all([
|
|
23681
|
-
import("./core-
|
|
23681
|
+
import("./core-CK68iv6w.es.js"),
|
|
23682
23682
|
import("./engine-oniguruma-C4vnmooL.es.js"),
|
|
23683
23683
|
import("./sql-DCkt643-.es.js"),
|
|
23684
23684
|
import("./json-71t8ZF9g.es.js"),
|
|
@@ -61353,7 +61353,12 @@ function tK({
|
|
|
61353
61353
|
icon: /* @__PURE__ */ p(Ys, { type: "data" }),
|
|
61354
61354
|
tint: Ro.darkBlue,
|
|
61355
61355
|
label: A.path,
|
|
61356
|
-
rightLabel:
|
|
61356
|
+
rightLabel: (
|
|
61357
|
+
// A file the server could not probe is listed with
|
|
61358
|
+
// `error` and no `info`; show that instead of a
|
|
61359
|
+
// row count rather than reading through undefined.
|
|
61360
|
+
A.info ? Nq(A.info.rowCount) : "Unreadable"
|
|
61361
|
+
),
|
|
61357
61362
|
onClick: () => c(A)
|
|
61358
61363
|
},
|
|
61359
61364
|
A.path
|
|
@@ -61401,16 +61406,19 @@ function tK({
|
|
|
61401
61406
|
}
|
|
61402
61407
|
)
|
|
61403
61408
|
] }),
|
|
61404
|
-
/* @__PURE__ */
|
|
61405
|
-
/* @__PURE__ */ p(
|
|
61406
|
-
|
|
61407
|
-
/* @__PURE__ */ p(
|
|
61408
|
-
|
|
61409
|
-
|
|
61410
|
-
|
|
61411
|
-
/* @__PURE__ */ p(
|
|
61412
|
-
|
|
61413
|
-
|
|
61409
|
+
/* @__PURE__ */ z(Jn, { children: [
|
|
61410
|
+
u?.error && /* @__PURE__ */ p(ke, { variant: "body2", color: "error", children: u.error }),
|
|
61411
|
+
u?.info?.columns && /* @__PURE__ */ z(_l, { size: "small", children: [
|
|
61412
|
+
/* @__PURE__ */ p(Bl, { children: /* @__PURE__ */ z(yo, { children: [
|
|
61413
|
+
/* @__PURE__ */ p(mt, { children: "Column" }),
|
|
61414
|
+
/* @__PURE__ */ p(mt, { children: "Type" })
|
|
61415
|
+
] }) }),
|
|
61416
|
+
/* @__PURE__ */ p($l, { children: u.info.columns.map((A) => /* @__PURE__ */ z(yo, { children: [
|
|
61417
|
+
/* @__PURE__ */ p(mt, { component: "th", scope: "row", children: A.name }),
|
|
61418
|
+
/* @__PURE__ */ p(mt, { children: A.type })
|
|
61419
|
+
] }, A.name)) })
|
|
61420
|
+
] })
|
|
61421
|
+
] })
|
|
61414
61422
|
]
|
|
61415
61423
|
}
|
|
61416
61424
|
)
|
|
@@ -89,7 +89,7 @@ import {${t.sourceName}}" from '${t.modelPath}'"
|
|
|
89
89
|
- [ ] `),/^\d+.\s/.test(s)&&(v=`
|
|
90
90
|
`+(parseInt(s)+1)+". "),is(r,v)}else if(e.code&&e.code.toLowerCase()==="keyd"&&e.ctrlKey){du(e);var S={start:r.selectionStart,end:r.selectionEnd},I=S;S=$a({text:r.value,selection:S});var T=r.value.slice(S.start,S.end);a.setSelectionRange({start:S.end,end:S.end}),is(r,`
|
|
91
91
|
`+T),a.setSelectionRange({start:I.start,end:I.end})}else e.code&&e.code.toLowerCase()==="arrowup"&&e.altKey?ag(e,-1):e.code&&e.code.toLowerCase()==="arrowdown"&&e.altKey&&ag(e,1)}var UR=["prefixCls","onChange"],VR=["markdown","commands","fullscreen","preview","highlightEnable","extraCommands","tabSize","defaultTabEnable","autoFocusEnd","textareaWarp","dispatch"];function WR(e){var{prefixCls:t,onChange:n}=e,r=Ze(e,UR),o=W.useContext(Is),{markdown:i,commands:s,fullscreen:a,preview:l,highlightEnable:u,extraCommands:d,tabSize:f,defaultTabEnable:h,autoFocusEnd:p,textareaWarp:m,dispatch:b}=o;Ze(o,VR);var y=W.useRef(null),x=W.useRef(),C=W.useRef({fullscreen:a,preview:l});W.useEffect(()=>{C.current={fullscreen:a,preview:l,highlightEnable:u}},[a,l,u]),W.useEffect(()=>{if(y.current&&b){var S=new Sp(y.current);x.current=S,b({textarea:y.current,commandOrchestrator:S})}},[]),W.useEffect(()=>{if(p&&y.current&&m){y.current.focus();var S=y.current.value.length;y.current.setSelectionRange(S,S),setTimeout(()=>{m&&(m.scrollTop=m.scrollHeight),y.current&&(y.current.scrollTop=y.current.scrollHeight)},0)}},[m]);var v=S=>{zR(S,f,h),jx(S,[...s||[],...d||[]],x.current,b,C.current)};return W.useEffect(()=>(y.current&&y.current.addEventListener("keydown",v),()=>{y.current&&y.current.removeEventListener("keydown",v)}),[]),c.jsx("textarea",Y({autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1},r,{ref:y,className:t+"-text-input "+(r.className?r.className:""),value:i,onChange:S=>{b&&b({markdown:S.target.value}),n&&n(S)}}))}var qR=["prefixCls","className","onScroll","renderTextarea"];function YR(e){var t=e||{},{prefixCls:n,className:r,onScroll:o,renderTextarea:i}=t,s=Ze(t,qR),{markdown:a,scrollTop:l,commands:u,extraCommands:d,dispatch:f}=W.useContext(Is),h=W.useRef(null),p=W.useRef(),m=W.createRef();W.useEffect(()=>{var y={};m.current&&(y.textareaWarp=m.current||void 0,m.current.scrollTop=l||0),f&&f(Y({},y))},[]),W.useEffect(()=>{if(h.current&&f){var y=new Sp(h.current);p.current=y,f({textarea:h.current,commandOrchestrator:y})}},[]);var b={WebkitTextFillColor:"initial",overflow:"auto"};return c.jsx("div",{ref:m,className:n+"-area "+(r||""),onScroll:o,children:c.jsx("div",{className:n+"-text",children:i?W.cloneElement(i(Y({},s,{value:a,autoComplete:"off",autoCorrect:"off",spellCheck:"false",autoCapitalize:"off",className:n+"-text-input",style:{WebkitTextFillColor:"inherit",overflow:"auto"}}),{dispatch:f,onChange:s.onChange,shortcuts:jx,useContext:{commands:u,extraCommands:d,commandOrchestrator:p.current}}),{ref:h}):c.jsx(W.Fragment,{children:c.jsx(WR,Y({prefixCls:n},s,{style:b}))})})})}function KR(e){var{prefixCls:t,groupName:n,commands:r,children:o}=e||{},{barPopup:i={}}=W.useContext(Is);return W.useMemo(()=>c.jsx("div",{className:t+"-toolbar-child "+(n&&i[n]?"active":""),onClick:s=>s.stopPropagation(),children:Array.isArray(r)?c.jsx(Vx,Y({commands:r},e,{isChild:!0})):o}),[r,i,n,t])}function lg(e){var{prefixCls:t,overflow:n}=e,{fullscreen:r,preview:o,barPopup:i={},components:s,commandOrchestrator:a,dispatch:l}=W.useContext(Is),u=W.useRef("");function d(f,h){if(l){var p={barPopup:Y({},i)};f.keyCommand==="preview"&&(p.preview=f.value),f.keyCommand==="fullscreen"&&(p.fullscreen=!r),e.commands&&f.keyCommand==="group"?e.commands.forEach(m=>{h===m.groupName?p.barPopup[h]=!0:m.keyCommand&&(p.barPopup[m.groupName]=!1)}):(h||f.parent)&&Object.keys(p.barPopup||{}).forEach(m=>{p.barPopup[m]=!1}),Object.keys(p).length&&l(Y({},p)),a&&a.executeCommand(f)}}return W.useEffect(()=>{document&&n&&(r?document.body.style.overflow="hidden":(u.current||(u.current=window.getComputedStyle(document.body,null).overflow),document.body.style.overflow=u.current))},[r,u,n]),c.jsx("ul",{children:(e.commands||[]).map((f,h)=>{if(f.keyCommand==="divider")return c.jsx("li",Y({},f.liProps,{className:t+"-toolbar-divider"}),h);if(!f.keyCommand)return c.jsx(W.Fragment,{},h);var p=r&&f.keyCommand==="fullscreen"||f.keyCommand==="preview"&&o===f.value,m=f.children&&typeof f.children=="function"?f.children({getState:()=>a.getState(),textApi:a?a.textApi:void 0,close:()=>d({},f.groupName),execute:()=>d({execute:f.execute}),dispatch:l}):void 0,b=i&&o&&o==="preview"&&!/(preview|fullscreen)/.test(f.keyCommand),y=s?.toolbar||f.render,x=y&&typeof y=="function"?y(f,!!b,d,h):null;return c.jsxs("li",Y({},f.liProps,{className:p?"active":"",children:[x&&W.isValidElement(x)&&x,!x&&!f.buttonProps&&f.icon,!x&&f.buttonProps&&W.createElement("button",Y({type:"button",key:h,disabled:b,"data-name":f.name},f.buttonProps,{onClick:C=>{C.stopPropagation(),d(f,f.groupName)}}),f.icon),f.children&&c.jsx(KR,{overflow:n,groupName:f.groupName,prefixCls:t,children:m,commands:Array.isArray(f.children)?f.children:void 0})]}),h)})})}function Vx(e){e===void 0&&(e={});var{prefixCls:t,isChild:n,className:r}=e,{commands:o,extraCommands:i}=W.useContext(Is);return c.jsxs("div",{className:t+"-toolbar "+r,children:[c.jsx(lg,Y({},e,{commands:e.commands||o||[]})),!n&&c.jsx(lg,Y({},e,{commands:i||[]}))]})}function ug(e){var{hideToolbar:t,toolbarBottom:n,placement:r,overflow:o,prefixCls:i}=e;if(t||r==="bottom"&&!n||r==="top"&&n)return null;var s=n?"bottom":"";return c.jsx(Vx,{prefixCls:i,overflow:o,className:s})}var GR=e=>{var{prefixCls:t,onChange:n}=e||{},r=W.useRef(null),o=W.useRef(),i=W.useRef(e.height);W.useEffect(()=>{i.current!==e.height&&(i.current=e.height)},[e.height]);function s(d){if(o.current){var f,h=d.clientY||((f=d.changedTouches[0])==null?void 0:f.clientY),p=o.current.height+h-o.current.dragY;p>=e.minHeight&&p<=e.maxHeight&&n&&n(o.current.height+(h-o.current.dragY))}}function a(){var d,f;o.current=void 0,document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",a),(d=r.current)==null||d.removeEventListener("touchmove",s),(f=r.current)==null||f.removeEventListener("touchend",a)}function l(d){var f,h,p;d.preventDefault();var m=d.clientY||((f=d.changedTouches[0])==null?void 0:f.clientY);o.current={height:i.current,dragY:m},document.addEventListener("mousemove",s),document.addEventListener("mouseup",a),(h=r.current)==null||h.addEventListener("touchmove",s,{passive:!1}),(p=r.current)==null||p.addEventListener("touchend",a,{passive:!1})}W.useEffect(()=>{if(document){var d,f;(d=r.current)==null||d.addEventListener("touchstart",l,{passive:!1}),(f=r.current)==null||f.addEventListener("mousedown",l)}return()=>{if(document){var h;(h=r.current)==null||h.removeEventListener("touchstart",l),document.removeEventListener("mousemove",s)}}},[]);var u=W.useMemo(()=>c.jsx("svg",{viewBox:"0 0 512 512",height:"100%",children:c.jsx("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z"})}),[]);return c.jsx("div",{className:t+"-bar",ref:r,children:u})},QR=["prefixCls","className","value","commands","commandsFilter","direction","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","autoFocusEnd","tabSize","defaultTabEnable","onChange","onStatistics","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function XR(e){return e===void 0&&(e={}),Object.keys(e).forEach(t=>{e[t]=!1}),e}var ZR=W.forwardRef((e,t)=>{var n=e||{},{prefixCls:r="w-md-editor",className:o,value:i,commands:s=$R(),commandsFilter:a,direction:l,extraCommands:u=HR(),height:d=200,enableScroll:f=!0,visibleDragbar:h=typeof e.visiableDragbar=="boolean"?e.visiableDragbar:!0,highlightEnable:p=!0,preview:m="live",fullscreen:b=!1,overflow:y=!0,previewOptions:x={},textareaProps:C,maxHeight:v=1200,minHeight:S=100,autoFocus:I,autoFocusEnd:T=!1,tabSize:N=2,defaultTabEnable:O=!1,onChange:F,onStatistics:B,onHeightChange:j,hideToolbar:D,toolbarBottom:H=!1,components:_,renderTextarea:L}=n,$=Ze(n,QR),K=s.map(we=>a?a(we,!1):we).filter(Boolean),G=u.map(we=>a?a(we,!0):we).filter(Boolean),[q,R]=W.useReducer(aR,{markdown:i,preview:m,components:_,height:d,minHeight:S,highlightEnable:p,tabSize:N,defaultTabEnable:O,scrollTop:0,scrollTopPreview:0,commands:K,extraCommands:G,fullscreen:b,barPopup:{}}),oe=W.useRef(null),se=W.useRef(null),z=W.useRef(f);W.useImperativeHandle(t,()=>Y({},q,{container:oe.current,dispatch:R})),W.useMemo(()=>z.current=f,[f]),W.useEffect(()=>{var we={};oe.current&&(we.container=oe.current||void 0),we.markdown=i||"",we.barPopup={},R&&R(Y({},q,we))},[]);var pe=[o,"wmde-markdown-var",l?r+"-"+l:null,r,q.preview?r+"-show-"+q.preview:null,q.fullscreen?r+"-fullscreen":null].filter(Boolean).join(" ").trim();W.useMemo(()=>i!==q.markdown&&R({markdown:i||""}),[i,q.markdown]),W.useMemo(()=>m!==q.preview&&R({preview:m}),[m]),W.useMemo(()=>N!==q.tabSize&&R({tabSize:N}),[N]),W.useMemo(()=>p!==q.highlightEnable&&R({highlightEnable:p}),[p]),W.useMemo(()=>I!==q.autoFocus&&R({autoFocus:I}),[I]),W.useMemo(()=>T!==q.autoFocusEnd&&R({autoFocusEnd:T}),[T]),W.useMemo(()=>b!==q.fullscreen&&R({fullscreen:b}),[b]),W.useMemo(()=>d!==q.height&&R({height:d}),[d]),W.useMemo(()=>d!==q.height&&j&&j(q.height,d,q),[d,j,q]),W.useMemo(()=>s!==q.commands&&R({commands:K}),[e.commands]),W.useMemo(()=>u!==q.extraCommands&&R({extraCommands:G}),[e.extraCommands]);var J=W.useRef(),Q=W.useRef("preview"),re=W.useRef(!1);W.useMemo(()=>{J.current=q.textareaWarp,q.textareaWarp&&(q.textareaWarp.addEventListener("mouseover",()=>{Q.current="text"}),q.textareaWarp.addEventListener("mouseleave",()=>{Q.current="preview"}))},[q.textareaWarp]);var ne=(we,ye)=>{if(z.current){var ze=J.current,Ne=se.current?se.current:void 0;if(re.current||(Q.current=ye,re.current=!0),ze&&Ne){var nt=(ze.scrollHeight-ze.offsetHeight)/(Ne.scrollHeight-Ne.offsetHeight);we.target===ze&&Q.current==="text"&&(Ne.scrollTop=ze.scrollTop/nt),we.target===Ne&&Q.current==="preview"&&(ze.scrollTop=Ne.scrollTop*nt);var _e=0;Q.current==="text"?_e=ze.scrollTop||0:Q.current==="preview"&&(_e=Ne.scrollTop||0),R({scrollTop:_e})}}},ae=r+"-preview "+(x.className||""),ie=we=>ne(we,"preview"),Z=W.useMemo(()=>c.jsx("div",{ref:se,className:ae,children:c.jsx(_x,Y({},x,{onScroll:ie,source:q.markdown||""}))}),[ae,x,q.markdown]),me=_?.preview&&_?.preview(q.markdown||"",q,R);me&&W.isValidElement(me)&&(Z=c.jsx("div",{className:ae,ref:se,onScroll:ie,children:me}));var le=Y({},$.style,{height:q.height||"100%"}),ue=()=>R({barPopup:Y({},XR(q.barPopup))}),Ie=we=>R({height:we}),Ce=we=>{if(F&&F(we.target.value,we,q),C&&C.onChange&&C.onChange(we),q.textarea&&q.textarea instanceof HTMLTextAreaElement&&B){var ye=new Sp(q.textarea),ze=ye.getState()||{};B(Y({},ze,{lineCount:we.target.value.split(`
|
|
92
|
-
`).length,length:we.target.value.length}))}};return c.jsx(Is.Provider,{value:Y({},q,{dispatch:R}),children:c.jsxs("div",Y({ref:oe,className:pe},$,{onClick:ue,style:le,children:[c.jsx(ug,{hideToolbar:D,toolbarBottom:H,prefixCls:r,overflow:y,placement:"top"}),c.jsxs("div",{className:r+"-content",children:[/(edit|live)/.test(q.preview||"")&&c.jsx(YR,Y({className:r+"-input",prefixCls:r,autoFocus:I},C,{onChange:Ce,renderTextarea:_?.textarea||L,onScroll:we=>ne(we,"text")})),/(live|preview)/.test(q.preview||"")&&Z]}),h&&!q.fullscreen&&c.jsx(GR,{prefixCls:r,height:q.height,maxHeight:v,minHeight:S,onChange:Ie}),c.jsx(ug,{hideToolbar:D,toolbarBottom:H,prefixCls:r,overflow:y,placement:"bottom"})]}))})}),Wx=ZR;Wx.Markdown=_x;const Od={scopeName:"source.malloy",patterns:[{include:"#malloy-language"}],repository:{"malloy-language":{patterns:[{include:"#sql-string"},{include:"#comments"},{include:"#tags"},{include:"#strings"},{include:"#numbers"},{include:"#keywords"},{include:"#properties"},{include:"#functions"},{include:"#datetimes"},{include:"#identifiers-quoted"},{include:"#types"},{include:"#constants"},{include:"#timeframes"},{include:"#identifiers-unquoted"}]},"malloy-matched":{begin:"{",end:"}",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"malloy-in-sql":{begin:"%{",name:"source.malloy-in-sql",end:"}%?",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"sql-string":{patterns:[{begin:'(\\b[A-Za-z_][A-Za-z_0-9]*)(\\s*\\.\\s*)(sql)(\\s*\\(\\s*)(""")',end:'"""',beginCaptures:{1:{name:"variable.other"},3:{name:"keyword.control.sql"},5:{name:"punctuation.sql-block.open"}},endCaptures:{0:{name:"punctuation.sql-block.close"}},name:"source.sql",patterns:[{include:"#malloy-in-sql"},{include:"source.sql"}]}]},functions:{patterns:[{match:"(?i)\\b(count)(\\s*\\()(distinct)",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.function.modifier"}}},{match:"(?i)\\b(AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE|UNGROUPED)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(!)(timestamp|number|string|boolean|date)?(\\s*\\()",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.type"}}}]},datetimes:{patterns:[{match:"(?i)@[0-9]{4}-[0-9]{2}-[0-9]{2}[ T][0-9]{2}:[0-9]{2}((:[0-9]{2})(([\\.,][0-9]+)(\\[[A-Za-z_/]+\\])?)?)?",name:"constant.numeric.timestamp"},{match:"(?i)@[0-9]{4}(-Q[1-4]|-[0-9]{2}(-[0-9]{2}(-WK)?)?)?",name:"constant.numeric.date"}]},"identifiers-quoted":{patterns:[{match:"`[^`]*`",name:"variable.other.quoted"}]},"identifiers-unquoted":{patterns:[{match:"(?i)\\b[A-Za-z_][A-Za-z_0-9]*\\b",name:"variable.other"}]},timeframes:{patterns:[{match:"(?i)\\b((year|quarter|month|week|day|hour|minute|second)s?)\\b",name:"keyword.other.timeframe"},{match:"(?i)\\b(day_of_year|day_of_month)\\b",name:"keyword.other.timeframe"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]},tags:{patterns:[{match:"##\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:'#"',end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{match:"#\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:"#\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"##\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"#",end:"\\n",beginCaptures:{0:{name:"string.quoted"}},name:"string.quoted"}],repository:{"tag-values":{name:"support.type.property-name.json",match:'(-)?((?:[^\\s=#]+)|(?:"[^#]+"))(?:\\s*(=)\\s*((?:[^\\s=#]+)|(?:"[^#]+")))?',captures:{1:{name:"keyword.control.negate"},2:{name:"support.type.property-name.json"},3:{name:"keyword.operator.comparison.ts"},4:{name:"string.quoted"}}}}},strings:{patterns:[{begin:"'",end:"'",beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.single",patterns:[{include:"#escapes"}]},{begin:'"',end:'"',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.double",patterns:[{include:"#escapes"}]},{begin:'"""',end:'"""',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.triple"},{begin:"(?i)[r|/]'",end:"'",name:"string.regexp",patterns:[{include:"#regex-escapes"}]}],repository:{escapes:{name:"constant.character.escape",match:"\\\\(u[A-Fa-f0-9]{4}|.)",captures:{0:{name:"constant.character.escape"}}},"regex-escapes":{name:"constant.character.escape",match:"\\\\.",captures:{0:{name:"constant.character.escape"}}}}},numbers:{match:"(?i)(\\b((0|[1-9][0-9]*)(E[+-]?[0-9]+|\\.[0-9]*)?)|\\.[0-9]+)",name:"constant.numeric"},constants:{patterns:[{match:"(?i)\\bnull\\b",name:"constant.language.null"},{match:"(?i)\\btrue\\b",name:"constant.language.true"},{match:"(?i)\\bfalse\\b",name:"constant.language.false"}]},types:{patterns:[{match:"(?i)\\bstring\\b",name:"entity.name.type.string"},{match:"(?i)\\bnumber\\b",name:"entity.name.type.number"},{match:"(?i)\\bdate\\b",name:"entity.name.type.date"},{match:"(?i)\\btimestamp\\b",name:"entity.name.type.timestamp"},{match:"(?i)\\bboolean\\b",name:"entity.name.type.boolean"}]},properties:{patterns:[{match:"(?i)\\baccept\\b",name:"keyword.control.accept"},{match:"(?i)\\bselect\\b",name:"keyword.control.select"},{match:"(?i)\\bconnection\\b",name:"keyword.control.connection"},{match:"(?i)\\brun\\b",name:"keyword.control.run"},{match:"(?i)\\bextend\\b",name:"keyword.control.extend"},{match:"(?i)\\brefine\\b",name:"keyword.control.refine"},{match:"(?i)\\baggregate\\b",name:"keyword.control.aggregate"},{match:"(?i)\\bsample\\b",name:"keyword.control.sample"},{match:"(?i)\\bcalculate\\b",name:"keyword.control.calculate"},{match:"(?i)\\btimezone\\b",name:"keyword.control.timezone"},{match:"(?i)\\bdimension\\b",name:"keyword.control.dimension"},{match:"(?i)\\bexcept\\b",name:"keyword.control.except"},{match:"(?i)\\bsource\\b",name:"keyword.control.source"},{match:"(?i)\\bgroup_by\\b",name:"keyword.control.group_by"},{match:"(?i)\\bhaving\\b",name:"keyword.control.having"},{match:"(?i)\\bindex\\b",name:"keyword.control.index"},{match:"(?i)\\bjoin_one\\b",name:"keyword.control.join_one"},{match:"(?i)\\bwith\\b",name:"keyword.control.with"},{match:"(?i)\\bjoin_many\\b",name:"keyword.control.join_many"},{match:"(?i)\\bjoin_cross\\b",name:"keyword.control.join_cross"},{match:"(?i)\\blimit\\b",name:"keyword.control.limit"},{match:"(?i)\\bmeasure\\b",name:"keyword.control.measure"},{match:"(?i)\\bnest\\b",name:"keyword.control.nest"},{match:"(?i)\\border_by\\b",name:"keyword.control.order_by"},{match:"(?i)\\bpartition_by\\b",name:"keyword.control.partition_by"},{match:"(?i)\\bprimary_key\\b",name:"keyword.control.primary_key"},{match:"(?i)\\bproject\\b",name:"keyword.control.project"},{match:"(?i)\\bquery\\b",name:"keyword.control.query"},{match:"(?i)\\brename\\b",name:"keyword.control.rename"},{match:"(?i)\\btop\\b",name:"keyword.control.top"},{match:"(?i)\\bview\\b",name:"keyword.control.view"},{match:"(?i)\\bwhere\\b",name:"keyword.control.where"},{match:"(?i)\\bdeclare\\b",name:"keyword.control.declare"}]},keywords:{patterns:[{match:"(?i)\\bis\\b",name:"keyword.control.is"},{match:"(?i)\\bon\\b",name:"keyword.control.on"},{match:"(?i)\\bnot\\b",name:"keyword.other.not"},{match:"(?i)\\bor\\b",name:"keyword.other.or"},{match:"(?i)\\bdesc\\b",name:"keyword.control.desc"},{match:"(?i)\\bby\\b",name:"keyword.control.by"},{match:"(?i)\\band\\b",name:"keyword.other.and"},{match:"(?i)\\basc\\b",name:"keyword.control.asc"},{match:"(?i)\\bfor\\b",name:"keyword.other.for"},{match:"(?i)\\belse\\b",name:"keyword.other.else"},{match:"(?i)\\bto\\b",name:"keyword.other.to"},{match:"(?i)\\bwhen\\b",name:"keyword.other.when"},{match:"(?i)\\bpick\\b",name:"keyword.other.pick"},{match:"(?i)\\bimport\\b",name:"keyword.control.import"}]}}},JR={...Od,patterns:[...Od.patterns,{include:"#docvar"}],repository:{...Od.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},eN={name:"Malloy SQL",scopeName:"source.malloy-sql",patterns:[{include:"#malloysql-sql"}],repository:{"malloysql-sql":{beginCaptures:{0:{name:"entity.other.attribute.malloy-sql"},1:{name:"entity.other.attribute.malloy-sql"},3:{name:"comment.line.double-slash"}},name:"meta.embedded.block.malloysql.sql",patterns:[{include:"#comments"},{begin:"%{",end:"}%",beginCaptures:{0:{name:"punctuation.definition.malloy-sql"}},endCaptures:{0:{name:"punctuation.definition.malloy-sql"}},name:"meta.embedded.block.malloy",patterns:[{include:"source.malloy"}]},{include:"source.sql"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]}}},tN="github-light",nN="github-dark";let Md;function rN(){return Md||(Md=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:i},{default:s}]=await Promise.all([Promise.resolve().then(()=>require("./core-DPpebaY3.cjs.js")),Promise.resolve().then(()=>require("./engine-oniguruma-BkproSVE.cjs.js")),Promise.resolve().then(()=>require("./sql-BqWZrLHB.cjs.js")),Promise.resolve().then(()=>require("./json-y-J1j5EW.cjs.js")),Promise.resolve().then(()=>require("./typescript-BqvpT6pB.cjs.js")),Promise.resolve().then(()=>require("./github-light-BFTOhCbz.cjs.js")),Promise.resolve().then(()=>require("./github-dark-BKL9xNgN.cjs.js"))]);return e({engine:t(Promise.resolve().then(()=>require("./wasm-Dw4u1m6u.cjs.js"))),themes:[i,s],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...JR},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...eN}]})})()),Md}async function $u(e,t,n="light"){return(await rN()).codeToHtml(e,{lang:t,theme:n==="dark"?nN:tN})}function Xt(e){const{server:t}=De.useServer(),n={...e,queryKey:[...e.queryKey,t],queryFn:async()=>{try{return await e.queryFn()}catch(r){if(r&&typeof r=="object"&&"response"in r){const o=r;if(o.response?.data){const i=new Error(o.response.data.message||o.message);throw i.status=o.response.status,i.data=o.response.data,i}}throw r}},retry:!1,throwOnError:!1};return Lr.useQuery(n,De.globalQueryClient)}function vn(e){const t={...e,mutationFn:async n=>{try{return await e.mutationFn(n)}catch(r){if(r&&typeof r=="object"&&"response"in r){const o=r;if(o.response?.data){const i=new Error(o.response.data.message||o.message);throw i.status=o.response.status,i.data=o.response.data,i}}throw r}},retry:!1,throwOnError:!1};return Lr.useMutation(t,De.globalQueryClient)}const Ht=e=>{const t=new URL(e),n={};if(t.protocol!=="publisher:")throw new Error(`Failed to parse resource URI: ${e}`);const r=(t.hostname+t.pathname).split("/");for(let o=0;o<r.length;o+=2){const i=r[o];i==="environments"?n.environmentName=decodeURI(r[o+1])||void 0:i==="packages"?n.packageName=decodeURI(r[o+1])||void 0:i==="connections"?n.connectionName=decodeURI(r[o+1])||void 0:i==="models"&&(n.modelPath=decodeURI(r.slice(o+1).join("/"))||void 0)}if(n.versionId=t.searchParams.get("versionId")||void 0,!n.environmentName)throw new Error(`Failed to parse resource URI: ${e}`);return n},Cl=e=>{if(!e.environmentName)throw new Error(`Failed to encode resource URI, missing environment name: ${e}`);let t=`publisher://environments/${e.environmentName}`;return e.packageName&&(t+=`/packages/${e.packageName}`),e.connectionName&&(t+=`/connections/${e.connectionName}`),e.modelPath&&(t+=`/models/${e.modelPath}`),e.packageName&&e.versionId&&(t+=`?versionId=${e.versionId}`),t};function kp({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:i}){return W.useEffect(()=>{o&&o(t)},[t,o]),c.jsx(De.StyledCardMedia,{children:c.jsxs(Ot.Stack,{spacing:2,component:"section",children:[c.jsx(qx,{sourceAndPath:e[t],existingQuery:n,onChange:s=>{r&&r(s)},resourceUri:i}),c.jsx(Ot.Box,{height:"5px"})]})})}function fu(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function oN({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:i}){const[s,a]=W.useState(n||fu()),[l,u]=W.useState(void 0);W.useEffect(()=>{n&&a(n)},[n]);const[d,f]=W.useState([]),{MalloyExplorerProvider:h,QueryPanel:p,ResizableCollapsiblePanel:m,ResultPanel:b,SourcePanel:y}=r;W.useEffect(()=>{t&&t(s)},[t,s]);const{environmentName:x,packageName:C,versionId:v}=Ht(i),{apiClients:S}=De.useServer(),I=vn({mutationFn:()=>{const F=typeof s?.malloyQuery=="string"?s.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:s?.malloyQuery}).toMalloy();return u({executionState:"running",query:s?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{I.reset(),u(void 0)},response:{result:{}}}),a({...s,query:F}),S.models.executeQueryModel(x,C,e.modelPath,{query:F,sourceName:void 0,queryName:void 0,versionId:v})},onSuccess:F=>{if(F){const B=JSON.parse(F.data.result);a({...s,malloyResult:B}),u(j=>j?{...j,executionState:"finished",response:{result:B}}:void 0)}},onError:F=>{u(void 0),console.error("Query execution error:",F)}}),[T,N]=W.useState(e.sourceInfo.name);W.useEffect(()=>{T!==e.sourceInfo.name&&(N(e.sourceInfo.name),a(fu()),u(void 0))},[e,T]);const O=W.useCallback(F=>{a({...s,malloyQuery:F,malloyResult:void 0})},[s]);return T!==e.sourceInfo.name?c.jsx("div",{children:"Loading..."}):c.jsx(De.StyledExplorerContent,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:c.jsx(h,{source:e.sourceInfo,query:s?.malloyQuery,topValues:[],onFocusedNestViewPathChange:f,focusedNestViewPath:d,onQueryChange:O,children:c.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[c.jsx(m,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:c.jsx(y,{onRefresh:()=>a(fu())})}),c.jsx(m,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:c.jsx(p,{runQuery:()=>{console.log(`running query with: ${s?.malloyQuery}`);try{I.mutate()}catch(F){console.error("Error running query:",F)}}})}),c.jsx(b,{source:e.sourceInfo,draftQuery:s?.malloyQuery,setDraftQuery:F=>a({...s,malloyQuery:F}),submittedQuery:l,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function qx(e){const[t,n]=W.useState(null),[r,o]=W.useState(null),[i,s]=W.useState(!0);return W.useEffect(()=>{let a=!0;return Promise.all([import("@malloydata/malloy-explorer"),import("@malloydata/malloy-query-builder")]).then(([l,u])=>{a&&(n(l),o(u),s(!1))}).catch(l=>{console.error("Failed to load Malloy components:",l),a&&s(!1)}),()=>{a=!1}},[]),i||!t||!r?c.jsx(De.StyledExplorerPage,{children:c.jsx(De.StyledExplorerContent,{children:c.jsx(Ot.Box,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):c.jsx(oN,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}const Yx=mt(c.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}));function Sn({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:i=2,textVariant:s="body2"}){const a=c.jsxs(w.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:i},children:[c.jsx(w.CircularProgress,{size:t,color:n,thickness:r}),e&&c.jsx(w.Typography,{variant:s,color:"text.secondary",children:e})]});return o?c.jsx(w.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:a}):a}const iN=new Set(["warn","error"]);function sN(e){if(!e?.length)return;const t=[];let n=!1;for(const r of e)!r.message||!iN.has(r.severity??"")||(r.severity==="error"&&(n=!0),t.includes(r.message)||t.push(r.message));if(t.length)return{severity:n?"error":"warn",title:t.join(`
|
|
92
|
+
`).length,length:we.target.value.length}))}};return c.jsx(Is.Provider,{value:Y({},q,{dispatch:R}),children:c.jsxs("div",Y({ref:oe,className:pe},$,{onClick:ue,style:le,children:[c.jsx(ug,{hideToolbar:D,toolbarBottom:H,prefixCls:r,overflow:y,placement:"top"}),c.jsxs("div",{className:r+"-content",children:[/(edit|live)/.test(q.preview||"")&&c.jsx(YR,Y({className:r+"-input",prefixCls:r,autoFocus:I},C,{onChange:Ce,renderTextarea:_?.textarea||L,onScroll:we=>ne(we,"text")})),/(live|preview)/.test(q.preview||"")&&Z]}),h&&!q.fullscreen&&c.jsx(GR,{prefixCls:r,height:q.height,maxHeight:v,minHeight:S,onChange:Ie}),c.jsx(ug,{hideToolbar:D,toolbarBottom:H,prefixCls:r,overflow:y,placement:"bottom"})]}))})}),Wx=ZR;Wx.Markdown=_x;const Od={scopeName:"source.malloy",patterns:[{include:"#malloy-language"}],repository:{"malloy-language":{patterns:[{include:"#sql-string"},{include:"#comments"},{include:"#tags"},{include:"#strings"},{include:"#numbers"},{include:"#keywords"},{include:"#properties"},{include:"#functions"},{include:"#datetimes"},{include:"#identifiers-quoted"},{include:"#types"},{include:"#constants"},{include:"#timeframes"},{include:"#identifiers-unquoted"}]},"malloy-matched":{begin:"{",end:"}",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"malloy-in-sql":{begin:"%{",name:"source.malloy-in-sql",end:"}%?",patterns:[{include:"#malloy-matched"},{include:"#malloy-language"}]},"sql-string":{patterns:[{begin:'(\\b[A-Za-z_][A-Za-z_0-9]*)(\\s*\\.\\s*)(sql)(\\s*\\(\\s*)(""")',end:'"""',beginCaptures:{1:{name:"variable.other"},3:{name:"keyword.control.sql"},5:{name:"punctuation.sql-block.open"}},endCaptures:{0:{name:"punctuation.sql-block.close"}},name:"source.sql",patterns:[{include:"#malloy-in-sql"},{include:"source.sql"}]}]},functions:{patterns:[{match:"(?i)\\b(count)(\\s*\\()(distinct)",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.function.modifier"}}},{match:"(?i)\\b(AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE|UNGROUPED)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(\\s*\\()",captures:{1:{name:"entity.name.function"}}},{match:"(?i)\\b([a-zA-Z_][a-zA-Z_0-9]*)(!)(timestamp|number|string|boolean|date)?(\\s*\\()",captures:{1:{name:"entity.name.function"},3:{name:"entity.name.type"}}}]},datetimes:{patterns:[{match:"(?i)@[0-9]{4}-[0-9]{2}-[0-9]{2}[ T][0-9]{2}:[0-9]{2}((:[0-9]{2})(([\\.,][0-9]+)(\\[[A-Za-z_/]+\\])?)?)?",name:"constant.numeric.timestamp"},{match:"(?i)@[0-9]{4}(-Q[1-4]|-[0-9]{2}(-[0-9]{2}(-WK)?)?)?",name:"constant.numeric.date"}]},"identifiers-quoted":{patterns:[{match:"`[^`]*`",name:"variable.other.quoted"}]},"identifiers-unquoted":{patterns:[{match:"(?i)\\b[A-Za-z_][A-Za-z_0-9]*\\b",name:"variable.other"}]},timeframes:{patterns:[{match:"(?i)\\b((year|quarter|month|week|day|hour|minute|second)s?)\\b",name:"keyword.other.timeframe"},{match:"(?i)\\b(day_of_year|day_of_month)\\b",name:"keyword.other.timeframe"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]},tags:{patterns:[{match:"##\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:'#"',end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{match:"#\\n",name:"string.quoted",captures:{0:{name:"string.quoted"}}},{begin:"#\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"##\\s",end:"\\n",beginCaptures:{0:{name:"support.type.property-name.json"}},name:"comment.line.double-slash",patterns:[{include:"#tag-values"}]},{begin:"#",end:"\\n",beginCaptures:{0:{name:"string.quoted"}},name:"string.quoted"}],repository:{"tag-values":{name:"support.type.property-name.json",match:'(-)?((?:[^\\s=#]+)|(?:"[^#]+"))(?:\\s*(=)\\s*((?:[^\\s=#]+)|(?:"[^#]+")))?',captures:{1:{name:"keyword.control.negate"},2:{name:"support.type.property-name.json"},3:{name:"keyword.operator.comparison.ts"},4:{name:"string.quoted"}}}}},strings:{patterns:[{begin:"'",end:"'",beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.single",patterns:[{include:"#escapes"}]},{begin:'"',end:'"',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.double",patterns:[{include:"#escapes"}]},{begin:'"""',end:'"""',beginCaptures:{0:{name:"punctuation.definition.string.begin"}},endCaptures:{0:{name:"punctuation.definition.string.end"}},name:"string.quoted.triple"},{begin:"(?i)[r|/]'",end:"'",name:"string.regexp",patterns:[{include:"#regex-escapes"}]}],repository:{escapes:{name:"constant.character.escape",match:"\\\\(u[A-Fa-f0-9]{4}|.)",captures:{0:{name:"constant.character.escape"}}},"regex-escapes":{name:"constant.character.escape",match:"\\\\.",captures:{0:{name:"constant.character.escape"}}}}},numbers:{match:"(?i)(\\b((0|[1-9][0-9]*)(E[+-]?[0-9]+|\\.[0-9]*)?)|\\.[0-9]+)",name:"constant.numeric"},constants:{patterns:[{match:"(?i)\\bnull\\b",name:"constant.language.null"},{match:"(?i)\\btrue\\b",name:"constant.language.true"},{match:"(?i)\\bfalse\\b",name:"constant.language.false"}]},types:{patterns:[{match:"(?i)\\bstring\\b",name:"entity.name.type.string"},{match:"(?i)\\bnumber\\b",name:"entity.name.type.number"},{match:"(?i)\\bdate\\b",name:"entity.name.type.date"},{match:"(?i)\\btimestamp\\b",name:"entity.name.type.timestamp"},{match:"(?i)\\bboolean\\b",name:"entity.name.type.boolean"}]},properties:{patterns:[{match:"(?i)\\baccept\\b",name:"keyword.control.accept"},{match:"(?i)\\bselect\\b",name:"keyword.control.select"},{match:"(?i)\\bconnection\\b",name:"keyword.control.connection"},{match:"(?i)\\brun\\b",name:"keyword.control.run"},{match:"(?i)\\bextend\\b",name:"keyword.control.extend"},{match:"(?i)\\brefine\\b",name:"keyword.control.refine"},{match:"(?i)\\baggregate\\b",name:"keyword.control.aggregate"},{match:"(?i)\\bsample\\b",name:"keyword.control.sample"},{match:"(?i)\\bcalculate\\b",name:"keyword.control.calculate"},{match:"(?i)\\btimezone\\b",name:"keyword.control.timezone"},{match:"(?i)\\bdimension\\b",name:"keyword.control.dimension"},{match:"(?i)\\bexcept\\b",name:"keyword.control.except"},{match:"(?i)\\bsource\\b",name:"keyword.control.source"},{match:"(?i)\\bgroup_by\\b",name:"keyword.control.group_by"},{match:"(?i)\\bhaving\\b",name:"keyword.control.having"},{match:"(?i)\\bindex\\b",name:"keyword.control.index"},{match:"(?i)\\bjoin_one\\b",name:"keyword.control.join_one"},{match:"(?i)\\bwith\\b",name:"keyword.control.with"},{match:"(?i)\\bjoin_many\\b",name:"keyword.control.join_many"},{match:"(?i)\\bjoin_cross\\b",name:"keyword.control.join_cross"},{match:"(?i)\\blimit\\b",name:"keyword.control.limit"},{match:"(?i)\\bmeasure\\b",name:"keyword.control.measure"},{match:"(?i)\\bnest\\b",name:"keyword.control.nest"},{match:"(?i)\\border_by\\b",name:"keyword.control.order_by"},{match:"(?i)\\bpartition_by\\b",name:"keyword.control.partition_by"},{match:"(?i)\\bprimary_key\\b",name:"keyword.control.primary_key"},{match:"(?i)\\bproject\\b",name:"keyword.control.project"},{match:"(?i)\\bquery\\b",name:"keyword.control.query"},{match:"(?i)\\brename\\b",name:"keyword.control.rename"},{match:"(?i)\\btop\\b",name:"keyword.control.top"},{match:"(?i)\\bview\\b",name:"keyword.control.view"},{match:"(?i)\\bwhere\\b",name:"keyword.control.where"},{match:"(?i)\\bdeclare\\b",name:"keyword.control.declare"}]},keywords:{patterns:[{match:"(?i)\\bis\\b",name:"keyword.control.is"},{match:"(?i)\\bon\\b",name:"keyword.control.on"},{match:"(?i)\\bnot\\b",name:"keyword.other.not"},{match:"(?i)\\bor\\b",name:"keyword.other.or"},{match:"(?i)\\bdesc\\b",name:"keyword.control.desc"},{match:"(?i)\\bby\\b",name:"keyword.control.by"},{match:"(?i)\\band\\b",name:"keyword.other.and"},{match:"(?i)\\basc\\b",name:"keyword.control.asc"},{match:"(?i)\\bfor\\b",name:"keyword.other.for"},{match:"(?i)\\belse\\b",name:"keyword.other.else"},{match:"(?i)\\bto\\b",name:"keyword.other.to"},{match:"(?i)\\bwhen\\b",name:"keyword.other.when"},{match:"(?i)\\bpick\\b",name:"keyword.other.pick"},{match:"(?i)\\bimport\\b",name:"keyword.control.import"}]}}},JR={...Od,patterns:[...Od.patterns,{include:"#docvar"}],repository:{...Od.repository,docvar:{patterns:[{match:"\\<\\<[^(\\>\\>)]*\\>\\>",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"markup.italic.markdown"}]}}},eN={name:"Malloy SQL",scopeName:"source.malloy-sql",patterns:[{include:"#malloysql-sql"}],repository:{"malloysql-sql":{beginCaptures:{0:{name:"entity.other.attribute.malloy-sql"},1:{name:"entity.other.attribute.malloy-sql"},3:{name:"comment.line.double-slash"}},name:"meta.embedded.block.malloysql.sql",patterns:[{include:"#comments"},{begin:"%{",end:"}%",beginCaptures:{0:{name:"punctuation.definition.malloy-sql"}},endCaptures:{0:{name:"punctuation.definition.malloy-sql"}},name:"meta.embedded.block.malloy",patterns:[{include:"source.malloy"}]},{include:"source.sql"}]},comments:{patterns:[{begin:"/\\*",end:"\\*/",beginCaptures:{0:{name:"punctuation.definition.comment.begin"}},endCaptures:{0:{name:"punctuation.definition.comment.end"}},name:"comment.block"},{begin:"//",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-slash"},{begin:"--",end:"\\n",beginCaptures:{0:{name:"punctuation.definition.comment"}},name:"comment.line.double-hyphen"}]}}},tN="github-light",nN="github-dark";let Md;function rN(){return Md||(Md=(async()=>{const[{createHighlighterCore:e},{createOnigurumaEngine:t},{default:n},{default:r},{default:o},{default:i},{default:s}]=await Promise.all([Promise.resolve().then(()=>require("./core-DeaXfVr8.cjs.js")),Promise.resolve().then(()=>require("./engine-oniguruma-BkproSVE.cjs.js")),Promise.resolve().then(()=>require("./sql-BqWZrLHB.cjs.js")),Promise.resolve().then(()=>require("./json-y-J1j5EW.cjs.js")),Promise.resolve().then(()=>require("./typescript-BqvpT6pB.cjs.js")),Promise.resolve().then(()=>require("./github-light-BFTOhCbz.cjs.js")),Promise.resolve().then(()=>require("./github-dark-BKL9xNgN.cjs.js"))]);return e({engine:t(Promise.resolve().then(()=>require("./wasm-Dw4u1m6u.cjs.js"))),themes:[i,s],langs:[n,r,o,{name:"malloy",scopeName:"source.malloy",embeddedLangs:["sql"],...JR},{name:"malloysql",scopeName:"source.malloy-sql",embeddedLangs:["sql"],...eN}]})})()),Md}async function $u(e,t,n="light"){return(await rN()).codeToHtml(e,{lang:t,theme:n==="dark"?nN:tN})}function Xt(e){const{server:t}=De.useServer(),n={...e,queryKey:[...e.queryKey,t],queryFn:async()=>{try{return await e.queryFn()}catch(r){if(r&&typeof r=="object"&&"response"in r){const o=r;if(o.response?.data){const i=new Error(o.response.data.message||o.message);throw i.status=o.response.status,i.data=o.response.data,i}}throw r}},retry:!1,throwOnError:!1};return Lr.useQuery(n,De.globalQueryClient)}function vn(e){const t={...e,mutationFn:async n=>{try{return await e.mutationFn(n)}catch(r){if(r&&typeof r=="object"&&"response"in r){const o=r;if(o.response?.data){const i=new Error(o.response.data.message||o.message);throw i.status=o.response.status,i.data=o.response.data,i}}throw r}},retry:!1,throwOnError:!1};return Lr.useMutation(t,De.globalQueryClient)}const Ht=e=>{const t=new URL(e),n={};if(t.protocol!=="publisher:")throw new Error(`Failed to parse resource URI: ${e}`);const r=(t.hostname+t.pathname).split("/");for(let o=0;o<r.length;o+=2){const i=r[o];i==="environments"?n.environmentName=decodeURI(r[o+1])||void 0:i==="packages"?n.packageName=decodeURI(r[o+1])||void 0:i==="connections"?n.connectionName=decodeURI(r[o+1])||void 0:i==="models"&&(n.modelPath=decodeURI(r.slice(o+1).join("/"))||void 0)}if(n.versionId=t.searchParams.get("versionId")||void 0,!n.environmentName)throw new Error(`Failed to parse resource URI: ${e}`);return n},Cl=e=>{if(!e.environmentName)throw new Error(`Failed to encode resource URI, missing environment name: ${e}`);let t=`publisher://environments/${e.environmentName}`;return e.packageName&&(t+=`/packages/${e.packageName}`),e.connectionName&&(t+=`/connections/${e.connectionName}`),e.modelPath&&(t+=`/models/${e.modelPath}`),e.packageName&&e.versionId&&(t+=`?versionId=${e.versionId}`),t};function kp({sourceAndPaths:e,selectedSourceIndex:t,existingQuery:n,onQueryChange:r,onSourceChange:o,resourceUri:i}){return W.useEffect(()=>{o&&o(t)},[t,o]),c.jsx(De.StyledCardMedia,{children:c.jsxs(Ot.Stack,{spacing:2,component:"section",children:[c.jsx(qx,{sourceAndPath:e[t],existingQuery:n,onChange:s=>{r&&r(s)},resourceUri:i}),c.jsx(Ot.Box,{height:"5px"})]})})}function fu(){return{query:void 0,malloyQuery:void 0,malloyResult:void 0}}function oN({sourceAndPath:e,onChange:t,existingQuery:n,explorerComponents:r,QueryBuilder:o,resourceUri:i}){const[s,a]=W.useState(n||fu()),[l,u]=W.useState(void 0);W.useEffect(()=>{n&&a(n)},[n]);const[d,f]=W.useState([]),{MalloyExplorerProvider:h,QueryPanel:p,ResizableCollapsiblePanel:m,ResultPanel:b,SourcePanel:y}=r;W.useEffect(()=>{t&&t(s)},[t,s]);const{environmentName:x,packageName:C,versionId:v}=Ht(i),{apiClients:S}=De.useServer(),I=vn({mutationFn:()=>{const F=typeof s?.malloyQuery=="string"?s.malloyQuery:new o.ASTQuery({source:e.sourceInfo,query:s?.malloyQuery}).toMalloy();return u({executionState:"running",query:s?.malloyQuery,queryResolutionStartMillis:Date.now(),onCancel:()=>{I.reset(),u(void 0)},response:{result:{}}}),a({...s,query:F}),S.models.executeQueryModel(x,C,e.modelPath,{query:F,sourceName:void 0,queryName:void 0,versionId:v})},onSuccess:F=>{if(F){const B=JSON.parse(F.data.result);a({...s,malloyResult:B}),u(j=>j?{...j,executionState:"finished",response:{result:B}}:void 0)}},onError:F=>{u(void 0),console.error("Query execution error:",F)}}),[T,N]=W.useState(e.sourceInfo.name);W.useEffect(()=>{T!==e.sourceInfo.name&&(N(e.sourceInfo.name),a(fu()),u(void 0))},[e,T]);const O=W.useCallback(F=>{a({...s,malloyQuery:F,malloyResult:void 0})},[s]);return T!==e.sourceInfo.name?c.jsx("div",{children:"Loading..."}):c.jsx(De.StyledExplorerContent,{sx:{border:"1px solid #e0e0e0",borderRadius:"8px",overflow:"hidden"},children:c.jsx(h,{source:e.sourceInfo,query:s?.malloyQuery,topValues:[],onFocusedNestViewPathChange:f,focusedNestViewPath:d,onQueryChange:O,children:c.jsxs("div",{style:{display:"flex",height:"100%",overflowY:"auto"},children:[c.jsx(m,{isInitiallyExpanded:!0,initialWidth:180,minWidth:180,icon:"database",title:e.sourceInfo.name,children:c.jsx(y,{onRefresh:()=>a(fu())})}),c.jsx(m,{isInitiallyExpanded:!0,initialWidth:280,minWidth:280,icon:"filterSliders",title:"Query",children:c.jsx(p,{runQuery:()=>{console.log(`running query with: ${s?.malloyQuery}`);try{I.mutate()}catch(F){console.error("Error running query:",F)}}})}),c.jsx(b,{source:e.sourceInfo,draftQuery:s?.malloyQuery,setDraftQuery:F=>a({...s,malloyQuery:F}),submittedQuery:l,options:{showRawQuery:!0}})]})})},e.sourceInfo.name)}function qx(e){const[t,n]=W.useState(null),[r,o]=W.useState(null),[i,s]=W.useState(!0);return W.useEffect(()=>{let a=!0;return Promise.all([import("@malloydata/malloy-explorer"),import("@malloydata/malloy-query-builder")]).then(([l,u])=>{a&&(n(l),o(u),s(!1))}).catch(l=>{console.error("Failed to load Malloy components:",l),a&&s(!1)}),()=>{a=!1}},[]),i||!t||!r?c.jsx(De.StyledExplorerPage,{children:c.jsx(De.StyledExplorerContent,{children:c.jsx(Ot.Box,{sx:{alignItems:"center",justifyContent:"center",height:"200px",color:"text.secondary"},children:"Loading explorer..."})})}):c.jsx(oN,{...e,explorerComponents:t,QueryBuilder:r,resourceUri:e.resourceUri})}const Yx=mt(c.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}));function Sn({text:e,size:t=20,color:n="primary",thickness:r=3.6,centered:o=!0,spacing:i=2,textVariant:s="body2"}){const a=c.jsxs(w.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:i},children:[c.jsx(w.CircularProgress,{size:t,color:n,thickness:r}),e&&c.jsx(w.Typography,{variant:s,color:"text.secondary",children:e})]});return o?c.jsx(w.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"200px",width:"100%"},children:a}):a}const iN=new Set(["warn","error"]);function sN(e){if(!e?.length)return;const t=[];let n=!1;for(const r of e)!r.message||!iN.has(r.severity??"")||(r.severity==="error"&&(n=!0),t.includes(r.message)||t.push(r.message));if(t.length)return{severity:n?"error":"warn",title:t.join(`
|
|
93
93
|
`)}}const aN=W.lazy(()=>Promise.resolve().then(()=>_W));function Os({result:e,maxHeight:t,maxResultSize:n=0,renderLogs:r}){const o=W.useRef(null),[i,s]=W.useState(t),[a,l]=W.useState(!1),u=sN(r);if(!e)return null;if(n>0&&e.length>n&&!a)return c.jsxs(w.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,p:4,backgroundColor:"#fafafa",border:"1px solid",borderColor:"#e0e0e0",borderRadius:1},children:[c.jsx(On.Warning,{sx:{fontSize:48,color:"#757575"}}),c.jsx(w.Typography,{variant:"h6",color:"text.secondary",align:"center",children:"Processing large results may cause browser performance issues. Proceed?"}),c.jsx(w.Button,{variant:"contained",color:"primary",onClick:()=>l(!0),children:"Proceed"})]});const f=c.jsx(Sn,{text:"Loading...",centered:!0,size:32}),h=Math.min(t,i);return c.jsxs(w.Box,{ref:o,sx:{position:"relative",height:"auto",border:"0px",borderRadius:0,overflow:"hidden"},children:[e&&c.jsx(W.Suspense,{fallback:f,children:c.jsx(aN,{result:e,height:h,onSizeChange:s})}),u&&c.jsx(w.Box,{sx:{position:"absolute",top:4,right:4,zIndex:1},children:c.jsx(w.Tooltip,{title:u.title,slotProps:{tooltip:{sx:{whiteSpace:"pre-line"}}},children:c.jsx(w.IconButton,{size:"small","aria-label":"Render tag warnings",sx:{backgroundColor:"rgba(255, 255, 255, 0.9)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"}},children:c.jsx(Yx,{fontSize:"small",color:u.severity==="error"?"error":"warning"})})})})]})}function lN({cell:e,sourceAndPaths:t,resourceUri:n,onQueryChange:r,onSourceChange:o}){const i={query:e.value,malloyResult:e.result?JSON.parse(e.result):void 0,malloyQuery:e.queryInfo?JSON.parse(e.queryInfo):void 0},s=t.findIndex(a=>a.sourceInfo.name===e.sourceName);return c.jsx(kp,{resourceUri:n,sourceAndPaths:t,selectedSourceIndex:s>=0?s:0,existingQuery:i,onQueryChange:r,onSourceChange:o})}function uN({cell:e,editingMalloy:t,editingMarkdown:n,sourceAndPaths:r,resourceUri:o,onCellChange:i,onClose:s,onEdit:a,onDelete:l,addButtonCallback:u}){const[d,f]=W.useState(e.value),[h,p]=W.useState(!1),[m,b]=W.useState(!1),[y,x]=W.useState(),[C]=W.useState(),[v,S]=W.useState(fu()),[I,T]=W.useState(!1),[N,O]=W.useState(e.sourceName?r.findIndex(se=>se.sourceInfo.name===e.sourceName):0),{mode:F}=De.usePublisherTheme();W.useEffect(()=>{e.isMarkdown||$u(e.value,"malloy",F).then(se=>{x(se)})},[e,F]),W.useEffect(()=>{document.documentElement.setAttribute("data-color-mode","light")});const[B,j]=W.useState(!1),D=()=>{l(),j(!1)},H=r.length===0,_=W.useCallback(()=>{const se=r[N],z=se?.modelPath||e.modelPath||"",pe=se?.sourceInfo.name||e.sourceName||"";i({...e,value:e.isMarkdown?d:v.query,result:v.malloyResult?JSON.stringify(v.malloyResult):void 0,queryInfo:v.malloyQuery?JSON.stringify(v.malloyQuery):void 0,sourceName:pe,modelPath:z})},[e,d,v,i,N,r]),L=c.jsx(w.Tooltip,{title:"Delete Cell",children:c.jsx(w.IconButton,{size:"small",onClick:()=>j(!0),children:c.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:c.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m2 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14zM10 11v6M14 11v6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}),$=c.jsxs(w.Dialog,{open:B,onClose:()=>j(!1),children:[c.jsx(w.DialogTitle,{children:"Confirm Delete"}),c.jsx(w.DialogContent,{children:c.jsx(w.Typography,{children:"Are you sure you want to delete this cell?"})}),c.jsxs(w.DialogActions,{children:[c.jsx(w.Button,{onClick:()=>j(!1),children:"Cancel"}),c.jsx(w.Button,{onClick:D,color:"error",children:"Delete"})]})]}),K=()=>{_(),s()},G=e.isMarkdown?c.jsxs(c.Fragment,{children:[n?c.jsx(w.Tooltip,{title:"Save",children:c.jsx(w.IconButton,{size:"small",onClick:K,children:c.jsx(Hl,{})})}):c.jsx(w.Tooltip,{title:"Edit",children:c.jsx(w.IconButton,{size:"small",onClick:a,children:c.jsx(Pm,{})})}),!n&&L]}):c.jsxs(c.Fragment,{children:[!t&&c.jsx(w.Tooltip,{title:h?"Hide Code":"View Code",children:c.jsx(w.IconButton,{size:"small",onClick:()=>{p(!h)},children:c.jsx(vb,{})})}),!t&&e.result&&c.jsx(w.Tooltip,{title:m?"Hide Embedding":"View Embedding",children:c.jsx(w.IconButton,{size:"small",onClick:()=>{b(!m)},children:c.jsx(Kf,{})})}),t&&c.jsx(w.Tooltip,{title:"Save",children:c.jsx(w.IconButton,{size:"small",onClick:K,children:c.jsx(Hl,{})})}),!t&&c.jsx(w.Tooltip,{title:"Edit",children:c.jsx(w.IconButton,{size:"small",onClick:a,children:c.jsx(Pm,{})})}),!t&&L]}),q=t||n,R=n?c.jsx(w.Tooltip,{title:"Save",children:c.jsx(w.IconButton,{size:"small",onClick:K,children:c.jsx(Hl,{})})}):t?c.jsx(w.Tooltip,{title:"Save",children:c.jsx(w.IconButton,{size:"small",onClick:K,children:c.jsx(Hl,{})})}):null,oe=I&&c.jsx(w.Box,{sx:{position:"absolute",top:"4px",right:"4px",display:"flex",gap:"8px",backgroundColor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:"8px",padding:"2px 4px",boxShadow:1,zIndex:10},children:!q&&c.jsxs(c.Fragment,{children:[u(!0),u(!1),G]})||R});return c.jsxs(De.StyledCard,{sx:se=>({position:"relative",marginTop:"5px",marginBottom:"5px",borderWidth:"1.5px",backgroundColor:se.palette.background.paper,minHeight:"50px"}),onMouseEnter:()=>T(!0),onMouseLeave:()=>{T(!1)},children:[oe,e.isMarkdown?c.jsx(c.Fragment,{children:n?c.jsx(Wx,{value:d,preview:"edit",autoFocus:!0,onChange:se=>{f(se),i({...e,value:se})},onBlur:()=>{_(),I||K()}}):c.jsx(w.Box,{sx:{px:.5,pt:0,mt:0,"& h1, & h2, & h3, & h4, & h5, & h6":{mt:.5,mb:.5},"& p":{mt:.5,mb:.5},"& ul, & ol":{mt:.5,mb:.5},"& li":{mt:0,mb:0},"& pre, & code":{mt:.5,mb:.5},"& blockquote":{mt:.5,mb:.5}},children:e.value?c.jsx(w.Box,{onClick:a,sx:{cursor:"pointer"},children:c.jsx(wu,{children:e.value})}):c.jsxs(w.Box,{onClick:a,sx:{cursor:"pointer"},children:[c.jsx(w.Typography,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Markdown is empty"}),c.jsx(w.Typography,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})})}):c.jsxs(c.Fragment,{children:[c.jsx(w.Collapse,{in:m,timeout:"auto",unmountOnExit:!0,children:c.jsx(w.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:c.jsx(w.Typography,{component:"div",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:C}})})}),c.jsx(w.Collapse,{in:h,timeout:"auto",unmountOnExit:!0,children:c.jsx(w.Stack,{sx:{p:"10px",borderRadius:0,flexDirection:"row",justifyContent:"space-between"},children:c.jsx(w.Typography,{component:"div",className:"content",sx:{fontSize:"12px","& .line":{textWrap:"wrap"}},dangerouslySetInnerHTML:{__html:y}})})}),t&&(H?c.jsxs(c.Fragment,{children:[c.jsx(w.Typography,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"No Model Imports"}),c.jsx(w.Typography,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Please add a model import above."})]}):c.jsx(lN,{sourceAndPaths:r,resourceUri:o,onQueryChange:se=>{S(se)},onSourceChange:se=>{O(se)},cell:e})),!t&&e.result&&c.jsx(De.StyledCard,{variant:"outlined",sx:{borderRadius:0},children:c.jsx(Os,{result:e.result,maxHeight:800})}),!t&&!e.result&&c.jsxs(w.Box,{onClick:a,sx:{cursor:"pointer"},children:[c.jsx(w.Typography,{sx:{p:2,textAlign:"center",variant:"subtitle2",fontWeight:"medium"},children:"Explore is empty"}),c.jsx(w.Typography,{sx:{mb:2,textAlign:"center",variant:"body2"},children:"Click to edit."})]})]}),B&&$]})}const Kx=W.createContext(void 0);function cN({children:e,workbookStorage:t}){const n=W.useMemo(()=>({workbookStorage:t}),[t]);return c.jsx(Kx.Provider,{value:n,children:e})}function wp(){const e=W.useContext(Kx);if(!e)throw new Error("useWorkbookStorage must be used within a WorkbookStorageProvider");return e}const Fr=mt(c.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),dN=mt(c.jsx("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3zM7 9l1.41 1.41L11 7.83V16h2V7.83l2.59 2.58L17 9l-5-5z"}));function kn({error:e,context:t}){const n=e.data?.message||"Unknown Error";return c.jsxs(c.Fragment,{children:[t&&c.jsx(w.Typography,{variant:"body2",sx:{p:"10px",m:"auto"},children:t}),c.jsx("pre",{style:{whiteSpace:"pre-wrap",color:"red",padding:"10px",margin:"auto"},children:n})]})}function fN({initialSelectedModels:e,onModelChange:t,resourceUri:n}){const{environmentName:r,packageName:o,versionId:i}=Ht(n),{apiClients:s}=De.useServer(),{data:a,isLoading:l,isSuccess:u,isError:d,error:f}=Xt({queryKey:["models",r,o,i],queryFn:()=>s.models.listModels(r,o,i)}),[h,p]=W.useState(e||[]),[m,b]=W.useState(null);W.useEffect(()=>{p(e||[])},[e]);const y=v=>{const S=h.filter(I=>I!==v);p(S),t(S)},x=v=>{const S=[...h,v];p(S),t(S),b(null)};let C=[];return u&&a?.data&&(C=a.data.filter(v=>!h.includes(v.path)).map(v=>v.path)),d?c.jsx(kn,{error:f,context:`${r} > ${o} > Model Picker`}):c.jsxs(c.Fragment,{children:[c.jsxs(w.FormControl,{fullWidth:!0,children:[l&&c.jsx(w.Typography,{children:"Loading..."}),c.jsxs(w.Stack,{direction:"row",spacing:1,children:[h.map(v=>c.jsx(w.Chip,{label:v,onDelete:()=>y(v),deleteIcon:c.jsx(Fr,{}),sx:{marginBottom:"5px"}},v)),c.jsx(w.Button,{size:"small",startIcon:c.jsx(dN,{}),onClick:v=>b(v.currentTarget),disabled:l||d||C.length===0,children:"Add Model"})]})]}),c.jsxs(w.Menu,{anchorEl:m,open:!!m,onClose:()=>b(null),children:[c.jsx(w.Typography,{variant:"subtitle2",sx:{ml:1},children:"Models"}),c.jsx(w.Divider,{}),C.length===0?c.jsx(w.MenuItem,{disabled:!0,children:"No models available"}):C.map(v=>c.jsx(w.MenuItem,{onClick:()=>x(v),children:c.jsx(w.Typography,{variant:"body2",children:v})},v))]})]})}function Gx(){const e=rT.useNavigate();return(t,n)=>{if(!n||!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&n.button!==1){e(t);return}const r=new URL(t,window.location.href).href;(n.metaKey||n.ctrlKey||n.button===1||n.shiftKey)&&window.open(r,"_blank")}}function pN({workbookPath:e,resourceUri:t}){const n=Gx(),{server:r,getAccessToken:o}=De.useServer(),{apiClients:i}=De.useServer(),{workbookStorage:s}=wp(),{environmentName:a,packageName:l}=Ht(t),[u,d]=W.useState(void 0),[f,h]=W.useState(void 0);if(!s)throw new Error("Workbook storage be provided via WorkbookStorageProvider");const[p,m]=W.useState(),[b,y]=W.useState(),[x,C]=W.useState(),[v,S]=W.useState([]),[I,T]=W.useState(null),[N,O]=W.useState(null),F=!!I,B=()=>{T(null),O(null)},j=(oe,se)=>{p&&(m(p.insertCell(se,{isMarkdown:oe,value:""})),oe?C(se):y(se),B(),console.log("handleAddCell",oe,se))},[D,H]=W.useState(!1),_=()=>{H(!0)},L=async()=>{e&&s&&await s.deleteWorkbook(e).then(()=>{h(void 0),d(void 0)}).catch(oe=>{h(`Error deleting workbook: ${oe.message}`),d(void 0)}),H(!1),n(`/${a}/${l}`)},$=()=>{H(!1)},K=W.useCallback(async()=>{if(!p){console.log("No workbook data ref");return}try{m(await p.saveWorkbook()),h(void 0),d("Workbook saved")}catch(oe){h(`Error saving workbook: ${oe.message}`),d(void 0)}},[p]);if(W.useEffect(()=>{if(!p)return;(async()=>{const se=new Map(v.map(({modelPath:J,sourceInfos:Q})=>[J,Q])),z=[],pe=[];for(const J of p.getModels())se.has(J)?z.push({modelPath:J,sourceInfos:se.get(J)}):(console.log("Fetching model from Publisher",J),pe.push(i.models.getModel(a,l,J,void 0).then(Q=>({modelPath:J,sourceInfos:Q.data.sourceInfos.map(re=>JSON.parse(re))}))));if(pe.length>0){const J=await Promise.all(pe);S([...z,...J])}else S(z)})()},[o,p,l,a,r]),W.useEffect(()=>{e&&ns.loadWorkbook(s,e).then(oe=>{m(oe)})},[e,s]),!p)return c.jsx("div",{children:"Loading..."});const G=oe=>{const se=[];for(const z of oe)for(const pe of z.sourceInfos)se.push({modelPath:z.modelPath,sourceInfo:pe});return se},q=(oe,se)=>c.jsx(w.Button,{size:"small",startIcon:c.jsx(fl,{}),onClick:()=>j(oe,se),variant:"contained",sx:{backgroundColor:z=>z.palette.background.paper,color:z=>z.palette.mode==="dark"?z.palette.grey[100]:z.palette.grey[700],boxShadow:"none","&:hover":{backgroundColor:z=>z.palette.mode==="dark"?z.palette.grey[500]:z.palette.grey[300],boxShadow:"none"}},children:oe?"Markdown":"Explore"}),R=c.jsxs(w.Box,{sx:{display:"flex",gap:1,justifyContent:"center",flex:2},children:[q(!1,p.getCells().length),q(!0,p.getCells().length)]});return c.jsxs(De.StyledCard,{variant:"outlined",children:[c.jsxs(De.StyledCardContent,{children:[c.jsx(w.Box,{sx:{mb:2},children:c.jsx(w.Box,{sx:{minHeight:"24px"},children:f?c.jsx(w.Typography,{color:"error",variant:"body2",children:f}):u?c.jsx(w.Typography,{color:"success",variant:"body2",children:u}):c.jsx("span",{children:" "})})}),c.jsxs(Ui,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[c.jsxs(Ui,{direction:"row",spacing:1,alignItems:"center",children:[c.jsx(w.Typography,{variant:"overline",sx:{fontSize:"13px",fontWeight:"bold",verticalAlign:"middle"},children:"Workbook"}),c.jsx(w.Typography,{variant:"subtitle2",sx:{fontSize:"13px",fontWeight:"normal",verticalAlign:"middle",ml:1},children:`${e.workspace} > ${e.path}`})]}),c.jsxs(Ui,{sx:{display:"flex",flexDirection:"row",gap:1},children:[c.jsx(w.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:c.jsx(hN,{workbookData:p})}),c.jsxs(w.Box,{sx:{display:"flex",alignItems:"center",mt:1,mb:1},children:[c.jsx(w.Button,{color:"error",onClick:_,size:"small",children:"Delete"}),c.jsxs(w.Dialog,{open:D,onClose:$,children:[c.jsx(w.DialogTitle,{children:"Delete Workbook"}),c.jsx(w.DialogContent,{children:c.jsxs(w.DialogContentText,{children:['Are you sure you want to delete the workbook "',e.path,'"? This action cannot be undone.']})}),c.jsxs(w.DialogActions,{children:[c.jsx(w.Button,{onClick:$,color:"primary",size:"small",children:"Cancel"}),c.jsx(w.Button,{onClick:L,color:"error",autoFocus:!0,size:"small",children:"Delete"})]})]})]})]})]}),c.jsx(w.Divider,{}),c.jsxs(Ui,{sx:{display:"flex",flexDirection:"row",width:"100%",mt:2},children:[c.jsx(w.Box,{sx:{flex:1},children:c.jsx(fN,{initialSelectedModels:p.getModels(),onModelChange:oe=>{m(p.setModels(oe)),K()},resourceUri:t})}),c.jsx(w.Box,{sx:{flex:1}})]})]}),c.jsx(De.StyledCardMedia,{children:c.jsxs(Ui,{children:[p.getCells().length===0&&c.jsxs(c.Fragment,{children:[c.jsx(w.Typography,{sx:{textAlign:"center",p:2,variant:"subtitle2",fontWeight:"medium"},children:"Workbook is empty"}),c.jsx(w.Typography,{variant:"body2",sx:{textAlign:"center",mb:2,variant:"body2"},children:"Click the + buttons to add a markdown or code cell."})]}),p.getCells().map((oe,se)=>c.jsx(W.Fragment,{children:c.jsx(uN,{cell:oe,resourceUri:t,addButtonCallback:z=>q(z,se),sourceAndPaths:G(v),editingMarkdown:x===se,editingMalloy:b===se,onDelete:()=>{m(p.deleteCell(se)),K()},onCellChange:z=>{m(p.setCell(se,z))},onEdit:()=>{oe.isMarkdown?C(se):y(se)},onClose:()=>{oe.isMarkdown?C(void 0):y(void 0),K()}},`${se}-${oe.isMarkdown}-${e.workspace}-${e.path}`)},`${se}-${p.getCells().length}`)),R,c.jsxs(w.Menu,{anchorEl:I,open:F,onClose:B,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[c.jsx(w.MenuItem,{onClick:()=>j(!0,N??0),children:"Add Markdown"}),c.jsx(w.MenuItem,{onClick:()=>j(!1,N??0),children:"Add Malloy"})]}),c.jsx(Ui,{sx:{flexDirection:"row",justifyContent:"flex-end",p:1}})]})})]})}function hN({workbookData:e}){const[t,n]=W.useState(!1),r=async()=>{if(!e)return;const o=e.toMalloyWorkbook();try{await navigator.clipboard.writeText(o),n(!0),setTimeout(()=>n(!1),1500)}catch{n(!1),alert("Failed to copy to clipboard")}};return c.jsx(w.Button,{color:"primary",onClick:r,size:"small",children:t?"Copied!":"Export"})}function Qx({onWorkbookClick:e}){const{workbookStorage:t}=wp(),[n,r]=W.useState([]),[o,i]=W.useState(void 0);return W.useEffect(()=>{t&&t.listWorkspaces(!1).then(s=>{const a=[];Promise.all(s.map(async l=>{await t.listWorkbooks(l).then(u=>{a.push(...u)}).catch(u=>{i(`Error listing workbooks: ${u.message}`)})})).then(()=>{r(a),i(void 0)})})},[t]),c.jsxs(c.Fragment,{children:[o&&c.jsx(w.Box,{sx:{mb:2},children:c.jsx(w.Typography,{color:"error",variant:"body2",children:o})}),c.jsx(w.Divider,{}),c.jsx(w.Box,{sx:{maxHeight:"300px",overflow:"auto","&::-webkit-scrollbar":{width:"8px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"rgba(0,0,0,0.2)",borderRadius:"4px"}},children:c.jsxs(w.List,{dense:!0,children:[n.length===0&&c.jsx(w.ListItem,{children:c.jsx(w.ListItemText,{primary:"No workbooks found.",sx:{textAlign:"center"}})}),n.map(s=>c.jsx(w.ListItem,{onClick:a=>e(s,a),sx:{cursor:"pointer","&:hover":{backgroundColor:"action.hover"}},children:c.jsx(w.ListItemText,{primary:s.path})},s.path))]})})]})}const cg="Local";class mN{async listWorkspaces(t){return Promise.resolve([{name:cg,description:"Stored locally- only accessible to this browser",writeable:!0}])}async listWorkbooks(t){const n=[];for(let r=0;r<localStorage.length;r++){const o=localStorage.key(r);n.push({path:o,workspace:cg})}return n}async getWorkbook(t){const n=localStorage.getItem(t.path);if(n===null)throw new Error(`Notebook not found at path: ${t}`);return n}async deleteWorkbook(t){if(localStorage.getItem(t.path)===null)throw new Error(`Notebook not found at path: ${t}`);localStorage.removeItem(t.path)}async saveWorkbook(t,n){localStorage.setItem(t.path,n)}async moveWorkbook(t,n){const r=localStorage.getItem(t.path);if(r===null)throw new Error(`Notebook not found at path: ${t.path}`);localStorage.setItem(n.path,r),localStorage.removeItem(t.path)}}function gN({onWorkbookSelect:e}){const{workbookStorage:t}=wp(),[n,r]=W.useState(""),[o,i]=W.useState(""),[s,a]=W.useState([]),[l,u]=W.useState(null),[d,f]=W.useState(!1),[h,p]=W.useState(!1),m=!!l,b=T=>{u(T.currentTarget)},y=()=>{u(null)},x=()=>{p(!1)},C=()=>{f(!1),r(""),i("")};W.useEffect(()=>{t&&(console.log("fetching workspaces"),t.listWorkspaces(!0).then(T=>{a(T),T.length===1&&i(T[0].name)}).catch(T=>{console.error("Error fetching workspaces:",T),a([])}))},[t]);const v=(T,N)=>{p(!1),e(T,N)},S=T=>{f(!1),e({path:n,workspace:o},T),r(""),i("")},I=s.length===0;return c.jsxs(c.Fragment,{children:[c.jsx(w.Button,{"aria-controls":m?"basic-menu":void 0,"aria-haspopup":"true","aria-expanded":m?"true":void 0,onClick:b,variant:"contained",sx:{height:"40px",px:2,backgroundColor:"#fbbb04","&:hover":{backgroundColor:"#eab308"}},children:"Analyze Package"}),c.jsxs(w.Menu,{id:"basic-menu",anchorEl:l,open:m,onClose:y,MenuListProps:{"aria-labelledby":"basic-button",sx:{py:.5}},children:[c.jsxs(w.MenuItem,{onClick:()=>{f(!0),y()},sx:{py:1,px:2},disabled:I,children:[c.jsx(w.ListItemIcon,{children:c.jsx(On.Add,{fontSize:"small"})}),c.jsxs(w.ListItemText,{children:[c.jsx(w.Typography,{variant:"body2",fontWeight:500,children:"New Workbook"}),I?c.jsx(w.Typography,{variant:"caption",color:"text.secondary",children:"No workspaces available"}):c.jsx(w.Typography,{variant:"caption",color:"text.secondary",children:"Create a new analysis workbook"})]})]}),c.jsxs(w.MenuItem,{onClick:()=>{p(!0),y()},sx:{py:1,px:2},children:[c.jsx(w.ListItemIcon,{children:c.jsx(On.Launch,{fontSize:"small"})}),c.jsxs(w.ListItemText,{children:[c.jsx(w.Typography,{variant:"body2",fontWeight:500,children:"Open Workbook"}),c.jsx(w.Typography,{variant:"caption",color:"text.secondary",children:"Open an existing workbook"})]})]})]}),c.jsxs(w.Dialog,{open:d,onClose:C,maxWidth:"sm",fullWidth:!0,children:[c.jsxs(w.DialogTitle,{sx:{pb:1,pt:2,px:2},children:[c.jsx(w.Typography,{fontWeight:600,sx:{fontSize:"1.5rem",mb:.5},children:"Create New Workbook"}),c.jsx(w.Typography,{variant:"body2",color:"text.secondary",children:"Start a new analysis workbook to explore your data"})]}),c.jsx(w.DialogContent,{sx:{px:2,pb:2},children:c.jsxs(w.Stack,{spacing:2,sx:{mt:1},children:[s.length>1?c.jsxs(w.FormControl,{fullWidth:!0,size:"small",children:[c.jsx(w.InputLabel,{children:"Workspace"}),c.jsx(w.Select,{value:o,label:"Workspace",onChange:T=>i(T.target.value),children:s.map(T=>c.jsx(w.MenuItem,{value:T.name,children:c.jsxs(w.Box,{children:[c.jsx(w.Typography,{variant:"body2",fontWeight:500,children:T.name}),c.jsx(w.Typography,{variant:"caption",color:"text.secondary",children:T.description})]})},T.name))})]}):s.length===1?c.jsxs(w.Box,{sx:T=>({p:2,border:1,borderColor:"divider",borderRadius:1,backgroundColor:T.palette.mode==="dark"?"rgba(255, 255, 255, 0.04)":"grey.50"}),children:[c.jsxs(w.Typography,{variant:"body2",fontWeight:500,gutterBottom:!0,children:["Workspace: ",s[0].name]}),c.jsx(w.Typography,{variant:"caption",color:"text.secondary",children:s[0].description})]}):null,c.jsx(w.FormControl,{fullWidth:!0,children:c.jsx(w.TextField,{label:"Workbook Name",value:n,onChange:T=>r(T.target.value),placeholder:"Enter workbook name...",fullWidth:!0,autoFocus:!0,size:"small"})}),c.jsxs(w.Stack,{direction:"row",spacing:1,justifyContent:"flex-end",children:[c.jsx(w.Button,{onClick:C,variant:"outlined",size:"small",children:"Cancel"}),c.jsx(w.Button,{onClick:T=>S(T),variant:"contained",disabled:!n.trim()||s.length>1&&!o,size:"small",children:"Create Workbook"})]})]})})]}),c.jsxs(w.Dialog,{open:h,onClose:x,maxWidth:"md",fullWidth:!0,children:[c.jsxs(w.DialogTitle,{sx:{pb:1,pt:2,px:2},children:[c.jsx(w.Typography,{fontWeight:600,sx:{mb:.5,fontSize:"1.5rem"},children:"Open Workbook"}),c.jsx(w.Typography,{variant:"body2",color:"text.secondary",children:"Select an existing workbook to continue your analysis"})]}),c.jsx(w.DialogContent,{sx:{px:2,pb:2},children:c.jsx(Qx,{onWorkbookClick:v})})]})]})}const Xx=mt(c.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}));function bN({onSubmit:e,isSubmitting:t,disabled:n,disabledReason:r}){const[o,i]=W.useState(!1),[s,a]=W.useState(!1),l=()=>i(!1),u=async()=>{try{await e({forceRefresh:s}),i(!1)}catch{}},d=c.jsx("span",{children:c.jsx(w.Button,{variant:"contained",startIcon:c.jsx(fl,{}),onClick:()=>i(!0),disabled:n,"aria-label":"New materialization",children:"New materialization"})});return c.jsxs(c.Fragment,{children:[n&&r?c.jsx(w.Tooltip,{title:r,children:d}):d,c.jsxs(w.Dialog,{open:o,onClose:l,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"create-materialization-title",children:[c.jsx(w.DialogTitle,{id:"create-materialization-title",children:"New materialization"}),c.jsxs(w.DialogContent,{children:[c.jsx(w.DialogContentText,{sx:{mb:2},children:"Materialize every persist source in this package: compile, build the tables, and load them so queries serve from the materialized tables."}),c.jsx(w.FormGroup,{children:c.jsx(w.FormControlLabel,{control:c.jsx(w.Switch,{checked:s,onChange:f=>a(f.target.checked)}),label:"Force refresh (rebuild even if unchanged)"})})]}),c.jsxs(w.DialogActions,{children:[c.jsx(w.Button,{onClick:l,children:"Cancel"}),c.jsx(w.Button,{variant:"contained",loading:t,onClick:u,children:"Materialize"})]})]})]})}function Tf({children:e}){return c.jsx(w.Typography,{variant:"caption",component:"h6",sx:{display:"block",textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:"text.secondary",mb:1},children:e})}function Ja(e){return e===De.MaterializationStatus.Pending||e===De.MaterializationStatus.ManifestRowsReady}function yN(e){return e===De.MaterializationStatus.ManifestFileReady||e===De.MaterializationStatus.Failed||e===De.MaterializationStatus.Cancelled}function Zx(e){switch(e){case De.MaterializationStatus.ManifestFileReady:return"Done";case De.MaterializationStatus.Failed:return"Failed";case De.MaterializationStatus.Cancelled:return"Cancelled";case De.MaterializationStatus.Pending:case De.MaterializationStatus.ManifestRowsReady:return"Pending";default:return"Unknown"}}function Jx(e){switch(e){case De.MaterializationStatus.ManifestRowsReady:return"info";case De.MaterializationStatus.ManifestFileReady:return"success";case De.MaterializationStatus.Failed:return"error";case De.MaterializationStatus.Cancelled:return"warning";case De.MaterializationStatus.Pending:default:return"default"}}function e2(e){return e.metadata??{}}function xN(e){return e.trigger==="SCHEDULER"?"Scheduled":"Manual"}function t2(e,t){if(!e)return"-";const n=new Date(e).getTime(),r=t?new Date(t).getTime():Date.now(),o=Math.max(0,r-n);if(o<1e3)return`${o}ms`;const i=Math.round(o/1e3);if(i<60)return`${i}s`;const s=Math.floor(i/60),a=i%60;if(s<60)return`${s}m ${a}s`;const l=Math.floor(s/60),u=s%60;return`${l}h ${u}m`}function Sf(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":t.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function CN(e){if(!e)return"-";const t=new Date(e).getTime(),n=Math.round((Date.now()-t)/1e3);if(n<60)return"just now";const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function EN({entries:e,builtAt:t}){const n=Object.entries(e??{});return c.jsxs(w.Box,{children:[c.jsxs(w.Stack,{direction:"row",alignItems:"baseline",justifyContent:"space-between",children:[c.jsx(Tf,{children:"Build manifest"}),t&&c.jsxs(w.Typography,{variant:"caption",color:"text.secondary",children:["Built ",Sf(t)]})]}),n.length===0?c.jsx(w.Typography,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"No materialized tables yet."}):c.jsxs(w.Table,{size:"small",children:[c.jsx(w.TableHead,{children:c.jsxs(w.TableRow,{children:[c.jsx(w.TableCell,{children:"Source"}),c.jsx(w.TableCell,{children:"Table name"}),c.jsx(w.TableCell,{children:"Connection"}),c.jsx(w.TableCell,{children:"Realization"}),c.jsx(w.TableCell,{align:"right",children:"Rows"})]})}),c.jsx(w.TableBody,{children:n.map(([r,o])=>c.jsxs(w.TableRow,{children:[c.jsx(w.TableCell,{sx:{fontFamily:De.MONO_FONT_FAMILY},children:o.sourceName??r}),c.jsx(w.TableCell,{sx:{fontFamily:De.MONO_FONT_FAMILY},children:o.physicalTableName??"-"}),c.jsx(w.TableCell,{sx:{fontFamily:De.MONO_FONT_FAMILY},children:o.connectionName??"-"}),c.jsx(w.TableCell,{children:o.realization??"-"}),c.jsx(w.TableCell,{align:"right",children:o.rowCount??"-"})]},r))})]})]})}const Hu=mt([c.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),c.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")]),vN=mt(c.jsx("path",{d:"M9 11.24V7.5C9 6.12 10.12 5 11.5 5S14 6.12 14 7.5v3.74c1.21-.81 2-2.18 2-3.74C16 5.01 13.99 3 11.5 3S7 5.01 7 7.5c0 1.56.79 2.93 2 3.74m9.84 4.63-4.54-2.26c-.17-.07-.35-.11-.54-.11H13v-6c0-.83-.67-1.5-1.5-1.5S10 6.67 10 7.5v10.74c-3.6-.76-3.54-.75-3.67-.75-.31 0-.59.13-.79.33l-.79.8 4.94 4.94c.27.27.65.44 1.06.44h6.79c.75 0 1.33-.55 1.44-1.28l.75-5.27c.01-.07.02-.14.02-.2 0-.62-.38-1.16-.91-1.38"}));function n2({meta:e}){const t=e.trigger==="SCHEDULER";return c.jsx(w.Tooltip,{title:t?"Fired by the materialization schedule":"Triggered manually",children:c.jsx(w.Chip,{size:"small",variant:"outlined",color:t?"info":"default",icon:t?c.jsx(Hu,{fontSize:"small"}):c.jsx(vN,{fontSize:"small"}),label:xN(e)})})}function r2({materialization:e,buildPlan:t,showBuildPlan:n=!0,onClose:r}){const o=e?e2(e):{},i=Object.values(t?.sources??{});return c.jsx(w.Dialog,{open:e!==null,onClose:r,maxWidth:"md",fullWidth:!0,"aria-labelledby":"materialization-detail-title",children:e&&c.jsxs(c.Fragment,{children:[c.jsxs(w.DialogTitle,{sx:{pr:6,pb:1.5},id:"materialization-detail-title",children:[c.jsxs(w.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{mb:.75},children:[c.jsx(w.Chip,{size:"small",label:Zx(e.status),color:Jx(e.status),variant:Ja(e.status)?"filled":"outlined"}),c.jsx(n2,{meta:o})]}),c.jsx(w.Typography,{variant:"subtitle1",sx:{fontWeight:600},children:e.packageName??"Materialization"}),c.jsx(w.Typography,{variant:"caption",color:"text.secondary",sx:{fontFamily:De.MONO_FONT_FAMILY,wordBreak:"break-all"},children:e.id}),c.jsx(w.IconButton,{"aria-label":"close",onClick:r,sx:{position:"absolute",right:8,top:8},children:c.jsx(Fr,{fontSize:"small"})})]}),c.jsxs(w.DialogContent,{dividers:!0,children:[c.jsxs(w.Box,{sx:{bgcolor:"action.hover",borderRadius:2,p:2,mb:3,display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:2},children:[c.jsx(na,{label:"Started",value:Sf(e.startedAt??e.createdAt)}),c.jsx(na,{label:"Completed",value:Sf(e.completedAt)}),c.jsx(na,{label:"Duration",value:t2(e.startedAt,e.completedAt)}),c.jsx(na,{label:"Sources",value:`${o.sourcesBuilt??0} built · ${o.sourcesReused??0} reused`}),c.jsx(na,{label:"Force refresh",value:o.forceRefresh?"Yes":"No"})]}),e.error&&c.jsxs(w.Box,{sx:{borderRadius:2,p:2,mb:3,border:"1px solid",borderColor:"error.main"},children:[c.jsx(Tf,{children:c.jsx(w.Box,{component:"span",sx:{color:"error.main"},children:"Error"})}),c.jsx(w.Typography,{variant:"body2",sx:{fontFamily:De.MONO_FONT_FAMILY,whiteSpace:"pre-wrap"},children:e.error})]}),n&&c.jsxs(w.Box,{sx:{mb:3},children:[c.jsx(Tf,{children:"Build plan"}),i.length===0?c.jsx(w.Typography,{variant:"body2",color:"text.secondary",sx:{fontStyle:"italic"},children:"This package has no persist sources."}):c.jsxs(w.Table,{size:"small",children:[c.jsx(w.TableHead,{children:c.jsxs(w.TableRow,{children:[c.jsx(w.TableCell,{children:"Source"}),c.jsx(w.TableCell,{children:"Connection"}),c.jsx(w.TableCell,{children:"Dialect"}),c.jsx(w.TableCell,{align:"right",children:"Columns"}),c.jsx(w.TableCell,{children:"Source Entity ID"})]})}),c.jsx(w.TableBody,{children:i.map(s=>c.jsxs(w.TableRow,{children:[c.jsx(w.TableCell,{sx:{fontFamily:De.MONO_FONT_FAMILY},children:s.name}),c.jsx(w.TableCell,{sx:{fontFamily:De.MONO_FONT_FAMILY},children:s.connectionName}),c.jsx(w.TableCell,{children:s.dialect??"-"}),c.jsx(w.TableCell,{align:"right",children:s.columns?.length??0}),c.jsx(w.TableCell,{sx:{fontFamily:De.MONO_FONT_FAMILY,fontSize:"0.75rem",wordBreak:"break-all",maxWidth:220},children:s.sourceEntityId})]},s.sourceID))})]})]}),c.jsx(EN,{entries:e.manifest?.entries,builtAt:e.manifest?.builtAt})]})]})})}function na({label:e,value:t}){return c.jsxs(w.Box,{children:[c.jsx(w.Typography,{variant:"caption",color:"text.secondary",display:"block",children:e}),c.jsx(w.Typography,{variant:"body2",children:t})]})}const TN=mt(c.jsx("path",{d:"M6 6h12v12H6z"})),o2=Ee.oneOfType([Ee.func,Ee.object]);function dg(e){try{return e.matches(":focus-visible")}catch{}return!1}const fg={};function i2(e,t){const n=M.useRef(fg);return n.current===fg&&(n.current=e(t)),n}class zu{static create(){return new zu}static use(){const t=i2(zu.create).current,[n,r]=M.useState(!1);return t.shouldMount=n,t.setShouldMount=r,M.useEffect(t.mountEffect,[n]),t}constructor(){this.ref={current:null},this.mounted=null,this.didMount=!1,this.shouldMount=!1,this.setShouldMount=null}mount(){return this.mounted||(this.mounted=kN(),this.shouldMount=!0,this.setShouldMount(this.shouldMount)),this.mounted}mountEffect=()=>{this.shouldMount&&!this.didMount&&this.ref.current!==null&&(this.didMount=!0,this.mounted.resolve())};start(...t){this.mount().then(()=>this.ref.current?.start(...t))}stop(...t){this.mount().then(()=>this.ref.current?.stop(...t))}pulsate(...t){this.mount().then(()=>this.ref.current?.pulsate(...t))}}function SN(){return zu.use()}function kN(){let e,t;const n=new Promise((r,o)=>{e=r,t=o});return n.resolve=e,n.reject=t,n}function kf(e,t){return kf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},kf(e,t)}function Dp(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,kf(e,t)}function wN(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function DN(e,t){e.classList?e.classList.add(t):wN(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function pg(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function IN(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=pg(e.className,t):e.setAttribute("class",pg(e.className&&e.className.baseVal||"",t))}const hg={disabled:!1},Uu=W.createContext(null);var s2=function(t){return t.scrollTop},Da="unmounted",ei="exited",ti="entering",Qi="entered",wf="exiting",Dr=(function(e){Dp(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var s=o,a=s&&!s.isMounting?r.enter:r.appear,l;return i.appearStatus=null,r.in?a?(l=ei,i.appearStatus=ti):l=Qi:r.unmountOnExit||r.mountOnEnter?l=Da:l=ei,i.state={status:l},i.nextCallback=null,i}t.getDerivedStateFromProps=function(o,i){var s=o.in;return s&&i.status===Da?{status:ei}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(o){var i=null;if(o!==this.props){var s=this.state.status;this.props.in?s!==ti&&s!==Qi&&(i=ti):(s===ti||s===Qi)&&(i=wf)}this.updateStatus(!1,i)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,i,s,a;return i=s=a=o,o!=null&&typeof o!="number"&&(i=o.exit,s=o.enter,a=o.appear!==void 0?o.appear:s),{exit:i,enter:s,appear:a}},n.updateStatus=function(o,i){if(o===void 0&&(o=!1),i!==null)if(this.cancelNextCallback(),i===ti){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:Ta.findDOMNode(this);s&&s2(s)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===ei&&this.setState({status:Da})},n.performEnter=function(o){var i=this,s=this.props.enter,a=this.context?this.context.isMounting:o,l=this.props.nodeRef?[a]:[Ta.findDOMNode(this),a],u=l[0],d=l[1],f=this.getTimeouts(),h=a?f.appear:f.enter;if(!o&&!s||hg.disabled){this.safeSetState({status:Qi},function(){i.props.onEntered(u)});return}this.props.onEnter(u,d),this.safeSetState({status:ti},function(){i.props.onEntering(u,d),i.onTransitionEnd(h,function(){i.safeSetState({status:Qi},function(){i.props.onEntered(u,d)})})})},n.performExit=function(){var o=this,i=this.props.exit,s=this.getTimeouts(),a=this.props.nodeRef?void 0:Ta.findDOMNode(this);if(!i||hg.disabled){this.safeSetState({status:ei},function(){o.props.onExited(a)});return}this.props.onExit(a),this.safeSetState({status:wf},function(){o.props.onExiting(a),o.onTransitionEnd(s.exit,function(){o.safeSetState({status:ei},function(){o.props.onExited(a)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(o,i){i=this.setNextCallback(i),this.setState(o,i)},n.setNextCallback=function(o){var i=this,s=!0;return this.nextCallback=function(a){s&&(s=!1,i.nextCallback=null,o(a))},this.nextCallback.cancel=function(){s=!1},this.nextCallback},n.onTransitionEnd=function(o,i){this.setNextCallback(i);var s=this.props.nodeRef?this.props.nodeRef.current:Ta.findDOMNode(this),a=o==null&&!this.props.addEndListener;if(!s||a){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],u=l[0],d=l[1];this.props.addEndListener(u,d)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===Da)return null;var i=this.props,s=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var a=Ze(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return W.createElement(Uu.Provider,{value:null},typeof s=="function"?s(o,a):W.cloneElement(W.Children.only(s),a))},t})(W.Component);Dr.contextType=Uu;Dr.propTypes={};function Yi(){}Dr.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Yi,onEntering:Yi,onEntered:Yi,onExit:Yi,onExiting:Yi,onExited:Yi};Dr.UNMOUNTED=Da;Dr.EXITED=ei;Dr.ENTERING=ti;Dr.ENTERED=Qi;Dr.EXITING=wf;var AN=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return DN(t,r)})},Pd=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return IN(t,r)})},Ip=(function(e){Dp(t,e);function t(){for(var r,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];return r=e.call.apply(e,[this].concat(i))||this,r.appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(a,l){var u=r.resolveArguments(a,l),d=u[0],f=u[1];r.removeClasses(d,"exit"),r.addClass(d,f?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(a,l)},r.onEntering=function(a,l){var u=r.resolveArguments(a,l),d=u[0],f=u[1],h=f?"appear":"enter";r.addClass(d,h,"active"),r.props.onEntering&&r.props.onEntering(a,l)},r.onEntered=function(a,l){var u=r.resolveArguments(a,l),d=u[0],f=u[1],h=f?"appear":"enter";r.removeClasses(d,h),r.addClass(d,h,"done"),r.props.onEntered&&r.props.onEntered(a,l)},r.onExit=function(a){var l=r.resolveArguments(a),u=l[0];r.removeClasses(u,"appear"),r.removeClasses(u,"enter"),r.addClass(u,"exit","base"),r.props.onExit&&r.props.onExit(a)},r.onExiting=function(a){var l=r.resolveArguments(a),u=l[0];r.addClass(u,"exit","active"),r.props.onExiting&&r.props.onExiting(a)},r.onExited=function(a){var l=r.resolveArguments(a),u=l[0];r.removeClasses(u,"exit"),r.addClass(u,"exit","done"),r.props.onExited&&r.props.onExited(a)},r.resolveArguments=function(a,l){return r.props.nodeRef?[r.props.nodeRef.current,a]:[a,l]},r.getClassNames=function(a){var l=r.props.classNames,u=typeof l=="string",d=u&&l?l+"-":"",f=u?""+d+a:l[a],h=u?f+"-active":l[a+"Active"],p=u?f+"-done":l[a+"Done"];return{baseClassName:f,activeClassName:h,doneClassName:p}},r}var n=t.prototype;return n.addClass=function(o,i,s){var a=this.getClassNames(i)[s+"ClassName"],l=this.getClassNames("enter"),u=l.doneClassName;i==="appear"&&s==="done"&&u&&(a+=" "+u),s==="active"&&o&&s2(o),a&&(this.appliedClasses[i][s]=a,AN(o,a))},n.removeClasses=function(o,i){var s=this.appliedClasses[i],a=s.base,l=s.active,u=s.done;this.appliedClasses[i]={},a&&Pd(o,a),l&&Pd(o,l),u&&Pd(o,u)},n.render=function(){var o=this.props;o.classNames;var i=Ze(o,["classNames"]);return W.createElement(Dr,Y({},i,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t})(W.Component);Ip.defaultProps={classNames:""};Ip.propTypes={};function ON(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ap(e,t){var n=function(i){return t&&W.isValidElement(i)?t(i):i},r=Object.create(null);return e&&W.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function MN(e,t){e=e||{},t=t||{};function n(d){return d in t?t[d]:e[d]}var r=Object.create(null),o=[];for(var i in e)i in t?o.length&&(r[i]=o,o=[]):o.push(i);var s,a={};for(var l in t){if(r[l])for(s=0;s<r[l].length;s++){var u=r[l][s];a[r[l][s]]=n(u)}a[l]=n(l)}for(s=0;s<o.length;s++)a[o[s]]=n(o[s]);return a}function oi(e,t,n){return n[t]!=null?n[t]:e.props[t]}function PN(e,t){return Ap(e.children,function(n){return W.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:oi(n,"appear",e),enter:oi(n,"enter",e),exit:oi(n,"exit",e)})})}function RN(e,t,n){var r=Ap(e.children),o=MN(t,r);return Object.keys(o).forEach(function(i){var s=o[i];if(W.isValidElement(s)){var a=i in t,l=i in r,u=t[i],d=W.isValidElement(u)&&!u.props.in;l&&(!a||d)?o[i]=W.cloneElement(s,{onExited:n.bind(null,s),in:!0,exit:oi(s,"exit",e),enter:oi(s,"enter",e)}):!l&&a&&!d?o[i]=W.cloneElement(s,{in:!1}):l&&a&&W.isValidElement(u)&&(o[i]=W.cloneElement(s,{onExited:n.bind(null,s),in:u.props.in,exit:oi(s,"exit",e),enter:oi(s,"enter",e)}))}}),o}var NN=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},FN={component:"div",childFactory:function(t){return t}},El=(function(e){Dp(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var s=i.handleExited.bind(ON(i));return i.state={contextValue:{isMounting:!0},handleExited:s,firstRender:!0},i}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(o,i){var s=i.children,a=i.handleExited,l=i.firstRender;return{children:l?PN(o,a):RN(o,s,a),firstRender:!1}},n.handleExited=function(o,i){var s=Ap(this.props.children);o.key in s||(o.props.onExited&&o.props.onExited(i),this.mounted&&this.setState(function(a){var l=Y({},a.children);return delete l[o.key],{children:l}}))},n.render=function(){var o=this.props,i=o.component,s=o.childFactory,a=Ze(o,["component","childFactory"]),l=this.state.contextValue,u=NN(this.state.children).map(s);return delete a.appear,delete a.enter,delete a.exit,i===null?W.createElement(Uu.Provider,{value:l},u):W.createElement(Uu.Provider,{value:l},W.createElement(i,a,u))},t})(W.Component);El.propTypes={};El.defaultProps=FN;const LN=[];function _N(e){M.useEffect(e,LN)}class Op{static create(){return new Op}currentId=null;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,n()},t)}clear=()=>{this.currentId!==null&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function Sc(){const e=i2(Op.create).current;return _N(e.disposeEffect),e}function BN(e){const{className:t,classes:n,pulsate:r=!1,rippleX:o,rippleY:i,rippleSize:s,in:a,onExited:l,timeout:u}=e,[d,f]=M.useState(!1),h=Ue(t,n.ripple,n.rippleVisible,r&&n.ripplePulsate),p={width:s,height:s,top:-(s/2)+i,left:-(s/2)+o},m=Ue(n.child,d&&n.childLeaving,r&&n.childPulsate);return!a&&!d&&f(!0),M.useEffect(()=>{if(!a&&l!=null){const b=setTimeout(l,u);return()=>{clearTimeout(b)}}},[l,a,u]),c.jsx("span",{className:h,style:p,children:c.jsx("span",{className:m})})}const pr=We("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),Df=550,jN=80,$N=Ot.keyframes`
|
|
94
94
|
0% {
|
|
95
95
|
transform: scale(0);
|
|
@@ -218,7 +218,7 @@ import {${t.sourceName}}" from '${t.modelPath}'"
|
|
|
218
218
|
`:r==="t"?" ":r==="r"?"\r":r):e}_t.extend(PC);function VU(e){const t=(e.annotations??[]).filter(r=>r.trim().startsWith("#("));if(t.length===0)return;const n=[];for(const r of t){const o=r.trim(),i=o.match(/description="([^"]*)"/);if(i){n.push(i[1]);continue}const s=o.replace(/^#\(/,"").replace(/\)\s*$/,"").trim();s&&n.push(s)}return n.length>0?n.join(`
|
|
219
219
|
`):void 0}function WU({given:e,value:t,onChange:n}){const r=e.name??"",o=e.type??"string",i=VU(e),s=zU(o,e.default),a=s!==void 0?`Default: ${s===""?"(empty)":s}`:void 0,l=i||a?c.jsxs(c.Fragment,{children:[i,i&&a?c.jsx("br",{}):null,a]}):void 0;if(o==="boolean"){const f=typeof t=="boolean",h=e.default?.trim()==="true",p=f?t:h;return c.jsxs(w.FormControl,{children:[c.jsxs(w.Stack,{direction:"row",alignItems:"center",children:[c.jsx(w.FormControlLabel,{control:c.jsx(w.Checkbox,{checked:p,onChange:m=>n(m.target.checked)}),label:r}),f&&c.jsx(w.IconButton,{size:"small","aria-label":"clear value",onClick:()=>n(null),edge:"end",children:c.jsx(YC,{fontSize:"small"})})]}),l&&c.jsx(w.FormHelperText,{children:l})]})}if(o==="number"){const f=typeof t=="number"?t:"";return c.jsx(w.TextField,{label:r,type:"number",value:f,onChange:h=>{const p=h.target.value;n(p===""?null:Number(p))},placeholder:s,helperText:l,slotProps:{input:{endAdornment:f!==""&&c.jsx(G1,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"})}if(o==="date"||o==="timestamp"||o==="timestamptz"){const f=t instanceof Date?_t.utc(t):null;return c.jsx(Xu,{dateAdapter:Bf,children:c.jsx(vu,{label:r,value:f,onChange:h=>n(h?h.toDate():null),slotProps:{textField:{fullWidth:!0,size:"small",helperText:l},field:{clearable:!0,onClear:()=>n(null)}}})})}if(o.startsWith("array<")){const f=Array.isArray(t)?t.map(String):[];return c.jsx(w.Autocomplete,{multiple:!0,freeSolo:!0,options:[],value:f,onChange:(h,p)=>n(p.length===0?null:p),renderInput:h=>c.jsx(w.TextField,{...h,label:r,size:"small",placeholder:f.length===0?s:void 0,helperText:l}),fullWidth:!0})}const u=typeof t=="string"?t:"",d=t!=null;return c.jsx(w.TextField,{label:r,value:u,onChange:f=>n(f.target.value),placeholder:d?void 0:s??(o.startsWith("filter<")?o:void 0),helperText:l,slotProps:{input:{endAdornment:d&&c.jsx(G1,{onClear:()=>n(null)})}},fullWidth:!0,size:"small"})}function G1({onClear:e}){return c.jsx(w.InputAdornment,{position:"end",children:c.jsx(w.IconButton,{size:"small","aria-label":"clear value",onClick:e,edge:"end",children:c.jsx(YC,{fontSize:"small"})})})}function qU({givens:e,values:t,onChange:n,onClearAll:r}){if(e.length===0)return null;const o=t.size>0;return c.jsxs(w.Paper,{elevation:0,sx:{p:3,backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[c.jsxs(w.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:2},children:[c.jsx(w.Typography,{variant:"subtitle2",sx:{fontWeight:600,color:"#333"},children:"Parameters"}),o&&c.jsx(w.Button,{variant:"text",size:"small",onClick:r,sx:{textTransform:"none"},children:"Reset"})]}),c.jsx(w.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))",gap:3},children:e.map(i=>c.jsx(w.Box,{children:c.jsx(WU,{given:i,value:i.name?t.get(i.name):void 0,onChange:s=>i.name&&n(i.name,s)})},i.name))})]})}const YU=mt(c.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"}));function dh(e){const{environmentName:t,packageName:n}=Ht(e.resourceUri);if(!t||!n)throw new Error("Environment and Package name must be provided for query embedding.");return JSON.stringify({...e})}function KU({embeddedQueryResult:e}){const{query:t,sourceName:n,queryName:r,resourceUri:o,height:i}=JSON.parse(e),{modelPath:s}=Ht(o);if(!s||!t&&(!r||!n)||typeof s!="string")throw new Error("Invalid embedded query result: "+e);return c.jsx(KC,{query:t,sourceName:n,queryName:r,resourceUri:o,height:i})}function KC({query:e,sourceName:t,queryName:n,resourceUri:r,height:o=400}){const{modelPath:i,environmentName:s,packageName:a,versionId:l}=Ht(r),{apiClients:u}=De.useServer();if(!s||!a)throw new Error("No environment or package name provided. A resource URI must be provided.");const{data:d,isSuccess:f,isError:h,error:p}=Xt({queryKey:[r,e,t,n],queryFn:()=>u.models.executeQueryModel(s,a,i,{query:e,sourceName:t,queryName:n,versionId:l}),...De.CHART_RESULT_QUERY_OPTIONS});return c.jsxs(c.Fragment,{children:[!f&&!h&&c.jsx(Sn,{text:"Fetching Query Results..."}),f&&c.jsx(W.Suspense,{fallback:c.jsx("div",{children:"Loading..."}),children:c.jsx(Os,{result:d.data.result,maxHeight:o,renderLogs:d.data.renderLogs})}),h&&c.jsx(kn,{context:`${s} > ${a} > ${i}`,error:p})]})}function GU({href:e,title:t,children:n,envName:r,pkgName:o,sourceDir:i,onNavigate:s}){const a=!!e&&/^[a-z][a-z0-9+.-]*:/i.test(e);if(!(!!e&&!a&&!e.startsWith("/")&&!e.startsWith("#"))||!e){const h=a&&!/^(https?|mailto|tel):/i.test(e??"");return c.jsx("a",{href:h?void 0:e,title:t,...a?{target:"_blank",rel:"noopener noreferrer"}:{},children:n})}const u=new URL(e,`https://malloy.invalid/${i}`),d=u.pathname.slice(1)+u.search+u.hash,f=`/${r}/${o}/${d}`;return c.jsx("a",{href:f,title:t,onClick:s?h=>{h.preventDefault(),s(f,h)}:void 0,children:n})}function QU({cell:e,hideCodeCellIcon:t,hideEmbeddingIcon:n,resourceUri:r,index:o,maxResultSize:i,isExecuting:s,onNavigate:a}){const[l,u]=W.useState(!1),[d,f]=W.useState(!1),[h,p]=W.useState(!1),[m,b]=W.useState(),[y,x]=W.useState(),[C,v]=W.useState(!1),[S,I]=W.useState(""),{environmentName:T,packageName:N,modelPath:O}=Ht(r),F=O&&O.includes("/")?O.slice(0,O.lastIndexOf("/")+1):"",B={overrides:{a:{component:GU,props:{envName:T,pkgName:N,sourceDir:F,onNavigate:a}}}},j=/import\s*\{([^}]+)\}\s*from\s*['"`][^'"`]+['"`]/,D=/import\s*(?:\{[^}]*\}\s*from\s*)?['"`]([^'"`]+)['"`]/,H=R=>R.split(`
|
|
220
220
|
`).filter(oe=>!oe.trimStart().startsWith("##")).join(`
|
|
221
|
-
`),_=!!e.text&&(j.test(e.text)||D.test(e.text)),L=()=>{if(!e.newSources||e.newSources.length===0)return 0;let R=[],oe="";if(e.text){const se=e.text.match(j);se&&(R=se[1].split(",").map(pe=>pe.trim()));const z=e.text.match(D);z&&(oe=z[1].trim())}for(let se=0;se<e.newSources.length;se++)try{const z=JSON.parse(e.newSources[se]);if(R.length>0&&R.includes(z.name)||oe&&oe===z.path)return se}catch{continue}return 0},$=e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:r}:void 0,K=dh({query:e.text,resourceUri:r}),{mode:G}=De.usePublisherTheme();W.useEffect(()=>{e.type==="code"&&$u(H(e.text),"malloy",G).then(R=>{b(R)})},[e,G]),W.useEffect(()=>{$u(K,"typescript",G).then(R=>{x(R)})},[K,G]);const q=()=>{const R=window.location.href;navigator.clipboard.writeText(R).then(()=>I("URL copied to clipboard!")).catch(()=>I("Failed to copy URL"))};return e.type==="markdown"&&c.jsx(De.CleanNotebookCell,{children:c.jsxs(w.Box,{sx:R=>({"& h1, & h2, & h3, & h4, & h5, & h6":{fontWeight:"600",color:R.palette.text.primary,marginBottom:"8px",marginTop:"16px"},"& h1":{fontSize:"28px"},"& h2":{fontSize:"24px"},"& h3":{fontSize:"20px"},"& p":{color:R.palette.text.primary,lineHeight:"1.7",marginBottom:"8px",fontSize:"16px"},"& ul, & ol":{color:R.palette.text.primary,lineHeight:"1.7",marginBottom:"8px",fontSize:"16px"},"& li":{marginBottom:"4px"}}),children:[o===0?c.jsxs(w.Stack,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",children:[c.jsx(wu,{options:B,children:e.text}),c.jsx(w.Tooltip,{title:"Click to copy link",children:c.jsx(Kf,{sx:{fontSize:"24px",color:"text.secondary",cursor:"pointer",marginTop:"26px"},onClick:q})})]}):c.jsx(wu,{options:B,children:e.text}),c.jsx(w.Snackbar,{open:S!=="",autoHideDuration:6e3,onClose:()=>I(""),message:S})]})})||e.type==="code"&&c.jsxs(De.CleanNotebookCell,{children:[(!t||!n&&e.result||e.newSources&&e.newSources.length>0)&&c.jsx(w.Stack,{sx:{flexDirection:"column",gap:"8px",marginBottom:"2px"},children:e.newSources&&e.newSources.length>0&&c.jsx(De.CleanMetricCard,{sx:{position:"relative",padding:"0"},children:c.jsxs(w.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"24px",paddingRight:"8px"},children:[m&&c.jsx("span",{dangerouslySetInnerHTML:{__html:m},style:{fontFamily:"monospace",fontSize:"14px",flex:1,marginRight:"8px"}}),_&&c.jsx(w.IconButton,{sx:{backgroundColor:"rgba(255, 255, 255, 0.9)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"},width:"32px",height:"32px",flexShrink:0},onClick:()=>v(!0),children:c.jsx(Zu,{sx:{fontSize:"18px",color:"grey.700"}})})]})})}),c.jsx(lh,{open:C,onClose:()=>v(!1),title:"Data Sources",hasValidImport:_,resourceUri:r,data:$,initialSelectedSourceIndex:L()}),c.jsxs(w.Dialog,{open:l,onClose:()=>u(!1),maxWidth:"lg",fullWidth:!0,children:[c.jsxs(w.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Malloy Code",c.jsx(w.IconButton,{onClick:()=>u(!1),sx:{color:"text.secondary"},children:c.jsx(Fr,{})})]}),c.jsx(w.DialogContent,{children:c.jsx(w.Box,{sx:R=>({border:`1px solid ${R.palette.divider}`,borderRadius:"8px",padding:"16px",fontFamily:"monospace",fontSize:"14px",lineHeight:"1.5",overflow:"auto",maxHeight:"70vh",backgroundColor:R.palette.background.paper,color:R.palette.text.primary}),children:c.jsx("pre",{className:"code-display",style:{margin:0},dangerouslySetInnerHTML:{__html:m}})})})]}),c.jsxs(w.Dialog,{open:d,onClose:()=>f(!1),maxWidth:"lg",fullWidth:!0,children:[c.jsxs(w.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Embeddable Code",c.jsx(w.IconButton,{onClick:()=>f(!1),sx:{color:"text.secondary"},children:c.jsx(Fr,{})})]}),c.jsx(w.DialogContent,{children:c.jsxs(w.Stack,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"flex-start"},children:[c.jsx(w.Typography,{component:"div",sx:{fontSize:"12px",fontFamily:"monospace","& .line":{textWrap:"wrap"},flex:1},dangerouslySetInnerHTML:{__html:y}}),c.jsx(w.Tooltip,{title:"Copy Embeddable Code",children:c.jsx(w.IconButton,{sx:{width:"24px",height:"24px",marginLeft:"8px",color:"text.secondary"},onClick:()=>{navigator.clipboard.writeText(K)},children:c.jsx(YU,{})})})]})})]}),c.jsx(HC,{open:h,onClose:()=>p(!1),result:e.result||"",title:"Results"}),s&&!e.result&&!_&&!(e.newSources&&e.newSources.length>0)&&c.jsx(De.CleanMetricCard,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:200},children:c.jsx(w.CircularProgress,{size:32})}),e.result&&c.jsxs(De.CleanMetricCard,{sx:{position:"relative"},children:[c.jsx(w.Box,{sx:{paddingTop:"24px"},children:c.jsx(Os,{result:e.result,maxHeight:700,maxResultSize:i})}),c.jsxs(w.Stack,{sx:{position:"absolute",top:"-12px",right:"8px",flexDirection:"row",gap:"8px",alignItems:"center",zIndex:2},children:[!t&&c.jsx(w.IconButton,{sx:{backgroundColor:"rgba(255, 255, 255, 0.9)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"},width:"32px",height:"32px"},onClick:R=>{R.stopPropagation(),u(!0)},children:c.jsx(vb,{sx:{fontSize:"18px",color:"grey.700"}})}),c.jsx(w.IconButton,{sx:{backgroundColor:"rgba(255, 255, 255, 0.9)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"},width:"32px",height:"32px"},onClick:()=>p(!0),children:c.jsx(Zu,{sx:{fontSize:"18px",color:"grey.700"}})})]})]})]})}const XU=4;function GC({resourceUri:e,maxResultSize:t=0,retrievalFn:n,onNavigate:r}){const{apiClients:o}=De.useServer(),{environmentName:i,packageName:s,versionId:a,modelPath:l}=Ht(e),{data:u,isSuccess:d,isError:f,error:h}=Xt({queryKey:[e],queryFn:async()=>(await o.notebooks.getNotebook(i,s,l,a)).data}),[p,m]=W.useState([]),[b,y]=W.useState(!1),[x,C]=W.useState(null),v=W.useMemo(()=>u?NC(u.annotations):null,[u]),S=W.useMemo(()=>u?.notebookCells?LC(u.notebookCells):null,[u]),I=W.useMemo(()=>S?.sourceInfoMap??new Map,[S]),T=S?.modelPath??null,N=W.useMemo(()=>{const pe=new Map;if(!u?.sources)return pe;for(const J of u.sources)if(J.name&&J.filters&&J.filters.length>0){const Q=J.filters.filter(re=>!re.implicit);Q.length>0&&pe.set(J.name,Q)}return pe},[u]),O=N.size>0,F=W.useMemo(()=>{if(O&&T){const pe=[];for(const[J,Q]of N)for(const re of Q??[]){if(!re.dimension||!re.type)continue;let ne;const ae=re.dimensionType;ae==="boolean"?ne="Boolean":ae==="date"||ae==="timestamp"||ae==="timestamptz"?ne="DateMinMax":ae==="number"?ne=re.type==="equal"||re.type==="in"?"Star":"MinMax":ne={equal:"Star",in:"Star",like:"Star",greater_than:"MinMax",less_than:"MinMax"}[re.type]??"Star";const Z={equal:"Equals",in:"Equals",like:"Contains",greater_than:ne==="DateMinMax"?"After":"Greater Than",less_than:ne==="DateMinMax"?"Before":"Less Than"}[re.type],me=re.name!==re.dimension?re.name:void 0;pe.push({source:J,model:T,dimensionName:re.dimension,filterType:ne,label:me,filterName:re.name??re.dimension,defaultMatchType:Z,required:re.required??!1})}return pe}return!v||I.size===0||!T?[]:_C(I,v.filters,T)},[O,N,v,I,T]),{filterStates:B,updateFilter:j,getActiveFilters:D}=ch({dimensionSpecs:F}),H=W.useMemo(()=>D(),[B,D]),_=qC(u),{givenValues:L,updateGiven:$,clearAll:K}=WC(_);W.useMemo(()=>{const pe=new Map;for(const J of F){const Q=xo(J);pe.set(Q,J.source)}return pe},[F]);const{data:G}=uh({environment:i,package:s,dimensionSpecs:F,versionId:a,enabled:F.length>0}),q=W.useCallback(pe=>{if(pe.length===0)return;const J=re=>re instanceof Date?re.toISOString().slice(0,10):String(re),Q={};for(const re of pe){const ne=re.filterName??re.dimensionName,ae=re.value;Array.isArray(ae)?Q[ne]=ae.map(J):ae!=null&&(Q[ne]=J(ae))}return Object.keys(Q).length>0?JSON.stringify(Q):void 0},[]),R=W.useCallback(pe=>{if(pe.size===0)return;const J=re=>re instanceof Date?re.toISOString().slice(0,10):Array.isArray(re)?re.map(ne=>J(ne)):re,Q={};return pe.forEach((re,ne)=>{re!=null&&(Q[ne]=J(re))}),Object.keys(Q).length>0?JSON.stringify(Q):void 0},[]),oe=W.useCallback(async(pe=[],J=new Map)=>{if(!d||!u?.notebookCells)return;m(ne=>ne.length===0?u.notebookCells.map(ae=>({...ae})):ne.map(ae=>({...ae,result:void 0}))),y(!0),C(null);const Q=O?q(pe):void 0,re=R(J);try{const ne=[];for(let ie=0;ie<u.notebookCells.length;ie++){const Z=u.notebookCells[ie];if(Z.type==="markdown")continue;const me=ie,le=async()=>{try{const Ie=(await o.notebooks.executeNotebookCell(i,s,l,me,a,Q,void 0,re)).data,Ce=Ie.result,we=Z.newSources||Ie.newSources;m(ye=>{const ze=[...ye];return ze[me]||(ze[me]={...Z}),ze[me]={...ze[me],result:Ce,newSources:we},ze})}catch(ue){console.error(`Error executing cell ${me}:`,ue)}};ne.push(le)}const ae=[];for(const ie of ne){const Z=ie().then(()=>{ae.splice(ae.indexOf(Z),1)});ae.push(Z),ae.length>=XU&&await Promise.race(ae)}await Promise.all(ae)}catch(ne){console.error("Error executing notebook cells:",ne),C(ne)}finally{y(!1)}},[d,u,O,q,R,i,s,l,a,o.notebooks]);W.useEffect(()=>{!d||!u?.notebookCells||oe([],new Map)},[d,u,oe]);const se=W.useRef("");W.useEffect(()=>{const pe=JSON.stringify({filters:H.map(J=>({dim:J.dimensionName,type:J.matchType,val:J.value,val2:J.value2})),givens:Array.from(L.entries()).sort(([J],[Q])=>J.localeCompare(Q)).map(([J,Q])=>[J,Q instanceof Date?Q.toISOString().slice(0,10):Q])});if(pe!==se.current){if(se.current===""&&H.length===0&&L.size===0){se.current=pe;return}b||(se.current=pe,oe(H,L))}},[H,L,b,oe]);const z=W.useCallback(pe=>J=>{j(pe,J)},[j]);return F.some(pe=>pe.filterType==="Retrieval"),c.jsx(De.CleanNotebookContainer,{children:c.jsx(De.CleanNotebookSection,{children:c.jsxs(w.Stack,{spacing:3,component:"section",children:[c.jsx(qU,{givens:_,values:L,onChange:$,onClearAll:K}),F.length>0&&G&&c.jsxs(w.Paper,{elevation:0,sx:{p:3,backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[c.jsx(w.Typography,{variant:"subtitle2",sx:{fontWeight:600,mb:2,color:"#333"},children:"Filters"}),c.jsx(w.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))",gap:3},children:F.map(pe=>{const J=xo(pe),Q=G.get(J)||[],re=B.get(J);return pe.filterType==="Retrieval"&&!n?null:c.jsx(w.Box,{children:c.jsx(RC,{spec:pe,values:Q,selection:re?.selection,onChange:z(J),retrievalFn:n})},J)})})]}),!d&&!f&&c.jsx(Sn,{text:"Fetching Notebook..."}),d&&(p.length>0?p:u?.notebookCells||[]).map((pe,J)=>c.jsx(QU,{cell:pe,index:J,resourceUri:e,maxResultSize:t,isExecuting:b,onNavigate:r},J)),f&&h.status===404&&c.jsxs(w.Typography,{variant:"body2",sx:{color:"text.secondary"},children:[c.jsx("code",{children:`${i} > ${s} > ${l}`})," ","not found."]}),f&&h.status!==404&&c.jsx(kn,{error:h,context:`${i} > ${s} > ${l}`}),x&&c.jsx(kn,{error:{message:x.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})})})}const QC=mt(c.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),ZU="publisher:resize";function JU(e){return typeof e=="object"&&e!==null&&e.type===ZU&&typeof e.height=="number"}function XC(e){return e.replace(/\/api\/v0\/?$/,"")}function Ca({type:e,size:t=18,sx:n,...r}){return c.jsxs(Ou,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:[e==="report"&&c.jsx(eV,{}),e==="model"&&c.jsx(tV,{}),e==="data"&&c.jsx(nV,{}),e==="materialization"&&c.jsx(rV,{}),e==="page"&&c.jsx(oV,{})]})}function eV(){return c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M14 3 H6 a2 2 0 0 0 -2 2 v14 a2 2 0 0 0 2 2 h12 a2 2 0 0 0 2 -2 V9 z"}),c.jsx("path",{d:"M14 3 v4 a2 2 0 0 0 2 2 h4"}),c.jsx("path",{d:"M8 17 v-3"}),c.jsx("path",{d:"M12 17 v-6"}),c.jsx("path",{d:"M16 17 v-4"})]})}function tV(){return c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M12 3 L4 7 v10 l8 4 l8 -4 V7 z"}),c.jsx("path",{d:"M4 7 l8 4 l8 -4"}),c.jsx("path",{d:"M12 11 v10"})]})}function nV(){return c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),c.jsx("path",{d:"M3.5 9.5 H20.5"}),c.jsx("path",{d:"M9.5 3.5 V20.5"})]})}function rV(){return c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M12 3 L21 7.5 L12 12 L3 7.5 Z"}),c.jsx("path",{d:"M3 12 L12 16.5 L21 12"}),c.jsx("path",{d:"M3 16.5 L12 21 L21 16.5"})]})}function oV(){return c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),c.jsx("path",{d:"M3.5 9.5 H20.5"}),c.jsx("path",{d:"M7 13.5 H17"}),c.jsx("path",{d:"M7 16.5 H13"})]})}const Q1="README.malloynb";function iV({onClickPackageFile:e,resourceUri:t,retrievalFn:n}){const{apiClients:r,server:o}=De.useServer(),i=e??(O=>{window.location.href=O}),{environmentName:s,packageName:a,versionId:l}=Ht(t),[u,d]=W.useState(null),f=Xt({queryKey:["package",s,a,l],queryFn:()=>r.packages.getPackage(s,a,l,!1)}),h=Xt({queryKey:["notebooks",s,a,l],queryFn:()=>r.notebooks.listNotebooks(s,a,l)}),p=Xt({queryKey:["models",s,a,l],queryFn:()=>r.models.listModels(s,a,l)}),m=Xt({queryKey:["databases",s,a,l],queryFn:()=>r.databases.listDatabases(s,a,l)}),y=Xt({queryKey:["pages",s,a],queryFn:async()=>{try{return await r.pages.listPages(s,a)}catch(O){const F=O?.response?.status;if(F===404||F===void 0)return{data:[]};throw O}}}).data?.data??[],x=(h.data?.data??[]).slice().sort((O,F)=>O.path.localeCompare(F.path)),C=(p.data?.data??[]).slice().sort((O,F)=>O.path.localeCompare(F.path)),v=(m.data?.data??[]).slice().sort((O,F)=>O.path.localeCompare(F.path)),S=f.data?.data?.description??"",I=x.some(O=>O.path===Q1),T=Cl({environmentName:s,packageName:a,versionId:l,modelPath:Q1}),N=!h.isSuccess&&!h.isError;return f.isError?c.jsx(kn,{error:f.error,context:`${s} > ${a}`}):c.jsxs(w.Container,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[c.jsxs(w.Box,{sx:{mb:4},children:[c.jsxs(w.Link,{onClick:O=>i(`/${s}/`,O),underline:"none",sx:{display:"inline-flex",alignItems:"center",gap:.5,cursor:"pointer",color:"text.secondary",fontSize:"0.875rem",mb:2,"&:hover":{color:"primary.main"}},children:[c.jsx(Xx,{sx:{fontSize:18}}),"Back to ",s]}),c.jsx(w.Typography,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em",mb:.5},children:a}),S&&c.jsx(w.Typography,{variant:"body2",color:"text.secondary",children:S})]}),N&&c.jsx(Sn,{text:"Loading package..."}),!N&&c.jsxs(c.Fragment,{children:[c.jsxs(Ea,{title:"Governed Reports",count:x.length,children:[x.map(O=>c.jsx(va,{icon:c.jsx(Ca,{type:"report"}),tint:De.MALLOY_BRAND.teal,label:O.path,onClick:F=>i(`/${s}/${a}/${O.path}`,F)},O.path)),x.length===0&&c.jsx(Wd,{label:"No notebooks"})]}),y.length>0&&c.jsx(Ea,{title:"Pages",count:y.length,children:y.map(O=>{const F=!!O.title&&O.title!==O.path,B=`${XC(o)}${O.resource}`;return c.jsx(va,{icon:c.jsx(Ca,{type:"page"}),tint:De.MALLOY_BRAND.teal,label:F?O.title:O.path,rightLabel:F?O.path:void 0,onClick:j=>{e?e(`/${s}/${a}/pages/${O.path}`,j):j&&(j.metaKey||j.ctrlKey)?window.open(B,"_blank"):window.location.href=B},trailingAction:c.jsx(w.Tooltip,{title:"Open standalone in new tab",children:c.jsx(w.IconButton,{size:"small",href:B,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",onClick:j=>j.stopPropagation(),sx:{color:"text.secondary"},children:c.jsx(QC,{fontSize:"small"})})})},O.path)})}),c.jsxs(Ea,{title:"Semantic Models",count:C.length,children:[C.map(O=>c.jsx(va,{icon:c.jsx(Ca,{type:"model"}),tint:De.MALLOY_BRAND.orange,label:O.path,onClick:F=>i(`/${s}/${a}/${O.path}`,F)},O.path)),C.length===0&&c.jsx(Wd,{label:"No models"})]}),c.jsxs(Ea,{title:"Package Data",count:v.length,children:[v.map(O=>c.jsx(va,{icon:c.jsx(Ca,{type:"data"}),tint:De.MALLOY_BRAND.darkBlue,label:O.path,rightLabel:sV(O.info.rowCount),onClick:()=>d(O)},O.path)),v.length===0&&c.jsx(Wd,{label:"No data files"})]}),c.jsx(Ea,{title:"Materializations",children:c.jsx(va,{icon:c.jsx(Ca,{type:"materialization"}),tint:De.MALLOY_BRAND.teal,label:"Materializations",onClick:O=>i(`/${s}/${a}/materializations`,O)})}),I&&c.jsx(w.Box,{sx:{mt:6},children:c.jsx(GC,{resourceUri:T,retrievalFn:n,onNavigate:i})})]}),c.jsxs(w.Dialog,{open:u!==null,onClose:()=>d(null),maxWidth:"sm",fullWidth:!0,children:[c.jsxs(w.DialogTitle,{sx:{pr:6},children:[u?.path,c.jsx(w.IconButton,{"aria-label":"close",onClick:()=>d(null),sx:{position:"absolute",right:8,top:8},children:c.jsx(Fr,{fontSize:"small"})})]}),c.jsx(w.DialogContent,{children:u?.info?.columns&&c.jsxs(w.Table,{size:"small",children:[c.jsx(w.TableHead,{children:c.jsxs(w.TableRow,{children:[c.jsx(w.TableCell,{children:"Column"}),c.jsx(w.TableCell,{children:"Type"})]})}),c.jsx(w.TableBody,{children:u.info.columns.map(O=>c.jsxs(w.TableRow,{children:[c.jsx(w.TableCell,{component:"th",scope:"row",children:O.name}),c.jsx(w.TableCell,{children:O.type})]},O.name))})]})})]})]})}function Ea({title:e,count:t,children:n}){return c.jsxs(w.Box,{sx:{mb:4},children:[c.jsxs(w.Stack,{direction:"row",alignItems:"baseline",spacing:1,sx:{mb:1},children:[c.jsx(w.Typography,{variant:"h6",sx:{fontWeight:600,letterSpacing:"-0.025em"},children:e}),t!==void 0&&c.jsxs(w.Typography,{variant:"caption",color:"text.secondary",children:["(",t,")"]})]}),c.jsx(w.Box,{children:n})]})}function va({icon:e,tint:t,label:n,rightLabel:r,onClick:o,trailingAction:i}){const s=!!o,a=l=>{o&&(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),o(l))};return c.jsxs(w.Box,{onClick:o,onKeyDown:s?a:void 0,role:s?"button":void 0,tabIndex:s?0:void 0,sx:l=>({display:"flex",alignItems:"center",gap:1.5,py:1,px:1,mx:-1,cursor:s?"pointer":"default",borderRadius:1.5,transition:"background-color 0.1s","&:hover":s?{backgroundColor:l.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}:void 0,"&:focus-visible":s?{outline:"2px solid",outlineColor:"primary.main",outlineOffset:2}:void 0}),children:[c.jsx(w.Box,{sx:{width:32,height:32,borderRadius:1,bgcolor:t,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e}),c.jsx(w.Typography,{variant:"body2",sx:{fontFamily:De.MONO_FONT_FAMILY,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),r&&c.jsx(w.Typography,{variant:"caption",color:"text.secondary",sx:{flexShrink:0},children:r}),i&&c.jsx(w.Box,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:i})]})}function Wd({label:e}){return c.jsx(w.Typography,{variant:"body2",color:"text.secondary",sx:{py:1,fontStyle:"italic"},children:e})}function sV(e){return e>=1e9?`${(e/1e9).toFixed(1)} B rows`:e>=1e6?`${(e/1e6).toFixed(1)} M rows`:e>=1e3?`${(e/1e3).toFixed(1)} K rows`:`${e} rows`}function aV(e){return Ge("MuiCollapse",e)}We("MuiCollapse",["root","horizontal","vertical","entered","hidden","wrapper","wrapperInner"]);const lV=e=>{const{orientation:t,classes:n}=e,r={root:["root",`${t}`],entered:["entered"],hidden:["hidden"],wrapper:["wrapper",`${t}`],wrapperInner:["wrapperInner",`${t}`]};return Ke(r,aV,n)},uV=fe("div",{name:"MuiCollapse",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.state==="entered"&&t.entered,n.state==="exited"&&!n.in&&n.collapsedSize==="0px"&&t.hidden]}})(ft(({theme:e})=>({height:0,overflow:"hidden",transition:e.transitions.create("height"),variants:[{props:{orientation:"horizontal"},style:{height:"auto",width:0,transition:e.transitions.create("width")}},{props:{state:"entered"},style:{height:"auto",overflow:"visible"}},{props:{state:"entered",orientation:"horizontal"},style:{width:"auto"}},{props:({ownerState:t})=>t.state==="exited"&&!t.in&&t.collapsedSize==="0px",style:{visibility:"hidden"}}]}))),cV=fe("div",{name:"MuiCollapse",slot:"Wrapper"})({display:"flex",width:"100%",variants:[{props:{orientation:"horizontal"},style:{width:"auto",height:"100%"}}]}),dV=fe("div",{name:"MuiCollapse",slot:"WrapperInner"})({width:"100%",variants:[{props:{orientation:"horizontal"},style:{width:"auto",height:"100%"}}]}),sl=M.forwardRef(function(t,n){const r=ut({props:t,name:"MuiCollapse"}),{addEndListener:o,children:i,className:s,collapsedSize:a="0px",component:l,easing:u,in:d,onEnter:f,onEntered:h,onEntering:p,onExit:m,onExited:b,onExiting:y,orientation:x="vertical",style:C,timeout:v=pb.standard,TransitionComponent:S=Dr,...I}=r,T={...r,orientation:x,collapsedSize:a},N=lV(T),O=Lo(),F=Sc(),B=M.useRef(null),j=M.useRef(),D=typeof a=="number"?`${a}px`:a,H=x==="horizontal",_=H?"width":"height",L=M.useRef(null),$=vt(n,L),K=Q=>re=>{if(Q){const ne=L.current;re===void 0?Q(ne):Q(ne,re)}},G=()=>B.current?B.current[H?"clientWidth":"clientHeight"]:0,q=K((Q,re)=>{B.current&&H&&(B.current.style.position="absolute"),Q.style[_]=D,f&&f(Q,re)}),R=K((Q,re)=>{const ne=G();B.current&&H&&(B.current.style.position="");const{duration:ae,easing:ie}=ms({style:C,timeout:v,easing:u},{mode:"enter"});if(v==="auto"){const Z=O.transitions.getAutoHeightDuration(ne);Q.style.transitionDuration=`${Z}ms`,j.current=Z}else Q.style.transitionDuration=typeof ae=="string"?ae:`${ae}ms`;Q.style[_]=`${ne}px`,Q.style.transitionTimingFunction=ie,p&&p(Q,re)}),oe=K((Q,re)=>{Q.style[_]="auto",h&&h(Q,re)}),se=K(Q=>{Q.style[_]=`${G()}px`,m&&m(Q)}),z=K(b),pe=K(Q=>{const re=G(),{duration:ne,easing:ae}=ms({style:C,timeout:v,easing:u},{mode:"exit"});if(v==="auto"){const ie=O.transitions.getAutoHeightDuration(re);Q.style.transitionDuration=`${ie}ms`,j.current=ie}else Q.style.transitionDuration=typeof ne=="string"?ne:`${ne}ms`;Q.style[_]=D,Q.style.transitionTimingFunction=ae,y&&y(Q)}),J=Q=>{v==="auto"&&F.start(j.current||0,Q),o&&o(L.current,Q)};return c.jsx(S,{in:d,onEnter:q,onEntered:oe,onEntering:R,onExit:se,onExited:z,onExiting:pe,addEndListener:J,nodeRef:L,timeout:v==="auto"?null:v,...I,children:(Q,{ownerState:re,...ne})=>c.jsx(uV,{as:l,className:Ue(N.root,s,{entered:N.entered,exited:!d&&D==="0px"&&N.hidden}[Q]),style:{[H?"minWidth":"minHeight"]:D,...C},ref:$,ownerState:{...T,state:Q},...ne,children:c.jsx(cV,{ownerState:{...T,state:Q},className:N.wrapper,ref:B,children:c.jsx(dV,{ownerState:{...T,state:Q},className:N.wrapperInner,children:i})})})})});sl&&(sl.muiSupportAuto=!0);function ZC(e){return Kt}const JC=M.createContext(null);function fV(e){const{value:t,children:n}=e;return c.jsx(JC.Provider,{value:t,children:t.wrapRoot({children:n,instance:t.instance})})}const Si=()=>{const e=M.useContext(JC);if(e==null)throw new Error(["MUI X: Could not find the Tree View context.","It looks like you rendered your component outside of a SimpleTreeView or RichTreeView parent component.","This can also happen if you are bundling multiple versions of the Tree View."].join(`
|
|
221
|
+
`),_=!!e.text&&(j.test(e.text)||D.test(e.text)),L=()=>{if(!e.newSources||e.newSources.length===0)return 0;let R=[],oe="";if(e.text){const se=e.text.match(j);se&&(R=se[1].split(",").map(pe=>pe.trim()));const z=e.text.match(D);z&&(oe=z[1].trim())}for(let se=0;se<e.newSources.length;se++)try{const z=JSON.parse(e.newSources[se]);if(R.length>0&&R.includes(z.name)||oe&&oe===z.path)return se}catch{continue}return 0},$=e.newSources&&e.newSources.length>0?{sourceInfos:e.newSources,resource:r}:void 0,K=dh({query:e.text,resourceUri:r}),{mode:G}=De.usePublisherTheme();W.useEffect(()=>{e.type==="code"&&$u(H(e.text),"malloy",G).then(R=>{b(R)})},[e,G]),W.useEffect(()=>{$u(K,"typescript",G).then(R=>{x(R)})},[K,G]);const q=()=>{const R=window.location.href;navigator.clipboard.writeText(R).then(()=>I("URL copied to clipboard!")).catch(()=>I("Failed to copy URL"))};return e.type==="markdown"&&c.jsx(De.CleanNotebookCell,{children:c.jsxs(w.Box,{sx:R=>({"& h1, & h2, & h3, & h4, & h5, & h6":{fontWeight:"600",color:R.palette.text.primary,marginBottom:"8px",marginTop:"16px"},"& h1":{fontSize:"28px"},"& h2":{fontSize:"24px"},"& h3":{fontSize:"20px"},"& p":{color:R.palette.text.primary,lineHeight:"1.7",marginBottom:"8px",fontSize:"16px"},"& ul, & ol":{color:R.palette.text.primary,lineHeight:"1.7",marginBottom:"8px",fontSize:"16px"},"& li":{marginBottom:"4px"}}),children:[o===0?c.jsxs(w.Stack,{direction:"row",alignItems:"flex-start",justifyContent:"space-between",children:[c.jsx(wu,{options:B,children:e.text}),c.jsx(w.Tooltip,{title:"Click to copy link",children:c.jsx(Kf,{sx:{fontSize:"24px",color:"text.secondary",cursor:"pointer",marginTop:"26px"},onClick:q})})]}):c.jsx(wu,{options:B,children:e.text}),c.jsx(w.Snackbar,{open:S!=="",autoHideDuration:6e3,onClose:()=>I(""),message:S})]})})||e.type==="code"&&c.jsxs(De.CleanNotebookCell,{children:[(!t||!n&&e.result||e.newSources&&e.newSources.length>0)&&c.jsx(w.Stack,{sx:{flexDirection:"column",gap:"8px",marginBottom:"2px"},children:e.newSources&&e.newSources.length>0&&c.jsx(De.CleanMetricCard,{sx:{position:"relative",padding:"0"},children:c.jsxs(w.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"24px",paddingRight:"8px"},children:[m&&c.jsx("span",{dangerouslySetInnerHTML:{__html:m},style:{fontFamily:"monospace",fontSize:"14px",flex:1,marginRight:"8px"}}),_&&c.jsx(w.IconButton,{sx:{backgroundColor:"rgba(255, 255, 255, 0.9)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"},width:"32px",height:"32px",flexShrink:0},onClick:()=>v(!0),children:c.jsx(Zu,{sx:{fontSize:"18px",color:"grey.700"}})})]})})}),c.jsx(lh,{open:C,onClose:()=>v(!1),title:"Data Sources",hasValidImport:_,resourceUri:r,data:$,initialSelectedSourceIndex:L()}),c.jsxs(w.Dialog,{open:l,onClose:()=>u(!1),maxWidth:"lg",fullWidth:!0,children:[c.jsxs(w.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Malloy Code",c.jsx(w.IconButton,{onClick:()=>u(!1),sx:{color:"text.secondary"},children:c.jsx(Fr,{})})]}),c.jsx(w.DialogContent,{children:c.jsx(w.Box,{sx:R=>({border:`1px solid ${R.palette.divider}`,borderRadius:"8px",padding:"16px",fontFamily:"monospace",fontSize:"14px",lineHeight:"1.5",overflow:"auto",maxHeight:"70vh",backgroundColor:R.palette.background.paper,color:R.palette.text.primary}),children:c.jsx("pre",{className:"code-display",style:{margin:0},dangerouslySetInnerHTML:{__html:m}})})})]}),c.jsxs(w.Dialog,{open:d,onClose:()=>f(!1),maxWidth:"lg",fullWidth:!0,children:[c.jsxs(w.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Embeddable Code",c.jsx(w.IconButton,{onClick:()=>f(!1),sx:{color:"text.secondary"},children:c.jsx(Fr,{})})]}),c.jsx(w.DialogContent,{children:c.jsxs(w.Stack,{sx:{flexDirection:"row",justifyContent:"space-between",alignItems:"flex-start"},children:[c.jsx(w.Typography,{component:"div",sx:{fontSize:"12px",fontFamily:"monospace","& .line":{textWrap:"wrap"},flex:1},dangerouslySetInnerHTML:{__html:y}}),c.jsx(w.Tooltip,{title:"Copy Embeddable Code",children:c.jsx(w.IconButton,{sx:{width:"24px",height:"24px",marginLeft:"8px",color:"text.secondary"},onClick:()=>{navigator.clipboard.writeText(K)},children:c.jsx(YU,{})})})]})})]}),c.jsx(HC,{open:h,onClose:()=>p(!1),result:e.result||"",title:"Results"}),s&&!e.result&&!_&&!(e.newSources&&e.newSources.length>0)&&c.jsx(De.CleanMetricCard,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:200},children:c.jsx(w.CircularProgress,{size:32})}),e.result&&c.jsxs(De.CleanMetricCard,{sx:{position:"relative"},children:[c.jsx(w.Box,{sx:{paddingTop:"24px"},children:c.jsx(Os,{result:e.result,maxHeight:700,maxResultSize:i})}),c.jsxs(w.Stack,{sx:{position:"absolute",top:"-12px",right:"8px",flexDirection:"row",gap:"8px",alignItems:"center",zIndex:2},children:[!t&&c.jsx(w.IconButton,{sx:{backgroundColor:"rgba(255, 255, 255, 0.9)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"},width:"32px",height:"32px"},onClick:R=>{R.stopPropagation(),u(!0)},children:c.jsx(vb,{sx:{fontSize:"18px",color:"grey.700"}})}),c.jsx(w.IconButton,{sx:{backgroundColor:"rgba(255, 255, 255, 0.9)","&:hover":{backgroundColor:"rgba(255, 255, 255, 1)"},width:"32px",height:"32px"},onClick:()=>p(!0),children:c.jsx(Zu,{sx:{fontSize:"18px",color:"grey.700"}})})]})]})]})}const XU=4;function GC({resourceUri:e,maxResultSize:t=0,retrievalFn:n,onNavigate:r}){const{apiClients:o}=De.useServer(),{environmentName:i,packageName:s,versionId:a,modelPath:l}=Ht(e),{data:u,isSuccess:d,isError:f,error:h}=Xt({queryKey:[e],queryFn:async()=>(await o.notebooks.getNotebook(i,s,l,a)).data}),[p,m]=W.useState([]),[b,y]=W.useState(!1),[x,C]=W.useState(null),v=W.useMemo(()=>u?NC(u.annotations):null,[u]),S=W.useMemo(()=>u?.notebookCells?LC(u.notebookCells):null,[u]),I=W.useMemo(()=>S?.sourceInfoMap??new Map,[S]),T=S?.modelPath??null,N=W.useMemo(()=>{const pe=new Map;if(!u?.sources)return pe;for(const J of u.sources)if(J.name&&J.filters&&J.filters.length>0){const Q=J.filters.filter(re=>!re.implicit);Q.length>0&&pe.set(J.name,Q)}return pe},[u]),O=N.size>0,F=W.useMemo(()=>{if(O&&T){const pe=[];for(const[J,Q]of N)for(const re of Q??[]){if(!re.dimension||!re.type)continue;let ne;const ae=re.dimensionType;ae==="boolean"?ne="Boolean":ae==="date"||ae==="timestamp"||ae==="timestamptz"?ne="DateMinMax":ae==="number"?ne=re.type==="equal"||re.type==="in"?"Star":"MinMax":ne={equal:"Star",in:"Star",like:"Star",greater_than:"MinMax",less_than:"MinMax"}[re.type]??"Star";const Z={equal:"Equals",in:"Equals",like:"Contains",greater_than:ne==="DateMinMax"?"After":"Greater Than",less_than:ne==="DateMinMax"?"Before":"Less Than"}[re.type],me=re.name!==re.dimension?re.name:void 0;pe.push({source:J,model:T,dimensionName:re.dimension,filterType:ne,label:me,filterName:re.name??re.dimension,defaultMatchType:Z,required:re.required??!1})}return pe}return!v||I.size===0||!T?[]:_C(I,v.filters,T)},[O,N,v,I,T]),{filterStates:B,updateFilter:j,getActiveFilters:D}=ch({dimensionSpecs:F}),H=W.useMemo(()=>D(),[B,D]),_=qC(u),{givenValues:L,updateGiven:$,clearAll:K}=WC(_);W.useMemo(()=>{const pe=new Map;for(const J of F){const Q=xo(J);pe.set(Q,J.source)}return pe},[F]);const{data:G}=uh({environment:i,package:s,dimensionSpecs:F,versionId:a,enabled:F.length>0}),q=W.useCallback(pe=>{if(pe.length===0)return;const J=re=>re instanceof Date?re.toISOString().slice(0,10):String(re),Q={};for(const re of pe){const ne=re.filterName??re.dimensionName,ae=re.value;Array.isArray(ae)?Q[ne]=ae.map(J):ae!=null&&(Q[ne]=J(ae))}return Object.keys(Q).length>0?JSON.stringify(Q):void 0},[]),R=W.useCallback(pe=>{if(pe.size===0)return;const J=re=>re instanceof Date?re.toISOString().slice(0,10):Array.isArray(re)?re.map(ne=>J(ne)):re,Q={};return pe.forEach((re,ne)=>{re!=null&&(Q[ne]=J(re))}),Object.keys(Q).length>0?JSON.stringify(Q):void 0},[]),oe=W.useCallback(async(pe=[],J=new Map)=>{if(!d||!u?.notebookCells)return;m(ne=>ne.length===0?u.notebookCells.map(ae=>({...ae})):ne.map(ae=>({...ae,result:void 0}))),y(!0),C(null);const Q=O?q(pe):void 0,re=R(J);try{const ne=[];for(let ie=0;ie<u.notebookCells.length;ie++){const Z=u.notebookCells[ie];if(Z.type==="markdown")continue;const me=ie,le=async()=>{try{const Ie=(await o.notebooks.executeNotebookCell(i,s,l,me,a,Q,void 0,re)).data,Ce=Ie.result,we=Z.newSources||Ie.newSources;m(ye=>{const ze=[...ye];return ze[me]||(ze[me]={...Z}),ze[me]={...ze[me],result:Ce,newSources:we},ze})}catch(ue){console.error(`Error executing cell ${me}:`,ue)}};ne.push(le)}const ae=[];for(const ie of ne){const Z=ie().then(()=>{ae.splice(ae.indexOf(Z),1)});ae.push(Z),ae.length>=XU&&await Promise.race(ae)}await Promise.all(ae)}catch(ne){console.error("Error executing notebook cells:",ne),C(ne)}finally{y(!1)}},[d,u,O,q,R,i,s,l,a,o.notebooks]);W.useEffect(()=>{!d||!u?.notebookCells||oe([],new Map)},[d,u,oe]);const se=W.useRef("");W.useEffect(()=>{const pe=JSON.stringify({filters:H.map(J=>({dim:J.dimensionName,type:J.matchType,val:J.value,val2:J.value2})),givens:Array.from(L.entries()).sort(([J],[Q])=>J.localeCompare(Q)).map(([J,Q])=>[J,Q instanceof Date?Q.toISOString().slice(0,10):Q])});if(pe!==se.current){if(se.current===""&&H.length===0&&L.size===0){se.current=pe;return}b||(se.current=pe,oe(H,L))}},[H,L,b,oe]);const z=W.useCallback(pe=>J=>{j(pe,J)},[j]);return F.some(pe=>pe.filterType==="Retrieval"),c.jsx(De.CleanNotebookContainer,{children:c.jsx(De.CleanNotebookSection,{children:c.jsxs(w.Stack,{spacing:3,component:"section",children:[c.jsx(qU,{givens:_,values:L,onChange:$,onClearAll:K}),F.length>0&&G&&c.jsxs(w.Paper,{elevation:0,sx:{p:3,backgroundColor:"transparent",border:"none",boxShadow:"none"},children:[c.jsx(w.Typography,{variant:"subtitle2",sx:{fontWeight:600,mb:2,color:"#333"},children:"Filters"}),c.jsx(w.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(250px, 1fr))",gap:3},children:F.map(pe=>{const J=xo(pe),Q=G.get(J)||[],re=B.get(J);return pe.filterType==="Retrieval"&&!n?null:c.jsx(w.Box,{children:c.jsx(RC,{spec:pe,values:Q,selection:re?.selection,onChange:z(J),retrievalFn:n})},J)})})]}),!d&&!f&&c.jsx(Sn,{text:"Fetching Notebook..."}),d&&(p.length>0?p:u?.notebookCells||[]).map((pe,J)=>c.jsx(QU,{cell:pe,index:J,resourceUri:e,maxResultSize:t,isExecuting:b,onNavigate:r},J)),f&&h.status===404&&c.jsxs(w.Typography,{variant:"body2",sx:{color:"text.secondary"},children:[c.jsx("code",{children:`${i} > ${s} > ${l}`})," ","not found."]}),f&&h.status!==404&&c.jsx(kn,{error:h,context:`${i} > ${s} > ${l}`}),x&&c.jsx(kn,{error:{message:x.message,status:500,name:"ExecutionError"},context:"Notebook Execution"})]})})})}const QC=mt(c.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),ZU="publisher:resize";function JU(e){return typeof e=="object"&&e!==null&&e.type===ZU&&typeof e.height=="number"}function XC(e){return e.replace(/\/api\/v0\/?$/,"")}function Ca({type:e,size:t=18,sx:n,...r}){return c.jsxs(Ou,{...r,viewBox:"0 0 24 24",sx:{width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",...n},children:[e==="report"&&c.jsx(eV,{}),e==="model"&&c.jsx(tV,{}),e==="data"&&c.jsx(nV,{}),e==="materialization"&&c.jsx(rV,{}),e==="page"&&c.jsx(oV,{})]})}function eV(){return c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M14 3 H6 a2 2 0 0 0 -2 2 v14 a2 2 0 0 0 2 2 h12 a2 2 0 0 0 2 -2 V9 z"}),c.jsx("path",{d:"M14 3 v4 a2 2 0 0 0 2 2 h4"}),c.jsx("path",{d:"M8 17 v-3"}),c.jsx("path",{d:"M12 17 v-6"}),c.jsx("path",{d:"M16 17 v-4"})]})}function tV(){return c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M12 3 L4 7 v10 l8 4 l8 -4 V7 z"}),c.jsx("path",{d:"M4 7 l8 4 l8 -4"}),c.jsx("path",{d:"M12 11 v10"})]})}function nV(){return c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"3.5",y:"3.5",width:"17",height:"17",rx:"2"}),c.jsx("path",{d:"M3.5 9.5 H20.5"}),c.jsx("path",{d:"M9.5 3.5 V20.5"})]})}function rV(){return c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M12 3 L21 7.5 L12 12 L3 7.5 Z"}),c.jsx("path",{d:"M3 12 L12 16.5 L21 12"}),c.jsx("path",{d:"M3 16.5 L12 21 L21 16.5"})]})}function oV(){return c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),c.jsx("path",{d:"M3.5 9.5 H20.5"}),c.jsx("path",{d:"M7 13.5 H17"}),c.jsx("path",{d:"M7 16.5 H13"})]})}const Q1="README.malloynb";function iV({onClickPackageFile:e,resourceUri:t,retrievalFn:n}){const{apiClients:r,server:o}=De.useServer(),i=e??(O=>{window.location.href=O}),{environmentName:s,packageName:a,versionId:l}=Ht(t),[u,d]=W.useState(null),f=Xt({queryKey:["package",s,a,l],queryFn:()=>r.packages.getPackage(s,a,l,!1)}),h=Xt({queryKey:["notebooks",s,a,l],queryFn:()=>r.notebooks.listNotebooks(s,a,l)}),p=Xt({queryKey:["models",s,a,l],queryFn:()=>r.models.listModels(s,a,l)}),m=Xt({queryKey:["databases",s,a,l],queryFn:()=>r.databases.listDatabases(s,a,l)}),y=Xt({queryKey:["pages",s,a],queryFn:async()=>{try{return await r.pages.listPages(s,a)}catch(O){const F=O?.response?.status;if(F===404||F===void 0)return{data:[]};throw O}}}).data?.data??[],x=(h.data?.data??[]).slice().sort((O,F)=>O.path.localeCompare(F.path)),C=(p.data?.data??[]).slice().sort((O,F)=>O.path.localeCompare(F.path)),v=(m.data?.data??[]).slice().sort((O,F)=>O.path.localeCompare(F.path)),S=f.data?.data?.description??"",I=x.some(O=>O.path===Q1),T=Cl({environmentName:s,packageName:a,versionId:l,modelPath:Q1}),N=!h.isSuccess&&!h.isError;return f.isError?c.jsx(kn,{error:f.error,context:`${s} > ${a}`}):c.jsxs(w.Container,{maxWidth:!1,sx:{maxWidth:1024,mx:"auto",px:3,py:6},children:[c.jsxs(w.Box,{sx:{mb:4},children:[c.jsxs(w.Link,{onClick:O=>i(`/${s}/`,O),underline:"none",sx:{display:"inline-flex",alignItems:"center",gap:.5,cursor:"pointer",color:"text.secondary",fontSize:"0.875rem",mb:2,"&:hover":{color:"primary.main"}},children:[c.jsx(Xx,{sx:{fontSize:18}}),"Back to ",s]}),c.jsx(w.Typography,{variant:"h4",component:"h1",sx:{fontWeight:600,letterSpacing:"-0.025em",mb:.5},children:a}),S&&c.jsx(w.Typography,{variant:"body2",color:"text.secondary",children:S})]}),N&&c.jsx(Sn,{text:"Loading package..."}),!N&&c.jsxs(c.Fragment,{children:[c.jsxs(Ea,{title:"Governed Reports",count:x.length,children:[x.map(O=>c.jsx(va,{icon:c.jsx(Ca,{type:"report"}),tint:De.MALLOY_BRAND.teal,label:O.path,onClick:F=>i(`/${s}/${a}/${O.path}`,F)},O.path)),x.length===0&&c.jsx(Wd,{label:"No notebooks"})]}),y.length>0&&c.jsx(Ea,{title:"Pages",count:y.length,children:y.map(O=>{const F=!!O.title&&O.title!==O.path,B=`${XC(o)}${O.resource}`;return c.jsx(va,{icon:c.jsx(Ca,{type:"page"}),tint:De.MALLOY_BRAND.teal,label:F?O.title:O.path,rightLabel:F?O.path:void 0,onClick:j=>{e?e(`/${s}/${a}/pages/${O.path}`,j):j&&(j.metaKey||j.ctrlKey)?window.open(B,"_blank"):window.location.href=B},trailingAction:c.jsx(w.Tooltip,{title:"Open standalone in new tab",children:c.jsx(w.IconButton,{size:"small",href:B,target:"_blank",rel:"noopener noreferrer","aria-label":"Open standalone in new tab",onClick:j=>j.stopPropagation(),sx:{color:"text.secondary"},children:c.jsx(QC,{fontSize:"small"})})})},O.path)})}),c.jsxs(Ea,{title:"Semantic Models",count:C.length,children:[C.map(O=>c.jsx(va,{icon:c.jsx(Ca,{type:"model"}),tint:De.MALLOY_BRAND.orange,label:O.path,onClick:F=>i(`/${s}/${a}/${O.path}`,F)},O.path)),C.length===0&&c.jsx(Wd,{label:"No models"})]}),c.jsxs(Ea,{title:"Package Data",count:v.length,children:[v.map(O=>c.jsx(va,{icon:c.jsx(Ca,{type:"data"}),tint:De.MALLOY_BRAND.darkBlue,label:O.path,rightLabel:O.info?sV(O.info.rowCount):"Unreadable",onClick:()=>d(O)},O.path)),v.length===0&&c.jsx(Wd,{label:"No data files"})]}),c.jsx(Ea,{title:"Materializations",children:c.jsx(va,{icon:c.jsx(Ca,{type:"materialization"}),tint:De.MALLOY_BRAND.teal,label:"Materializations",onClick:O=>i(`/${s}/${a}/materializations`,O)})}),I&&c.jsx(w.Box,{sx:{mt:6},children:c.jsx(GC,{resourceUri:T,retrievalFn:n,onNavigate:i})})]}),c.jsxs(w.Dialog,{open:u!==null,onClose:()=>d(null),maxWidth:"sm",fullWidth:!0,children:[c.jsxs(w.DialogTitle,{sx:{pr:6},children:[u?.path,c.jsx(w.IconButton,{"aria-label":"close",onClick:()=>d(null),sx:{position:"absolute",right:8,top:8},children:c.jsx(Fr,{fontSize:"small"})})]}),c.jsxs(w.DialogContent,{children:[u?.error&&c.jsx(w.Typography,{variant:"body2",color:"error",children:u.error}),u?.info?.columns&&c.jsxs(w.Table,{size:"small",children:[c.jsx(w.TableHead,{children:c.jsxs(w.TableRow,{children:[c.jsx(w.TableCell,{children:"Column"}),c.jsx(w.TableCell,{children:"Type"})]})}),c.jsx(w.TableBody,{children:u.info.columns.map(O=>c.jsxs(w.TableRow,{children:[c.jsx(w.TableCell,{component:"th",scope:"row",children:O.name}),c.jsx(w.TableCell,{children:O.type})]},O.name))})]})]})]})]})}function Ea({title:e,count:t,children:n}){return c.jsxs(w.Box,{sx:{mb:4},children:[c.jsxs(w.Stack,{direction:"row",alignItems:"baseline",spacing:1,sx:{mb:1},children:[c.jsx(w.Typography,{variant:"h6",sx:{fontWeight:600,letterSpacing:"-0.025em"},children:e}),t!==void 0&&c.jsxs(w.Typography,{variant:"caption",color:"text.secondary",children:["(",t,")"]})]}),c.jsx(w.Box,{children:n})]})}function va({icon:e,tint:t,label:n,rightLabel:r,onClick:o,trailingAction:i}){const s=!!o,a=l=>{o&&(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),o(l))};return c.jsxs(w.Box,{onClick:o,onKeyDown:s?a:void 0,role:s?"button":void 0,tabIndex:s?0:void 0,sx:l=>({display:"flex",alignItems:"center",gap:1.5,py:1,px:1,mx:-1,cursor:s?"pointer":"default",borderRadius:1.5,transition:"background-color 0.1s","&:hover":s?{backgroundColor:l.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}:void 0,"&:focus-visible":s?{outline:"2px solid",outlineColor:"primary.main",outlineOffset:2}:void 0}),children:[c.jsx(w.Box,{sx:{width:32,height:32,borderRadius:1,bgcolor:t,color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e}),c.jsx(w.Typography,{variant:"body2",sx:{fontFamily:De.MONO_FONT_FAMILY,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),r&&c.jsx(w.Typography,{variant:"caption",color:"text.secondary",sx:{flexShrink:0},children:r}),i&&c.jsx(w.Box,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:i})]})}function Wd({label:e}){return c.jsx(w.Typography,{variant:"body2",color:"text.secondary",sx:{py:1,fontStyle:"italic"},children:e})}function sV(e){return e>=1e9?`${(e/1e9).toFixed(1)} B rows`:e>=1e6?`${(e/1e6).toFixed(1)} M rows`:e>=1e3?`${(e/1e3).toFixed(1)} K rows`:`${e} rows`}function aV(e){return Ge("MuiCollapse",e)}We("MuiCollapse",["root","horizontal","vertical","entered","hidden","wrapper","wrapperInner"]);const lV=e=>{const{orientation:t,classes:n}=e,r={root:["root",`${t}`],entered:["entered"],hidden:["hidden"],wrapper:["wrapper",`${t}`],wrapperInner:["wrapperInner",`${t}`]};return Ke(r,aV,n)},uV=fe("div",{name:"MuiCollapse",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],n.state==="entered"&&t.entered,n.state==="exited"&&!n.in&&n.collapsedSize==="0px"&&t.hidden]}})(ft(({theme:e})=>({height:0,overflow:"hidden",transition:e.transitions.create("height"),variants:[{props:{orientation:"horizontal"},style:{height:"auto",width:0,transition:e.transitions.create("width")}},{props:{state:"entered"},style:{height:"auto",overflow:"visible"}},{props:{state:"entered",orientation:"horizontal"},style:{width:"auto"}},{props:({ownerState:t})=>t.state==="exited"&&!t.in&&t.collapsedSize==="0px",style:{visibility:"hidden"}}]}))),cV=fe("div",{name:"MuiCollapse",slot:"Wrapper"})({display:"flex",width:"100%",variants:[{props:{orientation:"horizontal"},style:{width:"auto",height:"100%"}}]}),dV=fe("div",{name:"MuiCollapse",slot:"WrapperInner"})({width:"100%",variants:[{props:{orientation:"horizontal"},style:{width:"auto",height:"100%"}}]}),sl=M.forwardRef(function(t,n){const r=ut({props:t,name:"MuiCollapse"}),{addEndListener:o,children:i,className:s,collapsedSize:a="0px",component:l,easing:u,in:d,onEnter:f,onEntered:h,onEntering:p,onExit:m,onExited:b,onExiting:y,orientation:x="vertical",style:C,timeout:v=pb.standard,TransitionComponent:S=Dr,...I}=r,T={...r,orientation:x,collapsedSize:a},N=lV(T),O=Lo(),F=Sc(),B=M.useRef(null),j=M.useRef(),D=typeof a=="number"?`${a}px`:a,H=x==="horizontal",_=H?"width":"height",L=M.useRef(null),$=vt(n,L),K=Q=>re=>{if(Q){const ne=L.current;re===void 0?Q(ne):Q(ne,re)}},G=()=>B.current?B.current[H?"clientWidth":"clientHeight"]:0,q=K((Q,re)=>{B.current&&H&&(B.current.style.position="absolute"),Q.style[_]=D,f&&f(Q,re)}),R=K((Q,re)=>{const ne=G();B.current&&H&&(B.current.style.position="");const{duration:ae,easing:ie}=ms({style:C,timeout:v,easing:u},{mode:"enter"});if(v==="auto"){const Z=O.transitions.getAutoHeightDuration(ne);Q.style.transitionDuration=`${Z}ms`,j.current=Z}else Q.style.transitionDuration=typeof ae=="string"?ae:`${ae}ms`;Q.style[_]=`${ne}px`,Q.style.transitionTimingFunction=ie,p&&p(Q,re)}),oe=K((Q,re)=>{Q.style[_]="auto",h&&h(Q,re)}),se=K(Q=>{Q.style[_]=`${G()}px`,m&&m(Q)}),z=K(b),pe=K(Q=>{const re=G(),{duration:ne,easing:ae}=ms({style:C,timeout:v,easing:u},{mode:"exit"});if(v==="auto"){const ie=O.transitions.getAutoHeightDuration(re);Q.style.transitionDuration=`${ie}ms`,j.current=ie}else Q.style.transitionDuration=typeof ne=="string"?ne:`${ne}ms`;Q.style[_]=D,Q.style.transitionTimingFunction=ae,y&&y(Q)}),J=Q=>{v==="auto"&&F.start(j.current||0,Q),o&&o(L.current,Q)};return c.jsx(S,{in:d,onEnter:q,onEntered:oe,onEntering:R,onExit:se,onExited:z,onExiting:pe,addEndListener:J,nodeRef:L,timeout:v==="auto"?null:v,...I,children:(Q,{ownerState:re,...ne})=>c.jsx(uV,{as:l,className:Ue(N.root,s,{entered:N.entered,exited:!d&&D==="0px"&&N.hidden}[Q]),style:{[H?"minWidth":"minHeight"]:D,...C},ref:$,ownerState:{...T,state:Q},...ne,children:c.jsx(cV,{ownerState:{...T,state:Q},className:N.wrapper,ref:B,children:c.jsx(dV,{ownerState:{...T,state:Q},className:N.wrapperInner,children:i})})})})});sl&&(sl.muiSupportAuto=!0);function ZC(e){return Kt}const JC=M.createContext(null);function fV(e){const{value:t,children:n}=e;return c.jsx(JC.Provider,{value:t,children:t.wrapRoot({children:n,instance:t.instance})})}const Si=()=>{const e=M.useContext(JC);if(e==null)throw new Error(["MUI X: Could not find the Tree View context.","It looks like you rendered your component outside of a SimpleTreeView or RichTreeView parent component.","This can also happen if you are bundling multiple versions of the Tree View."].join(`
|
|
222
222
|
`));return e},pV=({props:e})=>{const{instance:t}=Si(),{label:n,itemId:r}=e,[o,i]=M.useState(n),s=t.isItemBeingEdited(r);return M.useEffect(()=>{s||i(n)},[s,n]),{propsEnhancers:{labelInput:({externalEventHandlers:a,interactions:l})=>t.isItemEditable(r)?{value:o??"","data-element":"labelInput",onChange:p=>{a.onChange?.(p),i(p.target.value)},onKeyDown:p=>{if(a.onKeyDown?.(p),p.defaultMuiPrevented)return;const m=p.target;p.key==="Enter"&&m.value?l.handleSaveItemLabel(p,m.value):p.key==="Escape"&&l.handleCancelItemLabelEditing(p)},onBlur:p=>{a.onBlur?.(p),!p.defaultMuiPrevented&&p.target.value&&l.handleSaveItemLabel(p,p.target.value)},autoFocus:!0,type:"text"}:{}}}},xr=({instance:e,state:t,setState:n,params:r})=>{const o=M.useRef(t.editedItemId),i=f=>o.current===f,s=f=>{n(h=>Y({},h,{editedItemId:f})),o.current=f},a=f=>f===t.editedItemId,l=!!r.isItemEditable,u=f=>{if(f==null||!l)return!1;const h=e.getItem(f);return h?typeof r.isItemEditable=="function"?r.isItemEditable(h):!!r.isItemEditable:!1},d=(f,h)=>{if(!h)throw new Error(["MUI X: The Tree View component requires all items to have a `label` property.","The label of an item cannot be empty.",f].join(`
|
|
223
223
|
`));n(p=>{const m=p.items.itemMetaMap[f];return m.label!==h?Y({},p,{items:Y({},p.items,{itemMetaMap:Y({},p.items.itemMetaMap,{[f]:Y({},m,{label:h})})})}):p}),r.onItemLabelChange&&r.onItemLabelChange(f,h)};return{instance:{setEditedItemId:s,isItemBeingEdited:a,updateItemLabel:d,isItemEditable:u,isTreeViewEditable:l,isItemBeingEditedRef:i},publicAPI:{updateItemLabel:d}}};xr.itemPlugin=pV;xr.getDefaultizedParams=({params:e,experimentalFeatures:t})=>{const n=t?.labelEditing;return Y({},e,{isItemEditable:n?e.isItemEditable??!1:!1})};xr.getInitialState=()=>({editedItemId:null});xr.params={onItemLabelChange:!0,isItemEditable:!0};const ui=(e,t)=>e.getAvailablePlugins().has(t),eE=e=>Array.isArray(e)?e.length>0&&e.some(eE):!!e,hV=({itemId:e,children:t})=>{const{instance:n,selection:{multiSelect:r},publicAPI:o}=Si(),i={expandable:eE(t),expanded:n.isItemExpanded(e),focused:n.isItemFocused(e),selected:n.isItemSelected(e),disabled:n.isItemDisabled(e),editing:n?.isItemBeingEdited?n?.isItemBeingEdited(e):!1,editable:n.isItemEditable?n.isItemEditable(e):!1},s=p=>{if(i.disabled)return;i.focused||n.focusItem(p,e);const m=r&&(p.shiftKey||p.ctrlKey||p.metaKey);i.expandable&&!(m&&n.isItemExpanded(e))&&n.toggleItemExpansion(p,e)},a=p=>{if(i.disabled)return;!i.focused&&!i.editing&&n.focusItem(p,e),r&&(p.shiftKey||p.ctrlKey||p.metaKey)?p.shiftKey?n.expandSelectionRange(p,e):n.selectItem({event:p,itemId:e,keepExistingSelection:!0}):n.selectItem({event:p,itemId:e,shouldBeSelected:!0})},l=p=>{const m=p.nativeEvent.shiftKey;r&&m?n.expandSelectionRange(p,e):n.selectItem({event:p,itemId:e,keepExistingSelection:r,shouldBeSelected:p.target.checked})},u=()=>{ui(n,xr)&&n.isItemEditable(e)&&(n.isItemBeingEdited(e)?n.setEditedItemId(null):n.setEditedItemId(e))};return{interactions:{handleExpansion:s,handleSelection:a,handleCheckboxSelection:l,toggleItemEditing:u,handleSaveItemLabel:(p,m)=>{ui(n,xr)&&n.isItemBeingEditedRef(e)&&(n.updateItemLabel(e,m),u(),n.focusItem(p,e))},handleCancelItemLabelEditing:p=>{ui(n,xr)&&n.isItemBeingEditedRef(e)&&(u(),n.focusItem(p,e))}},status:i,publicAPI:o}},fh=M.createContext(()=>-1),tE=(e,t)=>{let n=t.length-1;for(;n>=0&&!e.isItemNavigable(t[n]);)n-=1;if(n!==-1)return t[n]},nE=(e,t)=>{const n=e.getItemMeta(t),r=e.getItemOrderedChildrenIds(n.parentId),o=e.getItemIndex(t);if(o===0)return n.parentId;let i=o-1;for(;!e.isItemNavigable(r[i])&&i>=0;)i-=1;if(i===-1)return n.parentId==null?null:nE(e,n.parentId);let s=r[i],a=tE(e,e.getItemOrderedChildrenIds(s));for(;e.isItemExpanded(s)&&a!=null;)s=a,a=e.getItemOrderedChildrenIds(s).find(e.isItemNavigable);return s},Su=(e,t)=>{if(e.isItemExpanded(t)){const r=e.getItemOrderedChildrenIds(t).find(e.isItemNavigable);if(r!=null)return r}let n=e.getItemMeta(t);for(;n!=null;){const r=e.getItemOrderedChildrenIds(n.parentId),o=e.getItemIndex(n.id);if(o<r.length-1){let i=o+1;for(;!e.isItemNavigable(r[i])&&i<r.length-1;)i+=1;if(e.isItemNavigable(r[i]))return r[i]}n=e.getItemMeta(n.parentId)}return null},rE=e=>{let t=null;for(;t==null||e.isItemExpanded(t);){const n=e.getItemOrderedChildrenIds(t),r=tE(e,n);if(r==null)return t;t=r}return t},al=e=>e.getItemOrderedChildrenIds(null).find(e.isItemNavigable),oE=(e,t,n)=>{if(t===n)return[t,n];const r=e.getItemMeta(t),o=e.getItemMeta(n);if(r.parentId===o.id||o.parentId===r.id)return o.parentId===r.id?[r.id,o.id]:[o.id,r.id];const i=[r.id],s=[o.id];let a=r.parentId,l=o.parentId,u=s.indexOf(a)!==-1,d=i.indexOf(l)!==-1,f=!0,h=!0;for(;!d&&!u;)f&&(i.push(a),u=s.indexOf(a)!==-1,f=a!==null,!u&&f&&(a=e.getItemMeta(a).parentId)),h&&!u&&(s.push(l),d=i.indexOf(l)!==-1,h=l!==null,!d&&h&&(l=e.getItemMeta(l).parentId));const p=u?a:l,m=e.getItemOrderedChildrenIds(p),b=i[i.indexOf(p)-1],y=s[s.indexOf(p)-1];return m.indexOf(b)<m.indexOf(y)?[t,n]:[n,t]},mV=(e,t,n)=>{const r=l=>{if(e.isItemExpandable(l)&&e.isItemExpanded(l))return e.getItemOrderedChildrenIds(l)[0];let u=e.getItemMeta(l);for(;u!=null;){const d=e.getItemOrderedChildrenIds(u.parentId),f=e.getItemIndex(u.id);if(f<d.length-1)return d[f+1];u=e.getItemMeta(u.parentId)}throw new Error("Invalid range")},[o,i]=oE(e,t,n),s=[o];let a=o;for(;a!==i;)a=r(a),e.isItemDisabled(a)||s.push(a);return s},gV=e=>{let t=al(e);const n=[];for(;t!=null;)n.push(t),t=Su(e,t);return n},ll=(e,t)=>t!==e.closest('*[role="treeitem"]');let X1=0;const bV=()=>(X1+=1,`mui-tree-view-${X1}`),ph=({id:e,treeId:t="",itemId:n})=>e??`${t}-${n}`,yV=e=>{const{runItemPlugins:t,items:{onItemClick:n,disabledItemsFocusable:r,indentationAtItemLevel:o},selection:{disableSelection:i,checkboxSelection:s},expansion:{expansionTrigger:a},treeId:l,instance:u,publicAPI:d}=Si(),f=M.useContext(fh),{id:h,itemId:p,label:m,children:b,rootRef:y}=e,{rootRef:x,contentRef:C,propsEnhancers:v}=t(e),{interactions:S,status:I}=hV({itemId:p,children:b}),T=M.useRef(null),N=M.useRef(null),O=vt(y,x,T),F=vt(C,N),B=M.useRef(null),j=ph({itemId:p,treeId:l,id:h}),D=u.canItemBeTabbed(p)?0:-1,H={rootRefObject:T,contentRefObject:N,interactions:S},_=ie=>Z=>{if(ie.onFocus?.(Z),Z.defaultMuiPrevented)return;const me=!I.disabled||r;!I.focused&&me&&Z.currentTarget===Z.target&&u.focusItem(Z,p)},L=ie=>Z=>{if(ie.onBlur?.(Z),Z.defaultMuiPrevented)return;const me=u.getItemDOMElement(p);I.editing||Z.relatedTarget&&ll(Z.relatedTarget,me)&&(Z.target&&Z.target?.dataset?.element==="labelInput"&&ll(Z.target,me)||Z.relatedTarget?.dataset?.element==="labelInput")||u.removeFocusedItem()},$=ie=>Z=>{ie.onKeyDown?.(Z),!(Z.defaultMuiPrevented||Z.target?.dataset?.element==="labelInput")&&u.handleItemKeyDown(Z,p)},K=ie=>Z=>{ie.onDoubleClick?.(Z),!Z.defaultMuiPrevented&&S.toggleItemEditing()},G=ie=>Z=>{ie.onClick?.(Z),n?.(Z,p),!(Z.defaultMuiPrevented||B.current?.contains(Z.target))&&(a==="content"&&S.handleExpansion(Z),s||S.handleSelection(Z))},q=ie=>Z=>{ie.onMouseDown?.(Z),!Z.defaultMuiPrevented&&(Z.shiftKey||Z.ctrlKey||Z.metaKey||I.disabled)&&Z.preventDefault()},R=ie=>Z=>{ie.onChange?.(Z),!Z.defaultMuiPrevented&&(i||I.disabled||S.handleCheckboxSelection(Z))},oe=ie=>Z=>{ie.onClick?.(Z),!Z.defaultMuiPrevented&&a==="iconContainer"&&S.handleExpansion(Z)};return{getRootProps:(ie={})=>{const Z=Y({},Ln(e),Ln(ie));let me;I.selected?me=!0:i||I.disabled?me=void 0:me=!1;const le=Y({},Z,{ref:O,role:"treeitem",tabIndex:D,id:j,"aria-expanded":I.expandable?I.expanded:void 0,"aria-selected":me,"aria-disabled":I.disabled||void 0},ie,{onFocus:_(Z),onBlur:L(Z),onKeyDown:$(Z)});o&&(le.style={"--TreeView-itemDepth":typeof f=="function"?f(p):f});const ue=v.root?.(Y({},H,{externalEventHandlers:Z}))??{};return Y({},le,ue)},getContentProps:(ie={})=>{const Z=Ln(ie),me=Y({},Z,ie,{ref:F,onClick:G(Z),onMouseDown:q(Z),status:I});o&&(me.indentationAtItemLevel=!0);const le=v.content?.(Y({},H,{externalEventHandlers:Z}))??{};return Y({},me,le)},getGroupTransitionProps:(ie={})=>{const Z=Ln(ie),me=Y({},Z,{unmountOnExit:!0,component:"ul",role:"group",in:I.expanded,children:b},ie);return o&&(me.indentationAtItemLevel=!0),me},getIconContainerProps:(ie={})=>{const Z=Ln(ie);return Y({},Z,ie,{onClick:oe(Z)})},getCheckboxProps:(ie={})=>{const Z=Ln(ie);return Y({},Z,{visible:s,ref:B,checked:I.selected,disabled:i||I.disabled,tabIndex:-1},ie,{onChange:R(Z)})},getLabelProps:(ie={})=>{const Z=Y({},Ln(ie)),me=Y({},Z,{children:m},ie,{onDoubleClick:K(Z)});return u.isTreeViewEditable&&(me.editable=I.editable),me},getLabelInputProps:(ie={})=>{const Z=Ln(ie),me=v.labelInput?.({rootRefObject:T,contentRefObject:N,externalEventHandlers:Z,interactions:S})??{};return Y({},ie,me)},getDragAndDropOverlayProps:(ie={})=>{const Z=Ln(ie),me=v.dragAndDropOverlay?.(Y({},H,{externalEventHandlers:Z}))??{};return Y({},ie,me)},rootRef:O,status:I,publicAPI:d}},xV=yV;function iE(e){const{instance:t,items:{onItemClick:n},selection:{multiSelect:r,checkboxSelection:o,disableSelection:i},expansion:{expansionTrigger:s}}=Si(),a=t.isItemExpandable(e),l=t.isItemExpanded(e),u=t.isItemFocused(e),d=t.isItemSelected(e),f=t.isItemDisabled(e),h=t?.isItemBeingEdited?t?.isItemBeingEdited(e):!1,p=t.isItemEditable?t.isItemEditable(e):!1,m=I=>{if(!f){u||t.focusItem(I,e);const T=r&&(I.shiftKey||I.ctrlKey||I.metaKey);a&&!(T&&t.isItemExpanded(e))&&t.toggleItemExpansion(I,e)}},b=I=>{f||(!u&&!h&&t.focusItem(I,e),r&&(I.shiftKey||I.ctrlKey||I.metaKey)?I.shiftKey?t.expandSelectionRange(I,e):t.selectItem({event:I,itemId:e,keepExistingSelection:!0}):t.selectItem({event:I,itemId:e,shouldBeSelected:!0}))},y=I=>{if(i||f)return;const T=I.nativeEvent.shiftKey;r&&T?t.expandSelectionRange(I,e):t.selectItem({event:I,itemId:e,keepExistingSelection:r,shouldBeSelected:I.target.checked})},x=I=>{(I.shiftKey||I.ctrlKey||I.metaKey||f)&&I.preventDefault()},C=()=>{ui(t,xr)&&t.isItemEditable(e)&&(t.isItemBeingEdited(e)?t.setEditedItemId(null):t.setEditedItemId(e))};return{disabled:f,expanded:l,selected:d,focused:u,editable:p,editing:h,disableSelection:i,checkboxSelection:o,handleExpansion:m,handleSelection:b,handleCheckboxSelection:y,handleContentClick:n,preventSelection:x,expansionTrigger:s,toggleItemEditing:C,handleSaveItemLabel:(I,T)=>{ui(t,xr)&&t.isItemBeingEditedRef(e)&&(t.updateItemLabel(e,T),C(),t.focusItem(I,e))},handleCancelItemLabelEditing:I=>{ui(t,xr)&&t.isItemBeingEditedRef(e)&&(C(),t.focusItem(I,e))}}}const CV=fe("div",{name:"MuiTreeItem2DragAndDropOverlay",slot:"Root",overridesResolver:(e,t)=>t.root,shouldForwardProp:e=>Ot.shouldForwardProp(e)&&e!=="action"})(({theme:e})=>({position:"absolute",left:0,display:"flex",top:0,bottom:0,right:0,pointerEvents:"none",variants:[{props:{action:"make-child"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderRadius:e.shape.borderRadius,backgroundColor:e.vars?`rgba(${e.vars.palette.primary.darkChannel} / ${e.vars.palette.action.focusOpacity})`:Ot.alpha(e.palette.primary.dark,e.palette.action.focusOpacity)}},{props:{action:"reorder-above"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderTop:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"reorder-below"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"move-to-parent"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * calc(var(--TreeView-itemDepth) - 1))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}}]}));function EV(e){return e.action==null?null:c.jsx(CV,Y({},e))}const vV=fe("input",{name:"MuiTreeItem2",slot:"LabelInput",overridesResolver:(e,t)=>t.labelInput})(({theme:e})=>Y({},e.typography.body1,{width:"100%",backgroundColor:e.palette.background.paper,borderRadius:e.shape.borderRadius,border:"none",padding:"0 2px",boxSizing:"border-box","&:focus":{outline:`1px solid ${e.palette.primary.main}`}})),TV=["classes","className","displayIcon","expansionIcon","icon","label","itemId","onClick","onMouseDown","dragAndDropOverlayProps","labelInputProps"],sE=M.forwardRef(function(t,n){const{classes:r,className:o,displayIcon:i,expansionIcon:s,icon:a,label:l,itemId:u,onClick:d,onMouseDown:f,dragAndDropOverlayProps:h,labelInputProps:p}=t,m=Ze(t,TV),{disabled:b,expanded:y,selected:x,focused:C,editing:v,editable:S,disableSelection:I,checkboxSelection:T,handleExpansion:N,handleSelection:O,handleCheckboxSelection:F,handleContentClick:B,preventSelection:j,expansionTrigger:D,toggleItemEditing:H}=iE(u),_=a||s||i,L=M.useRef(null),$=q=>{j(q),f&&f(q)},K=q=>{B?.(q,u),!L.current?.contains(q.target)&&(D==="content"&&N(q),T||O(q),d&&d(q))},G=q=>{q.defaultMuiPrevented||H()};return c.jsxs("div",Y({},m,{className:Ue(r.root,o,y&&r.expanded,x&&r.selected,C&&r.focused,b&&r.disabled,v&&r.editing,S&&r.editable),onClick:K,onMouseDown:$,ref:n,children:[c.jsx("div",{className:r.iconContainer,children:_}),T&&c.jsx(Pp,{className:r.checkbox,checked:x,onChange:F,disabled:b||I,ref:L,tabIndex:-1}),v?c.jsx(vV,Y({},p,{className:r.labelInput})):c.jsx("div",Y({className:r.label},S&&{onDoubleClick:G},{children:l})),h&&c.jsx(EV,Y({},h))]}))});function SV(e){return Ge("MuiTreeItem",e)}const co=We("MuiTreeItem",["root","groupTransition","content","expanded","selected","focused","disabled","iconContainer","label","checkbox","labelInput","editable","editing","dragAndDropOverlay"]),aE=mt(c.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),lE=mt(c.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}));function hh(e){const{children:t,itemId:n}=e,{wrapItem:r,instance:o}=Si();return r({children:t,itemId:n,instance:o})}hh.propTypes={children:Ee.node,itemId:Ee.string.isRequired};const kV=["children","className","slots","slotProps","ContentComponent","ContentProps","itemId","id","label","onClick","onMouseDown","onFocus","onBlur","onKeyDown"],wV=["ownerState"],DV=["ownerState"],IV=["ownerState"],AV=ZC(),OV=e=>{const{classes:t}=e;return Ke({root:["root"],content:["content"],expanded:["expanded"],selected:["selected"],focused:["focused"],disabled:["disabled"],iconContainer:["iconContainer"],checkbox:["checkbox"],label:["label"],labelInput:["labelInput"],editing:["editing"],editable:["editable"],groupTransition:["groupTransition"]},SV,t)},MV=fe("li",{name:"MuiTreeItem",slot:"Root",overridesResolver:(e,t)=>t.root})({listStyle:"none",margin:0,padding:0,outline:0}),PV=fe(sE,{name:"MuiTreeItem",slot:"Content",overridesResolver:(e,t)=>[t.content,t.iconContainer&&{[`& .${co.iconContainer}`]:t.iconContainer},t.label&&{[`& .${co.label}`]:t.label}],shouldForwardProp:e=>No(e)&&e!=="indentationAtItemLevel"})(({theme:e})=>({padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius,width:"100%",boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",gap:e.spacing(1),cursor:"pointer",WebkitTapHighlightColor:"transparent","&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${co.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity,backgroundColor:"transparent"},[`&.${co.focused}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${co.selected}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Ot.alpha(e.palette.primary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:Ot.alpha(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Ot.alpha(e.palette.primary.main,e.palette.action.selectedOpacity)}},[`&.${co.focused}`]:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:Ot.alpha(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},[`& .${co.iconContainer}`]:{width:16,display:"flex",flexShrink:0,justifyContent:"center","& svg":{fontSize:18}},[`& .${co.label}`]:Y({width:"100%",boxSizing:"border-box",minWidth:0,position:"relative"},e.typography.body1),[`& .${co.checkbox}`]:{padding:0},variants:[{props:{indentationAtItemLevel:!0},style:{paddingLeft:`calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`}}]})),RV=fe(sl,{name:"MuiTreeItem",slot:"GroupTransition",overridesResolver:(e,t)=>t.groupTransition,shouldForwardProp:e=>No(e)&&e!=="indentationAtItemLevel"})({margin:0,padding:0,paddingLeft:"var(--TreeView-itemChildrenIndentation)",variants:[{props:{indentationAtItemLevel:!0},style:{paddingLeft:0}}]}),NV=M.forwardRef(function(t,n){const{icons:r,runItemPlugins:o,items:{disabledItemsFocusable:i,indentationAtItemLevel:s},selection:{disableSelection:a},expansion:{expansionTrigger:l},treeId:u,instance:d}=Si(),f=M.useContext(fh),h=AV({props:t,name:"MuiTreeItem"}),{children:p,className:m,slots:b,slotProps:y,ContentComponent:x=sE,ContentProps:C,itemId:v,id:S,label:I,onClick:T,onMouseDown:N,onBlur:O,onKeyDown:F}=h,B=Ze(h,kV),{expanded:j,focused:D,selected:H,disabled:_,editing:L,handleExpansion:$,handleCancelItemLabelEditing:K,handleSaveItemLabel:G}=iE(v),{contentRef:q,rootRef:R,propsEnhancers:oe}=o(h),se=M.useRef(null),z=M.useRef(null),pe=vt(n,R,se),J=vt(C?.ref,q,z),Q={expandIcon:b?.expandIcon??r.slots.expandIcon??aE,collapseIcon:b?.collapseIcon??r.slots.collapseIcon??lE,endIcon:b?.endIcon??r.slots.endIcon,icon:b?.icon,groupTransition:b?.groupTransition},re=Oe=>Array.isArray(Oe)?Oe.length>0&&Oe.some(re):!!Oe,ne=re(p),ae=Y({},h,{expanded:j,focused:D,selected:H,disabled:_,indentationAtItemLevel:s}),ie=OV(ae),Z=Q.groupTransition??void 0,me=Et({elementType:Z,ownerState:{},externalSlotProps:y?.groupTransition,additionalProps:Y({unmountOnExit:!0,in:j,component:"ul",role:"group"},s?{indentationAtItemLevel:!0}:{}),className:ie.groupTransition}),le=Oe=>{l==="iconContainer"&&$(Oe)},ue=j?Q.collapseIcon:Q.expandIcon,Ie=Et({elementType:ue,ownerState:{},externalSlotProps:Oe=>j?Y({},br(r.slotProps.collapseIcon,Oe),br(y?.collapseIcon,Oe)):Y({},br(r.slotProps.expandIcon,Oe),br(y?.expandIcon,Oe)),additionalProps:{onClick:le}}),Ce=Ze(Ie,wV),we=ne&&ue?c.jsx(ue,Y({},Ce)):null,ye=ne?void 0:Q.endIcon,ze=Et({elementType:ye,ownerState:{},externalSlotProps:Oe=>ne?{}:Y({},br(r.slotProps.endIcon,Oe),br(y?.endIcon,Oe))}),Ne=Ze(ze,DV),nt=ye?c.jsx(ye,Y({},Ne)):null,_e=Q.icon,Bt=Et({elementType:_e,ownerState:{},externalSlotProps:y?.icon}),yt=Ze(Bt,IV),ot=_e?c.jsx(_e,Y({},yt)):null;let xe;H?xe=!0:a||_?xe=void 0:xe=!1;function Pe(Oe){!D&&(!_||i)&&Oe.currentTarget===Oe.target&&d.focusItem(Oe,v)}function qe(Oe){O?.(Oe),!(L||Oe.relatedTarget&&ll(Oe.relatedTarget,se.current)&&(Oe.target&&Oe.target?.dataset?.element==="labelInput"&&ll(Oe.target,se.current)||Oe.relatedTarget?.dataset?.element==="labelInput"))&&d.removeFocusedItem()}const Je=Oe=>{F?.(Oe),Oe.target?.dataset?.element!=="labelInput"&&d.handleItemKeyDown(Oe,v)},Xe=ph({itemId:v,treeId:u,id:S}),Re=d.canItemBeTabbed(v)?0:-1,ct={rootRefObject:se,contentRefObject:z,interactions:{handleSaveItemLabel:G,handleCancelItemLabelEditing:K}},lt=oe.root?.(Y({},ct,{externalEventHandlers:Ln(B)}))??{},Mt=oe.content?.(Y({},ct,{externalEventHandlers:Ln(C)}))??{},be=oe.dragAndDropOverlay?.(Y({},ct,{externalEventHandlers:{}}))??{},Ae=oe.labelInput?.(Y({},ct,{externalEventHandlers:{}}))??{};return c.jsx(hh,{itemId:v,children:c.jsxs(MV,Y({className:Ue(ie.root,m),role:"treeitem","aria-expanded":ne?j:void 0,"aria-selected":xe,"aria-disabled":_||void 0,id:Xe,tabIndex:Re},B,{ownerState:ae,onFocus:Pe,onBlur:qe,onKeyDown:Je,ref:pe,style:s?Y({},B.style,{"--TreeView-itemDepth":typeof f=="function"?f(v):f}):B.style},lt,{children:[c.jsx(PV,Y({as:x,classes:{root:ie.content,expanded:ie.expanded,selected:ie.selected,focused:ie.focused,disabled:ie.disabled,editable:ie.editable,editing:ie.editing,iconContainer:ie.iconContainer,label:ie.label,labelInput:ie.labelInput,checkbox:ie.checkbox},label:I,itemId:v,onClick:T,onMouseDown:N,icon:ot,expansionIcon:we,displayIcon:nt,ownerState:ae},C,Mt,be.action==null?{}:{dragAndDropOverlayProps:be},Ae.value==null?{}:{labelInputProps:Ae},{ref:J})),p&&c.jsx(RV,Y({as:Z},me,{children:p}))]}))})});function FV(e){const{slots:t,slotProps:n,status:r}=e,o=Si(),i=Y({},o.icons.slots,{expandIcon:o.icons.slots.expandIcon??aE,collapseIcon:o.icons.slots.collapseIcon??lE}),s=o.icons.slotProps;let a;t?.icon?a="icon":r.expandable?r.expanded?a="collapseIcon":a="expandIcon":a="endIcon";const l=t?.[a]??i[a],u=Et({elementType:l,externalSlotProps:d=>Y({},br(s[a],d),br(n?.[a],d)),ownerState:{}});return l?c.jsx(l,Y({},u)):null}const LV=["visible"],_V=fe("li",{name:"MuiTreeItem2",slot:"Root",overridesResolver:(e,t)=>t.root})({listStyle:"none",margin:0,padding:0,outline:0}),BV=fe("div",{name:"MuiTreeItem2",slot:"Content",overridesResolver:(e,t)=>t.content,shouldForwardProp:e=>No(e)&&e!=="status"&&e!=="indentationAtItemLevel"})(({theme:e})=>({padding:e.spacing(.5,1),borderRadius:e.shape.borderRadius,width:"100%",boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",gap:e.spacing(1),cursor:"pointer",WebkitTapHighlightColor:"transparent","&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},variants:[{props:{indentationAtItemLevel:!0},style:{paddingLeft:`calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`}},{props:({status:t})=>t.disabled,style:{opacity:(e.vars||e).palette.action.disabledOpacity,backgroundColor:"transparent"}},{props:({status:t})=>t.focused,style:{backgroundColor:(e.vars||e).palette.action.focus}},{props:({status:t})=>t.selected,style:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Ot.alpha(e.palette.primary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:Ot.alpha(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Ot.alpha(e.palette.primary.main,e.palette.action.selectedOpacity)}}}},{props:({status:t})=>t.selected&&t.focused,style:{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:Ot.alpha(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}}]})),jV=fe("div",{name:"MuiTreeItem2",slot:"Label",overridesResolver:(e,t)=>t.label,shouldForwardProp:e=>No(e)&&e!=="editable"})(({theme:e})=>Y({width:"100%",boxSizing:"border-box",minWidth:0,position:"relative",overflow:"hidden"},e.typography.body1,{variants:[{props:({editable:t})=>t,style:{paddingLeft:"2px"}}]})),$V=fe("div",{name:"MuiTreeItem2",slot:"IconContainer",overridesResolver:(e,t)=>t.iconContainer})({width:16,display:"flex",flexShrink:0,justifyContent:"center","& svg":{fontSize:18}});fe(sl,{name:"MuiTreeItem2",slot:"GroupTransition",overridesResolver:(e,t)=>t.groupTransition,shouldForwardProp:e=>No(e)&&e!=="indentationAtItemLevel"})({margin:0,padding:0,paddingLeft:"var(--TreeView-itemChildrenIndentation)",variants:[{props:{indentationAtItemLevel:!0},style:{paddingLeft:0}}]});fe(M.forwardRef((e,t)=>{const{visible:n}=e,r=Ze(e,LV);return n?c.jsx(Pp,Y({},r,{ref:t})):null}),{name:"MuiTreeItem2",slot:"Checkbox",overridesResolver:(e,t)=>t.checkbox})({padding:0});function HV(e){return Ge("MuiRichTreeView",e)}We("MuiRichTreeView",["root"]);const zV=(e,t)=>{const n=M.useRef({}),[r,o]=M.useState(()=>{const s={};return e.forEach(a=>{a.models&&Object.entries(a.models).forEach(([l,u])=>{n.current[l]={isControlled:t[l]!==void 0,getDefaultValue:u.getDefaultValue},s[l]=u.getDefaultValue(t)})}),s});return Object.fromEntries(Object.entries(n.current).map(([s,a])=>{const l=t[s]??r[s];return[s,{value:l,setControlledValue:u=>{a.isControlled||o(d=>Y({},d,{[s]:u}))}}]}))};class UV{constructor(){this.maxListeners=20,this.warnOnce=!1,this.events={}}on(t,n,r={}){let o=this.events[t];o||(o={highPriority:new Map,regular:new Map},this.events[t]=o),r.isFirst?o.highPriority.set(n,!0):o.regular.set(n,!0)}removeListener(t,n){this.events[t]&&(this.events[t].regular.delete(n),this.events[t].highPriority.delete(n))}removeAllListeners(){this.events={}}emit(t,...n){const r=this.events[t];if(!r)return;const o=Array.from(r.highPriority.keys()),i=Array.from(r.regular.keys());for(let s=o.length-1;s>=0;s-=1){const a=o[s];r.highPriority.has(a)&&a.apply(this,n)}for(let s=0;s<i.length;s+=1){const a=i[s];r.regular.has(a)&&a.apply(this,n)}}once(t,n){const r=this;this.on(t,function o(...i){r.removeListener(t,o),n.apply(r,i)})}}const VV=e=>e.isPropagationStopped!==void 0,uE=()=>{const[e]=M.useState(()=>new UV),t=M.useCallback((...r)=>{const[o,i,s={}]=r;s.defaultMuiPrevented=!1,!(VV(s)&&s.isPropagationStopped())&&e.emit(o,i,s)},[e]),n=M.useCallback((r,o)=>(e.on(r,o),()=>{e.removeListener(r,o)}),[e]);return{instance:{$$publishEvent:t,$$subscribeEvent:n}}};uE.params={};const cE=({plugins:e})=>{const t=new Set(e);return{instance:{getAvailablePlugins:()=>t}}};cE.params={};const mh=({params:e,state:t,setState:n})=>{M.useEffect(()=>{n(o=>o.id.treeId===e.id&&o.id.treeId!==void 0?o:Y({},o,{id:Y({},o.id,{treeId:e.id??bV()})}))},[n,e.id]);const r=e.id??t.id.treeId;return{getRootProps:()=>({id:r}),contextValue:{treeId:r}}};mh.params={id:!0};mh.getInitialState=({id:e})=>({id:{treeId:e??void 0}});const WV=[uE,cE,mh],qV=["slots","slotProps","apiRef","experimentalFeatures"],YV=e=>{let{props:{slots:t,slotProps:n,apiRef:r,experimentalFeatures:o},plugins:i}=e,s=Ze(e.props,qV);const a={};i.forEach(h=>{Object.assign(a,h.params)});const l={},u={};Object.keys(s).forEach(h=>{const p=s[h];a[h]?l[h]=p:u[h]=p});const d=o??{},f=i.reduce((h,p)=>p.getDefaultizedParams?p.getDefaultizedParams({params:h,experimentalFeatures:d}):h,l);return{apiRef:r,forwardedProps:u,pluginParams:f,slots:t??{},slotProps:n??{},experimentalFeatures:d}},KV=({plugins:e,instance:t,publicAPI:n,rootRef:r})=>({runItemPlugins:a=>{let l=null,u=null;const d=[],f={};e.forEach(m=>{if(!m.itemPlugin)return;const b=m.itemPlugin({props:a,rootRef:l,contentRef:u});b?.rootRef&&(l=b.rootRef),b?.contentRef&&(u=b.contentRef),b?.propsEnhancers&&(d.push(b.propsEnhancers),Object.keys(b.propsEnhancers).forEach(y=>{f[y]=!0}))});const h=m=>b=>{const y={};return d.forEach(x=>{const C=x[m];C!=null&&Object.assign(y,C(b))}),y},p=Object.fromEntries(Object.keys(f).map(m=>[m,h(m)]));return{contentRef:u,rootRef:l,propsEnhancers:p}},wrapItem:({itemId:a,children:l})=>{let u=l;for(let d=e.length-1;d>=0;d-=1){const f=e[d];f.wrapItem&&(u=f.wrapItem({itemId:a,children:u,instance:t}))}return u},wrapRoot:({children:a})=>{let l=a;for(let u=e.length-1;u>=0;u-=1){const d=e[u];d.wrapRoot&&(l=d.wrapRoot({children:l,instance:t}))}return l},instance:t,rootRef:r,publicAPI:n});function GV(e){const t=M.useRef({});return e?(e.current==null&&(e.current={}),e.current):t.current}const QV=({plugins:e,rootRef:t,props:n})=>{const r=[...WV,...e],{pluginParams:o,forwardedProps:i,apiRef:s,experimentalFeatures:a,slots:l,slotProps:u}=YV({plugins:r,props:n}),d=zV(r,o),h=M.useRef({}).current,p=GV(s),m=M.useRef(null),b=vt(m,t),y=KV({plugins:r,instance:h,publicAPI:p,rootRef:m}),[x,C]=M.useState(()=>{const T={};return r.forEach(N=>{N.getInitialState&&Object.assign(T,N.getInitialState(o))}),T}),v=[],S=T=>{const N=T({instance:h,params:o,slots:l,slotProps:u,experimentalFeatures:a,state:x,setState:C,rootRef:m,models:d,plugins:r});N.getRootProps&&v.push(N.getRootProps),N.publicAPI&&Object.assign(p,N.publicAPI),N.instance&&Object.assign(h,N.instance),N.contextValue&&Object.assign(y,N.contextValue)};return r.forEach(S),{getRootProps:(T={})=>{const N=Y({role:"tree"},i,T,{ref:b});return v.forEach(O=>{Object.assign(N,O(T))}),N},rootRef:b,contextValue:y,instance:h}},XV=(e,t,n)=>{e.$$publishEvent(t,n)},es="__TREE_VIEW_ROOT_PARENT_ID__",ZV=e=>{const t={};return e.forEach((n,r)=>{t[n]=r}),t},JV=["children"],dE=({items:e,isItemDisabled:t,getItemLabel:n,getItemId:r})=>{const o={},i={},s={[es]:[]},a=(u,d,f)=>{const h=r?r(u):u.id;if(h==null)throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.","Alternatively, you can use the `getItemId` prop to specify a custom id for each item.","An item was provided without id in the `items` prop:",JSON.stringify(u)].join(`
|
|
224
224
|
`));if(o[h]!=null)throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.","Alternatively, you can use the `getItemId` prop to specify a custom id for each item.",`Two items were provided with the same id in the \`items\` prop: "${h}"`].join(`
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-D0RRMPyp.cjs.js"),r=require("./ServerProvider-BlufsK4M.cjs.js");exports.AnalyzePackageButton=e.AnalyzePackageButton;exports.BrowserWorkbookStorage=e.BrowserWorkbookStorage;exports.ConnectionExplorer=e.ConnectionExplorer;exports.DOC_LINKS=e.DOC_LINKS;exports.DimensionFilter=e.DimensionFilter;exports.EmbeddedQueryResult=e.EmbeddedQueryResult;exports.Environment=e.Environment;exports.EnvironmentMaterializations=e.EnvironmentMaterializations;exports.Home=e.Home;exports.Loading=e.Loading;exports.Materializations=e.Materializations;exports.Model=e.Model;exports.ModelExplorer=e.ModelExplorer;exports.ModelExplorerDialog=e.ModelExplorerDialog;exports.Models=e.Models;exports.Notebook=e.Notebook;exports.Package=e.Package;exports.Packages=e.Packages;exports.PageViewer=e.PageViewer;exports.QueryResult=e.QueryResult;exports.RenderedResult=e.RenderedResult;exports.ResultContainer=e.ResultContainer;exports.SourceExplorerComponent=e.SourceExplorerComponent;exports.SourcesExplorer=e.SourcesExplorer;exports.Workbook=e.Workbook;exports.WorkbookList=e.WorkbookList;exports.WorkbookManager=e.WorkbookManager;exports.WorkbookStorageProvider=e.WorkbookStorageProvider;exports.buildMalloyExplicitTheme=e.buildMalloyExplicitTheme;exports.buildTableCssVars=e.buildTableCssVars;exports.buildVegaThemeOverride=e.buildVegaThemeOverride;exports.createEmbeddedQueryResult=e.createEmbeddedQueryResult;exports.encodeResourceUri=e.encodeResourceUri;exports.extractDimensionSpecs=e.extractDimensionSpecs;exports.extractSourceFromQuery=e.extractSourceFromQuery;exports.generateFilterClause=e.generateFilterClause;exports.getDimensionKey=e.getDimensionKey;exports.getJoinedSources=e.getJoinedSources;exports.injectWhereClause=e.injectWhereClause;exports.makeDimensionKey=e.makeDimensionKey;exports.parseAllSourceInfos=e.parseAllSourceInfos;exports.parseDimensionFilterAnnotation=e.parseDimensionFilterAnnotation;exports.parseNotebookFilterAnnotation=e.parseNotebookFilterAnnotation;exports.parseResourceUri=e.parseResourceUri;exports.readChartAnnotations=e.readChartAnnotations;exports.useDimensionFilters=e.useDimensionFilters;exports.useDimensionFiltersFromSpec=e.useDimensionFiltersFromSpec;exports.useDimensionFiltersQuery=e.useDimensionFiltersQuery;exports.useDimensionalFilterRangeData=e.useDimensionalFilterRangeData;exports.useGivensForm=e.useGivensForm;exports.useModelData=e.useModelData;exports.useModelGivens=e.useModelGivens;exports.useRawQueryData=e.useRawQueryData;exports.useRouterClickHandler=e.useRouterClickHandler;exports.DEFAULT_THEME=r.DEFAULT_THEME;exports.ServerProvider=r.ServerProvider;exports.ThemeProvider=r.ThemeProvider;exports.resolveMode=r.resolveMode;exports.resolveTheme=r.resolveTheme;exports.usePublisherTheme=r.usePublisherTheme;exports.useServer=r.useServer;
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as s, T as o, C as r, a8 as i, D as n, G as t, E as l, o as u, H as d, L as m, M as c, q as k, r as D, t as p, B as g, N as E, y as b, P as S, F as v, Q as F, R as M, J as R, v as x, S as y, W as C, K as P, U as T, O as h, a2 as A, a3 as Q, a4 as W, I as L, a7 as B, g as H, i as K, j as N, _ as U, k as V, l as f, $ as w, p as z, m as G, n as I, a6 as O, a5 as _, V as j, X as J, Y as q, Z as X, a1 as Y, x as Z, a0 as $, u as ee, e as ae } from "./index-
|
|
2
|
-
import { aC as oe, S as re, aE as ie, aD as ne, aB as te, an as le, u as ue } from "./ServerProvider-
|
|
1
|
+
import { A as s, T as o, C as r, a8 as i, D as n, G as t, E as l, o as u, H as d, L as m, M as c, q as k, r as D, t as p, B as g, N as E, y as b, P as S, F as v, Q as F, R as M, J as R, v as x, S as y, W as C, K as P, U as T, O as h, a2 as A, a3 as Q, a4 as W, I as L, a7 as B, g as H, i as K, j as N, _ as U, k as V, l as f, $ as w, p as z, m as G, n as I, a6 as O, a5 as _, V as j, X as J, Y as q, Z as X, a1 as Y, x as Z, a0 as $, u as ee, e as ae } from "./index-3Ctefu0u.es.js";
|
|
2
|
+
import { aC as oe, S as re, aE as ie, aD as ne, aB as te, an as le, u as ue } from "./ServerProvider-DMk_BDrm.es.js";
|
|
3
3
|
export {
|
|
4
4
|
s as AnalyzePackageButton,
|
|
5
5
|
o as BrowserWorkbookStorage,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloy-publisher/sdk",
|
|
3
3
|
"description": "Malloy Publisher SDK",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.232",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
7
7
|
"module": "dist/index.es.js",
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"react-router-dom": ">=7.6.2",
|
|
72
72
|
"@tanstack/react-query": ">=5.59.16",
|
|
73
73
|
"@malloydata/malloy-explorer": "0.0.338-dev260215172810",
|
|
74
|
-
"@malloydata/malloy-interfaces": "^0.0.
|
|
75
|
-
"@malloydata/malloy-query-builder": "^0.0.
|
|
76
|
-
"@malloydata/malloy-tag": "^0.0.
|
|
77
|
-
"@malloydata/render": "^0.0.
|
|
74
|
+
"@malloydata/malloy-interfaces": "^0.0.426",
|
|
75
|
+
"@malloydata/malloy-query-builder": "^0.0.426",
|
|
76
|
+
"@malloydata/malloy-tag": "^0.0.426",
|
|
77
|
+
"@malloydata/render": "^0.0.426",
|
|
78
78
|
"@mui/icons-material": ">=7.1.1",
|
|
79
79
|
"@mui/x-date-pickers": ">=7.1.1",
|
|
80
80
|
"@mui/material": ">=7.1.1",
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@malloydata/malloy-explorer": "0.0.338-dev260215172810",
|
|
97
|
-
"@malloydata/malloy-query-builder": "^0.0.
|
|
98
|
-
"@malloydata/malloy-tag": "^0.0.
|
|
97
|
+
"@malloydata/malloy-query-builder": "^0.0.426",
|
|
98
|
+
"@malloydata/malloy-tag": "^0.0.426",
|
|
99
99
|
"@openapitools/openapi-generator-cli": "^2.20.2",
|
|
100
100
|
"@types/bun": "^1.2.21",
|
|
101
101
|
"@types/k6": "^1.0.2",
|
|
@@ -316,7 +316,14 @@ export default function Package({
|
|
|
316
316
|
icon={<ContentTypeIcon type="data" />}
|
|
317
317
|
tint={MALLOY_BRAND.darkBlue}
|
|
318
318
|
label={database.path}
|
|
319
|
-
rightLabel={
|
|
319
|
+
rightLabel={
|
|
320
|
+
// A file the server could not probe is listed with
|
|
321
|
+
// `error` and no `info`; show that instead of a
|
|
322
|
+
// row count rather than reading through undefined.
|
|
323
|
+
database.info
|
|
324
|
+
? formatRowCount(database.info.rowCount)
|
|
325
|
+
: "Unreadable"
|
|
326
|
+
}
|
|
320
327
|
onClick={() => setSchemaDatabase(database)}
|
|
321
328
|
/>
|
|
322
329
|
))}
|
|
@@ -366,6 +373,11 @@ export default function Package({
|
|
|
366
373
|
</IconButton>
|
|
367
374
|
</DialogTitle>
|
|
368
375
|
<DialogContent>
|
|
376
|
+
{schemaDatabase?.error && (
|
|
377
|
+
<Typography variant="body2" color="error">
|
|
378
|
+
{schemaDatabase.error}
|
|
379
|
+
</Typography>
|
|
380
|
+
)}
|
|
369
381
|
{schemaDatabase?.info?.columns && (
|
|
370
382
|
<Table size="small">
|
|
371
383
|
<TableHead>
|