@malloy-publisher/app 0.9.11 → 0.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api-doc.yaml CHANGED
@@ -93,6 +93,11 @@ tags:
93
93
  description: Real-time file watching for development workflows
94
94
  - name: materializations
95
95
  description: Package-level materializations for persisting Malloy sources
96
+ - name: storage-destinations
97
+ description: |
98
+ Table lifecycle inside an environment's storage destinations, for an
99
+ orchestrator that assigns its own physical table names and so owns their
100
+ garbage collection
96
101
 
97
102
  paths:
98
103
  /status:
@@ -554,6 +559,8 @@ paths:
554
559
  $ref: "#/components/schemas/PostgresConnection"
555
560
  mysqlConnection:
556
561
  $ref: "#/components/schemas/MysqlConnection"
562
+ sqlserverConnection:
563
+ $ref: "#/components/schemas/SqlserverConnection"
557
564
  bigqueryConnection:
558
565
  $ref: "#/components/schemas/BigqueryConnection"
559
566
  snowflakeConnection:
@@ -910,6 +917,8 @@ paths:
910
917
  application/json:
911
918
  schema:
912
919
  $ref: "#/components/schemas/QueryData"
920
+ "400":
921
+ $ref: "#/components/responses/BadRequest"
913
922
  "401":
914
923
  $ref: "#/components/responses/Unauthorized"
915
924
  "403":
@@ -968,6 +977,8 @@ paths:
968
977
  application/json:
969
978
  schema:
970
979
  $ref: "#/components/schemas/TemporaryTable"
980
+ "400":
981
+ $ref: "#/components/responses/BadRequest"
971
982
  "401":
972
983
  $ref: "#/components/responses/Unauthorized"
973
984
  "404":
@@ -1306,6 +1317,8 @@ paths:
1306
1317
  application/json:
1307
1318
  schema:
1308
1319
  $ref: "#/components/schemas/QueryData"
1320
+ "400":
1321
+ $ref: "#/components/responses/BadRequest"
1309
1322
  "401":
1310
1323
  $ref: "#/components/responses/Unauthorized"
1311
1324
  "403":
@@ -1370,6 +1383,8 @@ paths:
1370
1383
  application/json:
1371
1384
  schema:
1372
1385
  $ref: "#/components/schemas/TemporaryTable"
1386
+ "400":
1387
+ $ref: "#/components/responses/BadRequest"
1373
1388
  "401":
1374
1389
  $ref: "#/components/responses/Unauthorized"
1375
1390
  "404":
@@ -3308,6 +3323,120 @@ paths:
3308
3323
  schema:
3309
3324
  $ref: "#/components/schemas/Error"
3310
3325
 
3326
+ /environments/{environmentName}/storageDestinations/{destinationName}/schemas/{schemaName}/tables:
3327
+ get:
3328
+ tags:
3329
+ - storage-destinations
3330
+ operationId: list-storage-destination-tables
3331
+ summary: List tables in a storage destination
3332
+ description: |
3333
+ Lists the tables in one schema of a storage destination, in name order.
3334
+ Storage destinations are never reachable through the connection routes, so
3335
+ this is how an orchestrator finds tables it has lost track of. A DuckLake
3336
+ destination is attached read-only for the listing.
3337
+ parameters:
3338
+ - $ref: "#/components/parameters/environmentName"
3339
+ - $ref: "#/components/parameters/destinationName"
3340
+ - $ref: "#/components/parameters/storageSchemaName"
3341
+ responses:
3342
+ "200":
3343
+ description: The tables in the schema
3344
+ content:
3345
+ application/json:
3346
+ schema:
3347
+ type: array
3348
+ items:
3349
+ $ref: "#/components/schemas/StorageTable"
3350
+ "400":
3351
+ $ref: "#/components/responses/BadRequest"
3352
+ "404":
3353
+ $ref: "#/components/responses/NotFound"
3354
+ "500":
3355
+ $ref: "#/components/responses/InternalServerError"
3356
+
3357
+ /environments/{environmentName}/storageDestinations/{destinationName}/schemas/{schemaName}/tables/{tableName}:
3358
+ delete:
3359
+ tags:
3360
+ - storage-destinations
3361
+ operationId: delete-storage-destination-table
3362
+ summary: Drop a table from a storage destination
3363
+ description: |
3364
+ Drops one named table from a storage destination. Idempotent: a table that
3365
+ does not exist answers 204 as well, so a retried drop is free.
3366
+
3367
+ For a DuckLake destination this retires the table in the catalog; its data
3368
+ files stay in storage until a file cleanup reclaims them (see
3369
+ `create-storage-destination-file-cleanup`), which is also the window in
3370
+ which the table can still be read at an earlier snapshot.
3371
+ parameters:
3372
+ - $ref: "#/components/parameters/environmentName"
3373
+ - $ref: "#/components/parameters/destinationName"
3374
+ - $ref: "#/components/parameters/storageSchemaName"
3375
+ - name: tableName
3376
+ in: path
3377
+ required: true
3378
+ description: Name of the table
3379
+ schema:
3380
+ $ref: "#/components/schemas/IdentifierPattern"
3381
+ responses:
3382
+ "204":
3383
+ description: The table is dropped, or did not exist
3384
+ "400":
3385
+ $ref: "#/components/responses/BadRequest"
3386
+ "404":
3387
+ $ref: "#/components/responses/NotFound"
3388
+ "500":
3389
+ $ref: "#/components/responses/InternalServerError"
3390
+
3391
+ /environments/{environmentName}/storageDestinations/{destinationName}/fileCleanups:
3392
+ post:
3393
+ tags:
3394
+ - storage-destinations
3395
+ operationId: create-storage-destination-file-cleanup
3396
+ summary: Reclaim storage behind dropped tables in a DuckLake destination
3397
+ description: |
3398
+ Reclaims the object-storage bytes that dropped and rewritten tables leave
3399
+ behind in a DuckLake destination. Runs, in order:
3400
+
3401
+ 1. `ducklake_expire_snapshots(older_than => snapshotsOlderThan)` — forgets
3402
+ snapshots older than the cutoff (never the latest) and schedules for
3403
+ deletion the files only they referenced. Snapshots that remain are what
3404
+ time travel can still read, so this cutoff is the recovery window for a
3405
+ dropped table.
3406
+ 2. `ducklake_cleanup_old_files(older_than => filesOlderThan)` — deletes the
3407
+ files scheduled for deletion before the cutoff. The age counts from when
3408
+ step 1 scheduled the file, so this protects readers still scanning a
3409
+ file from a snapshot that was just expired.
3410
+
3411
+ Only files the catalog itself recorded and then retired are deleted. It
3412
+ does not run `CHECKPOINT` or `ducklake_delete_orphaned_files`, which also
3413
+ delete untracked files — another catalog's, when two share a data path, or
3414
+ a concurrent build's not-yet-committed output.
3415
+
3416
+ Synchronous. Refused with 400 for a destination that is not DuckLake.
3417
+ parameters:
3418
+ - $ref: "#/components/parameters/environmentName"
3419
+ - $ref: "#/components/parameters/destinationName"
3420
+ requestBody:
3421
+ required: true
3422
+ content:
3423
+ application/json:
3424
+ schema:
3425
+ $ref: "#/components/schemas/StorageFileCleanupRequest"
3426
+ responses:
3427
+ "201":
3428
+ description: The cleanup ran; what it reclaimed
3429
+ content:
3430
+ application/json:
3431
+ schema:
3432
+ $ref: "#/components/schemas/StorageFileCleanup"
3433
+ "400":
3434
+ $ref: "#/components/responses/BadRequest"
3435
+ "404":
3436
+ $ref: "#/components/responses/NotFound"
3437
+ "500":
3438
+ $ref: "#/components/responses/InternalServerError"
3439
+
3311
3440
  components:
3312
3441
  responses:
3313
3442
  BadRequest:
@@ -3454,6 +3583,57 @@ components:
3454
3583
  pattern: "^[a-zA-Z0-9_-]+$"
3455
3584
  description: Standard identifier pattern for resource names
3456
3585
 
3586
+ StorageTable:
3587
+ type: object
3588
+ description: A table in a storage destination
3589
+ required:
3590
+ - name
3591
+ properties:
3592
+ name:
3593
+ type: string
3594
+ description: Table name, unqualified
3595
+
3596
+ StorageFileCleanupRequest:
3597
+ type: object
3598
+ required:
3599
+ - snapshotsOlderThan
3600
+ - filesOlderThan
3601
+ properties:
3602
+ snapshotsOlderThan:
3603
+ type: string
3604
+ format: date-time
3605
+ description: |
3606
+ Expire snapshots older than this. Sets how long a dropped table stays
3607
+ recoverable.
3608
+ filesOlderThan:
3609
+ type: string
3610
+ format: date-time
3611
+ description: |
3612
+ Delete files scheduled for deletion before this. Must outlast the
3613
+ longest query reading the destination.
3614
+
3615
+ StorageFileCleanup:
3616
+ type: object
3617
+ description: What one file cleanup reclaimed
3618
+ required:
3619
+ - snapshotsOlderThan
3620
+ - filesOlderThan
3621
+ - expiredSnapshots
3622
+ - deletedFiles
3623
+ properties:
3624
+ snapshotsOlderThan:
3625
+ type: string
3626
+ format: date-time
3627
+ filesOlderThan:
3628
+ type: string
3629
+ format: date-time
3630
+ expiredSnapshots:
3631
+ type: integer
3632
+ description: Snapshots this cleanup expired
3633
+ deletedFiles:
3634
+ type: integer
3635
+ description: Data and delete files this cleanup removed from storage
3636
+
3457
3637
  VersionIdPattern:
3458
3638
  type: string
3459
3639
  pattern: "^[a-zA-Z0-9_.-]+$"
@@ -6412,6 +6592,7 @@ components:
6412
6592
  trino,
6413
6593
  databricks,
6414
6594
  mysql,
6595
+ sqlserver,
6415
6596
  duckdb,
6416
6597
  motherduck,
6417
6598
  ducklake,
@@ -6543,6 +6724,8 @@ components:
6543
6724
  $ref: "#/components/schemas/DatabricksConnection"
6544
6725
  mysqlConnection:
6545
6726
  $ref: "#/components/schemas/MysqlConnection"
6727
+ sqlserverConnection:
6728
+ $ref: "#/components/schemas/SqlserverConnection"
6546
6729
  duckdbConnection:
6547
6730
  $ref: "#/components/schemas/DuckdbConnection"
6548
6731
  motherduckConnection:
@@ -6711,6 +6894,58 @@ components:
6711
6894
  type: string
6712
6895
  description: MySQL password for authentication
6713
6896
 
6897
+ SqlserverConnection:
6898
+ type: object
6899
+ description: >-
6900
+ Microsoft SQL Server connection configuration: a SQL Server login over
6901
+ TCP. Field names are the connector's own (`@malloydata/db-sqlserver`),
6902
+ so a value here reaches the driver unchanged. The dialect is
6903
+ experimental upstream; Publisher accepts it on the model author's
6904
+ behalf, so a model needs no `##! experimental.dialect.sqlserver`
6905
+ pragma. The connection is read-only: a `#@ persist` on a SQL Server
6906
+ source is refused at load (see `RefusedSource.reason`).
6907
+ properties:
6908
+ server:
6909
+ type: string
6910
+ description: SQL Server host name or IP address
6911
+ port:
6912
+ type: integer
6913
+ description: TCP port; 1433 when omitted. Not used when `instanceName` is set.
6914
+ database:
6915
+ type: string
6916
+ description: Name of the database to open
6917
+ user:
6918
+ type: string
6919
+ description: SQL Server login name
6920
+ password:
6921
+ type: string
6922
+ description: SQL Server login password
6923
+ encrypt:
6924
+ type: boolean
6925
+ description: >-
6926
+ Encrypt the connection with TLS. On when omitted, as the driver
6927
+ defaults it; a server that requires encryption refuses a
6928
+ connection with it off.
6929
+ trustServerCertificate:
6930
+ type: boolean
6931
+ description: >-
6932
+ Accept a server certificate the client cannot verify, such as a
6933
+ self-signed one on a local or test server. Off when omitted. Leave
6934
+ it off for any server you do not control; a certificate the client
6935
+ cannot verify then fails the connection rather than being trusted.
6936
+ hostNameInCertificate:
6937
+ type: string
6938
+ description: >-
6939
+ The host name the server's certificate is issued to, when it is
6940
+ not `server` (a server reached by IP address, or through a
6941
+ tunnel). Checked against the certificate when `encrypt` is on and
6942
+ `trustServerCertificate` is off.
6943
+ instanceName:
6944
+ type: string
6945
+ description: >-
6946
+ A named instance, located through the SQL Browser service (UDP
6947
+ 1434); `port` is then not used.
6948
+
6714
6949
  GCSConnection:
6715
6950
  type: object
6716
6951
  description: Google Cloud Storage connection configuration for DuckDB
@@ -7742,6 +7977,7 @@ components:
7742
7977
  authorize,
7743
7978
  not_duckdb_portable,
