@malloy-publisher/server 0.9.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.docker.md +14 -0
  2. package/dist/app/api-doc.yaml +287 -45
  3. package/dist/app/assets/{EnvironmentPage-B-t_QP32.js → EnvironmentPage-uo3igcP9.js} +1 -1
  4. package/dist/app/assets/{HomePage-Cpu2zMy-.js → HomePage-0OQVchl4.js} +1 -1
  5. package/dist/app/assets/MainPage-D4SOACdm.js +1 -0
  6. package/dist/app/assets/ModelPage-B5CpdEDl.js +2 -0
  7. package/dist/app/assets/PackagePage-BzUfTQKy.js +1 -0
  8. package/dist/app/assets/{RenderedResult-CBLHr32C.es-DRr9Gmsz.js → RenderedResult-DwB0-9Yx.es-1MzhmBXH.js} +3 -3
  9. package/dist/app/assets/{RouteError-mgOkv7XK.js → RouteError-BXcrPjvD.js} +1 -1
  10. package/dist/app/assets/ThemeEditorPage-FpYg5NPt.js +1 -0
  11. package/dist/app/assets/ToggleButtonGroup-Vkkjsbxx.js +1 -0
  12. package/dist/app/assets/documentRoutes-BWHzvbNO.js +1 -0
  13. package/dist/app/assets/index-BZEvIUf-.js +484 -0
  14. package/dist/app/assets/index-CprgMbE_.js +1 -0
  15. package/dist/app/assets/{index-IC0jPCkR.js → index-DFvJYp4Q.js} +7 -7
  16. package/dist/app/assets/index-NVPzfbUZ.js +1317 -0
  17. package/dist/app/assets/{index-ireHUsv_.js → index-sKcoT1e_.js} +422 -427
  18. package/dist/app/assets/index.es-D2Ts8adM.js +195 -0
  19. package/dist/app/index.html +1 -1
  20. package/dist/cpufeatures-1yrn0vtw.node +0 -0
  21. package/dist/package_load_worker.mjs +368 -27
  22. package/dist/server.mjs +12986 -9250
  23. package/package.json +15 -15
  24. package/dist/app/assets/LightMode-DOBl6awB.js +0 -1
  25. package/dist/app/assets/MainPage-C7ySrclP.js +0 -1
  26. package/dist/app/assets/ModelPage-D8r_J-N9.js +0 -2
  27. package/dist/app/assets/PackagePage-CcVFBhnT.js +0 -1
  28. package/dist/app/assets/ThemeEditorPage-CIPDs2w9.js +0 -1
  29. package/dist/app/assets/ToggleButtonGroup-CEZThrzh.js +0 -1
  30. package/dist/app/assets/index-Bg-M8sZz.js +0 -1
  31. package/dist/app/assets/index-ByieDZlo.js +0 -23
  32. package/dist/app/assets/index-CGdwupPP.js +0 -457
  33. package/dist/app/assets/index-CeLTZAFW.js +0 -1322
  34. package/dist/app/assets/index-DoF8ihra.js +0 -1
  35. package/dist/app/assets/index.es-6eARPKZf.js +0 -198
  36. package/dist/sshcrypto-cqb52edz.node +0 -0
package/README.docker.md CHANGED
@@ -47,6 +47,20 @@ docker run -d \
47
47
 
