@malloy-publisher/app 0.13.1 → 0.14.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 (24) hide show
  1. package/dist/api-doc.yaml +198 -105
  2. package/dist/assets/{EnvironmentPage-B74sWMJb.js → EnvironmentPage-CX8dwMPh.js} +1 -1
  3. package/dist/assets/{HomePage-BOb2eaod.js → HomePage-C7yrR-ec.js} +1 -1
  4. package/dist/assets/{MainPage-D6QvMDBc.js → MainPage-BKs7CeWW.js} +1 -1
  5. package/dist/assets/{ModelPage-DOac8VF3.js → ModelPage-BGlX8geE.js} +2 -2
  6. package/dist/assets/{PackagePage-CpahRMLt.js → PackagePage-Bd5y7ILU.js} +1 -1
  7. package/dist/assets/PackageSplatRoute-Cw-yA9CE.js +2 -0
  8. package/dist/assets/{RenderedResult-D5HJr2Xo.es-CFweT1ny.js → RenderedResult-D0kAzSrP.es-DldjGxsY.js} +3 -3
  9. package/dist/assets/{RouteError-r7ydeLAE.js → RouteError-BJHAXzBN.js} +1 -1
  10. package/dist/assets/{ThemeEditorPage-dxaIYM0S.js → ThemeEditorPage-yUJpFBCR.js} +1 -1
  11. package/dist/assets/{ToggleButtonGroup-B8CQst36.js → ToggleButtonGroup-BoCnLGaG.js} +1 -1
  12. package/dist/assets/{documentRoutes-Dn5OclPv.js → documentRoutes-CIhmKz4i.js} +1 -1
  13. package/dist/assets/{editPageMounted-BXWQAQvv.js → editPageMounted-B5IyuuMZ.js} +2 -2
  14. package/dist/assets/{index-jw6yCO3t.js → index-B6DUq-GT.js} +1 -1
  15. package/dist/assets/{index-C2rpVa58.js → index-DTKG_ab2.js} +1 -1
  16. package/dist/assets/{index-D3PvzI_V.js → index-DqJz_hGj.js} +119 -119
  17. package/dist/assets/{index-BiZnC_i6.js → index-DrMbh_v4.js} +1 -1
  18. package/dist/assets/{index.es-BfpodLFo.js → index.es-VBpWc8yM.js} +1 -1
  19. package/dist/assets/usePackageLinkNavigate-BcERmCFv.js +1 -0
  20. package/dist/assets/{usePackageRoute-CwvWFoYD.js → usePackageRoute-CTkLtO3i.js} +1 -1
  21. package/dist/index.html +1 -1
  22. package/package.json +2 -2
  23. package/dist/assets/PackageSplatRoute-BBPH3864.js +0 -2
  24. package/dist/assets/usePackageLinkNavigate-CpjXFkgK.js +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-BfpodLFo.js","assets/index-D3PvzI_V.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-B8CQst36.js"])))=>i.map(i=>d[i]);
