posthog-js-lite 4.11.0 → 4.12.0

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/index.cjs CHANGED
@@ -1,381 +1,299 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var core = require('@posthog/core');
6
-
7
- const version = "4.11.0";
8
-
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ let _posthog_core = require("@posthog/core");
6
+ //#region src/version.ts
7
+ const version = "4.12.0";
8
+ //#endregion
9
+ //#region src/context.ts
9
10
  function getContext(window, disableCaptureUrlHashes = false) {
10
- let context = {};
11
- if (window?.navigator) {
12
- const userAgent = window.navigator.userAgent;
13
- const osValue = os(window);
14
- context = {
15
- ...context,
16
- ...(osValue !== undefined && {
17
- $os: osValue
18
- }),
19
- $browser: core.detectBrowser(userAgent, window.navigator.vendor),
20
- $referrer: window.document.referrer,
21
- $referring_domain: referringDomain(window.document.referrer),
22
- $device: device(userAgent),
23
- $current_url: disableCaptureUrlHashes ? core.stripUrlHash(window.location.href) : window.location.href,
24
- $host: window.location.host,
25
- $pathname: window.location.pathname,
26
- $browser_version: core.detectBrowserVersion(userAgent, window.navigator.vendor),
27
- $screen_height: window.screen.height,
28
- $screen_width: window.screen.width,
29
- $screen_dpr: window.devicePixelRatio
30
- };
31
- }
32
- context = {
33
- ...context,
34
- $lib: 'js',
35
- $lib_version: version,
36
- $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10),
37
- $time: core.currentTimestamp() / 1000 // epoch time in seconds
38
- };
39
- return context; // TODO: strip empty props?
11
+ let context = {};
12
+ if (window?.navigator) {
13
+ const userAgent = window.navigator.userAgent;
14
+ const osValue = os(window);
15
+ const [webviewApp, webviewAppVersion] = (0, _posthog_core.detectWebviewApp)(userAgent);
16
+ context = {
17
+ ...context,
18
+ ...osValue !== void 0 && { $os: osValue },
19
+ $browser: (0, _posthog_core.detectBrowser)(userAgent, window.navigator.vendor),
20
+ ...webviewApp && { $webview_app: webviewApp },
21
+ ...webviewAppVersion && { $webview_app_version: webviewAppVersion },
22
+ $referrer: window.document.referrer,
23
+ $referring_domain: referringDomain(window.document.referrer),
24
+ $device: device(userAgent),
25
+ $current_url: disableCaptureUrlHashes ? (0, _posthog_core.stripUrlHash)(window.location.href) : window.location.href,
26
+ $host: window.location.host,
27
+ $pathname: window.location.pathname,
28
+ $browser_version: (0, _posthog_core.detectBrowserVersion)(userAgent, window.navigator.vendor),
29
+ $screen_height: window.screen.height,
30
+ $screen_width: window.screen.width,
31
+ $screen_dpr: window.devicePixelRatio
32
+ };
33
+ }
34
+ context = {
35
+ ...context,
36
+ $lib: "js",
37
+ $lib_version: version,
38
+ $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10),
39
+ $time: (0, _posthog_core.currentTimestamp)() / 1e3
40
+ };
41
+ return context;
40
42
  }
41
43
  function os(window) {
42
- if (!window?.navigator) {
43
- return undefined;
44
- }
45
- const a = window.navigator.userAgent;
46
- if (/Windows/i.test(a)) {
47
- if (/Phone/.test(a) || /WPDesktop/.test(a)) {
48
- return 'Windows Phone';
49
- }
50
- return 'Windows';
51
- } else if (/(iPhone|iPad|iPod)/.test(a)) {
52
- return 'iOS';
53
- } else if (/Android/.test(a)) {
54
- return 'Android';
55
- } else if (/(BlackBerry|PlayBook|BB10)/i.test(a)) {
56
- return 'BlackBerry';
57
- } else if (/Mac/i.test(a)) {
58
- return 'Mac OS X';
59
- } else if (/Linux/.test(a)) {
60
- return 'Linux';
61
- } else if (/CrOS/.test(a)) {
62
- return 'Chrome OS';
63
- } else {
64
- return undefined;
65
- }
44
+ if (!window?.navigator) return;
45
+ const a = window.navigator.userAgent;
46
+ if (/Windows/i.test(a)) {
47
+ if (/Phone/.test(a) || /WPDesktop/.test(a)) return "Windows Phone";
48
+ return "Windows";
49
+ } else if (/(iPhone|iPad|iPod)/.test(a)) return "iOS";
50
+ else if (/Android/.test(a)) return "Android";
51
+ else if (/(BlackBerry|PlayBook|BB10)/i.test(a)) return "BlackBerry";
52
+ else if (/Mac/i.test(a)) return "Mac OS X";
53
+ else if (/Linux/.test(a)) return "Linux";
54
+ else if (/CrOS/.test(a)) return "Chrome OS";
55
+ else return;
66
56
  }
