@malloy-publisher/server 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.docker.md +1 -1
  2. package/dist/app/api-doc.yaml +127 -5
  3. package/dist/app/assets/{EnvironmentPage-Dfn26tY2.js → EnvironmentPage-xh4aL2P9.js} +1 -1
  4. package/dist/app/assets/{HomePage-CNuMPINA.js → HomePage-B1w1b7e1.js} +1 -1
  5. package/dist/app/assets/{MainPage-DWjs4_e3.js → MainPage-BrYzrVlB.js} +1 -1
  6. package/dist/app/assets/{ModelPage-GZ6hXGgw.js → ModelPage-DC5HfNar.js} +2 -2
  7. package/dist/app/assets/{PackagePage-_5vFWxqm.js → PackagePage-DRKFqQHw.js} +1 -1
  8. package/dist/app/assets/{PackageSplatRoute-CTxtXKZO.js → PackageSplatRoute-CU3-BYcC.js} +2 -2
  9. package/dist/app/assets/{RenderedResult-r3dg2xOJ.es-t-MnqNaH.js → RenderedResult-D8bCgThO.es-bV5QVotj.js} +1 -1
  10. package/dist/app/assets/{RouteError-y4xkvszw.js → RouteError-Dmo0qwGV.js} +1 -1
  11. package/dist/app/assets/{ThemeEditorPage-BffGFYK5.js → ThemeEditorPage-ByJldD0t.js} +1 -1
  12. package/dist/app/assets/{ToggleButtonGroup-BfTJg9cJ.js → ToggleButtonGroup-Dxax2bOe.js} +1 -1
  13. package/dist/app/assets/{documentRoutes-DnpGGXs4.js → documentRoutes-DFdmdaBX.js} +1 -1
  14. package/dist/app/assets/{editPageMounted-efTmRdGK.js → editPageMounted-CjmdfOM1.js} +2 -2
  15. package/dist/app/assets/{index-CW23I6Cr.js → index-9_OOEQph.js} +1 -1
  16. package/dist/app/assets/{index-D8JKtZm5.js → index-BLi0H5mL.js} +5 -5
  17. package/dist/app/assets/{index-CG6r_Zwr.js → index-BsumQDtR.js} +1 -1
  18. package/dist/app/assets/{index-g1sInkiO.js → index-BvJ7NTSs.js} +1 -1
  19. package/dist/app/assets/{index.es-AXVff-Xr.js → index.es-CbR1CwU4.js} +1 -1
  20. package/dist/app/assets/usePackageLinkNavigate-SMJdqHGs.js +1 -0
  21. package/dist/app/assets/{usePackageRoute-BUdFd5dP.js → usePackageRoute-DzmKqWKq.js} +1 -1
  22. package/dist/app/index.html +1 -1
  23. package/dist/instrumentation.mjs +5 -1
  24. package/dist/package_load_worker.mjs +241 -109
  25. package/dist/server.mjs +18506 -13618
  26. package/dist/{sshcrypto-a4xyg5e8.node → sshcrypto-fqcyz88x.node} +0 -0
  27. package/package.json +1 -1
  28. package/publisher.config.example.duckdb.json +4 -0
  29. package/dist/app/assets/usePackageLinkNavigate-DpGlRKnc.js +0 -1
package/README.docker.md CHANGED
@@ -193,7 +193,7 @@ All flags exposed by `bin/malloy-publisher --help` have an equivalent env var, s
193
193
  | `PUBLISHER_MEMORY_LOW_WATER_FRACTION` | — | `0.7` | Fraction at which back-pressure clears. The gap between low and high gives hysteresis so the governor doesn't flap on every GC cycle. |
194
194
  | `PUBLISHER_MEMORY_CHECK_INTERVAL_MS` | — | `5000` | How often the governor samples RSS. Minimum `100`. Smaller values catch spikes faster but burn a few extra microseconds per tick. |
195
195
  | `PUBLISHER_MEMORY_BACKPRESSURE` | — | `true` | When `false`, the governor still samples RSS and emits metrics but never flips the back-pressure flag. Useful for a monitoring-only rollout before enabling the 503 behaviour. |
196
- | `EMBEDDING_API_KEY` | — | _unset_ | Enables semantic ranking for `get_context` question retrieval; sent as a bearer token to the embedding endpoint. Unset keeps lexical retrieval, unchanged. Entity names, annotation text, and query strings are sent to the endpoint when enabled; see "Semantic retrieval" in `docs/configuration.md`. |
196
+ | `EMBEDDING_API_KEY` | — | _unset_ | Turns on embedding closeness in `get_context`'s search; sent as a bearer token to the embedding endpoint. Unset: `get_context` ranks by keyword and stored values only. Entity names, annotation text, and query strings are sent to the endpoint when enabled; see "How get_context searches" in `docs/configuration.md`. |
197
197
  | `EMBEDDING_MODEL` | — | `text-embedding-3-small` | Embedding model name. |
198
198
  | `EMBEDDING_API_BASE` | — | `https://api.openai.com/v1` | Base URL of an OpenAI-compatible embeddings API. |
199
199
  | `EMBEDDING_DIMENSIONS` | — | _unset_ | Optional `dimensions` request parameter; omitted when unset. |
@@ -2133,6 +2133,21 @@ paths:
2133
2133
  $ref: "#/components/schemas/PathPattern"
2134
2134
  - $ref: "#/components/parameters/versionId"
2135
2135
  - $ref: "#/components/parameters/includeHiddenFilesAndSources"
2136
+ - name: givens
2137
+ in: query
2138
+ required: false
2139
+ description: >-
2140
+ The caller's givens as the trusted tier set them, one JSON object
2141
+ (`{"ROLES":["clinician"]}`). A source whose `#(authorize)` lock
2142
+ cannot admit the caller on the `#(secure)` givens supplied, or
2143
+ reads a secure given not supplied, is omitted from `sources`,
2144
+ `queries` and `sourceInfos`, as a source locked with `false` is.
2145
+ Plain givens and `#(access_filter)` row filters hide nothing.
2146
+ Discovery only: the query route's gates decide what is served
2147
+ either way. Absent: every published source. Not a JSON object:
2148
+ 400.
2149
+ schema:
2150
+ type: string
2136
2151
  responses:
2137
2152
  "200":
2138
2153
  description: Compiled Malloy model
@@ -2824,7 +2839,11 @@ paths:
2824
2839
  `relative_filepath` from `GET .../agents/{agentName}?skills=summary`
2825
2840
  (for example `analyst-conventions/SKILL.md`), with the same `source`
2826
2841
  pin as the full definition. The path is looked up in the resolved set,
2827
- never joined onto the filesystem.
2842
+ never joined onto the filesystem. A `relative_filepath` from the
2843
+ agent's `assets` listing (`<skill>/assets/...`, full view only) is
2844
+ matched exactly against the listing, then read from disk as UTF-8 text
2845
+ and served only if it still hashes to its listed `sha256`; one that
2846
+ changed, or became a link, since the load is a 404.
2828
2847
 
2829
2848
  404 when the agent or the file is not served.
2830
2849
  parameters:
@@ -4985,7 +5004,14 @@ components:
4985
5004
  `report-name-ambiguous`: two or more grid reports share a
4986
5005
  basename, so the deprecated `GET …/dashboards/{name}` route
4987
5006
  answers 409 for it (one per name, `subject` naming it and the
4988
- message every path; `warn`). The per-file
5007
+ message every path; `warn`). `classification-coverage`: a
5008
+ published source with a dimension or measure that carries no
5009
+ `#(classification)` while some field in the package does (one
5010
+ per source, `model` naming its file and `subject` the source;
5011
+ `warn`; see docs/classification.md).
5012
+ `classification-malformed`: a `#(classification)` annotation
5013
+ that names no single class (one per field, `subject` the
5014
+ source; `warn`). The per-file
4989
5015
  report findings (`notebook-…`, `report-…`) and the report
4990
5016
  curation findings (`report-on-surface`,
4991
5017
  `index-is-not-a-report`). The message wording may change; the
@@ -5396,6 +5422,8 @@ components:
5396
5422
  body carrying it is ignored.
5397
5423
  items:
5398
5424
  $ref: "#/components/schemas/SecureGivenSummary"
5425
+ classification:
5426
+ $ref: "#/components/schemas/ClassificationSummary"
5399
5427
 
5400
5428
  AgentSchedule:
5401
5429
  type: object
@@ -5491,10 +5519,30 @@ components:
5491
5519
  type: integer
5492
5520
  description: Size of `file_contents` in UTF-8 bytes. Only in the `skills=summary` view.
5493
5521
 
5522
+ AgentAsset:
5523
+ type: object
5524
+ readOnly: true
5525
+ description: >-
5526
+ A text file a skill ships under `<skill>/assets/` for an agent to copy
5527
+ into an app it builds and not read. Listed without its contents; fetch
5528
+ one with `GET .../agents/{agentName}/skills/{relative_filepath}`.
5529
+ properties:
5530
+ relative_filepath:
5531
+ type: string
5532
+ description: "`<skill>/assets/...`, relative to the agent's skill roots."
5533
+ bytes:
5534
+ type: integer
5535
+ description: Size in UTF-8 bytes, under 1 MiB.
5536
+ sha256:
5537
+ type: string
5538
+ description: SHA-256 of the file's bytes.
5539
+
5494
5540
  AgentSkillRead:
5495
5541
  type: object
5496
5542
  readOnly: true
5497
- description: One agent skill file, with the pin of the definition it belongs to.
5543
+ description: >-
5544
+ One agent skill file or asset, with the pin of the definition it
5545
+ belongs to.
5498
5546
  properties:
5499
5547
  relative_filepath:
5500
5548
  type: string
@@ -5553,6 +5601,29 @@ components:
5553
5601
  description: The agent's own skill files, sorted by `relative_filepath`.
5554
5602
  items:
5555
5603
  $ref: "#/components/schemas/AgentSkillFile"
5604
+ asset_roots:
5605
+ type: object
5606
+ description: >-
5607
+ For each skill that ships assets, the package-relative directory
5608
+ holding it. Absent when no skill does. Not in the
5609
+ `skills=summary` view.
5610
+ additionalProperties:
5611
+ type: string
5612
+ assets:
5613
+ type: array
5614
+ description: >-
5615
+ Every asset the agent's skills ship, listed without contents and
5616
+ sorted by `relative_filepath`. Absent when there are none and in
5617
+ the `skills=summary` view.
5618
+ items:
5619
+ $ref: "#/components/schemas/AgentAsset"
5620
+ asset_counts:
5621
+ type: object
5622
+ description: >-
5623
+ Only in the `skills=summary` view, and only when there are assets:
5624
+ how many assets each skill ships.
5625
+ additionalProperties:
5626
+ type: integer
5556
5627
  schedules:
5557
5628
  type: array
5558
5629
  items:
@@ -5566,6 +5637,57 @@ components:
5566
5637
  source:
5567
5638
  $ref: "#/components/schemas/AgentSource"
5568
5639
 
5640
+ ClassificationSummary:
5641
+ type: object
5642
+ readOnly: true
5643
+ required: [sources]
5644
+ description: >-
5645
+ Server-computed, read-only, on a single package read
5646
+ (`GET …/packages/{packageName}`) only, never on a listing: for each
5647
+ published entry point, the classes its `#(carries)` declares and how
5648
+ many of its fields carry each class (`#(classification)`, declared or
5649
+ inherited). Covers only the sources discovery shows, so it reveals
5650
+ nothing curation hides; a source locked to every caller is left out.
5651
+ A field's own classes, and what they were inherited from, are on its
5652
+ `get_context` card. Absent when no published field carries a class.
5653
+ It cannot be set: a PATCH body carrying it is ignored.
5654
+ properties:
5655
+ sources:
5656
+ type: array
5657
+ description: Sorted by model path, then name.
5658
+ items:
5659
+ $ref: "#/components/schemas/ClassificationSummarySource"
5660
+
5661
+ ClassificationSummarySource:
5662
+ type: object
5663
+ readOnly: true
5664
+ required: [modelPath, name, fields, unclassified, classCounts]
5665
+ properties:
5666
+ modelPath:
5667
+ type: string
5668
+ name:
5669
+ type: string
5670
+ carries:
5671
+ type: array
5672
+ description: >-
5673
+ The classes the source's `#(carries)` lists, sorted, inherited
5674
+ through `extend` like a gate. Absent when it declares none.
5675
+ items:
5676
+ type: string
5677
+ fields:
5678
+ type: integer
5679
+ description: The dimensions and measures a caller can reach from the source, through joins included.
5680
+ unclassified:
5681
+ type: integer
5682
+ description: How many of those carry no class.
5683
+ classCounts:
5684
+ type: object
5685
+ description: >-
5686
+ How many of those fields carry each class, keyed by class. A field
5687
+ under several classes counts under each.
5688
+ additionalProperties:
5689
+ type: integer
5690
+
5569
5691
  SkillSummary:
5570
5692
  type: object
5571
5693
  readOnly: true
@@ -7733,8 +7855,8 @@ components:
7733
7855
  for plaintext) — a server-applied default, not a schema default. On
7734
7856
  a direct connection the same modes apply against the configured
7735
7857
  host; when omitted, the deployment PGSSLMODE applies. Ignored when
7736
- connectionString is set, which carries its own sslmode. Not applied
7737
- to a DuckLake catalog connection.
7858
+ connectionString is set, which carries its own sslmode. Applies to a
7859
+ DuckLake catalog connection as well.
7738
7860
  statementTimeoutMilliseconds:
7739
7861
  type: integer
7740
7862
  minimum: 1
