@malloy-publisher/server 0.15.0 → 0.16.0

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 (27) hide show
  1. package/dist/app/api-doc.yaml +256 -15
  2. package/dist/app/assets/{EnvironmentPage-CKUvEX7r.js → EnvironmentPage-Y9IWPC9J.js} +1 -1
  3. package/dist/app/assets/{HomePage-COpZmm3Z.js → HomePage-BOUo0MEl.js} +1 -1
  4. package/dist/app/assets/{MainPage-nIyVOgy5.js → MainPage-BkM5UDRU.js} +1 -1
  5. package/dist/app/assets/{ModelPage-BelGfTpw.js → ModelPage-PgDTkS5C.js} +2 -2
  6. package/dist/app/assets/{PackagePage-CbnVG2uD.js → PackagePage-Dn7FrQ5r.js} +1 -1
  7. package/dist/app/assets/{PackageSplatRoute-37oqxKyq.js → PackageSplatRoute-BLC29ek-.js} +2 -2
  8. package/dist/app/assets/{RenderedResult-Ct3z543g.es-QeWq894a.js → RenderedResult-vyM2wQbC.es-ha8dF24T.js} +3 -3
  9. package/dist/app/assets/{RouteError-CjmVxFgv.js → RouteError-BolMqTuz.js} +1 -1
  10. package/dist/app/assets/{ThemeEditorPage-BjPyhpFF.js → ThemeEditorPage-CPv1eHkI.js} +1 -1
  11. package/dist/app/assets/{ToggleButtonGroup-bM-WVZrV.js → ToggleButtonGroup-DZtImN0S.js} +1 -1
  12. package/dist/app/assets/{documentRoutes-BAPDdua3.js → documentRoutes-DI5cX3ty.js} +1 -1
  13. package/dist/app/assets/{editPageMounted-B4HEQbbz.js → editPageMounted-C--4kcld.js} +2 -2
  14. package/dist/app/assets/{index-DbRUcXfe.js → index-CbsrzNSp.js} +1 -1
  15. package/dist/app/assets/{index-C-aFb4Gn.js → index-D9wSfMZN.js} +1 -1
  16. package/dist/app/assets/{index-DUgED99B.js → index-DLToSg1f.js} +62 -62
  17. package/dist/app/assets/{index-Bx-5B05C.js → index-DyYEltlF.js} +1 -1
  18. package/dist/app/assets/{index.es-DO67FMt6.js → index.es-D8SVyfmS.js} +1 -1
  19. package/dist/app/assets/usePackageLinkNavigate-DxHGKrmZ.js +1 -0
  20. package/dist/app/assets/{usePackageRoute-Cso_p7RX.js → usePackageRoute-A_YQMrax.js} +1 -1
  21. package/dist/app/index.html +1 -1
  22. package/dist/app/mcp-app/report.js +145 -145
  23. package/dist/instrumentation.mjs +9 -1
  24. package/dist/package_load_worker.mjs +161 -13
  25. package/dist/server.mjs +1415 -228
  26. package/package.json +1 -1
  27. package/dist/app/assets/usePackageLinkNavigate-BgdbNERJ.js +0 -1
@@ -882,6 +882,13 @@ paths:
882
882
  than serializing the response. Set PUBLISHER_MAX_QUERY_ROWS=0 to
883
883
  disable the cap. A caller-supplied rowLimit smaller than the cap is
884
884
  preserved; larger values are clamped down to cap+1.
885
+
886
+ On a DuckDB-backed connection (`duckdb`, including a package's
887
+ `duckdb` sandbox, `ducklake` and `motherduck`), `sqlStatement` runs
888
+ only as a single SELECT. Any other statement, more than one
889
+ statement, or SQL that does not parse answers 400 before anything
890
+ runs. `sqlSource` and `sqlTemporaryTable` apply the same rule to the
891
+ caller's SQL.
885
892
  parameters:
886
893
  - name: environmentName
887
894
  in: path
@@ -1293,7 +1300,8 @@ paths:
1293
1300
  resolved in the context of the named package, and returns the results.
1294
1301
 
1295
1302
  Subject to the same PUBLISHER_MAX_QUERY_ROWS row cap as the
1296
- environment-level sqlQuery endpoint.
1303
+ environment-level sqlQuery endpoint, and to the same single-SELECT
1304
+ rule on a DuckDB-backed connection: any other statement answers 400.
1297
1305
  parameters:
1298
1306
  - name: environmentName
1299
1307
  in: path
@@ -4131,9 +4139,12 @@ paths:
4131
4139
  description: |
4132
4140
  Deletes a terminal (MANIFEST_FILE_READY, FAILED, or CANCELLED)
4133
4141
  materialization record. A delete is record-only: it never drops a
4134
- table, and the caller owns table GC. To drop a table this run produced,
4135
- check that no remaining run, of any version, names a table with that
4136
- name in any place, then drop it through its connection.
4142
+ table, and the caller owns table GC. To drop a database table this run
4143
+ produced, use `drop-materialized-table` (`DELETE
4144
+ …/connections/{connectionName}/materializedTables/{tableName}`), which
4145
+ checks that no remaining run, of any version, names a table with that
4146
+ name in any place; a table built before 0.16.0 carries no ownership
4147
+ mark, so drop it first, passing this run's id, then delete the run.
4137
4148
  `dropTables=true` is refused with 400 and deletes nothing, as is any
4138
4149
  value other than `true` or `false` (the fix is to omit it);
4139
4150
  `dropTables=false`, which older clients send, is accepted and ignored.
@@ -4158,6 +4169,126 @@ paths:
4158
4169
  "410":
4159
4170
  $ref: "#/components/responses/Gone"
4160
4171
 
4172
+ /environments/{environmentName}/packages/{packageName}/connections/{connectionName}/materializedTables/{tableName}:
4173
+ delete:
4174
+ tags:
4175
+ - materializations
4176
+ operationId: drop-materialized-table
4177
+ summary: Drop a materialized table from a package's connection
4178
+ description: |
4179
+ Drops one database-tier table a materialization of this package built
4180
+ on one of the package's connections, with the staging and backup
4181
+ copies a crashed build can leave beside it when a run record names
4182
+ the table. This is the drop a caller makes after (or before) deleting
4183
+ a run's record, which never drops a table. A `storage=` table lives in
4184
+ a storage destination, which this route does not reach; the admin
4185
+ API's catalog routes drop those.
4186
+
4187
+ Publisher does not authenticate the caller: the gateway in front of
4188
+ it decides who may call this route, and should allow only the
4189
+ operator that owns the package's materialization lifecycle. The
4190
+ route itself refuses any table it cannot prove is this package's and
4191
+ unused, under the package's run lock and the table name's lock, so no
4192
+ run starts, commits or claims the name between the checks and the
4193
+ drop:
4194
+
4195
+ * 400: the name cannot be quoted in the connection's dialect, or
4196
+ it is the staging or backup copy a build makes of a table a run
4197
+ of the package records, which is dropped only with that table.
4198
+ * 404, with no `reason`: the package does not reach a connection by
4199
+ that name (or the environment, package or `materializationId`
4200
+ does not exist).
4201
+ * 409 `MATERIALIZATION_CONFLICT`: a run of the package is active.
4202
+ Retry once it settles.
4203
+ * 409 `TABLE_IN_USE`: a committed run of the package, of any
4204
+ version, other than the one `materializationId` names, names a
4205
+ table with this name in any place; the run `materializationId`
4206
+ names is the one a version or the package serves; or a loaded
4207
+ copy of any package in the environment is bound to a table with
4208
+ this name; or the warehouse refused the drop because other
4209
+ objects depend on the table (Postgres 2BP01). Delete or replace
4210
+ that run, or those objects, first.
4211
+ * 409 `TABLE_OWNED_ELSEWHERE`: the table carries another package's
4212
+ ownership mark, or the name is held by a view Publisher did not
4213
+ create or another package's view; or the warehouse refused the
4214
+ drop because the connection may not drop it (42501) or the name
4215
+ holds something other than a table (42809). The answer does not
4216
+ name the holder.
4217
+ * 409 `TABLE_OWNERSHIP_UNVERIFIED`: the table carries no ownership
4218
+ mark this route accepts, and the run `materializationId` names
4219
+ (terminal, of this package) does not record it on this
4220
+ connection; or who holds the name could not be read. A mark is
4221
+ accepted only when it names this package and the very place the
4222
+ warehouse's catalog says the name resolves to now (its fully
4223
+ qualified location, recorded when the mark was written): a
4224
+ comment travels with a renamed, moved or cloned table, so such a
4225
+ copy, or another schema's table a search path finds first, is
4226
+ treated as unmarked, as is a mark written before 0.16.0 (it names
4227
+ no place). Drop such a table passing the id of the run
4228
+ that records it, before deleting that run's record.
4229
+ * 404 `TABLE_NOT_FOUND`: no table holds the name and no run record
4230
+ of this package names it on this connection, so nothing proves it
4231
+ was ever this package's.
4232
+
4233
+ A table that is already gone answers 204 when a run record of this
4234
+ package still names it on this connection (pass its
4235
+ `materializationId`, or retry before deleting the record), so a
4236
+ retried drop succeeds; otherwise 404 `TABLE_NOT_FOUND`.
4237
+ parameters:
4238
+ - $ref: "#/components/parameters/environmentName"
4239
+ - $ref: "#/components/parameters/packageName"
4240
+ - name: connectionName
4241
+ in: path
4242
+ description: Name of the connection the table was built on, as the package reaches it
4243
+ required: true
4244
+ schema:
4245
+ $ref: "#/components/schemas/IdentifierPattern"
4246
+ - name: tableName
4247
+ in: path
4248
+ description: |
4249
+ The table's full name as the run's manifest records it
4250
+ (`physicalTableName`: `table`, `schema.table` or
4251
+ `catalog.schema.table`), URL-encoded. It is quoted for the
4252
+ connection's dialect as the build quoted it; a name the dialect
4253
+ cannot quote answers 400.
4254
+ required: true
4255
+ schema:
4256
+ type: string
4257
+ - name: materializationId
4258
+ in: query
4259
+ required: false
4260
+ description: |
4261
+ The id of the run that built the table, as evidence that it is
4262
+ this package's when it carries no ownership mark. That run is not
4263
+ counted as using the table, unless it is the one a version or
4264
+ the package serves. Must be a terminal run of this package
4265
+ (404 otherwise; 409 `MATERIALIZATION_CONFLICT` while it is
4266
+ active).
4267
+ schema:
4268
+ type: string
4269
+ - $ref: "#/components/parameters/versionId"
4270
+ responses:
4271
+ "204":
4272
+ description: |
4273
+ The table was dropped, or is already gone and a run record of
4274
+ this package names it on this connection.
4275
+ "400":
4276
+ $ref: "#/components/responses/BadRequest"
4277
+ "404":
4278
+ $ref: "#/components/responses/NotFound"
4279
+ "409":
4280
+ description: |
4281
+ The table was not dropped: a run is active
4282
+ (`MATERIALIZATION_CONFLICT`), the table is in use (`TABLE_IN_USE`),
4283
+ it is another's (`TABLE_OWNED_ELSEWHERE`), or it cannot be proven
4284
+ this package's (`TABLE_OWNERSHIP_UNVERIFIED`).
4285
+ content:
4286
+ application/json:
4287
+ schema:
4288
+ $ref: "#/components/schemas/Error"
4289
+ "410":
4290
+ $ref: "#/components/responses/Gone"
4291
+
4161
4292
  /environments/{environmentName}/storageDestinations/{destinationName}/schemas/{schemaName}/tables:
4162
4293
  get:
4163
4294
  tags:
@@ -6133,6 +6264,12 @@ components:
6133
6264
  the same SQL on one connection, so they share one table and
6134
6265
  one boundary, where at least one is incremental (one per
6135
6266
  source; `warn`).