2
- import{_ as te,E as B,r as f,d7 as se,d8 as ne,d9 as U,da as W,a5 as q,D as z,j as t,H as x,db as re,a7 as E,dc as I,a4 as oe,az as ae,dd as ie,bn as ce,de as le,C as de,z as R,df as ue,as as fe,a2 as O,a3 as G,dg as he,dh as pe,a6 as N,T as w,di as xe,dj as H,G as me,dk as ge,a1 as ve,a0 as P,dl as _,A as je,N as ye,dm as be,dn as L,dp as we,dq as Ee}from"./index-D3PvzI_V.js";import{i as D,w as ke,a as V,l as Re}from"./documentRoutes-Dn5OclPv.js";import{v as Se,w as A,u as K}from"./usePackageRoute-CwvWFoYD.js";import{u as Ce}from"./usePackageLinkNavigate-CpjXFkgK.js";import{T as X,P as S}from"./PackageSplatRoute-BBPH3864.js";import{a as De,l as Y}from"./editPageMounted-BXWQAQvv.js";function Ae(e,s,n){const r=te(),{reports:a,settled:h,isError:c}=B(e,s,Se(n)),o=h&&!c;return f.useCallback((i,l)=>{const u=i.path;if(!se(u))return"malformed";const d=ne(u,a),p=A(U(e,s,d.kind==="path"?d.report.path:u),e,s,n),g=new URLSearchParams(i.givens).toString();return r(p+(g?`?${g}`:""),l),d.kind==="path"?"resolved":o?"unresolved":"unverified"},[r,e,s,n,a,o])}const Te='[data-tile-kind="query"]',$e=".malloy-render, .malloy-table, [role='alert'], .MuiAlert-root",Me=3e3;function Z(e,s,n,r){const a=f.useRef(n);a.current=n;const h=f.useRef(!1);f.useEffect(()=>{if(!a.current||h.current)return;let c=0;const o={},i=()=>{clearTimeout(u),o.beat!==void 0&&clearInterval(o.beat),cancelAnimationFrame(c),o.observer?.disconnect()},l=()=>{h.current||(h.current=!0,i(),a.current?.())},u=setTimeout(l,Me);if(!s)return()=>clearTimeout(u);const d=()=>{const p=e.current;if(!p||r&&p.querySelector(r)===null)return;const g=window.innerHeight;[...p.querySelectorAll(Te)].filter(m=>{if(m.getBoundingClientRect().top>=g)return!1;const j=m.querySelector($e);return!j||j.getBoundingClientRect().height<8}).length===0&&c===0&&(c=requestAnimationFrame(()=>{c=requestAnimationFrame(l)}))};return o.observer=new MutationObserver(d),e.current&&o.observer.observe(e.current,{childList:!0,subtree:!0}),o.beat=setInterval(d,50),d(),i},[s,e,r])}function J({environmentName:e,packageName:s,versionId:n,path:r,editable:a=r.endsWith(".malloy"),onReady:h}){const c=f.useRef(null);Z(c,!0,h,`.${ae.report}`);const{params:o,onGivensChange:i}=W(),{versionSegment:l}=K(),u=Ae(e,s,l),d=Ce(e,s,l),p=f.useMemo(()=>q({environmentName:e,packageName:s}),[e,s]),g=z();return f.useEffect(()=>{if(!a||g)return;const y=()=>void oe(()=>import("./index.es-BfpodLFo.js"),__vite__mapDeps([0,1,2,3])),m=window.requestIdleCallback;if(m){const j=m(y);return()=>window.cancelIdleCallback?.(j)}const v=setTimeout(y,1500);return()=>clearTimeout(v)},[a,g]),t.jsx(x,{ref:c,sx:X,children:r.endsWith(".malloynb")?t.jsx(re,{resourceUri:E({environmentName:e,packageName:s,modelPath:r,versionId:n}),givens:o,onGivensChange:i,onNavigate:d,onDrillNavigate:u,maxResultSize:1024*1024}):t.jsx(I,{resourceUri:E({environmentName:e,packageName:s,versionId:n}),path:r,givens:o,onGivensChange:i,onNavigate:u,onLinkNavigate:d,onEvent:p,maxResultSize:1024*1024})})}function Pe(){const[e,s]=f.useState(!1),n=f.useRef(!1),r=f.useRef(!1),a=f.useCallback(i=>{n.current=i,s(i)},[]),h=f.useCallback(()=>{r.current=!0},[]),c=ie(f.useCallback(({currentLocation:i,nextLocation:l})=>n.current&&!r.current&&(i.pathname!==l.pathname||D(i.search)!==D(l.search)),[]));f.useEffect(()=>{if(!e)return;const i=l=>{l.preventDefault(),l.returnValue=""};return window.addEventListener("beforeunload",i),()=>window.removeEventListener("beforeunload",i)},[e]);const o=t.jsx(ce,{open:c.state==="blocked",canSave:!1,onKeepEditing:()=>c.reset?.(),onDiscard:()=>c.proceed?.()});return{onDirtyChange:a,leaving:h,dialog:o}}const _e=G.lazy(()=>Y().then(e=>({default:e.ReportEditor}))),Le=G.lazy(()=>Y().then(e=>({default:e.BuilderBar})));function Fe(){const[e,s]=f.useState(null);return f.useEffect(()=>{s(document.getElementById("header-actions-portal"))},[]),e}function Q({environmentName:e,packageName:s,path:n,layout:r="grid",onReady:a,quietLoading:h=!1,offstage:c=!1}){const o=Pe();De();const[i]=f.useState(le),l=de(),{pathname:u,search:d}=R(),p=Fe(),[g,y]=f.useState(),m=f.useRef(null),v=z();Z(m,g!==void 0||v,a);const j=()=>l(`${u.replace(/\/$/,"")}${ke(d)}`),C=f.useMemo(()=>q({environmentName:e,packageName:s}),[e,s]),k=t.jsx(I,{resourceUri:E({environmentName:e,packageName:s}),path:n,manifestStaleTime:1e4});return t.jsxs(x,{ref:m,sx:X,children:[t.jsx(ue,{children:t.jsx(f.Suspense,{fallback:h?null:k,children:t.jsx(_e,{resourceUri:E({environmentName:e,packageName:s}),path:n,layout:r,keepDraft:i,onDirtyChange:o.onDirtyChange,onExit:j,onOpenModel:b=>l(`/${[e,s,...b.split("/")].map(encodeURIComponent).join("/")}`),onEvent:C,loading:h?null:k,onControlsChange:y},`${e}/${s}/${n}`)})}),o.dialog,p&&!c&&fe.createPortal(t.jsx(f.Suspense,{fallback:t.jsx(O,{variant:"contained",disableElevation:!0,onClick:j,children:"Done"}),children:t.jsx(Le,{controls:g,onDone:j})}),p)]})}function Be({environmentName:e,packageName:s,versionSegment:n,routePath:r,edit:a,reports:h,children:c}){const{search:o}=R(),i=d=>A(U(e,s,d),e,s,n),l=he(r);if(!l)return t.jsx(t.Fragment,{children:c});const u=pe(l.name,h,l.prefer);return"found"in u?t.jsx(N,{replace:!0,to:`${i(u.found.path)}${a?V(o):o}`}):"ambiguous"in u?t.jsxs(x,{sx:S,children:[t.jsxs(w,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:["More than one report is named ",l.name]}),t.jsx(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"This is an old link, which names a report by its file name alone. Open one by its path:"}),t.jsx(x,{component:"ul",sx:{mt:1},children:u.ambiguous.map(d=>t.jsx("li",{children:t.jsx(xe,{to:i(d),style:{fontFamily:H},children:d})},d))})]}):t.jsx(t.Fragment,{children:c})}function Ue({environmentName:e,packageName:s,routePath:n,edit:r,notFound:a,notFoundUntilListed:h=!1,versionId:c,versionSegment:o,readOnly:i=!1}){const{reports:l,settled:u,isFetching:d,isError:p,refetch:g}=B(e,s,c),{search:y}=R(),m=`${n}.malloy`,v=u?me(m,l):void 0,j=u&&!d&&!p,[C,k]=f.useState();f.useEffect(()=>{j&&k(m)},[j,m]);const b=v!==void 0||j||C===m,T=ge(e,s,m,r&&!i&&b&&!v),$=ee=>t.jsx(Be,{environmentName:e,packageName:s,...o!==void 0?{versionSegment:o}:{},routePath:n,edit:r,reports:l,children:ee});if(!b&&(h&&!r&&!v))return $(a);if(!b&&p&&!d)return t.jsx(x,{sx:S,children:t.jsxs(ve,{severity:"warning",action:t.jsx(O,{color:"inherit",size:"small",onClick:()=>void g(),children:"Retry"}),children:["Could not list this package's reports, so this page cannot tell what is at ",n,"."]})});if(!b)return t.jsx(P,{text:_.opening()});if(v)return t.jsx(We,{environmentName:e,packageName:s,...c!==void 0?{versionId:c}:{},path:v.path,editable:i?!1:v.editable,layout:v.layout,edit:r&&!i});const M=r?void 0:Re(n);return M!==void 0?t.jsx(N,{replace:!0,to:`${A(`/${e}/${s}/${M.split("/").map(encodeURIComponent).join("/")}`,e,s,o)}${V(y)}`}):$(r&&!i?T.settled?t.jsx(Q,{environmentName:e,packageName:s,path:m,layout:T.layout??"grid"}):t.jsx(P,{text:_.opening()}):a)}function We({environmentName:e,packageName:s,versionId:n,path:r,editable:a,layout:h,edit:c}){const[o,i]=f.useState(c?"editor":"reader"),l=c?"editor":"reader",u=l==="reader"||o==="reader",d=l==="editor"||o==="editor",p={position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",overflow:"hidden"};return t.jsxs(x,{sx:{position:"relative"},"data-switching":u&&d||void 0,children:[u&&t.jsx(x,{sx:o==="reader"?void 0:p,"aria-hidden":o!=="reader"||void 0,children:t.jsx(J,{environmentName:e,packageName:s,...n!==void 0?{versionId:n}:{},path:r,...a!==void 0?{editable:a}:{},onReady:()=>{c||i("reader")}})},"reader"),d&&t.jsx(x,{sx:o==="editor"?void 0:p,"aria-hidden":o!=="editor"||void 0,children:t.jsx(Q,{environmentName:e,packageName:s,path:r,...h?{layout:h}:{},quietLoading:u,offstage:l!=="editor"||o!=="editor",onReady:()=>{c&&i("editor")}})},"editor")]})}function Ve(){const e=je(),{search:s}=R(),{path:n,versionId:r,versionSegment:a,writable:h}=K({always:!0}),{server:c}=ye(),{params:o,onGivensChange:i,setParam:l}=W();if(!e.environmentName)return t.jsx("div",{children:t.jsx("h2",{children:"Missing environment name"})});if(!e.packageName)return t.jsx("div",{children:t.jsx("h2",{children:"Missing package name"})});if(n!==void 0&&n!==""&&!n.endsWith(".malloy")&&!n.endsWith(".malloynb")){const d=n.replace(/\/$/,""),p=d.startsWith("data-apps/"),g=p?t.jsx(be,{resourceUri:E({environmentName:e.environmentName,packageName:e.packageName,modelPath:d.slice(10),versionId:r})}):t.jsx(F,{environmentName:e.environmentName,packageName:e.packageName,modelPath:n,staticUrl:L({server:c,environmentName:e.environmentName,packageName:e.packageName,path:n,...r!==void 0?{versionId:r}:{}})});return t.jsx(Ue,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},...a!==void 0?{versionSegment:a}:{},readOnly:!h,routePath:d,edit:D(s),notFound:g,notFoundUntilListed:p})}const u=E({environmentName:e.environmentName,packageName:e.packageName,modelPath:n,versionId:r});return n?.endsWith(".malloy")?t.jsx(x,{sx:S,children:t.jsx(we,{resourceUri:u,runOnDemand:!0,sourceName:o.source,onSourceChange:d=>l("source",d),givens:o,onGivensChange:i,maxResultSize:512*1024})}):n?.endsWith(".malloynb")?t.jsx(J,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},path:n,editable:!1}):t.jsx(F,{environmentName:e.environmentName,packageName:e.packageName,modelPath:n??"",staticUrl:L({server:c,environmentName:e.environmentName,packageName:e.packageName,path:n??"",...r!==void 0?{versionId:r}:{}})})}function F({packageName:e,modelPath:s,staticUrl:n}){const r=/\.[^./]+$/.test(s),a={fontFamily:H};return t.jsxs(x,{sx:S,children:[t.jsx(w,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Nothing to open at this path"}),t.jsxs(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[t.jsx(x,{component:"span",sx:a,children:s})," ","does not name a report, a"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"})," ","or a"," ",t.jsx(x,{component:"span",sx:a,children:".malloynb"})," ","file in package"," ",t.jsx(x,{component:"span",sx:a,children:e}),". This address opens reports by their path without"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"}),", and"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"})," ","and"," ",t.jsx(x,{component:"span",sx:a,children:".malloynb"})," ","files."]}),r&&t.jsxs(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",t.jsx(x,{component:"span",sx:a,children:"public/"})," ","directory is served at ",t.jsx(Ee,{href:n,children:n}),"."]}),t.jsx(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its reports, models, and data apps."})]})}export{Ve as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-VBpWc8yM.js","assets/index-DqJz_hGj.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-BoCnLGaG.js"])))=>i.map(i=>d[i]);
2
+ import{W as te,E as W,r as f,d7 as se,d8 as ne,d9 as B,da as U,a5 as q,X as z,j as t,G as x,db as re,a7 as E,dc as I,a4 as oe,az as ae,dd as ie,bn as ce,de as le,C as de,z as k,df as ue,as as fe,a2 as O,a3 as G,dg as he,dh as pe,a6 as N,T as w,di as xe,dj as V,F as me,dk as ge,a1 as ve,a0 as P,dl as _,A as je,N as ye,dm as be,dn as F,dp as we,dq as Ee}from"./index-DqJz_hGj.js";import{i as D,w as Re,a as X,l as ke}from"./documentRoutes-CIhmKz4i.js";import{v as Ce,w as A,u as H}from"./usePackageRoute-CTkLtO3i.js";import{u as Se}from"./usePackageLinkNavigate-BcERmCFv.js";import{T as K,P as C}from"./PackageSplatRoute-Cw-yA9CE.js";import{a as De,l as Y}from"./editPageMounted-B5IyuuMZ.js";function Ae(e,s,n){const r=te(),{reports:a,settled:h,isError:c}=W(e,s,Ce(n)),o=h&&!c;return f.useCallback((i,l)=>{const u=i.path;if(!se(u))return"malformed";const d=ne(u,a),p=A(B(e,s,d.kind==="path"?d.report.path:u),e,s,n),g=new URLSearchParams(i.givens).toString();return r(p+(g?`?${g}`:""),l),d.kind==="path"?"resolved":o?"unresolved":"unverified"},[r,e,s,n,a,o])}const Te='[data-tile-kind="query"]',$e=".malloy-render, .malloy-table, [role='alert'], .MuiAlert-root",Me=3e3;function J(e,s,n,r){const a=f.useRef(n);a.current=n;const h=f.useRef(!1);f.useEffect(()=>{if(!a.current||h.current)return;let c=0;const o={},i=()=>{clearTimeout(u),o.beat!==void 0&&clearInterval(o.beat),cancelAnimationFrame(c),o.observer?.disconnect()},l=()=>{h.current||(h.current=!0,i(),a.current?.())},u=setTimeout(l,Me);if(!s)return()=>clearTimeout(u);const d=()=>{const p=e.current;if(!p||r&&p.querySelector(r)===null)return;const g=window.innerHeight;[...p.querySelectorAll(Te)].filter(m=>{if(m.getBoundingClientRect().top>=g)return!1;const j=m.querySelector($e);return!j||j.getBoundingClientRect().height<8}).length===0&&c===0&&(c=requestAnimationFrame(()=>{c=requestAnimationFrame(l)}))};return o.observer=new MutationObserver(d),e.current&&o.observer.observe(e.current,{childList:!0,subtree:!0}),o.beat=setInterval(d,50),d(),i},[s,e,r])}function Q({environmentName:e,packageName:s,versionId:n,path:r,editable:a=r.endsWith(".malloy"),onReady:h}){const c=f.useRef(null);J(c,!0,h,`.${ae.report}`);const{params:o,onGivensChange:i}=U(),{versionSegment:l}=H(),u=Ae(e,s,l),d=Se(e,s,l),p=f.useMemo(()=>q({environmentName:e,packageName:s}),[e,s]),g=z();return f.useEffect(()=>{if(!a||g)return;const y=()=>void oe(()=>import("./index.es-VBpWc8yM.js"),__vite__mapDeps([0,1,2,3])),m=window.requestIdleCallback;if(m){const j=m(y);return()=>window.cancelIdleCallback?.(j)}const v=setTimeout(y,1500);return()=>clearTimeout(v)},[a,g]),t.jsx(x,{ref:c,sx:K,children:r.endsWith(".malloynb")?t.jsx(re,{resourceUri:E({environmentName:e,packageName:s,modelPath:r,versionId:n}),givens:o,onGivensChange:i,onNavigate:d,onDrillNavigate:u,maxResultSize:1024*1024}):t.jsx(I,{resourceUri:E({environmentName:e,packageName:s,versionId:n}),path:r,givens:o,onGivensChange:i,onNavigate:u,onLinkNavigate:d,onEvent:p,maxResultSize:1024*1024})})}function Pe(){const[e,s]=f.useState(!1),n=f.useRef(!1),r=f.useRef(!1),a=f.useCallback(i=>{n.current=i,s(i)},[]),h=f.useCallback(()=>{r.current=!0},[]),c=ie(f.useCallback(({currentLocation:i,nextLocation:l})=>n.current&&!r.current&&(i.pathname!==l.pathname||D(i.search)!==D(l.search)),[]));f.useEffect(()=>{if(!e)return;const i=l=>{l.preventDefault(),l.returnValue=""};return window.addEventListener("beforeunload",i),()=>window.removeEventListener("beforeunload",i)},[e]);const o=t.jsx(ce,{open:c.state==="blocked",canSave:!1,onKeepEditing:()=>c.reset?.(),onDiscard:()=>c.proceed?.()});return{onDirtyChange:a,leaving:h,dialog:o}}const _e=G.lazy(()=>Y().then(e=>({default:e.ReportEditor}))),Fe=G.lazy(()=>Y().then(e=>({default:e.BuilderBar})));function Le(){const[e,s]=f.useState(null);return f.useEffect(()=>{s(document.getElementById("header-actions-portal"))},[]),e}function Z({environmentName:e,packageName:s,path:n,layout:r="grid",onReady:a,quietLoading:h=!1,offstage:c=!1}){const o=Pe();De();const[i]=f.useState(le),l=de(),{pathname:u,search:d}=k(),p=Le(),[g,y]=f.useState(),m=f.useRef(null),v=z();J(m,g!==void 0||v,a);const j=()=>l(`${u.replace(/\/$/,"")}${Re(d)}`),S=f.useMemo(()=>q({environmentName:e,packageName:s}),[e,s]),R=t.jsx(I,{resourceUri:E({environmentName:e,packageName:s}),path:n,manifestStaleTime:1e4});return t.jsxs(x,{ref:m,sx:K,children:[t.jsx(ue,{children:t.jsx(f.Suspense,{fallback:h?null:R,children:t.jsx(_e,{resourceUri:E({environmentName:e,packageName:s}),path:n,layout:r,keepDraft:i,onDirtyChange:o.onDirtyChange,onExit:j,onOpenModel:b=>l(`/${[e,s,...b.split("/")].map(encodeURIComponent).join("/")}`),onEvent:S,loading:h?null:R,onControlsChange:y},`${e}/${s}/${n}`)})}),o.dialog,p&&!c&&fe.createPortal(t.jsx(f.Suspense,{fallback:t.jsx(O,{variant:"contained",disableElevation:!0,onClick:j,children:"Done"}),children:t.jsx(Fe,{controls:g,onDone:j})}),p)]})}function We({environmentName:e,packageName:s,versionSegment:n,routePath:r,edit:a,reports:h,children:c}){const{search:o}=k(),i=d=>A(B(e,s,d),e,s,n),l=he(r);if(!l)return t.jsx(t.Fragment,{children:c});const u=pe(l.name,h,l.prefer);return"found"in u?t.jsx(N,{replace:!0,to:`${i(u.found.path)}${a?X(o):o}`}):"ambiguous"in u?t.jsxs(x,{sx:C,children:[t.jsxs(w,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:["More than one report is named ",l.name]}),t.jsx(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"This is an old link, which names a report by its file name alone. Open one by its path:"}),t.jsx(x,{component:"ul",sx:{mt:1},children:u.ambiguous.map(d=>t.jsx("li",{children:t.jsx(xe,{to:i(d),style:{fontFamily:V},children:d})},d))})]}):t.jsx(t.Fragment,{children:c})}function Be({environmentName:e,packageName:s,routePath:n,edit:r,notFound:a,notFoundUntilListed:h=!1,versionId:c,versionSegment:o,readOnly:i=!1}){const{reports:l,settled:u,isFetching:d,isError:p,refetch:g}=W(e,s,c),{search:y}=k(),m=`${n}.malloy`,v=u?me(m,l):void 0,j=u&&!d&&!p,[S,R]=f.useState();f.useEffect(()=>{j&&R(m)},[j,m]);const b=v!==void 0||j||S===m,T=ge(e,s,m,r&&!i&&b&&!v),$=ee=>t.jsx(We,{environmentName:e,packageName:s,...o!==void 0?{versionSegment:o}:{},routePath:n,edit:r,reports:l,children:ee});if(!b&&(h&&!r&&!v))return $(a);if(!b&&p&&!d)return t.jsx(x,{sx:C,children:t.jsxs(ve,{severity:"warning",action:t.jsx(O,{color:"inherit",size:"small",onClick:()=>void g(),children:"Retry"}),children:["Could not list this package's reports, so this page cannot tell what is at ",n,"."]})});if(!b)return t.jsx(P,{text:_.opening()});if(v)return t.jsx(Ue,{environmentName:e,packageName:s,...c!==void 0?{versionId:c}:{},path:v.path,editable:i?!1:v.editable,layout:v.layout,edit:r&&!i});const M=r?void 0:ke(n);return M!==void 0?t.jsx(N,{replace:!0,to:`${A(`/${e}/${s}/${M.split("/").map(encodeURIComponent).join("/")}`,e,s,o)}${X(y)}`}):$(r&&!i?T.settled?t.jsx(Z,{environmentName:e,packageName:s,path:m,layout:T.layout??"grid"}):t.jsx(P,{text:_.opening()}):a)}function Ue({environmentName:e,packageName:s,versionId:n,path:r,editable:a,layout:h,edit:c}){const[o,i]=f.useState(c?"editor":"reader"),l=c?"editor":"reader",u=l==="reader"||o==="reader",d=l==="editor"||o==="editor",p={position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",overflow:"hidden"};return t.jsxs(x,{sx:{position:"relative"},"data-switching":u&&d||void 0,children:[u&&t.jsx(x,{sx:o==="reader"?void 0:p,"aria-hidden":o!=="reader"||void 0,children:t.jsx(Q,{environmentName:e,packageName:s,...n!==void 0?{versionId:n}:{},path:r,...a!==void 0?{editable:a}:{},onReady:()=>{c||i("reader")}})},"reader"),d&&t.jsx(x,{sx:o==="editor"?void 0:p,"aria-hidden":o!=="editor"||void 0,children:t.jsx(Z,{environmentName:e,packageName:s,path:r,...h?{layout:h}:{},quietLoading:u,offstage:l!=="editor"||o!=="editor",onReady:()=>{c&&i("editor")}})},"editor")]})}function Xe(){const e=je(),{search:s}=k(),{path:n,versionId:r,versionSegment:a,writable:h}=H({always:!0}),{server:c}=ye(),{params:o,onGivensChange:i,setParam:l}=U();if(!e.environmentName)return t.jsx("div",{children:t.jsx("h2",{children:"Missing environment name"})});if(!e.packageName)return t.jsx("div",{children:t.jsx("h2",{children:"Missing package name"})});if(n!==void 0&&n!==""&&!n.endsWith(".malloy")&&!n.endsWith(".malloynb")){const d=n.replace(/\/$/,""),p=d.startsWith("data-apps/"),g=p?t.jsx(be,{resourceUri:E({environmentName:e.environmentName,packageName:e.packageName,modelPath:d.slice(10),versionId:r})}):t.jsx(L,{environmentName:e.environmentName,packageName:e.packageName,modelPath:n,staticUrl:F({server:c,environmentName:e.environmentName,packageName:e.packageName,path:n,...r!==void 0?{versionId:r}:{}})});return t.jsx(Be,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},...a!==void 0?{versionSegment:a}:{},readOnly:!h,routePath:d,edit:D(s),notFound:g,notFoundUntilListed:p})}const u=E({environmentName:e.environmentName,packageName:e.packageName,modelPath:n,versionId:r});return n?.endsWith(".malloy")?t.jsx(x,{sx:C,children:t.jsx(we,{resourceUri:u,runOnDemand:!0,sourceName:o.source,onSourceChange:d=>l("source",d),givens:o,onGivensChange:i,maxResultSize:512*1024})}):n?.endsWith(".malloynb")?t.jsx(Q,{environmentName:e.environmentName,packageName:e.packageName,...r!==void 0?{versionId:r}:{},path:n,editable:!1}):t.jsx(L,{environmentName:e.environmentName,packageName:e.packageName,modelPath:n??"",staticUrl:F({server:c,environmentName:e.environmentName,packageName:e.packageName,path:n??"",...r!==void 0?{versionId:r}:{}})})}function L({packageName:e,modelPath:s,staticUrl:n}){const r=/\.[^./]+$/.test(s),a={fontFamily:V};return t.jsxs(x,{sx:C,children:[t.jsx(w,{variant:"h6",sx:{fontWeight:"fontWeightMedium"},children:"Nothing to open at this path"}),t.jsxs(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[t.jsx(x,{component:"span",sx:a,children:s})," ","does not name a report, a"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"})," ","or a"," ",t.jsx(x,{component:"span",sx:a,children:".malloynb"})," ","file in package"," ",t.jsx(x,{component:"span",sx:a,children:e}),". This address opens reports by their path without"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"}),", and"," ",t.jsx(x,{component:"span",sx:a,children:".malloy"})," ","and"," ",t.jsx(x,{component:"span",sx:a,children:".malloynb"})," ","files."]}),r&&t.jsxs(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",t.jsx(x,{component:"span",sx:a,children:"public/"})," ","directory is served at ",t.jsx(Ee,{href:n,children:n}),"."]}),t.jsx(w,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its reports, models, and data apps."})]})}export{Xe as default};
@@ -1 +1 @@
1
- import{z as x,_ as N,C as f,r as h,a5 as j,j as n,a6 as E,a7 as P,a8 as L}from"./index-D3PvzI_V.js";import{d as M}from"./documentRoutes-Dn5OclPv.js";import{u as R,p as r,L as c}from"./usePackageRoute-CwvWFoYD.js";import{u as S}from"./usePackageLinkNavigate-CpjXFkgK.js";function V(){const{environmentName:e,packageName:a,versionSegment:o,versionId:m,versioned:u}=R({always:!0}),{search:g}=x(),p=N(),v=f(),i=S(e??"",a??"",o),l=h.useMemo(()=>j({environmentName:e??"",packageName:a??""}),[e,a]);if(e){if(!a)return n.jsx("div",{children:n.jsx("h2",{children:"Missing package name"})})}else return n.jsx("div",{children:n.jsx("h2",{children:"Missing environment name"})});if(u&&o===void 0)return n.jsx(E,{to:`${r(e,a,c)}${g}`,replace:!0});const d=P({environmentName:e,packageName:a,versionId:m});return n.jsx(L,{onClickPackageFile:i,onOpenDocument:({path:s,mode:t},k)=>i(M(e,a,s,t),k),onSelectVersion:(s,t)=>p(r(e,a,s),t),onReplaceVersion:s=>v(r(e,a,s??c),{replace:!0}),resourceUri:d,onEvent:l})}export{V as default};
1
+ import{z as x,W as N,C as f,r as h,a5 as j,j as n,a6 as E,a7 as P,a8 as L}from"./index-DqJz_hGj.js";import{d as M}from"./documentRoutes-CIhmKz4i.js";import{u as R,p as r,L as c}from"./usePackageRoute-CTkLtO3i.js";import{u as S}from"./usePackageLinkNavigate-BcERmCFv.js";function W(){const{environmentName:e,packageName:a,versionSegment:o,versionId:m,versioned:u}=R({always:!0}),{search:g}=x(),p=N(),v=f(),i=S(e??"",a??"",o),l=h.useMemo(()=>j({environmentName:e??"",packageName:a??""}),[e,a]);if(e){if(!a)return n.jsx("div",{children:n.jsx("h2",{children:"Missing package name"})})}else return n.jsx("div",{children:n.jsx("h2",{children:"Missing environment name"})});if(u&&o===void 0)return n.jsx(E,{to:`${r(e,a,c)}${g}`,replace:!0});const d=P({environmentName:e,packageName:a,versionId:m});return n.jsx(L,{onClickPackageFile:i,onOpenDocument:({path:s,mode:t},k)=>i(M(e,a,s,t),k),onSelectVersion:(s,t)=>p(r(e,a,s),t),onReplaceVersion:s=>v(r(e,a,s??c),{replace:!0}),resourceUri:d,onEvent:l})}export{W as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelPage-BGlX8geE.js","assets/index-DqJz_hGj.js","assets/index-DUqldpo0.css","assets/documentRoutes-CIhmKz4i.js","assets/usePackageRoute-CTkLtO3i.js","assets/usePackageLinkNavigate-BcERmCFv.js","assets/editPageMounted-B5IyuuMZ.js","assets/PackagePage-Bd5y7ILU.js"])))=>i.map(i=>d[i]);
2
+ import{z as P,C as g,r as h,j as e,G as x,a1 as f,a2 as A,a3 as c,a4 as d}from"./index-DqJz_hGj.js";import{u as R,w as S,L as T}from"./usePackageRoute-CTkLtO3i.js";const j=1200,u={p:3,maxWidth:j,mx:"auto"},G={...u,pt:6},y=c.lazy(()=>d(()=>import("./ModelPage-BGlX8geE.js"),__vite__mapDeps([0,1,2,3,4,5,6]))),k=c.lazy(()=>d(()=>import("./PackagePage-Bd5y7ILU.js"),__vite__mapDeps([7,1,2,3,4,5])));function L(){const{environmentName:l,packageName:_,versionSegment:s,path:a,versioned:p,deciding:m,undecided:v,retry:E}=R({always:!0}),{pathname:o,search:r,hash:n}=P(),i=g(),t=p&&s===void 0?S(o,l??"",_??"",T):void 0;return h.useEffect(()=>{t!==void 0&&t!==o&&i(`${t}${r}${n}`,{replace:!0})},[t,o,r,n,i]),m?null:v?e.jsx(x,{sx:u,children:e.jsx(f,{severity:"error",action:e.jsx(A,{color:"inherit",size:"small",onClick:E,children:"Retry"}),children:"Could not read this package's versions, so this address can't be opened yet."})}):s!==void 0&&(a===void 0||a===""||a==="/")?e.jsx(k,{}):e.jsx(y,{})}const b=Object.freeze(Object.defineProperty({__proto__:null,default:L},Symbol.toStringTag,{value:"Module"}));export{u as P,G as T,b as a};
@@ -1,5 +1,5 @@
1
- import{az as ge,j as O,H as se,r as g,aA as ve,R as we,aB as ke,ah as xe,aC as Ce,aD as G,aE as Y,aF as Ae,aG as Ee,aH as Se,aI as ze,aJ as De,aK as Fe,aL as $e,aM as me,aN as de}from"./index-D3PvzI_V.js";const v=ge.drillCell;function Re(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 L(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function je(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=L(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=L(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=L(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 Te(e){const t=e.closest(".malloy-table"),r=L(e);return!t||!r?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(a=>a.closest(".malloy-table")===t&&L(a)===r)}function ce(e,t){const r=Te(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 Me(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 _e(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 Oe(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 ve){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 Z=e=>(e??[]).map(t=>t?.value).filter(t=>typeof t=="string");function Be(e){const t=e.replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const Le=e=>Z(e.annotations).some(t=>{const r=t.trim();return/^#[^("]/.test(r)&&/(?:^#|[\s{])label\s*=/.test(r)}),Ie=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,qe=e=>e.type?.element_type?.fields??e.type?.fields;function be(e,t){let r=!1;return{fields:e.map(a=>{const o=qe(a);if(o){const l=be(o,me(Z(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||Le(a))return a;const n=Be(a.name);return n===a.name?a:(r=!0,{...a,annotations:[{value:`# label=${Ie(n)}
2
- `},...a.annotations??[]]})}),changed:r}}function Ne(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}=be(r,me(Z(t.annotations)));return o?{...t,schema:{...t.schema,fields:a}}:e}const he=320,Pe=10,He=96,Ye=4e3;function Ve(e,t){if(e!=="bar"&&e!=="combo"&&e!=="line"&&e!=="chart"&&e!=="scatter_chart")return;if(e!=="bar"&&e!=="combo")return he;const r=t?.data?.array_value?.length,a=r===void 0?0:r*Pe+He;return Math.min(Math.max(he,a),Ye)}function Ke(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 We(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";let V;function ye(){if(V===void 0)try{V=new Function("return true")()===!0}catch{V=!1}return V}const Je=async(e,t,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:a}=await Ee();return new a({onClick:t,...r?{onDrill:r,tableConfig:{enableDrill:!0}}:{},vegaConfigOverride:_e(e),...ye()?{}:{useVegaInterpreter:!0},theme:Me(e),onError:o=>{console.error("Error rendering visualization:",typeof o,o)}}).createViz()};async function Qe(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 Ae())}catch{return}try{const{tag:o}=a(r);return Oe(o)}catch(o){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:o,lines:r});return}}function Xe(e,t,r){const a=Se(t,r);for(const[o,n]of Object.entries(a))e.style.setProperty(o,n)}const Ge=`
1
+ import{az as ge,j as O,G as se,r as g,aA as ve,_ as we,aB as ke,ah as xe,aC as Ce,aD as X,aE as Y,aF as Ae,aG as Ee,aH as Se,aI as ze,aJ as De,aK as Fe,aL as $e,aM as me,aN as de}from"./index-DqJz_hGj.js";const v=ge.drillCell;function je(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 L(e){const t=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return t?t[1]:void 0}function Re(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=L(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=L(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=L(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 Te(e){const t=e.closest(".malloy-table"),r=L(e);return!t||!r?[]:Array.from(t.querySelectorAll(`.${v}`)).filter(a=>a.closest(".malloy-table")===t&&L(a)===r)}function ce(e,t){const r=Te(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 _e(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 Oe(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 ve){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 Z=e=>(e??[]).map(t=>t?.value).filter(t=>typeof t=="string");function Be(e){const t=e.replace(/[-_]+/g," ").replace(/\s+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const Le=e=>Z(e.annotations).some(t=>{const r=t.trim();return/^#[^("]/.test(r)&&/(?:^#|[\s{])label\s*=/.test(r)}),Ie=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,qe=e=>e.type?.element_type?.fields??e.type?.fields;function be(e,t){let r=!1;return{fields:e.map(a=>{const o=qe(a);if(o){const l=be(o,me(Z(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||Le(a))return a;const n=Be(a.name);return n===a.name?a:(r=!0,{...a,annotations:[{value:`# label=${Ie(n)}
2
+ `},...a.annotations??[]]})}),changed:r}}function Ne(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}=be(r,me(Z(t.annotations)));return o?{...t,schema:{...t.schema,fields:a}}:e}const he=320,Pe=10,He=96,Ye=4e3;function Ve(e,t){if(e!=="bar"&&e!=="combo"&&e!=="line"&&e!=="chart"&&e!=="scatter_chart")return;if(e!=="bar"&&e!=="combo")return he;const r=t?.data?.array_value?.length,a=r===void 0?0:r*Pe+He;return Math.min(Math.max(he,a),Ye)}function Ke(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 We(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";let V;function ye(){if(V===void 0)try{V=new Function("return true")()===!0}catch{V=!1}return V}const Ge=async(e,t,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:a}=await Ee();return new a({onClick:t,...r?{onDrill:r,tableConfig:{enableDrill:!0}}:{},vegaConfigOverride:Me(e),...ye()?{}:{useVegaInterpreter:!0},theme:_e(e),onError:o=>{console.error("Error rendering visualization:",typeof o,o)}}).createViz()};async function Je(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 Ae())}catch{return}try{const{tag:o}=a(r);return Oe(o)}catch(o){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:o,lines:r});return}}function Qe(e,t,r){const a=Se(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
5
5
  passes each through to the --malloy-render--* the card CSS reads, so a value
@@ -176,4 +176,4 @@ div.malloy-render .malloy-dashboard .dashboard-row-header {
176
176
  .malloy-render .malloy-table .td.highlight:not(.${v}) {
177
177
  cursor: inherit;
178
178
  }
179
- `,ue="publisher-malloy-renderer-overrides";function Ze(){if(typeof document>"u"||document.getElementById(ue))return;const e=document.createElement("style");e.id=ue,e.textContent=Ge,document.head.appendChild(e)}function et({result:e,height:t,drill:r,onSizeChange:a,onSizing:o,fill:n}){const l=g.useRef(null),i=g.useRef(r);i.current=r;const b=g.useMemo(()=>Ke(d=>i.current?.onClick(d)),[]),f=r!==void 0,x=g.useRef(!1),k=g.useRef(null),K=g.useRef(0),{theme:I,layers:U,mode:ee}=we(),te=g.useMemo(()=>({radius:I.ui.radius.tile,padding:`${ke}px`}),[I.ui.radius.tile]);return g.useEffect(()=>()=>{K.current+=1;const d=k.current;d?.viz.remove(),d?.node.remove(),k.current=null},[]),g.useLayoutEffect(()=>{if(!l.current||!e)return;Ze();const d=l.current,fe=K.current+=1;let W=!1;const J=()=>!W&&fe===K.current;let c,y,q=null,Q=0,N=null,P=null,H=null,R=null,j=null,T=null,re=null,ae=0,z=null;x.current=!1;let p,D;const X=w=>{if(W||!w.firstElementChild||G(p,D)==="container")return;const M=ze(p,D);if(x.current&&!M)return;const _=d.hasAttribute(B);_&&d.removeAttribute(B);const C=d.closest(`.${De}`),h=C?.style.overflowY;C&&(C.style.overflowY="hidden");const F=Fe(w,de(p));C&&(C.style.overflowY=h??""),_&&d.setAttribute(B,""),F>0&&(x.current=!0,a&&F!==ae&&(ae=F,a(F)));const A=$e(w,de(p));M&&A&&re!==A&&(re=A,T?.disconnect(),T=new ResizeObserver(()=>X(w)),T.observe(A))};return(async()=>{let w;try{w=JSON.parse(e)}catch(m){console.error("Error parsing visualization result:",m);return}const M=await Qe(w),_=M?xe([...U,Ce(U,M)],ee):I;if(!J())return;try{y=await Je(_,b.onClick,f?b.onDrill:void 0)}catch(m){console.error("Failed to create renderer:",m);return}if(!J()){y.remove(),y=void 0;return}const C=k.current;c=document.createElement("div"),c.style.width="100%",c.style.height="100%",Xe(c,_,te),d.childElementCount>0&&(d.style.position="relative",c.style.position="absolute",c.style.inset="0",c.style.visibility="hidden"),d.appendChild(c);const h=c;R=new MutationObserver(()=>{j&&clearTimeout(j),j=setTimeout(()=>{X(h),x.current&&R?.disconnect()},100)}),R.observe(c,{childList:!0,subtree:!0,attributes:!0});const F=y;let A=!1;const oe=()=>{if(!(A||!J())){A=!0,z&&(clearTimeout(z),z=null),C?.viz.remove();for(const m of Array.from(d.children))m!==h&&d.removeChild(m);h.style.position="",h.style.inset="",h.style.visibility="",d.style.position="",k.current={viz:F,node:h},X(h)}};try{y.setResult(Ne(w));try{const E=y.getMetadata(),S=E?.getRootField();f&&We(S),p=S?.renderAs(),D=S?E?.getPluginsForField(S.key)?.[0]?.sizingStrategy:void 0}catch{p=void 0,D=void 0}o?.(G(p,D),p),c.dataset.malloyRenderAs=p??"unknown",c.dataset.malloySizing=G(p,D);const m=Ve(p,w);c.style.minWidth=m===void 0?"":`${m}px`,d.style.overflowX=m===void 0?"":"auto",d.style.overflowY=m===void 0?"":"hidden",y.render(c);const ne=i.current;try{if(ne){const E=Re(y,ne.canDrill),S=()=>{try{je(h,E)}catch(s){console.warn("Drill affordance skipped:",s)}};S();const le=s=>{const u=s.querySelector(".cell-content")??s,$=u.getBoundingClientRect();u.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:u.ownerDocument.defaultView,clientX:Math.round($.left+$.width/2),clientY:Math.round($.bottom)}))},ie=s=>s.target?.closest?.(`.${v}`)??null,pe=(s,u)=>{ce(s,u)?.focus()};N=s=>{const u=ie(s);if(!u)return;const $=s.key==="ArrowDown"?1:s.key==="ArrowUp"?-1:s.key==="Home"?"first":s.key==="End"?"last":void 0;if($!==void 0){s.preventDefault(),pe(u,$);return}s.key==="Enter"?(s.preventDefault(),le(u)):s.key===" "&&s.preventDefault()},P=s=>{if(s.key!==" ")return;const u=ie(s);u&&(s.preventDefault(),le(u))},H=s=>{const u=s.target?.closest?.(`.${v}`);u&&ce(u,0)},h.addEventListener("keydown",N),h.addEventListener("keyup",P),h.addEventListener("focusin",H),E.size>0&&typeof MutationObserver<"u"&&(q=new MutationObserver(()=>{cancelAnimationFrame(Q),Q=requestAnimationFrame(S)}),q.observe(h,{childList:!0,subtree:!0}))}}catch(E){console.warn("Drill affordance skipped:",E)}y.onReady(oe),z=setTimeout(oe,1e4)}catch(m){console.error("Error rendering visualization:",m),R?.disconnect(),T?.disconnect(),q?.disconnect(),y.remove(),y=void 0,h.parentNode===d&&d.removeChild(h)}})(),()=>{W=!0,R?.disconnect(),T?.disconnect(),j&&clearTimeout(j),z&&clearTimeout(z),c&&k.current?.node!==c&&(N&&c.removeEventListener("keydown",N),P&&c.removeEventListener("keyup",P),H&&c.removeEventListener("focusin",H),q?.disconnect(),cancelAnimationFrame(Q),y?.remove(),c.parentNode===d&&d.removeChild(c),d.style.position="")}},[e,b,f,a,o,I,U,ee,te]),O.jsx("div",{ref:l,...n?{[B]:""}:{},style:{width:"100%",height:t?`${t}px`:"400px"}})}function tt(e){return typeof window>"u"?O.jsx(se,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):O.jsx(g.Suspense,{fallback:O.jsx(se,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:O.jsx(et,{...e})})}const at=Object.freeze(Object.defineProperty({__proto__:null,default:tt,pageAllowsEval:ye},Symbol.toStringTag,{value:"Module"}));export{v as D,tt as R,_e as a,Me as b,at as c,Re as d,je as m,Oe as r};
179
+ `,ue="publisher-malloy-renderer-overrides";function Ze(){if(typeof document>"u"||document.getElementById(ue))return;const e=document.createElement("style");e.id=ue,e.textContent=Xe,document.head.appendChild(e)}function et({result:e,height:t,drill:r,onSizeChange:a,onSizing:o,fill:n}){const l=g.useRef(null),i=g.useRef(r);i.current=r;const b=g.useMemo(()=>Ke(d=>i.current?.onClick(d)),[]),f=r!==void 0,x=g.useRef(!1),k=g.useRef(null),K=g.useRef(0),{theme:I,layers:U,mode:ee}=we(),te=g.useMemo(()=>({radius:I.ui.radius.tile,padding:`${ke}px`}),[I.ui.radius.tile]);return g.useEffect(()=>()=>{K.current+=1;const d=k.current;d?.viz.remove(),d?.node.remove(),k.current=null},[]),g.useLayoutEffect(()=>{if(!l.current||!e)return;Ze();const d=l.current,fe=K.current+=1;let W=!1;const G=()=>!W&&fe===K.current;let c,y,q=null,J=0,N=null,P=null,H=null,j=null,R=null,T=null,re=null,ae=0,z=null;x.current=!1;let p,D;const Q=w=>{if(W||!w.firstElementChild||X(p,D)==="container")return;const _=ze(p,D);if(x.current&&!_)return;const M=d.hasAttribute(B);M&&d.removeAttribute(B);const C=d.closest(`.${De}`),h=C?.style.overflowY;C&&(C.style.overflowY="hidden");const F=Fe(w,de(p));C&&(C.style.overflowY=h??""),M&&d.setAttribute(B,""),F>0&&(x.current=!0,a&&F!==ae&&(ae=F,a(F)));const A=$e(w,de(p));_&&A&&re!==A&&(re=A,T?.disconnect(),T=new ResizeObserver(()=>Q(w)),T.observe(A))};return(async()=>{let w;try{w=JSON.parse(e)}catch(m){console.error("Error parsing visualization result:",m);return}const _=await Je(w),M=_?xe([...U,Ce(U,_)],ee):I;if(!G())return;try{y=await Ge(M,b.onClick,f?b.onDrill:void 0)}catch(m){console.error("Failed to create renderer:",m);return}if(!G()){y.remove(),y=void 0;return}const C=k.current;c=document.createElement("div"),c.style.width="100%",c.style.height="100%",Qe(c,M,te),d.childElementCount>0&&(d.style.position="relative",c.style.position="absolute",c.style.inset="0",c.style.visibility="hidden"),d.appendChild(c);const h=c;j=new MutationObserver(()=>{R&&clearTimeout(R),R=setTimeout(()=>{Q(h),x.current&&j?.disconnect()},100)}),j.observe(c,{childList:!0,subtree:!0,attributes:!0});const F=y;let A=!1;const oe=()=>{if(!(A||!G())){A=!0,z&&(clearTimeout(z),z=null),C?.viz.remove();for(const m of Array.from(d.children))m!==h&&d.removeChild(m);h.style.position="",h.style.inset="",h.style.visibility="",d.style.position="",k.current={viz:F,node:h},Q(h)}};try{y.setResult(Ne(w));try{const E=y.getMetadata(),S=E?.getRootField();f&&We(S),p=S?.renderAs(),D=S?E?.getPluginsForField(S.key)?.[0]?.sizingStrategy:void 0}catch{p=void 0,D=void 0}o?.(X(p,D),p),c.dataset.malloyRenderAs=p??"unknown",c.dataset.malloySizing=X(p,D);const m=Ve(p,w);c.style.minWidth=m===void 0?"":`${m}px`,d.style.overflowX=m===void 0?"":"auto",d.style.overflowY=m===void 0?"":"hidden",y.render(c);const ne=i.current;try{if(ne){const E=je(y,ne.canDrill),S=()=>{try{Re(h,E)}catch(s){console.warn("Drill affordance skipped:",s)}};S();const le=s=>{const u=s.querySelector(".cell-content")??s,$=u.getBoundingClientRect();u.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:u.ownerDocument.defaultView,clientX:Math.round($.left+$.width/2),clientY:Math.round($.bottom)}))},ie=s=>s.target?.closest?.(`.${v}`)??null,pe=(s,u)=>{ce(s,u)?.focus()};N=s=>{const u=ie(s);if(!u)return;const $=s.key==="ArrowDown"?1:s.key==="ArrowUp"?-1:s.key==="Home"?"first":s.key==="End"?"last":void 0;if($!==void 0){s.preventDefault(),pe(u,$);return}s.key==="Enter"?(s.preventDefault(),le(u)):s.key===" "&&s.preventDefault()},P=s=>{if(s.key!==" ")return;const u=ie(s);u&&(s.preventDefault(),le(u))},H=s=>{const u=s.target?.closest?.(`.${v}`);u&&ce(u,0)},h.addEventListener("keydown",N),h.addEventListener("keyup",P),h.addEventListener("focusin",H),E.size>0&&typeof MutationObserver<"u"&&(q=new MutationObserver(()=>{cancelAnimationFrame(J),J=requestAnimationFrame(S)}),q.observe(h,{childList:!0,subtree:!0}))}}catch(E){console.warn("Drill affordance skipped:",E)}y.onReady(oe),z=setTimeout(oe,1e4)}catch(m){console.error("Error rendering visualization:",m),j?.disconnect(),T?.disconnect(),q?.disconnect(),y.remove(),y=void 0,h.parentNode===d&&d.removeChild(h)}})(),()=>{W=!0,j?.disconnect(),T?.disconnect(),R&&clearTimeout(R),z&&clearTimeout(z),c&&k.current?.node!==c&&(N&&c.removeEventListener("keydown",N),P&&c.removeEventListener("keyup",P),H&&c.removeEventListener("focusin",H),q?.disconnect(),cancelAnimationFrame(J),y?.remove(),c.parentNode===d&&d.removeChild(c),d.style.position="")}},[e,b,f,a,o,I,U,ee,te]),O.jsx("div",{ref:l,...n?{[B]:""}:{},style:{width:"100%",height:t?`${t}px`:"400px"}})}function tt(e){return typeof window>"u"?O.jsx(se,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):O.jsx(g.Suspense,{fallback:O.jsx(se,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:O.jsx(et,{...e})})}const at=Object.freeze(Object.defineProperty({__proto__:null,default:tt,pageAllowsEval:ye},Symbol.toStringTag,{value:"Module"}));export{v as D,tt as R,Me as a,_e as b,at as c,je as d,Re as m,Oe as r};
@@ -1 +1 @@
1
- import{ab as o,j as r,ac as s,ad as n,H as t,T as a}from"./index-D3PvzI_V.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,G as t,T as a}from"./index-DqJz_hGj.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};