67
57
  function device(userAgent) {
68
- if (/Windows Phone/i.test(userAgent) || /WPDesktop/.test(userAgent)) {
69
- return 'Windows Phone';
70
- } else if (/iPad/.test(userAgent)) {
71
- return 'iPad';
72
- } else if (/iPod/.test(userAgent)) {
73
- return 'iPod Touch';
74
- } else if (/iPhone/.test(userAgent)) {
75
- return 'iPhone';
76
- } else if (/(BlackBerry|PlayBook|BB10)/i.test(userAgent)) {
77
- return 'BlackBerry';
78
- } else if (/Android/.test(userAgent)) {
79
- return 'Android';
80
- } else {
81
- return '';
82
- }
58
+ if (/Windows Phone/i.test(userAgent) || /WPDesktop/.test(userAgent)) return "Windows Phone";
59
+ else if (/iPad/.test(userAgent)) return "iPad";
60
+ else if (/iPod/.test(userAgent)) return "iPod Touch";
61
+ else if (/iPhone/.test(userAgent)) return "iPhone";
62
+ else if (/(BlackBerry|PlayBook|BB10)/i.test(userAgent)) return "BlackBerry";
63
+ else if (/Android/.test(userAgent)) return "Android";
64
+ else return "";
83
65
  }
84
66
  function referringDomain(referrer) {
85
- const split = referrer.split('/');
86
- if (split.length >= 3) {
87
- return split[2];
88
- }
89
- return '';
67
+ const split = referrer.split("/");
68
+ if (split.length >= 3) return split[2];
69
+ return "";
90
70
  }
91
-
92
- // Methods partially borrowed from quirksmode.org/js/cookies.html
71
+ //#endregion
72
+ //#region src/storage.ts
93
73
  const cookieStore = {
94
- getItem(key) {
95
- try {
96
- const nameEQ = key + '=';
97
- const ca = document.cookie.split(';');
98
- for (let i = 0; i < ca.length; i++) {
99
- let c = ca[i];
100
- while (c.charAt(0) == ' ') {
101
- c = c.substring(1, c.length);
102
- }
103
- if (c.indexOf(nameEQ) === 0) {
104
- return decodeURIComponent(c.substring(nameEQ.length, c.length));
105
- }
106
- }
107
- } catch (err) {}
108
- return null;
109
- },
110
- setItem(key, value) {
111
- try {
112
- const cdomain = '',
113
- expires = '',
114
- secure = '';
115
- const new_cookie_val = key + '=' + encodeURIComponent(value) + expires + '; path=/' + cdomain + secure;
116
- document.cookie = new_cookie_val;
117
- } catch (err) {
118
- return;
119
- }
120
- },
121
- removeItem(name) {
122
- try {
123
- cookieStore.setItem(name, '');
124
- } catch (err) {
125
- return;
126
- }
127
- },
128
- clear() {
129
- document.cookie = '';
130
- },
131
- getAllKeys() {
132
- const ca = document.cookie.split(';');
133
- const keys = [];
134
- for (let i = 0; i < ca.length; i++) {
135
- let c = ca[i];
136
- while (c.charAt(0) == ' ') {
137
- c = c.substring(1, c.length);
138
- }
139
- keys.push(c.split('=')[0]);
140
- }
141
- return keys;
142
- }
74
+ getItem(key) {
75
+ try {
76
+ const nameEQ = key + "=";
77
+ const ca = document.cookie.split(";");
78
+ for (let i = 0; i < ca.length; i++) {
79
+ let c = ca[i];
80
+ while (c.charAt(0) == " ") c = c.substring(1, c.length);
81
+ if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length));
82
+ }
83
+ } catch (err) {}
84
+ return null;
85
+ },
86
+ setItem(key, value) {
87
+ try {
88
+ const new_cookie_val = key + "=" + encodeURIComponent(value) + "; path=/";
89
+ document.cookie = new_cookie_val;
90
+ } catch (err) {
91
+ return;
92
+ }
93
+ },
94
+ removeItem(name) {
95
+ try {
96
+ cookieStore.setItem(name, "");
97
+ } catch (err) {
98
+ return;
99
+ }
100
+ },
101
+ clear() {
102
+ document.cookie = "";
103
+ },
104
+ getAllKeys() {
105
+ const ca = document.cookie.split(";");
106
+ const keys = [];
107
+ for (let i = 0; i < ca.length; i++) {
108
+ let c = ca[i];
109
+ while (c.charAt(0) == " ") c = c.substring(1, c.length);
110
+ keys.push(c.split("=")[0]);
111
+ }
112
+ return keys;
113
+ }
143
114
  };
