@malloy-publisher/server 0.0.118 → 0.0.119

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.
@@ -0,0 +1 @@
1
+ import{G as o,j as a,L as e}from"./index-DjbXd602.js";function n(){const t=o();return a.jsx(e,{onClickProject:t})}export{n as default};
@@ -0,0 +1,2 @@
1
+ import{u as V,g as F,r as g,R as _,a as X,b as S,c as M,d as A,j as t,s as b,e as w,f as v,h as I,P as Y,m as R,i as J,k as z,B as K,l as N,n as Z,T as U,o as q,p as oo,G as eo,q as m,C as j,t as ro,v as to,I as so,M as ao,w as $,S as no,x as lo,y as io,O as co}from"./index-DjbXd602.js";function po(o,e,r,s,n){const[a,i]=g.useState(()=>n&&r?r(o).matches:s?s(o).matches:e);return X(()=>{if(!r)return;const p=r(o),u=()=>{i(p.matches)};return u(),p.addEventListener("change",u),()=>{p.removeEventListener("change",u)}},[o,r]),a}const uo={..._},L=uo.useSyncExternalStore;function go(o,e,r,s,n){const a=g.useCallback(()=>e,[e]),i=g.useMemo(()=>{if(n&&r)return()=>r(o).matches;if(s!==null){const{matches:c}=s(o);return()=>c}return a},[a,o,s,n,r]),[p,u]=g.useMemo(()=>{if(r===null)return[a,()=>()=>{}];const c=r(o);return[()=>c.matches,l=>(c.addEventListener("change",l),()=>{c.removeEventListener("change",l)})]},[a,r,o]);return L(u,p,i)}function O(o={}){const{themeId:e}=o;return function(s,n={}){let a=V();a&&e&&(a=a[e]||a);const i=typeof window<"u"&&typeof window.matchMedia<"u",{defaultMatches:p=!1,matchMedia:u=i?window.matchMedia:null,ssrMatchMedia:d=null,noSsr:c=!1}=F({name:"MuiUseMediaQuery",props:n,theme:a});let l=typeof s=="function"?s(a):s;return l=l.replace(/^@media( ?)/m,""),l.includes("print")&&console.warn(["MUI: You have provided a `print` query to the `useMediaQuery` hook.","Using the print media query to modify print styles can lead to unexpected results.","Consider using the `displayPrint` field in the `sx` prop instead.","More information about `displayPrint` on our docs: https://mui.com/system/display/#display-in-print."].join(`
2
+ `)),(L!==void 0?go:po)(l,p,u,d,c)}}O();function xo(o){return S("MuiAppBar",o)}M("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const bo=o=>{const{color:e,position:r,classes:s}=o,n={root:["root",`color${v(e)}`,`position${v(r)}`]};return I(n,xo,s)},D=(o,e)=>o?`${o?.replace(")","")}, ${e})`:e,mo=b(Y,{name:"MuiAppBar",slot:"Root",overridesResolver:(o,e)=>{const{ownerState:r}=o;return[e.root,e[`position${v(r.position)}`],e[`color${v(r.color)}`]]}})(R(({theme:o})=>({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0,variants:[{props:{position:"fixed"},style:{position:"fixed",zIndex:(o.vars||o).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}}},{props:{position:"absolute"},style:{position:"absolute",zIndex:(o.vars||o).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"sticky"},style:{position:"sticky",zIndex:(o.vars||o).zIndex.appBar,top:0,left:"auto",right:0}},{props:{position:"static"},style:{position:"static"}},{props:{position:"relative"},style:{position:"relative"}},{props:{color:"inherit"},style:{"--AppBar-color":"inherit"}},{props:{color:"default"},style:{"--AppBar-background":o.vars?o.vars.palette.AppBar.defaultBg:o.palette.grey[100],"--AppBar-color":o.vars?o.vars.palette.text.primary:o.palette.getContrastText(o.palette.grey[100]),...o.applyStyles("dark",{"--AppBar-background":o.vars?o.vars.palette.AppBar.defaultBg:o.palette.grey[900],"--AppBar-color":o.vars?o.vars.palette.text.primary:o.palette.getContrastText(o.palette.grey[900])})}},...Object.entries(o.palette).filter(J(["contrastText"])).map(([e])=>({props:{color:e},style:{"--AppBar-background":(o.vars??o).palette[e].main,"--AppBar-color":(o.vars??o).palette[e].contrastText}})),{props:e=>e.enableColorOnDark===!0&&!["inherit","transparent"].includes(e.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)"}},{props:e=>e.enableColorOnDark===!1&&!["inherit","transparent"].includes(e.color),style:{backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...o.applyStyles("dark",{backgroundColor:o.vars?D(o.vars.palette.AppBar.darkBg,"var(--AppBar-background)"):null,color:o.vars?D(o.vars.palette.AppBar.darkColor,"var(--AppBar-color)"):null})}},{props:{color:"transparent"},style:{"--AppBar-background":"transparent","--AppBar-color":"inherit",backgroundColor:"var(--AppBar-background)",color:"var(--AppBar-color)",...o.applyStyles("dark",{backgroundImage:"none"})}}]}))),fo=g.forwardRef(function(e,r){const s=A({props:e,name:"MuiAppBar"}),{className:n,color:a="primary",enableColorOnDark:i=!1,position:p="fixed",...u}=s,d={...s,color:a,position:p,enableColorOnDark:i},c=bo(d);return t.jsx(mo,{square:!0,component:"header",ownerState:d,elevation:4,className:w(c.root,n,p==="fixed"&&"mui-fixed"),ref:r,...u})}),ho=z(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"})),yo=b(K,{name:"MuiBreadcrumbCollapsed"})(R(({theme:o})=>({display:"flex",marginLeft:`calc(${o.spacing(1)} * 0.5)`,marginRight:`calc(${o.spacing(1)} * 0.5)`,...o.palette.mode==="light"?{backgroundColor:o.palette.grey[100],color:o.palette.grey[700]}:{backgroundColor:o.palette.grey[700],color:o.palette.grey[100]},borderRadius:2,"&:hover, &:focus":{...o.palette.mode==="light"?{backgroundColor:o.palette.grey[200]}:{backgroundColor:o.palette.grey[600]}},"&:active":{boxShadow:o.shadows[0],...o.palette.mode==="light"?{backgroundColor:N(o.palette.grey[200],.12)}:{backgroundColor:N(o.palette.grey[600],.12)}}}))),vo=b(ho)({width:24,height:16});function Bo(o){const{slots:e={},slotProps:r={},...s}=o,n=o;return t.jsx("li",{children:t.jsx(yo,{focusRipple:!0,...s,ownerState:n,children:t.jsx(vo,{as:e.CollapsedIcon,ownerState:n,...r.collapsedIcon})})})}function ko(o){return S("MuiBreadcrumbs",o)}const Co=M("MuiBreadcrumbs",["root","ol","li","separator"]),jo=o=>{const{classes:e}=o;return I({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},ko,e)},So=b(U,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(o,e)=>[{[`& .${Co.li}`]:e.li},e.root]})({}),Mo=b("ol",{name:"MuiBreadcrumbs",slot:"Ol"})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),Ao=b("li",{name:"MuiBreadcrumbs",slot:"Separator"})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function wo(o,e,r,s){return o.reduce((n,a,i)=>(i<o.length-1?n=n.concat(a,t.jsx(Ao,{"aria-hidden":!0,className:e,ownerState:s,children:r},`separator-${i}`)):n.push(a),n),[])}const Io=g.forwardRef(function(e,r){const s=A({props:e,name:"MuiBreadcrumbs"}),{children:n,className:a,component:i="nav",slots:p={},slotProps:u={},expandText:d="Show path",itemsAfterCollapse:c=1,itemsBeforeCollapse:l=1,maxItems:h=8,separator:B="/",...Q}=s,[T,W]=g.useState(!1),f={...s,component:i,expanded:T,expandText:d,itemsAfterCollapse:c,itemsBeforeCollapse:l,maxItems:h,separator:B},y=jo(f),H=Z({elementType:p.CollapsedIcon,externalSlotProps:u.collapsedIcon,ownerState:f}),P=g.useRef(null),G=x=>{const C=()=>{W(!0);const E=P.current.querySelector("a[href],button,[tabindex]");E&&E.focus()};return l+c>=x.length?x:[...x.slice(0,l),t.jsx(Bo,{"aria-label":d,slots:{CollapsedIcon:p.CollapsedIcon},slotProps:{collapsedIcon:H},onClick:C},"ellipsis"),...x.slice(x.length-c,x.length)]},k=g.Children.toArray(n).filter(x=>g.isValidElement(x)).map((x,C)=>t.jsx("li",{className:y.li,children:x},`child-${C}`));return t.jsx(So,{ref:r,component:i,color:"textSecondary",className:w(y.root,a),ownerState:f,...Q,children:t.jsx(Mo,{className:y.ol,ref:P,ownerState:f,children:wo(T||h&&k.length<=h?k:G(k),y.separator,B,f)})})});function Ro(o){return S("MuiToolbar",o)}M("MuiToolbar",["root","gutters","regular","dense"]);const zo=o=>{const{classes:e,disableGutters:r,variant:s}=o;return I({root:["root",!r&&"gutters",s]},Ro,e)},To=b("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(o,e)=>{const{ownerState:r}=o;return[e.root,!r.disableGutters&&e.gutters,e[r.variant]]}})(R(({theme:o})=>({position:"relative",display:"flex",alignItems:"center",variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:o.spacing(2),paddingRight:o.spacing(2),[o.breakpoints.up("sm")]:{paddingLeft:o.spacing(3),paddingRight:o.spacing(3)}}},{props:{variant:"dense"},style:{minHeight:48}},{props:{variant:"regular"},style:o.mixins.toolbar}]}))),Po=g.forwardRef(function(e,r){const s=A({props:e,name:"MuiToolbar"}),{className:n,component:a="div",disableGutters:i=!1,variant:p="regular",...u}=s,d={...s,component:a,disableGutters:i,variant:p},c=zo(d);return t.jsx(To,{as:a,className:w(c.root,n),ref:r,ownerState:d,...u})}),Eo=O({themeId:q}),No=z(t.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),$o=z(t.jsx("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}));function Do(){const o=oo(),e=o["*"],r=eo();return t.jsx(m,{sx:{display:"flex",alignItems:"center"},children:t.jsxs(Io,{"aria-label":"breadcrumb",separator:t.jsx(No,{sx:{fontSize:14,color:"text.secondary"}}),sx:{"& .MuiBreadcrumbs-separator":{margin:"0 6px"}},children:[o.projectName&&t.jsx(j,{onClick:s=>r(`/${o.projectName}/`,s),label:o.projectName,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"1rem",cursor:"pointer","&:hover":{backgroundColor:"primary.100"}}}),o.packageName&&t.jsx(j,{onClick:s=>r(`/${o.projectName}/${o.packageName}/`,s),label:o.packageName,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"1rem",cursor:"pointer","&:hover":{backgroundColor:"secondary.100"}}}),e&&t.jsx(j,{onClick:s=>r(`/${o.projectName}/${o.packageName}/${e}`,s),label:e,size:"medium",sx:{backgroundColor:"white",color:"primary.main",fontWeight:500,height:"32px",fontSize:"1rem",cursor:"pointer","&:hover":{backgroundColor:"grey.200"}}})]})})}function Uo({logoHeader:o,endCap:e}){const r=ro(),s=to(),n=Eo(s.breakpoints.down("sm")),[a,i]=g.useState(null),p=!!a,u=l=>{i(l.currentTarget)},d=()=>i(null),c=[{label:"Malloy Docs",link:"https://docs.malloydata.dev/documentation/",sx:{color:"#14b3cb"}},{label:"Publisher Docs",link:"https://github.com/malloydata/publisher/blob/main/README.md",sx:{color:"#14b3cb"}},{label:"Publisher API",link:"/api-doc.html",sx:{color:"#14b3cb"}}];return t.jsxs(fo,{position:"sticky",elevation:0,sx:{backgroundColor:"background.paper",borderBottom:"1px solid",borderColor:"divider"},children:[t.jsxs(Po,{sx:{justifyContent:"space-between",flexWrap:"nowrap",minHeight:64},children:[o||t.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer"},onClick:()=>r("/"),children:[t.jsx(m,{component:"img",src:"/logo.svg",alt:"Malloy",sx:{width:28,height:28}}),t.jsx(U,{variant:"h6",sx:{color:"text.primary",fontWeight:700,letterSpacing:"-0.025em",fontSize:{xs:"1.1rem",sm:"1.25rem"}},children:"Malloy Publisher"})]}),n?t.jsxs(t.Fragment,{children:[t.jsx(so,{color:"inherit",onClick:u,children:t.jsx($o,{})}),t.jsxs(ao,{anchorEl:a,open:p,onClose:d,anchorOrigin:{vertical:"bottom",horizontal:"right"},children:[c.map(l=>t.jsx($,{onClick:()=>{d(),window.location.href=l.link},sx:l.sx,children:l.label},l.label)),e&&t.jsx($,{children:e})]})]}):t.jsxs(no,{direction:"row",spacing:2,alignItems:"center",children:[c.map(l=>t.jsx(lo,{href:l.link,sx:l.sx,children:l.label},l.label)),e]})]}),t.jsx(m,{sx:{borderTop:"1px solid",borderColor:"white",paddingTop:"0px",marginBottom:"1px",px:2,py:1,overflowX:"auto",bgcolor:"background.paper"},children:t.jsx(Do,{})})]})}function Oo({headerProps:o}){return t.jsxs(m,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh"},children:[t.jsx(Uo,{...o}),t.jsx(io,{maxWidth:"xl",component:"main",sx:{flex:1,display:"flex",flexDirection:"column",py:2,gap:2},children:t.jsx(m,{sx:{flex:1},children:t.jsx(co,{})})})]})}export{Oo as default};
@@ -1 +1 @@
1
- import{l as n,j as e,t as i,X as t,v as c}from"./index-CbVGARSr.js";function m(){const a=n(),r=a["*"];if(!a.projectName)return e.jsx("div",{children:e.jsx("h2",{children:"Missing project name"})});if(!a.packageName)return e.jsx("div",{children:e.jsx("h2",{children:"Missing package name"})});const s=i({projectName:a.projectName,packageName:a.packageName,modelPath:r});return r?.endsWith(".malloy")?e.jsx(t,{resourceUri:s}):r?.endsWith(".malloynb")?e.jsx(c,{resourceUri:s}):e.jsx("div",{children:e.jsxs("h2",{children:["Unrecognized file type: ",r]})})}export{m as default};
1
+ import{p as n,j as e,F as i,z as t,A as c}from"./index-DjbXd602.js";function d(){const a=n(),r=a["*"];if(!a.projectName)return e.jsx("div",{children:e.jsx("h2",{children:"Missing project name"})});if(!a.packageName)return e.jsx("div",{children:e.jsx("h2",{children:"Missing package name"})});const s=i({projectName:a.projectName,packageName:a.packageName,modelPath:r});return r?.endsWith(".malloy")?e.jsx(t,{resourceUri:s}):r?.endsWith(".malloynb")?e.jsx(c,{resourceUri:s}):e.jsx("div",{children:e.jsxs("h2",{children:["Unrecognized file type: ",r]})})}export{d as default};
@@ -0,0 +1 @@
1
+ import{p as n,G as c,j as e,F as t,D as o}from"./index-DjbXd602.js";function l(){const{projectName:s,packageName:a}=n(),r=c();if(s)if(a){const i=t({projectName:s,packageName:a});return e.jsx(o,{onClickPackageFile:r,resourceUri:i})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing package name"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing project name"})})}export{l as default};
@@ -0,0 +1 @@
1
+ import{G as t,p as n,j as e,F as o,N as c}from"./index-DjbXd602.js";function j(){const r=t(),{projectName:s}=n();if(s){const a=o({projectName:s});return e.jsx(c,{onSelectPackage:r,resourceUri:a})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing project name"})})}export{j as default};
@@ -1 +1 @@
1
- import{y as o,j as r,q as s,S as n,n as t,T as a}from"./index-CbVGARSr.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{E as o,j as r,y as s,S as n,q as t,T as a}from"./index-DjbXd602.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};
@@ -0,0 +1 @@
1
+ import{p as a,j as e,F as t,_ as c}from"./index-DjbXd602.js";function d(){const{workspace:r,workbookPath:s,projectName:i,packageName:n}=a();if(r)if(s)if(i)if(n){const o=t({projectName:i,packageName:n});return e.jsx(c,{workbookPath:{path:s,workspace:r},resourceUri:o},`${s}`)}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing package name"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing project name"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing workbook path"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing workspace"})})}export{d as default};
@@ -1,4 +1,4 @@
1
- import{D as kD,r as T,j as A,R as It,E as rR,F as nR,G as Zi}from"./index-CbVGARSr.js";import{r as wm,a as iR,b as sR,c as Dm,d as Lm,e as oR,f as aR,g as uR,h as lR,j as cR,k as dR,l as xR,m as fR,n as pR,o as df,p as s1,q as o1,s as $l,t as hR,u as MD,v as it}from"./index-BZ_1Ar9v.js";import{a as Zg}from"./index.umd-9JpsJxlU.js";var Xs={},U2={},pr={},Q2={},BE;function Ke(){return BE||(BE=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TD=e.ValueType=void 0,e.exprHasKids=t,e.exprHasE=r,e.exprIsLeaf=s,e.isAsymmetricExpr=o,e.mkTemporal=u,e.isRawCast=d,e.isFilterExprType=l,e.isParameterType=f,e.paramHasValue=x,e.expressionIsScalar=m,e.expressionIsAggregate=h,e.expressionIsUngroupedAggregate=p,e.expressionInvolvesAggregate=c,e.expressionIsCalculation=C,e.expressionIsAnalytic=v,e.isExpressionTypeLEQ=_,e.maxExpressionType=R,e.maxOfExpressionTypes=y,e.hasExpression=S,e.isTemporalType=w,e.isAtomicFieldType=L,e.canOrderBy=O,e.isCastType=I,e.fieldIsIntrinsic=N,e.mkFieldDef=k,e.mkArrayDef=P,e.isRepeatedRecordFunctionParam=W,e.isRepeatedRecord=H,e.isBasicArray=$,e.isMatrixOperation=Y,e.isJoinable=K,e.isJoined=pe,e.isJoinedSource=G,e.isDateUnit=J,e.isTimestampUnit=te,e.isExtractUnit=se,e.refIsStructDef=ce,e.segmentHasErrors=ae,e.structHasErrors=Ee,e.isReduceSegment=he,e.isPartialSegment=j,e.isProjectSegment=Z,e.isQuerySegment=de,e.isSamplingRows=ie,e.isSamplingPercent=_e,e.isSamplingEnable=De,e.isRawSegment=be,e.isIndexSegment=Te,e.bareFieldUsage=Ne,e.isSegmentSQL=Qe,e.sourceBase=Je,e.isSourceDef=Xe,e.isBaseTable=rt,e.isLiteral=xt,e.mergeEvalSpaces=Gt,e.isBasicAtomic=ar,e.getIdentifier=kt,e.isTurtle=cr,e.isAtomic=Fr,e.isValueString=Ut,e.isValueNumber=dr,e.isValueBoolean=br,e.isValueTimestamp=vr,e.isValueDate=xr,e.mergeUniqueKeyRequirement=oe;function t(U){return"kids"in U}function r(U){return"e"in U}function s(U){return!(t(U)||r(U))}function o(U){return U.node==="aggregate"&&["sum","avg","count","distinct"].includes(U.function)}function a(U){return U.node!=="arrayLiteral"&&U.node!=="recordLiteral"}function u(U,xe){if(!("typeDef"in U)){const Re=typeof xe=="string"?{type:xe}:xe;if(a(U))return{...U,typeDef:{...Re}}}return U}function d(U){return"dstSQLType"in U}function l(U){return["string","number","boolean","date","timestamp"].includes(U)}function f(U){return["string","number","boolean","date","timestamp","filter expression","error"].includes(U)}function x(U){return U.value!==null}function m(U){return U===void 0||U==="scalar"}function h(U){return U==="aggregate"||U==="ungrouped_aggregate"}function p(U){return U==="ungrouped_aggregate"}function c(U){return U==="aggregate"||U==="ungrouped_aggregate"||U==="aggregate_analytic"}function C(U){return U==="aggregate"||U==="scalar_analytic"||U==="aggregate_analytic"||U==="ungrouped_aggregate"}function v(U){return U==="aggregate_analytic"||U==="scalar_analytic"}function E(U){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[U]}function _(U,xe){return U===xe||E(U)<E(xe)}function R(U,xe){let Re="scalar";return(U==="aggregate"||xe==="aggregate")&&(Re="aggregate"),(U==="ungrouped_aggregate"||xe==="ungrouped_aggregate")&&(Re="ungrouped_aggregate"),(U==="scalar_analytic"||xe==="scalar_analytic")&&(Re="scalar_analytic"),(U==="aggregate_analytic"||xe==="aggregate_analytic")&&(Re="aggregate_analytic"),(U==="scalar_analytic"&&xe==="aggregate"||U==="aggregate"&&xe==="scalar_analytic")&&(Re="aggregate_analytic"),Re}function y(U){return U.reduce(R,"scalar")}function S(U){return"e"in U&&U.e!==void 0}function w(U){return U==="date"||U==="timestamp"}function L(U){return["string","number","date","timestamp","boolean","json","sql native","record","array","error"].includes(U)}function O(U){return["string","number","date","boolean","date","timestamp"].includes(U)}function I(U){return["string","number","date","timestamp","boolean","json"].includes(U)}function N(U){return L(U.type)&&!S(U)}function k(U,xe){if($(U))return P(U.elementTypeDef,xe);if(H(U)){const{type:Ie,fields:je,elementTypeDef:Ge}=U;return{type:Ie,fields:je,elementTypeDef:Ge,join:"many",name:xe}}if(U.type==="record"){const{type:Ie,fields:je}=U;return{type:Ie,fields:je,join:"one",name:xe}}const Re={name:xe,type:U.type};switch(U.type){case"sql native":return{...Re,rawType:U.rawType};case"number":{const Ie=U.numberType;return Ie?{...Re,numberType:Ie}:Re}case"date":{const Ie=U.timeframe;return Ie?{name:xe,type:"date",timeframe:Ie}:Re}case"timestamp":{const Ie=U.timeframe;return Ie?{name:xe,type:"timestamp",timeframe:Ie}:Re}}return Re}function P(U,xe){if(U.type==="record")return{type:"array",join:"many",name:xe,elementTypeDef:{type:"record_element"},fields:U.fields};const Re=k(U,"value");return{type:"array",join:"many",name:xe,elementTypeDef:U,fields:[Re,{...Re,name:"each",e:{node:"field",path:["value"]}}]}}function W(U){return U.type==="array"&&U.elementTypeDef.type==="record_element"}function H(U){return U.type==="array"&&U.elementTypeDef.type==="record_element"}function $(U){return U.type==="array"&&U.elementTypeDef.type!=="record_element"}function Y(U){return["left","right","full","inner"].includes(U)}function K(U){return["composite","table","sql_select","query_source","array","record"].includes(U.type)}function pe(U){return"join"in U}function G(U){return Xe(U)&&pe(U)}function J(U){return["day","week","month","quarter","year"].includes(U)}function te(U){return J(U)||["hour","minute","second"].includes(U)}function se(U){return te(U)||U==="day_of_week"||U==="day_of_year"}var X;(function(U){U.Date="date",U.Timestamp="timestamp",U.Number="number",U.String="string"})(X||(e.ValueType=X={}));function ce(U){return typeof U!="string"}function ae(U){return!!((U.type==="reduce"||U.type==="project"||U.type==="partial")&&(U.extendSource&&U.extendSource.some(xe=>xe.type==="error")||U.queryFields.some(xe=>xe.type==="error")))}function Ee(U){return U.fields.some(xe=>xe.type==="error")}function he(U){return U.type==="reduce"}function j(U){return U.type==="partial"}function Z(U){return U.type==="project"}function de(U){return Z(U)||he(U)}function ie(U){return U.rows!==void 0}function _e(U){return U.percent!==void 0}function De(U){return U.enable!==void 0}function be(U){return U.type==="raw"}function Te(U){return U.type==="index"}function Ne(U){return U.uniqueKeyRequirement===void 0&&U.analyticFunctionUse===void 0}function Qe(U){return"sql"in U}function Je(U){return{...U}}function Xe(U){return U.type==="table"||U.type==="sql_select"||U.type==="query_source"||U.type==="query_result"||U.type==="finalize"||U.type==="nest_source"||U.type==="composite"}function rt(U){return G(U)?!1:!!Xe(U)}function xt(U){return U==="literal"}function Gt(...U){return U.length<=1&&U.every(xe=>xe==="literal")?"literal":U.every(xe=>xe==="constant"||xe==="literal")?"constant":U.every(xe=>xe==="output"||xe==="constant"||xe==="literal")?"output":"input"}function ar(U){return U.type==="string"||w(U.type)||U.type==="number"||U.type==="boolean"||U.type==="json"||U.type==="sql native"||U.type==="error"}function kt(U){return U.as!==void 0?U.as:U.name}function cr(U){return U.type==="turtle"}function Fr(U){return L(U.type)}function Ut(U,xe){return xe.type==="string"}function dr(U,xe){return xe.type==="number"}function br(U,xe){return xe.type==="boolean"}function vr(U,xe){return xe.type==="timestamp"}function xr(U,xe){return xe.type==="date"}e.TD={isAtomic(U){return U!==void 0&&L(U.type)},isBasicAtomic(U){return U!==void 0&&ar({type:U.type})},isString:U=>U?.type==="string",isNumber:U=>U?.type==="number",isBoolean:U=>U?.type==="boolean",isJSON:U=>U?.type==="json",isSQL:U=>U?.type==="sql native",isDate:U=>U?.type==="date",isTimestamp:U=>U?.type==="timestamp",isTemporal(U){var xe;const Re=(xe=U?.type)!==null&&xe!==void 0?xe:"";return w(Re)},isError:U=>U?.type==="error",eq(U,xe){if(U===void 0||xe===void 0)return!1;function Re(Ie,je){const Ge={};for(const nt of Ie.fields||[])if(nt.name)Ge[nt.name]=nt;else return!1;for(const nt of je.fields||[])if(!e.TD.eq(Ge[nt.name],nt))return!1;return!0}return U.type==="array"&&xe.type==="array"?U.elementTypeDef.type!==xe.elementTypeDef.type?!1:U.elementTypeDef.type!=="record_element"&&xe.elementTypeDef.type!=="record_element"?e.TD.eq(U.elementTypeDef,xe.elementTypeDef):e.TD.isAtomic(U)&&e.TD.isAtomic(xe)&&Re(U,xe):U.type==="record"&&xe.type==="record"?e.TD.isAtomic(U)&&e.TD.isAtomic(xe)&&Re(U,xe):U.type==="sql native"&&xe.type==="sql native"?U.rawType!==void 0&&U.rawType===xe.rawType:U.type===xe.type}};function oe(U,xe){return U?xe?{isCount:U.isCount||xe.isCount}:U:xe}})(Q2)),Q2}var $E;function Ns(){if($E)return pr;$E=1,Object.defineProperty(pr,"__esModule",{value:!0}),pr.arg=t,pr.spread=r,pr.sql=s,pr.constant=o,pr.output=a,pr.literal=u,pr.variadicParam=d,pr.param=l,pr.makeParam=f,pr.maxScalar=x,pr.maxAggregate=m,pr.anyExprType=h,pr.maxUngroupedAggregate=p,pr.maxAnalytic=c,pr.minScalar=C,pr.minAggregate=v,pr.minAnalytic=E,pr.overload=_,pr.expandBlueprintMap=se,pr.expandOverrideMapFromBase=ae,pr.def=he;const e=Ke();function t(j){return{node:"function_parameter",name:j}}function r(j,Z=void 0,de=void 0){return{node:"spread",e:j,prefix:Z,suffix:de}}function s(j,...Z){const de={node:"genericSQLExpr",kids:{args:[]},src:[]},ie=[...Z];let _e="";for(const De of j){_e+=De;const be=ie.shift();be!==void 0&&(typeof be=="string"?_e+=be:(de.src.push(_e),de.kids.args.push(be),_e=""))}return _e.length>0&&de.src.push(_e),de}function o(j){return{...j,evalSpace:"constant"}}function a(j){return{...j,evalSpace:"output"}}function u(j){return{...j,evalSpace:"literal"}}function d(j,...Z){return{name:j,isVariadic:!0,allowedTypes:Z}}function l(j,...Z){return{name:j,isVariadic:!1,allowedTypes:Z}}function f(j,...Z){return{param:l(j,...Z),arg:t(j)}}function x(j){return{...j,expressionType:"scalar",evalSpace:"input"}}function m(j){return{...j,expressionType:"aggregate",evalSpace:"input"}}function h(j){return{...j,expressionType:void 0,evalSpace:"input"}}function p(j){return{...j,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function c(j){return{...j,expressionType:"aggregate_analytic",evalSpace:"input"}}function C(j){return{...j,expressionType:"scalar",evalSpace:"input"}}function v(j){return{...j,expressionType:"aggregate",evalSpace:"input"}}function E(j){return{...j,expressionType:"scalar_analytic",evalSpace:"input"}}function _(j,Z,de,ie){return{returnType:j,params:Z,e:de,needsWindowOrderBy:ie?.needsWindowOrderBy,between:ie?.between,isSymmetric:ie?.isSymmetric,supportsOrderBy:ie?.supportsOrderBy,defaultOrderByArgIndex:ie?.defaultOrderByArgIndex,supportsLimit:ie?.supportsLimit}}function R(j,Z=!0,de=!0){if(!Z&&j==="any")throw new Error("Return type cannot include any");if(typeof j=="string")return{type:j};if("array"in j){const ie=Z?R(j.array,!0):R(j.array,!1);return ie.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ie.fields}:{type:"array",elementTypeDef:ie}}else if("record"in j){const ie=[];for(const[_e,De]of Object.entries(j.record)){const be=Z?R(De,!0):R(De,!1);e.TD.isAtomic(be)&&ie.push((0,e.mkFieldDef)(be,_e))}return{type:"record",fields:ie}}else if("generic"in j){if(!de)throw new Error("Cannot use generic");return{type:"generic",generic:j.generic}}else if("sql_native"in j)return{type:"sql native",rawType:j.sql_native};throw new Error("Cannot figure out type")}function y(j){if(j==="any")throw new Error("Cannot return any type");if(typeof j=="string")return C({type:j});if("array"in j)return h(R(j,!1));if("record"in j)return h(R(j,!1));if("generic"in j)return C(R(j,!1));if("literal"in j)return u(C(R(j.literal,!1)));if("constant"in j)return o(C(R(j.constant,!1)));if("dimension"in j)return C(R(j.dimension,!1));if("measure"in j)return v(R(j.measure,!1));if("sql_native"in j)return h({type:"sql native",rawType:j.sql_native});if("calculation"in j)return E(R(j.calculation,!1));throw new Error("Invalid function blueprint")}function S(j){return typeof j=="string"||"array"in j||"record"in j||"generic"in j||"literal"in j||"constant"in j||"dimension"in j||"measure"in j||"calculation"in j||"sql_native"in j}function w(j){return S(j)?[j]:Array.isArray(j)?j:S(j.variadic)?[j.variadic]:j.variadic}function L(j){if(typeof j=="string")return h({type:j});if("generic"in j)return h(R(j));if("literal"in j)return u(x(R(j.literal)));if("constant"in j)return o(x(R(j.constant)));if("dimension"in j)return x(R(j.dimension));if("measure"in j)return m(R(j.measure));if("array"in j)return h(R(j,!1));if("record"in j)return h(R(j,!1));if("sql_native"in j)return h({type:"sql native",rawType:j.sql_native});if("calculation"in j)return c(R(j.calculation));throw new Error("Invalid function blueprint")}function O(j){return j.map(Z=>L(Z))}function I(j){return typeof j!="string"&&"variadic"in j}function N(j,Z){return{name:j,allowedTypes:O(w(Z)),isVariadic:I(Z)}}function k(j){return Object.entries(j).map(de=>N(de[0],de[1]))}function P(j){const Z=[],de=[];let ie=j;for(;ie.length>0;){const De=ie.indexOf("${");if(De===-1){Z.push(ie);break}const be=ie.slice(0,De);ie=ie.slice(De);const Te=ie.indexOf("}");if(Te===-1){Z.push(be+ie);break}const Ne=ie.slice(2,Te);ie=ie.slice(Te+1);const Qe=Ne.startsWith("..."),Je=Ne.endsWith(":"),Xe=Qe?Ne.slice(3):Je?Ne.slice(0,-1):Ne,rt={node:"function_parameter",name:Xe};Z.push(be),Qe?de.push({node:"spread",e:rt,prefix:"",suffix:""}):Je&&Xe==="order_by"?de.push({node:"aggregate_order_by"}):Je&&Xe==="limit"?de.push({node:"aggregate_limit"}):de.push(rt)}return{node:"genericSQLExpr",kids:{args:de},src:Z}}function W(j,Z){return I(Z)?{node:"spread",e:{node:"function_parameter",name:j},prefix:"",suffix:""}:{node:"function_parameter",name:j}}function H(j,Z){const de=Object.entries(Z.takes),ie=de.length>0?de.length-1:0;return{node:"genericSQLExpr",kids:{args:de.map(_e=>W(_e[0],_e[1]))},src:[`${j}(`,...Array(ie).fill(","),")"]}}function $(j){return"sql"in j.impl?P(j.impl.sql):"expr"in j.impl?j.impl.expr:H(j.impl.function,j)}function Y(j){return{e:$(j),between:j.impl.between,needsWindowOrderBy:j.impl.needsWindowOrderBy,defaultOrderByArgIndex:j.impl.defaultOrderByArgIndex}}function K(j){if(j!==void 0)return Object.entries(j).map(([Z,de])=>({name:Z,acceptibleTypes:de.map(ie=>R(ie,!0,!1))}))}function pe(j){return{returnType:y(j.returns),params:k(j.takes),isSymmetric:j.isSymmetric,supportsOrderBy:j.supportsOrderBy,supportsLimit:j.supportsLimit,genericTypes:K(j.generic),...Y(j)}}function G(j){return"takes"in j&&"returns"in j&&"impl"in j}function J(j){return"function"in j||"sql"in j||"expr"in j}function te(j){return G(j)?[pe(j)]:Object.values(j).flatMap(Z=>pe(Z))}function se(j){const Z={};for(const de in j)Z[de]=te(j[de]);return Z}function X(j,Z){return[pe({...j,impl:Z})]}function ce(j,Z,de){if(J(de)){if(!G(Z))throw new Error(`Malformed function override: ${j}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(Z)})`);return X(Z,de)}else{if(G(Z))throw new Error(`Malformed function override: ${j}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(de)})`);return Object.entries(de).flatMap(([ie,_e])=>{const De=Z[ie];if(De===void 0)throw new Error(`Malformed function override: ${j}. No overload named ${ie}`);return X(De,_e)})}}function ae(j,Z){const de={};for(const ie in Z){if(!(ie in j))throw new Error(`Malformed function override: ${ie}. No such function in Malloy standard`);de[ie]=ce(ie,j[ie],Z[ie])}return de}function*Ee(j){if(typeof j!="string"){if("generic"in j)yield j;else if("record"in j)for(const Z of Object.values(j.record))yield*Ee(Z);else for(const Z of["array","literal","measure","dimension","measure","constant","cacluation"])if(Z in j){yield*Ee(j[Z]);return}}}function he(j,Z,de,ie={}){let _e=!1;const De={};for(const Te of Object.values(Z))for(const Ne of Ee(Te))De[Ne.generic]=["any"],_e=!0;_e&&ie.generic===void 0&&(ie.generic=De);const be={takes:Z,returns:de,impl:{function:j.toUpperCase()},...ie};return{[j]:be}}return pr}var H2={},qE;function xu(){return qE||(qE=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Dialect=e.dayIndex=void 0,e.inDays=s,e.qtz=o;const t=Ke(),r=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];e.dayIndex=r.indexOf("day");function s(u){return r.indexOf(u)>=e.dayIndex}function o(u){const d=u.queryTimezone;if(!(d===void 0||d===u.systemTimezone))return d}class a{constructor(){this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsArraysInData=!0,this.readsNestedData=!0,this.orderByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.supportsCountApprox=!1,this.supportsHyperLogLog=!1,this.supportsFullJoin=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0,this.booleanType="supported",this.likeEscape=!0}sqlFinalStage(d,l){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(d){return this.castToString(`DATE(${d})`)}sqlLiteralNumber(d){return d}ignoreInProject(d){return!1}exprToSQL(d,l){switch(l.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(l);case"delta":return this.sqlAlterTimeExpr(l);case"trunc":return this.sqlTruncExpr(d,l);case"extract":return this.sqlTimeExtractExpr(d,l);case"cast":return this.sqlCast(d,l);case"regexpMatch":return this.sqlRegexpMatch(l);case"/":return this.divisionIsInteger?`${l.kids.left.sql}*1.0/${l.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${l.kids.left.sql},${l.kids.right.sql})`;case"timeLiteral":return this.sqlLiteralTime(d,l);case"stringLiteral":return this.sqlLiteralString(l.literal);case"numberLiteral":return this.sqlLiteralNumber(l.literal);case"regexpLiteral":return this.sqlLiteralRegexp(l.literal);case"recordLiteral":return this.sqlLiteralRecord(l);case"arrayLiteral":return this.sqlLiteralArray(l)}}sqlSumDistinct(d,l,f){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(d,l,f){return"sqlAggDistinct called but not implemented"}sqlSampleTable(d,l){if(l!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return d}sqlOrderBy(d,l){return`ORDER BY ${d.join(",")}`}sqlTzStr(d){return`"${d.queryTimezone}"`}sqlMakeUnnestKey(d,l){return this.concat(d,"'x'",l)}sqlStringAggDistinct(d,l,f){const x="__STRING_AGG_KS__",m="__STRING_AGG_KE__";return`REGEXP_REPLACE(
1
+ import{H as kD,r as T,j as A,J as It,R as rR,K as nR,Q as Zi}from"./index-DjbXd602.js";import{r as wm,a as iR,b as sR,c as Dm,d as Lm,e as oR,f as aR,g as uR,h as lR,j as cR,k as dR,l as xR,m as fR,n as pR,o as df,p as s1,q as o1,s as $l,t as hR,u as MD,v as it}from"./index-DlZbNvNc.js";import{a as Zg}from"./index.umd-DQiSWsWe.js";var Xs={},U2={},pr={},Q2={},BE;function Ke(){return BE||(BE=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TD=e.ValueType=void 0,e.exprHasKids=t,e.exprHasE=r,e.exprIsLeaf=s,e.isAsymmetricExpr=o,e.mkTemporal=u,e.isRawCast=d,e.isFilterExprType=l,e.isParameterType=f,e.paramHasValue=x,e.expressionIsScalar=m,e.expressionIsAggregate=h,e.expressionIsUngroupedAggregate=p,e.expressionInvolvesAggregate=c,e.expressionIsCalculation=C,e.expressionIsAnalytic=v,e.isExpressionTypeLEQ=_,e.maxExpressionType=R,e.maxOfExpressionTypes=y,e.hasExpression=S,e.isTemporalType=w,e.isAtomicFieldType=L,e.canOrderBy=O,e.isCastType=I,e.fieldIsIntrinsic=N,e.mkFieldDef=k,e.mkArrayDef=P,e.isRepeatedRecordFunctionParam=W,e.isRepeatedRecord=H,e.isBasicArray=$,e.isMatrixOperation=Y,e.isJoinable=K,e.isJoined=pe,e.isJoinedSource=G,e.isDateUnit=J,e.isTimestampUnit=te,e.isExtractUnit=se,e.refIsStructDef=ce,e.segmentHasErrors=ae,e.structHasErrors=Ee,e.isReduceSegment=he,e.isPartialSegment=j,e.isProjectSegment=Z,e.isQuerySegment=de,e.isSamplingRows=ie,e.isSamplingPercent=_e,e.isSamplingEnable=De,e.isRawSegment=be,e.isIndexSegment=Te,e.bareFieldUsage=Ne,e.isSegmentSQL=Qe,e.sourceBase=Je,e.isSourceDef=Xe,e.isBaseTable=rt,e.isLiteral=xt,e.mergeEvalSpaces=Gt,e.isBasicAtomic=ar,e.getIdentifier=kt,e.isTurtle=cr,e.isAtomic=Fr,e.isValueString=Ut,e.isValueNumber=dr,e.isValueBoolean=br,e.isValueTimestamp=vr,e.isValueDate=xr,e.mergeUniqueKeyRequirement=oe;function t(U){return"kids"in U}function r(U){return"e"in U}function s(U){return!(t(U)||r(U))}function o(U){return U.node==="aggregate"&&["sum","avg","count","distinct"].includes(U.function)}function a(U){return U.node!=="arrayLiteral"&&U.node!=="recordLiteral"}function u(U,xe){if(!("typeDef"in U)){const Re=typeof xe=="string"?{type:xe}:xe;if(a(U))return{...U,typeDef:{...Re}}}return U}function d(U){return"dstSQLType"in U}function l(U){return["string","number","boolean","date","timestamp"].includes(U)}function f(U){return["string","number","boolean","date","timestamp","filter expression","error"].includes(U)}function x(U){return U.value!==null}function m(U){return U===void 0||U==="scalar"}function h(U){return U==="aggregate"||U==="ungrouped_aggregate"}function p(U){return U==="ungrouped_aggregate"}function c(U){return U==="aggregate"||U==="ungrouped_aggregate"||U==="aggregate_analytic"}function C(U){return U==="aggregate"||U==="scalar_analytic"||U==="aggregate_analytic"||U==="ungrouped_aggregate"}function v(U){return U==="aggregate_analytic"||U==="scalar_analytic"}function E(U){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[U]}function _(U,xe){return U===xe||E(U)<E(xe)}function R(U,xe){let Re="scalar";return(U==="aggregate"||xe==="aggregate")&&(Re="aggregate"),(U==="ungrouped_aggregate"||xe==="ungrouped_aggregate")&&(Re="ungrouped_aggregate"),(U==="scalar_analytic"||xe==="scalar_analytic")&&(Re="scalar_analytic"),(U==="aggregate_analytic"||xe==="aggregate_analytic")&&(Re="aggregate_analytic"),(U==="scalar_analytic"&&xe==="aggregate"||U==="aggregate"&&xe==="scalar_analytic")&&(Re="aggregate_analytic"),Re}function y(U){return U.reduce(R,"scalar")}function S(U){return"e"in U&&U.e!==void 0}function w(U){return U==="date"||U==="timestamp"}function L(U){return["string","number","date","timestamp","boolean","json","sql native","record","array","error"].includes(U)}function O(U){return["string","number","date","boolean","date","timestamp"].includes(U)}function I(U){return["string","number","date","timestamp","boolean","json"].includes(U)}function N(U){return L(U.type)&&!S(U)}function k(U,xe){if($(U))return P(U.elementTypeDef,xe);if(H(U)){const{type:Ie,fields:je,elementTypeDef:Ge}=U;return{type:Ie,fields:je,elementTypeDef:Ge,join:"many",name:xe}}if(U.type==="record"){const{type:Ie,fields:je}=U;return{type:Ie,fields:je,join:"one",name:xe}}const Re={name:xe,type:U.type};switch(U.type){case"sql native":return{...Re,rawType:U.rawType};case"number":{const Ie=U.numberType;return Ie?{...Re,numberType:Ie}:Re}case"date":{const Ie=U.timeframe;return Ie?{name:xe,type:"date",timeframe:Ie}:Re}case"timestamp":{const Ie=U.timeframe;return Ie?{name:xe,type:"timestamp",timeframe:Ie}:Re}}return Re}function P(U,xe){if(U.type==="record")return{type:"array",join:"many",name:xe,elementTypeDef:{type:"record_element"},fields:U.fields};const Re=k(U,"value");return{type:"array",join:"many",name:xe,elementTypeDef:U,fields:[Re,{...Re,name:"each",e:{node:"field",path:["value"]}}]}}function W(U){return U.type==="array"&&U.elementTypeDef.type==="record_element"}function H(U){return U.type==="array"&&U.elementTypeDef.type==="record_element"}function $(U){return U.type==="array"&&U.elementTypeDef.type!=="record_element"}function Y(U){return["left","right","full","inner"].includes(U)}function K(U){return["composite","table","sql_select","query_source","array","record"].includes(U.type)}function pe(U){return"join"in U}function G(U){return Xe(U)&&pe(U)}function J(U){return["day","week","month","quarter","year"].includes(U)}function te(U){return J(U)||["hour","minute","second"].includes(U)}function se(U){return te(U)||U==="day_of_week"||U==="day_of_year"}var X;(function(U){U.Date="date",U.Timestamp="timestamp",U.Number="number",U.String="string"})(X||(e.ValueType=X={}));function ce(U){return typeof U!="string"}function ae(U){return!!((U.type==="reduce"||U.type==="project"||U.type==="partial")&&(U.extendSource&&U.extendSource.some(xe=>xe.type==="error")||U.queryFields.some(xe=>xe.type==="error")))}function Ee(U){return U.fields.some(xe=>xe.type==="error")}function he(U){return U.type==="reduce"}function j(U){return U.type==="partial"}function Z(U){return U.type==="project"}function de(U){return Z(U)||he(U)}function ie(U){return U.rows!==void 0}function _e(U){return U.percent!==void 0}function De(U){return U.enable!==void 0}function be(U){return U.type==="raw"}function Te(U){return U.type==="index"}function Ne(U){return U.uniqueKeyRequirement===void 0&&U.analyticFunctionUse===void 0}function Qe(U){return"sql"in U}function Je(U){return{...U}}function Xe(U){return U.type==="table"||U.type==="sql_select"||U.type==="query_source"||U.type==="query_result"||U.type==="finalize"||U.type==="nest_source"||U.type==="composite"}function rt(U){return G(U)?!1:!!Xe(U)}function xt(U){return U==="literal"}function Gt(...U){return U.length<=1&&U.every(xe=>xe==="literal")?"literal":U.every(xe=>xe==="constant"||xe==="literal")?"constant":U.every(xe=>xe==="output"||xe==="constant"||xe==="literal")?"output":"input"}function ar(U){return U.type==="string"||w(U.type)||U.type==="number"||U.type==="boolean"||U.type==="json"||U.type==="sql native"||U.type==="error"}function kt(U){return U.as!==void 0?U.as:U.name}function cr(U){return U.type==="turtle"}function Fr(U){return L(U.type)}function Ut(U,xe){return xe.type==="string"}function dr(U,xe){return xe.type==="number"}function br(U,xe){return xe.type==="boolean"}function vr(U,xe){return xe.type==="timestamp"}function xr(U,xe){return xe.type==="date"}e.TD={isAtomic(U){return U!==void 0&&L(U.type)},isBasicAtomic(U){return U!==void 0&&ar({type:U.type})},isString:U=>U?.type==="string",isNumber:U=>U?.type==="number",isBoolean:U=>U?.type==="boolean",isJSON:U=>U?.type==="json",isSQL:U=>U?.type==="sql native",isDate:U=>U?.type==="date",isTimestamp:U=>U?.type==="timestamp",isTemporal(U){var xe;const Re=(xe=U?.type)!==null&&xe!==void 0?xe:"";return w(Re)},isError:U=>U?.type==="error",eq(U,xe){if(U===void 0||xe===void 0)return!1;function Re(Ie,je){const Ge={};for(const nt of Ie.fields||[])if(nt.name)Ge[nt.name]=nt;else return!1;for(const nt of je.fields||[])if(!e.TD.eq(Ge[nt.name],nt))return!1;return!0}return U.type==="array"&&xe.type==="array"?U.elementTypeDef.type!==xe.elementTypeDef.type?!1:U.elementTypeDef.type!=="record_element"&&xe.elementTypeDef.type!=="record_element"?e.TD.eq(U.elementTypeDef,xe.elementTypeDef):e.TD.isAtomic(U)&&e.TD.isAtomic(xe)&&Re(U,xe):U.type==="record"&&xe.type==="record"?e.TD.isAtomic(U)&&e.TD.isAtomic(xe)&&Re(U,xe):U.type==="sql native"&&xe.type==="sql native"?U.rawType!==void 0&&U.rawType===xe.rawType:U.type===xe.type}};function oe(U,xe){return U?xe?{isCount:U.isCount||xe.isCount}:U:xe}})(Q2)),Q2}var $E;function Ns(){if($E)return pr;$E=1,Object.defineProperty(pr,"__esModule",{value:!0}),pr.arg=t,pr.spread=r,pr.sql=s,pr.constant=o,pr.output=a,pr.literal=u,pr.variadicParam=d,pr.param=l,pr.makeParam=f,pr.maxScalar=x,pr.maxAggregate=m,pr.anyExprType=h,pr.maxUngroupedAggregate=p,pr.maxAnalytic=c,pr.minScalar=C,pr.minAggregate=v,pr.minAnalytic=E,pr.overload=_,pr.expandBlueprintMap=se,pr.expandOverrideMapFromBase=ae,pr.def=he;const e=Ke();function t(j){return{node:"function_parameter",name:j}}function r(j,Z=void 0,de=void 0){return{node:"spread",e:j,prefix:Z,suffix:de}}function s(j,...Z){const de={node:"genericSQLExpr",kids:{args:[]},src:[]},ie=[...Z];let _e="";for(const De of j){_e+=De;const be=ie.shift();be!==void 0&&(typeof be=="string"?_e+=be:(de.src.push(_e),de.kids.args.push(be),_e=""))}return _e.length>0&&de.src.push(_e),de}function o(j){return{...j,evalSpace:"constant"}}function a(j){return{...j,evalSpace:"output"}}function u(j){return{...j,evalSpace:"literal"}}function d(j,...Z){return{name:j,isVariadic:!0,allowedTypes:Z}}function l(j,...Z){return{name:j,isVariadic:!1,allowedTypes:Z}}function f(j,...Z){return{param:l(j,...Z),arg:t(j)}}function x(j){return{...j,expressionType:"scalar",evalSpace:"input"}}function m(j){return{...j,expressionType:"aggregate",evalSpace:"input"}}function h(j){return{...j,expressionType:void 0,evalSpace:"input"}}function p(j){return{...j,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function c(j){return{...j,expressionType:"aggregate_analytic",evalSpace:"input"}}function C(j){return{...j,expressionType:"scalar",evalSpace:"input"}}function v(j){return{...j,expressionType:"aggregate",evalSpace:"input"}}function E(j){return{...j,expressionType:"scalar_analytic",evalSpace:"input"}}function _(j,Z,de,ie){return{returnType:j,params:Z,e:de,needsWindowOrderBy:ie?.needsWindowOrderBy,between:ie?.between,isSymmetric:ie?.isSymmetric,supportsOrderBy:ie?.supportsOrderBy,defaultOrderByArgIndex:ie?.defaultOrderByArgIndex,supportsLimit:ie?.supportsLimit}}function R(j,Z=!0,de=!0){if(!Z&&j==="any")throw new Error("Return type cannot include any");if(typeof j=="string")return{type:j};if("array"in j){const ie=Z?R(j.array,!0):R(j.array,!1);return ie.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ie.fields}:{type:"array",elementTypeDef:ie}}else if("record"in j){const ie=[];for(const[_e,De]of Object.entries(j.record)){const be=Z?R(De,!0):R(De,!1);e.TD.isAtomic(be)&&ie.push((0,e.mkFieldDef)(be,_e))}return{type:"record",fields:ie}}else if("generic"in j){if(!de)throw new Error("Cannot use generic");return{type:"generic",generic:j.generic}}else if("sql_native"in j)return{type:"sql native",rawType:j.sql_native};throw new Error("Cannot figure out type")}function y(j){if(j==="any")throw new Error("Cannot return any type");if(typeof j=="string")return C({type:j});if("array"in j)return h(R(j,!1));if("record"in j)return h(R(j,!1));if("generic"in j)return C(R(j,!1));if("literal"in j)return u(C(R(j.literal,!1)));if("constant"in j)return o(C(R(j.constant,!1)));if("dimension"in j)return C(R(j.dimension,!1));if("measure"in j)return v(R(j.measure,!1));if("sql_native"in j)return h({type:"sql native",rawType:j.sql_native});if("calculation"in j)return E(R(j.calculation,!1));throw new Error("Invalid function blueprint")}function S(j){return typeof j=="string"||"array"in j||"record"in j||"generic"in j||"literal"in j||"constant"in j||"dimension"in j||"measure"in j||"calculation"in j||"sql_native"in j}function w(j){return S(j)?[j]:Array.isArray(j)?j:S(j.variadic)?[j.variadic]:j.variadic}function L(j){if(typeof j=="string")return h({type:j});if("generic"in j)return h(R(j));if("literal"in j)return u(x(R(j.literal)));if("constant"in j)return o(x(R(j.constant)));if("dimension"in j)return x(R(j.dimension));if("measure"in j)return m(R(j.measure));if("array"in j)return h(R(j,!1));if("record"in j)return h(R(j,!1));if("sql_native"in j)return h({type:"sql native",rawType:j.sql_native});if("calculation"in j)return c(R(j.calculation));throw new Error("Invalid function blueprint")}function O(j){return j.map(Z=>L(Z))}function I(j){return typeof j!="string"&&"variadic"in j}function N(j,Z){return{name:j,allowedTypes:O(w(Z)),isVariadic:I(Z)}}function k(j){return Object.entries(j).map(de=>N(de[0],de[1]))}function P(j){const Z=[],de=[];let ie=j;for(;ie.length>0;){const De=ie.indexOf("${");if(De===-1){Z.push(ie);break}const be=ie.slice(0,De);ie=ie.slice(De);const Te=ie.indexOf("}");if(Te===-1){Z.push(be+ie);break}const Ne=ie.slice(2,Te);ie=ie.slice(Te+1);const Qe=Ne.startsWith("..."),Je=Ne.endsWith(":"),Xe=Qe?Ne.slice(3):Je?Ne.slice(0,-1):Ne,rt={node:"function_parameter",name:Xe};Z.push(be),Qe?de.push({node:"spread",e:rt,prefix:"",suffix:""}):Je&&Xe==="order_by"?de.push({node:"aggregate_order_by"}):Je&&Xe==="limit"?de.push({node:"aggregate_limit"}):de.push(rt)}return{node:"genericSQLExpr",kids:{args:de},src:Z}}function W(j,Z){return I(Z)?{node:"spread",e:{node:"function_parameter",name:j},prefix:"",suffix:""}:{node:"function_parameter",name:j}}function H(j,Z){const de=Object.entries(Z.takes),ie=de.length>0?de.length-1:0;return{node:"genericSQLExpr",kids:{args:de.map(_e=>W(_e[0],_e[1]))},src:[`${j}(`,...Array(ie).fill(","),")"]}}function $(j){return"sql"in j.impl?P(j.impl.sql):"expr"in j.impl?j.impl.expr:H(j.impl.function,j)}function Y(j){return{e:$(j),between:j.impl.between,needsWindowOrderBy:j.impl.needsWindowOrderBy,defaultOrderByArgIndex:j.impl.defaultOrderByArgIndex}}function K(j){if(j!==void 0)return Object.entries(j).map(([Z,de])=>({name:Z,acceptibleTypes:de.map(ie=>R(ie,!0,!1))}))}function pe(j){return{returnType:y(j.returns),params:k(j.takes),isSymmetric:j.isSymmetric,supportsOrderBy:j.supportsOrderBy,supportsLimit:j.supportsLimit,genericTypes:K(j.generic),...Y(j)}}function G(j){return"takes"in j&&"returns"in j&&"impl"in j}function J(j){return"function"in j||"sql"in j||"expr"in j}function te(j){return G(j)?[pe(j)]:Object.values(j).flatMap(Z=>pe(Z))}function se(j){const Z={};for(const de in j)Z[de]=te(j[de]);return Z}function X(j,Z){return[pe({...j,impl:Z})]}function ce(j,Z,de){if(J(de)){if(!G(Z))throw new Error(`Malformed function override: ${j}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(Z)})`);return X(Z,de)}else{if(G(Z))throw new Error(`Malformed function override: ${j}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(de)})`);return Object.entries(de).flatMap(([ie,_e])=>{const De=Z[ie];if(De===void 0)throw new Error(`Malformed function override: ${j}. No overload named ${ie}`);return X(De,_e)})}}function ae(j,Z){const de={};for(const ie in Z){if(!(ie in j))throw new Error(`Malformed function override: ${ie}. No such function in Malloy standard`);de[ie]=ce(ie,j[ie],Z[ie])}return de}function*Ee(j){if(typeof j!="string"){if("generic"in j)yield j;else if("record"in j)for(const Z of Object.values(j.record))yield*Ee(Z);else for(const Z of["array","literal","measure","dimension","measure","constant","cacluation"])if(Z in j){yield*Ee(j[Z]);return}}}function he(j,Z,de,ie={}){let _e=!1;const De={};for(const Te of Object.values(Z))for(const Ne of Ee(Te))De[Ne.generic]=["any"],_e=!0;_e&&ie.generic===void 0&&(ie.generic=De);const be={takes:Z,returns:de,impl:{function:j.toUpperCase()},...ie};return{[j]:be}}return pr}var H2={},qE;function xu(){return qE||(qE=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Dialect=e.dayIndex=void 0,e.inDays=s,e.qtz=o;const t=Ke(),r=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];e.dayIndex=r.indexOf("day");function s(u){return r.indexOf(u)>=e.dayIndex}function o(u){const d=u.queryTimezone;if(!(d===void 0||d===u.systemTimezone))return d}class a{constructor(){this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsArraysInData=!0,this.readsNestedData=!0,this.orderByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.supportsCountApprox=!1,this.supportsHyperLogLog=!1,this.supportsFullJoin=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0,this.booleanType="supported",this.likeEscape=!0}sqlFinalStage(d,l){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(d){return this.castToString(`DATE(${d})`)}sqlLiteralNumber(d){return d}ignoreInProject(d){return!1}exprToSQL(d,l){switch(l.node){case"now":return this.sqlNowExpr();case"timeDiff":return this.sqlMeasureTimeExpr(l);case"delta":return this.sqlAlterTimeExpr(l);case"trunc":return this.sqlTruncExpr(d,l);case"extract":return this.sqlTimeExtractExpr(d,l);case"cast":return this.sqlCast(d,l);case"regexpMatch":return this.sqlRegexpMatch(l);case"/":return this.divisionIsInteger?`${l.kids.left.sql}*1.0/${l.kids.right.sql}`:void 0;case"%":return this.hasModOperator?void 0:`MOD(${l.kids.left.sql},${l.kids.right.sql})`;case"timeLiteral":return this.sqlLiteralTime(d,l);case"stringLiteral":return this.sqlLiteralString(l.literal);case"numberLiteral":return this.sqlLiteralNumber(l.literal);case"regexpLiteral":return this.sqlLiteralRegexp(l.literal);case"recordLiteral":return this.sqlLiteralRecord(l);case"arrayLiteral":return this.sqlLiteralArray(l)}}sqlSumDistinct(d,l,f){return"sqlSumDistinct called but not implemented"}sqlAggDistinct(d,l,f){return"sqlAggDistinct called but not implemented"}sqlSampleTable(d,l){if(l!==void 0)throw new Error(`Sampling is not supported on dialect ${this.name}.`);return d}sqlOrderBy(d,l){return`ORDER BY ${d.join(",")}`}sqlTzStr(d){return`"${d.queryTimezone}"`}sqlMakeUnnestKey(d,l){return this.concat(d,"'x'",l)}sqlStringAggDistinct(d,l,f){const x="__STRING_AGG_KS__",m="__STRING_AGG_KE__";return`REGEXP_REPLACE(
2
2
  STRING_AGG(DISTINCT ${`concat('${x}', ${d}, '${m}', ${l})`}${f.length>0?","+f:""}),
3
3
  '${x}.*?${m}',
4
4
  ''