@@ -1 +1 @@
1
- import{p as r,C as t,j as e,a7 as i,aa as o}from"./index-D8JKtZm5.js";function m(){const s=r(),{environmentName:n}=t();if(n){const a=i({environmentName:n});return e.jsx(o,{onSelectPackage:s,resourceUri:a})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing environment name"})})}export{m as default};
1
+ import{p as r,C as t,j as e,a7 as i,aa as o}from"./index-BLi0H5mL.js";function m(){const s=r(),{environmentName:n}=t();if(n){const a=i({environmentName:n});return e.jsx(o,{onSelectPackage:s,resourceUri:a})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing environment name"})})}export{m as default};
@@ -1 +1 @@
1
- import{p as t,j as o,D as a}from"./index-D8JKtZm5.js";function s(){const n=t();return o.jsx(a,{onClickEnvironment:n})}export{s as default};
1
+ import{p as t,j as o,D as a}from"./index-BLi0H5mL.js";function s(){const n=t();return o.jsx(a,{onClickEnvironment:n})}export{s as default};
@@ -1 +1 @@
1
- import{c as j,j as t,s as I,B as Ee,m as Q,e as ce,g as me,a as fe,r as x,u as ge,b as Me,d as W,f as ye,T as K,h as Z,i as ze,k as Ce,l as Ie,o as be,n as De,q as Te,t as de,v as Be,w as Re,x as O,y as $,M as He,P as Le,z as $e,S as Ne,A as G,C as J,E as Oe,F as Ae,G as We,Z as pe,H as Ve,p as ee,I as u,J as Fe,K as Y,L as V,N as te,O as Ue,Q as _e,R as ue,U as Xe,V as re,W as ne,X as oe,Y as Ye,_ as qe,$ as Qe,a0 as Ke}from"./index-D8JKtZm5.js";import{u as Ze,l as he}from"./editPageMounted-efTmRdGK.js";import{i as Ge,w as Je,a as et}from"./documentRoutes-DnpGGXs4.js";import{u as ve,p as tt}from"./usePackageRoute-BUdFd5dP.js";const rt=j(t.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),nt=I(Ee,{name:"MuiBreadcrumbCollapsed"})(Q(({theme:e})=>({display:"flex",marginLeft:`calc(${e.spacing(1)} * 0.5)`,marginRight:`calc(${e.spacing(1)} * 0.5)`,...e.palette.mode==="light"?{backgroundColor:e.palette.grey[100],color:e.palette.grey[700]}:{backgroundColor:e.palette.grey[700],color:e.palette.grey[100]},borderRadius:2,"&:hover, &:focus":{...e.palette.mode==="light"?{backgroundColor:e.palette.grey[200]}:{backgroundColor:e.palette.grey[600]}},"&:active":{boxShadow:e.shadows[0],...e.palette.mode==="light"?{backgroundColor:ce(e.palette.grey[200],.12)}:{backgroundColor:ce(e.palette.grey[600],.12)}}}))),ot=I(rt)({width:24,height:16});function st(e){const{slots:r={},slotProps:o={},...n}=e,s=e;return t.jsx("li",{children:t.jsx(nt,{focusRipple:!0,...n,ownerState:s,children:t.jsx(ot,{as:r.CollapsedIcon,ownerState:s,...o.collapsedIcon})})})}function at(e){return me("MuiBreadcrumbs",e)}const it=fe("MuiBreadcrumbs",["root","ol","li","separator"]),lt=e=>{const{classes:r}=e;return ye({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},at,r)},ct=I(K,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,r)=>[{[`& .${it.li}`]:r.li},r.root]})({}),dt=I("ol",{name:"MuiBreadcrumbs",slot:"Ol"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),pt=I("li",{name:"MuiBreadcrumbs",slot:"Separator"})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function ut(e,r,o,n){return e.reduce((s,a,i)=>(i<e.length-1?s=s.concat(a,t.jsx(pt,{"aria-hidden":!0,className:r,ownerState:n,children:o},`separator-${i}`)):s.push(a),s),[])}const ht=x.forwardRef(function(r,o){const n=ge({props:r,name:"MuiBreadcrumbs"}),{children:s,className:a,component:i="nav",slots:d={},slotProps:m={},expandText:p="Show path",itemsAfterCollapse:h=1,itemsBeforeCollapse:b=1,maxItems:g=8,separator:w="/",...D}=n,[k,S]=x.useState(!1),v={...n,component:i,expanded:k,expandText:p,itemsAfterCollapse:h,itemsBeforeCollapse:b,maxItems:g,separator:w},z=lt(v),T=Me({elementType:d.CollapsedIcon,externalSlotProps:m.collapsedIcon,ownerState:v}),P=x.useRef(null),E=c=>{const M=()=>{S(!0);const y=P.current.querySelector("a[href],button,[tabindex]");y&&y.focus()};return b+h>=c.length?c:[...c.slice(0,b),t.jsx(st,{"aria-label":p,slots:{CollapsedIcon:d.CollapsedIcon},slotProps:{collapsedIcon:T},onClick:M},"ellipsis"),...c.slice(c.length-h,c.length)]},B=x.Children.toArray(s).filter(c=>x.isValidElement(c)).map((c,M)=>t.jsx("li",{className:z.li,children:c},`child-${M}`));return t.jsx(ct,{ref:o,component:i,color:"textSecondary",className:W(z.root,a),ownerState:v,...D,children:t.jsx(dt,{className:z.ol,ref:P,ownerState:v,children:ut(k||g&&B.length<=g?B:E(B),z.separator,w,v)})})});function xt(e,r,o){const n=r.getBoundingClientRect(),s=o&&o.getBoundingClientRect(),a=be(r);let i;if(r.fakeTransform)i=r.fakeTransform;else{const p=a.getComputedStyle(r);i=p.getPropertyValue("-webkit-transform")||p.getPropertyValue("transform")}let d=0,m=0;if(i&&i!=="none"&&typeof i=="string"){const p=i.split("(")[1].split(")")[0].split(",");d=parseInt(p[4],10),m=parseInt(p[5],10)}return e==="left"?s?`translateX(${s.right+d-n.left}px)`:`translateX(${a.innerWidth+d-n.left}px)`:e==="right"?s?`translateX(-${n.right-s.left-d}px)`:`translateX(-${n.left+n.width-d}px)`:e==="up"?s?`translateY(${s.bottom+m-n.top}px)`:`translateY(${a.innerHeight+m-n.top}px)`:s?`translateY(-${n.top-s.top+n.height-m}px)`:`translateY(-${n.top+n.height-m}px)`}function mt(e){return typeof e=="function"?e():e}function A(e,r,o){const n=mt(o),s=xt(e,r,n);s&&(r.style.webkitTransform=s,r.style.transform=s)}const ft=x.forwardRef(function(r,o){const n=Z(),s={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},a={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:i,appear:d=!0,children:m,container:p,direction:h="down",easing:b=s,in:g,onEnter:w,onEntered:D,onEntering:k,onExit:S,onExited:v,onExiting:z,style:T,timeout:P=a,TransitionComponent:E=ze,...B}=r,c=x.useRef(null),M=Ce(Ie(m),c,o),y=l=>f=>{l&&(f===void 0?l(c.current):l(c.current,f))},F=y((l,f)=>{A(h,l,p),Te(l),w&&w(l,f)}),ae=y((l,f)=>{const L=de({timeout:P,style:T,easing:b},{mode:"enter"});l.style.webkitTransition=n.transitions.create("-webkit-transform",{...L}),l.style.transition=n.transitions.create("transform",{...L}),l.style.webkitTransform="none",l.style.transform="none",k&&k(l,f)}),R=y(D),H=y(z),C=y(l=>{const f=de({timeout:P,style:T,easing:b},{mode:"exit"});l.style.webkitTransition=n.transitions.create("-webkit-transform",f),l.style.transition=n.transitions.create("transform",f),A(h,l,p),S&&S(l)}),U=y(l=>{l.style.webkitTransition="",l.style.transition="",v&&v(l)}),_=l=>{i&&i(c.current,l)},N=x.useCallback(()=>{c.current&&A(h,c.current,p)},[h,p]);return x.useEffect(()=>{if(g||h==="down"||h==="right")return;const l=De(()=>{c.current&&A(h,c.current,p)}),f=be(c.current);return f.addEventListener("resize",l),()=>{l.clear(),f.removeEventListener("resize",l)}},[h,g,p]),x.useEffect(()=>{g||N()},[g,N]),t.jsx(E,{nodeRef:c,onEnter:F,onEntered:R,onEntering:ae,onExit:C,onExited:U,onExiting:H,addEndListener:_,appear:d,in:g,timeout:P,...B,children:(l,{ownerState:f,...L})=>x.cloneElement(m,{ref:M,style:{visibility:l==="exited"&&!g?"hidden":void 0,...T,...m.props.style},...L})})});function gt(e){return me("MuiDrawer",e)}fe("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const je=(e,r)=>{const{ownerState:o}=e;return[r.root,(o.variant==="permanent"||o.variant==="persistent")&&r.docked,r.modal]},yt=e=>{const{classes:r,anchor:o,variant:n}=e,s={root:["root",`anchor${$(o)}`],docked:[(n==="permanent"||n==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${$(o)}`,n!=="temporary"&&`paperAnchorDocked${$(o)}`]};return ye(s,gt,r)},bt=I(He,{name:"MuiDrawer",slot:"Root",overridesResolver:je})(Q(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),vt=I("div",{shouldForwardProp:$e,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:je})({flex:"0 0 auto"}),jt=I(Le,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,r)=>{const{ownerState:o}=e;return[r.paper,r[`paperAnchor${$(o.anchor)}`],o.variant!=="temporary"&&r[`paperAnchorDocked${$(o.anchor)}`]]}})(Q(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:r})=>r.anchor==="left"&&r.variant!=="temporary",style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="top"&&r.variant!=="temporary",style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="right"&&r.variant!=="temporary",style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="bottom"&&r.variant!=="temporary",style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),ke={left:"right",right:"left",top:"down",bottom:"up"};function kt(e){return["left","right"].includes(e)}function wt({direction:e},r){return e==="rtl"&&kt(r)?ke[r]:r}const St=x.forwardRef(function(r,o){const n=ge({props:r,name:"MuiDrawer"}),s=Z(),a=Be(),i={enter:s.transitions.duration.enteringScreen,exit:s.transitions.duration.leavingScreen},{anchor:d="left",BackdropProps:m,children:p,className:h,elevation:b=16,hideBackdrop:g=!1,ModalProps:{BackdropProps:w,...D}={},onClose:k,open:S=!1,PaperProps:v={},SlideProps:z,TransitionComponent:T,transitionDuration:P=i,variant:E="temporary",slots:B={},slotProps:c={},...M}=n,y=x.useRef(!1);x.useEffect(()=>{y.current=!0},[]);const F=wt({direction:a?"rtl":"ltr"},d),R={...n,anchor:d,elevation:b,open:S,variant:E,...M},H=yt(R),C={slots:{transition:T,...B},slotProps:{paper:v,transition:z,...c,backdrop:Re(c.backdrop||{...m,...w},{transitionDuration:P})}},[U,_]=O("root",{ref:o,elementType:bt,className:W(H.root,H.modal,h),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...C,...M,...D},additionalProps:{open:S,onClose:k,hideBackdrop:g,slots:{backdrop:C.slots.backdrop},slotProps:{backdrop:C.slotProps.backdrop}}}),[N,l]=O("paper",{elementType:jt,shouldForwardComponentProp:!0,className:W(H.paper,v.className),ownerState:R,externalForwardedProps:C,additionalProps:{elevation:E==="temporary"?b:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[f,L]=O("docked",{elementType:vt,ref:o,className:W(H.root,H.docked,h),ownerState:R,externalForwardedProps:C,additionalProps:M}),[Se,Pe]=O("transition",{elementType:ft,ownerState:R,externalForwardedProps:C,additionalProps:{in:S,direction:ke[F],timeout:P,appear:y.current}}),ie=t.jsx(N,{...l,children:p});if(E==="permanent")return t.jsx(f,{...L,children:ie});const le=t.jsx(Se,{...Pe,children:ie});return E==="persistent"?t.jsx(f,{...L,children:le}):t.jsx(U,{..._,children:le})}),Pt=j([t.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),t.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),Et=j(t.jsx("path",{d:"M10.85 12.65h2.3L12 9zM20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM14.3 16l-.7-2h-3.2l-.7 2H7.8L11 7h2l3.2 9z"})),Mt=j(t.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"})),zt=j(t.jsx("path",{d:"M9.37 5.51c-.18.64-.27 1.31-.27 1.99 0 4.08 3.32 7.4 7.4 7.4.68 0 1.35-.09 1.99-.27C17.45 17.19 14.93 19 12 19c-3.86 0-7-3.14-7-7 0-2.93 1.81-5.45 4.37-6.49M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1"})),Ct=j(t.jsx("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"})),It=j(t.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"})),Dt=j(t.jsx("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81zM12 3 2 12h3v8h6v-6h2v6h6v-8h3z"})),Tt=j(t.jsx("path",{d:"M12 9c1.65 0 3 1.35 3 3s-1.35 3-3 3-3-1.35-3-3 1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z"})),Bt=j(t.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),Rt=j([t.jsx("path",{d:"M12 22C6.49 22 2 17.51 2 12S6.49 2 12 2s10 4.04 10 9c0 3.31-2.69 6-6 6h-1.77c-.28 0-.5.22-.5.5 0 .12.05.23.13.33.41.47.64 1.06.64 1.67 0 1.38-1.12 2.5-2.5 2.5m0-18c-4.41 0-8 3.59-8 8s3.59 8 8 8c.28 0 .5-.22.5-.5 0-.16-.08-.28-.14-.35-.41-.46-.63-1.05-.63-1.65 0-1.38 1.12-2.5 2.5-2.5H16c2.21 0 4-1.79 4-4 0-3.86-3.59-7-8-7"},"0"),t.jsx("circle",{cx:"6.5",cy:"11.5",r:"1.5"},"1"),t.jsx("circle",{cx:"9.5",cy:"7.5",r:"1.5"},"2"),t.jsx("circle",{cx:"14.5",cy:"7.5",r:"1.5"},"3"),t.jsx("circle",{cx:"17.5",cy:"11.5",r:"1.5"},"4")]);function q(e){return t.jsxs(Ne,{...e,viewBox:"0 0 24 24",sx:{fill:"none",...e.sx},children:[t.jsx("rect",{x:"3.25",y:"4.75",width:"17.5",height:"14.5",rx:"2.25",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("line",{x1:"8.5",y1:"5",x2:"8.5",y2:"19",stroke:"currentColor",strokeWidth:"1.5"})]})}const Ht=/\.malloy(nb)?$/;function Lt(){const{pathname:e,search:r}=G(),o=J(),n=Oe(),s=Ae(),a=Ze(),i=o.environmentName??"",d=o.packageName??"",m=ve({always:!0}),p=m.path??"",h=i!==""&&d!==""&&p!==""&&m.writable&&!Ht.test(p),{reports:b,settled:g}=We(i,d,void 0,h);if(!h||s)return null;const w=p.replace(/\/$/,""),D=Ge(r),k=e.replace(/\/$/,"");return D?a?null:t.jsx(pe,{label:"View",onClick:()=>n(`${k}${Je(r)}`)}):(g?Ve(`${w}.malloy`,b):void 0)?.editable?t.jsx("span",{onPointerEnter:()=>void he(),onFocus:()=>void he(),children:t.jsx(pe,{label:"Edit",icon:t.jsx(Ct,{}),onClick:()=>n(`${k}${et(r)}`)})}):null}function X({label:e,onClick:r,current:o=!1}){return t.jsx(Fe,{clickable:!0,onClick:r,label:e,size:"small","aria-label":`Navigate to ${e}`,"aria-current":o?"page":void 0,sx:n=>({backgroundColor:"transparent",border:"none",color:o?"text.primary":"text.secondary",fontWeight:o?500:400,fontSize:13,height:28,cursor:"pointer",borderRadius:"6px",maxWidth:320,"& .MuiChip-label":{px:.75,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},"&:hover":{backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}})})}function $t(){const e=J(),r=ve(),o=e.environmentName&&e.packageName?tt(e.environmentName,e.packageName,r.versionSegment):"",n=r.path?r.path.replace(/\/$/,""):void 0,s=ee();return!e.environmentName&&!e.packageName&&!n?null:t.jsx(u,{sx:{display:"flex",alignItems:"center",minWidth:0},children:t.jsxs(ht,{"aria-label":"breadcrumb",separator:t.jsx(u,{component:"span","aria-hidden":!0,sx:{color:"text.disabled"},children:"/"}),children:[e.environmentName&&t.jsx(X,{label:e.environmentName,current:!e.packageName&&!n,onClick:a=>s(`/${e.environmentName}/`,a)}),e.packageName&&t.jsx(X,{label:e.packageName,current:!n,onClick:a=>s(`${o}/`,a)}),n&&t.jsx(X,{label:n,current:!0,onClick:a=>s(`${o}/${n}`,a)})]})})}const Nt=260,Ot=64;function we({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){return t.jsxs(u,{sx:{height:"100dvh",width:e?Ot:Nt,flexShrink:0,display:"flex",flexDirection:"column",backgroundColor:"background.paper",transition:"width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden"},children:[t.jsx(At,{isCollapsed:e,onToggleCollapse:r,logoHeader:o}),t.jsxs(u,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",py:1},children:[t.jsx(Wt,{isCollapsed:e}),t.jsx(Vt,{isCollapsed:e})]}),t.jsx(Ft,{isCollapsed:e})]})}function At({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){const n=ee();return o?t.jsxs(u,{sx:{height:56,display:"flex",alignItems:"center",justifyContent:"space-between",px:e?0:2,flexShrink:0},children:[o,t.jsx(Y,{size:"small",onClick:r,"aria-label":e?"Expand sidebar":"Collapse sidebar",children:t.jsx(q,{fontSize:"small"})})]}):t.jsxs(u,{sx:{minHeight:56,display:"flex",flexDirection:e?"column":"row",alignItems:"center",justifyContent:e?"center":"space-between",gap:e?.5:0,py:e?1:0,px:e?0:2,flexShrink:0},children:[t.jsxs(u,{onClick:s=>n("/",s),sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer",minWidth:0},children:[t.jsx(u,{component:"img",src:"/logo.svg",alt:"Malloy",sx:{width:24,height:24,flexShrink:0}}),!e&&t.jsx(K,{variant:"subtitle1",sx:{color:"text.primary",fontWeight:500,letterSpacing:"-0.025em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Malloy Publisher"})]}),t.jsx(V,{title:e?"Expand sidebar":"Collapse sidebar",placement:"right",children:t.jsx(Y,{size:"small",onClick:r,"aria-label":e?"Expand sidebar":"Collapse sidebar",children:t.jsx(q,{fontSize:"small"})})})]})}function Wt({isCollapsed:e}){const o=G().pathname==="/";return t.jsx(te,{sx:{py:0},children:t.jsx(se,{icon:t.jsx(Dt,{fontSize:"small"}),label:"Home",to:"/",selected:o,isCollapsed:e})})}function Vt({isCollapsed:e}){const{apiClients:r}=Ue(),o=J(),{data:n}=_e({queryKey:["environments"],queryFn:()=>r.environments.listEnvironments()}),s=n?.data??[];return s.length===0?null:t.jsxs(u,{sx:{mt:1},children:[!e&&t.jsx(K,{variant:"caption",sx:{display:"block",px:3,py:1,color:"text.secondary",fontWeight:500,textTransform:"uppercase",fontSize:"0.6875rem",letterSpacing:"0.5px"},children:"Environments"}),t.jsx(te,{sx:{py:0},children:s.map(a=>{const i=a.name??"";return t.jsx(se,{icon:t.jsx(It,{fontSize:"small"}),label:i,to:`/${i}`,selected:o.environmentName===i,isCollapsed:e},i)})})]})}function Ft({isCollapsed:e}){const{pathname:r}=G(),o=[{label:"Malloy Docs",href:ue.docsHome,icon:t.jsx(Pt,{fontSize:"small"}),external:!0},{label:"Publisher Docs",href:ue.publishing,icon:t.jsx(Bt,{fontSize:"small"}),external:!0},{label:"Publisher API",href:"/api-doc.html",icon:t.jsx(Mt,{fontSize:"small"}),external:!1}];return t.jsxs(te,{sx:{py:1},children:[t.jsx(se,{icon:t.jsx(Rt,{fontSize:"small"}),label:"Theme",to:"/settings/theme",selected:r.startsWith("/settings/theme"),isCollapsed:e}),t.jsx(Yt,{isCollapsed:e}),o.map(n=>t.jsx(Ut,{label:n.label,href:n.href,icon:n.icon,external:n.external,isCollapsed:e},n.label))]})}function se({icon:e,label:r,to:o,selected:n,isCollapsed:s}){const a=ee(),i=t.jsxs(re,{selected:n,onClick:d=>a(o,d),sx:{justifyContent:s?"center":"flex-start",px:s?0:2},children:[t.jsx(ne,{sx:{minWidth:s?0:36,justifyContent:"center",color:n?"text.primary":"text.secondary"},children:e}),!s&&t.jsx(oe,{primary:r,primaryTypographyProps:{variant:"body2",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(V,{title:r,placement:"right",children:t.jsx(u,{children:i})}):i}function Ut({label:e,href:r,icon:o,external:n,isCollapsed:s}){const a=t.jsxs(re,{component:"a",href:r,target:n?"_blank":void 0,rel:n?"noopener noreferrer":void 0,sx:{justifyContent:s?"center":"flex-start",px:s?0:2},children:[t.jsx(ne,{sx:{minWidth:s?0:36,justifyContent:"center",color:"text.secondary"},children:o}),!s&&t.jsx(oe,{primary:e,primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(V,{title:e,placement:"right",children:t.jsx(u,{children:a})}):a}const _t={light:"dark",dark:"auto",auto:"light"},Xt={light:"Light mode",dark:"Dark mode",auto:"Auto mode"},xe={light:"Light mode (click for dark)",dark:"Dark mode (click for auto)",auto:"Auto mode (follows OS, click for light)"};function Yt({isCollapsed:e}){const{mode:r,userChoice:o,setMode:n,allowUserToggle:s}=Xe();if(!s)return null;const a=o??r,i=a==="auto"?Et:a==="dark"?zt:Tt,d=t.jsxs(re,{"aria-label":xe[a],onClick:()=>n(_t[a]),sx:{justifyContent:e?"center":"flex-start",px:e?0:2},children:[t.jsx(ne,{sx:{minWidth:e?0:36,justifyContent:"center",color:"text.secondary"},children:t.jsx(i,{fontSize:"small"})}),!e&&t.jsx(oe,{primary:Xt[a],primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",whiteSpace:"nowrap"}}})]});return t.jsx(V,{title:xe[a],placement:"right",disableHoverListener:!e,children:t.jsx(u,{children:d})})}function qt({open:e,onClose:r,logoHeader:o}){return t.jsx(St,{anchor:"left",open:e,onClose:r,ModalProps:{keepMounted:!0},sx:{display:{xs:"block",md:"none"},"& .MuiDrawer-paper":{boxSizing:"border-box",width:260}},children:t.jsx(we,{isCollapsed:!1,onToggleCollapse:r,logoHeader:o})})}function Jt({headerProps:e}){const r=Z(),o=Ye(r.breakpoints.up("md")),[n,s]=x.useState(!1),[a,i]=x.useState(!1);return x.useEffect(()=>{o&&n&&s(!1)},[o,n]),t.jsxs(u,{sx:{height:"100dvh",display:"flex",flexDirection:"row",bgcolor:"background.default"},children:[o&&t.jsx(we,{isCollapsed:a,onToggleCollapse:()=>i(d=>!d),logoHeader:e?.logoHeader}),t.jsxs(u,{component:"main",sx:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[t.jsxs(u,{sx:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"space-between",height:qe.headerHeight,px:{xs:1,md:3},backgroundColor:"background.default"},children:[t.jsx(u,{sx:{display:{xs:"flex",md:"none"},alignItems:"center",mr:1},children:t.jsx(Y,{size:"small",onClick:()=>s(!0),"aria-label":"Open navigation",children:t.jsx(q,{fontSize:"small"})})}),t.jsx(u,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"center"},children:t.jsx($t,{})}),t.jsxs(u,{id:"header-actions-portal",sx:{display:"flex",alignItems:"center",flexShrink:0,gap:1},children:[t.jsx(Lt,{}),e?.endCap]})]}),t.jsx(u,{sx:{flex:1,overflow:"auto",minWidth:320,minHeight:0},children:t.jsx(x.Suspense,{fallback:t.jsx(Ke,{}),children:t.jsx(Qe,{})})})]}),t.jsx(qt,{open:n,onClose:()=>s(!1),logoHeader:e?.logoHeader})]})}export{Jt as default};
1
+ import{c as j,j as t,s as I,B as Ee,m as Q,e as ce,g as me,a as fe,r as x,u as ge,b as Me,d as W,f as ye,T as K,h as Z,i as ze,k as Ce,l as Ie,o as be,n as De,q as Te,t as de,v as Be,w as Re,x as O,y as $,M as He,P as Le,z as $e,S as Ne,A as G,C as J,E as Oe,F as Ae,G as We,Z as pe,H as Ve,p as ee,I as u,J as Fe,K as Y,L as V,N as te,O as Ue,Q as _e,R as ue,U as Xe,V as re,W as ne,X as oe,Y as Ye,_ as qe,$ as Qe,a0 as Ke}from"./index-BLi0H5mL.js";import{u as Ze,l as he}from"./editPageMounted-CjmdfOM1.js";import{i as Ge,w as Je,a as et}from"./documentRoutes-DFdmdaBX.js";import{u as ve,p as tt}from"./usePackageRoute-DzmKqWKq.js";const rt=j(t.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),nt=I(Ee,{name:"MuiBreadcrumbCollapsed"})(Q(({theme:e})=>({display:"flex",marginLeft:`calc(${e.spacing(1)} * 0.5)`,marginRight:`calc(${e.spacing(1)} * 0.5)`,...e.palette.mode==="light"?{backgroundColor:e.palette.grey[100],color:e.palette.grey[700]}:{backgroundColor:e.palette.grey[700],color:e.palette.grey[100]},borderRadius:2,"&:hover, &:focus":{...e.palette.mode==="light"?{backgroundColor:e.palette.grey[200]}:{backgroundColor:e.palette.grey[600]}},"&:active":{boxShadow:e.shadows[0],...e.palette.mode==="light"?{backgroundColor:ce(e.palette.grey[200],.12)}:{backgroundColor:ce(e.palette.grey[600],.12)}}}))),ot=I(rt)({width:24,height:16});function st(e){const{slots:r={},slotProps:o={},...n}=e,s=e;return t.jsx("li",{children:t.jsx(nt,{focusRipple:!0,...n,ownerState:s,children:t.jsx(ot,{as:r.CollapsedIcon,ownerState:s,...o.collapsedIcon})})})}function at(e){return me("MuiBreadcrumbs",e)}const it=fe("MuiBreadcrumbs",["root","ol","li","separator"]),lt=e=>{const{classes:r}=e;return ye({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},at,r)},ct=I(K,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,r)=>[{[`& .${it.li}`]:r.li},r.root]})({}),dt=I("ol",{name:"MuiBreadcrumbs",slot:"Ol"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),pt=I("li",{name:"MuiBreadcrumbs",slot:"Separator"})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function ut(e,r,o,n){return e.reduce((s,a,i)=>(i<e.length-1?s=s.concat(a,t.jsx(pt,{"aria-hidden":!0,className:r,ownerState:n,children:o},`separator-${i}`)):s.push(a),s),[])}const ht=x.forwardRef(function(r,o){const n=ge({props:r,name:"MuiBreadcrumbs"}),{children:s,className:a,component:i="nav",slots:d={},slotProps:m={},expandText:p="Show path",itemsAfterCollapse:h=1,itemsBeforeCollapse:b=1,maxItems:g=8,separator:w="/",...D}=n,[k,S]=x.useState(!1),v={...n,component:i,expanded:k,expandText:p,itemsAfterCollapse:h,itemsBeforeCollapse:b,maxItems:g,separator:w},z=lt(v),T=Me({elementType:d.CollapsedIcon,externalSlotProps:m.collapsedIcon,ownerState:v}),P=x.useRef(null),E=c=>{const M=()=>{S(!0);const y=P.current.querySelector("a[href],button,[tabindex]");y&&y.focus()};return b+h>=c.length?c:[...c.slice(0,b),t.jsx(st,{"aria-label":p,slots:{CollapsedIcon:d.CollapsedIcon},slotProps:{collapsedIcon:T},onClick:M},"ellipsis"),...c.slice(c.length-h,c.length)]},B=x.Children.toArray(s).filter(c=>x.isValidElement(c)).map((c,M)=>t.jsx("li",{className:z.li,children:c},`child-${M}`));return t.jsx(ct,{ref:o,component:i,color:"textSecondary",className:W(z.root,a),ownerState:v,...D,children:t.jsx(dt,{className:z.ol,ref:P,ownerState:v,children:ut(k||g&&B.length<=g?B:E(B),z.separator,w,v)})})});function xt(e,r,o){const n=r.getBoundingClientRect(),s=o&&o.getBoundingClientRect(),a=be(r);let i;if(r.fakeTransform)i=r.fakeTransform;else{const p=a.getComputedStyle(r);i=p.getPropertyValue("-webkit-transform")||p.getPropertyValue("transform")}let d=0,m=0;if(i&&i!=="none"&&typeof i=="string"){const p=i.split("(")[1].split(")")[0].split(",");d=parseInt(p[4],10),m=parseInt(p[5],10)}return e==="left"?s?`translateX(${s.right+d-n.left}px)`:`translateX(${a.innerWidth+d-n.left}px)`:e==="right"?s?`translateX(-${n.right-s.left-d}px)`:`translateX(-${n.left+n.width-d}px)`:e==="up"?s?`translateY(${s.bottom+m-n.top}px)`:`translateY(${a.innerHeight+m-n.top}px)`:s?`translateY(-${n.top-s.top+n.height-m}px)`:`translateY(-${n.top+n.height-m}px)`}function mt(e){return typeof e=="function"?e():e}function A(e,r,o){const n=mt(o),s=xt(e,r,n);s&&(r.style.webkitTransform=s,r.style.transform=s)}const ft=x.forwardRef(function(r,o){const n=Z(),s={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},a={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:i,appear:d=!0,children:m,container:p,direction:h="down",easing:b=s,in:g,onEnter:w,onEntered:D,onEntering:k,onExit:S,onExited:v,onExiting:z,style:T,timeout:P=a,TransitionComponent:E=ze,...B}=r,c=x.useRef(null),M=Ce(Ie(m),c,o),y=l=>f=>{l&&(f===void 0?l(c.current):l(c.current,f))},F=y((l,f)=>{A(h,l,p),Te(l),w&&w(l,f)}),ae=y((l,f)=>{const L=de({timeout:P,style:T,easing:b},{mode:"enter"});l.style.webkitTransition=n.transitions.create("-webkit-transform",{...L}),l.style.transition=n.transitions.create("transform",{...L}),l.style.webkitTransform="none",l.style.transform="none",k&&k(l,f)}),R=y(D),H=y(z),C=y(l=>{const f=de({timeout:P,style:T,easing:b},{mode:"exit"});l.style.webkitTransition=n.transitions.create("-webkit-transform",f),l.style.transition=n.transitions.create("transform",f),A(h,l,p),S&&S(l)}),U=y(l=>{l.style.webkitTransition="",l.style.transition="",v&&v(l)}),_=l=>{i&&i(c.current,l)},N=x.useCallback(()=>{c.current&&A(h,c.current,p)},[h,p]);return x.useEffect(()=>{if(g||h==="down"||h==="right")return;const l=De(()=>{c.current&&A(h,c.current,p)}),f=be(c.current);return f.addEventListener("resize",l),()=>{l.clear(),f.removeEventListener("resize",l)}},[h,g,p]),x.useEffect(()=>{g||N()},[g,N]),t.jsx(E,{nodeRef:c,onEnter:F,onEntered:R,onEntering:ae,onExit:C,onExited:U,onExiting:H,addEndListener:_,appear:d,in:g,timeout:P,...B,children:(l,{ownerState:f,...L})=>x.cloneElement(m,{ref:M,style:{visibility:l==="exited"&&!g?"hidden":void 0,...T,...m.props.style},...L})})});function gt(e){return me("MuiDrawer",e)}fe("MuiDrawer",["root","docked","paper","anchorLeft","anchorRight","anchorTop","anchorBottom","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const je=(e,r)=>{const{ownerState:o}=e;return[r.root,(o.variant==="permanent"||o.variant==="persistent")&&r.docked,r.modal]},yt=e=>{const{classes:r,anchor:o,variant:n}=e,s={root:["root",`anchor${$(o)}`],docked:[(n==="permanent"||n==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${$(o)}`,n!=="temporary"&&`paperAnchorDocked${$(o)}`]};return ye(s,gt,r)},bt=I(He,{name:"MuiDrawer",slot:"Root",overridesResolver:je})(Q(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),vt=I("div",{shouldForwardProp:$e,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:je})({flex:"0 0 auto"}),jt=I(Le,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,r)=>{const{ownerState:o}=e;return[r.paper,r[`paperAnchor${$(o.anchor)}`],o.variant!=="temporary"&&r[`paperAnchorDocked${$(o.anchor)}`]]}})(Q(({theme:e})=>({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0,variants:[{props:{anchor:"left"},style:{left:0}},{props:{anchor:"top"},style:{top:0,left:0,right:0,height:"auto",maxHeight:"100%"}},{props:{anchor:"right"},style:{right:0}},{props:{anchor:"bottom"},style:{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"}},{props:({ownerState:r})=>r.anchor==="left"&&r.variant!=="temporary",style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="top"&&r.variant!=="temporary",style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="right"&&r.variant!=="temporary",style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:r})=>r.anchor==="bottom"&&r.variant!=="temporary",style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),ke={left:"right",right:"left",top:"down",bottom:"up"};function kt(e){return["left","right"].includes(e)}function wt({direction:e},r){return e==="rtl"&&kt(r)?ke[r]:r}const St=x.forwardRef(function(r,o){const n=ge({props:r,name:"MuiDrawer"}),s=Z(),a=Be(),i={enter:s.transitions.duration.enteringScreen,exit:s.transitions.duration.leavingScreen},{anchor:d="left",BackdropProps:m,children:p,className:h,elevation:b=16,hideBackdrop:g=!1,ModalProps:{BackdropProps:w,...D}={},onClose:k,open:S=!1,PaperProps:v={},SlideProps:z,TransitionComponent:T,transitionDuration:P=i,variant:E="temporary",slots:B={},slotProps:c={},...M}=n,y=x.useRef(!1);x.useEffect(()=>{y.current=!0},[]);const F=wt({direction:a?"rtl":"ltr"},d),R={...n,anchor:d,elevation:b,open:S,variant:E,...M},H=yt(R),C={slots:{transition:T,...B},slotProps:{paper:v,transition:z,...c,backdrop:Re(c.backdrop||{...m,...w},{transitionDuration:P})}},[U,_]=O("root",{ref:o,elementType:bt,className:W(H.root,H.modal,h),shouldForwardComponentProp:!0,ownerState:R,externalForwardedProps:{...C,...M,...D},additionalProps:{open:S,onClose:k,hideBackdrop:g,slots:{backdrop:C.slots.backdrop},slotProps:{backdrop:C.slotProps.backdrop}}}),[N,l]=O("paper",{elementType:jt,shouldForwardComponentProp:!0,className:W(H.paper,v.className),ownerState:R,externalForwardedProps:C,additionalProps:{elevation:E==="temporary"?b:0,square:!0,...E==="temporary"&&{role:"dialog","aria-modal":"true"}}}),[f,L]=O("docked",{elementType:vt,ref:o,className:W(H.root,H.docked,h),ownerState:R,externalForwardedProps:C,additionalProps:M}),[Se,Pe]=O("transition",{elementType:ft,ownerState:R,externalForwardedProps:C,additionalProps:{in:S,direction:ke[F],timeout:P,appear:y.current}}),ie=t.jsx(N,{...l,children:p});if(E==="permanent")return t.jsx(f,{...L,children:ie});const le=t.jsx(Se,{...Pe,children:ie});return E==="persistent"?t.jsx(f,{...L,children:le}):t.jsx(U,{..._,children:le})}),Pt=j([t.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),t.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),Et=j(t.jsx("path",{d:"M10.85 12.65h2.3L12 9zM20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM14.3 16l-.7-2h-3.2l-.7 2H7.8L11 7h2l3.2 9z"})),Mt=j(t.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"})),zt=j(t.jsx("path",{d:"M9.37 5.51c-.18.64-.27 1.31-.27 1.99 0 4.08 3.32 7.4 7.4 7.4.68 0 1.35-.09 1.99-.27C17.45 17.19 14.93 19 12 19c-3.86 0-7-3.14-7-7 0-2.93 1.81-5.45 4.37-6.49M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1"})),Ct=j(t.jsx("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"})),It=j(t.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"})),Dt=j(t.jsx("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81zM12 3 2 12h3v8h6v-6h2v6h6v-8h3z"})),Tt=j(t.jsx("path",{d:"M12 9c1.65 0 3 1.35 3 3s-1.35 3-3 3-3-1.35-3-3 1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z"})),Bt=j(t.jsx("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3z"})),Rt=j([t.jsx("path",{d:"M12 22C6.49 22 2 17.51 2 12S6.49 2 12 2s10 4.04 10 9c0 3.31-2.69 6-6 6h-1.77c-.28 0-.5.22-.5.5 0 .12.05.23.13.33.41.47.64 1.06.64 1.67 0 1.38-1.12 2.5-2.5 2.5m0-18c-4.41 0-8 3.59-8 8s3.59 8 8 8c.28 0 .5-.22.5-.5 0-.16-.08-.28-.14-.35-.41-.46-.63-1.05-.63-1.65 0-1.38 1.12-2.5 2.5-2.5H16c2.21 0 4-1.79 4-4 0-3.86-3.59-7-8-7"},"0"),t.jsx("circle",{cx:"6.5",cy:"11.5",r:"1.5"},"1"),t.jsx("circle",{cx:"9.5",cy:"7.5",r:"1.5"},"2"),t.jsx("circle",{cx:"14.5",cy:"7.5",r:"1.5"},"3"),t.jsx("circle",{cx:"17.5",cy:"11.5",r:"1.5"},"4")]);function q(e){return t.jsxs(Ne,{...e,viewBox:"0 0 24 24",sx:{fill:"none",...e.sx},children:[t.jsx("rect",{x:"3.25",y:"4.75",width:"17.5",height:"14.5",rx:"2.25",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("line",{x1:"8.5",y1:"5",x2:"8.5",y2:"19",stroke:"currentColor",strokeWidth:"1.5"})]})}const Ht=/\.malloy(nb)?$/;function Lt(){const{pathname:e,search:r}=G(),o=J(),n=Oe(),s=Ae(),a=Ze(),i=o.environmentName??"",d=o.packageName??"",m=ve({always:!0}),p=m.path??"",h=i!==""&&d!==""&&p!==""&&m.writable&&!Ht.test(p),{reports:b,settled:g}=We(i,d,void 0,h);if(!h||s)return null;const w=p.replace(/\/$/,""),D=Ge(r),k=e.replace(/\/$/,"");return D?a?null:t.jsx(pe,{label:"View",onClick:()=>n(`${k}${Je(r)}`)}):(g?Ve(`${w}.malloy`,b):void 0)?.editable?t.jsx("span",{onPointerEnter:()=>void he(),onFocus:()=>void he(),children:t.jsx(pe,{label:"Edit",icon:t.jsx(Ct,{}),onClick:()=>n(`${k}${et(r)}`)})}):null}function X({label:e,onClick:r,current:o=!1}){return t.jsx(Fe,{clickable:!0,onClick:r,label:e,size:"small","aria-label":`Navigate to ${e}`,"aria-current":o?"page":void 0,sx:n=>({backgroundColor:"transparent",border:"none",color:o?"text.primary":"text.secondary",fontWeight:o?500:400,fontSize:13,height:28,cursor:"pointer",borderRadius:"6px",maxWidth:320,"& .MuiChip-label":{px:.75,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},"&:hover":{backgroundColor:n.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"grey.100"}})})}function $t(){const e=J(),r=ve(),o=e.environmentName&&e.packageName?tt(e.environmentName,e.packageName,r.versionSegment):"",n=r.path?r.path.replace(/\/$/,""):void 0,s=ee();return!e.environmentName&&!e.packageName&&!n?null:t.jsx(u,{sx:{display:"flex",alignItems:"center",minWidth:0},children:t.jsxs(ht,{"aria-label":"breadcrumb",separator:t.jsx(u,{component:"span","aria-hidden":!0,sx:{color:"text.disabled"},children:"/"}),children:[e.environmentName&&t.jsx(X,{label:e.environmentName,current:!e.packageName&&!n,onClick:a=>s(`/${e.environmentName}/`,a)}),e.packageName&&t.jsx(X,{label:e.packageName,current:!n,onClick:a=>s(`${o}/`,a)}),n&&t.jsx(X,{label:n,current:!0,onClick:a=>s(`${o}/${n}`,a)})]})})}const Nt=260,Ot=64;function we({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){return t.jsxs(u,{sx:{height:"100dvh",width:e?Ot:Nt,flexShrink:0,display:"flex",flexDirection:"column",backgroundColor:"background.paper",transition:"width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden"},children:[t.jsx(At,{isCollapsed:e,onToggleCollapse:r,logoHeader:o}),t.jsxs(u,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",py:1},children:[t.jsx(Wt,{isCollapsed:e}),t.jsx(Vt,{isCollapsed:e})]}),t.jsx(Ft,{isCollapsed:e})]})}function At({isCollapsed:e,onToggleCollapse:r,logoHeader:o}){const n=ee();return o?t.jsxs(u,{sx:{height:56,display:"flex",alignItems:"center",justifyContent:"space-between",px:e?0:2,flexShrink:0},children:[o,t.jsx(Y,{size:"small",onClick:r,"aria-label":e?"Expand sidebar":"Collapse sidebar",children:t.jsx(q,{fontSize:"small"})})]}):t.jsxs(u,{sx:{minHeight:56,display:"flex",flexDirection:e?"column":"row",alignItems:"center",justifyContent:e?"center":"space-between",gap:e?.5:0,py:e?1:0,px:e?0:2,flexShrink:0},children:[t.jsxs(u,{onClick:s=>n("/",s),sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer",minWidth:0},children:[t.jsx(u,{component:"img",src:"/logo.svg",alt:"Malloy",sx:{width:24,height:24,flexShrink:0}}),!e&&t.jsx(K,{variant:"subtitle1",sx:{color:"text.primary",fontWeight:500,letterSpacing:"-0.025em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Malloy Publisher"})]}),t.jsx(V,{title:e?"Expand sidebar":"Collapse sidebar",placement:"right",children:t.jsx(Y,{size:"small",onClick:r,"aria-label":e?"Expand sidebar":"Collapse sidebar",children:t.jsx(q,{fontSize:"small"})})})]})}function Wt({isCollapsed:e}){const o=G().pathname==="/";return t.jsx(te,{sx:{py:0},children:t.jsx(se,{icon:t.jsx(Dt,{fontSize:"small"}),label:"Home",to:"/",selected:o,isCollapsed:e})})}function Vt({isCollapsed:e}){const{apiClients:r}=Ue(),o=J(),{data:n}=_e({queryKey:["environments"],queryFn:()=>r.environments.listEnvironments()}),s=n?.data??[];return s.length===0?null:t.jsxs(u,{sx:{mt:1},children:[!e&&t.jsx(K,{variant:"caption",sx:{display:"block",px:3,py:1,color:"text.secondary",fontWeight:500,textTransform:"uppercase",fontSize:"0.6875rem",letterSpacing:"0.5px"},children:"Environments"}),t.jsx(te,{sx:{py:0},children:s.map(a=>{const i=a.name??"";return t.jsx(se,{icon:t.jsx(It,{fontSize:"small"}),label:i,to:`/${i}`,selected:o.environmentName===i,isCollapsed:e},i)})})]})}function Ft({isCollapsed:e}){const{pathname:r}=G(),o=[{label:"Malloy Docs",href:ue.docsHome,icon:t.jsx(Pt,{fontSize:"small"}),external:!0},{label:"Publisher Docs",href:ue.publishing,icon:t.jsx(Bt,{fontSize:"small"}),external:!0},{label:"Publisher API",href:"/api-doc.html",icon:t.jsx(Mt,{fontSize:"small"}),external:!1}];return t.jsxs(te,{sx:{py:1},children:[t.jsx(se,{icon:t.jsx(Rt,{fontSize:"small"}),label:"Theme",to:"/settings/theme",selected:r.startsWith("/settings/theme"),isCollapsed:e}),t.jsx(Yt,{isCollapsed:e}),o.map(n=>t.jsx(Ut,{label:n.label,href:n.href,icon:n.icon,external:n.external,isCollapsed:e},n.label))]})}function se({icon:e,label:r,to:o,selected:n,isCollapsed:s}){const a=ee(),i=t.jsxs(re,{selected:n,onClick:d=>a(o,d),sx:{justifyContent:s?"center":"flex-start",px:s?0:2},children:[t.jsx(ne,{sx:{minWidth:s?0:36,justifyContent:"center",color:n?"text.primary":"text.secondary"},children:e}),!s&&t.jsx(oe,{primary:r,primaryTypographyProps:{variant:"body2",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(V,{title:r,placement:"right",children:t.jsx(u,{children:i})}):i}function Ut({label:e,href:r,icon:o,external:n,isCollapsed:s}){const a=t.jsxs(re,{component:"a",href:r,target:n?"_blank":void 0,rel:n?"noopener noreferrer":void 0,sx:{justifyContent:s?"center":"flex-start",px:s?0:2},children:[t.jsx(ne,{sx:{minWidth:s?0:36,justifyContent:"center",color:"text.secondary"},children:o}),!s&&t.jsx(oe,{primary:e,primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}})]});return s?t.jsx(V,{title:e,placement:"right",children:t.jsx(u,{children:a})}):a}const _t={light:"dark",dark:"auto",auto:"light"},Xt={light:"Light mode",dark:"Dark mode",auto:"Auto mode"},xe={light:"Light mode (click for dark)",dark:"Dark mode (click for auto)",auto:"Auto mode (follows OS, click for light)"};function Yt({isCollapsed:e}){const{mode:r,userChoice:o,setMode:n,allowUserToggle:s}=Xe();if(!s)return null;const a=o??r,i=a==="auto"?Et:a==="dark"?zt:Tt,d=t.jsxs(re,{"aria-label":xe[a],onClick:()=>n(_t[a]),sx:{justifyContent:e?"center":"flex-start",px:e?0:2},children:[t.jsx(ne,{sx:{minWidth:e?0:36,justifyContent:"center",color:"text.secondary"},children:t.jsx(i,{fontSize:"small"})}),!e&&t.jsx(oe,{primary:Xt[a],primaryTypographyProps:{variant:"body2",sx:{color:"text.secondary",whiteSpace:"nowrap"}}})]});return t.jsx(V,{title:xe[a],placement:"right",disableHoverListener:!e,children:t.jsx(u,{children:d})})}function qt({open:e,onClose:r,logoHeader:o}){return t.jsx(St,{anchor:"left",open:e,onClose:r,ModalProps:{keepMounted:!0},sx:{display:{xs:"block",md:"none"},"& .MuiDrawer-paper":{boxSizing:"border-box",width:260}},children:t.jsx(we,{isCollapsed:!1,onToggleCollapse:r,logoHeader:o})})}function Jt({headerProps:e}){const r=Z(),o=Ye(r.breakpoints.up("md")),[n,s]=x.useState(!1),[a,i]=x.useState(!1);return x.useEffect(()=>{o&&n&&s(!1)},[o,n]),t.jsxs(u,{sx:{height:"100dvh",display:"flex",flexDirection:"row",bgcolor:"background.default"},children:[o&&t.jsx(we,{isCollapsed:a,onToggleCollapse:()=>i(d=>!d),logoHeader:e?.logoHeader}),t.jsxs(u,{component:"main",sx:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[t.jsxs(u,{sx:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"space-between",height:qe.headerHeight,px:{xs:1,md:3},backgroundColor:"background.default"},children:[t.jsx(u,{sx:{display:{xs:"flex",md:"none"},alignItems:"center",mr:1},children:t.jsx(Y,{size:"small",onClick:()=>s(!0),"aria-label":"Open navigation",children:t.jsx(q,{fontSize:"small"})})}),t.jsx(u,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"center"},children:t.jsx($t,{})}),t.jsxs(u,{id:"header-actions-portal",sx:{display:"flex",alignItems:"center",flexShrink:0,gap:1},children:[t.jsx(Lt,{}),e?.endCap]})]}),t.jsx(u,{sx:{flex:1,overflow:"auto",minWidth:320,minHeight:0},children:t.jsx(x.Suspense,{fallback:t.jsx(Ke,{}),children:t.jsx(Qe,{})})})]}),t.jsx(qt,{open:n,onClose:()=>s(!1),logoHeader:e?.logoHeader})]})}export{Jt as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-AXVff-Xr.js","assets/index-D8JKtZm5.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-BfTJg9cJ.js"])))=>i.map(i=>d[i]);
2
- import{g as oe,a as ae,d8 as E,d9 as ie,r as f,u as le,h as ce,j as n,d as de,y as V,f as ue,s as pe,T as C,m as fe,d7 as he,da as F,p as xe,G as I,db as me,dc as ye,dd as q,de as z,a5 as O,F as N,I as x,df as ge,a7 as R,dg as G,a4 as ve,aw as be,dh as je,bp as ke,di as we,E as Ce,A as D,dj as Ee,as as Re,a2 as H,a3 as X,dk as Se,dl as De,a6 as K,dm as $e,dn as Y,H as Le,dp as Ae,a1 as Te,a0 as P,dq as U,C as Me,O as Fe,dr as Pe,ds as B,dt as Ue}from"./index-D8JKtZm5.js";import{i as L,w as Be,a as Z,l as _e}from"./documentRoutes-DnpGGXs4.js";import{v as We,w as A,u as J}from"./usePackageRoute-BUdFd5dP.js";import{u as Ve}from"./usePackageLinkNavigate-DpGlRKnc.js";import{T as Q,P as $}from"./PackageSplatRoute-CTxtXKZO.js";import{a as Ie,l as ee}from"./editPageMounted-efTmRdGK.js";function qe(e){return oe("MuiLink",e)}const ze=ae("MuiLink",["root","underlineNone","underlineHover","underlineAlways","button","focusVisible"]),Oe=({theme:e,ownerState:t})=>{const s=t.color;if("colorSpace"in e&&e.colorSpace){const p=E(e,`palette.${s}.main`)||E(e,`palette.${s}`)||t.color;return e.alpha(p,.4)}const r=E(e,`palette.${s}.main`,!1)||E(e,`palette.${s}`,!1)||t.color,o=E(e,`palette.${s}.mainChannel`)||E(e,`palette.${s}Channel`);return"vars"in e&&o?`rgba(${o} / 0.4)`:ie(r,.4)},_={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Ne=e=>{const{classes:t,component:s,focusVisible:r,underline:o}=e,p={root:["root",`underline${V(o)}`,s==="button"&&"button",r&&"focusVisible"]};return ue(p,qe,t)},Ge=pe(C,{name:"MuiLink",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:s}=e;return[t.root,t[`underline${V(s.underline)}`],s.component==="button"&&t.button]}})(fe(({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:t,ownerState:s})=>t==="always"&&s.color!=="inherit",style:{textDecorationColor:"var(--Link-underlineColor)"}},{props:({underline:t,ownerState:s})=>t==="always"&&s.color==="inherit",style:e.colorSpace?{textDecorationColor:e.alpha("currentColor",.4)}:null},...Object.entries(e.palette).filter(he()).map(([t])=>({props:{underline:"always",color:t},style:{"--Link-underlineColor":e.alpha((e.vars||e).palette[t].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"},[`&.${ze.focusVisible}`]:{outline:"auto"}}}]}))),He=f.forwardRef(function(t,s){const r=le({props:t,name:"MuiLink"}),o=ce(),{className:p,color:a="primary",component:i="a",onBlur:l,onFocus:c,TypographyClasses:u,underline:d="always",variant:h="inherit",sx:y,...b}=r,[m,g]=f.useState(!1),v=w=>{F(w.target)||g(!1),l&&l(w)},S=w=>{F(w.target)&&g(!0),c&&c(w)},j={...r,color:a,component:i,focusVisible:m,underline:d,variant:h},k=Ne(j);return n.jsx(Ge,{color:a,className:de(k.root,p),classes:u,component:i,onBlur:v,onFocus:S,ref:s,ownerState:j,variant:h,...b,sx:[..._[a]===void 0?[{color:a}]:[],...Array.isArray(y)?y:[y]],style:{...b.style,...d==="always"&&a!=="inherit"&&!_[a]&&{"--Link-underlineColor":Oe({theme:o,ownerState:j})}}})});function Xe(e,t,s){const r=xe(),{reports:o,settled:p,isError:a}=I(e,t,We(s)),i=p&&!a;return f.useCallback((l,c)=>{const u=l.path;if(!me(u))return"malformed";const d=ye(u,o),h=A(q(e,t,d.kind==="path"?d.report.path:u),e,t,s),y=new URLSearchParams(l.givens).toString();return r(h+(y?`?${y}`:""),c),d.kind==="path"?"resolved":i?"unresolved":"unverified"},[r,e,t,s,o,i])}const Ke='[data-tile-kind="query"]',Ye=".malloy-render, .malloy-table, [role='alert'], .MuiAlert-root",Ze=3e3;function te(e,t,s,r){const o=f.useRef(s);o.current=s;const p=f.useRef(!1);f.useEffect(()=>{if(!o.current||p.current)return;let a=0;const i={},l=()=>{clearTimeout(u),i.beat!==void 0&&clearInterval(i.beat),cancelAnimationFrame(a),i.observer?.disconnect()},c=()=>{p.current||(p.current=!0,l(),o.current?.())},u=setTimeout(c,Ze);if(!t)return()=>clearTimeout(u);const d=()=>{const h=e.current;if(!h||r&&h.querySelector(r)===null)return;const y=window.innerHeight;[...h.querySelectorAll(Ke)].filter(m=>{if(m.getBoundingClientRect().top>=y)return!1;const v=m.querySelector(Ye);return!v||v.getBoundingClientRect().height<8}).length===0&&a===0&&(a=requestAnimationFrame(()=>{a=requestAnimationFrame(c)}))};return i.observer=new MutationObserver(d),e.current&&i.observer.observe(e.current,{childList:!0,subtree:!0}),i.beat=setInterval(d,50),d(),l},[t,e,r])}function ne({environmentName:e,packageName:t,versionId:s,path:r,editable:o=r.endsWith(".malloy"),onReady:p}){const a=f.useRef(null);te(a,!0,p,`.${be.report}`);const{params:i,onGivensChange:l}=z(),{versionSegment:c}=J(),u=Xe(e,t,c),d=Ve(e,t,c),h=f.useMemo(()=>O({environmentName:e,packageName:t}),[e,t]),y=N();return f.useEffect(()=>{if(!o||y)return;const b=()=>void ve(()=>import("./index.es-AXVff-Xr.js"),__vite__mapDeps([0,1,2,3])),m=window.requestIdleCallback;if(m){const v=m(b);return()=>window.cancelIdleCallback?.(v)}const g=setTimeout(b,1500);return()=>clearTimeout(g)},[o,y]),n.jsx(x,{ref:a,sx:Q,children:r.endsWith(".malloynb")?n.jsx(ge,{resourceUri:R({environmentName:e,packageName:t,modelPath:r,versionId:s}),givens:i,onGivensChange:l,onNavigate:d,onDrillNavigate:u,maxResultSize:1024*1024}):n.jsx(G,{resourceUri:R({environmentName:e,packageName:t,versionId:s}),path:r,givens:i,onGivensChange:l,onNavigate:u,onLinkNavigate:d,onEvent:h,maxResultSize:1024*1024})})}function Je(){const[e,t]=f.useState(!1),s=f.useRef(!1),r=f.useRef(!1),o=f.useCallback(l=>{s.current=l,t(l)},[]),p=f.useCallback(()=>{r.current=!0},[]),a=je(f.useCallback(({currentLocation:l,nextLocation:c})=>s.current&&!r.current&&(l.pathname!==c.pathname||L(l.search)!==L(c.search)),[]));f.useEffect(()=>{if(!e)return;const l=c=>{c.preventDefault(),c.returnValue=""};return window.addEventListener("beforeunload",l),()=>window.removeEventListener("beforeunload",l)},[e]);const i=n.jsx(ke,{open:a.state==="blocked",canSave:!1,onKeepEditing:()=>a.reset?.(),onDiscard:()=>a.proceed?.()});return{onDirtyChange:o,leaving:p,dialog:i}}const Qe=X.lazy(()=>ee().then(e=>({default:e.ReportEditor}))),et=X.lazy(()=>ee().then(e=>({default:e.BuilderBar})));function tt(){const[e,t]=f.useState(null);return f.useEffect(()=>{t(document.getElementById("header-actions-portal"))},[]),e}function se({environmentName:e,packageName:t,path:s,layout:r="grid",onReady:o,quietLoading:p=!1,offstage:a=!1}){const i=Je();Ie();const[l]=f.useState(we),c=Ce(),{pathname:u,search:d}=D(),h=tt(),[y,b]=f.useState(),m=f.useRef(null),g=N();te(m,y!==void 0||g,o);const v=()=>c(`${u.replace(/\/$/,"")}${Be(d)}`),S=f.useMemo(()=>O({environmentName:e,packageName:t}),[e,t]),j=n.jsx(G,{resourceUri:R({environmentName:e,packageName:t}),path:s,manifestStaleTime:1e4});return n.jsxs(x,{ref:m,sx:Q,children:[n.jsx(Ee,{children:n.jsx(f.Suspense,{fallback:p?null:j,children:n.jsx(Qe,{resourceUri:R({environmentName:e,packageName:t}),path:s,layout:r,keepDraft:l,onDirtyChange:i.onDirtyChange,onExit:v,onOpenModel:k=>c(`/${[e,t,...k.split("/")].map(encodeURIComponent).join("/")}`),onEvent:S,loading:p?null:j,onControlsChange:b},`${e}/${t}/${s}`)})}),i.dialog,h&&!a&&Re.createPortal(n.jsx(f.Suspense,{fallback:n.jsx(H,{variant:"contained",disableElevation:!0,onClick:v,children:"Done"}),children:n.jsx(et,{controls:y,onDone:v})}),h)]})}function nt({environmentName:e,packageName:t,versionSegment:s,routePath:r,edit:o,reports:p,children:a}){const{search:i}=D(),l=d=>A(q(e,t,d),e,t,s),c=Se(r);if(!c)return n.jsx(n.Fragment,{children:a});const u=De(c.name,p,c.prefer);return"found"in u?n.jsx(K,{replace:!0,to:`${l(u.found.path)}${o?Z(i):i}`}):"ambiguous"in u?n.jsxs(x,{sx:$,children:[n.jsxs(C,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:["More than one report is named ",c.name]}),n.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:"}),n.jsx(x,{component:"ul",sx:{mt:1},children:u.ambiguous.map(d=>n.jsx("li",{children:n.jsx($e,{to:l(d),style:{fontFamily:Y},children:d})},d))})]}):n.jsx(n.Fragment,{children:a})}function st({environmentName:e,packageName:t,routePath:s,edit:r,notFound:o,notFoundUntilListed:p=!1,versionId:a,versionSegment:i,readOnly:l=!1}){const{reports:c,settled:u,isFetching:d,isError:h,refetch:y}=I(e,t,a),{search:b}=D(),m=`${s}.malloy`,g=u?Le(m,c):void 0,v=u&&!d&&!h,[S,j]=f.useState();f.useEffect(()=>{v&&j(m)},[v,m]);const k=g!==void 0||v||S===m,w=Ae(e,t,m,r&&!l&&k&&!g),T=re=>n.jsx(nt,{environmentName:e,packageName:t,...i!==void 0?{versionSegment:i}:{},routePath:s,edit:r,reports:c,children:re});if(!k&&(p&&!r&&!g))return T(o);if(!k&&h&&!d)return n.jsx(x,{sx:$,children:n.jsxs(Te,{severity:"warning",action:n.jsx(H,{color:"inherit",size:"small",onClick:()=>void y(),children:"Retry"}),children:["Could not list this package's reports, so this page cannot tell what is at ",s,"."]})});if(!k)return n.jsx(P,{text:U.opening()});if(g)return n.jsx(rt,{environmentName:e,packageName:t,...a!==void 0?{versionId:a}:{},path:g.path,editable:l?!1:g.editable,layout:g.layout,edit:r&&!l});const M=r?void 0:_e(s);return M!==void 0?n.jsx(K,{replace:!0,to:`${A(`/${e}/${t}/${M.split("/").map(encodeURIComponent).join("/")}`,e,t,i)}${Z(b)}`}):T(r&&!l?w.settled?n.jsx(se,{environmentName:e,packageName:t,path:m,layout:w.layout??"grid"}):n.jsx(P,{text:U.opening()}):o)}function rt({environmentName:e,packageName:t,versionId:s,path:r,editable:o,layout:p,edit:a}){const[i,l]=f.useState(a?"editor":"reader"),c=a?"editor":"reader",u=c==="reader"||i==="reader",d=c==="editor"||i==="editor",h={position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",overflow:"hidden"};return n.jsxs(x,{sx:{position:"relative"},"data-switching":u&&d||void 0,children:[u&&n.jsx(x,{sx:i==="reader"?void 0:h,"aria-hidden":i!=="reader"||void 0,children:n.jsx(ne,{environmentName:e,packageName:t,...s!==void 0?{versionId:s}:{},path:r,...o!==void 0?{editable:o}:{},onReady:()=>{a||l("reader")}})},"reader"),d&&n.jsx(x,{sx:i==="editor"?void 0:h,"aria-hidden":i!=="editor"||void 0,children:n.jsx(se,{environmentName:e,packageName:t,path:r,...p?{layout:p}:{},quietLoading:u,offstage:c!=="editor"||i!=="editor",onReady:()=>{a&&l("editor")}})},"editor")]})}function pt(){const e=Me(),{search:t}=D(),{path:s,versionId:r,versionSegment:o,writable:p}=J({always:!0}),{server:a}=Fe(),{params:i,onGivensChange:l}=z();if(!e.environmentName)return n.jsx("div",{children:n.jsx("h2",{children:"Missing environment name"})});if(!e.packageName)return n.jsx("div",{children:n.jsx("h2",{children:"Missing package name"})});if(s!==void 0&&s!==""&&!s.endsWith(".malloy")&&!s.endsWith(".malloynb")){const u=s.replace(/\/$/,""),d=u.startsWith("data-apps/"),h=d?n.jsx(Pe,{resourceUri:R({environmentName:e.environmentName,packageName:e.packageName,modelPath:u.slice(10),versionId:r})}):n.jsx(W,{environmentName:e.environmentName,packageName:e.packageName,modelPath:s,staticUrl:B({server:a,environmentName:e.environmentName,packageName:e.packageName,path:s,...r!==void 0?{versionId:r}:{}})});return n.jsx(st,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},...o!==void 0?{versionSegment:o}:{},readOnly:!p,routePath:u,edit:L(t),notFound:h,notFoundUntilListed:d})}const c=R({environmentName:e.environmentName,packageName:e.packageName,modelPath:s,versionId:r});return s?.endsWith(".malloy")?n.jsx(x,{sx:$,children:n.jsx(Ue,{resourceUri:c,runOnDemand:!0,maxResultSize:512*1024,givens:i,onGivensChange:l})}):s?.endsWith(".malloynb")?n.jsx(ne,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},path:s,editable:!1}):n.jsx(W,{environmentName:e.environmentName,packageName:e.packageName,modelPath:s??"",staticUrl:B({server:a,environmentName:e.environmentName,packageName:e.packageName,path:s??"",...r!==void 0?{versionId:r}:{}})})}function W({packageName:e,modelPath:t,staticUrl:s}){const r=/\.[^./]+$/.test(t),o={fontFamily:Y};return n.jsxs(x,{sx:$,children:[n.jsx(C,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Nothing to open at this path"}),n.jsxs(C,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[n.jsx(x,{component:"span",sx:o,children:t})," ","does not name a report, a"," ",n.jsx(x,{component:"span",sx:o,children:".malloy"})," ","or a"," ",n.jsx(x,{component:"span",sx:o,children:".malloynb"})," ","file in package"," ",n.jsx(x,{component:"span",sx:o,children:e}),". This address opens reports by their path without"," ",n.jsx(x,{component:"span",sx:o,children:".malloy"}),", and"," ",n.jsx(x,{component:"span",sx:o,children:".malloy"})," ","and"," ",n.jsx(x,{component:"span",sx:o,children:".malloynb"})," ","files."]}),r&&n.jsxs(C,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",n.jsx(x,{component:"span",sx:o,children:"public/"})," ","directory is served at ",n.jsx(He,{href:s,children:s}),"."]}),n.jsx(C,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its reports, models, and data apps."})]})}export{pt as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-CbR1CwU4.js","assets/index-BLi0H5mL.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-Dxax2bOe.js"])))=>i.map(i=>d[i]);
2
+ import{g as oe,a as ae,d8 as E,d9 as ie,r as f,u as le,h as ce,j as n,d as de,y as V,f as ue,s as pe,T as C,m as fe,d7 as he,da as F,p as xe,G as I,db as me,dc as ye,dd as q,de as z,a5 as O,F as N,I as x,df as ge,a7 as R,dg as G,a4 as ve,aw as be,dh as je,bp as ke,di as we,E as Ce,A as D,dj as Ee,as as Re,a2 as H,a3 as X,dk as Se,dl as De,a6 as K,dm as $e,dn as Y,H as Le,dp as Ae,a1 as Te,a0 as P,dq as U,C as Me,O as Fe,dr as Pe,ds as B,dt as Ue}from"./index-BLi0H5mL.js";import{i as L,w as Be,a as Z,l as _e}from"./documentRoutes-DFdmdaBX.js";import{v as We,w as A,u as J}from"./usePackageRoute-DzmKqWKq.js";import{u as Ve}from"./usePackageLinkNavigate-SMJdqHGs.js";import{T as Q,P as $}from"./PackageSplatRoute-CU3-BYcC.js";import{a as Ie,l as ee}from"./editPageMounted-CjmdfOM1.js";function qe(e){return oe("MuiLink",e)}const ze=ae("MuiLink",["root","underlineNone","underlineHover","underlineAlways","button","focusVisible"]),Oe=({theme:e,ownerState:t})=>{const s=t.color;if("colorSpace"in e&&e.colorSpace){const p=E(e,`palette.${s}.main`)||E(e,`palette.${s}`)||t.color;return e.alpha(p,.4)}const r=E(e,`palette.${s}.main`,!1)||E(e,`palette.${s}`,!1)||t.color,o=E(e,`palette.${s}.mainChannel`)||E(e,`palette.${s}Channel`);return"vars"in e&&o?`rgba(${o} / 0.4)`:ie(r,.4)},_={primary:!0,secondary:!0,error:!0,info:!0,success:!0,warning:!0,textPrimary:!0,textSecondary:!0,textDisabled:!0},Ne=e=>{const{classes:t,component:s,focusVisible:r,underline:o}=e,p={root:["root",`underline${V(o)}`,s==="button"&&"button",r&&"focusVisible"]};return ue(p,qe,t)},Ge=pe(C,{name:"MuiLink",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:s}=e;return[t.root,t[`underline${V(s.underline)}`],s.component==="button"&&t.button]}})(fe(({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:t,ownerState:s})=>t==="always"&&s.color!=="inherit",style:{textDecorationColor:"var(--Link-underlineColor)"}},{props:({underline:t,ownerState:s})=>t==="always"&&s.color==="inherit",style:e.colorSpace?{textDecorationColor:e.alpha("currentColor",.4)}:null},...Object.entries(e.palette).filter(he()).map(([t])=>({props:{underline:"always",color:t},style:{"--Link-underlineColor":e.alpha((e.vars||e).palette[t].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"},[`&.${ze.focusVisible}`]:{outline:"auto"}}}]}))),He=f.forwardRef(function(t,s){const r=le({props:t,name:"MuiLink"}),o=ce(),{className:p,color:a="primary",component:i="a",onBlur:l,onFocus:c,TypographyClasses:u,underline:d="always",variant:h="inherit",sx:y,...b}=r,[m,g]=f.useState(!1),v=w=>{F(w.target)||g(!1),l&&l(w)},S=w=>{F(w.target)&&g(!0),c&&c(w)},j={...r,color:a,component:i,focusVisible:m,underline:d,variant:h},k=Ne(j);return n.jsx(Ge,{color:a,className:de(k.root,p),classes:u,component:i,onBlur:v,onFocus:S,ref:s,ownerState:j,variant:h,...b,sx:[..._[a]===void 0?[{color:a}]:[],...Array.isArray(y)?y:[y]],style:{...b.style,...d==="always"&&a!=="inherit"&&!_[a]&&{"--Link-underlineColor":Oe({theme:o,ownerState:j})}}})});function Xe(e,t,s){const r=xe(),{reports:o,settled:p,isError:a}=I(e,t,We(s)),i=p&&!a;return f.useCallback((l,c)=>{const u=l.path;if(!me(u))return"malformed";const d=ye(u,o),h=A(q(e,t,d.kind==="path"?d.report.path:u),e,t,s),y=new URLSearchParams(l.givens).toString();return r(h+(y?`?${y}`:""),c),d.kind==="path"?"resolved":i?"unresolved":"unverified"},[r,e,t,s,o,i])}const Ke='[data-tile-kind="query"]',Ye=".malloy-render, .malloy-table, [role='alert'], .MuiAlert-root",Ze=3e3;function te(e,t,s,r){const o=f.useRef(s);o.current=s;const p=f.useRef(!1);f.useEffect(()=>{if(!o.current||p.current)return;let a=0;const i={},l=()=>{clearTimeout(u),i.beat!==void 0&&clearInterval(i.beat),cancelAnimationFrame(a),i.observer?.disconnect()},c=()=>{p.current||(p.current=!0,l(),o.current?.())},u=setTimeout(c,Ze);if(!t)return()=>clearTimeout(u);const d=()=>{const h=e.current;if(!h||r&&h.querySelector(r)===null)return;const y=window.innerHeight;[...h.querySelectorAll(Ke)].filter(m=>{if(m.getBoundingClientRect().top>=y)return!1;const v=m.querySelector(Ye);return!v||v.getBoundingClientRect().height<8}).length===0&&a===0&&(a=requestAnimationFrame(()=>{a=requestAnimationFrame(c)}))};return i.observer=new MutationObserver(d),e.current&&i.observer.observe(e.current,{childList:!0,subtree:!0}),i.beat=setInterval(d,50),d(),l},[t,e,r])}function ne({environmentName:e,packageName:t,versionId:s,path:r,editable:o=r.endsWith(".malloy"),onReady:p}){const a=f.useRef(null);te(a,!0,p,`.${be.report}`);const{params:i,onGivensChange:l}=z(),{versionSegment:c}=J(),u=Xe(e,t,c),d=Ve(e,t,c),h=f.useMemo(()=>O({environmentName:e,packageName:t}),[e,t]),y=N();return f.useEffect(()=>{if(!o||y)return;const b=()=>void ve(()=>import("./index.es-CbR1CwU4.js"),__vite__mapDeps([0,1,2,3])),m=window.requestIdleCallback;if(m){const v=m(b);return()=>window.cancelIdleCallback?.(v)}const g=setTimeout(b,1500);return()=>clearTimeout(g)},[o,y]),n.jsx(x,{ref:a,sx:Q,children:r.endsWith(".malloynb")?n.jsx(ge,{resourceUri:R({environmentName:e,packageName:t,modelPath:r,versionId:s}),givens:i,onGivensChange:l,onNavigate:d,onDrillNavigate:u,maxResultSize:1024*1024}):n.jsx(G,{resourceUri:R({environmentName:e,packageName:t,versionId:s}),path:r,givens:i,onGivensChange:l,onNavigate:u,onLinkNavigate:d,onEvent:h,maxResultSize:1024*1024})})}function Je(){const[e,t]=f.useState(!1),s=f.useRef(!1),r=f.useRef(!1),o=f.useCallback(l=>{s.current=l,t(l)},[]),p=f.useCallback(()=>{r.current=!0},[]),a=je(f.useCallback(({currentLocation:l,nextLocation:c})=>s.current&&!r.current&&(l.pathname!==c.pathname||L(l.search)!==L(c.search)),[]));f.useEffect(()=>{if(!e)return;const l=c=>{c.preventDefault(),c.returnValue=""};return window.addEventListener("beforeunload",l),()=>window.removeEventListener("beforeunload",l)},[e]);const i=n.jsx(ke,{open:a.state==="blocked",canSave:!1,onKeepEditing:()=>a.reset?.(),onDiscard:()=>a.proceed?.()});return{onDirtyChange:o,leaving:p,dialog:i}}const Qe=X.lazy(()=>ee().then(e=>({default:e.ReportEditor}))),et=X.lazy(()=>ee().then(e=>({default:e.BuilderBar})));function tt(){const[e,t]=f.useState(null);return f.useEffect(()=>{t(document.getElementById("header-actions-portal"))},[]),e}function se({environmentName:e,packageName:t,path:s,layout:r="grid",onReady:o,quietLoading:p=!1,offstage:a=!1}){const i=Je();Ie();const[l]=f.useState(we),c=Ce(),{pathname:u,search:d}=D(),h=tt(),[y,b]=f.useState(),m=f.useRef(null),g=N();te(m,y!==void 0||g,o);const v=()=>c(`${u.replace(/\/$/,"")}${Be(d)}`),S=f.useMemo(()=>O({environmentName:e,packageName:t}),[e,t]),j=n.jsx(G,{resourceUri:R({environmentName:e,packageName:t}),path:s,manifestStaleTime:1e4});return n.jsxs(x,{ref:m,sx:Q,children:[n.jsx(Ee,{children:n.jsx(f.Suspense,{fallback:p?null:j,children:n.jsx(Qe,{resourceUri:R({environmentName:e,packageName:t}),path:s,layout:r,keepDraft:l,onDirtyChange:i.onDirtyChange,onExit:v,onOpenModel:k=>c(`/${[e,t,...k.split("/")].map(encodeURIComponent).join("/")}`),onEvent:S,loading:p?null:j,onControlsChange:b},`${e}/${t}/${s}`)})}),i.dialog,h&&!a&&Re.createPortal(n.jsx(f.Suspense,{fallback:n.jsx(H,{variant:"contained",disableElevation:!0,onClick:v,children:"Done"}),children:n.jsx(et,{controls:y,onDone:v})}),h)]})}function nt({environmentName:e,packageName:t,versionSegment:s,routePath:r,edit:o,reports:p,children:a}){const{search:i}=D(),l=d=>A(q(e,t,d),e,t,s),c=Se(r);if(!c)return n.jsx(n.Fragment,{children:a});const u=De(c.name,p,c.prefer);return"found"in u?n.jsx(K,{replace:!0,to:`${l(u.found.path)}${o?Z(i):i}`}):"ambiguous"in u?n.jsxs(x,{sx:$,children:[n.jsxs(C,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:["More than one report is named ",c.name]}),n.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:"}),n.jsx(x,{component:"ul",sx:{mt:1},children:u.ambiguous.map(d=>n.jsx("li",{children:n.jsx($e,{to:l(d),style:{fontFamily:Y},children:d})},d))})]}):n.jsx(n.Fragment,{children:a})}function st({environmentName:e,packageName:t,routePath:s,edit:r,notFound:o,notFoundUntilListed:p=!1,versionId:a,versionSegment:i,readOnly:l=!1}){const{reports:c,settled:u,isFetching:d,isError:h,refetch:y}=I(e,t,a),{search:b}=D(),m=`${s}.malloy`,g=u?Le(m,c):void 0,v=u&&!d&&!h,[S,j]=f.useState();f.useEffect(()=>{v&&j(m)},[v,m]);const k=g!==void 0||v||S===m,w=Ae(e,t,m,r&&!l&&k&&!g),T=re=>n.jsx(nt,{environmentName:e,packageName:t,...i!==void 0?{versionSegment:i}:{},routePath:s,edit:r,reports:c,children:re});if(!k&&(p&&!r&&!g))return T(o);if(!k&&h&&!d)return n.jsx(x,{sx:$,children:n.jsxs(Te,{severity:"warning",action:n.jsx(H,{color:"inherit",size:"small",onClick:()=>void y(),children:"Retry"}),children:["Could not list this package's reports, so this page cannot tell what is at ",s,"."]})});if(!k)return n.jsx(P,{text:U.opening()});if(g)return n.jsx(rt,{environmentName:e,packageName:t,...a!==void 0?{versionId:a}:{},path:g.path,editable:l?!1:g.editable,layout:g.layout,edit:r&&!l});const M=r?void 0:_e(s);return M!==void 0?n.jsx(K,{replace:!0,to:`${A(`/${e}/${t}/${M.split("/").map(encodeURIComponent).join("/")}`,e,t,i)}${Z(b)}`}):T(r&&!l?w.settled?n.jsx(se,{environmentName:e,packageName:t,path:m,layout:w.layout??"grid"}):n.jsx(P,{text:U.opening()}):o)}function rt({environmentName:e,packageName:t,versionId:s,path:r,editable:o,layout:p,edit:a}){const[i,l]=f.useState(a?"editor":"reader"),c=a?"editor":"reader",u=c==="reader"||i==="reader",d=c==="editor"||i==="editor",h={position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",overflow:"hidden"};return n.jsxs(x,{sx:{position:"relative"},"data-switching":u&&d||void 0,children:[u&&n.jsx(x,{sx:i==="reader"?void 0:h,"aria-hidden":i!=="reader"||void 0,children:n.jsx(ne,{environmentName:e,packageName:t,...s!==void 0?{versionId:s}:{},path:r,...o!==void 0?{editable:o}:{},onReady:()=>{a||l("reader")}})},"reader"),d&&n.jsx(x,{sx:i==="editor"?void 0:h,"aria-hidden":i!=="editor"||void 0,children:n.jsx(se,{environmentName:e,packageName:t,path:r,...p?{layout:p}:{},quietLoading:u,offstage:c!=="editor"||i!=="editor",onReady:()=>{a&&l("editor")}})},"editor")]})}function pt(){const e=Me(),{search:t}=D(),{path:s,versionId:r,versionSegment:o,writable:p}=J({always:!0}),{server:a}=Fe(),{params:i,onGivensChange:l}=z();if(!e.environmentName)return n.jsx("div",{children:n.jsx("h2",{children:"Missing environment name"})});if(!e.packageName)return n.jsx("div",{children:n.jsx("h2",{children:"Missing package name"})});if(s!==void 0&&s!==""&&!s.endsWith(".malloy")&&!s.endsWith(".malloynb")){const u=s.replace(/\/$/,""),d=u.startsWith("data-apps/"),h=d?n.jsx(Pe,{resourceUri:R({environmentName:e.environmentName,packageName:e.packageName,modelPath:u.slice(10),versionId:r})}):n.jsx(W,{environmentName:e.environmentName,packageName:e.packageName,modelPath:s,staticUrl:B({server:a,environmentName:e.environmentName,packageName:e.packageName,path:s,...r!==void 0?{versionId:r}:{}})});return n.jsx(st,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},...o!==void 0?{versionSegment:o}:{},readOnly:!p,routePath:u,edit:L(t),notFound:h,notFoundUntilListed:d})}const c=R({environmentName:e.environmentName,packageName:e.packageName,modelPath:s,versionId:r});return s?.endsWith(".malloy")?n.jsx(x,{sx:$,children:n.jsx(Ue,{resourceUri:c,runOnDemand:!0,maxResultSize:512*1024,givens:i,onGivensChange:l})}):s?.endsWith(".malloynb")?n.jsx(ne,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},path:s,editable:!1}):n.jsx(W,{environmentName:e.environmentName,packageName:e.packageName,modelPath:s??"",staticUrl:B({server:a,environmentName:e.environmentName,packageName:e.packageName,path:s??"",...r!==void 0?{versionId:r}:{}})})}function W({packageName:e,modelPath:t,staticUrl:s}){const r=/\.[^./]+$/.test(t),o={fontFamily:Y};return n.jsxs(x,{sx:$,children:[n.jsx(C,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Nothing to open at this path"}),n.jsxs(C,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[n.jsx(x,{component:"span",sx:o,children:t})," ","does not name a report, a"," ",n.jsx(x,{component:"span",sx:o,children:".malloy"})," ","or a"," ",n.jsx(x,{component:"span",sx:o,children:".malloynb"})," ","file in package"," ",n.jsx(x,{component:"span",sx:o,children:e}),". This address opens reports by their path without"," ",n.jsx(x,{component:"span",sx:o,children:".malloy"}),", and"," ",n.jsx(x,{component:"span",sx:o,children:".malloy"})," ","and"," ",n.jsx(x,{component:"span",sx:o,children:".malloynb"})," ","files."]}),r&&n.jsxs(C,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",n.jsx(x,{component:"span",sx:o,children:"public/"})," ","directory is served at ",n.jsx(He,{href:s,children:s}),"."]}),n.jsx(C,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its reports, models, and data apps."})]})}export{pt as default};
@@ -1 +1 @@
1
- import{A as x,p as N,E as f,r as h,a5 as j,j as n,a6 as E,a7 as P,a8 as R}from"./index-D8JKtZm5.js";import{d as L}from"./documentRoutes-DnpGGXs4.js";import{u as M,p as r,L as c}from"./usePackageRoute-BUdFd5dP.js";import{u as S}from"./usePackageLinkNavigate-DpGlRKnc.js";function $(){const{environmentName:e,packageName:a,versionSegment:o,versionId:m,versioned:u}=M({always:!0}),{search:p}=x(),g=N(),v=f(),i=S(e??"",a??"",o),l=h.useMemo(()=>j({environmentName:e??"",packageName:a??""}),[e,a]);if(e){if(!a)return n.jsx("div",{children:n.jsx("h2",{children:"Missing package name"})})}else return n.jsx("div",{children:n.jsx("h2",{children:"Missing environment name"})});if(u&&o===void 0)return n.jsx(E,{to:`${r(e,a,c)}${p}`,replace:!0});const d=P({environmentName:e,packageName:a,versionId:m});return n.jsx(R,{onClickPackageFile:i,onOpenDocument:({path:s,mode:t},k)=>i(L(e,a,s,t),k),onSelectVersion:(s,t)=>g(r(e,a,s),t),onReplaceVersion:s=>v(r(e,a,s??c),{replace:!0}),resourceUri:d,onEvent:l})}export{$ as default};
1
+ import{A as x,p as N,E as f,r as h,a5 as j,j as n,a6 as E,a7 as P,a8 as R}from"./index-BLi0H5mL.js";import{d as L}from"./documentRoutes-DFdmdaBX.js";import{u as M,p as r,L as c}from"./usePackageRoute-DzmKqWKq.js";import{u as S}from"./usePackageLinkNavigate-SMJdqHGs.js";function $(){const{environmentName:e,packageName:a,versionSegment:o,versionId:m,versioned:u}=M({always:!0}),{search:p}=x(),g=N(),v=f(),i=S(e??"",a??"",o),l=h.useMemo(()=>j({environmentName:e??"",packageName:a??""}),[e,a]);if(e){if(!a)return n.jsx("div",{children:n.jsx("h2",{children:"Missing package name"})})}else return n.jsx("div",{children:n.jsx("h2",{children:"Missing environment name"})});if(u&&o===void 0)return n.jsx(E,{to:`${r(e,a,c)}${p}`,replace:!0});const d=P({environmentName:e,packageName:a,versionId:m});return n.jsx(R,{onClickPackageFile:i,onOpenDocument:({path:s,mode:t},k)=>i(L(e,a,s,t),k),onSelectVersion:(s,t)=>g(r(e,a,s),t),onReplaceVersion:s=>v(r(e,a,s??c),{replace:!0}),resourceUri:d,onEvent:l})}export{$ as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelPage-GZ6hXGgw.js","assets/index-D8JKtZm5.js","assets/index-DUqldpo0.css","assets/documentRoutes-DnpGGXs4.js","assets/usePackageRoute-BUdFd5dP.js","assets/usePackageLinkNavigate-DpGlRKnc.js","assets/editPageMounted-efTmRdGK.js","assets/PackagePage-_5vFWxqm.js"])))=>i.map(i=>d[i]);
2
- import{A as P,E as g,r as h,j as e,I as x,a1 as f,a2 as A,a3 as c,a4 as d}from"./index-D8JKtZm5.js";import{u as R,w as S,L as T}from"./usePackageRoute-BUdFd5dP.js";const j=1200,u={p:3,maxWidth:j,mx:"auto"},b={...u,pt:6},y=c.lazy(()=>d(()=>import("./ModelPage-GZ6hXGgw.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),k=c.lazy(()=>d(()=>import("./PackagePage-_5vFWxqm.js"),__vite__mapDeps([7,1,2,3,4,5])));function L(){const{environmentName:l,packageName:_,versionSegment:s,path:a,versioned:p,deciding:m,undecided:E,retry:v}=R({always:!0}),{pathname:o,search:r,hash:n}=P(),i=g(),t=p&&s===void 0?S(o,l??"",_??"",T):void 0;return h.useEffect(()=>{t!==void 0&&t!==o&&i(`${t}${r}${n}`,{replace:!0})},[t,o,r,n,i]),m?null:E?e.jsx(x,{sx:u,children:e.jsx(f,{severity:"error",action:e.jsx(A,{color:"inherit",size:"small",onClick:v,children:"Retry"}),children:"Could not read this package's versions, so this address can't be opened yet."})}):s!==void 0&&(a===void 0||a===""||a==="/")?e.jsx(k,{}):e.jsx(y,{})}const z=Object.freeze(Object.defineProperty({__proto__:null,default:L},Symbol.toStringTag,{value:"Module"}));export{u as P,b as T,z as a};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelPage-DC5HfNar.js","assets/index-BLi0H5mL.js","assets/index-DUqldpo0.css","assets/documentRoutes-DFdmdaBX.js","assets/usePackageRoute-DzmKqWKq.js","assets/usePackageLinkNavigate-SMJdqHGs.js","assets/editPageMounted-CjmdfOM1.js","assets/PackagePage-DRKFqQHw.js"])))=>i.map(i=>d[i]);
2
+ import{A as P,E as g,r as h,j as e,I as x,a1 as f,a2 as A,a3 as c,a4 as d}from"./index-BLi0H5mL.js";import{u as R,w as S,L as T}from"./usePackageRoute-DzmKqWKq.js";const j=1200,u={p:3,maxWidth:j,mx:"auto"},b={...u,pt:6},y=c.lazy(()=>d(()=>import("./ModelPage-DC5HfNar.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),k=c.lazy(()=>d(()=>import("./PackagePage-DRKFqQHw.js"),__vite__mapDeps([7,1,2,3,4,5])));function L(){const{environmentName:l,packageName:_,versionSegment:s,path:a,versioned:p,deciding:m,undecided:E,retry:v}=R({always:!0}),{pathname:o,search:r,hash:n}=P(),i=g(),t=p&&s===void 0?S(o,l??"",_??"",T):void 0;return h.useEffect(()=>{t!==void 0&&t!==o&&i(`${t}${r}${n}`,{replace:!0})},[t,o,r,n,i]),m?null:E?e.jsx(x,{sx:u,children:e.jsx(f,{severity:"error",action:e.jsx(A,{color:"inherit",size:"small",onClick:v,children:"Retry"}),children:"Could not read this package's versions, so this address can't be opened yet."})}):s!==void 0&&(a===void 0||a===""||a==="/")?e.jsx(k,{}):e.jsx(y,{})}const z=Object.freeze(Object.defineProperty({__proto__:null,default:L},Symbol.toStringTag,{value:"Module"}));export{u as P,b as T,z as a};
@@ -1,4 +1,4 @@
1
- import{aw as fe,j as O,I as ie,r as g,ax as pe,U as ge,ay as ve,ah as we,az as ke,aA as G,aB as H,aC as xe,aD as Ce,aE as Ae,aF as De,aG as Ee,aH as Se,aI as ze,aJ as ue,aK as se}from"./index-D8JKtZm5.js";const v=fe.drillCell;function $e(e,t){const r=new Set;let a;try{a=e.getMetadata()?.getAllFields()??[]}catch{return r}const o=new Set;for(const n of a)!n||t(n)||n.tag?.tag("hidden")===void 0&&o.add(n.tag?.text("label")??n.name);for(const n of a){if(!n||!t(n))continue;const l=n.tag?.text("label")??n.name;o.has(l)||r.add(l)}return r}function I(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function Fe(e,t){if(t.size!==0)for(const r of e.querySelectorAll(".malloy-table")){const a=l=>l.closest(".malloy-table")===r,o=new Set;for(const l of r.querySelectorAll(".column-cell.th")){if(!a(l))continue;const i=(l.textContent??"").replace(/\u200b/g,"").trim(),b=I(l);b&&t.has(i)&&o.add(b)}if(o.size===0)continue;const n=new Set;for(const l of r.querySelectorAll(`.${v}[tabindex="0"]`)){if(!a(l))continue;const i=I(l);i&&(n.has(i)?l.tabIndex=-1:n.add(i))}for(const l of r.querySelectorAll(".column-cell.td")){if(!a(l))continue;const i=I(l),b=!l.querySelector(".value-null")&&(l.textContent??"").trim()!=="";if(i&&b&&o.has(i)&&!l.querySelector(".malloy-table")){if(l.classList.add(v),l.tabIndex===0)n.add(i);else{const f=n.has(i);f||n.add(i),l.tabIndex=f?-1:0}l.setAttribute("role","button")}}}}function je(e){const t=e.closest(".malloy-table"),r=I(e);return!t||!r?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(a=>a.closest(".malloy-table")===t&&I(a)===r)}function de(e,t){const r=je(e),a=r.indexOf(e);if(a===-1)return;const o=t==="first"?r[0]:t==="last"?r[r.length-1]:r[Math.min(Math.max(a+t,0),r.length-1)];if(o){for(const n of r)n.tabIndex=n===o?0:-1;return o}}function Re(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 Me(e){const{foreground:t,axisFaint:r,gridline:a,font:o}=e,n={background:e.background,font:o.family,title:{color:t,font:o.family},axis:{labelColor:t,titleColor:t,domainColor:r,tickColor:r,gridColor:a,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}},l={...n,legend:{...n.legend,orient:"bottom"}};return i=>i==="shape_map"?l:n}function Te(e){if(!e)return;const t=e.tag("theme");if(!t)return;const r={},a=t.tag("palette");if(a){const n={},l=a.textArray("series");l&&l.length>0&&(n.series=l);for(const i of pe){const b=a.tag(i);if(!b)continue;const f={},x=b.text("light"),k=b.text("dark");x&&(f.light=x),k&&(f.dark=k),Object.keys(f).length>0&&(n[i]=f)}Object.keys(n).length>0&&(r.palette=n)}const o=t.tag("font");if(o){const n={},l=o.text("family");l&&(n.family=l);const i=o.numeric("size");typeof i=="number"&&Number.isFinite(i)&&(n.size=i),Object.keys(n).length>0&&(r.font=n)}return Object.keys(r).length>0?r:void 0}const Q=e=>(e??[]).map(t=>t?.value).filter(t=>typeof t=="string");function _e(e){const t=e.replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const Oe=e=>Q(e.annotations).some(t=>{const r=t.trim();return/^#[^("]/.test(r)&&/(?:^#|[\s{])label\s*=/.test(r)}),Be=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Ie=e=>e.type?.element_type?.fields??e.type?.fields;function me(e,t){let r=!1;return{fields:e.map(a=>{const o=Ie(a);if(o){const l=me(o,ue(Q(a.annotations)));if(!l.changed)return a;r=!0;const i=a.type?.element_type?{...a.type,element_type:{...a.type.element_type,fields:l.fields}}:{...a.type,fields:l.fields};return{...a,type:i}}if(!t||!a.name||Oe(a))return a;const n=_e(a.name);return n===a.name?a:(r=!0,{...a,annotations:[{value:`# label=${Be(n)}
1
+ import{aw as fe,j as O,I as ie,r as g,ax as pe,U as ge,ay as ve,ah as we,az as ke,aA as G,aB as H,aC as xe,aD as Ce,aE as Ae,aF as De,aG as Ee,aH as Se,aI as ze,aJ as ue,aK as se}from"./index-BLi0H5mL.js";const v=fe.drillCell;function $e(e,t){const r=new Set;let a;try{a=e.getMetadata()?.getAllFields()??[]}catch{return r}const o=new Set;for(const n of a)!n||t(n)||n.tag?.tag("hidden")===void 0&&o.add(n.tag?.text("label")??n.name);for(const n of a){if(!n||!t(n))continue;const l=n.tag?.text("label")??n.name;o.has(l)||r.add(l)}return r}function I(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function Fe(e,t){if(t.size!==0)for(const r of e.querySelectorAll(".malloy-table")){const a=l=>l.closest(".malloy-table")===r,o=new Set;for(const l of r.querySelectorAll(".column-cell.th")){if(!a(l))continue;const i=(l.textContent??"").replace(/\u200b/g,"").trim(),b=I(l);b&&t.has(i)&&o.add(b)}if(o.size===0)continue;const n=new Set;for(const l of r.querySelectorAll(`.${v}[tabindex="0"]`)){if(!a(l))continue;const i=I(l);i&&(n.has(i)?l.tabIndex=-1:n.add(i))}for(const l of r.querySelectorAll(".column-cell.td")){if(!a(l))continue;const i=I(l),b=!l.querySelector(".value-null")&&(l.textContent??"").trim()!=="";if(i&&b&&o.has(i)&&!l.querySelector(".malloy-table")){if(l.classList.add(v),l.tabIndex===0)n.add(i);else{const f=n.has(i);f||n.add(i),l.tabIndex=f?-1:0}l.setAttribute("role","button")}}}}function je(e){const t=e.closest(".malloy-table"),r=I(e);return!t||!r?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(a=>a.closest(".malloy-table")===t&&I(a)===r)}function de(e,t){const r=je(e),a=r.indexOf(e);if(a===-1)return;const o=t==="first"?r[0]:t==="last"?r[r.length-1]:r[Math.min(Math.max(a+t,0),r.length-1)];if(o){for(const n of r)n.tabIndex=n===o?0:-1;return o}}function Re(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 Me(e){const{foreground:t,axisFaint:r,gridline:a,font:o}=e,n={background:e.background,font:o.family,title:{color:t,font:o.family},axis:{labelColor:t,titleColor:t,domainColor:r,tickColor:r,gridColor:a,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}},l={...n,legend:{...n.legend,orient:"bottom"}};return i=>i==="shape_map"?l:n}function Te(e){if(!e)return;const t=e.tag("theme");if(!t)return;const r={},a=t.tag("palette");if(a){const n={},l=a.textArray("series");l&&l.length>0&&(n.series=l);for(const i of pe){const b=a.tag(i);if(!b)continue;const f={},x=b.text("light"),k=b.text("dark");x&&(f.light=x),k&&(f.dark=k),Object.keys(f).length>0&&(n[i]=f)}Object.keys(n).length>0&&(r.palette=n)}const o=t.tag("font");if(o){const n={},l=o.text("family");l&&(n.family=l);const i=o.numeric("size");typeof i=="number"&&Number.isFinite(i)&&(n.size=i),Object.keys(n).length>0&&(r.font=n)}return Object.keys(r).length>0?r:void 0}const Q=e=>(e??[]).map(t=>t?.value).filter(t=>typeof t=="string");function _e(e){const t=e.replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const Oe=e=>Q(e.annotations).some(t=>{const r=t.trim();return/^#[^("]/.test(r)&&/(?:^#|[\s{])label\s*=/.test(r)}),Be=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Ie=e=>e.type?.element_type?.fields??e.type?.fields;function me(e,t){let r=!1;return{fields:e.map(a=>{const o=Ie(a);if(o){const l=me(o,ue(Q(a.annotations)));if(!l.changed)return a;r=!0;const i=a.type?.element_type?{...a.type,element_type:{...a.type.element_type,fields:l.fields}}:{...a.type,fields:l.fields};return{...a,type:i}}if(!t||!a.name||Oe(a))return a;const n=_e(a.name);return n===a.name?a:(r=!0,{...a,annotations:[{value:`# label=${Be(n)}
2
2
  `},...a.annotations??[]]})}),changed:r}}function Le(e){if(!e||typeof e!="object")return e;const t=e,r=t.schema?.fields;if(!Array.isArray(r))return e;const{fields:a,changed:o}=me(r,ue(Q(t.annotations)));return o?{...t,schema:{...t.schema,fields:a}}:e}const ce=320,qe=10,Ne=96,Pe=4e3;function Ye(e,t){if(e!=="bar"&&e!=="combo"&&e!=="line"&&e!=="chart"&&e!=="scatter_chart")return;if(e!=="bar"&&e!=="combo")return ce;const r=t?.data?.array_value?.length,a=r===void 0?0:r*qe+Ne;return Math.min(Math.max(ce,a),Pe)}function He(e){let t;return{onClick:r=>{const a={...r,...Ue(r)};t=a,queueMicrotask(()=>{t===a&&(t=void 0),e(a)})},onDrill:r=>{const a=t;t=void 0,a&&r.stableDrillClauses!==void 0&&(a.drillClauses=r.stableDrillClauses)}}}function Ue(e){const t=e.field;try{const r=t?.getEffectiveQueryTimezone?.();return r?{timezone:r}:{}}catch{return{}}}function Ve(e){const t=r=>{let a=!1;try{a=r.isArray?.()===!0}catch{a=!1}a&&"stableDrillFilters"in r&&Object.defineProperty(r,"stableDrillFilters",{configurable:!0,get:()=>[]});for(const o of r.fields??[])t(o)};e&&t(e)}const B="data-publisher-fill",Ke=async(e,t,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:a}=await Ce();return new a({onClick:t,...r?{onDrill:r,tableConfig:{enableDrill:!0}}:{},vegaConfigOverride:Me(e),theme:Re(e),onError:o=>{console.error("Error rendering visualization:",typeof o,o)}}).createViz()};async function We(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 a;try{({parseAnnotation:a}=await xe())}catch{return}try{const{tag:o}=a(r);return Te(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 a=Ae(t,r);for(const[o,n]of Object.entries(a))e.style.setProperty(o,n)}const Xe=`
3
3
  /* Card geometry, through the renderer's OWN theme vars rather than over the top
4
4
  of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
@@ -1 +1 @@
1
- import{ab as o,j as r,ac as s,ad as n,I as t,T as a}from"./index-D8JKtZm5.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-BLi0H5mL.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};