144
- const createStorageLike = store => {
145
- return {
146
- getItem(key) {
147
- return store.getItem(key);
148
- },
149
- setItem(key, value) {
150
- store.setItem(key, value);
151
- },
152
- removeItem(key) {
153
- store.removeItem(key);
154
- },
155
- clear() {
156
- store.clear();
157
- },
158
- getAllKeys() {
159
- const keys = [];
160
- for (const key in localStorage) {
161
- keys.push(key);
162
- }
163
- return keys;
164
- }
165
- };
115
+ const createStorageLike = (store) => {
116
+ return {
117
+ getItem(key) {
118
+ return store.getItem(key);
119
+ },
120
+ setItem(key, value) {
121
+ store.setItem(key, value);
122
+ },
123
+ removeItem(key) {
124
+ store.removeItem(key);
125
+ },
126
+ clear() {
127
+ store.clear();
128
+ },
129
+ getAllKeys() {
130
+ const keys = [];
131
+ for (const key in localStorage) keys.push(key);
132
+ return keys;
133
+ }
134
+ };
166
135
  };
167
- const checkStoreIsSupported = (storage, key = '__mplssupport__') => {
168
- try {
169
- const val = 'xyz';
170
- storage.setItem(key, val);
171
- if (storage.getItem(key) !== val) {
172
- return false;
173
- }
174
- storage.removeItem(key);
175
- return true;
176
- } catch (err) {
177
- return false;
178
- }
136
+ const checkStoreIsSupported = (storage, key = "__mplssupport__") => {
137
+ try {
138
+ const val = "xyz";
139
+ storage.setItem(key, val);
140
+ if (storage.getItem(key) !== val) return false;
141
+ storage.removeItem(key);
142
+ return true;
143
+ } catch (err) {
144
+ return false;
145
+ }
179
146
  };
180
- let localStore = undefined;
181
- let sessionStore = undefined;
147
+ let localStore = void 0;
148
+ let sessionStore = void 0;
182
149
  const createMemoryStorage = () => {
183
- const _cache = {};
184
- const store = {
185
- getItem(key) {
186
- return _cache[key];
187
- },
188
- setItem(key, value) {
189
- _cache[key] = value !== null ? value : undefined;
190
- },
191
- removeItem(key) {
192
- delete _cache[key];
193
- },
194
- clear() {
195
- for (const key in _cache) {
196
- delete _cache[key];
197
- }
198
- },
199
- getAllKeys() {
200
- const keys = [];
201
- for (const key in _cache) {
202
- keys.push(key);
203
- }
204
- return keys;
205
- }
206
- };
207
- return store;
150
+ const _cache = {};
151
+ return {
152
+ getItem(key) {
153
+ return _cache[key];
154
+ },
155
+ setItem(key, value) {
156
+ _cache[key] = value !== null ? value : void 0;
157
+ },
158
+ removeItem(key) {
159
+ delete _cache[key];
160
+ },
161
+ clear() {
162
+ for (const key in _cache) delete _cache[key];
163
+ },
164
+ getAllKeys() {
165
+ const keys = [];
166
+ for (const key in _cache) keys.push(key);
167
+ return keys;
168
+ }
169
+ };
208
170
  };
209
171
  const getStorage = (type, window) => {
210
- if (window) {
211
- if (!localStore) {
212
- const _localStore = createStorageLike(window.localStorage);
213
- localStore = checkStoreIsSupported(_localStore) ? _localStore : undefined;
214
- }
215
- if (!sessionStore) {
216
- const _sessionStore = createStorageLike(window.sessionStorage);
217
- sessionStore = checkStoreIsSupported(_sessionStore) ? _sessionStore : undefined;
218
- }
219
- }
220
- switch (type) {
221
- case 'cookie':
222
- return cookieStore || localStore || sessionStore || createMemoryStorage();
223
- case 'localStorage':
224
- return localStore || sessionStore || createMemoryStorage();
225
- case 'sessionStorage':
226
- return sessionStore || createMemoryStorage();
227
- case 'memory':
228
- return createMemoryStorage();
229
- default:
230
- return createMemoryStorage();
231
- }
172
+ if (window) {
173
+ if (!localStore) {
174
+ const _localStore = createStorageLike(window.localStorage);
175
+ localStore = checkStoreIsSupported(_localStore) ? _localStore : void 0;
176
+ }
177
+ if (!sessionStore) {
178
+ const _sessionStore = createStorageLike(window.sessionStorage);
179
+ sessionStore = checkStoreIsSupported(_sessionStore) ? _sessionStore : void 0;
180
+ }
181
+ }
182
+ switch (type) {
183
+ case "cookie": return cookieStore || localStore || sessionStore || createMemoryStorage();
184
+ case "localStorage": return localStore || sessionStore || createMemoryStorage();
185
+ case "sessionStorage": return sessionStore || createMemoryStorage();
186
+ case "memory": return createMemoryStorage();
187
+ default: return createMemoryStorage();
188
+ }
232
189
  };
233
-
234
- // Portions of this file are derived from getsentry/sentry-javascript
235
- // Copyright (c) 2012 Functional Software, Inc. dba Sentry
236
- // Licensed under the MIT License: https://github.com/getsentry/sentry-javascript/blob/develop/LICENSE
237
- // import { patch } from 'rrweb/typings/utils'
238
- // copied from: https://github.com/PostHog/posthog-js/blob/main/src/extensions/replay/rrweb-plugins/patch.ts
239
- // which was copied from https://github.com/rrweb-io/rrweb/blob/8aea5b00a4dfe5a6f59bd2ae72bb624f45e51e81/packages/rrweb/src/utils.ts#L129
240
- // copied from: https://github.com/PostHog/posthog-js/blob/main/react/src/utils/type-utils.ts#L4
241
- const isFunction = function (f) {
242
- return typeof f === 'function';
190
+ //#endregion
191
+ //#region src/patch.ts
192
+ const isFunction = function(f) {
193
+ return typeof f === "function";
243
194
  };
244
195
  function patch(source, name, replacement) {
245
- try {
246
- if (!(name in source)) {
247
- return () => {
248
- //
249
- };
250
- }
251
- const original = source[name];
252
- const wrapped = replacement(original);
253
- // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work
254
- // otherwise it'll throw "TypeError: Object.defineProperties called on non-object"
255
- if (isFunction(wrapped)) {
256
- wrapped.prototype = wrapped.prototype || {};
257
- Object.defineProperties(wrapped, {
258
- __posthog_wrapped__: {
259
- enumerable: false,
260
- value: true
261
- }
262
- });
263
- }
264
- source[name] = wrapped;
265
- return () => {
266
- source[name] = original;
267
- };
268
- } catch {
269
- return () => {
270
- //
271
- };
272
- // This can throw when multiple instrumentation layers try to wrap the same global object,
273
- // such as XMLHttpRequest, and redefine the same non-configurable wrapper marker.
274
- }
196
+ try {
197
+ if (!(name in source)) return () => {};
198
+ const original = source[name];
199
+ const wrapped = replacement(original);
200
+ if (isFunction(wrapped)) {
201
+ wrapped.prototype = wrapped.prototype || {};
202
+ Object.defineProperties(wrapped, { __posthog_wrapped__: {
203
+ enumerable: false,
204
+ value: true
205
+ } });
206
+ }
207
+ source[name] = wrapped;
208
+ return () => {
209
+ source[name] = original;
210
+ };
211
+ } catch {
212
+ return () => {};
213
+ }
275
214
  }
276
-
277
- class PostHog extends core.PostHogCore {
278
- constructor(apiKey, options) {
279
- super(apiKey, options);
280
- this._lastPathname = '';
281
- // posthog-js stores options in one object on
282
- this._storageKey = options?.persistence_name ? `ph_${options.persistence_name}` : `ph_${apiKey}_posthog`;
283
- this._disableCaptureUrlHashes = options?.disable_capture_url_hashes ?? false;
284
- this._storage = getStorage(options?.persistence || 'localStorage', this.getWindow());
285
- this.setupBootstrap(options);
286
- if (options?.preloadFeatureFlags !== false) {
287
- this.reloadFeatureFlags();
288
- }
289
- if (options?.captureHistoryEvents && typeof window !== 'undefined') {
290
- this._lastPathname = window?.location?.pathname || '';
291
- this.setupHistoryEventTracking();
292
- }
293
- }
294
- getWindow() {
295
- return typeof window !== 'undefined' ? window : undefined;
296
- }
297
- getPersistedProperty(key) {
298
- if (!this._storageCache) {
299
- this._storageCache = JSON.parse(this._storage.getItem(this._storageKey) || '{}') || {};
300
- }
301
- return this._storageCache[key];
302
- }
303
- setPersistedProperty(key, value) {
304
- if (!this._storageCache) {
305
- this._storageCache = JSON.parse(this._storage.getItem(this._storageKey) || '{}') || {};
306
- }
307
- if (value === null) {
308
- delete this._storageCache[key];
309
- } else {
310
- this._storageCache[key] = value;
311
- }
312
- this._storage.setItem(this._storageKey, JSON.stringify(this._storageCache));
313
- }
314
- fetch(url, options) {
315
- const fetchFn = core.getFetch();
316
- if (!fetchFn) {
317
- // error will be handled by the caller (fetchWithRetry)
318
- return Promise.reject(new Error('Fetch API is not available in this environment.'));
319
- }
320
- return fetchFn(url, options);
321
- }
322
- getLibraryId() {
323
- return 'posthog-js-lite';
324
- }
325
- getLibraryVersion() {
326
- return version;
327
- }
328
- getCustomUserAgent() {
329
- return;
330
- }
331
- getCommonEventProperties() {
332
- return {
333
- ...super.getCommonEventProperties(),
334
- ...getContext(this.getWindow(), this._disableCaptureUrlHashes)
335
- };
336
- }
337
- setupHistoryEventTracking() {
338
- const window = this.getWindow();
339
- if (!window) {
340
- return;
341
- }
342
- // Old fashioned, we could also use arrow functions but I think the closure for a patch is more reliable
343
- const self = this;
344
- patch(window.history, 'pushState', originalPushState => {
345
- return function patchedPushState(state, title, url) {
346
- ;
347
- originalPushState.call(this, state, title, url);
348
- self.captureNavigationEvent('pushState');
349
- };
350
- });
351
- patch(window.history, 'replaceState', originalReplaceState => {
352
- return function patchedReplaceState(state, title, url) {
353
- ;
354
- originalReplaceState.call(this, state, title, url);
355
- self.captureNavigationEvent('replaceState');
356
- };
357
- });
358
- // For popstate we need to listen to the event instead of overriding a method
359
- window.addEventListener('popstate', () => {
360
- this.captureNavigationEvent('popstate');
361
- });
362
- }
363
- captureNavigationEvent(navigationType) {
364
- const window = this.getWindow();
365
- if (!window) {
366
- return;
367
- }
368
- const currentPathname = window.location.pathname;
369
- // Only capture pageview if the pathname has changed
370
- if (currentPathname !== this._lastPathname) {
371
- this.capture('$pageview', {
372
- navigation_type: navigationType
373
- });
374
- this._lastPathname = currentPathname;
375
- }
376
- }
377
- }
378
-
215
+ //#endregion
216
+ //#region src/posthog-web.ts
217
+ var PostHog = class extends _posthog_core.PostHogCore {
218
+ constructor(apiKey, options) {
219
+ super(apiKey, options);
220
+ this._lastPathname = "";
221
+ this._storageKey = options?.persistence_name ? `ph_${options.persistence_name}` : `ph_${apiKey}_posthog`;
222
+ this._disableCaptureUrlHashes = options?.disable_capture_url_hashes ?? false;
223
+ this._storage = getStorage(options?.persistence || "localStorage", this.getWindow());
224
+ this.setupBootstrap(options);
225
+ if (options?.preloadFeatureFlags !== false) this.reloadFeatureFlags();
226
+ if (options?.captureHistoryEvents && typeof window !== "undefined") {
227
+ this._lastPathname = window?.location?.pathname || "";
228
+ this.setupHistoryEventTracking();
229
+ }
230
+ }
231
+ getWindow() {
232
+ return typeof window !== "undefined" ? window : void 0;
233
+ }
234
+ getPersistedProperty(key) {
235
+ if (!this._storageCache) this._storageCache = JSON.parse(this._storage.getItem(this._storageKey) || "{}") || {};
236
+ return this._storageCache[key];
237
+ }
238
+ setPersistedProperty(key, value) {
239
+ if (!this._storageCache) this._storageCache = JSON.parse(this._storage.getItem(this._storageKey) || "{}") || {};
240
+ if (value === null) delete this._storageCache[key];
241
+ else this._storageCache[key] = value;
242
+ this._storage.setItem(this._storageKey, JSON.stringify(this._storageCache));
243
+ }
244
+ fetch(url, options) {
245
+ const fetchFn = (0, _posthog_core.getFetch)();
246
+ if (!fetchFn) return Promise.reject(/* @__PURE__ */ new Error("Fetch API is not available in this environment."));
247
+ return fetchFn(url, options);
248
+ }
249
+ getLibraryId() {
250
+ return "posthog-js-lite";
251
+ }
252
+ getLibraryVersion() {
253
+ return version;
254
+ }
255
+ getCustomUserAgent() {}
256
+ getCommonEventProperties() {
257
+ return {
258
+ ...super.getCommonEventProperties(),
259
+ ...getContext(this.getWindow(), this._disableCaptureUrlHashes)
260
+ };
261
+ }
262
+ setupHistoryEventTracking() {
263
+ const window = this.getWindow();
264
+ if (!window) return;
265
+ const self = this;
266
+ patch(window.history, "pushState", (originalPushState) => {
267
+ return function patchedPushState(state, title, url) {
268
+ originalPushState.call(this, state, title, url);
269
+ self.captureNavigationEvent("pushState");
270
+ };
271
+ });
272
+ patch(window.history, "replaceState", (originalReplaceState) => {
273
+ return function patchedReplaceState(state, title, url) {
274
+ originalReplaceState.call(this, state, title, url);
275
+ self.captureNavigationEvent("replaceState");
276
+ };
277
+ });
278
+ window.addEventListener("popstate", () => {
279
+ this.captureNavigationEvent("popstate");
280
+ });
281
+ }
282
+ captureNavigationEvent(navigationType) {
283
+ const window = this.getWindow();
284
+ if (!window) return;
285
+ const currentPathname = window.location.pathname;
286
+ if (currentPathname !== this._lastPathname) {
287
+ this.capture("$pageview", { navigation_type: navigationType });
288
+ this._lastPathname = currentPathname;
289
+ }
290
+ }
291
+ };
292
+ //#endregion
293
+ //#region src/index.ts
294
+ var src_default = PostHog;
295
+ //#endregion
379
296
  exports.PostHog = PostHog;
380
- exports.default = PostHog;
381
- //# sourceMappingURL=index.cjs.map
297
+ exports.default = src_default;
298
+
299
+ //# sourceMappingURL=index.cjs.map