@burdenoff/microfe-timecampus 2026.1117.1 → 2026.1122.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Pure geographic validation, sanitization, and distance utilities for
3
+ * TimeCampus location tracking and geofencing maps.
4
+ */
5
+ export declare const MIN_LATITUDE = -90;
6
+ export declare const MAX_LATITUDE = 90;
7
+ export declare const MIN_LONGITUDE = -180;
8
+ export declare const MAX_LONGITUDE = 180;
9
+ export declare const MIN_GEOFENCE_RADIUS_METERS = 10;
10
+ export declare const MAX_GEOFENCE_RADIUS_METERS = 50000;
11
+ export declare const BACKEND_MAX_GEOFENCE_RADIUS_METERS = 100000;
12
+ export declare const DEFAULT_GEOFENCE_RADIUS_METERS = 150;
13
+ export declare const MAX_GEOFENCE_NAME_LENGTH = 200;
14
+ /** Default map viewport center (San Francisco) when no valid coordinates exist yet. */
15
+ export declare const DEFAULT_MAP_CENTER: readonly [number, number];
16
+ export declare const DEFAULT_MAP_ZOOM = 13;
17
+ export interface CoordinateLike {
18
+ latitude: unknown;
19
+ longitude: unknown;
20
+ }
21
+ export interface GeofenceGeometryLike extends CoordinateLike {
22
+ radius: unknown;
23
+ }
24
+ export interface ValidCoordinate {
25
+ latitude: number;
26
+ longitude: number;
27
+ }
28
+ export interface ValidGeofenceGeometry extends ValidCoordinate {
29
+ radius: number;
30
+ }
31
+ export interface GeofenceFormDraft {
32
+ name: string;
33
+ latitude: string;
34
+ longitude: string;
35
+ radius: string;
36
+ }
37
+ export interface GeofenceFormValidationResult {
38
+ valid: boolean;
39
+ errors: Partial<Record<"name" | "latitude" | "longitude" | "radius", string>>;
40
+ parsed?: {
41
+ name: string;
42
+ latitude: number;
43
+ longitude: number;
44
+ radius: number;
45
+ };
46
+ }
47
+ export interface LocationEntryFormDraft {
48
+ latitude: string;
49
+ longitude: string;
50
+ startTime: string;
51
+ endTime: string;
52
+ }
53
+ export interface LocationEntryFormValidationResult {
54
+ valid: boolean;
55
+ errors: Partial<Record<"latitude" | "longitude" | "startTime" | "endTime", string>>;
56
+ parsed?: {
57
+ latitude: number;
58
+ longitude: number;
59
+ startTimeIso: string;
60
+ endTimeIso?: string;
61
+ durationSeconds?: number;
62
+ };
63
+ }
64
+ /** Returns true when `value` is a finite number within `[min, max]`. */
65
+ export declare function isFiniteInRange(value: unknown, min: number, max: number): value is number;
66
+ /** Validates a WGS-84 latitude/longitude pair. */
67
+ export declare function isValidCoordinate(lat: unknown, lng: unknown): boolean;
68
+ /** Validates a circular geofence's center coordinates and radius in meters. */
69
+ export declare function isValidGeofenceGeometry(fence: GeofenceGeometryLike): fence is ValidGeofenceGeometry;
70
+ /** Splits stored geofences into renderable valid geometries and malformed rows. */
71
+ export declare function partitionValidGeofences<T extends GeofenceGeometryLike>(fences: readonly T[]): {
72
+ valid: Array<T & ValidGeofenceGeometry>;
73
+ invalid: T[];
74
+ };
75
+ /** Splits location entries into valid coordinates (chronological order) and malformed rows. */
76
+ export declare function partitionValidLocationEntries<T extends CoordinateLike & {
77
+ startTime?: string | null;
78
+ }>(entries: readonly T[]): {
79
+ valid: Array<T & ValidCoordinate>;
80
+ invalid: T[];
81
+ };
82
+ /** Parses a numeric text input, rejecting blank, whitespace-only, or non-finite values. */
83
+ export declare function parseStrictNumber(raw: string): number | null;
84
+ /** Validates the geofence create/edit form before dispatching a gateway mutation. */
85
+ export declare function validateGeofenceForm(form: GeofenceFormDraft): GeofenceFormValidationResult;
86
+ /** Validates a manual location entry form before dispatching a gateway mutation. */
87
+ export declare function validateLocationEntryForm(form: LocationEntryFormDraft): LocationEntryFormValidationResult;
88
+ /** Rounds a coordinate to 6 decimal places (~11cm precision). */
89
+ export declare function roundCoordinate(value: number): number;
90
+ /** Clamps a geofence radius in meters to the interactive UI bounds. */
91
+ export declare function clampGeofenceRadius(meters: number): number;
92
+ /**
93
+ * Computes the great-circle distance in meters between two WGS-84 coordinates
94
+ * using the Haversine formula.
95
+ */
96
+ export declare function haversineDistanceMeters(lat1: number, lng1: number, lat2: number, lng2: number): number;
97
+ /**
98
+ * Computes an east-edge handle coordinate `radiusMeters` east of `(lat, lng)`
99
+ * so users can drag the perimeter handle to resize a circular geofence.
100
+ */
101
+ export declare function computeCircleHandlePosition(lat: number, lng: number, radiusMeters: number): [number, number];
102
+ /** Formats coordinates cleanly for UI display and screen readers. */
103
+ export declare function formatCoordinates(lat: number, lng: number): string;
104
+ /** Formats a radius in meters as `150m` or `1.5km`. */
105
+ export declare function formatRadius(meters: number): string;
@@ -0,0 +1,114 @@
1
+ var e = -180, t = 5e4, n = 1e5, r = [37.7749, -122.4194], i = 6371e3, a = Math.PI / 180, o = 180 / Math.PI;
2
+ function s(e, t, n) {
3
+ return typeof e == "number" && Number.isFinite(e) && e >= t && e <= n;
4
+ }
5
+ function c(e, t) {
6
+ return s(e, -90, 90) && s(t, -180, 180);
7
+ }
8
+ function l(e) {
9
+ return c(e.latitude, e.longitude) && typeof e.radius == "number" && Number.isFinite(e.radius) && e.radius > 0 && e.radius <= 1e5;
10
+ }
11
+ function u(e) {
12
+ let t = [], n = [];
13
+ for (let r of e) l(r) ? t.push(r) : n.push(r);
14
+ return {
15
+ valid: t,
16
+ invalid: n
17
+ };
18
+ }
19
+ function d(e) {
20
+ let t = [], n = [];
21
+ for (let r of e) c(r.latitude, r.longitude) ? t.push(r) : n.push(r);
22
+ return t.sort((e, t) => {
23
+ let n = e.startTime ? Date.parse(e.startTime) : 0, r = t.startTime ? Date.parse(t.startTime) : 0;
24
+ return (Number.isFinite(n) ? n : 0) - (Number.isFinite(r) ? r : 0);
25
+ }), {
26
+ valid: t,
27
+ invalid: n
28
+ };
29
+ }
30
+ function f(e) {
31
+ let t = e.trim();
32
+ if (!t) return null;
33
+ let n = Number(t);
34
+ return Number.isFinite(n) ? n : null;
35
+ }
36
+ function p(e) {
37
+ let n = {}, r = e.name.trim();
38
+ r ? r.length > 200 && (n.name = "Name must be at most 200 characters.") : n.name = "Name is required.";
39
+ let i = f(e.latitude);
40
+ (i === null || i < -90 || i > 90) && (n.latitude = "Latitude must be between -90 and 90.");
41
+ let a = f(e.longitude);
42
+ (a === null || a < -180 || a > 180) && (n.longitude = "Longitude must be between -180 and 180.");
43
+ let o = f(e.radius);
44
+ return (o === null || o < 10 || o > 5e4) && (n.radius = `Radius must be between 10m and ${t.toLocaleString()}m.`), Object.keys(n).length > 0 || i === null || a === null || o === null ? {
45
+ valid: !1,
46
+ errors: n
47
+ } : {
48
+ valid: !0,
49
+ errors: {},
50
+ parsed: {
51
+ name: r,
52
+ latitude: h(i),
53
+ longitude: h(a),
54
+ radius: Math.round(o)
55
+ }
56
+ };
57
+ }
58
+ function m(e) {
59
+ let t = {}, n = f(e.latitude);
60
+ (n === null || n < -90 || n > 90) && (t.latitude = "Latitude must be between -90 and 90.");
61
+ let r = f(e.longitude);
62
+ (r === null || r < -180 || r > 180) && (t.longitude = "Longitude must be between -180 and 180.");
63
+ let i = e.startTime.trim() ? Date.parse(e.startTime) : NaN;
64
+ Number.isFinite(i) || (t.startTime = "Valid start time is required.");
65
+ let a;
66
+ if (e.endTime.trim()) {
67
+ let n = Date.parse(e.endTime);
68
+ Number.isFinite(n) ? Number.isFinite(i) && n < i ? t.endTime = "End time must be after start time." : a = n : t.endTime = "End time must be a valid date/time.";
69
+ }
70
+ if (Object.keys(t).length > 0 || n === null || r === null || !Number.isFinite(i)) return {
71
+ valid: !1,
72
+ errors: t
73
+ };
74
+ let o = new Date(i).toISOString(), s = a === void 0 ? void 0 : new Date(a).toISOString(), c = a === void 0 ? void 0 : Math.max(0, Math.round((a - i) / 1e3));
75
+ return {
76
+ valid: !0,
77
+ errors: {},
78
+ parsed: {
79
+ latitude: h(n),
80
+ longitude: h(r),
81
+ startTimeIso: o,
82
+ endTimeIso: s,
83
+ durationSeconds: c
84
+ }
85
+ };
86
+ }
87
+ function h(e) {
88
+ return Math.round(e * 1e6) / 1e6;
89
+ }
90
+ function g(e) {
91
+ return Number.isFinite(e) ? Math.round(Math.min(t, Math.max(10, e))) : 150;
92
+ }
93
+ function _(e, t, n, r) {
94
+ let o = (n - e) * a, s = (r - t) * a, c = e * a, l = n * a, u = Math.sin(o / 2), d = Math.sin(s / 2), f = u * u + Math.cos(c) * Math.cos(l) * d * d;
95
+ return i * (2 * Math.atan2(Math.sqrt(f), Math.sqrt(Math.max(0, 1 - f))));
96
+ }
97
+ function v(t, n, r) {
98
+ let s = r / (i * Math.max(.01, Math.cos(t * a))) * o, c = n + s, l = c > 180 ? n - s : c;
99
+ return [h(t), h(Math.max(e, Math.min(180, l)))];
100
+ }
101
+ function y(e, t) {
102
+ return `${e.toFixed(5)}, ${t.toFixed(5)}`;
103
+ }
104
+ function b(e) {
105
+ if (!Number.isFinite(e) || e <= 0) return "0m";
106
+ if (e >= 1e3) {
107
+ let t = e / 1e3;
108
+ return `${t >= 10 ? t.toFixed(0) : t.toFixed(1)}km`;
109
+ }
110
+ return `${Math.round(e)}m`;
111
+ }
112
+ export { n as BACKEND_MAX_GEOFENCE_RADIUS_METERS, r as DEFAULT_MAP_CENTER, t as MAX_GEOFENCE_RADIUS_METERS, e as MIN_LONGITUDE, g as clampGeofenceRadius, v as computeCircleHandlePosition, y as formatCoordinates, b as formatRadius, _ as haversineDistanceMeters, s as isFiniteInRange, c as isValidCoordinate, l as isValidGeofenceGeometry, f as parseStrictNumber, u as partitionValidGeofences, d as partitionValidLocationEntries, h as roundCoordinate, p as validateGeofenceForm, m as validateLocationEntryForm };
113
+
114
+ //# sourceMappingURL=locationGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locationGeometry.js","names":["MIN_LONGITUDE","MAX_GEOFENCE_RADIUS_METERS","BACKEND_MAX_GEOFENCE_RADIUS_METERS","DEFAULT_MAP_CENTER","EARTH_RADIUS_METERS","DEG_TO_RAD","RAD_TO_DEG","isFiniteInRange","value","min","max","isValidCoordinate","lat","lng","isValidGeofenceGeometry","fence","partitionValidGeofences","valid","invalid","fences","partitionValidLocationEntries","entry","entries","aMs","a","bMs","b","parseStrictNumber","trimmed","raw","parsed","validateGeofenceForm","errors","trimmedName","form","radius","roundCoordinate","validateLocationEntryForm","startMs","endMs","parsedEnd","startTimeIso","endTimeIso","durationSeconds","clampGeofenceRadius","meters","haversineDistanceMeters","dLat","lat2","lat1","dLng","lng2","lng1","rLat1","rLat2","sinLat","sinLng","computeCircleHandlePosition","deltaLng","radiusMeters","nextLng","wrappedLng","formatCoordinates","formatRadius","km"],"sources":["../../../../src/timecampus/components/maps/locationGeometry.ts"],"sourcesContent":["/**\n * Pure geographic validation, sanitization, and distance utilities for\n * TimeCampus location tracking and geofencing maps.\n */\n\nexport const MIN_LATITUDE = -90;\nexport const MAX_LATITUDE = 90;\nexport const MIN_LONGITUDE = -180;\nexport const MAX_LONGITUDE = 180;\n\nexport const MIN_GEOFENCE_RADIUS_METERS = 10;\nexport const MAX_GEOFENCE_RADIUS_METERS = 50_000;\nexport const BACKEND_MAX_GEOFENCE_RADIUS_METERS = 100_000;\nexport const DEFAULT_GEOFENCE_RADIUS_METERS = 150;\nexport const MAX_GEOFENCE_NAME_LENGTH = 200;\n\n/** Default map viewport center (San Francisco) when no valid coordinates exist yet. */\nexport const DEFAULT_MAP_CENTER: readonly [number, number] = [\n 37.7749, -122.4194,\n];\nexport const DEFAULT_MAP_ZOOM = 13;\n\nconst EARTH_RADIUS_METERS = 6_371_000;\nconst DEG_TO_RAD = Math.PI / 180;\nconst RAD_TO_DEG = 180 / Math.PI;\n\nexport interface CoordinateLike {\n latitude: unknown;\n longitude: unknown;\n}\n\nexport interface GeofenceGeometryLike extends CoordinateLike {\n radius: unknown;\n}\n\nexport interface ValidCoordinate {\n latitude: number;\n longitude: number;\n}\n\nexport interface ValidGeofenceGeometry extends ValidCoordinate {\n radius: number;\n}\n\nexport interface GeofenceFormDraft {\n name: string;\n latitude: string;\n longitude: string;\n radius: string;\n}\n\nexport interface GeofenceFormValidationResult {\n valid: boolean;\n errors: Partial<Record<\"name\" | \"latitude\" | \"longitude\" | \"radius\", string>>;\n parsed?: {\n name: string;\n latitude: number;\n longitude: number;\n radius: number;\n };\n}\n\nexport interface LocationEntryFormDraft {\n latitude: string;\n longitude: string;\n startTime: string;\n endTime: string;\n}\n\nexport interface LocationEntryFormValidationResult {\n valid: boolean;\n errors: Partial<\n Record<\"latitude\" | \"longitude\" | \"startTime\" | \"endTime\", string>\n >;\n parsed?: {\n latitude: number;\n longitude: number;\n startTimeIso: string;\n endTimeIso?: string;\n durationSeconds?: number;\n };\n}\n\n/** Returns true when `value` is a finite number within `[min, max]`. */\nexport function isFiniteInRange(\n value: unknown,\n min: number,\n max: number,\n): value is number {\n return (\n typeof value === \"number\" &&\n Number.isFinite(value) &&\n value >= min &&\n value <= max\n );\n}\n\n/** Validates a WGS-84 latitude/longitude pair. */\nexport function isValidCoordinate(lat: unknown, lng: unknown): boolean {\n return (\n isFiniteInRange(lat, MIN_LATITUDE, MAX_LATITUDE) &&\n isFiniteInRange(lng, MIN_LONGITUDE, MAX_LONGITUDE)\n );\n}\n\n/** Validates a circular geofence's center coordinates and radius in meters. */\nexport function isValidGeofenceGeometry(\n fence: GeofenceGeometryLike,\n): fence is ValidGeofenceGeometry {\n return (\n isValidCoordinate(fence.latitude, fence.longitude) &&\n typeof fence.radius === \"number\" &&\n Number.isFinite(fence.radius) &&\n fence.radius > 0 &&\n fence.radius <= BACKEND_MAX_GEOFENCE_RADIUS_METERS\n );\n}\n\n/** Splits stored geofences into renderable valid geometries and malformed rows. */\nexport function partitionValidGeofences<T extends GeofenceGeometryLike>(\n fences: readonly T[],\n): {\n valid: Array<T & ValidGeofenceGeometry>;\n invalid: T[];\n} {\n const valid: Array<T & ValidGeofenceGeometry> = [];\n const invalid: T[] = [];\n for (const fence of fences) {\n if (isValidGeofenceGeometry(fence)) {\n valid.push(fence as T & ValidGeofenceGeometry);\n } else {\n invalid.push(fence);\n }\n }\n return { valid, invalid };\n}\n\n/** Splits location entries into valid coordinates (chronological order) and malformed rows. */\nexport function partitionValidLocationEntries<\n T extends CoordinateLike & { startTime?: string | null },\n>(\n entries: readonly T[],\n): {\n valid: Array<T & ValidCoordinate>;\n invalid: T[];\n} {\n const valid: Array<T & ValidCoordinate> = [];\n const invalid: T[] = [];\n for (const entry of entries) {\n if (isValidCoordinate(entry.latitude, entry.longitude)) {\n valid.push(entry as T & ValidCoordinate);\n } else {\n invalid.push(entry);\n }\n }\n valid.sort((a, b) => {\n const aMs = a.startTime ? Date.parse(a.startTime) : 0;\n const bMs = b.startTime ? Date.parse(b.startTime) : 0;\n const safeA = Number.isFinite(aMs) ? aMs : 0;\n const safeB = Number.isFinite(bMs) ? bMs : 0;\n return safeA - safeB;\n });\n return { valid, invalid };\n}\n\n/** Parses a numeric text input, rejecting blank, whitespace-only, or non-finite values. */\nexport function parseStrictNumber(raw: string): number | null {\n const trimmed = raw.trim();\n if (!trimmed) return null;\n const parsed = Number(trimmed);\n return Number.isFinite(parsed) ? parsed : null;\n}\n\n/** Validates the geofence create/edit form before dispatching a gateway mutation. */\nexport function validateGeofenceForm(\n form: GeofenceFormDraft,\n): GeofenceFormValidationResult {\n const errors: GeofenceFormValidationResult[\"errors\"] = {};\n const trimmedName = form.name.trim();\n if (!trimmedName) {\n errors.name = \"Name is required.\";\n } else if (trimmedName.length > MAX_GEOFENCE_NAME_LENGTH) {\n errors.name = `Name must be at most ${MAX_GEOFENCE_NAME_LENGTH} characters.`;\n }\n\n const lat = parseStrictNumber(form.latitude);\n if (lat === null || lat < MIN_LATITUDE || lat > MAX_LATITUDE) {\n errors.latitude = \"Latitude must be between -90 and 90.\";\n }\n\n const lng = parseStrictNumber(form.longitude);\n if (lng === null || lng < MIN_LONGITUDE || lng > MAX_LONGITUDE) {\n errors.longitude = \"Longitude must be between -180 and 180.\";\n }\n\n const radius = parseStrictNumber(form.radius);\n if (\n radius === null ||\n radius < MIN_GEOFENCE_RADIUS_METERS ||\n radius > MAX_GEOFENCE_RADIUS_METERS\n ) {\n errors.radius = `Radius must be between ${MIN_GEOFENCE_RADIUS_METERS}m and ${MAX_GEOFENCE_RADIUS_METERS.toLocaleString()}m.`;\n }\n\n if (\n Object.keys(errors).length > 0 ||\n lat === null ||\n lng === null ||\n radius === null\n ) {\n return { valid: false, errors };\n }\n\n return {\n valid: true,\n errors: {},\n parsed: {\n name: trimmedName,\n latitude: roundCoordinate(lat),\n longitude: roundCoordinate(lng),\n radius: Math.round(radius),\n },\n };\n}\n\n/** Validates a manual location entry form before dispatching a gateway mutation. */\nexport function validateLocationEntryForm(\n form: LocationEntryFormDraft,\n): LocationEntryFormValidationResult {\n const errors: LocationEntryFormValidationResult[\"errors\"] = {};\n\n const lat = parseStrictNumber(form.latitude);\n if (lat === null || lat < MIN_LATITUDE || lat > MAX_LATITUDE) {\n errors.latitude = \"Latitude must be between -90 and 90.\";\n }\n\n const lng = parseStrictNumber(form.longitude);\n if (lng === null || lng < MIN_LONGITUDE || lng > MAX_LONGITUDE) {\n errors.longitude = \"Longitude must be between -180 and 180.\";\n }\n\n const startMs = form.startTime.trim()\n ? Date.parse(form.startTime)\n : Number.NaN;\n if (!Number.isFinite(startMs)) {\n errors.startTime = \"Valid start time is required.\";\n }\n\n let endMs: number | undefined;\n if (form.endTime.trim()) {\n const parsedEnd = Date.parse(form.endTime);\n if (!Number.isFinite(parsedEnd)) {\n errors.endTime = \"End time must be a valid date/time.\";\n } else if (Number.isFinite(startMs) && parsedEnd < startMs) {\n errors.endTime = \"End time must be after start time.\";\n } else {\n endMs = parsedEnd;\n }\n }\n\n if (\n Object.keys(errors).length > 0 ||\n lat === null ||\n lng === null ||\n !Number.isFinite(startMs)\n ) {\n return { valid: false, errors };\n }\n\n const startTimeIso = new Date(startMs).toISOString();\n const endTimeIso =\n endMs !== undefined ? new Date(endMs).toISOString() : undefined;\n const durationSeconds =\n endMs !== undefined\n ? Math.max(0, Math.round((endMs - startMs) / 1000))\n : undefined;\n\n return {\n valid: true,\n errors: {},\n parsed: {\n latitude: roundCoordinate(lat),\n longitude: roundCoordinate(lng),\n startTimeIso,\n endTimeIso,\n durationSeconds,\n },\n };\n}\n\n/** Rounds a coordinate to 6 decimal places (~11cm precision). */\nexport function roundCoordinate(value: number): number {\n return Math.round(value * 1_000_000) / 1_000_000;\n}\n\n/** Clamps a geofence radius in meters to the interactive UI bounds. */\nexport function clampGeofenceRadius(meters: number): number {\n if (!Number.isFinite(meters)) return DEFAULT_GEOFENCE_RADIUS_METERS;\n return Math.round(\n Math.min(\n MAX_GEOFENCE_RADIUS_METERS,\n Math.max(MIN_GEOFENCE_RADIUS_METERS, meters),\n ),\n );\n}\n\n/**\n * Computes the great-circle distance in meters between two WGS-84 coordinates\n * using the Haversine formula.\n */\nexport function haversineDistanceMeters(\n lat1: number,\n lng1: number,\n lat2: number,\n lng2: number,\n): number {\n const dLat = (lat2 - lat1) * DEG_TO_RAD;\n const dLng = (lng2 - lng1) * DEG_TO_RAD;\n const rLat1 = lat1 * DEG_TO_RAD;\n const rLat2 = lat2 * DEG_TO_RAD;\n const sinLat = Math.sin(dLat / 2);\n const sinLng = Math.sin(dLng / 2);\n const a =\n sinLat * sinLat + Math.cos(rLat1) * Math.cos(rLat2) * sinLng * sinLng;\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(Math.max(0, 1 - a)));\n return EARTH_RADIUS_METERS * c;\n}\n\n/**\n * Computes an east-edge handle coordinate `radiusMeters` east of `(lat, lng)`\n * so users can drag the perimeter handle to resize a circular geofence.\n */\nexport function computeCircleHandlePosition(\n lat: number,\n lng: number,\n radiusMeters: number,\n): [number, number] {\n const cosLat = Math.max(0.01, Math.cos(lat * DEG_TO_RAD));\n const deltaLng = (radiusMeters / (EARTH_RADIUS_METERS * cosLat)) * RAD_TO_DEG;\n const nextLng = lng + deltaLng;\n const wrappedLng = nextLng > MAX_LONGITUDE ? lng - deltaLng : nextLng;\n return [\n roundCoordinate(lat),\n roundCoordinate(\n Math.max(MIN_LONGITUDE, Math.min(MAX_LONGITUDE, wrappedLng)),\n ),\n ];\n}\n\n/** Formats coordinates cleanly for UI display and screen readers. */\nexport function formatCoordinates(lat: number, lng: number): string {\n return `${lat.toFixed(5)}, ${lng.toFixed(5)}`;\n}\n\n/** Formats a radius in meters as `150m` or `1.5km`. */\nexport function formatRadius(meters: number): string {\n if (!Number.isFinite(meters) || meters <= 0) return \"0m\";\n if (meters >= 1000) {\n const km = meters / 1000;\n return `${km >= 10 ? km.toFixed(0) : km.toFixed(1)}km`;\n }\n return `${Math.round(meters)}m`;\n}\n"],"mappings":"AAOA,IAAaA,IAAgB,MAIhBC,IAA6B,KAC7BC,IAAqC,KAKrCC,IAAgD,CAC3D,SAAS,SACX,GAGMC,IAAsB,QACtBC,IAAa,KAAK,KAAK,KACvBC,IAAa,MAAM,KAAK;AA4D9B,SAAgBC,EACd,GACA,GACA,GACiB;CACjB,OACE,OAAOC,KAAU,YACjB,OAAO,SAASA,CAAK,KACrBA,KAASC,KACTD,KAASE;AAEb;AAGA,SAAgBC,EAAkB,GAAc,GAAuB;CACrE,OACEJ,EAAgBK,GAAA,KAAA,EAA+B,KAC/CL,EAAgBM,GAAA,MAAA,GAAiC;AAErD;AAGA,SAAgBC,EACd,GACgC;CAChC,OACEH,EAAkBI,EAAM,UAAUA,EAAM,SAAS,KACjD,OAAOA,EAAM,UAAW,YACxB,OAAO,SAASA,EAAM,MAAM,KAC5BA,EAAM,SAAS,KACfA,EAAM,UAAA;AAEV;AAGA,SAAgBC,EACd,GAIA;CACA,IAAMC,IAA0C,CAAC,GAC3CC,IAAe,CAAC;CACtB,KAAK,IAAMH,KAASI,GAClB,AAAIL,EAAwBC,CAAK,IAC/BE,EAAM,KAAKF,CAAkC,IAE7CG,EAAQ,KAAKH,CAAK;CAGtB,OAAO;EAAE;EAAO;CAAQ;AAC1B;AAGA,SAAgBK,EAGd,GAIA;CACA,IAAMH,IAAoC,CAAC,GACrCC,IAAe,CAAC;CACtB,KAAK,IAAMG,KAASC,GAClB,AAAIX,EAAkBU,EAAM,UAAUA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AAG,OAAO;CACpD,IAAIA,KAAU,KAAM;EAClB,IAAMmB,IAAKnB,IAAS;EACpB,OAAO,GAAGmB,KAAM,KAAKA,EAAG,QAAQ,CAAC,IAAIA,EAAG,QAAQ,CAAC,EAAE;CACrD;CACA,OAAO,GAAG,KAAK,MAAMnB,CAAM,EAAE;AAC/B"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Token-safe Leaflet styling utilities.
3
+ *
4
+ * Every visual color references a Boff UI 2.0 CSS custom property (`--color-*`)
5
+ * so maps adapt automatically to dark/light theme switches and TimeCampus brand
6
+ * tokens without any hardcoded raw color values.
7
+ */
8
+ /**
9
+ * Semantic chart token names used to distinguish multiple geofence zones on the
10
+ * map without introducing raw hex/rgb literals.
11
+ */
12
+ export declare const MAP_ZONE_TOKENS: readonly ["--color-action-primary-bg", "--color-chart-1", "--color-chart-2", "--color-chart-3", "--color-chart-4", "--color-chart-5", "--color-chart-6", "--color-chart-7", "--color-chart-8"];
13
+ /**
14
+ * Resolves a CSS custom property to its computed color value when mounted in a
15
+ * browser, falling back to the CSS `var(...)` expression (never a raw color).
16
+ */
17
+ export declare function resolveCssToken(tokenName: string): string;
18
+ /** Picks a deterministic semantic token for zone index `index`. */
19
+ export declare function zoneTokenForIndex(index: number): string;
20
+ /**
21
+ * Ensures both Leaflet's core stylesheet (bundled by host shell, or SRI CDN
22
+ * fallback in standalone/Storybook) and TimeCampus semantic token overrides
23
+ * are active in the document head.
24
+ */
25
+ export declare function ensureLeafletStyles(): void;
@@ -0,0 +1,45 @@
1
+ // src/timecampus/components/maps/mapTheme.ts
2
+ var e = "tc-leaflet-theme-styles", t = "leaflet-css", n = [
3
+ "--color-action-primary-bg",
4
+ "--color-chart-1",
5
+ "--color-chart-2",
6
+ "--color-chart-3",
7
+ "--color-chart-4",
8
+ "--color-chart-5",
9
+ "--color-chart-6",
10
+ "--color-chart-7",
11
+ "--color-chart-8"
12
+ ];
13
+ function r(e) {
14
+ if (typeof document < "u") {
15
+ let t = getComputedStyle(document.documentElement).getPropertyValue(e).trim();
16
+ if (t) return t;
17
+ }
18
+ return `var(${e})`;
19
+ }
20
+ function i(e) {
21
+ return n[Math.abs(e) % n.length];
22
+ }
23
+ function a() {
24
+ if (typeof document > "u" || document.getElementById(t)) return !0;
25
+ let e = document.createElement("div");
26
+ e.className = "leaflet-container", e.style.position = "absolute", e.style.visibility = "hidden", e.style.pointerEvents = "none", document.body.appendChild(e);
27
+ let n = getComputedStyle(e).overflow;
28
+ return e.remove(), n === "hidden";
29
+ }
30
+ var o = "\n.tc-map-canvas {\n background-color: var(--color-bg-sunken);\n background-image:\n linear-gradient(to right, var(--color-border-subtle) 1px, transparent 1px),\n linear-gradient(to bottom, var(--color-border-subtle) 1px, transparent 1px);\n background-size: 32px 32px;\n color: var(--color-text-primary);\n font-family: var(--font-family-body, inherit);\n}\n.tc-map-canvas .leaflet-container {\n background: transparent;\n color: var(--color-text-primary);\n font-family: inherit;\n}\n[data-theme=\"dark\"] .tc-map-canvas .leaflet-tile-pane,\n.dark .tc-map-canvas .leaflet-tile-pane {\n filter: brightness(0.68) invert(1) contrast(1.12) hue-rotate(196deg) saturate(0.45);\n}\n.tc-map-canvas .leaflet-popup-content-wrapper,\n.tc-map-canvas .leaflet-popup-tip {\n background-color: var(--color-bg-elevated, var(--color-bg-surface));\n color: var(--color-text-primary);\n border: 1px solid var(--color-border-subtle);\n box-shadow: var(--shadow-lg, none);\n}\n.tc-map-canvas .leaflet-popup-content {\n margin: 10px 12px;\n font-size: 12px;\n line-height: 1.45;\n}\n.tc-map-canvas .leaflet-popup-close-button {\n color: var(--color-text-secondary);\n}\n.tc-map-canvas .leaflet-popup-close-button:hover {\n color: var(--color-text-primary);\n}\n.tc-map-canvas .leaflet-tooltip {\n background-color: var(--color-bg-elevated, var(--color-bg-surface));\n color: var(--color-text-primary);\n border: 1px solid var(--color-border-subtle);\n font-size: 11px;\n font-weight: 500;\n padding: 2px 6px;\n}\n.tc-map-canvas .leaflet-control-attribution {\n background-color: var(--color-bg-surface);\n color: var(--color-text-muted);\n border-top-left-radius: var(--radius-input, 6px);\n font-size: 10px;\n opacity: 0.9;\n}\n.tc-map-canvas .leaflet-control-attribution a {\n color: var(--color-text-link);\n}\n.tc-map-canvas .leaflet-control-scale-line {\n background-color: var(--color-bg-surface);\n color: var(--color-text-secondary);\n border-color: var(--color-border-default);\n font-size: 10px;\n}\n.tc-map-dot-marker {\n background: transparent;\n border: none;\n}\n.tc-map-dot-inner {\n width: 14px;\n height: 14px;\n border-radius: 9999px;\n border: 2px solid var(--color-bg-surface);\n background-color: var(--color-action-primary-bg);\n}\n.tc-map-dot-inner--draft {\n width: 18px;\n height: 18px;\n border-radius: 9999px;\n border: 2px solid var(--color-bg-surface);\n background-color: var(--color-action-primary-bg);\n outline: 3px solid var(--color-border-focus, var(--color-action-primary-bg));\n cursor: grab;\n}\n.tc-map-radius-handle {\n width: 16px;\n height: 16px;\n border-radius: 9999px;\n border: 2px solid var(--color-action-primary-bg);\n background-color: var(--color-bg-surface);\n cursor: ew-resize;\n}\n.tc-map-canvas .leaflet-interactive:focus-visible {\n outline: 2px solid var(--color-border-focus);\n outline-offset: 2px;\n}\n";
31
+ function s() {
32
+ if (typeof document < "u") {
33
+ if (!a()) {
34
+ let e = document.createElement("link");
35
+ e.id = t, e.rel = "stylesheet", e.href = "https://unpkg.com/leaflet@1.9.4/dist/leaflet.css", e.integrity = "sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=", e.crossOrigin = "anonymous", document.head.appendChild(e);
36
+ }
37
+ if (!document.getElementById(e)) {
38
+ let t = document.createElement("style");
39
+ t.id = e, t.textContent = o, document.head.appendChild(t);
40
+ }
41
+ }
42
+ }
43
+ export { n as MAP_ZONE_TOKENS, s as ensureLeafletStyles, r as resolveCssToken, i as zoneTokenForIndex };
44
+
45
+ //# sourceMappingURL=mapTheme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapTheme.js","names":["THEME_STYLE_ID","LEAFLET_LINK_ID","MAP_ZONE_TOKENS","resolveCssToken","computed","tokenName","zoneTokenForIndex","index","hasLeafletCoreStyles","probe","overflow","TOKEN_MAP_CSS","ensureLeafletStyles","link","style"],"sources":["../../../../src/timecampus/components/maps/mapTheme.ts"],"sourcesContent":["/**\n * Token-safe Leaflet styling utilities.\n *\n * Every visual color references a Boff UI 2.0 CSS custom property (`--color-*`)\n * so maps adapt automatically to dark/light theme switches and TimeCampus brand\n * tokens without any hardcoded raw color values.\n */\n\nconst LEAFLET_CDN_CSS = \"https://unpkg.com/leaflet@1.9.4/dist/leaflet.css\";\nconst LEAFLET_CDN_SRI = \"sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=\";\n\nconst THEME_STYLE_ID = \"tc-leaflet-theme-styles\";\nconst LEAFLET_LINK_ID = \"leaflet-css\";\n\n/**\n * Semantic chart token names used to distinguish multiple geofence zones on the\n * map without introducing raw hex/rgb literals.\n */\nexport const MAP_ZONE_TOKENS = [\n \"--color-action-primary-bg\",\n \"--color-chart-1\",\n \"--color-chart-2\",\n \"--color-chart-3\",\n \"--color-chart-4\",\n \"--color-chart-5\",\n \"--color-chart-6\",\n \"--color-chart-7\",\n \"--color-chart-8\",\n] as const;\n\n/**\n * Resolves a CSS custom property to its computed color value when mounted in a\n * browser, falling back to the CSS `var(...)` expression (never a raw color).\n */\nexport function resolveCssToken(tokenName: string): string {\n if (typeof document !== \"undefined\") {\n const computed = getComputedStyle(document.documentElement)\n .getPropertyValue(tokenName)\n .trim();\n if (computed) return computed;\n }\n return `var(${tokenName})`;\n}\n\n/** Picks a deterministic semantic token for zone index `index`. */\nexport function zoneTokenForIndex(index: number): string {\n const safeIndex = Math.abs(index) % MAP_ZONE_TOKENS.length;\n return MAP_ZONE_TOKENS[safeIndex];\n}\n\n/**\n * Checks whether Leaflet's core stylesheet is already loaded (for example,\n * bundled by the host app shell via `@import \"leaflet/dist/leaflet.css\"`).\n */\nfunction hasLeafletCoreStyles(): boolean {\n if (typeof document === \"undefined\") return true;\n if (document.getElementById(LEAFLET_LINK_ID)) return true;\n const probe = document.createElement(\"div\");\n probe.className = \"leaflet-container\";\n probe.style.position = \"absolute\";\n probe.style.visibility = \"hidden\";\n probe.style.pointerEvents = \"none\";\n document.body.appendChild(probe);\n const overflow = getComputedStyle(probe).overflow;\n probe.remove();\n return overflow === \"hidden\";\n}\n\nconst TOKEN_MAP_CSS = `\n.tc-map-canvas {\n background-color: var(--color-bg-sunken);\n background-image:\n linear-gradient(to right, var(--color-border-subtle) 1px, transparent 1px),\n linear-gradient(to bottom, var(--color-border-subtle) 1px, transparent 1px);\n background-size: 32px 32px;\n color: var(--color-text-primary);\n font-family: var(--font-family-body, inherit);\n}\n.tc-map-canvas .leaflet-container {\n background: transparent;\n color: var(--color-text-primary);\n font-family: inherit;\n}\n[data-theme=\"dark\"] .tc-map-canvas .leaflet-tile-pane,\n.dark .tc-map-canvas .leaflet-tile-pane {\n filter: brightness(0.68) invert(1) contrast(1.12) hue-rotate(196deg) saturate(0.45);\n}\n.tc-map-canvas .leaflet-popup-content-wrapper,\n.tc-map-canvas .leaflet-popup-tip {\n background-color: var(--color-bg-elevated, var(--color-bg-surface));\n color: var(--color-text-primary);\n border: 1px solid var(--color-border-subtle);\n box-shadow: var(--shadow-lg, none);\n}\n.tc-map-canvas .leaflet-popup-content {\n margin: 10px 12px;\n font-size: 12px;\n line-height: 1.45;\n}\n.tc-map-canvas .leaflet-popup-close-button {\n color: var(--color-text-secondary);\n}\n.tc-map-canvas .leaflet-popup-close-button:hover {\n color: var(--color-text-primary);\n}\n.tc-map-canvas .leaflet-tooltip {\n background-color: var(--color-bg-elevated, var(--color-bg-surface));\n color: var(--color-text-primary);\n border: 1px solid var(--color-border-subtle);\n font-size: 11px;\n font-weight: 500;\n padding: 2px 6px;\n}\n.tc-map-canvas .leaflet-control-attribution {\n background-color: var(--color-bg-surface);\n color: var(--color-text-muted);\n border-top-left-radius: var(--radius-input, 6px);\n font-size: 10px;\n opacity: 0.9;\n}\n.tc-map-canvas .leaflet-control-attribution a {\n color: var(--color-text-link);\n}\n.tc-map-canvas .leaflet-control-scale-line {\n background-color: var(--color-bg-surface);\n color: var(--color-text-secondary);\n border-color: var(--color-border-default);\n font-size: 10px;\n}\n.tc-map-dot-marker {\n background: transparent;\n border: none;\n}\n.tc-map-dot-inner {\n width: 14px;\n height: 14px;\n border-radius: 9999px;\n border: 2px solid var(--color-bg-surface);\n background-color: var(--color-action-primary-bg);\n}\n.tc-map-dot-inner--draft {\n width: 18px;\n height: 18px;\n border-radius: 9999px;\n border: 2px solid var(--color-bg-surface);\n background-color: var(--color-action-primary-bg);\n outline: 3px solid var(--color-border-focus, var(--color-action-primary-bg));\n cursor: grab;\n}\n.tc-map-radius-handle {\n width: 16px;\n height: 16px;\n border-radius: 9999px;\n border: 2px solid var(--color-action-primary-bg);\n background-color: var(--color-bg-surface);\n cursor: ew-resize;\n}\n.tc-map-canvas .leaflet-interactive:focus-visible {\n outline: 2px solid var(--color-border-focus);\n outline-offset: 2px;\n}\n`;\n\n/**\n * Ensures both Leaflet's core stylesheet (bundled by host shell, or SRI CDN\n * fallback in standalone/Storybook) and TimeCampus semantic token overrides\n * are active in the document head.\n */\nexport function ensureLeafletStyles(): void {\n if (typeof document === \"undefined\") return;\n\n if (!hasLeafletCoreStyles()) {\n const link = document.createElement(\"link\");\n link.id = LEAFLET_LINK_ID;\n link.rel = \"stylesheet\";\n link.href = LEAFLET_CDN_CSS;\n link.integrity = LEAFLET_CDN_SRI;\n link.crossOrigin = \"anonymous\";\n document.head.appendChild(link);\n }\n\n if (!document.getElementById(THEME_STYLE_ID)) {\n const style = document.createElement(\"style\");\n style.id = THEME_STYLE_ID;\n style.textContent = TOKEN_MAP_CSS;\n document.head.appendChild(style);\n }\n}\n"],"mappings":";AAQA,IAGMA,IAAiB,2BACjBC,IAAkB,eAMXC,IAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;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