@malloydata/render 0.0.231 → 0.0.232-dev250118020814

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.
@@ -54337,7 +54337,7 @@ Md.exploreQueryWalkerBuilder = V6e;
54337
54337
  var Oe = {}, cS = {};
54338
54338
  Object.defineProperty(cS, "__esModule", { value: !0 });
54339
54339
  cS.MALLOY_VERSION = void 0;
54340
- cS.MALLOY_VERSION = "0.0.231";
54340
+ cS.MALLOY_VERSION = "0.0.232";
54341
54341
  Object.defineProperty(Oe, "__esModule", { value: !0 });
54342
54342
  Oe.CSVWriter = Oe.JSONWriter = Oe.DataWriter = Oe.DataRecord = Oe.DataArray = Oe.Result = Oe.ExploreMaterializer = Oe.PreparedResultMaterializer = Oe.QueryMaterializer = Oe.ModelMaterializer = Oe.SingleConnectionRuntime = Oe.ConnectionRuntime = Oe.Runtime = Oe.ExploreField = Oe.JoinRelationship = Oe.QueryField = Oe.Query = Oe.StringField = Oe.UnsupportedField = Oe.JSONField = Oe.BooleanField = Oe.NumberField = Oe.TimestampField = Oe.DateField = Oe.TimestampTimeframe = Oe.DateTimeframe = Oe.AtomicField = Oe.AtomicFieldType = Oe.Explore = Oe.SourceRelationship = Oe.FixedConnectionMap = Oe.InMemoryURLReader = Oe.EmptyURLReader = Oe.PreparedResult = Oe.DocumentCompletion = Oe.DocumentSymbol = Oe.DocumentPosition = Oe.DocumentRange = Oe.DocumentTablePath = Oe.Parse = Oe.PreparedQuery = Oe.Model = Oe.MalloyError = Oe.Malloy = void 0;
54343
54343
  const Y6e = S8, Jn = hs, _j = Ww, An = So, B6 = yh, K6e = cS;
@@ -1266,7 +1266,7 @@ QUERY: ${(0,Zz.inspect)(n,{breakLength:72,depth:1/0})}`)}return eQ.ErrorFactory.
1266
1266
  | ${l}`,u>0&&(i=i+`
1267
1267
  | ${" ".repeat(u)}^`)}else i=`line ${o+1}: char ${u}: ${r.message}`}n!==s&&(i=`FILE: ${s}
1268
1268
  `+i,n=s),e!==""?e=`${e}
1269
- ${i}`:e=i}return e}childRequest(e){var n;const r=decodeURI(new URL(e,this.sourceURL).toString()),i=(n=this.childTranslators.get(r))===null||n===void 0?void 0:n.translate();if(i!=null&&i.compileSQL)return{compileSQL:i.compileSQL,partialModel:i.partialModel}}getChildExports(e){const n={},r=decodeURI(new URL(e,this.sourceURL).toString()),i=this.childTranslators.get(r);if(i&&i.translate().modelDef)for(const o of i.modelDef.exports){const u=i.modelDef.contents[o];((0,C6e.isSourceDef)(u)||u.type==="query")&&(n[o]=u)}return n}translate(e){if(this.finalAnswer)return this.finalAnswer;const n=this.translateStep.step(this,e);return n.final&&(this.finalAnswer=n),n}translatorForDependency(e){return this.childTranslators.get(e)}importAt(e){for(let n=0;n<this.imports.length;n++){const r=this.imports[n];if((0,F6e.locationContainsPosition)(r.location,e))return r}}metadata(){return this.metadataStep.step(this)}modelAnnotation(e){return this.modelAnnotationStep.step(this,e)}tablePathInfo(){return this.tablePathInfoStep.step(this)}completions(e){return this.completionsStep.step(this,e)}helpContext(e){return this.helpContextStep.step(this,e)}defaultLocation(){return{url:this.sourceURL,range:{start:{line:0,character:0},end:{line:0,character:0}}}}rangeFromContext(e){return this.rangeFromTokens(e.start,e.stop||e.start)}rangeFromTokens(e,n){const r={line:e.line-1,character:e.charPositionInLine};if(this.parseStep.sourceInfo&&n.stopIndex!==-1){const i=this.parseStep.sourceInfo.lines.length-1;for(let s=e.line-1;s<=i;s++){const o=this.parseStep.sourceInfo.at[s];if(n.stopIndex>=o.begin&&n.stopIndex<o.end)return{start:r,end:{line:s,character:n.stopIndex-o.begin+1}}}return{start:r,end:{line:i,character:this.parseStep.sourceInfo.lines[i].length}}}return{start:r,end:r}}rangeFromToken(e){return this.rangeFromTokens(e,e)}firstReferenceToDialect(e){return this.dialectAlreadyChecked[e]?!1:(this.dialectAlreadyChecked[e]=!0,!0)}experimentalDialectEnabled(e){if(this.allDialectsEnabled)return!0;const n=this.compilerFlags.tag("experimental");return n!==void 0&&(n.bare()||n.has("dialect",e))}}iu.MalloyTranslation=r7;class TG extends r7{constructor(e,n){super(e),this.root=n}}iu.MalloyChildTranslator=TG;class Q6e extends r7{constructor(e,n=null,r=null,i=null){super(e,n),this.eventStream=i,this.schemaZone=new n7.Zone,this.importZone=new n7.Zone,this.pretranslatedModels=new Map,this.sqlQueryZone=new n7.Zone,this.root=this,this.logger=new t7.BaseMessageLogger(i),r&&this.update(r)}update(e){var n,r,i;this.schemaZone.updateFrom(e.tables,(n=e.errors)===null||n===void 0?void 0:n.tables),this.importZone.updateFrom(e.urls,(r=e.errors)===null||r===void 0?void 0:r.urls),this.sqlQueryZone.updateFrom(e.compileSQL,(i=e.errors)===null||i===void 0?void 0:i.compileSQL);for(const s in e.translations)this.pretranslatedModels.set(s,e.translations[s])}logError(e,n,r){return this.logger.log((0,t7.makeLogMessage)(e,n,{severity:"error",...r})),e}}iu.MalloyTranslator=Q6e;class RG{constructor(e,n){this.translator=e,this.messages=n}logError(e,n,r){return this.messages.log((0,t7.makeLogMessage)(e,n,{severity:"error",...r})),e}syntaxError(e,n,r,i,s,o){const u={line:r-1,character:i},a=n?this.translator.rangeFromToken(n):{start:u,end:u};this.logError("syntax-error",{message:s},{at:{url:this.translator.sourceURL,range:a}})}}iu.MalloyParserErrorHandler=RG;function OG(t){return[...Object.keys(t),...Object.keys(t).map(e=>OG(t[e])).flat()]}var Jd={};Object.defineProperty(Jd,"__esModule",{value:!0}),Jd.exploreQueryWalkerBuilder=Jd.ExploreQueryWalker=void 0;const G6e=Sl;class DG{constructor(e){this.inDocument=!1,this.exploreClauseRefs=[],this.tokens=e}exploreQueryAtOffset(e){return this.exploreClauseRefs.find(n=>n.range[0]===void 0||n.range[1]===void 0?!1:n.range[0]<=e&&n.range[1]>=e)}filterAtOffset(e){const n=this.exploreQueryAtOffset(e);if(n)return n.filterRefs.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e)}hasFilterListAtOffset(e){const n=this.exploreQueryAtOffset(e);return n?!!n.filterLists.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e):!1}enterMalloyDocument(){this.inDocument=!0}}Jd.ExploreQueryWalker=DG;function W6e(t,e){const n=new DG(t),r=n;return G6e.ParseTreeWalker.DEFAULT.walk(r,e),n}Jd.exploreQueryWalkerBuilder=W6e,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.exploreQueryWalkerBuilder=t.MalloyTranslation=t.MalloyTranslator=void 0;var e=iu;Object.defineProperty(t,"MalloyTranslator",{enumerable:!0,get:function(){return e.MalloyTranslator}}),Object.defineProperty(t,"MalloyTranslation",{enumerable:!0,get:function(){return e.MalloyTranslation}});var n=Jd;Object.defineProperty(t,"exploreQueryWalkerBuilder",{enumerable:!0,get:function(){return n.exploreQueryWalkerBuilder}})}(cR);var Oe={},Qv={};Object.defineProperty(Qv,"__esModule",{value:!0}),Qv.MALLOY_VERSION=void 0,Qv.MALLOY_VERSION="0.0.231",Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.CSVWriter=Oe.JSONWriter=Oe.DataWriter=Oe.DataRecord=Oe.DataArray=Oe.Result=Oe.ExploreMaterializer=Oe.PreparedResultMaterializer=Oe.QueryMaterializer=Oe.ModelMaterializer=Oe.SingleConnectionRuntime=Oe.ConnectionRuntime=Oe.Runtime=Oe.ExploreField=Oe.JoinRelationship=Oe.QueryField=Oe.Query=Oe.StringField=Oe.UnsupportedField=Oe.JSONField=Oe.BooleanField=Oe.NumberField=Oe.TimestampField=Oe.DateField=Oe.TimestampTimeframe=Oe.DateTimeframe=Oe.AtomicField=Oe.AtomicFieldType=Oe.Explore=Oe.SourceRelationship=Oe.FixedConnectionMap=Oe.InMemoryURLReader=Oe.EmptyURLReader=Oe.PreparedResult=Oe.DocumentCompletion=Oe.DocumentSymbol=Oe.DocumentPosition=Oe.DocumentRange=Oe.DocumentTablePath=Oe.Parse=Oe.PreparedQuery=Oe.Model=Oe.MalloyError=Oe.Malloy=void 0;const V6e=cR,Zn=Qi,NG=tD,_n=Js,i7=Sx,Y6e=Qv;class In{static get version(){return Y6e.MALLOY_VERSION}static _parse(e,n,r,i){n===void 0&&(n=new URL("internal://internal.malloy"));let s=n;i!=null&&i.importBaseURL&&(s=i==null?void 0:i.importBaseURL);const o=new V6e.MalloyTranslator(n.toString(),s.toString(),{urls:{[n.toString()]:e}},r);return i!=null&&i.testEnvironment&&(o.allDialectsEnabled=!0),new FG(o)}static parse({url:e,urlReader:n,source:r,eventStream:i,options:s}){if(r!==void 0)return In._parse(r,e,i,s);if(n===void 0)throw new Error("Internal Error: urlReader is required.");if(e===void 0)throw new Error("Internal Error: url is required if source not present.");return n.readURL(e).then(o=>In._parse(o,e,i,s))}static async compile({urlReader:e,connections:n,parse:r,model:i,refreshSchemaCache:s,noThrowOnError:o,eventStream:u,replaceMaterializedReferences:a,materializedTablePrefix:l}){var c,f,x,h;let p;s&&(p=typeof s=="number"?s:Date.now());const m=r._translator;for(;;){const g=m.translate(i==null?void 0:i._modelDef);if(g.final){if(g.modelDef)return new yg(g.modelDef,g.problems||[],[...(c=i==null?void 0:i.fromSources)!==null&&c!==void 0?c:[],...(f=g.fromSources)!==null&&f!==void 0?f:[]],y=>m.referenceAt(y),y=>m.importAt(y));if(o){const y={name:"modelDidNotCompile",exports:[],contents:{},dependencies:{},queryList:[]},E=(i==null?void 0:i._modelDef)||y;return new yg(E,g.problems||[],[...(x=i==null?void 0:i.fromSources)!==null&&x!==void 0?x:[],...(h=g.fromSources)!==null&&h!==void 0?h:[]],A=>m.referenceAt(A),A=>m.importAt(A))}else{const y=g.problems||[],E=m.prettyErrors();throw new wG(`Error(s) compiling model:
1269
+ ${i}`:e=i}return e}childRequest(e){var n;const r=decodeURI(new URL(e,this.sourceURL).toString()),i=(n=this.childTranslators.get(r))===null||n===void 0?void 0:n.translate();if(i!=null&&i.compileSQL)return{compileSQL:i.compileSQL,partialModel:i.partialModel}}getChildExports(e){const n={},r=decodeURI(new URL(e,this.sourceURL).toString()),i=this.childTranslators.get(r);if(i&&i.translate().modelDef)for(const o of i.modelDef.exports){const u=i.modelDef.contents[o];((0,C6e.isSourceDef)(u)||u.type==="query")&&(n[o]=u)}return n}translate(e){if(this.finalAnswer)return this.finalAnswer;const n=this.translateStep.step(this,e);return n.final&&(this.finalAnswer=n),n}translatorForDependency(e){return this.childTranslators.get(e)}importAt(e){for(let n=0;n<this.imports.length;n++){const r=this.imports[n];if((0,F6e.locationContainsPosition)(r.location,e))return r}}metadata(){return this.metadataStep.step(this)}modelAnnotation(e){return this.modelAnnotationStep.step(this,e)}tablePathInfo(){return this.tablePathInfoStep.step(this)}completions(e){return this.completionsStep.step(this,e)}helpContext(e){return this.helpContextStep.step(this,e)}defaultLocation(){return{url:this.sourceURL,range:{start:{line:0,character:0},end:{line:0,character:0}}}}rangeFromContext(e){return this.rangeFromTokens(e.start,e.stop||e.start)}rangeFromTokens(e,n){const r={line:e.line-1,character:e.charPositionInLine};if(this.parseStep.sourceInfo&&n.stopIndex!==-1){const i=this.parseStep.sourceInfo.lines.length-1;for(let s=e.line-1;s<=i;s++){const o=this.parseStep.sourceInfo.at[s];if(n.stopIndex>=o.begin&&n.stopIndex<o.end)return{start:r,end:{line:s,character:n.stopIndex-o.begin+1}}}return{start:r,end:{line:i,character:this.parseStep.sourceInfo.lines[i].length}}}return{start:r,end:r}}rangeFromToken(e){return this.rangeFromTokens(e,e)}firstReferenceToDialect(e){return this.dialectAlreadyChecked[e]?!1:(this.dialectAlreadyChecked[e]=!0,!0)}experimentalDialectEnabled(e){if(this.allDialectsEnabled)return!0;const n=this.compilerFlags.tag("experimental");return n!==void 0&&(n.bare()||n.has("dialect",e))}}iu.MalloyTranslation=r7;class TG extends r7{constructor(e,n){super(e),this.root=n}}iu.MalloyChildTranslator=TG;class Q6e extends r7{constructor(e,n=null,r=null,i=null){super(e,n),this.eventStream=i,this.schemaZone=new n7.Zone,this.importZone=new n7.Zone,this.pretranslatedModels=new Map,this.sqlQueryZone=new n7.Zone,this.root=this,this.logger=new t7.BaseMessageLogger(i),r&&this.update(r)}update(e){var n,r,i;this.schemaZone.updateFrom(e.tables,(n=e.errors)===null||n===void 0?void 0:n.tables),this.importZone.updateFrom(e.urls,(r=e.errors)===null||r===void 0?void 0:r.urls),this.sqlQueryZone.updateFrom(e.compileSQL,(i=e.errors)===null||i===void 0?void 0:i.compileSQL);for(const s in e.translations)this.pretranslatedModels.set(s,e.translations[s])}logError(e,n,r){return this.logger.log((0,t7.makeLogMessage)(e,n,{severity:"error",...r})),e}}iu.MalloyTranslator=Q6e;class RG{constructor(e,n){this.translator=e,this.messages=n}logError(e,n,r){return this.messages.log((0,t7.makeLogMessage)(e,n,{severity:"error",...r})),e}syntaxError(e,n,r,i,s,o){const u={line:r-1,character:i},a=n?this.translator.rangeFromToken(n):{start:u,end:u};this.logError("syntax-error",{message:s},{at:{url:this.translator.sourceURL,range:a}})}}iu.MalloyParserErrorHandler=RG;function OG(t){return[...Object.keys(t),...Object.keys(t).map(e=>OG(t[e])).flat()]}var Jd={};Object.defineProperty(Jd,"__esModule",{value:!0}),Jd.exploreQueryWalkerBuilder=Jd.ExploreQueryWalker=void 0;const G6e=Sl;class DG{constructor(e){this.inDocument=!1,this.exploreClauseRefs=[],this.tokens=e}exploreQueryAtOffset(e){return this.exploreClauseRefs.find(n=>n.range[0]===void 0||n.range[1]===void 0?!1:n.range[0]<=e&&n.range[1]>=e)}filterAtOffset(e){const n=this.exploreQueryAtOffset(e);if(n)return n.filterRefs.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e)}hasFilterListAtOffset(e){const n=this.exploreQueryAtOffset(e);return n?!!n.filterLists.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e):!1}enterMalloyDocument(){this.inDocument=!0}}Jd.ExploreQueryWalker=DG;function W6e(t,e){const n=new DG(t),r=n;return G6e.ParseTreeWalker.DEFAULT.walk(r,e),n}Jd.exploreQueryWalkerBuilder=W6e,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.exploreQueryWalkerBuilder=t.MalloyTranslation=t.MalloyTranslator=void 0;var e=iu;Object.defineProperty(t,"MalloyTranslator",{enumerable:!0,get:function(){return e.MalloyTranslator}}),Object.defineProperty(t,"MalloyTranslation",{enumerable:!0,get:function(){return e.MalloyTranslation}});var n=Jd;Object.defineProperty(t,"exploreQueryWalkerBuilder",{enumerable:!0,get:function(){return n.exploreQueryWalkerBuilder}})}(cR);var Oe={},Qv={};Object.defineProperty(Qv,"__esModule",{value:!0}),Qv.MALLOY_VERSION=void 0,Qv.MALLOY_VERSION="0.0.232",Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.CSVWriter=Oe.JSONWriter=Oe.DataWriter=Oe.DataRecord=Oe.DataArray=Oe.Result=Oe.ExploreMaterializer=Oe.PreparedResultMaterializer=Oe.QueryMaterializer=Oe.ModelMaterializer=Oe.SingleConnectionRuntime=Oe.ConnectionRuntime=Oe.Runtime=Oe.ExploreField=Oe.JoinRelationship=Oe.QueryField=Oe.Query=Oe.StringField=Oe.UnsupportedField=Oe.JSONField=Oe.BooleanField=Oe.NumberField=Oe.TimestampField=Oe.DateField=Oe.TimestampTimeframe=Oe.DateTimeframe=Oe.AtomicField=Oe.AtomicFieldType=Oe.Explore=Oe.SourceRelationship=Oe.FixedConnectionMap=Oe.InMemoryURLReader=Oe.EmptyURLReader=Oe.PreparedResult=Oe.DocumentCompletion=Oe.DocumentSymbol=Oe.DocumentPosition=Oe.DocumentRange=Oe.DocumentTablePath=Oe.Parse=Oe.PreparedQuery=Oe.Model=Oe.MalloyError=Oe.Malloy=void 0;const V6e=cR,Zn=Qi,NG=tD,_n=Js,i7=Sx,Y6e=Qv;class In{static get version(){return Y6e.MALLOY_VERSION}static _parse(e,n,r,i){n===void 0&&(n=new URL("internal://internal.malloy"));let s=n;i!=null&&i.importBaseURL&&(s=i==null?void 0:i.importBaseURL);const o=new V6e.MalloyTranslator(n.toString(),s.toString(),{urls:{[n.toString()]:e}},r);return i!=null&&i.testEnvironment&&(o.allDialectsEnabled=!0),new FG(o)}static parse({url:e,urlReader:n,source:r,eventStream:i,options:s}){if(r!==void 0)return In._parse(r,e,i,s);if(n===void 0)throw new Error("Internal Error: urlReader is required.");if(e===void 0)throw new Error("Internal Error: url is required if source not present.");return n.readURL(e).then(o=>In._parse(o,e,i,s))}static async compile({urlReader:e,connections:n,parse:r,model:i,refreshSchemaCache:s,noThrowOnError:o,eventStream:u,replaceMaterializedReferences:a,materializedTablePrefix:l}){var c,f,x,h;let p;s&&(p=typeof s=="number"?s:Date.now());const m=r._translator;for(;;){const g=m.translate(i==null?void 0:i._modelDef);if(g.final){if(g.modelDef)return new yg(g.modelDef,g.problems||[],[...(c=i==null?void 0:i.fromSources)!==null&&c!==void 0?c:[],...(f=g.fromSources)!==null&&f!==void 0?f:[]],y=>m.referenceAt(y),y=>m.importAt(y));if(o){const y={name:"modelDidNotCompile",exports:[],contents:{},dependencies:{},queryList:[]},E=(i==null?void 0:i._modelDef)||y;return new yg(E,g.problems||[],[...(x=i==null?void 0:i.fromSources)!==null&&x!==void 0?x:[],...(h=g.fromSources)!==null&&h!==void 0?h:[]],A=>m.referenceAt(A),A=>m.importAt(A))}else{const y=g.problems||[],E=m.prettyErrors();throw new wG(`Error(s) compiling model:
1270
1270
  ${E}`,y)}}else{if(g.urls)for(const E of g.urls)try{if(E.startsWith("internal://"))throw new Error("In order to use relative imports, you must compile a file via a URL.");const A=await e.readURL(new URL(E)),_={[E]:A};m.update({urls:_})}catch(A){m.update({errors:{urls:{[E]:A.message}}})}const{modelAnnotation:y}=m.modelAnnotation(i==null?void 0:i._modelDef);if(g.tables){const E=new Map;for(const A in g.tables){const{connectionName:_,tablePath:v}=g.tables[A],C=E.get(_);C===void 0?E.set(_,{[A]:v}):C[A]=v}for(const[A,_]of E)try{const v=await n.lookupConnection(A),{schemas:C,errors:S}=await In.safelyFetchTableSchema(v,_,{refreshTimestamp:p,modelAnnotation:y});m.update({tables:C,errors:{tables:S}})}catch(v){const C={},S={};for(const b in _)S[b]=v.toString();m.update({tables:C,errors:{tables:S}})}}if(g.compileSQL){const E=g.compileSQL,A=E.connection;try{const _=await n.lookupConnection(A),v=In.compileSQLBlock(_.dialectName,g.partialModel,E,{replaceMaterializedReferences:a,materializedTablePrefix:l,eventStream:u}),C=await _.fetchSchemaForSQLStruct(v,{refreshTimestamp:p,modelAnnotation:y});C.error&&m.update({errors:{compileSQL:{[v.name]:C.error}}}),C.structDef&&m.update({compileSQL:{[v.name]:C.structDef}})}catch(_){const v={};v[E.name]=_.toString(),m.update({errors:{compileSQL:v}})}}}}}static async safelyFetchTableSchema(e,n,r){const i=await e.fetchSchemaForTables(n,r);for(const s of Object.keys(n))if(i.schemas[s]===void 0&&i.errors[s]===void 0)throw new Error(`Schema fetch error for ${e.name}, no response for ${s} from ${e.dialectName}`);return i}static compileSQLBlock(e,n,r,i){let s,o="",u=!1;for(const c of r.select)if((0,Zn.isSegmentSQL)(c))o+=c.sql,u=c.sql.match(/\(\s*$/)!==null;else{if(!s){if(!n)throw new Error("Internal error: Partial model missing when compiling SQL block");s=new Zn.QueryModel(n,i==null?void 0:i.eventStream)}const f=s.compileQuery(c,{...i,defaultRowLimit:void 0},!1).sql;o+=u?f:`(${f})`,u=!1}const{name:a,connection:l}=r;return{type:"sql_select",name:a,connection:l,dialect:e,selectStr:o,fields:[]}}static async run({connections:e,preparedResult:n,sqlStruct:r,connection:i,options:s}){if(!i){if(!e)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");const o=(r==null?void 0:r.connection)||(n==null?void 0:n.connectionName);i=await e.lookupConnection(o)}if(r){const o=await i.runSQL(r.selectStr);return new vg({structs:[r],sql:r.selectStr,result:o.rows,totalRows:o.totalRows,runStats:o.runStats,lastStageName:r.name,malloy:"",connectionName:r.connection,sourceExplore:"",sourceFilters:[],profilingUrl:o.profilingUrl},{name:"empty_model",exports:[],contents:{},queryList:[],dependencies:{}})}else if(n){const o=await i.runSQL(n.sql,s);return new vg({...n._rawQuery,result:o.rows,totalRows:o.totalRows,runStats:o.runStats,profilingUrl:o.profilingUrl},n._modelDef)}else throw new Error("Internal error: sqlStruct or preparedResult must be provided.")}static async*runStream({connections:e,preparedResult:n,sqlStruct:r,connection:i,options:s}){if(r===void 0&&n===void 0)throw new Error("Internal error: sqlBlock or preparedResult must be provided.");const o=(r==null?void 0:r.connection)||(n==null?void 0:n.connectionName);if(i===void 0){if(e===void 0)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");i=await e.lookupConnection(o)}if(!i.canStream())throw new Error(`Connection '${o}' cannot stream results.`);let u,a;if(r)a=new ss(r),u=r.selectStr;else if(n!==void 0)a=n.resultExplore,u=n.sql;else throw new Error("Internal error: sqlStruct or preparedResult must be provided.");let l=0;for await(const c of i.runSQLStream(u,s))yield new ff(c,l,a,void 0,void 0),l+=1}static async estimateQueryCost({connections:e,preparedResult:n,sqlStruct:r}){if(!e)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");const i=(r==null?void 0:r.connection)||(n==null?void 0:n.connectionName),s=await e.lookupConnection(i);if(r)return await s.estimateQueryCost(r.selectStr);if(n)return await s.estimateQueryCost(n.sql);throw new Error("Internal error: sqlStruct or preparedResult must be provided.")}}Oe.Malloy=In;class wG extends Error{constructor(e,n=[]){super(e),this.problems=n}}Oe.MalloyError=wG;let yg=class{constructor(e,n,r,i=()=>{},s=()=>{}){this.modelDef=e,this.problems=n,this.fromSources=r,this._referenceAt=i,this._importAt=s}tagParse(e){return _n.Tag.annotationToTag(this.modelDef.annotation,e)}getTaglines(e){return _n.Tag.annotationToTaglines(this.modelDef.annotation,e)}getReference(e){return this._referenceAt(e)}getImport(e){return this._importAt(e)}getPreparedQueryByName(e){const n=this.modelDef.contents[e];if((n==null?void 0:n.type)==="query")return new Xd(n,this.modelDef,this.problems,e);throw new Error("Given query name does not refer to a named query.")}getPreparedQueryByIndex(e){if(e<0)throw new Error(`Invalid index ${e}.`);if(e>=this.modelDef.queryList.length)throw new Error(`Query index ${e} is out of bounds.`);return new Xd(this.modelDef.queryList[e],this.modelDef,this.problems)}get preparedQuery(){return this.getPreparedQuery()}getPreparedQuery(){if(this.modelDef.queryList.length===0)throw new Error("Model has no queries.");return new Xd(this.modelDef.queryList[this.modelDef.queryList.length-1],this.modelDef,this.problems)}getExploreByName(e){const n=this.modelDef.contents[e];if((0,Zn.isSourceDef)(n))return new ss(n);throw new Error("'name' is not an explore")}get explores(){return Object.values(this.modelDef.contents).filter(Zn.isSourceDef).map(e=>new ss(e))}get namedQueries(){const e=n=>n.type==="query";return Object.values(this.modelDef.contents).filter(e)}get exportedExplores(){return this.explores.filter(e=>this.modelDef.exports.includes(e.name))}get _modelDef(){return this.modelDef}};Oe.Model=yg;class Xd{constructor(e,n,r,i){this.problems=r,this.name=i,this._query=e,this._modelDef=n}tagParse(e){const n=_n.Tag.annotationToTag(this._modelDef.annotation).tag;return e=_n.Tag.addModelScope(e,n),_n.Tag.annotationToTag(this._query.annotation,e)}getTaglines(e){return _n.Tag.annotationToTaglines(this._query.annotation,e)}get preparedResult(){return this.getPreparedResult()}getPreparedResult(e){const r=new Zn.QueryModel(this._modelDef,e==null?void 0:e.eventStream).compileQuery(this._query,e);return new Eg({...r,queryName:this.name||r.queryName},this._modelDef)}get dialect(){const e=this._query.structRef,n=typeof e=="string"?this._modelDef.contents[e]:e;if(!(0,Zn.isSourceDef)(n))throw new Error("Invalid source for query");return n.dialect}getFlattenedQuery(e){return this}}Oe.PreparedQuery=Xd;class FG{constructor(e){this.translator=e}get symbols(){return(this.translator.metadata().symbols||[]).map(e=>new Gv(e))}get tablePathInfo(){var e;return((e=this.translator.tablePathInfo().pathInfo)!==null&&e!==void 0?e:[]).map(r=>new LG(r))}get _translator(){return this.translator}completions(e){return(this.translator.completions(e).completions||[]).map(n=>new IG(n))}helpContext(e){return this.translator.helpContext(e).helpContext}}Oe.Parse=FG;class LG{constructor(e){this._range=Zd.fromJSON(e.range),this._connectionId=e.connectionId,this._tablePath=e.tablePath}get range(){return this._range}get connectionId(){return this._connectionId}get tablePath(){return this._tablePath}}Oe.DocumentTablePath=LG;class Zd{constructor(e,n){this._start=e,this._end=n}get start(){return this._start}get end(){return this._end}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}static fromJSON(e){return new Zd(new s7(e.start.line,e.start.character),new s7(e.end.line,e.end.character))}}Oe.DocumentRange=Zd;class s7{constructor(e,n){this._line=e,this._character=n}get line(){return this._line}get character(){return this._character}toJSON(){return{line:this.line,character:this.character}}}Oe.DocumentPosition=s7;class Gv{constructor(e){this._range=Zd.fromJSON(e.range),this._lensRange=e.lensRange?Zd.fromJSON(e.lensRange):void 0,this._type=e.type,this._name=e.name,this._children=e.children.map(n=>new Gv(n))}get range(){return this._range}get lensRange(){var e;return(e=this._lensRange)!==null&&e!==void 0?e:this._range}get type(){return this._type}get name(){return this._name}get children(){return this._children}}Oe.DocumentSymbol=Gv;class IG{constructor(e){this.type=e.type,this.text=e.text}}Oe.DocumentCompletion=IG;class Eg{constructor(e,n){this.modelDef=n,this.inner=e}static fromJson({query:e,modelDef:n}){if(!e||!n)throw new Error("Missing required properties in JSON data");return new Eg(e,n)}tagParse(e){const n=_n.Tag.annotationToTag(this.modelDef.annotation).tag;return e=_n.Tag.addModelScope(e,n),_n.Tag.annotationToTag(this.inner.annotation,e)}getTaglines(e){return _n.Tag.annotationToTaglines(this.inner.annotation,e)}get annotation(){return this.inner.annotation}get modelAnnotation(){return this.modelDef.annotation}get modelTag(){return _n.Tag.annotationToTag(this.modelDef.annotation).tag}get connectionName(){return this.inner.connectionName}get _rawQuery(){return this.inner}get _modelDef(){return this.modelDef}get sql(){return this.inner.sql}get dependenciesToMaterialize(){return this.inner.dependenciesToMaterialize}get materialization(){return this.inner.materialization}get resultExplore(){if(this.inner.structs.length===0)throw new Error("Malformed query result.");const e=this.inner.structs[this.inner.structs.length-1],n={...e,annotation:this.inner.annotation,name:this.inner.queryName||e.name};try{return new ss(n,this.sourceExplore)}catch{return new ss(n)}}get sourceExplore(){const e=this.inner.sourceExplore,n=this.modelDef.contents[e];if(n===void 0)throw new Error("Malformed query result.");if((0,Zn.isSourceDef)(n))return new ss(n);throw new Error(`'${e} is not an explore`)}get _sourceExploreName(){return this.inner.sourceExplore}get _sourceFilters(){return this.inner.sourceFilters||[]}}Oe.PreparedResult=Eg;class BG{async readURL(e){throw new Error("No files.")}}Oe.EmptyURLReader=BG;class K6e{constructor(e){this.files=e}async readURL(e){const n=this.files.get(e.toString());if(n!==void 0)return Promise.resolve(n);throw new Error(`File not found '${e}'`)}}Oe.InMemoryURLReader=K6e;class Ag{constructor(e,n){this.connections=e,this.defaultConnectionName=n}async getConnection(e){if(e===void 0)if(this.defaultConnectionName!==void 0)e=this.defaultConnectionName;else throw new Error("No default connection.");const n=this.connections.get(e);if(n!==void 0)return Promise.resolve(n);throw new Error(`No connection found with name ${e}.`)}listConnections(){return Array.from(this.connections.values())}async lookupConnection(e){return this.getConnection(e)}static fromArray(e){return new Ag(new Map(e.map(n=>[n.name,n])))}}Oe.FixedConnectionMap=Ag;var $G;(function(t){t.Nested="nested",t.BaseTable="base_table",t.Cross="cross",t.One="one",t.Many="many",t.Inline="inline"})($G||(Oe.SourceRelationship=$G={}));class o7{constructor(e,n,r){this._name=e,this._parent=n,this._source=r}get source(){return this.source}get name(){return this._name}get sourceClasses(){const e=[];return this.source&&e.push(this.source.name),e.push(this.name),e}get fieldPath(){const e=[this.name];let n=this._parent;for(;n;)e.unshift(n.name),n=n._parent;return e}hasParentExplore(){return this._parent!==void 0}isExplore(){return this instanceof ss}isQuery(){return this instanceof d7}}class ss extends o7{constructor(e,n,r){super(e.as||e.name,n,r),this._structDef=e,this._parentExplore=n,this.sourceExplore=r}get source(){return this.sourceExplore}isIntrinsic(){return(0,Zn.isAtomicFieldType)(this._structDef.type)?!("e"in this._structDef):!1}isExploreField(){return!1}tagParse(e){return _n.Tag.annotationToTag(this._structDef.annotation,e)}getTaglines(e){return _n.Tag.annotationToTaglines(this._structDef.annotation,e)}get modelTag(){return this.parsedModelTag||(this.parsedModelTag=_n.Tag.annotationToTag(this._structDef.modelAnnotation).tag),this.parsedModelTag}get name(){return this.structDef.as||this.structDef.name}getQueryByName(e){const n=this.sourceStructDef;if(!n)throw new Error(`Cannot get query by name from a struct of type ${this.structDef.type}`);const r={type:"query",structRef:n,pipeline:[{type:"reduce",queryFields:[{type:"fieldref",path:[e]}]}]};return new Xd(r,this.modelDef,[],e)}get modelDef(){if(!(0,Zn.isSourceDef)(this.structDef))throw new Error(`Cannot create pseudo model for struct type ${this.structDef.type}`);return{name:"generated_model",exports:[],contents:{[this.structDef.name]:this.structDef},queryList:[],dependencies:{}}}getSingleExploreModel(){return new yg(this.modelDef,[],[])}get fieldMap(){var e;if(this._fieldMap===void 0){const n=((e=this.source)===null||e===void 0?void 0:e.fieldMap)||new Map;this._fieldMap=new Map(this.structDef.fields.map(r=>{const i=r.as||r.name,s=n.get(r.name);if((0,Zn.isJoined)(r))return[i,new h7(r,this,s)];if(r.type==="turtle")return[i,new d7(r,this,s)];if(r.type==="string")return[i,new x7(r,this,s)];if(r.type==="number")return[i,new Wv(r,this,s)];if(r.type==="date")return r.timeframe&&["day_of_month","day_of_week","day_of_year"].includes(r.timeframe)?[i,new Wv({...r,type:"number"},this,s)]:[i,new u7(r,this,s)];if(r.type==="timestamp")return[i,new a7(r,this,s)];if(r.type==="boolean")return[i,new l7(r,this,s)];if(r.type==="json")return[i,new c7(r,this,s)];if(r.type==="sql native")return[i,new f7(r,this,s)]}))}return this._fieldMap}get allFields(){return[...this.fieldMap.values()]}get allFieldsWithOrder(){var e,n,r;if(!this._allFieldsWithOrder){const i=[...((r=(n=(e=this.sourceStructDef)===null||e===void 0?void 0:e.resultMetadata)===null||n===void 0?void 0:n.orderBy)===null||r===void 0?void 0:r.map(o=>{if(typeof o.field=="string")return{field:this.fieldMap.get(o.field),dir:o.dir};throw new Error("Does not support mapping order by from number.")}))||[]],s=new Set(i.map(o=>o.field.name));this._allFieldsWithOrder=[...i,...this.allFields.filter(o=>!s.has(o.name)).map(o=>({field:o,dir:"asc"}))]}return this._allFieldsWithOrder}get intrinsicFields(){return[...this.fieldMap.values()].filter(e=>e.isIntrinsic())}get dimensions(){return[...this.allFieldsWithOrder].filter(e=>e.field.isAtomicField()&&e.field.sourceWasDimension())}getFieldByName(e){const n=this.fieldMap.get(e);if(n===void 0)throw new Error(`No such field ${e}.`);return n}getFieldByNameIfExists(e){return this.fieldMap.get(e)}get primaryKey(){var e;return(e=this.sourceStructDef)===null||e===void 0?void 0:e.primaryKey}get parentExplore(){return this._parentExplore}hasParentExplore(){return this instanceof h7}get filters(){var e;return(0,Zn.isSourceDef)(this.structDef)?((e=this.structDef.resultMetadata)===null||e===void 0?void 0:e.filterList)||[]:[]}get limit(){var e,n;return(n=(e=this.sourceStructDef)===null||e===void 0?void 0:e.resultMetadata)===null||n===void 0?void 0:n.limit}get structDef(){return this._structDef}get queryTimezone(){var e;return(e=this.sourceStructDef)===null||e===void 0?void 0:e.queryTimezone}get sourceStructDef(){if((0,Zn.isSourceDef)(this.structDef))return this.structDef}toJSON(){var e,n;return{_structDef:this._structDef,sourceExplore:(e=this.sourceExplore)===null||e===void 0?void 0:e.toJSON(),_parentExplore:(n=this._parentExplore)===null||n===void 0?void 0:n.toJSON()}}static fromJSON(e){const n=e._parentExplore!==void 0?ss.fromJSON(e._parentExplore):void 0,r=e.sourceExplore!==void 0?ss.fromJSON(e.sourceExplore):void 0;return new ss(e._structDef,n,r)}get location(){return this.structDef.location}}Oe.Explore=ss;var gu;(function(t){t.String="string",t.Number="number",t.Boolean="boolean",t.Date="date",t.Timestamp="timestamp",t.Json="json",t.NativeUnsupported="sql native",t.Error="error"})(gu||(Oe.AtomicFieldType=gu={}));class a0 extends o7{constructor(e,n,r){super(e.as||e.name,n,r),this.fieldTypeDef=e,this.parent=n}get type(){switch(this.fieldTypeDef.type){case"string":return gu.String;case"boolean":return gu.Boolean;case"date":return gu.Date;case"timestamp":return gu.Timestamp;case"number":return gu.Number;case"json":return gu.Json;case"sql native":return gu.NativeUnsupported;case"error":return gu.Error;case"record":case"array":throw new Error(`MTOY TODO IMPLEMENT Atomic ${this.fieldTypeDef.type}`);default:{const e=this.fieldTypeDef;throw new Error(`Can't make an atomic field from ${e}`)}}}tagParse(e){return e=_n.Tag.addModelScope(e,this.parent.modelTag),_n.Tag.annotationToTag(this.fieldTypeDef.annotation,e)}getTaglines(e){return _n.Tag.annotationToTaglines(this.fieldTypeDef.annotation,e)}isIntrinsic(){return(0,Zn.fieldIsIntrinsic)(this.fieldTypeDef)}isQueryField(){return!1}isExploreField(){return!1}isAtomicField(){return!0}isCalculation(){return(0,Zn.expressionIsCalculation)(this.fieldTypeDef.expressionType)}get sourceField(){throw new Error}get sourceClasses(){const e=this.fieldTypeDef.name||this.fieldTypeDef.as;return e?[e]:[]}get referenceId(){var e;return(e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.referenceId}sourceWasMeasure(){var e;return((e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.fieldKind)==="measure"}sourceWasMeasureLike(){var e,n;return((e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.fieldKind)==="measure"||((n=this.fieldTypeDef.resultMetadata)===null||n===void 0?void 0:n.fieldKind)==="struct"}sourceWasDimension(){var e;return((e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.fieldKind)==="dimension"}hasParentExplore(){return!0}isString(){return this instanceof x7}isNumber(){return this instanceof Wv}isDate(){return this instanceof u7}isBoolean(){return this instanceof l7}isJSON(){return this instanceof c7}isTimestamp(){return this instanceof a7}isUnsupported(){return this instanceof f7}get parentExplore(){return this.parent}get expression(){const e=".",n=this.fieldTypeDef.resultMetadata;return(n==null?void 0:n.sourceExpression)||(n!=null&&n.sourceField.includes(e)?n==null?void 0:n.sourceField:this.name)}get location(){return this.fieldTypeDef.location}}Oe.AtomicField=a0;var cf;(function(t){t.Day="day",t.Week="week",t.Month="month",t.Quarter="quarter",t.Year="year"})(cf||(Oe.DateTimeframe=cf={}));var mu;(function(t){t.Day="day",t.Week="week",t.Month="month",t.Quarter="quarter",t.Year="year",t.Second="second",t.Hour="hour",t.Minute="minute"})(mu||(Oe.TimestampTimeframe=mu={}));class u7 extends a0{constructor(e,n,r){super(e,n,r),this.fieldDateDef=e}get timeframe(){if(this.fieldDateDef.timeframe!==void 0)switch(this.fieldDateDef.timeframe){case"day":return cf.Day;case"week":return cf.Week;case"month":return cf.Month;case"quarter":return cf.Quarter;case"year":return cf.Year}}}Oe.DateField=u7;class a7 extends a0{constructor(e,n,r){super(e,n,r),this.fieldTimestampDef=e}get timeframe(){if(this.fieldTimestampDef.timeframe!==void 0)switch(this.fieldTimestampDef.timeframe){case"day":return mu.Day;case"week":return mu.Week;case"month":return mu.Month;case"quarter":return mu.Quarter;case"year":return mu.Year;case"second":return mu.Second;case"hour":return mu.Hour;case"minute":return mu.Minute}}}Oe.TimestampField=a7;class Wv extends a0{constructor(e,n,r){super(e,n,r),this.fieldNumberDef=e}}Oe.NumberField=Wv;class l7 extends a0{constructor(e,n,r){super(e,n,r),this.fieldBooleanDef=e}}Oe.BooleanField=l7;class c7 extends a0{constructor(e,n,r){super(e,n,r),this.fieldJSONDef=e}}Oe.JSONField=c7;class f7 extends a0{constructor(e,n,r){super(e,n,r),this.fieldUnsupportedDef=e}get rawType(){return this.fieldUnsupportedDef.rawType}}Oe.UnsupportedField=f7;class x7 extends a0{constructor(e,n,r){super(e,n,r),this.fieldStringDef=e}}Oe.StringField=x7;class kG extends o7{constructor(e,n,r){super(e.as||e.name,n,r),this.turtleDef=e}get source(){return this.sourceQuery}isIntrinsic(){return!1}get location(){return this.turtleDef.location}}Oe.Query=kG;class d7 extends kG{constructor(e,n,r){super(e,n,r),this.parent=n}tagParse(e){return e=_n.Tag.addModelScope(e,this.parent.modelTag),_n.Tag.annotationToTag(this.turtleDef.annotation,e)}getTaglines(e){return _n.Tag.annotationToTaglines(this.turtleDef.annotation,e)}isQueryField(){return!0}isExploreField(){return!1}isAtomicField(){return!1}get sourceClasses(){const e=this.turtleDef.name||this.turtleDef.as;return e?[e]:[]}hasParentExplore(){return!0}get parentExplore(){return this.parent}get expression(){return this.name}}Oe.QueryField=d7;var eh;(function(t){t.OneToOne="one_to_one",t.OneToMany="one_to_many",t.ManyToOne="many_to_one"})(eh||(Oe.JoinRelationship=eh={}));class h7 extends ss{constructor(e,n,r){super(e,n,r),this._parentExplore=n}get joinRelationship(){if((0,Zn.isJoined)(this.structDef))switch(this.structDef.join){case"one":return eh.OneToOne;case"many":case"cross":return eh.ManyToOne}throw new Error("A source field must have a join relationship.")}get isRecord(){return this.joinRelationship===eh.OneToOne}get isArray(){return this.joinRelationship!==eh.OneToOne}tagParse(e){return e=_n.Tag.addModelScope(e,this._parentExplore.modelTag),_n.Tag.annotationToTag(this._structDef.annotation,e)}isQueryField(){return!1}isExploreField(){return!0}isAtomicField(){return!1}get parentExplore(){return this._parentExplore}get sourceClasses(){const e=this.structDef.name||this.structDef.as;return e?[e]:[]}}Oe.ExploreField=h7;class p7{constructor(...e){this.isTestRuntime=!1;let n,r,i;for(const s of e)s!==void 0&&(KG(s)?n=s:tRe(s)?r=s:JG(s)?i=s:r={lookupConnection:()=>Promise.resolve(s)});if(n===void 0&&(n=new BG),r===void 0)throw new Error("A LookupConnection<Connection> or Connection is required.");this._urlReader=n,this._connections=r,this._eventStream=i}get urlReader(){return this._urlReader}get connections(){return this._connections}get eventStream(){return this._eventStream}loadModel(e,n){const{refreshSchemaCache:r,noThrowOnError:i}=n||{};return this.isTestRuntime&&(n===void 0?n={testEnvironment:!0}:n={...n,testEnvironment:!0}),new _g(this,async()=>{const s=e instanceof URL?await In.parse({url:e,urlReader:this.urlReader,eventStream:this.eventStream,options:n}):In.parse({source:e,eventStream:this.eventStream,options:n});return In.compile({urlReader:this.urlReader,connections:this.connections,parse:s,refreshSchemaCache:r,noThrowOnError:i,eventStream:this.eventStream,replaceMaterializedReferences:n==null?void 0:n.replaceMaterializedReferences,materializedTablePrefix:n==null?void 0:n.materializedTablePrefix})},n)}_loadModelFromModelDef(e,n){return new _g(this,async()=>new yg(e,[],[]),n)}loadQuery(e,n){return this.loadModel(e,n).loadFinalQuery()}loadQueryByIndex(e,n,r){return this.loadModel(e,r).loadQueryByIndex(n,r)}loadQueryByName(e,n,r){return this.loadModel(e,r).loadQueryByName(n,r)}getModel(e,n){return this.loadModel(e,n).getModel()}getQuery(e,n){return this.loadQuery(e,n).getPreparedQuery()}getQueryByIndex(e,n,r){return this.loadQueryByIndex(e,n,r).getPreparedQuery()}getQueryByName(e,n,r){return this.loadQueryByName(e,n,r).getPreparedQuery()}}Oe.Runtime=p7;class J6e extends p7{constructor(e,n){if(n===void 0){const r=e;super(Ag.fromArray(r)),this.rawConnections=r}else{const r=n;super(e,Ag.fromArray(r)),this.rawConnections=r}}}Oe.ConnectionRuntime=J6e;class X6e extends p7{constructor(...e){let n,r,i;for(const s of e)KG(s)&&(n=s),nRe(s)&&(r=s),JG(s)&&(i=s);if(r===void 0)throw new Error("Expected connection to be passed into SingleConnectionRuntime");super(n,r,i),this.connection=r}get supportsNesting(){return(0,i7.getDialect)(this.connection.dialectName).supportsNesting}quote(e){return(0,i7.getDialect)(this.connection.dialectName).sqlMaybeQuoteIdentifier(e)}get dialect(){return(0,i7.getDialect)(this.connection.dialectName)}getQuoter(){return e=>this.quote(e.toString())}}Oe.SingleConnectionRuntime=X6e;class Vv{constructor(e,n){this.runtime=e,this._materialize=n}materialize(){return this.materialized===void 0?this.rematerialize():this.materialized}rematerialize(){return this.materialized=this._materialize(),this.materialized}makeQueryMaterializer(e,n){return new PG(this.runtime,e,n)}makeExploreMaterializer(e,n){return new jG(this.runtime,e,n)}makePreparedResultMaterializer(e){return new MG(this.runtime,e)}}class _g extends Vv{constructor(e,n,r){super(e,n),this.runtime=e,this.compileQueryOptions=r}loadFinalQuery(e){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQuery(),{...this.compileQueryOptions,...e})}loadQueryByIndex(e,n){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQueryByIndex(e),{...this.compileQueryOptions,...n})}loadQueryByName(e,n){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQueryByName(e),{...this.compileQueryOptions,...n})}loadQuery(e,n){const{refreshSchemaCache:r,noThrowOnError:i}=n||{};return this.makeQueryMaterializer(async()=>{const s=this.runtime.urlReader,o=this.runtime.connections;this.runtime.isTestRuntime&&(n===void 0?n={testEnvironment:!0}:n={...n,testEnvironment:!0});const u=e instanceof URL?await In.parse({url:e,urlReader:s,options:n}):In.parse({source:e,options:n}),a=await this.getModel();return(await In.compile({urlReader:s,connections:o,parse:u,model:a,refreshSchemaCache:r,noThrowOnError:i,...this.compileQueryOptions})).preparedQuery})}extendModel(e,n){return this.runtime.isTestRuntime&&(n===void 0?n={testEnvironment:!0}:n={...n,testEnvironment:!0}),new _g(this.runtime,async()=>{const r=this.runtime.urlReader,i=this.runtime.connections,s=e instanceof URL?await In.parse({url:e,urlReader:r,options:n}):In.parse({source:e,options:n}),o=await this.getModel();return await In.compile({urlReader:r,connections:i,parse:s,model:o,refreshSchemaCache:n==null?void 0:n.refreshSchemaCache,noThrowOnError:n==null?void 0:n.noThrowOnError,...this.compileQueryOptions})},n)}async search(e,n,r=1e3,i=void 0,s){const o=await this.materialize(),u=new Zn.QueryModel(o._modelDef,s),a=o.getExploreByName(e).structDef;if(!(0,Zn.isSourceDef)(a))throw new Error("Source to be searched was unexpectedly, not a source");const l=a.connection,c=await this.runtime.connections.lookupConnection(l);return await u.searchIndex(c,e,n,r,i)}async searchValueMap(e,n=10,r){const s=(await this.materialize()).getExploreByName(e);if(!(0,Zn.isSourceDef)(s.structDef))throw new Error("Source to be searched was unexpectedly, not a source");let o="{index: *}";s.getFieldByNameIfExists("search_index")&&(o="search_index");const u=`
1271
1271
  run: ${e}
1272
1272
  -> ${o}
@@ -55496,7 +55496,7 @@ Eh.exploreQueryWalkerBuilder = zOe;
55496
55496
  var we = {}, Q4 = {};
55497
55497
  Object.defineProperty(Q4, "__esModule", { value: !0 });
55498
55498
  Q4.MALLOY_VERSION = void 0;
55499
- Q4.MALLOY_VERSION = "0.0.231";
55499
+ Q4.MALLOY_VERSION = "0.0.232";
55500
55500
  Object.defineProperty(we, "__esModule", { value: !0 });
55501
55501
  we.CSVWriter = we.JSONWriter = we.DataWriter = we.DataRecord = we.DataArray = we.Result = we.ExploreMaterializer = we.PreparedResultMaterializer = we.QueryMaterializer = we.ModelMaterializer = we.SingleConnectionRuntime = we.ConnectionRuntime = we.Runtime = we.ExploreField = we.JoinRelationship = we.QueryField = we.Query = we.StringField = we.UnsupportedField = we.JSONField = we.BooleanField = we.NumberField = we.TimestampField = we.DateField = we.TimestampTimeframe = we.DateTimeframe = we.AtomicField = we.AtomicFieldType = we.Explore = we.SourceRelationship = we.FixedConnectionMap = we.InMemoryURLReader = we.EmptyURLReader = we.PreparedResult = we.DocumentCompletion = we.DocumentSymbol = we.DocumentPosition = we.DocumentRange = we.DocumentTablePath = we.Parse = we.PreparedQuery = we.Model = we.MalloyError = we.Malloy = void 0;
55502
55502
  const QOe = ZN, nr = Cs, rU = Ti, Sn = Mo, AR = t2, GOe = Q4;
@@ -59583,7 +59583,7 @@ function vh(t, e) {
59583
59583
  const s = r.text("duration") ?? qn.Seconds;
59584
59584
  return zZ(t, e, { durationUnit: s }) ?? e.toLocaleString();
59585
59585
  } else
59586
- r.has("number") ? n = gA.format(r.text("number"), e) : n = e.toLocaleString();
59586
+ r.has("number") ? n = gA.format(r.text("number") ?? "#", e) : n = e.toLocaleString();
59587
59587
  return n;
59588
59588
  }
59589
59589
  var rNe = /* @__PURE__ */ Et("<a target=_blank>");
@@ -1266,7 +1266,7 @@ QUERY: ${(0,VQ.inspect)(n,{breakLength:72,depth:1/0})}`)}return YQ.ErrorFactory.
1266
1266
  | ${l}`,u>0&&(i=i+`
1267
1267
  | ${" ".repeat(u)}^`)}else i=`line ${o+1}: char ${u}: ${r.message}`}n!==s&&(i=`FILE: ${s}
1268
1268
  `+i,n=s),e!==""?e=`${e}
1269
- ${i}`:e=i}return e}childRequest(e){var n;const r=decodeURI(new URL(e,this.sourceURL).toString()),i=(n=this.childTranslators.get(r))===null||n===void 0?void 0:n.translate();if(i!=null&&i.compileSQL)return{compileSQL:i.compileSQL,partialModel:i.partialModel}}getChildExports(e){const n={},r=decodeURI(new URL(e,this.sourceURL).toString()),i=this.childTranslators.get(r);if(i&&i.translate().modelDef)for(const o of i.modelDef.exports){const u=i.modelDef.contents[o];((0,yOe.isSourceDef)(u)||u.type==="query")&&(n[o]=u)}return n}translate(e){if(this.finalAnswer)return this.finalAnswer;const n=this.translateStep.step(this,e);return n.final&&(this.finalAnswer=n),n}translatorForDependency(e){return this.childTranslators.get(e)}importAt(e){for(let n=0;n<this.imports.length;n++){const r=this.imports[n];if((0,ROe.locationContainsPosition)(r.location,e))return r}}metadata(){return this.metadataStep.step(this)}modelAnnotation(e){return this.modelAnnotationStep.step(this,e)}tablePathInfo(){return this.tablePathInfoStep.step(this)}completions(e){return this.completionsStep.step(this,e)}helpContext(e){return this.helpContextStep.step(this,e)}defaultLocation(){return{url:this.sourceURL,range:{start:{line:0,character:0},end:{line:0,character:0}}}}rangeFromContext(e){return this.rangeFromTokens(e.start,e.stop||e.start)}rangeFromTokens(e,n){const r={line:e.line-1,character:e.charPositionInLine};if(this.parseStep.sourceInfo&&n.stopIndex!==-1){const i=this.parseStep.sourceInfo.lines.length-1;for(let s=e.line-1;s<=i;s++){const o=this.parseStep.sourceInfo.at[s];if(n.stopIndex>=o.begin&&n.stopIndex<o.end)return{start:r,end:{line:s,character:n.stopIndex-o.begin+1}}}return{start:r,end:{line:i,character:this.parseStep.sourceInfo.lines[i].length}}}return{start:r,end:r}}rangeFromToken(e){return this.rangeFromTokens(e,e)}firstReferenceToDialect(e){return this.dialectAlreadyChecked[e]?!1:(this.dialectAlreadyChecked[e]=!0,!0)}experimentalDialectEnabled(e){if(this.allDialectsEnabled)return!0;const n=this.compilerFlags.tag("experimental");return n!==void 0&&(n.bare()||n.has("dialect",e))}}Au.MalloyTranslation=K7;class vW extends K7{constructor(e,n){super(e),this.root=n}}Au.MalloyChildTranslator=vW;class jOe extends K7{constructor(e,n=null,r=null,i=null){super(e,n),this.eventStream=i,this.schemaZone=new Y7.Zone,this.importZone=new Y7.Zone,this.pretranslatedModels=new Map,this.sqlQueryZone=new Y7.Zone,this.root=this,this.logger=new V7.BaseMessageLogger(i),r&&this.update(r)}update(e){var n,r,i;this.schemaZone.updateFrom(e.tables,(n=e.errors)===null||n===void 0?void 0:n.tables),this.importZone.updateFrom(e.urls,(r=e.errors)===null||r===void 0?void 0:r.urls),this.sqlQueryZone.updateFrom(e.compileSQL,(i=e.errors)===null||i===void 0?void 0:i.compileSQL);for(const s in e.translations)this.pretranslatedModels.set(s,e.translations[s])}logError(e,n,r){return this.logger.log((0,V7.makeLogMessage)(e,n,{severity:"error",...r})),e}}Au.MalloyTranslator=jOe;class _W{constructor(e,n){this.translator=e,this.messages=n}logError(e,n,r){return this.messages.log((0,V7.makeLogMessage)(e,n,{severity:"error",...r})),e}syntaxError(e,n,r,i,s,o){const u={line:r-1,character:i},a=n?this.translator.rangeFromToken(n):{start:u,end:u};this.logError("syntax-error",{message:s},{at:{url:this.translator.sourceURL,range:a}})}}Au.MalloyParserErrorHandler=_W;function SW(t){return[...Object.keys(t),...Object.keys(t).map(e=>SW(t[e])).flat()]}var Rh={};Object.defineProperty(Rh,"__esModule",{value:!0}),Rh.exploreQueryWalkerBuilder=Rh.ExploreQueryWalker=void 0;const UOe=Gl;class CW{constructor(e){this.inDocument=!1,this.exploreClauseRefs=[],this.tokens=e}exploreQueryAtOffset(e){return this.exploreClauseRefs.find(n=>n.range[0]===void 0||n.range[1]===void 0?!1:n.range[0]<=e&&n.range[1]>=e)}filterAtOffset(e){const n=this.exploreQueryAtOffset(e);if(n)return n.filterRefs.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e)}hasFilterListAtOffset(e){const n=this.exploreQueryAtOffset(e);return n?!!n.filterLists.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e):!1}enterMalloyDocument(){this.inDocument=!0}}Rh.ExploreQueryWalker=CW;function qOe(t,e){const n=new CW(t),r=n;return UOe.ParseTreeWalker.DEFAULT.walk(r,e),n}Rh.exploreQueryWalkerBuilder=qOe,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.exploreQueryWalkerBuilder=t.MalloyTranslation=t.MalloyTranslator=void 0;var e=Au;Object.defineProperty(t,"MalloyTranslator",{enumerable:!0,get:function(){return e.MalloyTranslator}}),Object.defineProperty(t,"MalloyTranslation",{enumerable:!0,get:function(){return e.MalloyTranslation}});var n=Rh;Object.defineProperty(t,"exploreQueryWalkerBuilder",{enumerable:!0,get:function(){return n.exploreQueryWalkerBuilder}})}(iO);var we={},q5={};Object.defineProperty(q5,"__esModule",{value:!0}),q5.MALLOY_VERSION=void 0,q5.MALLOY_VERSION="0.0.231",Object.defineProperty(we,"__esModule",{value:!0}),we.CSVWriter=we.JSONWriter=we.DataWriter=we.DataRecord=we.DataArray=we.Result=we.ExploreMaterializer=we.PreparedResultMaterializer=we.QueryMaterializer=we.ModelMaterializer=we.SingleConnectionRuntime=we.ConnectionRuntime=we.Runtime=we.ExploreField=we.JoinRelationship=we.QueryField=we.Query=we.StringField=we.UnsupportedField=we.JSONField=we.BooleanField=we.NumberField=we.TimestampField=we.DateField=we.TimestampTimeframe=we.DateTimeframe=we.AtomicField=we.AtomicFieldType=we.Explore=we.SourceRelationship=we.FixedConnectionMap=we.InMemoryURLReader=we.EmptyURLReader=we.PreparedResult=we.DocumentCompletion=we.DocumentSymbol=we.DocumentPosition=we.DocumentRange=we.DocumentTablePath=we.Parse=we.PreparedQuery=we.Model=we.MalloyError=we.Malloy=void 0;const HOe=iO,ir=ts,bW=ii,Cn=fo,J7=ed,zOe=q5;class Pn{static get version(){return zOe.MALLOY_VERSION}static _parse(e,n,r,i){n===void 0&&(n=new URL("internal://internal.malloy"));let s=n;i!=null&&i.importBaseURL&&(s=i==null?void 0:i.importBaseURL);const o=new HOe.MalloyTranslator(n.toString(),s.toString(),{urls:{[n.toString()]:e}},r);return i!=null&&i.testEnvironment&&(o.allDialectsEnabled=!0),new RW(o)}static parse({url:e,urlReader:n,source:r,eventStream:i,options:s}){if(r!==void 0)return Pn._parse(r,e,i,s);if(n===void 0)throw new Error("Internal Error: urlReader is required.");if(e===void 0)throw new Error("Internal Error: url is required if source not present.");return n.readURL(e).then(o=>Pn._parse(o,e,i,s))}static async compile({urlReader:e,connections:n,parse:r,model:i,refreshSchemaCache:s,noThrowOnError:o,eventStream:u,replaceMaterializedReferences:a,materializedTablePrefix:l}){var c,f,x,h;let p;s&&(p=typeof s=="number"?s:Date.now());const m=r._translator;for(;;){const g=m.translate(i==null?void 0:i._modelDef);if(g.final){if(g.modelDef)return new im(g.modelDef,g.problems||[],[...(c=i==null?void 0:i.fromSources)!==null&&c!==void 0?c:[],...(f=g.fromSources)!==null&&f!==void 0?f:[]],y=>m.referenceAt(y),y=>m.importAt(y));if(o){const y={name:"modelDidNotCompile",exports:[],contents:{},dependencies:{},queryList:[]},E=(i==null?void 0:i._modelDef)||y;return new im(E,g.problems||[],[...(x=i==null?void 0:i.fromSources)!==null&&x!==void 0?x:[],...(h=g.fromSources)!==null&&h!==void 0?h:[]],A=>m.referenceAt(A),A=>m.importAt(A))}else{const y=g.problems||[],E=m.prettyErrors();throw new TW(`Error(s) compiling model:
1269
+ ${i}`:e=i}return e}childRequest(e){var n;const r=decodeURI(new URL(e,this.sourceURL).toString()),i=(n=this.childTranslators.get(r))===null||n===void 0?void 0:n.translate();if(i!=null&&i.compileSQL)return{compileSQL:i.compileSQL,partialModel:i.partialModel}}getChildExports(e){const n={},r=decodeURI(new URL(e,this.sourceURL).toString()),i=this.childTranslators.get(r);if(i&&i.translate().modelDef)for(const o of i.modelDef.exports){const u=i.modelDef.contents[o];((0,yOe.isSourceDef)(u)||u.type==="query")&&(n[o]=u)}return n}translate(e){if(this.finalAnswer)return this.finalAnswer;const n=this.translateStep.step(this,e);return n.final&&(this.finalAnswer=n),n}translatorForDependency(e){return this.childTranslators.get(e)}importAt(e){for(let n=0;n<this.imports.length;n++){const r=this.imports[n];if((0,ROe.locationContainsPosition)(r.location,e))return r}}metadata(){return this.metadataStep.step(this)}modelAnnotation(e){return this.modelAnnotationStep.step(this,e)}tablePathInfo(){return this.tablePathInfoStep.step(this)}completions(e){return this.completionsStep.step(this,e)}helpContext(e){return this.helpContextStep.step(this,e)}defaultLocation(){return{url:this.sourceURL,range:{start:{line:0,character:0},end:{line:0,character:0}}}}rangeFromContext(e){return this.rangeFromTokens(e.start,e.stop||e.start)}rangeFromTokens(e,n){const r={line:e.line-1,character:e.charPositionInLine};if(this.parseStep.sourceInfo&&n.stopIndex!==-1){const i=this.parseStep.sourceInfo.lines.length-1;for(let s=e.line-1;s<=i;s++){const o=this.parseStep.sourceInfo.at[s];if(n.stopIndex>=o.begin&&n.stopIndex<o.end)return{start:r,end:{line:s,character:n.stopIndex-o.begin+1}}}return{start:r,end:{line:i,character:this.parseStep.sourceInfo.lines[i].length}}}return{start:r,end:r}}rangeFromToken(e){return this.rangeFromTokens(e,e)}firstReferenceToDialect(e){return this.dialectAlreadyChecked[e]?!1:(this.dialectAlreadyChecked[e]=!0,!0)}experimentalDialectEnabled(e){if(this.allDialectsEnabled)return!0;const n=this.compilerFlags.tag("experimental");return n!==void 0&&(n.bare()||n.has("dialect",e))}}Au.MalloyTranslation=K7;class vW extends K7{constructor(e,n){super(e),this.root=n}}Au.MalloyChildTranslator=vW;class jOe extends K7{constructor(e,n=null,r=null,i=null){super(e,n),this.eventStream=i,this.schemaZone=new Y7.Zone,this.importZone=new Y7.Zone,this.pretranslatedModels=new Map,this.sqlQueryZone=new Y7.Zone,this.root=this,this.logger=new V7.BaseMessageLogger(i),r&&this.update(r)}update(e){var n,r,i;this.schemaZone.updateFrom(e.tables,(n=e.errors)===null||n===void 0?void 0:n.tables),this.importZone.updateFrom(e.urls,(r=e.errors)===null||r===void 0?void 0:r.urls),this.sqlQueryZone.updateFrom(e.compileSQL,(i=e.errors)===null||i===void 0?void 0:i.compileSQL);for(const s in e.translations)this.pretranslatedModels.set(s,e.translations[s])}logError(e,n,r){return this.logger.log((0,V7.makeLogMessage)(e,n,{severity:"error",...r})),e}}Au.MalloyTranslator=jOe;class _W{constructor(e,n){this.translator=e,this.messages=n}logError(e,n,r){return this.messages.log((0,V7.makeLogMessage)(e,n,{severity:"error",...r})),e}syntaxError(e,n,r,i,s,o){const u={line:r-1,character:i},a=n?this.translator.rangeFromToken(n):{start:u,end:u};this.logError("syntax-error",{message:s},{at:{url:this.translator.sourceURL,range:a}})}}Au.MalloyParserErrorHandler=_W;function SW(t){return[...Object.keys(t),...Object.keys(t).map(e=>SW(t[e])).flat()]}var Rh={};Object.defineProperty(Rh,"__esModule",{value:!0}),Rh.exploreQueryWalkerBuilder=Rh.ExploreQueryWalker=void 0;const UOe=Gl;class CW{constructor(e){this.inDocument=!1,this.exploreClauseRefs=[],this.tokens=e}exploreQueryAtOffset(e){return this.exploreClauseRefs.find(n=>n.range[0]===void 0||n.range[1]===void 0?!1:n.range[0]<=e&&n.range[1]>=e)}filterAtOffset(e){const n=this.exploreQueryAtOffset(e);if(n)return n.filterRefs.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e)}hasFilterListAtOffset(e){const n=this.exploreQueryAtOffset(e);return n?!!n.filterLists.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e):!1}enterMalloyDocument(){this.inDocument=!0}}Rh.ExploreQueryWalker=CW;function qOe(t,e){const n=new CW(t),r=n;return UOe.ParseTreeWalker.DEFAULT.walk(r,e),n}Rh.exploreQueryWalkerBuilder=qOe,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.exploreQueryWalkerBuilder=t.MalloyTranslation=t.MalloyTranslator=void 0;var e=Au;Object.defineProperty(t,"MalloyTranslator",{enumerable:!0,get:function(){return e.MalloyTranslator}}),Object.defineProperty(t,"MalloyTranslation",{enumerable:!0,get:function(){return e.MalloyTranslation}});var n=Rh;Object.defineProperty(t,"exploreQueryWalkerBuilder",{enumerable:!0,get:function(){return n.exploreQueryWalkerBuilder}})}(iO);var we={},q5={};Object.defineProperty(q5,"__esModule",{value:!0}),q5.MALLOY_VERSION=void 0,q5.MALLOY_VERSION="0.0.232",Object.defineProperty(we,"__esModule",{value:!0}),we.CSVWriter=we.JSONWriter=we.DataWriter=we.DataRecord=we.DataArray=we.Result=we.ExploreMaterializer=we.PreparedResultMaterializer=we.QueryMaterializer=we.ModelMaterializer=we.SingleConnectionRuntime=we.ConnectionRuntime=we.Runtime=we.ExploreField=we.JoinRelationship=we.QueryField=we.Query=we.StringField=we.UnsupportedField=we.JSONField=we.BooleanField=we.NumberField=we.TimestampField=we.DateField=we.TimestampTimeframe=we.DateTimeframe=we.AtomicField=we.AtomicFieldType=we.Explore=we.SourceRelationship=we.FixedConnectionMap=we.InMemoryURLReader=we.EmptyURLReader=we.PreparedResult=we.DocumentCompletion=we.DocumentSymbol=we.DocumentPosition=we.DocumentRange=we.DocumentTablePath=we.Parse=we.PreparedQuery=we.Model=we.MalloyError=we.Malloy=void 0;const HOe=iO,ir=ts,bW=ii,Cn=fo,J7=ed,zOe=q5;class Pn{static get version(){return zOe.MALLOY_VERSION}static _parse(e,n,r,i){n===void 0&&(n=new URL("internal://internal.malloy"));let s=n;i!=null&&i.importBaseURL&&(s=i==null?void 0:i.importBaseURL);const o=new HOe.MalloyTranslator(n.toString(),s.toString(),{urls:{[n.toString()]:e}},r);return i!=null&&i.testEnvironment&&(o.allDialectsEnabled=!0),new RW(o)}static parse({url:e,urlReader:n,source:r,eventStream:i,options:s}){if(r!==void 0)return Pn._parse(r,e,i,s);if(n===void 0)throw new Error("Internal Error: urlReader is required.");if(e===void 0)throw new Error("Internal Error: url is required if source not present.");return n.readURL(e).then(o=>Pn._parse(o,e,i,s))}static async compile({urlReader:e,connections:n,parse:r,model:i,refreshSchemaCache:s,noThrowOnError:o,eventStream:u,replaceMaterializedReferences:a,materializedTablePrefix:l}){var c,f,x,h;let p;s&&(p=typeof s=="number"?s:Date.now());const m=r._translator;for(;;){const g=m.translate(i==null?void 0:i._modelDef);if(g.final){if(g.modelDef)return new im(g.modelDef,g.problems||[],[...(c=i==null?void 0:i.fromSources)!==null&&c!==void 0?c:[],...(f=g.fromSources)!==null&&f!==void 0?f:[]],y=>m.referenceAt(y),y=>m.importAt(y));if(o){const y={name:"modelDidNotCompile",exports:[],contents:{},dependencies:{},queryList:[]},E=(i==null?void 0:i._modelDef)||y;return new im(E,g.problems||[],[...(x=i==null?void 0:i.fromSources)!==null&&x!==void 0?x:[],...(h=g.fromSources)!==null&&h!==void 0?h:[]],A=>m.referenceAt(A),A=>m.importAt(A))}else{const y=g.problems||[],E=m.prettyErrors();throw new TW(`Error(s) compiling model:
1270
1270
  ${E}`,y)}}else{if(g.urls)for(const E of g.urls)try{if(E.startsWith("internal://"))throw new Error("In order to use relative imports, you must compile a file via a URL.");const A=await e.readURL(new URL(E)),v={[E]:A};m.update({urls:v})}catch(A){m.update({errors:{urls:{[E]:A.message}}})}const{modelAnnotation:y}=m.modelAnnotation(i==null?void 0:i._modelDef);if(g.tables){const E=new Map;for(const A in g.tables){const{connectionName:v,tablePath:_}=g.tables[A],S=E.get(v);S===void 0?E.set(v,{[A]:_}):S[A]=_}for(const[A,v]of E)try{const _=await n.lookupConnection(A),{schemas:S,errors:C}=await Pn.safelyFetchTableSchema(_,v,{refreshTimestamp:p,modelAnnotation:y});m.update({tables:S,errors:{tables:C}})}catch(_){const S={},C={};for(const b in v)C[b]=_.toString();m.update({tables:S,errors:{tables:C}})}}if(g.compileSQL){const E=g.compileSQL,A=E.connection;try{const v=await n.lookupConnection(A),_=Pn.compileSQLBlock(v.dialectName,g.partialModel,E,{replaceMaterializedReferences:a,materializedTablePrefix:l,eventStream:u}),S=await v.fetchSchemaForSQLStruct(_,{refreshTimestamp:p,modelAnnotation:y});S.error&&m.update({errors:{compileSQL:{[_.name]:S.error}}}),S.structDef&&m.update({compileSQL:{[_.name]:S.structDef}})}catch(v){const _={};_[E.name]=v.toString(),m.update({errors:{compileSQL:_}})}}}}}static async safelyFetchTableSchema(e,n,r){const i=await e.fetchSchemaForTables(n,r);for(const s of Object.keys(n))if(i.schemas[s]===void 0&&i.errors[s]===void 0)throw new Error(`Schema fetch error for ${e.name}, no response for ${s} from ${e.dialectName}`);return i}static compileSQLBlock(e,n,r,i){let s,o="",u=!1;for(const c of r.select)if((0,ir.isSegmentSQL)(c))o+=c.sql,u=c.sql.match(/\(\s*$/)!==null;else{if(!s){if(!n)throw new Error("Internal error: Partial model missing when compiling SQL block");s=new ir.QueryModel(n,i==null?void 0:i.eventStream)}const f=s.compileQuery(c,{...i,defaultRowLimit:void 0},!1).sql;o+=u?f:`(${f})`,u=!1}const{name:a,connection:l}=r;return{type:"sql_select",name:a,connection:l,dialect:e,selectStr:o,fields:[]}}static async run({connections:e,preparedResult:n,sqlStruct:r,connection:i,options:s}){if(!i){if(!e)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");const o=(r==null?void 0:r.connection)||(n==null?void 0:n.connectionName);i=await e.lookupConnection(o)}if(r){const o=await i.runSQL(r.selectStr);return new am({structs:[r],sql:r.selectStr,result:o.rows,totalRows:o.totalRows,runStats:o.runStats,lastStageName:r.name,malloy:"",connectionName:r.connection,sourceExplore:"",sourceFilters:[],profilingUrl:o.profilingUrl},{name:"empty_model",exports:[],contents:{},queryList:[],dependencies:{}})}else if(n){const o=await i.runSQL(n.sql,s);return new am({...n._rawQuery,result:o.rows,totalRows:o.totalRows,runStats:o.runStats,profilingUrl:o.profilingUrl},n._modelDef)}else throw new Error("Internal error: sqlStruct or preparedResult must be provided.")}static async*runStream({connections:e,preparedResult:n,sqlStruct:r,connection:i,options:s}){if(r===void 0&&n===void 0)throw new Error("Internal error: sqlBlock or preparedResult must be provided.");const o=(r==null?void 0:r.connection)||(n==null?void 0:n.connectionName);if(i===void 0){if(e===void 0)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");i=await e.lookupConnection(o)}if(!i.canStream())throw new Error(`Connection '${o}' cannot stream results.`);let u,a;if(r)a=new ps(r),u=r.selectStr;else if(n!==void 0)a=n.resultExplore,u=n.sql;else throw new Error("Internal error: sqlStruct or preparedResult must be provided.");let l=0;for await(const c of i.runSQLStream(u,s))yield new Bf(c,l,a,void 0,void 0),l+=1}static async estimateQueryCost({connections:e,preparedResult:n,sqlStruct:r}){if(!e)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");const i=(r==null?void 0:r.connection)||(n==null?void 0:n.connectionName),s=await e.lookupConnection(i);if(r)return await s.estimateQueryCost(r.selectStr);if(n)return await s.estimateQueryCost(n.sql);throw new Error("Internal error: sqlStruct or preparedResult must be provided.")}}we.Malloy=Pn;class TW extends Error{constructor(e,n=[]){super(e),this.problems=n}}we.MalloyError=TW;let im=class{constructor(e,n,r,i=()=>{},s=()=>{}){this.modelDef=e,this.problems=n,this.fromSources=r,this._referenceAt=i,this._importAt=s}tagParse(e){return Cn.Tag.annotationToTag(this.modelDef.annotation,e)}getTaglines(e){return Cn.Tag.annotationToTaglines(this.modelDef.annotation,e)}getReference(e){return this._referenceAt(e)}getImport(e){return this._importAt(e)}getPreparedQueryByName(e){const n=this.modelDef.contents[e];if((n==null?void 0:n.type)==="query")return new Oh(n,this.modelDef,this.problems,e);throw new Error("Given query name does not refer to a named query.")}getPreparedQueryByIndex(e){if(e<0)throw new Error(`Invalid index ${e}.`);if(e>=this.modelDef.queryList.length)throw new Error(`Query index ${e} is out of bounds.`);return new Oh(this.modelDef.queryList[e],this.modelDef,this.problems)}get preparedQuery(){return this.getPreparedQuery()}getPreparedQuery(){if(this.modelDef.queryList.length===0)throw new Error("Model has no queries.");return new Oh(this.modelDef.queryList[this.modelDef.queryList.length-1],this.modelDef,this.problems)}getExploreByName(e){const n=this.modelDef.contents[e];if((0,ir.isSourceDef)(n))return new ps(n);throw new Error("'name' is not an explore")}get explores(){return Object.values(this.modelDef.contents).filter(ir.isSourceDef).map(e=>new ps(e))}get namedQueries(){const e=n=>n.type==="query";return Object.values(this.modelDef.contents).filter(e)}get exportedExplores(){return this.explores.filter(e=>this.modelDef.exports.includes(e.name))}get _modelDef(){return this.modelDef}};we.Model=im;class Oh{constructor(e,n,r,i){this.problems=r,this.name=i,this._query=e,this._modelDef=n}tagParse(e){const n=Cn.Tag.annotationToTag(this._modelDef.annotation).tag;return e=Cn.Tag.addModelScope(e,n),Cn.Tag.annotationToTag(this._query.annotation,e)}getTaglines(e){return Cn.Tag.annotationToTaglines(this._query.annotation,e)}get preparedResult(){return this.getPreparedResult()}getPreparedResult(e){const r=new ir.QueryModel(this._modelDef,e==null?void 0:e.eventStream).compileQuery(this._query,e);return new sm({...r,queryName:this.name||r.queryName},this._modelDef)}get dialect(){const e=this._query.structRef,n=typeof e=="string"?this._modelDef.contents[e]:e;if(!(0,ir.isSourceDef)(n))throw new Error("Invalid source for query");return n.dialect}getFlattenedQuery(e){return this}}we.PreparedQuery=Oh;class RW{constructor(e){this.translator=e}get symbols(){return(this.translator.metadata().symbols||[]).map(e=>new H5(e))}get tablePathInfo(){var e;return((e=this.translator.tablePathInfo().pathInfo)!==null&&e!==void 0?e:[]).map(r=>new OW(r))}get _translator(){return this.translator}completions(e){return(this.translator.completions(e).completions||[]).map(n=>new DW(n))}helpContext(e){return this.translator.helpContext(e).helpContext}}we.Parse=RW;class OW{constructor(e){this._range=Dh.fromJSON(e.range),this._connectionId=e.connectionId,this._tablePath=e.tablePath}get range(){return this._range}get connectionId(){return this._connectionId}get tablePath(){return this._tablePath}}we.DocumentTablePath=OW;class Dh{constructor(e,n){this._start=e,this._end=n}get start(){return this._start}get end(){return this._end}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}static fromJSON(e){return new Dh(new X7(e.start.line,e.start.character),new X7(e.end.line,e.end.character))}}we.DocumentRange=Dh;class X7{constructor(e,n){this._line=e,this._character=n}get line(){return this._line}get character(){return this._character}toJSON(){return{line:this.line,character:this.character}}}we.DocumentPosition=X7;class H5{constructor(e){this._range=Dh.fromJSON(e.range),this._lensRange=e.lensRange?Dh.fromJSON(e.lensRange):void 0,this._type=e.type,this._name=e.name,this._children=e.children.map(n=>new H5(n))}get range(){return this._range}get lensRange(){var e;return(e=this._lensRange)!==null&&e!==void 0?e:this._range}get type(){return this._type}get name(){return this._name}get children(){return this._children}}we.DocumentSymbol=H5;class DW{constructor(e){this.type=e.type,this.text=e.text}}we.DocumentCompletion=DW;class sm{constructor(e,n){this.modelDef=n,this.inner=e}static fromJson({query:e,modelDef:n}){if(!e||!n)throw new Error("Missing required properties in JSON data");return new sm(e,n)}tagParse(e){const n=Cn.Tag.annotationToTag(this.modelDef.annotation).tag;return e=Cn.Tag.addModelScope(e,n),Cn.Tag.annotationToTag(this.inner.annotation,e)}getTaglines(e){return Cn.Tag.annotationToTaglines(this.inner.annotation,e)}get annotation(){return this.inner.annotation}get modelAnnotation(){return this.modelDef.annotation}get modelTag(){return Cn.Tag.annotationToTag(this.modelDef.annotation).tag}get connectionName(){return this.inner.connectionName}get _rawQuery(){return this.inner}get _modelDef(){return this.modelDef}get sql(){return this.inner.sql}get dependenciesToMaterialize(){return this.inner.dependenciesToMaterialize}get materialization(){return this.inner.materialization}get resultExplore(){if(this.inner.structs.length===0)throw new Error("Malformed query result.");const e=this.inner.structs[this.inner.structs.length-1],n={...e,annotation:this.inner.annotation,name:this.inner.queryName||e.name};try{return new ps(n,this.sourceExplore)}catch{return new ps(n)}}get sourceExplore(){const e=this.inner.sourceExplore,n=this.modelDef.contents[e];if(n===void 0)throw new Error("Malformed query result.");if((0,ir.isSourceDef)(n))return new ps(n);throw new Error(`'${e} is not an explore`)}get _sourceExploreName(){return this.inner.sourceExplore}get _sourceFilters(){return this.inner.sourceFilters||[]}}we.PreparedResult=sm;class wW{async readURL(e){throw new Error("No files.")}}we.EmptyURLReader=wW;class QOe{constructor(e){this.files=e}async readURL(e){const n=this.files.get(e.toString());if(n!==void 0)return Promise.resolve(n);throw new Error(`File not found '${e}'`)}}we.InMemoryURLReader=QOe;class om{constructor(e,n){this.connections=e,this.defaultConnectionName=n}async getConnection(e){if(e===void 0)if(this.defaultConnectionName!==void 0)e=this.defaultConnectionName;else throw new Error("No default connection.");const n=this.connections.get(e);if(n!==void 0)return Promise.resolve(n);throw new Error(`No connection found with name ${e}.`)}listConnections(){return Array.from(this.connections.values())}async lookupConnection(e){return this.getConnection(e)}static fromArray(e){return new om(new Map(e.map(n=>[n.name,n])))}}we.FixedConnectionMap=om;var NW;(function(t){t.Nested="nested",t.BaseTable="base_table",t.Cross="cross",t.One="one",t.Many="many",t.Inline="inline"})(NW||(we.SourceRelationship=NW={}));class Z7{constructor(e,n,r){this._name=e,this._parent=n,this._source=r}get source(){return this.source}get name(){return this._name}get sourceClasses(){const e=[];return this.source&&e.push(this.source.name),e.push(this.name),e}get fieldPath(){const e=[this.name];let n=this._parent;for(;n;)e.unshift(n.name),n=n._parent;return e}hasParentExplore(){return this._parent!==void 0}isExplore(){return this instanceof ps}isQuery(){return this instanceof ow}}class ps extends Z7{constructor(e,n,r){super(e.as||e.name,n,r),this._structDef=e,this._parentExplore=n,this.sourceExplore=r}get source(){return this.sourceExplore}isIntrinsic(){return(0,ir.isAtomicFieldType)(this._structDef.type)?!("e"in this._structDef):!1}isExploreField(){return!1}tagParse(e){return Cn.Tag.annotationToTag(this._structDef.annotation,e)}getTaglines(e){return Cn.Tag.annotationToTaglines(this._structDef.annotation,e)}get modelTag(){return this.parsedModelTag||(this.parsedModelTag=Cn.Tag.annotationToTag(this._structDef.modelAnnotation).tag),this.parsedModelTag}get name(){return this.structDef.as||this.structDef.name}getQueryByName(e){const n=this.sourceStructDef;if(!n)throw new Error(`Cannot get query by name from a struct of type ${this.structDef.type}`);const r={type:"query",structRef:n,pipeline:[{type:"reduce",queryFields:[{type:"fieldref",path:[e]}]}]};return new Oh(r,this.modelDef,[],e)}get modelDef(){if(!(0,ir.isSourceDef)(this.structDef))throw new Error(`Cannot create pseudo model for struct type ${this.structDef.type}`);return{name:"generated_model",exports:[],contents:{[this.structDef.name]:this.structDef},queryList:[],dependencies:{}}}getSingleExploreModel(){return new im(this.modelDef,[],[])}get fieldMap(){var e;if(this._fieldMap===void 0){const n=((e=this.source)===null||e===void 0?void 0:e.fieldMap)||new Map;this._fieldMap=new Map(this.structDef.fields.map(r=>{const i=r.as||r.name,s=n.get(r.name);if((0,ir.isJoined)(r))return[i,new uw(r,this,s)];if(r.type==="turtle")return[i,new ow(r,this,s)];if(r.type==="string")return[i,new sw(r,this,s)];if(r.type==="number")return[i,new z5(r,this,s)];if(r.type==="date")return r.timeframe&&["day_of_month","day_of_week","day_of_year"].includes(r.timeframe)?[i,new z5({...r,type:"number"},this,s)]:[i,new ew(r,this,s)];if(r.type==="timestamp")return[i,new tw(r,this,s)];if(r.type==="boolean")return[i,new nw(r,this,s)];if(r.type==="json")return[i,new rw(r,this,s)];if(r.type==="sql native")return[i,new iw(r,this,s)]}))}return this._fieldMap}get allFields(){return[...this.fieldMap.values()]}get allFieldsWithOrder(){var e,n,r;if(!this._allFieldsWithOrder){const i=[...((r=(n=(e=this.sourceStructDef)===null||e===void 0?void 0:e.resultMetadata)===null||n===void 0?void 0:n.orderBy)===null||r===void 0?void 0:r.map(o=>{if(typeof o.field=="string")return{field:this.fieldMap.get(o.field),dir:o.dir};throw new Error("Does not support mapping order by from number.")}))||[]],s=new Set(i.map(o=>o.field.name));this._allFieldsWithOrder=[...i,...this.allFields.filter(o=>!s.has(o.name)).map(o=>({field:o,dir:"asc"}))]}return this._allFieldsWithOrder}get intrinsicFields(){return[...this.fieldMap.values()].filter(e=>e.isIntrinsic())}get dimensions(){return[...this.allFieldsWithOrder].filter(e=>e.field.isAtomicField()&&e.field.sourceWasDimension())}getFieldByName(e){const n=this.fieldMap.get(e);if(n===void 0)throw new Error(`No such field ${e}.`);return n}getFieldByNameIfExists(e){return this.fieldMap.get(e)}get primaryKey(){var e;return(e=this.sourceStructDef)===null||e===void 0?void 0:e.primaryKey}get parentExplore(){return this._parentExplore}hasParentExplore(){return this instanceof uw}get filters(){var e;return(0,ir.isSourceDef)(this.structDef)?((e=this.structDef.resultMetadata)===null||e===void 0?void 0:e.filterList)||[]:[]}get limit(){var e,n;return(n=(e=this.sourceStructDef)===null||e===void 0?void 0:e.resultMetadata)===null||n===void 0?void 0:n.limit}get structDef(){return this._structDef}get queryTimezone(){var e;return(e=this.sourceStructDef)===null||e===void 0?void 0:e.queryTimezone}get sourceStructDef(){if((0,ir.isSourceDef)(this.structDef))return this.structDef}toJSON(){var e,n;return{_structDef:this._structDef,sourceExplore:(e=this.sourceExplore)===null||e===void 0?void 0:e.toJSON(),_parentExplore:(n=this._parentExplore)===null||n===void 0?void 0:n.toJSON()}}static fromJSON(e){const n=e._parentExplore!==void 0?ps.fromJSON(e._parentExplore):void 0,r=e.sourceExplore!==void 0?ps.fromJSON(e.sourceExplore):void 0;return new ps(e._structDef,n,r)}get location(){return this.structDef.location}}we.Explore=ps;var Fu;(function(t){t.String="string",t.Number="number",t.Boolean="boolean",t.Date="date",t.Timestamp="timestamp",t.Json="json",t.NativeUnsupported="sql native",t.Error="error"})(Fu||(we.AtomicFieldType=Fu={}));class w0 extends Z7{constructor(e,n,r){super(e.as||e.name,n,r),this.fieldTypeDef=e,this.parent=n}get type(){switch(this.fieldTypeDef.type){case"string":return Fu.String;case"boolean":return Fu.Boolean;case"date":return Fu.Date;case"timestamp":return Fu.Timestamp;case"number":return Fu.Number;case"json":return Fu.Json;case"sql native":return Fu.NativeUnsupported;case"error":return Fu.Error;case"record":case"array":throw new Error(`MTOY TODO IMPLEMENT Atomic ${this.fieldTypeDef.type}`);default:{const e=this.fieldTypeDef;throw new Error(`Can't make an atomic field from ${e}`)}}}tagParse(e){return e=Cn.Tag.addModelScope(e,this.parent.modelTag),Cn.Tag.annotationToTag(this.fieldTypeDef.annotation,e)}getTaglines(e){return Cn.Tag.annotationToTaglines(this.fieldTypeDef.annotation,e)}isIntrinsic(){return(0,ir.fieldIsIntrinsic)(this.fieldTypeDef)}isQueryField(){return!1}isExploreField(){return!1}isAtomicField(){return!0}isCalculation(){return(0,ir.expressionIsCalculation)(this.fieldTypeDef.expressionType)}get sourceField(){throw new Error}get sourceClasses(){const e=this.fieldTypeDef.name||this.fieldTypeDef.as;return e?[e]:[]}get referenceId(){var e;return(e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.referenceId}sourceWasMeasure(){var e;return((e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.fieldKind)==="measure"}sourceWasMeasureLike(){var e,n;return((e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.fieldKind)==="measure"||((n=this.fieldTypeDef.resultMetadata)===null||n===void 0?void 0:n.fieldKind)==="struct"}sourceWasDimension(){var e;return((e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.fieldKind)==="dimension"}hasParentExplore(){return!0}isString(){return this instanceof sw}isNumber(){return this instanceof z5}isDate(){return this instanceof ew}isBoolean(){return this instanceof nw}isJSON(){return this instanceof rw}isTimestamp(){return this instanceof tw}isUnsupported(){return this instanceof iw}get parentExplore(){return this.parent}get expression(){const e=".",n=this.fieldTypeDef.resultMetadata;return(n==null?void 0:n.sourceExpression)||(n!=null&&n.sourceField.includes(e)?n==null?void 0:n.sourceField:this.name)}get location(){return this.fieldTypeDef.location}}we.AtomicField=w0;var If;(function(t){t.Day="day",t.Week="week",t.Month="month",t.Quarter="quarter",t.Year="year"})(If||(we.DateTimeframe=If={}));var Lu;(function(t){t.Day="day",t.Week="week",t.Month="month",t.Quarter="quarter",t.Year="year",t.Second="second",t.Hour="hour",t.Minute="minute"})(Lu||(we.TimestampTimeframe=Lu={}));class ew extends w0{constructor(e,n,r){super(e,n,r),this.fieldDateDef=e}get timeframe(){if(this.fieldDateDef.timeframe!==void 0)switch(this.fieldDateDef.timeframe){case"day":return If.Day;case"week":return If.Week;case"month":return If.Month;case"quarter":return If.Quarter;case"year":return If.Year}}}we.DateField=ew;class tw extends w0{constructor(e,n,r){super(e,n,r),this.fieldTimestampDef=e}get timeframe(){if(this.fieldTimestampDef.timeframe!==void 0)switch(this.fieldTimestampDef.timeframe){case"day":return Lu.Day;case"week":return Lu.Week;case"month":return Lu.Month;case"quarter":return Lu.Quarter;case"year":return Lu.Year;case"second":return Lu.Second;case"hour":return Lu.Hour;case"minute":return Lu.Minute}}}we.TimestampField=tw;class z5 extends w0{constructor(e,n,r){super(e,n,r),this.fieldNumberDef=e}}we.NumberField=z5;class nw extends w0{constructor(e,n,r){super(e,n,r),this.fieldBooleanDef=e}}we.BooleanField=nw;class rw extends w0{constructor(e,n,r){super(e,n,r),this.fieldJSONDef=e}}we.JSONField=rw;class iw extends w0{constructor(e,n,r){super(e,n,r),this.fieldUnsupportedDef=e}get rawType(){return this.fieldUnsupportedDef.rawType}}we.UnsupportedField=iw;class sw extends w0{constructor(e,n,r){super(e,n,r),this.fieldStringDef=e}}we.StringField=sw;class FW extends Z7{constructor(e,n,r){super(e.as||e.name,n,r),this.turtleDef=e}get source(){return this.sourceQuery}isIntrinsic(){return!1}get location(){return this.turtleDef.location}}we.Query=FW;class ow extends FW{constructor(e,n,r){super(e,n,r),this.parent=n}tagParse(e){return e=Cn.Tag.addModelScope(e,this.parent.modelTag),Cn.Tag.annotationToTag(this.turtleDef.annotation,e)}getTaglines(e){return Cn.Tag.annotationToTaglines(this.turtleDef.annotation,e)}isQueryField(){return!0}isExploreField(){return!1}isAtomicField(){return!1}get sourceClasses(){const e=this.turtleDef.name||this.turtleDef.as;return e?[e]:[]}hasParentExplore(){return!0}get parentExplore(){return this.parent}get expression(){return this.name}}we.QueryField=ow;var wh;(function(t){t.OneToOne="one_to_one",t.OneToMany="one_to_many",t.ManyToOne="many_to_one"})(wh||(we.JoinRelationship=wh={}));class uw extends ps{constructor(e,n,r){super(e,n,r),this._parentExplore=n}get joinRelationship(){if((0,ir.isJoined)(this.structDef))switch(this.structDef.join){case"one":return wh.OneToOne;case"many":case"cross":return wh.ManyToOne}throw new Error("A source field must have a join relationship.")}get isRecord(){return this.joinRelationship===wh.OneToOne}get isArray(){return this.joinRelationship!==wh.OneToOne}tagParse(e){return e=Cn.Tag.addModelScope(e,this._parentExplore.modelTag),Cn.Tag.annotationToTag(this._structDef.annotation,e)}isQueryField(){return!1}isExploreField(){return!0}isAtomicField(){return!1}get parentExplore(){return this._parentExplore}get sourceClasses(){const e=this.structDef.name||this.structDef.as;return e?[e]:[]}}we.ExploreField=uw;class aw{constructor(...e){this.isTestRuntime=!1;let n,r,i;for(const s of e)s!==void 0&&(QW(s)?n=s:KOe(s)?r=s:GW(s)?i=s:r={lookupConnection:()=>Promise.resolve(s)});if(n===void 0&&(n=new wW),r===void 0)throw new Error("A LookupConnection<Connection> or Connection is required.");this._urlReader=n,this._connections=r,this._eventStream=i}get urlReader(){return this._urlReader}get connections(){return this._connections}get eventStream(){return this._eventStream}loadModel(e,n){const{refreshSchemaCache:r,noThrowOnError:i}=n||{};return this.isTestRuntime&&(n===void 0?n={testEnvironment:!0}:n={...n,testEnvironment:!0}),new um(this,async()=>{const s=e instanceof URL?await Pn.parse({url:e,urlReader:this.urlReader,eventStream:this.eventStream,options:n}):Pn.parse({source:e,eventStream:this.eventStream,options:n});return Pn.compile({urlReader:this.urlReader,connections:this.connections,parse:s,refreshSchemaCache:r,noThrowOnError:i,eventStream:this.eventStream,replaceMaterializedReferences:n==null?void 0:n.replaceMaterializedReferences,materializedTablePrefix:n==null?void 0:n.materializedTablePrefix})},n)}_loadModelFromModelDef(e,n){return new um(this,async()=>new im(e,[],[]),n)}loadQuery(e,n){return this.loadModel(e,n).loadFinalQuery()}loadQueryByIndex(e,n,r){return this.loadModel(e,r).loadQueryByIndex(n,r)}loadQueryByName(e,n,r){return this.loadModel(e,r).loadQueryByName(n,r)}getModel(e,n){return this.loadModel(e,n).getModel()}getQuery(e,n){return this.loadQuery(e,n).getPreparedQuery()}getQueryByIndex(e,n,r){return this.loadQueryByIndex(e,n,r).getPreparedQuery()}getQueryByName(e,n,r){return this.loadQueryByName(e,n,r).getPreparedQuery()}}we.Runtime=aw;class GOe extends aw{constructor(e,n){if(n===void 0){const r=e;super(om.fromArray(r)),this.rawConnections=r}else{const r=n;super(e,om.fromArray(r)),this.rawConnections=r}}}we.ConnectionRuntime=GOe;class WOe extends aw{constructor(...e){let n,r,i;for(const s of e)QW(s)&&(n=s),JOe(s)&&(r=s),GW(s)&&(i=s);if(r===void 0)throw new Error("Expected connection to be passed into SingleConnectionRuntime");super(n,r,i),this.connection=r}get supportsNesting(){return(0,J7.getDialect)(this.connection.dialectName).supportsNesting}quote(e){return(0,J7.getDialect)(this.connection.dialectName).sqlMaybeQuoteIdentifier(e)}get dialect(){return(0,J7.getDialect)(this.connection.dialectName)}getQuoter(){return e=>this.quote(e.toString())}}we.SingleConnectionRuntime=WOe;class Q5{constructor(e,n){this.runtime=e,this._materialize=n}materialize(){return this.materialized===void 0?this.rematerialize():this.materialized}rematerialize(){return this.materialized=this._materialize(),this.materialized}makeQueryMaterializer(e,n){return new LW(this.runtime,e,n)}makeExploreMaterializer(e,n){return new BW(this.runtime,e,n)}makePreparedResultMaterializer(e){return new IW(this.runtime,e)}}class um extends Q5{constructor(e,n,r){super(e,n),this.runtime=e,this.compileQueryOptions=r}loadFinalQuery(e){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQuery(),{...this.compileQueryOptions,...e})}loadQueryByIndex(e,n){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQueryByIndex(e),{...this.compileQueryOptions,...n})}loadQueryByName(e,n){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQueryByName(e),{...this.compileQueryOptions,...n})}loadQuery(e,n){const{refreshSchemaCache:r,noThrowOnError:i}=n||{};return this.makeQueryMaterializer(async()=>{const s=this.runtime.urlReader,o=this.runtime.connections;this.runtime.isTestRuntime&&(n===void 0?n={testEnvironment:!0}:n={...n,testEnvironment:!0});const u=e instanceof URL?await Pn.parse({url:e,urlReader:s,options:n}):Pn.parse({source:e,options:n}),a=await this.getModel();return(await Pn.compile({urlReader:s,connections:o,parse:u,model:a,refreshSchemaCache:r,noThrowOnError:i,...this.compileQueryOptions})).preparedQuery})}extendModel(e,n){return this.runtime.isTestRuntime&&(n===void 0?n={testEnvironment:!0}:n={...n,testEnvironment:!0}),new um(this.runtime,async()=>{const r=this.runtime.urlReader,i=this.runtime.connections,s=e instanceof URL?await Pn.parse({url:e,urlReader:r,options:n}):Pn.parse({source:e,options:n}),o=await this.getModel();return await Pn.compile({urlReader:r,connections:i,parse:s,model:o,refreshSchemaCache:n==null?void 0:n.refreshSchemaCache,noThrowOnError:n==null?void 0:n.noThrowOnError,...this.compileQueryOptions})},n)}async search(e,n,r=1e3,i=void 0,s){const o=await this.materialize(),u=new ir.QueryModel(o._modelDef,s),a=o.getExploreByName(e).structDef;if(!(0,ir.isSourceDef)(a))throw new Error("Source to be searched was unexpectedly, not a source");const l=a.connection,c=await this.runtime.connections.lookupConnection(l);return await u.searchIndex(c,e,n,r,i)}async searchValueMap(e,n=10,r){const s=(await this.materialize()).getExploreByName(e);if(!(0,ir.isSourceDef)(s.structDef))throw new Error("Source to be searched was unexpectedly, not a source");let o="{index: *}";s.getFieldByNameIfExists("search_index")&&(o="search_index");const u=`
1271
1271
  run: ${e}
1272
1272
  -> ${o}
@@ -1288,7 +1288,7 @@ ${E}`,y)}}else{if(g.urls)for(const E of g.urls)try{if(E.startsWith("internal://"
1288
1288
  `)}}this.stream.write(`
1289
1289
  ]
1290
1290
  `),this.stream.close()}}we.JSONWriter=XOe;class ZOe extends lw{constructor(){super(...arguments),this.columnSeparator=",",this.rowSeparator=`
1291
- `,this.quoteCharacter='"',this.includeHeader=!0,this.emptyCell=""}escape(e){const n=e.includes(this.quoteCharacter),r=e.includes(this.columnSeparator),i=e.includes(this.rowSeparator),s=r||n||i;return n&&(e=e.replace(new RegExp(this.quoteCharacter,"g"),this.quoteCharacter+this.quoteCharacter)),s&&(e=this.quoteCharacter+e+this.quoteCharacter),e}stringify(e){return e===null?this.emptyCell:e instanceof Date?e.toISOString():typeof e=="boolean"||typeof e=="number"?JSON.stringify(e):`${e}`}getColWeight(e){let n=e;Array.isArray(e)&&(n=e[0]);let r=0;for(const i in n){r=r+1;const s=n[i];if(Array.isArray(s)){const o=this.getColWeight(s)-1;r=r+o}}return r}getHeaderRow(e){const n=[];let r=0;for(const i in e){n.push(this.escape(i));const s=e[i];if(r++,Array.isArray(s)){const o=this.getColWeight(s)-1;r=r+o;for(let u=0;u<o;u++)n.push(this.emptyCell)}}return{rows:[n.join(this.columnSeparator)],length:1,width:r}}mergeMatrices(e){const n=Math.max(...e.map(s=>s.length)),r=e.reduce((s,o)=>s+o.width,0),i=[];for(let s=0;s<n;s++){const o=[];for(const u of e)if(s<u.length)o.push(u.rows[s]);else{const a=Array(u.width).fill(this.emptyCell);o.push(...a)}i.push(o.join(this.columnSeparator))}return{rows:i,length:n,width:r}}getChildMatrix(e){if(Array.isArray(e)){if(e.length===0)return{rows:[""],length:1,width:1}}else return{rows:["Invalid data found, value is not an array"],length:1,width:1};const n=[],r=this.getHeaderRow(e[0]);n.push(...r.rows);const i=r.width;let s=1;for(const o of e){const u=this.getRowMatrix(o);s=s+u.length,n.push(...u.rows)}return{rows:n,length:s,width:i}}getRowMatrix(e){const n=[];for(const r in e){const i=e[r];if(Array.isArray(i)){const s=this.getChildMatrix(i);n.push(s)}else{const s={rows:[this.stringify(i)],length:1,width:1};n.push(s)}}return this.mergeMatrices(n)}async process(e){let n=!1;for await(const r of e){if(!n&&this.includeHeader){const s=this.getHeaderRow(r.toObject());this.stream.write(s.rows[0]),this.stream.write(this.rowSeparator),n=!0}const i=this.getRowMatrix(r.toObject());for(const s of i.rows)this.stream.write(s),this.stream.write(this.rowSeparator)}this.stream.close()}}we.CSVWriter=ZOe;var V5={};Object.defineProperty(V5,"__esModule",{value:!0}),V5.toAsyncGenerator=void 0;async function*eDe(t){let e=!1;function n(i){let s;const o=new Promise(u=>{s=u});return i(u=>{s({done:!0,isError:!0,error:u})},u=>{s({done:!1,value:u,isError:!1,next:new Promise(a=>{s=a})})},()=>{s({done:!0,isError:!1})}),o}let r=n(t);for(;!e;){const i=await r;if(i.done){if(e=!0,i.isError)throw i.error;break}else r=i.next,yield i.value}}V5.toAsyncGenerator=eDe,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.InMemoryURLReader=t.EmptyURLReader=t.SingleConnectionRuntime=t.ConnectionRuntime=t.AtomicFieldType=t.Runtime=t.Malloy=t.Model=t.MalloyTranslator=t.composeSQLExpr=t.indent=t.expressionIsUngroupedAggregate=t.expressionIsScalar=t.expressionIsCalculation=t.expressionIsAnalytic=t.expressionIsAggregate=t.mkFieldDef=t.mkArrayDef=t.isScalarArray=t.isRepeatedRecord=t.isSamplingRows=t.isSamplingPercent=t.isSamplingEnable=t.isJoinedSource=t.isJoined=t.isLeafAtomic=t.Segment=t.isSourceDef=t.TinyParser=t.Dialect=t.spread=t.literal=t.variadicParam=t.param=t.makeParam=t.sql=t.maxScalar=t.minAggregate=t.anyExprType=t.minScalar=t.overload=t.qtz=t.arg=t.registerDialect=t.MySQLDialect=t.SnowflakeDialect=t.PostgresDialect=t.TrinoDialect=t.StandardSQLDialect=t.DuckDBDialect=void 0,t.Tag=t.toAsyncGenerator=t.Explore=t.DataWriter=t.Parse=t.JSONWriter=t.CSVWriter=t.QueryMaterializer=t.Result=t.PreparedResult=t.TimestampTimeframe=t.DateTimeframe=t.SourceRelationship=t.JoinRelationship=t.MalloyError=t.FixedConnectionMap=void 0;var e=ed;Object.defineProperty(t,"DuckDBDialect",{enumerable:!0,get:function(){return e.DuckDBDialect}}),Object.defineProperty(t,"StandardSQLDialect",{enumerable:!0,get:function(){return e.StandardSQLDialect}}),Object.defineProperty(t,"TrinoDialect",{enumerable:!0,get:function(){return e.TrinoDialect}}),Object.defineProperty(t,"PostgresDialect",{enumerable:!0,get:function(){return e.PostgresDialect}}),Object.defineProperty(t,"SnowflakeDialect",{enumerable:!0,get:function(){return e.SnowflakeDialect}}),Object.defineProperty(t,"MySQLDialect",{enumerable:!0,get:function(){return e.MySQLDialect}}),Object.defineProperty(t,"registerDialect",{enumerable:!0,get:function(){return e.registerDialect}}),Object.defineProperty(t,"arg",{enumerable:!0,get:function(){return e.arg}}),Object.defineProperty(t,"qtz",{enumerable:!0,get:function(){return e.qtz}}),Object.defineProperty(t,"overload",{enumerable:!0,get:function(){return e.overload}}),Object.defineProperty(t,"minScalar",{enumerable:!0,get:function(){return e.minScalar}}),Object.defineProperty(t,"anyExprType",{enumerable:!0,get:function(){return e.anyExprType}}),Object.defineProperty(t,"minAggregate",{enumerable:!0,get:function(){return e.minAggregate}}),Object.defineProperty(t,"maxScalar",{enumerable:!0,get:function(){return e.maxScalar}}),Object.defineProperty(t,"sql",{enumerable:!0,get:function(){return e.sql}}),Object.defineProperty(t,"makeParam",{enumerable:!0,get:function(){return e.makeParam}}),Object.defineProperty(t,"param",{enumerable:!0,get:function(){return e.param}}),Object.defineProperty(t,"variadicParam",{enumerable:!0,get:function(){return e.variadicParam}}),Object.defineProperty(t,"literal",{enumerable:!0,get:function(){return e.literal}}),Object.defineProperty(t,"spread",{enumerable:!0,get:function(){return e.spread}}),Object.defineProperty(t,"Dialect",{enumerable:!0,get:function(){return e.Dialect}}),Object.defineProperty(t,"TinyParser",{enumerable:!0,get:function(){return e.TinyParser}});var n=ts;Object.defineProperty(t,"isSourceDef",{enumerable:!0,get:function(){return n.isSourceDef}}),Object.defineProperty(t,"Segment",{enumerable:!0,get:function(){return n.Segment}}),Object.defineProperty(t,"isLeafAtomic",{enumerable:!0,get:function(){return n.isLeafAtomic}}),Object.defineProperty(t,"isJoined",{enumerable:!0,get:function(){return n.isJoined}}),Object.defineProperty(t,"isJoinedSource",{enumerable:!0,get:function(){return n.isJoinedSource}}),Object.defineProperty(t,"isSamplingEnable",{enumerable:!0,get:function(){return n.isSamplingEnable}}),Object.defineProperty(t,"isSamplingPercent",{enumerable:!0,get:function(){return n.isSamplingPercent}}),Object.defineProperty(t,"isSamplingRows",{enumerable:!0,get:function(){return n.isSamplingRows}}),Object.defineProperty(t,"isRepeatedRecord",{enumerable:!0,get:function(){return n.isRepeatedRecord}}),Object.defineProperty(t,"isScalarArray",{enumerable:!0,get:function(){return n.isScalarArray}}),Object.defineProperty(t,"mkArrayDef",{enumerable:!0,get:function(){return n.mkArrayDef}}),Object.defineProperty(t,"mkFieldDef",{enumerable:!0,get:function(){return n.mkFieldDef}}),Object.defineProperty(t,"expressionIsAggregate",{enumerable:!0,get:function(){return n.expressionIsAggregate}}),Object.defineProperty(t,"expressionIsAnalytic",{enumerable:!0,get:function(){return n.expressionIsAnalytic}}),Object.defineProperty(t,"expressionIsCalculation",{enumerable:!0,get:function(){return n.expressionIsCalculation}}),Object.defineProperty(t,"expressionIsScalar",{enumerable:!0,get:function(){return n.expressionIsScalar}}),Object.defineProperty(t,"expressionIsUngroupedAggregate",{enumerable:!0,get:function(){return n.expressionIsUngroupedAggregate}}),Object.defineProperty(t,"indent",{enumerable:!0,get:function(){return n.indent}}),Object.defineProperty(t,"composeSQLExpr",{enumerable:!0,get:function(){return n.composeSQLExpr}});var r=iO;Object.defineProperty(t,"MalloyTranslator",{enumerable:!0,get:function(){return r.MalloyTranslator}});var i=we;Object.defineProperty(t,"Model",{enumerable:!0,get:function(){return i.Model}}),Object.defineProperty(t,"Malloy",{enumerable:!0,get:function(){return i.Malloy}}),Object.defineProperty(t,"Runtime",{enumerable:!0,get:function(){return i.Runtime}}),Object.defineProperty(t,"AtomicFieldType",{enumerable:!0,get:function(){return i.AtomicFieldType}}),Object.defineProperty(t,"ConnectionRuntime",{enumerable:!0,get:function(){return i.ConnectionRuntime}}),Object.defineProperty(t,"SingleConnectionRuntime",{enumerable:!0,get:function(){return i.SingleConnectionRuntime}}),Object.defineProperty(t,"EmptyURLReader",{enumerable:!0,get:function(){return i.EmptyURLReader}}),Object.defineProperty(t,"InMemoryURLReader",{enumerable:!0,get:function(){return i.InMemoryURLReader}}),Object.defineProperty(t,"FixedConnectionMap",{enumerable:!0,get:function(){return i.FixedConnectionMap}}),Object.defineProperty(t,"MalloyError",{enumerable:!0,get:function(){return i.MalloyError}}),Object.defineProperty(t,"JoinRelationship",{enumerable:!0,get:function(){return i.JoinRelationship}}),Object.defineProperty(t,"SourceRelationship",{enumerable:!0,get:function(){return i.SourceRelationship}}),Object.defineProperty(t,"DateTimeframe",{enumerable:!0,get:function(){return i.DateTimeframe}}),Object.defineProperty(t,"TimestampTimeframe",{enumerable:!0,get:function(){return i.TimestampTimeframe}}),Object.defineProperty(t,"PreparedResult",{enumerable:!0,get:function(){return i.PreparedResult}}),Object.defineProperty(t,"Result",{enumerable:!0,get:function(){return i.Result}}),Object.defineProperty(t,"QueryMaterializer",{enumerable:!0,get:function(){return i.QueryMaterializer}}),Object.defineProperty(t,"CSVWriter",{enumerable:!0,get:function(){return i.CSVWriter}}),Object.defineProperty(t,"JSONWriter",{enumerable:!0,get:function(){return i.JSONWriter}}),Object.defineProperty(t,"Parse",{enumerable:!0,get:function(){return i.Parse}}),Object.defineProperty(t,"DataWriter",{enumerable:!0,get:function(){return i.DataWriter}}),Object.defineProperty(t,"Explore",{enumerable:!0,get:function(){return i.Explore}});var s=V5;Object.defineProperty(t,"toAsyncGenerator",{enumerable:!0,get:function(){return s.toAsyncGenerator}});var o=fo;Object.defineProperty(t,"Tag",{enumerable:!0,get:function(){return o.Tag}})}(fk);function WW(t){const e=t.parentExplore;return(e==null?void 0:e.allFields.findIndex(n=>n.name===t.name))??-1}function cm(t){return t.parentExplore?WW(t)===t.parentExplore.allFields.length-1:!0}function fm(t){return WW(t)===0}function VW(t,e){return t.isAtomicField()&&t.isNumber()&&e!==null}function tDe(t,e){return t.isAtomicField()&&t.isBoolean()&&e!==null}function YW(t,e){return t.isAtomicField()&&t.isString()&&e!==null}function nDe(t,e){return t.isAtomicField()&&(t.isDate()||t.isTimestamp())&&e!==null}function cw(t,e){const n=document.createElement("div");n.innerHTML=t;for(const[i,s]of Object.entries(e))n.style[i]=s;document.body.appendChild(n);const r=n.getBoundingClientRect();return document.body.removeChild(n),r.width}function Hs(t){return JSON.stringify(t.fieldPath)}function fw(t){return t[1]-t[0]+1}var Y5=(t=>(t.Dollars="usd",t.Euros="euro",t.Pounds="pound",t))(Y5||{}),Hn=(t=>(t.Nanoseconds="nanoseconds",t.Microseconds="microseconds",t.Milliseconds="milliseconds",t.Seconds="seconds",t.Minutes="minutes",t.Hours="hours",t.Days="days",t))(Hn||{});function rDe(t){return Object.values(Hn).includes(t)}var KW={exports:{}};(function(t){var e={},n=function(i){i.version="0.11.2";function s(w){for(var $="",M=w.length-1;M>=0;)$+=w.charAt(M--);return $}function o(w,$){for(var M="";M.length<$;)M+=w;return M}function u(w,$){var M=""+w;return M.length>=$?M:o("0",$-M.length)+M}function a(w,$){var M=""+w;return M.length>=$?M:o(" ",$-M.length)+M}function l(w,$){var M=""+w;return M.length>=$?M:M+o(" ",$-M.length)}function c(w,$){var M=""+Math.round(w);return M.length>=$?M:o("0",$-M.length)+M}function f(w,$){var M=""+w;return M.length>=$?M:o("0",$-M.length)+M}var x=Math.pow(2,32);function h(w,$){if(w>x||w<-x)return c(w,$);var M=Math.round(w);return f(M,$)}function p(w,$){return $=$||0,w.length>=7+$&&(w.charCodeAt($)|32)===103&&(w.charCodeAt($+1)|32)===101&&(w.charCodeAt($+2)|32)===110&&(w.charCodeAt($+3)|32)===101&&(w.charCodeAt($+4)|32)===114&&(w.charCodeAt($+5)|32)===97&&(w.charCodeAt($+6)|32)===108}var m=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],g=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];function y(w){w[0]="General",w[1]="0",w[2]="0.00",w[3]="#,##0",w[4]="#,##0.00",w[9]="0%",w[10]="0.00%",w[11]="0.00E+00",w[12]="# ?/?",w[13]="# ??/??",w[14]="m/d/yy",w[15]="d-mmm-yy",w[16]="d-mmm",w[17]="mmm-yy",w[18]="h:mm AM/PM",w[19]="h:mm:ss AM/PM",w[20]="h:mm",w[21]="h:mm:ss",w[22]="m/d/yy h:mm",w[37]="#,##0 ;(#,##0)",w[38]="#,##0 ;[Red](#,##0)",w[39]="#,##0.00;(#,##0.00)",w[40]="#,##0.00;[Red](#,##0.00)",w[45]="mm:ss",w[46]="[h]:mm:ss",w[47]="mmss.0",w[48]="##0.0E+0",w[49]="@",w[56]='"上午/下午 "hh"時"mm"分"ss"秒 "'}var E={};y(E);var A=[],v=0;for(v=5;v<=8;++v)A[v]=32+v;for(v=23;v<=26;++v)A[v]=0;for(v=27;v<=31;++v)A[v]=14;for(v=50;v<=58;++v)A[v]=14;for(v=59;v<=62;++v)A[v]=v-58;for(v=67;v<=68;++v)A[v]=v-58;for(v=72;v<=75;++v)A[v]=v-58;for(v=67;v<=68;++v)A[v]=v-57;for(v=76;v<=78;++v)A[v]=v-56;for(v=79;v<=81;++v)A[v]=v-34;var _=[];_[5]=_[63]='"$"#,##0_);\\("$"#,##0\\)',_[6]=_[64]='"$"#,##0_);[Red]\\("$"#,##0\\)',_[7]=_[65]='"$"#,##0.00_);\\("$"#,##0.00\\)',_[8]=_[66]='"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',_[41]='_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',_[42]='_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',_[43]='_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',_[44]='_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)';function S(w,$,M){for(var Q=w<0?-1:1,B=w*Q,z=0,j=1,J=0,xe=1,oe=0,Z=0,ce=Math.floor(B);oe<$&&(ce=Math.floor(B),J=ce*j+z,Z=ce*oe+xe,!(B-ce<5e-8));)B=1/(B-ce),z=j,j=J,xe=oe,oe=Z;if(Z>$&&(oe>$?(Z=xe,J=z):(Z=oe,J=j)),!M)return[0,Q*J,Z];var Re=Math.floor(Q*J/Z);return[Re,Q*J-Re*Z,Z]}function C(w,$,M){if(w>2958465||w<0)return null;var Q=w|0,B=Math.floor(86400*(w-Q)),z=0,j=[],J={D:Q,T:B,u:86400*(w-Q)-B,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(J.u)<1e-6&&(J.u=0),$&&$.date1904&&(Q+=1462),J.u>.9999&&(J.u=0,++B==86400&&(J.T=B=0,++Q,++J.D)),Q===60)j=M?[1317,10,29]:[1900,2,29],z=3;else if(Q===0)j=M?[1317,8,29]:[1900,1,0],z=6;else{Q>60&&--Q;var xe=new Date(1900,0,1);xe.setDate(xe.getDate()+Q-1),j=[xe.getFullYear(),xe.getMonth()+1,xe.getDate()],z=xe.getDay(),Q<60&&(z=(z+6)%7),M&&(z=G(xe,j))}return J.y=j[0],J.m=j[1],J.d=j[2],J.S=B%60,B=Math.floor(B/60),J.M=B%60,B=Math.floor(B/60),J.H=B,J.q=z,J}i.parse_date_code=C;var b=new Date(1899,11,31,0,0,0),N=b.getTime(),L=new Date(1900,2,1,0,0,0);function I(w,$){var M=w.getTime();return $?M-=1262304e5:w>=L&&(M+=864e5),(M-(N+(w.getTimezoneOffset()-b.getTimezoneOffset())*6e4))/864e5}function P(w){return w.toString(10)}i._general_int=P;var q=function(){var $=/(?:\.0*|(\.\d*[1-9])0+)$/;function M(oe){return oe.indexOf(".")==-1?oe:oe.replace($,"$1")}var Q=/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,B=/(E[+-])(\d)$/;function z(oe){return oe.indexOf("E")==-1?oe:oe.replace(Q,"$1E").replace(B,"$10$2")}function j(oe){var Z=oe<0?12:11,ce=M(oe.toFixed(12));return ce.length<=Z||(ce=oe.toPrecision(10),ce.length<=Z)?ce:oe.toExponential(5)}function J(oe){var Z=M(oe.toFixed(11));return Z.length>(oe<0?12:11)||Z==="0"||Z==="-0"?oe.toPrecision(6):Z}function xe(oe){var Z=Math.floor(Math.log(Math.abs(oe))*Math.LOG10E),ce;return Z>=-4&&Z<=-1?ce=oe.toPrecision(10+Z):Math.abs(Z)<=9?ce=j(oe):Z===10?ce=oe.toFixed(10).substr(0,12):ce=J(oe),M(z(ce.toUpperCase()))}return xe}();i._general_num=q;function X(w,$){switch(typeof w){case"string":return w;case"boolean":return w?"TRUE":"FALSE";case"number":return(w|0)===w?w.toString(10):q(w);case"undefined":return"";case"object":if(w==null)return"";if(w instanceof Date)return W(14,I(w,$&&$.date1904),$)}throw new Error("unsupported value in General format: "+w)}i._general=X;function G(w,$){$[0]-=581;var M=w.getDay();return w<60&&(M=(M+6)%7),M}function ue(w,$,M,Q){var B="",z=0,j=0,J=M.y,xe,oe=0;switch(w){case 98:J=M.y+543;case 121:switch($.length){case 1:case 2:xe=J%100,oe=2;break;default:xe=J%1e4,oe=4;break}break;case 109:switch($.length){case 1:case 2:xe=M.m,oe=$.length;break;case 3:return g[M.m-1][1];case 5:return g[M.m-1][0];default:return g[M.m-1][2]}break;case 100:switch($.length){case 1:case 2:xe=M.d,oe=$.length;break;case 3:return m[M.q][0];default:return m[M.q][1]}break;case 104:switch($.length){case 1:case 2:xe=1+(M.H+11)%12,oe=$.length;break;default:throw"bad hour format: "+$}break;case 72:switch($.length){case 1:case 2:xe=M.H,oe=$.length;break;default:throw"bad hour format: "+$}break;case 77:switch($.length){case 1:case 2:xe=M.M,oe=$.length;break;default:throw"bad minute format: "+$}break;case 115:if($!="s"&&$!="ss"&&$!=".0"&&$!=".00"&&$!=".000")throw"bad second format: "+$;return M.u===0&&($=="s"||$=="ss")?u(M.S,$.length):(Q>=2?j=Q===3?1e3:100:j=Q===1?10:1,z=Math.round(j*(M.S+M.u)),z>=60*j&&(z=0),$==="s"?z===0?"0":""+z/j:(B=u(z,2+Q),$==="ss"?B.substr(0,2):"."+B.substr(2,$.length-1)));case 90:switch($){case"[h]":case"[hh]":xe=M.D*24+M.H;break;case"[m]":case"[mm]":xe=(M.D*24+M.H)*60+M.M;break;case"[s]":case"[ss]":xe=((M.D*24+M.H)*60+M.M)*60+Math.round(M.S+M.u);break;default:throw"bad abstime format: "+$}oe=$.length===3?1:2;break;case 101:xe=J,oe=1;break}var Z=oe>0?u(xe,oe):"";return Z}function he(w){var $=3;if(w.length<=$)return w;for(var M=w.length%$,Q=w.substr(0,M);M!=w.length;M+=$)Q+=(Q.length>0?",":"")+w.substr(M,$);return Q}var pe=function(){var $=/%/g;function M(ne,V,se){var Te=V.replace($,""),K=V.length-Te.length;return pe(ne,Te,se*Math.pow(10,2*K))+o("%",K)}function Q(ne,V,se){for(var Te=V.length-1;V.charCodeAt(Te-1)===44;)--Te;return pe(ne,V.substr(0,Te),se/Math.pow(10,3*(V.length-Te)))}function B(ne,V){var se,Te=ne.indexOf("E")-ne.indexOf(".")-1;if(ne.match(/^#+0.0E\+0$/)){if(V==0)return"0.0E+0";if(V<0)return"-"+B(ne,-V);var K=ne.indexOf(".");K===-1&&(K=ne.indexOf("E"));var de=Math.floor(Math.log(V)*Math.LOG10E)%K;if(de<0&&(de+=K),se=(V/Math.pow(10,de)).toPrecision(Te+1+(K+de)%K),se.indexOf("e")===-1){var Le=Math.floor(Math.log(V)*Math.LOG10E);for(se.indexOf(".")===-1?se=se.charAt(0)+"."+se.substr(1)+"E+"+(Le-se.length+de):se+="E+"+(Le-de);se.substr(0,2)==="0.";)se=se.charAt(0)+se.substr(2,K)+"."+se.substr(2+K),se=se.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");se=se.replace(/\+-/,"-")}se=se.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(He,ot,_t,ut){return ot+_t+ut.substr(0,(K+de)%K)+"."+ut.substr(de)+"E"})}else se=V.toExponential(Te);return ne.match(/E\+00$/)&&se.match(/e[+-]\d$/)&&(se=se.substr(0,se.length-1)+"0"+se.charAt(se.length-1)),ne.match(/E\-/)&&se.match(/e\+/)&&(se=se.replace(/e\+/,"e")),se.replace("e","E")}var z=/# (\?+)( ?)\/( ?)(\d+)/;function j(ne,V,se){var Te=parseInt(ne[4],10),K=Math.round(V*Te),de=Math.floor(K/Te),Le=K-de*Te,He=Te;return se+(de===0?"":""+de)+" "+(Le===0?o(" ",ne[1].length+1+ne[4].length):a(Le,ne[1].length)+ne[2]+"/"+ne[3]+u(He,ne[4].length))}function J(ne,V,se){return se+(V===0?"":""+V)+o(" ",ne[1].length+2+ne[4].length)}var xe=/^#*0*\.([0#]+)/,oe=/\).*[0#]/,Z=/\(###\) ###\\?-####/;function ce(ne){for(var V="",se,Te=0;Te!=ne.length;++Te)switch(se=ne.charCodeAt(Te)){case 35:break;case 63:V+=" ";break;case 48:V+="0";break;default:V+=String.fromCharCode(se)}return V}function Re(ne,V){var se=Math.pow(10,V);return""+Math.round(ne*se)/se}function ke(ne,V){var se=ne-Math.floor(ne),Te=Math.pow(10,V);return V<(""+Math.round(se*Te)).length?0:Math.round(se*Te)}function Ve(ne,V){return V<(""+Math.round((ne-Math.floor(ne))*Math.pow(10,V))).length?1:0}function Y(ne){return ne<2147483647&&ne>-2147483648?""+(ne>=0?ne|0:ne-1|0):""+Math.floor(ne)}function ee(ne,V,se){if(ne.charCodeAt(0)===40&&!V.match(oe)){var Te=V.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return se>=0?ee("n",Te,se):"("+ee("n",Te,-se)+")"}if(V.charCodeAt(V.length-1)===44)return Q(ne,V,se);if(V.indexOf("%")!==-1)return M(ne,V,se);if(V.indexOf("E")!==-1)return B(V,se);if(V.charCodeAt(0)===36)return"$"+ee(ne,V.substr(V.charAt(1)==" "?2:1),se);var K,de,Le,He,ot=Math.abs(se),_t=se<0?"-":"";if(V.match(/^00+$/))return _t+h(ot,V.length);if(V.match(/^[#?]+$/))return K=h(se,0),K==="0"&&(K=""),K.length>V.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(z))return j(de,ot,_t);if(V.match(/^#+0+$/))return _t+h(ot,V.length-V.indexOf("0"));if(de=V.match(xe))return K=Re(se,de[1].length).replace(/^([^\.]+)$/,"$1."+ce(de[1])).replace(/\.$/,"."+ce(de[1])).replace(/\.(\d*)$/,function(Ds,qy){return"."+qy+o("0",ce(de[1]).length-qy.length)}),V.indexOf("0.")!==-1?K:K.replace(/^0\./,".");if(V=V.replace(/^#+([0.])/,"$1"),de=V.match(/^(0*)\.(#*)$/))return _t+Re(ot,de[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,de[1].length?"0.":".");if(de=V.match(/^#{1,3},##0(\.?)$/))return _t+he(h(ot,0));if(de=V.match(/^#,##0\.([#0]*0)$/))return se<0?"-"+ee(ne,V,-se):he(""+(Math.floor(se)+Ve(se,de[1].length)))+"."+u(ke(se,de[1].length),de[1].length);if(de=V.match(/^#,#*,#0/))return ee(ne,V.replace(/^#,#*,/,""),se);if(de=V.match(/^([0#]+)(\\?-([0#]+))+$/))return K=s(ee(ne,V.replace(/[\\-]/g,""),se)),Le=0,s(s(V.replace(/\\/g,"")).replace(/[0#]/g,function(Ds){return Le<K.length?K.charAt(Le++):Ds==="0"?"0":""}));if(V.match(Z))return K=ee(ne,"##########",se),"("+K.substr(0,3)+") "+K.substr(3,3)+"-"+K.substr(6);var ut="";if(de=V.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(de[4].length,7),He=S(ot,Math.pow(10,Le)-1,!1),K=""+_t,ut=pe("n",de[1],He[1]),ut.charAt(ut.length-1)==" "&&(ut=ut.substr(0,ut.length-1)+"0"),K+=ut+de[2]+"/"+de[3],ut=l(He[2],Le),ut.length<de[4].length&&(ut=ce(de[4].substr(de[4].length-ut.length))+ut),K+=ut,K;if(de=V.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(Math.max(de[1].length,de[4].length),7),He=S(ot,Math.pow(10,Le)-1,!0),_t+(He[0]||(He[1]?"":"0"))+" "+(He[1]?a(He[1],Le)+de[2]+"/"+de[3]+l(He[2],Le):o(" ",2*Le+1+de[2].length+de[3].length));if(de=V.match(/^[#0?]+$/))return K=h(se,0),V.length<=K.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(/^([#0?]+)\.([#0]+)$/)){K=""+se.toFixed(Math.min(de[2].length,10)).replace(/([^0])0+$/,"$1"),Le=K.indexOf(".");var pr=V.indexOf(".")-Le,wc=V.length-K.length-pr;return ce(V.substr(0,pr)+K+V.substr(V.length-wc))}if(de=V.match(/^00,000\.([#0]*0)$/))return Le=ke(se,de[1].length),se<0?"-"+ee(ne,V,-se):he(Y(se)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(Ds){return"00,"+(Ds.length<3?u(0,3-Ds.length):"")+Ds})+"."+u(Le,de[1].length);switch(V){case"###,##0.00":return ee(ne,"#,##0.00",se);case"###,###":case"##,###":case"#,###":var Uy=he(h(ot,0));return Uy!=="0"?_t+Uy:"";case"###,###.00":return ee(ne,"###,##0.00",se).replace(/^0\./,".");case"#,###.00":return ee(ne,"#,##0.00",se).replace(/^0\./,".")}throw new Error("unsupported format |"+V+"|")}function Ce(ne,V,se){for(var Te=V.length-1;V.charCodeAt(Te-1)===44;)--Te;return pe(ne,V.substr(0,Te),se/Math.pow(10,3*(V.length-Te)))}function Me(ne,V,se){var Te=V.replace($,""),K=V.length-Te.length;return pe(ne,Te,se*Math.pow(10,2*K))+o("%",K)}function Pe(ne,V){var se,Te=ne.indexOf("E")-ne.indexOf(".")-1;if(ne.match(/^#+0.0E\+0$/)){if(V==0)return"0.0E+0";if(V<0)return"-"+Pe(ne,-V);var K=ne.indexOf(".");K===-1&&(K=ne.indexOf("E"));var de=Math.floor(Math.log(V)*Math.LOG10E)%K;if(de<0&&(de+=K),se=(V/Math.pow(10,de)).toPrecision(Te+1+(K+de)%K),!se.match(/[Ee]/)){var Le=Math.floor(Math.log(V)*Math.LOG10E);se.indexOf(".")===-1?se=se.charAt(0)+"."+se.substr(1)+"E+"+(Le-se.length+de):se+="E+"+(Le-de),se=se.replace(/\+-/,"-")}se=se.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(He,ot,_t,ut){return ot+_t+ut.substr(0,(K+de)%K)+"."+ut.substr(de)+"E"})}else se=V.toExponential(Te);return ne.match(/E\+00$/)&&se.match(/e[+-]\d$/)&&(se=se.substr(0,se.length-1)+"0"+se.charAt(se.length-1)),ne.match(/E\-/)&&se.match(/e\+/)&&(se=se.replace(/e\+/,"e")),se.replace("e","E")}function U(ne,V,se){if(ne.charCodeAt(0)===40&&!V.match(oe)){var Te=V.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return se>=0?U("n",Te,se):"("+U("n",Te,-se)+")"}if(V.charCodeAt(V.length-1)===44)return Ce(ne,V,se);if(V.indexOf("%")!==-1)return Me(ne,V,se);if(V.indexOf("E")!==-1)return Pe(V,se);if(V.charCodeAt(0)===36)return"$"+U(ne,V.substr(V.charAt(1)==" "?2:1),se);var K,de,Le,He,ot=Math.abs(se),_t=se<0?"-":"";if(V.match(/^00+$/))return _t+u(ot,V.length);if(V.match(/^[#?]+$/))return K=""+se,se===0&&(K=""),K.length>V.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(z))return J(de,ot,_t);if(V.match(/^#+0+$/))return _t+u(ot,V.length-V.indexOf("0"));if(de=V.match(xe))return K=(""+se).replace(/^([^\.]+)$/,"$1."+ce(de[1])).replace(/\.$/,"."+ce(de[1])),K=K.replace(/\.(\d*)$/,function(Ds,qy){return"."+qy+o("0",ce(de[1]).length-qy.length)}),V.indexOf("0.")!==-1?K:K.replace(/^0\./,".");if(V=V.replace(/^#+([0.])/,"$1"),de=V.match(/^(0*)\.(#*)$/))return _t+(""+ot).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,de[1].length?"0.":".");if(de=V.match(/^#{1,3},##0(\.?)$/))return _t+he(""+ot);if(de=V.match(/^#,##0\.([#0]*0)$/))return se<0?"-"+U(ne,V,-se):he(""+se)+"."+o("0",de[1].length);if(de=V.match(/^#,#*,#0/))return U(ne,V.replace(/^#,#*,/,""),se);if(de=V.match(/^([0#]+)(\\?-([0#]+))+$/))return K=s(U(ne,V.replace(/[\\-]/g,""),se)),Le=0,s(s(V.replace(/\\/g,"")).replace(/[0#]/g,function(Ds){return Le<K.length?K.charAt(Le++):Ds==="0"?"0":""}));if(V.match(Z))return K=U(ne,"##########",se),"("+K.substr(0,3)+") "+K.substr(3,3)+"-"+K.substr(6);var ut="";if(de=V.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(de[4].length,7),He=S(ot,Math.pow(10,Le)-1,!1),K=""+_t,ut=pe("n",de[1],He[1]),ut.charAt(ut.length-1)==" "&&(ut=ut.substr(0,ut.length-1)+"0"),K+=ut+de[2]+"/"+de[3],ut=l(He[2],Le),ut.length<de[4].length&&(ut=ce(de[4].substr(de[4].length-ut.length))+ut),K+=ut,K;if(de=V.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(Math.max(de[1].length,de[4].length),7),He=S(ot,Math.pow(10,Le)-1,!0),_t+(He[0]||(He[1]?"":"0"))+" "+(He[1]?a(He[1],Le)+de[2]+"/"+de[3]+l(He[2],Le):o(" ",2*Le+1+de[2].length+de[3].length));if(de=V.match(/^[#0?]+$/))return K=""+se,V.length<=K.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(/^([#0]+)\.([#0]+)$/)){K=""+se.toFixed(Math.min(de[2].length,10)).replace(/([^0])0+$/,"$1"),Le=K.indexOf(".");var pr=V.indexOf(".")-Le,wc=V.length-K.length-pr;return ce(V.substr(0,pr)+K+V.substr(V.length-wc))}if(de=V.match(/^00,000\.([#0]*0)$/))return se<0?"-"+U(ne,V,-se):he(""+se).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(Ds){return"00,"+(Ds.length<3?u(0,3-Ds.length):"")+Ds})+"."+u(0,de[1].length);switch(V){case"###,###":case"##,###":case"#,###":var Uy=he(""+ot);return Uy!=="0"?_t+Uy:"";default:if(V.match(/\.[0#?]*$/))return U(ne,V.slice(0,V.lastIndexOf(".")),se)+ce(V.slice(V.lastIndexOf(".")))}throw new Error("unsupported format |"+V+"|")}return function(V,se,Te){return(Te|0)===Te?U(V,se,Te):ee(V,se,Te)}}();function ae(w){for(var $=[],M=!1,Q=0,B=0;Q<w.length;++Q)switch(w.charCodeAt(Q)){case 34:M=!M;break;case 95:case 42:case 92:++Q;break;case 59:$[$.length]=w.substr(B,Q-B),B=Q+1}if($[$.length]=w.substr(B),M===!0)throw new Error("Format |"+w+"| unterminated string ");return $}i._split=ae;var fe=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function re(w){for(var $=0,M="",Q="";$<w.length;)switch(M=w.charAt($)){case"G":p(w,$)&&($+=6),$++;break;case'"':for(;w.charCodeAt(++$)!==34&&$<w.length;);++$;break;case"\\":$+=2;break;case"_":$+=2;break;case"@":++$;break;case"B":case"b":if(w.charAt($+1)==="1"||w.charAt($+1)==="2")return!0;case"M":case"D":case"Y":case"H":case"S":case"E":case"m":case"d":case"y":case"h":case"s":case"e":case"g":return!0;case"A":case"a":case"上":if(w.substr($,3).toUpperCase()==="A/P"||w.substr($,5).toUpperCase()==="AM/PM"||w.substr($,5).toUpperCase()==="上午/下午")return!0;++$;break;case"[":for(Q=M;w.charAt($++)!=="]"&&$<w.length;)Q+=w.charAt($);if(Q.match(fe))return!0;break;case".":case"0":case"#":for(;$<w.length&&("0#?.,E+-%".indexOf(M=w.charAt(++$))>-1||M=="\\"&&w.charAt($+1)=="-"&&"0#".indexOf(w.charAt($+2))>-1););break;case"?":for(;w.charAt(++$)===M;);break;case"*":++$,(w.charAt($)==" "||w.charAt($)=="*")&&++$;break;case"(":case")":++$;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;$<w.length&&"0123456789".indexOf(w.charAt(++$))>-1;);break;case" ":++$;break;default:++$;break}return!1}i.is_date=re;function ie(w,$,M,Q){for(var B=[],z="",j=0,J="",xe="t",oe,Z,ce,Re="H";j<w.length;)switch(J=w.charAt(j)){case"G":if(!p(w,j))throw new Error("unrecognized character "+J+" in "+w);B[B.length]={t:"G",v:"General"},j+=7;break;case'"':for(z="";(ce=w.charCodeAt(++j))!==34&&j<w.length;)z+=String.fromCharCode(ce);B[B.length]={t:"t",v:z},++j;break;case"\\":var ke=w.charAt(++j),Ve=ke==="("||ke===")"?ke:"t";B[B.length]={t:Ve,v:ke},++j;break;case"_":B[B.length]={t:"t",v:" "},j+=2;break;case"@":B[B.length]={t:"T",v:$},++j;break;case"B":case"b":if(w.charAt(j+1)==="1"||w.charAt(j+1)==="2"){if(oe==null&&(oe=C($,M,w.charAt(j+1)==="2"),oe==null))return"";B[B.length]={t:"X",v:w.substr(j,2)},xe=J,j+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":J=J.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if($<0||oe==null&&(oe=C($,M),oe==null))return"";for(z=J;++j<w.length&&w.charAt(j).toLowerCase()===J;)z+=J;J==="m"&&xe.toLowerCase()==="h"&&(J="M"),J==="h"&&(J=Re),B[B.length]={t:J,v:z},xe=J;break;case"A":case"a":case"上":var Y={t:J,v:J};if(oe==null&&(oe=C($,M)),w.substr(j,3).toUpperCase()==="A/P"?(oe!=null&&(Y.v=oe.H>=12?"P":"A"),Y.t="T",Re="h",j+=3):w.substr(j,5).toUpperCase()==="AM/PM"?(oe!=null&&(Y.v=oe.H>=12?"PM":"AM"),Y.t="T",j+=5,Re="h"):w.substr(j,5).toUpperCase()==="上午/下午"?(oe!=null&&(Y.v=oe.H>=12?"下午":"上午"),Y.t="T",j+=5,Re="h"):(Y.t="t",++j),oe==null&&Y.t==="T")return"";B[B.length]=Y,xe=J;break;case"[":for(z=J;w.charAt(j++)!=="]"&&j<w.length;)z+=w.charAt(j);if(z.slice(-1)!=="]")throw'unterminated "[" block: |'+z+"|";if(z.match(fe)){if(oe==null&&(oe=C($,M),oe==null))return"";B[B.length]={t:"Z",v:z.toLowerCase()},xe=z.charAt(1)}else z.indexOf("$")>-1&&(z=(z.match(/\$([^-\[\]]*)/)||[])[1]||"$",re(w)||(B[B.length]={t:"t",v:z}));break;case".":if(oe!=null){for(z=J;++j<w.length&&(J=w.charAt(j))==="0";)z+=J;B[B.length]={t:"s",v:z};break}case"0":case"#":for(z=J;++j<w.length&&"0#?.,E+-%".indexOf(J=w.charAt(j))>-1;)z+=J;B[B.length]={t:"n",v:z};break;case"?":for(z=J;w.charAt(++j)===J;)z+=J;B[B.length]={t:J,v:z},xe=J;break;case"*":++j,(w.charAt(j)==" "||w.charAt(j)=="*")&&++j;break;case"(":case")":B[B.length]={t:Q===1?"t":J,v:J},++j;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(z=J;j<w.length&&"0123456789".indexOf(w.charAt(++j))>-1;)z+=w.charAt(j);B[B.length]={t:"D",v:z};break;case" ":B[B.length]={t:J,v:J},++j;break;case"$":B[B.length]={t:"t",v:"$"},++j;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(J)===-1)throw new Error("unrecognized character "+J+" in "+w);B[B.length]={t:"t",v:J},++j;break}var ee=0,Ce=0,Me;for(j=B.length-1,xe="t";j>=0;--j)switch(B[j].t){case"h":case"H":B[j].t=Re,xe="h",ee<1&&(ee=1);break;case"s":(Me=B[j].v.match(/\.0+$/))&&(Ce=Math.max(Ce,Me[0].length-1)),ee<3&&(ee=3);case"d":case"y":case"M":case"e":xe=B[j].t;break;case"m":xe==="s"&&(B[j].t="M",ee<2&&(ee=2));break;case"X":break;case"Z":ee<1&&B[j].v.match(/[Hh]/)&&(ee=1),ee<2&&B[j].v.match(/[Mm]/)&&(ee=2),ee<3&&B[j].v.match(/[Ss]/)&&(ee=3)}switch(ee){case 0:break;case 1:oe.u>=.5&&(oe.u=0,++oe.S),oe.S>=60&&(oe.S=0,++oe.M),oe.M>=60&&(oe.M=0,++oe.H);break;case 2:oe.u>=.5&&(oe.u=0,++oe.S),oe.S>=60&&(oe.S=0,++oe.M);break}var Pe="",U;for(j=0;j<B.length;++j)switch(B[j].t){case"t":case"T":case" ":case"D":break;case"X":B[j].v="",B[j].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":B[j].v=ue(B[j].t.charCodeAt(0),B[j].v,oe,Ce),B[j].t="t";break;case"n":case"?":for(U=j+1;B[U]!=null&&((J=B[U].t)==="?"||J==="D"||(J===" "||J==="t")&&B[U+1]!=null&&(B[U+1].t==="?"||B[U+1].t==="t"&&B[U+1].v==="/")||B[j].t==="("&&(J===" "||J==="n"||J===")")||J==="t"&&(B[U].v==="/"||B[U].v===" "&&B[U+1]!=null&&B[U+1].t=="?"));)B[j].v+=B[U].v,B[U]={v:"",t:";"},++U;Pe+=B[j].v,j=U-1;break;case"G":B[j].t="t",B[j].v=X($,M);break}var ne="",V,se;if(Pe.length>0){Pe.charCodeAt(0)==40?(V=$<0&&Pe.charCodeAt(0)===45?-$:$,se=pe("n",Pe,V)):(V=$<0&&Q>1?-$:$,se=pe("n",Pe,V),V<0&&B[0]&&B[0].t=="t"&&(se=se.substr(1),B[0].v="-"+B[0].v)),U=se.length-1;var Te=B.length;for(j=0;j<B.length;++j)if(B[j]!=null&&B[j].t!="t"&&B[j].v.indexOf(".")>-1){Te=j;break}var K=B.length;if(Te===B.length&&se.indexOf("E")===-1){for(j=B.length-1;j>=0;--j)B[j]==null||"n?".indexOf(B[j].t)===-1||(U>=B[j].v.length-1?(U-=B[j].v.length,B[j].v=se.substr(U+1,B[j].v.length)):U<0?B[j].v="":(B[j].v=se.substr(0,U+1),U=-1),B[j].t="t",K=j);U>=0&&K<B.length&&(B[K].v=se.substr(0,U+1)+B[K].v)}else if(Te!==B.length&&se.indexOf("E")===-1){for(U=se.indexOf(".")-1,j=Te;j>=0;--j)if(!(B[j]==null||"n?".indexOf(B[j].t)===-1)){for(Z=B[j].v.indexOf(".")>-1&&j===Te?B[j].v.indexOf(".")-1:B[j].v.length-1,ne=B[j].v.substr(Z+1);Z>=0;--Z)U>=0&&(B[j].v.charAt(Z)==="0"||B[j].v.charAt(Z)==="#")&&(ne=se.charAt(U--)+ne);B[j].v=ne,B[j].t="t",K=j}for(U>=0&&K<B.length&&(B[K].v=se.substr(0,U+1)+B[K].v),U=se.indexOf(".")+1,j=Te;j<B.length;++j)if(!(B[j]==null||"n?(".indexOf(B[j].t)===-1&&j!==Te)){for(Z=B[j].v.indexOf(".")>-1&&j===Te?B[j].v.indexOf(".")+1:0,ne=B[j].v.substr(0,Z);Z<B[j].v.length;++Z)U<se.length&&(ne+=se.charAt(U++));B[j].v=ne,B[j].t="t",K=j}}}for(j=0;j<B.length;++j)B[j]!=null&&"n?".indexOf(B[j].t)>-1&&(V=Q>1&&$<0&&j>0&&B[j-1].v==="-"?-$:$,B[j].v=pe(B[j].t,B[j].v,V),B[j].t="t");var de="";for(j=0;j!==B.length;++j)B[j]!=null&&(de+=B[j].v);return de}i._eval=ie;var D=/\[[=<>]/,R=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function O(w,$){if($==null)return!1;var M=parseFloat($[2]);switch($[1]){case"=":if(w==M)return!0;break;case">":if(w>M)return!0;break;case"<":if(w<M)return!0;break;case"<>":if(w!=M)return!0;break;case">=":if(w>=M)return!0;break;case"<=":if(w<=M)return!0;break}return!1}function k(w,$){var M=ae(w),Q=M.length,B=M[Q-1].indexOf("@");if(Q<4&&B>-1&&--Q,M.length>4)throw new Error("cannot find right format for |"+M.join("|")+"|");if(typeof $!="number")return[4,M.length===4||B>-1?M[M.length-1]:"@"];switch(M.length){case 1:M=B>-1?["General","General","General",M[0]]:[M[0],M[0],M[0],"@"];break;case 2:M=B>-1?[M[0],M[0],M[0],M[1]]:[M[0],M[1],M[0],"@"];break;case 3:M=B>-1?[M[0],M[1],M[0],M[2]]:[M[0],M[1],M[2],"@"];break}var z=$>0?M[0]:$<0?M[1]:M[2];if(M[0].indexOf("[")===-1&&M[1].indexOf("[")===-1)return[Q,z];if(M[0].match(D)!=null||M[1].match(D)!=null){var j=M[0].match(R),J=M[1].match(R);return O($,j)?[Q,M[0]]:O($,J)?[Q,M[1]]:[Q,M[j!=null&&J!=null?2:1]]}return[Q,z]}function W(w,$,M){M==null&&(M={});var Q="";switch(typeof w){case"string":w=="m/d/yy"&&M.dateNF?Q=M.dateNF:Q=w;break;case"number":w==14&&M.dateNF?Q=M.dateNF:Q=(M.table!=null?M.table:E)[w],Q==null&&(Q=M.table&&M.table[A[w]]||E[A[w]]),Q==null&&(Q=_[w]||"General");break}if(p(Q,0))return X($,M);$ instanceof Date&&($=I($,M.date1904));var B=k(Q,$);if(p(B[1]))return X($,M);if($===!0)$="TRUE";else if($===!1)$="FALSE";else if($===""||$==null)return"";return ie(B[1],$,M,B[0])}function H(w,$){if(typeof $!="number"){$=+$||-1;for(var M=0;M<392;++M){if(E[M]==null){$<0&&($=M);continue}if(E[M]==w){$=M;break}}$<0&&($=391)}return E[$]=w,$}i.load=H,i._table=E,i.get_table=function(){return E},i.load_table=function($){for(var M=0;M!=392;++M)$[M]!==void 0&&H($[M],M)},i.init_table=y,i.format=W};n(e),typeof DO_NOT_EXPORT_SSF>"u"&&(t.exports=e)})(KW);var K5=KW.exports;function iDe(t,e,n,r){var i=-1,s=t==null?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}var sDe=iDe;function oDe(t){return function(e){return t==null?void 0:t[e]}}var uDe=oDe,aDe=uDe,lDe={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},cDe=aDe(lDe),fDe=cDe,xDe=typeof T=="object"&&T&&T.Object===Object&&T,dDe=xDe,hDe=dDe,pDe=typeof self=="object"&&self&&self.Object===Object&&self,gDe=hDe||pDe||Function("return this")(),mDe=gDe,yDe=mDe,EDe=yDe.Symbol,xw=EDe;function ADe(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var vDe=ADe,_De=Array.isArray,SDe=_De,JW=xw,XW=Object.prototype,CDe=XW.hasOwnProperty,bDe=XW.toString,xm=JW?JW.toStringTag:void 0;function TDe(t){var e=CDe.call(t,xm),n=t[xm];try{t[xm]=void 0;var r=!0}catch{}var i=bDe.call(t);return r&&(e?t[xm]=n:delete t[xm]),i}var RDe=TDe,ODe=Object.prototype,DDe=ODe.toString;function wDe(t){return DDe.call(t)}var NDe=wDe,ZW=xw,FDe=RDe,LDe=NDe,IDe="[object Null]",BDe="[object Undefined]",eV=ZW?ZW.toStringTag:void 0;function $De(t){return t==null?t===void 0?BDe:IDe:eV&&eV in Object(t)?FDe(t):LDe(t)}var kDe=$De;function PDe(t){return t!=null&&typeof t=="object"}var MDe=PDe,jDe=kDe,UDe=MDe,qDe="[object Symbol]";function HDe(t){return typeof t=="symbol"||UDe(t)&&jDe(t)==qDe}var zDe=HDe,tV=xw,QDe=vDe,GDe=SDe,WDe=zDe,VDe=1/0,nV=tV?tV.prototype:void 0,rV=nV?nV.toString:void 0;function iV(t){if(typeof t=="string")return t;if(GDe(t))return QDe(t,iV)+"";if(WDe(t))return rV?rV.call(t):"";var e=t+"";return e=="0"&&1/t==-VDe?"-0":e}var YDe=iV,KDe=YDe;function JDe(t){return t==null?"":KDe(t)}var dw=JDe,XDe=fDe,ZDe=dw,e7e=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,t7e="\\u0300-\\u036f",n7e="\\ufe20-\\ufe2f",r7e="\\u20d0-\\u20ff",i7e=t7e+n7e+r7e,s7e="["+i7e+"]",o7e=RegExp(s7e,"g");function u7e(t){return t=ZDe(t),t&&t.replace(e7e,XDe).replace(o7e,"")}var a7e=u7e,l7e=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function c7e(t){return t.match(l7e)||[]}var f7e=c7e,x7e=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function d7e(t){return x7e.test(t)}var h7e=d7e,sV="\\ud800-\\udfff",p7e="\\u0300-\\u036f",g7e="\\ufe20-\\ufe2f",m7e="\\u20d0-\\u20ff",y7e=p7e+g7e+m7e,oV="\\u2700-\\u27bf",uV="a-z\\xdf-\\xf6\\xf8-\\xff",E7e="\\xac\\xb1\\xd7\\xf7",A7e="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",v7e="\\u2000-\\u206f",_7e=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",aV="A-Z\\xc0-\\xd6\\xd8-\\xde",S7e="\\ufe0e\\ufe0f",lV=E7e+A7e+v7e+_7e,cV="['’]",fV="["+lV+"]",C7e="["+y7e+"]",xV="\\d+",b7e="["+oV+"]",dV="["+uV+"]",hV="[^"+sV+lV+xV+oV+uV+aV+"]",T7e="\\ud83c[\\udffb-\\udfff]",R7e="(?:"+C7e+"|"+T7e+")",O7e="[^"+sV+"]",pV="(?:\\ud83c[\\udde6-\\uddff]){2}",gV="[\\ud800-\\udbff][\\udc00-\\udfff]",Nh="["+aV+"]",D7e="\\u200d",mV="(?:"+dV+"|"+hV+")",w7e="(?:"+Nh+"|"+hV+")",yV="(?:"+cV+"(?:d|ll|m|re|s|t|ve))?",EV="(?:"+cV+"(?:D|LL|M|RE|S|T|VE))?",AV=R7e+"?",vV="["+S7e+"]?",N7e="(?:"+D7e+"(?:"+[O7e,pV,gV].join("|")+")"+vV+AV+")*",F7e="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",L7e="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",I7e=vV+AV+N7e,B7e="(?:"+[b7e,pV,gV].join("|")+")"+I7e,$7e=RegExp([Nh+"?"+dV+"+"+yV+"(?="+[fV,Nh,"$"].join("|")+")",w7e+"+"+EV+"(?="+[fV,Nh+mV,"$"].join("|")+")",Nh+"?"+mV+"+"+yV,Nh+"+"+EV,L7e,F7e,xV,B7e].join("|"),"g");function k7e(t){return t.match($7e)||[]}var P7e=k7e,M7e=f7e,j7e=h7e,U7e=dw,q7e=P7e;function H7e(t,e,n){return t=U7e(t),e=n?void 0:e,e===void 0?j7e(t)?q7e(t):M7e(t):t.match(e)||[]}var z7e=H7e,Q7e=sDe,G7e=a7e,W7e=z7e,V7e="['’]",Y7e=RegExp(V7e,"g");function K7e(t){return function(e){return Q7e(W7e(G7e(e).replace(Y7e,"")),t,"")}}var J7e=K7e;function X7e(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}var Z7e=X7e,ewe=Z7e;function twe(t,e,n){var r=t.length;return n=n===void 0?r:n,!e&&n>=r?t:ewe(t,e,n)}var nwe=twe,rwe="\\ud800-\\udfff",iwe="\\u0300-\\u036f",swe="\\ufe20-\\ufe2f",owe="\\u20d0-\\u20ff",uwe=iwe+swe+owe,awe="\\ufe0e\\ufe0f",lwe="\\u200d",cwe=RegExp("["+lwe+rwe+uwe+awe+"]");function fwe(t){return cwe.test(t)}var _V=fwe;function xwe(t){return t.split("")}var dwe=xwe,SV="\\ud800-\\udfff",hwe="\\u0300-\\u036f",pwe="\\ufe20-\\ufe2f",gwe="\\u20d0-\\u20ff",mwe=hwe+pwe+gwe,ywe="\\ufe0e\\ufe0f",Ewe="["+SV+"]",hw="["+mwe+"]",pw="\\ud83c[\\udffb-\\udfff]",Awe="(?:"+hw+"|"+pw+")",CV="[^"+SV+"]",bV="(?:\\ud83c[\\udde6-\\uddff]){2}",TV="[\\ud800-\\udbff][\\udc00-\\udfff]",vwe="\\u200d",RV=Awe+"?",OV="["+ywe+"]?",_we="(?:"+vwe+"(?:"+[CV,bV,TV].join("|")+")"+OV+RV+")*",Swe=OV+RV+_we,Cwe="(?:"+[CV+hw+"?",hw,bV,TV,Ewe].join("|")+")",bwe=RegExp(pw+"(?="+pw+")|"+Cwe+Swe,"g");function Twe(t){return t.match(bwe)||[]}var Rwe=Twe,Owe=dwe,Dwe=_V,wwe=Rwe;function Nwe(t){return Dwe(t)?wwe(t):Owe(t)}var Fwe=Nwe,Lwe=nwe,Iwe=_V,Bwe=Fwe,$we=dw;function kwe(t){return function(e){e=$we(e);var n=Iwe(e)?Bwe(e):void 0,r=n?n[0]:e.charAt(0),i=n?Lwe(n,1).join(""):e.slice(1);return r[t]()+i}}var Pwe=kwe,Mwe=Pwe,jwe=Mwe("toUpperCase"),Uwe=jwe,qwe=J7e,Hwe=Uwe,zwe=qwe(function(t,e,n){return t+(n?" ":"")+Hwe(e)}),Qwe=zwe;const Gwe=rE(Qwe);function Wa(t,e,n=!1){if(t!==void 0)switch(t){case"ordinal":return{range:["#C2D5EE","#1A73E8"]};case"temporal":case"quantitative":return e?n?{range:["#6BA4EE","#EEA361"]}:{range:["#1A73E8","#E8710A"]}:{range:["#C2D5EE","#1A73E8"]};case"nominal":return n?{range:["#6BA4EE","#66CEDC","#EC72B8","#EEA361","#F9C85B","#AACD85","#B87CED","#ACB0B3"]}:{range:["#1A73E8","#12B5CB","#E52592","#E8710A","#F9AB00","#7CB342","#9334E6","#80868B"]}}}function Wwe(t,e){const n=wAe.fromJSDate(t,{zone:e??"UTC"});return new Date(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond)}function Vwe(t,e){const n=t.createElement("span");return n.classList.add("error"),n.appendChild(t.createTextNode(typeof e=="string"?e:e.message)),n}function Ywe(t){const e=t.createElement("span");return e.appendChild(t.createTextNode("∅")),e.classList.add("value-null"),e}function $f(t,e,n,r){var o;const i=((o=n==null?void 0:n.data)==null?void 0:o.label)||e.name;let s=t.titleCase?Gwe(i):i;return e.isAtomicField()&&(e.isDate()||e.isTimestamp())&&r&&(s=`${s} (${r})`),s}function Kwe(t,e=0){let n=t;for(;e>0&&n.parentRecord;)e-=1,n=n.parentRecord;return n}function Jwe(t){const e=t.split("/"),n=e.filter(i=>i==="..").length+1,r=e.filter(i=>i!==".."&&i!=="");return{levelsUp:n,pathSegments:r}}function DV({tag:t,data:e}){var n;try{const r=((n=t.tag("field"))==null?void 0:n.text())??"",{levelsUp:i,pathSegments:s}=Jwe(r);let o=Kwe(e,i);for(;s.length>0&&"cell"in o;){const u=s.shift();o=o.cell(u)}return o==null?void 0:o.value}catch{return}}class kf{constructor(){this.tagOptionExtractors={}}addExtractor(e,...n){for(const r in n)this.tagOptionExtractors[n[r]]=e}activates(e){return!1}isValidMatch(e){return!0}matches(e){return e.renderer===this.rendererName}parseTagParameters(e){const n={};for(const r in this.tagOptionExtractors){const i=e.tag(r);i&&this.tagOptionExtractors[r](n,i)}return n}}class wV{constructor(e){this.document=e}getText(e){return e.value===null?null:`${e.value}`}async render(e){let n=null;try{n=this.getText(e)}catch(i){return Vwe(this.document,i)}if(n===null)return Ywe(this.document);const r=this.document.createElement("span");return r.appendChild(this.document.createTextNode(n)),r}}const BT=class BT extends kf{activates(e){return e.hasParentExplore()&&!e.isExploreField()}create(e,n,r,i,s){return new wV(e)}get rendererName(){}};BT.instance=new BT;let NV=BT;function FV(t,e,n={}){let r=e.toString();return n.terse?r=Xwe.get(e)??r:t===1&&(r=r.substring(0,r.length-1)),`${n.numFormat?K5.format(n.numFormat,t):t.toLocaleString()}${n.terse?"":" "}${r}`}const Xwe=new Map([[Hn.Nanoseconds,"ns"],[Hn.Microseconds,"µs"],[Hn.Milliseconds,"ms"],[Hn.Seconds,"s"],[Hn.Minutes,"m"],[Hn.Hours,"h"],[Hn.Days,"d"]]),Zwe=new Map([[Hn.Nanoseconds,1e3],[Hn.Microseconds,1e3],[Hn.Milliseconds,1e3],[Hn.Seconds,60],[Hn.Minutes,60],[Hn.Hours,24],[Hn.Days,Number.MAX_VALUE]]);function LV(t,e,n){const r=n.durationUnit&&rDe(n.durationUnit)?n.durationUnit:Hn.Seconds,i=t.tagParse().tag,s=i.text("number"),o=i.has("duration","terse");let u=e,a=0,l=[],c=!1;for(const[f,x]of Zwe)if(f===r&&(c=!0),!!c&&(a=u%x,u=Math.floor(u/=x),a>0&&(l=[FV(a,f,{numFormat:s,terse:o}),...l]),u===0))break;return l.length>0?l.slice(0,2).join(" "):FV(0,r,{numFormat:s,terse:o})}class eNe extends wV{constructor(e,n){super(e),this.options=n}getText(e){if(e.isNull())return null;if(!e.isNumber())throw new Error(`Cannot format field ${e.field.name} as a duration unit since its not a number`);return LV(e.field,e.number.value,{durationUnit:this.options.duration_unit})}}const $T=class $T extends kf{constructor(){super(),this.addExtractor((e,n)=>{e.duration_unit=(n==null?void 0:n.text())??Hn.Seconds},this.rendererName)}create(e,n,r,i,s){return new eNe(e,s)}get rendererName(){return"duration"}};$T.instance=new $T;let IV=$T;function Fh(t,e){let n=e;const{tag:r}=t.tagParse();if(r.has("currency")){let i="$";switch(r.text("currency")){case Y5.Euros:i="€";break;case Y5.Pounds:i="£";break;case Y5.Dollars:break}n=K5.format(`${i}#,##0.00`,e)}else if(r.has("percent"))n=K5.format("#,##0.00%",e);else if(r.has("duration")){const s=r.text("duration")??Hn.Seconds;return LV(t,e,{durationUnit:s})??e.toLocaleString()}else r.has("number")?n=K5.format(r.text("number"),e):n=e.toLocaleString();return n}var tNe=yt("<a target=_blank>");function nNe(t,e){const{tag:n}=t.tagParse();if(e.isNull())return"∅";const r=String(e.value),i=n.tag("link");if(!i)throw new Error("Missing tag for Link renderer");const s=DV({tag:i,data:e})??r,o=i.text("url_template");let u=s;o&&(o.indexOf("$$")>-1?u=o.replace("$$",s):u=o+s);const a=r.replace(/\//g,"/‌");return(()=>{var l=tNe();return Zi(l,"href",u),Je(l,a),l})()}function gs(t,e,n){return t.fields=e||[],t.fname=n,t}function wn(t){return t==null?null:t.fname}function oi(t){return t==null?null:t.fields}function BV(t){return t.length===1?rNe(t[0]):iNe(t)}const rNe=t=>function(e){return e[t]},iNe=t=>{const e=t.length;return function(n){for(let r=0;r<e;++r)n=n[t[r]];return n}};function _e(t){throw Error(t)}function Va(t){const e=[],n=t.length;let r=null,i=0,s="",o,u,a;t=t+"";function l(){e.push(s+t.substring(o,u)),s="",o=u+1}for(o=u=0;u<n;++u)if(a=t[u],a==="\\")s+=t.substring(o,u),s+=t.substring(++u,++u),o=u;else if(a===r)l(),r=null,i=-1;else{if(r)continue;o===i&&a==='"'||o===i&&a==="'"?(o=u+1,r=a):a==="."&&!i?u>o?l():o=u+1:a==="["?(u>o&&l(),i=o=u+1):a==="]"&&(i||_e("Access path missing open bracket: "+t),i>0&&l(),i=0,o=u+1)}return i&&_e("Access path missing closing bracket: "+t),r&&_e("Access path missing closing quote: "+t),u>o&&(u++,l()),e}function ms(t,e,n){const r=Va(t);return t=r.length===1?r[0]:t,gs((n&&n.get||BV)(r),[t],e||t)}const J5=ms("id"),ui=gs(t=>t,[],"identity"),Pf=gs(()=>0,[],"zero"),dm=gs(()=>1,[],"one"),Fo=gs(()=>!0,[],"true"),Mf=gs(()=>!1,[],"false");function sNe(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}const oNe=0,$V=1,kV=2,uNe=3,aNe=4;function PV(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:sNe,r=t||oNe;return{level(i){return arguments.length?(r=+i,this):r},error(){return r>=$V&&n("error","ERROR",arguments),this},warn(){return r>=kV&&n("warn","WARN",arguments),this},info(){return r>=uNe&&n("log","INFO",arguments),this},debug(){return r>=aNe&&n("log","DEBUG",arguments),this}}}var Se=Array.isArray;function ze(t){return t===Object(t)}const MV=t=>t!=="__proto__";function gw(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce((r,i)=>{for(const s in i)if(s==="signals")r.signals=lNe(r.signals,i.signals);else{const o=s==="legend"?{layout:1}:s==="style"?!0:null;X5(r,s,i[s],o)}return r},{})}function X5(t,e,n,r){if(!MV(e))return;let i,s;if(ze(n)&&!Se(n)){s=ze(t[e])?t[e]:t[e]={};for(i in n)r&&(r===!0||r[i])?X5(s,i,n[i]):MV(i)&&(s[i]=n[i])}else t[e]=n}function lNe(t,e){if(t==null)return e;const n={},r=[];function i(s){n[s.name]||(n[s.name]=1,r.push(s))}return e.forEach(i),t.forEach(i),r}function Rt(t){return t[t.length-1]}function ai(t){return t==null||t===""?null:+t}const jV=t=>e=>t*Math.exp(e),UV=t=>e=>Math.log(t*e),qV=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),HV=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,Z5=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function eS(t,e,n,r){const i=n(t[0]),s=n(Rt(t)),o=(s-i)*e;return[r(i-o),r(s-o)]}function cNe(t,e){return eS(t,e,ai,ui)}function fNe(t,e){var n=Math.sign(t[0]);return eS(t,e,UV(n),jV(n))}function xNe(t,e,n){return eS(t,e,Z5(n),Z5(1/n))}function dNe(t,e,n){return eS(t,e,qV(n),HV(n))}function tS(t,e,n,r,i){const s=r(t[0]),o=r(Rt(t)),u=e!=null?r(e):(s+o)/2;return[i(u+(s-u)*n),i(u+(o-u)*n)]}function zV(t,e,n){return tS(t,e,n,ai,ui)}function QV(t,e,n){const r=Math.sign(t[0]);return tS(t,e,n,UV(r),jV(r))}function mw(t,e,n,r){return tS(t,e,n,Z5(r),Z5(1/r))}function GV(t,e,n,r){return tS(t,e,n,qV(r),HV(r))}function hNe(t){return 1+~~(new Date(t).getMonth()/3)}function pNe(t){return 1+~~(new Date(t).getUTCMonth()/3)}function Ue(t){return t!=null?Se(t)?t:[t]:[]}function gNe(t,e,n){let r=t[0],i=t[1],s;return i<r&&(s=i,i=r,r=s),s=i-r,s>=n-e?[e,n]:[r=Math.min(Math.max(r,e),n-s),r+s]}function pt(t){return typeof t=="function"}const mNe="descending";function WV(t,e,n){n=n||{},e=Ue(e)||[];const r=[],i=[],s={},o=n.comparator||yNe;return Ue(t).forEach((u,a)=>{u!=null&&(r.push(e[a]===mNe?-1:1),i.push(u=pt(u)?u:ms(u,null,n)),(oi(u)||[]).forEach(l=>s[l]=1))}),i.length===0?null:gs(o(i,r),Object.keys(s))}const yw=(t,e)=>(t<e||t==null)&&e!=null?-1:(t>e||e==null)&&t!=null?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e===e?-1:e!==e&&t===t?1:0),yNe=(t,e)=>t.length===1?ENe(t[0],e[0]):ANe(t,e,t.length),ENe=(t,e)=>function(n,r){return yw(t(n),t(r))*e},ANe=(t,e,n)=>(e.push(0),function(r,i){let s,o=0,u=-1;for(;o===0&&++u<n;)s=t[u],o=yw(s(r),s(i));return o*e[u]});function li(t){return pt(t)?t:()=>t}function VV(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(e(r),n=null),t)}}function gt(t){for(let e,n,r=1,i=arguments.length;r<i;++r){e=arguments[r];for(n in e)t[n]=e[n]}return t}function Ya(t,e){let n=0,r,i,s,o;if(t&&(r=t.length))if(e==null){for(i=t[n];n<r&&(i==null||i!==i);i=t[++n]);for(s=o=i;n<r;++n)i=t[n],i!=null&&(i<s&&(s=i),i>o&&(o=i))}else{for(i=e(t[n]);n<r&&(i==null||i!==i);i=e(t[++n]));for(s=o=i;n<r;++n)i=e(t[n]),i!=null&&(i<s&&(s=i),i>o&&(o=i))}return[s,o]}function vNe(t,e){const n=t.length;let r=-1,i,s,o,u,a;if(e==null){for(;++r<n;)if(s=t[r],s!=null&&s>=s){i=o=s;break}if(r===n)return[-1,-1];for(u=a=r;++r<n;)s=t[r],s!=null&&(i>s&&(i=s,u=r),o<s&&(o=s,a=r))}else{for(;++r<n;)if(s=e(t[r],r,t),s!=null&&s>=s){i=o=s;break}if(r===n)return[-1,-1];for(u=a=r;++r<n;)s=e(t[r],r,t),s!=null&&(i>s&&(i=s,u=r),o<s&&(o=s,a=r))}return[u,a]}const _Ne=Object.prototype.hasOwnProperty;function tt(t,e){return _Ne.call(t,e)}const nS={};function hm(t){let e={},n;function r(s){return tt(e,s)&&e[s]!==nS}const i={size:0,empty:0,object:e,has:r,get(s){return r(s)?e[s]:void 0},set(s,o){return r(s)||(++i.size,e[s]===nS&&--i.empty),e[s]=o,this},delete(s){return r(s)&&(--i.size,++i.empty,e[s]=nS),this},clear(){i.size=i.empty=0,i.object=e={}},test(s){return arguments.length?(n=s,i):n},clean(){const s={};let o=0;for(const u in e){const a=e[u];a!==nS&&(!n||!n(a))&&(s[u]=a,++o)}i.size=o,i.empty=0,i.object=e=s}};return t&&Object.keys(t).forEach(s=>{i.set(s,t[s])}),i}function SNe(t,e,n,r,i,s){if(!n&&n!==0)return s;const o=+n;let u=t[0],a=Rt(t),l;a<u&&(l=u,u=a,a=l),l=Math.abs(e-u);const c=Math.abs(a-e);return l<c&&l<=o?r:c<=o?i:s}function Ne(t,e,n){const r=t.prototype=Object.create(e.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),gt(r,n)}function pm(t,e,n,r){let i=e[0],s=e[e.length-1],o;return i>s&&(o=i,i=s,s=o),n=n===void 0||n,r=r===void 0||r,(n?i<=t:i<t)&&(r?t<=s:t<s)}function Lh(t){return typeof t=="boolean"}function jf(t){return Object.prototype.toString.call(t)==="[object Date]"}function CNe(t){return t&&pt(t[Symbol.iterator])}function on(t){return typeof t=="number"}function bNe(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function qe(t){return typeof t=="string"}function YV(t,e,n){t&&(t=e?Ue(t).map(u=>u.replace(/\\(.)/g,"$1")):Ue(t));const r=t&&t.length,i=n&&n.get||BV,s=u=>i(e?[u]:Va(u));let o;if(!r)o=function(){return""};else if(r===1){const u=s(t[0]);o=function(a){return""+u(a)}}else{const u=t.map(s);o=function(a){let l=""+u[0](a),c=0;for(;++c<r;)l+="|"+u[c](a);return l}}return gs(o,t,"key")}function TNe(t,e){const n=t[0],r=Rt(t),i=+e;return i?i===1?r:n+i*(r-n):n}const RNe=1e4;function ONe(t){t=+t||RNe;let e,n,r;const i=()=>{e={},n={},r=0},s=(o,u)=>(++r>t&&(n=e,e={},r=1),e[o]=u);return i(),{clear:i,has:o=>tt(e,o)||tt(n,o),get:o=>tt(e,o)?e[o]:tt(n,o)?s(o,n[o]):void 0,set:(o,u)=>tt(e,o)?e[o]=u:s(o,u)}}function DNe(t,e,n,r){const i=e.length,s=n.length;if(!s)return e;if(!i)return n;const o=r||new e.constructor(i+s);let u=0,a=0,l=0;for(;u<i&&a<s;++l)o[l]=t(e[u],n[a])>0?n[a++]:e[u++];for(;u<i;++u,++l)o[l]=e[u];for(;a<s;++a,++l)o[l]=n[a];return o}function rS(t,e){let n="";for(;--e>=0;)n+=t;return n}function wNe(t,e,n,r){const i=n||" ",s=t+"",o=e-s.length;return o<=0?s:r==="left"?rS(i,o)+s:r==="center"?rS(i,~~(o/2))+s+rS(i,Math.ceil(o/2)):s+rS(i,o)}function iS(t){return t&&Rt(t)-t[0]||0}function Fe(t){return Se(t)?"["+t.map(Fe)+"]":ze(t)||qe(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function KV(t){return t==null||t===""?null:!t||t==="false"||t==="0"?!1:!!t}const NNe=t=>on(t)||jf(t)?t:Date.parse(t);function JV(t,e){return e=e||NNe,t==null||t===""?null:e(t)}function XV(t){return t==null||t===""?null:t+""}function Bu(t){const e={},n=t.length;for(let r=0;r<n;++r)e[t[r]]=!0;return e}function FNe(t,e,n,r){const i=r??"…",s=t+"",o=s.length,u=Math.max(0,e-i.length);return o<=e?s:n==="left"?i+s.slice(o-u):n==="center"?s.slice(0,Math.ceil(u/2))+i+s.slice(o-~~(u/2)):s.slice(0,u)+i}function Uf(t,e,n){if(t)if(e){const r=t.length;for(let i=0;i<r;++i){const s=e(t[i]);s&&n(s,i,t)}}else t.forEach(n)}var ZV={},Ew={},Aw=34,gm=10,vw=13;function eY(t){return new Function("d","return {"+t.map(function(e,n){return JSON.stringify(e)+": d["+n+'] || ""'}).join(",")+"}")}function LNe(t,e){var n=eY(t);return function(r,i){return e(n(r),i,t)}}function tY(t){var e=Object.create(null),n=[];return t.forEach(function(r){for(var i in r)i in e||n.push(e[i]=i)}),n}function Bi(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function INe(t){return t<0?"-"+Bi(-t,6):t>9999?"+"+Bi(t,6):Bi(t,4)}function BNe(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":INe(t.getUTCFullYear())+"-"+Bi(t.getUTCMonth()+1,2)+"-"+Bi(t.getUTCDate(),2)+(i?"T"+Bi(e,2)+":"+Bi(n,2)+":"+Bi(r,2)+"."+Bi(i,3)+"Z":r?"T"+Bi(e,2)+":"+Bi(n,2)+":"+Bi(r,2)+"Z":n||e?"T"+Bi(e,2)+":"+Bi(n,2)+"Z":"")}function $Ne(t){var e=new RegExp('["'+t+`
1291
+ `,this.quoteCharacter='"',this.includeHeader=!0,this.emptyCell=""}escape(e){const n=e.includes(this.quoteCharacter),r=e.includes(this.columnSeparator),i=e.includes(this.rowSeparator),s=r||n||i;return n&&(e=e.replace(new RegExp(this.quoteCharacter,"g"),this.quoteCharacter+this.quoteCharacter)),s&&(e=this.quoteCharacter+e+this.quoteCharacter),e}stringify(e){return e===null?this.emptyCell:e instanceof Date?e.toISOString():typeof e=="boolean"||typeof e=="number"?JSON.stringify(e):`${e}`}getColWeight(e){let n=e;Array.isArray(e)&&(n=e[0]);let r=0;for(const i in n){r=r+1;const s=n[i];if(Array.isArray(s)){const o=this.getColWeight(s)-1;r=r+o}}return r}getHeaderRow(e){const n=[];let r=0;for(const i in e){n.push(this.escape(i));const s=e[i];if(r++,Array.isArray(s)){const o=this.getColWeight(s)-1;r=r+o;for(let u=0;u<o;u++)n.push(this.emptyCell)}}return{rows:[n.join(this.columnSeparator)],length:1,width:r}}mergeMatrices(e){const n=Math.max(...e.map(s=>s.length)),r=e.reduce((s,o)=>s+o.width,0),i=[];for(let s=0;s<n;s++){const o=[];for(const u of e)if(s<u.length)o.push(u.rows[s]);else{const a=Array(u.width).fill(this.emptyCell);o.push(...a)}i.push(o.join(this.columnSeparator))}return{rows:i,length:n,width:r}}getChildMatrix(e){if(Array.isArray(e)){if(e.length===0)return{rows:[""],length:1,width:1}}else return{rows:["Invalid data found, value is not an array"],length:1,width:1};const n=[],r=this.getHeaderRow(e[0]);n.push(...r.rows);const i=r.width;let s=1;for(const o of e){const u=this.getRowMatrix(o);s=s+u.length,n.push(...u.rows)}return{rows:n,length:s,width:i}}getRowMatrix(e){const n=[];for(const r in e){const i=e[r];if(Array.isArray(i)){const s=this.getChildMatrix(i);n.push(s)}else{const s={rows:[this.stringify(i)],length:1,width:1};n.push(s)}}return this.mergeMatrices(n)}async process(e){let n=!1;for await(const r of e){if(!n&&this.includeHeader){const s=this.getHeaderRow(r.toObject());this.stream.write(s.rows[0]),this.stream.write(this.rowSeparator),n=!0}const i=this.getRowMatrix(r.toObject());for(const s of i.rows)this.stream.write(s),this.stream.write(this.rowSeparator)}this.stream.close()}}we.CSVWriter=ZOe;var V5={};Object.defineProperty(V5,"__esModule",{value:!0}),V5.toAsyncGenerator=void 0;async function*eDe(t){let e=!1;function n(i){let s;const o=new Promise(u=>{s=u});return i(u=>{s({done:!0,isError:!0,error:u})},u=>{s({done:!1,value:u,isError:!1,next:new Promise(a=>{s=a})})},()=>{s({done:!0,isError:!1})}),o}let r=n(t);for(;!e;){const i=await r;if(i.done){if(e=!0,i.isError)throw i.error;break}else r=i.next,yield i.value}}V5.toAsyncGenerator=eDe,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.InMemoryURLReader=t.EmptyURLReader=t.SingleConnectionRuntime=t.ConnectionRuntime=t.AtomicFieldType=t.Runtime=t.Malloy=t.Model=t.MalloyTranslator=t.composeSQLExpr=t.indent=t.expressionIsUngroupedAggregate=t.expressionIsScalar=t.expressionIsCalculation=t.expressionIsAnalytic=t.expressionIsAggregate=t.mkFieldDef=t.mkArrayDef=t.isScalarArray=t.isRepeatedRecord=t.isSamplingRows=t.isSamplingPercent=t.isSamplingEnable=t.isJoinedSource=t.isJoined=t.isLeafAtomic=t.Segment=t.isSourceDef=t.TinyParser=t.Dialect=t.spread=t.literal=t.variadicParam=t.param=t.makeParam=t.sql=t.maxScalar=t.minAggregate=t.anyExprType=t.minScalar=t.overload=t.qtz=t.arg=t.registerDialect=t.MySQLDialect=t.SnowflakeDialect=t.PostgresDialect=t.TrinoDialect=t.StandardSQLDialect=t.DuckDBDialect=void 0,t.Tag=t.toAsyncGenerator=t.Explore=t.DataWriter=t.Parse=t.JSONWriter=t.CSVWriter=t.QueryMaterializer=t.Result=t.PreparedResult=t.TimestampTimeframe=t.DateTimeframe=t.SourceRelationship=t.JoinRelationship=t.MalloyError=t.FixedConnectionMap=void 0;var e=ed;Object.defineProperty(t,"DuckDBDialect",{enumerable:!0,get:function(){return e.DuckDBDialect}}),Object.defineProperty(t,"StandardSQLDialect",{enumerable:!0,get:function(){return e.StandardSQLDialect}}),Object.defineProperty(t,"TrinoDialect",{enumerable:!0,get:function(){return e.TrinoDialect}}),Object.defineProperty(t,"PostgresDialect",{enumerable:!0,get:function(){return e.PostgresDialect}}),Object.defineProperty(t,"SnowflakeDialect",{enumerable:!0,get:function(){return e.SnowflakeDialect}}),Object.defineProperty(t,"MySQLDialect",{enumerable:!0,get:function(){return e.MySQLDialect}}),Object.defineProperty(t,"registerDialect",{enumerable:!0,get:function(){return e.registerDialect}}),Object.defineProperty(t,"arg",{enumerable:!0,get:function(){return e.arg}}),Object.defineProperty(t,"qtz",{enumerable:!0,get:function(){return e.qtz}}),Object.defineProperty(t,"overload",{enumerable:!0,get:function(){return e.overload}}),Object.defineProperty(t,"minScalar",{enumerable:!0,get:function(){return e.minScalar}}),Object.defineProperty(t,"anyExprType",{enumerable:!0,get:function(){return e.anyExprType}}),Object.defineProperty(t,"minAggregate",{enumerable:!0,get:function(){return e.minAggregate}}),Object.defineProperty(t,"maxScalar",{enumerable:!0,get:function(){return e.maxScalar}}),Object.defineProperty(t,"sql",{enumerable:!0,get:function(){return e.sql}}),Object.defineProperty(t,"makeParam",{enumerable:!0,get:function(){return e.makeParam}}),Object.defineProperty(t,"param",{enumerable:!0,get:function(){return e.param}}),Object.defineProperty(t,"variadicParam",{enumerable:!0,get:function(){return e.variadicParam}}),Object.defineProperty(t,"literal",{enumerable:!0,get:function(){return e.literal}}),Object.defineProperty(t,"spread",{enumerable:!0,get:function(){return e.spread}}),Object.defineProperty(t,"Dialect",{enumerable:!0,get:function(){return e.Dialect}}),Object.defineProperty(t,"TinyParser",{enumerable:!0,get:function(){return e.TinyParser}});var n=ts;Object.defineProperty(t,"isSourceDef",{enumerable:!0,get:function(){return n.isSourceDef}}),Object.defineProperty(t,"Segment",{enumerable:!0,get:function(){return n.Segment}}),Object.defineProperty(t,"isLeafAtomic",{enumerable:!0,get:function(){return n.isLeafAtomic}}),Object.defineProperty(t,"isJoined",{enumerable:!0,get:function(){return n.isJoined}}),Object.defineProperty(t,"isJoinedSource",{enumerable:!0,get:function(){return n.isJoinedSource}}),Object.defineProperty(t,"isSamplingEnable",{enumerable:!0,get:function(){return n.isSamplingEnable}}),Object.defineProperty(t,"isSamplingPercent",{enumerable:!0,get:function(){return n.isSamplingPercent}}),Object.defineProperty(t,"isSamplingRows",{enumerable:!0,get:function(){return n.isSamplingRows}}),Object.defineProperty(t,"isRepeatedRecord",{enumerable:!0,get:function(){return n.isRepeatedRecord}}),Object.defineProperty(t,"isScalarArray",{enumerable:!0,get:function(){return n.isScalarArray}}),Object.defineProperty(t,"mkArrayDef",{enumerable:!0,get:function(){return n.mkArrayDef}}),Object.defineProperty(t,"mkFieldDef",{enumerable:!0,get:function(){return n.mkFieldDef}}),Object.defineProperty(t,"expressionIsAggregate",{enumerable:!0,get:function(){return n.expressionIsAggregate}}),Object.defineProperty(t,"expressionIsAnalytic",{enumerable:!0,get:function(){return n.expressionIsAnalytic}}),Object.defineProperty(t,"expressionIsCalculation",{enumerable:!0,get:function(){return n.expressionIsCalculation}}),Object.defineProperty(t,"expressionIsScalar",{enumerable:!0,get:function(){return n.expressionIsScalar}}),Object.defineProperty(t,"expressionIsUngroupedAggregate",{enumerable:!0,get:function(){return n.expressionIsUngroupedAggregate}}),Object.defineProperty(t,"indent",{enumerable:!0,get:function(){return n.indent}}),Object.defineProperty(t,"composeSQLExpr",{enumerable:!0,get:function(){return n.composeSQLExpr}});var r=iO;Object.defineProperty(t,"MalloyTranslator",{enumerable:!0,get:function(){return r.MalloyTranslator}});var i=we;Object.defineProperty(t,"Model",{enumerable:!0,get:function(){return i.Model}}),Object.defineProperty(t,"Malloy",{enumerable:!0,get:function(){return i.Malloy}}),Object.defineProperty(t,"Runtime",{enumerable:!0,get:function(){return i.Runtime}}),Object.defineProperty(t,"AtomicFieldType",{enumerable:!0,get:function(){return i.AtomicFieldType}}),Object.defineProperty(t,"ConnectionRuntime",{enumerable:!0,get:function(){return i.ConnectionRuntime}}),Object.defineProperty(t,"SingleConnectionRuntime",{enumerable:!0,get:function(){return i.SingleConnectionRuntime}}),Object.defineProperty(t,"EmptyURLReader",{enumerable:!0,get:function(){return i.EmptyURLReader}}),Object.defineProperty(t,"InMemoryURLReader",{enumerable:!0,get:function(){return i.InMemoryURLReader}}),Object.defineProperty(t,"FixedConnectionMap",{enumerable:!0,get:function(){return i.FixedConnectionMap}}),Object.defineProperty(t,"MalloyError",{enumerable:!0,get:function(){return i.MalloyError}}),Object.defineProperty(t,"JoinRelationship",{enumerable:!0,get:function(){return i.JoinRelationship}}),Object.defineProperty(t,"SourceRelationship",{enumerable:!0,get:function(){return i.SourceRelationship}}),Object.defineProperty(t,"DateTimeframe",{enumerable:!0,get:function(){return i.DateTimeframe}}),Object.defineProperty(t,"TimestampTimeframe",{enumerable:!0,get:function(){return i.TimestampTimeframe}}),Object.defineProperty(t,"PreparedResult",{enumerable:!0,get:function(){return i.PreparedResult}}),Object.defineProperty(t,"Result",{enumerable:!0,get:function(){return i.Result}}),Object.defineProperty(t,"QueryMaterializer",{enumerable:!0,get:function(){return i.QueryMaterializer}}),Object.defineProperty(t,"CSVWriter",{enumerable:!0,get:function(){return i.CSVWriter}}),Object.defineProperty(t,"JSONWriter",{enumerable:!0,get:function(){return i.JSONWriter}}),Object.defineProperty(t,"Parse",{enumerable:!0,get:function(){return i.Parse}}),Object.defineProperty(t,"DataWriter",{enumerable:!0,get:function(){return i.DataWriter}}),Object.defineProperty(t,"Explore",{enumerable:!0,get:function(){return i.Explore}});var s=V5;Object.defineProperty(t,"toAsyncGenerator",{enumerable:!0,get:function(){return s.toAsyncGenerator}});var o=fo;Object.defineProperty(t,"Tag",{enumerable:!0,get:function(){return o.Tag}})}(fk);function WW(t){const e=t.parentExplore;return(e==null?void 0:e.allFields.findIndex(n=>n.name===t.name))??-1}function cm(t){return t.parentExplore?WW(t)===t.parentExplore.allFields.length-1:!0}function fm(t){return WW(t)===0}function VW(t,e){return t.isAtomicField()&&t.isNumber()&&e!==null}function tDe(t,e){return t.isAtomicField()&&t.isBoolean()&&e!==null}function YW(t,e){return t.isAtomicField()&&t.isString()&&e!==null}function nDe(t,e){return t.isAtomicField()&&(t.isDate()||t.isTimestamp())&&e!==null}function cw(t,e){const n=document.createElement("div");n.innerHTML=t;for(const[i,s]of Object.entries(e))n.style[i]=s;document.body.appendChild(n);const r=n.getBoundingClientRect();return document.body.removeChild(n),r.width}function Hs(t){return JSON.stringify(t.fieldPath)}function fw(t){return t[1]-t[0]+1}var Y5=(t=>(t.Dollars="usd",t.Euros="euro",t.Pounds="pound",t))(Y5||{}),Hn=(t=>(t.Nanoseconds="nanoseconds",t.Microseconds="microseconds",t.Milliseconds="milliseconds",t.Seconds="seconds",t.Minutes="minutes",t.Hours="hours",t.Days="days",t))(Hn||{});function rDe(t){return Object.values(Hn).includes(t)}var KW={exports:{}};(function(t){var e={},n=function(i){i.version="0.11.2";function s(w){for(var $="",M=w.length-1;M>=0;)$+=w.charAt(M--);return $}function o(w,$){for(var M="";M.length<$;)M+=w;return M}function u(w,$){var M=""+w;return M.length>=$?M:o("0",$-M.length)+M}function a(w,$){var M=""+w;return M.length>=$?M:o(" ",$-M.length)+M}function l(w,$){var M=""+w;return M.length>=$?M:M+o(" ",$-M.length)}function c(w,$){var M=""+Math.round(w);return M.length>=$?M:o("0",$-M.length)+M}function f(w,$){var M=""+w;return M.length>=$?M:o("0",$-M.length)+M}var x=Math.pow(2,32);function h(w,$){if(w>x||w<-x)return c(w,$);var M=Math.round(w);return f(M,$)}function p(w,$){return $=$||0,w.length>=7+$&&(w.charCodeAt($)|32)===103&&(w.charCodeAt($+1)|32)===101&&(w.charCodeAt($+2)|32)===110&&(w.charCodeAt($+3)|32)===101&&(w.charCodeAt($+4)|32)===114&&(w.charCodeAt($+5)|32)===97&&(w.charCodeAt($+6)|32)===108}var m=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],g=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];function y(w){w[0]="General",w[1]="0",w[2]="0.00",w[3]="#,##0",w[4]="#,##0.00",w[9]="0%",w[10]="0.00%",w[11]="0.00E+00",w[12]="# ?/?",w[13]="# ??/??",w[14]="m/d/yy",w[15]="d-mmm-yy",w[16]="d-mmm",w[17]="mmm-yy",w[18]="h:mm AM/PM",w[19]="h:mm:ss AM/PM",w[20]="h:mm",w[21]="h:mm:ss",w[22]="m/d/yy h:mm",w[37]="#,##0 ;(#,##0)",w[38]="#,##0 ;[Red](#,##0)",w[39]="#,##0.00;(#,##0.00)",w[40]="#,##0.00;[Red](#,##0.00)",w[45]="mm:ss",w[46]="[h]:mm:ss",w[47]="mmss.0",w[48]="##0.0E+0",w[49]="@",w[56]='"上午/下午 "hh"時"mm"分"ss"秒 "'}var E={};y(E);var A=[],v=0;for(v=5;v<=8;++v)A[v]=32+v;for(v=23;v<=26;++v)A[v]=0;for(v=27;v<=31;++v)A[v]=14;for(v=50;v<=58;++v)A[v]=14;for(v=59;v<=62;++v)A[v]=v-58;for(v=67;v<=68;++v)A[v]=v-58;for(v=72;v<=75;++v)A[v]=v-58;for(v=67;v<=68;++v)A[v]=v-57;for(v=76;v<=78;++v)A[v]=v-56;for(v=79;v<=81;++v)A[v]=v-34;var _=[];_[5]=_[63]='"$"#,##0_);\\("$"#,##0\\)',_[6]=_[64]='"$"#,##0_);[Red]\\("$"#,##0\\)',_[7]=_[65]='"$"#,##0.00_);\\("$"#,##0.00\\)',_[8]=_[66]='"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',_[41]='_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',_[42]='_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',_[43]='_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',_[44]='_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)';function S(w,$,M){for(var Q=w<0?-1:1,B=w*Q,z=0,j=1,J=0,xe=1,oe=0,Z=0,ce=Math.floor(B);oe<$&&(ce=Math.floor(B),J=ce*j+z,Z=ce*oe+xe,!(B-ce<5e-8));)B=1/(B-ce),z=j,j=J,xe=oe,oe=Z;if(Z>$&&(oe>$?(Z=xe,J=z):(Z=oe,J=j)),!M)return[0,Q*J,Z];var Re=Math.floor(Q*J/Z);return[Re,Q*J-Re*Z,Z]}function C(w,$,M){if(w>2958465||w<0)return null;var Q=w|0,B=Math.floor(86400*(w-Q)),z=0,j=[],J={D:Q,T:B,u:86400*(w-Q)-B,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(J.u)<1e-6&&(J.u=0),$&&$.date1904&&(Q+=1462),J.u>.9999&&(J.u=0,++B==86400&&(J.T=B=0,++Q,++J.D)),Q===60)j=M?[1317,10,29]:[1900,2,29],z=3;else if(Q===0)j=M?[1317,8,29]:[1900,1,0],z=6;else{Q>60&&--Q;var xe=new Date(1900,0,1);xe.setDate(xe.getDate()+Q-1),j=[xe.getFullYear(),xe.getMonth()+1,xe.getDate()],z=xe.getDay(),Q<60&&(z=(z+6)%7),M&&(z=G(xe,j))}return J.y=j[0],J.m=j[1],J.d=j[2],J.S=B%60,B=Math.floor(B/60),J.M=B%60,B=Math.floor(B/60),J.H=B,J.q=z,J}i.parse_date_code=C;var b=new Date(1899,11,31,0,0,0),N=b.getTime(),L=new Date(1900,2,1,0,0,0);function I(w,$){var M=w.getTime();return $?M-=1262304e5:w>=L&&(M+=864e5),(M-(N+(w.getTimezoneOffset()-b.getTimezoneOffset())*6e4))/864e5}function P(w){return w.toString(10)}i._general_int=P;var q=function(){var $=/(?:\.0*|(\.\d*[1-9])0+)$/;function M(oe){return oe.indexOf(".")==-1?oe:oe.replace($,"$1")}var Q=/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,B=/(E[+-])(\d)$/;function z(oe){return oe.indexOf("E")==-1?oe:oe.replace(Q,"$1E").replace(B,"$10$2")}function j(oe){var Z=oe<0?12:11,ce=M(oe.toFixed(12));return ce.length<=Z||(ce=oe.toPrecision(10),ce.length<=Z)?ce:oe.toExponential(5)}function J(oe){var Z=M(oe.toFixed(11));return Z.length>(oe<0?12:11)||Z==="0"||Z==="-0"?oe.toPrecision(6):Z}function xe(oe){var Z=Math.floor(Math.log(Math.abs(oe))*Math.LOG10E),ce;return Z>=-4&&Z<=-1?ce=oe.toPrecision(10+Z):Math.abs(Z)<=9?ce=j(oe):Z===10?ce=oe.toFixed(10).substr(0,12):ce=J(oe),M(z(ce.toUpperCase()))}return xe}();i._general_num=q;function X(w,$){switch(typeof w){case"string":return w;case"boolean":return w?"TRUE":"FALSE";case"number":return(w|0)===w?w.toString(10):q(w);case"undefined":return"";case"object":if(w==null)return"";if(w instanceof Date)return W(14,I(w,$&&$.date1904),$)}throw new Error("unsupported value in General format: "+w)}i._general=X;function G(w,$){$[0]-=581;var M=w.getDay();return w<60&&(M=(M+6)%7),M}function ue(w,$,M,Q){var B="",z=0,j=0,J=M.y,xe,oe=0;switch(w){case 98:J=M.y+543;case 121:switch($.length){case 1:case 2:xe=J%100,oe=2;break;default:xe=J%1e4,oe=4;break}break;case 109:switch($.length){case 1:case 2:xe=M.m,oe=$.length;break;case 3:return g[M.m-1][1];case 5:return g[M.m-1][0];default:return g[M.m-1][2]}break;case 100:switch($.length){case 1:case 2:xe=M.d,oe=$.length;break;case 3:return m[M.q][0];default:return m[M.q][1]}break;case 104:switch($.length){case 1:case 2:xe=1+(M.H+11)%12,oe=$.length;break;default:throw"bad hour format: "+$}break;case 72:switch($.length){case 1:case 2:xe=M.H,oe=$.length;break;default:throw"bad hour format: "+$}break;case 77:switch($.length){case 1:case 2:xe=M.M,oe=$.length;break;default:throw"bad minute format: "+$}break;case 115:if($!="s"&&$!="ss"&&$!=".0"&&$!=".00"&&$!=".000")throw"bad second format: "+$;return M.u===0&&($=="s"||$=="ss")?u(M.S,$.length):(Q>=2?j=Q===3?1e3:100:j=Q===1?10:1,z=Math.round(j*(M.S+M.u)),z>=60*j&&(z=0),$==="s"?z===0?"0":""+z/j:(B=u(z,2+Q),$==="ss"?B.substr(0,2):"."+B.substr(2,$.length-1)));case 90:switch($){case"[h]":case"[hh]":xe=M.D*24+M.H;break;case"[m]":case"[mm]":xe=(M.D*24+M.H)*60+M.M;break;case"[s]":case"[ss]":xe=((M.D*24+M.H)*60+M.M)*60+Math.round(M.S+M.u);break;default:throw"bad abstime format: "+$}oe=$.length===3?1:2;break;case 101:xe=J,oe=1;break}var Z=oe>0?u(xe,oe):"";return Z}function he(w){var $=3;if(w.length<=$)return w;for(var M=w.length%$,Q=w.substr(0,M);M!=w.length;M+=$)Q+=(Q.length>0?",":"")+w.substr(M,$);return Q}var pe=function(){var $=/%/g;function M(ne,V,se){var Te=V.replace($,""),K=V.length-Te.length;return pe(ne,Te,se*Math.pow(10,2*K))+o("%",K)}function Q(ne,V,se){for(var Te=V.length-1;V.charCodeAt(Te-1)===44;)--Te;return pe(ne,V.substr(0,Te),se/Math.pow(10,3*(V.length-Te)))}function B(ne,V){var se,Te=ne.indexOf("E")-ne.indexOf(".")-1;if(ne.match(/^#+0.0E\+0$/)){if(V==0)return"0.0E+0";if(V<0)return"-"+B(ne,-V);var K=ne.indexOf(".");K===-1&&(K=ne.indexOf("E"));var de=Math.floor(Math.log(V)*Math.LOG10E)%K;if(de<0&&(de+=K),se=(V/Math.pow(10,de)).toPrecision(Te+1+(K+de)%K),se.indexOf("e")===-1){var Le=Math.floor(Math.log(V)*Math.LOG10E);for(se.indexOf(".")===-1?se=se.charAt(0)+"."+se.substr(1)+"E+"+(Le-se.length+de):se+="E+"+(Le-de);se.substr(0,2)==="0.";)se=se.charAt(0)+se.substr(2,K)+"."+se.substr(2+K),se=se.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");se=se.replace(/\+-/,"-")}se=se.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(He,ot,_t,ut){return ot+_t+ut.substr(0,(K+de)%K)+"."+ut.substr(de)+"E"})}else se=V.toExponential(Te);return ne.match(/E\+00$/)&&se.match(/e[+-]\d$/)&&(se=se.substr(0,se.length-1)+"0"+se.charAt(se.length-1)),ne.match(/E\-/)&&se.match(/e\+/)&&(se=se.replace(/e\+/,"e")),se.replace("e","E")}var z=/# (\?+)( ?)\/( ?)(\d+)/;function j(ne,V,se){var Te=parseInt(ne[4],10),K=Math.round(V*Te),de=Math.floor(K/Te),Le=K-de*Te,He=Te;return se+(de===0?"":""+de)+" "+(Le===0?o(" ",ne[1].length+1+ne[4].length):a(Le,ne[1].length)+ne[2]+"/"+ne[3]+u(He,ne[4].length))}function J(ne,V,se){return se+(V===0?"":""+V)+o(" ",ne[1].length+2+ne[4].length)}var xe=/^#*0*\.([0#]+)/,oe=/\).*[0#]/,Z=/\(###\) ###\\?-####/;function ce(ne){for(var V="",se,Te=0;Te!=ne.length;++Te)switch(se=ne.charCodeAt(Te)){case 35:break;case 63:V+=" ";break;case 48:V+="0";break;default:V+=String.fromCharCode(se)}return V}function Re(ne,V){var se=Math.pow(10,V);return""+Math.round(ne*se)/se}function ke(ne,V){var se=ne-Math.floor(ne),Te=Math.pow(10,V);return V<(""+Math.round(se*Te)).length?0:Math.round(se*Te)}function Ve(ne,V){return V<(""+Math.round((ne-Math.floor(ne))*Math.pow(10,V))).length?1:0}function Y(ne){return ne<2147483647&&ne>-2147483648?""+(ne>=0?ne|0:ne-1|0):""+Math.floor(ne)}function ee(ne,V,se){if(ne.charCodeAt(0)===40&&!V.match(oe)){var Te=V.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return se>=0?ee("n",Te,se):"("+ee("n",Te,-se)+")"}if(V.charCodeAt(V.length-1)===44)return Q(ne,V,se);if(V.indexOf("%")!==-1)return M(ne,V,se);if(V.indexOf("E")!==-1)return B(V,se);if(V.charCodeAt(0)===36)return"$"+ee(ne,V.substr(V.charAt(1)==" "?2:1),se);var K,de,Le,He,ot=Math.abs(se),_t=se<0?"-":"";if(V.match(/^00+$/))return _t+h(ot,V.length);if(V.match(/^[#?]+$/))return K=h(se,0),K==="0"&&(K=""),K.length>V.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(z))return j(de,ot,_t);if(V.match(/^#+0+$/))return _t+h(ot,V.length-V.indexOf("0"));if(de=V.match(xe))return K=Re(se,de[1].length).replace(/^([^\.]+)$/,"$1."+ce(de[1])).replace(/\.$/,"."+ce(de[1])).replace(/\.(\d*)$/,function(Ds,qy){return"."+qy+o("0",ce(de[1]).length-qy.length)}),V.indexOf("0.")!==-1?K:K.replace(/^0\./,".");if(V=V.replace(/^#+([0.])/,"$1"),de=V.match(/^(0*)\.(#*)$/))return _t+Re(ot,de[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,de[1].length?"0.":".");if(de=V.match(/^#{1,3},##0(\.?)$/))return _t+he(h(ot,0));if(de=V.match(/^#,##0\.([#0]*0)$/))return se<0?"-"+ee(ne,V,-se):he(""+(Math.floor(se)+Ve(se,de[1].length)))+"."+u(ke(se,de[1].length),de[1].length);if(de=V.match(/^#,#*,#0/))return ee(ne,V.replace(/^#,#*,/,""),se);if(de=V.match(/^([0#]+)(\\?-([0#]+))+$/))return K=s(ee(ne,V.replace(/[\\-]/g,""),se)),Le=0,s(s(V.replace(/\\/g,"")).replace(/[0#]/g,function(Ds){return Le<K.length?K.charAt(Le++):Ds==="0"?"0":""}));if(V.match(Z))return K=ee(ne,"##########",se),"("+K.substr(0,3)+") "+K.substr(3,3)+"-"+K.substr(6);var ut="";if(de=V.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(de[4].length,7),He=S(ot,Math.pow(10,Le)-1,!1),K=""+_t,ut=pe("n",de[1],He[1]),ut.charAt(ut.length-1)==" "&&(ut=ut.substr(0,ut.length-1)+"0"),K+=ut+de[2]+"/"+de[3],ut=l(He[2],Le),ut.length<de[4].length&&(ut=ce(de[4].substr(de[4].length-ut.length))+ut),K+=ut,K;if(de=V.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(Math.max(de[1].length,de[4].length),7),He=S(ot,Math.pow(10,Le)-1,!0),_t+(He[0]||(He[1]?"":"0"))+" "+(He[1]?a(He[1],Le)+de[2]+"/"+de[3]+l(He[2],Le):o(" ",2*Le+1+de[2].length+de[3].length));if(de=V.match(/^[#0?]+$/))return K=h(se,0),V.length<=K.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(/^([#0?]+)\.([#0]+)$/)){K=""+se.toFixed(Math.min(de[2].length,10)).replace(/([^0])0+$/,"$1"),Le=K.indexOf(".");var pr=V.indexOf(".")-Le,wc=V.length-K.length-pr;return ce(V.substr(0,pr)+K+V.substr(V.length-wc))}if(de=V.match(/^00,000\.([#0]*0)$/))return Le=ke(se,de[1].length),se<0?"-"+ee(ne,V,-se):he(Y(se)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(Ds){return"00,"+(Ds.length<3?u(0,3-Ds.length):"")+Ds})+"."+u(Le,de[1].length);switch(V){case"###,##0.00":return ee(ne,"#,##0.00",se);case"###,###":case"##,###":case"#,###":var Uy=he(h(ot,0));return Uy!=="0"?_t+Uy:"";case"###,###.00":return ee(ne,"###,##0.00",se).replace(/^0\./,".");case"#,###.00":return ee(ne,"#,##0.00",se).replace(/^0\./,".")}throw new Error("unsupported format |"+V+"|")}function Ce(ne,V,se){for(var Te=V.length-1;V.charCodeAt(Te-1)===44;)--Te;return pe(ne,V.substr(0,Te),se/Math.pow(10,3*(V.length-Te)))}function Me(ne,V,se){var Te=V.replace($,""),K=V.length-Te.length;return pe(ne,Te,se*Math.pow(10,2*K))+o("%",K)}function Pe(ne,V){var se,Te=ne.indexOf("E")-ne.indexOf(".")-1;if(ne.match(/^#+0.0E\+0$/)){if(V==0)return"0.0E+0";if(V<0)return"-"+Pe(ne,-V);var K=ne.indexOf(".");K===-1&&(K=ne.indexOf("E"));var de=Math.floor(Math.log(V)*Math.LOG10E)%K;if(de<0&&(de+=K),se=(V/Math.pow(10,de)).toPrecision(Te+1+(K+de)%K),!se.match(/[Ee]/)){var Le=Math.floor(Math.log(V)*Math.LOG10E);se.indexOf(".")===-1?se=se.charAt(0)+"."+se.substr(1)+"E+"+(Le-se.length+de):se+="E+"+(Le-de),se=se.replace(/\+-/,"-")}se=se.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(He,ot,_t,ut){return ot+_t+ut.substr(0,(K+de)%K)+"."+ut.substr(de)+"E"})}else se=V.toExponential(Te);return ne.match(/E\+00$/)&&se.match(/e[+-]\d$/)&&(se=se.substr(0,se.length-1)+"0"+se.charAt(se.length-1)),ne.match(/E\-/)&&se.match(/e\+/)&&(se=se.replace(/e\+/,"e")),se.replace("e","E")}function U(ne,V,se){if(ne.charCodeAt(0)===40&&!V.match(oe)){var Te=V.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return se>=0?U("n",Te,se):"("+U("n",Te,-se)+")"}if(V.charCodeAt(V.length-1)===44)return Ce(ne,V,se);if(V.indexOf("%")!==-1)return Me(ne,V,se);if(V.indexOf("E")!==-1)return Pe(V,se);if(V.charCodeAt(0)===36)return"$"+U(ne,V.substr(V.charAt(1)==" "?2:1),se);var K,de,Le,He,ot=Math.abs(se),_t=se<0?"-":"";if(V.match(/^00+$/))return _t+u(ot,V.length);if(V.match(/^[#?]+$/))return K=""+se,se===0&&(K=""),K.length>V.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(z))return J(de,ot,_t);if(V.match(/^#+0+$/))return _t+u(ot,V.length-V.indexOf("0"));if(de=V.match(xe))return K=(""+se).replace(/^([^\.]+)$/,"$1."+ce(de[1])).replace(/\.$/,"."+ce(de[1])),K=K.replace(/\.(\d*)$/,function(Ds,qy){return"."+qy+o("0",ce(de[1]).length-qy.length)}),V.indexOf("0.")!==-1?K:K.replace(/^0\./,".");if(V=V.replace(/^#+([0.])/,"$1"),de=V.match(/^(0*)\.(#*)$/))return _t+(""+ot).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,de[1].length?"0.":".");if(de=V.match(/^#{1,3},##0(\.?)$/))return _t+he(""+ot);if(de=V.match(/^#,##0\.([#0]*0)$/))return se<0?"-"+U(ne,V,-se):he(""+se)+"."+o("0",de[1].length);if(de=V.match(/^#,#*,#0/))return U(ne,V.replace(/^#,#*,/,""),se);if(de=V.match(/^([0#]+)(\\?-([0#]+))+$/))return K=s(U(ne,V.replace(/[\\-]/g,""),se)),Le=0,s(s(V.replace(/\\/g,"")).replace(/[0#]/g,function(Ds){return Le<K.length?K.charAt(Le++):Ds==="0"?"0":""}));if(V.match(Z))return K=U(ne,"##########",se),"("+K.substr(0,3)+") "+K.substr(3,3)+"-"+K.substr(6);var ut="";if(de=V.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(de[4].length,7),He=S(ot,Math.pow(10,Le)-1,!1),K=""+_t,ut=pe("n",de[1],He[1]),ut.charAt(ut.length-1)==" "&&(ut=ut.substr(0,ut.length-1)+"0"),K+=ut+de[2]+"/"+de[3],ut=l(He[2],Le),ut.length<de[4].length&&(ut=ce(de[4].substr(de[4].length-ut.length))+ut),K+=ut,K;if(de=V.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(Math.max(de[1].length,de[4].length),7),He=S(ot,Math.pow(10,Le)-1,!0),_t+(He[0]||(He[1]?"":"0"))+" "+(He[1]?a(He[1],Le)+de[2]+"/"+de[3]+l(He[2],Le):o(" ",2*Le+1+de[2].length+de[3].length));if(de=V.match(/^[#0?]+$/))return K=""+se,V.length<=K.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(/^([#0]+)\.([#0]+)$/)){K=""+se.toFixed(Math.min(de[2].length,10)).replace(/([^0])0+$/,"$1"),Le=K.indexOf(".");var pr=V.indexOf(".")-Le,wc=V.length-K.length-pr;return ce(V.substr(0,pr)+K+V.substr(V.length-wc))}if(de=V.match(/^00,000\.([#0]*0)$/))return se<0?"-"+U(ne,V,-se):he(""+se).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(Ds){return"00,"+(Ds.length<3?u(0,3-Ds.length):"")+Ds})+"."+u(0,de[1].length);switch(V){case"###,###":case"##,###":case"#,###":var Uy=he(""+ot);return Uy!=="0"?_t+Uy:"";default:if(V.match(/\.[0#?]*$/))return U(ne,V.slice(0,V.lastIndexOf(".")),se)+ce(V.slice(V.lastIndexOf(".")))}throw new Error("unsupported format |"+V+"|")}return function(V,se,Te){return(Te|0)===Te?U(V,se,Te):ee(V,se,Te)}}();function ae(w){for(var $=[],M=!1,Q=0,B=0;Q<w.length;++Q)switch(w.charCodeAt(Q)){case 34:M=!M;break;case 95:case 42:case 92:++Q;break;case 59:$[$.length]=w.substr(B,Q-B),B=Q+1}if($[$.length]=w.substr(B),M===!0)throw new Error("Format |"+w+"| unterminated string ");return $}i._split=ae;var fe=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function re(w){for(var $=0,M="",Q="";$<w.length;)switch(M=w.charAt($)){case"G":p(w,$)&&($+=6),$++;break;case'"':for(;w.charCodeAt(++$)!==34&&$<w.length;);++$;break;case"\\":$+=2;break;case"_":$+=2;break;case"@":++$;break;case"B":case"b":if(w.charAt($+1)==="1"||w.charAt($+1)==="2")return!0;case"M":case"D":case"Y":case"H":case"S":case"E":case"m":case"d":case"y":case"h":case"s":case"e":case"g":return!0;case"A":case"a":case"上":if(w.substr($,3).toUpperCase()==="A/P"||w.substr($,5).toUpperCase()==="AM/PM"||w.substr($,5).toUpperCase()==="上午/下午")return!0;++$;break;case"[":for(Q=M;w.charAt($++)!=="]"&&$<w.length;)Q+=w.charAt($);if(Q.match(fe))return!0;break;case".":case"0":case"#":for(;$<w.length&&("0#?.,E+-%".indexOf(M=w.charAt(++$))>-1||M=="\\"&&w.charAt($+1)=="-"&&"0#".indexOf(w.charAt($+2))>-1););break;case"?":for(;w.charAt(++$)===M;);break;case"*":++$,(w.charAt($)==" "||w.charAt($)=="*")&&++$;break;case"(":case")":++$;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;$<w.length&&"0123456789".indexOf(w.charAt(++$))>-1;);break;case" ":++$;break;default:++$;break}return!1}i.is_date=re;function ie(w,$,M,Q){for(var B=[],z="",j=0,J="",xe="t",oe,Z,ce,Re="H";j<w.length;)switch(J=w.charAt(j)){case"G":if(!p(w,j))throw new Error("unrecognized character "+J+" in "+w);B[B.length]={t:"G",v:"General"},j+=7;break;case'"':for(z="";(ce=w.charCodeAt(++j))!==34&&j<w.length;)z+=String.fromCharCode(ce);B[B.length]={t:"t",v:z},++j;break;case"\\":var ke=w.charAt(++j),Ve=ke==="("||ke===")"?ke:"t";B[B.length]={t:Ve,v:ke},++j;break;case"_":B[B.length]={t:"t",v:" "},j+=2;break;case"@":B[B.length]={t:"T",v:$},++j;break;case"B":case"b":if(w.charAt(j+1)==="1"||w.charAt(j+1)==="2"){if(oe==null&&(oe=C($,M,w.charAt(j+1)==="2"),oe==null))return"";B[B.length]={t:"X",v:w.substr(j,2)},xe=J,j+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":J=J.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if($<0||oe==null&&(oe=C($,M),oe==null))return"";for(z=J;++j<w.length&&w.charAt(j).toLowerCase()===J;)z+=J;J==="m"&&xe.toLowerCase()==="h"&&(J="M"),J==="h"&&(J=Re),B[B.length]={t:J,v:z},xe=J;break;case"A":case"a":case"上":var Y={t:J,v:J};if(oe==null&&(oe=C($,M)),w.substr(j,3).toUpperCase()==="A/P"?(oe!=null&&(Y.v=oe.H>=12?"P":"A"),Y.t="T",Re="h",j+=3):w.substr(j,5).toUpperCase()==="AM/PM"?(oe!=null&&(Y.v=oe.H>=12?"PM":"AM"),Y.t="T",j+=5,Re="h"):w.substr(j,5).toUpperCase()==="上午/下午"?(oe!=null&&(Y.v=oe.H>=12?"下午":"上午"),Y.t="T",j+=5,Re="h"):(Y.t="t",++j),oe==null&&Y.t==="T")return"";B[B.length]=Y,xe=J;break;case"[":for(z=J;w.charAt(j++)!=="]"&&j<w.length;)z+=w.charAt(j);if(z.slice(-1)!=="]")throw'unterminated "[" block: |'+z+"|";if(z.match(fe)){if(oe==null&&(oe=C($,M),oe==null))return"";B[B.length]={t:"Z",v:z.toLowerCase()},xe=z.charAt(1)}else z.indexOf("$")>-1&&(z=(z.match(/\$([^-\[\]]*)/)||[])[1]||"$",re(w)||(B[B.length]={t:"t",v:z}));break;case".":if(oe!=null){for(z=J;++j<w.length&&(J=w.charAt(j))==="0";)z+=J;B[B.length]={t:"s",v:z};break}case"0":case"#":for(z=J;++j<w.length&&"0#?.,E+-%".indexOf(J=w.charAt(j))>-1;)z+=J;B[B.length]={t:"n",v:z};break;case"?":for(z=J;w.charAt(++j)===J;)z+=J;B[B.length]={t:J,v:z},xe=J;break;case"*":++j,(w.charAt(j)==" "||w.charAt(j)=="*")&&++j;break;case"(":case")":B[B.length]={t:Q===1?"t":J,v:J},++j;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(z=J;j<w.length&&"0123456789".indexOf(w.charAt(++j))>-1;)z+=w.charAt(j);B[B.length]={t:"D",v:z};break;case" ":B[B.length]={t:J,v:J},++j;break;case"$":B[B.length]={t:"t",v:"$"},++j;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(J)===-1)throw new Error("unrecognized character "+J+" in "+w);B[B.length]={t:"t",v:J},++j;break}var ee=0,Ce=0,Me;for(j=B.length-1,xe="t";j>=0;--j)switch(B[j].t){case"h":case"H":B[j].t=Re,xe="h",ee<1&&(ee=1);break;case"s":(Me=B[j].v.match(/\.0+$/))&&(Ce=Math.max(Ce,Me[0].length-1)),ee<3&&(ee=3);case"d":case"y":case"M":case"e":xe=B[j].t;break;case"m":xe==="s"&&(B[j].t="M",ee<2&&(ee=2));break;case"X":break;case"Z":ee<1&&B[j].v.match(/[Hh]/)&&(ee=1),ee<2&&B[j].v.match(/[Mm]/)&&(ee=2),ee<3&&B[j].v.match(/[Ss]/)&&(ee=3)}switch(ee){case 0:break;case 1:oe.u>=.5&&(oe.u=0,++oe.S),oe.S>=60&&(oe.S=0,++oe.M),oe.M>=60&&(oe.M=0,++oe.H);break;case 2:oe.u>=.5&&(oe.u=0,++oe.S),oe.S>=60&&(oe.S=0,++oe.M);break}var Pe="",U;for(j=0;j<B.length;++j)switch(B[j].t){case"t":case"T":case" ":case"D":break;case"X":B[j].v="",B[j].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":B[j].v=ue(B[j].t.charCodeAt(0),B[j].v,oe,Ce),B[j].t="t";break;case"n":case"?":for(U=j+1;B[U]!=null&&((J=B[U].t)==="?"||J==="D"||(J===" "||J==="t")&&B[U+1]!=null&&(B[U+1].t==="?"||B[U+1].t==="t"&&B[U+1].v==="/")||B[j].t==="("&&(J===" "||J==="n"||J===")")||J==="t"&&(B[U].v==="/"||B[U].v===" "&&B[U+1]!=null&&B[U+1].t=="?"));)B[j].v+=B[U].v,B[U]={v:"",t:";"},++U;Pe+=B[j].v,j=U-1;break;case"G":B[j].t="t",B[j].v=X($,M);break}var ne="",V,se;if(Pe.length>0){Pe.charCodeAt(0)==40?(V=$<0&&Pe.charCodeAt(0)===45?-$:$,se=pe("n",Pe,V)):(V=$<0&&Q>1?-$:$,se=pe("n",Pe,V),V<0&&B[0]&&B[0].t=="t"&&(se=se.substr(1),B[0].v="-"+B[0].v)),U=se.length-1;var Te=B.length;for(j=0;j<B.length;++j)if(B[j]!=null&&B[j].t!="t"&&B[j].v.indexOf(".")>-1){Te=j;break}var K=B.length;if(Te===B.length&&se.indexOf("E")===-1){for(j=B.length-1;j>=0;--j)B[j]==null||"n?".indexOf(B[j].t)===-1||(U>=B[j].v.length-1?(U-=B[j].v.length,B[j].v=se.substr(U+1,B[j].v.length)):U<0?B[j].v="":(B[j].v=se.substr(0,U+1),U=-1),B[j].t="t",K=j);U>=0&&K<B.length&&(B[K].v=se.substr(0,U+1)+B[K].v)}else if(Te!==B.length&&se.indexOf("E")===-1){for(U=se.indexOf(".")-1,j=Te;j>=0;--j)if(!(B[j]==null||"n?".indexOf(B[j].t)===-1)){for(Z=B[j].v.indexOf(".")>-1&&j===Te?B[j].v.indexOf(".")-1:B[j].v.length-1,ne=B[j].v.substr(Z+1);Z>=0;--Z)U>=0&&(B[j].v.charAt(Z)==="0"||B[j].v.charAt(Z)==="#")&&(ne=se.charAt(U--)+ne);B[j].v=ne,B[j].t="t",K=j}for(U>=0&&K<B.length&&(B[K].v=se.substr(0,U+1)+B[K].v),U=se.indexOf(".")+1,j=Te;j<B.length;++j)if(!(B[j]==null||"n?(".indexOf(B[j].t)===-1&&j!==Te)){for(Z=B[j].v.indexOf(".")>-1&&j===Te?B[j].v.indexOf(".")+1:0,ne=B[j].v.substr(0,Z);Z<B[j].v.length;++Z)U<se.length&&(ne+=se.charAt(U++));B[j].v=ne,B[j].t="t",K=j}}}for(j=0;j<B.length;++j)B[j]!=null&&"n?".indexOf(B[j].t)>-1&&(V=Q>1&&$<0&&j>0&&B[j-1].v==="-"?-$:$,B[j].v=pe(B[j].t,B[j].v,V),B[j].t="t");var de="";for(j=0;j!==B.length;++j)B[j]!=null&&(de+=B[j].v);return de}i._eval=ie;var D=/\[[=<>]/,R=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function O(w,$){if($==null)return!1;var M=parseFloat($[2]);switch($[1]){case"=":if(w==M)return!0;break;case">":if(w>M)return!0;break;case"<":if(w<M)return!0;break;case"<>":if(w!=M)return!0;break;case">=":if(w>=M)return!0;break;case"<=":if(w<=M)return!0;break}return!1}function k(w,$){var M=ae(w),Q=M.length,B=M[Q-1].indexOf("@");if(Q<4&&B>-1&&--Q,M.length>4)throw new Error("cannot find right format for |"+M.join("|")+"|");if(typeof $!="number")return[4,M.length===4||B>-1?M[M.length-1]:"@"];switch(M.length){case 1:M=B>-1?["General","General","General",M[0]]:[M[0],M[0],M[0],"@"];break;case 2:M=B>-1?[M[0],M[0],M[0],M[1]]:[M[0],M[1],M[0],"@"];break;case 3:M=B>-1?[M[0],M[1],M[0],M[2]]:[M[0],M[1],M[2],"@"];break}var z=$>0?M[0]:$<0?M[1]:M[2];if(M[0].indexOf("[")===-1&&M[1].indexOf("[")===-1)return[Q,z];if(M[0].match(D)!=null||M[1].match(D)!=null){var j=M[0].match(R),J=M[1].match(R);return O($,j)?[Q,M[0]]:O($,J)?[Q,M[1]]:[Q,M[j!=null&&J!=null?2:1]]}return[Q,z]}function W(w,$,M){M==null&&(M={});var Q="";switch(typeof w){case"string":w=="m/d/yy"&&M.dateNF?Q=M.dateNF:Q=w;break;case"number":w==14&&M.dateNF?Q=M.dateNF:Q=(M.table!=null?M.table:E)[w],Q==null&&(Q=M.table&&M.table[A[w]]||E[A[w]]),Q==null&&(Q=_[w]||"General");break}if(p(Q,0))return X($,M);$ instanceof Date&&($=I($,M.date1904));var B=k(Q,$);if(p(B[1]))return X($,M);if($===!0)$="TRUE";else if($===!1)$="FALSE";else if($===""||$==null)return"";return ie(B[1],$,M,B[0])}function H(w,$){if(typeof $!="number"){$=+$||-1;for(var M=0;M<392;++M){if(E[M]==null){$<0&&($=M);continue}if(E[M]==w){$=M;break}}$<0&&($=391)}return E[$]=w,$}i.load=H,i._table=E,i.get_table=function(){return E},i.load_table=function($){for(var M=0;M!=392;++M)$[M]!==void 0&&H($[M],M)},i.init_table=y,i.format=W};n(e),typeof DO_NOT_EXPORT_SSF>"u"&&(t.exports=e)})(KW);var K5=KW.exports;function iDe(t,e,n,r){var i=-1,s=t==null?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}var sDe=iDe;function oDe(t){return function(e){return t==null?void 0:t[e]}}var uDe=oDe,aDe=uDe,lDe={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},cDe=aDe(lDe),fDe=cDe,xDe=typeof T=="object"&&T&&T.Object===Object&&T,dDe=xDe,hDe=dDe,pDe=typeof self=="object"&&self&&self.Object===Object&&self,gDe=hDe||pDe||Function("return this")(),mDe=gDe,yDe=mDe,EDe=yDe.Symbol,xw=EDe;function ADe(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var vDe=ADe,_De=Array.isArray,SDe=_De,JW=xw,XW=Object.prototype,CDe=XW.hasOwnProperty,bDe=XW.toString,xm=JW?JW.toStringTag:void 0;function TDe(t){var e=CDe.call(t,xm),n=t[xm];try{t[xm]=void 0;var r=!0}catch{}var i=bDe.call(t);return r&&(e?t[xm]=n:delete t[xm]),i}var RDe=TDe,ODe=Object.prototype,DDe=ODe.toString;function wDe(t){return DDe.call(t)}var NDe=wDe,ZW=xw,FDe=RDe,LDe=NDe,IDe="[object Null]",BDe="[object Undefined]",eV=ZW?ZW.toStringTag:void 0;function $De(t){return t==null?t===void 0?BDe:IDe:eV&&eV in Object(t)?FDe(t):LDe(t)}var kDe=$De;function PDe(t){return t!=null&&typeof t=="object"}var MDe=PDe,jDe=kDe,UDe=MDe,qDe="[object Symbol]";function HDe(t){return typeof t=="symbol"||UDe(t)&&jDe(t)==qDe}var zDe=HDe,tV=xw,QDe=vDe,GDe=SDe,WDe=zDe,VDe=1/0,nV=tV?tV.prototype:void 0,rV=nV?nV.toString:void 0;function iV(t){if(typeof t=="string")return t;if(GDe(t))return QDe(t,iV)+"";if(WDe(t))return rV?rV.call(t):"";var e=t+"";return e=="0"&&1/t==-VDe?"-0":e}var YDe=iV,KDe=YDe;function JDe(t){return t==null?"":KDe(t)}var dw=JDe,XDe=fDe,ZDe=dw,e7e=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,t7e="\\u0300-\\u036f",n7e="\\ufe20-\\ufe2f",r7e="\\u20d0-\\u20ff",i7e=t7e+n7e+r7e,s7e="["+i7e+"]",o7e=RegExp(s7e,"g");function u7e(t){return t=ZDe(t),t&&t.replace(e7e,XDe).replace(o7e,"")}var a7e=u7e,l7e=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function c7e(t){return t.match(l7e)||[]}var f7e=c7e,x7e=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function d7e(t){return x7e.test(t)}var h7e=d7e,sV="\\ud800-\\udfff",p7e="\\u0300-\\u036f",g7e="\\ufe20-\\ufe2f",m7e="\\u20d0-\\u20ff",y7e=p7e+g7e+m7e,oV="\\u2700-\\u27bf",uV="a-z\\xdf-\\xf6\\xf8-\\xff",E7e="\\xac\\xb1\\xd7\\xf7",A7e="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",v7e="\\u2000-\\u206f",_7e=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",aV="A-Z\\xc0-\\xd6\\xd8-\\xde",S7e="\\ufe0e\\ufe0f",lV=E7e+A7e+v7e+_7e,cV="['’]",fV="["+lV+"]",C7e="["+y7e+"]",xV="\\d+",b7e="["+oV+"]",dV="["+uV+"]",hV="[^"+sV+lV+xV+oV+uV+aV+"]",T7e="\\ud83c[\\udffb-\\udfff]",R7e="(?:"+C7e+"|"+T7e+")",O7e="[^"+sV+"]",pV="(?:\\ud83c[\\udde6-\\uddff]){2}",gV="[\\ud800-\\udbff][\\udc00-\\udfff]",Nh="["+aV+"]",D7e="\\u200d",mV="(?:"+dV+"|"+hV+")",w7e="(?:"+Nh+"|"+hV+")",yV="(?:"+cV+"(?:d|ll|m|re|s|t|ve))?",EV="(?:"+cV+"(?:D|LL|M|RE|S|T|VE))?",AV=R7e+"?",vV="["+S7e+"]?",N7e="(?:"+D7e+"(?:"+[O7e,pV,gV].join("|")+")"+vV+AV+")*",F7e="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",L7e="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",I7e=vV+AV+N7e,B7e="(?:"+[b7e,pV,gV].join("|")+")"+I7e,$7e=RegExp([Nh+"?"+dV+"+"+yV+"(?="+[fV,Nh,"$"].join("|")+")",w7e+"+"+EV+"(?="+[fV,Nh+mV,"$"].join("|")+")",Nh+"?"+mV+"+"+yV,Nh+"+"+EV,L7e,F7e,xV,B7e].join("|"),"g");function k7e(t){return t.match($7e)||[]}var P7e=k7e,M7e=f7e,j7e=h7e,U7e=dw,q7e=P7e;function H7e(t,e,n){return t=U7e(t),e=n?void 0:e,e===void 0?j7e(t)?q7e(t):M7e(t):t.match(e)||[]}var z7e=H7e,Q7e=sDe,G7e=a7e,W7e=z7e,V7e="['’]",Y7e=RegExp(V7e,"g");function K7e(t){return function(e){return Q7e(W7e(G7e(e).replace(Y7e,"")),t,"")}}var J7e=K7e;function X7e(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}var Z7e=X7e,ewe=Z7e;function twe(t,e,n){var r=t.length;return n=n===void 0?r:n,!e&&n>=r?t:ewe(t,e,n)}var nwe=twe,rwe="\\ud800-\\udfff",iwe="\\u0300-\\u036f",swe="\\ufe20-\\ufe2f",owe="\\u20d0-\\u20ff",uwe=iwe+swe+owe,awe="\\ufe0e\\ufe0f",lwe="\\u200d",cwe=RegExp("["+lwe+rwe+uwe+awe+"]");function fwe(t){return cwe.test(t)}var _V=fwe;function xwe(t){return t.split("")}var dwe=xwe,SV="\\ud800-\\udfff",hwe="\\u0300-\\u036f",pwe="\\ufe20-\\ufe2f",gwe="\\u20d0-\\u20ff",mwe=hwe+pwe+gwe,ywe="\\ufe0e\\ufe0f",Ewe="["+SV+"]",hw="["+mwe+"]",pw="\\ud83c[\\udffb-\\udfff]",Awe="(?:"+hw+"|"+pw+")",CV="[^"+SV+"]",bV="(?:\\ud83c[\\udde6-\\uddff]){2}",TV="[\\ud800-\\udbff][\\udc00-\\udfff]",vwe="\\u200d",RV=Awe+"?",OV="["+ywe+"]?",_we="(?:"+vwe+"(?:"+[CV,bV,TV].join("|")+")"+OV+RV+")*",Swe=OV+RV+_we,Cwe="(?:"+[CV+hw+"?",hw,bV,TV,Ewe].join("|")+")",bwe=RegExp(pw+"(?="+pw+")|"+Cwe+Swe,"g");function Twe(t){return t.match(bwe)||[]}var Rwe=Twe,Owe=dwe,Dwe=_V,wwe=Rwe;function Nwe(t){return Dwe(t)?wwe(t):Owe(t)}var Fwe=Nwe,Lwe=nwe,Iwe=_V,Bwe=Fwe,$we=dw;function kwe(t){return function(e){e=$we(e);var n=Iwe(e)?Bwe(e):void 0,r=n?n[0]:e.charAt(0),i=n?Lwe(n,1).join(""):e.slice(1);return r[t]()+i}}var Pwe=kwe,Mwe=Pwe,jwe=Mwe("toUpperCase"),Uwe=jwe,qwe=J7e,Hwe=Uwe,zwe=qwe(function(t,e,n){return t+(n?" ":"")+Hwe(e)}),Qwe=zwe;const Gwe=rE(Qwe);function Wa(t,e,n=!1){if(t!==void 0)switch(t){case"ordinal":return{range:["#C2D5EE","#1A73E8"]};case"temporal":case"quantitative":return e?n?{range:["#6BA4EE","#EEA361"]}:{range:["#1A73E8","#E8710A"]}:{range:["#C2D5EE","#1A73E8"]};case"nominal":return n?{range:["#6BA4EE","#66CEDC","#EC72B8","#EEA361","#F9C85B","#AACD85","#B87CED","#ACB0B3"]}:{range:["#1A73E8","#12B5CB","#E52592","#E8710A","#F9AB00","#7CB342","#9334E6","#80868B"]}}}function Wwe(t,e){const n=wAe.fromJSDate(t,{zone:e??"UTC"});return new Date(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond)}function Vwe(t,e){const n=t.createElement("span");return n.classList.add("error"),n.appendChild(t.createTextNode(typeof e=="string"?e:e.message)),n}function Ywe(t){const e=t.createElement("span");return e.appendChild(t.createTextNode("∅")),e.classList.add("value-null"),e}function $f(t,e,n,r){var o;const i=((o=n==null?void 0:n.data)==null?void 0:o.label)||e.name;let s=t.titleCase?Gwe(i):i;return e.isAtomicField()&&(e.isDate()||e.isTimestamp())&&r&&(s=`${s} (${r})`),s}function Kwe(t,e=0){let n=t;for(;e>0&&n.parentRecord;)e-=1,n=n.parentRecord;return n}function Jwe(t){const e=t.split("/"),n=e.filter(i=>i==="..").length+1,r=e.filter(i=>i!==".."&&i!=="");return{levelsUp:n,pathSegments:r}}function DV({tag:t,data:e}){var n;try{const r=((n=t.tag("field"))==null?void 0:n.text())??"",{levelsUp:i,pathSegments:s}=Jwe(r);let o=Kwe(e,i);for(;s.length>0&&"cell"in o;){const u=s.shift();o=o.cell(u)}return o==null?void 0:o.value}catch{return}}class kf{constructor(){this.tagOptionExtractors={}}addExtractor(e,...n){for(const r in n)this.tagOptionExtractors[n[r]]=e}activates(e){return!1}isValidMatch(e){return!0}matches(e){return e.renderer===this.rendererName}parseTagParameters(e){const n={};for(const r in this.tagOptionExtractors){const i=e.tag(r);i&&this.tagOptionExtractors[r](n,i)}return n}}class wV{constructor(e){this.document=e}getText(e){return e.value===null?null:`${e.value}`}async render(e){let n=null;try{n=this.getText(e)}catch(i){return Vwe(this.document,i)}if(n===null)return Ywe(this.document);const r=this.document.createElement("span");return r.appendChild(this.document.createTextNode(n)),r}}const BT=class BT extends kf{activates(e){return e.hasParentExplore()&&!e.isExploreField()}create(e,n,r,i,s){return new wV(e)}get rendererName(){}};BT.instance=new BT;let NV=BT;function FV(t,e,n={}){let r=e.toString();return n.terse?r=Xwe.get(e)??r:t===1&&(r=r.substring(0,r.length-1)),`${n.numFormat?K5.format(n.numFormat,t):t.toLocaleString()}${n.terse?"":" "}${r}`}const Xwe=new Map([[Hn.Nanoseconds,"ns"],[Hn.Microseconds,"µs"],[Hn.Milliseconds,"ms"],[Hn.Seconds,"s"],[Hn.Minutes,"m"],[Hn.Hours,"h"],[Hn.Days,"d"]]),Zwe=new Map([[Hn.Nanoseconds,1e3],[Hn.Microseconds,1e3],[Hn.Milliseconds,1e3],[Hn.Seconds,60],[Hn.Minutes,60],[Hn.Hours,24],[Hn.Days,Number.MAX_VALUE]]);function LV(t,e,n){const r=n.durationUnit&&rDe(n.durationUnit)?n.durationUnit:Hn.Seconds,i=t.tagParse().tag,s=i.text("number"),o=i.has("duration","terse");let u=e,a=0,l=[],c=!1;for(const[f,x]of Zwe)if(f===r&&(c=!0),!!c&&(a=u%x,u=Math.floor(u/=x),a>0&&(l=[FV(a,f,{numFormat:s,terse:o}),...l]),u===0))break;return l.length>0?l.slice(0,2).join(" "):FV(0,r,{numFormat:s,terse:o})}class eNe extends wV{constructor(e,n){super(e),this.options=n}getText(e){if(e.isNull())return null;if(!e.isNumber())throw new Error(`Cannot format field ${e.field.name} as a duration unit since its not a number`);return LV(e.field,e.number.value,{durationUnit:this.options.duration_unit})}}const $T=class $T extends kf{constructor(){super(),this.addExtractor((e,n)=>{e.duration_unit=(n==null?void 0:n.text())??Hn.Seconds},this.rendererName)}create(e,n,r,i,s){return new eNe(e,s)}get rendererName(){return"duration"}};$T.instance=new $T;let IV=$T;function Fh(t,e){let n=e;const{tag:r}=t.tagParse();if(r.has("currency")){let i="$";switch(r.text("currency")){case Y5.Euros:i="€";break;case Y5.Pounds:i="£";break;case Y5.Dollars:break}n=K5.format(`${i}#,##0.00`,e)}else if(r.has("percent"))n=K5.format("#,##0.00%",e);else if(r.has("duration")){const s=r.text("duration")??Hn.Seconds;return LV(t,e,{durationUnit:s})??e.toLocaleString()}else r.has("number")?n=K5.format(r.text("number")??"#",e):n=e.toLocaleString();return n}var tNe=yt("<a target=_blank>");function nNe(t,e){const{tag:n}=t.tagParse();if(e.isNull())return"∅";const r=String(e.value),i=n.tag("link");if(!i)throw new Error("Missing tag for Link renderer");const s=DV({tag:i,data:e})??r,o=i.text("url_template");let u=s;o&&(o.indexOf("$$")>-1?u=o.replace("$$",s):u=o+s);const a=r.replace(/\//g,"/‌");return(()=>{var l=tNe();return Zi(l,"href",u),Je(l,a),l})()}function gs(t,e,n){return t.fields=e||[],t.fname=n,t}function wn(t){return t==null?null:t.fname}function oi(t){return t==null?null:t.fields}function BV(t){return t.length===1?rNe(t[0]):iNe(t)}const rNe=t=>function(e){return e[t]},iNe=t=>{const e=t.length;return function(n){for(let r=0;r<e;++r)n=n[t[r]];return n}};function _e(t){throw Error(t)}function Va(t){const e=[],n=t.length;let r=null,i=0,s="",o,u,a;t=t+"";function l(){e.push(s+t.substring(o,u)),s="",o=u+1}for(o=u=0;u<n;++u)if(a=t[u],a==="\\")s+=t.substring(o,u),s+=t.substring(++u,++u),o=u;else if(a===r)l(),r=null,i=-1;else{if(r)continue;o===i&&a==='"'||o===i&&a==="'"?(o=u+1,r=a):a==="."&&!i?u>o?l():o=u+1:a==="["?(u>o&&l(),i=o=u+1):a==="]"&&(i||_e("Access path missing open bracket: "+t),i>0&&l(),i=0,o=u+1)}return i&&_e("Access path missing closing bracket: "+t),r&&_e("Access path missing closing quote: "+t),u>o&&(u++,l()),e}function ms(t,e,n){const r=Va(t);return t=r.length===1?r[0]:t,gs((n&&n.get||BV)(r),[t],e||t)}const J5=ms("id"),ui=gs(t=>t,[],"identity"),Pf=gs(()=>0,[],"zero"),dm=gs(()=>1,[],"one"),Fo=gs(()=>!0,[],"true"),Mf=gs(()=>!1,[],"false");function sNe(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}const oNe=0,$V=1,kV=2,uNe=3,aNe=4;function PV(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:sNe,r=t||oNe;return{level(i){return arguments.length?(r=+i,this):r},error(){return r>=$V&&n("error","ERROR",arguments),this},warn(){return r>=kV&&n("warn","WARN",arguments),this},info(){return r>=uNe&&n("log","INFO",arguments),this},debug(){return r>=aNe&&n("log","DEBUG",arguments),this}}}var Se=Array.isArray;function ze(t){return t===Object(t)}const MV=t=>t!=="__proto__";function gw(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce((r,i)=>{for(const s in i)if(s==="signals")r.signals=lNe(r.signals,i.signals);else{const o=s==="legend"?{layout:1}:s==="style"?!0:null;X5(r,s,i[s],o)}return r},{})}function X5(t,e,n,r){if(!MV(e))return;let i,s;if(ze(n)&&!Se(n)){s=ze(t[e])?t[e]:t[e]={};for(i in n)r&&(r===!0||r[i])?X5(s,i,n[i]):MV(i)&&(s[i]=n[i])}else t[e]=n}function lNe(t,e){if(t==null)return e;const n={},r=[];function i(s){n[s.name]||(n[s.name]=1,r.push(s))}return e.forEach(i),t.forEach(i),r}function Rt(t){return t[t.length-1]}function ai(t){return t==null||t===""?null:+t}const jV=t=>e=>t*Math.exp(e),UV=t=>e=>Math.log(t*e),qV=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),HV=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,Z5=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function eS(t,e,n,r){const i=n(t[0]),s=n(Rt(t)),o=(s-i)*e;return[r(i-o),r(s-o)]}function cNe(t,e){return eS(t,e,ai,ui)}function fNe(t,e){var n=Math.sign(t[0]);return eS(t,e,UV(n),jV(n))}function xNe(t,e,n){return eS(t,e,Z5(n),Z5(1/n))}function dNe(t,e,n){return eS(t,e,qV(n),HV(n))}function tS(t,e,n,r,i){const s=r(t[0]),o=r(Rt(t)),u=e!=null?r(e):(s+o)/2;return[i(u+(s-u)*n),i(u+(o-u)*n)]}function zV(t,e,n){return tS(t,e,n,ai,ui)}function QV(t,e,n){const r=Math.sign(t[0]);return tS(t,e,n,UV(r),jV(r))}function mw(t,e,n,r){return tS(t,e,n,Z5(r),Z5(1/r))}function GV(t,e,n,r){return tS(t,e,n,qV(r),HV(r))}function hNe(t){return 1+~~(new Date(t).getMonth()/3)}function pNe(t){return 1+~~(new Date(t).getUTCMonth()/3)}function Ue(t){return t!=null?Se(t)?t:[t]:[]}function gNe(t,e,n){let r=t[0],i=t[1],s;return i<r&&(s=i,i=r,r=s),s=i-r,s>=n-e?[e,n]:[r=Math.min(Math.max(r,e),n-s),r+s]}function pt(t){return typeof t=="function"}const mNe="descending";function WV(t,e,n){n=n||{},e=Ue(e)||[];const r=[],i=[],s={},o=n.comparator||yNe;return Ue(t).forEach((u,a)=>{u!=null&&(r.push(e[a]===mNe?-1:1),i.push(u=pt(u)?u:ms(u,null,n)),(oi(u)||[]).forEach(l=>s[l]=1))}),i.length===0?null:gs(o(i,r),Object.keys(s))}const yw=(t,e)=>(t<e||t==null)&&e!=null?-1:(t>e||e==null)&&t!=null?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e===e?-1:e!==e&&t===t?1:0),yNe=(t,e)=>t.length===1?ENe(t[0],e[0]):ANe(t,e,t.length),ENe=(t,e)=>function(n,r){return yw(t(n),t(r))*e},ANe=(t,e,n)=>(e.push(0),function(r,i){let s,o=0,u=-1;for(;o===0&&++u<n;)s=t[u],o=yw(s(r),s(i));return o*e[u]});function li(t){return pt(t)?t:()=>t}function VV(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(e(r),n=null),t)}}function gt(t){for(let e,n,r=1,i=arguments.length;r<i;++r){e=arguments[r];for(n in e)t[n]=e[n]}return t}function Ya(t,e){let n=0,r,i,s,o;if(t&&(r=t.length))if(e==null){for(i=t[n];n<r&&(i==null||i!==i);i=t[++n]);for(s=o=i;n<r;++n)i=t[n],i!=null&&(i<s&&(s=i),i>o&&(o=i))}else{for(i=e(t[n]);n<r&&(i==null||i!==i);i=e(t[++n]));for(s=o=i;n<r;++n)i=e(t[n]),i!=null&&(i<s&&(s=i),i>o&&(o=i))}return[s,o]}function vNe(t,e){const n=t.length;let r=-1,i,s,o,u,a;if(e==null){for(;++r<n;)if(s=t[r],s!=null&&s>=s){i=o=s;break}if(r===n)return[-1,-1];for(u=a=r;++r<n;)s=t[r],s!=null&&(i>s&&(i=s,u=r),o<s&&(o=s,a=r))}else{for(;++r<n;)if(s=e(t[r],r,t),s!=null&&s>=s){i=o=s;break}if(r===n)return[-1,-1];for(u=a=r;++r<n;)s=e(t[r],r,t),s!=null&&(i>s&&(i=s,u=r),o<s&&(o=s,a=r))}return[u,a]}const _Ne=Object.prototype.hasOwnProperty;function tt(t,e){return _Ne.call(t,e)}const nS={};function hm(t){let e={},n;function r(s){return tt(e,s)&&e[s]!==nS}const i={size:0,empty:0,object:e,has:r,get(s){return r(s)?e[s]:void 0},set(s,o){return r(s)||(++i.size,e[s]===nS&&--i.empty),e[s]=o,this},delete(s){return r(s)&&(--i.size,++i.empty,e[s]=nS),this},clear(){i.size=i.empty=0,i.object=e={}},test(s){return arguments.length?(n=s,i):n},clean(){const s={};let o=0;for(const u in e){const a=e[u];a!==nS&&(!n||!n(a))&&(s[u]=a,++o)}i.size=o,i.empty=0,i.object=e=s}};return t&&Object.keys(t).forEach(s=>{i.set(s,t[s])}),i}function SNe(t,e,n,r,i,s){if(!n&&n!==0)return s;const o=+n;let u=t[0],a=Rt(t),l;a<u&&(l=u,u=a,a=l),l=Math.abs(e-u);const c=Math.abs(a-e);return l<c&&l<=o?r:c<=o?i:s}function Ne(t,e,n){const r=t.prototype=Object.create(e.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),gt(r,n)}function pm(t,e,n,r){let i=e[0],s=e[e.length-1],o;return i>s&&(o=i,i=s,s=o),n=n===void 0||n,r=r===void 0||r,(n?i<=t:i<t)&&(r?t<=s:t<s)}function Lh(t){return typeof t=="boolean"}function jf(t){return Object.prototype.toString.call(t)==="[object Date]"}function CNe(t){return t&&pt(t[Symbol.iterator])}function on(t){return typeof t=="number"}function bNe(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function qe(t){return typeof t=="string"}function YV(t,e,n){t&&(t=e?Ue(t).map(u=>u.replace(/\\(.)/g,"$1")):Ue(t));const r=t&&t.length,i=n&&n.get||BV,s=u=>i(e?[u]:Va(u));let o;if(!r)o=function(){return""};else if(r===1){const u=s(t[0]);o=function(a){return""+u(a)}}else{const u=t.map(s);o=function(a){let l=""+u[0](a),c=0;for(;++c<r;)l+="|"+u[c](a);return l}}return gs(o,t,"key")}function TNe(t,e){const n=t[0],r=Rt(t),i=+e;return i?i===1?r:n+i*(r-n):n}const RNe=1e4;function ONe(t){t=+t||RNe;let e,n,r;const i=()=>{e={},n={},r=0},s=(o,u)=>(++r>t&&(n=e,e={},r=1),e[o]=u);return i(),{clear:i,has:o=>tt(e,o)||tt(n,o),get:o=>tt(e,o)?e[o]:tt(n,o)?s(o,n[o]):void 0,set:(o,u)=>tt(e,o)?e[o]=u:s(o,u)}}function DNe(t,e,n,r){const i=e.length,s=n.length;if(!s)return e;if(!i)return n;const o=r||new e.constructor(i+s);let u=0,a=0,l=0;for(;u<i&&a<s;++l)o[l]=t(e[u],n[a])>0?n[a++]:e[u++];for(;u<i;++u,++l)o[l]=e[u];for(;a<s;++a,++l)o[l]=n[a];return o}function rS(t,e){let n="";for(;--e>=0;)n+=t;return n}function wNe(t,e,n,r){const i=n||" ",s=t+"",o=e-s.length;return o<=0?s:r==="left"?rS(i,o)+s:r==="center"?rS(i,~~(o/2))+s+rS(i,Math.ceil(o/2)):s+rS(i,o)}function iS(t){return t&&Rt(t)-t[0]||0}function Fe(t){return Se(t)?"["+t.map(Fe)+"]":ze(t)||qe(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function KV(t){return t==null||t===""?null:!t||t==="false"||t==="0"?!1:!!t}const NNe=t=>on(t)||jf(t)?t:Date.parse(t);function JV(t,e){return e=e||NNe,t==null||t===""?null:e(t)}function XV(t){return t==null||t===""?null:t+""}function Bu(t){const e={},n=t.length;for(let r=0;r<n;++r)e[t[r]]=!0;return e}function FNe(t,e,n,r){const i=r??"…",s=t+"",o=s.length,u=Math.max(0,e-i.length);return o<=e?s:n==="left"?i+s.slice(o-u):n==="center"?s.slice(0,Math.ceil(u/2))+i+s.slice(o-~~(u/2)):s.slice(0,u)+i}function Uf(t,e,n){if(t)if(e){const r=t.length;for(let i=0;i<r;++i){const s=e(t[i]);s&&n(s,i,t)}}else t.forEach(n)}var ZV={},Ew={},Aw=34,gm=10,vw=13;function eY(t){return new Function("d","return {"+t.map(function(e,n){return JSON.stringify(e)+": d["+n+'] || ""'}).join(",")+"}")}function LNe(t,e){var n=eY(t);return function(r,i){return e(n(r),i,t)}}function tY(t){var e=Object.create(null),n=[];return t.forEach(function(r){for(var i in r)i in e||n.push(e[i]=i)}),n}function Bi(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function INe(t){return t<0?"-"+Bi(-t,6):t>9999?"+"+Bi(t,6):Bi(t,4)}function BNe(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":INe(t.getUTCFullYear())+"-"+Bi(t.getUTCMonth()+1,2)+"-"+Bi(t.getUTCDate(),2)+(i?"T"+Bi(e,2)+":"+Bi(n,2)+":"+Bi(r,2)+"."+Bi(i,3)+"Z":r?"T"+Bi(e,2)+":"+Bi(n,2)+":"+Bi(r,2)+"Z":n||e?"T"+Bi(e,2)+":"+Bi(n,2)+"Z":"")}function $Ne(t){var e=new RegExp('["'+t+`
1292
1292
  \r]`),n=t.charCodeAt(0);function r(f,x){var h,p,m=i(f,function(g,y){if(h)return h(g,y-1);p=g,h=x?LNe(g,x):eY(g)});return m.columns=p||[],m}function i(f,x){var h=[],p=f.length,m=0,g=0,y,E=p<=0,A=!1;f.charCodeAt(p-1)===gm&&--p,f.charCodeAt(p-1)===vw&&--p;function v(){if(E)return Ew;if(A)return A=!1,ZV;var S,C=m,b;if(f.charCodeAt(C)===Aw){for(;m++<p&&f.charCodeAt(m)!==Aw||f.charCodeAt(++m)===Aw;);return(S=m)>=p?E=!0:(b=f.charCodeAt(m++))===gm?A=!0:b===vw&&(A=!0,f.charCodeAt(m)===gm&&++m),f.slice(C+1,S-1).replace(/""/g,'"')}for(;m<p;){if((b=f.charCodeAt(S=m++))===gm)A=!0;else if(b===vw)A=!0,f.charCodeAt(m)===gm&&++m;else if(b!==n)continue;return f.slice(C,S)}return E=!0,f.slice(C,p)}for(;(y=v())!==Ew;){for(var _=[];y!==ZV&&y!==Ew;)_.push(y),y=v();x&&(_=x(_,g++))==null||h.push(_)}return h}function s(f,x){return f.map(function(h){return x.map(function(p){return c(h[p])}).join(t)})}function o(f,x){return x==null&&(x=tY(f)),[x.map(c).join(t)].concat(s(f,x)).join(`
1293
1293
  `)}function u(f,x){return x==null&&(x=tY(f)),s(f,x).join(`
1294
1294
  `)}function a(f){return f.map(l).join(`
@@ -55496,7 +55496,7 @@ Eh.exploreQueryWalkerBuilder = zOe;
55496
55496
  var we = {}, Q4 = {};
55497
55497
  Object.defineProperty(Q4, "__esModule", { value: !0 });
55498
55498
  Q4.MALLOY_VERSION = void 0;
55499
- Q4.MALLOY_VERSION = "0.0.231";
55499
+ Q4.MALLOY_VERSION = "0.0.232";
55500
55500
  Object.defineProperty(we, "__esModule", { value: !0 });
55501
55501
  we.CSVWriter = we.JSONWriter = we.DataWriter = we.DataRecord = we.DataArray = we.Result = we.ExploreMaterializer = we.PreparedResultMaterializer = we.QueryMaterializer = we.ModelMaterializer = we.SingleConnectionRuntime = we.ConnectionRuntime = we.Runtime = we.ExploreField = we.JoinRelationship = we.QueryField = we.Query = we.StringField = we.UnsupportedField = we.JSONField = we.BooleanField = we.NumberField = we.TimestampField = we.DateField = we.TimestampTimeframe = we.DateTimeframe = we.AtomicField = we.AtomicFieldType = we.Explore = we.SourceRelationship = we.FixedConnectionMap = we.InMemoryURLReader = we.EmptyURLReader = we.PreparedResult = we.DocumentCompletion = we.DocumentSymbol = we.DocumentPosition = we.DocumentRange = we.DocumentTablePath = we.Parse = we.PreparedQuery = we.Model = we.MalloyError = we.Malloy = void 0;
55502
55502
  const QOe = ZN, nr = Cs, rU = Ti, Sn = Mo, AR = t2, GOe = Q4;
@@ -59583,7 +59583,7 @@ function vh(t, e) {
59583
59583
  const s = r.text("duration") ?? qn.Seconds;
59584
59584
  return zZ(t, e, { durationUnit: s }) ?? e.toLocaleString();
59585
59585
  } else
59586
- r.has("number") ? n = gA.format(r.text("number"), e) : n = e.toLocaleString();
59586
+ r.has("number") ? n = gA.format(r.text("number") ?? "#", e) : n = e.toLocaleString();
59587
59587
  return n;
59588
59588
  }
59589
59589
  var rNe = /* @__PURE__ */ Et("<a target=_blank>");
@@ -1266,7 +1266,7 @@ QUERY: ${(0,WQ.inspect)(n,{breakLength:72,depth:1/0})}`)}return VQ.ErrorFactory.
1266
1266
  | ${l}`,u>0&&(i=i+`
1267
1267
  | ${" ".repeat(u)}^`)}else i=`line ${o+1}: char ${u}: ${r.message}`}n!==s&&(i=`FILE: ${s}
1268
1268
  `+i,n=s),e!==""?e=`${e}
1269
- ${i}`:e=i}return e}childRequest(e){var n;const r=decodeURI(new URL(e,this.sourceURL).toString()),i=(n=this.childTranslators.get(r))===null||n===void 0?void 0:n.translate();if(i!=null&&i.compileSQL)return{compileSQL:i.compileSQL,partialModel:i.partialModel}}getChildExports(e){const n={},r=decodeURI(new URL(e,this.sourceURL).toString()),i=this.childTranslators.get(r);if(i&&i.translate().modelDef)for(const o of i.modelDef.exports){const u=i.modelDef.contents[o];((0,yOe.isSourceDef)(u)||u.type==="query")&&(n[o]=u)}return n}translate(e){if(this.finalAnswer)return this.finalAnswer;const n=this.translateStep.step(this,e);return n.final&&(this.finalAnswer=n),n}translatorForDependency(e){return this.childTranslators.get(e)}importAt(e){for(let n=0;n<this.imports.length;n++){const r=this.imports[n];if((0,ROe.locationContainsPosition)(r.location,e))return r}}metadata(){return this.metadataStep.step(this)}modelAnnotation(e){return this.modelAnnotationStep.step(this,e)}tablePathInfo(){return this.tablePathInfoStep.step(this)}completions(e){return this.completionsStep.step(this,e)}helpContext(e){return this.helpContextStep.step(this,e)}defaultLocation(){return{url:this.sourceURL,range:{start:{line:0,character:0},end:{line:0,character:0}}}}rangeFromContext(e){return this.rangeFromTokens(e.start,e.stop||e.start)}rangeFromTokens(e,n){const r={line:e.line-1,character:e.charPositionInLine};if(this.parseStep.sourceInfo&&n.stopIndex!==-1){const i=this.parseStep.sourceInfo.lines.length-1;for(let s=e.line-1;s<=i;s++){const o=this.parseStep.sourceInfo.at[s];if(n.stopIndex>=o.begin&&n.stopIndex<o.end)return{start:r,end:{line:s,character:n.stopIndex-o.begin+1}}}return{start:r,end:{line:i,character:this.parseStep.sourceInfo.lines[i].length}}}return{start:r,end:r}}rangeFromToken(e){return this.rangeFromTokens(e,e)}firstReferenceToDialect(e){return this.dialectAlreadyChecked[e]?!1:(this.dialectAlreadyChecked[e]=!0,!0)}experimentalDialectEnabled(e){if(this.allDialectsEnabled)return!0;const n=this.compilerFlags.tag("experimental");return n!==void 0&&(n.bare()||n.has("dialect",e))}}Au.MalloyTranslation=Y7;class AW extends Y7{constructor(e,n){super(e),this.root=n}}Au.MalloyChildTranslator=AW;class jOe extends Y7{constructor(e,n=null,r=null,i=null){super(e,n),this.eventStream=i,this.schemaZone=new V7.Zone,this.importZone=new V7.Zone,this.pretranslatedModels=new Map,this.sqlQueryZone=new V7.Zone,this.root=this,this.logger=new W7.BaseMessageLogger(i),r&&this.update(r)}update(e){var n,r,i;this.schemaZone.updateFrom(e.tables,(n=e.errors)===null||n===void 0?void 0:n.tables),this.importZone.updateFrom(e.urls,(r=e.errors)===null||r===void 0?void 0:r.urls),this.sqlQueryZone.updateFrom(e.compileSQL,(i=e.errors)===null||i===void 0?void 0:i.compileSQL);for(const s in e.translations)this.pretranslatedModels.set(s,e.translations[s])}logError(e,n,r){return this.logger.log((0,W7.makeLogMessage)(e,n,{severity:"error",...r})),e}}Au.MalloyTranslator=jOe;class vW{constructor(e,n){this.translator=e,this.messages=n}logError(e,n,r){return this.messages.log((0,W7.makeLogMessage)(e,n,{severity:"error",...r})),e}syntaxError(e,n,r,i,s,o){const u={line:r-1,character:i},a=n?this.translator.rangeFromToken(n):{start:u,end:u};this.logError("syntax-error",{message:s},{at:{url:this.translator.sourceURL,range:a}})}}Au.MalloyParserErrorHandler=vW;function _W(t){return[...Object.keys(t),...Object.keys(t).map(e=>_W(t[e])).flat()]}var Rh={};Object.defineProperty(Rh,"__esModule",{value:!0}),Rh.exploreQueryWalkerBuilder=Rh.ExploreQueryWalker=void 0;const UOe=Gl;class SW{constructor(e){this.inDocument=!1,this.exploreClauseRefs=[],this.tokens=e}exploreQueryAtOffset(e){return this.exploreClauseRefs.find(n=>n.range[0]===void 0||n.range[1]===void 0?!1:n.range[0]<=e&&n.range[1]>=e)}filterAtOffset(e){const n=this.exploreQueryAtOffset(e);if(n)return n.filterRefs.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e)}hasFilterListAtOffset(e){const n=this.exploreQueryAtOffset(e);return n?!!n.filterLists.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e):!1}enterMalloyDocument(){this.inDocument=!0}}Rh.ExploreQueryWalker=SW;function qOe(t,e){const n=new SW(t),r=n;return UOe.ParseTreeWalker.DEFAULT.walk(r,e),n}Rh.exploreQueryWalkerBuilder=qOe,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.exploreQueryWalkerBuilder=t.MalloyTranslation=t.MalloyTranslator=void 0;var e=Au;Object.defineProperty(t,"MalloyTranslator",{enumerable:!0,get:function(){return e.MalloyTranslator}}),Object.defineProperty(t,"MalloyTranslation",{enumerable:!0,get:function(){return e.MalloyTranslation}});var n=Rh;Object.defineProperty(t,"exploreQueryWalkerBuilder",{enumerable:!0,get:function(){return n.exploreQueryWalkerBuilder}})}(rO);var we={},U5={};Object.defineProperty(U5,"__esModule",{value:!0}),U5.MALLOY_VERSION=void 0,U5.MALLOY_VERSION="0.0.231",Object.defineProperty(we,"__esModule",{value:!0}),we.CSVWriter=we.JSONWriter=we.DataWriter=we.DataRecord=we.DataArray=we.Result=we.ExploreMaterializer=we.PreparedResultMaterializer=we.QueryMaterializer=we.ModelMaterializer=we.SingleConnectionRuntime=we.ConnectionRuntime=we.Runtime=we.ExploreField=we.JoinRelationship=we.QueryField=we.Query=we.StringField=we.UnsupportedField=we.JSONField=we.BooleanField=we.NumberField=we.TimestampField=we.DateField=we.TimestampTimeframe=we.DateTimeframe=we.AtomicField=we.AtomicFieldType=we.Explore=we.SourceRelationship=we.FixedConnectionMap=we.InMemoryURLReader=we.EmptyURLReader=we.PreparedResult=we.DocumentCompletion=we.DocumentSymbol=we.DocumentPosition=we.DocumentRange=we.DocumentTablePath=we.Parse=we.PreparedQuery=we.Model=we.MalloyError=we.Malloy=void 0;const HOe=rO,ir=ts,CW=ii,Cn=fo,K7=ed,zOe=U5;class Pn{static get version(){return zOe.MALLOY_VERSION}static _parse(e,n,r,i){n===void 0&&(n=new URL("internal://internal.malloy"));let s=n;i!=null&&i.importBaseURL&&(s=i==null?void 0:i.importBaseURL);const o=new HOe.MalloyTranslator(n.toString(),s.toString(),{urls:{[n.toString()]:e}},r);return i!=null&&i.testEnvironment&&(o.allDialectsEnabled=!0),new TW(o)}static parse({url:e,urlReader:n,source:r,eventStream:i,options:s}){if(r!==void 0)return Pn._parse(r,e,i,s);if(n===void 0)throw new Error("Internal Error: urlReader is required.");if(e===void 0)throw new Error("Internal Error: url is required if source not present.");return n.readURL(e).then(o=>Pn._parse(o,e,i,s))}static async compile({urlReader:e,connections:n,parse:r,model:i,refreshSchemaCache:s,noThrowOnError:o,eventStream:u,replaceMaterializedReferences:a,materializedTablePrefix:l}){var c,f,x,h;let p;s&&(p=typeof s=="number"?s:Date.now());const m=r._translator;for(;;){const g=m.translate(i==null?void 0:i._modelDef);if(g.final){if(g.modelDef)return new nm(g.modelDef,g.problems||[],[...(c=i==null?void 0:i.fromSources)!==null&&c!==void 0?c:[],...(f=g.fromSources)!==null&&f!==void 0?f:[]],y=>m.referenceAt(y),y=>m.importAt(y));if(o){const y={name:"modelDidNotCompile",exports:[],contents:{},dependencies:{},queryList:[]},E=(i==null?void 0:i._modelDef)||y;return new nm(E,g.problems||[],[...(x=i==null?void 0:i.fromSources)!==null&&x!==void 0?x:[],...(h=g.fromSources)!==null&&h!==void 0?h:[]],A=>m.referenceAt(A),A=>m.importAt(A))}else{const y=g.problems||[],E=m.prettyErrors();throw new bW(`Error(s) compiling model:
1269
+ ${i}`:e=i}return e}childRequest(e){var n;const r=decodeURI(new URL(e,this.sourceURL).toString()),i=(n=this.childTranslators.get(r))===null||n===void 0?void 0:n.translate();if(i!=null&&i.compileSQL)return{compileSQL:i.compileSQL,partialModel:i.partialModel}}getChildExports(e){const n={},r=decodeURI(new URL(e,this.sourceURL).toString()),i=this.childTranslators.get(r);if(i&&i.translate().modelDef)for(const o of i.modelDef.exports){const u=i.modelDef.contents[o];((0,yOe.isSourceDef)(u)||u.type==="query")&&(n[o]=u)}return n}translate(e){if(this.finalAnswer)return this.finalAnswer;const n=this.translateStep.step(this,e);return n.final&&(this.finalAnswer=n),n}translatorForDependency(e){return this.childTranslators.get(e)}importAt(e){for(let n=0;n<this.imports.length;n++){const r=this.imports[n];if((0,ROe.locationContainsPosition)(r.location,e))return r}}metadata(){return this.metadataStep.step(this)}modelAnnotation(e){return this.modelAnnotationStep.step(this,e)}tablePathInfo(){return this.tablePathInfoStep.step(this)}completions(e){return this.completionsStep.step(this,e)}helpContext(e){return this.helpContextStep.step(this,e)}defaultLocation(){return{url:this.sourceURL,range:{start:{line:0,character:0},end:{line:0,character:0}}}}rangeFromContext(e){return this.rangeFromTokens(e.start,e.stop||e.start)}rangeFromTokens(e,n){const r={line:e.line-1,character:e.charPositionInLine};if(this.parseStep.sourceInfo&&n.stopIndex!==-1){const i=this.parseStep.sourceInfo.lines.length-1;for(let s=e.line-1;s<=i;s++){const o=this.parseStep.sourceInfo.at[s];if(n.stopIndex>=o.begin&&n.stopIndex<o.end)return{start:r,end:{line:s,character:n.stopIndex-o.begin+1}}}return{start:r,end:{line:i,character:this.parseStep.sourceInfo.lines[i].length}}}return{start:r,end:r}}rangeFromToken(e){return this.rangeFromTokens(e,e)}firstReferenceToDialect(e){return this.dialectAlreadyChecked[e]?!1:(this.dialectAlreadyChecked[e]=!0,!0)}experimentalDialectEnabled(e){if(this.allDialectsEnabled)return!0;const n=this.compilerFlags.tag("experimental");return n!==void 0&&(n.bare()||n.has("dialect",e))}}Au.MalloyTranslation=Y7;class AW extends Y7{constructor(e,n){super(e),this.root=n}}Au.MalloyChildTranslator=AW;class jOe extends Y7{constructor(e,n=null,r=null,i=null){super(e,n),this.eventStream=i,this.schemaZone=new V7.Zone,this.importZone=new V7.Zone,this.pretranslatedModels=new Map,this.sqlQueryZone=new V7.Zone,this.root=this,this.logger=new W7.BaseMessageLogger(i),r&&this.update(r)}update(e){var n,r,i;this.schemaZone.updateFrom(e.tables,(n=e.errors)===null||n===void 0?void 0:n.tables),this.importZone.updateFrom(e.urls,(r=e.errors)===null||r===void 0?void 0:r.urls),this.sqlQueryZone.updateFrom(e.compileSQL,(i=e.errors)===null||i===void 0?void 0:i.compileSQL);for(const s in e.translations)this.pretranslatedModels.set(s,e.translations[s])}logError(e,n,r){return this.logger.log((0,W7.makeLogMessage)(e,n,{severity:"error",...r})),e}}Au.MalloyTranslator=jOe;class vW{constructor(e,n){this.translator=e,this.messages=n}logError(e,n,r){return this.messages.log((0,W7.makeLogMessage)(e,n,{severity:"error",...r})),e}syntaxError(e,n,r,i,s,o){const u={line:r-1,character:i},a=n?this.translator.rangeFromToken(n):{start:u,end:u};this.logError("syntax-error",{message:s},{at:{url:this.translator.sourceURL,range:a}})}}Au.MalloyParserErrorHandler=vW;function _W(t){return[...Object.keys(t),...Object.keys(t).map(e=>_W(t[e])).flat()]}var Rh={};Object.defineProperty(Rh,"__esModule",{value:!0}),Rh.exploreQueryWalkerBuilder=Rh.ExploreQueryWalker=void 0;const UOe=Gl;class SW{constructor(e){this.inDocument=!1,this.exploreClauseRefs=[],this.tokens=e}exploreQueryAtOffset(e){return this.exploreClauseRefs.find(n=>n.range[0]===void 0||n.range[1]===void 0?!1:n.range[0]<=e&&n.range[1]>=e)}filterAtOffset(e){const n=this.exploreQueryAtOffset(e);if(n)return n.filterRefs.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e)}hasFilterListAtOffset(e){const n=this.exploreQueryAtOffset(e);return n?!!n.filterLists.find(r=>r.range[0]===void 0||r.range[1]===void 0?!1:r.range[0]<=e&&r.range[1]>=e):!1}enterMalloyDocument(){this.inDocument=!0}}Rh.ExploreQueryWalker=SW;function qOe(t,e){const n=new SW(t),r=n;return UOe.ParseTreeWalker.DEFAULT.walk(r,e),n}Rh.exploreQueryWalkerBuilder=qOe,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.exploreQueryWalkerBuilder=t.MalloyTranslation=t.MalloyTranslator=void 0;var e=Au;Object.defineProperty(t,"MalloyTranslator",{enumerable:!0,get:function(){return e.MalloyTranslator}}),Object.defineProperty(t,"MalloyTranslation",{enumerable:!0,get:function(){return e.MalloyTranslation}});var n=Rh;Object.defineProperty(t,"exploreQueryWalkerBuilder",{enumerable:!0,get:function(){return n.exploreQueryWalkerBuilder}})}(rO);var we={},U5={};Object.defineProperty(U5,"__esModule",{value:!0}),U5.MALLOY_VERSION=void 0,U5.MALLOY_VERSION="0.0.232",Object.defineProperty(we,"__esModule",{value:!0}),we.CSVWriter=we.JSONWriter=we.DataWriter=we.DataRecord=we.DataArray=we.Result=we.ExploreMaterializer=we.PreparedResultMaterializer=we.QueryMaterializer=we.ModelMaterializer=we.SingleConnectionRuntime=we.ConnectionRuntime=we.Runtime=we.ExploreField=we.JoinRelationship=we.QueryField=we.Query=we.StringField=we.UnsupportedField=we.JSONField=we.BooleanField=we.NumberField=we.TimestampField=we.DateField=we.TimestampTimeframe=we.DateTimeframe=we.AtomicField=we.AtomicFieldType=we.Explore=we.SourceRelationship=we.FixedConnectionMap=we.InMemoryURLReader=we.EmptyURLReader=we.PreparedResult=we.DocumentCompletion=we.DocumentSymbol=we.DocumentPosition=we.DocumentRange=we.DocumentTablePath=we.Parse=we.PreparedQuery=we.Model=we.MalloyError=we.Malloy=void 0;const HOe=rO,ir=ts,CW=ii,Cn=fo,K7=ed,zOe=U5;class Pn{static get version(){return zOe.MALLOY_VERSION}static _parse(e,n,r,i){n===void 0&&(n=new URL("internal://internal.malloy"));let s=n;i!=null&&i.importBaseURL&&(s=i==null?void 0:i.importBaseURL);const o=new HOe.MalloyTranslator(n.toString(),s.toString(),{urls:{[n.toString()]:e}},r);return i!=null&&i.testEnvironment&&(o.allDialectsEnabled=!0),new TW(o)}static parse({url:e,urlReader:n,source:r,eventStream:i,options:s}){if(r!==void 0)return Pn._parse(r,e,i,s);if(n===void 0)throw new Error("Internal Error: urlReader is required.");if(e===void 0)throw new Error("Internal Error: url is required if source not present.");return n.readURL(e).then(o=>Pn._parse(o,e,i,s))}static async compile({urlReader:e,connections:n,parse:r,model:i,refreshSchemaCache:s,noThrowOnError:o,eventStream:u,replaceMaterializedReferences:a,materializedTablePrefix:l}){var c,f,x,h;let p;s&&(p=typeof s=="number"?s:Date.now());const m=r._translator;for(;;){const g=m.translate(i==null?void 0:i._modelDef);if(g.final){if(g.modelDef)return new nm(g.modelDef,g.problems||[],[...(c=i==null?void 0:i.fromSources)!==null&&c!==void 0?c:[],...(f=g.fromSources)!==null&&f!==void 0?f:[]],y=>m.referenceAt(y),y=>m.importAt(y));if(o){const y={name:"modelDidNotCompile",exports:[],contents:{},dependencies:{},queryList:[]},E=(i==null?void 0:i._modelDef)||y;return new nm(E,g.problems||[],[...(x=i==null?void 0:i.fromSources)!==null&&x!==void 0?x:[],...(h=g.fromSources)!==null&&h!==void 0?h:[]],A=>m.referenceAt(A),A=>m.importAt(A))}else{const y=g.problems||[],E=m.prettyErrors();throw new bW(`Error(s) compiling model:
1270
1270
  ${E}`,y)}}else{if(g.urls)for(const E of g.urls)try{if(E.startsWith("internal://"))throw new Error("In order to use relative imports, you must compile a file via a URL.");const A=await e.readURL(new URL(E)),v={[E]:A};m.update({urls:v})}catch(A){m.update({errors:{urls:{[E]:A.message}}})}const{modelAnnotation:y}=m.modelAnnotation(i==null?void 0:i._modelDef);if(g.tables){const E=new Map;for(const A in g.tables){const{connectionName:v,tablePath:_}=g.tables[A],S=E.get(v);S===void 0?E.set(v,{[A]:_}):S[A]=_}for(const[A,v]of E)try{const _=await n.lookupConnection(A),{schemas:S,errors:C}=await Pn.safelyFetchTableSchema(_,v,{refreshTimestamp:p,modelAnnotation:y});m.update({tables:S,errors:{tables:C}})}catch(_){const S={},C={};for(const b in v)C[b]=_.toString();m.update({tables:S,errors:{tables:C}})}}if(g.compileSQL){const E=g.compileSQL,A=E.connection;try{const v=await n.lookupConnection(A),_=Pn.compileSQLBlock(v.dialectName,g.partialModel,E,{replaceMaterializedReferences:a,materializedTablePrefix:l,eventStream:u}),S=await v.fetchSchemaForSQLStruct(_,{refreshTimestamp:p,modelAnnotation:y});S.error&&m.update({errors:{compileSQL:{[_.name]:S.error}}}),S.structDef&&m.update({compileSQL:{[_.name]:S.structDef}})}catch(v){const _={};_[E.name]=v.toString(),m.update({errors:{compileSQL:_}})}}}}}static async safelyFetchTableSchema(e,n,r){const i=await e.fetchSchemaForTables(n,r);for(const s of Object.keys(n))if(i.schemas[s]===void 0&&i.errors[s]===void 0)throw new Error(`Schema fetch error for ${e.name}, no response for ${s} from ${e.dialectName}`);return i}static compileSQLBlock(e,n,r,i){let s,o="",u=!1;for(const c of r.select)if((0,ir.isSegmentSQL)(c))o+=c.sql,u=c.sql.match(/\(\s*$/)!==null;else{if(!s){if(!n)throw new Error("Internal error: Partial model missing when compiling SQL block");s=new ir.QueryModel(n,i==null?void 0:i.eventStream)}const f=s.compileQuery(c,{...i,defaultRowLimit:void 0},!1).sql;o+=u?f:`(${f})`,u=!1}const{name:a,connection:l}=r;return{type:"sql_select",name:a,connection:l,dialect:e,selectStr:o,fields:[]}}static async run({connections:e,preparedResult:n,sqlStruct:r,connection:i,options:s}){if(!i){if(!e)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");const o=(r==null?void 0:r.connection)||(n==null?void 0:n.connectionName);i=await e.lookupConnection(o)}if(r){const o=await i.runSQL(r.selectStr);return new om({structs:[r],sql:r.selectStr,result:o.rows,totalRows:o.totalRows,runStats:o.runStats,lastStageName:r.name,malloy:"",connectionName:r.connection,sourceExplore:"",sourceFilters:[],profilingUrl:o.profilingUrl},{name:"empty_model",exports:[],contents:{},queryList:[],dependencies:{}})}else if(n){const o=await i.runSQL(n.sql,s);return new om({...n._rawQuery,result:o.rows,totalRows:o.totalRows,runStats:o.runStats,profilingUrl:o.profilingUrl},n._modelDef)}else throw new Error("Internal error: sqlStruct or preparedResult must be provided.")}static async*runStream({connections:e,preparedResult:n,sqlStruct:r,connection:i,options:s}){if(r===void 0&&n===void 0)throw new Error("Internal error: sqlBlock or preparedResult must be provided.");const o=(r==null?void 0:r.connection)||(n==null?void 0:n.connectionName);if(i===void 0){if(e===void 0)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");i=await e.lookupConnection(o)}if(!i.canStream())throw new Error(`Connection '${o}' cannot stream results.`);let u,a;if(r)a=new ps(r),u=r.selectStr;else if(n!==void 0)a=n.resultExplore,u=n.sql;else throw new Error("Internal error: sqlStruct or preparedResult must be provided.");let l=0;for await(const c of i.runSQLStream(u,s))yield new Bf(c,l,a,void 0,void 0),l+=1}static async estimateQueryCost({connections:e,preparedResult:n,sqlStruct:r}){if(!e)throw new Error("Internal Error: Connection or LookupConnection<Connection> must be provided.");const i=(r==null?void 0:r.connection)||(n==null?void 0:n.connectionName),s=await e.lookupConnection(i);if(r)return await s.estimateQueryCost(r.selectStr);if(n)return await s.estimateQueryCost(n.sql);throw new Error("Internal error: sqlStruct or preparedResult must be provided.")}}we.Malloy=Pn;class bW extends Error{constructor(e,n=[]){super(e),this.problems=n}}we.MalloyError=bW;let nm=class{constructor(e,n,r,i=()=>{},s=()=>{}){this.modelDef=e,this.problems=n,this.fromSources=r,this._referenceAt=i,this._importAt=s}tagParse(e){return Cn.Tag.annotationToTag(this.modelDef.annotation,e)}getTaglines(e){return Cn.Tag.annotationToTaglines(this.modelDef.annotation,e)}getReference(e){return this._referenceAt(e)}getImport(e){return this._importAt(e)}getPreparedQueryByName(e){const n=this.modelDef.contents[e];if((n==null?void 0:n.type)==="query")return new Oh(n,this.modelDef,this.problems,e);throw new Error("Given query name does not refer to a named query.")}getPreparedQueryByIndex(e){if(e<0)throw new Error(`Invalid index ${e}.`);if(e>=this.modelDef.queryList.length)throw new Error(`Query index ${e} is out of bounds.`);return new Oh(this.modelDef.queryList[e],this.modelDef,this.problems)}get preparedQuery(){return this.getPreparedQuery()}getPreparedQuery(){if(this.modelDef.queryList.length===0)throw new Error("Model has no queries.");return new Oh(this.modelDef.queryList[this.modelDef.queryList.length-1],this.modelDef,this.problems)}getExploreByName(e){const n=this.modelDef.contents[e];if((0,ir.isSourceDef)(n))return new ps(n);throw new Error("'name' is not an explore")}get explores(){return Object.values(this.modelDef.contents).filter(ir.isSourceDef).map(e=>new ps(e))}get namedQueries(){const e=n=>n.type==="query";return Object.values(this.modelDef.contents).filter(e)}get exportedExplores(){return this.explores.filter(e=>this.modelDef.exports.includes(e.name))}get _modelDef(){return this.modelDef}};we.Model=nm;class Oh{constructor(e,n,r,i){this.problems=r,this.name=i,this._query=e,this._modelDef=n}tagParse(e){const n=Cn.Tag.annotationToTag(this._modelDef.annotation).tag;return e=Cn.Tag.addModelScope(e,n),Cn.Tag.annotationToTag(this._query.annotation,e)}getTaglines(e){return Cn.Tag.annotationToTaglines(this._query.annotation,e)}get preparedResult(){return this.getPreparedResult()}getPreparedResult(e){const r=new ir.QueryModel(this._modelDef,e==null?void 0:e.eventStream).compileQuery(this._query,e);return new rm({...r,queryName:this.name||r.queryName},this._modelDef)}get dialect(){const e=this._query.structRef,n=typeof e=="string"?this._modelDef.contents[e]:e;if(!(0,ir.isSourceDef)(n))throw new Error("Invalid source for query");return n.dialect}getFlattenedQuery(e){return this}}we.PreparedQuery=Oh;class TW{constructor(e){this.translator=e}get symbols(){return(this.translator.metadata().symbols||[]).map(e=>new q5(e))}get tablePathInfo(){var e;return((e=this.translator.tablePathInfo().pathInfo)!==null&&e!==void 0?e:[]).map(r=>new RW(r))}get _translator(){return this.translator}completions(e){return(this.translator.completions(e).completions||[]).map(n=>new OW(n))}helpContext(e){return this.translator.helpContext(e).helpContext}}we.Parse=TW;class RW{constructor(e){this._range=Dh.fromJSON(e.range),this._connectionId=e.connectionId,this._tablePath=e.tablePath}get range(){return this._range}get connectionId(){return this._connectionId}get tablePath(){return this._tablePath}}we.DocumentTablePath=RW;class Dh{constructor(e,n){this._start=e,this._end=n}get start(){return this._start}get end(){return this._end}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}static fromJSON(e){return new Dh(new J7(e.start.line,e.start.character),new J7(e.end.line,e.end.character))}}we.DocumentRange=Dh;class J7{constructor(e,n){this._line=e,this._character=n}get line(){return this._line}get character(){return this._character}toJSON(){return{line:this.line,character:this.character}}}we.DocumentPosition=J7;class q5{constructor(e){this._range=Dh.fromJSON(e.range),this._lensRange=e.lensRange?Dh.fromJSON(e.lensRange):void 0,this._type=e.type,this._name=e.name,this._children=e.children.map(n=>new q5(n))}get range(){return this._range}get lensRange(){var e;return(e=this._lensRange)!==null&&e!==void 0?e:this._range}get type(){return this._type}get name(){return this._name}get children(){return this._children}}we.DocumentSymbol=q5;class OW{constructor(e){this.type=e.type,this.text=e.text}}we.DocumentCompletion=OW;class rm{constructor(e,n){this.modelDef=n,this.inner=e}static fromJson({query:e,modelDef:n}){if(!e||!n)throw new Error("Missing required properties in JSON data");return new rm(e,n)}tagParse(e){const n=Cn.Tag.annotationToTag(this.modelDef.annotation).tag;return e=Cn.Tag.addModelScope(e,n),Cn.Tag.annotationToTag(this.inner.annotation,e)}getTaglines(e){return Cn.Tag.annotationToTaglines(this.inner.annotation,e)}get annotation(){return this.inner.annotation}get modelAnnotation(){return this.modelDef.annotation}get modelTag(){return Cn.Tag.annotationToTag(this.modelDef.annotation).tag}get connectionName(){return this.inner.connectionName}get _rawQuery(){return this.inner}get _modelDef(){return this.modelDef}get sql(){return this.inner.sql}get dependenciesToMaterialize(){return this.inner.dependenciesToMaterialize}get materialization(){return this.inner.materialization}get resultExplore(){if(this.inner.structs.length===0)throw new Error("Malformed query result.");const e=this.inner.structs[this.inner.structs.length-1],n={...e,annotation:this.inner.annotation,name:this.inner.queryName||e.name};try{return new ps(n,this.sourceExplore)}catch{return new ps(n)}}get sourceExplore(){const e=this.inner.sourceExplore,n=this.modelDef.contents[e];if(n===void 0)throw new Error("Malformed query result.");if((0,ir.isSourceDef)(n))return new ps(n);throw new Error(`'${e} is not an explore`)}get _sourceExploreName(){return this.inner.sourceExplore}get _sourceFilters(){return this.inner.sourceFilters||[]}}we.PreparedResult=rm;class DW{async readURL(e){throw new Error("No files.")}}we.EmptyURLReader=DW;class QOe{constructor(e){this.files=e}async readURL(e){const n=this.files.get(e.toString());if(n!==void 0)return Promise.resolve(n);throw new Error(`File not found '${e}'`)}}we.InMemoryURLReader=QOe;class im{constructor(e,n){this.connections=e,this.defaultConnectionName=n}async getConnection(e){if(e===void 0)if(this.defaultConnectionName!==void 0)e=this.defaultConnectionName;else throw new Error("No default connection.");const n=this.connections.get(e);if(n!==void 0)return Promise.resolve(n);throw new Error(`No connection found with name ${e}.`)}listConnections(){return Array.from(this.connections.values())}async lookupConnection(e){return this.getConnection(e)}static fromArray(e){return new im(new Map(e.map(n=>[n.name,n])))}}we.FixedConnectionMap=im;var wW;(function(t){t.Nested="nested",t.BaseTable="base_table",t.Cross="cross",t.One="one",t.Many="many",t.Inline="inline"})(wW||(we.SourceRelationship=wW={}));class X7{constructor(e,n,r){this._name=e,this._parent=n,this._source=r}get source(){return this.source}get name(){return this._name}get sourceClasses(){const e=[];return this.source&&e.push(this.source.name),e.push(this.name),e}get fieldPath(){const e=[this.name];let n=this._parent;for(;n;)e.unshift(n.name),n=n._parent;return e}hasParentExplore(){return this._parent!==void 0}isExplore(){return this instanceof ps}isQuery(){return this instanceof sw}}class ps extends X7{constructor(e,n,r){super(e.as||e.name,n,r),this._structDef=e,this._parentExplore=n,this.sourceExplore=r}get source(){return this.sourceExplore}isIntrinsic(){return(0,ir.isAtomicFieldType)(this._structDef.type)?!("e"in this._structDef):!1}isExploreField(){return!1}tagParse(e){return Cn.Tag.annotationToTag(this._structDef.annotation,e)}getTaglines(e){return Cn.Tag.annotationToTaglines(this._structDef.annotation,e)}get modelTag(){return this.parsedModelTag||(this.parsedModelTag=Cn.Tag.annotationToTag(this._structDef.modelAnnotation).tag),this.parsedModelTag}get name(){return this.structDef.as||this.structDef.name}getQueryByName(e){const n=this.sourceStructDef;if(!n)throw new Error(`Cannot get query by name from a struct of type ${this.structDef.type}`);const r={type:"query",structRef:n,pipeline:[{type:"reduce",queryFields:[{type:"fieldref",path:[e]}]}]};return new Oh(r,this.modelDef,[],e)}get modelDef(){if(!(0,ir.isSourceDef)(this.structDef))throw new Error(`Cannot create pseudo model for struct type ${this.structDef.type}`);return{name:"generated_model",exports:[],contents:{[this.structDef.name]:this.structDef},queryList:[],dependencies:{}}}getSingleExploreModel(){return new nm(this.modelDef,[],[])}get fieldMap(){var e;if(this._fieldMap===void 0){const n=((e=this.source)===null||e===void 0?void 0:e.fieldMap)||new Map;this._fieldMap=new Map(this.structDef.fields.map(r=>{const i=r.as||r.name,s=n.get(r.name);if((0,ir.isJoined)(r))return[i,new ow(r,this,s)];if(r.type==="turtle")return[i,new sw(r,this,s)];if(r.type==="string")return[i,new iw(r,this,s)];if(r.type==="number")return[i,new H5(r,this,s)];if(r.type==="date")return r.timeframe&&["day_of_month","day_of_week","day_of_year"].includes(r.timeframe)?[i,new H5({...r,type:"number"},this,s)]:[i,new Z7(r,this,s)];if(r.type==="timestamp")return[i,new ew(r,this,s)];if(r.type==="boolean")return[i,new tw(r,this,s)];if(r.type==="json")return[i,new nw(r,this,s)];if(r.type==="sql native")return[i,new rw(r,this,s)]}))}return this._fieldMap}get allFields(){return[...this.fieldMap.values()]}get allFieldsWithOrder(){var e,n,r;if(!this._allFieldsWithOrder){const i=[...((r=(n=(e=this.sourceStructDef)===null||e===void 0?void 0:e.resultMetadata)===null||n===void 0?void 0:n.orderBy)===null||r===void 0?void 0:r.map(o=>{if(typeof o.field=="string")return{field:this.fieldMap.get(o.field),dir:o.dir};throw new Error("Does not support mapping order by from number.")}))||[]],s=new Set(i.map(o=>o.field.name));this._allFieldsWithOrder=[...i,...this.allFields.filter(o=>!s.has(o.name)).map(o=>({field:o,dir:"asc"}))]}return this._allFieldsWithOrder}get intrinsicFields(){return[...this.fieldMap.values()].filter(e=>e.isIntrinsic())}get dimensions(){return[...this.allFieldsWithOrder].filter(e=>e.field.isAtomicField()&&e.field.sourceWasDimension())}getFieldByName(e){const n=this.fieldMap.get(e);if(n===void 0)throw new Error(`No such field ${e}.`);return n}getFieldByNameIfExists(e){return this.fieldMap.get(e)}get primaryKey(){var e;return(e=this.sourceStructDef)===null||e===void 0?void 0:e.primaryKey}get parentExplore(){return this._parentExplore}hasParentExplore(){return this instanceof ow}get filters(){var e;return(0,ir.isSourceDef)(this.structDef)?((e=this.structDef.resultMetadata)===null||e===void 0?void 0:e.filterList)||[]:[]}get limit(){var e,n;return(n=(e=this.sourceStructDef)===null||e===void 0?void 0:e.resultMetadata)===null||n===void 0?void 0:n.limit}get structDef(){return this._structDef}get queryTimezone(){var e;return(e=this.sourceStructDef)===null||e===void 0?void 0:e.queryTimezone}get sourceStructDef(){if((0,ir.isSourceDef)(this.structDef))return this.structDef}toJSON(){var e,n;return{_structDef:this._structDef,sourceExplore:(e=this.sourceExplore)===null||e===void 0?void 0:e.toJSON(),_parentExplore:(n=this._parentExplore)===null||n===void 0?void 0:n.toJSON()}}static fromJSON(e){const n=e._parentExplore!==void 0?ps.fromJSON(e._parentExplore):void 0,r=e.sourceExplore!==void 0?ps.fromJSON(e.sourceExplore):void 0;return new ps(e._structDef,n,r)}get location(){return this.structDef.location}}we.Explore=ps;var Fu;(function(t){t.String="string",t.Number="number",t.Boolean="boolean",t.Date="date",t.Timestamp="timestamp",t.Json="json",t.NativeUnsupported="sql native",t.Error="error"})(Fu||(we.AtomicFieldType=Fu={}));class w0 extends X7{constructor(e,n,r){super(e.as||e.name,n,r),this.fieldTypeDef=e,this.parent=n}get type(){switch(this.fieldTypeDef.type){case"string":return Fu.String;case"boolean":return Fu.Boolean;case"date":return Fu.Date;case"timestamp":return Fu.Timestamp;case"number":return Fu.Number;case"json":return Fu.Json;case"sql native":return Fu.NativeUnsupported;case"error":return Fu.Error;case"record":case"array":throw new Error(`MTOY TODO IMPLEMENT Atomic ${this.fieldTypeDef.type}`);default:{const e=this.fieldTypeDef;throw new Error(`Can't make an atomic field from ${e}`)}}}tagParse(e){return e=Cn.Tag.addModelScope(e,this.parent.modelTag),Cn.Tag.annotationToTag(this.fieldTypeDef.annotation,e)}getTaglines(e){return Cn.Tag.annotationToTaglines(this.fieldTypeDef.annotation,e)}isIntrinsic(){return(0,ir.fieldIsIntrinsic)(this.fieldTypeDef)}isQueryField(){return!1}isExploreField(){return!1}isAtomicField(){return!0}isCalculation(){return(0,ir.expressionIsCalculation)(this.fieldTypeDef.expressionType)}get sourceField(){throw new Error}get sourceClasses(){const e=this.fieldTypeDef.name||this.fieldTypeDef.as;return e?[e]:[]}get referenceId(){var e;return(e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.referenceId}sourceWasMeasure(){var e;return((e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.fieldKind)==="measure"}sourceWasMeasureLike(){var e,n;return((e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.fieldKind)==="measure"||((n=this.fieldTypeDef.resultMetadata)===null||n===void 0?void 0:n.fieldKind)==="struct"}sourceWasDimension(){var e;return((e=this.fieldTypeDef.resultMetadata)===null||e===void 0?void 0:e.fieldKind)==="dimension"}hasParentExplore(){return!0}isString(){return this instanceof iw}isNumber(){return this instanceof H5}isDate(){return this instanceof Z7}isBoolean(){return this instanceof tw}isJSON(){return this instanceof nw}isTimestamp(){return this instanceof ew}isUnsupported(){return this instanceof rw}get parentExplore(){return this.parent}get expression(){const e=".",n=this.fieldTypeDef.resultMetadata;return(n==null?void 0:n.sourceExpression)||(n!=null&&n.sourceField.includes(e)?n==null?void 0:n.sourceField:this.name)}get location(){return this.fieldTypeDef.location}}we.AtomicField=w0;var If;(function(t){t.Day="day",t.Week="week",t.Month="month",t.Quarter="quarter",t.Year="year"})(If||(we.DateTimeframe=If={}));var Lu;(function(t){t.Day="day",t.Week="week",t.Month="month",t.Quarter="quarter",t.Year="year",t.Second="second",t.Hour="hour",t.Minute="minute"})(Lu||(we.TimestampTimeframe=Lu={}));class Z7 extends w0{constructor(e,n,r){super(e,n,r),this.fieldDateDef=e}get timeframe(){if(this.fieldDateDef.timeframe!==void 0)switch(this.fieldDateDef.timeframe){case"day":return If.Day;case"week":return If.Week;case"month":return If.Month;case"quarter":return If.Quarter;case"year":return If.Year}}}we.DateField=Z7;class ew extends w0{constructor(e,n,r){super(e,n,r),this.fieldTimestampDef=e}get timeframe(){if(this.fieldTimestampDef.timeframe!==void 0)switch(this.fieldTimestampDef.timeframe){case"day":return Lu.Day;case"week":return Lu.Week;case"month":return Lu.Month;case"quarter":return Lu.Quarter;case"year":return Lu.Year;case"second":return Lu.Second;case"hour":return Lu.Hour;case"minute":return Lu.Minute}}}we.TimestampField=ew;class H5 extends w0{constructor(e,n,r){super(e,n,r),this.fieldNumberDef=e}}we.NumberField=H5;class tw extends w0{constructor(e,n,r){super(e,n,r),this.fieldBooleanDef=e}}we.BooleanField=tw;class nw extends w0{constructor(e,n,r){super(e,n,r),this.fieldJSONDef=e}}we.JSONField=nw;class rw extends w0{constructor(e,n,r){super(e,n,r),this.fieldUnsupportedDef=e}get rawType(){return this.fieldUnsupportedDef.rawType}}we.UnsupportedField=rw;class iw extends w0{constructor(e,n,r){super(e,n,r),this.fieldStringDef=e}}we.StringField=iw;class NW extends X7{constructor(e,n,r){super(e.as||e.name,n,r),this.turtleDef=e}get source(){return this.sourceQuery}isIntrinsic(){return!1}get location(){return this.turtleDef.location}}we.Query=NW;class sw extends NW{constructor(e,n,r){super(e,n,r),this.parent=n}tagParse(e){return e=Cn.Tag.addModelScope(e,this.parent.modelTag),Cn.Tag.annotationToTag(this.turtleDef.annotation,e)}getTaglines(e){return Cn.Tag.annotationToTaglines(this.turtleDef.annotation,e)}isQueryField(){return!0}isExploreField(){return!1}isAtomicField(){return!1}get sourceClasses(){const e=this.turtleDef.name||this.turtleDef.as;return e?[e]:[]}hasParentExplore(){return!0}get parentExplore(){return this.parent}get expression(){return this.name}}we.QueryField=sw;var wh;(function(t){t.OneToOne="one_to_one",t.OneToMany="one_to_many",t.ManyToOne="many_to_one"})(wh||(we.JoinRelationship=wh={}));class ow extends ps{constructor(e,n,r){super(e,n,r),this._parentExplore=n}get joinRelationship(){if((0,ir.isJoined)(this.structDef))switch(this.structDef.join){case"one":return wh.OneToOne;case"many":case"cross":return wh.ManyToOne}throw new Error("A source field must have a join relationship.")}get isRecord(){return this.joinRelationship===wh.OneToOne}get isArray(){return this.joinRelationship!==wh.OneToOne}tagParse(e){return e=Cn.Tag.addModelScope(e,this._parentExplore.modelTag),Cn.Tag.annotationToTag(this._structDef.annotation,e)}isQueryField(){return!1}isExploreField(){return!0}isAtomicField(){return!1}get parentExplore(){return this._parentExplore}get sourceClasses(){const e=this.structDef.name||this.structDef.as;return e?[e]:[]}}we.ExploreField=ow;class uw{constructor(...e){this.isTestRuntime=!1;let n,r,i;for(const s of e)s!==void 0&&(zW(s)?n=s:KOe(s)?r=s:QW(s)?i=s:r={lookupConnection:()=>Promise.resolve(s)});if(n===void 0&&(n=new DW),r===void 0)throw new Error("A LookupConnection<Connection> or Connection is required.");this._urlReader=n,this._connections=r,this._eventStream=i}get urlReader(){return this._urlReader}get connections(){return this._connections}get eventStream(){return this._eventStream}loadModel(e,n){const{refreshSchemaCache:r,noThrowOnError:i}=n||{};return this.isTestRuntime&&(n===void 0?n={testEnvironment:!0}:n={...n,testEnvironment:!0}),new sm(this,async()=>{const s=e instanceof URL?await Pn.parse({url:e,urlReader:this.urlReader,eventStream:this.eventStream,options:n}):Pn.parse({source:e,eventStream:this.eventStream,options:n});return Pn.compile({urlReader:this.urlReader,connections:this.connections,parse:s,refreshSchemaCache:r,noThrowOnError:i,eventStream:this.eventStream,replaceMaterializedReferences:n==null?void 0:n.replaceMaterializedReferences,materializedTablePrefix:n==null?void 0:n.materializedTablePrefix})},n)}_loadModelFromModelDef(e,n){return new sm(this,async()=>new nm(e,[],[]),n)}loadQuery(e,n){return this.loadModel(e,n).loadFinalQuery()}loadQueryByIndex(e,n,r){return this.loadModel(e,r).loadQueryByIndex(n,r)}loadQueryByName(e,n,r){return this.loadModel(e,r).loadQueryByName(n,r)}getModel(e,n){return this.loadModel(e,n).getModel()}getQuery(e,n){return this.loadQuery(e,n).getPreparedQuery()}getQueryByIndex(e,n,r){return this.loadQueryByIndex(e,n,r).getPreparedQuery()}getQueryByName(e,n,r){return this.loadQueryByName(e,n,r).getPreparedQuery()}}we.Runtime=uw;class GOe extends uw{constructor(e,n){if(n===void 0){const r=e;super(im.fromArray(r)),this.rawConnections=r}else{const r=n;super(e,im.fromArray(r)),this.rawConnections=r}}}we.ConnectionRuntime=GOe;class WOe extends uw{constructor(...e){let n,r,i;for(const s of e)zW(s)&&(n=s),JOe(s)&&(r=s),QW(s)&&(i=s);if(r===void 0)throw new Error("Expected connection to be passed into SingleConnectionRuntime");super(n,r,i),this.connection=r}get supportsNesting(){return(0,K7.getDialect)(this.connection.dialectName).supportsNesting}quote(e){return(0,K7.getDialect)(this.connection.dialectName).sqlMaybeQuoteIdentifier(e)}get dialect(){return(0,K7.getDialect)(this.connection.dialectName)}getQuoter(){return e=>this.quote(e.toString())}}we.SingleConnectionRuntime=WOe;class z5{constructor(e,n){this.runtime=e,this._materialize=n}materialize(){return this.materialized===void 0?this.rematerialize():this.materialized}rematerialize(){return this.materialized=this._materialize(),this.materialized}makeQueryMaterializer(e,n){return new FW(this.runtime,e,n)}makeExploreMaterializer(e,n){return new IW(this.runtime,e,n)}makePreparedResultMaterializer(e){return new LW(this.runtime,e)}}class sm extends z5{constructor(e,n,r){super(e,n),this.runtime=e,this.compileQueryOptions=r}loadFinalQuery(e){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQuery(),{...this.compileQueryOptions,...e})}loadQueryByIndex(e,n){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQueryByIndex(e),{...this.compileQueryOptions,...n})}loadQueryByName(e,n){return this.makeQueryMaterializer(async()=>(await this.materialize()).getPreparedQueryByName(e),{...this.compileQueryOptions,...n})}loadQuery(e,n){const{refreshSchemaCache:r,noThrowOnError:i}=n||{};return this.makeQueryMaterializer(async()=>{const s=this.runtime.urlReader,o=this.runtime.connections;this.runtime.isTestRuntime&&(n===void 0?n={testEnvironment:!0}:n={...n,testEnvironment:!0});const u=e instanceof URL?await Pn.parse({url:e,urlReader:s,options:n}):Pn.parse({source:e,options:n}),a=await this.getModel();return(await Pn.compile({urlReader:s,connections:o,parse:u,model:a,refreshSchemaCache:r,noThrowOnError:i,...this.compileQueryOptions})).preparedQuery})}extendModel(e,n){return this.runtime.isTestRuntime&&(n===void 0?n={testEnvironment:!0}:n={...n,testEnvironment:!0}),new sm(this.runtime,async()=>{const r=this.runtime.urlReader,i=this.runtime.connections,s=e instanceof URL?await Pn.parse({url:e,urlReader:r,options:n}):Pn.parse({source:e,options:n}),o=await this.getModel();return await Pn.compile({urlReader:r,connections:i,parse:s,model:o,refreshSchemaCache:n==null?void 0:n.refreshSchemaCache,noThrowOnError:n==null?void 0:n.noThrowOnError,...this.compileQueryOptions})},n)}async search(e,n,r=1e3,i=void 0,s){const o=await this.materialize(),u=new ir.QueryModel(o._modelDef,s),a=o.getExploreByName(e).structDef;if(!(0,ir.isSourceDef)(a))throw new Error("Source to be searched was unexpectedly, not a source");const l=a.connection,c=await this.runtime.connections.lookupConnection(l);return await u.searchIndex(c,e,n,r,i)}async searchValueMap(e,n=10,r){const s=(await this.materialize()).getExploreByName(e);if(!(0,ir.isSourceDef)(s.structDef))throw new Error("Source to be searched was unexpectedly, not a source");let o="{index: *}";s.getFieldByNameIfExists("search_index")&&(o="search_index");const u=`
1271
1271
  run: ${e}
1272
1272
  -> ${o}
@@ -1288,7 +1288,7 @@ ${E}`,y)}}else{if(g.urls)for(const E of g.urls)try{if(E.startsWith("internal://"
1288
1288
  `)}}this.stream.write(`
1289
1289
  ]
1290
1290
  `),this.stream.close()}}we.JSONWriter=XOe;class ZOe extends aw{constructor(){super(...arguments),this.columnSeparator=",",this.rowSeparator=`
1291
- `,this.quoteCharacter='"',this.includeHeader=!0,this.emptyCell=""}escape(e){const n=e.includes(this.quoteCharacter),r=e.includes(this.columnSeparator),i=e.includes(this.rowSeparator),s=r||n||i;return n&&(e=e.replace(new RegExp(this.quoteCharacter,"g"),this.quoteCharacter+this.quoteCharacter)),s&&(e=this.quoteCharacter+e+this.quoteCharacter),e}stringify(e){return e===null?this.emptyCell:e instanceof Date?e.toISOString():typeof e=="boolean"||typeof e=="number"?JSON.stringify(e):`${e}`}getColWeight(e){let n=e;Array.isArray(e)&&(n=e[0]);let r=0;for(const i in n){r=r+1;const s=n[i];if(Array.isArray(s)){const o=this.getColWeight(s)-1;r=r+o}}return r}getHeaderRow(e){const n=[];let r=0;for(const i in e){n.push(this.escape(i));const s=e[i];if(r++,Array.isArray(s)){const o=this.getColWeight(s)-1;r=r+o;for(let u=0;u<o;u++)n.push(this.emptyCell)}}return{rows:[n.join(this.columnSeparator)],length:1,width:r}}mergeMatrices(e){const n=Math.max(...e.map(s=>s.length)),r=e.reduce((s,o)=>s+o.width,0),i=[];for(let s=0;s<n;s++){const o=[];for(const u of e)if(s<u.length)o.push(u.rows[s]);else{const a=Array(u.width).fill(this.emptyCell);o.push(...a)}i.push(o.join(this.columnSeparator))}return{rows:i,length:n,width:r}}getChildMatrix(e){if(Array.isArray(e)){if(e.length===0)return{rows:[""],length:1,width:1}}else return{rows:["Invalid data found, value is not an array"],length:1,width:1};const n=[],r=this.getHeaderRow(e[0]);n.push(...r.rows);const i=r.width;let s=1;for(const o of e){const u=this.getRowMatrix(o);s=s+u.length,n.push(...u.rows)}return{rows:n,length:s,width:i}}getRowMatrix(e){const n=[];for(const r in e){const i=e[r];if(Array.isArray(i)){const s=this.getChildMatrix(i);n.push(s)}else{const s={rows:[this.stringify(i)],length:1,width:1};n.push(s)}}return this.mergeMatrices(n)}async process(e){let n=!1;for await(const r of e){if(!n&&this.includeHeader){const s=this.getHeaderRow(r.toObject());this.stream.write(s.rows[0]),this.stream.write(this.rowSeparator),n=!0}const i=this.getRowMatrix(r.toObject());for(const s of i.rows)this.stream.write(s),this.stream.write(this.rowSeparator)}this.stream.close()}}we.CSVWriter=ZOe;var W5={};Object.defineProperty(W5,"__esModule",{value:!0}),W5.toAsyncGenerator=void 0;async function*eDe(t){let e=!1;function n(i){let s;const o=new Promise(u=>{s=u});return i(u=>{s({done:!0,isError:!0,error:u})},u=>{s({done:!1,value:u,isError:!1,next:new Promise(a=>{s=a})})},()=>{s({done:!0,isError:!1})}),o}let r=n(t);for(;!e;){const i=await r;if(i.done){if(e=!0,i.isError)throw i.error;break}else r=i.next,yield i.value}}W5.toAsyncGenerator=eDe,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.InMemoryURLReader=t.EmptyURLReader=t.SingleConnectionRuntime=t.ConnectionRuntime=t.AtomicFieldType=t.Runtime=t.Malloy=t.Model=t.MalloyTranslator=t.composeSQLExpr=t.indent=t.expressionIsUngroupedAggregate=t.expressionIsScalar=t.expressionIsCalculation=t.expressionIsAnalytic=t.expressionIsAggregate=t.mkFieldDef=t.mkArrayDef=t.isScalarArray=t.isRepeatedRecord=t.isSamplingRows=t.isSamplingPercent=t.isSamplingEnable=t.isJoinedSource=t.isJoined=t.isLeafAtomic=t.Segment=t.isSourceDef=t.TinyParser=t.Dialect=t.spread=t.literal=t.variadicParam=t.param=t.makeParam=t.sql=t.maxScalar=t.minAggregate=t.anyExprType=t.minScalar=t.overload=t.qtz=t.arg=t.registerDialect=t.MySQLDialect=t.SnowflakeDialect=t.PostgresDialect=t.TrinoDialect=t.StandardSQLDialect=t.DuckDBDialect=void 0,t.Tag=t.toAsyncGenerator=t.Explore=t.DataWriter=t.Parse=t.JSONWriter=t.CSVWriter=t.QueryMaterializer=t.Result=t.PreparedResult=t.TimestampTimeframe=t.DateTimeframe=t.SourceRelationship=t.JoinRelationship=t.MalloyError=t.FixedConnectionMap=void 0;var e=ed;Object.defineProperty(t,"DuckDBDialect",{enumerable:!0,get:function(){return e.DuckDBDialect}}),Object.defineProperty(t,"StandardSQLDialect",{enumerable:!0,get:function(){return e.StandardSQLDialect}}),Object.defineProperty(t,"TrinoDialect",{enumerable:!0,get:function(){return e.TrinoDialect}}),Object.defineProperty(t,"PostgresDialect",{enumerable:!0,get:function(){return e.PostgresDialect}}),Object.defineProperty(t,"SnowflakeDialect",{enumerable:!0,get:function(){return e.SnowflakeDialect}}),Object.defineProperty(t,"MySQLDialect",{enumerable:!0,get:function(){return e.MySQLDialect}}),Object.defineProperty(t,"registerDialect",{enumerable:!0,get:function(){return e.registerDialect}}),Object.defineProperty(t,"arg",{enumerable:!0,get:function(){return e.arg}}),Object.defineProperty(t,"qtz",{enumerable:!0,get:function(){return e.qtz}}),Object.defineProperty(t,"overload",{enumerable:!0,get:function(){return e.overload}}),Object.defineProperty(t,"minScalar",{enumerable:!0,get:function(){return e.minScalar}}),Object.defineProperty(t,"anyExprType",{enumerable:!0,get:function(){return e.anyExprType}}),Object.defineProperty(t,"minAggregate",{enumerable:!0,get:function(){return e.minAggregate}}),Object.defineProperty(t,"maxScalar",{enumerable:!0,get:function(){return e.maxScalar}}),Object.defineProperty(t,"sql",{enumerable:!0,get:function(){return e.sql}}),Object.defineProperty(t,"makeParam",{enumerable:!0,get:function(){return e.makeParam}}),Object.defineProperty(t,"param",{enumerable:!0,get:function(){return e.param}}),Object.defineProperty(t,"variadicParam",{enumerable:!0,get:function(){return e.variadicParam}}),Object.defineProperty(t,"literal",{enumerable:!0,get:function(){return e.literal}}),Object.defineProperty(t,"spread",{enumerable:!0,get:function(){return e.spread}}),Object.defineProperty(t,"Dialect",{enumerable:!0,get:function(){return e.Dialect}}),Object.defineProperty(t,"TinyParser",{enumerable:!0,get:function(){return e.TinyParser}});var n=ts;Object.defineProperty(t,"isSourceDef",{enumerable:!0,get:function(){return n.isSourceDef}}),Object.defineProperty(t,"Segment",{enumerable:!0,get:function(){return n.Segment}}),Object.defineProperty(t,"isLeafAtomic",{enumerable:!0,get:function(){return n.isLeafAtomic}}),Object.defineProperty(t,"isJoined",{enumerable:!0,get:function(){return n.isJoined}}),Object.defineProperty(t,"isJoinedSource",{enumerable:!0,get:function(){return n.isJoinedSource}}),Object.defineProperty(t,"isSamplingEnable",{enumerable:!0,get:function(){return n.isSamplingEnable}}),Object.defineProperty(t,"isSamplingPercent",{enumerable:!0,get:function(){return n.isSamplingPercent}}),Object.defineProperty(t,"isSamplingRows",{enumerable:!0,get:function(){return n.isSamplingRows}}),Object.defineProperty(t,"isRepeatedRecord",{enumerable:!0,get:function(){return n.isRepeatedRecord}}),Object.defineProperty(t,"isScalarArray",{enumerable:!0,get:function(){return n.isScalarArray}}),Object.defineProperty(t,"mkArrayDef",{enumerable:!0,get:function(){return n.mkArrayDef}}),Object.defineProperty(t,"mkFieldDef",{enumerable:!0,get:function(){return n.mkFieldDef}}),Object.defineProperty(t,"expressionIsAggregate",{enumerable:!0,get:function(){return n.expressionIsAggregate}}),Object.defineProperty(t,"expressionIsAnalytic",{enumerable:!0,get:function(){return n.expressionIsAnalytic}}),Object.defineProperty(t,"expressionIsCalculation",{enumerable:!0,get:function(){return n.expressionIsCalculation}}),Object.defineProperty(t,"expressionIsScalar",{enumerable:!0,get:function(){return n.expressionIsScalar}}),Object.defineProperty(t,"expressionIsUngroupedAggregate",{enumerable:!0,get:function(){return n.expressionIsUngroupedAggregate}}),Object.defineProperty(t,"indent",{enumerable:!0,get:function(){return n.indent}}),Object.defineProperty(t,"composeSQLExpr",{enumerable:!0,get:function(){return n.composeSQLExpr}});var r=rO;Object.defineProperty(t,"MalloyTranslator",{enumerable:!0,get:function(){return r.MalloyTranslator}});var i=we;Object.defineProperty(t,"Model",{enumerable:!0,get:function(){return i.Model}}),Object.defineProperty(t,"Malloy",{enumerable:!0,get:function(){return i.Malloy}}),Object.defineProperty(t,"Runtime",{enumerable:!0,get:function(){return i.Runtime}}),Object.defineProperty(t,"AtomicFieldType",{enumerable:!0,get:function(){return i.AtomicFieldType}}),Object.defineProperty(t,"ConnectionRuntime",{enumerable:!0,get:function(){return i.ConnectionRuntime}}),Object.defineProperty(t,"SingleConnectionRuntime",{enumerable:!0,get:function(){return i.SingleConnectionRuntime}}),Object.defineProperty(t,"EmptyURLReader",{enumerable:!0,get:function(){return i.EmptyURLReader}}),Object.defineProperty(t,"InMemoryURLReader",{enumerable:!0,get:function(){return i.InMemoryURLReader}}),Object.defineProperty(t,"FixedConnectionMap",{enumerable:!0,get:function(){return i.FixedConnectionMap}}),Object.defineProperty(t,"MalloyError",{enumerable:!0,get:function(){return i.MalloyError}}),Object.defineProperty(t,"JoinRelationship",{enumerable:!0,get:function(){return i.JoinRelationship}}),Object.defineProperty(t,"SourceRelationship",{enumerable:!0,get:function(){return i.SourceRelationship}}),Object.defineProperty(t,"DateTimeframe",{enumerable:!0,get:function(){return i.DateTimeframe}}),Object.defineProperty(t,"TimestampTimeframe",{enumerable:!0,get:function(){return i.TimestampTimeframe}}),Object.defineProperty(t,"PreparedResult",{enumerable:!0,get:function(){return i.PreparedResult}}),Object.defineProperty(t,"Result",{enumerable:!0,get:function(){return i.Result}}),Object.defineProperty(t,"QueryMaterializer",{enumerable:!0,get:function(){return i.QueryMaterializer}}),Object.defineProperty(t,"CSVWriter",{enumerable:!0,get:function(){return i.CSVWriter}}),Object.defineProperty(t,"JSONWriter",{enumerable:!0,get:function(){return i.JSONWriter}}),Object.defineProperty(t,"Parse",{enumerable:!0,get:function(){return i.Parse}}),Object.defineProperty(t,"DataWriter",{enumerable:!0,get:function(){return i.DataWriter}}),Object.defineProperty(t,"Explore",{enumerable:!0,get:function(){return i.Explore}});var s=W5;Object.defineProperty(t,"toAsyncGenerator",{enumerable:!0,get:function(){return s.toAsyncGenerator}});var o=fo;Object.defineProperty(t,"Tag",{enumerable:!0,get:function(){return o.Tag}})}(ck);function GW(t){const e=t.parentExplore;return(e==null?void 0:e.allFields.findIndex(n=>n.name===t.name))??-1}function am(t){return t.parentExplore?GW(t)===t.parentExplore.allFields.length-1:!0}function lm(t){return GW(t)===0}function WW(t,e){return t.isAtomicField()&&t.isNumber()&&e!==null}function tDe(t,e){return t.isAtomicField()&&t.isBoolean()&&e!==null}function VW(t,e){return t.isAtomicField()&&t.isString()&&e!==null}function nDe(t,e){return t.isAtomicField()&&(t.isDate()||t.isTimestamp())&&e!==null}function lw(t,e){const n=document.createElement("div");n.innerHTML=t;for(const[i,s]of Object.entries(e))n.style[i]=s;document.body.appendChild(n);const r=n.getBoundingClientRect();return document.body.removeChild(n),r.width}function Hs(t){return JSON.stringify(t.fieldPath)}function cw(t){return t[1]-t[0]+1}var V5=(t=>(t.Dollars="usd",t.Euros="euro",t.Pounds="pound",t))(V5||{}),Hn=(t=>(t.Nanoseconds="nanoseconds",t.Microseconds="microseconds",t.Milliseconds="milliseconds",t.Seconds="seconds",t.Minutes="minutes",t.Hours="hours",t.Days="days",t))(Hn||{});function rDe(t){return Object.values(Hn).includes(t)}var YW={exports:{}};(function(t){var e={},n=function(i){i.version="0.11.2";function s(w){for(var $="",M=w.length-1;M>=0;)$+=w.charAt(M--);return $}function o(w,$){for(var M="";M.length<$;)M+=w;return M}function u(w,$){var M=""+w;return M.length>=$?M:o("0",$-M.length)+M}function a(w,$){var M=""+w;return M.length>=$?M:o(" ",$-M.length)+M}function l(w,$){var M=""+w;return M.length>=$?M:M+o(" ",$-M.length)}function c(w,$){var M=""+Math.round(w);return M.length>=$?M:o("0",$-M.length)+M}function f(w,$){var M=""+w;return M.length>=$?M:o("0",$-M.length)+M}var x=Math.pow(2,32);function h(w,$){if(w>x||w<-x)return c(w,$);var M=Math.round(w);return f(M,$)}function p(w,$){return $=$||0,w.length>=7+$&&(w.charCodeAt($)|32)===103&&(w.charCodeAt($+1)|32)===101&&(w.charCodeAt($+2)|32)===110&&(w.charCodeAt($+3)|32)===101&&(w.charCodeAt($+4)|32)===114&&(w.charCodeAt($+5)|32)===97&&(w.charCodeAt($+6)|32)===108}var m=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],g=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];function y(w){w[0]="General",w[1]="0",w[2]="0.00",w[3]="#,##0",w[4]="#,##0.00",w[9]="0%",w[10]="0.00%",w[11]="0.00E+00",w[12]="# ?/?",w[13]="# ??/??",w[14]="m/d/yy",w[15]="d-mmm-yy",w[16]="d-mmm",w[17]="mmm-yy",w[18]="h:mm AM/PM",w[19]="h:mm:ss AM/PM",w[20]="h:mm",w[21]="h:mm:ss",w[22]="m/d/yy h:mm",w[37]="#,##0 ;(#,##0)",w[38]="#,##0 ;[Red](#,##0)",w[39]="#,##0.00;(#,##0.00)",w[40]="#,##0.00;[Red](#,##0.00)",w[45]="mm:ss",w[46]="[h]:mm:ss",w[47]="mmss.0",w[48]="##0.0E+0",w[49]="@",w[56]='"上午/下午 "hh"時"mm"分"ss"秒 "'}var E={};y(E);var A=[],v=0;for(v=5;v<=8;++v)A[v]=32+v;for(v=23;v<=26;++v)A[v]=0;for(v=27;v<=31;++v)A[v]=14;for(v=50;v<=58;++v)A[v]=14;for(v=59;v<=62;++v)A[v]=v-58;for(v=67;v<=68;++v)A[v]=v-58;for(v=72;v<=75;++v)A[v]=v-58;for(v=67;v<=68;++v)A[v]=v-57;for(v=76;v<=78;++v)A[v]=v-56;for(v=79;v<=81;++v)A[v]=v-34;var _=[];_[5]=_[63]='"$"#,##0_);\\("$"#,##0\\)',_[6]=_[64]='"$"#,##0_);[Red]\\("$"#,##0\\)',_[7]=_[65]='"$"#,##0.00_);\\("$"#,##0.00\\)',_[8]=_[66]='"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',_[41]='_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',_[42]='_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',_[43]='_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',_[44]='_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)';function S(w,$,M){for(var Q=w<0?-1:1,B=w*Q,z=0,j=1,J=0,xe=1,oe=0,Z=0,ce=Math.floor(B);oe<$&&(ce=Math.floor(B),J=ce*j+z,Z=ce*oe+xe,!(B-ce<5e-8));)B=1/(B-ce),z=j,j=J,xe=oe,oe=Z;if(Z>$&&(oe>$?(Z=xe,J=z):(Z=oe,J=j)),!M)return[0,Q*J,Z];var Re=Math.floor(Q*J/Z);return[Re,Q*J-Re*Z,Z]}function C(w,$,M){if(w>2958465||w<0)return null;var Q=w|0,B=Math.floor(86400*(w-Q)),z=0,j=[],J={D:Q,T:B,u:86400*(w-Q)-B,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(J.u)<1e-6&&(J.u=0),$&&$.date1904&&(Q+=1462),J.u>.9999&&(J.u=0,++B==86400&&(J.T=B=0,++Q,++J.D)),Q===60)j=M?[1317,10,29]:[1900,2,29],z=3;else if(Q===0)j=M?[1317,8,29]:[1900,1,0],z=6;else{Q>60&&--Q;var xe=new Date(1900,0,1);xe.setDate(xe.getDate()+Q-1),j=[xe.getFullYear(),xe.getMonth()+1,xe.getDate()],z=xe.getDay(),Q<60&&(z=(z+6)%7),M&&(z=G(xe,j))}return J.y=j[0],J.m=j[1],J.d=j[2],J.S=B%60,B=Math.floor(B/60),J.M=B%60,B=Math.floor(B/60),J.H=B,J.q=z,J}i.parse_date_code=C;var b=new Date(1899,11,31,0,0,0),N=b.getTime(),L=new Date(1900,2,1,0,0,0);function I(w,$){var M=w.getTime();return $?M-=1262304e5:w>=L&&(M+=864e5),(M-(N+(w.getTimezoneOffset()-b.getTimezoneOffset())*6e4))/864e5}function P(w){return w.toString(10)}i._general_int=P;var q=function(){var $=/(?:\.0*|(\.\d*[1-9])0+)$/;function M(oe){return oe.indexOf(".")==-1?oe:oe.replace($,"$1")}var Q=/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,B=/(E[+-])(\d)$/;function z(oe){return oe.indexOf("E")==-1?oe:oe.replace(Q,"$1E").replace(B,"$10$2")}function j(oe){var Z=oe<0?12:11,ce=M(oe.toFixed(12));return ce.length<=Z||(ce=oe.toPrecision(10),ce.length<=Z)?ce:oe.toExponential(5)}function J(oe){var Z=M(oe.toFixed(11));return Z.length>(oe<0?12:11)||Z==="0"||Z==="-0"?oe.toPrecision(6):Z}function xe(oe){var Z=Math.floor(Math.log(Math.abs(oe))*Math.LOG10E),ce;return Z>=-4&&Z<=-1?ce=oe.toPrecision(10+Z):Math.abs(Z)<=9?ce=j(oe):Z===10?ce=oe.toFixed(10).substr(0,12):ce=J(oe),M(z(ce.toUpperCase()))}return xe}();i._general_num=q;function X(w,$){switch(typeof w){case"string":return w;case"boolean":return w?"TRUE":"FALSE";case"number":return(w|0)===w?w.toString(10):q(w);case"undefined":return"";case"object":if(w==null)return"";if(w instanceof Date)return W(14,I(w,$&&$.date1904),$)}throw new Error("unsupported value in General format: "+w)}i._general=X;function G(w,$){$[0]-=581;var M=w.getDay();return w<60&&(M=(M+6)%7),M}function ue(w,$,M,Q){var B="",z=0,j=0,J=M.y,xe,oe=0;switch(w){case 98:J=M.y+543;case 121:switch($.length){case 1:case 2:xe=J%100,oe=2;break;default:xe=J%1e4,oe=4;break}break;case 109:switch($.length){case 1:case 2:xe=M.m,oe=$.length;break;case 3:return g[M.m-1][1];case 5:return g[M.m-1][0];default:return g[M.m-1][2]}break;case 100:switch($.length){case 1:case 2:xe=M.d,oe=$.length;break;case 3:return m[M.q][0];default:return m[M.q][1]}break;case 104:switch($.length){case 1:case 2:xe=1+(M.H+11)%12,oe=$.length;break;default:throw"bad hour format: "+$}break;case 72:switch($.length){case 1:case 2:xe=M.H,oe=$.length;break;default:throw"bad hour format: "+$}break;case 77:switch($.length){case 1:case 2:xe=M.M,oe=$.length;break;default:throw"bad minute format: "+$}break;case 115:if($!="s"&&$!="ss"&&$!=".0"&&$!=".00"&&$!=".000")throw"bad second format: "+$;return M.u===0&&($=="s"||$=="ss")?u(M.S,$.length):(Q>=2?j=Q===3?1e3:100:j=Q===1?10:1,z=Math.round(j*(M.S+M.u)),z>=60*j&&(z=0),$==="s"?z===0?"0":""+z/j:(B=u(z,2+Q),$==="ss"?B.substr(0,2):"."+B.substr(2,$.length-1)));case 90:switch($){case"[h]":case"[hh]":xe=M.D*24+M.H;break;case"[m]":case"[mm]":xe=(M.D*24+M.H)*60+M.M;break;case"[s]":case"[ss]":xe=((M.D*24+M.H)*60+M.M)*60+Math.round(M.S+M.u);break;default:throw"bad abstime format: "+$}oe=$.length===3?1:2;break;case 101:xe=J,oe=1;break}var Z=oe>0?u(xe,oe):"";return Z}function he(w){var $=3;if(w.length<=$)return w;for(var M=w.length%$,Q=w.substr(0,M);M!=w.length;M+=$)Q+=(Q.length>0?",":"")+w.substr(M,$);return Q}var pe=function(){var $=/%/g;function M(ne,V,se){var Te=V.replace($,""),K=V.length-Te.length;return pe(ne,Te,se*Math.pow(10,2*K))+o("%",K)}function Q(ne,V,se){for(var Te=V.length-1;V.charCodeAt(Te-1)===44;)--Te;return pe(ne,V.substr(0,Te),se/Math.pow(10,3*(V.length-Te)))}function B(ne,V){var se,Te=ne.indexOf("E")-ne.indexOf(".")-1;if(ne.match(/^#+0.0E\+0$/)){if(V==0)return"0.0E+0";if(V<0)return"-"+B(ne,-V);var K=ne.indexOf(".");K===-1&&(K=ne.indexOf("E"));var de=Math.floor(Math.log(V)*Math.LOG10E)%K;if(de<0&&(de+=K),se=(V/Math.pow(10,de)).toPrecision(Te+1+(K+de)%K),se.indexOf("e")===-1){var Le=Math.floor(Math.log(V)*Math.LOG10E);for(se.indexOf(".")===-1?se=se.charAt(0)+"."+se.substr(1)+"E+"+(Le-se.length+de):se+="E+"+(Le-de);se.substr(0,2)==="0.";)se=se.charAt(0)+se.substr(2,K)+"."+se.substr(2+K),se=se.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");se=se.replace(/\+-/,"-")}se=se.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(He,ot,_t,ut){return ot+_t+ut.substr(0,(K+de)%K)+"."+ut.substr(de)+"E"})}else se=V.toExponential(Te);return ne.match(/E\+00$/)&&se.match(/e[+-]\d$/)&&(se=se.substr(0,se.length-1)+"0"+se.charAt(se.length-1)),ne.match(/E\-/)&&se.match(/e\+/)&&(se=se.replace(/e\+/,"e")),se.replace("e","E")}var z=/# (\?+)( ?)\/( ?)(\d+)/;function j(ne,V,se){var Te=parseInt(ne[4],10),K=Math.round(V*Te),de=Math.floor(K/Te),Le=K-de*Te,He=Te;return se+(de===0?"":""+de)+" "+(Le===0?o(" ",ne[1].length+1+ne[4].length):a(Le,ne[1].length)+ne[2]+"/"+ne[3]+u(He,ne[4].length))}function J(ne,V,se){return se+(V===0?"":""+V)+o(" ",ne[1].length+2+ne[4].length)}var xe=/^#*0*\.([0#]+)/,oe=/\).*[0#]/,Z=/\(###\) ###\\?-####/;function ce(ne){for(var V="",se,Te=0;Te!=ne.length;++Te)switch(se=ne.charCodeAt(Te)){case 35:break;case 63:V+=" ";break;case 48:V+="0";break;default:V+=String.fromCharCode(se)}return V}function Re(ne,V){var se=Math.pow(10,V);return""+Math.round(ne*se)/se}function ke(ne,V){var se=ne-Math.floor(ne),Te=Math.pow(10,V);return V<(""+Math.round(se*Te)).length?0:Math.round(se*Te)}function Ve(ne,V){return V<(""+Math.round((ne-Math.floor(ne))*Math.pow(10,V))).length?1:0}function Y(ne){return ne<2147483647&&ne>-2147483648?""+(ne>=0?ne|0:ne-1|0):""+Math.floor(ne)}function ee(ne,V,se){if(ne.charCodeAt(0)===40&&!V.match(oe)){var Te=V.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return se>=0?ee("n",Te,se):"("+ee("n",Te,-se)+")"}if(V.charCodeAt(V.length-1)===44)return Q(ne,V,se);if(V.indexOf("%")!==-1)return M(ne,V,se);if(V.indexOf("E")!==-1)return B(V,se);if(V.charCodeAt(0)===36)return"$"+ee(ne,V.substr(V.charAt(1)==" "?2:1),se);var K,de,Le,He,ot=Math.abs(se),_t=se<0?"-":"";if(V.match(/^00+$/))return _t+h(ot,V.length);if(V.match(/^[#?]+$/))return K=h(se,0),K==="0"&&(K=""),K.length>V.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(z))return j(de,ot,_t);if(V.match(/^#+0+$/))return _t+h(ot,V.length-V.indexOf("0"));if(de=V.match(xe))return K=Re(se,de[1].length).replace(/^([^\.]+)$/,"$1."+ce(de[1])).replace(/\.$/,"."+ce(de[1])).replace(/\.(\d*)$/,function(Ds,jy){return"."+jy+o("0",ce(de[1]).length-jy.length)}),V.indexOf("0.")!==-1?K:K.replace(/^0\./,".");if(V=V.replace(/^#+([0.])/,"$1"),de=V.match(/^(0*)\.(#*)$/))return _t+Re(ot,de[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,de[1].length?"0.":".");if(de=V.match(/^#{1,3},##0(\.?)$/))return _t+he(h(ot,0));if(de=V.match(/^#,##0\.([#0]*0)$/))return se<0?"-"+ee(ne,V,-se):he(""+(Math.floor(se)+Ve(se,de[1].length)))+"."+u(ke(se,de[1].length),de[1].length);if(de=V.match(/^#,#*,#0/))return ee(ne,V.replace(/^#,#*,/,""),se);if(de=V.match(/^([0#]+)(\\?-([0#]+))+$/))return K=s(ee(ne,V.replace(/[\\-]/g,""),se)),Le=0,s(s(V.replace(/\\/g,"")).replace(/[0#]/g,function(Ds){return Le<K.length?K.charAt(Le++):Ds==="0"?"0":""}));if(V.match(Z))return K=ee(ne,"##########",se),"("+K.substr(0,3)+") "+K.substr(3,3)+"-"+K.substr(6);var ut="";if(de=V.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(de[4].length,7),He=S(ot,Math.pow(10,Le)-1,!1),K=""+_t,ut=pe("n",de[1],He[1]),ut.charAt(ut.length-1)==" "&&(ut=ut.substr(0,ut.length-1)+"0"),K+=ut+de[2]+"/"+de[3],ut=l(He[2],Le),ut.length<de[4].length&&(ut=ce(de[4].substr(de[4].length-ut.length))+ut),K+=ut,K;if(de=V.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(Math.max(de[1].length,de[4].length),7),He=S(ot,Math.pow(10,Le)-1,!0),_t+(He[0]||(He[1]?"":"0"))+" "+(He[1]?a(He[1],Le)+de[2]+"/"+de[3]+l(He[2],Le):o(" ",2*Le+1+de[2].length+de[3].length));if(de=V.match(/^[#0?]+$/))return K=h(se,0),V.length<=K.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(/^([#0?]+)\.([#0]+)$/)){K=""+se.toFixed(Math.min(de[2].length,10)).replace(/([^0])0+$/,"$1"),Le=K.indexOf(".");var pr=V.indexOf(".")-Le,wc=V.length-K.length-pr;return ce(V.substr(0,pr)+K+V.substr(V.length-wc))}if(de=V.match(/^00,000\.([#0]*0)$/))return Le=ke(se,de[1].length),se<0?"-"+ee(ne,V,-se):he(Y(se)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(Ds){return"00,"+(Ds.length<3?u(0,3-Ds.length):"")+Ds})+"."+u(Le,de[1].length);switch(V){case"###,##0.00":return ee(ne,"#,##0.00",se);case"###,###":case"##,###":case"#,###":var My=he(h(ot,0));return My!=="0"?_t+My:"";case"###,###.00":return ee(ne,"###,##0.00",se).replace(/^0\./,".");case"#,###.00":return ee(ne,"#,##0.00",se).replace(/^0\./,".")}throw new Error("unsupported format |"+V+"|")}function Ce(ne,V,se){for(var Te=V.length-1;V.charCodeAt(Te-1)===44;)--Te;return pe(ne,V.substr(0,Te),se/Math.pow(10,3*(V.length-Te)))}function Me(ne,V,se){var Te=V.replace($,""),K=V.length-Te.length;return pe(ne,Te,se*Math.pow(10,2*K))+o("%",K)}function Pe(ne,V){var se,Te=ne.indexOf("E")-ne.indexOf(".")-1;if(ne.match(/^#+0.0E\+0$/)){if(V==0)return"0.0E+0";if(V<0)return"-"+Pe(ne,-V);var K=ne.indexOf(".");K===-1&&(K=ne.indexOf("E"));var de=Math.floor(Math.log(V)*Math.LOG10E)%K;if(de<0&&(de+=K),se=(V/Math.pow(10,de)).toPrecision(Te+1+(K+de)%K),!se.match(/[Ee]/)){var Le=Math.floor(Math.log(V)*Math.LOG10E);se.indexOf(".")===-1?se=se.charAt(0)+"."+se.substr(1)+"E+"+(Le-se.length+de):se+="E+"+(Le-de),se=se.replace(/\+-/,"-")}se=se.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(He,ot,_t,ut){return ot+_t+ut.substr(0,(K+de)%K)+"."+ut.substr(de)+"E"})}else se=V.toExponential(Te);return ne.match(/E\+00$/)&&se.match(/e[+-]\d$/)&&(se=se.substr(0,se.length-1)+"0"+se.charAt(se.length-1)),ne.match(/E\-/)&&se.match(/e\+/)&&(se=se.replace(/e\+/,"e")),se.replace("e","E")}function U(ne,V,se){if(ne.charCodeAt(0)===40&&!V.match(oe)){var Te=V.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return se>=0?U("n",Te,se):"("+U("n",Te,-se)+")"}if(V.charCodeAt(V.length-1)===44)return Ce(ne,V,se);if(V.indexOf("%")!==-1)return Me(ne,V,se);if(V.indexOf("E")!==-1)return Pe(V,se);if(V.charCodeAt(0)===36)return"$"+U(ne,V.substr(V.charAt(1)==" "?2:1),se);var K,de,Le,He,ot=Math.abs(se),_t=se<0?"-":"";if(V.match(/^00+$/))return _t+u(ot,V.length);if(V.match(/^[#?]+$/))return K=""+se,se===0&&(K=""),K.length>V.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(z))return J(de,ot,_t);if(V.match(/^#+0+$/))return _t+u(ot,V.length-V.indexOf("0"));if(de=V.match(xe))return K=(""+se).replace(/^([^\.]+)$/,"$1."+ce(de[1])).replace(/\.$/,"."+ce(de[1])),K=K.replace(/\.(\d*)$/,function(Ds,jy){return"."+jy+o("0",ce(de[1]).length-jy.length)}),V.indexOf("0.")!==-1?K:K.replace(/^0\./,".");if(V=V.replace(/^#+([0.])/,"$1"),de=V.match(/^(0*)\.(#*)$/))return _t+(""+ot).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,de[1].length?"0.":".");if(de=V.match(/^#{1,3},##0(\.?)$/))return _t+he(""+ot);if(de=V.match(/^#,##0\.([#0]*0)$/))return se<0?"-"+U(ne,V,-se):he(""+se)+"."+o("0",de[1].length);if(de=V.match(/^#,#*,#0/))return U(ne,V.replace(/^#,#*,/,""),se);if(de=V.match(/^([0#]+)(\\?-([0#]+))+$/))return K=s(U(ne,V.replace(/[\\-]/g,""),se)),Le=0,s(s(V.replace(/\\/g,"")).replace(/[0#]/g,function(Ds){return Le<K.length?K.charAt(Le++):Ds==="0"?"0":""}));if(V.match(Z))return K=U(ne,"##########",se),"("+K.substr(0,3)+") "+K.substr(3,3)+"-"+K.substr(6);var ut="";if(de=V.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(de[4].length,7),He=S(ot,Math.pow(10,Le)-1,!1),K=""+_t,ut=pe("n",de[1],He[1]),ut.charAt(ut.length-1)==" "&&(ut=ut.substr(0,ut.length-1)+"0"),K+=ut+de[2]+"/"+de[3],ut=l(He[2],Le),ut.length<de[4].length&&(ut=ce(de[4].substr(de[4].length-ut.length))+ut),K+=ut,K;if(de=V.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(Math.max(de[1].length,de[4].length),7),He=S(ot,Math.pow(10,Le)-1,!0),_t+(He[0]||(He[1]?"":"0"))+" "+(He[1]?a(He[1],Le)+de[2]+"/"+de[3]+l(He[2],Le):o(" ",2*Le+1+de[2].length+de[3].length));if(de=V.match(/^[#0?]+$/))return K=""+se,V.length<=K.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(/^([#0]+)\.([#0]+)$/)){K=""+se.toFixed(Math.min(de[2].length,10)).replace(/([^0])0+$/,"$1"),Le=K.indexOf(".");var pr=V.indexOf(".")-Le,wc=V.length-K.length-pr;return ce(V.substr(0,pr)+K+V.substr(V.length-wc))}if(de=V.match(/^00,000\.([#0]*0)$/))return se<0?"-"+U(ne,V,-se):he(""+se).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(Ds){return"00,"+(Ds.length<3?u(0,3-Ds.length):"")+Ds})+"."+u(0,de[1].length);switch(V){case"###,###":case"##,###":case"#,###":var My=he(""+ot);return My!=="0"?_t+My:"";default:if(V.match(/\.[0#?]*$/))return U(ne,V.slice(0,V.lastIndexOf(".")),se)+ce(V.slice(V.lastIndexOf(".")))}throw new Error("unsupported format |"+V+"|")}return function(V,se,Te){return(Te|0)===Te?U(V,se,Te):ee(V,se,Te)}}();function ae(w){for(var $=[],M=!1,Q=0,B=0;Q<w.length;++Q)switch(w.charCodeAt(Q)){case 34:M=!M;break;case 95:case 42:case 92:++Q;break;case 59:$[$.length]=w.substr(B,Q-B),B=Q+1}if($[$.length]=w.substr(B),M===!0)throw new Error("Format |"+w+"| unterminated string ");return $}i._split=ae;var fe=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function re(w){for(var $=0,M="",Q="";$<w.length;)switch(M=w.charAt($)){case"G":p(w,$)&&($+=6),$++;break;case'"':for(;w.charCodeAt(++$)!==34&&$<w.length;);++$;break;case"\\":$+=2;break;case"_":$+=2;break;case"@":++$;break;case"B":case"b":if(w.charAt($+1)==="1"||w.charAt($+1)==="2")return!0;case"M":case"D":case"Y":case"H":case"S":case"E":case"m":case"d":case"y":case"h":case"s":case"e":case"g":return!0;case"A":case"a":case"上":if(w.substr($,3).toUpperCase()==="A/P"||w.substr($,5).toUpperCase()==="AM/PM"||w.substr($,5).toUpperCase()==="上午/下午")return!0;++$;break;case"[":for(Q=M;w.charAt($++)!=="]"&&$<w.length;)Q+=w.charAt($);if(Q.match(fe))return!0;break;case".":case"0":case"#":for(;$<w.length&&("0#?.,E+-%".indexOf(M=w.charAt(++$))>-1||M=="\\"&&w.charAt($+1)=="-"&&"0#".indexOf(w.charAt($+2))>-1););break;case"?":for(;w.charAt(++$)===M;);break;case"*":++$,(w.charAt($)==" "||w.charAt($)=="*")&&++$;break;case"(":case")":++$;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;$<w.length&&"0123456789".indexOf(w.charAt(++$))>-1;);break;case" ":++$;break;default:++$;break}return!1}i.is_date=re;function ie(w,$,M,Q){for(var B=[],z="",j=0,J="",xe="t",oe,Z,ce,Re="H";j<w.length;)switch(J=w.charAt(j)){case"G":if(!p(w,j))throw new Error("unrecognized character "+J+" in "+w);B[B.length]={t:"G",v:"General"},j+=7;break;case'"':for(z="";(ce=w.charCodeAt(++j))!==34&&j<w.length;)z+=String.fromCharCode(ce);B[B.length]={t:"t",v:z},++j;break;case"\\":var ke=w.charAt(++j),Ve=ke==="("||ke===")"?ke:"t";B[B.length]={t:Ve,v:ke},++j;break;case"_":B[B.length]={t:"t",v:" "},j+=2;break;case"@":B[B.length]={t:"T",v:$},++j;break;case"B":case"b":if(w.charAt(j+1)==="1"||w.charAt(j+1)==="2"){if(oe==null&&(oe=C($,M,w.charAt(j+1)==="2"),oe==null))return"";B[B.length]={t:"X",v:w.substr(j,2)},xe=J,j+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":J=J.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if($<0||oe==null&&(oe=C($,M),oe==null))return"";for(z=J;++j<w.length&&w.charAt(j).toLowerCase()===J;)z+=J;J==="m"&&xe.toLowerCase()==="h"&&(J="M"),J==="h"&&(J=Re),B[B.length]={t:J,v:z},xe=J;break;case"A":case"a":case"上":var Y={t:J,v:J};if(oe==null&&(oe=C($,M)),w.substr(j,3).toUpperCase()==="A/P"?(oe!=null&&(Y.v=oe.H>=12?"P":"A"),Y.t="T",Re="h",j+=3):w.substr(j,5).toUpperCase()==="AM/PM"?(oe!=null&&(Y.v=oe.H>=12?"PM":"AM"),Y.t="T",j+=5,Re="h"):w.substr(j,5).toUpperCase()==="上午/下午"?(oe!=null&&(Y.v=oe.H>=12?"下午":"上午"),Y.t="T",j+=5,Re="h"):(Y.t="t",++j),oe==null&&Y.t==="T")return"";B[B.length]=Y,xe=J;break;case"[":for(z=J;w.charAt(j++)!=="]"&&j<w.length;)z+=w.charAt(j);if(z.slice(-1)!=="]")throw'unterminated "[" block: |'+z+"|";if(z.match(fe)){if(oe==null&&(oe=C($,M),oe==null))return"";B[B.length]={t:"Z",v:z.toLowerCase()},xe=z.charAt(1)}else z.indexOf("$")>-1&&(z=(z.match(/\$([^-\[\]]*)/)||[])[1]||"$",re(w)||(B[B.length]={t:"t",v:z}));break;case".":if(oe!=null){for(z=J;++j<w.length&&(J=w.charAt(j))==="0";)z+=J;B[B.length]={t:"s",v:z};break}case"0":case"#":for(z=J;++j<w.length&&"0#?.,E+-%".indexOf(J=w.charAt(j))>-1;)z+=J;B[B.length]={t:"n",v:z};break;case"?":for(z=J;w.charAt(++j)===J;)z+=J;B[B.length]={t:J,v:z},xe=J;break;case"*":++j,(w.charAt(j)==" "||w.charAt(j)=="*")&&++j;break;case"(":case")":B[B.length]={t:Q===1?"t":J,v:J},++j;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(z=J;j<w.length&&"0123456789".indexOf(w.charAt(++j))>-1;)z+=w.charAt(j);B[B.length]={t:"D",v:z};break;case" ":B[B.length]={t:J,v:J},++j;break;case"$":B[B.length]={t:"t",v:"$"},++j;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(J)===-1)throw new Error("unrecognized character "+J+" in "+w);B[B.length]={t:"t",v:J},++j;break}var ee=0,Ce=0,Me;for(j=B.length-1,xe="t";j>=0;--j)switch(B[j].t){case"h":case"H":B[j].t=Re,xe="h",ee<1&&(ee=1);break;case"s":(Me=B[j].v.match(/\.0+$/))&&(Ce=Math.max(Ce,Me[0].length-1)),ee<3&&(ee=3);case"d":case"y":case"M":case"e":xe=B[j].t;break;case"m":xe==="s"&&(B[j].t="M",ee<2&&(ee=2));break;case"X":break;case"Z":ee<1&&B[j].v.match(/[Hh]/)&&(ee=1),ee<2&&B[j].v.match(/[Mm]/)&&(ee=2),ee<3&&B[j].v.match(/[Ss]/)&&(ee=3)}switch(ee){case 0:break;case 1:oe.u>=.5&&(oe.u=0,++oe.S),oe.S>=60&&(oe.S=0,++oe.M),oe.M>=60&&(oe.M=0,++oe.H);break;case 2:oe.u>=.5&&(oe.u=0,++oe.S),oe.S>=60&&(oe.S=0,++oe.M);break}var Pe="",U;for(j=0;j<B.length;++j)switch(B[j].t){case"t":case"T":case" ":case"D":break;case"X":B[j].v="",B[j].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":B[j].v=ue(B[j].t.charCodeAt(0),B[j].v,oe,Ce),B[j].t="t";break;case"n":case"?":for(U=j+1;B[U]!=null&&((J=B[U].t)==="?"||J==="D"||(J===" "||J==="t")&&B[U+1]!=null&&(B[U+1].t==="?"||B[U+1].t==="t"&&B[U+1].v==="/")||B[j].t==="("&&(J===" "||J==="n"||J===")")||J==="t"&&(B[U].v==="/"||B[U].v===" "&&B[U+1]!=null&&B[U+1].t=="?"));)B[j].v+=B[U].v,B[U]={v:"",t:";"},++U;Pe+=B[j].v,j=U-1;break;case"G":B[j].t="t",B[j].v=X($,M);break}var ne="",V,se;if(Pe.length>0){Pe.charCodeAt(0)==40?(V=$<0&&Pe.charCodeAt(0)===45?-$:$,se=pe("n",Pe,V)):(V=$<0&&Q>1?-$:$,se=pe("n",Pe,V),V<0&&B[0]&&B[0].t=="t"&&(se=se.substr(1),B[0].v="-"+B[0].v)),U=se.length-1;var Te=B.length;for(j=0;j<B.length;++j)if(B[j]!=null&&B[j].t!="t"&&B[j].v.indexOf(".")>-1){Te=j;break}var K=B.length;if(Te===B.length&&se.indexOf("E")===-1){for(j=B.length-1;j>=0;--j)B[j]==null||"n?".indexOf(B[j].t)===-1||(U>=B[j].v.length-1?(U-=B[j].v.length,B[j].v=se.substr(U+1,B[j].v.length)):U<0?B[j].v="":(B[j].v=se.substr(0,U+1),U=-1),B[j].t="t",K=j);U>=0&&K<B.length&&(B[K].v=se.substr(0,U+1)+B[K].v)}else if(Te!==B.length&&se.indexOf("E")===-1){for(U=se.indexOf(".")-1,j=Te;j>=0;--j)if(!(B[j]==null||"n?".indexOf(B[j].t)===-1)){for(Z=B[j].v.indexOf(".")>-1&&j===Te?B[j].v.indexOf(".")-1:B[j].v.length-1,ne=B[j].v.substr(Z+1);Z>=0;--Z)U>=0&&(B[j].v.charAt(Z)==="0"||B[j].v.charAt(Z)==="#")&&(ne=se.charAt(U--)+ne);B[j].v=ne,B[j].t="t",K=j}for(U>=0&&K<B.length&&(B[K].v=se.substr(0,U+1)+B[K].v),U=se.indexOf(".")+1,j=Te;j<B.length;++j)if(!(B[j]==null||"n?(".indexOf(B[j].t)===-1&&j!==Te)){for(Z=B[j].v.indexOf(".")>-1&&j===Te?B[j].v.indexOf(".")+1:0,ne=B[j].v.substr(0,Z);Z<B[j].v.length;++Z)U<se.length&&(ne+=se.charAt(U++));B[j].v=ne,B[j].t="t",K=j}}}for(j=0;j<B.length;++j)B[j]!=null&&"n?".indexOf(B[j].t)>-1&&(V=Q>1&&$<0&&j>0&&B[j-1].v==="-"?-$:$,B[j].v=pe(B[j].t,B[j].v,V),B[j].t="t");var de="";for(j=0;j!==B.length;++j)B[j]!=null&&(de+=B[j].v);return de}i._eval=ie;var D=/\[[=<>]/,R=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function O(w,$){if($==null)return!1;var M=parseFloat($[2]);switch($[1]){case"=":if(w==M)return!0;break;case">":if(w>M)return!0;break;case"<":if(w<M)return!0;break;case"<>":if(w!=M)return!0;break;case">=":if(w>=M)return!0;break;case"<=":if(w<=M)return!0;break}return!1}function k(w,$){var M=ae(w),Q=M.length,B=M[Q-1].indexOf("@");if(Q<4&&B>-1&&--Q,M.length>4)throw new Error("cannot find right format for |"+M.join("|")+"|");if(typeof $!="number")return[4,M.length===4||B>-1?M[M.length-1]:"@"];switch(M.length){case 1:M=B>-1?["General","General","General",M[0]]:[M[0],M[0],M[0],"@"];break;case 2:M=B>-1?[M[0],M[0],M[0],M[1]]:[M[0],M[1],M[0],"@"];break;case 3:M=B>-1?[M[0],M[1],M[0],M[2]]:[M[0],M[1],M[2],"@"];break}var z=$>0?M[0]:$<0?M[1]:M[2];if(M[0].indexOf("[")===-1&&M[1].indexOf("[")===-1)return[Q,z];if(M[0].match(D)!=null||M[1].match(D)!=null){var j=M[0].match(R),J=M[1].match(R);return O($,j)?[Q,M[0]]:O($,J)?[Q,M[1]]:[Q,M[j!=null&&J!=null?2:1]]}return[Q,z]}function W(w,$,M){M==null&&(M={});var Q="";switch(typeof w){case"string":w=="m/d/yy"&&M.dateNF?Q=M.dateNF:Q=w;break;case"number":w==14&&M.dateNF?Q=M.dateNF:Q=(M.table!=null?M.table:E)[w],Q==null&&(Q=M.table&&M.table[A[w]]||E[A[w]]),Q==null&&(Q=_[w]||"General");break}if(p(Q,0))return X($,M);$ instanceof Date&&($=I($,M.date1904));var B=k(Q,$);if(p(B[1]))return X($,M);if($===!0)$="TRUE";else if($===!1)$="FALSE";else if($===""||$==null)return"";return ie(B[1],$,M,B[0])}function H(w,$){if(typeof $!="number"){$=+$||-1;for(var M=0;M<392;++M){if(E[M]==null){$<0&&($=M);continue}if(E[M]==w){$=M;break}}$<0&&($=391)}return E[$]=w,$}i.load=H,i._table=E,i.get_table=function(){return E},i.load_table=function($){for(var M=0;M!=392;++M)$[M]!==void 0&&H($[M],M)},i.init_table=y,i.format=W};n(e),typeof DO_NOT_EXPORT_SSF>"u"&&(t.exports=e)})(YW);var Y5=YW.exports;function iDe(t,e,n,r){var i=-1,s=t==null?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}var sDe=iDe;function oDe(t){return function(e){return t==null?void 0:t[e]}}var uDe=oDe,aDe=uDe,lDe={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},cDe=aDe(lDe),fDe=cDe,xDe=typeof T=="object"&&T&&T.Object===Object&&T,dDe=xDe,hDe=dDe,pDe=typeof self=="object"&&self&&self.Object===Object&&self,gDe=hDe||pDe||Function("return this")(),mDe=gDe,yDe=mDe,EDe=yDe.Symbol,fw=EDe;function ADe(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var vDe=ADe,_De=Array.isArray,SDe=_De,KW=fw,JW=Object.prototype,CDe=JW.hasOwnProperty,bDe=JW.toString,cm=KW?KW.toStringTag:void 0;function TDe(t){var e=CDe.call(t,cm),n=t[cm];try{t[cm]=void 0;var r=!0}catch{}var i=bDe.call(t);return r&&(e?t[cm]=n:delete t[cm]),i}var RDe=TDe,ODe=Object.prototype,DDe=ODe.toString;function wDe(t){return DDe.call(t)}var NDe=wDe,XW=fw,FDe=RDe,LDe=NDe,IDe="[object Null]",BDe="[object Undefined]",ZW=XW?XW.toStringTag:void 0;function $De(t){return t==null?t===void 0?BDe:IDe:ZW&&ZW in Object(t)?FDe(t):LDe(t)}var kDe=$De;function PDe(t){return t!=null&&typeof t=="object"}var MDe=PDe,jDe=kDe,UDe=MDe,qDe="[object Symbol]";function HDe(t){return typeof t=="symbol"||UDe(t)&&jDe(t)==qDe}var zDe=HDe,eV=fw,QDe=vDe,GDe=SDe,WDe=zDe,VDe=1/0,tV=eV?eV.prototype:void 0,nV=tV?tV.toString:void 0;function rV(t){if(typeof t=="string")return t;if(GDe(t))return QDe(t,rV)+"";if(WDe(t))return nV?nV.call(t):"";var e=t+"";return e=="0"&&1/t==-VDe?"-0":e}var YDe=rV,KDe=YDe;function JDe(t){return t==null?"":KDe(t)}var xw=JDe,XDe=fDe,ZDe=xw,e7e=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,t7e="\\u0300-\\u036f",n7e="\\ufe20-\\ufe2f",r7e="\\u20d0-\\u20ff",i7e=t7e+n7e+r7e,s7e="["+i7e+"]",o7e=RegExp(s7e,"g");function u7e(t){return t=ZDe(t),t&&t.replace(e7e,XDe).replace(o7e,"")}var a7e=u7e,l7e=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function c7e(t){return t.match(l7e)||[]}var f7e=c7e,x7e=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function d7e(t){return x7e.test(t)}var h7e=d7e,iV="\\ud800-\\udfff",p7e="\\u0300-\\u036f",g7e="\\ufe20-\\ufe2f",m7e="\\u20d0-\\u20ff",y7e=p7e+g7e+m7e,sV="\\u2700-\\u27bf",oV="a-z\\xdf-\\xf6\\xf8-\\xff",E7e="\\xac\\xb1\\xd7\\xf7",A7e="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",v7e="\\u2000-\\u206f",_7e=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",uV="A-Z\\xc0-\\xd6\\xd8-\\xde",S7e="\\ufe0e\\ufe0f",aV=E7e+A7e+v7e+_7e,lV="['’]",cV="["+aV+"]",C7e="["+y7e+"]",fV="\\d+",b7e="["+sV+"]",xV="["+oV+"]",dV="[^"+iV+aV+fV+sV+oV+uV+"]",T7e="\\ud83c[\\udffb-\\udfff]",R7e="(?:"+C7e+"|"+T7e+")",O7e="[^"+iV+"]",hV="(?:\\ud83c[\\udde6-\\uddff]){2}",pV="[\\ud800-\\udbff][\\udc00-\\udfff]",Nh="["+uV+"]",D7e="\\u200d",gV="(?:"+xV+"|"+dV+")",w7e="(?:"+Nh+"|"+dV+")",mV="(?:"+lV+"(?:d|ll|m|re|s|t|ve))?",yV="(?:"+lV+"(?:D|LL|M|RE|S|T|VE))?",EV=R7e+"?",AV="["+S7e+"]?",N7e="(?:"+D7e+"(?:"+[O7e,hV,pV].join("|")+")"+AV+EV+")*",F7e="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",L7e="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",I7e=AV+EV+N7e,B7e="(?:"+[b7e,hV,pV].join("|")+")"+I7e,$7e=RegExp([Nh+"?"+xV+"+"+mV+"(?="+[cV,Nh,"$"].join("|")+")",w7e+"+"+yV+"(?="+[cV,Nh+gV,"$"].join("|")+")",Nh+"?"+gV+"+"+mV,Nh+"+"+yV,L7e,F7e,fV,B7e].join("|"),"g");function k7e(t){return t.match($7e)||[]}var P7e=k7e,M7e=f7e,j7e=h7e,U7e=xw,q7e=P7e;function H7e(t,e,n){return t=U7e(t),e=n?void 0:e,e===void 0?j7e(t)?q7e(t):M7e(t):t.match(e)||[]}var z7e=H7e,Q7e=sDe,G7e=a7e,W7e=z7e,V7e="['’]",Y7e=RegExp(V7e,"g");function K7e(t){return function(e){return Q7e(W7e(G7e(e).replace(Y7e,"")),t,"")}}var J7e=K7e;function X7e(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}var Z7e=X7e,ewe=Z7e;function twe(t,e,n){var r=t.length;return n=n===void 0?r:n,!e&&n>=r?t:ewe(t,e,n)}var nwe=twe,rwe="\\ud800-\\udfff",iwe="\\u0300-\\u036f",swe="\\ufe20-\\ufe2f",owe="\\u20d0-\\u20ff",uwe=iwe+swe+owe,awe="\\ufe0e\\ufe0f",lwe="\\u200d",cwe=RegExp("["+lwe+rwe+uwe+awe+"]");function fwe(t){return cwe.test(t)}var vV=fwe;function xwe(t){return t.split("")}var dwe=xwe,_V="\\ud800-\\udfff",hwe="\\u0300-\\u036f",pwe="\\ufe20-\\ufe2f",gwe="\\u20d0-\\u20ff",mwe=hwe+pwe+gwe,ywe="\\ufe0e\\ufe0f",Ewe="["+_V+"]",dw="["+mwe+"]",hw="\\ud83c[\\udffb-\\udfff]",Awe="(?:"+dw+"|"+hw+")",SV="[^"+_V+"]",CV="(?:\\ud83c[\\udde6-\\uddff]){2}",bV="[\\ud800-\\udbff][\\udc00-\\udfff]",vwe="\\u200d",TV=Awe+"?",RV="["+ywe+"]?",_we="(?:"+vwe+"(?:"+[SV,CV,bV].join("|")+")"+RV+TV+")*",Swe=RV+TV+_we,Cwe="(?:"+[SV+dw+"?",dw,CV,bV,Ewe].join("|")+")",bwe=RegExp(hw+"(?="+hw+")|"+Cwe+Swe,"g");function Twe(t){return t.match(bwe)||[]}var Rwe=Twe,Owe=dwe,Dwe=vV,wwe=Rwe;function Nwe(t){return Dwe(t)?wwe(t):Owe(t)}var Fwe=Nwe,Lwe=nwe,Iwe=vV,Bwe=Fwe,$we=xw;function kwe(t){return function(e){e=$we(e);var n=Iwe(e)?Bwe(e):void 0,r=n?n[0]:e.charAt(0),i=n?Lwe(n,1).join(""):e.slice(1);return r[t]()+i}}var Pwe=kwe,Mwe=Pwe,jwe=Mwe("toUpperCase"),Uwe=jwe,qwe=J7e,Hwe=Uwe,zwe=qwe(function(t,e,n){return t+(n?" ":"")+Hwe(e)}),Qwe=zwe;const Gwe=nE(Qwe);function Wa(t,e,n=!1){if(t!==void 0)switch(t){case"ordinal":return{range:["#C2D5EE","#1A73E8"]};case"temporal":case"quantitative":return e?n?{range:["#6BA4EE","#EEA361"]}:{range:["#1A73E8","#E8710A"]}:{range:["#C2D5EE","#1A73E8"]};case"nominal":return n?{range:["#6BA4EE","#66CEDC","#EC72B8","#EEA361","#F9C85B","#AACD85","#B87CED","#ACB0B3"]}:{range:["#1A73E8","#12B5CB","#E52592","#E8710A","#F9AB00","#7CB342","#9334E6","#80868B"]}}}function Wwe(t,e){const n=wAe.fromJSDate(t,{zone:e??"UTC"});return new Date(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond)}function Vwe(t,e){const n=t.createElement("span");return n.classList.add("error"),n.appendChild(t.createTextNode(typeof e=="string"?e:e.message)),n}function Ywe(t){const e=t.createElement("span");return e.appendChild(t.createTextNode("∅")),e.classList.add("value-null"),e}function $f(t,e,n,r){var o;const i=((o=n==null?void 0:n.data)==null?void 0:o.label)||e.name;let s=t.titleCase?Gwe(i):i;return e.isAtomicField()&&(e.isDate()||e.isTimestamp())&&r&&(s=`${s} (${r})`),s}function Kwe(t,e=0){let n=t;for(;e>0&&n.parentRecord;)e-=1,n=n.parentRecord;return n}function Jwe(t){const e=t.split("/"),n=e.filter(i=>i==="..").length+1,r=e.filter(i=>i!==".."&&i!=="");return{levelsUp:n,pathSegments:r}}function OV({tag:t,data:e}){var n;try{const r=((n=t.tag("field"))==null?void 0:n.text())??"",{levelsUp:i,pathSegments:s}=Jwe(r);let o=Kwe(e,i);for(;s.length>0&&"cell"in o;){const u=s.shift();o=o.cell(u)}return o==null?void 0:o.value}catch{return}}class kf{constructor(){this.tagOptionExtractors={}}addExtractor(e,...n){for(const r in n)this.tagOptionExtractors[n[r]]=e}activates(e){return!1}isValidMatch(e){return!0}matches(e){return e.renderer===this.rendererName}parseTagParameters(e){const n={};for(const r in this.tagOptionExtractors){const i=e.tag(r);i&&this.tagOptionExtractors[r](n,i)}return n}}class DV{constructor(e){this.document=e}getText(e){return e.value===null?null:`${e.value}`}async render(e){let n=null;try{n=this.getText(e)}catch(i){return Vwe(this.document,i)}if(n===null)return Ywe(this.document);const r=this.document.createElement("span");return r.appendChild(this.document.createTextNode(n)),r}}const IT=class IT extends kf{activates(e){return e.hasParentExplore()&&!e.isExploreField()}create(e,n,r,i,s){return new DV(e)}get rendererName(){}};IT.instance=new IT;let wV=IT;function NV(t,e,n={}){let r=e.toString();return n.terse?r=Xwe.get(e)??r:t===1&&(r=r.substring(0,r.length-1)),`${n.numFormat?Y5.format(n.numFormat,t):t.toLocaleString()}${n.terse?"":" "}${r}`}const Xwe=new Map([[Hn.Nanoseconds,"ns"],[Hn.Microseconds,"µs"],[Hn.Milliseconds,"ms"],[Hn.Seconds,"s"],[Hn.Minutes,"m"],[Hn.Hours,"h"],[Hn.Days,"d"]]),Zwe=new Map([[Hn.Nanoseconds,1e3],[Hn.Microseconds,1e3],[Hn.Milliseconds,1e3],[Hn.Seconds,60],[Hn.Minutes,60],[Hn.Hours,24],[Hn.Days,Number.MAX_VALUE]]);function FV(t,e,n){const r=n.durationUnit&&rDe(n.durationUnit)?n.durationUnit:Hn.Seconds,i=t.tagParse().tag,s=i.text("number"),o=i.has("duration","terse");let u=e,a=0,l=[],c=!1;for(const[f,x]of Zwe)if(f===r&&(c=!0),!!c&&(a=u%x,u=Math.floor(u/=x),a>0&&(l=[NV(a,f,{numFormat:s,terse:o}),...l]),u===0))break;return l.length>0?l.slice(0,2).join(" "):NV(0,r,{numFormat:s,terse:o})}class eNe extends DV{constructor(e,n){super(e),this.options=n}getText(e){if(e.isNull())return null;if(!e.isNumber())throw new Error(`Cannot format field ${e.field.name} as a duration unit since its not a number`);return FV(e.field,e.number.value,{durationUnit:this.options.duration_unit})}}const BT=class BT extends kf{constructor(){super(),this.addExtractor((e,n)=>{e.duration_unit=(n==null?void 0:n.text())??Hn.Seconds},this.rendererName)}create(e,n,r,i,s){return new eNe(e,s)}get rendererName(){return"duration"}};BT.instance=new BT;let LV=BT;function Fh(t,e){let n=e;const{tag:r}=t.tagParse();if(r.has("currency")){let i="$";switch(r.text("currency")){case V5.Euros:i="€";break;case V5.Pounds:i="£";break;case V5.Dollars:break}n=Y5.format(`${i}#,##0.00`,e)}else if(r.has("percent"))n=Y5.format("#,##0.00%",e);else if(r.has("duration")){const s=r.text("duration")??Hn.Seconds;return FV(t,e,{durationUnit:s})??e.toLocaleString()}else r.has("number")?n=Y5.format(r.text("number"),e):n=e.toLocaleString();return n}var tNe=yt("<a target=_blank>");function nNe(t,e){const{tag:n}=t.tagParse();if(e.isNull())return"∅";const r=String(e.value),i=n.tag("link");if(!i)throw new Error("Missing tag for Link renderer");const s=OV({tag:i,data:e})??r,o=i.text("url_template");let u=s;o&&(o.indexOf("$$")>-1?u=o.replace("$$",s):u=o+s);const a=r.replace(/\//g,"/‌");return(()=>{var l=tNe();return Zi(l,"href",u),Je(l,a),l})()}function gs(t,e,n){return t.fields=e||[],t.fname=n,t}function wn(t){return t==null?null:t.fname}function oi(t){return t==null?null:t.fields}function IV(t){return t.length===1?rNe(t[0]):iNe(t)}const rNe=t=>function(e){return e[t]},iNe=t=>{const e=t.length;return function(n){for(let r=0;r<e;++r)n=n[t[r]];return n}};function _e(t){throw Error(t)}function Va(t){const e=[],n=t.length;let r=null,i=0,s="",o,u,a;t=t+"";function l(){e.push(s+t.substring(o,u)),s="",o=u+1}for(o=u=0;u<n;++u)if(a=t[u],a==="\\")s+=t.substring(o,u),s+=t.substring(++u,++u),o=u;else if(a===r)l(),r=null,i=-1;else{if(r)continue;o===i&&a==='"'||o===i&&a==="'"?(o=u+1,r=a):a==="."&&!i?u>o?l():o=u+1:a==="["?(u>o&&l(),i=o=u+1):a==="]"&&(i||_e("Access path missing open bracket: "+t),i>0&&l(),i=0,o=u+1)}return i&&_e("Access path missing closing bracket: "+t),r&&_e("Access path missing closing quote: "+t),u>o&&(u++,l()),e}function ms(t,e,n){const r=Va(t);return t=r.length===1?r[0]:t,gs((n&&n.get||IV)(r),[t],e||t)}const K5=ms("id"),ui=gs(t=>t,[],"identity"),Pf=gs(()=>0,[],"zero"),fm=gs(()=>1,[],"one"),Fo=gs(()=>!0,[],"true"),Mf=gs(()=>!1,[],"false");function sNe(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}const oNe=0,BV=1,$V=2,uNe=3,aNe=4;function kV(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:sNe,r=t||oNe;return{level(i){return arguments.length?(r=+i,this):r},error(){return r>=BV&&n("error","ERROR",arguments),this},warn(){return r>=$V&&n("warn","WARN",arguments),this},info(){return r>=uNe&&n("log","INFO",arguments),this},debug(){return r>=aNe&&n("log","DEBUG",arguments),this}}}var Se=Array.isArray;function ze(t){return t===Object(t)}const PV=t=>t!=="__proto__";function pw(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce((r,i)=>{for(const s in i)if(s==="signals")r.signals=lNe(r.signals,i.signals);else{const o=s==="legend"?{layout:1}:s==="style"?!0:null;J5(r,s,i[s],o)}return r},{})}function J5(t,e,n,r){if(!PV(e))return;let i,s;if(ze(n)&&!Se(n)){s=ze(t[e])?t[e]:t[e]={};for(i in n)r&&(r===!0||r[i])?J5(s,i,n[i]):PV(i)&&(s[i]=n[i])}else t[e]=n}function lNe(t,e){if(t==null)return e;const n={},r=[];function i(s){n[s.name]||(n[s.name]=1,r.push(s))}return e.forEach(i),t.forEach(i),r}function Rt(t){return t[t.length-1]}function ai(t){return t==null||t===""?null:+t}const MV=t=>e=>t*Math.exp(e),jV=t=>e=>Math.log(t*e),UV=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),qV=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,X5=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function Z5(t,e,n,r){const i=n(t[0]),s=n(Rt(t)),o=(s-i)*e;return[r(i-o),r(s-o)]}function cNe(t,e){return Z5(t,e,ai,ui)}function fNe(t,e){var n=Math.sign(t[0]);return Z5(t,e,jV(n),MV(n))}function xNe(t,e,n){return Z5(t,e,X5(n),X5(1/n))}function dNe(t,e,n){return Z5(t,e,UV(n),qV(n))}function eS(t,e,n,r,i){const s=r(t[0]),o=r(Rt(t)),u=e!=null?r(e):(s+o)/2;return[i(u+(s-u)*n),i(u+(o-u)*n)]}function HV(t,e,n){return eS(t,e,n,ai,ui)}function zV(t,e,n){const r=Math.sign(t[0]);return eS(t,e,n,jV(r),MV(r))}function gw(t,e,n,r){return eS(t,e,n,X5(r),X5(1/r))}function QV(t,e,n,r){return eS(t,e,n,UV(r),qV(r))}function hNe(t){return 1+~~(new Date(t).getMonth()/3)}function pNe(t){return 1+~~(new Date(t).getUTCMonth()/3)}function Ue(t){return t!=null?Se(t)?t:[t]:[]}function gNe(t,e,n){let r=t[0],i=t[1],s;return i<r&&(s=i,i=r,r=s),s=i-r,s>=n-e?[e,n]:[r=Math.min(Math.max(r,e),n-s),r+s]}function pt(t){return typeof t=="function"}const mNe="descending";function GV(t,e,n){n=n||{},e=Ue(e)||[];const r=[],i=[],s={},o=n.comparator||yNe;return Ue(t).forEach((u,a)=>{u!=null&&(r.push(e[a]===mNe?-1:1),i.push(u=pt(u)?u:ms(u,null,n)),(oi(u)||[]).forEach(l=>s[l]=1))}),i.length===0?null:gs(o(i,r),Object.keys(s))}const mw=(t,e)=>(t<e||t==null)&&e!=null?-1:(t>e||e==null)&&t!=null?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e===e?-1:e!==e&&t===t?1:0),yNe=(t,e)=>t.length===1?ENe(t[0],e[0]):ANe(t,e,t.length),ENe=(t,e)=>function(n,r){return mw(t(n),t(r))*e},ANe=(t,e,n)=>(e.push(0),function(r,i){let s,o=0,u=-1;for(;o===0&&++u<n;)s=t[u],o=mw(s(r),s(i));return o*e[u]});function li(t){return pt(t)?t:()=>t}function WV(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(e(r),n=null),t)}}function gt(t){for(let e,n,r=1,i=arguments.length;r<i;++r){e=arguments[r];for(n in e)t[n]=e[n]}return t}function Ya(t,e){let n=0,r,i,s,o;if(t&&(r=t.length))if(e==null){for(i=t[n];n<r&&(i==null||i!==i);i=t[++n]);for(s=o=i;n<r;++n)i=t[n],i!=null&&(i<s&&(s=i),i>o&&(o=i))}else{for(i=e(t[n]);n<r&&(i==null||i!==i);i=e(t[++n]));for(s=o=i;n<r;++n)i=e(t[n]),i!=null&&(i<s&&(s=i),i>o&&(o=i))}return[s,o]}function vNe(t,e){const n=t.length;let r=-1,i,s,o,u,a;if(e==null){for(;++r<n;)if(s=t[r],s!=null&&s>=s){i=o=s;break}if(r===n)return[-1,-1];for(u=a=r;++r<n;)s=t[r],s!=null&&(i>s&&(i=s,u=r),o<s&&(o=s,a=r))}else{for(;++r<n;)if(s=e(t[r],r,t),s!=null&&s>=s){i=o=s;break}if(r===n)return[-1,-1];for(u=a=r;++r<n;)s=e(t[r],r,t),s!=null&&(i>s&&(i=s,u=r),o<s&&(o=s,a=r))}return[u,a]}const _Ne=Object.prototype.hasOwnProperty;function tt(t,e){return _Ne.call(t,e)}const tS={};function xm(t){let e={},n;function r(s){return tt(e,s)&&e[s]!==tS}const i={size:0,empty:0,object:e,has:r,get(s){return r(s)?e[s]:void 0},set(s,o){return r(s)||(++i.size,e[s]===tS&&--i.empty),e[s]=o,this},delete(s){return r(s)&&(--i.size,++i.empty,e[s]=tS),this},clear(){i.size=i.empty=0,i.object=e={}},test(s){return arguments.length?(n=s,i):n},clean(){const s={};let o=0;for(const u in e){const a=e[u];a!==tS&&(!n||!n(a))&&(s[u]=a,++o)}i.size=o,i.empty=0,i.object=e=s}};return t&&Object.keys(t).forEach(s=>{i.set(s,t[s])}),i}function SNe(t,e,n,r,i,s){if(!n&&n!==0)return s;const o=+n;let u=t[0],a=Rt(t),l;a<u&&(l=u,u=a,a=l),l=Math.abs(e-u);const c=Math.abs(a-e);return l<c&&l<=o?r:c<=o?i:s}function Ne(t,e,n){const r=t.prototype=Object.create(e.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),gt(r,n)}function dm(t,e,n,r){let i=e[0],s=e[e.length-1],o;return i>s&&(o=i,i=s,s=o),n=n===void 0||n,r=r===void 0||r,(n?i<=t:i<t)&&(r?t<=s:t<s)}function Lh(t){return typeof t=="boolean"}function jf(t){return Object.prototype.toString.call(t)==="[object Date]"}function CNe(t){return t&&pt(t[Symbol.iterator])}function on(t){return typeof t=="number"}function bNe(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function qe(t){return typeof t=="string"}function VV(t,e,n){t&&(t=e?Ue(t).map(u=>u.replace(/\\(.)/g,"$1")):Ue(t));const r=t&&t.length,i=n&&n.get||IV,s=u=>i(e?[u]:Va(u));let o;if(!r)o=function(){return""};else if(r===1){const u=s(t[0]);o=function(a){return""+u(a)}}else{const u=t.map(s);o=function(a){let l=""+u[0](a),c=0;for(;++c<r;)l+="|"+u[c](a);return l}}return gs(o,t,"key")}function TNe(t,e){const n=t[0],r=Rt(t),i=+e;return i?i===1?r:n+i*(r-n):n}const RNe=1e4;function ONe(t){t=+t||RNe;let e,n,r;const i=()=>{e={},n={},r=0},s=(o,u)=>(++r>t&&(n=e,e={},r=1),e[o]=u);return i(),{clear:i,has:o=>tt(e,o)||tt(n,o),get:o=>tt(e,o)?e[o]:tt(n,o)?s(o,n[o]):void 0,set:(o,u)=>tt(e,o)?e[o]=u:s(o,u)}}function DNe(t,e,n,r){const i=e.length,s=n.length;if(!s)return e;if(!i)return n;const o=r||new e.constructor(i+s);let u=0,a=0,l=0;for(;u<i&&a<s;++l)o[l]=t(e[u],n[a])>0?n[a++]:e[u++];for(;u<i;++u,++l)o[l]=e[u];for(;a<s;++a,++l)o[l]=n[a];return o}function nS(t,e){let n="";for(;--e>=0;)n+=t;return n}function wNe(t,e,n,r){const i=n||" ",s=t+"",o=e-s.length;return o<=0?s:r==="left"?nS(i,o)+s:r==="center"?nS(i,~~(o/2))+s+nS(i,Math.ceil(o/2)):s+nS(i,o)}function rS(t){return t&&Rt(t)-t[0]||0}function Fe(t){return Se(t)?"["+t.map(Fe)+"]":ze(t)||qe(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function YV(t){return t==null||t===""?null:!t||t==="false"||t==="0"?!1:!!t}const NNe=t=>on(t)||jf(t)?t:Date.parse(t);function KV(t,e){return e=e||NNe,t==null||t===""?null:e(t)}function JV(t){return t==null||t===""?null:t+""}function Bu(t){const e={},n=t.length;for(let r=0;r<n;++r)e[t[r]]=!0;return e}function FNe(t,e,n,r){const i=r??"…",s=t+"",o=s.length,u=Math.max(0,e-i.length);return o<=e?s:n==="left"?i+s.slice(o-u):n==="center"?s.slice(0,Math.ceil(u/2))+i+s.slice(o-~~(u/2)):s.slice(0,u)+i}function Uf(t,e,n){if(t)if(e){const r=t.length;for(let i=0;i<r;++i){const s=e(t[i]);s&&n(s,i,t)}}else t.forEach(n)}var XV={},yw={},Ew=34,hm=10,Aw=13;function ZV(t){return new Function("d","return {"+t.map(function(e,n){return JSON.stringify(e)+": d["+n+'] || ""'}).join(",")+"}")}function LNe(t,e){var n=ZV(t);return function(r,i){return e(n(r),i,t)}}function eY(t){var e=Object.create(null),n=[];return t.forEach(function(r){for(var i in r)i in e||n.push(e[i]=i)}),n}function Bi(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function INe(t){return t<0?"-"+Bi(-t,6):t>9999?"+"+Bi(t,6):Bi(t,4)}function BNe(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":INe(t.getUTCFullYear())+"-"+Bi(t.getUTCMonth()+1,2)+"-"+Bi(t.getUTCDate(),2)+(i?"T"+Bi(e,2)+":"+Bi(n,2)+":"+Bi(r,2)+"."+Bi(i,3)+"Z":r?"T"+Bi(e,2)+":"+Bi(n,2)+":"+Bi(r,2)+"Z":n||e?"T"+Bi(e,2)+":"+Bi(n,2)+"Z":"")}function $Ne(t){var e=new RegExp('["'+t+`
1291
+ `,this.quoteCharacter='"',this.includeHeader=!0,this.emptyCell=""}escape(e){const n=e.includes(this.quoteCharacter),r=e.includes(this.columnSeparator),i=e.includes(this.rowSeparator),s=r||n||i;return n&&(e=e.replace(new RegExp(this.quoteCharacter,"g"),this.quoteCharacter+this.quoteCharacter)),s&&(e=this.quoteCharacter+e+this.quoteCharacter),e}stringify(e){return e===null?this.emptyCell:e instanceof Date?e.toISOString():typeof e=="boolean"||typeof e=="number"?JSON.stringify(e):`${e}`}getColWeight(e){let n=e;Array.isArray(e)&&(n=e[0]);let r=0;for(const i in n){r=r+1;const s=n[i];if(Array.isArray(s)){const o=this.getColWeight(s)-1;r=r+o}}return r}getHeaderRow(e){const n=[];let r=0;for(const i in e){n.push(this.escape(i));const s=e[i];if(r++,Array.isArray(s)){const o=this.getColWeight(s)-1;r=r+o;for(let u=0;u<o;u++)n.push(this.emptyCell)}}return{rows:[n.join(this.columnSeparator)],length:1,width:r}}mergeMatrices(e){const n=Math.max(...e.map(s=>s.length)),r=e.reduce((s,o)=>s+o.width,0),i=[];for(let s=0;s<n;s++){const o=[];for(const u of e)if(s<u.length)o.push(u.rows[s]);else{const a=Array(u.width).fill(this.emptyCell);o.push(...a)}i.push(o.join(this.columnSeparator))}return{rows:i,length:n,width:r}}getChildMatrix(e){if(Array.isArray(e)){if(e.length===0)return{rows:[""],length:1,width:1}}else return{rows:["Invalid data found, value is not an array"],length:1,width:1};const n=[],r=this.getHeaderRow(e[0]);n.push(...r.rows);const i=r.width;let s=1;for(const o of e){const u=this.getRowMatrix(o);s=s+u.length,n.push(...u.rows)}return{rows:n,length:s,width:i}}getRowMatrix(e){const n=[];for(const r in e){const i=e[r];if(Array.isArray(i)){const s=this.getChildMatrix(i);n.push(s)}else{const s={rows:[this.stringify(i)],length:1,width:1};n.push(s)}}return this.mergeMatrices(n)}async process(e){let n=!1;for await(const r of e){if(!n&&this.includeHeader){const s=this.getHeaderRow(r.toObject());this.stream.write(s.rows[0]),this.stream.write(this.rowSeparator),n=!0}const i=this.getRowMatrix(r.toObject());for(const s of i.rows)this.stream.write(s),this.stream.write(this.rowSeparator)}this.stream.close()}}we.CSVWriter=ZOe;var W5={};Object.defineProperty(W5,"__esModule",{value:!0}),W5.toAsyncGenerator=void 0;async function*eDe(t){let e=!1;function n(i){let s;const o=new Promise(u=>{s=u});return i(u=>{s({done:!0,isError:!0,error:u})},u=>{s({done:!1,value:u,isError:!1,next:new Promise(a=>{s=a})})},()=>{s({done:!0,isError:!1})}),o}let r=n(t);for(;!e;){const i=await r;if(i.done){if(e=!0,i.isError)throw i.error;break}else r=i.next,yield i.value}}W5.toAsyncGenerator=eDe,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.InMemoryURLReader=t.EmptyURLReader=t.SingleConnectionRuntime=t.ConnectionRuntime=t.AtomicFieldType=t.Runtime=t.Malloy=t.Model=t.MalloyTranslator=t.composeSQLExpr=t.indent=t.expressionIsUngroupedAggregate=t.expressionIsScalar=t.expressionIsCalculation=t.expressionIsAnalytic=t.expressionIsAggregate=t.mkFieldDef=t.mkArrayDef=t.isScalarArray=t.isRepeatedRecord=t.isSamplingRows=t.isSamplingPercent=t.isSamplingEnable=t.isJoinedSource=t.isJoined=t.isLeafAtomic=t.Segment=t.isSourceDef=t.TinyParser=t.Dialect=t.spread=t.literal=t.variadicParam=t.param=t.makeParam=t.sql=t.maxScalar=t.minAggregate=t.anyExprType=t.minScalar=t.overload=t.qtz=t.arg=t.registerDialect=t.MySQLDialect=t.SnowflakeDialect=t.PostgresDialect=t.TrinoDialect=t.StandardSQLDialect=t.DuckDBDialect=void 0,t.Tag=t.toAsyncGenerator=t.Explore=t.DataWriter=t.Parse=t.JSONWriter=t.CSVWriter=t.QueryMaterializer=t.Result=t.PreparedResult=t.TimestampTimeframe=t.DateTimeframe=t.SourceRelationship=t.JoinRelationship=t.MalloyError=t.FixedConnectionMap=void 0;var e=ed;Object.defineProperty(t,"DuckDBDialect",{enumerable:!0,get:function(){return e.DuckDBDialect}}),Object.defineProperty(t,"StandardSQLDialect",{enumerable:!0,get:function(){return e.StandardSQLDialect}}),Object.defineProperty(t,"TrinoDialect",{enumerable:!0,get:function(){return e.TrinoDialect}}),Object.defineProperty(t,"PostgresDialect",{enumerable:!0,get:function(){return e.PostgresDialect}}),Object.defineProperty(t,"SnowflakeDialect",{enumerable:!0,get:function(){return e.SnowflakeDialect}}),Object.defineProperty(t,"MySQLDialect",{enumerable:!0,get:function(){return e.MySQLDialect}}),Object.defineProperty(t,"registerDialect",{enumerable:!0,get:function(){return e.registerDialect}}),Object.defineProperty(t,"arg",{enumerable:!0,get:function(){return e.arg}}),Object.defineProperty(t,"qtz",{enumerable:!0,get:function(){return e.qtz}}),Object.defineProperty(t,"overload",{enumerable:!0,get:function(){return e.overload}}),Object.defineProperty(t,"minScalar",{enumerable:!0,get:function(){return e.minScalar}}),Object.defineProperty(t,"anyExprType",{enumerable:!0,get:function(){return e.anyExprType}}),Object.defineProperty(t,"minAggregate",{enumerable:!0,get:function(){return e.minAggregate}}),Object.defineProperty(t,"maxScalar",{enumerable:!0,get:function(){return e.maxScalar}}),Object.defineProperty(t,"sql",{enumerable:!0,get:function(){return e.sql}}),Object.defineProperty(t,"makeParam",{enumerable:!0,get:function(){return e.makeParam}}),Object.defineProperty(t,"param",{enumerable:!0,get:function(){return e.param}}),Object.defineProperty(t,"variadicParam",{enumerable:!0,get:function(){return e.variadicParam}}),Object.defineProperty(t,"literal",{enumerable:!0,get:function(){return e.literal}}),Object.defineProperty(t,"spread",{enumerable:!0,get:function(){return e.spread}}),Object.defineProperty(t,"Dialect",{enumerable:!0,get:function(){return e.Dialect}}),Object.defineProperty(t,"TinyParser",{enumerable:!0,get:function(){return e.TinyParser}});var n=ts;Object.defineProperty(t,"isSourceDef",{enumerable:!0,get:function(){return n.isSourceDef}}),Object.defineProperty(t,"Segment",{enumerable:!0,get:function(){return n.Segment}}),Object.defineProperty(t,"isLeafAtomic",{enumerable:!0,get:function(){return n.isLeafAtomic}}),Object.defineProperty(t,"isJoined",{enumerable:!0,get:function(){return n.isJoined}}),Object.defineProperty(t,"isJoinedSource",{enumerable:!0,get:function(){return n.isJoinedSource}}),Object.defineProperty(t,"isSamplingEnable",{enumerable:!0,get:function(){return n.isSamplingEnable}}),Object.defineProperty(t,"isSamplingPercent",{enumerable:!0,get:function(){return n.isSamplingPercent}}),Object.defineProperty(t,"isSamplingRows",{enumerable:!0,get:function(){return n.isSamplingRows}}),Object.defineProperty(t,"isRepeatedRecord",{enumerable:!0,get:function(){return n.isRepeatedRecord}}),Object.defineProperty(t,"isScalarArray",{enumerable:!0,get:function(){return n.isScalarArray}}),Object.defineProperty(t,"mkArrayDef",{enumerable:!0,get:function(){return n.mkArrayDef}}),Object.defineProperty(t,"mkFieldDef",{enumerable:!0,get:function(){return n.mkFieldDef}}),Object.defineProperty(t,"expressionIsAggregate",{enumerable:!0,get:function(){return n.expressionIsAggregate}}),Object.defineProperty(t,"expressionIsAnalytic",{enumerable:!0,get:function(){return n.expressionIsAnalytic}}),Object.defineProperty(t,"expressionIsCalculation",{enumerable:!0,get:function(){return n.expressionIsCalculation}}),Object.defineProperty(t,"expressionIsScalar",{enumerable:!0,get:function(){return n.expressionIsScalar}}),Object.defineProperty(t,"expressionIsUngroupedAggregate",{enumerable:!0,get:function(){return n.expressionIsUngroupedAggregate}}),Object.defineProperty(t,"indent",{enumerable:!0,get:function(){return n.indent}}),Object.defineProperty(t,"composeSQLExpr",{enumerable:!0,get:function(){return n.composeSQLExpr}});var r=rO;Object.defineProperty(t,"MalloyTranslator",{enumerable:!0,get:function(){return r.MalloyTranslator}});var i=we;Object.defineProperty(t,"Model",{enumerable:!0,get:function(){return i.Model}}),Object.defineProperty(t,"Malloy",{enumerable:!0,get:function(){return i.Malloy}}),Object.defineProperty(t,"Runtime",{enumerable:!0,get:function(){return i.Runtime}}),Object.defineProperty(t,"AtomicFieldType",{enumerable:!0,get:function(){return i.AtomicFieldType}}),Object.defineProperty(t,"ConnectionRuntime",{enumerable:!0,get:function(){return i.ConnectionRuntime}}),Object.defineProperty(t,"SingleConnectionRuntime",{enumerable:!0,get:function(){return i.SingleConnectionRuntime}}),Object.defineProperty(t,"EmptyURLReader",{enumerable:!0,get:function(){return i.EmptyURLReader}}),Object.defineProperty(t,"InMemoryURLReader",{enumerable:!0,get:function(){return i.InMemoryURLReader}}),Object.defineProperty(t,"FixedConnectionMap",{enumerable:!0,get:function(){return i.FixedConnectionMap}}),Object.defineProperty(t,"MalloyError",{enumerable:!0,get:function(){return i.MalloyError}}),Object.defineProperty(t,"JoinRelationship",{enumerable:!0,get:function(){return i.JoinRelationship}}),Object.defineProperty(t,"SourceRelationship",{enumerable:!0,get:function(){return i.SourceRelationship}}),Object.defineProperty(t,"DateTimeframe",{enumerable:!0,get:function(){return i.DateTimeframe}}),Object.defineProperty(t,"TimestampTimeframe",{enumerable:!0,get:function(){return i.TimestampTimeframe}}),Object.defineProperty(t,"PreparedResult",{enumerable:!0,get:function(){return i.PreparedResult}}),Object.defineProperty(t,"Result",{enumerable:!0,get:function(){return i.Result}}),Object.defineProperty(t,"QueryMaterializer",{enumerable:!0,get:function(){return i.QueryMaterializer}}),Object.defineProperty(t,"CSVWriter",{enumerable:!0,get:function(){return i.CSVWriter}}),Object.defineProperty(t,"JSONWriter",{enumerable:!0,get:function(){return i.JSONWriter}}),Object.defineProperty(t,"Parse",{enumerable:!0,get:function(){return i.Parse}}),Object.defineProperty(t,"DataWriter",{enumerable:!0,get:function(){return i.DataWriter}}),Object.defineProperty(t,"Explore",{enumerable:!0,get:function(){return i.Explore}});var s=W5;Object.defineProperty(t,"toAsyncGenerator",{enumerable:!0,get:function(){return s.toAsyncGenerator}});var o=fo;Object.defineProperty(t,"Tag",{enumerable:!0,get:function(){return o.Tag}})}(ck);function GW(t){const e=t.parentExplore;return(e==null?void 0:e.allFields.findIndex(n=>n.name===t.name))??-1}function am(t){return t.parentExplore?GW(t)===t.parentExplore.allFields.length-1:!0}function lm(t){return GW(t)===0}function WW(t,e){return t.isAtomicField()&&t.isNumber()&&e!==null}function tDe(t,e){return t.isAtomicField()&&t.isBoolean()&&e!==null}function VW(t,e){return t.isAtomicField()&&t.isString()&&e!==null}function nDe(t,e){return t.isAtomicField()&&(t.isDate()||t.isTimestamp())&&e!==null}function lw(t,e){const n=document.createElement("div");n.innerHTML=t;for(const[i,s]of Object.entries(e))n.style[i]=s;document.body.appendChild(n);const r=n.getBoundingClientRect();return document.body.removeChild(n),r.width}function Hs(t){return JSON.stringify(t.fieldPath)}function cw(t){return t[1]-t[0]+1}var V5=(t=>(t.Dollars="usd",t.Euros="euro",t.Pounds="pound",t))(V5||{}),Hn=(t=>(t.Nanoseconds="nanoseconds",t.Microseconds="microseconds",t.Milliseconds="milliseconds",t.Seconds="seconds",t.Minutes="minutes",t.Hours="hours",t.Days="days",t))(Hn||{});function rDe(t){return Object.values(Hn).includes(t)}var YW={exports:{}};(function(t){var e={},n=function(i){i.version="0.11.2";function s(w){for(var $="",M=w.length-1;M>=0;)$+=w.charAt(M--);return $}function o(w,$){for(var M="";M.length<$;)M+=w;return M}function u(w,$){var M=""+w;return M.length>=$?M:o("0",$-M.length)+M}function a(w,$){var M=""+w;return M.length>=$?M:o(" ",$-M.length)+M}function l(w,$){var M=""+w;return M.length>=$?M:M+o(" ",$-M.length)}function c(w,$){var M=""+Math.round(w);return M.length>=$?M:o("0",$-M.length)+M}function f(w,$){var M=""+w;return M.length>=$?M:o("0",$-M.length)+M}var x=Math.pow(2,32);function h(w,$){if(w>x||w<-x)return c(w,$);var M=Math.round(w);return f(M,$)}function p(w,$){return $=$||0,w.length>=7+$&&(w.charCodeAt($)|32)===103&&(w.charCodeAt($+1)|32)===101&&(w.charCodeAt($+2)|32)===110&&(w.charCodeAt($+3)|32)===101&&(w.charCodeAt($+4)|32)===114&&(w.charCodeAt($+5)|32)===97&&(w.charCodeAt($+6)|32)===108}var m=[["Sun","Sunday"],["Mon","Monday"],["Tue","Tuesday"],["Wed","Wednesday"],["Thu","Thursday"],["Fri","Friday"],["Sat","Saturday"]],g=[["J","Jan","January"],["F","Feb","February"],["M","Mar","March"],["A","Apr","April"],["M","May","May"],["J","Jun","June"],["J","Jul","July"],["A","Aug","August"],["S","Sep","September"],["O","Oct","October"],["N","Nov","November"],["D","Dec","December"]];function y(w){w[0]="General",w[1]="0",w[2]="0.00",w[3]="#,##0",w[4]="#,##0.00",w[9]="0%",w[10]="0.00%",w[11]="0.00E+00",w[12]="# ?/?",w[13]="# ??/??",w[14]="m/d/yy",w[15]="d-mmm-yy",w[16]="d-mmm",w[17]="mmm-yy",w[18]="h:mm AM/PM",w[19]="h:mm:ss AM/PM",w[20]="h:mm",w[21]="h:mm:ss",w[22]="m/d/yy h:mm",w[37]="#,##0 ;(#,##0)",w[38]="#,##0 ;[Red](#,##0)",w[39]="#,##0.00;(#,##0.00)",w[40]="#,##0.00;[Red](#,##0.00)",w[45]="mm:ss",w[46]="[h]:mm:ss",w[47]="mmss.0",w[48]="##0.0E+0",w[49]="@",w[56]='"上午/下午 "hh"時"mm"分"ss"秒 "'}var E={};y(E);var A=[],v=0;for(v=5;v<=8;++v)A[v]=32+v;for(v=23;v<=26;++v)A[v]=0;for(v=27;v<=31;++v)A[v]=14;for(v=50;v<=58;++v)A[v]=14;for(v=59;v<=62;++v)A[v]=v-58;for(v=67;v<=68;++v)A[v]=v-58;for(v=72;v<=75;++v)A[v]=v-58;for(v=67;v<=68;++v)A[v]=v-57;for(v=76;v<=78;++v)A[v]=v-56;for(v=79;v<=81;++v)A[v]=v-34;var _=[];_[5]=_[63]='"$"#,##0_);\\("$"#,##0\\)',_[6]=_[64]='"$"#,##0_);[Red]\\("$"#,##0\\)',_[7]=_[65]='"$"#,##0.00_);\\("$"#,##0.00\\)',_[8]=_[66]='"$"#,##0.00_);[Red]\\("$"#,##0.00\\)',_[41]='_(* #,##0_);_(* \\(#,##0\\);_(* "-"_);_(@_)',_[42]='_("$"* #,##0_);_("$"* \\(#,##0\\);_("$"* "-"_);_(@_)',_[43]='_(* #,##0.00_);_(* \\(#,##0.00\\);_(* "-"??_);_(@_)',_[44]='_("$"* #,##0.00_);_("$"* \\(#,##0.00\\);_("$"* "-"??_);_(@_)';function S(w,$,M){for(var Q=w<0?-1:1,B=w*Q,z=0,j=1,J=0,xe=1,oe=0,Z=0,ce=Math.floor(B);oe<$&&(ce=Math.floor(B),J=ce*j+z,Z=ce*oe+xe,!(B-ce<5e-8));)B=1/(B-ce),z=j,j=J,xe=oe,oe=Z;if(Z>$&&(oe>$?(Z=xe,J=z):(Z=oe,J=j)),!M)return[0,Q*J,Z];var Re=Math.floor(Q*J/Z);return[Re,Q*J-Re*Z,Z]}function C(w,$,M){if(w>2958465||w<0)return null;var Q=w|0,B=Math.floor(86400*(w-Q)),z=0,j=[],J={D:Q,T:B,u:86400*(w-Q)-B,y:0,m:0,d:0,H:0,M:0,S:0,q:0};if(Math.abs(J.u)<1e-6&&(J.u=0),$&&$.date1904&&(Q+=1462),J.u>.9999&&(J.u=0,++B==86400&&(J.T=B=0,++Q,++J.D)),Q===60)j=M?[1317,10,29]:[1900,2,29],z=3;else if(Q===0)j=M?[1317,8,29]:[1900,1,0],z=6;else{Q>60&&--Q;var xe=new Date(1900,0,1);xe.setDate(xe.getDate()+Q-1),j=[xe.getFullYear(),xe.getMonth()+1,xe.getDate()],z=xe.getDay(),Q<60&&(z=(z+6)%7),M&&(z=G(xe,j))}return J.y=j[0],J.m=j[1],J.d=j[2],J.S=B%60,B=Math.floor(B/60),J.M=B%60,B=Math.floor(B/60),J.H=B,J.q=z,J}i.parse_date_code=C;var b=new Date(1899,11,31,0,0,0),N=b.getTime(),L=new Date(1900,2,1,0,0,0);function I(w,$){var M=w.getTime();return $?M-=1262304e5:w>=L&&(M+=864e5),(M-(N+(w.getTimezoneOffset()-b.getTimezoneOffset())*6e4))/864e5}function P(w){return w.toString(10)}i._general_int=P;var q=function(){var $=/(?:\.0*|(\.\d*[1-9])0+)$/;function M(oe){return oe.indexOf(".")==-1?oe:oe.replace($,"$1")}var Q=/(?:\.0*|(\.\d*[1-9])0+)[Ee]/,B=/(E[+-])(\d)$/;function z(oe){return oe.indexOf("E")==-1?oe:oe.replace(Q,"$1E").replace(B,"$10$2")}function j(oe){var Z=oe<0?12:11,ce=M(oe.toFixed(12));return ce.length<=Z||(ce=oe.toPrecision(10),ce.length<=Z)?ce:oe.toExponential(5)}function J(oe){var Z=M(oe.toFixed(11));return Z.length>(oe<0?12:11)||Z==="0"||Z==="-0"?oe.toPrecision(6):Z}function xe(oe){var Z=Math.floor(Math.log(Math.abs(oe))*Math.LOG10E),ce;return Z>=-4&&Z<=-1?ce=oe.toPrecision(10+Z):Math.abs(Z)<=9?ce=j(oe):Z===10?ce=oe.toFixed(10).substr(0,12):ce=J(oe),M(z(ce.toUpperCase()))}return xe}();i._general_num=q;function X(w,$){switch(typeof w){case"string":return w;case"boolean":return w?"TRUE":"FALSE";case"number":return(w|0)===w?w.toString(10):q(w);case"undefined":return"";case"object":if(w==null)return"";if(w instanceof Date)return W(14,I(w,$&&$.date1904),$)}throw new Error("unsupported value in General format: "+w)}i._general=X;function G(w,$){$[0]-=581;var M=w.getDay();return w<60&&(M=(M+6)%7),M}function ue(w,$,M,Q){var B="",z=0,j=0,J=M.y,xe,oe=0;switch(w){case 98:J=M.y+543;case 121:switch($.length){case 1:case 2:xe=J%100,oe=2;break;default:xe=J%1e4,oe=4;break}break;case 109:switch($.length){case 1:case 2:xe=M.m,oe=$.length;break;case 3:return g[M.m-1][1];case 5:return g[M.m-1][0];default:return g[M.m-1][2]}break;case 100:switch($.length){case 1:case 2:xe=M.d,oe=$.length;break;case 3:return m[M.q][0];default:return m[M.q][1]}break;case 104:switch($.length){case 1:case 2:xe=1+(M.H+11)%12,oe=$.length;break;default:throw"bad hour format: "+$}break;case 72:switch($.length){case 1:case 2:xe=M.H,oe=$.length;break;default:throw"bad hour format: "+$}break;case 77:switch($.length){case 1:case 2:xe=M.M,oe=$.length;break;default:throw"bad minute format: "+$}break;case 115:if($!="s"&&$!="ss"&&$!=".0"&&$!=".00"&&$!=".000")throw"bad second format: "+$;return M.u===0&&($=="s"||$=="ss")?u(M.S,$.length):(Q>=2?j=Q===3?1e3:100:j=Q===1?10:1,z=Math.round(j*(M.S+M.u)),z>=60*j&&(z=0),$==="s"?z===0?"0":""+z/j:(B=u(z,2+Q),$==="ss"?B.substr(0,2):"."+B.substr(2,$.length-1)));case 90:switch($){case"[h]":case"[hh]":xe=M.D*24+M.H;break;case"[m]":case"[mm]":xe=(M.D*24+M.H)*60+M.M;break;case"[s]":case"[ss]":xe=((M.D*24+M.H)*60+M.M)*60+Math.round(M.S+M.u);break;default:throw"bad abstime format: "+$}oe=$.length===3?1:2;break;case 101:xe=J,oe=1;break}var Z=oe>0?u(xe,oe):"";return Z}function he(w){var $=3;if(w.length<=$)return w;for(var M=w.length%$,Q=w.substr(0,M);M!=w.length;M+=$)Q+=(Q.length>0?",":"")+w.substr(M,$);return Q}var pe=function(){var $=/%/g;function M(ne,V,se){var Te=V.replace($,""),K=V.length-Te.length;return pe(ne,Te,se*Math.pow(10,2*K))+o("%",K)}function Q(ne,V,se){for(var Te=V.length-1;V.charCodeAt(Te-1)===44;)--Te;return pe(ne,V.substr(0,Te),se/Math.pow(10,3*(V.length-Te)))}function B(ne,V){var se,Te=ne.indexOf("E")-ne.indexOf(".")-1;if(ne.match(/^#+0.0E\+0$/)){if(V==0)return"0.0E+0";if(V<0)return"-"+B(ne,-V);var K=ne.indexOf(".");K===-1&&(K=ne.indexOf("E"));var de=Math.floor(Math.log(V)*Math.LOG10E)%K;if(de<0&&(de+=K),se=(V/Math.pow(10,de)).toPrecision(Te+1+(K+de)%K),se.indexOf("e")===-1){var Le=Math.floor(Math.log(V)*Math.LOG10E);for(se.indexOf(".")===-1?se=se.charAt(0)+"."+se.substr(1)+"E+"+(Le-se.length+de):se+="E+"+(Le-de);se.substr(0,2)==="0.";)se=se.charAt(0)+se.substr(2,K)+"."+se.substr(2+K),se=se.replace(/^0+([1-9])/,"$1").replace(/^0+\./,"0.");se=se.replace(/\+-/,"-")}se=se.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(He,ot,_t,ut){return ot+_t+ut.substr(0,(K+de)%K)+"."+ut.substr(de)+"E"})}else se=V.toExponential(Te);return ne.match(/E\+00$/)&&se.match(/e[+-]\d$/)&&(se=se.substr(0,se.length-1)+"0"+se.charAt(se.length-1)),ne.match(/E\-/)&&se.match(/e\+/)&&(se=se.replace(/e\+/,"e")),se.replace("e","E")}var z=/# (\?+)( ?)\/( ?)(\d+)/;function j(ne,V,se){var Te=parseInt(ne[4],10),K=Math.round(V*Te),de=Math.floor(K/Te),Le=K-de*Te,He=Te;return se+(de===0?"":""+de)+" "+(Le===0?o(" ",ne[1].length+1+ne[4].length):a(Le,ne[1].length)+ne[2]+"/"+ne[3]+u(He,ne[4].length))}function J(ne,V,se){return se+(V===0?"":""+V)+o(" ",ne[1].length+2+ne[4].length)}var xe=/^#*0*\.([0#]+)/,oe=/\).*[0#]/,Z=/\(###\) ###\\?-####/;function ce(ne){for(var V="",se,Te=0;Te!=ne.length;++Te)switch(se=ne.charCodeAt(Te)){case 35:break;case 63:V+=" ";break;case 48:V+="0";break;default:V+=String.fromCharCode(se)}return V}function Re(ne,V){var se=Math.pow(10,V);return""+Math.round(ne*se)/se}function ke(ne,V){var se=ne-Math.floor(ne),Te=Math.pow(10,V);return V<(""+Math.round(se*Te)).length?0:Math.round(se*Te)}function Ve(ne,V){return V<(""+Math.round((ne-Math.floor(ne))*Math.pow(10,V))).length?1:0}function Y(ne){return ne<2147483647&&ne>-2147483648?""+(ne>=0?ne|0:ne-1|0):""+Math.floor(ne)}function ee(ne,V,se){if(ne.charCodeAt(0)===40&&!V.match(oe)){var Te=V.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return se>=0?ee("n",Te,se):"("+ee("n",Te,-se)+")"}if(V.charCodeAt(V.length-1)===44)return Q(ne,V,se);if(V.indexOf("%")!==-1)return M(ne,V,se);if(V.indexOf("E")!==-1)return B(V,se);if(V.charCodeAt(0)===36)return"$"+ee(ne,V.substr(V.charAt(1)==" "?2:1),se);var K,de,Le,He,ot=Math.abs(se),_t=se<0?"-":"";if(V.match(/^00+$/))return _t+h(ot,V.length);if(V.match(/^[#?]+$/))return K=h(se,0),K==="0"&&(K=""),K.length>V.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(z))return j(de,ot,_t);if(V.match(/^#+0+$/))return _t+h(ot,V.length-V.indexOf("0"));if(de=V.match(xe))return K=Re(se,de[1].length).replace(/^([^\.]+)$/,"$1."+ce(de[1])).replace(/\.$/,"."+ce(de[1])).replace(/\.(\d*)$/,function(Ds,jy){return"."+jy+o("0",ce(de[1]).length-jy.length)}),V.indexOf("0.")!==-1?K:K.replace(/^0\./,".");if(V=V.replace(/^#+([0.])/,"$1"),de=V.match(/^(0*)\.(#*)$/))return _t+Re(ot,de[2].length).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,de[1].length?"0.":".");if(de=V.match(/^#{1,3},##0(\.?)$/))return _t+he(h(ot,0));if(de=V.match(/^#,##0\.([#0]*0)$/))return se<0?"-"+ee(ne,V,-se):he(""+(Math.floor(se)+Ve(se,de[1].length)))+"."+u(ke(se,de[1].length),de[1].length);if(de=V.match(/^#,#*,#0/))return ee(ne,V.replace(/^#,#*,/,""),se);if(de=V.match(/^([0#]+)(\\?-([0#]+))+$/))return K=s(ee(ne,V.replace(/[\\-]/g,""),se)),Le=0,s(s(V.replace(/\\/g,"")).replace(/[0#]/g,function(Ds){return Le<K.length?K.charAt(Le++):Ds==="0"?"0":""}));if(V.match(Z))return K=ee(ne,"##########",se),"("+K.substr(0,3)+") "+K.substr(3,3)+"-"+K.substr(6);var ut="";if(de=V.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(de[4].length,7),He=S(ot,Math.pow(10,Le)-1,!1),K=""+_t,ut=pe("n",de[1],He[1]),ut.charAt(ut.length-1)==" "&&(ut=ut.substr(0,ut.length-1)+"0"),K+=ut+de[2]+"/"+de[3],ut=l(He[2],Le),ut.length<de[4].length&&(ut=ce(de[4].substr(de[4].length-ut.length))+ut),K+=ut,K;if(de=V.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(Math.max(de[1].length,de[4].length),7),He=S(ot,Math.pow(10,Le)-1,!0),_t+(He[0]||(He[1]?"":"0"))+" "+(He[1]?a(He[1],Le)+de[2]+"/"+de[3]+l(He[2],Le):o(" ",2*Le+1+de[2].length+de[3].length));if(de=V.match(/^[#0?]+$/))return K=h(se,0),V.length<=K.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(/^([#0?]+)\.([#0]+)$/)){K=""+se.toFixed(Math.min(de[2].length,10)).replace(/([^0])0+$/,"$1"),Le=K.indexOf(".");var pr=V.indexOf(".")-Le,wc=V.length-K.length-pr;return ce(V.substr(0,pr)+K+V.substr(V.length-wc))}if(de=V.match(/^00,000\.([#0]*0)$/))return Le=ke(se,de[1].length),se<0?"-"+ee(ne,V,-se):he(Y(se)).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(Ds){return"00,"+(Ds.length<3?u(0,3-Ds.length):"")+Ds})+"."+u(Le,de[1].length);switch(V){case"###,##0.00":return ee(ne,"#,##0.00",se);case"###,###":case"##,###":case"#,###":var My=he(h(ot,0));return My!=="0"?_t+My:"";case"###,###.00":return ee(ne,"###,##0.00",se).replace(/^0\./,".");case"#,###.00":return ee(ne,"#,##0.00",se).replace(/^0\./,".")}throw new Error("unsupported format |"+V+"|")}function Ce(ne,V,se){for(var Te=V.length-1;V.charCodeAt(Te-1)===44;)--Te;return pe(ne,V.substr(0,Te),se/Math.pow(10,3*(V.length-Te)))}function Me(ne,V,se){var Te=V.replace($,""),K=V.length-Te.length;return pe(ne,Te,se*Math.pow(10,2*K))+o("%",K)}function Pe(ne,V){var se,Te=ne.indexOf("E")-ne.indexOf(".")-1;if(ne.match(/^#+0.0E\+0$/)){if(V==0)return"0.0E+0";if(V<0)return"-"+Pe(ne,-V);var K=ne.indexOf(".");K===-1&&(K=ne.indexOf("E"));var de=Math.floor(Math.log(V)*Math.LOG10E)%K;if(de<0&&(de+=K),se=(V/Math.pow(10,de)).toPrecision(Te+1+(K+de)%K),!se.match(/[Ee]/)){var Le=Math.floor(Math.log(V)*Math.LOG10E);se.indexOf(".")===-1?se=se.charAt(0)+"."+se.substr(1)+"E+"+(Le-se.length+de):se+="E+"+(Le-de),se=se.replace(/\+-/,"-")}se=se.replace(/^([+-]?)(\d*)\.(\d*)[Ee]/,function(He,ot,_t,ut){return ot+_t+ut.substr(0,(K+de)%K)+"."+ut.substr(de)+"E"})}else se=V.toExponential(Te);return ne.match(/E\+00$/)&&se.match(/e[+-]\d$/)&&(se=se.substr(0,se.length-1)+"0"+se.charAt(se.length-1)),ne.match(/E\-/)&&se.match(/e\+/)&&(se=se.replace(/e\+/,"e")),se.replace("e","E")}function U(ne,V,se){if(ne.charCodeAt(0)===40&&!V.match(oe)){var Te=V.replace(/\( */,"").replace(/ \)/,"").replace(/\)/,"");return se>=0?U("n",Te,se):"("+U("n",Te,-se)+")"}if(V.charCodeAt(V.length-1)===44)return Ce(ne,V,se);if(V.indexOf("%")!==-1)return Me(ne,V,se);if(V.indexOf("E")!==-1)return Pe(V,se);if(V.charCodeAt(0)===36)return"$"+U(ne,V.substr(V.charAt(1)==" "?2:1),se);var K,de,Le,He,ot=Math.abs(se),_t=se<0?"-":"";if(V.match(/^00+$/))return _t+u(ot,V.length);if(V.match(/^[#?]+$/))return K=""+se,se===0&&(K=""),K.length>V.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(z))return J(de,ot,_t);if(V.match(/^#+0+$/))return _t+u(ot,V.length-V.indexOf("0"));if(de=V.match(xe))return K=(""+se).replace(/^([^\.]+)$/,"$1."+ce(de[1])).replace(/\.$/,"."+ce(de[1])),K=K.replace(/\.(\d*)$/,function(Ds,jy){return"."+jy+o("0",ce(de[1]).length-jy.length)}),V.indexOf("0.")!==-1?K:K.replace(/^0\./,".");if(V=V.replace(/^#+([0.])/,"$1"),de=V.match(/^(0*)\.(#*)$/))return _t+(""+ot).replace(/\.(\d*[1-9])0*$/,".$1").replace(/^(-?\d*)$/,"$1.").replace(/^0\./,de[1].length?"0.":".");if(de=V.match(/^#{1,3},##0(\.?)$/))return _t+he(""+ot);if(de=V.match(/^#,##0\.([#0]*0)$/))return se<0?"-"+U(ne,V,-se):he(""+se)+"."+o("0",de[1].length);if(de=V.match(/^#,#*,#0/))return U(ne,V.replace(/^#,#*,/,""),se);if(de=V.match(/^([0#]+)(\\?-([0#]+))+$/))return K=s(U(ne,V.replace(/[\\-]/g,""),se)),Le=0,s(s(V.replace(/\\/g,"")).replace(/[0#]/g,function(Ds){return Le<K.length?K.charAt(Le++):Ds==="0"?"0":""}));if(V.match(Z))return K=U(ne,"##########",se),"("+K.substr(0,3)+") "+K.substr(3,3)+"-"+K.substr(6);var ut="";if(de=V.match(/^([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(de[4].length,7),He=S(ot,Math.pow(10,Le)-1,!1),K=""+_t,ut=pe("n",de[1],He[1]),ut.charAt(ut.length-1)==" "&&(ut=ut.substr(0,ut.length-1)+"0"),K+=ut+de[2]+"/"+de[3],ut=l(He[2],Le),ut.length<de[4].length&&(ut=ce(de[4].substr(de[4].length-ut.length))+ut),K+=ut,K;if(de=V.match(/^# ([#0?]+)( ?)\/( ?)([#0?]+)/))return Le=Math.min(Math.max(de[1].length,de[4].length),7),He=S(ot,Math.pow(10,Le)-1,!0),_t+(He[0]||(He[1]?"":"0"))+" "+(He[1]?a(He[1],Le)+de[2]+"/"+de[3]+l(He[2],Le):o(" ",2*Le+1+de[2].length+de[3].length));if(de=V.match(/^[#0?]+$/))return K=""+se,V.length<=K.length?K:ce(V.substr(0,V.length-K.length))+K;if(de=V.match(/^([#0]+)\.([#0]+)$/)){K=""+se.toFixed(Math.min(de[2].length,10)).replace(/([^0])0+$/,"$1"),Le=K.indexOf(".");var pr=V.indexOf(".")-Le,wc=V.length-K.length-pr;return ce(V.substr(0,pr)+K+V.substr(V.length-wc))}if(de=V.match(/^00,000\.([#0]*0)$/))return se<0?"-"+U(ne,V,-se):he(""+se).replace(/^\d,\d{3}$/,"0$&").replace(/^\d*$/,function(Ds){return"00,"+(Ds.length<3?u(0,3-Ds.length):"")+Ds})+"."+u(0,de[1].length);switch(V){case"###,###":case"##,###":case"#,###":var My=he(""+ot);return My!=="0"?_t+My:"";default:if(V.match(/\.[0#?]*$/))return U(ne,V.slice(0,V.lastIndexOf(".")),se)+ce(V.slice(V.lastIndexOf(".")))}throw new Error("unsupported format |"+V+"|")}return function(V,se,Te){return(Te|0)===Te?U(V,se,Te):ee(V,se,Te)}}();function ae(w){for(var $=[],M=!1,Q=0,B=0;Q<w.length;++Q)switch(w.charCodeAt(Q)){case 34:M=!M;break;case 95:case 42:case 92:++Q;break;case 59:$[$.length]=w.substr(B,Q-B),B=Q+1}if($[$.length]=w.substr(B),M===!0)throw new Error("Format |"+w+"| unterminated string ");return $}i._split=ae;var fe=/\[[HhMmSs\u0E0A\u0E19\u0E17]*\]/;function re(w){for(var $=0,M="",Q="";$<w.length;)switch(M=w.charAt($)){case"G":p(w,$)&&($+=6),$++;break;case'"':for(;w.charCodeAt(++$)!==34&&$<w.length;);++$;break;case"\\":$+=2;break;case"_":$+=2;break;case"@":++$;break;case"B":case"b":if(w.charAt($+1)==="1"||w.charAt($+1)==="2")return!0;case"M":case"D":case"Y":case"H":case"S":case"E":case"m":case"d":case"y":case"h":case"s":case"e":case"g":return!0;case"A":case"a":case"上":if(w.substr($,3).toUpperCase()==="A/P"||w.substr($,5).toUpperCase()==="AM/PM"||w.substr($,5).toUpperCase()==="上午/下午")return!0;++$;break;case"[":for(Q=M;w.charAt($++)!=="]"&&$<w.length;)Q+=w.charAt($);if(Q.match(fe))return!0;break;case".":case"0":case"#":for(;$<w.length&&("0#?.,E+-%".indexOf(M=w.charAt(++$))>-1||M=="\\"&&w.charAt($+1)=="-"&&"0#".indexOf(w.charAt($+2))>-1););break;case"?":for(;w.charAt(++$)===M;);break;case"*":++$,(w.charAt($)==" "||w.charAt($)=="*")&&++$;break;case"(":case")":++$;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;$<w.length&&"0123456789".indexOf(w.charAt(++$))>-1;);break;case" ":++$;break;default:++$;break}return!1}i.is_date=re;function ie(w,$,M,Q){for(var B=[],z="",j=0,J="",xe="t",oe,Z,ce,Re="H";j<w.length;)switch(J=w.charAt(j)){case"G":if(!p(w,j))throw new Error("unrecognized character "+J+" in "+w);B[B.length]={t:"G",v:"General"},j+=7;break;case'"':for(z="";(ce=w.charCodeAt(++j))!==34&&j<w.length;)z+=String.fromCharCode(ce);B[B.length]={t:"t",v:z},++j;break;case"\\":var ke=w.charAt(++j),Ve=ke==="("||ke===")"?ke:"t";B[B.length]={t:Ve,v:ke},++j;break;case"_":B[B.length]={t:"t",v:" "},j+=2;break;case"@":B[B.length]={t:"T",v:$},++j;break;case"B":case"b":if(w.charAt(j+1)==="1"||w.charAt(j+1)==="2"){if(oe==null&&(oe=C($,M,w.charAt(j+1)==="2"),oe==null))return"";B[B.length]={t:"X",v:w.substr(j,2)},xe=J,j+=2;break}case"M":case"D":case"Y":case"H":case"S":case"E":J=J.toLowerCase();case"m":case"d":case"y":case"h":case"s":case"e":case"g":if($<0||oe==null&&(oe=C($,M),oe==null))return"";for(z=J;++j<w.length&&w.charAt(j).toLowerCase()===J;)z+=J;J==="m"&&xe.toLowerCase()==="h"&&(J="M"),J==="h"&&(J=Re),B[B.length]={t:J,v:z},xe=J;break;case"A":case"a":case"上":var Y={t:J,v:J};if(oe==null&&(oe=C($,M)),w.substr(j,3).toUpperCase()==="A/P"?(oe!=null&&(Y.v=oe.H>=12?"P":"A"),Y.t="T",Re="h",j+=3):w.substr(j,5).toUpperCase()==="AM/PM"?(oe!=null&&(Y.v=oe.H>=12?"PM":"AM"),Y.t="T",j+=5,Re="h"):w.substr(j,5).toUpperCase()==="上午/下午"?(oe!=null&&(Y.v=oe.H>=12?"下午":"上午"),Y.t="T",j+=5,Re="h"):(Y.t="t",++j),oe==null&&Y.t==="T")return"";B[B.length]=Y,xe=J;break;case"[":for(z=J;w.charAt(j++)!=="]"&&j<w.length;)z+=w.charAt(j);if(z.slice(-1)!=="]")throw'unterminated "[" block: |'+z+"|";if(z.match(fe)){if(oe==null&&(oe=C($,M),oe==null))return"";B[B.length]={t:"Z",v:z.toLowerCase()},xe=z.charAt(1)}else z.indexOf("$")>-1&&(z=(z.match(/\$([^-\[\]]*)/)||[])[1]||"$",re(w)||(B[B.length]={t:"t",v:z}));break;case".":if(oe!=null){for(z=J;++j<w.length&&(J=w.charAt(j))==="0";)z+=J;B[B.length]={t:"s",v:z};break}case"0":case"#":for(z=J;++j<w.length&&"0#?.,E+-%".indexOf(J=w.charAt(j))>-1;)z+=J;B[B.length]={t:"n",v:z};break;case"?":for(z=J;w.charAt(++j)===J;)z+=J;B[B.length]={t:J,v:z},xe=J;break;case"*":++j,(w.charAt(j)==" "||w.charAt(j)=="*")&&++j;break;case"(":case")":B[B.length]={t:Q===1?"t":J,v:J},++j;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(z=J;j<w.length&&"0123456789".indexOf(w.charAt(++j))>-1;)z+=w.charAt(j);B[B.length]={t:"D",v:z};break;case" ":B[B.length]={t:J,v:J},++j;break;case"$":B[B.length]={t:"t",v:"$"},++j;break;default:if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(J)===-1)throw new Error("unrecognized character "+J+" in "+w);B[B.length]={t:"t",v:J},++j;break}var ee=0,Ce=0,Me;for(j=B.length-1,xe="t";j>=0;--j)switch(B[j].t){case"h":case"H":B[j].t=Re,xe="h",ee<1&&(ee=1);break;case"s":(Me=B[j].v.match(/\.0+$/))&&(Ce=Math.max(Ce,Me[0].length-1)),ee<3&&(ee=3);case"d":case"y":case"M":case"e":xe=B[j].t;break;case"m":xe==="s"&&(B[j].t="M",ee<2&&(ee=2));break;case"X":break;case"Z":ee<1&&B[j].v.match(/[Hh]/)&&(ee=1),ee<2&&B[j].v.match(/[Mm]/)&&(ee=2),ee<3&&B[j].v.match(/[Ss]/)&&(ee=3)}switch(ee){case 0:break;case 1:oe.u>=.5&&(oe.u=0,++oe.S),oe.S>=60&&(oe.S=0,++oe.M),oe.M>=60&&(oe.M=0,++oe.H);break;case 2:oe.u>=.5&&(oe.u=0,++oe.S),oe.S>=60&&(oe.S=0,++oe.M);break}var Pe="",U;for(j=0;j<B.length;++j)switch(B[j].t){case"t":case"T":case" ":case"D":break;case"X":B[j].v="",B[j].t=";";break;case"d":case"m":case"y":case"h":case"H":case"M":case"s":case"e":case"b":case"Z":B[j].v=ue(B[j].t.charCodeAt(0),B[j].v,oe,Ce),B[j].t="t";break;case"n":case"?":for(U=j+1;B[U]!=null&&((J=B[U].t)==="?"||J==="D"||(J===" "||J==="t")&&B[U+1]!=null&&(B[U+1].t==="?"||B[U+1].t==="t"&&B[U+1].v==="/")||B[j].t==="("&&(J===" "||J==="n"||J===")")||J==="t"&&(B[U].v==="/"||B[U].v===" "&&B[U+1]!=null&&B[U+1].t=="?"));)B[j].v+=B[U].v,B[U]={v:"",t:";"},++U;Pe+=B[j].v,j=U-1;break;case"G":B[j].t="t",B[j].v=X($,M);break}var ne="",V,se;if(Pe.length>0){Pe.charCodeAt(0)==40?(V=$<0&&Pe.charCodeAt(0)===45?-$:$,se=pe("n",Pe,V)):(V=$<0&&Q>1?-$:$,se=pe("n",Pe,V),V<0&&B[0]&&B[0].t=="t"&&(se=se.substr(1),B[0].v="-"+B[0].v)),U=se.length-1;var Te=B.length;for(j=0;j<B.length;++j)if(B[j]!=null&&B[j].t!="t"&&B[j].v.indexOf(".")>-1){Te=j;break}var K=B.length;if(Te===B.length&&se.indexOf("E")===-1){for(j=B.length-1;j>=0;--j)B[j]==null||"n?".indexOf(B[j].t)===-1||(U>=B[j].v.length-1?(U-=B[j].v.length,B[j].v=se.substr(U+1,B[j].v.length)):U<0?B[j].v="":(B[j].v=se.substr(0,U+1),U=-1),B[j].t="t",K=j);U>=0&&K<B.length&&(B[K].v=se.substr(0,U+1)+B[K].v)}else if(Te!==B.length&&se.indexOf("E")===-1){for(U=se.indexOf(".")-1,j=Te;j>=0;--j)if(!(B[j]==null||"n?".indexOf(B[j].t)===-1)){for(Z=B[j].v.indexOf(".")>-1&&j===Te?B[j].v.indexOf(".")-1:B[j].v.length-1,ne=B[j].v.substr(Z+1);Z>=0;--Z)U>=0&&(B[j].v.charAt(Z)==="0"||B[j].v.charAt(Z)==="#")&&(ne=se.charAt(U--)+ne);B[j].v=ne,B[j].t="t",K=j}for(U>=0&&K<B.length&&(B[K].v=se.substr(0,U+1)+B[K].v),U=se.indexOf(".")+1,j=Te;j<B.length;++j)if(!(B[j]==null||"n?(".indexOf(B[j].t)===-1&&j!==Te)){for(Z=B[j].v.indexOf(".")>-1&&j===Te?B[j].v.indexOf(".")+1:0,ne=B[j].v.substr(0,Z);Z<B[j].v.length;++Z)U<se.length&&(ne+=se.charAt(U++));B[j].v=ne,B[j].t="t",K=j}}}for(j=0;j<B.length;++j)B[j]!=null&&"n?".indexOf(B[j].t)>-1&&(V=Q>1&&$<0&&j>0&&B[j-1].v==="-"?-$:$,B[j].v=pe(B[j].t,B[j].v,V),B[j].t="t");var de="";for(j=0;j!==B.length;++j)B[j]!=null&&(de+=B[j].v);return de}i._eval=ie;var D=/\[[=<>]/,R=/\[(=|>[=]?|<[>=]?)(-?\d+(?:\.\d*)?)\]/;function O(w,$){if($==null)return!1;var M=parseFloat($[2]);switch($[1]){case"=":if(w==M)return!0;break;case">":if(w>M)return!0;break;case"<":if(w<M)return!0;break;case"<>":if(w!=M)return!0;break;case">=":if(w>=M)return!0;break;case"<=":if(w<=M)return!0;break}return!1}function k(w,$){var M=ae(w),Q=M.length,B=M[Q-1].indexOf("@");if(Q<4&&B>-1&&--Q,M.length>4)throw new Error("cannot find right format for |"+M.join("|")+"|");if(typeof $!="number")return[4,M.length===4||B>-1?M[M.length-1]:"@"];switch(M.length){case 1:M=B>-1?["General","General","General",M[0]]:[M[0],M[0],M[0],"@"];break;case 2:M=B>-1?[M[0],M[0],M[0],M[1]]:[M[0],M[1],M[0],"@"];break;case 3:M=B>-1?[M[0],M[1],M[0],M[2]]:[M[0],M[1],M[2],"@"];break}var z=$>0?M[0]:$<0?M[1]:M[2];if(M[0].indexOf("[")===-1&&M[1].indexOf("[")===-1)return[Q,z];if(M[0].match(D)!=null||M[1].match(D)!=null){var j=M[0].match(R),J=M[1].match(R);return O($,j)?[Q,M[0]]:O($,J)?[Q,M[1]]:[Q,M[j!=null&&J!=null?2:1]]}return[Q,z]}function W(w,$,M){M==null&&(M={});var Q="";switch(typeof w){case"string":w=="m/d/yy"&&M.dateNF?Q=M.dateNF:Q=w;break;case"number":w==14&&M.dateNF?Q=M.dateNF:Q=(M.table!=null?M.table:E)[w],Q==null&&(Q=M.table&&M.table[A[w]]||E[A[w]]),Q==null&&(Q=_[w]||"General");break}if(p(Q,0))return X($,M);$ instanceof Date&&($=I($,M.date1904));var B=k(Q,$);if(p(B[1]))return X($,M);if($===!0)$="TRUE";else if($===!1)$="FALSE";else if($===""||$==null)return"";return ie(B[1],$,M,B[0])}function H(w,$){if(typeof $!="number"){$=+$||-1;for(var M=0;M<392;++M){if(E[M]==null){$<0&&($=M);continue}if(E[M]==w){$=M;break}}$<0&&($=391)}return E[$]=w,$}i.load=H,i._table=E,i.get_table=function(){return E},i.load_table=function($){for(var M=0;M!=392;++M)$[M]!==void 0&&H($[M],M)},i.init_table=y,i.format=W};n(e),typeof DO_NOT_EXPORT_SSF>"u"&&(t.exports=e)})(YW);var Y5=YW.exports;function iDe(t,e,n,r){var i=-1,s=t==null?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}var sDe=iDe;function oDe(t){return function(e){return t==null?void 0:t[e]}}var uDe=oDe,aDe=uDe,lDe={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},cDe=aDe(lDe),fDe=cDe,xDe=typeof T=="object"&&T&&T.Object===Object&&T,dDe=xDe,hDe=dDe,pDe=typeof self=="object"&&self&&self.Object===Object&&self,gDe=hDe||pDe||Function("return this")(),mDe=gDe,yDe=mDe,EDe=yDe.Symbol,fw=EDe;function ADe(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var vDe=ADe,_De=Array.isArray,SDe=_De,KW=fw,JW=Object.prototype,CDe=JW.hasOwnProperty,bDe=JW.toString,cm=KW?KW.toStringTag:void 0;function TDe(t){var e=CDe.call(t,cm),n=t[cm];try{t[cm]=void 0;var r=!0}catch{}var i=bDe.call(t);return r&&(e?t[cm]=n:delete t[cm]),i}var RDe=TDe,ODe=Object.prototype,DDe=ODe.toString;function wDe(t){return DDe.call(t)}var NDe=wDe,XW=fw,FDe=RDe,LDe=NDe,IDe="[object Null]",BDe="[object Undefined]",ZW=XW?XW.toStringTag:void 0;function $De(t){return t==null?t===void 0?BDe:IDe:ZW&&ZW in Object(t)?FDe(t):LDe(t)}var kDe=$De;function PDe(t){return t!=null&&typeof t=="object"}var MDe=PDe,jDe=kDe,UDe=MDe,qDe="[object Symbol]";function HDe(t){return typeof t=="symbol"||UDe(t)&&jDe(t)==qDe}var zDe=HDe,eV=fw,QDe=vDe,GDe=SDe,WDe=zDe,VDe=1/0,tV=eV?eV.prototype:void 0,nV=tV?tV.toString:void 0;function rV(t){if(typeof t=="string")return t;if(GDe(t))return QDe(t,rV)+"";if(WDe(t))return nV?nV.call(t):"";var e=t+"";return e=="0"&&1/t==-VDe?"-0":e}var YDe=rV,KDe=YDe;function JDe(t){return t==null?"":KDe(t)}var xw=JDe,XDe=fDe,ZDe=xw,e7e=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,t7e="\\u0300-\\u036f",n7e="\\ufe20-\\ufe2f",r7e="\\u20d0-\\u20ff",i7e=t7e+n7e+r7e,s7e="["+i7e+"]",o7e=RegExp(s7e,"g");function u7e(t){return t=ZDe(t),t&&t.replace(e7e,XDe).replace(o7e,"")}var a7e=u7e,l7e=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function c7e(t){return t.match(l7e)||[]}var f7e=c7e,x7e=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function d7e(t){return x7e.test(t)}var h7e=d7e,iV="\\ud800-\\udfff",p7e="\\u0300-\\u036f",g7e="\\ufe20-\\ufe2f",m7e="\\u20d0-\\u20ff",y7e=p7e+g7e+m7e,sV="\\u2700-\\u27bf",oV="a-z\\xdf-\\xf6\\xf8-\\xff",E7e="\\xac\\xb1\\xd7\\xf7",A7e="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",v7e="\\u2000-\\u206f",_7e=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",uV="A-Z\\xc0-\\xd6\\xd8-\\xde",S7e="\\ufe0e\\ufe0f",aV=E7e+A7e+v7e+_7e,lV="['’]",cV="["+aV+"]",C7e="["+y7e+"]",fV="\\d+",b7e="["+sV+"]",xV="["+oV+"]",dV="[^"+iV+aV+fV+sV+oV+uV+"]",T7e="\\ud83c[\\udffb-\\udfff]",R7e="(?:"+C7e+"|"+T7e+")",O7e="[^"+iV+"]",hV="(?:\\ud83c[\\udde6-\\uddff]){2}",pV="[\\ud800-\\udbff][\\udc00-\\udfff]",Nh="["+uV+"]",D7e="\\u200d",gV="(?:"+xV+"|"+dV+")",w7e="(?:"+Nh+"|"+dV+")",mV="(?:"+lV+"(?:d|ll|m|re|s|t|ve))?",yV="(?:"+lV+"(?:D|LL|M|RE|S|T|VE))?",EV=R7e+"?",AV="["+S7e+"]?",N7e="(?:"+D7e+"(?:"+[O7e,hV,pV].join("|")+")"+AV+EV+")*",F7e="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",L7e="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",I7e=AV+EV+N7e,B7e="(?:"+[b7e,hV,pV].join("|")+")"+I7e,$7e=RegExp([Nh+"?"+xV+"+"+mV+"(?="+[cV,Nh,"$"].join("|")+")",w7e+"+"+yV+"(?="+[cV,Nh+gV,"$"].join("|")+")",Nh+"?"+gV+"+"+mV,Nh+"+"+yV,L7e,F7e,fV,B7e].join("|"),"g");function k7e(t){return t.match($7e)||[]}var P7e=k7e,M7e=f7e,j7e=h7e,U7e=xw,q7e=P7e;function H7e(t,e,n){return t=U7e(t),e=n?void 0:e,e===void 0?j7e(t)?q7e(t):M7e(t):t.match(e)||[]}var z7e=H7e,Q7e=sDe,G7e=a7e,W7e=z7e,V7e="['’]",Y7e=RegExp(V7e,"g");function K7e(t){return function(e){return Q7e(W7e(G7e(e).replace(Y7e,"")),t,"")}}var J7e=K7e;function X7e(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}var Z7e=X7e,ewe=Z7e;function twe(t,e,n){var r=t.length;return n=n===void 0?r:n,!e&&n>=r?t:ewe(t,e,n)}var nwe=twe,rwe="\\ud800-\\udfff",iwe="\\u0300-\\u036f",swe="\\ufe20-\\ufe2f",owe="\\u20d0-\\u20ff",uwe=iwe+swe+owe,awe="\\ufe0e\\ufe0f",lwe="\\u200d",cwe=RegExp("["+lwe+rwe+uwe+awe+"]");function fwe(t){return cwe.test(t)}var vV=fwe;function xwe(t){return t.split("")}var dwe=xwe,_V="\\ud800-\\udfff",hwe="\\u0300-\\u036f",pwe="\\ufe20-\\ufe2f",gwe="\\u20d0-\\u20ff",mwe=hwe+pwe+gwe,ywe="\\ufe0e\\ufe0f",Ewe="["+_V+"]",dw="["+mwe+"]",hw="\\ud83c[\\udffb-\\udfff]",Awe="(?:"+dw+"|"+hw+")",SV="[^"+_V+"]",CV="(?:\\ud83c[\\udde6-\\uddff]){2}",bV="[\\ud800-\\udbff][\\udc00-\\udfff]",vwe="\\u200d",TV=Awe+"?",RV="["+ywe+"]?",_we="(?:"+vwe+"(?:"+[SV,CV,bV].join("|")+")"+RV+TV+")*",Swe=RV+TV+_we,Cwe="(?:"+[SV+dw+"?",dw,CV,bV,Ewe].join("|")+")",bwe=RegExp(hw+"(?="+hw+")|"+Cwe+Swe,"g");function Twe(t){return t.match(bwe)||[]}var Rwe=Twe,Owe=dwe,Dwe=vV,wwe=Rwe;function Nwe(t){return Dwe(t)?wwe(t):Owe(t)}var Fwe=Nwe,Lwe=nwe,Iwe=vV,Bwe=Fwe,$we=xw;function kwe(t){return function(e){e=$we(e);var n=Iwe(e)?Bwe(e):void 0,r=n?n[0]:e.charAt(0),i=n?Lwe(n,1).join(""):e.slice(1);return r[t]()+i}}var Pwe=kwe,Mwe=Pwe,jwe=Mwe("toUpperCase"),Uwe=jwe,qwe=J7e,Hwe=Uwe,zwe=qwe(function(t,e,n){return t+(n?" ":"")+Hwe(e)}),Qwe=zwe;const Gwe=nE(Qwe);function Wa(t,e,n=!1){if(t!==void 0)switch(t){case"ordinal":return{range:["#C2D5EE","#1A73E8"]};case"temporal":case"quantitative":return e?n?{range:["#6BA4EE","#EEA361"]}:{range:["#1A73E8","#E8710A"]}:{range:["#C2D5EE","#1A73E8"]};case"nominal":return n?{range:["#6BA4EE","#66CEDC","#EC72B8","#EEA361","#F9C85B","#AACD85","#B87CED","#ACB0B3"]}:{range:["#1A73E8","#12B5CB","#E52592","#E8710A","#F9AB00","#7CB342","#9334E6","#80868B"]}}}function Wwe(t,e){const n=wAe.fromJSDate(t,{zone:e??"UTC"});return new Date(n.year,n.month-1,n.day,n.hour,n.minute,n.second,n.millisecond)}function Vwe(t,e){const n=t.createElement("span");return n.classList.add("error"),n.appendChild(t.createTextNode(typeof e=="string"?e:e.message)),n}function Ywe(t){const e=t.createElement("span");return e.appendChild(t.createTextNode("∅")),e.classList.add("value-null"),e}function $f(t,e,n,r){var o;const i=((o=n==null?void 0:n.data)==null?void 0:o.label)||e.name;let s=t.titleCase?Gwe(i):i;return e.isAtomicField()&&(e.isDate()||e.isTimestamp())&&r&&(s=`${s} (${r})`),s}function Kwe(t,e=0){let n=t;for(;e>0&&n.parentRecord;)e-=1,n=n.parentRecord;return n}function Jwe(t){const e=t.split("/"),n=e.filter(i=>i==="..").length+1,r=e.filter(i=>i!==".."&&i!=="");return{levelsUp:n,pathSegments:r}}function OV({tag:t,data:e}){var n;try{const r=((n=t.tag("field"))==null?void 0:n.text())??"",{levelsUp:i,pathSegments:s}=Jwe(r);let o=Kwe(e,i);for(;s.length>0&&"cell"in o;){const u=s.shift();o=o.cell(u)}return o==null?void 0:o.value}catch{return}}class kf{constructor(){this.tagOptionExtractors={}}addExtractor(e,...n){for(const r in n)this.tagOptionExtractors[n[r]]=e}activates(e){return!1}isValidMatch(e){return!0}matches(e){return e.renderer===this.rendererName}parseTagParameters(e){const n={};for(const r in this.tagOptionExtractors){const i=e.tag(r);i&&this.tagOptionExtractors[r](n,i)}return n}}class DV{constructor(e){this.document=e}getText(e){return e.value===null?null:`${e.value}`}async render(e){let n=null;try{n=this.getText(e)}catch(i){return Vwe(this.document,i)}if(n===null)return Ywe(this.document);const r=this.document.createElement("span");return r.appendChild(this.document.createTextNode(n)),r}}const IT=class IT extends kf{activates(e){return e.hasParentExplore()&&!e.isExploreField()}create(e,n,r,i,s){return new DV(e)}get rendererName(){}};IT.instance=new IT;let wV=IT;function NV(t,e,n={}){let r=e.toString();return n.terse?r=Xwe.get(e)??r:t===1&&(r=r.substring(0,r.length-1)),`${n.numFormat?Y5.format(n.numFormat,t):t.toLocaleString()}${n.terse?"":" "}${r}`}const Xwe=new Map([[Hn.Nanoseconds,"ns"],[Hn.Microseconds,"µs"],[Hn.Milliseconds,"ms"],[Hn.Seconds,"s"],[Hn.Minutes,"m"],[Hn.Hours,"h"],[Hn.Days,"d"]]),Zwe=new Map([[Hn.Nanoseconds,1e3],[Hn.Microseconds,1e3],[Hn.Milliseconds,1e3],[Hn.Seconds,60],[Hn.Minutes,60],[Hn.Hours,24],[Hn.Days,Number.MAX_VALUE]]);function FV(t,e,n){const r=n.durationUnit&&rDe(n.durationUnit)?n.durationUnit:Hn.Seconds,i=t.tagParse().tag,s=i.text("number"),o=i.has("duration","terse");let u=e,a=0,l=[],c=!1;for(const[f,x]of Zwe)if(f===r&&(c=!0),!!c&&(a=u%x,u=Math.floor(u/=x),a>0&&(l=[NV(a,f,{numFormat:s,terse:o}),...l]),u===0))break;return l.length>0?l.slice(0,2).join(" "):NV(0,r,{numFormat:s,terse:o})}class eNe extends DV{constructor(e,n){super(e),this.options=n}getText(e){if(e.isNull())return null;if(!e.isNumber())throw new Error(`Cannot format field ${e.field.name} as a duration unit since its not a number`);return FV(e.field,e.number.value,{durationUnit:this.options.duration_unit})}}const BT=class BT extends kf{constructor(){super(),this.addExtractor((e,n)=>{e.duration_unit=(n==null?void 0:n.text())??Hn.Seconds},this.rendererName)}create(e,n,r,i,s){return new eNe(e,s)}get rendererName(){return"duration"}};BT.instance=new BT;let LV=BT;function Fh(t,e){let n=e;const{tag:r}=t.tagParse();if(r.has("currency")){let i="$";switch(r.text("currency")){case V5.Euros:i="€";break;case V5.Pounds:i="£";break;case V5.Dollars:break}n=Y5.format(`${i}#,##0.00`,e)}else if(r.has("percent"))n=Y5.format("#,##0.00%",e);else if(r.has("duration")){const s=r.text("duration")??Hn.Seconds;return FV(t,e,{durationUnit:s})??e.toLocaleString()}else r.has("number")?n=Y5.format(r.text("number")??"#",e):n=e.toLocaleString();return n}var tNe=yt("<a target=_blank>");function nNe(t,e){const{tag:n}=t.tagParse();if(e.isNull())return"∅";const r=String(e.value),i=n.tag("link");if(!i)throw new Error("Missing tag for Link renderer");const s=OV({tag:i,data:e})??r,o=i.text("url_template");let u=s;o&&(o.indexOf("$$")>-1?u=o.replace("$$",s):u=o+s);const a=r.replace(/\//g,"/‌");return(()=>{var l=tNe();return Zi(l,"href",u),Je(l,a),l})()}function gs(t,e,n){return t.fields=e||[],t.fname=n,t}function wn(t){return t==null?null:t.fname}function oi(t){return t==null?null:t.fields}function IV(t){return t.length===1?rNe(t[0]):iNe(t)}const rNe=t=>function(e){return e[t]},iNe=t=>{const e=t.length;return function(n){for(let r=0;r<e;++r)n=n[t[r]];return n}};function _e(t){throw Error(t)}function Va(t){const e=[],n=t.length;let r=null,i=0,s="",o,u,a;t=t+"";function l(){e.push(s+t.substring(o,u)),s="",o=u+1}for(o=u=0;u<n;++u)if(a=t[u],a==="\\")s+=t.substring(o,u),s+=t.substring(++u,++u),o=u;else if(a===r)l(),r=null,i=-1;else{if(r)continue;o===i&&a==='"'||o===i&&a==="'"?(o=u+1,r=a):a==="."&&!i?u>o?l():o=u+1:a==="["?(u>o&&l(),i=o=u+1):a==="]"&&(i||_e("Access path missing open bracket: "+t),i>0&&l(),i=0,o=u+1)}return i&&_e("Access path missing closing bracket: "+t),r&&_e("Access path missing closing quote: "+t),u>o&&(u++,l()),e}function ms(t,e,n){const r=Va(t);return t=r.length===1?r[0]:t,gs((n&&n.get||IV)(r),[t],e||t)}const K5=ms("id"),ui=gs(t=>t,[],"identity"),Pf=gs(()=>0,[],"zero"),fm=gs(()=>1,[],"one"),Fo=gs(()=>!0,[],"true"),Mf=gs(()=>!1,[],"false");function sNe(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}const oNe=0,BV=1,$V=2,uNe=3,aNe=4;function kV(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:sNe,r=t||oNe;return{level(i){return arguments.length?(r=+i,this):r},error(){return r>=BV&&n("error","ERROR",arguments),this},warn(){return r>=$V&&n("warn","WARN",arguments),this},info(){return r>=uNe&&n("log","INFO",arguments),this},debug(){return r>=aNe&&n("log","DEBUG",arguments),this}}}var Se=Array.isArray;function ze(t){return t===Object(t)}const PV=t=>t!=="__proto__";function pw(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce((r,i)=>{for(const s in i)if(s==="signals")r.signals=lNe(r.signals,i.signals);else{const o=s==="legend"?{layout:1}:s==="style"?!0:null;J5(r,s,i[s],o)}return r},{})}function J5(t,e,n,r){if(!PV(e))return;let i,s;if(ze(n)&&!Se(n)){s=ze(t[e])?t[e]:t[e]={};for(i in n)r&&(r===!0||r[i])?J5(s,i,n[i]):PV(i)&&(s[i]=n[i])}else t[e]=n}function lNe(t,e){if(t==null)return e;const n={},r=[];function i(s){n[s.name]||(n[s.name]=1,r.push(s))}return e.forEach(i),t.forEach(i),r}function Rt(t){return t[t.length-1]}function ai(t){return t==null||t===""?null:+t}const MV=t=>e=>t*Math.exp(e),jV=t=>e=>Math.log(t*e),UV=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),qV=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,X5=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function Z5(t,e,n,r){const i=n(t[0]),s=n(Rt(t)),o=(s-i)*e;return[r(i-o),r(s-o)]}function cNe(t,e){return Z5(t,e,ai,ui)}function fNe(t,e){var n=Math.sign(t[0]);return Z5(t,e,jV(n),MV(n))}function xNe(t,e,n){return Z5(t,e,X5(n),X5(1/n))}function dNe(t,e,n){return Z5(t,e,UV(n),qV(n))}function eS(t,e,n,r,i){const s=r(t[0]),o=r(Rt(t)),u=e!=null?r(e):(s+o)/2;return[i(u+(s-u)*n),i(u+(o-u)*n)]}function HV(t,e,n){return eS(t,e,n,ai,ui)}function zV(t,e,n){const r=Math.sign(t[0]);return eS(t,e,n,jV(r),MV(r))}function gw(t,e,n,r){return eS(t,e,n,X5(r),X5(1/r))}function QV(t,e,n,r){return eS(t,e,n,UV(r),qV(r))}function hNe(t){return 1+~~(new Date(t).getMonth()/3)}function pNe(t){return 1+~~(new Date(t).getUTCMonth()/3)}function Ue(t){return t!=null?Se(t)?t:[t]:[]}function gNe(t,e,n){let r=t[0],i=t[1],s;return i<r&&(s=i,i=r,r=s),s=i-r,s>=n-e?[e,n]:[r=Math.min(Math.max(r,e),n-s),r+s]}function pt(t){return typeof t=="function"}const mNe="descending";function GV(t,e,n){n=n||{},e=Ue(e)||[];const r=[],i=[],s={},o=n.comparator||yNe;return Ue(t).forEach((u,a)=>{u!=null&&(r.push(e[a]===mNe?-1:1),i.push(u=pt(u)?u:ms(u,null,n)),(oi(u)||[]).forEach(l=>s[l]=1))}),i.length===0?null:gs(o(i,r),Object.keys(s))}const mw=(t,e)=>(t<e||t==null)&&e!=null?-1:(t>e||e==null)&&t!=null?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e===e?-1:e!==e&&t===t?1:0),yNe=(t,e)=>t.length===1?ENe(t[0],e[0]):ANe(t,e,t.length),ENe=(t,e)=>function(n,r){return mw(t(n),t(r))*e},ANe=(t,e,n)=>(e.push(0),function(r,i){let s,o=0,u=-1;for(;o===0&&++u<n;)s=t[u],o=mw(s(r),s(i));return o*e[u]});function li(t){return pt(t)?t:()=>t}function WV(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(e(r),n=null),t)}}function gt(t){for(let e,n,r=1,i=arguments.length;r<i;++r){e=arguments[r];for(n in e)t[n]=e[n]}return t}function Ya(t,e){let n=0,r,i,s,o;if(t&&(r=t.length))if(e==null){for(i=t[n];n<r&&(i==null||i!==i);i=t[++n]);for(s=o=i;n<r;++n)i=t[n],i!=null&&(i<s&&(s=i),i>o&&(o=i))}else{for(i=e(t[n]);n<r&&(i==null||i!==i);i=e(t[++n]));for(s=o=i;n<r;++n)i=e(t[n]),i!=null&&(i<s&&(s=i),i>o&&(o=i))}return[s,o]}function vNe(t,e){const n=t.length;let r=-1,i,s,o,u,a;if(e==null){for(;++r<n;)if(s=t[r],s!=null&&s>=s){i=o=s;break}if(r===n)return[-1,-1];for(u=a=r;++r<n;)s=t[r],s!=null&&(i>s&&(i=s,u=r),o<s&&(o=s,a=r))}else{for(;++r<n;)if(s=e(t[r],r,t),s!=null&&s>=s){i=o=s;break}if(r===n)return[-1,-1];for(u=a=r;++r<n;)s=e(t[r],r,t),s!=null&&(i>s&&(i=s,u=r),o<s&&(o=s,a=r))}return[u,a]}const _Ne=Object.prototype.hasOwnProperty;function tt(t,e){return _Ne.call(t,e)}const tS={};function xm(t){let e={},n;function r(s){return tt(e,s)&&e[s]!==tS}const i={size:0,empty:0,object:e,has:r,get(s){return r(s)?e[s]:void 0},set(s,o){return r(s)||(++i.size,e[s]===tS&&--i.empty),e[s]=o,this},delete(s){return r(s)&&(--i.size,++i.empty,e[s]=tS),this},clear(){i.size=i.empty=0,i.object=e={}},test(s){return arguments.length?(n=s,i):n},clean(){const s={};let o=0;for(const u in e){const a=e[u];a!==tS&&(!n||!n(a))&&(s[u]=a,++o)}i.size=o,i.empty=0,i.object=e=s}};return t&&Object.keys(t).forEach(s=>{i.set(s,t[s])}),i}function SNe(t,e,n,r,i,s){if(!n&&n!==0)return s;const o=+n;let u=t[0],a=Rt(t),l;a<u&&(l=u,u=a,a=l),l=Math.abs(e-u);const c=Math.abs(a-e);return l<c&&l<=o?r:c<=o?i:s}function Ne(t,e,n){const r=t.prototype=Object.create(e.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),gt(r,n)}function dm(t,e,n,r){let i=e[0],s=e[e.length-1],o;return i>s&&(o=i,i=s,s=o),n=n===void 0||n,r=r===void 0||r,(n?i<=t:i<t)&&(r?t<=s:t<s)}function Lh(t){return typeof t=="boolean"}function jf(t){return Object.prototype.toString.call(t)==="[object Date]"}function CNe(t){return t&&pt(t[Symbol.iterator])}function on(t){return typeof t=="number"}function bNe(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function qe(t){return typeof t=="string"}function VV(t,e,n){t&&(t=e?Ue(t).map(u=>u.replace(/\\(.)/g,"$1")):Ue(t));const r=t&&t.length,i=n&&n.get||IV,s=u=>i(e?[u]:Va(u));let o;if(!r)o=function(){return""};else if(r===1){const u=s(t[0]);o=function(a){return""+u(a)}}else{const u=t.map(s);o=function(a){let l=""+u[0](a),c=0;for(;++c<r;)l+="|"+u[c](a);return l}}return gs(o,t,"key")}function TNe(t,e){const n=t[0],r=Rt(t),i=+e;return i?i===1?r:n+i*(r-n):n}const RNe=1e4;function ONe(t){t=+t||RNe;let e,n,r;const i=()=>{e={},n={},r=0},s=(o,u)=>(++r>t&&(n=e,e={},r=1),e[o]=u);return i(),{clear:i,has:o=>tt(e,o)||tt(n,o),get:o=>tt(e,o)?e[o]:tt(n,o)?s(o,n[o]):void 0,set:(o,u)=>tt(e,o)?e[o]=u:s(o,u)}}function DNe(t,e,n,r){const i=e.length,s=n.length;if(!s)return e;if(!i)return n;const o=r||new e.constructor(i+s);let u=0,a=0,l=0;for(;u<i&&a<s;++l)o[l]=t(e[u],n[a])>0?n[a++]:e[u++];for(;u<i;++u,++l)o[l]=e[u];for(;a<s;++a,++l)o[l]=n[a];return o}function nS(t,e){let n="";for(;--e>=0;)n+=t;return n}function wNe(t,e,n,r){const i=n||" ",s=t+"",o=e-s.length;return o<=0?s:r==="left"?nS(i,o)+s:r==="center"?nS(i,~~(o/2))+s+nS(i,Math.ceil(o/2)):s+nS(i,o)}function rS(t){return t&&Rt(t)-t[0]||0}function Fe(t){return Se(t)?"["+t.map(Fe)+"]":ze(t)||qe(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function YV(t){return t==null||t===""?null:!t||t==="false"||t==="0"?!1:!!t}const NNe=t=>on(t)||jf(t)?t:Date.parse(t);function KV(t,e){return e=e||NNe,t==null||t===""?null:e(t)}function JV(t){return t==null||t===""?null:t+""}function Bu(t){const e={},n=t.length;for(let r=0;r<n;++r)e[t[r]]=!0;return e}function FNe(t,e,n,r){const i=r??"…",s=t+"",o=s.length,u=Math.max(0,e-i.length);return o<=e?s:n==="left"?i+s.slice(o-u):n==="center"?s.slice(0,Math.ceil(u/2))+i+s.slice(o-~~(u/2)):s.slice(0,u)+i}function Uf(t,e,n){if(t)if(e){const r=t.length;for(let i=0;i<r;++i){const s=e(t[i]);s&&n(s,i,t)}}else t.forEach(n)}var XV={},yw={},Ew=34,hm=10,Aw=13;function ZV(t){return new Function("d","return {"+t.map(function(e,n){return JSON.stringify(e)+": d["+n+'] || ""'}).join(",")+"}")}function LNe(t,e){var n=ZV(t);return function(r,i){return e(n(r),i,t)}}function eY(t){var e=Object.create(null),n=[];return t.forEach(function(r){for(var i in r)i in e||n.push(e[i]=i)}),n}function Bi(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function INe(t){return t<0?"-"+Bi(-t,6):t>9999?"+"+Bi(t,6):Bi(t,4)}function BNe(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":INe(t.getUTCFullYear())+"-"+Bi(t.getUTCMonth()+1,2)+"-"+Bi(t.getUTCDate(),2)+(i?"T"+Bi(e,2)+":"+Bi(n,2)+":"+Bi(r,2)+"."+Bi(i,3)+"Z":r?"T"+Bi(e,2)+":"+Bi(n,2)+":"+Bi(r,2)+"Z":n||e?"T"+Bi(e,2)+":"+Bi(n,2)+"Z":"")}function $Ne(t){var e=new RegExp('["'+t+`
1292
1292
  \r]`),n=t.charCodeAt(0);function r(f,x){var h,p,m=i(f,function(g,y){if(h)return h(g,y-1);p=g,h=x?LNe(g,x):ZV(g)});return m.columns=p||[],m}function i(f,x){var h=[],p=f.length,m=0,g=0,y,E=p<=0,A=!1;f.charCodeAt(p-1)===hm&&--p,f.charCodeAt(p-1)===Aw&&--p;function v(){if(E)return yw;if(A)return A=!1,XV;var S,C=m,b;if(f.charCodeAt(C)===Ew){for(;m++<p&&f.charCodeAt(m)!==Ew||f.charCodeAt(++m)===Ew;);return(S=m)>=p?E=!0:(b=f.charCodeAt(m++))===hm?A=!0:b===Aw&&(A=!0,f.charCodeAt(m)===hm&&++m),f.slice(C+1,S-1).replace(/""/g,'"')}for(;m<p;){if((b=f.charCodeAt(S=m++))===hm)A=!0;else if(b===Aw)A=!0,f.charCodeAt(m)===hm&&++m;else if(b!==n)continue;return f.slice(C,S)}return E=!0,f.slice(C,p)}for(;(y=v())!==yw;){for(var _=[];y!==XV&&y!==yw;)_.push(y),y=v();x&&(_=x(_,g++))==null||h.push(_)}return h}function s(f,x){return f.map(function(h){return x.map(function(p){return c(h[p])}).join(t)})}function o(f,x){return x==null&&(x=eY(f)),[x.map(c).join(t)].concat(s(f,x)).join(`
1293
1293
  `)}function u(f,x){return x==null&&(x=eY(f)),s(f,x).join(`
1294
1294
  `)}function a(f){return f.map(l).join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/render",
3
- "version": "0.0.231",
3
+ "version": "0.0.232-dev250118020814",
4
4
  "license": "MIT",
5
5
  "main": "dist/module/index.umd.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "build-types": "tsc --build --declaration --emitDeclarationOnly"
32
32
  },
33
33
  "dependencies": {
34
- "@malloydata/malloy": "^0.0.231",
34
+ "@malloydata/malloy": "^0.0.232-dev250118020814",
35
35
  "@tanstack/solid-virtual": "^3.10.4",
36
36
  "component-register": "^0.8.6",
37
37
  "lodash": "^4.17.20",