6267
+ `persist-incremental-late-rows`: an incremental source whose
6268
+ bound table a delta's late-row check found missing rows
6269
+ stamped just below where a delta started reading, which no
6270
+ later delta reads (its manifest entry's `lateRows`); it is
6271
+ carried until the source is rebuilt in full (one per source;
6272
+ `warn`).
6136
6273
  `rollup-join-one-key-repeated`: a bound rollup whose last
6137
6274
  build found the key of a `join_one` it reads repeated, so a
6138
6275
  query reading that join beside other aggregates is answered
@@ -8776,7 +8913,7 @@ components:
8776
8913
  indistinguishable from a storage hit at the call site, and treating it
8777
8914
  as one would report a healthy hit rate for a broken store. On
8778
8915
  `publisher_query_route_total` the same event is the answering leg's
8779
- `outcome="fallback", reason="RUN_FAILED"`.
8916
+ `outcome="fallback", reason="READ_FAILED"`.
8780
8917
 
8781
8918
  Null means no materialized table answered: the query was served
8782
8919
  live. `path`, the path report, says why each table that could have
@@ -10224,14 +10361,33 @@ components:
10224
10361
  answers the same: only the server's metrics and log tell those
10225
10362
  apart. A 403 with any other reason is not a gate's.
10226
10363
 
10227
- MATERIALIZATION_REFUSED, on a 422, means a valid materialization
10228
- declaration this server will not build. The body's `refusalReason`
10229
- is the refusal's `RefusedSource.reason`.
10364
+ MATERIALIZATION_REFUSED means a valid materialization declaration
10365
+ this server will not build, and the body's `refusalReason` is the
10366
+ refusal's `RefusedSource.reason`. Reserved: no route answers with
10367
+ it today. The eligibility gate runs inside a materialization run,
10368
+ after `POST …/materializations` has answered 201, so a refusal is
10369
+ recorded on the run instead: as a `SourceFailure` with `refused`
10370
+ and `refusalReason` on a run with `buildInstructions`, otherwise
10371
+ in the run's `metadata.refusedSources`, or its `error` when
10372
+ nothing else was left to build.
10230
10373
 
10231
10374
  TABLE_OWNED_ELSEWHERE and TABLE_OWNERSHIP_UNVERIFIED, on a 400,
10232
10375
  mean a build was refused before it wrote because its `name=` is
10233
10376
  held by a table this package does not own, or because who holds
10234
- it could not be read.
10377
+ it could not be read. On a 409 from dropping a materialized table
10378
+ (`drop-materialized-table`), they mean the drop was refused for
10379
+ the same reasons: the table is another's, or nothing proves it is
10380
+ this package's.
10381
+
10382
+ TABLE_IN_USE, on a 409 from dropping a materialized table, means
10383
+ the table may still be read: a committed run of the package, of
10384
+ any version, names a table with that name (other than the run the
10385
+ caller named, unless that run is the one a version or the package
10386
+ serves); a loaded copy of any package in the environment, or any
10387
+ loaded version of one, is bound to a table with that name; or the
10388
+ warehouse refused the drop because other objects depend on the
10389
+ table. Delete or replace that run, rebind that copy, or drop
10390
+ those objects first.
10235
10391
 
10236
10392
  BUILD_INSTRUCTIONS_INVALID, on a 400 from creating a
10237
10393
  materialization, means its body or build instructions are not a
@@ -10292,7 +10448,7 @@ components:
10292
10448
  CONNECTION_AUTH_FAILED, CONNECTION_NOT_FOUND,
10293
10449
  STORAGE_ACCESS_DENIED, PATH_ACCESS_DENIED, ACCESS_DENIED,
10294
10450
  MATERIALIZATION_REFUSED, TABLE_OWNED_ELSEWHERE,
10295
- TABLE_OWNERSHIP_UNVERIFIED, BUILD_INSTRUCTIONS_INVALID,
10451
+ TABLE_OWNERSHIP_UNVERIFIED, TABLE_IN_USE, BUILD_INSTRUCTIONS_INVALID,
10296
10452
  MATERIALIZATION_CONFLICT, MANIFEST_VERSION_MISSING, MANIFEST_VERSION_INVALID,
10297
10453
  VERSION_CONFLICT, PACKAGE_IS_VERSIONED,
10298
10454
  PACKAGE_INSTALLED_FROM_LOCATION, FILE_EXISTS, VERSION_IS_LATEST,
@@ -11563,10 +11719,23 @@ components:
11563
11719
  quoted string (`merge_key="order_id, region"`).
11564
11720
 
11565
11721
 
11566
- Both are validated at publish against the compiled output schema, so
11567
- a dangling or stale name is rejected rather than deferred to a build.
11568
- Neither participates in `sourceEntityId`: adding a watermark to an
11569
- existing source must not re-address its table.
11722
+ * `lookback` — a duration (a positive whole number and one unit:
11723
+ `seconds`, `minutes`, `hours`, `days` or `weeks`, singular or
11724
+ plural, or `s`, `m`, `h`, `d` or `w`, as in `"2 days"` or `"36h"`;
11725
+ at most 365 days). Each delta of a `date` or `timestamp` watermark
11726
+ starts that much below the newest watermark the stored table holds,
11727
+ and the merge key matches the rows read again. Valid only with
11728
+ `refresh="incremental"`, a `date` or `timestamp` watermark and a
11729
+ `merge_key`; absent means no lookback.
11730
+
11731
+
11732
+ All three are checked at publish: `watermark` and `merge_key`
11733
+ against the compiled output schema, and `lookback` against its
11734
+ grammar, its limit and the keys it requires, so a dangling or stale
11735
+ name, or an invalid lookback, is rejected rather than deferred to a
11736
+ build. None participates in
11737
+ `sourceEntityId`: adding a watermark to an existing source must not
11738
+ re-address its table.
11570
11739
 
11571
11740
 
11572
11741
  For a synthesized rollup (`origin: rollup`) the annotation was
@@ -12108,7 +12277,8 @@ components:
12108
12277
  and bounds fail the same way on every attempt. It is reported for an
12109
12278
  eligibility refusal (always, beside `refused`), a Malloy or SQL
12110
12279
  compile defect (a syntax or parser error), a rejected credential or
12111
- missing grant (permission or access denied), and a source refused under
12280
+ missing grant (a message that says permission or access denied), a
12281
+ warehouse's own data or syntax error, and a source refused under
12112
12282
  `strictUpstreams` because a persisted upstream it reads failed
12113
12283
  deterministically earlier in the same run. That last source
12114
12284
  inherits its upstream's classification (`true` when any such
@@ -12118,6 +12288,20 @@ components:
12118
12288
  recompute its stored upstreams from the warehouse.
12119
12289
 
12120
12290
 
12291
+ A warehouse's own data or syntax error is one the warehouse names
12292
+ as such: a Postgres or Snowflake SQLSTATE in class 22 (data
12293
+ exception) or 42 (syntax error or access rule violation), or a
12294
+ BigQuery `invalidQuery` or `invalid` job error, and a Postgres data
12295
+ exception that reaches Publisher as text only (through a DuckDB
12296
+ passthrough). Five SQLSTATEs in class 42 are left to the other rules:
12297
+ a missing table or column (`42P01`, `42703`, `42S02`, `42S22`, and
12298
+ a BigQuery `Unrecognized name` or `Not found`), which stays absent,
12299
+ and `42501` (insufficient privilege). A Postgres `42501` still
12300
+ reports `false`, because its message says permission denied; a
12301
+ Snowflake `42501` stays absent. Transient codes (`40001`, `40P01`,
12302
+ and BigQuery's backend and quota reasons) are never `false`.
12303
+
12304
+
12121
12305
  `true` is a transient failure, not a property of the inputs: the
12122
12306
  database could not be reached or reset the connection, a timeout,
12123
12307
  a rate limit, the build session running out of memory (`Out of
@@ -12331,6 +12515,13 @@ components:
12331
12515
  Not a location: it does not name the table the rows came from.
12332
12516
  Absent for a source that reads no persisted upstream, which has one
12333
12517
  way to build and no choice to report.
12518
+
12519
+ A database rollup reports what its build actually read: `reused`
12520
+ only when it built from its base's materialized table, and absent
12521
+ when it built from the warehouse, even over a persisted base. Before
12522
+ 0.15.0 every rollup over a persisted base reported `reused`. A
12523
+ `storage=` rollup reports `reused` only when it stacked on a stored
12524
+ table.
12334
12525
  upstreamRecomputeReason:
12335
12526
  type: string
12336
12527
  description: >-
@@ -12388,6 +12579,56 @@ components:
12388
12579
  `refresh="full"`, or one whose declaration the delta path cannot act
12389
12580
  on at all (an unsupported source dialect), which the publish
12390
12581
  gate rejects anyway.
12582
+ lateRows:
12583
+ type: object
12584
+ required: [count, from, to]
12585
+ description: >-
12586
+ For a source this run advanced by a delta (`refresh` is `delta`):
12587
+ rows the source holds below where the delta started reading that
12588
+ the stored table lacks. A delta reads from the newest watermark
12589
+ the table holds (less the source's `lookback=`), so a row stamped
12590
+ below that, landing after the rows above it were stored, is never
12591
+ read, and the table undercounts it until it is rebuilt.
12592
+
12593
+ The check reads one window directly below the delta's start, as
12594
+ wide as the delta's own range, so it finds a row stamped within
12595
+ that window and not one older. With `merge_key=` a source row
12596
+ counts when no stored row has its keys and its watermark (a
12597
+ skipped restatement counts too); without one, it is the source's
12598
+ rows in the window less the table's.
12599
+
12600
+ The window is capped, for a date or timestamp watermark, at
12601
+ seven days or the source's `lookback=`, whichever is longer.
12602
+
12603
+ Carried until the source is rebuilt in full: a later delta or
12604
+ skip reports what earlier ones found (read from the manifest
12605
+ bound when it runs), with its own findings added to `count` and
12606
+ `to` moved up, and a slice is checked once, so a row is counted
12607
+ once, so `count` is a lower bound: a row that lands in a slice
12608
+ already checked is not counted. It stays until a full rebuild,
12609
+ even after a widened `lookback=` has written the rows. `from` is
12610
+ where the first such window started. Absent when
12611
+ nothing was found since the last full rebuild. The check is
12612
+ best-effort, and not run for a pair table, a string watermark or
12613
+ a `storage=` source on BigQuery: it gives up after 60 seconds,
12614
+ stopping its statement, and one that fails is
12615
+ logged and leaves what was carried. While the run's manifest is
12616
+ bound, the package also warns with code
12617
+ `persist-incremental-late-rows`.
12618
+ properties:
12619
+ count:
12620
+ type: integer
12621
+ description: Source rows in the window the stored table lacks.
12622
+ from:
12623
+ type: string
12624
+ description: >-
12625
+ Where the window starts (inclusive), as the watermark's value:
12626
+ ISO-8601 for a date or timestamp, decimal text for a number.
12627
+ to:
12628
+ type: string
12629
+ description: >-
12630
+ Where it ends (exclusive): the delta's lower bound, spelled as
12631
+ `from` is.
12391
12632
 
12392
12633
  parameters:
12393
12634
  includeHiddenFilesAndSources:
@@ -1 +1 @@
1
- import{y as r,C as t,j as e,a7 as i,aa as o}from"./index-DUgED99B.js";function m(){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{m as default};
1
+ import{y as r,C as t,j as e,a7 as i,aa as o}from"./index-DLToSg1f.js";function m(){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{m as default};
@@ -1 +1 @@
1
- import{y as t,j as o,I as a}from"./index-DUgED99B.js";function s(){const n=t();return o.jsx(a,{onClickEnvironment:n})}export{s as default};
1
+ import{y as t,j as o,I as a}from"./index-DLToSg1f.js";function s(){const n=t();return o.jsx(a,{onClickEnvironment:n})}export{s as default};
@@ -1 +1 @@
1
- import{c as j,j as t,s as I,B as Ee,m as Q,e as ce,g as me,a as fe,r as x,u as ge,b as Me,d as W,f as ye,T as K,h as G,i as ze,k as Ce,l as Ie,o as be,n as De,p as Te,q as de,t as Be,v as Re,w as A,x as $,M as He,P as Le,z as $e,S as Ne,A as J,C as Z,D as Ae,E as Oe,F as We,G as pe,H as Ve,y as ee,J as u,K as Fe,L as Y,N as V,O as te,Q as Ue,R as _e,U as ue,V as Xe,W as re,X as ne,Y as oe,Z as Ye,_ as qe,$ as Qe,a0 as Ke}from"./index-DUgED99B.js";import{u as Ge,l as he}from"./editPageMounted-B4HEQbbz.js";import{i as Je,w as Ze,a as et}from"./documentRoutes-BAPDdua3.js";import{u as ve,p as tt}from"./usePackageRoute-Cso_p7RX.js";const rt=j(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"})),nt=I(Ee,{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:ce(e.palette.grey[200],.12)}:{backgroundColor:ce(e.palette.grey[600],.12)}}}))),ot=I(rt)({width:24,height:16});function st(e){const{slots:r={},slotProps:o={},...n}=e,s=e;return t.jsx("li",{children:t.jsx(nt,{focusRipple:!0,...n,ownerState:s,children:t.jsx(ot,{as:r.CollapsedIcon,ownerState:s,...o.collapsedIcon})})})}function at(e){return me("MuiBreadcrumbs",e)}const it=fe("MuiBreadcrumbs",["root","ol","li","separator"]),lt=e=>{const{classes:r}=e;return ye({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},at,r)},ct=I(K,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,r)=>[{[`& .${it.li}`]:r.li},r.root]})({}),dt=I("ol",{name:"MuiBreadcrumbs",slot:"Ol"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),pt=I("li",{name:"MuiBreadcrumbs",slot:"Separator"})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function ut(e,r,o,n){return e.reduce((s,a,i)=>(i<e.length-1?s=s.concat(a,t.jsx(pt,{"aria-hidden":!0,className:r,ownerState:n,children:o},`separator-${i}`)):s.push(a),s),[])}const ht=x.forwardRef(function(r,o){const n=ge({props:r,name:"MuiBreadcrumbs"}),{children:s,className:a,component:i="nav",slots:d={},slotProps:m={},expandText:p="Show path",itemsAfterCollapse:h=1,itemsBeforeCollapse:b=1,maxItems:g=8,separator:w="/",...D}=n,[k,S]=x.useState(!1),v={...n,component:i,expanded:k,expandText:p,itemsAfterCollapse:h,itemsBeforeCollapse:b,maxItems:g,separator:w},z=lt(v),T=Me({elementType:d.CollapsedIcon,externalSlotProps:m.collapsedIcon,ownerState:v}),P=x.useRef(null),E=c=>{const M=()=>{S(!0);const y=P.current.querySelector("a[href],button,[tabindex]");y&&y.focus()};return b+h>=c.length?c:[...c.slice(0,b),t.jsx(st,{"aria-label":p,slots:{CollapsedIcon:d.CollapsedIcon},slotProps:{collapsedIcon:T},onClick:M},"ellipsis"),...c.slice(c.length-h,c.length)]},B=x.Children.toArray(s).filter(c=>x.isValidElement(c)).map((c,M)=>t.jsx("li",{className:z.li,children:c},`child-${M}`));return t.jsx(ct,{ref:o,component:i,color:"textSecondary",className:W(z.root,a),ownerState:v,...D,children:t.jsx(dt,{className:z.ol,ref:P,ownerState:v,children:ut(k||g&&B.length<=g?B:E(B),z.separator,w,v)})})});function xt(e,r,o){const n=r.getBoundingClientRect(),s=o&&o.getBoundingClientRect(),a=be(r);let i;if(r.fakeTransform)i=r.fakeTransform;else{const p=a.getComputedStyle(r);i=p.getPropertyValue("-webkit-transform")||p.getPropertyValue("transform")}let d=0,m=0;if(i&&i!=="none"&&typeof i=="string"){const p=i.split("(")[1].split(")")[0].split(",");d=parseInt(p[4],10),m=parseInt(p[5],10)}return e==="left"?s?`translateX(${s.right+d-n.left}px)`:`translateX(${a.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+m-n.top}px)`:`translateY(${a.innerHeight+m-n.top}px)`:s?`translateY(-${n.top-s.top+n.height-m}px)`:`translateY(-${n.top+n.height-m}px)`}function mt(e){return typeof e=="function"?e():e}function O(e,r,o){const n=mt(o),s=xt(e,r,n);s&&(r.style.webkitTransform=s,r.style.transform=s)}const ft=x.forwardRef(function(r,o){const n=G(),s={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},a={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:i,appear:d=!0,children:m,container:p,direction:h="down",easing:b=s,in:g,onEnter:w,onEntered:D,onEntering:k,onExit:S,onExited:v,onExiting:z,style:T,timeout:P=a,TransitionComponent:E=ze,...B}=r,c=x.useRef(null),M=Ce(Ie(m),c,o),y=l=>f=>{l&&(f===void 0?l(c.current):l(c.current,f))},F=y((l,f)=>{O(h,l,p),Te(l),w&&w(l,f)}),ae=y((l,f)=>{const L=de({timeout:P,style:T,easing:b},{mode:"enter"});l.style.webkitTransition=n.transitions.create("-webkit-transform",{...L}),l.style.transition=n.transitions.create("transform",{...L}),l.style.webkitTransform="none",l.style.transform="none",k&&k(l,f)}),R=y(D),H=y(z),C=y(l=>{const f=de({timeout:P,style:T,easing:b},{mode:"exit"});l.style.webkitTransition=n.transitions.create("-webkit-transform",f),l.style.transition=n.transitions.create("transform",f),O(h,l,p),S&&S(l)}),U=y(l=>{l.style.webkitTransition="",l.style.transition="",v&&v(l)}),_=l=>{i&&i(c.current,l)},N=x.useCallback(()=>{c.current&&O(h,c.current,p)},[h,p]);return x.useEffect(()=>{if(g||h==="down"||h==="right")return;const l=De(()=>{c.current&&O(h,c.current,p)}),f=be(c.current);return f.addEventListener("resize",l),()=>{l.clear(),f.removeEventListener("resize",l)}},[h,g,p]),x.useEffect(()=>{g||N()},[g,N]),t.jsx(E,{nodeRef:c,onEnter:F,onEntered:R,onEntering:ae,onExit:C,onExited:U,onExiting:H,addEndListener:_,appear:d,in:g,timeout:P,...B,children:(l,{ownerState:f,...L})=>x.cloneElement(m,{ref:M,style:{visibility:l==="exited"&&!g?"hidden":void 0,...T,...m.props.style},...L})})});function gt(e){return me("MuiDrawer",e)}fe("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const je=(e,r)=>{const{ownerState:o}=e;return[r.root,(o.variant==="permanent"||o.variant==="persistent")&&r.docked,r.modal]},yt=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 ye(s,gt,r)},bt=I(He,{name:"MuiDrawer",slot:"Root",overridesResolver:je})(Q(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),vt=I("div",{shouldForwardProp:$e,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:je})({flex:"0 0 auto"}),jt=I(Le,{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}`}}]}))),ke={left:"right",right:"left",top:"down",bottom:"up"};function kt(e){return["left","right"].includes(e)}function wt({direction:e},r){return e==="rtl"&&kt(r)?ke[r]:r}const St=x.forwardRef(function(r,o){const n=ge({props:r,name:"MuiDrawer"}),s=G(),a=Be(),i={enter:s.transitions.duration.enteringScreen,exit:s.transitions.duration.leavingScreen},{anchor:d="left",BackdropProps:m,children:p,className:h,elevation:b=16,hideBackdrop:g=!1,ModalProps:{BackdropProps:w,...D}={},onClose:k,open:S=!1,PaperProps:v={},SlideProps:z,TransitionComponent:T,transitionDuration:P=i,variant:E="temporary",slots:B={},slotProps:c={},...M}=n,y=x.useRef(!1);x.useEffect(()=>{y.current=!0},[]);const F=wt({direction:a?"rtl":"ltr"},d),R={...n,anchor:d,elevation:b,open:S,variant:E,...M},H=yt(R),C={slots:{transition:T,...B},slotProps:{paper:v,transition:z,...c,backdrop:Re(c.backdrop||{...m,...w},{transitionDuration:P})}},[U,_]=A("root",{ref:o,elementType:bt,className:W(H.root,H.modal,h),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...C,...M,...D},additionalProps:{open:S,onClose:k,hideBackdrop:g,slots:{backdrop:C.slots.backdrop},slotProps:{backdrop:C.slotProps.backdrop}}}),[N,l]=A("paper",{elementType:jt,shouldForwardComponentProp:!0,className:W(H.paper,v.className),ownerState:R,externalForwardedProps:C,additionalProps:{elevation:E==="temporary"?b:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[f,L]=A("docked",{elementType:vt,ref:o,className:W(H.root,H.docked,h),ownerState:R,externalForwardedProps:C,additionalProps:M}),[Se,Pe]=A("transition",{elementType:ft,ownerState:R,externalForwardedProps:C,additionalProps:{in:S,direction:ke[F],timeout:P,appear:y.current}}),ie=t.jsx(N,{...l,children:p});if(E==="permanent")return t.jsx(f,{...L,children:ie});const le=t.jsx(Se,{...Pe,children:ie});return E==="persistent"?t.jsx(f,{...L,children:le}):t.jsx(U,{..._,children:le})}),Pt=j([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")]),Et=j(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"})),Mt=j(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"})),zt=j(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"})),Ct=j(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"})),It=j(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"})),Dt=j(t.jsx("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81zM12 3 2 12h3v8h6v-6h2v6h6v-8h3z"})),Tt=j(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"})),Bt=j(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"})),Rt=j([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")]);function q(e){return t.jsxs(Ne,{...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 Ht=/\.malloy(nb)?$/;function Lt(){const{pathname:e,search:r}=J(),o=Z(),n=Ae(),s=Oe(),a=Ge(),i=o.environmentName??"",d=o.packageName??"",m=ve({always:!0}),p=m.path??"",h=i!==""&&d!==""&&p!==""&&m.writable&&!Ht.test(p),{reports:b,settled:g}=We(i,d,void 0,h);if(!h||s)return null;const w=p.replace(/\/$/,""),D=Je(r),k=e.replace(/\/$/,"");return D?a?null:t.jsx(pe,{label:"View",onClick:()=>n(`${k}${Ze(r)}`)}):(g?Ve(`${w}.malloy`,b):void 0)?.editable?t.jsx("span",{onPointerEnter:()=>void he(),onFocus:()=>void he(),children:t.jsx(pe,{label:"Edit",icon:t.jsx(Ct,{}),onClick:()=>n(`${k}${et(r)}`)})}):null}function X({label:e,onClick:r,current:o=!1}){return t.jsx(Fe,{clickable:!0,onClick:r,label:e,size:"small","aria-label":`Navigate to ${e}`,"aria-current":o?"page":void 0,sx:n=>({backgroundColor:"transparent",border:"none",color:o?"text.primary":"text.secondary",fontWeight:o?500:400,fontSize:13,height:28,cursor:"pointer",borderRadius:"6px",maxWidth:320,"& .MuiChip-label":{px:.75,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},"&:hover":{backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}})})}function $t(){const e=Z(),r=ve(),o=e.environmentName&&e.packageName?tt(e.environmentName,e.packageName,r.versionSegment):"",n=r.path?r.path.replace(/\/$/,""):void 0,s=ee();return!e.environmentName&&!e.packageName&&!n?null:t.jsx(u,{sx:{display:"flex",alignItems:"center",minWidth:0},children:t.jsxs(ht,{"aria-label":"breadcrumb",separator:t.jsx(u,{component:"span","aria-hidden":!0,sx:{color:"text.disabled"},children:"/"}),children:[e.environmentName&&t.jsx(X,{label:e.environmentName,current:!e.packageName&&!n,onClick:a=>s(`/${e.environmentName}/`,a)}),e.packageName&&t.jsx(X,{label:e.packageName,current:!n,onClick:a=>s(`${o}/`,a)}),n&&t.jsx(X,{label:n,current:!0,onClick:a=>s(`${o}/${n}`,a)})]})})}const Nt=260,At=64;function we({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){return t.jsxs(u,{sx:{height:"100dvh",width:e?At:Nt,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(Ot,{isCollapsed:e,onToggleCollapse:r,logoHeader:o}),t.jsxs(u,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",py:1},children:[t.jsx(Wt,{isCollapsed:e}),t.jsx(Vt,{isCollapsed:e})]}),t.jsx(Ft,{isCollapsed:e})]})}function Ot({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){const n=ee();return o?t.jsxs(u,{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(u,{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(u,{onClick:s=>n("/",s),sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer",minWidth:0},children:[t.jsx(u,{component:"img",src:"/logo.svg",alt:"Malloy",sx:{width:24,height:24,flexShrink:0}}),!e&&t.jsx(K,{variant:"subtitle1",sx:{color:"text.primary",fontWeight:500,letterSpacing:"-0.025em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Malloy Publisher"})]}),t.jsx(V,{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 Wt({isCollapsed:e}){const o=J().pathname==="/";return t.jsx(te,{sx:{py:0},children:t.jsx(se,{icon:t.jsx(Dt,{fontSize:"small"}),label:"Home",to:"/",selected:o,isCollapsed:e})})}function Vt({isCollapsed:e}){const{apiClients:r}=Ue(),o=Z(),{data:n}=_e({queryKey:["environments"],queryFn:()=>r.environments.listEnvironments()}),s=n?.data??[];return s.length===0?null:t.jsxs(u,{sx:{mt:1},children:[!e&&t.jsx(K,{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(te,{sx:{py:0},children:s.map(a=>{const i=a.name??"";return t.jsx(se,{icon:t.jsx(It,{fontSize:"small"}),label:i,to:`/${i}`,selected:o.environmentName===i,isCollapsed:e},i)})})]})}function Ft({isCollapsed:e}){const{pathname:r}=J(),o=[{label:"Malloy Docs",href:ue.docsHome,icon:t.jsx(Pt,{fontSize:"small"}),external:!0},{label:"Publisher Docs",href:ue.publishing,icon:t.jsx(Bt,{fontSize:"small"}),external:!0},{label:"Publisher API",href:"/api-doc.html",icon:t.jsx(Mt,{fontSize:"small"}),external:!1}];return t.jsxs(te,{sx:{py:1},children:[t.jsx(se,{icon:t.jsx(Rt,{fontSize:"small"}),label:"Theme",to:"/settings/theme",selected:r.startsWith("/settings/theme"),isCollapsed:e}),t.jsx(Yt,{isCollapsed:e}),o.map(n=>t.jsx(Ut,{label:n.label,href:n.href,icon:n.icon,external:n.external,isCollapsed:e},n.label))]})}function se({icon:e,label:r,to:o,selected:n,isCollapsed:s}){const a=ee(),i=t.jsxs(re,{selected:n,onClick:d=>a(o,d),sx:{justifyContent:s?"center":"flex-start",px:s?0:2},children:[t.jsx(ne,{sx:{minWidth:s?0:36,justifyContent:"center",color:n?"text.primary":"text.secondary"},children:e}),!s&&t.jsx(oe,{primary:r,primaryTypographyProps:{variant:"body2",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(V,{title:r,placement:"right",children:t.jsx(u,{children:i})}):i}function Ut({label:e,href:r,icon:o,external:n,isCollapsed:s}){const a=t.jsxs(re,{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(ne,{sx:{minWidth:s?0:36,justifyContent:"center",color:"text.secondary"},children:o}),!s&&t.jsx(oe,{primary:e,primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(V,{title:e,placement:"right",children:t.jsx(u,{children:a})}):a}const _t={light:"dark",dark:"auto",auto:"light"},Xt={light:"Light mode",dark:"Dark mode",auto:"Auto mode"},xe={light:"Light mode (click for dark)",dark:"Dark mode (click for auto)",auto:"Auto mode (follows OS, click for light)"};function Yt({isCollapsed:e}){const{mode:r,userChoice:o,setMode:n,allowUserToggle:s}=Xe();if(!s)return null;const a=o??r,i=a==="auto"?Et:a==="dark"?zt:Tt,d=t.jsxs(re,{"aria-label":xe[a],onClick:()=>n(_t[a]),sx:{justifyContent:e?"center":"flex-start",px:e?0:2},children:[t.jsx(ne,{sx:{minWidth:e?0:36,justifyContent:"center",color:"text.secondary"},children:t.jsx(i,{fontSize:"small"})}),!e&&t.jsx(oe,{primary:Xt[a],primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",whiteSpace:"nowrap"}}})]});return t.jsx(V,{title:xe[a],placement:"right",disableHoverListener:!e,children:t.jsx(u,{children:d})})}function qt({open:e,onClose:r,logoHeader:o}){return t.jsx(St,{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(we,{isCollapsed:!1,onToggleCollapse:r,logoHeader:o})})}function Zt({headerProps:e}){const r=G(),o=Ye(r.breakpoints.up("md")),[n,s]=x.useState(!1),[a,i]=x.useState(!1);return x.useEffect(()=>{o&&n&&s(!1)},[o,n]),t.jsxs(u,{sx:{height:"100dvh",display:"flex",flexDirection:"row",bgcolor:"background.default"},children:[o&&t.jsx(we,{isCollapsed:a,onToggleCollapse:()=>i(d=>!d),logoHeader:e?.logoHeader}),t.jsxs(u,{component:"main",sx:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[t.jsxs(u,{sx:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"space-between",height:qe.headerHeight,px:{xs:1,md:3},backgroundColor:"background.default"},children:[t.jsx(u,{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(u,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"center"},children:t.jsx($t,{})}),t.jsxs(u,{id:"header-actions-portal",sx:{display:"flex",alignItems:"center",flexShrink:0,gap:1},children:[t.jsx(Lt,{}),e?.endCap]})]}),t.jsx(u,{sx:{flex:1,overflow:"auto",minWidth:320,minHeight:0},children:t.jsx(x.Suspense,{fallback:t.jsx(Ke,{}),children:t.jsx(Qe,{})})})]}),t.jsx(qt,{open:n,onClose:()=>s(!1),logoHeader:e?.logoHeader})]})}export{Zt as default};
1
+ import{c as j,j as t,s as I,B as Ee,m as Q,e as ce,g as me,a as fe,r as x,u as ge,b as Me,d as W,f as ye,T as K,h as G,i as ze,k as Ce,l as Ie,o as be,n as De,p as Te,q as de,t as Be,v as Re,w as A,x as $,M as He,P as Le,z as $e,S as Ne,A as J,C as Z,D as Ae,E as Oe,F as We,G as pe,H as Ve,y as ee,J as u,K as Fe,L as Y,N as V,O as te,Q as Ue,R as _e,U as ue,V as Xe,W as re,X as ne,Y as oe,Z as Ye,_ as qe,$ as Qe,a0 as Ke}from"./index-DLToSg1f.js";import{u as Ge,l as he}from"./editPageMounted-C--4kcld.js";import{i as Je,w as Ze,a as et}from"./documentRoutes-DI5cX3ty.js";import{u as ve,p as tt}from"./usePackageRoute-A_YQMrax.js";const rt=j(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"})),nt=I(Ee,{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:ce(e.palette.grey[200],.12)}:{backgroundColor:ce(e.palette.grey[600],.12)}}}))),ot=I(rt)({width:24,height:16});function st(e){const{slots:r={},slotProps:o={},...n}=e,s=e;return t.jsx("li",{children:t.jsx(nt,{focusRipple:!0,...n,ownerState:s,children:t.jsx(ot,{as:r.CollapsedIcon,ownerState:s,...o.collapsedIcon})})})}function at(e){return me("MuiBreadcrumbs",e)}const it=fe("MuiBreadcrumbs",["root","ol","li","separator"]),lt=e=>{const{classes:r}=e;return ye({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},at,r)},ct=I(K,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,r)=>[{[`& .${it.li}`]:r.li},r.root]})({}),dt=I("ol",{name:"MuiBreadcrumbs",slot:"Ol"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),pt=I("li",{name:"MuiBreadcrumbs",slot:"Separator"})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function ut(e,r,o,n){return e.reduce((s,a,i)=>(i<e.length-1?s=s.concat(a,t.jsx(pt,{"aria-hidden":!0,className:r,ownerState:n,children:o},`separator-${i}`)):s.push(a),s),[])}const ht=x.forwardRef(function(r,o){const n=ge({props:r,name:"MuiBreadcrumbs"}),{children:s,className:a,component:i="nav",slots:d={},slotProps:m={},expandText:p="Show path",itemsAfterCollapse:h=1,itemsBeforeCollapse:b=1,maxItems:g=8,separator:w="/",...D}=n,[k,S]=x.useState(!1),v={...n,component:i,expanded:k,expandText:p,itemsAfterCollapse:h,itemsBeforeCollapse:b,maxItems:g,separator:w},z=lt(v),T=Me({elementType:d.CollapsedIcon,externalSlotProps:m.collapsedIcon,ownerState:v}),P=x.useRef(null),E=c=>{const M=()=>{S(!0);const y=P.current.querySelector("a[href],button,[tabindex]");y&&y.focus()};return b+h>=c.length?c:[...c.slice(0,b),t.jsx(st,{"aria-label":p,slots:{CollapsedIcon:d.CollapsedIcon},slotProps:{collapsedIcon:T},onClick:M},"ellipsis"),...c.slice(c.length-h,c.length)]},B=x.Children.toArray(s).filter(c=>x.isValidElement(c)).map((c,M)=>t.jsx("li",{className:z.li,children:c},`child-${M}`));return t.jsx(ct,{ref:o,component:i,color:"textSecondary",className:W(z.root,a),ownerState:v,...D,children:t.jsx(dt,{className:z.ol,ref:P,ownerState:v,children:ut(k||g&&B.length<=g?B:E(B),z.separator,w,v)})})});function xt(e,r,o){const n=r.getBoundingClientRect(),s=o&&o.getBoundingClientRect(),a=be(r);let i;if(r.fakeTransform)i=r.fakeTransform;else{const p=a.getComputedStyle(r);i=p.getPropertyValue("-webkit-transform")||p.getPropertyValue("transform")}let d=0,m=0;if(i&&i!=="none"&&typeof i=="string"){const p=i.split("(")[1].split(")")[0].split(",");d=parseInt(p[4],10),m=parseInt(p[5],10)}return e==="left"?s?`translateX(${s.right+d-n.left}px)`:`translateX(${a.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+m-n.top}px)`:`translateY(${a.innerHeight+m-n.top}px)`:s?`translateY(-${n.top-s.top+n.height-m}px)`:`translateY(-${n.top+n.height-m}px)`}function mt(e){return typeof e=="function"?e():e}function O(e,r,o){const n=mt(o),s=xt(e,r,n);s&&(r.style.webkitTransform=s,r.style.transform=s)}const ft=x.forwardRef(function(r,o){const n=G(),s={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},a={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:i,appear:d=!0,children:m,container:p,direction:h="down",easing:b=s,in:g,onEnter:w,onEntered:D,onEntering:k,onExit:S,onExited:v,onExiting:z,style:T,timeout:P=a,TransitionComponent:E=ze,...B}=r,c=x.useRef(null),M=Ce(Ie(m),c,o),y=l=>f=>{l&&(f===void 0?l(c.current):l(c.current,f))},F=y((l,f)=>{O(h,l,p),Te(l),w&&w(l,f)}),ae=y((l,f)=>{const L=de({timeout:P,style:T,easing:b},{mode:"enter"});l.style.webkitTransition=n.transitions.create("-webkit-transform",{...L}),l.style.transition=n.transitions.create("transform",{...L}),l.style.webkitTransform="none",l.style.transform="none",k&&k(l,f)}),R=y(D),H=y(z),C=y(l=>{const f=de({timeout:P,style:T,easing:b},{mode:"exit"});l.style.webkitTransition=n.transitions.create("-webkit-transform",f),l.style.transition=n.transitions.create("transform",f),O(h,l,p),S&&S(l)}),U=y(l=>{l.style.webkitTransition="",l.style.transition="",v&&v(l)}),_=l=>{i&&i(c.current,l)},N=x.useCallback(()=>{c.current&&O(h,c.current,p)},[h,p]);return x.useEffect(()=>{if(g||h==="down"||h==="right")return;const l=De(()=>{c.current&&O(h,c.current,p)}),f=be(c.current);return f.addEventListener("resize",l),()=>{l.clear(),f.removeEventListener("resize",l)}},[h,g,p]),x.useEffect(()=>{g||N()},[g,N]),t.jsx(E,{nodeRef:c,onEnter:F,onEntered:R,onEntering:ae,onExit:C,onExited:U,onExiting:H,addEndListener:_,appear:d,in:g,timeout:P,...B,children:(l,{ownerState:f,...L})=>x.cloneElement(m,{ref:M,style:{visibility:l==="exited"&&!g?"hidden":void 0,...T,...m.props.style},...L})})});function gt(e){return me("MuiDrawer",e)}fe("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const je=(e,r)=>{const{ownerState:o}=e;return[r.root,(o.variant==="permanent"||o.variant==="persistent")&&r.docked,r.modal]},yt=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 ye(s,gt,r)},bt=I(He,{name:"MuiDrawer",slot:"Root",overridesResolver:je})(Q(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),vt=I("div",{shouldForwardProp:$e,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:je})({flex:"0 0 auto"}),jt=I(Le,{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}`}}]}))),ke={left:"right",right:"left",top:"down",bottom:"up"};function kt(e){return["left","right"].includes(e)}function wt({direction:e},r){return e==="rtl"&&kt(r)?ke[r]:r}const St=x.forwardRef(function(r,o){const n=ge({props:r,name:"MuiDrawer"}),s=G(),a=Be(),i={enter:s.transitions.duration.enteringScreen,exit:s.transitions.duration.leavingScreen},{anchor:d="left",BackdropProps:m,children:p,className:h,elevation:b=16,hideBackdrop:g=!1,ModalProps:{BackdropProps:w,...D}={},onClose:k,open:S=!1,PaperProps:v={},SlideProps:z,TransitionComponent:T,transitionDuration:P=i,variant:E="temporary",slots:B={},slotProps:c={},...M}=n,y=x.useRef(!1);x.useEffect(()=>{y.current=!0},[]);const F=wt({direction:a?"rtl":"ltr"},d),R={...n,anchor:d,elevation:b,open:S,variant:E,...M},H=yt(R),C={slots:{transition:T,...B},slotProps:{paper:v,transition:z,...c,backdrop:Re(c.backdrop||{...m,...w},{transitionDuration:P})}},[U,_]=A("root",{ref:o,elementType:bt,className:W(H.root,H.modal,h),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...C,...M,...D},additionalProps:{open:S,onClose:k,hideBackdrop:g,slots:{backdrop:C.slots.backdrop},slotProps:{backdrop:C.slotProps.backdrop}}}),[N,l]=A("paper",{elementType:jt,shouldForwardComponentProp:!0,className:W(H.paper,v.className),ownerState:R,externalForwardedProps:C,additionalProps:{elevation:E==="temporary"?b:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[f,L]=A("docked",{elementType:vt,ref:o,className:W(H.root,H.docked,h),ownerState:R,externalForwardedProps:C,additionalProps:M}),[Se,Pe]=A("transition",{elementType:ft,ownerState:R,externalForwardedProps:C,additionalProps:{in:S,direction:ke[F],timeout:P,appear:y.current}}),ie=t.jsx(N,{...l,children:p});if(E==="permanent")return t.jsx(f,{...L,children:ie});const le=t.jsx(Se,{...Pe,children:ie});return E==="persistent"?t.jsx(f,{...L,children:le}):t.jsx(U,{..._,children:le})}),Pt=j([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")]),Et=j(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"})),Mt=j(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"})),zt=j(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"})),Ct=j(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"})),It=j(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"})),Dt=j(t.jsx("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81zM12 3 2 12h3v8h6v-6h2v6h6v-8h3z"})),Tt=j(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"})),Bt=j(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"})),Rt=j([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")]);function q(e){return t.jsxs(Ne,{...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 Ht=/\.malloy(nb)?$/;function Lt(){const{pathname:e,search:r}=J(),o=Z(),n=Ae(),s=Oe(),a=Ge(),i=o.environmentName??"",d=o.packageName??"",m=ve({always:!0}),p=m.path??"",h=i!==""&&d!==""&&p!==""&&m.writable&&!Ht.test(p),{reports:b,settled:g}=We(i,d,void 0,h);if(!h||s)return null;const w=p.replace(/\/$/,""),D=Je(r),k=e.replace(/\/$/,"");return D?a?null:t.jsx(pe,{label:"View",onClick:()=>n(`${k}${Ze(r)}`)}):(g?Ve(`${w}.malloy`,b):void 0)?.editable?t.jsx("span",{onPointerEnter:()=>void he(),onFocus:()=>void he(),children:t.jsx(pe,{label:"Edit",icon:t.jsx(Ct,{}),onClick:()=>n(`${k}${et(r)}`)})}):null}function X({label:e,onClick:r,current:o=!1}){return t.jsx(Fe,{clickable:!0,onClick:r,label:e,size:"small","aria-label":`Navigate to ${e}`,"aria-current":o?"page":void 0,sx:n=>({backgroundColor:"transparent",border:"none",color:o?"text.primary":"text.secondary",fontWeight:o?500:400,fontSize:13,height:28,cursor:"pointer",borderRadius:"6px",maxWidth:320,"& .MuiChip-label":{px:.75,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},"&:hover":{backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}})})}function $t(){const e=Z(),r=ve(),o=e.environmentName&&e.packageName?tt(e.environmentName,e.packageName,r.versionSegment):"",n=r.path?r.path.replace(/\/$/,""):void 0,s=ee();return!e.environmentName&&!e.packageName&&!n?null:t.jsx(u,{sx:{display:"flex",alignItems:"center",minWidth:0},children:t.jsxs(ht,{"aria-label":"breadcrumb",separator:t.jsx(u,{component:"span","aria-hidden":!0,sx:{color:"text.disabled"},children:"/"}),children:[e.environmentName&&t.jsx(X,{label:e.environmentName,current:!e.packageName&&!n,onClick:a=>s(`/${e.environmentName}/`,a)}),e.packageName&&t.jsx(X,{label:e.packageName,current:!n,onClick:a=>s(`${o}/`,a)}),n&&t.jsx(X,{label:n,current:!0,onClick:a=>s(`${o}/${n}`,a)})]})})}const Nt=260,At=64;function we({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){return t.jsxs(u,{sx:{height:"100dvh",width:e?At:Nt,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(Ot,{isCollapsed:e,onToggleCollapse:r,logoHeader:o}),t.jsxs(u,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",py:1},children:[t.jsx(Wt,{isCollapsed:e}),t.jsx(Vt,{isCollapsed:e})]}),t.jsx(Ft,{isCollapsed:e})]})}function Ot({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){const n=ee();return o?t.jsxs(u,{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(u,{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(u,{onClick:s=>n("/",s),sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer",minWidth:0},children:[t.jsx(u,{component:"img",src:"/logo.svg",alt:"Malloy",sx:{width:24,height:24,flexShrink:0}}),!e&&t.jsx(K,{variant:"subtitle1",sx:{color:"text.primary",fontWeight:500,letterSpacing:"-0.025em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Malloy Publisher"})]}),t.jsx(V,{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 Wt({isCollapsed:e}){const o=J().pathname==="/";return t.jsx(te,{sx:{py:0},children:t.jsx(se,{icon:t.jsx(Dt,{fontSize:"small"}),label:"Home",to:"/",selected:o,isCollapsed:e})})}function Vt({isCollapsed:e}){const{apiClients:r}=Ue(),o=Z(),{data:n}=_e({queryKey:["environments"],queryFn:()=>r.environments.listEnvironments()}),s=n?.data??[];return s.length===0?null:t.jsxs(u,{sx:{mt:1},children:[!e&&t.jsx(K,{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(te,{sx:{py:0},children:s.map(a=>{const i=a.name??"";return t.jsx(se,{icon:t.jsx(It,{fontSize:"small"}),label:i,to:`/${i}`,selected:o.environmentName===i,isCollapsed:e},i)})})]})}function Ft({isCollapsed:e}){const{pathname:r}=J(),o=[{label:"Malloy Docs",href:ue.docsHome,icon:t.jsx(Pt,{fontSize:"small"}),external:!0},{label:"Publisher Docs",href:ue.publishing,icon:t.jsx(Bt,{fontSize:"small"}),external:!0},{label:"Publisher API",href:"/api-doc.html",icon:t.jsx(Mt,{fontSize:"small"}),external:!1}];return t.jsxs(te,{sx:{py:1},children:[t.jsx(se,{icon:t.jsx(Rt,{fontSize:"small"}),label:"Theme",to:"/settings/theme",selected:r.startsWith("/settings/theme"),isCollapsed:e}),t.jsx(Yt,{isCollapsed:e}),o.map(n=>t.jsx(Ut,{label:n.label,href:n.href,icon:n.icon,external:n.external,isCollapsed:e},n.label))]})}function se({icon:e,label:r,to:o,selected:n,isCollapsed:s}){const a=ee(),i=t.jsxs(re,{selected:n,onClick:d=>a(o,d),sx:{justifyContent:s?"center":"flex-start",px:s?0:2},children:[t.jsx(ne,{sx:{minWidth:s?0:36,justifyContent:"center",color:n?"text.primary":"text.secondary"},children:e}),!s&&t.jsx(oe,{primary:r,primaryTypographyProps:{variant:"body2",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(V,{title:r,placement:"right",children:t.jsx(u,{children:i})}):i}function Ut({label:e,href:r,icon:o,external:n,isCollapsed:s}){const a=t.jsxs(re,{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(ne,{sx:{minWidth:s?0:36,justifyContent:"center",color:"text.secondary"},children:o}),!s&&t.jsx(oe,{primary:e,primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(V,{title:e,placement:"right",children:t.jsx(u,{children:a})}):a}const _t={light:"dark",dark:"auto",auto:"light"},Xt={light:"Light mode",dark:"Dark mode",auto:"Auto mode"},xe={light:"Light mode (click for dark)",dark:"Dark mode (click for auto)",auto:"Auto mode (follows OS, click for light)"};function Yt({isCollapsed:e}){const{mode:r,userChoice:o,setMode:n,allowUserToggle:s}=Xe();if(!s)return null;const a=o??r,i=a==="auto"?Et:a==="dark"?zt:Tt,d=t.jsxs(re,{"aria-label":xe[a],onClick:()=>n(_t[a]),sx:{justifyContent:e?"center":"flex-start",px:e?0:2},children:[t.jsx(ne,{sx:{minWidth:e?0:36,justifyContent:"center",color:"text.secondary"},children:t.jsx(i,{fontSize:"small"})}),!e&&t.jsx(oe,{primary:Xt[a],primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",whiteSpace:"nowrap"}}})]});return t.jsx(V,{title:xe[a],placement:"right",disableHoverListener:!e,children:t.jsx(u,{children:d})})}function qt({open:e,onClose:r,logoHeader:o}){return t.jsx(St,{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(we,{isCollapsed:!1,onToggleCollapse:r,logoHeader:o})})}function Zt({headerProps:e}){const r=G(),o=Ye(r.breakpoints.up("md")),[n,s]=x.useState(!1),[a,i]=x.useState(!1);return x.useEffect(()=>{o&&n&&s(!1)},[o,n]),t.jsxs(u,{sx:{height:"100dvh",display:"flex",flexDirection:"row",bgcolor:"background.default"},children:[o&&t.jsx(we,{isCollapsed:a,onToggleCollapse:()=>i(d=>!d),logoHeader:e?.logoHeader}),t.jsxs(u,{component:"main",sx:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[t.jsxs(u,{sx:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"space-between",height:qe.headerHeight,px:{xs:1,md:3},backgroundColor:"background.default"},children:[t.jsx(u,{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(u,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"center"},children:t.jsx($t,{})}),t.jsxs(u,{id:"header-actions-portal",sx:{display:"flex",alignItems:"center",flexShrink:0,gap:1},children:[t.jsx(Lt,{}),e?.endCap]})]}),t.jsx(u,{sx:{flex:1,overflow:"auto",minWidth:320,minHeight:0},children:t.jsx(x.Suspense,{fallback:t.jsx(Ke,{}),children:t.jsx(Qe,{})})})]}),t.jsx(qt,{open:n,onClose:()=>s(!1),logoHeader:e?.logoHeader})]})}export{Zt as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-DO67FMt6.js","assets/index-DUgED99B.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-bM-WVZrV.js"])))=>i.map(i=>d[i]);
2
- import{y as te,F as B,r as f,d7 as ne,d8 as se,d9 as U,da as W,a5 as q,E as I,j as t,J as m,db as re,a7 as E,dc as z,a4 as oe,az as ae,dd as ie,bn as ce,de as le,D as de,A as k,df as ue,as as fe,a2 as O,a3 as H,dg as he,dh as pe,a6 as G,T as w,di as me,dj as N,H as xe,dk as ge,a1 as ve,a0 as P,dl as L,C as je,Q as ye,dm as be,dn as _,dp as we,dq as Ee}from"./index-DUgED99B.js";import{i as D,w as Re,a as K,l as ke}from"./documentRoutes-BAPDdua3.js";import{v as Se,w as A,u as V}from"./usePackageRoute-Cso_p7RX.js";import{u as Ce}from"./usePackageLinkNavigate-BgdbNERJ.js";import{T as X,P as S}from"./PackageSplatRoute-37oqxKyq.js";import{a as De,l as Y}from"./editPageMounted-B4HEQbbz.js";function Ae(e,n,s){const r=te(),{reports:a,settled:h,isError:c}=B(e,n,Se(s)),o=h&&!c;return f.useCallback((i,l)=>{const u=i.path;if(!ne(u))return"malformed";const d=se(u,a),p=A(U(e,n,d.kind==="path"?d.report.path:u),e,n,s),g=new URLSearchParams(i.givens).toString();return r(p+(g?`?${g}`:""),l),d.kind==="path"?"resolved":o?"unresolved":"unverified"},[r,e,n,s,a,o])}const Te='[data-tile-kind="query"]',$e=".malloy-render, .malloy-table, [role='alert'], .MuiAlert-root",Me=3e3;function J(e,n,s,r){const a=f.useRef(s);a.current=s;const h=f.useRef(!1);f.useEffect(()=>{if(!a.current||h.current)return;let c=0;const o={},i=()=>{clearTimeout(u),o.beat!==void 0&&clearInterval(o.beat),cancelAnimationFrame(c),o.observer?.disconnect()},l=()=>{h.current||(h.current=!0,i(),a.current?.())},u=setTimeout(l,Me);if(!n)return()=>clearTimeout(u);const d=()=>{const p=e.current;if(!p||r&&p.querySelector(r)===null)return;const g=window.innerHeight;[...p.querySelectorAll(Te)].filter(x=>{if(x.getBoundingClientRect().top>=g)return!1;const j=x.querySelector($e);return!j||j.getBoundingClientRect().height<8}).length===0&&c===0&&(c=requestAnimationFrame(()=>{c=requestAnimationFrame(l)}))};return o.observer=new MutationObserver(d),e.current&&o.observer.observe(e.current,{childList:!0,subtree:!0}),o.beat=setInterval(d,50),d(),i},[n,e,r])}function Q({environmentName:e,packageName:n,versionId:s,path:r,editable:a=r.endsWith(".malloy"),onReady:h}){const c=f.useRef(null);J(c,!0,h,`.${ae.report}`);const{params:o,onGivensChange:i}=W(),{versionSegment:l}=V(),u=Ae(e,n,l),d=Ce(e,n,l),p=f.useMemo(()=>q({environmentName:e,packageName:n}),[e,n]),g=I();return f.useEffect(()=>{if(!a||g)return;const y=()=>void oe(()=>import("./index.es-DO67FMt6.js"),__vite__mapDeps([0,1,2,3])),x=window.requestIdleCallback;if(x){const j=x(y);return()=>window.cancelIdleCallback?.(j)}const v=setTimeout(y,1500);return()=>clearTimeout(v)},[a,g]),t.jsx(m,{ref:c,sx:X,children:r.endsWith(".malloynb")?t.jsx(re,{resourceUri:E({environmentName:e,packageName:n,modelPath:r,versionId:s}),givens:o,onGivensChange:i,onNavigate:d,onDrillNavigate:u,maxResultSize:1024*1024}):t.jsx(z,{resourceUri:E({environmentName:e,packageName:n,versionId:s}),path:r,givens:o,onGivensChange:i,onNavigate:u,onLinkNavigate:d,onEvent:p,maxResultSize:1024*1024})})}function Pe(){const[e,n]=f.useState(!1),s=f.useRef(!1),r=f.useRef(!1),a=f.useCallback(i=>{s.current=i,n(i)},[]),h=f.useCallback(()=>{r.current=!0},[]),c=ie(f.useCallback(({currentLocation:i,nextLocation:l})=>s.current&&!r.current&&(i.pathname!==l.pathname||D(i.search)!==D(l.search)),[]));f.useEffect(()=>{if(!e)return;const i=l=>{l.preventDefault(),l.returnValue=""};return window.addEventListener("beforeunload",i),()=>window.removeEventListener("beforeunload",i)},[e]);const o=t.jsx(ce,{open:c.state==="blocked",canSave:!1,onKeepEditing:()=>c.reset?.(),onDiscard:()=>c.proceed?.()});return{onDirtyChange:a,leaving:h,dialog:o}}const Le=H.lazy(()=>Y().then(e=>({default:e.ReportEditor}))),_e=H.lazy(()=>Y().then(e=>({default:e.BuilderBar})));function Fe(){const[e,n]=f.useState(null);return f.useEffect(()=>{n(document.getElementById("header-actions-portal"))},[]),e}function Z({environmentName:e,packageName:n,path:s,layout:r="grid",onReady:a,quietLoading:h=!1,offstage:c=!1}){const o=Pe();De();const[i]=f.useState(le),l=de(),{pathname:u,search:d}=k(),p=Fe(),[g,y]=f.useState(),x=f.useRef(null),v=I();J(x,g!==void 0||v,a);const j=()=>l(`${u.replace(/\/$/,"")}${Re(d)}`),C=f.useMemo(()=>q({environmentName:e,packageName:n}),[e,n]),R=t.jsx(z,{resourceUri:E({environmentName:e,packageName:n}),path:s,manifestStaleTime:1e4});return t.jsxs(m,{ref:x,sx:X,children:[t.jsx(ue,{children:t.jsx(f.Suspense,{fallback:h?null:R,children:t.jsx(Le,{resourceUri:E({environmentName:e,packageName:n}),path:s,layout:r,keepDraft:i,onDirtyChange:o.onDirtyChange,onExit:j,onOpenModel:b=>l(`/${[e,n,...b.split("/")].map(encodeURIComponent).join("/")}`),onEvent:C,loading:h?null:R,onControlsChange:y},`${e}/${n}/${s}`)})}),o.dialog,p&&!c&&fe.createPortal(t.jsx(f.Suspense,{fallback:t.jsx(O,{variant:"contained",disableElevation:!0,onClick:j,children:"Done"}),children:t.jsx(_e,{controls:g,onDone:j})}),p)]})}function Be({environmentName:e,packageName:n,versionSegment:s,routePath:r,edit:a,reports:h,children:c}){const{search:o}=k(),i=d=>A(U(e,n,d),e,n,s),l=he(r);if(!l)return t.jsx(t.Fragment,{children:c});const u=pe(l.name,h,l.prefer);return"found"in u?t.jsx(G,{replace:!0,to:`${i(u.found.path)}${a?K(o):o}`}):"ambiguous"in u?t.jsxs(m,{sx:S,children:[t.jsxs(w,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:["More than one report is named ",l.name]}),t.jsx(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"This is an old link, which names a report by its file name alone. Open one by its path:"}),t.jsx(m,{component:"ul",sx:{mt:1},children:u.ambiguous.map(d=>t.jsx("li",{children:t.jsx(me,{to:i(d),style:{fontFamily:N},children:d})},d))})]}):t.jsx(t.Fragment,{children:c})}function Ue({environmentName:e,packageName:n,routePath:s,edit:r,notFound:a,notFoundUntilListed:h=!1,versionId:c,versionSegment:o,readOnly:i=!1}){const{reports:l,settled:u,isFetching:d,isError:p,refetch:g}=B(e,n,c),{search:y}=k(),x=`${s}.malloy`,v=u?xe(x,l):void 0,j=u&&!d&&!p,[C,R]=f.useState();f.useEffect(()=>{j&&R(x)},[j,x]);const b=v!==void 0||j||C===x,T=ge(e,n,x,r&&!i&&b&&!v),$=ee=>t.jsx(Be,{environmentName:e,packageName:n,...o!==void 0?{versionSegment:o}:{},routePath:s,edit:r,reports:l,children:ee});if(!b&&(h&&!r&&!v))return $(a);if(!b&&p&&!d)return t.jsx(m,{sx:S,children:t.jsxs(ve,{severity:"warning",action:t.jsx(O,{color:"inherit",size:"small",onClick:()=>void g(),children:"Retry"}),children:["Could not list this package's reports, so this page cannot tell what is at ",s,"."]})});if(!b)return t.jsx(P,{text:L.opening()});if(v)return t.jsx(We,{environmentName:e,packageName:n,...c!==void 0?{versionId:c}:{},path:v.path,editable:i?!1:v.editable,layout:v.layout,edit:r&&!i});const M=r?void 0:ke(s);return M!==void 0?t.jsx(G,{replace:!0,to:`${A(`/${e}/${n}/${M.split("/").map(encodeURIComponent).join("/")}`,e,n,o)}${K(y)}`}):$(r&&!i?T.settled?t.jsx(Z,{environmentName:e,packageName:n,path:x,layout:T.layout??"grid"}):t.jsx(P,{text:L.opening()}):a)}function We({environmentName:e,packageName:n,versionId:s,path:r,editable:a,layout:h,edit:c}){const[o,i]=f.useState(c?"editor":"reader"),l=c?"editor":"reader",u=l==="reader"||o==="reader",d=l==="editor"||o==="editor",p={position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",overflow:"hidden"};return t.jsxs(m,{sx:{position:"relative"},"data-switching":u&&d||void 0,children:[u&&t.jsx(m,{sx:o==="reader"?void 0:p,"aria-hidden":o!=="reader"||void 0,children:t.jsx(Q,{environmentName:e,packageName:n,...s!==void 0?{versionId:s}:{},path:r,...a!==void 0?{editable:a}:{},onReady:()=>{c||i("reader")}})},"reader"),d&&t.jsx(m,{sx:o==="editor"?void 0:p,"aria-hidden":o!=="editor"||void 0,children:t.jsx(Z,{environmentName:e,packageName:n,path:r,...h?{layout:h}:{},quietLoading:u,offstage:l!=="editor"||o!=="editor",onReady:()=>{c&&i("editor")}})},"editor")]})}function Ke(){const e=je(),{search:n}=k(),{path:s,versionId:r,versionSegment:a,writable:h}=V({always:!0}),{server:c}=ye(),{params:o,onGivensChange:i,setParam:l}=W();if(!e.environmentName)return t.jsx("div",{children:t.jsx("h2",{children:"Missing environment name"})});if(!e.packageName)return t.jsx("div",{children:t.jsx("h2",{children:"Missing package name"})});if(s!==void 0&&s!==""&&!s.endsWith(".malloy")&&!s.endsWith(".malloynb")){const d=s.replace(/\/$/,""),p=d.startsWith("data-apps/"),g=p?t.jsx(be,{resourceUri:E({environmentName:e.environmentName,packageName:e.packageName,modelPath:d.slice(10),versionId:r})}):t.jsx(F,{environmentName:e.environmentName,packageName:e.packageName,modelPath:s,staticUrl:_({server:c,environmentName:e.environmentName,packageName:e.packageName,path:s,...r!==void 0?{versionId:r}:{}})});return t.jsx(Ue,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},...a!==void 0?{versionSegment:a}:{},readOnly:!h,routePath:d,edit:D(n),notFound:g,notFoundUntilListed:p})}const u=E({environmentName:e.environmentName,packageName:e.packageName,modelPath:s,versionId:r});return s?.endsWith(".malloy")?t.jsx(m,{sx:S,children:t.jsx(we,{resourceUri:u,runOnDemand:!0,sourceName:o.source,onSourceChange:d=>l("source",d),givens:o,onGivensChange:i,maxResultSize:512*1024})}):s?.endsWith(".malloynb")?t.jsx(Q,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},path:s,editable:!1}):t.jsx(F,{environmentName:e.environmentName,packageName:e.packageName,modelPath:s??"",staticUrl:_({server:c,environmentName:e.environmentName,packageName:e.packageName,path:s??"",...r!==void 0?{versionId:r}:{}})})}function F({packageName:e,modelPath:n,staticUrl:s}){const r=/\.[^./]+$/.test(n),a={fontFamily:N};return t.jsxs(m,{sx:S,children:[t.jsx(w,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Nothing to open at this path"}),t.jsxs(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[t.jsx(m,{component:"span",sx:a,children:n})," ","does not name a report, a"," ",t.jsx(m,{component:"span",sx:a,children:".malloy"})," ","or a"," ",t.jsx(m,{component:"span",sx:a,children:".malloynb"})," ","file in package"," ",t.jsx(m,{component:"span",sx:a,children:e}),". This address opens reports by their path without"," ",t.jsx(m,{component:"span",sx:a,children:".malloy"}),", and"," ",t.jsx(m,{component:"span",sx:a,children:".malloy"})," ","and"," ",t.jsx(m,{component:"span",sx:a,children:".malloynb"})," ","files."]}),r&&t.jsxs(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",t.jsx(m,{component:"span",sx:a,children:"public/"})," ","directory is served at ",t.jsx(Ee,{href:s,children:s}),"."]}),t.jsx(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its reports, models, and data apps."})]})}export{Ke as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-D8SVyfmS.js","assets/index-DLToSg1f.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-DZtImN0S.js"])))=>i.map(i=>d[i]);
2
+ import{y as te,F as B,r as f,d7 as ne,d8 as se,d9 as U,da as W,a5 as q,E as I,j as t,J as m,db as re,a7 as E,dc as z,a4 as oe,az as ae,dd as ie,bn as ce,de as le,D as de,A as k,df as ue,as as fe,a2 as O,a3 as H,dg as he,dh as pe,a6 as G,T as w,di as me,dj as N,H as xe,dk as ge,a1 as ve,a0 as P,dl as L,C as je,Q as ye,dm as be,dn as _,dp as we,dq as Ee}from"./index-DLToSg1f.js";import{i as D,w as Re,a as K,l as ke}from"./documentRoutes-DI5cX3ty.js";import{v as Se,w as A,u as V}from"./usePackageRoute-A_YQMrax.js";import{u as Ce}from"./usePackageLinkNavigate-DxHGKrmZ.js";import{T as X,P as S}from"./PackageSplatRoute-BLC29ek-.js";import{a as De,l as Y}from"./editPageMounted-C--4kcld.js";function Ae(e,n,s){const r=te(),{reports:a,settled:h,isError:c}=B(e,n,Se(s)),o=h&&!c;return f.useCallback((i,l)=>{const u=i.path;if(!ne(u))return"malformed";const d=se(u,a),p=A(U(e,n,d.kind==="path"?d.report.path:u),e,n,s),g=new URLSearchParams(i.givens).toString();return r(p+(g?`?${g}`:""),l),d.kind==="path"?"resolved":o?"unresolved":"unverified"},[r,e,n,s,a,o])}const Te='[data-tile-kind="query"]',$e=".malloy-render, .malloy-table, [role='alert'], .MuiAlert-root",Me=3e3;function J(e,n,s,r){const a=f.useRef(s);a.current=s;const h=f.useRef(!1);f.useEffect(()=>{if(!a.current||h.current)return;let c=0;const o={},i=()=>{clearTimeout(u),o.beat!==void 0&&clearInterval(o.beat),cancelAnimationFrame(c),o.observer?.disconnect()},l=()=>{h.current||(h.current=!0,i(),a.current?.())},u=setTimeout(l,Me);if(!n)return()=>clearTimeout(u);const d=()=>{const p=e.current;if(!p||r&&p.querySelector(r)===null)return;const g=window.innerHeight;[...p.querySelectorAll(Te)].filter(x=>{if(x.getBoundingClientRect().top>=g)return!1;const j=x.querySelector($e);return!j||j.getBoundingClientRect().height<8}).length===0&&c===0&&(c=requestAnimationFrame(()=>{c=requestAnimationFrame(l)}))};return o.observer=new MutationObserver(d),e.current&&o.observer.observe(e.current,{childList:!0,subtree:!0}),o.beat=setInterval(d,50),d(),i},[n,e,r])}function Q({environmentName:e,packageName:n,versionId:s,path:r,editable:a=r.endsWith(".malloy"),onReady:h}){const c=f.useRef(null);J(c,!0,h,`.${ae.report}`);const{params:o,onGivensChange:i}=W(),{versionSegment:l}=V(),u=Ae(e,n,l),d=Ce(e,n,l),p=f.useMemo(()=>q({environmentName:e,packageName:n}),[e,n]),g=I();return f.useEffect(()=>{if(!a||g)return;const y=()=>void oe(()=>import("./index.es-D8SVyfmS.js"),__vite__mapDeps([0,1,2,3])),x=window.requestIdleCallback;if(x){const j=x(y);return()=>window.cancelIdleCallback?.(j)}const v=setTimeout(y,1500);return()=>clearTimeout(v)},[a,g]),t.jsx(m,{ref:c,sx:X,children:r.endsWith(".malloynb")?t.jsx(re,{resourceUri:E({environmentName:e,packageName:n,modelPath:r,versionId:s}),givens:o,onGivensChange:i,onNavigate:d,onDrillNavigate:u,maxResultSize:1024*1024}):t.jsx(z,{resourceUri:E({environmentName:e,packageName:n,versionId:s}),path:r,givens:o,onGivensChange:i,onNavigate:u,onLinkNavigate:d,onEvent:p,maxResultSize:1024*1024})})}function Pe(){const[e,n]=f.useState(!1),s=f.useRef(!1),r=f.useRef(!1),a=f.useCallback(i=>{s.current=i,n(i)},[]),h=f.useCallback(()=>{r.current=!0},[]),c=ie(f.useCallback(({currentLocation:i,nextLocation:l})=>s.current&&!r.current&&(i.pathname!==l.pathname||D(i.search)!==D(l.search)),[]));f.useEffect(()=>{if(!e)return;const i=l=>{l.preventDefault(),l.returnValue=""};return window.addEventListener("beforeunload",i),()=>window.removeEventListener("beforeunload",i)},[e]);const o=t.jsx(ce,{open:c.state==="blocked",canSave:!1,onKeepEditing:()=>c.reset?.(),onDiscard:()=>c.proceed?.()});return{onDirtyChange:a,leaving:h,dialog:o}}const Le=H.lazy(()=>Y().then(e=>({default:e.ReportEditor}))),_e=H.lazy(()=>Y().then(e=>({default:e.BuilderBar})));function Fe(){const[e,n]=f.useState(null);return f.useEffect(()=>{n(document.getElementById("header-actions-portal"))},[]),e}function Z({environmentName:e,packageName:n,path:s,layout:r="grid",onReady:a,quietLoading:h=!1,offstage:c=!1}){const o=Pe();De();const[i]=f.useState(le),l=de(),{pathname:u,search:d}=k(),p=Fe(),[g,y]=f.useState(),x=f.useRef(null),v=I();J(x,g!==void 0||v,a);const j=()=>l(`${u.replace(/\/$/,"")}${Re(d)}`),C=f.useMemo(()=>q({environmentName:e,packageName:n}),[e,n]),R=t.jsx(z,{resourceUri:E({environmentName:e,packageName:n}),path:s,manifestStaleTime:1e4});return t.jsxs(m,{ref:x,sx:X,children:[t.jsx(ue,{children:t.jsx(f.Suspense,{fallback:h?null:R,children:t.jsx(Le,{resourceUri:E({environmentName:e,packageName:n}),path:s,layout:r,keepDraft:i,onDirtyChange:o.onDirtyChange,onExit:j,onOpenModel:b=>l(`/${[e,n,...b.split("/")].map(encodeURIComponent).join("/")}`),onEvent:C,loading:h?null:R,onControlsChange:y},`${e}/${n}/${s}`)})}),o.dialog,p&&!c&&fe.createPortal(t.jsx(f.Suspense,{fallback:t.jsx(O,{variant:"contained",disableElevation:!0,onClick:j,children:"Done"}),children:t.jsx(_e,{controls:g,onDone:j})}),p)]})}function Be({environmentName:e,packageName:n,versionSegment:s,routePath:r,edit:a,reports:h,children:c}){const{search:o}=k(),i=d=>A(U(e,n,d),e,n,s),l=he(r);if(!l)return t.jsx(t.Fragment,{children:c});const u=pe(l.name,h,l.prefer);return"found"in u?t.jsx(G,{replace:!0,to:`${i(u.found.path)}${a?K(o):o}`}):"ambiguous"in u?t.jsxs(m,{sx:S,children:[t.jsxs(w,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:["More than one report is named ",l.name]}),t.jsx(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"This is an old link, which names a report by its file name alone. Open one by its path:"}),t.jsx(m,{component:"ul",sx:{mt:1},children:u.ambiguous.map(d=>t.jsx("li",{children:t.jsx(me,{to:i(d),style:{fontFamily:N},children:d})},d))})]}):t.jsx(t.Fragment,{children:c})}function Ue({environmentName:e,packageName:n,routePath:s,edit:r,notFound:a,notFoundUntilListed:h=!1,versionId:c,versionSegment:o,readOnly:i=!1}){const{reports:l,settled:u,isFetching:d,isError:p,refetch:g}=B(e,n,c),{search:y}=k(),x=`${s}.malloy`,v=u?xe(x,l):void 0,j=u&&!d&&!p,[C,R]=f.useState();f.useEffect(()=>{j&&R(x)},[j,x]);const b=v!==void 0||j||C===x,T=ge(e,n,x,r&&!i&&b&&!v),$=ee=>t.jsx(Be,{environmentName:e,packageName:n,...o!==void 0?{versionSegment:o}:{},routePath:s,edit:r,reports:l,children:ee});if(!b&&(h&&!r&&!v))return $(a);if(!b&&p&&!d)return t.jsx(m,{sx:S,children:t.jsxs(ve,{severity:"warning",action:t.jsx(O,{color:"inherit",size:"small",onClick:()=>void g(),children:"Retry"}),children:["Could not list this package's reports, so this page cannot tell what is at ",s,"."]})});if(!b)return t.jsx(P,{text:L.opening()});if(v)return t.jsx(We,{environmentName:e,packageName:n,...c!==void 0?{versionId:c}:{},path:v.path,editable:i?!1:v.editable,layout:v.layout,edit:r&&!i});const M=r?void 0:ke(s);return M!==void 0?t.jsx(G,{replace:!0,to:`${A(`/${e}/${n}/${M.split("/").map(encodeURIComponent).join("/")}`,e,n,o)}${K(y)}`}):$(r&&!i?T.settled?t.jsx(Z,{environmentName:e,packageName:n,path:x,layout:T.layout??"grid"}):t.jsx(P,{text:L.opening()}):a)}function We({environmentName:e,packageName:n,versionId:s,path:r,editable:a,layout:h,edit:c}){const[o,i]=f.useState(c?"editor":"reader"),l=c?"editor":"reader",u=l==="reader"||o==="reader",d=l==="editor"||o==="editor",p={position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",overflow:"hidden"};return t.jsxs(m,{sx:{position:"relative"},"data-switching":u&&d||void 0,children:[u&&t.jsx(m,{sx:o==="reader"?void 0:p,"aria-hidden":o!=="reader"||void 0,children:t.jsx(Q,{environmentName:e,packageName:n,...s!==void 0?{versionId:s}:{},path:r,...a!==void 0?{editable:a}:{},onReady:()=>{c||i("reader")}})},"reader"),d&&t.jsx(m,{sx:o==="editor"?void 0:p,"aria-hidden":o!=="editor"||void 0,children:t.jsx(Z,{environmentName:e,packageName:n,path:r,...h?{layout:h}:{},quietLoading:u,offstage:l!=="editor"||o!=="editor",onReady:()=>{c&&i("editor")}})},"editor")]})}function Ke(){const e=je(),{search:n}=k(),{path:s,versionId:r,versionSegment:a,writable:h}=V({always:!0}),{server:c}=ye(),{params:o,onGivensChange:i,setParam:l}=W();if(!e.environmentName)return t.jsx("div",{children:t.jsx("h2",{children:"Missing environment name"})});if(!e.packageName)return t.jsx("div",{children:t.jsx("h2",{children:"Missing package name"})});if(s!==void 0&&s!==""&&!s.endsWith(".malloy")&&!s.endsWith(".malloynb")){const d=s.replace(/\/$/,""),p=d.startsWith("data-apps/"),g=p?t.jsx(be,{resourceUri:E({environmentName:e.environmentName,packageName:e.packageName,modelPath:d.slice(10),versionId:r})}):t.jsx(F,{environmentName:e.environmentName,packageName:e.packageName,modelPath:s,staticUrl:_({server:c,environmentName:e.environmentName,packageName:e.packageName,path:s,...r!==void 0?{versionId:r}:{}})});return t.jsx(Ue,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},...a!==void 0?{versionSegment:a}:{},readOnly:!h,routePath:d,edit:D(n),notFound:g,notFoundUntilListed:p})}const u=E({environmentName:e.environmentName,packageName:e.packageName,modelPath:s,versionId:r});return s?.endsWith(".malloy")?t.jsx(m,{sx:S,children:t.jsx(we,{resourceUri:u,runOnDemand:!0,sourceName:o.source,onSourceChange:d=>l("source",d),givens:o,onGivensChange:i,maxResultSize:512*1024})}):s?.endsWith(".malloynb")?t.jsx(Q,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},path:s,editable:!1}):t.jsx(F,{environmentName:e.environmentName,packageName:e.packageName,modelPath:s??"",staticUrl:_({server:c,environmentName:e.environmentName,packageName:e.packageName,path:s??"",...r!==void 0?{versionId:r}:{}})})}function F({packageName:e,modelPath:n,staticUrl:s}){const r=/\.[^./]+$/.test(n),a={fontFamily:N};return t.jsxs(m,{sx:S,children:[t.jsx(w,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Nothing to open at this path"}),t.jsxs(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[t.jsx(m,{component:"span",sx:a,children:n})," ","does not name a report, a"," ",t.jsx(m,{component:"span",sx:a,children:".malloy"})," ","or a"," ",t.jsx(m,{component:"span",sx:a,children:".malloynb"})," ","file in package"," ",t.jsx(m,{component:"span",sx:a,children:e}),". This address opens reports by their path without"," ",t.jsx(m,{component:"span",sx:a,children:".malloy"}),", and"," ",t.jsx(m,{component:"span",sx:a,children:".malloy"})," ","and"," ",t.jsx(m,{component:"span",sx:a,children:".malloynb"})," ","files."]}),r&&t.jsxs(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",t.jsx(m,{component:"span",sx:a,children:"public/"})," ","directory is served at ",t.jsx(Ee,{href:s,children:s}),"."]}),t.jsx(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its reports, models, and data apps."})]})}export{Ke as default};
@@ -1 +1 @@
1
- import{A as x,y as N,D as f,r as h,a5 as j,j as n,a6 as P,a7 as E,a8 as L}from"./index-DUgED99B.js";import{d as M}from"./documentRoutes-BAPDdua3.js";import{u as R,p as r,L as c}from"./usePackageRoute-Cso_p7RX.js";import{u as S}from"./usePackageLinkNavigate-BgdbNERJ.js";function D(){const{environmentName:e,packageName:a,versionSegment:o,versionId:m,versioned:u}=R({always:!0}),{search:g}=x(),p=N(),v=f(),i=S(e??"",a??"",o),l=h.useMemo(()=>j({environmentName:e??"",packageName:a??""}),[e,a]);if(e){if(!a)return n.jsx("div",{children:n.jsx("h2",{children:"Missing package name"})})}else return n.jsx("div",{children:n.jsx("h2",{children:"Missing environment name"})});if(u&&o===void 0)return n.jsx(P,{to:`${r(e,a,c)}${g}`,replace:!0});const d=E({environmentName:e,packageName:a,versionId:m});return n.jsx(L,{onClickPackageFile:i,onOpenDocument:({path:s,mode:t},k)=>i(M(e,a,s,t),k),onSelectVersion:(s,t)=>p(r(e,a,s),t),onReplaceVersion:s=>v(r(e,a,s??c),{replace:!0}),resourceUri:d,onEvent:l})}export{D as default};
1
+ import{A as x,y as N,D as f,r as h,a5 as j,j as n,a6 as P,a7 as E,a8 as L}from"./index-DLToSg1f.js";import{d as M}from"./documentRoutes-DI5cX3ty.js";import{u as R,p as r,L as c}from"./usePackageRoute-A_YQMrax.js";import{u as S}from"./usePackageLinkNavigate-DxHGKrmZ.js";function D(){const{environmentName:e,packageName:a,versionSegment:o,versionId:m,versioned:u}=R({always:!0}),{search:g}=x(),p=N(),v=f(),i=S(e??"",a??"",o),l=h.useMemo(()=>j({environmentName:e??"",packageName:a??""}),[e,a]);if(e){if(!a)return n.jsx("div",{children:n.jsx("h2",{children:"Missing package name"})})}else return n.jsx("div",{children:n.jsx("h2",{children:"Missing environment name"})});if(u&&o===void 0)return n.jsx(P,{to:`${r(e,a,c)}${g}`,replace:!0});const d=E({environmentName:e,packageName:a,versionId:m});return n.jsx(L,{onClickPackageFile:i,onOpenDocument:({path:s,mode:t},k)=>i(M(e,a,s,t),k),onSelectVersion:(s,t)=>p(r(e,a,s),t),onReplaceVersion:s=>v(r(e,a,s??c),{replace:!0}),resourceUri:d,onEvent:l})}export{D as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelPage-BelGfTpw.js","assets/index-DUgED99B.js","assets/index-DUqldpo0.css","assets/documentRoutes-BAPDdua3.js","assets/usePackageRoute-Cso_p7RX.js","assets/usePackageLinkNavigate-BgdbNERJ.js","assets/editPageMounted-B4HEQbbz.js","assets/PackagePage-CbnVG2uD.js"])))=>i.map(i=>d[i]);
2
- import{A as P,D as g,r as h,j as e,J as x,a1 as f,a2 as A,a3 as c,a4 as d}from"./index-DUgED99B.js";import{u as R,w as S,L as T}from"./usePackageRoute-Cso_p7RX.js";const j=1200,u={p:3,maxWidth:j,mx:"auto"},b={...u,pt:6},y=c.lazy(()=>d(()=>import("./ModelPage-BelGfTpw.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),k=c.lazy(()=>d(()=>import("./PackagePage-CbnVG2uD.js"),__vite__mapDeps([7,1,2,3,4,5])));function L(){const{environmentName:l,packageName:_,versionSegment:s,path:a,versioned:p,deciding:m,undecided:v,retry:E}=R({always:!0}),{pathname:o,search:r,hash:n}=P(),i=g(),t=p&&s===void 0?S(o,l??"",_??"",T):void 0;return h.useEffect(()=>{t!==void 0&&t!==o&&i(`${t}${r}${n}`,{replace:!0})},[t,o,r,n,i]),m?null:v?e.jsx(x,{sx:u,children:e.jsx(f,{severity:"error",action:e.jsx(A,{color:"inherit",size:"small",onClick:E,children:"Retry"}),children:"Could not read this package's versions, so this address can't be opened yet."})}):s!==void 0&&(a===void 0||a===""||a==="/")?e.jsx(k,{}):e.jsx(y,{})}const z=Object.freeze(Object.defineProperty({__proto__:null,default:L},Symbol.toStringTag,{value:"Module"}));export{u as P,b as T,z as a};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelPage-PgDTkS5C.js","assets/index-DLToSg1f.js","assets/index-DUqldpo0.css","assets/documentRoutes-DI5cX3ty.js","assets/usePackageRoute-A_YQMrax.js","assets/usePackageLinkNavigate-DxHGKrmZ.js","assets/editPageMounted-C--4kcld.js","assets/PackagePage-Dn7FrQ5r.js"])))=>i.map(i=>d[i]);
2
+ import{A as P,D as g,r as h,j as e,J as x,a1 as f,a2 as A,a3 as c,a4 as d}from"./index-DLToSg1f.js";import{u as R,w as S,L as T}from"./usePackageRoute-A_YQMrax.js";const j=1200,u={p:3,maxWidth:j,mx:"auto"},b={...u,pt:6},y=c.lazy(()=>d(()=>import("./ModelPage-PgDTkS5C.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),k=c.lazy(()=>d(()=>import("./PackagePage-Dn7FrQ5r.js"),__vite__mapDeps([7,1,2,3,4,5])));function L(){const{environmentName:l,packageName:_,versionSegment:s,path:a,versioned:p,deciding:m,undecided:v,retry:E}=R({always:!0}),{pathname:o,search:r,hash:n}=P(),i=g(),t=p&&s===void 0?S(o,l??"",_??"",T):void 0;return h.useEffect(()=>{t!==void 0&&t!==o&&i(`${t}${r}${n}`,{replace:!0})},[t,o,r,n,i]),m?null:v?e.jsx(x,{sx:u,children:e.jsx(f,{severity:"error",action:e.jsx(A,{color:"inherit",size:"small",onClick:E,children:"Retry"}),children:"Could not read this package's versions, so this address can't be opened yet."})}):s!==void 0&&(a===void 0||a===""||a==="/")?e.jsx(k,{}):e.jsx(y,{})}const z=Object.freeze(Object.defineProperty({__proto__:null,default:L},Symbol.toStringTag,{value:"Module"}));export{u as P,b as T,z as a};