48
48
  See the [Docker Hub tags page](https://hub.docker.com/r/ms2data/malloy-publisher/tags) for available versions. Tag-scheme guidance (`:latest`, `:X.Y.Z`) lives in the [deployment guide](../../docs/deployment.md).
49
49
 
50
+ ### Verifying the image
51
+
52
+ Released images are signed with [Sigstore cosign](https://docs.sigstore.dev/cosign/verifying/verify/) using GitHub Actions keyless signing, so there is no public key to distribute: the signing certificate names the workflow that built the image, and the signature is recorded in the public Rekor transparency log. To check that an image was published by this repository's release workflow:
53
+
54
+ ```bash
55
+ cosign verify ms2data/malloy-publisher:X.Y.Z \
56
+ --certificate-identity https://github.com/malloydata/publisher/.github/workflows/docker-image.yml@refs/heads/main \
57
+ --certificate-oidc-issuer https://token.actions.githubusercontent.com
58
+ ```
59
+
60
+ Use cosign v3 or later. The image is signed in the Sigstore bundle format and the signature is stored as an OCI referrer of the image, not as a `sha256-<digest>.sig` tag, so an older cosign or a policy engine that only looks for the `.sig` tag reports no signatures on a signed image.
61
+
62
+ The signature covers the multi-platform manifest list, which references each platform image and its SBOM and SLSA provenance attestations by digest. Those attestations can be read with `docker buildx imagetools inspect ms2data/malloy-publisher:X.Y.Z --format '{{ json .SBOM }}'` (or `.Provenance`). Images released before signing was introduced carry no signature.
63
+
50
64
  ## Runtime layout
51
65
 
52
66
  | Path inside container | What's there |
@@ -1884,6 +1884,33 @@ paths:
1884
1884
  access to all sources, imports, and queries defined in the model.
1885
1885
  Relative imports resolve correctly against sibling model files.
1886
1886
  Returns compilation status and any problems (errors or warnings) found.
1887
+
1888
+ When the submitted source (scope `append`) carries a model-level
1889
+ `## artifact` tag, it is read as a document and the response gains a
1890
+ `document`: the cells and manifest the same text would serve once saved,
1891
+ read from the submitted text alone so the model's own `run:` statements
1892
+ and `##` notes never mix in. The compile runs nothing, including a
1893
+ control's `suggest` query. A cell or tile whose source the caller may
1894
+ not read is not compiled at all and comes back `restricted` with no
1895
+ diagnostic; the rest of the document compiles. A tile expression that
1896
+ uses a construct `append` refuses (a data root of its own, such as
1897
+ `duckdb.table(...)`) is refused with 400, and a tile that does not parse
1898
+ is reported as a `tile-does-not-compile` problem. Submitted text that is a document (it carries the tag, at scope `append`) and writes a render tag turning a value
1899
+ into a URL (`# image`, `# link`), or HTML in a `# label`, is refused with 400
1900
+ before anything compiles, for a field, view or query alike, because other
1901
+ viewers run it; plain `append` text without the tag, and a model file,
1902
+ keep the tags they define themselves. The same refusal covers an annotation that
1903
+ reads `@env.` (in a `##` note too), one the tag parser rejects or that exceeds 8,192 characters,
1904
+ text that frees a column (`except:`, `rename:`) and declares one of the same name
1905
+ in the same extend chain, and one with over 1,000 annotations or 64 KB of them.
1906
+ This removes the author-written paths only: the renderer's other
1907
+ value-to-HTML sinks are not covered by it. A cell that names a source
1908
+ that is both gated and hidden from the caller answers 404 for the whole
1909
+ request, as it does without a document. In a document, problem positions
1910
+ are lines of the submitted text, problems carry no `model` tag, and
1911
+ `includeSql` returns no `sql`. A tag that names no `kind` is a dashboard
1912
+ when it lists `tiles` or carries a `dashboard { … }` grid tag, and a
1913
+ notebook otherwise, since submitted text has no folder to take a kind from.
1887
1914
  parameters:
1888
1915
  - name: environmentName
1889
1916
  in: path
@@ -3073,6 +3100,60 @@ components:
3073
3100
  type: string
3074
3101
  dark:
3075
3102
  type: string
3103
+ border:
3104
+ type: object
3105
+ description: Hairline color for table gridlines and row rules,
3106
+ per mode.
3107
+ properties:
3108
+ light:
3109
+ type: string
3110
+ dark:
3111
+ type: string
3112
+ cardBorder:
3113
+ type: object
3114
+ description: Edge color of a dashboard card and of a pinned table
3115
+ header row, per mode. A step stronger than `border`, so a
3116
+ card reads as a card on a page whose ground and tile share
3117
+ one colour.
3118
+ properties:
3119
+ light:
3120
+ type: string
3121
+ dark:
3122
+ type: string
3123
+ axis:
3124
+ type: object
3125
+ description: Color of chart axis domain and tick lines, per mode.
3126
+ properties:
3127
+ light:
3128
+ type: string
3129
+ dark:
3130
+ type: string
3131
+ gridline:
3132
+ type: object
3133
+ description: Color of chart gridlines, per mode.
3134
+ properties:
3135
+ light:
3136
+ type: string
3137
+ dark:
3138
+ type: string
3139
+ chartText:
3140
+ type: object
3141
+ description: Color of chart text (axis labels and titles, legend,
3142
+ chart and header titles), per mode.
3143
+ properties:
3144
+ light:
3145
+ type: string
3146
+ dark:
3147
+ type: string
3148
+ value:
3149
+ type: object
3150
+ description: Color of the big-value (KPI) number in a dashboard
3151
+ tile, per mode.
3152
+ properties:
3153
+ light:
3154
+ type: string
3155
+ dark:
3156
+ type: string
3076
3157
  font:
3077
3158
  type: object
3078
3159
  description:
@@ -3680,75 +3761,173 @@ components:
3680
3761
  description: >-
3681
3762
  Server-computed, read-only: the state of this package's semantic
3682
3763
  discovery index, which is what `get_context` ranks against
3683
- when an embedding provider is configured. Absent when the server
3684
- has no provider, because there is no index to describe.
3764
+ when an embedding provider is configured. `status: lexical` when
3765
+ the server has no provider, because there is no index to describe.
3685
3766
 
3686
3767
  PackageEmbeddingIndex:
3687
3768
  type: object
3688
3769
  readOnly: true
3689
3770
  description: >-
3690
- State of a package's semantic discovery index. Poll `status` until
3691
- `ready` to know retrieval is warm - before this, that state existed
3692
- only as a server log line, so anything waiting on a warm index had to
3693
- scrape logs. Send the package one `get_context` question first, then
3694
- poll: only a question starts the sync, and a restart forgets which
3695
- syncs completed, so after every restart each package reads `indexing`
3696
- until it is asked something. Polling before asking waits forever.
3771
+ State of a package's semantic discovery index. The server builds the
3772
+ index in the background when the package loads (and reloads), one
3773
+ package at a time across the whole server, saving each batch of vectors
3774
+ as it goes. Poll `status` until `ready` to know retrieval is warm.
3775
+ While `indexing`, `embeddedRows` rises toward `totalRows`. A restart
3776
+ starts every package's index again, but vectors already stored for
3777
+ unchanged content are reused, so a restart over an unchanged package
3778
+ embeds nothing new.
3697
3779
  Every count is scoped to the embedding model currently configured, so
3698
- rows left behind by an earlier model are never counted. Read `status` for readiness and the counts for
3699
- coverage: they answer different questions, and only `status` tracks
3700
- what the search path will do. The first read after a package loads or
3701
- reloads builds the package's entity index and its content
3702
- fingerprint, which is work a metadata read would not otherwise do.
3703
- After that a read is two row counts and never waits on a sync, so
3704
- polling is cheap.
3780
+ rows left behind by an earlier model are never counted. Read `status`
3781
+ for readiness and the counts for progress: they answer different
3782
+ questions, and only `status` tracks what the search path will do. The
3783
+ first read after a package loads builds the package's entity index and
3784
+ its content fingerprint, which is work a metadata read would not
3785
+ otherwise do. After that a read is two row counts and never waits on a
3786
+ sync, so polling is cheap.
3705
3787
  properties:
3706
3788
  status:
3707
3789
  type: string
3708
3790
  enum:
3791
+ - lexical
3709
3792
  - indexing
3710
3793
  - ready
3794
+ - error
3711
3795
  - cooldown
3712
3796
  - too-many-entities
3713
3797
  description: >-
3714
- `ready` = the index is warm, so the next `get_context` question
3715
- about this package is ranked semantically rather than lexically.
3716
- (It is a statement about the index, not a promise about the next
3717
- response: a question whose own query embedding fails still falls
3718
- back, reporting `retrieval_reason: provider-error`.) It is decided
3719
- by the same completed sync the search path gates on, not by
3720
- whether cached rows happen to cover the current entity names.
3721
- Those two differ exactly where it matters - the rows outlive a
3722
- restart and a reload, so a coverage test called an index warm
3723
- while the next question was still answered lexically.
3724
- `indexing` = no completed sync covers the package's current
3725
- content under the current model, so retrieval answers lexically
3726
- meanwhile. A reload whose files did not change stays `ready`,
3727
- because the vectors still describe that content. Four things move
3728
- a package to `indexing`: an edit, a new package, a changed
3729
- `EMBEDDING_MODEL`, and a server restart - the sync is recorded in
3730
- memory, so a restart reports `indexing` until the first question
3731
- re-establishes it, even though the vectors are still on disk. It
3732
- clears when a `get_context` question triggers a sync, which is
3733
- what builds the index; a package nothing has ever queried does not
3734
- warm on its own.
3735
- `cooldown` = the provider failed recently, so the semantic path is
3736
- short-circuited for a window. `too-many-entities` = the package has
3737
- more entities than the embedding cap, so it stays lexical
3738
- permanently rather than transiently. The same vocabulary as
3739
- `get_context`'s `retrieval_reason`, deliberately.
3798
+ `lexical` = no embedding provider is configured, so `get_context`
3799
+ ranks by words only. That is a mode of the server, not a failure.
3800
+ `indexing` = vectors for this package are being built or are
3801
+ queued behind another package's; while this lasts and a provider is
3802
+ configured, `get_context` answers a search with an "indexing"
3803
+ message and no results, not a lexical ranking. `ready` = the index
3804
+ is warm, so the next `get_context` question about this package is
3805
+ ranked semantically. (It is a statement about the index, not a
3806
+ promise about the next response: a question whose own query
3807
+ embedding fails returns an error naming the provider failure.) It
3808
+ is decided by the same completed sync the search path gates on, not
3809
+ by whether cached rows happen to cover the current entity names.
3810
+ `error` = the index cannot serve now; `reason` and `lastError`
3811
+ say why. A changed `EMBEDDING_MODEL` or a changed package moves a
3812
+ `ready` package back to `indexing`.
3813
+ `cooldown` and `too-many-entities` are deprecated. Earlier versions
3814
+ reported them as the `status` itself; they are now the `reason` of
3815
+ an `error`. They stay in this list so a client generated from an
3816
+ earlier spec still understands every value, and they are never sent.
3817
+ reason:
3818
+ type: string
3819
+ enum:
3820
+ - cooldown
3821
+ - too-many-entities
3822
+ description: >-
3823
+ Present when `status` is `error` for one of two reasons that earlier
3824
+ versions reported as the `status` itself. `cooldown` = the provider
3825
+ failed (after retries) and the package is waiting out a window
3826
+ before the next try; `lastError.retryAt` says when. `too-many-entities`
3827
+ = the package has more entities than the embedding cap, which no
3828
+ retry fixes. Absent for other errors, such as an invalid embedding
3829
+ configuration, which `lastError.message` describes.
3830
+ stage:
3831
+ type: string
3832
+ enum:
3833
+ - keyphrase
3834
+ - source_summary
3835
+ description: >-
3836
+ The sync stage that failed, when `status` is `error` because of one.
3837
+ `keyphrase` = the LLM could not write the package's keyphrases
3838
+ (after retries), so nothing was embedded; `source_summary` = the
3839
+ LLM could not write the package's source summaries (after retries),
3840
+ so nothing was embedded. `lastError.message` has the reason.
3841
+ Absent when the embedding call itself failed.
3842
+ keyphraseProgress:
3843
+ type: object
3844
+ description: >-
3845
+ Present only when keyphrases are on: the package asks for them
3846
+ (`retrieval.keyphrases` is `auto` or `always`, the default being
3847
+ `auto`) and `retrieval.llm` is configured. Counts the entities whose
3848
+ keyphrase comes from the LLM; an entity with a short description
3849
+ uses it as its keyphrase and is not counted.
3850
+ properties:
3851
+ done:
3852
+ type: integer
3853
+ description: Entities that need an LLM keyphrase and have one stored.
3854
+ total:
3855
+ type: integer
3856
+ description: Entities that need an LLM keyphrase.
3857
+ capped:
3858
+ type: boolean
3859
+ description: >-
3860
+ True when `retrieval.llm.maxCallsPerSync` stopped the step before
3861
+ every entity had one. The status can be `ready` with `done` below
3862
+ `total`; the next sync (a restart) continues from there.
3863
+ sourceSummaryProgress:
3864
+ type: object
3865
+ description: >-
3866
+ Present only when source summaries are on: the package does not turn
3867
+ them off (`retrieval.sourceSummary.enabled` is `auto` or `true`, the
3868
+ default being `auto`) and `retrieval.llm` is configured. Counts the
3869
+ sources that get an LLM-written summary. A source with no fields is
3870
+ not counted.
3871
+ properties:
3872
+ done:
3873
+ type: integer
3874
+ description: Sources that get a summary and have a current one stored.
3875
+ total:
3876
+ type: integer
3877
+ description: Sources that get a summary.
3878
+ capped:
3879
+ type: boolean
3880
+ description: >-
3881
+ True when `retrieval.llm.maxCallsPerSync` stopped the step before
3882
+ every source had one. The status can be `ready` with `done` below
3883
+ `total`; the next sync (a restart) continues from there.
3884
+ lastError:
3885
+ type: object
3886
+ description: Present when `status` is `error`.
3887
+ properties:
3888
+ message:
3889
+ type: string
3890
+ description: >-
3891
+ What went wrong, with the fix where there is one. Never
3892
+ contains the provider's URL or the API key; the full error
3893
+ is in the server log.
3894
+ retryAt:
3895
+ type: string
3896
+ format: date-time
3897
+ description: >-
3898
+ The earliest time a retry can start. Nothing retries on a
3899
+ timer: the first `get_context` question about this package
3900
+ after this time starts the retry, so a package nobody asks
3901
+ about stays in `error` and a status poll alone never sees it
3902
+ recover. Absent when no retry can start (for example
3903
+ `too-many-entities`).
3904
+ startedAt:
3905
+ type: string
3906
+ format: date-time
3907
+ description: >-
3908
+ When the sync now running began. Absent when none is running,
3909
+ including while this package waits its turn in the queue.
3740
3910
  embeddedRows:
3741
3911
  type: integer
3742
3912
  description: >-
3743
3913
  Cached vectors for this package under the current embedding model.
3744
- An entity contributes one row for its name plus one per chunk of
3745
- its documentation, so this exceeds `totalEntities` on a documented
3746
- model and is not a count of entities. Scoped by model only, not by
3914
+ With the default `retrieval.representation` of `single` an entity
3915
+ contributes one row, so this equals `totalEntities` once indexed.
3916
+ With `facets` an entity contributes one row for its name plus one
3917
+ per chunk of its documentation, so this exceeds `totalEntities` on
3918
+ a documented model and is not a count of entities. A keyphrase row
3919
+ is an extra on top of those and is not counted here or in
3920
+ `totalRows`. Scoped by model only, not by
3747
3921
  vector length, so it counts what is cached rather than what a
3748
3922
  search could read today: after a change to `EMBEDDING_DIMENSIONS`
3749
3923
  that no question has probed yet, rows of the old length are still
3750
3924
  counted here until the next search discards them. `status` is
3751
3925
  already `indexing` in that window.
3926
+ totalRows:
3927
+ type: integer
3928
+ description: >-
3929
+ Rows the package wants cached: the denominator for `embeddedRows`.
3930
+ `embeddedRows` of `totalRows` is the progress of a first index.
3752
3931
  totalEntities:
3753
3932
  type: integer
3754
3933
  description: Entities the package currently exposes to retrieval.
@@ -4097,6 +4276,12 @@ components:
4097
4276
  the `query` field of a `POST …/models/{path}/query` body, prefixed
4098
4277
  with `run:`. Sending it in `queryName`, the field
4099
4278
  `DashboardManifest.query` takes, is rejected.
4279
+ restricted:
4280
+ type: boolean
4281
+ description: >-
4282
+ Set on a tile of a compiled document (`CompileResult.document`) whose
4283
+ source the caller may not read. The tile carries its `query` and
4284
+ nothing derived from the source: no `givenNames`, no layout tags.
4100
4285
  givenNames:
4101
4286
  type: array
4102
4287
  items:
@@ -4425,6 +4610,13 @@ components:
4425
4610
  description: Annotations attached to the given declaration
4426
4611
  items:
4427
4612
  type: string
4613
+ secure:
4614
+ type: boolean
4615
+ description: >-
4616
+ True when the declaration carries `#(secure)`: its value is the
4617
+ host's to set. The builder withholds its control only when it edits
4618
+ a document held as text; a saved dashboard or notebook renders it
4619
+ as before. Absent otherwise.
4428
4620
  default:
4429
4621
  type: string
4430
4622
  description: The given's default value as a Malloy source literal
@@ -4764,6 +4956,12 @@ components:
4764
4956
  maxItems: 2
4765
4957
  items:
4766
4958
  type: integer
4959
+ restricted:
4960
+ type: boolean
4961
+ description: >-
4962
+ Set on a cell of a compiled document (`CompileResult.document`) whose
4963
+ source the caller may not read. It was not compiled, so nothing else
4964
+ is known about what it reads.
4767
4965
  codeLine:
4768
4966
  type: integer
4769
4967
  description:
@@ -6060,6 +6258,16 @@ components:
6060
6258
  and a model that does not exist is a 400 that deliberately says only
6061
6259
  that it could not be loaded. An invalid scope value is rejected with
6062
6260
  a 400 naming the valid set.
6261
+
6262
+ "append" text that carries a model-level `## artifact` tag is a
6263
+ document, which other viewers run, and is also refused with a 400
6264
+ for `# image`, `# link`, markup in a `# label`, `@env.` in an
6265
+ annotation, an annotation the tag parser rejects or that exceeds
6266
+ 8,192 characters, `except:` or `rename:` followed by a declaration
6267
+ of the same name in the same extend chain, and more than 1,000
6268
+ annotations or 64 KB of them. Plain "append" text without that tag
6269
+ keeps those tags; a model file defines them itself, and its edit is
6270
+ checked at "file".
6063
6271
  includeSql:
6064
6272
  type: boolean
6065
6273
  default: false
@@ -6126,6 +6334,40 @@ components:
6126
6334
  description:
6127
6335
  Generated SQL for the compiled query. Only present when includeSql
6128
6336
  is true and compilation succeeds with a runnable query.
6337
+ document:
6338
+ $ref: "#/components/schemas/CompiledDocument"
6339
+
6340
+ CompiledDocument:
6341
+ type: object
6342
+ description: >-
6343
+ The document a compiled source describes, in the shape the same text
6344
+ serves once saved. Present only when the source carries a model-level
6345
+ `## artifact` tag and compiled far enough to read.
6346
+ properties:
6347
+ kind:
6348
+ type: string
6349
+ enum: [dashboard, notebook]
6350
+ description: >-
6351
+ From the tag's `kind`. When it names none, a document that lists
6352
+ `tiles` or carries a `dashboard { … }` grid tag is a dashboard and
6353
+ any other is a notebook: submitted text has no folder to decide.
6354
+ manifest:
6355
+ allOf:
6356
+ - $ref: "#/components/schemas/DashboardManifest"
6357
+ description: >-
6358
+ Shaped like a served dashboard's manifest, with two differences:
6359
+ `path` is absent (the text runs on the model it was compiled on top
6360
+ of, which is the model in the request URL) and `name` is that
6361
+ model's file slug rather than a document name, which the host owns;
6362
+ `title` is the heading.
6363
+ cells:
6364
+ type: array
6365
+ description: >-
6366
+ The file's own cells. A document laid out as tiles lists only its
6367
+ definition cells, as a saved one does; its prose and queries are
6368
+ `manifest.tiles`.
6369
+ items:
6370
+ $ref: "#/components/schemas/NotebookCell"
6129
6371
 
6130
6372
  CompileProblem:
6131
6373
  type: object
@@ -1 +1 @@
1
- import{m as r,G as t,j as e,a2 as i,ak as o}from"./index-CGdwupPP.js";function c(){const s=r(),{environmentName:n}=t();if(n){const a=i({environmentName:n});return e.jsx(o,{onSelectPackage:s,resourceUri:a})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing environment name"})})}export{c as default};
1
+ import{q as r,E as t,j as e,a5 as i,am as o}from"./index-BZEvIUf-.js";function c(){const s=r(),{environmentName:n}=t();if(n){const a=i({environmentName:n});return e.jsx(o,{onSelectPackage:s,resourceUri:a})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing environment name"})})}export{c as default};
@@ -1 +1 @@
1
- import{m as t,j as o,D as a}from"./index-CGdwupPP.js";function s(){const n=t();return o.jsx(a,{onClickEnvironment:n})}export{s as default};
1
+ import{q as t,j as o,J as a}from"./index-BZEvIUf-.js";function s(){const n=t();return o.jsx(a,{onClickEnvironment:n})}export{s as default};
@@ -0,0 +1 @@
1
+ import{c as g,j as t,s as E,B as Se,m as Q,e as le,g as he,a as xe,r as u,u as me,b as Me,d as V,f as fe,T as G,h as K,i as Ce,k as Pe,l as Ee,o as ge,n as ze,p as Ie,t as ce,v as De,w as Te,x as N,y as $,M as Re,P as Be,z as Le,S as He,A as Z,C as $e,D as Oe,I as de,E as ye,q as J,F as p,G as Ne,H as Y,K as W,L as ee,N as Ae,O as Ve,Q as pe,R as We,U as te,V as re,W as ne,X as Fe,Y as Ue,Z as _e,_ as Xe}from"./index-BZEvIUf-.js";import{e as Ye,s as qe}from"./documentRoutes-BWHzvbNO.js";const Qe=g(t.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),Ge=E(Se,{name:"MuiBreadcrumbCollapsed"})(Q(({theme:e})=>({display:"flex",marginLeft:`calc(${e.spacing(1)} * 0.5)`,marginRight:`calc(${e.spacing(1)} * 0.5)`,...e.palette.mode==="light"?{backgroundColor:e.palette.grey[100],color:e.palette.grey[700]}:{backgroundColor:e.palette.grey[700],color:e.palette.grey[100]},borderRadius:2,"&:hover, &:focus":{...e.palette.mode==="light"?{backgroundColor:e.palette.grey[200]}:{backgroundColor:e.palette.grey[600]}},"&:active":{boxShadow:e.shadows[0],...e.palette.mode==="light"?{backgroundColor:le(e.palette.grey[200],.12)}:{backgroundColor:le(e.palette.grey[600],.12)}}}))),Ke=E(Qe)({width:24,height:16});function Ze(e){const{slots:r={},slotProps:o={},...n}=e,s=e;return t.jsx("li",{children:t.jsx(Ge,{focusRipple:!0,...n,ownerState:s,children:t.jsx(Ke,{as:r.CollapsedIcon,ownerState:s,...o.collapsedIcon})})})}function Je(e){return he("MuiBreadcrumbs",e)}const et=xe("MuiBreadcrumbs",["root","ol","li","separator"]),tt=e=>{const{classes:r}=e;return fe({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},Je,r)},rt=E(G,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,r)=>[{[`& .${et.li}`]:r.li},r.root]})({}),nt=E("ol",{name:"MuiBreadcrumbs",slot:"Ol"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),ot=E("li",{name:"MuiBreadcrumbs",slot:"Separator"})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function st(e,r,o,n){return e.reduce((s,l,i)=>(i<e.length-1?s=s.concat(l,t.jsx(ot,{"aria-hidden":!0,className:r,ownerState:n,children:o},`separator-${i}`)):s.push(l),s),[])}const at=u.forwardRef(function(r,o){const n=me({props:r,name:"MuiBreadcrumbs"}),{children:s,className:l,component:i="nav",slots:d={},slotProps:f={},expandText:h="Show path",itemsAfterCollapse:m=1,itemsBeforeCollapse:v=1,maxItems:y=8,separator:z="/",...H}=n,[I,M]=u.useState(!1),j={...n,component:i,expanded:I,expandText:h,itemsAfterCollapse:m,itemsBeforeCollapse:v,maxItems:y,separator:z},C=tt(j),D=Me({elementType:d.CollapsedIcon,externalSlotProps:f.collapsedIcon,ownerState:j}),k=u.useRef(null),w=c=>{const S=()=>{M(!0);const b=k.current.querySelector("a[href],button,[tabindex]");b&&b.focus()};return v+m>=c.length?c:[...c.slice(0,v),t.jsx(Ze,{"aria-label":h,slots:{CollapsedIcon:d.CollapsedIcon},slotProps:{collapsedIcon:D},onClick:S},"ellipsis"),...c.slice(c.length-m,c.length)]},T=u.Children.toArray(s).filter(c=>u.isValidElement(c)).map((c,S)=>t.jsx("li",{className:C.li,children:c},`child-${S}`));return t.jsx(rt,{ref:o,component:i,color:"textSecondary",className:V(C.root,l),ownerState:j,...H,children:t.jsx(nt,{className:C.ol,ref:k,ownerState:j,children:st(I||y&&T.length<=y?T:w(T),C.separator,z,j)})})});function it(e,r,o){const n=r.getBoundingClientRect(),s=o&&o.getBoundingClientRect(),l=ge(r);let i;if(r.fakeTransform)i=r.fakeTransform;else{const h=l.getComputedStyle(r);i=h.getPropertyValue("-webkit-transform")||h.getPropertyValue("transform")}let d=0,f=0;if(i&&i!=="none"&&typeof i=="string"){const h=i.split("(")[1].split(")")[0].split(",");d=parseInt(h[4],10),f=parseInt(h[5],10)}return e==="left"?s?`translateX(${s.right+d-n.left}px)`:`translateX(${l.innerWidth+d-n.left}px)`:e==="right"?s?`translateX(-${n.right-s.left-d}px)`:`translateX(-${n.left+n.width-d}px)`:e==="up"?s?`translateY(${s.bottom+f-n.top}px)`:`translateY(${l.innerHeight+f-n.top}px)`:s?`translateY(-${n.top-s.top+n.height-f}px)`:`translateY(-${n.top+n.height-f}px)`}function lt(e){return typeof e=="function"?e():e}function A(e,r,o){const n=lt(o),s=it(e,r,n);s&&(r.style.webkitTransform=s,r.style.transform=s)}const ct=u.forwardRef(function(r,o){const n=K(),s={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},l={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:i,appear:d=!0,children:f,container:h,direction:m="down",easing:v=s,in:y,onEnter:z,onEntered:H,onEntering:I,onExit:M,onExited:j,onExiting:C,style:D,timeout:k=l,TransitionComponent:w=Ce,...T}=r,c=u.useRef(null),S=Pe(Ee(f),c,o),b=a=>x=>{a&&(x===void 0?a(c.current):a(c.current,x))},F=b((a,x)=>{A(m,a,h),Ie(a),z&&z(a,x)}),se=b((a,x)=>{const L=ce({timeout:k,style:D,easing:v},{mode:"enter"});a.style.webkitTransition=n.transitions.create("-webkit-transform",{...L}),a.style.transition=n.transitions.create("transform",{...L}),a.style.webkitTransform="none",a.style.transform="none",I&&I(a,x)}),R=b(H),B=b(C),P=b(a=>{const x=ce({timeout:k,style:D,easing:v},{mode:"exit"});a.style.webkitTransition=n.transitions.create("-webkit-transform",x),a.style.transition=n.transitions.create("transform",x),A(m,a,h),M&&M(a)}),U=b(a=>{a.style.webkitTransition="",a.style.transition="",j&&j(a)}),_=a=>{i&&i(c.current,a)},O=u.useCallback(()=>{c.current&&A(m,c.current,h)},[m,h]);return u.useEffect(()=>{if(y||m==="down"||m==="right")return;const a=ze(()=>{c.current&&A(m,c.current,h)}),x=ge(c.current);return x.addEventListener("resize",a),()=>{a.clear(),x.removeEventListener("resize",a)}},[m,y,h]),u.useEffect(()=>{y||O()},[y,O]),t.jsx(w,{nodeRef:c,onEnter:F,onEntered:R,onEntering:se,onExit:P,onExited:U,onExiting:B,addEndListener:_,appear:d,in:y,timeout:k,...T,children:(a,{ownerState:x,...L})=>u.cloneElement(f,{ref:S,style:{visibility:a==="exited"&&!y?"hidden":void 0,...D,...f.props.style},...L})})});function dt(e){return he("MuiDrawer",e)}xe("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const be=(e,r)=>{const{ownerState:o}=e;return[r.root,(o.variant==="permanent"||o.variant==="persistent")&&r.docked,r.modal]},pt=e=>{const{classes:r,anchor:o,variant:n}=e,s={root:["root",`anchor${$(o)}`],docked:[(n==="permanent"||n==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${$(o)}`,n!=="temporary"&&`paperAnchorDocked${$(o)}`]};return fe(s,dt,r)},ut=E(Re,{name:"MuiDrawer",slot:"Root",overridesResolver:be})(Q(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),ht=E("div",{shouldForwardProp:Le,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:be})({flex:"0 0 auto"}),xt=E(Be,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,r)=>{const{ownerState:o}=e;return[r.paper,r[`paperAnchor${$(o.anchor)}`],o.variant!=="temporary"&&r[`paperAnchorDocked${$(o.anchor)}`]]}})(Q(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:r})=>r.anchor==="left"&&r.variant!=="temporary",style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="top"&&r.variant!=="temporary",style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="right"&&r.variant!=="temporary",style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="bottom"&&r.variant!=="temporary",style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),je={left:"right",right:"left",top:"down",bottom:"up"};function mt(e){return["left","right"].includes(e)}function ft({direction:e},r){return e==="rtl"&&mt(r)?je[r]:r}const gt=u.forwardRef(function(r,o){const n=me({props:r,name:"MuiDrawer"}),s=K(),l=De(),i={enter:s.transitions.duration.enteringScreen,exit:s.transitions.duration.leavingScreen},{anchor:d="left",BackdropProps:f,children:h,className:m,elevation:v=16,hideBackdrop:y=!1,ModalProps:{BackdropProps:z,...H}={},onClose:I,open:M=!1,PaperProps:j={},SlideProps:C,TransitionComponent:D,transitionDuration:k=i,variant:w="temporary",slots:T={},slotProps:c={},...S}=n,b=u.useRef(!1);u.useEffect(()=>{b.current=!0},[]);const F=ft({direction:l?"rtl":"ltr"},d),R={...n,anchor:d,elevation:v,open:M,variant:w,...S},B=pt(R),P={slots:{transition:D,...T},slotProps:{paper:j,transition:C,...c,backdrop:Te(c.backdrop||{...f,...z},{transitionDuration:k})}},[U,_]=N("root",{ref:o,elementType:ut,className:V(B.root,B.modal,m),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...P,...S,...H},additionalProps:{open:M,onClose:I,hideBackdrop:y,slots:{backdrop:P.slots.backdrop},slotProps:{backdrop:P.slotProps.backdrop}}}),[O,a]=N("paper",{elementType:xt,shouldForwardComponentProp:!0,className:V(B.paper,j.className),ownerState:R,externalForwardedProps:P,additionalProps:{elevation:w==="temporary"?v:0,square:!0,...w==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[x,L]=N("docked",{elementType:ht,ref:o,className:V(B.root,B.docked,m),ownerState:R,externalForwardedProps:P,additionalProps:S}),[ke,we]=N("transition",{elementType:ct,ownerState:R,externalForwardedProps:P,additionalProps:{in:M,direction:je[F],timeout:k,appear:b.current}}),ae=t.jsx(O,{...a,children:h});if(w==="permanent")return t.jsx(x,{...L,children:ae});const ie=t.jsx(ke,{...we,children:ae});return w==="persistent"?t.jsx(x,{...L,children:ie}):t.jsx(U,{..._,children:ie})}),yt=g([t.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),t.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),bt=g(t.jsx("path",{d:"M10.85 12.65h2.3L12 9zM20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM14.3 16l-.7-2h-3.2l-.7 2H7.8L11 7h2l3.2 9z"})),jt=g(t.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),vt=g(t.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"})),kt=g(t.jsx("path",{d:"M9.37 5.51c-.18.64-.27 1.31-.27 1.99 0 4.08 3.32 7.4 7.4 7.4.68 0 1.35-.09 1.99-.27C17.45 17.19 14.93 19 12 19c-3.86 0-7-3.14-7-7 0-2.93 1.81-5.45 4.37-6.49M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1"})),wt=g(t.jsx("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"})),St=g(t.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"})),Mt=g(t.jsx("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81zM12 3 2 12h3v8h6v-6h2v6h6v-8h3z"})),Ct=g(t.jsx("path",{d:"M12 9c1.65 0 3 1.35 3 3s-1.35 3-3 3-3-1.35-3-3 1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z"})),Pt=g(t.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"})),Et=g([t.jsx("path",{d:"M12 22C6.49 22 2 17.51 2 12S6.49 2 12 2s10 4.04 10 9c0 3.31-2.69 6-6 6h-1.77c-.28 0-.5.22-.5.5 0 .12.05.23.13.33.41.47.64 1.06.64 1.67 0 1.38-1.12 2.5-2.5 2.5m0-18c-4.41 0-8 3.59-8 8s3.59 8 8 8c.28 0 .5-.22.5-.5 0-.16-.08-.28-.14-.35-.41-.46-.63-1.05-.63-1.65 0-1.38 1.12-2.5 2.5-2.5H16c2.21 0 4-1.79 4-4 0-3.86-3.59-7-8-7"},"0"),t.jsx("circle",{cx:"6.5",cy:"11.5",r:"1.5"},"1"),t.jsx("circle",{cx:"9.5",cy:"7.5",r:"1.5"},"2"),t.jsx("circle",{cx:"14.5",cy:"7.5",r:"1.5"},"3"),t.jsx("circle",{cx:"17.5",cy:"11.5",r:"1.5"},"4")]),zt=g(t.jsx("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5C19.17 14.87 15.79 17 12 17s-7.17-2.13-8.82-5.5C4.83 8.13 8.21 6 12 6m0-2C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4m0 5c1.38 0 2.5 1.12 2.5 2.5S13.38 14 12 14s-2.5-1.12-2.5-2.5S10.62 9 12 9m0-2c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7"}));function q(e){return t.jsxs(He,{...e,viewBox:"0 0 24 24",sx:{fill:"none",...e.sx},children:[t.jsx("rect",{x:"3.25",y:"4.75",width:"17.5",height:"14.5",rx:"2.25",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("line",{x1:"8.5",y1:"5",x2:"8.5",y2:"19",stroke:"currentColor",strokeWidth:"1.5"})]})}const It=/^(.*\/[^/]+\/[^/]+\/(?:dashboards|notebooks)\/([^/]+?))(\/edit)?\/?$/,Dt=/\.malloy(nb)?$/;function Tt(){const{pathname:e}=Z(),r=$e(),o=Oe(),n=It.exec(e);if(!n||o)return null;const[,s,l,i]=n;return Dt.test(l)?null:i?t.jsx(de,{label:"View",icon:t.jsx(zt,{}),onClick:()=>r(s)}):t.jsx(de,{label:"Edit",icon:t.jsx(wt,{}),onClick:()=>r(Ye(s))})}function X({label:e,onClick:r}){return t.jsx(Ne,{clickable:!0,onClick:r,label:e,size:"small","aria-label":`Navigate to ${e}`,sx:o=>({backgroundColor:"transparent",border:`1px solid ${o.palette.divider}`,color:"text.primary",fontWeight:500,fontSize:"0.875rem",height:32,cursor:"pointer",borderRadius:"4px",maxWidth:320,"& .MuiChip-label":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},"&:hover":{backgroundColor:o.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}})})}function Rt(){const e=ye(),r=e["*"]?qe(e["*"]).path:void 0,o=J();return!e.environmentName&&!e.packageName&&!r?null:t.jsx(p,{sx:{display:"flex",alignItems:"center",minWidth:0},children:t.jsxs(at,{"aria-label":"breadcrumb",separator:t.jsx(jt,{sx:{fontSize:14,color:"text.secondary"}}),children:[e.environmentName&&t.jsx(X,{label:e.environmentName,onClick:n=>o(`/${e.environmentName}/`,n)}),e.packageName&&t.jsx(X,{label:e.packageName,onClick:n=>o(`/${e.environmentName}/${e.packageName}/`,n)}),r&&t.jsx(X,{label:r,onClick:n=>o(`/${e.environmentName}/${e.packageName}/${r}`,n)})]})})}const Bt=260,Lt=64;function ve({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){return t.jsxs(p,{sx:{height:"100dvh",width:e?Lt:Bt,flexShrink:0,display:"flex",flexDirection:"column",backgroundColor:"background.paper",transition:"width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden"},children:[t.jsx(Ht,{isCollapsed:e,onToggleCollapse:r,logoHeader:o}),t.jsxs(p,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",py:1},children:[t.jsx($t,{isCollapsed:e}),t.jsx(Ot,{isCollapsed:e})]}),t.jsx(Nt,{isCollapsed:e})]})}function Ht({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){const n=J();return o?t.jsxs(p,{sx:{height:56,display:"flex",alignItems:"center",justifyContent:"space-between",px:e?0:2,flexShrink:0},children:[o,t.jsx(Y,{size:"small",onClick:r,"aria-label":e?"Expand sidebar":"Collapse sidebar",children:t.jsx(q,{fontSize:"small"})})]}):t.jsxs(p,{sx:{minHeight:56,display:"flex",flexDirection:e?"column":"row",alignItems:"center",justifyContent:e?"center":"space-between",gap:e?.5:0,py:e?1:0,px:e?0:2,flexShrink:0},children:[t.jsxs(p,{onClick:s=>n("/",s),sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer",minWidth:0},children:[t.jsx(p,{component:"img",src:"/logo.svg",alt:"Malloy",sx:{width:24,height:24,flexShrink:0}}),!e&&t.jsx(G,{variant:"subtitle1",sx:{color:"text.primary",fontWeight:500,letterSpacing:"-0.025em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Malloy Publisher"})]}),t.jsx(W,{title:e?"Expand sidebar":"Collapse sidebar",placement:"right",children:t.jsx(Y,{size:"small",onClick:r,"aria-label":e?"Expand sidebar":"Collapse sidebar",children:t.jsx(q,{fontSize:"small"})})})]})}function $t({isCollapsed:e}){const o=Z().pathname==="/";return t.jsx(ee,{sx:{py:0},children:t.jsx(oe,{icon:t.jsx(Mt,{fontSize:"small"}),label:"Home",to:"/",selected:o,isCollapsed:e})})}function Ot({isCollapsed:e}){const{apiClients:r}=Ae(),o=ye(),{data:n}=Ve({queryKey:["environments"],queryFn:()=>r.environments.listEnvironments()}),s=n?.data??[];return s.length===0?null:t.jsxs(p,{sx:{mt:1},children:[!e&&t.jsx(G,{variant:"caption",sx:{display:"block",px:3,py:1,color:"text.secondary",fontWeight:500,textTransform:"uppercase",fontSize:"0.6875rem",letterSpacing:"0.5px"},children:"Environments"}),t.jsx(ee,{sx:{py:0},children:s.map(l=>{const i=l.name??"";return t.jsx(oe,{icon:t.jsx(St,{fontSize:"small"}),label:i,to:`/${i}`,selected:o.environmentName===i,isCollapsed:e},i)})})]})}function Nt({isCollapsed:e}){const{pathname:r}=Z(),o=[{label:"Malloy Docs",href:pe.docsHome,icon:t.jsx(yt,{fontSize:"small"}),external:!0},{label:"Publisher Docs",href:pe.publishing,icon:t.jsx(Pt,{fontSize:"small"}),external:!0},{label:"Publisher API",href:"/api-doc.html",icon:t.jsx(vt,{fontSize:"small"}),external:!1}];return t.jsxs(ee,{sx:{py:1},children:[t.jsx(oe,{icon:t.jsx(Et,{fontSize:"small"}),label:"Theme",to:"/settings/theme",selected:r.startsWith("/settings/theme"),isCollapsed:e}),t.jsx(Ft,{isCollapsed:e}),o.map(n=>t.jsx(At,{label:n.label,href:n.href,icon:n.icon,external:n.external,isCollapsed:e},n.label))]})}function oe({icon:e,label:r,to:o,selected:n,isCollapsed:s}){const l=J(),i=t.jsxs(te,{selected:n,onClick:d=>l(o,d),sx:{justifyContent:s?"center":"flex-start",px:s?0:2},children:[t.jsx(re,{sx:{minWidth:s?0:36,justifyContent:"center",color:n?"text.primary":"text.secondary"},children:e}),!s&&t.jsx(ne,{primary:r,primaryTypographyProps:{variant:"body2",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(W,{title:r,placement:"right",children:t.jsx(p,{children:i})}):i}function At({label:e,href:r,icon:o,external:n,isCollapsed:s}){const l=t.jsxs(te,{component:"a",href:r,target:n?"_blank":void 0,rel:n?"noopener noreferrer":void 0,sx:{justifyContent:s?"center":"flex-start",px:s?0:2},children:[t.jsx(re,{sx:{minWidth:s?0:36,justifyContent:"center",color:"text.secondary"},children:o}),!s&&t.jsx(ne,{primary:e,primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(W,{title:e,placement:"right",children:t.jsx(p,{children:l})}):l}const Vt={light:"dark",dark:"auto",auto:"light"},Wt={light:"Light mode",dark:"Dark mode",auto:"Auto mode"},ue={light:"Light mode (click for dark)",dark:"Dark mode (click for auto)",auto:"Auto mode (follows OS, click for light)"};function Ft({isCollapsed:e}){const{mode:r,userChoice:o,setMode:n,allowUserToggle:s}=We();if(!s)return null;const l=o??r,i=l==="auto"?bt:l==="dark"?kt:Ct,d=t.jsxs(te,{"aria-label":ue[l],onClick:()=>n(Vt[l]),sx:{justifyContent:e?"center":"flex-start",px:e?0:2},children:[t.jsx(re,{sx:{minWidth:e?0:36,justifyContent:"center",color:"text.secondary"},children:t.jsx(i,{fontSize:"small"})}),!e&&t.jsx(ne,{primary:Wt[l],primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",whiteSpace:"nowrap"}}})]});return t.jsx(W,{title:ue[l],placement:"right",disableHoverListener:!e,children:t.jsx(p,{children:d})})}function Ut({open:e,onClose:r,logoHeader:o}){return t.jsx(gt,{anchor:"left",open:e,onClose:r,ModalProps:{keepMounted:!0},sx:{display:{xs:"block",md:"none"},"& .MuiDrawer-paper":{boxSizing:"border-box",width:260}},children:t.jsx(ve,{isCollapsed:!1,onToggleCollapse:r,logoHeader:o})})}function Yt({headerProps:e}){const r=K(),o=Fe(r.breakpoints.up("md")),[n,s]=u.useState(!1),[l,i]=u.useState(!1);return u.useEffect(()=>{o&&n&&s(!1)},[o,n]),t.jsxs(p,{sx:{height:"100dvh",display:"flex",flexDirection:"row",bgcolor:"background.default"},children:[o&&t.jsx(ve,{isCollapsed:l,onToggleCollapse:()=>i(d=>!d),logoHeader:e?.logoHeader}),t.jsxs(p,{component:"main",sx:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[t.jsxs(p,{sx:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"space-between",height:Ue.headerHeight,px:{xs:1,md:3},backgroundColor:"background.default"},children:[t.jsx(p,{sx:{display:{xs:"flex",md:"none"},alignItems:"center",mr:1},children:t.jsx(Y,{size:"small",onClick:()=>s(!0),"aria-label":"Open navigation",children:t.jsx(q,{fontSize:"small"})})}),t.jsx(p,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"center"},children:t.jsx(Rt,{})}),t.jsxs(p,{id:"header-actions-portal",sx:{display:"flex",alignItems:"center",flexShrink:0,gap:1},children:[t.jsx(Tt,{}),e?.endCap]})]}),t.jsx(p,{sx:{flex:1,overflow:"auto",minWidth:320,minHeight:0},children:t.jsx(u.Suspense,{fallback:t.jsx(Xe,{}),children:t.jsx(_e,{})})})]}),t.jsx(Ut,{open:n,onClose:()=>s(!1),logoHeader:e?.logoHeader})]})}export{Yt as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-D2Ts8adM.js","assets/index-BZEvIUf-.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-Vkkjsbxx.js"])))=>i.map(i=>d[i]);
2
+ import{g as q,a as B,$ as f,a0 as G,r as d,u as O,h as H,j as o,d as K,y as P,f as J,s as Q,T as b,m as X,a1 as Y,a2 as L,q as S,a3 as C,D as _,F as m,a4 as Z,a5 as g,a6 as w,a7 as ee,a8 as ne,a9 as T,aa as te,ab as oe,_ as U,ac as F,ad as se,ae,af as re,E as ie,N as le,ag as ce,ah as ue,ai as de,aj as x}from"./index-BZEvIUf-.js";import{s as R}from"./documentRoutes-BWHzvbNO.js";function pe(e){return q("MuiLink",e)}const me=B("MuiLink",["root","underlineNone","underlineHover","underlineAlways","button","focusVisible"]),he=({theme:e,ownerState:n})=>{const t=n.color;if("colorSpace"in e&&e.colorSpace){const a=f(e,`palette.${t}.main`)||f(e,`palette.${t}`)||n.color;return e.alpha(a,.4)}const s=f(e,`palette.${t}.main`,!1)||f(e,`palette.${t}`,!1)||n.color,l=f(e,`palette.${t}.mainChannel`)||f(e,`palette.${t}Channel`);return"vars"in e&&l?`rgba(${l} / 0.4)`:G(s,.4)},$={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},xe=e=>{const{classes:n,component:t,focusVisible:s,underline:l}=e,a={root:["root",`underline${P(l)}`,t==="button"&&"button",s&&"focusVisible"]};return J(a,pe,n)},fe=Q(b,{name:"MuiLink",slot:"Root",overridesResolver:(e,n)=>{const{ownerState:t}=e;return[n.root,n[`underline${P(t.underline)}`],t.component==="button"&&n.button]}})(X(({theme:e})=>({variants:[{props:{underline:"none"},style:{textDecoration:"none"}},{props:{underline:"hover"},style:{textDecoration:"none","&:hover":{textDecoration:"underline"}}},{props:{underline:"always"},style:{textDecoration:"underline","&:hover":{textDecorationColor:"inherit"}}},{props:({underline:n,ownerState:t})=>n==="always"&&t.color!=="inherit",style:{textDecorationColor:"var(--Link-underlineColor)"}},{props:({underline:n,ownerState:t})=>n==="always"&&t.color==="inherit",style:e.colorSpace?{textDecorationColor:e.alpha("currentColor",.4)}:null},...Object.entries(e.palette).filter(Y()).map(([n])=>({props:{underline:"always",color:n},style:{"--Link-underlineColor":e.alpha((e.vars||e).palette[n].main,.4)}})),{props:{underline:"always",color:"textPrimary"},style:{"--Link-underlineColor":e.alpha((e.vars||e).palette.text.primary,.4)}},{props:{underline:"always",color:"textSecondary"},style:{"--Link-underlineColor":e.alpha((e.vars||e).palette.text.secondary,.4)}},{props:{underline:"always",color:"textDisabled"},style:{"--Link-underlineColor":(e.vars||e).palette.text.disabled}},{props:{component:"button"},style:{position:"relative",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none","&::-moz-focus-inner":{borderStyle:"none"},[`&.${me.focusVisible}`]:{outline:"auto"}}}]}))),ye=d.forwardRef(function(n,t){const s=O({props:n,name:"MuiLink"}),l=H(),{className:a,color:r="primary",component:u="a",onBlur:i,onFocus:c,TypographyClasses:p,underline:h="always",variant:v="inherit",sx:k,...D}=s,[M,E]=d.useState(!1),N=y=>{L(y.target)||E(!1),i&&i(y)},I=y=>{L(y.target)&&E(!0),c&&c(y)},j={...s,color:r,component:u,focusVisible:M,underline:h,variant:v},z=xe(j);return o.jsx(fe,{color:r,className:K(z.root,a),classes:p,component:u,onBlur:N,onFocus:I,ref:t,ownerState:j,variant:v,...D,sx:[...$[r]===void 0?[{color:r}]:[],...Array.isArray(k)?k:[k]],style:{...D.style,...h==="always"&&r!=="inherit"&&!$[r]&&{"--Link-underlineColor":he({theme:l,ownerState:j})}}})});function V(e,n){const t=S();return d.useCallback((s,l)=>{const a=new URLSearchParams(s.givens).toString(),r=encodeURIComponent(e),u=encodeURIComponent(n),i=encodeURIComponent(s.dashboard);t(`/${r}/${u}/dashboards/${i}`+(a?`?${a}`:""),l)},[t,e,n])}function A({environmentName:e,packageName:n,notebookPath:t}){const{params:s,onGivensChange:l}=C(),a=V(e,n),r=S(),u=t.endsWith(".malloy"),i=_();return d.useEffect(()=>{if(!u||i)return;const c=()=>void w(()=>import("./index.es-D2Ts8adM.js"),__vite__mapDeps([0,1,2,3])),p=window.requestIdleCallback;if(p){const v=p(c);return()=>window.cancelIdleCallback?.(v)}const h=setTimeout(c,1500);return()=>clearTimeout(h)},[u,i]),o.jsx(m,{sx:{p:3,maxWidth:1600,mx:"auto"},children:o.jsx(Z,{resourceUri:g({environmentName:e,packageName:n,modelPath:t}),maxResultSize:1024*1024,givens:s,onGivensChange:l,onNavigate:r,onDrillNavigate:a})})}function be(){const[e,n]=d.useState(!1),t=d.useRef(!1),s=d.useRef(!1),l=d.useCallback(i=>{t.current=i,n(i)},[]),a=d.useCallback(()=>{s.current=!0},[]),r=ee(d.useCallback(({currentLocation:i,nextLocation:c})=>t.current&&!s.current&&i.pathname!==c.pathname,[]));d.useEffect(()=>{if(!e)return;const i=c=>{c.preventDefault(),c.returnValue=""};return window.addEventListener("beforeunload",i),()=>window.removeEventListener("beforeunload",i)},[e]);const u=o.jsx(ne,{open:r.state==="blocked",canSave:!1,onKeepEditing:()=>r.reset?.(),onDiscard:()=>r.proceed?.()});return{onDirtyChange:l,leaving:a,dialog:u}}const ge=se.lazy(()=>w(()=>import("./index.es-D2Ts8adM.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.DashboardEditor})));function ve({environmentName:e,packageName:n,dashboardName:t,kind:s="dashboard",path:l}){const a=be(),r=d.useMemo(()=>s==="dashboard"?T({environmentName:e,packageName:n,dashboardName:t}):te({environmentName:e,packageName:n,notebookName:t}),[s,e,n,t]);return o.jsxs(m,{sx:{p:3,maxWidth:1600,mx:"auto"},children:[o.jsx(oe,{children:o.jsx(d.Suspense,{fallback:o.jsx(U,{text:F.opening("builder")}),children:o.jsx(ge,{resourceUri:g({environmentName:e,packageName:n}),dashboard:t,kind:s,path:l,onDirtyChange:a.onDirtyChange,onEvent:r},`${e}/${n}/${s}/${t}`)})}),a.dialog]})}function ke({environmentName:e,packageName:n,dashboardName:t}){const{params:s,onGivensChange:l}=C(),a=V(e,n),r=d.useMemo(()=>T({environmentName:e,packageName:n,dashboardName:t}),[e,n,t]),u=_();return d.useEffect(()=>{if(u)return;const i=()=>void w(()=>import("./index.es-D2Ts8adM.js"),__vite__mapDeps([0,1,2,3])),c=window.requestIdleCallback;if(c){const h=c(i);return()=>window.cancelIdleCallback?.(h)}const p=setTimeout(i,1500);return()=>clearTimeout(p)},[u]),o.jsx(m,{sx:{p:3,maxWidth:1600,mx:"auto"},children:o.jsx(ae,{resourceUri:g({environmentName:e,packageName:n}),dashboard:t,givens:s,onGivensChange:l,onNavigate:a,onEvent:r,maxResultSize:1024*1024})})}function W({environmentName:e,packageName:n,routeKind:t,slug:s,edit:l}){const{location:a,settled:r}=re(e,n,t,s);if(!r)return o.jsx(U,{text:F.opening()});const u=a?.kind??t;return l?o.jsx(ve,{environmentName:e,packageName:n,dashboardName:s,kind:u,...a?{path:a.path}:{}}):u==="dashboard"?o.jsx(ke,{environmentName:e,packageName:n,dashboardName:s}):o.jsx(A,{environmentName:e,packageName:n,notebookPath:a?.path??`notebooks/${s}.malloy`})}function we(){const e=ie(),n=e["*"],{server:t}=le(),{params:s,onGivensChange:l}=C();if(!e.environmentName)return o.jsx("div",{children:o.jsx("h2",{children:"Missing environment name"})});if(!e.packageName)return o.jsx("div",{children:o.jsx("h2",{children:"Missing package name"})});const a={p:3,maxWidth:1200,mx:"auto"};if(n?.startsWith("dashboards/")&&!n.endsWith(".malloy")&&!n.endsWith(".malloynb")){const c=n.slice(11),{path:p,edit:h}=R(c);return o.jsx(W,{environmentName:e.environmentName,packageName:e.packageName,routeKind:"dashboard",slug:p,edit:h})}if(n?.startsWith("notebooks/")&&!n.endsWith(".malloy")&&!n.endsWith(".malloynb")){const c=n.slice(10),{path:p,edit:h}=R(c);return o.jsx(W,{environmentName:e.environmentName,packageName:e.packageName,routeKind:"notebook",slug:p,edit:h})}if(n?.startsWith("data-apps/")&&!n.endsWith(".malloy")&&!n.endsWith(".malloynb")){const c=n.slice(10),p=g({environmentName:e.environmentName,packageName:e.packageName,modelPath:c});return o.jsx(ce,{resourceUri:p})}const r=g({environmentName:e.environmentName,packageName:e.packageName,modelPath:n});if(n?.endsWith(".malloy"))return o.jsx(m,{sx:a,children:o.jsx(ue,{resourceUri:r,runOnDemand:!0,maxResultSize:512*1024,givens:s,onGivensChange:l})});if(n?.endsWith(".malloynb"))return o.jsx(A,{environmentName:e.environmentName,packageName:e.packageName,notebookPath:n});const u=/\.[^./]+$/.test(n??""),i=de({server:t,environmentName:e.environmentName,packageName:e.packageName,path:n??""});return o.jsxs(m,{sx:a,children:[o.jsx(b,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Nothing to open at this path"}),o.jsxs(b,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[o.jsx(m,{component:"span",sx:{fontFamily:x},children:n})," ","does not name a"," ",o.jsx(m,{component:"span",sx:{fontFamily:x},children:".malloy"})," ","or"," ",o.jsx(m,{component:"span",sx:{fontFamily:x},children:".malloynb"})," ","file in package"," ",o.jsx(m,{component:"span",sx:{fontFamily:x},children:e.packageName}),". This address opens"," ",o.jsx(m,{component:"span",sx:{fontFamily:x},children:".malloy"})," ","and"," ",o.jsx(m,{component:"span",sx:{fontFamily:x},children:".malloynb"})," ","files."]}),u&&o.jsxs(b,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",o.jsx(m,{component:"span",sx:{fontFamily:x},children:"public/"})," ","directory is served at ",o.jsx(ye,{href:i,children:i}),"."]}),o.jsx(b,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its models, notebooks, and data apps."})]})}export{we as default};
@@ -0,0 +1 @@
1
+ import{E as m,q as u,j as e,a5 as d,ak as l}from"./index-BZEvIUf-.js";import{d as g}from"./documentRoutes-BWHzvbNO.js";function h(){const{environmentName:n,packageName:a}=m(),s=u();if(n)if(a){const i=d({environmentName:n,packageName:a});return e.jsx(l,{onClickPackageFile:s,onOpenDocument:({kind:r,slug:t,mode:o},c)=>s(g(n,a,r,t,o),c),resourceUri:i})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing package name"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing environment name"})})}export{h as default};
@@ -1,4 +1,4 @@
1
- import{j as T,H as oe,r as p,aI as ue,A as me,i as be,aJ as ye,aq as pe,aK as J,aL as fe,a3 as ie,aM as ge,aN as ve,aO as we,aP as ke,aQ as ne}from"./index-CGdwupPP.js";const v="publisher-drill";function xe(e,t){const r=new Set;let a;try{a=e.getMetadata()?.getAllFields()??[]}catch{return r}const l=new Set;for(const o of a)!o||t(o)||o.tag?.tag("hidden")===void 0&&l.add(o.tag?.text("label")??o.name);for(const o of a){if(!o||!t(o))continue;const n=o.tag?.text("label")??o.name;l.has(n)||r.add(n)}return r}function B(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function Ce(e,t){if(t.size!==0)for(const r of e.querySelectorAll(".malloy-table")){const a=n=>n.closest(".malloy-table")===r,l=new Set;for(const n of r.querySelectorAll(".column-cell.th")){if(!a(n))continue;const i=(n.textContent??"").replace(/\u200b/g,"").trim(),b=B(n);b&&t.has(i)&&l.add(b)}if(l.size===0)continue;const o=new Set;for(const n of r.querySelectorAll(`.${v}[tabindex="0"]`)){if(!a(n))continue;const i=B(n);i&&(o.has(i)?n.tabIndex=-1:o.add(i))}for(const n of r.querySelectorAll(".column-cell.td")){if(!a(n))continue;const i=B(n),b=!n.querySelector(".value-null")&&(n.textContent??"").trim()!=="";if(i&&b&&l.has(i)&&!n.querySelector(".malloy-table")){if(n.classList.add(v),n.tabIndex===0)o.add(i);else{const f=o.has(i);f||o.add(i),n.tabIndex=f?-1:0}n.setAttribute("role","button")}}}}function Ae(e){const t=e.closest(".malloy-table"),r=B(e);return!t||!r?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(a=>a.closest(".malloy-table")===t&&B(a)===r)}function le(e,t){const r=Ae(e),a=r.indexOf(e);if(a===-1)return;const l=t==="first"?r[0]:t==="last"?r[r.length-1]:r[Math.min(Math.max(a+t,0),r.length-1)];if(l){for(const o of r)o.tabIndex=o===l?0:-1;return l}}function Ee(e){return{background:e.dashboardRoot,tableBackground:e.tableBackground,tableHeaderColor:e.tableHeader,tableBodyColor:e.tableBody,tableBorder:e.border,tablePinnedBackground:e.tableHeaderBackground,tablePinnedBorder:e.pinnedBorder,tableFontSize:`${e.font.size}px`,fontFamily:e.font.family,mapColor:e.mapColor}}function Se(e){const{foreground:t,axisFaint:r,font:a}=e,l={background:e.background,font:a.family,title:{color:t,font:a.family},axis:{labelColor:t,titleColor:t,domainColor:r,tickColor:r,gridColor:r,labelFont:a.family,titleFont:a.family},legend:{labelColor:t,titleColor:t,labelFont:a.family,titleFont:a.family},header:{labelColor:t,titleColor:t},range:{category:e.series}};return o=>l}function Re(e){if(!e)return;const t=e.tag("theme");if(!t)return;const r={},a=t.tag("palette");if(a){const o={},n=a.textArray("series");n&&n.length>0&&(o.series=n);for(const i of ue){const b=a.tag(i);if(!b)continue;const f={},x=b.text("light"),w=b.text("dark");x&&(f.light=x),w&&(f.dark=w),Object.keys(f).length>0&&(o[i]=f)}Object.keys(o).length>0&&(r.palette=o)}const l=t.tag("font");if(l){const o={},n=l.text("family");n&&(o.family=n);const i=l.numeric("size");typeof i=="number"&&Number.isFinite(i)&&(o.size=i),Object.keys(o).length>0&&(r.font=o)}return Object.keys(r).length>0?r:void 0}const $="data-publisher-fill",_e=async(e,t)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:r}=await ie(async()=>{const{MalloyRenderer:a}=await import("./index-ireHUsv_.js");return{MalloyRenderer:a}},[]);return new r({onClick:t,vegaConfigOverride:Se(e),theme:Ee(e),onError:a=>{console.error("Error rendering visualization:",typeof a,a)}}).createViz()};typeof window<"u"&&ie(()=>import("./index-ireHUsv_.js"),[]);async function ze(e){if(!e||typeof e!="object")return;const t=e,r=[...Array.isArray(t.model_annotations)?t.model_annotations:[],...Array.isArray(t.source_annotations)?t.source_annotations:[],...Array.isArray(t.annotations)?t.annotations:[]].map(l=>typeof l?.value=="string"?l.value:void 0).filter(l=>!!l);if(r.length===0)return;let a;try{({parseAnnotation:a}=await fe())}catch{return}try{const{tag:l}=a(r);return Re(l)}catch(l){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:l,lines:r});return}}function Fe(e,t,r){const a=ge(t,r);for(const[l,o]of Object.entries(a))e.style.setProperty(l,o)}const Oe=`
1
+ import{j as $,F as oe,r as f,aN as he,R as ue,h as me,aO as be,at as ye,aP as K,aQ as fe,aR as pe,aS as ge,aT as ve,aU as we,aV as ke,aW as ne}from"./index-BZEvIUf-.js";const v="publisher-drill";function xe(e,t){const r=new Set;let l;try{l=e.getMetadata()?.getAllFields()??[]}catch{return r}const a=new Set;for(const o of l)!o||t(o)||o.tag?.tag("hidden")===void 0&&a.add(o.tag?.text("label")??o.name);for(const o of l){if(!o||!t(o))continue;const n=o.tag?.text("label")??o.name;a.has(n)||r.add(n)}return r}function D(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function Ce(e,t){if(t.size!==0)for(const r of e.querySelectorAll(".malloy-table")){const l=n=>n.closest(".malloy-table")===r,a=new Set;for(const n of r.querySelectorAll(".column-cell.th")){if(!l(n))continue;const i=(n.textContent??"").replace(/\u200b/g,"").trim(),b=D(n);b&&t.has(i)&&a.add(b)}if(a.size===0)continue;const o=new Set;for(const n of r.querySelectorAll(`.${v}[tabindex="0"]`)){if(!l(n))continue;const i=D(n);i&&(o.has(i)?n.tabIndex=-1:o.add(i))}for(const n of r.querySelectorAll(".column-cell.td")){if(!l(n))continue;const i=D(n),b=!n.querySelector(".value-null")&&(n.textContent??"").trim()!=="";if(i&&b&&a.has(i)&&!n.querySelector(".malloy-table")){if(n.classList.add(v),n.tabIndex===0)o.add(i);else{const p=o.has(i);p||o.add(i),n.tabIndex=p?-1:0}n.setAttribute("role","button")}}}}function Ae(e){const t=e.closest(".malloy-table"),r=D(e);return!t||!r?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(l=>l.closest(".malloy-table")===t&&D(l)===r)}function le(e,t){const r=Ae(e),l=r.indexOf(e);if(l===-1)return;const a=t==="first"?r[0]:t==="last"?r[r.length-1]:r[Math.min(Math.max(l+t,0),r.length-1)];if(a){for(const o of r)o.tabIndex=o===a?0:-1;return a}}function Se(e){return{background:e.dashboardRoot,tableBackground:e.tableBackground,tableHeaderColor:e.tableHeader,tableBodyColor:e.tableBody,tableBorder:e.border,tablePinnedBackground:e.tableHeaderBackground,tablePinnedBorder:e.pinnedBorder,tableFontSize:`${e.font.size}px`,fontFamily:e.font.family,mapColor:e.mapColor}}function Ee(e){const{foreground:t,axisFaint:r,gridline:l,font:a}=e,o={background:e.background,font:a.family,title:{color:t,font:a.family},axis:{labelColor:t,titleColor:t,domainColor:r,tickColor:r,gridColor:l,labelFont:a.family,titleFont:a.family},legend:{labelColor:t,titleColor:t,labelFont:a.family,titleFont:a.family},header:{labelColor:t,titleColor:t},range:{category:e.series}};return n=>o}function Fe(e){if(!e)return;const t=e.tag("theme");if(!t)return;const r={},l=t.tag("palette");if(l){const o={},n=l.textArray("series");n&&n.length>0&&(o.series=n);for(const i of he){const b=l.tag(i);if(!b)continue;const p={},x=b.text("light"),w=b.text("dark");x&&(p.light=x),w&&(p.dark=w),Object.keys(p).length>0&&(o[i]=p)}Object.keys(o).length>0&&(r.palette=o)}const a=t.tag("font");if(a){const o={},n=a.text("family");n&&(o.family=n);const i=a.numeric("size");typeof i=="number"&&Number.isFinite(i)&&(o.size=i),Object.keys(o).length>0&&(r.font=o)}return Object.keys(r).length>0?r:void 0}const B="data-publisher-fill",ze=async(e,t)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:r}=await pe();return new r({onClick:t,vegaConfigOverride:Ee(e),theme:Se(e),onError:l=>{console.error("Error rendering visualization:",typeof l,l)}}).createViz()};async function Re(e){if(!e||typeof e!="object")return;const t=e,r=[...Array.isArray(t.model_annotations)?t.model_annotations:[],...Array.isArray(t.source_annotations)?t.source_annotations:[],...Array.isArray(t.annotations)?t.annotations:[]].map(a=>typeof a?.value=="string"?a.value:void 0).filter(a=>!!a);if(r.length===0)return;let l;try{({parseAnnotation:l}=await fe())}catch{return}try{const{tag:a}=l(r);return Fe(a)}catch(a){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:a,lines:r});return}}function je(e,t,r){const l=ge(t,r);for(const[a,o]of Object.entries(l))e.style.setProperty(a,o)}const Oe=`
2
2
  /* Card geometry, through the renderer's OWN theme vars rather than over the top
3
3
  of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
4
4
  passes each through to the --malloy-render--* the card CSS reads, so a value
@@ -84,7 +84,7 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
84
84
  background: var(--malloy-render--table-border) !important;
85
85
  }
86
86
  /* !important because the malloy-explorer stylesheet pins these same properties with it. */
87
- [${$}] .malloy-table.root {
87
+ [${B}] .malloy-table.root {
88
88
  height: 100% !important;
89
89
  align-content: start !important;
90
90
  grid-template-columns: repeat(var(--total-header-size), minmax(max-content, 1fr)) !important;
@@ -138,4 +138,4 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
138
138
  color: var(--publisher-drill-link) !important;
139
139
  text-decoration: underline;
140
140
  }
141
- `,se="publisher-malloy-renderer-overrides";function Me(){if(typeof document>"u"||document.getElementById(se))return;const e=document.createElement("style");e.id=se,e.textContent=Oe,document.head.appendChild(e)}function je({result:e,height:t,drill:r,onSizeChange:a,onSizing:l,fill:o}){const n=p.useRef(null),i=p.useRef(r);i.current=r;const b=p.useCallback(c=>{i.current?.onClick(c)},[]),f=r!==void 0,x=p.useRef(!1),w=p.useRef(null),P=p.useRef(0),{theme:Q,layers:U,mode:W}=me(),X=be().shape.borderRadius,Y=p.useMemo(()=>({radius:`${X}px`,padding:`${ye}px`}),[X]);return p.useEffect(()=>()=>{P.current+=1;const c=w.current;c?.viz.remove(),c?.node.remove(),w.current=null},[]),p.useLayoutEffect(()=>{if(!n.current||!e)return;Me();const c=n.current,de=P.current+=1;let q=!1;const V=()=>!q&&de===P.current;let d,m,D=null,H=0,L=null,I=null,N=null,z=null,F=null,O=null,G=null,Z=0,A=null;x.current=!1;let g,E;const K=k=>{if(q||!k.firstElementChild||J(g,E)==="container")return;const M=ve(g,E);if(x.current&&!M)return;const j=c.hasAttribute($);j&&c.removeAttribute($);const S=we(k,ne(g));j&&c.setAttribute($,""),S>0&&(x.current=!0,a&&S!==Z&&(Z=S,a(S)));const h=ke(k,ne(g));M&&h&&G!==h&&(G=h,O?.disconnect(),O=new ResizeObserver(()=>K(k)),O.observe(h))};return(async()=>{let k;try{k=JSON.parse(e)}catch(y){console.error("Error parsing visualization result:",y);return}const M=await ze(k),j=M?pe([...U,M],W):Q;if(!V())return;try{m=await _e(j,b)}catch(y){console.error("Failed to create renderer:",y);return}if(!V()){m.remove(),m=void 0;return}const S=w.current;d=document.createElement("div"),d.style.width="100%",d.style.height="100%",Fe(d,j,Y),c.childElementCount>0&&(c.style.position="relative",d.style.position="absolute",d.style.inset="0",d.style.visibility="hidden"),c.appendChild(d);const h=d;z=new MutationObserver(()=>{F&&clearTimeout(F),F=setTimeout(()=>{K(h),x.current&&z?.disconnect()},100)}),z.observe(d,{childList:!0,subtree:!0,attributes:!0});const ce=m;let ee=!1;const te=()=>{if(!(ee||!V())){ee=!0,A&&(clearTimeout(A),A=null),S?.viz.remove();for(const y of Array.from(c.children))y!==h&&c.removeChild(y);h.style.position="",h.style.inset="",h.style.visibility="",c.style.position="",w.current={viz:ce,node:h},K(h)}};try{m.setResult(k);try{const C=m.getMetadata(),R=C?.getRootField();g=R?.renderAs(),E=R?C?.getPluginsForField(R.key)?.[0]?.sizingStrategy:void 0}catch{g=void 0,E=void 0}l?.(J(g,E)),d.dataset.malloyRenderAs=g??"unknown",d.dataset.malloySizing=J(g,E),m.render(d);const y=i.current;try{if(y){const C=xe(m,y.canDrill),R=()=>{try{Ce(h,C)}catch(s){console.warn("Drill affordance skipped:",s)}};R();const re=s=>{const u=s.querySelector(".cell-content")??s,_=u.getBoundingClientRect();u.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:u.ownerDocument.defaultView,clientX:Math.round(_.left+_.width/2),clientY:Math.round(_.bottom)}))},ae=s=>s.target?.closest?.(`.${v}`)??null,he=(s,u)=>{le(s,u)?.focus()};L=s=>{const u=ae(s);if(!u)return;const _=s.key==="ArrowDown"?1:s.key==="ArrowUp"?-1:s.key==="Home"?"first":s.key==="End"?"last":void 0;if(_!==void 0){s.preventDefault(),he(u,_);return}s.key==="Enter"?(s.preventDefault(),re(u)):s.key===" "&&s.preventDefault()},I=s=>{if(s.key!==" ")return;const u=ae(s);u&&(s.preventDefault(),re(u))},N=s=>{const u=s.target?.closest?.(`.${v}`);u&&le(u,0)},h.addEventListener("keydown",L),h.addEventListener("keyup",I),h.addEventListener("focusin",N),C.size>0&&typeof MutationObserver<"u"&&(D=new MutationObserver(()=>{cancelAnimationFrame(H),H=requestAnimationFrame(R)}),D.observe(h,{childList:!0,subtree:!0}))}}catch(C){console.warn("Drill affordance skipped:",C)}m.onReady(te),A=setTimeout(te,1e4)}catch(y){console.error("Error rendering visualization:",y),z?.disconnect(),O?.disconnect(),D?.disconnect(),m.remove(),m=void 0,h.parentNode===c&&c.removeChild(h)}})(),()=>{q=!0,z?.disconnect(),O?.disconnect(),F&&clearTimeout(F),A&&clearTimeout(A),d&&w.current?.node!==d&&(L&&d.removeEventListener("keydown",L),I&&d.removeEventListener("keyup",I),N&&d.removeEventListener("focusin",N),D?.disconnect(),cancelAnimationFrame(H),m?.remove(),d.parentNode===c&&c.removeChild(d),c.style.position="")}},[e,b,f,a,l,Q,U,W,Y]),T.jsx("div",{ref:n,...o?{[$]:""}:{},style:{width:"100%",height:t?`${t}px`:"400px"}})}function Te(e){return typeof window>"u"?T.jsx(oe,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):T.jsx(p.Suspense,{fallback:T.jsx(oe,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:T.jsx(je,{...e})})}const Be=Object.freeze(Object.defineProperty({__proto__:null,default:Te},Symbol.toStringTag,{value:"Module"}));export{v as D,Te as R,Se as a,Ee as b,Be as c,xe as d,Ce as m,Re as r};
141
+ `,se="publisher-malloy-renderer-overrides";function Te(){if(typeof document>"u"||document.getElementById(se))return;const e=document.createElement("style");e.id=se,e.textContent=Oe,document.head.appendChild(e)}function Me({result:e,height:t,drill:r,onSizeChange:l,onSizing:a,fill:o}){const n=f.useRef(null),i=f.useRef(r);i.current=r;const b=f.useCallback(c=>{i.current?.onClick(c)},[]),p=r!==void 0,x=f.useRef(!1),w=f.useRef(null),P=f.useRef(0),{theme:W,layers:G,mode:J}=ue(),Q=me().shape.borderRadius,X=f.useMemo(()=>({radius:`${Q}px`,padding:`${be}px`}),[Q]);return f.useEffect(()=>()=>{P.current+=1;const c=w.current;c?.viz.remove(),c?.node.remove(),w.current=null},[]),f.useLayoutEffect(()=>{if(!n.current||!e)return;Te();const c=n.current,ie=P.current+=1;let q=!1;const V=()=>!q&&ie===P.current;let d,m,L=null,H=0,I=null,N=null,_=null,R=null,j=null,O=null,Y=null,Z=0,A=null;x.current=!1;let g,S;const U=k=>{if(q||!k.firstElementChild||K(g,S)==="container")return;const T=ve(g,S);if(x.current&&!T)return;const M=c.hasAttribute(B);M&&c.removeAttribute(B);const E=we(k,ne(g));M&&c.setAttribute(B,""),E>0&&(x.current=!0,l&&E!==Z&&(Z=E,l(E)));const h=ke(k,ne(g));T&&h&&Y!==h&&(Y=h,O?.disconnect(),O=new ResizeObserver(()=>U(k)),O.observe(h))};return(async()=>{let k;try{k=JSON.parse(e)}catch(y){console.error("Error parsing visualization result:",y);return}const T=await Re(k),M=T?ye([...G,T],J):W;if(!V())return;try{m=await ze(M,b)}catch(y){console.error("Failed to create renderer:",y);return}if(!V()){m.remove(),m=void 0;return}const E=w.current;d=document.createElement("div"),d.style.width="100%",d.style.height="100%",je(d,M,X),c.childElementCount>0&&(c.style.position="relative",d.style.position="absolute",d.style.inset="0",d.style.visibility="hidden"),c.appendChild(d);const h=d;R=new MutationObserver(()=>{j&&clearTimeout(j),j=setTimeout(()=>{U(h),x.current&&R?.disconnect()},100)}),R.observe(d,{childList:!0,subtree:!0,attributes:!0});const de=m;let ee=!1;const te=()=>{if(!(ee||!V())){ee=!0,A&&(clearTimeout(A),A=null),E?.viz.remove();for(const y of Array.from(c.children))y!==h&&c.removeChild(y);h.style.position="",h.style.inset="",h.style.visibility="",c.style.position="",w.current={viz:de,node:h},U(h)}};try{m.setResult(k);try{const C=m.getMetadata(),F=C?.getRootField();g=F?.renderAs(),S=F?C?.getPluginsForField(F.key)?.[0]?.sizingStrategy:void 0}catch{g=void 0,S=void 0}a?.(K(g,S)),d.dataset.malloyRenderAs=g??"unknown",d.dataset.malloySizing=K(g,S),m.render(d);const y=i.current;try{if(y){const C=xe(m,y.canDrill),F=()=>{try{Ce(h,C)}catch(s){console.warn("Drill affordance skipped:",s)}};F();const re=s=>{const u=s.querySelector(".cell-content")??s,z=u.getBoundingClientRect();u.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:u.ownerDocument.defaultView,clientX:Math.round(z.left+z.width/2),clientY:Math.round(z.bottom)}))},ae=s=>s.target?.closest?.(`.${v}`)??null,ce=(s,u)=>{le(s,u)?.focus()};I=s=>{const u=ae(s);if(!u)return;const z=s.key==="ArrowDown"?1:s.key==="ArrowUp"?-1:s.key==="Home"?"first":s.key==="End"?"last":void 0;if(z!==void 0){s.preventDefault(),ce(u,z);return}s.key==="Enter"?(s.preventDefault(),re(u)):s.key===" "&&s.preventDefault()},N=s=>{if(s.key!==" ")return;const u=ae(s);u&&(s.preventDefault(),re(u))},_=s=>{const u=s.target?.closest?.(`.${v}`);u&&le(u,0)},h.addEventListener("keydown",I),h.addEventListener("keyup",N),h.addEventListener("focusin",_),C.size>0&&typeof MutationObserver<"u"&&(L=new MutationObserver(()=>{cancelAnimationFrame(H),H=requestAnimationFrame(F)}),L.observe(h,{childList:!0,subtree:!0}))}}catch(C){console.warn("Drill affordance skipped:",C)}m.onReady(te),A=setTimeout(te,1e4)}catch(y){console.error("Error rendering visualization:",y),R?.disconnect(),O?.disconnect(),L?.disconnect(),m.remove(),m=void 0,h.parentNode===c&&c.removeChild(h)}})(),()=>{q=!0,R?.disconnect(),O?.disconnect(),j&&clearTimeout(j),A&&clearTimeout(A),d&&w.current?.node!==d&&(I&&d.removeEventListener("keydown",I),N&&d.removeEventListener("keyup",N),_&&d.removeEventListener("focusin",_),L?.disconnect(),cancelAnimationFrame(H),m?.remove(),d.parentNode===c&&c.removeChild(d),c.style.position="")}},[e,b,p,l,a,W,G,J,X]),$.jsx("div",{ref:n,...o?{[B]:""}:{},style:{width:"100%",height:t?`${t}px`:"400px"}})}function $e(e){return typeof window>"u"?$.jsx(oe,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):$.jsx(f.Suspense,{fallback:$.jsx(oe,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:$.jsx(Me,{...e})})}const De=Object.freeze(Object.defineProperty({__proto__:null,default:$e},Symbol.toStringTag,{value:"Module"}));export{v as D,$e as R,Ee as a,Se as b,De as c,xe as d,Ce as m,Fe as r};
@@ -1 +1 @@
1
- import{al as o,j as r,am as s,a9 as n,H as t,T as a}from"./index-CGdwupPP.js";function x(){const e=o();return console.error(e),r.jsx(s,{maxWidth:"lg",component:"main",sx:{display:"flex",flexDirection:"column",my:2,gap:0},children:r.jsxs(n,{sx:{m:"auto",flexDirection:"column"},children:[r.jsx(t,{sx:{height:"300px"}}),r.jsx("img",{src:"/error.png"}),r.jsx(a,{variant:"subtitle1",children:"An unexpected error occurred"})]})})}export{x as default};
1
+ import{an as o,j as r,ao as s,ap as n,F as t,T as a}from"./index-BZEvIUf-.js";function x(){const e=o();return console.error(e),r.jsx(s,{maxWidth:"lg",component:"main",sx:{display:"flex",flexDirection:"column",my:2,gap:0},children:r.jsxs(n,{sx:{m:"auto",flexDirection:"column"},children:[r.jsx(t,{sx:{height:"300px"}}),r.jsx("img",{src:"/error.png"}),r.jsx(a,{variant:"subtitle1",children:"An unexpected error occurred"})]})})}export{x as default};