7744
7979
  public_surface_unknown,
7980
+ read_only_dialect,
7745
7981
  ]
7746
7982
  description: >-
7747
7983
  The bounded refusal reason. Only the compile-time reasons can
@@ -7752,11 +7988,14 @@ components:
7752
7988
  `partition=` (`partition_without_storage`,
7753
7989
  `partition_column_unknown`, `partition_column_not_public`),
7754
7990
  `merge_key_scope_unresolved` (a `merge_key=` whose caller scope
7755
- cannot be expressed over the stored table's own columns), and
7991
+ cannot be expressed over the stored table's own columns),
7756
7992
  `preaggregate_over_dynamic_source` (a rollup whose base is scoped by
7757
- a given, which has no read-time re-application to put the term back)
7758
- — those being the only reasons the two compile-time eligibility
7759
- asserts this collection is computed from produce.
7993
+ a given, which has no read-time re-application to put the term back),
7994
+ and `read_only_dialect` (a colocated `#@ persist` on a source whose
7995
+ dialect cannot create tables; SQL Server today, whose connection
7996
+ reports `canPersist: false`) — those being the only reasons the two
7997
+ compile-time eligibility asserts this collection is computed from
7998
+ produce.
7760
7999
 
7761
8000
 
7762
8001
  `given_in_persisted_query` is raised by BOTH gates, for one
@@ -8839,6 +9078,22 @@ components:
8839
9078
  description: Name of the package
8840
9079
  schema:
8841
9080
  type: string
9081
+ destinationName:
9082
+ name: destinationName
9083
+ in: path
9084
+ required: true
9085
+ description: Name of a storage destination configured on the environment
9086
+ schema:
9087
+ $ref: "#/components/schemas/IdentifierPattern"
9088
+ storageSchemaName:
9089
+ name: schemaName
9090
+ in: path
9091
+ required: true
9092
+ description: |
9093
+ Schema within the storage destination. A table built from a bare
9094
+ physical name lives in `main`.
9095
+ schema:
9096
+ $ref: "#/components/schemas/IdentifierPattern"
8842
9097
  materializationId:
8843
9098
  name: materializationId
8844
9099
  in: path
