@bitcobblers/wod-wiki-lang 0.1.6 → 0.1.14
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.
- package/dist/{chunk-F2TOS4AF.mjs → chunk-PFQDVQQO.mjs} +3 -9
- package/dist/chunk-PFQDVQQO.mjs.map +1 -0
- package/dist/index.cjs +220 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +178 -96
- package/dist/index.d.ts +178 -96
- package/dist/index.mjs +178 -68
- package/dist/index.mjs.map +1 -1
- package/dist/react.mjs +2 -2
- package/package.json +2 -2
- package/dist/chunk-F2TOS4AF.mjs.map +0 -1
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __export = (target, all) => {
|
|
3
|
-
for (var name in all)
|
|
4
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
-
};
|
|
6
|
-
|
|
7
1
|
// src/runtime/INowProvider.ts
|
|
8
2
|
var wallClockNow = {
|
|
9
3
|
now: () => /* @__PURE__ */ new Date(),
|
|
@@ -74,6 +68,6 @@ var formatDurationSmart = (ms) => {
|
|
|
74
68
|
return formatTimeMMSS(ms);
|
|
75
69
|
};
|
|
76
70
|
|
|
77
|
-
export {
|
|
78
|
-
//# sourceMappingURL=chunk-
|
|
79
|
-
//# sourceMappingURL=chunk-
|
|
71
|
+
export { createBrowserRuntimeNow, formatDurationSmart, frozenNow, getRuntimeNowMs, wallClockNow };
|
|
72
|
+
//# sourceMappingURL=chunk-PFQDVQQO.mjs.map
|
|
73
|
+
//# sourceMappingURL=chunk-PFQDVQQO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/INowProvider.ts","../src/runtime/browserRuntimeNow.ts","../src/utils/formatTime.ts"],"names":[],"mappings":";AAYO,IAAM,YAAA,GAA6B;AAAA,EACtC,GAAA,EAAK,sBAAM,IAAI,IAAA,EAAK;AAAA,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,GAAsB,CAAC,EAAA,KAAuB;AACzD,EAAA,IAAI,EAAA,KAAO,UAAa,EAAA,KAAO,IAAA,IAAQ,CAAC,MAAA,CAAO,QAAA,CAAS,EAAE,CAAA,EAAG;AAC3D,IAAA,OAAO,OAAA;AAAA,EACT;AACA,EAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,GAAA,CAAI,EAAE,CAAA;AACzB,EAAA,MAAM,YAAA,GAAe,IAAA,CAAK,KAAA,CAAM,KAAA,GAAQ,GAAI,CAAA;AAC5C,EAAA,IAAI,gBAAgB,IAAA,EAAM;AACxB,IAAA,OAAO,iBAAiB,EAAE,CAAA;AAAA,EAC5B;AACA,EAAA,OAAO,eAAe,EAAE,CAAA;AAC1B","file":"chunk-PFQDVQQO.mjs","sourcesContent":["/**\n * INowProvider — the only seam for \"what time is it\" in the runtime.\n * Events, actions, and behaviors that need a timestamp take a now-fn\n * in their constructor; the runtime passes its single provider down.\n * Tests pass a frozen clock so the timeline is deterministic.\n */\nexport interface INowProvider {\n now(): Date;\n nowMs(): number;\n}\n\n/** Default provider: reads wall clock. */\nexport const wallClockNow: INowProvider = {\n now: () => new Date(),\n nowMs: () => Date.now(),\n};\n\n/** A provider that always returns the same Date (for tests). */\nexport function frozenNow(at: Date): INowProvider {\n return { now: () => at, nowMs: () => at.getTime() };\n}\n","import type { INowProvider } from './INowProvider';\n\ndeclare global {\n interface Window {\n __chromecast_senderClockTimeMs?: () => number;\n }\n}\n\n/**\n * Returns the canonical \"now\" used for runtime timer interpolation.\n *\n * Browser workbench: falls back to Date.now().\n * Chromecast receiver: uses sender-synchronized clock when available.\n */\nexport function getRuntimeNowMs(): number {\n if (typeof window !== 'undefined') {\n const senderClock = window.__chromecast_senderClockTimeMs;\n if (typeof senderClock === 'function') {\n try {\n const value = senderClock();\n if (Number.isFinite(value)) {\n return value;\n }\n } catch {\n // Ignore sender clock failures and fall back to Date.now().\n }\n }\n }\n\n return Date.now();\n}\n\n/** Creates an INowProvider that reads the browser sender-clock when available. */\nexport function createBrowserRuntimeNow(): INowProvider {\n return {\n now: () => new Date(getRuntimeNowMs()),\n nowMs: () => getRuntimeNowMs(),\n };\n}\n","/**\n * Canonical time formatting utilities\n * Consolidates 15+ inline formatter implementations across the codebase\n * \n * All formatters handle edge cases: null, undefined, negative numbers, non-finite values\n */\n\n/**\n * Formats milliseconds to MM:SS format\n * e.g., 65432 → \"01:05\" (~65 seconds)\n */\nexport const formatTimeMMSS = (ms: number): string => {\n if (ms === undefined || ms === null || !Number.isFinite(ms)) {\n return '--:--';\n }\n const isNegative = ms < 0;\n const absMs = Math.abs(ms);\n const totalSeconds = Math.floor(absMs / 1000);\n const minutes = Math.floor(totalSeconds / 60);\n const seconds = totalSeconds % 60;\n const sign = isNegative ? '-' : '';\n return `${sign}${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;\n};\n\n/**\n * Formats milliseconds to HH:MM:SS format\n * e.g., 3665432 → \"01:01:05\" (~1 hour, 1 minute, 5 seconds)\n */\nexport const formatTimeHHMMSS = (ms: number): string => {\n if (ms === undefined || ms === null || !Number.isFinite(ms)) {\n return '--:--:--';\n }\n const isNegative = ms < 0;\n const absMs = Math.abs(ms);\n const totalSeconds = Math.floor(absMs / 1000);\n const hours = Math.floor(totalSeconds / 3600);\n const minutes = Math.floor((totalSeconds % 3600) / 60);\n const seconds = totalSeconds % 60;\n const sign = isNegative ? '-' : '';\n return `${sign}${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;\n};\n\n/**\n * Formats milliseconds to MM:SS.ms format (with centisecond precision)\n * e.g., 65432 → \"01:05.43\" (~65.4 seconds)\n */\nexport const formatTimePrecise = (ms: number): string => {\n if (ms === undefined || ms === null || !Number.isFinite(ms)) {\n return '--:--.--';\n }\n const isNegative = ms < 0;\n const absMs = Math.abs(ms);\n const totalSeconds = Math.floor(absMs / 1000);\n const minutes = Math.floor(totalSeconds / 60);\n const seconds = totalSeconds % 60;\n const centiseconds = Math.floor((absMs % 1000) / 10);\n const sign = isNegative ? '-' : '';\n return `${sign}${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}.${centiseconds.toString().padStart(2, '0')}`;\n};\n\n/**\n * Formats seconds to MM:SS format\n * NOTE: Input is SECONDS, not milliseconds (unlike the ms variants above)\n * e.g., 65 → \"01:05\"\n * \n * Use this ONLY for callers that have seconds-based time values\n */\nexport const formatSecondsMMSS = (seconds: number): string => {\n if (seconds === undefined || seconds === null || !Number.isFinite(seconds)) {\n return '--:--';\n }\n const isNegative = seconds < 0;\n const absSeconds = Math.abs(seconds);\n const mins = Math.floor(absSeconds / 60);\n const secs = Math.floor(absSeconds % 60);\n const sign = isNegative ? '-' : '';\n return `${sign}${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;\n};\n\n/**\n * Formats seconds to HH:MM:SS format\n * NOTE: Input is SECONDS, not milliseconds\n * e.g., 3665 → \"01:01:05\"\n */\nexport const formatSecondsHHMMSS = (seconds: number): string => {\n if (seconds === undefined || seconds === null || !Number.isFinite(seconds)) {\n return '--:--:--';\n }\n const isNegative = seconds < 0;\n const absSeconds = Math.abs(seconds);\n const hours = Math.floor(absSeconds / 3600);\n const mins = Math.floor((absSeconds % 3600) / 60);\n const secs = Math.floor(absSeconds % 60);\n const sign = isNegative ? '-' : '';\n return `${sign}${hours.toString().padStart(2, '0')}:${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;\n};\n\n/**\n * Smart duration formatter: chooses MM:SS or HH:MM:SS based on total duration\n * If duration >= 1 hour: returns HH:MM:SS, else MM:SS\n * Input: milliseconds\n */\nexport const formatDurationSmart = (ms: number): string => {\n if (ms === undefined || ms === null || !Number.isFinite(ms)) {\n return '--:--';\n }\n const absMs = Math.abs(ms);\n const totalSeconds = Math.floor(absMs / 1000);\n if (totalSeconds >= 3600) {\n return formatTimeHHMMSS(ms);\n }\n return formatTimeMMSS(ms);\n};\n\n/**\n * Compact duration format: M:SS.m or MM:SS depending on magnitude\n * e.g., 5432 → \"5:43\", 65432 → \"01:05\"\n * Input: milliseconds\n * \n * Use this only for space-constrained UIs\n */\nexport const formatDurationCompact = (ms: number): string => {\n if (ms === undefined || ms === null || !Number.isFinite(ms)) {\n return '--:--';\n }\n const absMs = Math.abs(ms);\n const totalSeconds = Math.floor(absMs / 1000);\n const minutes = Math.floor(totalSeconds / 60);\n const seconds = totalSeconds % 60;\n \n // If minutes < 10, use compact format without leading zero\n if (minutes < 10) {\n return `${minutes}:${seconds.toString().padStart(2, '0')}`;\n }\n \n // Otherwise use standard MM:SS\n return formatTimeMMSS(ms);\n};\n\n/**\n * Formats a timestamp (Date or number) into HH:MM:SS format\n * e.g., new Date('2024-01-01T12:34:56Z') → \"12:34:56\"\n * Returns 'running' if date is undefined.\n */\nexport const formatTimestamp = (date?: Date | number): string => {\n if (!date) return 'running';\n const dateObj = typeof date === 'number' ? new Date(date) : date;\n return dateObj.toLocaleTimeString('en-US', {\n hour12: false,\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit'\n });\n};\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -6,12 +6,6 @@ var language = require('@codemirror/language');
|
|
|
6
6
|
var common = require('@lezer/common');
|
|
7
7
|
var uuid = require('uuid');
|
|
8
8
|
|
|
9
|
-
var __defProp = Object.defineProperty;
|
|
10
|
-
var __export = (target, all) => {
|
|
11
|
-
for (var name2 in all)
|
|
12
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
13
|
-
};
|
|
14
|
-
|
|
15
9
|
// src/registry/Registry.ts
|
|
16
10
|
var Registry = class {
|
|
17
11
|
items = /* @__PURE__ */ new Map();
|
|
@@ -5620,6 +5614,11 @@ function createBrowserRuntimeNow() {
|
|
|
5620
5614
|
nowMs: () => getRuntimeNowMs()
|
|
5621
5615
|
};
|
|
5622
5616
|
}
|
|
5617
|
+
|
|
5618
|
+
// src/runtime/contracts/ICastSubscription.ts
|
|
5619
|
+
function isCastSubscription(s) {
|
|
5620
|
+
return "sendAnalyticsSummary" in s && typeof s.sendAnalyticsSummary === "function";
|
|
5621
|
+
}
|
|
5623
5622
|
var CompletionTimestampBehavior = class {
|
|
5624
5623
|
completionTime;
|
|
5625
5624
|
wasComplete = false;
|
|
@@ -11942,6 +11941,170 @@ var RuntimeAdapter = class {
|
|
|
11942
11941
|
return icons[memoryType];
|
|
11943
11942
|
}
|
|
11944
11943
|
};
|
|
11944
|
+
|
|
11945
|
+
// src/runtime/subscriptions/LocalRuntimeSubscription.ts
|
|
11946
|
+
var LocalRuntimeSubscription = class {
|
|
11947
|
+
id;
|
|
11948
|
+
onStackSnapshotCallback;
|
|
11949
|
+
onOutputCallback;
|
|
11950
|
+
constructor(options) {
|
|
11951
|
+
this.id = options?.id ?? "local";
|
|
11952
|
+
this.onStackSnapshotCallback = options?.onStackSnapshot;
|
|
11953
|
+
this.onOutputCallback = options?.onOutput;
|
|
11954
|
+
}
|
|
11955
|
+
onStackSnapshot(snapshot) {
|
|
11956
|
+
this.onStackSnapshotCallback?.(snapshot);
|
|
11957
|
+
}
|
|
11958
|
+
onOutput(output) {
|
|
11959
|
+
this.onOutputCallback?.(output);
|
|
11960
|
+
}
|
|
11961
|
+
dispose() {
|
|
11962
|
+
this.onStackSnapshotCallback = void 0;
|
|
11963
|
+
this.onOutputCallback = void 0;
|
|
11964
|
+
}
|
|
11965
|
+
};
|
|
11966
|
+
|
|
11967
|
+
// src/runtime/subscriptions/LocalEventProvider.ts
|
|
11968
|
+
var LocalEventProvider = class _LocalEventProvider {
|
|
11969
|
+
constructor(runtime) {
|
|
11970
|
+
this.runtime = runtime;
|
|
11971
|
+
}
|
|
11972
|
+
runtime;
|
|
11973
|
+
static subscriptionCounter = 0;
|
|
11974
|
+
unsubscribes = [];
|
|
11975
|
+
disposed = false;
|
|
11976
|
+
dispatch(event) {
|
|
11977
|
+
if (this.disposed) return;
|
|
11978
|
+
this.runtime.handle(event);
|
|
11979
|
+
}
|
|
11980
|
+
onEvent(handler) {
|
|
11981
|
+
if (this.disposed) return () => {
|
|
11982
|
+
};
|
|
11983
|
+
const ownerId = `local-event-provider-${_LocalEventProvider.subscriptionCounter++}`;
|
|
11984
|
+
const unsubscribeFromBus = this.runtime.eventBus.on("*", (event) => {
|
|
11985
|
+
handler(event);
|
|
11986
|
+
}, ownerId);
|
|
11987
|
+
const unsubscribe = () => {
|
|
11988
|
+
unsubscribeFromBus();
|
|
11989
|
+
this.unsubscribes = this.unsubscribes.filter((candidate) => candidate !== unsubscribe);
|
|
11990
|
+
};
|
|
11991
|
+
this.unsubscribes.push(unsubscribe);
|
|
11992
|
+
return unsubscribe;
|
|
11993
|
+
}
|
|
11994
|
+
dispose() {
|
|
11995
|
+
if (this.disposed) return;
|
|
11996
|
+
this.disposed = true;
|
|
11997
|
+
const unsubscribes = [...this.unsubscribes];
|
|
11998
|
+
this.unsubscribes = [];
|
|
11999
|
+
for (const unsubscribe of unsubscribes) {
|
|
12000
|
+
unsubscribe();
|
|
12001
|
+
}
|
|
12002
|
+
}
|
|
12003
|
+
};
|
|
12004
|
+
|
|
12005
|
+
// src/runtime/subscriptions/SubscriptionManager.ts
|
|
12006
|
+
var SubscriptionManager = class {
|
|
12007
|
+
constructor(runtime) {
|
|
12008
|
+
this.runtime = runtime;
|
|
12009
|
+
this.stackUnsub = this.runtime.subscribeToStack((snapshot) => {
|
|
12010
|
+
for (const sub of this.subscriptions.values()) {
|
|
12011
|
+
try {
|
|
12012
|
+
sub.onStackSnapshot(snapshot);
|
|
12013
|
+
} catch (err) {
|
|
12014
|
+
console.error(`[SubscriptionManager] Error in subscription '${sub.id}' onStackSnapshot:`, err);
|
|
12015
|
+
}
|
|
12016
|
+
}
|
|
12017
|
+
});
|
|
12018
|
+
this.outputUnsub = this.runtime.subscribeToOutput((output) => {
|
|
12019
|
+
for (const sub of this.subscriptions.values()) {
|
|
12020
|
+
try {
|
|
12021
|
+
sub.onOutput(output);
|
|
12022
|
+
} catch (err) {
|
|
12023
|
+
console.error(`[SubscriptionManager] Error in subscription '${sub.id}' onOutput:`, err);
|
|
12024
|
+
}
|
|
12025
|
+
}
|
|
12026
|
+
});
|
|
12027
|
+
}
|
|
12028
|
+
runtime;
|
|
12029
|
+
subscriptions = /* @__PURE__ */ new Map();
|
|
12030
|
+
stackUnsub = null;
|
|
12031
|
+
outputUnsub = null;
|
|
12032
|
+
disposed = false;
|
|
12033
|
+
/**
|
|
12034
|
+
* Register a subscription. If a subscription with the same ID already exists,
|
|
12035
|
+
* the old one is disposed and replaced.
|
|
12036
|
+
*
|
|
12037
|
+
* New subscriptions immediately receive the current stack state and any
|
|
12038
|
+
* existing output statements to catch them up.
|
|
12039
|
+
*/
|
|
12040
|
+
add(subscription) {
|
|
12041
|
+
if (this.disposed) {
|
|
12042
|
+
console.warn("[SubscriptionManager] Cannot add subscription after dispose");
|
|
12043
|
+
return;
|
|
12044
|
+
}
|
|
12045
|
+
const existing = this.subscriptions.get(subscription.id);
|
|
12046
|
+
if (existing) {
|
|
12047
|
+
existing.dispose();
|
|
12048
|
+
}
|
|
12049
|
+
this.subscriptions.set(subscription.id, subscription);
|
|
12050
|
+
try {
|
|
12051
|
+
subscription.onStackSnapshot({
|
|
12052
|
+
type: "initial",
|
|
12053
|
+
blocks: [...this.runtime.stack.blocks],
|
|
12054
|
+
depth: this.runtime.stack.count,
|
|
12055
|
+
clockTime: this.runtime.clock.currentDate
|
|
12056
|
+
});
|
|
12057
|
+
const currentOutputs = this.runtime.getOutputStatements();
|
|
12058
|
+
for (const output of currentOutputs) {
|
|
12059
|
+
subscription.onOutput(output);
|
|
12060
|
+
}
|
|
12061
|
+
} catch (err) {
|
|
12062
|
+
console.error(`[SubscriptionManager] Error catching up subscription '${subscription.id}':`, err);
|
|
12063
|
+
}
|
|
12064
|
+
}
|
|
12065
|
+
/**
|
|
12066
|
+
* Remove and dispose a subscription by ID.
|
|
12067
|
+
* Returns true if the subscription was found and removed.
|
|
12068
|
+
*/
|
|
12069
|
+
remove(id) {
|
|
12070
|
+
const sub = this.subscriptions.get(id);
|
|
12071
|
+
if (!sub) return false;
|
|
12072
|
+
sub.dispose();
|
|
12073
|
+
this.subscriptions.delete(id);
|
|
12074
|
+
return true;
|
|
12075
|
+
}
|
|
12076
|
+
/**
|
|
12077
|
+
* Check if a subscription with the given ID is registered.
|
|
12078
|
+
*/
|
|
12079
|
+
has(id) {
|
|
12080
|
+
return this.subscriptions.has(id);
|
|
12081
|
+
}
|
|
12082
|
+
/**
|
|
12083
|
+
* Get the number of active subscriptions.
|
|
12084
|
+
*/
|
|
12085
|
+
get count() {
|
|
12086
|
+
return this.subscriptions.size;
|
|
12087
|
+
}
|
|
12088
|
+
/**
|
|
12089
|
+
* Dispose all subscriptions and unsubscribe from the runtime.
|
|
12090
|
+
*/
|
|
12091
|
+
dispose() {
|
|
12092
|
+
if (this.disposed) return;
|
|
12093
|
+
this.disposed = true;
|
|
12094
|
+
this.stackUnsub?.();
|
|
12095
|
+
this.stackUnsub = null;
|
|
12096
|
+
this.outputUnsub?.();
|
|
12097
|
+
this.outputUnsub = null;
|
|
12098
|
+
for (const sub of this.subscriptions.values()) {
|
|
12099
|
+
try {
|
|
12100
|
+
sub.dispose();
|
|
12101
|
+
} catch (err) {
|
|
12102
|
+
console.error(`[SubscriptionManager] Error disposing subscription '${sub.id}':`, err);
|
|
12103
|
+
}
|
|
12104
|
+
}
|
|
12105
|
+
this.subscriptions.clear();
|
|
12106
|
+
}
|
|
12107
|
+
};
|
|
11945
12108
|
function formatMetricLabel(key) {
|
|
11946
12109
|
return key.charAt(0).toUpperCase() + key.slice(1).replace(/_/g, " ");
|
|
11947
12110
|
}
|
|
@@ -12619,65 +12782,6 @@ function normalizeName(value) {
|
|
|
12619
12782
|
return value.trim().toLowerCase();
|
|
12620
12783
|
}
|
|
12621
12784
|
|
|
12622
|
-
// src/analytics/calc/index.ts
|
|
12623
|
-
var calc_exports = {};
|
|
12624
|
-
__export(calc_exports, {
|
|
12625
|
-
ABSENT: () => ABSENT,
|
|
12626
|
-
AGGREGATE_BUILTINS: () => AGGREGATE_BUILTINS,
|
|
12627
|
-
AUTHORITATIVE_CASTS: () => AUTHORITATIVE_CASTS,
|
|
12628
|
-
BUILTIN_CALCS: () => BUILTIN_CALCS,
|
|
12629
|
-
CONTEXT_ATOMS: () => CONTEXT_ATOMS,
|
|
12630
|
-
CalcEngine: () => CalcEngine,
|
|
12631
|
-
CalcEvalError: () => CalcEvalError,
|
|
12632
|
-
CalcParseError: () => CalcParseError,
|
|
12633
|
-
CalcRegistrationError: () => CalcRegistrationError,
|
|
12634
|
-
CalcUnitError: () => CalcUnitError,
|
|
12635
|
-
CalculationRegistry: () => CalculationRegistry,
|
|
12636
|
-
DIM_COUNT: () => DIM_COUNT,
|
|
12637
|
-
DIM_ENERGY: () => DIM_ENERGY,
|
|
12638
|
-
DIM_LENGTH: () => DIM_LENGTH,
|
|
12639
|
-
DIM_MASS: () => DIM_MASS,
|
|
12640
|
-
DIM_TIME: () => DIM_TIME,
|
|
12641
|
-
DIM_ZERO: () => DIM_ZERO,
|
|
12642
|
-
LookupRegistry: () => LookupRegistry,
|
|
12643
|
-
NAMED_COMPOUNDS: () => NAMED_COMPOUNDS,
|
|
12644
|
-
REST_EXCLUSION: () => REST_EXCLUSION,
|
|
12645
|
-
RPE_LABELS: () => RPE_LABELS,
|
|
12646
|
-
STORE_CALCS: () => STORE_CALCS,
|
|
12647
|
-
STREAM_ATOMS: () => STREAM_ATOMS,
|
|
12648
|
-
UNITS: () => UNITS,
|
|
12649
|
-
addDim: () => addDim,
|
|
12650
|
-
buildStaticLookups: () => buildStaticLookups,
|
|
12651
|
-
checkCalcLine: () => checkCalcLine,
|
|
12652
|
-
compileLineForm: () => compileLineForm,
|
|
12653
|
-
composeDivUnit: () => composeDivUnit,
|
|
12654
|
-
composeMulUnit: () => composeMulUnit,
|
|
12655
|
-
compoundName: () => compoundName,
|
|
12656
|
-
convertScalar: () => convertScalar,
|
|
12657
|
-
createCalcEngine: () => createCalcEngine,
|
|
12658
|
-
createCalcStack: () => createCalcStack,
|
|
12659
|
-
createDisciplinesTable: () => createDisciplinesTable,
|
|
12660
|
-
createEffortTable: () => createEffortTable,
|
|
12661
|
-
createProfileTable: () => createProfileTable,
|
|
12662
|
-
createRpeLabelsTable: () => createRpeLabelsTable,
|
|
12663
|
-
dimEquals: () => dimEquals,
|
|
12664
|
-
evaluate: () => evaluate,
|
|
12665
|
-
formatDim: () => formatDim,
|
|
12666
|
-
getUnit: () => getUnit,
|
|
12667
|
-
inferDim: () => inferDim,
|
|
12668
|
-
isDimensionless: () => isDimensionless,
|
|
12669
|
-
num: () => num,
|
|
12670
|
-
outputNodeId: () => outputNodeId,
|
|
12671
|
-
outputNodeIds: () => outputNodeIds,
|
|
12672
|
-
parseCalcLine: () => parseCalcLine,
|
|
12673
|
-
parseExpression: () => parseExpression,
|
|
12674
|
-
printCalculation: () => printCalculation,
|
|
12675
|
-
str: () => str,
|
|
12676
|
-
subDim: () => subDim,
|
|
12677
|
-
truthy: () => truthy,
|
|
12678
|
-
validateOutputUnit: () => validateOutputUnit
|
|
12679
|
-
});
|
|
12680
|
-
|
|
12681
12785
|
// src/analytics/calc/lineform.ts
|
|
12682
12786
|
var SCOPE_RE = /^(segment|workout|store)\b/;
|
|
12683
12787
|
function compileLineForm(src, defaultScope) {
|
|
@@ -13110,15 +13214,18 @@ function toStoredOutputStatement(output) {
|
|
|
13110
13214
|
}
|
|
13111
13215
|
|
|
13112
13216
|
// src/version.ts
|
|
13113
|
-
var VERSION = "0.1.
|
|
13114
|
-
var GIT_SHA = "
|
|
13115
|
-
var BUILD_TIME = "2026-08-18T18:
|
|
13217
|
+
var VERSION = "0.1.14";
|
|
13218
|
+
var GIT_SHA = "ce7593a";
|
|
13219
|
+
var BUILD_TIME = "2026-08-18T18:26:56.537Z";
|
|
13116
13220
|
var SEMVER = {
|
|
13117
|
-
version: "0.1.
|
|
13118
|
-
gitSha: "
|
|
13119
|
-
buildTime: "2026-08-18T18:
|
|
13221
|
+
version: "0.1.14",
|
|
13222
|
+
gitSha: "ce7593a",
|
|
13223
|
+
buildTime: "2026-08-18T18:26:56.537Z"
|
|
13120
13224
|
};
|
|
13121
13225
|
|
|
13226
|
+
exports.ABSENT = ABSENT;
|
|
13227
|
+
exports.AGGREGATE_BUILTINS = AGGREGATE_BUILTINS;
|
|
13228
|
+
exports.AUTHORITATIVE_CASTS = AUTHORITATIVE_CASTS;
|
|
13122
13229
|
exports.AbortSessionAction = AbortSessionAction;
|
|
13123
13230
|
exports.AnalyticsEngine = AnalyticsEngine;
|
|
13124
13231
|
exports.AnalyticsTransformer = AnalyticsTransformer;
|
|
@@ -13129,7 +13236,12 @@ exports.BehaviorContext = BehaviorContext;
|
|
|
13129
13236
|
exports.BlockContext = BlockContext;
|
|
13130
13237
|
exports.CONSUMED_HINTS = CONSUMED_HINTS;
|
|
13131
13238
|
exports.CONSUMED_HINT_KEYS = CONSUMED_HINT_KEYS;
|
|
13239
|
+
exports.CONTEXT_ATOMS = CONTEXT_ATOMS;
|
|
13132
13240
|
exports.CalcEngine = CalcEngine;
|
|
13241
|
+
exports.CalcEvalError = CalcEvalError;
|
|
13242
|
+
exports.CalcParseError = CalcParseError;
|
|
13243
|
+
exports.CalcRegistrationError = CalcRegistrationError;
|
|
13244
|
+
exports.CalcUnitError = CalcUnitError;
|
|
13133
13245
|
exports.CalculateBlockProcessor = CalculateBlockProcessor;
|
|
13134
13246
|
exports.CalculationRegistry = CalculationRegistry;
|
|
13135
13247
|
exports.CardioDialect = CardioDialect;
|
|
@@ -13141,6 +13253,8 @@ exports.CrossFitDialect = CrossFitDialect;
|
|
|
13141
13253
|
exports.DAY = DAY;
|
|
13142
13254
|
exports.DEFAULT_RESOLVER_OPTIONS = DEFAULT_RESOLVER_OPTIONS;
|
|
13143
13255
|
exports.DEFAULT_UNRESOLVED_EFFORT_MET = DEFAULT_UNRESOLVED_EFFORT_MET;
|
|
13256
|
+
exports.DIM_COUNT = DIM_COUNT;
|
|
13257
|
+
exports.DIM_ENERGY = DIM_ENERGY;
|
|
13144
13258
|
exports.DIM_LENGTH = DIM_LENGTH;
|
|
13145
13259
|
exports.DIM_MASS = DIM_MASS;
|
|
13146
13260
|
exports.DIM_TIME = DIM_TIME;
|
|
@@ -13162,10 +13276,13 @@ exports.HabitsDialect = HabitsDialect;
|
|
|
13162
13276
|
exports.INTENSITY_TIERS = INTENSITY_TIERS;
|
|
13163
13277
|
exports.InMemoryEffortRegistry = InMemoryEffortRegistry;
|
|
13164
13278
|
exports.JitCompiler = JitCompiler;
|
|
13279
|
+
exports.LocalEventProvider = LocalEventProvider;
|
|
13280
|
+
exports.LocalRuntimeSubscription = LocalRuntimeSubscription;
|
|
13165
13281
|
exports.LookupRegistry = LookupRegistry;
|
|
13166
13282
|
exports.MdTimerRuntime = MdTimerRuntime;
|
|
13167
13283
|
exports.MemoryLocation = MemoryLocation;
|
|
13168
13284
|
exports.MemoryTypeEnum = MemoryTypeEnum;
|
|
13285
|
+
exports.NAMED_COMPOUNDS = NAMED_COMPOUNDS;
|
|
13169
13286
|
exports.NextAction = NextAction;
|
|
13170
13287
|
exports.NextEvent = NextEvent;
|
|
13171
13288
|
exports.NextEventHandler = NextEventHandler;
|
|
@@ -13176,6 +13293,8 @@ exports.PlaySoundAction = PlaySoundAction;
|
|
|
13176
13293
|
exports.PopBlockAction = PopBlockAction;
|
|
13177
13294
|
exports.PushBlockAction = PushBlockAction;
|
|
13178
13295
|
exports.PushRestBlockAction = PushRestBlockAction;
|
|
13296
|
+
exports.REST_EXCLUSION = REST_EXCLUSION;
|
|
13297
|
+
exports.RPE_LABELS = RPE_LABELS;
|
|
13179
13298
|
exports.RegisterEventHandlerAction = RegisterEventHandlerAction;
|
|
13180
13299
|
exports.Registry = Registry;
|
|
13181
13300
|
exports.RestBlock = RestBlock;
|
|
@@ -13191,17 +13310,20 @@ exports.RuntimeStack = RuntimeStack;
|
|
|
13191
13310
|
exports.SEMVER = SEMVER;
|
|
13192
13311
|
exports.STANDARD_UNITS = STANDARD_UNITS;
|
|
13193
13312
|
exports.STORE_CALCS = STORE_CALCS;
|
|
13313
|
+
exports.STREAM_ATOMS = STREAM_ATOMS;
|
|
13194
13314
|
exports.ScriptRuntime = ScriptRuntime;
|
|
13195
13315
|
exports.SessionRootBlock = SessionRootBlock;
|
|
13196
13316
|
exports.SnapshotClock = SnapshotClock;
|
|
13197
13317
|
exports.StandardAnalyticsProfile = StandardAnalyticsProfile;
|
|
13198
13318
|
exports.StartSessionAction = StartSessionAction;
|
|
13199
13319
|
exports.StartWorkoutAction = StartWorkoutAction;
|
|
13320
|
+
exports.SubscriptionManager = SubscriptionManager;
|
|
13200
13321
|
exports.ThrowError = ThrowError;
|
|
13201
13322
|
exports.ThrowErrorAction = ThrowErrorAction;
|
|
13202
13323
|
exports.TimeSpan = TimeSpan;
|
|
13203
13324
|
exports.TwoPassEffortResolutionProcess = TwoPassEffortResolutionProcess;
|
|
13204
13325
|
exports.TypedMemoryReference = TypedMemoryReference;
|
|
13326
|
+
exports.UNITS = UNITS;
|
|
13205
13327
|
exports.UnitRegistry = UnitRegistry;
|
|
13206
13328
|
exports.UnitSet = UnitSet;
|
|
13207
13329
|
exports.UnitsDialect = UnitsDialect;
|
|
@@ -13214,29 +13336,42 @@ exports.WaitingToStartBlock = WaitingToStartBlock;
|
|
|
13214
13336
|
exports.WhiteboardScript = WhiteboardScript;
|
|
13215
13337
|
exports.WodDialect = WodDialect;
|
|
13216
13338
|
exports.YogaDialect = YogaDialect;
|
|
13339
|
+
exports.addDim = addDim;
|
|
13340
|
+
exports.buildStaticLookups = buildStaticLookups;
|
|
13217
13341
|
exports.buildTooltip = buildTooltip;
|
|
13218
13342
|
exports.bundledEfforts = bundledEfforts;
|
|
13219
|
-
exports.calc = calc_exports;
|
|
13220
13343
|
exports.calculateElapsed = calculateElapsed;
|
|
13344
|
+
exports.checkCalcLine = checkCalcLine;
|
|
13221
13345
|
exports.classifyStatements = classifyStatements;
|
|
13222
13346
|
exports.closeCurrentSpan = closeCurrentSpan;
|
|
13223
13347
|
exports.commonFixtureSet = commonFixtureSet;
|
|
13348
|
+
exports.compileLineForm = compileLineForm;
|
|
13349
|
+
exports.composeDivUnit = composeDivUnit;
|
|
13350
|
+
exports.composeMulUnit = composeMulUnit;
|
|
13351
|
+
exports.compoundName = compoundName;
|
|
13224
13352
|
exports.computeColumnLabel = computeColumnLabel;
|
|
13225
13353
|
exports.computeLabel = computeLabel;
|
|
13226
13354
|
exports.computeWorkloadRollups = computeWorkloadRollups;
|
|
13355
|
+
exports.convertScalar = convertScalar;
|
|
13227
13356
|
exports.createAnalyticsEngineForBlock = createAnalyticsEngineForBlock;
|
|
13228
13357
|
exports.createBrowserRuntimeNow = createBrowserRuntimeNow;
|
|
13229
13358
|
exports.createCalcEngine = createCalcEngine;
|
|
13359
|
+
exports.createCalcStack = createCalcStack;
|
|
13230
13360
|
exports.createCompiler = createCompiler;
|
|
13231
13361
|
exports.createDialectStack = createDialectStack;
|
|
13362
|
+
exports.createDisciplinesTable = createDisciplinesTable;
|
|
13363
|
+
exports.createEffortTable = createEffortTable;
|
|
13232
13364
|
exports.createLineLocator = createLineLocator;
|
|
13233
13365
|
exports.createMetricPresentationPolicy = createPolicy;
|
|
13234
13366
|
exports.createMockClock = createMockClock;
|
|
13235
13367
|
exports.createParser = createParser;
|
|
13368
|
+
exports.createProfileTable = createProfileTable;
|
|
13369
|
+
exports.createRpeLabelsTable = createRpeLabelsTable;
|
|
13236
13370
|
exports.dailySessionLoads = dailySessionLoads;
|
|
13237
13371
|
exports.dayBucket = dayBucket;
|
|
13238
13372
|
exports.dialectRegistry = dialectRegistry;
|
|
13239
13373
|
exports.dialectStack = dialectStack;
|
|
13374
|
+
exports.dimEquals = dimEquals;
|
|
13240
13375
|
exports.disciplineFactorFor = disciplineFactorFor;
|
|
13241
13376
|
exports.evaluate = evaluate;
|
|
13242
13377
|
exports.evaluateCalculateDefinitions = evaluateCalculateDefinitions;
|
|
@@ -13254,6 +13389,7 @@ exports.fixtureRowing = fixtureRowing;
|
|
|
13254
13389
|
exports.fixtureRunning = fixtureRunning;
|
|
13255
13390
|
exports.fixtureUserCustom = fixtureUserCustom;
|
|
13256
13391
|
exports.fixtureUserOverride = fixtureUserOverride;
|
|
13392
|
+
exports.formatDim = formatDim;
|
|
13257
13393
|
exports.formatDuration = formatDuration;
|
|
13258
13394
|
exports.fragmentsToLabel = metricsToLabel;
|
|
13259
13395
|
exports.frozenNow = frozenNow;
|
|
@@ -13265,9 +13401,13 @@ exports.getAnalyticsFromRuntime = getAnalyticsFromRuntime;
|
|
|
13265
13401
|
exports.getHints = getHints;
|
|
13266
13402
|
exports.getMetricVisibility = getMetricVisibility;
|
|
13267
13403
|
exports.getRuntimeNowMs = getRuntimeNowMs;
|
|
13404
|
+
exports.getUnit = getUnit;
|
|
13268
13405
|
exports.hasHint = hasHint;
|
|
13269
13406
|
exports.hintMetric = hintMetric;
|
|
13270
13407
|
exports.hintsToContainer = hintsToContainer;
|
|
13408
|
+
exports.inferDim = inferDim;
|
|
13409
|
+
exports.isCastSubscription = isCastSubscription;
|
|
13410
|
+
exports.isDimensionless = isDimensionless;
|
|
13271
13411
|
exports.isEffortDiscipline = isEffortDiscipline;
|
|
13272
13412
|
exports.isFragmentTag = isFragmentTag;
|
|
13273
13413
|
exports.isTimeLikeMetric = isTimeLikeMetric;
|
|
@@ -13276,19 +13416,27 @@ exports.levenshteinDistance = levenshteinDistance;
|
|
|
13276
13416
|
exports.metricPresentation = metricPresentation;
|
|
13277
13417
|
exports.mutateTimerSpans = mutateTimerSpans;
|
|
13278
13418
|
exports.normalizeForFuzzy = normalizeForFuzzy;
|
|
13419
|
+
exports.num = num;
|
|
13279
13420
|
exports.openSpan = openSpan;
|
|
13421
|
+
exports.outputNodeId = outputNodeId;
|
|
13422
|
+
exports.outputNodeIds = outputNodeIds;
|
|
13280
13423
|
exports.parseCalcLine = parseCalcLine;
|
|
13281
13424
|
exports.parseCalculateBlock = parseCalculateBlock;
|
|
13282
13425
|
exports.parseExpression = parseExpression;
|
|
13283
13426
|
exports.parseScript = parseScript;
|
|
13427
|
+
exports.printCalculation = printCalculation;
|
|
13284
13428
|
exports.readTimer = readTimer;
|
|
13285
13429
|
exports.realtimeProcessorRegistry = realtimeProcessorRegistry;
|
|
13286
13430
|
exports.resolveDominantOrigin = resolveDominantOrigin;
|
|
13287
13431
|
exports.sharedParser = sharedParser;
|
|
13288
13432
|
exports.startSpan = startSpan;
|
|
13433
|
+
exports.str = str;
|
|
13289
13434
|
exports.strategyRegistry = strategyRegistry;
|
|
13435
|
+
exports.subDim = subDim;
|
|
13290
13436
|
exports.summaryProcessorRegistry = summaryProcessorRegistry;
|
|
13291
13437
|
exports.toStoredOutputStatement = toStoredOutputStatement;
|
|
13438
|
+
exports.truthy = truthy;
|
|
13439
|
+
exports.validateOutputUnit = validateOutputUnit;
|
|
13292
13440
|
exports.wallClockNow = wallClockNow;
|
|
13293
13441
|
exports.whiteboardParser = parser;
|
|
13294
13442
|
exports.whiteboardScript = whiteboardScript;
|