@malloy-publisher/server 0.9.6 → 0.9.7

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 (21) hide show
  1. package/dist/app/api-doc.yaml +140 -16
  2. package/dist/app/assets/{EnvironmentPage-wGTml4WZ.js → EnvironmentPage-V6cQ_Kpr.js} +1 -1
  3. package/dist/app/assets/{HomePage-BPFJHBxN.js → HomePage-BM31X4Y8.js} +1 -1
  4. package/dist/app/assets/{MainPage-CNLgQje2.js → MainPage-CQW3P4wB.js} +1 -1
  5. package/dist/app/assets/{ModelPage-Br6I_s4J.js → ModelPage-dBHaHb6u.js} +2 -2
  6. package/dist/app/assets/{PackagePage-B6lmG1Uq.js → PackagePage-B-ruDCyR.js} +1 -1
  7. package/dist/app/assets/{RenderedResult-BUb2Xvr2.es-17Y63pbB.js → RenderedResult-CkUS04tl.es-CNz9JsEK.js} +1 -1
  8. package/dist/app/assets/{RouteError-B4yUUZFj.js → RouteError-DLJlCtRG.js} +1 -1
  9. package/dist/app/assets/{ThemeEditorPage-CjK8EVnV.js → ThemeEditorPage-Ck4rJ1vv.js} +1 -1
  10. package/dist/app/assets/{ToggleButtonGroup-BKiI79mw.js → ToggleButtonGroup-Bwj7gIJm.js} +1 -1
  11. package/dist/app/assets/{documentRoutes-D_78AAbq.js → documentRoutes-DGm_-EUy.js} +1 -1
  12. package/dist/app/assets/{index-B3woRPfQ.js → index-BcsfsLm3.js} +1 -1
  13. package/dist/app/assets/{index-dQ3jNgKw.js → index-D3HZqxOW.js} +1 -1
  14. package/dist/app/assets/{index-BIqIsMFr.js → index-hnA8HjeH.js} +5 -5
  15. package/dist/app/assets/{index-CfX148tj.js → index-wawGd6k1.js} +1 -1
  16. package/dist/app/assets/{index.es-Bhhg6pWY.js → index.es-B2kJpnhe.js} +1 -1
  17. package/dist/app/index.html +1 -1
  18. package/dist/package_load_worker.mjs +113 -9
  19. package/dist/server.mjs +644 -165
  20. package/package.json +2 -2
  21. package/dist/sshcrypto-cqb52edz.node +0 -0