@@ -0,0 +1 @@
1
+ import{c as r,D as t,j as e,ab as i,aA as o}from"./index-Dgqan3mQ.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};
@@ -0,0 +1 @@
1
+ import{c as t,j as o,x as a}from"./index-Dgqan3mQ.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 D,B as Pe,m as Q,e as ce,g as me,b as fe,r as h,u as ge,d as Ee,f as W,h as ye,T as J,i as K,k as Me,l as ze,n as Ie,o as be,p as Ce,q as De,t as de,w as Te,x as Be,y as A,z as L,M as Re,P as $e,A as He,S as Le,C as G,D as Z,E as Ne,H as Ae,F as Oe,U as pe,G as We,a as ee,I as u,J as Ve,K as Y,L as V,N as te,O as Fe,Q as Ue,R as ue,V as _e,W as re,X as ne,Y as oe,Z as Xe,_ as Ye,$ as qe,a0 as Qe}from"./index-gQEuz0Cg.js";import{u as Je,l as he}from"./editPageMounted-0kzl2sgg.js";import{i as Ke,w as Ge,a as Ze}from"./documentRoutes-D4TbSIi5.js";const et=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"})),tt=D(Pe,{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)}}}))),rt=D(et)({width:24,height:16});function nt(e){const{slots:r={},slotProps:o={},...n}=e,s=e;return t.jsx("li",{children:t.jsx(tt,{focusRipple:!0,...n,ownerState:s,children:t.jsx(rt,{as:r.CollapsedIcon,ownerState:s,...o.collapsedIcon})})})}function ot(e){return me("MuiBreadcrumbs",e)}const st=fe("MuiBreadcrumbs",["root","ol","li","separator"]),at=e=>{const{classes:r}=e;return ye({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},ot,r)},it=D(J,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,r)=>[{[`& .${st.li}`]:r.li},r.root]})({}),lt=D("ol",{name:"MuiBreadcrumbs",slot:"Ol"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),ct=D("li",{name:"MuiBreadcrumbs",slot:"Separator"})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function dt(e,r,o,n){return e.reduce((s,l,a)=>(a<e.length-1?s=s.concat(l,t.jsx(ct,{"aria-hidden":!0,className:r,ownerState:n,children:o},`separator-${a}`)):s.push(l),s),[])}const pt=h.forwardRef(function(r,o){const n=ge({props:r,name:"MuiBreadcrumbs"}),{children:s,className:l,component:a="nav",slots:d={},slotProps:x={},expandText:p="Show path",itemsAfterCollapse:m=1,itemsBeforeCollapse:b=1,maxItems:g=8,separator:k="/",...E}=n,[M,z]=h.useState(!1),v={...n,component:a,expanded:M,expandText:p,itemsAfterCollapse:m,itemsBeforeCollapse:b,maxItems:g,separator:k},I=at(v),T=Ee({elementType:d.CollapsedIcon,externalSlotProps:x.collapsedIcon,ownerState:v}),w=h.useRef(null),S=c=>{const P=()=>{z(!0);const y=w.current.querySelector("a[href],button,[tabindex]");y&&y.focus()};return b+m>=c.length?c:[...c.slice(0,b),t.jsx(nt,{"aria-label":p,slots:{CollapsedIcon:d.CollapsedIcon},slotProps:{collapsedIcon:T},onClick:P},"ellipsis"),...c.slice(c.length-m,c.length)]},B=h.Children.toArray(s).filter(c=>h.isValidElement(c)).map((c,P)=>t.jsx("li",{className:I.li,children:c},`child-${P}`));return t.jsx(it,{ref:o,component:a,color:"textSecondary",className:W(I.root,l),ownerState:v,...E,children:t.jsx(lt,{className:I.ol,ref:w,ownerState:v,children:dt(M||g&&B.length<=g?B:S(B),I.separator,k,v)})})});function ut(e,r,o){const n=r.getBoundingClientRect(),s=o&&o.getBoundingClientRect(),l=be(r);let a;if(r.fakeTransform)a=r.fakeTransform;else{const p=l.getComputedStyle(r);a=p.getPropertyValue("-webkit-transform")||p.getPropertyValue("transform")}let d=0,x=0;if(a&&a!=="none"&&typeof a=="string"){const p=a.split("(")[1].split(")")[0].split(",");d=parseInt(p[4],10),x=parseInt(p[5],10)}return e==="left"?s?`translateX(${s.right+d-n.left}px)`:`translateX(${l.innerWidth+d-n.left}px)`:e==="right"?s?`translateX(-${n.right-s.left-d}px)`:`translateX(-${n.left+n.width-d}px)`:e==="up"?s?`translateY(${s.bottom+x-n.top}px)`:`translateY(${l.innerHeight+x-n.top}px)`:s?`translateY(-${n.top-s.top+n.height-x}px)`:`translateY(-${n.top+n.height-x}px)`}function ht(e){return typeof e=="function"?e():e}function O(e,r,o){const n=ht(o),s=ut(e,r,n);s&&(r.style.webkitTransform=s,r.style.transform=s)}const xt=h.forwardRef(function(r,o){const n=K(),s={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},l={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:a,appear:d=!0,children:x,container:p,direction:m="down",easing:b=s,in:g,onEnter:k,onEntered:E,onEntering:M,onExit:z,onExited:v,onExiting:I,style:T,timeout:w=l,TransitionComponent:S=Me,...B}=r,c=h.useRef(null),P=ze(Ie(x),c,o),y=i=>f=>{i&&(f===void 0?i(c.current):i(c.current,f))},F=y((i,f)=>{O(m,i,p),De(i),k&&k(i,f)}),ae=y((i,f)=>{const H=de({timeout:w,style:T,easing:b},{mode:"enter"});i.style.webkitTransition=n.transitions.create("-webkit-transform",{...H}),i.style.transition=n.transitions.create("transform",{...H}),i.style.webkitTransform="none",i.style.transform="none",M&&M(i,f)}),R=y(E),$=y(I),C=y(i=>{const f=de({timeout:w,style:T,easing:b},{mode:"exit"});i.style.webkitTransition=n.transitions.create("-webkit-transform",f),i.style.transition=n.transitions.create("transform",f),O(m,i,p),z&&z(i)}),U=y(i=>{i.style.webkitTransition="",i.style.transition="",v&&v(i)}),_=i=>{a&&a(c.current,i)},N=h.useCallback(()=>{c.current&&O(m,c.current,p)},[m,p]);return h.useEffect(()=>{if(g||m==="down"||m==="right")return;const i=Ce(()=>{c.current&&O(m,c.current,p)}),f=be(c.current);return f.addEventListener("resize",i),()=>{i.clear(),f.removeEventListener("resize",i)}},[m,g,p]),h.useEffect(()=>{g||N()},[g,N]),t.jsx(S,{nodeRef:c,onEnter:F,onEntered:R,onEntering:ae,onExit:C,onExited:U,onExiting:$,addEndListener:_,appear:d,in:g,timeout:w,...B,children:(i,{ownerState:f,...H})=>h.cloneElement(x,{ref:P,style:{visibility:i==="exited"&&!g?"hidden":void 0,...T,...x.props.style},...H})})});function mt(e){return me("MuiDrawer",e)}fe("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const ve=(e,r)=>{const{ownerState:o}=e;return[r.root,(o.variant==="permanent"||o.variant==="persistent")&&r.docked,r.modal]},ft=e=>{const{classes:r,anchor:o,variant:n}=e,s={root:["root",`anchor${L(o)}`],docked:[(n==="permanent"||n==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${L(o)}`,n!=="temporary"&&`paperAnchorDocked${L(o)}`]};return ye(s,mt,r)},gt=D(Re,{name:"MuiDrawer",slot:"Root",overridesResolver:ve})(Q(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),yt=D("div",{shouldForwardProp:He,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:ve})({flex:"0 0 auto"}),bt=D($e,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,r)=>{const{ownerState:o}=e;return[r.paper,r[`paperAnchor${L(o.anchor)}`],o.variant!=="temporary"&&r[`paperAnchorDocked${L(o.anchor)}`]]}})(Q(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:r})=>r.anchor==="left"&&r.variant!=="temporary",style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="top"&&r.variant!=="temporary",style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="right"&&r.variant!=="temporary",style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="bottom"&&r.variant!=="temporary",style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),je={left:"right",right:"left",top:"down",bottom:"up"};function vt(e){return["left","right"].includes(e)}function jt({direction:e},r){return e==="rtl"&&vt(r)?je[r]:r}const kt=h.forwardRef(function(r,o){const n=ge({props:r,name:"MuiDrawer"}),s=K(),l=Te(),a={enter:s.transitions.duration.enteringScreen,exit:s.transitions.duration.leavingScreen},{anchor:d="left",BackdropProps:x,children:p,className:m,elevation:b=16,hideBackdrop:g=!1,ModalProps:{BackdropProps:k,...E}={},onClose:M,open:z=!1,PaperProps:v={},SlideProps:I,TransitionComponent:T,transitionDuration:w=a,variant:S="temporary",slots:B={},slotProps:c={},...P}=n,y=h.useRef(!1);h.useEffect(()=>{y.current=!0},[]);const F=jt({direction:l?"rtl":"ltr"},d),R={...n,anchor:d,elevation:b,open:z,variant:S,...P},$=ft(R),C={slots:{transition:T,...B},slotProps:{paper:v,transition:I,...c,backdrop:Be(c.backdrop||{...x,...k},{transitionDuration:w})}},[U,_]=A("root",{ref:o,elementType:gt,className:W($.root,$.modal,m),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...C,...P,...E},additionalProps:{open:z,onClose:M,hideBackdrop:g,slots:{backdrop:C.slots.backdrop},slotProps:{backdrop:C.slotProps.backdrop}}}),[N,i]=A("paper",{elementType:bt,shouldForwardComponentProp:!0,className:W($.paper,v.className),ownerState:R,externalForwardedProps:C,additionalProps:{elevation:S==="temporary"?b:0,square:!0,...S==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[f,H]=A("docked",{elementType:yt,ref:o,className:W($.root,$.docked,m),ownerState:R,externalForwardedProps:C,additionalProps:P}),[we,Se]=A("transition",{elementType:xt,ownerState:R,externalForwardedProps:C,additionalProps:{in:z,direction:je[F],timeout:w,appear:y.current}}),ie=t.jsx(N,{...i,children:p});if(S==="permanent")return t.jsx(f,{...H,children:ie});const le=t.jsx(we,{...Se,children:ie});return S==="persistent"?t.jsx(f,{...H,children:le}):t.jsx(U,{..._,children:le})}),wt=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")]),St=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"})),Pt=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"})),Et=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"})),Mt=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"})),zt=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"})),It=j(t.jsx("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81zM12 3 2 12h3v8h6v-6h2v6h6v-8h3z"})),Ct=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"})),Dt=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"})),Tt=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(Le,{...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 Bt=/\.malloy(nb)?$/;function Rt(){const{pathname:e,search:r}=G(),o=Z(),n=Ne(),s=Ae(),l=Je(),a=o.environmentName??"",d=o.packageName??"",x=o["*"]??"",p=a!==""&&d!==""&&x!==""&&!Bt.test(x),{reports:m,settled:b}=Oe(a,d,void 0,p);if(!p||s)return null;const g=x.replace(/\/$/,""),k=Ke(r),E=e.replace(/\/$/,"");return k?l?null:t.jsx(pe,{label:"View",onClick:()=>n(`${E}${Ge(r)}`)}):(b?We(`${g}.malloy`,m):void 0)?.editable?t.jsx("span",{onPointerEnter:()=>void he(),onFocus:()=>void he(),children:t.jsx(pe,{label:"Edit",icon:t.jsx(Mt,{}),onClick:()=>n(`${E}${Ze(r)}`)})}):null}function X({label:e,onClick:r,current:o=!1}){return t.jsx(Ve,{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=e["*"]?e["*"].replace(/\/$/,""):void 0,o=ee();return!e.environmentName&&!e.packageName&&!r?null:t.jsx(u,{sx:{display:"flex",alignItems:"center",minWidth:0},children:t.jsxs(pt,{"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&&!r,onClick:n=>o(`/${e.environmentName}/`,n)}),e.packageName&&t.jsx(X,{label:e.packageName,current:!r,onClick:n=>o(`/${e.environmentName}/${e.packageName}/`,n)}),r&&t.jsx(X,{label:r,current:!0,onClick:n=>o(`/${e.environmentName}/${e.packageName}/${r}`,n)})]})})}const Ht=260,Lt=64;function ke({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){return t.jsxs(u,{sx:{height:"100dvh",width:e?Lt:Ht,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(Nt,{isCollapsed:e,onToggleCollapse:r,logoHeader:o}),t.jsxs(u,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",py:1},children:[t.jsx(At,{isCollapsed:e}),t.jsx(Ot,{isCollapsed:e})]}),t.jsx(Wt,{isCollapsed:e})]})}function Nt({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(J,{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 At({isCollapsed:e}){const o=G().pathname==="/";return t.jsx(te,{sx:{py:0},children:t.jsx(se,{icon:t.jsx(It,{fontSize:"small"}),label:"Home",to:"/",selected:o,isCollapsed:e})})}function Ot({isCollapsed:e}){const{apiClients:r}=Fe(),o=Z(),{data:n}=Ue({queryKey:["environments"],queryFn:()=>r.environments.listEnvironments()}),s=n?.data??[];return s.length===0?null:t.jsxs(u,{sx:{mt:1},children:[!e&&t.jsx(J,{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(l=>{const a=l.name??"";return t.jsx(se,{icon:t.jsx(zt,{fontSize:"small"}),label:a,to:`/${a}`,selected:o.environmentName===a,isCollapsed:e},a)})})]})}function Wt({isCollapsed:e}){const{pathname:r}=G(),o=[{label:"Malloy Docs",href:ue.docsHome,icon:t.jsx(wt,{fontSize:"small"}),external:!0},{label:"Publisher Docs",href:ue.publishing,icon:t.jsx(Dt,{fontSize:"small"}),external:!0},{label:"Publisher API",href:"/api-doc.html",icon:t.jsx(Pt,{fontSize:"small"}),external:!1}];return t.jsxs(te,{sx:{py:1},children:[t.jsx(se,{icon:t.jsx(Tt,{fontSize:"small"}),label:"Theme",to:"/settings/theme",selected:r.startsWith("/settings/theme"),isCollapsed:e}),t.jsx(_t,{isCollapsed:e}),o.map(n=>t.jsx(Vt,{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 l=ee(),a=t.jsxs(re,{selected:n,onClick:d=>l(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:a})}):a}function Vt({label:e,href:r,icon:o,external:n,isCollapsed:s}){const l=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:l})}):l}const Ft={light:"dark",dark:"auto",auto:"light"},Ut={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 _t({isCollapsed:e}){const{mode:r,userChoice:o,setMode:n,allowUserToggle:s}=_e();if(!s)return null;const l=o??r,a=l==="auto"?St:l==="dark"?Et:Ct,d=t.jsxs(re,{"aria-label":xe[l],onClick:()=>n(Ft[l]),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(a,{fontSize:"small"})}),!e&&t.jsx(oe,{primary:Ut[l],primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",whiteSpace:"nowrap"}}})]});return t.jsx(V,{title:xe[l],placement:"right",disableHoverListener:!e,children:t.jsx(u,{children:d})})}function Xt({open:e,onClose:r,logoHeader:o}){return t.jsx(kt,{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(ke,{isCollapsed:!1,onToggleCollapse:r,logoHeader:o})})}function Jt({headerProps:e}){const r=K(),o=Xe(r.breakpoints.up("md")),[n,s]=h.useState(!1),[l,a]=h.useState(!1);return h.useEffect(()=>{o&&n&&s(!1)},[o,n]),t.jsxs(u,{sx:{height:"100dvh",display:"flex",flexDirection:"row",bgcolor:"background.default"},children:[o&&t.jsx(ke,{isCollapsed:l,onToggleCollapse:()=>a(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:Ye.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(Rt,{}),e?.endCap]})]}),t.jsx(u,{sx:{flex:1,overflow:"auto",minWidth:320,minHeight:0},children:t.jsx(h.Suspense,{fallback:t.jsx(Qe,{}),children:t.jsx(qe,{})})})]}),t.jsx(Xt,{open:n,onClose:()=>s(!1),logoHeader:e?.logoHeader})]})}export{Jt as default};
1
+ import{a as j,j as t,s as D,B as Me,m as Q,e as ce,g as me,b as fe,r as h,u as ge,d as Pe,f as W,h as ye,T as K,i as G,k as Ee,l as ze,n as Ie,o as be,p as Ce,q as De,t as de,v as Te,w as Be,y as A,z as H,M as Re,P as $e,A as Le,S as He,C as J,D as Z,E as Ne,U as Ae,F as Oe,G as pe,H as We,c as ee,I as u,J as Ve,K as Y,L as V,N as te,O as Fe,Q as Ue,R as ue,V as _e,W as re,X as ne,Y as oe,Z as Xe,_ as Ye,$ as qe,a0 as Qe}from"./index-Dgqan3mQ.js";import{u as Ke,l as he}from"./editPageMounted-BT7ByBX-.js";import{i as Ge,w as Je,a as Ze}from"./documentRoutes-QL_YE88h.js";const et=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"})),tt=D(Me,{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)}}}))),rt=D(et)({width:24,height:16});function nt(e){const{slots:r={},slotProps:o={},...n}=e,s=e;return t.jsx("li",{children:t.jsx(tt,{focusRipple:!0,...n,ownerState:s,children:t.jsx(rt,{as:r.CollapsedIcon,ownerState:s,...o.collapsedIcon})})})}function ot(e){return me("MuiBreadcrumbs",e)}const st=fe("MuiBreadcrumbs",["root","ol","li","separator"]),at=e=>{const{classes:r}=e;return ye({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},ot,r)},it=D(K,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,r)=>[{[`& .${st.li}`]:r.li},r.root]})({}),lt=D("ol",{name:"MuiBreadcrumbs",slot:"Ol"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),ct=D("li",{name:"MuiBreadcrumbs",slot:"Separator"})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function dt(e,r,o,n){return e.reduce((s,l,a)=>(a<e.length-1?s=s.concat(l,t.jsx(ct,{"aria-hidden":!0,className:r,ownerState:n,children:o},`separator-${a}`)):s.push(l),s),[])}const pt=h.forwardRef(function(r,o){const n=ge({props:r,name:"MuiBreadcrumbs"}),{children:s,className:l,component:a="nav",slots:d={},slotProps:x={},expandText:p="Show path",itemsAfterCollapse:m=1,itemsBeforeCollapse:b=1,maxItems:g=8,separator:k="/",...P}=n,[E,z]=h.useState(!1),v={...n,component:a,expanded:E,expandText:p,itemsAfterCollapse:m,itemsBeforeCollapse:b,maxItems:g,separator:k},I=at(v),T=Pe({elementType:d.CollapsedIcon,externalSlotProps:x.collapsedIcon,ownerState:v}),w=h.useRef(null),S=c=>{const M=()=>{z(!0);const y=w.current.querySelector("a[href],button,[tabindex]");y&&y.focus()};return b+m>=c.length?c:[...c.slice(0,b),t.jsx(nt,{"aria-label":p,slots:{CollapsedIcon:d.CollapsedIcon},slotProps:{collapsedIcon:T},onClick:M},"ellipsis"),...c.slice(c.length-m,c.length)]},B=h.Children.toArray(s).filter(c=>h.isValidElement(c)).map((c,M)=>t.jsx("li",{className:I.li,children:c},`child-${M}`));return t.jsx(it,{ref:o,component:a,color:"textSecondary",className:W(I.root,l),ownerState:v,...P,children:t.jsx(lt,{className:I.ol,ref:w,ownerState:v,children:dt(E||g&&B.length<=g?B:S(B),I.separator,k,v)})})});function ut(e,r,o){const n=r.getBoundingClientRect(),s=o&&o.getBoundingClientRect(),l=be(r);let a;if(r.fakeTransform)a=r.fakeTransform;else{const p=l.getComputedStyle(r);a=p.getPropertyValue("-webkit-transform")||p.getPropertyValue("transform")}let d=0,x=0;if(a&&a!=="none"&&typeof a=="string"){const p=a.split("(")[1].split(")")[0].split(",");d=parseInt(p[4],10),x=parseInt(p[5],10)}return e==="left"?s?`translateX(${s.right+d-n.left}px)`:`translateX(${l.innerWidth+d-n.left}px)`:e==="right"?s?`translateX(-${n.right-s.left-d}px)`:`translateX(-${n.left+n.width-d}px)`:e==="up"?s?`translateY(${s.bottom+x-n.top}px)`:`translateY(${l.innerHeight+x-n.top}px)`:s?`translateY(-${n.top-s.top+n.height-x}px)`:`translateY(-${n.top+n.height-x}px)`}function ht(e){return typeof e=="function"?e():e}function O(e,r,o){const n=ht(o),s=ut(e,r,n);s&&(r.style.webkitTransform=s,r.style.transform=s)}const xt=h.forwardRef(function(r,o){const n=G(),s={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},l={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:a,appear:d=!0,children:x,container:p,direction:m="down",easing:b=s,in:g,onEnter:k,onEntered:P,onEntering:E,onExit:z,onExited:v,onExiting:I,style:T,timeout:w=l,TransitionComponent:S=Ee,...B}=r,c=h.useRef(null),M=ze(Ie(x),c,o),y=i=>f=>{i&&(f===void 0?i(c.current):i(c.current,f))},F=y((i,f)=>{O(m,i,p),De(i),k&&k(i,f)}),ae=y((i,f)=>{const L=de({timeout:w,style:T,easing:b},{mode:"enter"});i.style.webkitTransition=n.transitions.create("-webkit-transform",{...L}),i.style.transition=n.transitions.create("transform",{...L}),i.style.webkitTransform="none",i.style.transform="none",E&&E(i,f)}),R=y(P),$=y(I),C=y(i=>{const f=de({timeout:w,style:T,easing:b},{mode:"exit"});i.style.webkitTransition=n.transitions.create("-webkit-transform",f),i.style.transition=n.transitions.create("transform",f),O(m,i,p),z&&z(i)}),U=y(i=>{i.style.webkitTransition="",i.style.transition="",v&&v(i)}),_=i=>{a&&a(c.current,i)},N=h.useCallback(()=>{c.current&&O(m,c.current,p)},[m,p]);return h.useEffect(()=>{if(g||m==="down"||m==="right")return;const i=Ce(()=>{c.current&&O(m,c.current,p)}),f=be(c.current);return f.addEventListener("resize",i),()=>{i.clear(),f.removeEventListener("resize",i)}},[m,g,p]),h.useEffect(()=>{g||N()},[g,N]),t.jsx(S,{nodeRef:c,onEnter:F,onEntered:R,onEntering:ae,onExit:C,onExited:U,onExiting:$,addEndListener:_,appear:d,in:g,timeout:w,...B,children:(i,{ownerState:f,...L})=>h.cloneElement(x,{ref:M,style:{visibility:i==="exited"&&!g?"hidden":void 0,...T,...x.props.style},...L})})});function mt(e){return me("MuiDrawer",e)}fe("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const ve=(e,r)=>{const{ownerState:o}=e;return[r.root,(o.variant==="permanent"||o.variant==="persistent")&&r.docked,r.modal]},ft=e=>{const{classes:r,anchor:o,variant:n}=e,s={root:["root",`anchor${H(o)}`],docked:[(n==="permanent"||n==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${H(o)}`,n!=="temporary"&&`paperAnchorDocked${H(o)}`]};return ye(s,mt,r)},gt=D(Re,{name:"MuiDrawer",slot:"Root",overridesResolver:ve})(Q(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),yt=D("div",{shouldForwardProp:Le,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:ve})({flex:"0 0 auto"}),bt=D($e,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,r)=>{const{ownerState:o}=e;return[r.paper,r[`paperAnchor${H(o.anchor)}`],o.variant!=="temporary"&&r[`paperAnchorDocked${H(o.anchor)}`]]}})(Q(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:r})=>r.anchor==="left"&&r.variant!=="temporary",style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="top"&&r.variant!=="temporary",style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="right"&&r.variant!=="temporary",style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="bottom"&&r.variant!=="temporary",style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),je={left:"right",right:"left",top:"down",bottom:"up"};function vt(e){return["left","right"].includes(e)}function jt({direction:e},r){return e==="rtl"&&vt(r)?je[r]:r}const kt=h.forwardRef(function(r,o){const n=ge({props:r,name:"MuiDrawer"}),s=G(),l=Te(),a={enter:s.transitions.duration.enteringScreen,exit:s.transitions.duration.leavingScreen},{anchor:d="left",BackdropProps:x,children:p,className:m,elevation:b=16,hideBackdrop:g=!1,ModalProps:{BackdropProps:k,...P}={},onClose:E,open:z=!1,PaperProps:v={},SlideProps:I,TransitionComponent:T,transitionDuration:w=a,variant:S="temporary",slots:B={},slotProps:c={},...M}=n,y=h.useRef(!1);h.useEffect(()=>{y.current=!0},[]);const F=jt({direction:l?"rtl":"ltr"},d),R={...n,anchor:d,elevation:b,open:z,variant:S,...M},$=ft(R),C={slots:{transition:T,...B},slotProps:{paper:v,transition:I,...c,backdrop:Be(c.backdrop||{...x,...k},{transitionDuration:w})}},[U,_]=A("root",{ref:o,elementType:gt,className:W($.root,$.modal,m),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...C,...M,...P},additionalProps:{open:z,onClose:E,hideBackdrop:g,slots:{backdrop:C.slots.backdrop},slotProps:{backdrop:C.slotProps.backdrop}}}),[N,i]=A("paper",{elementType:bt,shouldForwardComponentProp:!0,className:W($.paper,v.className),ownerState:R,externalForwardedProps:C,additionalProps:{elevation:S==="temporary"?b:0,square:!0,...S==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[f,L]=A("docked",{elementType:yt,ref:o,className:W($.root,$.docked,m),ownerState:R,externalForwardedProps:C,additionalProps:M}),[we,Se]=A("transition",{elementType:xt,ownerState:R,externalForwardedProps:C,additionalProps:{in:z,direction:je[F],timeout:w,appear:y.current}}),ie=t.jsx(N,{...i,children:p});if(S==="permanent")return t.jsx(f,{...L,children:ie});const le=t.jsx(we,{...Se,children:ie});return S==="persistent"?t.jsx(f,{...L,children:le}):t.jsx(U,{..._,children:le})}),wt=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")]),St=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"})),Pt=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"})),Et=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"})),zt=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"})),It=j(t.jsx("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81zM12 3 2 12h3v8h6v-6h2v6h6v-8h3z"})),Ct=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"})),Dt=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"})),Tt=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(He,{...e,viewBox:"0 0 24 24",sx:{fill:"none",...e.sx},children:[t.jsx("rect",{x:"3.25",y:"4.75",width:"17.5",height:"14.5",rx:"2.25",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("line",{x1:"8.5",y1:"5",x2:"8.5",y2:"19",stroke:"currentColor",strokeWidth:"1.5"})]})}const Bt=/\.malloy(nb)?$/;function Rt(){const{pathname:e,search:r}=J(),o=Z(),n=Ne(),s=Ae(),l=Ke(),a=o.environmentName??"",d=o.packageName??"",x=o["*"]??"",p=a!==""&&d!==""&&x!==""&&!Bt.test(x),{reports:m,settled:b}=Oe(a,d,void 0,p);if(!p||s)return null;const g=x.replace(/\/$/,""),k=Ge(r),P=e.replace(/\/$/,"");return k?l?null:t.jsx(pe,{label:"View",onClick:()=>n(`${P}${Je(r)}`)}):(b?We(`${g}.malloy`,m):void 0)?.editable?t.jsx("span",{onPointerEnter:()=>void he(),onFocus:()=>void he(),children:t.jsx(pe,{label:"Edit",icon:t.jsx(Et,{}),onClick:()=>n(`${P}${Ze(r)}`)})}):null}function X({label:e,onClick:r,current:o=!1}){return t.jsx(Ve,{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=e["*"]?e["*"].replace(/\/$/,""):void 0,o=ee();return!e.environmentName&&!e.packageName&&!r?null:t.jsx(u,{sx:{display:"flex",alignItems:"center",minWidth:0},children:t.jsxs(pt,{"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&&!r,onClick:n=>o(`/${e.environmentName}/`,n)}),e.packageName&&t.jsx(X,{label:e.packageName,current:!r,onClick:n=>o(`/${e.environmentName}/${e.packageName}/`,n)}),r&&t.jsx(X,{label:r,current:!0,onClick:n=>o(`/${e.environmentName}/${e.packageName}/${r}`,n)})]})})}const Lt=260,Ht=64;function ke({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){return t.jsxs(u,{sx:{height:"100dvh",width:e?Ht:Lt,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(Nt,{isCollapsed:e,onToggleCollapse:r,logoHeader:o}),t.jsxs(u,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",py:1},children:[t.jsx(At,{isCollapsed:e}),t.jsx(Ot,{isCollapsed:e})]}),t.jsx(Wt,{isCollapsed:e})]})}function Nt({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 At({isCollapsed:e}){const o=J().pathname==="/";return t.jsx(te,{sx:{py:0},children:t.jsx(se,{icon:t.jsx(It,{fontSize:"small"}),label:"Home",to:"/",selected:o,isCollapsed:e})})}function Ot({isCollapsed:e}){const{apiClients:r}=Fe(),o=Z(),{data:n}=Ue({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(l=>{const a=l.name??"";return t.jsx(se,{icon:t.jsx(zt,{fontSize:"small"}),label:a,to:`/${a}`,selected:o.environmentName===a,isCollapsed:e},a)})})]})}function Wt({isCollapsed:e}){const{pathname:r}=J(),o=[{label:"Malloy Docs",href:ue.docsHome,icon:t.jsx(wt,{fontSize:"small"}),external:!0},{label:"Publisher Docs",href:ue.publishing,icon:t.jsx(Dt,{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(Tt,{fontSize:"small"}),label:"Theme",to:"/settings/theme",selected:r.startsWith("/settings/theme"),isCollapsed:e}),t.jsx(_t,{isCollapsed:e}),o.map(n=>t.jsx(Vt,{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 l=ee(),a=t.jsxs(re,{selected:n,onClick:d=>l(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:a})}):a}function Vt({label:e,href:r,icon:o,external:n,isCollapsed:s}){const l=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:l})}):l}const Ft={light:"dark",dark:"auto",auto:"light"},Ut={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 _t({isCollapsed:e}){const{mode:r,userChoice:o,setMode:n,allowUserToggle:s}=_e();if(!s)return null;const l=o??r,a=l==="auto"?St:l==="dark"?Pt:Ct,d=t.jsxs(re,{"aria-label":xe[l],onClick:()=>n(Ft[l]),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(a,{fontSize:"small"})}),!e&&t.jsx(oe,{primary:Ut[l],primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",whiteSpace:"nowrap"}}})]});return t.jsx(V,{title:xe[l],placement:"right",disableHoverListener:!e,children:t.jsx(u,{children:d})})}function Xt({open:e,onClose:r,logoHeader:o}){return t.jsx(kt,{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(ke,{isCollapsed:!1,onToggleCollapse:r,logoHeader:o})})}function Kt({headerProps:e}){const r=G(),o=Xe(r.breakpoints.up("md")),[n,s]=h.useState(!1),[l,a]=h.useState(!1);return h.useEffect(()=>{o&&n&&s(!1)},[o,n]),t.jsxs(u,{sx:{height:"100dvh",display:"flex",flexDirection:"row",bgcolor:"background.default"},children:[o&&t.jsx(ke,{isCollapsed:l,onToggleCollapse:()=>a(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:Ye.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(Rt,{}),e?.endCap]})]}),t.jsx(u,{sx:{flex:1,overflow:"auto",minWidth:320,minHeight:0},children:t.jsx(h.Suspense,{fallback:t.jsx(Qe,{}),children:t.jsx(qe,{})})})]}),t.jsx(Xt,{open:n,onClose:()=>s(!1),logoHeader:e?.logoHeader})]})}export{Kt as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-B3P9tIm3.js","assets/index-gQEuz0Cg.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-TKxhg0Mg.js"])))=>i.map(i=>d[i]);
2
- import{g as ne,b as re,a1 as E,a2 as se,r as d,u as oe,i as ae,j as t,f as ie,z as W,h as le,s as ce,T as C,m as ue,a3 as de,a4 as M,a as B,F as I,a5 as pe,a6 as fe,a7 as A,a8 as N,a9 as V,H as z,I as x,aa as he,ab as R,ac as O,ad as xe,ae as me,af as ge,ag as ye,ah as ve,E as be,C as $,ai as je,aj as ke,ak as q,al as G,am as Ce,an as we,ao as H,ap as Ee,aq as X,G as Re,ar as De,as as Se,a0 as P,at as T,D as $e,O as Ae,au as Le,av as F,aw as Me}from"./index-gQEuz0Cg.js";import{i as L,w as Pe,a as J,l as Te}from"./documentRoutes-D4TbSIi5.js";import{a as Fe,l as K}from"./editPageMounted-0kzl2sgg.js";function _e(e){return ne("MuiLink",e)}const Ue=re("MuiLink",["root","underlineNone","underlineHover","underlineAlways","button","focusVisible"]),We=({theme:e,ownerState:r})=>{const n=r.color;if("colorSpace"in e&&e.colorSpace){const u=E(e,`palette.${n}.main`)||E(e,`palette.${n}`)||r.color;return e.alpha(u,.4)}const o=E(e,`palette.${n}.main`,!1)||E(e,`palette.${n}`,!1)||r.color,a=E(e,`palette.${n}.mainChannel`)||E(e,`palette.${n}Channel`);return"vars"in e&&a?`rgba(${a} / 0.4)`:se(o,.4)},_={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Be=e=>{const{classes:r,component:n,focusVisible:o,underline:a}=e,u={root:["root",`underline${W(a)}`,n==="button"&&"button",o&&"focusVisible"]};return le(u,_e,r)},Ie=ce(C,{name:"MuiLink",slot:"Root",overridesResolver:(e,r)=>{const{ownerState:n}=e;return[r.root,r[`underline${W(n.underline)}`],n.component==="button"&&r.button]}})(ue(({theme:e})=>({variants:[{props:{underline:"none"},style:{textDecoration:"none"}},{props:{underline:"hover"},style:{textDecoration:"none","&:hover":{textDecoration:"underline"}}},{props:{underline:"always"},style:{textDecoration:"underline","&:hover":{textDecorationColor:"inherit"}}},{props:({underline:r,ownerState:n})=>r==="always"&&n.color!=="inherit",style:{textDecorationColor:"var(--Link-underlineColor)"}},{props:({underline:r,ownerState:n})=>r==="always"&&n.color==="inherit",style:e.colorSpace?{textDecorationColor:e.alpha("currentColor",.4)}:null},...Object.entries(e.palette).filter(de()).map(([r])=>({props:{underline:"always",color:r},style:{"--Link-underlineColor":e.alpha((e.vars||e).palette[r].main,.4)}})),{props:{underline:"always",color:"textPrimary"},style:{"--Link-underlineColor":e.alpha((e.vars||e).palette.text.primary,.4)}},{props:{underline:"always",color:"textSecondary"},style:{"--Link-underlineColor":e.alpha((e.vars||e).palette.text.secondary,.4)}},{props:{underline:"always",color:"textDisabled"},style:{"--Link-underlineColor":(e.vars||e).palette.text.disabled}},{props:{component:"button"},style:{position:"relative",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none","&::-moz-focus-inner":{borderStyle:"none"},[`&.${Ue.focusVisible}`]:{outline:"auto"}}}]}))),Ne=d.forwardRef(function(r,n){const o=oe({props:r,name:"MuiLink"}),a=ae(),{className:u,color:s="primary",component:l="a",onBlur:i,onFocus:c,TypographyClasses:m,underline:h="always",variant:p="inherit",sx:f,...y}=o,[v,k]=d.useState(!1),g=j=>{M(j.target)||k(!1),i&&i(j)},w=j=>{M(j.target)&&k(!0),c&&c(j)},b={...o,color:s,component:l,focusVisible:v,underline:h,variant:p},S=Be(b);return t.jsx(Ie,{color:s,className:ie(S.root,u),classes:m,component:l,onBlur:g,onFocus:w,ref:n,ownerState:b,variant:p,...y,sx:[..._[s]===void 0?[{color:s}]:[],...Array.isArray(f)?f:[f]],style:{...y.style,...h==="always"&&s!=="inherit"&&!_[s]&&{"--Link-underlineColor":We({theme:a,ownerState:b})}}})});function Ve(e,r){const n=B(),{reports:o,settled:a,isError:u}=I(e,r),s=a&&!u;return d.useCallback((l,i)=>{const c=l.path;if(!pe(c))return"malformed";const m=fe(c,o),h=A(e,r,m.kind==="path"?m.report.path:c),p=new URLSearchParams(l.givens).toString();return n(h+(p?`?${p}`:""),i),m.kind==="path"?"resolved":s?"unresolved":"unverified"},[n,e,r,o,s])}const ze=1200,D={p:3,maxWidth:ze,mx:"auto"},Y={...D,pt:6},Oe='[data-tile-kind="query"]',qe=".malloy-render, .malloy-table, [role='alert'], .MuiAlert-root",Ge=3e3;function Q(e,r,n,o){const a=d.useRef(n);a.current=n;const u=d.useRef(!1);d.useEffect(()=>{if(!a.current||u.current)return;let s=0;const l={},i=()=>{clearTimeout(m),l.beat!==void 0&&clearInterval(l.beat),cancelAnimationFrame(s),l.observer?.disconnect()},c=()=>{u.current||(u.current=!0,i(),a.current?.())},m=setTimeout(c,Ge);if(!r)return()=>clearTimeout(m);const h=()=>{const p=e.current;if(!p||o&&p.querySelector(o)===null)return;const f=window.innerHeight;[...p.querySelectorAll(Oe)].filter(v=>{if(v.getBoundingClientRect().top>=f)return!1;const g=v.querySelector(qe);return!g||g.getBoundingClientRect().height<8}).length===0&&s===0&&(s=requestAnimationFrame(()=>{s=requestAnimationFrame(c)}))};return l.observer=new MutationObserver(h),e.current&&l.observer.observe(e.current,{childList:!0,subtree:!0}),l.beat=setInterval(h,50),h(),i},[r,e,o])}function Z({environmentName:e,packageName:r,path:n,editable:o=n.endsWith(".malloy"),onReady:a}){const u=d.useRef(null);Q(u,!0,a,`.${me.report}`);const{params:s,onGivensChange:l}=N(),i=Ve(e,r),c=B(),m=d.useMemo(()=>V({environmentName:e,packageName:r}),[e,r]),h=z();return d.useEffect(()=>{if(!o||h)return;const p=()=>void xe(()=>import("./index.es-B3P9tIm3.js"),__vite__mapDeps([0,1,2,3])),f=window.requestIdleCallback;if(f){const v=f(p);return()=>window.cancelIdleCallback?.(v)}const y=setTimeout(p,1500);return()=>clearTimeout(y)},[o,h]),t.jsx(x,{ref:u,sx:Y,children:n.endsWith(".malloynb")?t.jsx(he,{resourceUri:R({environmentName:e,packageName:r,modelPath:n}),givens:s,onGivensChange:l,onNavigate:c,onDrillNavigate:i,maxResultSize:1024*1024}):t.jsx(O,{resourceUri:R({environmentName:e,packageName:r}),path:n,givens:s,onGivensChange:l,onNavigate:i,onLinkNavigate:c,onEvent:m,maxResultSize:1024*1024})})}function He(){const[e,r]=d.useState(!1),n=d.useRef(!1),o=d.useRef(!1),a=d.useCallback(i=>{n.current=i,r(i)},[]),u=d.useCallback(()=>{o.current=!0},[]),s=ge(d.useCallback(({currentLocation:i,nextLocation:c})=>n.current&&!o.current&&(i.pathname!==c.pathname||L(i.search)!==L(c.search)),[]));d.useEffect(()=>{if(!e)return;const i=c=>{c.preventDefault(),c.returnValue=""};return window.addEventListener("beforeunload",i),()=>window.removeEventListener("beforeunload",i)},[e]);const l=t.jsx(ye,{open:s.state==="blocked",canSave:!1,onKeepEditing:()=>s.reset?.(),onDiscard:()=>s.proceed?.()});return{onDirtyChange:a,leaving:u,dialog:l}}const Xe=G.lazy(()=>K().then(e=>({default:e.ReportEditor}))),Je=G.lazy(()=>K().then(e=>({default:e.BuilderBar})));function Ke(){const[e,r]=d.useState(null);return d.useEffect(()=>{r(document.getElementById("header-actions-portal"))},[]),e}function ee({environmentName:e,packageName:r,path:n,layout:o="grid",onReady:a,quietLoading:u=!1,offstage:s=!1}){const l=He();Fe();const[i]=d.useState(ve),c=be(),{pathname:m,search:h}=$(),p=Ke(),[f,y]=d.useState(),v=d.useRef(null),k=z();Q(v,f!==void 0||k,a);const g=()=>c(`${m.replace(/\/$/,"")}${Pe(h)}`),w=d.useMemo(()=>V({environmentName:e,packageName:r}),[e,r]),b=t.jsx(O,{resourceUri:R({environmentName:e,packageName:r}),path:n,manifestStaleTime:1e4});return t.jsxs(x,{ref:v,sx:Y,children:[t.jsx(je,{children:t.jsx(d.Suspense,{fallback:u?null:b,children:t.jsx(Xe,{resourceUri:R({environmentName:e,packageName:r}),path:n,layout:o,keepDraft:i,onDirtyChange:l.onDirtyChange,onExit:g,onOpenModel:S=>c(`/${[e,r,...S.split("/")].map(encodeURIComponent).join("/")}`),onEvent:w,loading:u?null:b,onControlsChange:y},`${e}/${r}/${n}`)})}),l.dialog,p&&!s&&ke.createPortal(t.jsx(d.Suspense,{fallback:t.jsx(q,{variant:"contained",disableElevation:!0,onClick:g,children:"Done"}),children:t.jsx(Je,{controls:f,onDone:g})}),p)]})}function Ye({environmentName:e,packageName:r,routePath:n,edit:o,reports:a,children:u}){const{search:s}=$(),l=Ce(n);if(!l)return t.jsx(t.Fragment,{children:u});const i=we(l.name,a,l.prefer);return"found"in i?t.jsx(H,{replace:!0,to:`${A(e,r,i.found.path)}${o?J(s):s}`}):"ambiguous"in i?t.jsxs(x,{sx:D,children:[t.jsxs(C,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:["More than one report is named ",l.name]}),t.jsx(C,{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(x,{component:"ul",sx:{mt:1},children:i.ambiguous.map(c=>t.jsx("li",{children:t.jsx(Ee,{to:A(e,r,c),style:{fontFamily:X},children:c})},c))})]}):t.jsx(t.Fragment,{children:u})}function Qe({environmentName:e,packageName:r,routePath:n,edit:o,notFound:a,notFoundUntilListed:u=!1}){const{reports:s,settled:l,isFetching:i,isError:c,refetch:m}=I(e,r),{search:h}=$(),p=`${n}.malloy`,f=l?Re(p,s):void 0,y=l&&!i&&!c,[v,k]=d.useState();d.useEffect(()=>{y&&k(p)},[y,p]);const g=f!==void 0||y||v===p,w=De(e,r,p,o&&g&&!f),b=te=>t.jsx(Ye,{environmentName:e,packageName:r,routePath:n,edit:o,reports:s,children:te});if(!g&&(u&&!o&&!f))return b(a);if(!g&&c&&!i)return t.jsx(x,{sx:D,children:t.jsxs(Se,{severity:"warning",action:t.jsx(q,{color:"inherit",size:"small",onClick:()=>void m(),children:"Retry"}),children:["Could not list this package's reports, so this page cannot tell what is at ",n,"."]})});if(!g)return t.jsx(P,{text:T.opening()});if(f)return t.jsx(Ze,{environmentName:e,packageName:r,path:f.path,editable:f.editable,layout:f.layout,edit:o});const j=o?void 0:Te(n);return j!==void 0?t.jsx(H,{replace:!0,to:`/${e}/${r}/${j.split("/").map(encodeURIComponent).join("/")}${J(h)}`}):b(o?w.settled?t.jsx(ee,{environmentName:e,packageName:r,path:p,layout:w.layout??"grid"}):t.jsx(P,{text:T.opening()}):a)}function Ze({environmentName:e,packageName:r,path:n,editable:o,layout:a,edit:u}){const[s,l]=d.useState(u?"editor":"reader"),i=u?"editor":"reader",c=i==="reader"||s==="reader",m=i==="editor"||s==="editor",h={position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",overflow:"hidden"};return t.jsxs(x,{sx:{position:"relative"},"data-switching":c&&m||void 0,children:[c&&t.jsx(x,{sx:s==="reader"?void 0:h,"aria-hidden":s!=="reader"||void 0,children:t.jsx(Z,{environmentName:e,packageName:r,path:n,...o!==void 0?{editable:o}:{},onReady:()=>{u||l("reader")}})},"reader"),m&&t.jsx(x,{sx:s==="editor"?void 0:h,"aria-hidden":s!=="editor"||void 0,children:t.jsx(ee,{environmentName:e,packageName:r,path:n,...a?{layout:a}:{},quietLoading:c,offstage:i!=="editor"||s!=="editor",onReady:()=>{u&&l("editor")}})},"editor")]})}function rt(){const e=$e(),{search:r}=$(),n=e["*"],{server:o}=Ae(),{params:a,onGivensChange:u}=N();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(n!==void 0&&n!==""&&!n.endsWith(".malloy")&&!n.endsWith(".malloynb")){const l=n.replace(/\/$/,""),i=l.startsWith("data-apps/"),c=i?t.jsx(Le,{resourceUri:R({environmentName:e.environmentName,packageName:e.packageName,modelPath:l.slice(10)})}):t.jsx(U,{environmentName:e.environmentName,packageName:e.packageName,modelPath:n,staticUrl:F({server:o,environmentName:e.environmentName,packageName:e.packageName,path:n})});return t.jsx(Qe,{environmentName:e.environmentName,packageName:e.packageName,routePath:l,edit:L(r),notFound:c,notFoundUntilListed:i})}const s=R({environmentName:e.environmentName,packageName:e.packageName,modelPath:n});return n?.endsWith(".malloy")?t.jsx(x,{sx:D,children:t.jsx(Me,{resourceUri:s,runOnDemand:!0,maxResultSize:512*1024,givens:a,onGivensChange:u})}):n?.endsWith(".malloynb")?t.jsx(Z,{environmentName:e.environmentName,packageName:e.packageName,path:n,editable:!1}):t.jsx(U,{environmentName:e.environmentName,packageName:e.packageName,modelPath:n??"",staticUrl:F({server:o,environmentName:e.environmentName,packageName:e.packageName,path:n??""})})}function U({packageName:e,modelPath:r,staticUrl:n}){const o=/\.[^./]+$/.test(r),a={fontFamily:X};return t.jsxs(x,{sx:D,children:[t.jsx(C,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Nothing to open at this path"}),t.jsxs(C,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[t.jsx(x,{component:"span",sx:a,children:r})," ","does not name a report, a"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"})," ","or a"," ",t.jsx(x,{component:"span",sx:a,children:".malloynb"})," ","file in package"," ",t.jsx(x,{component:"span",sx:a,children:e}),". This address opens reports by their path without"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"}),", and"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"})," ","and"," ",t.jsx(x,{component:"span",sx:a,children:".malloynb"})," ","files."]}),o&&t.jsxs(C,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",t.jsx(x,{component:"span",sx:a,children:"public/"})," ","directory is served at ",t.jsx(Ne,{href:n,children:n}),"."]}),t.jsx(C,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its reports, models, and data apps."})]})}export{rt as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-BBmXDZRJ.js","assets/index-Dgqan3mQ.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-CWY9-__R.js"])))=>i.map(i=>d[i]);
2
+ import{g as ne,b as re,a1 as E,a2 as se,r as d,u as oe,i as ae,j as t,f as ie,z as B,h as le,s as ce,T as C,m as ue,a3 as de,a4 as M,c as W,F as I,a5 as pe,a6 as fe,a7 as A,a8 as N,a9 as z,U as V,I as x,aa as he,ab as R,ac as q,ad as xe,ae as me,af as ge,ag as ye,ah as ve,E as be,C as $,ai as je,aj as ke,ak as O,al as G,am as Ce,an as we,ao as H,ap as Ee,aq as X,H as Re,ar as Se,as as De,a0 as T,at as P,D as $e,O as Ae,au as Le,av as F,aw as Me}from"./index-Dgqan3mQ.js";import{i as L,w as Te,a as J,l as Pe}from"./documentRoutes-QL_YE88h.js";import{a as Fe,l as K}from"./editPageMounted-BT7ByBX-.js";function Ue(e){return ne("MuiLink",e)}const _e=re("MuiLink",["root","underlineNone","underlineHover","underlineAlways","button","focusVisible"]),Be=({theme:e,ownerState:r})=>{const n=r.color;if("colorSpace"in e&&e.colorSpace){const u=E(e,`palette.${n}.main`)||E(e,`palette.${n}`)||r.color;return e.alpha(u,.4)}const o=E(e,`palette.${n}.main`,!1)||E(e,`palette.${n}`,!1)||r.color,a=E(e,`palette.${n}.mainChannel`)||E(e,`palette.${n}Channel`);return"vars"in e&&a?`rgba(${a} / 0.4)`:se(o,.4)},U={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},We=e=>{const{classes:r,component:n,focusVisible:o,underline:a}=e,u={root:["root",`underline${B(a)}`,n==="button"&&"button",o&&"focusVisible"]};return le(u,Ue,r)},Ie=ce(C,{name:"MuiLink",slot:"Root",overridesResolver:(e,r)=>{const{ownerState:n}=e;return[r.root,r[`underline${B(n.underline)}`],n.component==="button"&&r.button]}})(ue(({theme:e})=>({variants:[{props:{underline:"none"},style:{textDecoration:"none"}},{props:{underline:"hover"},style:{textDecoration:"none","&:hover":{textDecoration:"underline"}}},{props:{underline:"always"},style:{textDecoration:"underline","&:hover":{textDecorationColor:"inherit"}}},{props:({underline:r,ownerState:n})=>r==="always"&&n.color!=="inherit",style:{textDecorationColor:"var(--Link-underlineColor)"}},{props:({underline:r,ownerState:n})=>r==="always"&&n.color==="inherit",style:e.colorSpace?{textDecorationColor:e.alpha("currentColor",.4)}:null},...Object.entries(e.palette).filter(de()).map(([r])=>({props:{underline:"always",color:r},style:{"--Link-underlineColor":e.alpha((e.vars||e).palette[r].main,.4)}})),{props:{underline:"always",color:"textPrimary"},style:{"--Link-underlineColor":e.alpha((e.vars||e).palette.text.primary,.4)}},{props:{underline:"always",color:"textSecondary"},style:{"--Link-underlineColor":e.alpha((e.vars||e).palette.text.secondary,.4)}},{props:{underline:"always",color:"textDisabled"},style:{"--Link-underlineColor":(e.vars||e).palette.text.disabled}},{props:{component:"button"},style:{position:"relative",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none","&::-moz-focus-inner":{borderStyle:"none"},[`&.${_e.focusVisible}`]:{outline:"auto"}}}]}))),Ne=d.forwardRef(function(r,n){const o=oe({props:r,name:"MuiLink"}),a=ae(),{className:u,color:s="primary",component:l="a",onBlur:i,onFocus:c,TypographyClasses:m,underline:h="always",variant:p="inherit",sx:f,...y}=o,[v,k]=d.useState(!1),g=j=>{M(j.target)||k(!1),i&&i(j)},w=j=>{M(j.target)&&k(!0),c&&c(j)},b={...o,color:s,component:l,focusVisible:v,underline:h,variant:p},D=We(b);return t.jsx(Ie,{color:s,className:ie(D.root,u),classes:m,component:l,onBlur:g,onFocus:w,ref:n,ownerState:b,variant:p,...y,sx:[...U[s]===void 0?[{color:s}]:[],...Array.isArray(f)?f:[f]],style:{...y.style,...h==="always"&&s!=="inherit"&&!U[s]&&{"--Link-underlineColor":Be({theme:a,ownerState:b})}}})});function ze(e,r){const n=W(),{reports:o,settled:a,isError:u}=I(e,r),s=a&&!u;return d.useCallback((l,i)=>{const c=l.path;if(!pe(c))return"malformed";const m=fe(c,o),h=A(e,r,m.kind==="path"?m.report.path:c),p=new URLSearchParams(l.givens).toString();return n(h+(p?`?${p}`:""),i),m.kind==="path"?"resolved":s?"unresolved":"unverified"},[n,e,r,o,s])}const Ve=1200,S={p:3,maxWidth:Ve,mx:"auto"},Y={...S,pt:6},qe='[data-tile-kind="query"]',Oe=".malloy-render, .malloy-table, [role='alert'], .MuiAlert-root",Ge=3e3;function Q(e,r,n,o){const a=d.useRef(n);a.current=n;const u=d.useRef(!1);d.useEffect(()=>{if(!a.current||u.current)return;let s=0;const l={},i=()=>{clearTimeout(m),l.beat!==void 0&&clearInterval(l.beat),cancelAnimationFrame(s),l.observer?.disconnect()},c=()=>{u.current||(u.current=!0,i(),a.current?.())},m=setTimeout(c,Ge);if(!r)return()=>clearTimeout(m);const h=()=>{const p=e.current;if(!p||o&&p.querySelector(o)===null)return;const f=window.innerHeight;[...p.querySelectorAll(qe)].filter(v=>{if(v.getBoundingClientRect().top>=f)return!1;const g=v.querySelector(Oe);return!g||g.getBoundingClientRect().height<8}).length===0&&s===0&&(s=requestAnimationFrame(()=>{s=requestAnimationFrame(c)}))};return l.observer=new MutationObserver(h),e.current&&l.observer.observe(e.current,{childList:!0,subtree:!0}),l.beat=setInterval(h,50),h(),i},[r,e,o])}function Z({environmentName:e,packageName:r,path:n,editable:o=n.endsWith(".malloy"),onReady:a}){const u=d.useRef(null);Q(u,!0,a,`.${me.report}`);const{params:s,onGivensChange:l}=N(),i=ze(e,r),c=W(),m=d.useMemo(()=>z({environmentName:e,packageName:r}),[e,r]),h=V();return d.useEffect(()=>{if(!o||h)return;const p=()=>void xe(()=>import("./index.es-BBmXDZRJ.js"),__vite__mapDeps([0,1,2,3])),f=window.requestIdleCallback;if(f){const v=f(p);return()=>window.cancelIdleCallback?.(v)}const y=setTimeout(p,1500);return()=>clearTimeout(y)},[o,h]),t.jsx(x,{ref:u,sx:Y,children:n.endsWith(".malloynb")?t.jsx(he,{resourceUri:R({environmentName:e,packageName:r,modelPath:n}),givens:s,onGivensChange:l,onNavigate:c,onDrillNavigate:i,maxResultSize:1024*1024}):t.jsx(q,{resourceUri:R({environmentName:e,packageName:r}),path:n,givens:s,onGivensChange:l,onNavigate:i,onLinkNavigate:c,onEvent:m,maxResultSize:1024*1024})})}function He(){const[e,r]=d.useState(!1),n=d.useRef(!1),o=d.useRef(!1),a=d.useCallback(i=>{n.current=i,r(i)},[]),u=d.useCallback(()=>{o.current=!0},[]),s=ge(d.useCallback(({currentLocation:i,nextLocation:c})=>n.current&&!o.current&&(i.pathname!==c.pathname||L(i.search)!==L(c.search)),[]));d.useEffect(()=>{if(!e)return;const i=c=>{c.preventDefault(),c.returnValue=""};return window.addEventListener("beforeunload",i),()=>window.removeEventListener("beforeunload",i)},[e]);const l=t.jsx(ye,{open:s.state==="blocked",canSave:!1,onKeepEditing:()=>s.reset?.(),onDiscard:()=>s.proceed?.()});return{onDirtyChange:a,leaving:u,dialog:l}}const Xe=G.lazy(()=>K().then(e=>({default:e.ReportEditor}))),Je=G.lazy(()=>K().then(e=>({default:e.BuilderBar})));function Ke(){const[e,r]=d.useState(null);return d.useEffect(()=>{r(document.getElementById("header-actions-portal"))},[]),e}function ee({environmentName:e,packageName:r,path:n,layout:o="grid",onReady:a,quietLoading:u=!1,offstage:s=!1}){const l=He();Fe();const[i]=d.useState(ve),c=be(),{pathname:m,search:h}=$(),p=Ke(),[f,y]=d.useState(),v=d.useRef(null),k=V();Q(v,f!==void 0||k,a);const g=()=>c(`${m.replace(/\/$/,"")}${Te(h)}`),w=d.useMemo(()=>z({environmentName:e,packageName:r}),[e,r]),b=t.jsx(q,{resourceUri:R({environmentName:e,packageName:r}),path:n,manifestStaleTime:1e4});return t.jsxs(x,{ref:v,sx:Y,children:[t.jsx(je,{children:t.jsx(d.Suspense,{fallback:u?null:b,children:t.jsx(Xe,{resourceUri:R({environmentName:e,packageName:r}),path:n,layout:o,keepDraft:i,onDirtyChange:l.onDirtyChange,onExit:g,onOpenModel:D=>c(`/${[e,r,...D.split("/")].map(encodeURIComponent).join("/")}`),onEvent:w,loading:u?null:b,onControlsChange:y},`${e}/${r}/${n}`)})}),l.dialog,p&&!s&&ke.createPortal(t.jsx(d.Suspense,{fallback:t.jsx(O,{variant:"contained",disableElevation:!0,onClick:g,children:"Done"}),children:t.jsx(Je,{controls:f,onDone:g})}),p)]})}function Ye({environmentName:e,packageName:r,routePath:n,edit:o,reports:a,children:u}){const{search:s}=$(),l=Ce(n);if(!l)return t.jsx(t.Fragment,{children:u});const i=we(l.name,a,l.prefer);return"found"in i?t.jsx(H,{replace:!0,to:`${A(e,r,i.found.path)}${o?J(s):s}`}):"ambiguous"in i?t.jsxs(x,{sx:S,children:[t.jsxs(C,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:["More than one report is named ",l.name]}),t.jsx(C,{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(x,{component:"ul",sx:{mt:1},children:i.ambiguous.map(c=>t.jsx("li",{children:t.jsx(Ee,{to:A(e,r,c),style:{fontFamily:X},children:c})},c))})]}):t.jsx(t.Fragment,{children:u})}function Qe({environmentName:e,packageName:r,routePath:n,edit:o,notFound:a,notFoundUntilListed:u=!1}){const{reports:s,settled:l,isFetching:i,isError:c,refetch:m}=I(e,r),{search:h}=$(),p=`${n}.malloy`,f=l?Re(p,s):void 0,y=l&&!i&&!c,[v,k]=d.useState();d.useEffect(()=>{y&&k(p)},[y,p]);const g=f!==void 0||y||v===p,w=Se(e,r,p,o&&g&&!f),b=te=>t.jsx(Ye,{environmentName:e,packageName:r,routePath:n,edit:o,reports:s,children:te});if(!g&&(u&&!o&&!f))return b(a);if(!g&&c&&!i)return t.jsx(x,{sx:S,children:t.jsxs(De,{severity:"warning",action:t.jsx(O,{color:"inherit",size:"small",onClick:()=>void m(),children:"Retry"}),children:["Could not list this package's reports, so this page cannot tell what is at ",n,"."]})});if(!g)return t.jsx(T,{text:P.opening()});if(f)return t.jsx(Ze,{environmentName:e,packageName:r,path:f.path,editable:f.editable,layout:f.layout,edit:o});const j=o?void 0:Pe(n);return j!==void 0?t.jsx(H,{replace:!0,to:`/${e}/${r}/${j.split("/").map(encodeURIComponent).join("/")}${J(h)}`}):b(o?w.settled?t.jsx(ee,{environmentName:e,packageName:r,path:p,layout:w.layout??"grid"}):t.jsx(T,{text:P.opening()}):a)}function Ze({environmentName:e,packageName:r,path:n,editable:o,layout:a,edit:u}){const[s,l]=d.useState(u?"editor":"reader"),i=u?"editor":"reader",c=i==="reader"||s==="reader",m=i==="editor"||s==="editor",h={position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",overflow:"hidden"};return t.jsxs(x,{sx:{position:"relative"},"data-switching":c&&m||void 0,children:[c&&t.jsx(x,{sx:s==="reader"?void 0:h,"aria-hidden":s!=="reader"||void 0,children:t.jsx(Z,{environmentName:e,packageName:r,path:n,...o!==void 0?{editable:o}:{},onReady:()=>{u||l("reader")}})},"reader"),m&&t.jsx(x,{sx:s==="editor"?void 0:h,"aria-hidden":s!=="editor"||void 0,children:t.jsx(ee,{environmentName:e,packageName:r,path:n,...a?{layout:a}:{},quietLoading:c,offstage:i!=="editor"||s!=="editor",onReady:()=>{u&&l("editor")}})},"editor")]})}function rt(){const e=$e(),{search:r}=$(),n=e["*"],{server:o}=Ae(),{params:a,onGivensChange:u}=N();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(n!==void 0&&n!==""&&!n.endsWith(".malloy")&&!n.endsWith(".malloynb")){const l=n.replace(/\/$/,""),i=l.startsWith("data-apps/"),c=i?t.jsx(Le,{resourceUri:R({environmentName:e.environmentName,packageName:e.packageName,modelPath:l.slice(10)})}):t.jsx(_,{environmentName:e.environmentName,packageName:e.packageName,modelPath:n,staticUrl:F({server:o,environmentName:e.environmentName,packageName:e.packageName,path:n})});return t.jsx(Qe,{environmentName:e.environmentName,packageName:e.packageName,routePath:l,edit:L(r),notFound:c,notFoundUntilListed:i})}const s=R({environmentName:e.environmentName,packageName:e.packageName,modelPath:n});return n?.endsWith(".malloy")?t.jsx(x,{sx:S,children:t.jsx(Me,{resourceUri:s,runOnDemand:!0,maxResultSize:512*1024,givens:a,onGivensChange:u})}):n?.endsWith(".malloynb")?t.jsx(Z,{environmentName:e.environmentName,packageName:e.packageName,path:n,editable:!1}):t.jsx(_,{environmentName:e.environmentName,packageName:e.packageName,modelPath:n??"",staticUrl:F({server:o,environmentName:e.environmentName,packageName:e.packageName,path:n??""})})}function _({packageName:e,modelPath:r,staticUrl:n}){const o=/\.[^./]+$/.test(r),a={fontFamily:X};return t.jsxs(x,{sx:S,children:[t.jsx(C,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Nothing to open at this path"}),t.jsxs(C,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[t.jsx(x,{component:"span",sx:a,children:r})," ","does not name a report, a"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"})," ","or a"," ",t.jsx(x,{component:"span",sx:a,children:".malloynb"})," ","file in package"," ",t.jsx(x,{component:"span",sx:a,children:e}),". This address opens reports by their path without"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"}),", and"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"})," ","and"," ",t.jsx(x,{component:"span",sx:a,children:".malloynb"})," ","files."]}),o&&t.jsxs(C,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",t.jsx(x,{component:"span",sx:a,children:"public/"})," ","directory is served at ",t.jsx(Ne,{href:n,children:n}),"."]}),t.jsx(C,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its reports, models, and data apps."})]})}export{rt as default};
@@ -1 +1 @@
1
- import{D as m,a as g,r as u,a9 as l,j as n,ab as p,ax as x}from"./index-gQEuz0Cg.js";import{d}from"./documentRoutes-D4TbSIi5.js";function j(){const{environmentName:e,packageName:a}=m(),s=g(),r=u.useMemo(()=>l({environmentName:e??"",packageName:a??""}),[e,a]);if(e)if(a){const t=p({environmentName:e,packageName:a});return n.jsx(x,{onClickPackageFile:s,onOpenDocument:({path:o,mode:i},c)=>s(d(e,a,o,i),c),resourceUri:t,onEvent:r})}else 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"})})}export{j as default};
1
+ import{D as m,c as g,r as u,a9 as l,j as n,ab as p,ax as x}from"./index-Dgqan3mQ.js";import{d}from"./documentRoutes-QL_YE88h.js";function j(){const{environmentName:e,packageName:a}=m(),s=g(),r=u.useMemo(()=>l({environmentName:e??"",packageName:a??""}),[e,a]);if(e)if(a){const t=p({environmentName:e,packageName:a});return n.jsx(x,{onClickPackageFile:s,onOpenDocument:({path:o,mode:i},c)=>s(d(e,a,o,i),c),resourceUri:t,onEvent:r})}else 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"})})}export{j as default};
@@ -1,4 +1,4 @@
1
- import{ae as ce,j as $,I as ae,r as p,aU as he,V as ue,aV as me,aH as be,aW as W,aX as ye,aY as pe,aZ as fe,a_ as ge,a$ as ve,b0 as we,b1 as oe}from"./index-gQEuz0Cg.js";const v=ce.drillCell;function ke(e,t){const r=new Set;let l;try{l=e.getMetadata()?.getAllFields()??[]}catch{return r}const o=new Set;for(const a of l)!a||t(a)||a.tag?.tag("hidden")===void 0&&o.add(a.tag?.text("label")??a.name);for(const a of l){if(!a||!t(a))continue;const n=a.tag?.text("label")??a.name;o.has(n)||r.add(n)}return r}function D(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function xe(e,t){if(t.size!==0)for(const r of e.querySelectorAll(".malloy-table")){const l=n=>n.closest(".malloy-table")===r,o=new Set;for(const n of r.querySelectorAll(".column-cell.th")){if(!l(n))continue;const i=(n.textContent??"").replace(/\u200b/g,"").trim(),b=D(n);b&&t.has(i)&&o.add(b)}if(o.size===0)continue;const a=new Set;for(const n of r.querySelectorAll(`.${v}[tabindex="0"]`)){if(!l(n))continue;const i=D(n);i&&(a.has(i)?n.tabIndex=-1:a.add(i))}for(const n of r.querySelectorAll(".column-cell.td")){if(!l(n))continue;const i=D(n),b=!n.querySelector(".value-null")&&(n.textContent??"").trim()!=="";if(i&&b&&o.has(i)&&!n.querySelector(".malloy-table")){if(n.classList.add(v),n.tabIndex===0)a.add(i);else{const f=a.has(i);f||a.add(i),n.tabIndex=f?-1:0}n.setAttribute("role","button")}}}}function Ce(e){const t=e.closest(".malloy-table"),r=D(e);return!t||!r?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(l=>l.closest(".malloy-table")===t&&D(l)===r)}function ne(e,t){const r=Ce(e),l=r.indexOf(e);if(l===-1)return;const o=t==="first"?r[0]:t==="last"?r[r.length-1]:r[Math.min(Math.max(l+t,0),r.length-1)];if(o){for(const a of r)a.tabIndex=a===o?0:-1;return o}}function Ae(e){return{background:e.dashboardRoot,tableBackground:e.tableBackground,tableHeaderColor:e.tableHeader,tableBodyColor:e.tableBody,tableBorder:e.border,tablePinnedBackground:e.tableHeaderBackground,tablePinnedBorder:e.pinnedBorder,tableFontSize:`${e.font.size}px`,fontFamily:e.font.family,mapColor:e.mapColor}}function Se(e){const{foreground:t,axisFaint:r,gridline:l,font:o}=e,a={background:e.background,font:o.family,title:{color:t,font:o.family},axis:{labelColor:t,titleColor:t,domainColor:r,tickColor:r,gridColor:l,labelFont:o.family,titleFont:o.family},legend:{labelColor:t,titleColor:t,labelFont:o.family,titleFont:o.family},header:{labelColor:t,titleColor:t},range:{category:e.series}},n={...a,legend:{...a.legend,orient:"bottom"}};return i=>i==="shape_map"?n:a}function Ee(e){if(!e)return;const t=e.tag("theme");if(!t)return;const r={},l=t.tag("palette");if(l){const a={},n=l.textArray("series");n&&n.length>0&&(a.series=n);for(const i of he){const b=l.tag(i);if(!b)continue;const f={},x=b.text("light"),w=b.text("dark");x&&(f.light=x),w&&(f.dark=w),Object.keys(f).length>0&&(a[i]=f)}Object.keys(a).length>0&&(r.palette=a)}const o=t.tag("font");if(o){const a={},n=o.text("family");n&&(a.family=n);const i=o.numeric("size");typeof i=="number"&&Number.isFinite(i)&&(a.size=i),Object.keys(a).length>0&&(r.font=a)}return Object.keys(r).length>0?r:void 0}const B="data-publisher-fill",ze=async(e,t)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:r}=await pe();return new r({onClick:t,vegaConfigOverride:Se(e),theme:Ae(e),onError:l=>{console.error("Error rendering visualization:",typeof l,l)}}).createViz()};async function Me(e){if(!e||typeof e!="object")return;const t=e,r=[...Array.isArray(t.model_annotations)?t.model_annotations:[],...Array.isArray(t.source_annotations)?t.source_annotations:[],...Array.isArray(t.annotations)?t.annotations:[]].map(o=>typeof o?.value=="string"?o.value:void 0).filter(o=>!!o);if(r.length===0)return;let l;try{({parseAnnotation:l}=await ye())}catch{return}try{const{tag:o}=l(r);return Ee(o)}catch(o){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:o,lines:r});return}}function je(e,t,r){const l=fe(t,r);for(const[o,a]of Object.entries(l))e.style.setProperty(o,a)}const Fe=`
1
+ import{ae as ce,j as $,I as ae,r as p,aU as he,V as ue,aV as me,aH as be,aW as W,aX as ye,aY as pe,aZ as fe,a_ as ge,a$ as ve,b0 as we,b1 as oe}from"./index-Dgqan3mQ.js";const v=ce.drillCell;function ke(e,t){const r=new Set;let l;try{l=e.getMetadata()?.getAllFields()??[]}catch{return r}const o=new Set;for(const a of l)!a||t(a)||a.tag?.tag("hidden")===void 0&&o.add(a.tag?.text("label")??a.name);for(const a of l){if(!a||!t(a))continue;const n=a.tag?.text("label")??a.name;o.has(n)||r.add(n)}return r}function D(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function xe(e,t){if(t.size!==0)for(const r of e.querySelectorAll(".malloy-table")){const l=n=>n.closest(".malloy-table")===r,o=new Set;for(const n of r.querySelectorAll(".column-cell.th")){if(!l(n))continue;const i=(n.textContent??"").replace(/\u200b/g,"").trim(),b=D(n);b&&t.has(i)&&o.add(b)}if(o.size===0)continue;const a=new Set;for(const n of r.querySelectorAll(`.${v}[tabindex="0"]`)){if(!l(n))continue;const i=D(n);i&&(a.has(i)?n.tabIndex=-1:a.add(i))}for(const n of r.querySelectorAll(".column-cell.td")){if(!l(n))continue;const i=D(n),b=!n.querySelector(".value-null")&&(n.textContent??"").trim()!=="";if(i&&b&&o.has(i)&&!n.querySelector(".malloy-table")){if(n.classList.add(v),n.tabIndex===0)a.add(i);else{const f=a.has(i);f||a.add(i),n.tabIndex=f?-1:0}n.setAttribute("role","button")}}}}function Ce(e){const t=e.closest(".malloy-table"),r=D(e);return!t||!r?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(l=>l.closest(".malloy-table")===t&&D(l)===r)}function ne(e,t){const r=Ce(e),l=r.indexOf(e);if(l===-1)return;const o=t==="first"?r[0]:t==="last"?r[r.length-1]:r[Math.min(Math.max(l+t,0),r.length-1)];if(o){for(const a of r)a.tabIndex=a===o?0:-1;return o}}function Ae(e){return{background:e.dashboardRoot,tableBackground:e.tableBackground,tableHeaderColor:e.tableHeader,tableBodyColor:e.tableBody,tableBorder:e.border,tablePinnedBackground:e.tableHeaderBackground,tablePinnedBorder:e.pinnedBorder,tableFontSize:`${e.font.size}px`,fontFamily:e.font.family,mapColor:e.mapColor}}function Se(e){const{foreground:t,axisFaint:r,gridline:l,font:o}=e,a={background:e.background,font:o.family,title:{color:t,font:o.family},axis:{labelColor:t,titleColor:t,domainColor:r,tickColor:r,gridColor:l,labelFont:o.family,titleFont:o.family},legend:{labelColor:t,titleColor:t,labelFont:o.family,titleFont:o.family},header:{labelColor:t,titleColor:t},range:{category:e.series}},n={...a,legend:{...a.legend,orient:"bottom"}};return i=>i==="shape_map"?n:a}function Ee(e){if(!e)return;const t=e.tag("theme");if(!t)return;const r={},l=t.tag("palette");if(l){const a={},n=l.textArray("series");n&&n.length>0&&(a.series=n);for(const i of he){const b=l.tag(i);if(!b)continue;const f={},x=b.text("light"),w=b.text("dark");x&&(f.light=x),w&&(f.dark=w),Object.keys(f).length>0&&(a[i]=f)}Object.keys(a).length>0&&(r.palette=a)}const o=t.tag("font");if(o){const a={},n=o.text("family");n&&(a.family=n);const i=o.numeric("size");typeof i=="number"&&Number.isFinite(i)&&(a.size=i),Object.keys(a).length>0&&(r.font=a)}return Object.keys(r).length>0?r:void 0}const B="data-publisher-fill",ze=async(e,t)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:r}=await pe();return new r({onClick:t,vegaConfigOverride:Se(e),theme:Ae(e),onError:l=>{console.error("Error rendering visualization:",typeof l,l)}}).createViz()};async function Me(e){if(!e||typeof e!="object")return;const t=e,r=[...Array.isArray(t.model_annotations)?t.model_annotations:[],...Array.isArray(t.source_annotations)?t.source_annotations:[],...Array.isArray(t.annotations)?t.annotations:[]].map(o=>typeof o?.value=="string"?o.value:void 0).filter(o=>!!o);if(r.length===0)return;let l;try{({parseAnnotation:l}=await ye())}catch{return}try{const{tag:o}=l(r);return Ee(o)}catch(o){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:o,lines:r});return}}function Re(e,t,r){const l=fe(t,r);for(const[o,a]of Object.entries(l))e.style.setProperty(o,a)}const Te=`
2
2
  /* Card geometry, through the renderer's OWN theme vars rather than over the top
3
3
  of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
4
4
  passes each through to the --malloy-render--* the card CSS reads, so a value
@@ -150,4 +150,4 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
150
150
  color: var(--publisher-drill-link) !important;
151
151
  text-decoration: underline;
152
152
  }
153
- `,le="publisher-malloy-renderer-overrides";function Re(){if(typeof document>"u"||document.getElementById(le))return;const e=document.createElement("style");e.id=le,e.textContent=Fe,document.head.appendChild(e)}function Te({result:e,height:t,drill:r,onSizeChange:l,onSizing:o,fill:a}){const n=p.useRef(null),i=p.useRef(r);i.current=r;const b=p.useCallback(c=>{i.current?.onClick(c)},[]),f=r!==void 0,x=p.useRef(!1),w=p.useRef(null),q=p.useRef(0),{theme:I,layers:Y,mode:J}=ue(),X=p.useMemo(()=>({radius:I.ui.radius.tile,padding:`${me}px`}),[I.ui.radius.tile]);return p.useEffect(()=>()=>{q.current+=1;const c=w.current;c?.viz.remove(),c?.node.remove(),w.current=null},[]),p.useLayoutEffect(()=>{if(!n.current||!e)return;Re();const c=n.current,se=q.current+=1;let V=!1;const H=()=>!V&&se===q.current;let d,m,_=null,K=0,L=null,N=null,P=null,j=null,F=null,R=null,Z=null,G=0,A=null;x.current=!1;let g,S;const U=k=>{if(V||!k.firstElementChild||W(g,S)==="container")return;const T=ge(g,S);if(x.current&&!T)return;const O=c.hasAttribute(B);O&&c.removeAttribute(B);const E=ve(k,oe(g));O&&c.setAttribute(B,""),E>0&&(x.current=!0,l&&E!==G&&(G=E,l(E)));const h=we(k,oe(g));T&&h&&Z!==h&&(Z=h,R?.disconnect(),R=new ResizeObserver(()=>U(k)),R.observe(h))};return(async()=>{let k;try{k=JSON.parse(e)}catch(y){console.error("Error parsing visualization result:",y);return}const T=await Me(k),O=T?be([...Y,T],J):I;if(!H())return;try{m=await ze(O,b)}catch(y){console.error("Failed to create renderer:",y);return}if(!H()){m.remove(),m=void 0;return}const E=w.current;d=document.createElement("div"),d.style.width="100%",d.style.height="100%",je(d,O,X),c.childElementCount>0&&(c.style.position="relative",d.style.position="absolute",d.style.inset="0",d.style.visibility="hidden"),c.appendChild(d);const h=d;j=new MutationObserver(()=>{F&&clearTimeout(F),F=setTimeout(()=>{U(h),x.current&&j?.disconnect()},100)}),j.observe(d,{childList:!0,subtree:!0,attributes:!0});const ie=m;let Q=!1;const ee=()=>{if(!(Q||!H())){Q=!0,A&&(clearTimeout(A),A=null),E?.viz.remove();for(const y of Array.from(c.children))y!==h&&c.removeChild(y);h.style.position="",h.style.inset="",h.style.visibility="",c.style.position="",w.current={viz:ie,node:h},U(h)}};try{m.setResult(k);try{const C=m.getMetadata(),z=C?.getRootField();g=z?.renderAs(),S=z?C?.getPluginsForField(z.key)?.[0]?.sizingStrategy:void 0}catch{g=void 0,S=void 0}o?.(W(g,S)),d.dataset.malloyRenderAs=g??"unknown",d.dataset.malloySizing=W(g,S),m.render(d);const y=i.current;try{if(y){const C=ke(m,y.canDrill),z=()=>{try{xe(h,C)}catch(s){console.warn("Drill affordance skipped:",s)}};z();const te=s=>{const u=s.querySelector(".cell-content")??s,M=u.getBoundingClientRect();u.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:u.ownerDocument.defaultView,clientX:Math.round(M.left+M.width/2),clientY:Math.round(M.bottom)}))},re=s=>s.target?.closest?.(`.${v}`)??null,de=(s,u)=>{ne(s,u)?.focus()};L=s=>{const u=re(s);if(!u)return;const M=s.key==="ArrowDown"?1:s.key==="ArrowUp"?-1:s.key==="Home"?"first":s.key==="End"?"last":void 0;if(M!==void 0){s.preventDefault(),de(u,M);return}s.key==="Enter"?(s.preventDefault(),te(u)):s.key===" "&&s.preventDefault()},N=s=>{if(s.key!==" ")return;const u=re(s);u&&(s.preventDefault(),te(u))},P=s=>{const u=s.target?.closest?.(`.${v}`);u&&ne(u,0)},h.addEventListener("keydown",L),h.addEventListener("keyup",N),h.addEventListener("focusin",P),C.size>0&&typeof MutationObserver<"u"&&(_=new MutationObserver(()=>{cancelAnimationFrame(K),K=requestAnimationFrame(z)}),_.observe(h,{childList:!0,subtree:!0}))}}catch(C){console.warn("Drill affordance skipped:",C)}m.onReady(ee),A=setTimeout(ee,1e4)}catch(y){console.error("Error rendering visualization:",y),j?.disconnect(),R?.disconnect(),_?.disconnect(),m.remove(),m=void 0,h.parentNode===c&&c.removeChild(h)}})(),()=>{V=!0,j?.disconnect(),R?.disconnect(),F&&clearTimeout(F),A&&clearTimeout(A),d&&w.current?.node!==d&&(L&&d.removeEventListener("keydown",L),N&&d.removeEventListener("keyup",N),P&&d.removeEventListener("focusin",P),_?.disconnect(),cancelAnimationFrame(K),m?.remove(),d.parentNode===c&&c.removeChild(d),c.style.position="")}},[e,b,f,l,o,I,Y,J,X]),$.jsx("div",{ref:n,...a?{[B]:""}:{},style:{width:"100%",height:t?`${t}px`:"400px"}})}function Oe(e){return typeof window>"u"?$.jsx(ae,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):$.jsx(p.Suspense,{fallback:$.jsx(ae,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:$.jsx(Te,{...e})})}const Be=Object.freeze(Object.defineProperty({__proto__:null,default:Oe},Symbol.toStringTag,{value:"Module"}));export{v as D,Oe as R,Se as a,Ae as b,Be as c,ke as d,xe as m,Ee as r};
153
+ `,le="publisher-malloy-renderer-overrides";function je(){if(typeof document>"u"||document.getElementById(le))return;const e=document.createElement("style");e.id=le,e.textContent=Te,document.head.appendChild(e)}function Fe({result:e,height:t,drill:r,onSizeChange:l,onSizing:o,fill:a}){const n=p.useRef(null),i=p.useRef(r);i.current=r;const b=p.useCallback(c=>{i.current?.onClick(c)},[]),f=r!==void 0,x=p.useRef(!1),w=p.useRef(null),P=p.useRef(0),{theme:I,layers:Y,mode:J}=ue(),X=p.useMemo(()=>({radius:I.ui.radius.tile,padding:`${me}px`}),[I.ui.radius.tile]);return p.useEffect(()=>()=>{P.current+=1;const c=w.current;c?.viz.remove(),c?.node.remove(),w.current=null},[]),p.useLayoutEffect(()=>{if(!n.current||!e)return;je();const c=n.current,se=P.current+=1;let H=!1;const V=()=>!H&&se===P.current;let d,m,_=null,K=0,L=null,N=null,q=null,R=null,T=null,j=null,Z=null,G=0,A=null;x.current=!1;let g,S;const U=k=>{if(H||!k.firstElementChild||W(g,S)==="container")return;const F=ge(g,S);if(x.current&&!F)return;const O=c.hasAttribute(B);O&&c.removeAttribute(B);const E=ve(k,oe(g));O&&c.setAttribute(B,""),E>0&&(x.current=!0,l&&E!==G&&(G=E,l(E)));const h=we(k,oe(g));F&&h&&Z!==h&&(Z=h,j?.disconnect(),j=new ResizeObserver(()=>U(k)),j.observe(h))};return(async()=>{let k;try{k=JSON.parse(e)}catch(y){console.error("Error parsing visualization result:",y);return}const F=await Me(k),O=F?be([...Y,F],J):I;if(!V())return;try{m=await ze(O,b)}catch(y){console.error("Failed to create renderer:",y);return}if(!V()){m.remove(),m=void 0;return}const E=w.current;d=document.createElement("div"),d.style.width="100%",d.style.height="100%",Re(d,O,X),c.childElementCount>0&&(c.style.position="relative",d.style.position="absolute",d.style.inset="0",d.style.visibility="hidden"),c.appendChild(d);const h=d;R=new MutationObserver(()=>{T&&clearTimeout(T),T=setTimeout(()=>{U(h),x.current&&R?.disconnect()},100)}),R.observe(d,{childList:!0,subtree:!0,attributes:!0});const ie=m;let Q=!1;const ee=()=>{if(!(Q||!V())){Q=!0,A&&(clearTimeout(A),A=null),E?.viz.remove();for(const y of Array.from(c.children))y!==h&&c.removeChild(y);h.style.position="",h.style.inset="",h.style.visibility="",c.style.position="",w.current={viz:ie,node:h},U(h)}};try{m.setResult(k);try{const C=m.getMetadata(),z=C?.getRootField();g=z?.renderAs(),S=z?C?.getPluginsForField(z.key)?.[0]?.sizingStrategy:void 0}catch{g=void 0,S=void 0}o?.(W(g,S)),d.dataset.malloyRenderAs=g??"unknown",d.dataset.malloySizing=W(g,S),m.render(d);const y=i.current;try{if(y){const C=ke(m,y.canDrill),z=()=>{try{xe(h,C)}catch(s){console.warn("Drill affordance skipped:",s)}};z();const te=s=>{const u=s.querySelector(".cell-content")??s,M=u.getBoundingClientRect();u.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:u.ownerDocument.defaultView,clientX:Math.round(M.left+M.width/2),clientY:Math.round(M.bottom)}))},re=s=>s.target?.closest?.(`.${v}`)??null,de=(s,u)=>{ne(s,u)?.focus()};L=s=>{const u=re(s);if(!u)return;const M=s.key==="ArrowDown"?1:s.key==="ArrowUp"?-1:s.key==="Home"?"first":s.key==="End"?"last":void 0;if(M!==void 0){s.preventDefault(),de(u,M);return}s.key==="Enter"?(s.preventDefault(),te(u)):s.key===" "&&s.preventDefault()},N=s=>{if(s.key!==" ")return;const u=re(s);u&&(s.preventDefault(),te(u))},q=s=>{const u=s.target?.closest?.(`.${v}`);u&&ne(u,0)},h.addEventListener("keydown",L),h.addEventListener("keyup",N),h.addEventListener("focusin",q),C.size>0&&typeof MutationObserver<"u"&&(_=new MutationObserver(()=>{cancelAnimationFrame(K),K=requestAnimationFrame(z)}),_.observe(h,{childList:!0,subtree:!0}))}}catch(C){console.warn("Drill affordance skipped:",C)}m.onReady(ee),A=setTimeout(ee,1e4)}catch(y){console.error("Error rendering visualization:",y),R?.disconnect(),j?.disconnect(),_?.disconnect(),m.remove(),m=void 0,h.parentNode===c&&c.removeChild(h)}})(),()=>{H=!0,R?.disconnect(),j?.disconnect(),T&&clearTimeout(T),A&&clearTimeout(A),d&&w.current?.node!==d&&(L&&d.removeEventListener("keydown",L),N&&d.removeEventListener("keyup",N),q&&d.removeEventListener("focusin",q),_?.disconnect(),cancelAnimationFrame(K),m?.remove(),d.parentNode===c&&c.removeChild(d),c.style.position="")}},[e,b,f,l,o,I,Y,J,X]),$.jsx("div",{ref:n,...a?{[B]:""}:{},style:{width:"100%",height:t?`${t}px`:"400px"}})}function Oe(e){return typeof window>"u"?$.jsx(ae,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):$.jsx(p.Suspense,{fallback:$.jsx(ae,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:$.jsx(Fe,{...e})})}const Be=Object.freeze(Object.defineProperty({__proto__:null,default:Oe},Symbol.toStringTag,{value:"Module"}));export{v as D,Oe as R,Se as a,Ae as b,Be as c,ke as d,xe as m,Ee as r};
@@ -1 +1 @@
1
- import{aB as o,j as r,aC as s,aD as n,I as t,T as a}from"./index-gQEuz0Cg.js";function x(){const e=o();return console.error(e),r.jsx(s,{maxWidth:"lg",component:"main",sx:{display:"flex",flexDirection:"column",my:2,gap:0},children:r.jsxs(n,{sx:{m:"auto",flexDirection:"column"},children:[r.jsx(t,{sx:{height:"300px"}}),r.jsx("img",{src:"/error.png"}),r.jsx(a,{variant:"subtitle1",children:"An unexpected error occurred"})]})})}export{x as default};
1
+ import{aB as o,j as r,aC as s,aD as n,I as t,T as a}from"./index-Dgqan3mQ.js";function x(){const e=o();return console.error(e),r.jsx(s,{maxWidth:"lg",component:"main",sx:{display:"flex",flexDirection:"column",my:2,gap:0},children:r.jsxs(n,{sx:{m:"auto",flexDirection:"column"},children:[r.jsx(t,{sx:{height:"300px"}}),r.jsx("img",{src:"/error.png"}),r.jsx(a,{variant:"subtitle1",children:"An unexpected error occurred"})]})})}export{x as default};