@@ -1,4 +1,4 @@
1
- import{aJ as dd,aK as Ss,aL as eR,aM as aN}from"./index-BIqIsMFr.js";import{r as d2}from"./index-CRAwrhYM.js";function lN(n,y){for(var S=0;S<y.length;S++){const g=y[S];if(typeof g!="string"&&!Array.isArray(g)){for(const h in g)if(h!=="default"&&!(h in n)){const u=Object.getOwnPropertyDescriptor(g,h);u&&Object.defineProperty(n,h,u.get?u:{enumerable:!0,get:()=>g[h]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var xi={},Hh={},bt={},Gh={},Cy;function Pe(){return Cy||(Cy=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.TD=n.ValueType=void 0,n.safeRecordGet=S,n.mkSafeRecord=g,n.exprHasKids=h,n.exprHasE=u,n.exprIsLeaf=l,n.isAsymmetricExpr=a,n.mkTemporal=c,n.isRawCast=r,n.isFilterExprType=o,n.isTimeLiteral=s,n.isParameterType=x,n.paramHasValue=t,n.activeName=m,n.expressionIsScalar=f,n.expressionIsAggregate=p,n.expressionIsUngroupedAggregate=A,n.expressionInvolvesAggregate=T,n.expressionIsCalculation=C,n.expressionIsAnalytic=D,n.isExpressionTypeLEQ=b,n.maxExpressionType=E,n.maxOfExpressionTypes=R,n.hasExpression=v,n.isTemporalType=O,n.isBasicAtomicType=L,n.isAtomicFieldType=M,n.canOrderBy=U,n.fieldIsIntrinsic=H,n.mkFieldDef=ee,n.mkArrayDef=ie,n.mkArrayTypeDef=se,n.isRepeatedRecordFunctionParam=J,n.isRepeatedRecord=W,n.isRecordOrRepeatedRecord=z,n.isBasicArray=X,n.isMatrixOperation=B,n.isJoinable=k,n.isJoined=$,n.isJoinedSource=I,n.isDateUnit=q,n.isTimestampUnit=w,n.isExtractUnit=V,n.refIsStructDef=ue,n.segmentHasErrors=ce,n.structHasErrors=oe,n.isReduceSegment=re,n.isPartialSegment=xe,n.isProjectSegment=fe,n.isQuerySegment=me,n.isSamplingRows=Ae,n.isSamplingPercent=he,n.isSamplingEnable=ge,n.isRawSegment=Re,n.isIndexSegment=je,n.bareFieldUsage=Ge,n.fieldUsageFrom=pe,n.givenUsageFrom=ye,n.mkRefSummary=Ne,n.mapFieldUsage=Fe,n.isSegmentSQL=Ie,n.isSegmentSource=Ve,n.isSourceRegistryReference=ze,n.sourceBase=Be,n.isSourceDef=tt,n.isPersistableSourceDef=rt,n.isBaseTable=Se,n.isLiteral=qe,n.mergeEvalSpaces=We,n.isBasicAtomic=ae,n.isUserTypeDef=de,n.isCompoundArrayData=Ee,n.isTurtle=_e,n.isAtomic=be,n.isValueString=Le,n.isValueNumber=$e,n.isValueBoolean=Je,n.isValueTimestamp=ut,n.isValueDate=ft,n.mergeUniqueKeyRequirement=it;const y=Object.prototype.hasOwnProperty;function S(te,Ce){return y.call(te,Ce)?te[Ce]:void 0}function g(){return Object.create(null)}function h(te){return"kids"in te}function u(te){return"e"in te}function l(te){return!(h(te)||u(te))}function a(te){return te.node==="aggregate"&&["sum","avg","count","distinct"].includes(te.function)}function i(te){return te.node!=="arrayLiteral"&&te.node!=="recordLiteral"}function c(te,Ce){if(!("typeDef"in te)){const Qe=typeof Ce=="string"?{type:Ce}:Ce;if(i(te))return{...te,typeDef:{...Qe}}}return te}function r(te){return"dstSQLType"in te}function o(te){return["string","number","boolean","date","timestamp","timestamptz"].includes(te)}function s(te){return te.node==="dateLiteral"||te.node==="timestampLiteral"||te.node==="timestamptzLiteral"}function x(te){return["string","number","boolean","date","timestamp","timestamptz","filter expression","error"].includes(te)}function t(te){return te.value!==null}function m(te){var Ce;return(Ce=te.as)!==null&&Ce!==void 0?Ce:te.name}function f(te){return te===void 0||te==="scalar"}function p(te){return te==="aggregate"||te==="ungrouped_aggregate"}function A(te){return te==="ungrouped_aggregate"}function T(te){return te==="aggregate"||te==="ungrouped_aggregate"||te==="aggregate_analytic"}function C(te){return te==="aggregate"||te==="scalar_analytic"||te==="aggregate_analytic"||te==="ungrouped_aggregate"}function D(te){return te==="aggregate_analytic"||te==="scalar_analytic"}function N(te){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[te]}function b(te,Ce){return te===Ce||N(te)<N(Ce)}function E(te,Ce){let Qe="scalar";return(te==="aggregate"||Ce==="aggregate")&&(Qe="aggregate"),(te==="ungrouped_aggregate"||Ce==="ungrouped_aggregate")&&(Qe="ungrouped_aggregate"),(te==="scalar_analytic"||Ce==="scalar_analytic")&&(Qe="scalar_analytic"),(te==="aggregate_analytic"||Ce==="aggregate_analytic")&&(Qe="aggregate_analytic"),(te==="scalar_analytic"&&Ce==="aggregate"||te==="aggregate"&&Ce==="scalar_analytic")&&(Qe="aggregate_analytic"),Qe}function R(te){return te.reduce(E,"scalar")}function v(te){return"e"in te&&te.e!==void 0}function O(te){return te==="date"||te==="timestamp"||te==="timestamptz"}function L(te){return["string","number","date","timestamp","timestamptz","boolean","json","sql native","error"].includes(te)}function M(te){return L(te)||te==="record"||te==="array"}function U(te){return["string","number","date","boolean","date","timestamp","timestamptz"].includes(te)}function H(te){return M(te.type)&&!v(te)}function ee(te,Ce){if(X(te))return ie(te.elementTypeDef,Ce);if(W(te)){const{type:Oe,fields:Ue,elementTypeDef:Ke}=te;return{type:Oe,fields:Ue,elementTypeDef:Ke,join:"many",name:Ce}}if(te.type==="record"){const{type:Oe,fields:Ue}=te;return{type:Oe,fields:Ue,join:"one",name:Ce}}const Qe={name:Ce,type:te.type};switch(te.type){case"sql native":return{...Qe,rawType:te.rawType};case"number":{const Oe=te.numberType;return Oe?{...Qe,numberType:Oe}:Qe}case"date":{const Oe=te.timeframe;return Oe?{name:Ce,type:"date",timeframe:Oe}:Qe}case"timestamp":{const Oe={name:Ce,type:"timestamp"};return te.timeframe&&(Oe.timeframe=te.timeframe),Oe}case"timestamptz":{const Oe={name:Ce,type:"timestamptz"};return te.timeframe&&(Oe.timeframe=te.timeframe),Oe}}return Qe}function ie(te,Ce){if(te.type==="record")return{type:"array",join:"many",name:Ce,elementTypeDef:{type:"record_element"},fields:te.fields};const Qe=ee(te,"value");return{type:"array",join:"many",name:Ce,elementTypeDef:te,fields:[Qe,{...Qe,name:"each",e:{node:"field",path:["value"]}}]}}function se(te){return te.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:te.fields}:{type:"array",elementTypeDef:te}}function J(te){return te.type==="array"&&te.elementTypeDef.type==="record_element"}function W(te){return te.type==="array"&&te.elementTypeDef.type==="record_element"}function z(te){return te.type==="record"||te.type==="array"&&"elementTypeDef"in te&&te.elementTypeDef.type==="record_element"}function X(te){return te.type==="array"&&te.elementTypeDef.type!=="record_element"}function B(te){return["left","right","full","inner"].includes(te)}function k(te){return["composite","table","sql_select","query_source","virtual","array","record"].includes(te.type)}function $(te){return"join"in te}function I(te){return tt(te)&&$(te)}function q(te){return["day","week","month","quarter","year"].includes(te)}function w(te){return q(te)||["hour","minute","second"].includes(te)}function V(te){return w(te)||te==="day_of_week"||te==="day_of_year"}var Z;(function(te){te.Date="date",te.Timestamp="timestamp",te.Number="number",te.String="string"})(Z||(n.ValueType=Z={}));function ue(te){return typeof te!="string"}function ce(te){return!!((te.type==="reduce"||te.type==="project"||te.type==="partial")&&(te.extendSource&&te.extendSource.some(Ce=>Ce.type==="error")||te.queryFields.some(Ce=>Ce.type==="error")))}function oe(te){return te.fields.some(Ce=>Ce.type==="error")}function re(te){return te.type==="reduce"}function xe(te){return te.type==="partial"}function fe(te){return te.type==="project"}function me(te){return fe(te)||re(te)}function Ae(te){return te.rows!==void 0}function he(te){return te.percent!==void 0}function ge(te){return te.enable!==void 0}function Re(te){return te.type==="raw"}function je(te){return te.type==="index"}function Ge(te){return te.uniqueKeyRequirement===void 0&&te.analyticFunctionUse===void 0}function pe(te){var Ce;return(Ce=te?.fieldUsage)!==null&&Ce!==void 0?Ce:[]}function ye(te){var Ce;return(Ce=te?.givenUsage)!==null&&Ce!==void 0?Ce:[]}function Ne({fieldUsage:te,givenUsage:Ce}){if(!(te===void 0&&Ce===void 0))return{fieldUsage:te??[],...Ce&&{givenUsage:Ce}}}function Fe(te,Ce){return te&&{...te,fieldUsage:te.fieldUsage.map(Ce)}}function Ie(te){return"sql"in te}function Ve(te){return"type"in te&&(te.type==="sql_select"||te.type==="query_source")}function ze(te){return te.type==="source_registry_reference"}function Be(te){return{...te}}function tt(te){return te.type==="table"||te.type==="sql_select"||te.type==="query_source"||te.type==="query_result"||te.type==="finalize"||te.type==="nest_source"||te.type==="virtual"||te.type==="composite"}function rt(te){return te.type==="sql_select"||te.type==="query_source"}function Se(te){return I(te)?!1:!!tt(te)}function qe(te){return te==="literal"}function We(...te){return te.length<=1&&te.every(Ce=>Ce==="literal")?"literal":te.every(Ce=>Ce==="constant"||Ce==="literal")?"constant":te.every(Ce=>Ce==="output"||Ce==="constant"||Ce==="literal")?"output":"input"}function ae(te){return te.type==="string"||O(te.type)||te.type==="number"||te.type==="boolean"||te.type==="json"||te.type==="sql native"||te.type==="error"}function de(te){return te.type==="userType"}function Ee(te){return Array.isArray(te)&&(te.length===0||typeof te[0]=="object"&&te[0]!==null&&!Array.isArray(te[0]))}function _e(te){return te.type==="turtle"}function be(te){return M(te.type)}function Le(te,Ce){return Ce.type==="string"}function $e(te,Ce){return Ce.type==="number"}function Je(te,Ce){return Ce.type==="boolean"}function ut(te,Ce){return Ce.type==="timestamp"}function ft(te,Ce){return Ce.type==="date"}n.TD={isAtomic(te){return te!==void 0&&M(te.type)},isBasicAtomic(te){return te!==void 0&&ae({type:te.type})},isString:te=>te?.type==="string",isNumber:te=>te?.type==="number",isBoolean:te=>te?.type==="boolean",isJSON:te=>te?.type==="json",isSQL:te=>te?.type==="sql native",isDate:te=>te?.type==="date",isTimestamp:te=>te?.type==="timestamp",isTimestamptz:te=>te?.type==="timestamptz",isAnyTimestamp(te){return te?.type==="timestamp"||te?.type==="timestamptz"},isTemporal(te){var Ce;const Qe=(Ce=te?.type)!==null&&Ce!==void 0?Ce:"";return O(Qe)},isError:te=>te?.type==="error",atomicDef(te){if(!n.TD.isAtomic(te))return{type:"error"};switch(te.type){case"array":return W(te)?{type:"array",elementTypeDef:te.elementTypeDef,fields:te.fields}:{type:"array",elementTypeDef:te.elementTypeDef};case"record":return{type:"record",fields:te.fields};case"number":return te.numberType?{type:"number",numberType:te.numberType}:{type:"number"};case"sql native":return te.rawType?{type:"sql native",rawType:te.rawType}:{type:"sql native"};case"timestamp":case"timestamptz":return te.timeframe?{type:te.type,timeframe:te.timeframe}:{type:te.type};default:return{type:te.type}}},eq(te,Ce){if(te===void 0||Ce===void 0)return!1;function Qe(Oe,Ue){const Ke={},at=Oe.fields||[],Xe=Ue.fields||[];if(at.length!==Xe.length)return!1;for(const Ze of at)if(Ze.name)Ke[Ze.name]=Ze;else return!1;for(const Ze of Xe)if(!n.TD.eq(Ke[Ze.name],Ze))return!1;return!0}return te.type==="array"&&Ce.type==="array"?te.elementTypeDef.type!==Ce.elementTypeDef.type?!1:te.elementTypeDef.type!=="record_element"&&Ce.elementTypeDef.type!=="record_element"?n.TD.eq(te.elementTypeDef,Ce.elementTypeDef):n.TD.isAtomic(te)&&n.TD.isAtomic(Ce)&&Qe(te,Ce):te.type==="record"&&Ce.type==="record"?n.TD.isAtomic(te)&&n.TD.isAtomic(Ce)&&Qe(te,Ce):te.type==="sql native"&&Ce.type==="sql native"?te.rawType!==void 0&&te.rawType===Ce.rawType:te.type===Ce.type}};function it(te,Ce){return te?Ce?{isCount:te.isCount||Ce.isCount}:te:Ce}})(Gh)),Gh}var vy;function $r(){if(vy)return bt;vy=1,Object.defineProperty(bt,"__esModule",{value:!0}),bt.arg=y,bt.spread=S,bt.sql=g,bt.constant=h,bt.output=u,bt.literal=l,bt.variadicParam=a,bt.param=i,bt.makeParam=c,bt.maxScalar=r,bt.maxAggregate=o,bt.anyExprType=s,bt.maxUngroupedAggregate=x,bt.maxAnalytic=t,bt.minScalar=m,bt.minAggregate=f,bt.minAnalytic=p,bt.overload=A,bt.expandBlueprintMap=X,bt.expandOverrideMapFromBase=$,bt.def=q;const n=Pe();function y(w){return{node:"function_parameter",name:w}}function S(w,V=void 0,Z=void 0){return{node:"spread",e:w,prefix:V,suffix:Z}}function g(w,...V){const Z={node:"genericSQLExpr",kids:{args:[]},src:[]},ue=[...V];let ce="";for(const oe of w){ce+=oe;const re=ue.shift();re!==void 0&&(typeof re=="string"?ce+=re:(Z.src.push(ce),Z.kids.args.push(re),ce=""))}return ce.length>0&&Z.src.push(ce),Z}function h(w){return{...w,evalSpace:"constant"}}function u(w){return{...w,evalSpace:"output"}}function l(w){return{...w,evalSpace:"literal"}}function a(w,...V){return{name:w,isVariadic:!0,allowedTypes:V}}function i(w,...V){return{name:w,isVariadic:!1,allowedTypes:V}}function c(w,...V){return{param:i(w,...V),arg:y(w)}}function r(w){return{...w,expressionType:"scalar",evalSpace:"input"}}function o(w){return{...w,expressionType:"aggregate",evalSpace:"input"}}function s(w){return{...w,expressionType:void 0,evalSpace:"input"}}function x(w){return{...w,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function t(w){return{...w,expressionType:"aggregate_analytic",evalSpace:"input"}}function m(w){return{...w,expressionType:"scalar",evalSpace:"input"}}function f(w){return{...w,expressionType:"aggregate",evalSpace:"input"}}function p(w){return{...w,expressionType:"scalar_analytic",evalSpace:"input"}}function A(w,V,Z,ue){return{returnType:w,params:V,e:Z,needsWindowOrderBy:ue?.needsWindowOrderBy,between:ue?.between,isSymmetric:ue?.isSymmetric,supportsOrderBy:ue?.supportsOrderBy,defaultOrderByArgIndex:ue?.defaultOrderByArgIndex,supportsLimit:ue?.supportsLimit}}function T(w,V=!0,Z=!0){if(!V&&w==="any")throw new Error("Return type cannot include any");if(typeof w=="string")return{type:w};if("array"in w){const ue=V?T(w.array,!0):T(w.array,!1);return ue.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ue.fields}:{type:"array",elementTypeDef:ue}}else if("record"in w){const ue=[];for(const[ce,oe]of Object.entries(w.record)){const re=V?T(oe,!0):T(oe,!1);n.TD.isAtomic(re)&&ue.push((0,n.mkFieldDef)(re,ce))}return{type:"record",fields:ue}}else if("generic"in w){if(!Z)throw new Error("Cannot use generic");return{type:"generic",generic:w.generic}}else if("sql_native"in w)return{type:"sql native",rawType:w.sql_native};throw new Error("Cannot figure out type")}function C(w){if(w==="any")throw new Error("Cannot return any type");if(typeof w=="string")return m({type:w});if("array"in w)return s(T(w,!1));if("record"in w)return s(T(w,!1));if("generic"in w)return m(T(w,!1));if("literal"in w)return l(m(T(w.literal,!1)));if("constant"in w)return h(m(T(w.constant,!1)));if("dimension"in w)return m(T(w.dimension,!1));if("measure"in w)return f(T(w.measure,!1));if("sql_native"in w)return s({type:"sql native",rawType:w.sql_native});if("calculation"in w)return p(T(w.calculation,!1));throw new Error("Invalid function blueprint")}function D(w){return typeof w=="string"||"array"in w||"record"in w||"generic"in w||"literal"in w||"constant"in w||"dimension"in w||"measure"in w||"calculation"in w||"sql_native"in w}function N(w){return D(w)?[w]:Array.isArray(w)?w:D(w.variadic)?[w.variadic]:w.variadic}function b(w){if(typeof w=="string")return s({type:w});if("generic"in w)return s(T(w));if("literal"in w)return l(r(T(w.literal)));if("constant"in w)return h(r(T(w.constant)));if("dimension"in w)return r(T(w.dimension));if("measure"in w)return o(T(w.measure));if("array"in w)return s(T(w,!1));if("record"in w)return s(T(w,!1));if("sql_native"in w)return s({type:"sql native",rawType:w.sql_native});if("calculation"in w)return t(T(w.calculation));throw new Error("Invalid function blueprint")}function E(w){return w.map(V=>b(V))}function R(w){return typeof w!="string"&&"variadic"in w}function v(w,V){return{name:w,allowedTypes:E(N(V)),isVariadic:R(V)}}function O(w){return Object.entries(w).map(Z=>v(Z[0],Z[1]))}function L(w){const V=[],Z=[];let ue=w;for(;ue.length>0;){const oe=ue.indexOf("${");if(oe===-1){V.push(ue);break}const re=ue.slice(0,oe);ue=ue.slice(oe);const xe=ue.indexOf("}");if(xe===-1){V.push(re+ue);break}const fe=ue.slice(2,xe);ue=ue.slice(xe+1);const me=fe.startsWith("..."),Ae=fe.endsWith(":"),he=me?fe.slice(3):Ae?fe.slice(0,-1):fe,ge={node:"function_parameter",name:he};V.push(re),me?Z.push({node:"spread",e:ge,prefix:"",suffix:""}):Ae&&he==="order_by"?Z.push({node:"aggregate_order_by"}):Ae&&he==="limit"?Z.push({node:"aggregate_limit"}):Z.push(ge)}return{node:"genericSQLExpr",kids:{args:Z},src:V}}function M(w,V){return R(V)?{node:"spread",e:{node:"function_parameter",name:w},prefix:"",suffix:""}:{node:"function_parameter",name:w}}function U(w,V){const Z=Object.entries(V.takes),ue=Z.length>0?Z.length-1:0;return{node:"genericSQLExpr",kids:{args:Z.map(ce=>M(ce[0],ce[1]))},src:[`${w}(`,...Array(ue).fill(","),")"]}}function H(w){return"sql"in w.impl?L(w.impl.sql):"expr"in w.impl?w.impl.expr:U(w.impl.function,w)}function ee(w){return{e:H(w),between:w.impl.between,needsWindowOrderBy:w.impl.needsWindowOrderBy,defaultOrderByArgIndex:w.impl.defaultOrderByArgIndex}}function ie(w){if(w!==void 0)return Object.entries(w).map(([V,Z])=>({name:V,acceptibleTypes:Z.map(ue=>T(ue,!0,!1))}))}function se(w){return{returnType:C(w.returns),params:O(w.takes),isSymmetric:w.isSymmetric,supportsOrderBy:w.supportsOrderBy,supportsLimit:w.supportsLimit,genericTypes:ie(w.generic),...ee(w)}}function J(w){return"takes"in w&&"returns"in w&&"impl"in w}function W(w){return"function"in w||"sql"in w||"expr"in w}function z(w){return J(w)?[se(w)]:Object.values(w).flatMap(V=>se(V))}function X(w){const V={};for(const Z in w)V[Z]=z(w[Z]);return V}function B(w,V){return[se({...w,impl:V})]}function k(w,V,Z){if(W(Z)){if(!J(V))throw new Error(`Malformed function override: ${w}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(V)})`);return B(V,Z)}else{if(J(V))throw new Error(`Malformed function override: ${w}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(Z)})`);return Object.entries(Z).flatMap(([ue,ce])=>{const oe=V[ue];if(oe===void 0)throw new Error(`Malformed function override: ${w}. No overload named ${ue}`);return B(oe,ce)})}}function $(w,V){const Z={};for(const ue in V){if(!(ue in w))throw new Error(`Malformed function override: ${ue}. No such function in Malloy standard`);Z[ue]=k(ue,w[ue],V[ue])}return Z}function*I(w){if(typeof w!="string"){if("generic"in w)yield w;else if("record"in w)for(const V of Object.values(w.record))yield*I(V);else for(const V of["array","literal","measure","dimension","measure","constant","cacluation"])if(V in w){yield*I(w[V]);return}}}function q(w,V,Z,ue={}){let ce=!1;const oe={};for(const xe of Object.values(V))for(const fe of I(xe))oe[fe.generic]=["any"],ce=!0;ce&&ue.generic===void 0&&(ue.generic=oe);const re={takes:V,returns:Z,impl:{function:w.toUpperCase()},...ue};return{[w]:re}}return bt}var Vh={},i0={},Ry;function f2(){if(Ry)return i0;Ry=1,Object.defineProperty(i0,"__esModule",{value:!0}),i0.decodeDottedTablePath=n,i0.validateDottedTablePath=y;function n(h,u){const{quoteChar:l,escapeStyle:a,bareIdentRegex:i,dialectName:c}=u;if(h.length===0)return{ok:!1,error:`${c} table path is empty`};const r=[];let o=0;for(;;){let s,x;if(h[o]===l){const t=S(h,o,l,a);if(t===null)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — unterminated quoted segment`};s=t.decoded,x=!0,o=t.end}else{const t=h.slice(o).match(i);if(!t||t.index!==0||t[0].length===0)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — invalid segment at position ${o}`};s=t[0],x=!1,o+=t[0].length}if(s.includes(";")||s.includes("--"))return{ok:!1,error:`Invalid ${c} table path: segment ${JSON.stringify(s)} contains forbidden character; even when quoted, table-path segments may not contain \`;\` or \`--\`.`};if(r.push({value:s,quoted:x}),o===h.length)return{ok:!0,segments:r};if(h[o]!==".")return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — expected '.' at position ${o}`};if(o++,o===h.length)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — trailing dot`}}}function y(h,u){const l=n(h,u);return l.ok?{ok:!0,canonical:h}:l}function S(h,u,l,a){let i=u+1,c="";for(;i<h.length;){if(a==="backslash"&&h[i]==="\\"){if(i+1>=h.length)return null;c+=g(h[i+1]),i+=2;continue}if(h[i]===l){if(a==="doubled"&&h[i+1]===l){c+=l,i+=2;continue}return{decoded:c,end:i+1}}c+=h[i],i++}return null}function g(h){switch(h){case"n":return`
1
+ import{aJ as dd,aK as Ss,aL as eR,aM as aN}from"./index-hnA8HjeH.js";import{r as d2}from"./index-CRAwrhYM.js";function lN(n,y){for(var S=0;S<y.length;S++){const g=y[S];if(typeof g!="string"&&!Array.isArray(g)){for(const h in g)if(h!=="default"&&!(h in n)){const u=Object.getOwnPropertyDescriptor(g,h);u&&Object.defineProperty(n,h,u.get?u:{enumerable:!0,get:()=>g[h]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var xi={},Hh={},bt={},Gh={},Cy;function Pe(){return Cy||(Cy=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.TD=n.ValueType=void 0,n.safeRecordGet=S,n.mkSafeRecord=g,n.exprHasKids=h,n.exprHasE=u,n.exprIsLeaf=l,n.isAsymmetricExpr=a,n.mkTemporal=c,n.isRawCast=r,n.isFilterExprType=o,n.isTimeLiteral=s,n.isParameterType=x,n.paramHasValue=t,n.activeName=m,n.expressionIsScalar=f,n.expressionIsAggregate=p,n.expressionIsUngroupedAggregate=A,n.expressionInvolvesAggregate=T,n.expressionIsCalculation=C,n.expressionIsAnalytic=D,n.isExpressionTypeLEQ=b,n.maxExpressionType=E,n.maxOfExpressionTypes=R,n.hasExpression=v,n.isTemporalType=O,n.isBasicAtomicType=L,n.isAtomicFieldType=M,n.canOrderBy=U,n.fieldIsIntrinsic=H,n.mkFieldDef=ee,n.mkArrayDef=ie,n.mkArrayTypeDef=se,n.isRepeatedRecordFunctionParam=J,n.isRepeatedRecord=W,n.isRecordOrRepeatedRecord=z,n.isBasicArray=X,n.isMatrixOperation=B,n.isJoinable=k,n.isJoined=$,n.isJoinedSource=I,n.isDateUnit=q,n.isTimestampUnit=w,n.isExtractUnit=V,n.refIsStructDef=ue,n.segmentHasErrors=ce,n.structHasErrors=oe,n.isReduceSegment=re,n.isPartialSegment=xe,n.isProjectSegment=fe,n.isQuerySegment=me,n.isSamplingRows=Ae,n.isSamplingPercent=he,n.isSamplingEnable=ge,n.isRawSegment=Re,n.isIndexSegment=je,n.bareFieldUsage=Ge,n.fieldUsageFrom=pe,n.givenUsageFrom=ye,n.mkRefSummary=Ne,n.mapFieldUsage=Fe,n.isSegmentSQL=Ie,n.isSegmentSource=Ve,n.isSourceRegistryReference=ze,n.sourceBase=Be,n.isSourceDef=tt,n.isPersistableSourceDef=rt,n.isBaseTable=Se,n.isLiteral=qe,n.mergeEvalSpaces=We,n.isBasicAtomic=ae,n.isUserTypeDef=de,n.isCompoundArrayData=Ee,n.isTurtle=_e,n.isAtomic=be,n.isValueString=Le,n.isValueNumber=$e,n.isValueBoolean=Je,n.isValueTimestamp=ut,n.isValueDate=ft,n.mergeUniqueKeyRequirement=it;const y=Object.prototype.hasOwnProperty;function S(te,Ce){return y.call(te,Ce)?te[Ce]:void 0}function g(){return Object.create(null)}function h(te){return"kids"in te}function u(te){return"e"in te}function l(te){return!(h(te)||u(te))}function a(te){return te.node==="aggregate"&&["sum","avg","count","distinct"].includes(te.function)}function i(te){return te.node!=="arrayLiteral"&&te.node!=="recordLiteral"}function c(te,Ce){if(!("typeDef"in te)){const Qe=typeof Ce=="string"?{type:Ce}:Ce;if(i(te))return{...te,typeDef:{...Qe}}}return te}function r(te){return"dstSQLType"in te}function o(te){return["string","number","boolean","date","timestamp","timestamptz"].includes(te)}function s(te){return te.node==="dateLiteral"||te.node==="timestampLiteral"||te.node==="timestamptzLiteral"}function x(te){return["string","number","boolean","date","timestamp","timestamptz","filter expression","error"].includes(te)}function t(te){return te.value!==null}function m(te){var Ce;return(Ce=te.as)!==null&&Ce!==void 0?Ce:te.name}function f(te){return te===void 0||te==="scalar"}function p(te){return te==="aggregate"||te==="ungrouped_aggregate"}function A(te){return te==="ungrouped_aggregate"}function T(te){return te==="aggregate"||te==="ungrouped_aggregate"||te==="aggregate_analytic"}function C(te){return te==="aggregate"||te==="scalar_analytic"||te==="aggregate_analytic"||te==="ungrouped_aggregate"}function D(te){return te==="aggregate_analytic"||te==="scalar_analytic"}function N(te){return{scalar:0,aggregate:1,ungrouped_aggregate:2,scalar_analytic:2,aggregate_analytic:3}[te]}function b(te,Ce){return te===Ce||N(te)<N(Ce)}function E(te,Ce){let Qe="scalar";return(te==="aggregate"||Ce==="aggregate")&&(Qe="aggregate"),(te==="ungrouped_aggregate"||Ce==="ungrouped_aggregate")&&(Qe="ungrouped_aggregate"),(te==="scalar_analytic"||Ce==="scalar_analytic")&&(Qe="scalar_analytic"),(te==="aggregate_analytic"||Ce==="aggregate_analytic")&&(Qe="aggregate_analytic"),(te==="scalar_analytic"&&Ce==="aggregate"||te==="aggregate"&&Ce==="scalar_analytic")&&(Qe="aggregate_analytic"),Qe}function R(te){return te.reduce(E,"scalar")}function v(te){return"e"in te&&te.e!==void 0}function O(te){return te==="date"||te==="timestamp"||te==="timestamptz"}function L(te){return["string","number","date","timestamp","timestamptz","boolean","json","sql native","error"].includes(te)}function M(te){return L(te)||te==="record"||te==="array"}function U(te){return["string","number","date","boolean","date","timestamp","timestamptz"].includes(te)}function H(te){return M(te.type)&&!v(te)}function ee(te,Ce){if(X(te))return ie(te.elementTypeDef,Ce);if(W(te)){const{type:Oe,fields:Ue,elementTypeDef:Ke}=te;return{type:Oe,fields:Ue,elementTypeDef:Ke,join:"many",name:Ce}}if(te.type==="record"){const{type:Oe,fields:Ue}=te;return{type:Oe,fields:Ue,join:"one",name:Ce}}const Qe={name:Ce,type:te.type};switch(te.type){case"sql native":return{...Qe,rawType:te.rawType};case"number":{const Oe=te.numberType;return Oe?{...Qe,numberType:Oe}:Qe}case"date":{const Oe=te.timeframe;return Oe?{name:Ce,type:"date",timeframe:Oe}:Qe}case"timestamp":{const Oe={name:Ce,type:"timestamp"};return te.timeframe&&(Oe.timeframe=te.timeframe),Oe}case"timestamptz":{const Oe={name:Ce,type:"timestamptz"};return te.timeframe&&(Oe.timeframe=te.timeframe),Oe}}return Qe}function ie(te,Ce){if(te.type==="record")return{type:"array",join:"many",name:Ce,elementTypeDef:{type:"record_element"},fields:te.fields};const Qe=ee(te,"value");return{type:"array",join:"many",name:Ce,elementTypeDef:te,fields:[Qe,{...Qe,name:"each",e:{node:"field",path:["value"]}}]}}function se(te){return te.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:te.fields}:{type:"array",elementTypeDef:te}}function J(te){return te.type==="array"&&te.elementTypeDef.type==="record_element"}function W(te){return te.type==="array"&&te.elementTypeDef.type==="record_element"}function z(te){return te.type==="record"||te.type==="array"&&"elementTypeDef"in te&&te.elementTypeDef.type==="record_element"}function X(te){return te.type==="array"&&te.elementTypeDef.type!=="record_element"}function B(te){return["left","right","full","inner"].includes(te)}function k(te){return["composite","table","sql_select","query_source","virtual","array","record"].includes(te.type)}function $(te){return"join"in te}function I(te){return tt(te)&&$(te)}function q(te){return["day","week","month","quarter","year"].includes(te)}function w(te){return q(te)||["hour","minute","second"].includes(te)}function V(te){return w(te)||te==="day_of_week"||te==="day_of_year"}var Z;(function(te){te.Date="date",te.Timestamp="timestamp",te.Number="number",te.String="string"})(Z||(n.ValueType=Z={}));function ue(te){return typeof te!="string"}function ce(te){return!!((te.type==="reduce"||te.type==="project"||te.type==="partial")&&(te.extendSource&&te.extendSource.some(Ce=>Ce.type==="error")||te.queryFields.some(Ce=>Ce.type==="error")))}function oe(te){return te.fields.some(Ce=>Ce.type==="error")}function re(te){return te.type==="reduce"}function xe(te){return te.type==="partial"}function fe(te){return te.type==="project"}function me(te){return fe(te)||re(te)}function Ae(te){return te.rows!==void 0}function he(te){return te.percent!==void 0}function ge(te){return te.enable!==void 0}function Re(te){return te.type==="raw"}function je(te){return te.type==="index"}function Ge(te){return te.uniqueKeyRequirement===void 0&&te.analyticFunctionUse===void 0}function pe(te){var Ce;return(Ce=te?.fieldUsage)!==null&&Ce!==void 0?Ce:[]}function ye(te){var Ce;return(Ce=te?.givenUsage)!==null&&Ce!==void 0?Ce:[]}function Ne({fieldUsage:te,givenUsage:Ce}){if(!(te===void 0&&Ce===void 0))return{fieldUsage:te??[],...Ce&&{givenUsage:Ce}}}function Fe(te,Ce){return te&&{...te,fieldUsage:te.fieldUsage.map(Ce)}}function Ie(te){return"sql"in te}function Ve(te){return"type"in te&&(te.type==="sql_select"||te.type==="query_source")}function ze(te){return te.type==="source_registry_reference"}function Be(te){return{...te}}function tt(te){return te.type==="table"||te.type==="sql_select"||te.type==="query_source"||te.type==="query_result"||te.type==="finalize"||te.type==="nest_source"||te.type==="virtual"||te.type==="composite"}function rt(te){return te.type==="sql_select"||te.type==="query_source"}function Se(te){return I(te)?!1:!!tt(te)}function qe(te){return te==="literal"}function We(...te){return te.length<=1&&te.every(Ce=>Ce==="literal")?"literal":te.every(Ce=>Ce==="constant"||Ce==="literal")?"constant":te.every(Ce=>Ce==="output"||Ce==="constant"||Ce==="literal")?"output":"input"}function ae(te){return te.type==="string"||O(te.type)||te.type==="number"||te.type==="boolean"||te.type==="json"||te.type==="sql native"||te.type==="error"}function de(te){return te.type==="userType"}function Ee(te){return Array.isArray(te)&&(te.length===0||typeof te[0]=="object"&&te[0]!==null&&!Array.isArray(te[0]))}function _e(te){return te.type==="turtle"}function be(te){return M(te.type)}function Le(te,Ce){return Ce.type==="string"}function $e(te,Ce){return Ce.type==="number"}function Je(te,Ce){return Ce.type==="boolean"}function ut(te,Ce){return Ce.type==="timestamp"}function ft(te,Ce){return Ce.type==="date"}n.TD={isAtomic(te){return te!==void 0&&M(te.type)},isBasicAtomic(te){return te!==void 0&&ae({type:te.type})},isString:te=>te?.type==="string",isNumber:te=>te?.type==="number",isBoolean:te=>te?.type==="boolean",isJSON:te=>te?.type==="json",isSQL:te=>te?.type==="sql native",isDate:te=>te?.type==="date",isTimestamp:te=>te?.type==="timestamp",isTimestamptz:te=>te?.type==="timestamptz",isAnyTimestamp(te){return te?.type==="timestamp"||te?.type==="timestamptz"},isTemporal(te){var Ce;const Qe=(Ce=te?.type)!==null&&Ce!==void 0?Ce:"";return O(Qe)},isError:te=>te?.type==="error",atomicDef(te){if(!n.TD.isAtomic(te))return{type:"error"};switch(te.type){case"array":return W(te)?{type:"array",elementTypeDef:te.elementTypeDef,fields:te.fields}:{type:"array",elementTypeDef:te.elementTypeDef};case"record":return{type:"record",fields:te.fields};case"number":return te.numberType?{type:"number",numberType:te.numberType}:{type:"number"};case"sql native":return te.rawType?{type:"sql native",rawType:te.rawType}:{type:"sql native"};case"timestamp":case"timestamptz":return te.timeframe?{type:te.type,timeframe:te.timeframe}:{type:te.type};default:return{type:te.type}}},eq(te,Ce){if(te===void 0||Ce===void 0)return!1;function Qe(Oe,Ue){const Ke={},at=Oe.fields||[],Xe=Ue.fields||[];if(at.length!==Xe.length)return!1;for(const Ze of at)if(Ze.name)Ke[Ze.name]=Ze;else return!1;for(const Ze of Xe)if(!n.TD.eq(Ke[Ze.name],Ze))return!1;return!0}return te.type==="array"&&Ce.type==="array"?te.elementTypeDef.type!==Ce.elementTypeDef.type?!1:te.elementTypeDef.type!=="record_element"&&Ce.elementTypeDef.type!=="record_element"?n.TD.eq(te.elementTypeDef,Ce.elementTypeDef):n.TD.isAtomic(te)&&n.TD.isAtomic(Ce)&&Qe(te,Ce):te.type==="record"&&Ce.type==="record"?n.TD.isAtomic(te)&&n.TD.isAtomic(Ce)&&Qe(te,Ce):te.type==="sql native"&&Ce.type==="sql native"?te.rawType!==void 0&&te.rawType===Ce.rawType:te.type===Ce.type}};function it(te,Ce){return te?Ce?{isCount:te.isCount||Ce.isCount}:te:Ce}})(Gh)),Gh}var vy;function $r(){if(vy)return bt;vy=1,Object.defineProperty(bt,"__esModule",{value:!0}),bt.arg=y,bt.spread=S,bt.sql=g,bt.constant=h,bt.output=u,bt.literal=l,bt.variadicParam=a,bt.param=i,bt.makeParam=c,bt.maxScalar=r,bt.maxAggregate=o,bt.anyExprType=s,bt.maxUngroupedAggregate=x,bt.maxAnalytic=t,bt.minScalar=m,bt.minAggregate=f,bt.minAnalytic=p,bt.overload=A,bt.expandBlueprintMap=X,bt.expandOverrideMapFromBase=$,bt.def=q;const n=Pe();function y(w){return{node:"function_parameter",name:w}}function S(w,V=void 0,Z=void 0){return{node:"spread",e:w,prefix:V,suffix:Z}}function g(w,...V){const Z={node:"genericSQLExpr",kids:{args:[]},src:[]},ue=[...V];let ce="";for(const oe of w){ce+=oe;const re=ue.shift();re!==void 0&&(typeof re=="string"?ce+=re:(Z.src.push(ce),Z.kids.args.push(re),ce=""))}return ce.length>0&&Z.src.push(ce),Z}function h(w){return{...w,evalSpace:"constant"}}function u(w){return{...w,evalSpace:"output"}}function l(w){return{...w,evalSpace:"literal"}}function a(w,...V){return{name:w,isVariadic:!0,allowedTypes:V}}function i(w,...V){return{name:w,isVariadic:!1,allowedTypes:V}}function c(w,...V){return{param:i(w,...V),arg:y(w)}}function r(w){return{...w,expressionType:"scalar",evalSpace:"input"}}function o(w){return{...w,expressionType:"aggregate",evalSpace:"input"}}function s(w){return{...w,expressionType:void 0,evalSpace:"input"}}function x(w){return{...w,expressionType:"ungrouped_aggregate",evalSpace:"input"}}function t(w){return{...w,expressionType:"aggregate_analytic",evalSpace:"input"}}function m(w){return{...w,expressionType:"scalar",evalSpace:"input"}}function f(w){return{...w,expressionType:"aggregate",evalSpace:"input"}}function p(w){return{...w,expressionType:"scalar_analytic",evalSpace:"input"}}function A(w,V,Z,ue){return{returnType:w,params:V,e:Z,needsWindowOrderBy:ue?.needsWindowOrderBy,between:ue?.between,isSymmetric:ue?.isSymmetric,supportsOrderBy:ue?.supportsOrderBy,defaultOrderByArgIndex:ue?.defaultOrderByArgIndex,supportsLimit:ue?.supportsLimit}}function T(w,V=!0,Z=!0){if(!V&&w==="any")throw new Error("Return type cannot include any");if(typeof w=="string")return{type:w};if("array"in w){const ue=V?T(w.array,!0):T(w.array,!1);return ue.type==="record"?{type:"array",elementTypeDef:{type:"record_element"},fields:ue.fields}:{type:"array",elementTypeDef:ue}}else if("record"in w){const ue=[];for(const[ce,oe]of Object.entries(w.record)){const re=V?T(oe,!0):T(oe,!1);n.TD.isAtomic(re)&&ue.push((0,n.mkFieldDef)(re,ce))}return{type:"record",fields:ue}}else if("generic"in w){if(!Z)throw new Error("Cannot use generic");return{type:"generic",generic:w.generic}}else if("sql_native"in w)return{type:"sql native",rawType:w.sql_native};throw new Error("Cannot figure out type")}function C(w){if(w==="any")throw new Error("Cannot return any type");if(typeof w=="string")return m({type:w});if("array"in w)return s(T(w,!1));if("record"in w)return s(T(w,!1));if("generic"in w)return m(T(w,!1));if("literal"in w)return l(m(T(w.literal,!1)));if("constant"in w)return h(m(T(w.constant,!1)));if("dimension"in w)return m(T(w.dimension,!1));if("measure"in w)return f(T(w.measure,!1));if("sql_native"in w)return s({type:"sql native",rawType:w.sql_native});if("calculation"in w)return p(T(w.calculation,!1));throw new Error("Invalid function blueprint")}function D(w){return typeof w=="string"||"array"in w||"record"in w||"generic"in w||"literal"in w||"constant"in w||"dimension"in w||"measure"in w||"calculation"in w||"sql_native"in w}function N(w){return D(w)?[w]:Array.isArray(w)?w:D(w.variadic)?[w.variadic]:w.variadic}function b(w){if(typeof w=="string")return s({type:w});if("generic"in w)return s(T(w));if("literal"in w)return l(r(T(w.literal)));if("constant"in w)return h(r(T(w.constant)));if("dimension"in w)return r(T(w.dimension));if("measure"in w)return o(T(w.measure));if("array"in w)return s(T(w,!1));if("record"in w)return s(T(w,!1));if("sql_native"in w)return s({type:"sql native",rawType:w.sql_native});if("calculation"in w)return t(T(w.calculation));throw new Error("Invalid function blueprint")}function E(w){return w.map(V=>b(V))}function R(w){return typeof w!="string"&&"variadic"in w}function v(w,V){return{name:w,allowedTypes:E(N(V)),isVariadic:R(V)}}function O(w){return Object.entries(w).map(Z=>v(Z[0],Z[1]))}function L(w){const V=[],Z=[];let ue=w;for(;ue.length>0;){const oe=ue.indexOf("${");if(oe===-1){V.push(ue);break}const re=ue.slice(0,oe);ue=ue.slice(oe);const xe=ue.indexOf("}");if(xe===-1){V.push(re+ue);break}const fe=ue.slice(2,xe);ue=ue.slice(xe+1);const me=fe.startsWith("..."),Ae=fe.endsWith(":"),he=me?fe.slice(3):Ae?fe.slice(0,-1):fe,ge={node:"function_parameter",name:he};V.push(re),me?Z.push({node:"spread",e:ge,prefix:"",suffix:""}):Ae&&he==="order_by"?Z.push({node:"aggregate_order_by"}):Ae&&he==="limit"?Z.push({node:"aggregate_limit"}):Z.push(ge)}return{node:"genericSQLExpr",kids:{args:Z},src:V}}function M(w,V){return R(V)?{node:"spread",e:{node:"function_parameter",name:w},prefix:"",suffix:""}:{node:"function_parameter",name:w}}function U(w,V){const Z=Object.entries(V.takes),ue=Z.length>0?Z.length-1:0;return{node:"genericSQLExpr",kids:{args:Z.map(ce=>M(ce[0],ce[1]))},src:[`${w}(`,...Array(ue).fill(","),")"]}}function H(w){return"sql"in w.impl?L(w.impl.sql):"expr"in w.impl?w.impl.expr:U(w.impl.function,w)}function ee(w){return{e:H(w),between:w.impl.between,needsWindowOrderBy:w.impl.needsWindowOrderBy,defaultOrderByArgIndex:w.impl.defaultOrderByArgIndex}}function ie(w){if(w!==void 0)return Object.entries(w).map(([V,Z])=>({name:V,acceptibleTypes:Z.map(ue=>T(ue,!0,!1))}))}function se(w){return{returnType:C(w.returns),params:O(w.takes),isSymmetric:w.isSymmetric,supportsOrderBy:w.supportsOrderBy,supportsLimit:w.supportsLimit,genericTypes:ie(w.generic),...ee(w)}}function J(w){return"takes"in w&&"returns"in w&&"impl"in w}function W(w){return"function"in w||"sql"in w||"expr"in w}function z(w){return J(w)?[se(w)]:Object.values(w).flatMap(V=>se(V))}function X(w){const V={};for(const Z in w)V[Z]=z(w[Z]);return V}function B(w,V){return[se({...w,impl:V})]}function k(w,V,Z){if(W(Z)){if(!J(V))throw new Error(`Malformed function override: ${w}. Attempt to override multiple overloads with a single overload (missing: ${Object.keys(V)})`);return B(V,Z)}else{if(J(V))throw new Error(`Malformed function override: ${w}. Attempt to override a single overload with multiple overloads (extraneous: ${Object.keys(Z)})`);return Object.entries(Z).flatMap(([ue,ce])=>{const oe=V[ue];if(oe===void 0)throw new Error(`Malformed function override: ${w}. No overload named ${ue}`);return B(oe,ce)})}}function $(w,V){const Z={};for(const ue in V){if(!(ue in w))throw new Error(`Malformed function override: ${ue}. No such function in Malloy standard`);Z[ue]=k(ue,w[ue],V[ue])}return Z}function*I(w){if(typeof w!="string"){if("generic"in w)yield w;else if("record"in w)for(const V of Object.values(w.record))yield*I(V);else for(const V of["array","literal","measure","dimension","measure","constant","cacluation"])if(V in w){yield*I(w[V]);return}}}function q(w,V,Z,ue={}){let ce=!1;const oe={};for(const xe of Object.values(V))for(const fe of I(xe))oe[fe.generic]=["any"],ce=!0;ce&&ue.generic===void 0&&(ue.generic=oe);const re={takes:V,returns:Z,impl:{function:w.toUpperCase()},...ue};return{[w]:re}}return bt}var Vh={},i0={},Ry;function f2(){if(Ry)return i0;Ry=1,Object.defineProperty(i0,"__esModule",{value:!0}),i0.decodeDottedTablePath=n,i0.validateDottedTablePath=y;function n(h,u){const{quoteChar:l,escapeStyle:a,bareIdentRegex:i,dialectName:c}=u;if(h.length===0)return{ok:!1,error:`${c} table path is empty`};const r=[];let o=0;for(;;){let s,x;if(h[o]===l){const t=S(h,o,l,a);if(t===null)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — unterminated quoted segment`};s=t.decoded,x=!0,o=t.end}else{const t=h.slice(o).match(i);if(!t||t.index!==0||t[0].length===0)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — invalid segment at position ${o}`};s=t[0],x=!1,o+=t[0].length}if(s.includes(";")||s.includes("--"))return{ok:!1,error:`Invalid ${c} table path: segment ${JSON.stringify(s)} contains forbidden character; even when quoted, table-path segments may not contain \`;\` or \`--\`.`};if(r.push({value:s,quoted:x}),o===h.length)return{ok:!0,segments:r};if(h[o]!==".")return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — expected '.' at position ${o}`};if(o++,o===h.length)return{ok:!1,error:`Invalid ${c} table path: ${JSON.stringify(h)} — trailing dot`}}}function y(h,u){const l=n(h,u);return l.ok?{ok:!0,canonical:h}:l}function S(h,u,l,a){let i=u+1,c="";for(;i<h.length;){if(a==="backslash"&&h[i]==="\\"){if(i+1>=h.length)return null;c+=g(h[i+1]),i+=2;continue}if(h[i]===l){if(a==="doubled"&&h[i+1]===l){c+=l,i+=2;continue}return{decoded:c,end:i+1}}c+=h[i],i++}return null}function g(h){switch(h){case"n":return`
2
2
  `;case"t":return" ";case"r":return"\r";default:return h}}return i0}var Dy;function jr(){return Dy||(Dy=1,(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.Dialect=n.dayIndex=n.EscapeStyle=n.MAX_DECIMAL38=n.MIN_DECIMAL38=n.MAX_INT128=n.MIN_INT128=n.MAX_INT64=n.MIN_INT64=n.MAX_INT32=n.MIN_INT32=void 0,n.inDays=h,n.qtz=u,n.turtleGroupSetCondition=l;const y=Pe(),S=f2();n.MIN_INT32=-2147483648,n.MAX_INT32=2147483647,n.MIN_INT64=BigInt("-9223372036854775808"),n.MAX_INT64=BigInt("9223372036854775807"),n.MIN_INT128=BigInt("-170141183460469231731687303715884105728"),n.MAX_INT128=BigInt("170141183460469231731687303715884105727"),n.MIN_DECIMAL38=BigInt("-99999999999999999999999999999999999999"),n.MAX_DECIMAL38=BigInt("99999999999999999999999999999999999999"),n.EscapeStyle={Doubled:"doubled",Backslash:"backslash",Unset:"unset"};const g=["microsecond","millisecond","second","minute","hour","day","week","month","quarter","year"];n.dayIndex=g.indexOf("day");function h(i){return g.indexOf(i)>=n.dayIndex}function u(i){const c=i.queryTimezone;if(!(c===void 0||c===i.systemTimezone))return c}function l(i,c){return i===void 0?c:c?`group_set=${i} AND ${c}`:`group_set=${i}`}class a{constructor(){this.experimentalAccepted=!1,this.cantPartitionWindowFunctionsOnExpressions=!1,this.supportsPipelinesInViews=!0,this.supportsNestedProjectionLimit=!1,this.supportsArraysInData=!0,this.hasTimestamptz=!1,this.readsNestedData=!0,this.orderByClause="ordinal",this.groupByClause="ordinal",this.nullMatchesFunctionSignature=!0,this.supportsSelectReplace=!0,this.supportsBigIntPrecision=!0,this.supportsComplexFilteredSources=!0,this.supportsTempTables=!0,this.maxIdentifierLength=128,this.hasModOperator=!0,this.supportsLeftJoinUnnest=!0,this.requiresExplicitUnnestOrdering=!1,this.hasLateralColumnAliasInSelect=!1,this.supportsCountApprox=!1,this.supportsHyperLogLog=!1,this.supportsFullJoin=!0,this.nestedArrays=!0,this.compoundObjectInSchema=!0,this.booleanType="supported",this.likeEscape=!0,this.likeExtraWildcards=[],this.integerTypeMappings=[{min:BigInt(n.MIN_INT32),max:BigInt(n.MAX_INT32),numberType:"integer"},{min:n.MIN_INT64,max:n.MAX_INT64,numberType:"bigint"}],this.tablePathBareIdentRegex=/^[A-Za-z_][A-Za-z0-9_]*/,this.identifierQuoteChar="",this.stringLiteralStyle=n.EscapeStyle.Unset,this.identifierEscapeStyle=n.EscapeStyle.Unset}isExperimental(){return this.experimental&&!this.experimentalAccepted}acceptExperimental(){this.experimentalAccepted=!0}sqlLateralJoinBag(c){throw this.cantPartitionWindowFunctionsOnExpressions?new Error(`Dialect '${this.name}' sets cantPartitionWindowFunctionsOnExpressions but does not implement sqlLateralJoinBag`):new Error("Internal error: sqlLateralJoinBag called but cantPartitionWindowFunctionsOnExpressions is false")}sqlOrderByLimit(c,r){let o=c.length>0?this.sqlOrderBy(c,"query")+`
3
3
  `:"";return r!==void 0&&(o+=`LIMIT ${r}
4
4
  `),o}literalNumberType(c){if(!/^-?\d+$/.test(c))return{type:"number",numberType:"float"};const o=BigInt(c);for(const s of this.integerTypeMappings)if(o>=s.min&&o<=s.max)return{type:"number",numberType:s.numberType};return{type:"number",numberType:"bigint"}}static makeTimeLiteralNode(c,r,o,s,x){var t;const m=(t=c?.hasTimestamptz)!==null&&t!==void 0?t:!1;return x==="date"?{node:"dateLiteral",literal:r,typeDef:{type:"date",timeframe:s!==void 0&&(0,y.isDateUnit)(s)?s:void 0}}:o&&m?{node:"timestamptzLiteral",literal:r,typeDef:{type:"timestamptz",timeframe:s},timezone:o}:o?{node:"timestampLiteral",literal:r,typeDef:{type:"timestamp",timeframe:s},timezone:o}:{node:"timestampLiteral",literal:r,typeDef:{type:"timestamp",timeframe:s}}}sqlValidateTableName(c){if(this.identifierEscapeStyle!==n.EscapeStyle.Doubled&&this.identifierEscapeStyle!==n.EscapeStyle.Backslash)throw new Error(`${this.name}: sqlValidateTableName requires identifierEscapeStyle to be set to Doubled or Backslash (or override sqlValidateTableName).`);return(0,S.validateDottedTablePath)(c,{quoteChar:this.identifierQuoteChar,escapeStyle:this.identifierEscapeStyle,bareIdentRegex:this.tablePathBareIdentRegex,dialectName:this.name})}sqlTurtleOrderByClause(c){const r=c.map(o=>` ${o.field} ${o.dir.toUpperCase()}`);return" "+this.sqlOrderBy(r,"turtle")}sqlCombineLastStageOrderBy(c,r){return c===void 0||c.length===0?"":` ORDER BY ${c.map(s=>{const x=typeof s.field=="string"?s.field:r[s.field-1].rawName;return`${this.sqlQuoteIdentifier(x)} ${s.dir||"asc"}`}).join(", ")}`}sqlFinalStage(c,r){throw new Error("Dialect has no final Stage but called Anyway")}sqlDateToString(c){return this.castToString(`DATE(${c})`)}escapeBackslashStyle(c,r){let o="";for(const s of c)switch(s){case"\\":o+="\\\\";break;case`