@builder.io/dev-tools 1.18.44-dev.202512111107.bf5b095a5 → 1.18.44-dev.202512111428.dadde891f
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/cli/index.cjs +2274 -1296
- package/cli/index.cjs.map +4 -4
- package/core/index.cjs +1 -1
- package/core/index.mjs +1 -1
- package/node/index.cjs +1 -1
- package/node/index.mjs +1 -1
- package/package.json +2 -1
- package/server/index.cjs +1133 -191
- package/server/index.mjs +1151 -209
- package/types/common/ast/component-input-types.d.ts +1 -1
- package/types/core/component-map-builder.d.ts +42 -0
- package/types/server/source-map-resolver.d.ts +31 -0
- package/types/tsconfig.tsbuildinfo +1 -1
- package/types/types.d.ts +13 -1
- package/types/cli/repo-indexing.d.ts +0 -17
- package/types/cli/repo-indexing.mock.d.ts +0 -5
- package/types/cli/utils/repo-indexing-group-prompts.d.ts +0 -1
- package/types/scripts/analyze-projects.d.ts +0 -18
- package/types/scripts/call-ensure-container.d.ts +0 -4
- package/types/scripts/check-backup.d.ts +0 -1
- package/types/scripts/cli.d.ts +0 -1
- package/types/scripts/download-projects.d.ts +0 -12
- package/types/scripts/utils/db.d.ts +0 -3
- package/types/scripts/utils/ensure-container.d.ts +0 -7
- package/types/scripts/utils/remove-machine-and-volume.d.ts +0 -5
package/server/index.cjs
CHANGED
|
@@ -40,7 +40,7 @@ var builderVersion, pkgVersion;
|
|
|
40
40
|
var init_version = __esm({
|
|
41
41
|
"packages/dev-tools/cli/version.ts"() {
|
|
42
42
|
"use strict";
|
|
43
|
-
builderVersion = true ? "1.18.44-dev.
|
|
43
|
+
builderVersion = true ? "1.18.44-dev.202512111428.dadde891f" : "0.0.0";
|
|
44
44
|
pkgVersion = process.env.OVERRIDE_VERSION ?? builderVersion;
|
|
45
45
|
}
|
|
46
46
|
});
|
|
@@ -152,12 +152,12 @@ function getImportPath(sys2, containingModulePath, moduleToImportPath) {
|
|
|
152
152
|
}
|
|
153
153
|
return p2;
|
|
154
154
|
}
|
|
155
|
-
function normalizePathSlash(
|
|
156
|
-
const isExtendedLengthPath =
|
|
155
|
+
function normalizePathSlash(path3) {
|
|
156
|
+
const isExtendedLengthPath = path3.startsWith("\\\\?\\");
|
|
157
157
|
if (isExtendedLengthPath) {
|
|
158
|
-
return
|
|
158
|
+
return path3;
|
|
159
159
|
}
|
|
160
|
-
return
|
|
160
|
+
return path3.replace(/\\/g, "/");
|
|
161
161
|
}
|
|
162
162
|
function getComponentImportNameFilePath(sys2, filePath) {
|
|
163
163
|
const ext = sys2.extname(filePath);
|
|
@@ -199,15 +199,15 @@ function getComponentImportPath(sys2, absFilePath) {
|
|
|
199
199
|
return "~/" + relFilePath;
|
|
200
200
|
}
|
|
201
201
|
function getDisplayFilePath(sys2, filePath) {
|
|
202
|
-
let
|
|
202
|
+
let path3 = filePath;
|
|
203
203
|
let parts = [];
|
|
204
204
|
for (let i = 0; i < 2; i++) {
|
|
205
|
-
const part = sys2.basename(
|
|
205
|
+
const part = sys2.basename(path3);
|
|
206
206
|
if (!part || part === "components") {
|
|
207
207
|
break;
|
|
208
208
|
}
|
|
209
209
|
parts.unshift(part);
|
|
210
|
-
|
|
210
|
+
path3 = sys2.dirname(path3);
|
|
211
211
|
}
|
|
212
212
|
return parts.join("/");
|
|
213
213
|
}
|
|
@@ -819,7 +819,7 @@ var init_types = __esm({
|
|
|
819
819
|
// packages/dev-tools/common/node-request.ts
|
|
820
820
|
function requestJSON(opts) {
|
|
821
821
|
const startTime = Date.now();
|
|
822
|
-
return new Promise((
|
|
822
|
+
return new Promise((resolve4, reject) => {
|
|
823
823
|
const request2 = getRequestModule(opts.url);
|
|
824
824
|
const req = request2(
|
|
825
825
|
{
|
|
@@ -846,7 +846,7 @@ function requestJSON(opts) {
|
|
|
846
846
|
);
|
|
847
847
|
} else {
|
|
848
848
|
try {
|
|
849
|
-
|
|
849
|
+
resolve4(JSON.parse(data));
|
|
850
850
|
} catch (err) {
|
|
851
851
|
reject(
|
|
852
852
|
`Response from ${opts.url.href} is not valid JSON: ${data}
|
|
@@ -1095,7 +1095,7 @@ async function connectBuilder(ctx, publicApiKey, privateAuthKey, kind) {
|
|
|
1095
1095
|
let MAX_RETRIES = 5;
|
|
1096
1096
|
let retries = 0;
|
|
1097
1097
|
while (!hasContent && retries < MAX_RETRIES) {
|
|
1098
|
-
await new Promise((
|
|
1098
|
+
await new Promise((resolve4) => setTimeout(resolve4, 1e3));
|
|
1099
1099
|
let content = await hasBuilderContentViaQueryAPI({
|
|
1100
1100
|
model: DEFAULT_MODEL_NAME,
|
|
1101
1101
|
pageUrl: frameworkPageOpts.pathname,
|
|
@@ -1131,7 +1131,7 @@ async function connectBuilder(ctx, publicApiKey, privateAuthKey, kind) {
|
|
|
1131
1131
|
`modified files: ${modifiedFiles.map((m2) => m2.displayFilePath).join(", ")}`
|
|
1132
1132
|
);
|
|
1133
1133
|
await ctx.restartAppServer();
|
|
1134
|
-
await new Promise((
|
|
1134
|
+
await new Promise((resolve4) => setTimeout(resolve4, 500));
|
|
1135
1135
|
} else {
|
|
1136
1136
|
ctx.debug(`no modified files`);
|
|
1137
1137
|
}
|
|
@@ -1183,6 +1183,927 @@ var init_builder_connect = __esm({
|
|
|
1183
1183
|
}
|
|
1184
1184
|
});
|
|
1185
1185
|
|
|
1186
|
+
// node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
1187
|
+
function decodeInteger(reader, relative) {
|
|
1188
|
+
let value = 0;
|
|
1189
|
+
let shift = 0;
|
|
1190
|
+
let integer = 0;
|
|
1191
|
+
do {
|
|
1192
|
+
const c = reader.next();
|
|
1193
|
+
integer = charToInt[c];
|
|
1194
|
+
value |= (integer & 31) << shift;
|
|
1195
|
+
shift += 5;
|
|
1196
|
+
} while (integer & 32);
|
|
1197
|
+
const shouldNegate = value & 1;
|
|
1198
|
+
value >>>= 1;
|
|
1199
|
+
if (shouldNegate) {
|
|
1200
|
+
value = -2147483648 | -value;
|
|
1201
|
+
}
|
|
1202
|
+
return relative + value;
|
|
1203
|
+
}
|
|
1204
|
+
function hasMoreVlq(reader, max) {
|
|
1205
|
+
if (reader.pos >= max)
|
|
1206
|
+
return false;
|
|
1207
|
+
return reader.peek() !== comma;
|
|
1208
|
+
}
|
|
1209
|
+
function decode(mappings) {
|
|
1210
|
+
const { length } = mappings;
|
|
1211
|
+
const reader = new StringReader(mappings);
|
|
1212
|
+
const decoded = [];
|
|
1213
|
+
let genColumn = 0;
|
|
1214
|
+
let sourcesIndex = 0;
|
|
1215
|
+
let sourceLine = 0;
|
|
1216
|
+
let sourceColumn = 0;
|
|
1217
|
+
let namesIndex = 0;
|
|
1218
|
+
do {
|
|
1219
|
+
const semi = reader.indexOf(";");
|
|
1220
|
+
const line = [];
|
|
1221
|
+
let sorted = true;
|
|
1222
|
+
let lastCol = 0;
|
|
1223
|
+
genColumn = 0;
|
|
1224
|
+
while (reader.pos < semi) {
|
|
1225
|
+
let seg;
|
|
1226
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
1227
|
+
if (genColumn < lastCol)
|
|
1228
|
+
sorted = false;
|
|
1229
|
+
lastCol = genColumn;
|
|
1230
|
+
if (hasMoreVlq(reader, semi)) {
|
|
1231
|
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
1232
|
+
sourceLine = decodeInteger(reader, sourceLine);
|
|
1233
|
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
1234
|
+
if (hasMoreVlq(reader, semi)) {
|
|
1235
|
+
namesIndex = decodeInteger(reader, namesIndex);
|
|
1236
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
|
1237
|
+
} else {
|
|
1238
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
|
1239
|
+
}
|
|
1240
|
+
} else {
|
|
1241
|
+
seg = [genColumn];
|
|
1242
|
+
}
|
|
1243
|
+
line.push(seg);
|
|
1244
|
+
reader.pos++;
|
|
1245
|
+
}
|
|
1246
|
+
if (!sorted)
|
|
1247
|
+
sort(line);
|
|
1248
|
+
decoded.push(line);
|
|
1249
|
+
reader.pos = semi + 1;
|
|
1250
|
+
} while (reader.pos <= length);
|
|
1251
|
+
return decoded;
|
|
1252
|
+
}
|
|
1253
|
+
function sort(line) {
|
|
1254
|
+
line.sort(sortComparator);
|
|
1255
|
+
}
|
|
1256
|
+
function sortComparator(a, b3) {
|
|
1257
|
+
return a[0] - b3[0];
|
|
1258
|
+
}
|
|
1259
|
+
var comma, semicolon, chars, intToChar, charToInt, bufLength, StringReader;
|
|
1260
|
+
var init_sourcemap_codec = __esm({
|
|
1261
|
+
"node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs"() {
|
|
1262
|
+
comma = ",".charCodeAt(0);
|
|
1263
|
+
semicolon = ";".charCodeAt(0);
|
|
1264
|
+
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1265
|
+
intToChar = new Uint8Array(64);
|
|
1266
|
+
charToInt = new Uint8Array(128);
|
|
1267
|
+
for (let i = 0; i < chars.length; i++) {
|
|
1268
|
+
const c = chars.charCodeAt(i);
|
|
1269
|
+
intToChar[i] = c;
|
|
1270
|
+
charToInt[c] = i;
|
|
1271
|
+
}
|
|
1272
|
+
bufLength = 1024 * 16;
|
|
1273
|
+
StringReader = class {
|
|
1274
|
+
constructor(buffer) {
|
|
1275
|
+
this.pos = 0;
|
|
1276
|
+
this.buffer = buffer;
|
|
1277
|
+
}
|
|
1278
|
+
next() {
|
|
1279
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
1280
|
+
}
|
|
1281
|
+
peek() {
|
|
1282
|
+
return this.buffer.charCodeAt(this.pos);
|
|
1283
|
+
}
|
|
1284
|
+
indexOf(char) {
|
|
1285
|
+
const { buffer, pos } = this;
|
|
1286
|
+
const idx = buffer.indexOf(char, pos);
|
|
1287
|
+
return idx === -1 ? buffer.length : idx;
|
|
1288
|
+
}
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
});
|
|
1292
|
+
|
|
1293
|
+
// node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
|
|
1294
|
+
function isAbsoluteUrl(input) {
|
|
1295
|
+
return schemeRegex.test(input);
|
|
1296
|
+
}
|
|
1297
|
+
function isSchemeRelativeUrl(input) {
|
|
1298
|
+
return input.startsWith("//");
|
|
1299
|
+
}
|
|
1300
|
+
function isAbsolutePath(input) {
|
|
1301
|
+
return input.startsWith("/");
|
|
1302
|
+
}
|
|
1303
|
+
function isFileUrl(input) {
|
|
1304
|
+
return input.startsWith("file:");
|
|
1305
|
+
}
|
|
1306
|
+
function isRelative(input) {
|
|
1307
|
+
return /^[.?#]/.test(input);
|
|
1308
|
+
}
|
|
1309
|
+
function parseAbsoluteUrl(input) {
|
|
1310
|
+
const match = urlRegex.exec(input);
|
|
1311
|
+
return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
|
|
1312
|
+
}
|
|
1313
|
+
function parseFileUrl(input) {
|
|
1314
|
+
const match = fileRegex.exec(input);
|
|
1315
|
+
const path3 = match[2];
|
|
1316
|
+
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path3) ? path3 : "/" + path3, match[3] || "", match[4] || "");
|
|
1317
|
+
}
|
|
1318
|
+
function makeUrl(scheme, user, host, port, path3, query, hash) {
|
|
1319
|
+
return {
|
|
1320
|
+
scheme,
|
|
1321
|
+
user,
|
|
1322
|
+
host,
|
|
1323
|
+
port,
|
|
1324
|
+
path: path3,
|
|
1325
|
+
query,
|
|
1326
|
+
hash,
|
|
1327
|
+
type: 7
|
|
1328
|
+
};
|
|
1329
|
+
}
|
|
1330
|
+
function parseUrl(input) {
|
|
1331
|
+
if (isSchemeRelativeUrl(input)) {
|
|
1332
|
+
const url2 = parseAbsoluteUrl("http:" + input);
|
|
1333
|
+
url2.scheme = "";
|
|
1334
|
+
url2.type = 6;
|
|
1335
|
+
return url2;
|
|
1336
|
+
}
|
|
1337
|
+
if (isAbsolutePath(input)) {
|
|
1338
|
+
const url2 = parseAbsoluteUrl("http://foo.com" + input);
|
|
1339
|
+
url2.scheme = "";
|
|
1340
|
+
url2.host = "";
|
|
1341
|
+
url2.type = 5;
|
|
1342
|
+
return url2;
|
|
1343
|
+
}
|
|
1344
|
+
if (isFileUrl(input))
|
|
1345
|
+
return parseFileUrl(input);
|
|
1346
|
+
if (isAbsoluteUrl(input))
|
|
1347
|
+
return parseAbsoluteUrl(input);
|
|
1348
|
+
const url = parseAbsoluteUrl("http://foo.com/" + input);
|
|
1349
|
+
url.scheme = "";
|
|
1350
|
+
url.host = "";
|
|
1351
|
+
url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
|
|
1352
|
+
return url;
|
|
1353
|
+
}
|
|
1354
|
+
function stripPathFilename(path3) {
|
|
1355
|
+
if (path3.endsWith("/.."))
|
|
1356
|
+
return path3;
|
|
1357
|
+
const index = path3.lastIndexOf("/");
|
|
1358
|
+
return path3.slice(0, index + 1);
|
|
1359
|
+
}
|
|
1360
|
+
function mergePaths(url, base) {
|
|
1361
|
+
normalizePath(base, base.type);
|
|
1362
|
+
if (url.path === "/") {
|
|
1363
|
+
url.path = base.path;
|
|
1364
|
+
} else {
|
|
1365
|
+
url.path = stripPathFilename(base.path) + url.path;
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
function normalizePath(url, type) {
|
|
1369
|
+
const rel = type <= 4;
|
|
1370
|
+
const pieces = url.path.split("/");
|
|
1371
|
+
let pointer = 1;
|
|
1372
|
+
let positive = 0;
|
|
1373
|
+
let addTrailingSlash = false;
|
|
1374
|
+
for (let i = 1; i < pieces.length; i++) {
|
|
1375
|
+
const piece = pieces[i];
|
|
1376
|
+
if (!piece) {
|
|
1377
|
+
addTrailingSlash = true;
|
|
1378
|
+
continue;
|
|
1379
|
+
}
|
|
1380
|
+
addTrailingSlash = false;
|
|
1381
|
+
if (piece === ".")
|
|
1382
|
+
continue;
|
|
1383
|
+
if (piece === "..") {
|
|
1384
|
+
if (positive) {
|
|
1385
|
+
addTrailingSlash = true;
|
|
1386
|
+
positive--;
|
|
1387
|
+
pointer--;
|
|
1388
|
+
} else if (rel) {
|
|
1389
|
+
pieces[pointer++] = piece;
|
|
1390
|
+
}
|
|
1391
|
+
continue;
|
|
1392
|
+
}
|
|
1393
|
+
pieces[pointer++] = piece;
|
|
1394
|
+
positive++;
|
|
1395
|
+
}
|
|
1396
|
+
let path3 = "";
|
|
1397
|
+
for (let i = 1; i < pointer; i++) {
|
|
1398
|
+
path3 += "/" + pieces[i];
|
|
1399
|
+
}
|
|
1400
|
+
if (!path3 || addTrailingSlash && !path3.endsWith("/..")) {
|
|
1401
|
+
path3 += "/";
|
|
1402
|
+
}
|
|
1403
|
+
url.path = path3;
|
|
1404
|
+
}
|
|
1405
|
+
function resolve(input, base) {
|
|
1406
|
+
if (!input && !base)
|
|
1407
|
+
return "";
|
|
1408
|
+
const url = parseUrl(input);
|
|
1409
|
+
let inputType = url.type;
|
|
1410
|
+
if (base && inputType !== 7) {
|
|
1411
|
+
const baseUrl = parseUrl(base);
|
|
1412
|
+
const baseType = baseUrl.type;
|
|
1413
|
+
switch (inputType) {
|
|
1414
|
+
case 1:
|
|
1415
|
+
url.hash = baseUrl.hash;
|
|
1416
|
+
// fall through
|
|
1417
|
+
case 2:
|
|
1418
|
+
url.query = baseUrl.query;
|
|
1419
|
+
// fall through
|
|
1420
|
+
case 3:
|
|
1421
|
+
case 4:
|
|
1422
|
+
mergePaths(url, baseUrl);
|
|
1423
|
+
// fall through
|
|
1424
|
+
case 5:
|
|
1425
|
+
url.user = baseUrl.user;
|
|
1426
|
+
url.host = baseUrl.host;
|
|
1427
|
+
url.port = baseUrl.port;
|
|
1428
|
+
// fall through
|
|
1429
|
+
case 6:
|
|
1430
|
+
url.scheme = baseUrl.scheme;
|
|
1431
|
+
}
|
|
1432
|
+
if (baseType > inputType)
|
|
1433
|
+
inputType = baseType;
|
|
1434
|
+
}
|
|
1435
|
+
normalizePath(url, inputType);
|
|
1436
|
+
const queryHash = url.query + url.hash;
|
|
1437
|
+
switch (inputType) {
|
|
1438
|
+
// This is impossible, because of the empty checks at the start of the function.
|
|
1439
|
+
// case UrlType.Empty:
|
|
1440
|
+
case 2:
|
|
1441
|
+
case 3:
|
|
1442
|
+
return queryHash;
|
|
1443
|
+
case 4: {
|
|
1444
|
+
const path3 = url.path.slice(1);
|
|
1445
|
+
if (!path3)
|
|
1446
|
+
return queryHash || ".";
|
|
1447
|
+
if (isRelative(base || input) && !isRelative(path3)) {
|
|
1448
|
+
return "./" + path3 + queryHash;
|
|
1449
|
+
}
|
|
1450
|
+
return path3 + queryHash;
|
|
1451
|
+
}
|
|
1452
|
+
case 5:
|
|
1453
|
+
return url.path + queryHash;
|
|
1454
|
+
default:
|
|
1455
|
+
return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
var schemeRegex, urlRegex, fileRegex;
|
|
1459
|
+
var init_resolve_uri = __esm({
|
|
1460
|
+
"node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs"() {
|
|
1461
|
+
schemeRegex = /^[\w+.-]+:\/\//;
|
|
1462
|
+
urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
|
1463
|
+
fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
|
|
1467
|
+
// node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
|
|
1468
|
+
function resolve2(input, base) {
|
|
1469
|
+
if (base && !base.endsWith("/"))
|
|
1470
|
+
base += "/";
|
|
1471
|
+
return resolve(input, base);
|
|
1472
|
+
}
|
|
1473
|
+
function stripFilename(path3) {
|
|
1474
|
+
if (!path3)
|
|
1475
|
+
return "";
|
|
1476
|
+
const index = path3.lastIndexOf("/");
|
|
1477
|
+
return path3.slice(0, index + 1);
|
|
1478
|
+
}
|
|
1479
|
+
function maybeSort(mappings, owned) {
|
|
1480
|
+
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
|
1481
|
+
if (unsortedIndex === mappings.length)
|
|
1482
|
+
return mappings;
|
|
1483
|
+
if (!owned)
|
|
1484
|
+
mappings = mappings.slice();
|
|
1485
|
+
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
|
|
1486
|
+
mappings[i] = sortSegments(mappings[i], owned);
|
|
1487
|
+
}
|
|
1488
|
+
return mappings;
|
|
1489
|
+
}
|
|
1490
|
+
function nextUnsortedSegmentLine(mappings, start) {
|
|
1491
|
+
for (let i = start; i < mappings.length; i++) {
|
|
1492
|
+
if (!isSorted(mappings[i]))
|
|
1493
|
+
return i;
|
|
1494
|
+
}
|
|
1495
|
+
return mappings.length;
|
|
1496
|
+
}
|
|
1497
|
+
function isSorted(line) {
|
|
1498
|
+
for (let j2 = 1; j2 < line.length; j2++) {
|
|
1499
|
+
if (line[j2][COLUMN] < line[j2 - 1][COLUMN]) {
|
|
1500
|
+
return false;
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
return true;
|
|
1504
|
+
}
|
|
1505
|
+
function sortSegments(line, owned) {
|
|
1506
|
+
if (!owned)
|
|
1507
|
+
line = line.slice();
|
|
1508
|
+
return line.sort(sortComparator2);
|
|
1509
|
+
}
|
|
1510
|
+
function sortComparator2(a, b3) {
|
|
1511
|
+
return a[COLUMN] - b3[COLUMN];
|
|
1512
|
+
}
|
|
1513
|
+
function binarySearch(haystack, needle, low, high) {
|
|
1514
|
+
while (low <= high) {
|
|
1515
|
+
const mid = low + (high - low >> 1);
|
|
1516
|
+
const cmp = haystack[mid][COLUMN] - needle;
|
|
1517
|
+
if (cmp === 0) {
|
|
1518
|
+
found = true;
|
|
1519
|
+
return mid;
|
|
1520
|
+
}
|
|
1521
|
+
if (cmp < 0) {
|
|
1522
|
+
low = mid + 1;
|
|
1523
|
+
} else {
|
|
1524
|
+
high = mid - 1;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
found = false;
|
|
1528
|
+
return low - 1;
|
|
1529
|
+
}
|
|
1530
|
+
function upperBound(haystack, needle, index) {
|
|
1531
|
+
for (let i = index + 1; i < haystack.length; index = i++) {
|
|
1532
|
+
if (haystack[i][COLUMN] !== needle)
|
|
1533
|
+
break;
|
|
1534
|
+
}
|
|
1535
|
+
return index;
|
|
1536
|
+
}
|
|
1537
|
+
function lowerBound(haystack, needle, index) {
|
|
1538
|
+
for (let i = index - 1; i >= 0; index = i--) {
|
|
1539
|
+
if (haystack[i][COLUMN] !== needle)
|
|
1540
|
+
break;
|
|
1541
|
+
}
|
|
1542
|
+
return index;
|
|
1543
|
+
}
|
|
1544
|
+
function memoizedState() {
|
|
1545
|
+
return {
|
|
1546
|
+
lastKey: -1,
|
|
1547
|
+
lastNeedle: -1,
|
|
1548
|
+
lastIndex: -1
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
function memoizedBinarySearch(haystack, needle, state, key) {
|
|
1552
|
+
const { lastKey, lastNeedle, lastIndex } = state;
|
|
1553
|
+
let low = 0;
|
|
1554
|
+
let high = haystack.length - 1;
|
|
1555
|
+
if (key === lastKey) {
|
|
1556
|
+
if (needle === lastNeedle) {
|
|
1557
|
+
found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
|
|
1558
|
+
return lastIndex;
|
|
1559
|
+
}
|
|
1560
|
+
if (needle >= lastNeedle) {
|
|
1561
|
+
low = lastIndex === -1 ? 0 : lastIndex;
|
|
1562
|
+
} else {
|
|
1563
|
+
high = lastIndex;
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
state.lastKey = key;
|
|
1567
|
+
state.lastNeedle = needle;
|
|
1568
|
+
return state.lastIndex = binarySearch(haystack, needle, low, high);
|
|
1569
|
+
}
|
|
1570
|
+
function cast(map) {
|
|
1571
|
+
return map;
|
|
1572
|
+
}
|
|
1573
|
+
function decodedMappings(map) {
|
|
1574
|
+
var _a;
|
|
1575
|
+
return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
|
|
1576
|
+
}
|
|
1577
|
+
function originalPositionFor(map, needle) {
|
|
1578
|
+
let { line, column, bias } = needle;
|
|
1579
|
+
line--;
|
|
1580
|
+
if (line < 0)
|
|
1581
|
+
throw new Error(LINE_GTR_ZERO);
|
|
1582
|
+
if (column < 0)
|
|
1583
|
+
throw new Error(COL_GTR_EQ_ZERO);
|
|
1584
|
+
const decoded = decodedMappings(map);
|
|
1585
|
+
if (line >= decoded.length)
|
|
1586
|
+
return OMapping(null, null, null, null);
|
|
1587
|
+
const segments = decoded[line];
|
|
1588
|
+
const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
|
|
1589
|
+
if (index === -1)
|
|
1590
|
+
return OMapping(null, null, null, null);
|
|
1591
|
+
const segment = segments[index];
|
|
1592
|
+
if (segment.length === 1)
|
|
1593
|
+
return OMapping(null, null, null, null);
|
|
1594
|
+
const { names, resolvedSources } = map;
|
|
1595
|
+
return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
|
|
1596
|
+
}
|
|
1597
|
+
function OMapping(source, line, column, name) {
|
|
1598
|
+
return { source, line, column, name };
|
|
1599
|
+
}
|
|
1600
|
+
function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
1601
|
+
let index = memoizedBinarySearch(segments, column, memo, line);
|
|
1602
|
+
if (found) {
|
|
1603
|
+
index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
|
|
1604
|
+
} else if (bias === LEAST_UPPER_BOUND)
|
|
1605
|
+
index++;
|
|
1606
|
+
if (index === -1 || index === segments.length)
|
|
1607
|
+
return -1;
|
|
1608
|
+
return index;
|
|
1609
|
+
}
|
|
1610
|
+
var COLUMN, SOURCES_INDEX, SOURCE_LINE, SOURCE_COLUMN, NAMES_INDEX, found, LINE_GTR_ZERO, COL_GTR_EQ_ZERO, LEAST_UPPER_BOUND, GREATEST_LOWER_BOUND, TraceMap;
|
|
1611
|
+
var init_trace_mapping = __esm({
|
|
1612
|
+
"node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs"() {
|
|
1613
|
+
init_sourcemap_codec();
|
|
1614
|
+
init_resolve_uri();
|
|
1615
|
+
COLUMN = 0;
|
|
1616
|
+
SOURCES_INDEX = 1;
|
|
1617
|
+
SOURCE_LINE = 2;
|
|
1618
|
+
SOURCE_COLUMN = 3;
|
|
1619
|
+
NAMES_INDEX = 4;
|
|
1620
|
+
found = false;
|
|
1621
|
+
LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
|
|
1622
|
+
COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
|
|
1623
|
+
LEAST_UPPER_BOUND = -1;
|
|
1624
|
+
GREATEST_LOWER_BOUND = 1;
|
|
1625
|
+
TraceMap = class {
|
|
1626
|
+
constructor(map, mapUrl) {
|
|
1627
|
+
const isString2 = typeof map === "string";
|
|
1628
|
+
if (!isString2 && map._decodedMemo)
|
|
1629
|
+
return map;
|
|
1630
|
+
const parsed = isString2 ? JSON.parse(map) : map;
|
|
1631
|
+
const { version: version4, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
|
1632
|
+
this.version = version4;
|
|
1633
|
+
this.file = file;
|
|
1634
|
+
this.names = names || [];
|
|
1635
|
+
this.sourceRoot = sourceRoot;
|
|
1636
|
+
this.sources = sources;
|
|
1637
|
+
this.sourcesContent = sourcesContent;
|
|
1638
|
+
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
|
1639
|
+
const from = resolve2(sourceRoot || "", stripFilename(mapUrl));
|
|
1640
|
+
this.resolvedSources = sources.map((s2) => resolve2(s2 || "", from));
|
|
1641
|
+
const { mappings } = parsed;
|
|
1642
|
+
if (typeof mappings === "string") {
|
|
1643
|
+
this._encoded = mappings;
|
|
1644
|
+
this._decoded = void 0;
|
|
1645
|
+
} else {
|
|
1646
|
+
this._encoded = void 0;
|
|
1647
|
+
this._decoded = maybeSort(mappings, isString2);
|
|
1648
|
+
}
|
|
1649
|
+
this._decodedMemo = memoizedState();
|
|
1650
|
+
this._bySources = void 0;
|
|
1651
|
+
this._bySourceMemos = void 0;
|
|
1652
|
+
}
|
|
1653
|
+
};
|
|
1654
|
+
}
|
|
1655
|
+
});
|
|
1656
|
+
|
|
1657
|
+
// packages/dev-tools/server/source-map-resolver.ts
|
|
1658
|
+
function cacheSet(key, value) {
|
|
1659
|
+
if (traceMapCache.size >= MAX_CACHE_SIZE) {
|
|
1660
|
+
const firstKey = traceMapCache.keys().next().value;
|
|
1661
|
+
if (firstKey) {
|
|
1662
|
+
traceMapCache.delete(firstKey);
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
traceMapCache.set(key, value);
|
|
1666
|
+
}
|
|
1667
|
+
function cacheGet(key) {
|
|
1668
|
+
if (!traceMapCache.has(key)) {
|
|
1669
|
+
CACHE_STATS.misses++;
|
|
1670
|
+
return void 0;
|
|
1671
|
+
}
|
|
1672
|
+
CACHE_STATS.hits++;
|
|
1673
|
+
const value = traceMapCache.get(key);
|
|
1674
|
+
traceMapCache.delete(key);
|
|
1675
|
+
traceMapCache.set(key, value);
|
|
1676
|
+
return value;
|
|
1677
|
+
}
|
|
1678
|
+
function extractSourceMappingURL(content) {
|
|
1679
|
+
const lines = content.split("\n").slice(-10);
|
|
1680
|
+
for (const line of lines.reverse()) {
|
|
1681
|
+
const match = line.match(/\/\/[#@]\s*sourceMappingURL=(.+)/);
|
|
1682
|
+
if (match) {
|
|
1683
|
+
let url = match[1].trim();
|
|
1684
|
+
try {
|
|
1685
|
+
url = decodeURIComponent(url);
|
|
1686
|
+
} catch (e2) {
|
|
1687
|
+
}
|
|
1688
|
+
return url;
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
return null;
|
|
1692
|
+
}
|
|
1693
|
+
async function loadSourceMap(projectRoot, devServerUrl, bundledPath, sourceMappingURL) {
|
|
1694
|
+
try {
|
|
1695
|
+
if (sourceMappingURL.startsWith("data:")) {
|
|
1696
|
+
const base64Match = sourceMappingURL.match(
|
|
1697
|
+
/^data:application\/json;(?:charset=utf-8;)?base64,(.+)$/
|
|
1698
|
+
);
|
|
1699
|
+
if (base64Match) {
|
|
1700
|
+
return Buffer.from(base64Match[1], "base64").toString("utf-8");
|
|
1701
|
+
}
|
|
1702
|
+
console.error(
|
|
1703
|
+
`[SourceMap] Unsupported inline source map format: ${sourceMappingURL.substring(0, 50)}...`
|
|
1704
|
+
);
|
|
1705
|
+
return null;
|
|
1706
|
+
}
|
|
1707
|
+
const bundledDir = path2.dirname(bundledPath);
|
|
1708
|
+
const isServerChunk = bundledPath.includes(".next/server/") || bundledPath.includes("_next/server/");
|
|
1709
|
+
if (isServerChunk) {
|
|
1710
|
+
const normalizedPath2 = sourceMappingURL.startsWith("/") ? sourceMappingURL.substring(1) : sourceMappingURL;
|
|
1711
|
+
const possiblePaths2 = [
|
|
1712
|
+
path2.join(projectRoot, bundledDir.replace(/^\//, ""), normalizedPath2),
|
|
1713
|
+
path2.join(projectRoot, normalizedPath2)
|
|
1714
|
+
];
|
|
1715
|
+
for (const possiblePath of possiblePaths2) {
|
|
1716
|
+
const resolvedPath = path2.resolve(possiblePath);
|
|
1717
|
+
const resolvedRoot = path2.resolve(projectRoot);
|
|
1718
|
+
if (!resolvedPath.startsWith(resolvedRoot)) {
|
|
1719
|
+
continue;
|
|
1720
|
+
}
|
|
1721
|
+
if (fs.existsSync(possiblePath)) {
|
|
1722
|
+
return fs.readFileSync(possiblePath, "utf-8");
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
console.error(
|
|
1726
|
+
`[SourceMap] Server chunk source map not found: ${sourceMappingURL}`
|
|
1727
|
+
);
|
|
1728
|
+
return null;
|
|
1729
|
+
}
|
|
1730
|
+
const sourceMapPath = path2.join(bundledDir, sourceMappingURL);
|
|
1731
|
+
const sourceMapUrl = `${devServerUrl}${sourceMapPath.startsWith("/") ? sourceMapPath : "/" + sourceMapPath}`;
|
|
1732
|
+
try {
|
|
1733
|
+
const response2 = await fetch(sourceMapUrl);
|
|
1734
|
+
if (response2.ok) {
|
|
1735
|
+
return await response2.text();
|
|
1736
|
+
}
|
|
1737
|
+
} catch (fetchError) {
|
|
1738
|
+
}
|
|
1739
|
+
const normalizedPath = sourceMappingURL.startsWith("/") ? sourceMappingURL.substring(1) : sourceMappingURL;
|
|
1740
|
+
const possiblePaths = [
|
|
1741
|
+
path2.join(projectRoot, bundledDir, normalizedPath),
|
|
1742
|
+
path2.join(projectRoot, normalizedPath),
|
|
1743
|
+
path2.join(
|
|
1744
|
+
projectRoot,
|
|
1745
|
+
bundledDir.replace("_next/", ".next/"),
|
|
1746
|
+
normalizedPath
|
|
1747
|
+
)
|
|
1748
|
+
];
|
|
1749
|
+
for (const possiblePath of possiblePaths) {
|
|
1750
|
+
const resolvedPath = path2.resolve(possiblePath);
|
|
1751
|
+
const resolvedRoot = path2.resolve(projectRoot);
|
|
1752
|
+
if (!resolvedPath.startsWith(resolvedRoot)) {
|
|
1753
|
+
continue;
|
|
1754
|
+
}
|
|
1755
|
+
if (fs.existsSync(possiblePath)) {
|
|
1756
|
+
return fs.readFileSync(possiblePath, "utf-8");
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
console.error(
|
|
1760
|
+
`[SourceMap] Source map not found: ${sourceMappingURL} (tried ${possiblePaths.length} paths)`
|
|
1761
|
+
);
|
|
1762
|
+
return null;
|
|
1763
|
+
} catch (error) {
|
|
1764
|
+
console.error(`[SourceMap] Error loading source map:`, error);
|
|
1765
|
+
return null;
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
async function resolveSourceLocation(projectRoot, devServerUrl, bundledPath, line, column) {
|
|
1769
|
+
try {
|
|
1770
|
+
try {
|
|
1771
|
+
bundledPath = decodeURIComponent(bundledPath);
|
|
1772
|
+
} catch (e2) {
|
|
1773
|
+
}
|
|
1774
|
+
if (bundledPath.includes("file://") || bundledPath.includes("/Server/") || bundledPath.includes("..") || // Prevent directory traversal
|
|
1775
|
+
bundledPath.includes("~")) {
|
|
1776
|
+
return null;
|
|
1777
|
+
}
|
|
1778
|
+
const normalizedBundledPath = path2.normalize(bundledPath);
|
|
1779
|
+
if (normalizedBundledPath.includes("..")) {
|
|
1780
|
+
return null;
|
|
1781
|
+
}
|
|
1782
|
+
const filename = bundledPath.split("/").pop() || "";
|
|
1783
|
+
const isServerChunk = bundledPath.includes(".next/server/") || bundledPath.includes("_next/server/");
|
|
1784
|
+
const definitelyInternalPatterns = [
|
|
1785
|
+
"webpack_",
|
|
1786
|
+
// Webpack runtime
|
|
1787
|
+
"[turbopack]",
|
|
1788
|
+
// Turbopack runtime
|
|
1789
|
+
"next-devtools",
|
|
1790
|
+
// Next.js devtools
|
|
1791
|
+
"polyfill"
|
|
1792
|
+
// Polyfills
|
|
1793
|
+
];
|
|
1794
|
+
if (definitelyInternalPatterns.some((pattern) => filename.includes(pattern))) {
|
|
1795
|
+
return null;
|
|
1796
|
+
}
|
|
1797
|
+
let jsContent;
|
|
1798
|
+
if (isServerChunk) {
|
|
1799
|
+
const fsPath = path2.join(projectRoot, bundledPath.replace(/^\//, ""));
|
|
1800
|
+
const resolvedPath = path2.resolve(fsPath);
|
|
1801
|
+
const resolvedRoot = path2.resolve(projectRoot);
|
|
1802
|
+
if (!resolvedPath.startsWith(resolvedRoot)) {
|
|
1803
|
+
console.error(
|
|
1804
|
+
`[SourceMap] Path traversal attempt detected: ${bundledPath}`
|
|
1805
|
+
);
|
|
1806
|
+
return null;
|
|
1807
|
+
}
|
|
1808
|
+
if (!fs.existsSync(fsPath)) {
|
|
1809
|
+
console.error(`[SourceMap] Server chunk file not found: ${fsPath}`);
|
|
1810
|
+
return null;
|
|
1811
|
+
}
|
|
1812
|
+
jsContent = fs.readFileSync(fsPath, "utf-8");
|
|
1813
|
+
} else {
|
|
1814
|
+
const fileUrl = `${devServerUrl}${bundledPath.startsWith("/") ? bundledPath : "/" + bundledPath}`;
|
|
1815
|
+
try {
|
|
1816
|
+
const response2 = await fetch(fileUrl);
|
|
1817
|
+
if (!response2.ok) {
|
|
1818
|
+
console.error(
|
|
1819
|
+
`[SourceMap] Failed to fetch JS file: ${response2.status} ${response2.statusText}`
|
|
1820
|
+
);
|
|
1821
|
+
return null;
|
|
1822
|
+
}
|
|
1823
|
+
jsContent = await response2.text();
|
|
1824
|
+
} catch (fetchError) {
|
|
1825
|
+
console.error(
|
|
1826
|
+
`[SourceMap] Network error fetching JS file:`,
|
|
1827
|
+
fetchError
|
|
1828
|
+
);
|
|
1829
|
+
return null;
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
const sourceMappingURL = extractSourceMappingURL(jsContent);
|
|
1833
|
+
if (!sourceMappingURL) {
|
|
1834
|
+
console.error(`[SourceMap] No sourceMappingURL found in ${bundledPath}`);
|
|
1835
|
+
return null;
|
|
1836
|
+
}
|
|
1837
|
+
const baseCacheKey = `${bundledPath}:${sourceMappingURL}`;
|
|
1838
|
+
const rawMapCacheKey = `${baseCacheKey}:raw`;
|
|
1839
|
+
let sourceMapJson = cacheGet(rawMapCacheKey);
|
|
1840
|
+
let tracer = null;
|
|
1841
|
+
if (sourceMapJson === null) {
|
|
1842
|
+
return null;
|
|
1843
|
+
}
|
|
1844
|
+
if (sourceMapJson === void 0) {
|
|
1845
|
+
const sourceMapContent = await loadSourceMap(
|
|
1846
|
+
projectRoot,
|
|
1847
|
+
devServerUrl,
|
|
1848
|
+
bundledPath,
|
|
1849
|
+
sourceMappingURL
|
|
1850
|
+
);
|
|
1851
|
+
if (!sourceMapContent) {
|
|
1852
|
+
cacheSet(rawMapCacheKey, null);
|
|
1853
|
+
return null;
|
|
1854
|
+
}
|
|
1855
|
+
try {
|
|
1856
|
+
sourceMapJson = JSON.parse(sourceMapContent);
|
|
1857
|
+
if (!sourceMapJson || typeof sourceMapJson !== "object") {
|
|
1858
|
+
console.error(
|
|
1859
|
+
`[SourceMap] Invalid source map structure (not an object)`
|
|
1860
|
+
);
|
|
1861
|
+
cacheSet(rawMapCacheKey, null);
|
|
1862
|
+
return null;
|
|
1863
|
+
}
|
|
1864
|
+
if (!sourceMapJson.mappings && !sourceMapJson.sections && sourceMapJson.version !== 3) {
|
|
1865
|
+
console.error(
|
|
1866
|
+
`[SourceMap] Invalid source map: missing mappings/sections or wrong version`
|
|
1867
|
+
);
|
|
1868
|
+
console.error(
|
|
1869
|
+
`[SourceMap] Available fields:`,
|
|
1870
|
+
Object.keys(sourceMapJson)
|
|
1871
|
+
);
|
|
1872
|
+
cacheSet(rawMapCacheKey, null);
|
|
1873
|
+
return null;
|
|
1874
|
+
}
|
|
1875
|
+
if (sourceMapJson.sections) {
|
|
1876
|
+
if (!Array.isArray(sourceMapJson.sections)) {
|
|
1877
|
+
console.error(
|
|
1878
|
+
`[SourceMap] Invalid indexed source map: sections is not an array`
|
|
1879
|
+
);
|
|
1880
|
+
cacheSet(rawMapCacheKey, null);
|
|
1881
|
+
return null;
|
|
1882
|
+
}
|
|
1883
|
+
for (let i = 0; i < sourceMapJson.sections.length; i++) {
|
|
1884
|
+
const section = sourceMapJson.sections[i];
|
|
1885
|
+
if (!section.offset) {
|
|
1886
|
+
console.error(
|
|
1887
|
+
`[SourceMap] Section ${i} missing offset:`,
|
|
1888
|
+
JSON.stringify(section).substring(0, 200)
|
|
1889
|
+
);
|
|
1890
|
+
cacheSet(rawMapCacheKey, null);
|
|
1891
|
+
return null;
|
|
1892
|
+
}
|
|
1893
|
+
if (!section.map && !section.url) {
|
|
1894
|
+
console.error(
|
|
1895
|
+
`[SourceMap] Section ${i} missing both map and url:`,
|
|
1896
|
+
JSON.stringify(section).substring(0, 200)
|
|
1897
|
+
);
|
|
1898
|
+
cacheSet(rawMapCacheKey, null);
|
|
1899
|
+
return null;
|
|
1900
|
+
}
|
|
1901
|
+
if (section.url) {
|
|
1902
|
+
console.error(
|
|
1903
|
+
`[SourceMap] Section ${i} uses 'url' reference (not supported yet): ${section.url}`
|
|
1904
|
+
);
|
|
1905
|
+
cacheSet(rawMapCacheKey, null);
|
|
1906
|
+
return null;
|
|
1907
|
+
}
|
|
1908
|
+
if (section.map) {
|
|
1909
|
+
if (!section.map.version) {
|
|
1910
|
+
console.error(`[SourceMap] Section ${i}.map missing version`);
|
|
1911
|
+
cacheSet(rawMapCacheKey, null);
|
|
1912
|
+
return null;
|
|
1913
|
+
}
|
|
1914
|
+
if (typeof section.map.mappings !== "string") {
|
|
1915
|
+
console.error(
|
|
1916
|
+
`[SourceMap] Section ${i}.map has invalid mappings type: ${typeof section.map.mappings}`
|
|
1917
|
+
);
|
|
1918
|
+
cacheSet(rawMapCacheKey, null);
|
|
1919
|
+
return null;
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
if (Array.isArray(sourceMapJson.sources) && sourceMapJson.sources.length === 0) {
|
|
1924
|
+
delete sourceMapJson.sources;
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
try {
|
|
1928
|
+
if (sourceMapJson.sections) {
|
|
1929
|
+
let matchingSection = null;
|
|
1930
|
+
let sectionIndex = -1;
|
|
1931
|
+
for (let i = 0; i < sourceMapJson.sections.length; i++) {
|
|
1932
|
+
const section = sourceMapJson.sections[i];
|
|
1933
|
+
const sectionLine = section.offset.line;
|
|
1934
|
+
const sectionColumn = section.offset.column;
|
|
1935
|
+
if (line > sectionLine || line === sectionLine && column >= sectionColumn) {
|
|
1936
|
+
matchingSection = section;
|
|
1937
|
+
sectionIndex = i;
|
|
1938
|
+
} else {
|
|
1939
|
+
break;
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
if (!matchingSection || !matchingSection.map) {
|
|
1943
|
+
return null;
|
|
1944
|
+
}
|
|
1945
|
+
const relativeLine = line - matchingSection.offset.line;
|
|
1946
|
+
const relativeColumn = line === matchingSection.offset.line ? column - matchingSection.offset.column : column;
|
|
1947
|
+
tracer = new TraceMap(matchingSection.map);
|
|
1948
|
+
const sectionCacheKey = `${baseCacheKey}:section${sectionIndex}`;
|
|
1949
|
+
cacheSet(sectionCacheKey, tracer);
|
|
1950
|
+
line = relativeLine;
|
|
1951
|
+
column = relativeColumn;
|
|
1952
|
+
} else {
|
|
1953
|
+
tracer = new TraceMap(sourceMapJson);
|
|
1954
|
+
cacheSet(baseCacheKey, tracer);
|
|
1955
|
+
}
|
|
1956
|
+
if (!cacheGet(rawMapCacheKey)) {
|
|
1957
|
+
cacheSet(rawMapCacheKey, sourceMapJson);
|
|
1958
|
+
}
|
|
1959
|
+
} catch (traceMapError) {
|
|
1960
|
+
console.error(
|
|
1961
|
+
`[SourceMap] TraceMap construction failed:`,
|
|
1962
|
+
traceMapError.message
|
|
1963
|
+
);
|
|
1964
|
+
console.error(
|
|
1965
|
+
`[SourceMap] Source map structure:`,
|
|
1966
|
+
JSON.stringify(
|
|
1967
|
+
{
|
|
1968
|
+
version: sourceMapJson.version,
|
|
1969
|
+
hasMapping: !!sourceMapJson.mappings,
|
|
1970
|
+
hasSections: !!sourceMapJson.sections,
|
|
1971
|
+
sectionsCount: sourceMapJson.sections?.length,
|
|
1972
|
+
sourcesCount: sourceMapJson.sources?.length
|
|
1973
|
+
},
|
|
1974
|
+
null,
|
|
1975
|
+
2
|
|
1976
|
+
)
|
|
1977
|
+
);
|
|
1978
|
+
cacheSet(rawMapCacheKey, null);
|
|
1979
|
+
return null;
|
|
1980
|
+
}
|
|
1981
|
+
} catch (parseError) {
|
|
1982
|
+
console.error(`[SourceMap] Error parsing source map:`, parseError);
|
|
1983
|
+
console.error(
|
|
1984
|
+
`[SourceMap] Source map content preview:`,
|
|
1985
|
+
sourceMapContent.substring(0, 500)
|
|
1986
|
+
);
|
|
1987
|
+
cacheSet(rawMapCacheKey, null);
|
|
1988
|
+
return null;
|
|
1989
|
+
}
|
|
1990
|
+
} else {
|
|
1991
|
+
if (sourceMapJson.sections) {
|
|
1992
|
+
let matchingSection = null;
|
|
1993
|
+
let sectionIndex = -1;
|
|
1994
|
+
for (let i = 0; i < sourceMapJson.sections.length; i++) {
|
|
1995
|
+
const section = sourceMapJson.sections[i];
|
|
1996
|
+
if (line > section.offset.line || line === section.offset.line && column >= section.offset.column) {
|
|
1997
|
+
matchingSection = section;
|
|
1998
|
+
sectionIndex = i;
|
|
1999
|
+
} else {
|
|
2000
|
+
break;
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
if (matchingSection) {
|
|
2004
|
+
const sectionCacheKey = `${baseCacheKey}:section${sectionIndex}`;
|
|
2005
|
+
tracer = cacheGet(sectionCacheKey);
|
|
2006
|
+
const relativeLine = line - matchingSection.offset.line;
|
|
2007
|
+
const relativeColumn = line === matchingSection.offset.line ? column - matchingSection.offset.column : column;
|
|
2008
|
+
if (!tracer) {
|
|
2009
|
+
tracer = new TraceMap(matchingSection.map);
|
|
2010
|
+
cacheSet(sectionCacheKey, tracer);
|
|
2011
|
+
}
|
|
2012
|
+
line = relativeLine;
|
|
2013
|
+
column = relativeColumn;
|
|
2014
|
+
}
|
|
2015
|
+
} else {
|
|
2016
|
+
tracer = cacheGet(baseCacheKey);
|
|
2017
|
+
if (!tracer) {
|
|
2018
|
+
tracer = new TraceMap(sourceMapJson);
|
|
2019
|
+
cacheSet(baseCacheKey, tracer);
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
if (!tracer) {
|
|
2024
|
+
return null;
|
|
2025
|
+
}
|
|
2026
|
+
const original = originalPositionFor(tracer, {
|
|
2027
|
+
line,
|
|
2028
|
+
column
|
|
2029
|
+
});
|
|
2030
|
+
if (!original || !original.source || original.line === null || original.column === null) {
|
|
2031
|
+
return null;
|
|
2032
|
+
}
|
|
2033
|
+
let cleanSource = original.source;
|
|
2034
|
+
if (cleanSource.startsWith("webpack://")) {
|
|
2035
|
+
cleanSource = cleanSource.replace(/^webpack:\/\/[^/]*\//, "");
|
|
2036
|
+
}
|
|
2037
|
+
if (cleanSource.startsWith("./")) {
|
|
2038
|
+
cleanSource = cleanSource.substring(2);
|
|
2039
|
+
}
|
|
2040
|
+
if (cleanSource.startsWith("file://")) {
|
|
2041
|
+
cleanSource = decodeURIComponent(cleanSource.replace(/^file:\/\//, ""));
|
|
2042
|
+
if (cleanSource.startsWith(projectRoot)) {
|
|
2043
|
+
cleanSource = cleanSource.substring(projectRoot.length);
|
|
2044
|
+
if (cleanSource.startsWith("/")) {
|
|
2045
|
+
cleanSource = cleanSource.substring(1);
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
const isFrameworkCode = cleanSource.includes("/node_modules/") || cleanSource.includes("react-dom") || cleanSource.includes("react-server") || cleanSource.includes("next/dist/") || cleanSource.includes("@swc/helpers") || cleanSource.includes("scheduler");
|
|
2050
|
+
if (isFrameworkCode) {
|
|
2051
|
+
return null;
|
|
2052
|
+
}
|
|
2053
|
+
const result = {
|
|
2054
|
+
source: cleanSource,
|
|
2055
|
+
line: original.line,
|
|
2056
|
+
column: original.column,
|
|
2057
|
+
name: original.name || void 0
|
|
2058
|
+
};
|
|
2059
|
+
return result;
|
|
2060
|
+
} catch (error) {
|
|
2061
|
+
console.error(`[SourceMap] Error resolving source location:`, error);
|
|
2062
|
+
return null;
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
async function batchResolveSourceLocations(projectRoot, devServerUrl, locations) {
|
|
2066
|
+
const requestMap = /* @__PURE__ */ new Map();
|
|
2067
|
+
locations.forEach((loc, index) => {
|
|
2068
|
+
const key = `${loc.bundledPath}:${loc.line}:${loc.column}`;
|
|
2069
|
+
if (requestMap.has(key)) {
|
|
2070
|
+
requestMap.get(key).indices.push(index);
|
|
2071
|
+
} else {
|
|
2072
|
+
requestMap.set(key, { indices: [index], request: loc });
|
|
2073
|
+
}
|
|
2074
|
+
});
|
|
2075
|
+
const uniqueResults = /* @__PURE__ */ new Map();
|
|
2076
|
+
for (const [key, { request: request2 }] of requestMap) {
|
|
2077
|
+
const resolved = await resolveSourceLocation(
|
|
2078
|
+
projectRoot,
|
|
2079
|
+
devServerUrl,
|
|
2080
|
+
request2.bundledPath,
|
|
2081
|
+
request2.line,
|
|
2082
|
+
request2.column
|
|
2083
|
+
);
|
|
2084
|
+
uniqueResults.set(key, resolved);
|
|
2085
|
+
}
|
|
2086
|
+
const results = [];
|
|
2087
|
+
for (let i = 0; i < locations.length; i++) {
|
|
2088
|
+
const loc = locations[i];
|
|
2089
|
+
const key = `${loc.bundledPath}:${loc.line}:${loc.column}`;
|
|
2090
|
+
results.push(uniqueResults.get(key) || null);
|
|
2091
|
+
}
|
|
2092
|
+
return results;
|
|
2093
|
+
}
|
|
2094
|
+
var fs, path2, MAX_CACHE_SIZE, CACHE_STATS, traceMapCache;
|
|
2095
|
+
var init_source_map_resolver = __esm({
|
|
2096
|
+
"packages/dev-tools/server/source-map-resolver.ts"() {
|
|
2097
|
+
"use strict";
|
|
2098
|
+
init_trace_mapping();
|
|
2099
|
+
fs = __toESM(require("fs"), 1);
|
|
2100
|
+
path2 = __toESM(require("path"), 1);
|
|
2101
|
+
MAX_CACHE_SIZE = 500;
|
|
2102
|
+
CACHE_STATS = { hits: 0, misses: 0 };
|
|
2103
|
+
traceMapCache = /* @__PURE__ */ new Map();
|
|
2104
|
+
}
|
|
2105
|
+
});
|
|
2106
|
+
|
|
1186
2107
|
// packages/dev-tools/server/dev-tools-api.ts
|
|
1187
2108
|
async function handleDevApiRequest(ctx, apiReq) {
|
|
1188
2109
|
const result = {
|
|
@@ -1306,6 +2227,26 @@ async function handleDevApiRequest(ctx, apiReq) {
|
|
|
1306
2227
|
result.data = await readConfigFile();
|
|
1307
2228
|
break;
|
|
1308
2229
|
}
|
|
2230
|
+
case "resolveSourceMap": {
|
|
2231
|
+
const projectRoot = ctx.getAppRootDir();
|
|
2232
|
+
const devServerUrl = "http://localhost:3000";
|
|
2233
|
+
if (Array.isArray(apiReq.data)) {
|
|
2234
|
+
result.data = await batchResolveSourceLocations(
|
|
2235
|
+
projectRoot,
|
|
2236
|
+
devServerUrl,
|
|
2237
|
+
apiReq.data
|
|
2238
|
+
);
|
|
2239
|
+
} else {
|
|
2240
|
+
result.data = await resolveSourceLocation(
|
|
2241
|
+
projectRoot,
|
|
2242
|
+
devServerUrl,
|
|
2243
|
+
apiReq.data.bundledPath,
|
|
2244
|
+
apiReq.data.line,
|
|
2245
|
+
apiReq.data.column
|
|
2246
|
+
);
|
|
2247
|
+
}
|
|
2248
|
+
break;
|
|
2249
|
+
}
|
|
1309
2250
|
default: {
|
|
1310
2251
|
result.errors = [`Unknown request type: ${JSON.stringify(apiReq)}`];
|
|
1311
2252
|
const _exhaustiveCheck = apiReq;
|
|
@@ -1314,15 +2255,15 @@ async function handleDevApiRequest(ctx, apiReq) {
|
|
|
1314
2255
|
}
|
|
1315
2256
|
return result;
|
|
1316
2257
|
}
|
|
1317
|
-
function isValidFileRequest(sys2,
|
|
1318
|
-
if (!
|
|
2258
|
+
function isValidFileRequest(sys2, path3) {
|
|
2259
|
+
if (!path3) {
|
|
1319
2260
|
return false;
|
|
1320
2261
|
}
|
|
1321
|
-
if (
|
|
2262
|
+
if (path3.includes("..")) {
|
|
1322
2263
|
return false;
|
|
1323
2264
|
}
|
|
1324
|
-
|
|
1325
|
-
const parts =
|
|
2265
|
+
path3 = path3.replace(/\\/g, "/");
|
|
2266
|
+
const parts = path3.split("/");
|
|
1326
2267
|
const last = parts[parts.length - 1];
|
|
1327
2268
|
if (last.length > 0) {
|
|
1328
2269
|
let ext = last.split(".").pop();
|
|
@@ -1334,7 +2275,7 @@ function isValidFileRequest(sys2, path2) {
|
|
|
1334
2275
|
}
|
|
1335
2276
|
}
|
|
1336
2277
|
}
|
|
1337
|
-
if (!validatePath(sys2,
|
|
2278
|
+
if (!validatePath(sys2, path3)) {
|
|
1338
2279
|
return false;
|
|
1339
2280
|
}
|
|
1340
2281
|
return false;
|
|
@@ -1372,6 +2313,7 @@ var init_dev_tools_api = __esm({
|
|
|
1372
2313
|
init_typescript();
|
|
1373
2314
|
init_node_sys();
|
|
1374
2315
|
init_builder_connect();
|
|
2316
|
+
init_source_map_resolver();
|
|
1375
2317
|
EXT_WHITELIST = [
|
|
1376
2318
|
".js",
|
|
1377
2319
|
".jsx",
|
|
@@ -1409,7 +2351,7 @@ var init_dev_tools_api = __esm({
|
|
|
1409
2351
|
|
|
1410
2352
|
// packages/dev-tools/server/client-script.ts
|
|
1411
2353
|
async function getClientScript(ctx) {
|
|
1412
|
-
return updateClientRuntimeVariables(ctx, '"use strict";\n(() => {\n var __create = Object.create;\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __getProtoOf = Object.getPrototypeOf;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n };\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === "object" || typeof from === "function") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. "__esModule" has not been set), then set\n // "default" to the CommonJS "module.exports" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,\n mod\n ));\n\n // node_modules/@amplitude/ua-parser-js/src/ua-parser.js\n var require_ua_parser = __commonJS({\n "node_modules/@amplitude/ua-parser-js/src/ua-parser.js"(exports, module) {\n (function(window2, undefined2) {\n "use strict";\n var LIBVERSION = "0.7.33", EMPTY = "", UNKNOWN = "?", FUNC_TYPE = "function", UNDEF_TYPE = "undefined", OBJ_TYPE = "object", STR_TYPE = "string", MAJOR = "major", MODEL = "model", NAME = "name", TYPE = "type", VENDOR = "vendor", VERSION2 = "version", ARCHITECTURE = "architecture", CONSOLE = "console", MOBILE = "mobile", TABLET = "tablet", SMARTTV = "smarttv", WEARABLE = "wearable", EMBEDDED = "embedded", UA_MAX_LENGTH = 350;\n var AMAZON = "Amazon", APPLE = "Apple", ASUS = "ASUS", BLACKBERRY = "BlackBerry", BROWSER = "Browser", CHROME = "Chrome", EDGE = "Edge", FIREFOX = "Firefox", GOOGLE = "Google", HUAWEI = "Huawei", LG = "LG", MICROSOFT = "Microsoft", MOTOROLA = "Motorola", OPERA = "Opera", SAMSUNG = "Samsung", SHARP = "Sharp", SONY = "Sony", XIAOMI = "Xiaomi", ZEBRA = "Zebra", FACEBOOK = "Facebook";\n var extend = function(regexes2, extensions) {\n var mergedRegexes = {};\n for (var i in regexes2) {\n if (extensions[i] && extensions[i].length % 2 === 0) {\n mergedRegexes[i] = extensions[i].concat(regexes2[i]);\n } else {\n mergedRegexes[i] = regexes2[i];\n }\n }\n return mergedRegexes;\n }, enumerize = function(arr) {\n var enums = {};\n for (var i = 0; i < arr.length; i++) {\n enums[arr[i].toUpperCase()] = arr[i];\n }\n return enums;\n }, has = function(str1, str2) {\n return typeof str1 === STR_TYPE ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false;\n }, lowerize = function(str) {\n return str.toLowerCase();\n }, majorize = function(version) {\n return typeof version === STR_TYPE ? version.replace(/[^\\d\\.]/g, EMPTY).split(".")[0] : undefined2;\n }, trim = function(str, len) {\n if (typeof str === STR_TYPE) {\n str = str.replace(/^\\s\\s*/, EMPTY);\n return typeof len === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);\n }\n };\n var rgxMapper = function(ua, arrays) {\n var i = 0, j, k, p, q, matches, match;\n while (i < arrays.length && !matches) {\n var regex = arrays[i], props = arrays[i + 1];\n j = k = 0;\n while (j < regex.length && !matches) {\n matches = regex[j++].exec(ua);\n if (!!matches) {\n for (p = 0; p < props.length; p++) {\n match = matches[++k];\n q = props[p];\n if (typeof q === OBJ_TYPE && q.length > 0) {\n if (q.length === 2) {\n if (typeof q[1] == FUNC_TYPE) {\n this[q[0]] = q[1].call(this, match);\n } else {\n this[q[0]] = q[1];\n }\n } else if (q.length === 3) {\n if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {\n this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined2;\n } else {\n this[q[0]] = match ? match.replace(q[1], q[2]) : undefined2;\n }\n } else if (q.length === 4) {\n this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined2;\n }\n } else {\n this[q] = match ? match : undefined2;\n }\n }\n }\n }\n i += 2;\n }\n }, strMapper = function(str, map) {\n for (var i in map) {\n if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {\n for (var j = 0; j < map[i].length; j++) {\n if (has(map[i][j], str)) {\n return i === UNKNOWN ? undefined2 : i;\n }\n }\n } else if (has(map[i], str)) {\n return i === UNKNOWN ? undefined2 : i;\n }\n }\n return str;\n };\n var oldSafariMap = {\n "1.0": "/8",\n 1.2: "/1",\n 1.3: "/3",\n "2.0": "/412",\n "2.0.2": "/416",\n "2.0.3": "/417",\n "2.0.4": "/419",\n "?": "/"\n }, windowsVersionMap = {\n ME: "4.90",\n "NT 3.11": "NT3.51",\n "NT 4.0": "NT4.0",\n 2e3: "NT 5.0",\n XP: ["NT 5.1", "NT 5.2"],\n Vista: "NT 6.0",\n 7: "NT 6.1",\n 8: "NT 6.2",\n 8.1: "NT 6.3",\n 10: ["NT 6.4", "NT 10.0"],\n RT: "ARM"\n };\n var regexes = {\n browser: [\n [\n /\\b(?:crmo|crios)\\/([\\w\\.]+)/i\n // Chrome for Android/iOS\n ],\n [VERSION2, [NAME, "Chrome"]],\n [\n /edg(?:e|ios|a)?\\/([\\w\\.]+)/i\n // Microsoft Edge\n ],\n [VERSION2, [NAME, "Edge"]],\n [\n // Presto based\n /(opera mini)\\/([-\\w\\.]+)/i,\n // Opera Mini\n /(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i,\n // Opera Mobi/Tablet\n /(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i\n // Opera\n ],\n [NAME, VERSION2],\n [\n /opios[\\/ ]+([\\w\\.]+)/i\n // Opera mini on iphone >= 8.0\n ],\n [VERSION2, [NAME, OPERA + " Mini"]],\n [\n /\\bopr\\/([\\w\\.]+)/i\n // Opera Webkit\n ],\n [VERSION2, [NAME, OPERA]],\n [\n // Mixed\n /(kindle)\\/([\\w\\.]+)/i,\n // Kindle\n /(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i,\n // Lunascape/Maxthon/Netfront/Jasmine/Blazer\n // Trident based\n /(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i,\n // Avant/IEMobile/SlimBrowser\n /(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i,\n // Baidu Browser\n /(?:ms|\\()(ie) ([\\w\\.]+)/i,\n // Internet Explorer\n // Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon\n /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\\/([-\\w\\.]+)/i,\n // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ\n /(weibo)__([\\d\\.]+)/i\n // Weibo\n ],\n [NAME, VERSION2],\n [\n /(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i\n // UCBrowser\n ],\n [VERSION2, [NAME, "UC" + BROWSER]],\n [\n /microm.+\\bqbcore\\/([\\w\\.]+)/i,\n // WeChat Desktop for Windows Built-in Browser\n /\\bqbcore\\/([\\w\\.]+).+microm/i\n ],\n [VERSION2, [NAME, "WeChat(Win) Desktop"]],\n [\n /micromessenger\\/([\\w\\.]+)/i\n // WeChat\n ],\n [VERSION2, [NAME, "WeChat"]],\n [\n /konqueror\\/([\\w\\.]+)/i\n // Konqueror\n ],\n [VERSION2, [NAME, "Konqueror"]],\n [\n /trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i\n // IE11\n ],\n [VERSION2, [NAME, "IE"]],\n [\n /yabrowser\\/([\\w\\.]+)/i\n // Yandex\n ],\n [VERSION2, [NAME, "Yandex"]],\n [\n /(avast|avg)\\/([\\w\\.]+)/i\n // Avast/AVG Secure Browser\n ],\n [[NAME, /(.+)/, "$1 Secure " + BROWSER], VERSION2],\n [\n /\\bfocus\\/([\\w\\.]+)/i\n // Firefox Focus\n ],\n [VERSION2, [NAME, FIREFOX + " Focus"]],\n [\n /\\bopt\\/([\\w\\.]+)/i\n // Opera Touch\n ],\n [VERSION2, [NAME, OPERA + " Touch"]],\n [\n /coc_coc\\w+\\/([\\w\\.]+)/i\n // Coc Coc Browser\n ],\n [VERSION2, [NAME, "Coc Coc"]],\n [\n /dolfin\\/([\\w\\.]+)/i\n // Dolphin\n ],\n [VERSION2, [NAME, "Dolphin"]],\n [\n /coast\\/([\\w\\.]+)/i\n // Opera Coast\n ],\n [VERSION2, [NAME, OPERA + " Coast"]],\n [\n /miuibrowser\\/([\\w\\.]+)/i\n // MIUI Browser\n ],\n [VERSION2, [NAME, "MIUI " + BROWSER]],\n [\n /fxios\\/([-\\w\\.]+)/i\n // Firefox for iOS\n ],\n [VERSION2, [NAME, FIREFOX]],\n [\n /\\bqihu|(qi?ho?o?|360)browser/i\n // 360\n ],\n [[NAME, "360 " + BROWSER]],\n [/(oculus|samsung|sailfish|huawei)browser\\/([\\w\\.]+)/i],\n [[NAME, /(.+)/, "$1 " + BROWSER], VERSION2],\n [\n // Oculus/Samsung/Sailfish/Huawei Browser\n /(comodo_dragon)\\/([\\w\\.]+)/i\n // Comodo Dragon\n ],\n [[NAME, /_/g, " "], VERSION2],\n [\n /(electron)\\/([\\w\\.]+) safari/i,\n // Electron-based App\n /(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i,\n // Tesla\n /m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i\n // QQBrowser/Baidu App/2345 Browser\n ],\n [NAME, VERSION2],\n [\n /(metasr)[\\/ ]?([\\w\\.]+)/i,\n // SouGouBrowser\n /(lbbrowser)/i,\n // LieBao Browser\n /\\[(linkedin)app\\]/i\n // LinkedIn App for iOS & Android\n ],\n [NAME],\n [\n // WebView\n /((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i\n // Facebook App for iOS & Android\n ],\n [[NAME, FACEBOOK], VERSION2],\n [\n /safari (line)\\/([\\w\\.]+)/i,\n // Line App for iOS\n /\\b(line)\\/([\\w\\.]+)\\/iab/i,\n // Line App for Android\n /(chromium|instagram)[\\/ ]([-\\w\\.]+)/i\n // Chromium/Instagram\n ],\n [NAME, VERSION2],\n [\n /\\bgsa\\/([\\w\\.]+) .*safari\\//i\n // Google Search Appliance on iOS\n ],\n [VERSION2, [NAME, "GSA"]],\n [\n /headlesschrome(?:\\/([\\w\\.]+)| )/i\n // Chrome Headless\n ],\n [VERSION2, [NAME, CHROME + " Headless"]],\n [\n / wv\\).+(chrome)\\/([\\w\\.]+)/i\n // Chrome WebView\n ],\n [[NAME, CHROME + " WebView"], VERSION2],\n [\n /droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i\n // Android Browser\n ],\n [VERSION2, [NAME, "Android " + BROWSER]],\n [\n /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i\n // Chrome/OmniWeb/Arora/Tizen/Nokia\n ],\n [NAME, VERSION2],\n [\n /version\\/([\\w\\.\\,]+) .*mobile\\/\\w+ (safari)/i\n // Mobile Safari\n ],\n [VERSION2, [NAME, "Mobile Safari"]],\n [\n /version\\/([\\w(\\.|\\,)]+) .*(mobile ?safari|safari)/i\n // Safari & Safari Mobile\n ],\n [VERSION2, NAME],\n [\n /webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i\n // Safari < 3.0\n ],\n [NAME, [VERSION2, strMapper, oldSafariMap]],\n [/(webkit|khtml)\\/([\\w\\.]+)/i],\n [NAME, VERSION2],\n [\n // Gecko based\n /(navigator|netscape\\d?)\\/([-\\w\\.]+)/i\n // Netscape\n ],\n [[NAME, "Netscape"], VERSION2],\n [\n /mobile vr; rv:([\\w\\.]+)\\).+firefox/i\n // Firefox Reality\n ],\n [VERSION2, [NAME, FIREFOX + " Reality"]],\n [\n /ekiohf.+(flow)\\/([\\w\\.]+)/i,\n // Flow\n /(swiftfox)/i,\n // Swiftfox\n /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,\n // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar\n /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,\n // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix\n /(firefox)\\/([\\w\\.]+)/i,\n // Other Firefox-based\n /(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i,\n // Mozilla\n // Other\n /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,\n // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser\n /(links) \\(([\\w\\.]+)/i\n // Links\n ],\n [NAME, VERSION2],\n [\n /(cobalt)\\/([\\w\\.]+)/i\n // Cobalt\n ],\n [NAME, [VERSION2, /master.|lts./, ""]]\n ],\n cpu: [\n [\n /(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i\n // AMD64 (x64)\n ],\n [[ARCHITECTURE, "amd64"]],\n [\n /(ia32(?=;))/i\n // IA32 (quicktime)\n ],\n [[ARCHITECTURE, lowerize]],\n [\n /((?:i[346]|x)86)[;\\)]/i\n // IA32 (x86)\n ],\n [[ARCHITECTURE, "ia32"]],\n [\n /\\b(aarch64|arm(v?8e?l?|_?64))\\b/i\n // ARM64\n ],\n [[ARCHITECTURE, "arm64"]],\n [\n /\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i\n // ARMHF\n ],\n [[ARCHITECTURE, "armhf"]],\n [\n // PocketPC mistakenly identified as PowerPC\n /windows (ce|mobile); ppc;/i\n ],\n [[ARCHITECTURE, "arm"]],\n [\n /((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i\n // PowerPC\n ],\n [[ARCHITECTURE, /ower/, EMPTY, lowerize]],\n [\n /(sun4\\w)[;\\)]/i\n // SPARC\n ],\n [[ARCHITECTURE, "sparc"]],\n [\n /((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i\n // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC\n ],\n [[ARCHITECTURE, lowerize]]\n ],\n device: [\n [\n //////////////////////////\n // MOBILES & TABLETS\n // Ordered by popularity\n /////////////////////////\n // Samsung\n /\\b(sch-i[89]0\\d|shw-m380s|sm-[ptx]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i\n ],\n [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]],\n [\n /\\b((?:s[cgp]h|gt|sm)-\\w+|galaxy nexus)/i,\n /samsung[- ]([-\\w]+)/i,\n /sec-(sgh\\w+)/i\n ],\n [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]],\n [\n // Apple\n /((ipod|iphone)\\d+,\\d+)/i\n // iPod/iPhone model\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]],\n [\n /(ipad\\d+,\\d+)/i\n // iPad model\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, TABLET]],\n [\n /\\((ip(?:hone|od)[\\w ]*);/i\n // iPod/iPhone\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]],\n [\n /\\((ipad);[-\\w\\),; ]+apple/i,\n // iPad\n /applecoremedia\\/[\\w\\.]+ \\((ipad)/i,\n /\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, TABLET]],\n [/(macintosh);/i],\n [MODEL, [VENDOR, APPLE]],\n [\n // Huawei\n /\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i\n ],\n [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]],\n [\n /(?:huawei|honor)([-\\w ]+)[;\\)]/i,\n /\\b(nexus 6p|\\w{2,4}e?-[atu]?[ln][\\dx][012359c][adn]?)\\b(?!.+d\\/s)/i\n ],\n [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]],\n [\n // Xiaomi\n /\\b(poco[\\w ]+)(?: bui|\\))/i,\n // Xiaomi POCO\n /\\b; (\\w+) build\\/hm\\1/i,\n // Xiaomi Hongmi \'numeric\' models\n /\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i,\n // Xiaomi Hongmi\n /\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i,\n // Xiaomi Redmi\n /\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i\n // Xiaomi Mi\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, XIAOMI],\n [TYPE, MOBILE]\n ],\n [\n /\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i\n // Mi Pad tablets\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, XIAOMI],\n [TYPE, TABLET]\n ],\n [\n // OPPO\n /; (\\w+) bui.+ oppo/i,\n /\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i\n ],\n [MODEL, [VENDOR, "OPPO"], [TYPE, MOBILE]],\n [\n // Vivo\n /vivo (\\w+)(?: bui|\\))/i,\n /\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i\n ],\n [MODEL, [VENDOR, "Vivo"], [TYPE, MOBILE]],\n [\n // Realme\n /\\b(rmx[12]\\d{3})(?: bui|;|\\))/i\n ],\n [MODEL, [VENDOR, "Realme"], [TYPE, MOBILE]],\n [\n // Motorola\n /\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,\n /\\bmot(?:orola)?[- ](\\w*)/i,\n /((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i\n ],\n [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]],\n [/\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i],\n [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]],\n [\n // LG\n /((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i\n ],\n [MODEL, [VENDOR, LG], [TYPE, TABLET]],\n [\n /(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,\n /\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,\n /\\blg-?([\\d\\w]+) bui/i\n ],\n [MODEL, [VENDOR, LG], [TYPE, MOBILE]],\n [\n // Lenovo\n /(ideatab[-\\w ]+)/i,\n /lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i\n ],\n [MODEL, [VENDOR, "Lenovo"], [TYPE, TABLET]],\n [\n // Nokia\n /(?:maemo|nokia).*(n900|lumia \\d+)/i,\n /nokia[-_ ]?([-\\w\\.]*)/i\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, "Nokia"],\n [TYPE, MOBILE]\n ],\n [\n // Google\n /(pixel c)\\b/i\n // Google Pixel C\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]],\n [\n /droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i\n // Google Pixel\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]],\n [\n // Sony\n /droid.+ (a?\\d[0-2]{2}so|[c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i\n ],\n [MODEL, [VENDOR, SONY], [TYPE, MOBILE]],\n [/sony tablet [ps]/i, /\\b(?:sony)?sgp\\w+(?: bui|\\))/i],\n [\n [MODEL, "Xperia Tablet"],\n [VENDOR, SONY],\n [TYPE, TABLET]\n ],\n [\n // OnePlus\n / (kb2005|in20[12]5|be20[12][59])\\b/i,\n /(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i\n ],\n [MODEL, [VENDOR, "OnePlus"], [TYPE, MOBILE]],\n [\n // Amazon\n /(alexa)webm/i,\n /(kf[a-z]{2}wi)( bui|\\))/i,\n // Kindle Fire without Silk\n /(kf[a-z]+)( bui|\\)).+silk\\//i\n // Kindle Fire HD\n ],\n [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]],\n [\n /((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i\n // Fire Phone\n ],\n [\n [MODEL, /(.+)/g, "Fire Phone $1"],\n [VENDOR, AMAZON],\n [TYPE, MOBILE]\n ],\n [\n // BlackBerry\n /(playbook);[-\\w\\),; ]+(rim)/i\n // BlackBerry PlayBook\n ],\n [MODEL, VENDOR, [TYPE, TABLET]],\n [\n /\\b((?:bb[a-f]|st[hv])100-\\d)/i,\n /\\(bb10; (\\w+)/i\n // BlackBerry 10\n ],\n [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]],\n [\n // Asus\n /(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i\n ],\n [MODEL, [VENDOR, ASUS], [TYPE, TABLET]],\n [/ (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i],\n [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]],\n [\n // HTC\n /(nexus 9)/i\n // HTC Nexus 9\n ],\n [MODEL, [VENDOR, "HTC"], [TYPE, TABLET]],\n [\n /(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i,\n // HTC\n // ZTE\n /(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,\n /(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\\w]*)/i\n // Alcatel/GeeksPhone/Nexian/Panasonic/Sony\n ],\n [VENDOR, [MODEL, /_/g, " "], [TYPE, MOBILE]],\n [\n // Acer\n /droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i\n ],\n [MODEL, [VENDOR, "Acer"], [TYPE, TABLET]],\n [\n // Meizu\n /droid.+; (m[1-5] note) bui/i,\n /\\bmz-([-\\w]{2,})/i\n ],\n [MODEL, [VENDOR, "Meizu"], [TYPE, MOBILE]],\n [\n // Sharp\n /\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i\n ],\n [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]],\n [\n // MIXED\n /(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,\n // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron\n /(hp) ([\\w ]+\\w)/i,\n // HP iPAQ\n /(asus)-?(\\w+)/i,\n // Asus\n /(microsoft); (lumia[\\w ]+)/i,\n // Microsoft Lumia\n /(lenovo)[-_ ]?([-\\w]+)/i,\n // Lenovo\n /(jolla)/i,\n // Jolla\n /(oppo) ?([\\w ]+) bui/i\n // OPPO\n ],\n [VENDOR, MODEL, [TYPE, MOBILE]],\n [\n /(archos) (gamepad2?)/i,\n // Archos\n /(hp).+(touchpad(?!.+tablet)|tablet)/i,\n // HP TouchPad\n /(kindle)\\/([\\w\\.]+)/i,\n // Kindle\n /(nook)[\\w ]+build\\/(\\w+)/i,\n // Nook\n /(dell) (strea[kpr\\d ]*[\\dko])/i,\n // Dell Streak\n /(le[- ]+pan)[- ]+(\\w{1,9}) bui/i,\n // Le Pan Tablets\n /(trinity)[- ]*(t\\d{3}) bui/i,\n // Trinity Tablets\n /(gigaset)[- ]+(q\\w{1,9}) bui/i,\n // Gigaset Tablets\n /(vodafone) ([\\w ]+)(?:\\)| bui)/i\n // Vodafone\n ],\n [VENDOR, MODEL, [TYPE, TABLET]],\n [\n /(surface duo)/i\n // Surface Duo\n ],\n [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]],\n [\n /droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i\n // Fairphone\n ],\n [MODEL, [VENDOR, "Fairphone"], [TYPE, MOBILE]],\n [\n /(u304aa)/i\n // AT&T\n ],\n [MODEL, [VENDOR, "AT&T"], [TYPE, MOBILE]],\n [\n /\\bsie-(\\w*)/i\n // Siemens\n ],\n [MODEL, [VENDOR, "Siemens"], [TYPE, MOBILE]],\n [\n /\\b(rct\\w+) b/i\n // RCA Tablets\n ],\n [MODEL, [VENDOR, "RCA"], [TYPE, TABLET]],\n [\n /\\b(venue[\\d ]{2,7}) b/i\n // Dell Venue Tablets\n ],\n [MODEL, [VENDOR, "Dell"], [TYPE, TABLET]],\n [\n /\\b(q(?:mv|ta)\\w+) b/i\n // Verizon Tablet\n ],\n [MODEL, [VENDOR, "Verizon"], [TYPE, TABLET]],\n [\n /\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i\n // Barnes & Noble Tablet\n ],\n [MODEL, [VENDOR, "Barnes & Noble"], [TYPE, TABLET]],\n [/\\b(tm\\d{3}\\w+) b/i],\n [MODEL, [VENDOR, "NuVision"], [TYPE, TABLET]],\n [\n /\\b(k88) b/i\n // ZTE K Series Tablet\n ],\n [MODEL, [VENDOR, "ZTE"], [TYPE, TABLET]],\n [\n /\\b(nx\\d{3}j) b/i\n // ZTE Nubia\n ],\n [MODEL, [VENDOR, "ZTE"], [TYPE, MOBILE]],\n [\n /\\b(gen\\d{3}) b.+49h/i\n // Swiss GEN Mobile\n ],\n [MODEL, [VENDOR, "Swiss"], [TYPE, MOBILE]],\n [\n /\\b(zur\\d{3}) b/i\n // Swiss ZUR Tablet\n ],\n [MODEL, [VENDOR, "Swiss"], [TYPE, TABLET]],\n [\n /\\b((zeki)?tb.*\\b) b/i\n // Zeki Tablets\n ],\n [MODEL, [VENDOR, "Zeki"], [TYPE, TABLET]],\n [\n /\\b([yr]\\d{2}) b/i,\n /\\b(dragon[- ]+touch |dt)(\\w{5}) b/i\n // Dragon Touch Tablet\n ],\n [[VENDOR, "Dragon Touch"], MODEL, [TYPE, TABLET]],\n [\n /\\b(ns-?\\w{0,9}) b/i\n // Insignia Tablets\n ],\n [MODEL, [VENDOR, "Insignia"], [TYPE, TABLET]],\n [\n /\\b((nxa|next)-?\\w{0,9}) b/i\n // NextBook Tablets\n ],\n [MODEL, [VENDOR, "NextBook"], [TYPE, TABLET]],\n [\n /\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i\n // Voice Xtreme Phones\n ],\n [[VENDOR, "Voice"], MODEL, [TYPE, MOBILE]],\n [\n /\\b(lvtel\\-)?(v1[12]) b/i\n // LvTel Phones\n ],\n [[VENDOR, "LvTel"], MODEL, [TYPE, MOBILE]],\n [\n /\\b(ph-1) /i\n // Essential PH-1\n ],\n [MODEL, [VENDOR, "Essential"], [TYPE, MOBILE]],\n [\n /\\b(v(100md|700na|7011|917g).*\\b) b/i\n // Envizen Tablets\n ],\n [MODEL, [VENDOR, "Envizen"], [TYPE, TABLET]],\n [\n /\\b(trio[-\\w\\. ]+) b/i\n // MachSpeed Tablets\n ],\n [MODEL, [VENDOR, "MachSpeed"], [TYPE, TABLET]],\n [\n /\\btu_(1491) b/i\n // Rotor Tablets\n ],\n [MODEL, [VENDOR, "Rotor"], [TYPE, TABLET]],\n [\n /(shield[\\w ]+) b/i\n // Nvidia Shield Tablets\n ],\n [MODEL, [VENDOR, "Nvidia"], [TYPE, TABLET]],\n [\n /(sprint) (\\w+)/i\n // Sprint Phones\n ],\n [VENDOR, MODEL, [TYPE, MOBILE]],\n [\n /(kin\\.[onetw]{3})/i\n // Microsoft Kin\n ],\n [\n [MODEL, /\\./g, " "],\n [VENDOR, MICROSOFT],\n [TYPE, MOBILE]\n ],\n [\n /droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i\n // Zebra\n ],\n [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]],\n [/droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i],\n [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]],\n [\n ///////////////////\n // CONSOLES\n ///////////////////\n /(ouya)/i,\n // Ouya\n /(nintendo) ([wids3utch]+)/i\n // Nintendo\n ],\n [VENDOR, MODEL, [TYPE, CONSOLE]],\n [\n /droid.+; (shield) bui/i\n // Nvidia\n ],\n [MODEL, [VENDOR, "Nvidia"], [TYPE, CONSOLE]],\n [\n /(playstation [345portablevi]+)/i\n // Playstation\n ],\n [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]],\n [\n /\\b(xbox(?: one)?(?!; xbox))[\\); ]/i\n // Microsoft Xbox\n ],\n [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]],\n [\n ///////////////////\n // SMARTTVS\n ///////////////////\n /smart-tv.+(samsung)/i\n // Samsung\n ],\n [VENDOR, [TYPE, SMARTTV]],\n [/hbbtv.+maple;(\\d+)/i],\n [\n [MODEL, /^/, "SmartTV"],\n [VENDOR, SAMSUNG],\n [TYPE, SMARTTV]\n ],\n [\n /(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i\n // LG SmartTV\n ],\n [\n [VENDOR, LG],\n [TYPE, SMARTTV]\n ],\n [\n /(apple) ?tv/i\n // Apple TV\n ],\n [VENDOR, [MODEL, APPLE + " TV"], [TYPE, SMARTTV]],\n [\n /crkey/i\n // Google Chromecast\n ],\n [\n [MODEL, CHROME + "cast"],\n [VENDOR, GOOGLE],\n [TYPE, SMARTTV]\n ],\n [\n /droid.+aft(\\w)( bui|\\))/i\n // Fire TV\n ],\n [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]],\n [\n /\\(dtv[\\);].+(aquos)/i,\n /(aquos-tv[\\w ]+)\\)/i\n // Sharp\n ],\n [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],\n [\n /(bravia[\\w ]+)( bui|\\))/i\n // Sony\n ],\n [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]],\n [\n /(mitv-\\w{5}) bui/i\n // Xiaomi\n ],\n [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]],\n [\n /\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i,\n // Roku\n /hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w ]*; *(\\w[^;]*);([^;]*)/i\n // HbbTV devices\n ],\n [\n [VENDOR, trim],\n [MODEL, trim],\n [TYPE, SMARTTV]\n ],\n [\n /\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i\n // SmartTV from Unidentified Vendors\n ],\n [[TYPE, SMARTTV]],\n [\n ///////////////////\n // WEARABLES\n ///////////////////\n /((pebble))app/i\n // Pebble\n ],\n [VENDOR, MODEL, [TYPE, WEARABLE]],\n [\n /droid.+; (glass) \\d/i\n // Google Glass\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]],\n [/droid.+; (wt63?0{2,3})\\)/i],\n [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]],\n [\n /(quest( 2)?)/i\n // Oculus Quest\n ],\n [MODEL, [VENDOR, FACEBOOK], [TYPE, WEARABLE]],\n [\n ///////////////////\n // EMBEDDED\n ///////////////////\n /(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i\n // Tesla\n ],\n [VENDOR, [TYPE, EMBEDDED]],\n [\n ////////////////////\n // MIXED (GENERIC)\n ///////////////////\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i\n // Android Phones from Unidentified Vendors\n ],\n [MODEL, [TYPE, MOBILE]],\n [\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i\n // Android Tablets from Unidentified Vendors\n ],\n [MODEL, [TYPE, TABLET]],\n [\n /\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i\n // Unidentifiable Tablet\n ],\n [[TYPE, TABLET]],\n [\n /(phone|mobile(?:[;\\/]| [ \\w\\/\\.]*safari)|pda(?=.+windows ce))/i\n // Unidentifiable Mobile\n ],\n [[TYPE, MOBILE]],\n [\n /(android[-\\w\\. ]{0,9});.+buil/i\n // Generic Android Device\n ],\n [MODEL, [VENDOR, "Generic"]]\n ],\n engine: [\n [\n /windows.+ edge\\/([\\w\\.]+)/i\n // EdgeHTML\n ],\n [VERSION2, [NAME, EDGE + "HTML"]],\n [\n /webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i\n // Blink\n ],\n [VERSION2, [NAME, "Blink"]],\n [\n /(presto)\\/([\\w\\.]+)/i,\n // Presto\n /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i,\n // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna\n /ekioh(flow)\\/([\\w\\.]+)/i,\n // Flow\n /(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i,\n // KHTML/Tasman/Links\n /(icab)[\\/ ]([23]\\.[\\d\\.]+)/i\n // iCab\n ],\n [NAME, VERSION2],\n [\n /rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i\n // Gecko\n ],\n [VERSION2, NAME]\n ],\n os: [\n [\n // Windows\n /microsoft (windows) (vista|xp)/i\n // Windows (iTunes)\n ],\n [NAME, VERSION2],\n [\n /(windows) nt 6\\.2; (arm)/i,\n // Windows RT\n /(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i,\n // Windows Phone\n /(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i\n ],\n [NAME, [VERSION2, strMapper, windowsVersionMap]],\n [/(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i],\n [\n [NAME, "Windows"],\n [VERSION2, strMapper, windowsVersionMap]\n ],\n [\n // iOS/macOS\n /ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i,\n // iOS\n /cfnetwork\\/.+darwin/i\n ],\n [\n [VERSION2, /_/g, "."],\n [NAME, "iOS"]\n ],\n [\n /(mac os x) ?([\\w\\. ]*)/i,\n /(macintosh|mac_powerpc\\b)(?!.+haiku)/i\n // Mac OS\n ],\n [\n [NAME, "Mac OS"],\n [VERSION2, /_/g, "."]\n ],\n [\n // Mobile OSes\n /droid ([\\w\\.]+)\\b.+(android[- ]x86|harmonyos)/i\n // Android-x86/HarmonyOS\n ],\n [VERSION2, NAME],\n [\n // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS\n /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,\n /(blackberry)\\w*\\/([\\w\\.]*)/i,\n // Blackberry\n /(tizen|kaios)[\\/ ]([\\w\\.]+)/i,\n // Tizen/KaiOS\n /\\((series40);/i\n // Series 40\n ],\n [NAME, VERSION2],\n [\n /\\(bb(10);/i\n // BlackBerry 10\n ],\n [VERSION2, [NAME, BLACKBERRY]],\n [\n /(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i\n // Symbian\n ],\n [VERSION2, [NAME, "Symbian"]],\n [\n /mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i\n // Firefox OS\n ],\n [VERSION2, [NAME, FIREFOX + " OS"]],\n [\n /web0s;.+rt(tv)/i,\n /\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i\n // WebOS\n ],\n [VERSION2, [NAME, "webOS"]],\n [\n // Google Chromecast\n /crkey\\/([\\d\\.]+)/i\n // Google Chromecast\n ],\n [VERSION2, [NAME, CHROME + "cast"]],\n [\n /(cros) [\\w]+ ([\\w\\.]+\\w)/i\n // Chromium OS\n ],\n [[NAME, "Chromium OS"], VERSION2],\n [\n // Console\n /(nintendo|playstation) ([wids345portablevuch]+)/i,\n // Nintendo/Playstation\n /(xbox); +xbox ([^\\);]+)/i,\n // Microsoft Xbox (360, One, X, S, Series X, Series S)\n // Other\n /\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i,\n // Joli/Palm\n /(mint)[\\/\\(\\) ]?(\\w*)/i,\n // Mint\n /(mageia|vectorlinux)[; ]/i,\n // Mageia/VectorLinux\n /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,\n // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire\n /(hurd|linux) ?([\\w\\.]*)/i,\n // Hurd/Linux\n /(gnu) ?([\\w\\.]*)/i,\n // GNU\n /\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i,\n // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly\n /(haiku) (\\w+)/i\n // Haiku\n ],\n [NAME, VERSION2],\n [\n /(sunos) ?([\\w\\.\\d]*)/i\n // Solaris\n ],\n [[NAME, "Solaris"], VERSION2],\n [\n /((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i,\n // Solaris\n /(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i,\n // AIX\n /\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,\n // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX\n /(unix) ?([\\w\\.]*)/i\n // UNIX\n ],\n [NAME, VERSION2]\n ]\n };\n var UAParser2 = function(ua, extensions) {\n if (typeof ua === OBJ_TYPE) {\n extensions = ua;\n ua = undefined2;\n }\n if (!(this instanceof UAParser2)) {\n return new UAParser2(ua, extensions).getResult();\n }\n var _ua = ua || (typeof window2 !== UNDEF_TYPE && window2.navigator && window2.navigator.userAgent ? window2.navigator.userAgent : EMPTY);\n var _rgxmap = extensions ? extend(regexes, extensions) : regexes;\n this.getBrowser = function() {\n var _browser = {};\n _browser[NAME] = undefined2;\n _browser[VERSION2] = undefined2;\n rgxMapper.call(_browser, _ua, _rgxmap.browser);\n _browser.major = majorize(_browser.version);\n return _browser;\n };\n this.getCPU = function() {\n var _cpu = {};\n _cpu[ARCHITECTURE] = undefined2;\n rgxMapper.call(_cpu, _ua, _rgxmap.cpu);\n return _cpu;\n };\n this.getDevice = function() {\n var _device = {};\n _device[VENDOR] = undefined2;\n _device[MODEL] = undefined2;\n _device[TYPE] = undefined2;\n rgxMapper.call(_device, _ua, _rgxmap.device);\n return _device;\n };\n this.getEngine = function() {\n var _engine = {};\n _engine[NAME] = undefined2;\n _engine[VERSION2] = undefined2;\n rgxMapper.call(_engine, _ua, _rgxmap.engine);\n return _engine;\n };\n this.getOS = function() {\n var _os = {};\n _os[NAME] = undefined2;\n _os[VERSION2] = undefined2;\n rgxMapper.call(_os, _ua, _rgxmap.os);\n return _os;\n };\n this.getResult = function() {\n return {\n ua: this.getUA(),\n browser: this.getBrowser(),\n engine: this.getEngine(),\n os: this.getOS(),\n device: this.getDevice(),\n cpu: this.getCPU()\n };\n };\n this.getUA = function() {\n return _ua;\n };\n this.setUA = function(ua2) {\n _ua = typeof ua2 === STR_TYPE && ua2.length > UA_MAX_LENGTH ? trim(ua2, UA_MAX_LENGTH) : ua2;\n return this;\n };\n this.setUA(_ua);\n return this;\n };\n UAParser2.VERSION = LIBVERSION;\n UAParser2.BROWSER = enumerize([NAME, VERSION2, MAJOR]);\n UAParser2.CPU = enumerize([ARCHITECTURE]);\n UAParser2.DEVICE = enumerize([\n MODEL,\n VENDOR,\n TYPE,\n CONSOLE,\n MOBILE,\n SMARTTV,\n TABLET,\n WEARABLE,\n EMBEDDED\n ]);\n UAParser2.ENGINE = UAParser2.OS = enumerize([NAME, VERSION2]);\n if (typeof exports !== UNDEF_TYPE) {\n if (typeof module !== UNDEF_TYPE && module.exports) {\n exports = module.exports = UAParser2;\n }\n exports.UAParser = UAParser2;\n } else {\n if (typeof define === FUNC_TYPE && define.amd) {\n define(function() {\n return UAParser2;\n });\n } else if (typeof window2 !== UNDEF_TYPE) {\n window2.UAParser = UAParser2;\n }\n }\n var $ = typeof window2 !== UNDEF_TYPE && (window2.jQuery || window2.Zepto);\n if ($ && !$.ua) {\n var parser = new UAParser2();\n $.ua = parser.getResult();\n $.ua.get = function() {\n return parser.getUA();\n };\n $.ua.set = function(ua) {\n parser.setUA(ua);\n var result = parser.getResult();\n for (var prop in result) {\n $.ua[prop] = result[prop];\n }\n };\n }\n })(typeof window === "object" ? window : exports);\n }\n });\n\n // packages/dev-tools/client/utils.ts\n var goToSection = (shadow, view) => {\n closeToasts(shadow);\n const aside = shadow.querySelector("aside");\n aside.dataset.view = view;\n aside.classList.remove("section-ready");\n setTimeout(() => {\n aside.classList.add("section-ready");\n }, 200);\n };\n var initBackButtons = (shadow) => {\n Array.from(shadow.querySelectorAll(".back-button")).forEach((elm) => {\n elm.addEventListener("click", (ev) => {\n closeToasts(shadow);\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n goToSection(shadow, target?.dataset.back || "nav-home");\n });\n });\n };\n var showToast = (shadow, html) => {\n closeToasts(shadow);\n const aside = shadow.querySelector("aside");\n const toast = document.createElement("div");\n toast.className = `ui-toast`;\n toast.innerHTML = html;\n aside.appendChild(toast);\n setTimeout(() => {\n toast.classList.add("ui-toast-show");\n setTimeout(() => {\n toast.classList.remove("ui-toast-show");\n setTimeout(() => {\n toast.remove();\n }, 500);\n }, 4e3);\n }, 30);\n };\n var closeToasts = (shadow) => {\n const aside = shadow.querySelector("aside");\n const existing = Array.from(aside.querySelectorAll(".ui-toast"));\n existing.forEach((el) => {\n el.classList.remove("ui-toast-show");\n });\n };\n var isEditEnabled = () => {\n const key = getDisableEditKey();\n return localStorage.getItem(key) !== "true";\n };\n var enableEdit = (enable) => {\n const key = getDisableEditKey();\n if (enable) {\n localStorage.removeItem(key);\n } else {\n localStorage.setItem(key, "true");\n }\n };\n var getDisableEditKey = () => getLocalStorageKey("disableEdit");\n var getLocalStorageKey = (name) => `builder.__LOCAL_APP_ID__.${name}`;\n var getEditorUrl = () => {\n const contentElm = document.body.querySelector("[builder-content-id]");\n const contentId = contentElm?.getAttribute("builder-content-id");\n return getBuilderContentUrl(contentId);\n };\n var getBuilderContentUrl = (contentId, blockId) => {\n let pathname = "/content";\n if (contentId) {\n pathname += "/" + contentId + "/edit";\n }\n const url = new URL(pathname, "https://builder.io");\n if (contentId && blockId) {\n url.searchParams.set("selectedBlock", blockId);\n }\n const previewUrl = new URL(location.pathname, location.href);\n url.searchParams.set("overridePreviewUrl", previewUrl.href);\n return url.href;\n };\n var DEV_TOOLS_URL = "__DEV_TOOLS_URL__";\n var APP_STATE = {\n components: [],\n registryPath: "",\n registryDisplayPath: "",\n frameworks: [],\n dependencies: [],\n publicApiKey: void 0,\n devToolsVersion: ""\n };\n var updateAppState = (registry) => {\n APP_STATE.components = registry.components;\n APP_STATE.registryPath = registry.registryPath;\n APP_STATE.registryDisplayPath = registry.registryDisplayPath;\n APP_STATE.dependencies = registry.dependencies;\n APP_STATE.publicApiKey = registry.publicApiKey;\n };\n\n // packages/dev-tools/client/edit-button/document-listeners.ts\n function initDocumentListeners(editButton) {\n let lastBlockId = null;\n const menu = document.querySelector(\n "builder-dev-tools-menu"\n );\n const hideEditButton = () => {\n editButton.hide();\n };\n const onPointerOver = (ev) => {\n const hoverElm = ev.target;\n if (!hoverElm) {\n hideEditButton();\n return;\n }\n if (hoverElm.closest("builder-dev-tools-edit")) {\n return;\n }\n const contentElm = hoverElm.closest("[builder-content-id]");\n const blockElm = hoverElm.closest("[builder-id]");\n if (!contentElm || !blockElm) {\n editButton.hide();\n return;\n }\n const blockId = editButton.show(contentElm, blockElm);\n if (!blockId || blockId === lastBlockId) {\n return;\n }\n menu.highlightOpener();\n lastBlockId = blockId;\n };\n document.addEventListener("pointerover", onPointerOver, { passive: true });\n document.addEventListener("pointerleave", hideEditButton, {\n passive: true\n });\n document.addEventListener("pointercancel", hideEditButton, {\n passive: true\n });\n document.addEventListener("visibilitychange", hideEditButton, {\n passive: true\n });\n window.addEventListener("popstate", hideEditButton, { passive: true });\n const originalPushState = history.pushState;\n history.pushState = function(...args) {\n editButton.hide();\n originalPushState.apply(this, args);\n };\n const originalReplaceState = history.replaceState;\n history.replaceState = function(...args) {\n editButton.hide();\n originalReplaceState.apply(this, args);\n };\n }\n\n // packages/dev-tools/client/edit-button/index.ts\n var BuilderDevToolsEditButton = class extends HTMLElement {\n openInBuilder = null;\n block = null;\n constructor() {\n super();\n }\n connectedCallback() {\n this.setAttribute("aria-hidden", "true");\n const shadow = this.attachShadow({ mode: "open" });\n shadow.innerHTML = \'<style>/* packages/dev-tools/client/common.css */\\n*,\\n*::before,\\n*::after {\\n box-sizing: border-box;\\n}\\n:host {\\n --background-color: rgba(40, 40, 40, 1);\\n --primary-color: rgba(72, 161, 255, 1);\\n --primary-color-subdued: rgb(72, 161, 255, 0.6);\\n --primary-color-highlight: rgb(126, 188, 255);\\n --primary-contrast-color: white;\\n --edit-color: #1d74e2;\\n --edit-color-highlight: #1c6bd1;\\n --edit-color-alpha: rgb(72, 161, 255, 0.15);\\n --error-color: #ff2b55;\\n --text-color: white;\\n --text-color-highlight: white;\\n --border-color: #454545;\\n --button-background-color-hover: rgba(255, 255, 255, 0.1);\\n --menu-width: 320px;\\n --transition-time: 150ms;\\n --font-family:\\n ui-sans-serif,\\n system-ui,\\n -apple-system,\\n BlinkMacSystemFont,\\n "Segoe UI",\\n Roboto,\\n "Helvetica Neue",\\n Arial,\\n "Noto Sans",\\n sans-serif,\\n "Apple Color Emoji",\\n "Segoe UI Emoji",\\n "Segoe UI Symbol",\\n "Noto Color Emoji";\\n font-family: var(--font-family);\\n line-height: 1.6;\\n}\\nbutton {\\n cursor: pointer;\\n color: var(--text-color);\\n -webkit-tap-highlight-color: transparent;\\n}\\ninput,\\nselect,\\nbutton {\\n font-family: var(--font-family);\\n}\\n\\n/* packages/dev-tools/client/edit-button/edit-button.css */\\n:host {\\n display: none;\\n position: absolute;\\n top: 0;\\n left: 0;\\n width: 100%;\\n height: 100%;\\n z-index: 2147483646;\\n user-select: none;\\n pointer-events: none;\\n color: var(--text-color);\\n}\\n#content-highlight,\\n#block {\\n position: absolute;\\n}\\n#content-highlight {\\n border: 3px solid var(--primary-color);\\n background-color: var(--primary-color-alpha);\\n}\\na {\\n position: absolute;\\n top: -33px;\\n left: 0;\\n display: block;\\n padding: 5px 10px 8px 10px;\\n pointer-events: auto;\\n z-index: 100;\\n text-decoration: none;\\n}\\na:hover {\\n text-decoration: none;\\n}\\na span {\\n display: block;\\n padding: 3px 6px;\\n font-size: 10px;\\n font-weight: 300;\\n border-radius: 3px;\\n text-align: center;\\n text-decoration: none;\\n pointer-events: none;\\n background-color: var(--edit-color);\\n color: var(--text-color);\\n white-space: nowrap;\\n}\\na:hover span {\\n background-color: var(--edit-color-highlight);\\n}\\na:hover ~ .outline {\\n border-color: var(--edit-color-highlight);\\n}\\n#open-in-editor {\\n display: none;\\n}\\n.outline {\\n position: absolute;\\n top: 0;\\n left: 0;\\n width: 100%;\\n height: 100%;\\n border: 1px solid var(--edit-color);\\n background-color: var(--edit-color-alpha);\\n}</style><div id="block"> <a id="open-in-builder" target="builder"><span>Open In Builder</span></a> <a id="open-in-editor" href="#open-in-editor"><span>Open In Editor</span></a> <div class="outline"></div> </div>\';\n this.openInBuilder = shadow.getElementById(\n "open-in-builder"\n );\n this.block = shadow.getElementById("block");\n initDocumentListeners(this);\n }\n show(contentElm, blockElm) {\n if (!isEditEnabled()) {\n this.hide();\n return null;\n }\n const contentId = contentElm.getAttribute("builder-content-id");\n const blockId = blockElm.getAttribute("builder-id");\n if (!contentId || !blockId) {\n this.hide();\n return null;\n }\n const block = this.block;\n const openInBuilder = this.openInBuilder;\n const builderRect = blockElm.getBoundingClientRect();\n block.style.top = builderRect.top + window.scrollY - 1 + "px";\n block.style.left = builderRect.left + window.scrollX + "px";\n block.style.width = builderRect.width + "px";\n block.style.height = builderRect.height + 1 + "px";\n const openInBuilderRect = openInBuilder.getBoundingClientRect();\n if (openInBuilderRect.width > builderRect.width) {\n const diff = openInBuilderRect.width - builderRect.width;\n openInBuilder.style.left = diff / 2 * -1 + "px";\n } else {\n openInBuilder.style.left = "";\n }\n openInBuilder.href = getBuilderContentUrl(contentId, blockId);\n this.style.display = "block";\n return blockId;\n }\n hide() {\n this.style.display = "";\n }\n };\n\n // packages/dev-tools/common/constants.ts\n var PREVIEW_URL_QS = `preview-url`;\n var CONNECTED_USER_ID_QS = "_b-uid";\n var BUILDER_AUTH_CONNECT_PATH = "/~builder-connect";\n var DEV_TOOLS_API_PATH = "/~builder-dev-tools";\n var AMPLITUDE_PROXY_URL = "https://cdn.builder.io/api/v1/proxy-api?url=https://api2.amplitude.com/2/httpapi";\n\n // packages/dev-tools/client/client-api.ts\n var apiValidateBuilder = () => apiFetch({\n type: "validateBuilder"\n });\n var apiLaunchEditor = (file) => apiFetch({\n type: "launchEditor",\n data: file\n });\n var apiRegistry = (opts) => apiFetch({\n type: "getRegistry",\n data: opts\n });\n var apiLoadComponent = (opts) => apiFetch({\n type: "loadComponent",\n data: opts\n });\n var apiRegisterComponent = (opts) => apiFetch({\n type: "registerComponent",\n data: opts\n });\n var apiSetComponentInfo = (opts) => apiFetch({\n type: "setComponentInfo",\n data: opts\n });\n var apiSetComponentInput = (opts) => apiFetch({\n type: "setComponentInput",\n data: opts\n });\n var apiUnregisterComponent = (opts) => apiFetch({\n type: "unregisterComponent",\n data: opts\n });\n var apiDevToolsEnabled = (enabled) => apiFetch({\n type: "enableDevTools",\n data: { enabled }\n });\n var apiLocalConfig = () => apiFetch({ type: "localConfig" });\n var apiFetch = async (data) => {\n const url = new URL(DEV_TOOLS_API_PATH, DEV_TOOLS_URL);\n let rsp;\n try {\n rsp = await fetch(url, {\n method: "POST",\n body: JSON.stringify(data)\n });\n } catch (e) {\n console.error(`Devtools Fetch Error, ${url.href}`, e);\n throw new Error(`Builder Devtools Fetch Error`);\n }\n const contentType = rsp.headers.get("content-type") || "";\n if (contentType.includes("application/json")) {\n const r = await rsp.json();\n if (rsp.ok) {\n return r.data;\n }\n if (Array.isArray(r.errors) && r.errors.length > 0) {\n r.errors.forEach((e) => console.error(e));\n throw new Error(`Builder Devtools Fetch Error: ${r.errors[0]}`);\n }\n }\n throw new Error(\n `Builder Devtools Fetch Error: ${rsp.status}, ${await rsp.text()}`\n );\n };\n\n // packages/dev-tools/common/ast/component-input-types.ts\n var INPUT_TYPES = [\n { value: "boolean", text: "boolean" },\n { value: "color", text: "color (provides a color in hex or rgb)" },\n { value: "date", text: "date (same format as the Date constructor)" },\n { value: "email", text: "email" },\n { value: "file", text: "file (uploads a file and provides a url)" },\n { value: "list", text: "list (collection of items)" },\n { value: "longText", text: "longText (multiline text editor)" },\n { value: "number", text: "number" },\n { value: "object", text: "object (set of specific names and values)" },\n { value: "richText", text: "richText (provides value as html)" },\n { value: "string", text: "string" }\n ];\n var STRING_TYPES = [\n "color",\n "date",\n "email",\n "file",\n "longText",\n "richText",\n "string"\n ];\n var NUMBER_TYPES = ["number"];\n var BOOLEAN_TYPES = ["boolean"];\n var ARRAY_TYPES = ["list"];\n var OBJECT_TYPES = ["object"];\n function getPrimitiveType(t) {\n if (STRING_TYPES.includes(t)) {\n return "string";\n } else if (NUMBER_TYPES.includes(t)) {\n return "number";\n } else if (BOOLEAN_TYPES.includes(t)) {\n return "boolean";\n } else if (ARRAY_TYPES.includes(t)) {\n return "array";\n } else if (OBJECT_TYPES.includes(t)) {\n return "object";\n } else {\n return "string";\n }\n }\n var PROP_BLACKLIST = new Set(\n [\n "about",\n "accessKey",\n "accessKeyLabel",\n "asChild",\n "autoCapitalize",\n "autoCorrect",\n "autoFocus",\n "autoSave",\n "blur",\n "contentEditable",\n "contextMenu",\n "dangerouslySetInnerHTML",\n "datatype",\n "defaultChecked",\n "defaultValue",\n "dir",\n "draggable",\n "enterKeyHint",\n "focus",\n "form",\n "formAction",\n "formEncType",\n "formMethod",\n "formNoValidate",\n "formTarget",\n "inlist",\n "innerText",\n "inputMode",\n "is",\n "isContentEditable",\n "itemID",\n "itemProp",\n "itemRef",\n "itemScope",\n "itemType",\n "lang",\n "nonce",\n "offsetHeight",\n "offsetLeft",\n "offsetTop",\n "offsetWidth",\n "outerText",\n "prefix",\n "property",\n "radioGroup",\n "rel",\n "resource",\n "results",\n "rev",\n "role",\n "security",\n "slot",\n "spellCheck",\n "suppressContentEditableWarning",\n "suppressHydrationWarning",\n "tabIndex",\n "translate",\n "typeof",\n "unselectable",\n "vocab"\n ].map((s) => s.toLowerCase())\n );\n\n // node_modules/tslib/tslib.es6.mjs\n var extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {\n d2.__proto__ = b2;\n } || function(d2, b2) {\n for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];\n };\n return extendStatics(d, b);\n };\n function __extends(d, b) {\n if (typeof b !== "function" && b !== null)\n throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n }\n var __assign = function() {\n __assign = Object.assign || function __assign3(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === "function")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n }\n function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function(resolve) {\n resolve(value);\n });\n }\n return new (P || (P = Promise))(function(resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator["throw"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n }\n function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() {\n if (t[0] & 1) throw t[1];\n return t[1];\n }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);\n return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {\n return this;\n }), g;\n function verb(n) {\n return function(v) {\n return step([n, v]);\n };\n }\n function step(op) {\n if (f) throw new TypeError("Generator is already executing.");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return { value: op[1], done: false };\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return { value: op[0] ? op[1] : void 0, done: true };\n }\n }\n function __values(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function() {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n }\n function __read(o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = { error };\n } finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n return ar;\n }\n function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n }\n\n // node_modules/@amplitude/analytics-types/lib/esm/index.js\n var esm_exports = {};\n __export(esm_exports, {\n IdentifyOperation: () => IdentifyOperation,\n LogLevel: () => LogLevel,\n PluginType: () => PluginType,\n RevenueProperty: () => RevenueProperty,\n ServerZone: () => ServerZone,\n SpecialEventType: () => SpecialEventType,\n Status: () => Status,\n TransportType: () => TransportType\n });\n\n // node_modules/@amplitude/analytics-types/lib/esm/event.js\n var IdentifyOperation;\n (function(IdentifyOperation2) {\n IdentifyOperation2["SET"] = "$set";\n IdentifyOperation2["SET_ONCE"] = "$setOnce";\n IdentifyOperation2["ADD"] = "$add";\n IdentifyOperation2["APPEND"] = "$append";\n IdentifyOperation2["PREPEND"] = "$prepend";\n IdentifyOperation2["REMOVE"] = "$remove";\n IdentifyOperation2["PREINSERT"] = "$preInsert";\n IdentifyOperation2["POSTINSERT"] = "$postInsert";\n IdentifyOperation2["UNSET"] = "$unset";\n IdentifyOperation2["CLEAR_ALL"] = "$clearAll";\n })(IdentifyOperation || (IdentifyOperation = {}));\n var RevenueProperty;\n (function(RevenueProperty2) {\n RevenueProperty2["REVENUE_PRODUCT_ID"] = "$productId";\n RevenueProperty2["REVENUE_QUANTITY"] = "$quantity";\n RevenueProperty2["REVENUE_PRICE"] = "$price";\n RevenueProperty2["REVENUE_TYPE"] = "$revenueType";\n RevenueProperty2["REVENUE_CURRENCY"] = "$currency";\n RevenueProperty2["REVENUE"] = "$revenue";\n })(RevenueProperty || (RevenueProperty = {}));\n var SpecialEventType;\n (function(SpecialEventType2) {\n SpecialEventType2["IDENTIFY"] = "$identify";\n SpecialEventType2["GROUP_IDENTIFY"] = "$groupidentify";\n SpecialEventType2["REVENUE"] = "revenue_amount";\n })(SpecialEventType || (SpecialEventType = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/logger.js\n var LogLevel;\n (function(LogLevel2) {\n LogLevel2[LogLevel2["None"] = 0] = "None";\n LogLevel2[LogLevel2["Error"] = 1] = "Error";\n LogLevel2[LogLevel2["Warn"] = 2] = "Warn";\n LogLevel2[LogLevel2["Verbose"] = 3] = "Verbose";\n LogLevel2[LogLevel2["Debug"] = 4] = "Debug";\n })(LogLevel || (LogLevel = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/plugin.js\n var PluginType;\n (function(PluginType2) {\n PluginType2["BEFORE"] = "before";\n PluginType2["ENRICHMENT"] = "enrichment";\n PluginType2["DESTINATION"] = "destination";\n })(PluginType || (PluginType = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/server-zone.js\n var ServerZone;\n (function(ServerZone2) {\n ServerZone2["US"] = "US";\n ServerZone2["EU"] = "EU";\n ServerZone2["STAGING"] = "STAGING";\n })(ServerZone || (ServerZone = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/status.js\n var Status;\n (function(Status2) {\n Status2["Unknown"] = "unknown";\n Status2["Skipped"] = "skipped";\n Status2["Success"] = "success";\n Status2["RateLimit"] = "rate_limit";\n Status2["PayloadTooLarge"] = "payload_too_large";\n Status2["Invalid"] = "invalid";\n Status2["Failed"] = "failed";\n Status2["Timeout"] = "Timeout";\n Status2["SystemError"] = "SystemError";\n })(Status || (Status = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/transport.js\n var TransportType;\n (function(TransportType2) {\n TransportType2["XHR"] = "xhr";\n TransportType2["SendBeacon"] = "beacon";\n TransportType2["Fetch"] = "fetch";\n })(TransportType || (TransportType = {}));\n\n // node_modules/@amplitude/analytics-core/lib/esm/constants.js\n var UNSET_VALUE = "-";\n var AMPLITUDE_PREFIX = "AMP";\n var STORAGE_PREFIX = "".concat(AMPLITUDE_PREFIX, "_unsent");\n var AMPLITUDE_SERVER_URL = "https://api2.amplitude.com/2/httpapi";\n var EU_AMPLITUDE_SERVER_URL = "https://api.eu.amplitude.com/2/httpapi";\n var AMPLITUDE_BATCH_SERVER_URL = "https://api2.amplitude.com/batch";\n var EU_AMPLITUDE_BATCH_SERVER_URL = "https://api.eu.amplitude.com/batch";\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js\n var MAX_PROPERTY_KEYS = 1e3;\n var isValidObject = function(properties) {\n if (Object.keys(properties).length > MAX_PROPERTY_KEYS) {\n return false;\n }\n for (var key in properties) {\n var value = properties[key];\n if (!isValidProperties(key, value))\n return false;\n }\n return true;\n };\n var isValidProperties = function(property, value) {\n var e_1, _a;\n if (typeof property !== "string")\n return false;\n if (Array.isArray(value)) {\n var isValid = true;\n try {\n for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {\n var valueElement = value_1_1.value;\n if (Array.isArray(valueElement)) {\n return false;\n } else if (typeof valueElement === "object") {\n isValid = isValid && isValidObject(valueElement);\n } else if (!["number", "string"].includes(typeof valueElement)) {\n return false;\n }\n if (!isValid) {\n return false;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n } else if (value === null || value === void 0) {\n return false;\n } else if (typeof value === "object") {\n return isValidObject(value);\n } else if (!["number", "string", "boolean"].includes(typeof value)) {\n return false;\n }\n return true;\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/identify.js\n var Identify = (\n /** @class */\n (function() {\n function Identify2() {\n this._propertySet = /* @__PURE__ */ new Set();\n this._properties = {};\n }\n Identify2.prototype.getUserProperties = function() {\n return __assign({}, this._properties);\n };\n Identify2.prototype.set = function(property, value) {\n this._safeSet(IdentifyOperation.SET, property, value);\n return this;\n };\n Identify2.prototype.setOnce = function(property, value) {\n this._safeSet(IdentifyOperation.SET_ONCE, property, value);\n return this;\n };\n Identify2.prototype.append = function(property, value) {\n this._safeSet(IdentifyOperation.APPEND, property, value);\n return this;\n };\n Identify2.prototype.prepend = function(property, value) {\n this._safeSet(IdentifyOperation.PREPEND, property, value);\n return this;\n };\n Identify2.prototype.postInsert = function(property, value) {\n this._safeSet(IdentifyOperation.POSTINSERT, property, value);\n return this;\n };\n Identify2.prototype.preInsert = function(property, value) {\n this._safeSet(IdentifyOperation.PREINSERT, property, value);\n return this;\n };\n Identify2.prototype.remove = function(property, value) {\n this._safeSet(IdentifyOperation.REMOVE, property, value);\n return this;\n };\n Identify2.prototype.add = function(property, value) {\n this._safeSet(IdentifyOperation.ADD, property, value);\n return this;\n };\n Identify2.prototype.unset = function(property) {\n this._safeSet(IdentifyOperation.UNSET, property, UNSET_VALUE);\n return this;\n };\n Identify2.prototype.clearAll = function() {\n this._properties = {};\n this._properties[IdentifyOperation.CLEAR_ALL] = UNSET_VALUE;\n return this;\n };\n Identify2.prototype._safeSet = function(operation, property, value) {\n if (this._validate(operation, property, value)) {\n var userPropertyMap = this._properties[operation];\n if (userPropertyMap === void 0) {\n userPropertyMap = {};\n this._properties[operation] = userPropertyMap;\n }\n userPropertyMap[property] = value;\n this._propertySet.add(property);\n return true;\n }\n return false;\n };\n Identify2.prototype._validate = function(operation, property, value) {\n if (this._properties[IdentifyOperation.CLEAR_ALL] !== void 0) {\n return false;\n }\n if (this._propertySet.has(property)) {\n return false;\n }\n if (operation === IdentifyOperation.ADD) {\n return typeof value === "number";\n }\n if (operation !== IdentifyOperation.UNSET && operation !== IdentifyOperation.REMOVE) {\n return isValidProperties(property, value);\n }\n return true;\n };\n return Identify2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js\n var createTrackEvent = function(eventInput, eventProperties, eventOptions) {\n var baseEvent = typeof eventInput === "string" ? { event_type: eventInput } : eventInput;\n return __assign(__assign(__assign({}, baseEvent), eventOptions), eventProperties && { event_properties: eventProperties });\n };\n var createIdentifyEvent = function(identify2, eventOptions) {\n var identifyEvent = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.IDENTIFY, user_properties: identify2.getUserProperties() });\n return identifyEvent;\n };\n var createGroupIdentifyEvent = function(groupType, groupName, identify2, eventOptions) {\n var _a;\n var groupIdentify2 = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.GROUP_IDENTIFY, group_properties: identify2.getUserProperties(), groups: (_a = {}, _a[groupType] = groupName, _a) });\n return groupIdentify2;\n };\n var createGroupEvent = function(groupType, groupName, eventOptions) {\n var _a;\n var identify2 = new Identify();\n identify2.set(groupType, groupName);\n var groupEvent = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.IDENTIFY, user_properties: identify2.getUserProperties(), groups: (_a = {}, _a[groupType] = groupName, _a) });\n return groupEvent;\n };\n var createRevenueEvent = function(revenue2, eventOptions) {\n return __assign(__assign({}, eventOptions), { event_type: SpecialEventType.REVENUE, event_properties: revenue2.getEventProperties() });\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js\n var buildResult = function(event, code, message) {\n if (code === void 0) {\n code = 0;\n }\n if (message === void 0) {\n message = Status.Unknown;\n }\n return { event, code, message };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/timeline.js\n var Timeline = (\n /** @class */\n (function() {\n function Timeline2(client) {\n this.client = client;\n this.queue = [];\n this.applying = false;\n this.plugins = [];\n }\n Timeline2.prototype.register = function(plugin, config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, plugin.setup(config, this.client)];\n case 1:\n _a.sent();\n this.plugins.push(plugin);\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.deregister = function(pluginName, config) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var index, plugin;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n index = this.plugins.findIndex(function(plugin2) {\n return plugin2.name === pluginName;\n });\n if (index === -1) {\n config.loggerProvider.warn("Plugin with name ".concat(pluginName, " does not exist, skipping deregistration"));\n return [\n 2\n /*return*/\n ];\n }\n plugin = this.plugins[index];\n this.plugins.splice(index, 1);\n return [4, (_a = plugin.teardown) === null || _a === void 0 ? void 0 : _a.call(plugin)];\n case 1:\n _b.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.reset = function(client) {\n this.applying = false;\n var plugins = this.plugins;\n plugins.map(function(plugin) {\n var _a;\n return (_a = plugin.teardown) === null || _a === void 0 ? void 0 : _a.call(plugin);\n });\n this.plugins = [];\n this.client = client;\n };\n Timeline2.prototype.push = function(event) {\n var _this = this;\n return new Promise(function(resolve) {\n _this.queue.push([event, resolve]);\n _this.scheduleApply(0);\n });\n };\n Timeline2.prototype.scheduleApply = function(timeout) {\n var _this = this;\n if (this.applying)\n return;\n this.applying = true;\n setTimeout(function() {\n void _this.apply(_this.queue.shift()).then(function() {\n _this.applying = false;\n if (_this.queue.length > 0) {\n _this.scheduleApply(0);\n }\n });\n }, timeout);\n };\n Timeline2.prototype.apply = function(item) {\n return __awaiter(this, void 0, void 0, function() {\n var _a, event, _b, resolve, before, before_1, before_1_1, plugin, e, e_1_1, enrichment, enrichment_1, enrichment_1_1, plugin, e, e_2_1, destination, executeDestinations;\n var e_1, _c, e_2, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n if (!item) {\n return [\n 2\n /*return*/\n ];\n }\n _a = __read(item, 1), event = _a[0];\n _b = __read(item, 2), resolve = _b[1];\n before = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.BEFORE;\n });\n _e.label = 1;\n case 1:\n _e.trys.push([1, 6, 7, 8]);\n before_1 = __values(before), before_1_1 = before_1.next();\n _e.label = 2;\n case 2:\n if (!!before_1_1.done) return [3, 5];\n plugin = before_1_1.value;\n return [4, plugin.execute(__assign({}, event))];\n case 3:\n e = _e.sent();\n if (e === null) {\n resolve({ event, code: 0, message: "" });\n return [\n 2\n /*return*/\n ];\n } else {\n event = e;\n }\n _e.label = 4;\n case 4:\n before_1_1 = before_1.next();\n return [3, 2];\n case 5:\n return [3, 8];\n case 6:\n e_1_1 = _e.sent();\n e_1 = { error: e_1_1 };\n return [3, 8];\n case 7:\n try {\n if (before_1_1 && !before_1_1.done && (_c = before_1.return)) _c.call(before_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 8:\n enrichment = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.ENRICHMENT;\n });\n _e.label = 9;\n case 9:\n _e.trys.push([9, 14, 15, 16]);\n enrichment_1 = __values(enrichment), enrichment_1_1 = enrichment_1.next();\n _e.label = 10;\n case 10:\n if (!!enrichment_1_1.done) return [3, 13];\n plugin = enrichment_1_1.value;\n return [4, plugin.execute(__assign({}, event))];\n case 11:\n e = _e.sent();\n if (e === null) {\n resolve({ event, code: 0, message: "" });\n return [\n 2\n /*return*/\n ];\n } else {\n event = e;\n }\n _e.label = 12;\n case 12:\n enrichment_1_1 = enrichment_1.next();\n return [3, 10];\n case 13:\n return [3, 16];\n case 14:\n e_2_1 = _e.sent();\n e_2 = { error: e_2_1 };\n return [3, 16];\n case 15:\n try {\n if (enrichment_1_1 && !enrichment_1_1.done && (_d = enrichment_1.return)) _d.call(enrichment_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 16:\n destination = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.DESTINATION;\n });\n executeDestinations = destination.map(function(plugin2) {\n var eventClone = __assign({}, event);\n return plugin2.execute(eventClone).catch(function(e2) {\n return buildResult(eventClone, 0, String(e2));\n });\n });\n void Promise.all(executeDestinations).then(function(_a2) {\n var _b2 = __read(_a2, 1), result = _b2[0];\n resolve(result);\n });\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.flush = function() {\n return __awaiter(this, void 0, void 0, function() {\n var queue, destination, executeDestinations;\n var _this = this;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n queue = this.queue;\n this.queue = [];\n return [4, Promise.all(queue.map(function(item) {\n return _this.apply(item);\n }))];\n case 1:\n _a.sent();\n destination = this.plugins.filter(function(plugin) {\n return plugin.type === PluginType.DESTINATION;\n });\n executeDestinations = destination.map(function(plugin) {\n return plugin.flush && plugin.flush();\n });\n return [4, Promise.all(executeDestinations)];\n case 2:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n return Timeline2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/messages.js\n var SUCCESS_MESSAGE = "Event tracked successfully";\n var UNEXPECTED_ERROR_MESSAGE = "Unexpected error occurred";\n var MAX_RETRIES_EXCEEDED_MESSAGE = "Event rejected due to exceeded retry count";\n var OPT_OUT_MESSAGE = "Event skipped due to optOut config";\n var MISSING_API_KEY_MESSAGE = "Event rejected due to missing API key";\n var INVALID_API_KEY = "Invalid API key";\n var CLIENT_NOT_INITIALIZED = "Client not initialized";\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js\n var returnWrapper = function(awaitable) {\n return {\n promise: awaitable || Promise.resolve()\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/core-client.js\n var AmplitudeCore = (\n /** @class */\n (function() {\n function AmplitudeCore2(name) {\n if (name === void 0) {\n name = "$default";\n }\n this.initializing = false;\n this.q = [];\n this.dispatchQ = [];\n this.logEvent = this.track.bind(this);\n this.timeline = new Timeline(this);\n this.name = name;\n }\n AmplitudeCore2.prototype._init = function(config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n this.config = config;\n this.timeline.reset(this);\n return [4, this.runQueuedFunctions("q")];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.runQueuedFunctions = function(queueName) {\n return __awaiter(this, void 0, void 0, function() {\n var queuedFunctions, queuedFunctions_1, queuedFunctions_1_1, queuedFunction, e_1_1;\n var e_1, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n queuedFunctions = this[queueName];\n this[queueName] = [];\n _b.label = 1;\n case 1:\n _b.trys.push([1, 6, 7, 8]);\n queuedFunctions_1 = __values(queuedFunctions), queuedFunctions_1_1 = queuedFunctions_1.next();\n _b.label = 2;\n case 2:\n if (!!queuedFunctions_1_1.done) return [3, 5];\n queuedFunction = queuedFunctions_1_1.value;\n return [4, queuedFunction()];\n case 3:\n _b.sent();\n _b.label = 4;\n case 4:\n queuedFunctions_1_1 = queuedFunctions_1.next();\n return [3, 2];\n case 5:\n return [3, 8];\n case 6:\n e_1_1 = _b.sent();\n e_1 = { error: e_1_1 };\n return [3, 8];\n case 7:\n try {\n if (queuedFunctions_1_1 && !queuedFunctions_1_1.done && (_a = queuedFunctions_1.return)) _a.call(queuedFunctions_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 8:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.track = function(eventInput, eventProperties, eventOptions) {\n var event = createTrackEvent(eventInput, eventProperties, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.identify = function(identify2, eventOptions) {\n var event = createIdentifyEvent(identify2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.groupIdentify = function(groupType, groupName, identify2, eventOptions) {\n var event = createGroupIdentifyEvent(groupType, groupName, identify2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.setGroup = function(groupType, groupName, eventOptions) {\n var event = createGroupEvent(groupType, groupName, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.revenue = function(revenue2, eventOptions) {\n var event = createRevenueEvent(revenue2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.add = function(plugin) {\n if (!this.config) {\n this.q.push(this.add.bind(this, plugin));\n return returnWrapper();\n }\n return returnWrapper(this.timeline.register(plugin, this.config));\n };\n AmplitudeCore2.prototype.remove = function(pluginName) {\n if (!this.config) {\n this.q.push(this.remove.bind(this, pluginName));\n return returnWrapper();\n }\n return returnWrapper(this.timeline.deregister(pluginName, this.config));\n };\n AmplitudeCore2.prototype.dispatchWithCallback = function(event, callback) {\n if (!this.config) {\n return callback(buildResult(event, 0, CLIENT_NOT_INITIALIZED));\n }\n void this.process(event).then(callback);\n };\n AmplitudeCore2.prototype.dispatch = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n if (!this.config) {\n return [2, new Promise(function(resolve) {\n _this.dispatchQ.push(_this.dispatchWithCallback.bind(_this, event, resolve));\n })];\n }\n return [2, this.process(event)];\n });\n });\n };\n AmplitudeCore2.prototype.process = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var result, e_2, message, result;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n if (this.config.optOut) {\n return [2, buildResult(event, 0, OPT_OUT_MESSAGE)];\n }\n return [4, this.timeline.push(event)];\n case 1:\n result = _a.sent();\n result.code === 200 ? this.config.loggerProvider.log(result.message) : this.config.loggerProvider.error(result.message);\n return [2, result];\n case 2:\n e_2 = _a.sent();\n this.config.loggerProvider.error(e_2);\n message = String(e_2);\n result = buildResult(event, 0, message);\n return [2, result];\n case 3:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.setOptOut = function(optOut) {\n if (!this.config) {\n this.q.push(this.setOptOut.bind(this, Boolean(optOut)));\n return;\n }\n this.config.optOut = Boolean(optOut);\n };\n AmplitudeCore2.prototype.flush = function() {\n return returnWrapper(this.timeline.flush());\n };\n return AmplitudeCore2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/revenue.js\n var Revenue = (\n /** @class */\n (function() {\n function Revenue2() {\n this.productId = "";\n this.quantity = 1;\n this.price = 0;\n }\n Revenue2.prototype.setProductId = function(productId) {\n this.productId = productId;\n return this;\n };\n Revenue2.prototype.setQuantity = function(quantity) {\n if (quantity > 0) {\n this.quantity = quantity;\n }\n return this;\n };\n Revenue2.prototype.setPrice = function(price) {\n this.price = price;\n return this;\n };\n Revenue2.prototype.setRevenueType = function(revenueType) {\n this.revenueType = revenueType;\n return this;\n };\n Revenue2.prototype.setCurrency = function(currency) {\n this.currency = currency;\n return this;\n };\n Revenue2.prototype.setRevenue = function(revenue2) {\n this.revenue = revenue2;\n return this;\n };\n Revenue2.prototype.setEventProperties = function(properties) {\n if (isValidObject(properties)) {\n this.properties = properties;\n }\n return this;\n };\n Revenue2.prototype.getEventProperties = function() {\n var eventProperties = this.properties ? __assign({}, this.properties) : {};\n eventProperties[RevenueProperty.REVENUE_PRODUCT_ID] = this.productId;\n eventProperties[RevenueProperty.REVENUE_QUANTITY] = this.quantity;\n eventProperties[RevenueProperty.REVENUE_PRICE] = this.price;\n eventProperties[RevenueProperty.REVENUE_TYPE] = this.revenueType;\n eventProperties[RevenueProperty.REVENUE_CURRENCY] = this.currency;\n eventProperties[RevenueProperty.REVENUE] = this.revenue;\n return eventProperties;\n };\n return Revenue2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js\n var chunk = function(arr, size) {\n var chunkSize = Math.max(size, 1);\n return arr.reduce(function(chunks, element, index) {\n var chunkIndex = Math.floor(index / chunkSize);\n if (!chunks[chunkIndex]) {\n chunks[chunkIndex] = [];\n }\n chunks[chunkIndex].push(element);\n return chunks;\n }, []);\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/logger.js\n var PREFIX = "Amplitude Logger ";\n var Logger = (\n /** @class */\n (function() {\n function Logger2() {\n this.logLevel = LogLevel.None;\n }\n Logger2.prototype.disable = function() {\n this.logLevel = LogLevel.None;\n };\n Logger2.prototype.enable = function(logLevel) {\n if (logLevel === void 0) {\n logLevel = LogLevel.Warn;\n }\n this.logLevel = logLevel;\n };\n Logger2.prototype.log = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Verbose) {\n return;\n }\n console.log("".concat(PREFIX, "[Log]: ").concat(args.join(" ")));\n };\n Logger2.prototype.warn = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Warn) {\n return;\n }\n console.warn("".concat(PREFIX, "[Warn]: ").concat(args.join(" ")));\n };\n Logger2.prototype.error = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Error) {\n return;\n }\n console.error("".concat(PREFIX, "[Error]: ").concat(args.join(" ")));\n };\n Logger2.prototype.debug = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Debug) {\n return;\n }\n console.log("".concat(PREFIX, "[Debug]: ").concat(args.join(" ")));\n };\n return Logger2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/config.js\n var getDefaultConfig = function() {\n return {\n flushMaxRetries: 12,\n flushQueueSize: 200,\n flushIntervalMillis: 1e4,\n instanceName: "$default_instance",\n logLevel: LogLevel.Warn,\n loggerProvider: new Logger(),\n optOut: false,\n serverUrl: AMPLITUDE_SERVER_URL,\n serverZone: ServerZone.US,\n useBatch: false\n };\n };\n var Config = (\n /** @class */\n (function() {\n function Config2(options) {\n var _a, _b, _c, _d;\n this._optOut = false;\n var defaultConfig = getDefaultConfig();\n this.apiKey = options.apiKey;\n this.flushIntervalMillis = (_a = options.flushIntervalMillis) !== null && _a !== void 0 ? _a : defaultConfig.flushIntervalMillis;\n this.flushMaxRetries = options.flushMaxRetries || defaultConfig.flushMaxRetries;\n this.flushQueueSize = options.flushQueueSize || defaultConfig.flushQueueSize;\n this.instanceName = options.instanceName || defaultConfig.instanceName;\n this.loggerProvider = options.loggerProvider || defaultConfig.loggerProvider;\n this.logLevel = (_b = options.logLevel) !== null && _b !== void 0 ? _b : defaultConfig.logLevel;\n this.minIdLength = options.minIdLength;\n this.plan = options.plan;\n this.ingestionMetadata = options.ingestionMetadata;\n this.optOut = (_c = options.optOut) !== null && _c !== void 0 ? _c : defaultConfig.optOut;\n this.serverUrl = options.serverUrl;\n this.serverZone = options.serverZone || defaultConfig.serverZone;\n this.storageProvider = options.storageProvider;\n this.transportProvider = options.transportProvider;\n this.useBatch = (_d = options.useBatch) !== null && _d !== void 0 ? _d : defaultConfig.useBatch;\n this.loggerProvider.enable(this.logLevel);\n var serverConfig = createServerConfig(options.serverUrl, options.serverZone, options.useBatch);\n this.serverZone = serverConfig.serverZone;\n this.serverUrl = serverConfig.serverUrl;\n }\n Object.defineProperty(Config2.prototype, "optOut", {\n get: function() {\n return this._optOut;\n },\n set: function(optOut) {\n this._optOut = optOut;\n },\n enumerable: false,\n configurable: true\n });\n return Config2;\n })()\n );\n var getServerUrl = function(serverZone, useBatch) {\n if (serverZone === ServerZone.EU) {\n return useBatch ? EU_AMPLITUDE_BATCH_SERVER_URL : EU_AMPLITUDE_SERVER_URL;\n }\n return useBatch ? AMPLITUDE_BATCH_SERVER_URL : AMPLITUDE_SERVER_URL;\n };\n var createServerConfig = function(serverUrl, serverZone, useBatch) {\n if (serverUrl === void 0) {\n serverUrl = "";\n }\n if (serverZone === void 0) {\n serverZone = getDefaultConfig().serverZone;\n }\n if (useBatch === void 0) {\n useBatch = getDefaultConfig().useBatch;\n }\n if (serverUrl) {\n return { serverUrl, serverZone: void 0 };\n }\n var _serverZone = ["US", "EU"].includes(serverZone) ? serverZone : getDefaultConfig().serverZone;\n return {\n serverZone: _serverZone,\n serverUrl: getServerUrl(_serverZone, useBatch)\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js\n function getErrorMessage(error) {\n if (error instanceof Error)\n return error.message;\n return String(error);\n }\n function getResponseBodyString(res) {\n var responseBodyString = "";\n try {\n if ("body" in res) {\n responseBodyString = JSON.stringify(res.body);\n }\n } catch (_a) {\n }\n return responseBodyString;\n }\n var Destination = (\n /** @class */\n (function() {\n function Destination2() {\n this.name = "amplitude";\n this.type = PluginType.DESTINATION;\n this.retryTimeout = 1e3;\n this.throttleTimeout = 3e4;\n this.storageKey = "";\n this.scheduled = null;\n this.queue = [];\n }\n Destination2.prototype.setup = function(config) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var unsent;\n var _this = this;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n this.config = config;\n this.storageKey = "".concat(STORAGE_PREFIX, "_").concat(this.config.apiKey.substring(0, 10));\n return [4, (_a = this.config.storageProvider) === null || _a === void 0 ? void 0 : _a.get(this.storageKey)];\n case 1:\n unsent = _b.sent();\n this.saveEvents();\n if (unsent && unsent.length > 0) {\n void Promise.all(unsent.map(function(event) {\n return _this.execute(event);\n })).catch();\n }\n return [2, Promise.resolve(void 0)];\n }\n });\n });\n };\n Destination2.prototype.execute = function(event) {\n var _this = this;\n return new Promise(function(resolve) {\n var context = {\n event,\n attempts: 0,\n callback: function(result) {\n return resolve(result);\n },\n timeout: 0\n };\n void _this.addToQueue(context);\n });\n };\n Destination2.prototype.addToQueue = function() {\n var _this = this;\n var list = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n list[_i] = arguments[_i];\n }\n var tryable = list.filter(function(context) {\n if (context.attempts < _this.config.flushMaxRetries) {\n context.attempts += 1;\n return true;\n }\n void _this.fulfillRequest([context], 500, MAX_RETRIES_EXCEEDED_MESSAGE);\n return false;\n });\n tryable.forEach(function(context) {\n _this.queue = _this.queue.concat(context);\n if (context.timeout === 0) {\n _this.schedule(_this.config.flushIntervalMillis);\n return;\n }\n setTimeout(function() {\n context.timeout = 0;\n _this.schedule(0);\n }, context.timeout);\n });\n this.saveEvents();\n };\n Destination2.prototype.schedule = function(timeout) {\n var _this = this;\n if (this.scheduled)\n return;\n this.scheduled = setTimeout(function() {\n void _this.flush(true).then(function() {\n if (_this.queue.length > 0) {\n _this.schedule(timeout);\n }\n });\n }, timeout);\n };\n Destination2.prototype.flush = function(useRetry) {\n if (useRetry === void 0) {\n useRetry = false;\n }\n return __awaiter(this, void 0, void 0, function() {\n var list, later, batches;\n var _this = this;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n list = [];\n later = [];\n this.queue.forEach(function(context) {\n return context.timeout === 0 ? list.push(context) : later.push(context);\n });\n this.queue = later;\n if (this.scheduled) {\n clearTimeout(this.scheduled);\n this.scheduled = null;\n }\n batches = chunk(list, this.config.flushQueueSize);\n return [4, Promise.all(batches.map(function(batch) {\n return _this.send(batch, useRetry);\n }))];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Destination2.prototype.send = function(list, useRetry) {\n if (useRetry === void 0) {\n useRetry = true;\n }\n return __awaiter(this, void 0, void 0, function() {\n var payload, serverUrl, res, e_1, errorMessage;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n if (!this.config.apiKey) {\n return [2, this.fulfillRequest(list, 400, MISSING_API_KEY_MESSAGE)];\n }\n payload = {\n api_key: this.config.apiKey,\n events: list.map(function(context) {\n var _a2 = context.event, extra = _a2.extra, eventWithoutExtra = __rest(_a2, ["extra"]);\n return eventWithoutExtra;\n }),\n options: {\n min_id_length: this.config.minIdLength\n }\n };\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n serverUrl = createServerConfig(this.config.serverUrl, this.config.serverZone, this.config.useBatch).serverUrl;\n return [4, this.config.transportProvider.send(serverUrl, payload)];\n case 2:\n res = _a.sent();\n if (res === null) {\n this.fulfillRequest(list, 0, UNEXPECTED_ERROR_MESSAGE);\n return [\n 2\n /*return*/\n ];\n }\n if (!useRetry) {\n if ("body" in res) {\n this.fulfillRequest(list, res.statusCode, "".concat(res.status, ": ").concat(getResponseBodyString(res)));\n } else {\n this.fulfillRequest(list, res.statusCode, res.status);\n }\n return [\n 2\n /*return*/\n ];\n }\n this.handleResponse(res, list);\n return [3, 4];\n case 3:\n e_1 = _a.sent();\n this.config.loggerProvider.error(e_1);\n errorMessage = getErrorMessage(e_1);\n this.fulfillRequest(list, 0, errorMessage);\n return [3, 4];\n case 4:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Destination2.prototype.handleResponse = function(res, list) {\n var status = res.status;\n switch (status) {\n case Status.Success: {\n this.handleSuccessResponse(res, list);\n break;\n }\n case Status.Invalid: {\n this.handleInvalidResponse(res, list);\n break;\n }\n case Status.PayloadTooLarge: {\n this.handlePayloadTooLargeResponse(res, list);\n break;\n }\n case Status.RateLimit: {\n this.handleRateLimitResponse(res, list);\n break;\n }\n default: {\n this.config.loggerProvider.warn(`{code: 0, error: "Status \'`.concat(status, "\' provided for ").concat(list.length, \' events"}\'));\n this.handleOtherResponse(list);\n break;\n }\n }\n };\n Destination2.prototype.handleSuccessResponse = function(res, list) {\n this.fulfillRequest(list, res.statusCode, SUCCESS_MESSAGE);\n };\n Destination2.prototype.handleInvalidResponse = function(res, list) {\n var _this = this;\n if (res.body.missingField || res.body.error.startsWith(INVALID_API_KEY)) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n var dropIndex = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(Object.values(res.body.eventsWithInvalidFields)), false), __read(Object.values(res.body.eventsWithMissingFields)), false), __read(Object.values(res.body.eventsWithInvalidIdLengths)), false), __read(res.body.silencedEvents), false).flat();\n var dropIndexSet = new Set(dropIndex);\n var retry = list.filter(function(context, index) {\n if (dropIndexSet.has(index)) {\n _this.fulfillRequest([context], res.statusCode, res.body.error);\n return;\n }\n return true;\n });\n if (retry.length > 0) {\n this.config.loggerProvider.warn(getResponseBodyString(res));\n }\n this.addToQueue.apply(this, __spreadArray([], __read(retry), false));\n };\n Destination2.prototype.handlePayloadTooLargeResponse = function(res, list) {\n if (list.length === 1) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n this.config.loggerProvider.warn(getResponseBodyString(res));\n this.config.flushQueueSize /= 2;\n this.addToQueue.apply(this, __spreadArray([], __read(list), false));\n };\n Destination2.prototype.handleRateLimitResponse = function(res, list) {\n var _this = this;\n var dropUserIds = Object.keys(res.body.exceededDailyQuotaUsers);\n var dropDeviceIds = Object.keys(res.body.exceededDailyQuotaDevices);\n var throttledIndex = res.body.throttledEvents;\n var dropUserIdsSet = new Set(dropUserIds);\n var dropDeviceIdsSet = new Set(dropDeviceIds);\n var throttledIndexSet = new Set(throttledIndex);\n var retry = list.filter(function(context, index) {\n if (context.event.user_id && dropUserIdsSet.has(context.event.user_id) || context.event.device_id && dropDeviceIdsSet.has(context.event.device_id)) {\n _this.fulfillRequest([context], res.statusCode, res.body.error);\n return;\n }\n if (throttledIndexSet.has(index)) {\n context.timeout = _this.throttleTimeout;\n }\n return true;\n });\n if (retry.length > 0) {\n this.config.loggerProvider.warn(getResponseBodyString(res));\n }\n this.addToQueue.apply(this, __spreadArray([], __read(retry), false));\n };\n Destination2.prototype.handleOtherResponse = function(list) {\n var _this = this;\n this.addToQueue.apply(this, __spreadArray([], __read(list.map(function(context) {\n context.timeout = context.attempts * _this.retryTimeout;\n return context;\n })), false));\n };\n Destination2.prototype.fulfillRequest = function(list, code, message) {\n this.saveEvents();\n list.forEach(function(context) {\n return context.callback(buildResult(context.event, code, message));\n });\n };\n Destination2.prototype.saveEvents = function() {\n if (!this.config.storageProvider) {\n return;\n }\n var events = Array.from(this.queue.map(function(context) {\n return context.event;\n }));\n void this.config.storageProvider.set(this.storageKey, events);\n };\n return Destination2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js\n var getStacktrace = function(ignoreDepth) {\n if (ignoreDepth === void 0) {\n ignoreDepth = 0;\n }\n var trace = new Error().stack || "";\n return trace.split("\\n").slice(2 + ignoreDepth).map(function(text) {\n return text.trim();\n });\n };\n var getClientLogConfig = function(client) {\n return function() {\n var _a = __assign({}, client.config), logger = _a.loggerProvider, logLevel = _a.logLevel;\n return {\n logger,\n logLevel\n };\n };\n };\n var getValueByStringPath = function(obj, path) {\n var e_1, _a;\n path = path.replace(/\\[(\\w+)\\]/g, ".$1");\n path = path.replace(/^\\./, "");\n try {\n for (var _b = __values(path.split(".")), _c = _b.next(); !_c.done; _c = _b.next()) {\n var attr = _c.value;\n if (attr in obj) {\n obj = obj[attr];\n } else {\n return;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n return obj;\n };\n var getClientStates = function(client, paths) {\n return function() {\n var e_2, _a;\n var res = {};\n try {\n for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {\n var path = paths_1_1.value;\n res[path] = getValueByStringPath(client, path);\n }\n } catch (e_2_1) {\n e_2 = { error: e_2_1 };\n } finally {\n try {\n if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n return res;\n };\n };\n var debugWrapper = function(fn, fnName, getLogConfig, getStates, fnContext) {\n if (fnContext === void 0) {\n fnContext = null;\n }\n return function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = getLogConfig(), logger = _a.logger, logLevel = _a.logLevel;\n if (logLevel && logLevel < LogLevel.Debug || !logLevel || !logger) {\n return fn.apply(fnContext, args);\n }\n var debugContext = {\n type: "invoke public method",\n name: fnName,\n args,\n stacktrace: getStacktrace(1),\n time: {\n start: (/* @__PURE__ */ new Date()).toISOString()\n },\n states: {}\n };\n if (getStates && debugContext.states) {\n debugContext.states.before = getStates();\n }\n var result = fn.apply(fnContext, args);\n if (result && result.promise) {\n result.promise.then(function() {\n if (getStates && debugContext.states) {\n debugContext.states.after = getStates();\n }\n if (debugContext.time) {\n debugContext.time.end = (/* @__PURE__ */ new Date()).toISOString();\n }\n logger.debug(JSON.stringify(debugContext, null, 2));\n });\n } else {\n if (getStates && debugContext.states) {\n debugContext.states.after = getStates();\n }\n if (debugContext.time) {\n debugContext.time.end = (/* @__PURE__ */ new Date()).toISOString();\n }\n logger.debug(JSON.stringify(debugContext, null, 2));\n }\n return result;\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js\n var UUID = function(a) {\n return a ? (\n // a random number from 0 to 15\n (a ^ // unless b is 8,\n Math.random() * // in which case\n 16 >> // a random number from\n a / 4).toString(16)\n ) : (\n // or otherwise a concatenated string:\n (String(1e7) + // 10000000 +\n String(-1e3) + // -1000 +\n String(-4e3) + // -4000 +\n String(-8e3) + // -80000000 +\n String(-1e11)).replace(\n // replacing\n /[018]/g,\n // zeroes, ones, and eights with\n UUID\n )\n );\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/storage/memory.js\n var MemoryStorage = (\n /** @class */\n (function() {\n function MemoryStorage2() {\n this.memoryStorage = /* @__PURE__ */ new Map();\n }\n MemoryStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, true];\n });\n });\n };\n MemoryStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, this.memoryStorage.get(key)];\n });\n });\n };\n MemoryStorage2.prototype.getRaw = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.get(key)];\n case 1:\n value = _a.sent();\n return [2, value ? JSON.stringify(value) : void 0];\n }\n });\n });\n };\n MemoryStorage2.prototype.set = function(key, value) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.set(key, value);\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n MemoryStorage2.prototype.remove = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.delete(key);\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n MemoryStorage2.prototype.reset = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.clear();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return MemoryStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/transports/base.js\n var BaseTransport = (\n /** @class */\n (function() {\n function BaseTransport2() {\n }\n BaseTransport2.prototype.send = function(_serverUrl, _payload) {\n return Promise.resolve(null);\n };\n BaseTransport2.prototype.buildResponse = function(responseJSON) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;\n if (typeof responseJSON !== "object") {\n return null;\n }\n var statusCode = responseJSON.code || 0;\n var status = this.buildStatus(statusCode);\n switch (status) {\n case Status.Success:\n return {\n status,\n statusCode,\n body: {\n eventsIngested: (_a = responseJSON.events_ingested) !== null && _a !== void 0 ? _a : 0,\n payloadSizeBytes: (_b = responseJSON.payload_size_bytes) !== null && _b !== void 0 ? _b : 0,\n serverUploadTime: (_c = responseJSON.server_upload_time) !== null && _c !== void 0 ? _c : 0\n }\n };\n case Status.Invalid:\n return {\n status,\n statusCode,\n body: {\n error: (_d = responseJSON.error) !== null && _d !== void 0 ? _d : "",\n missingField: (_e = responseJSON.missing_field) !== null && _e !== void 0 ? _e : "",\n eventsWithInvalidFields: (_f = responseJSON.events_with_invalid_fields) !== null && _f !== void 0 ? _f : {},\n eventsWithMissingFields: (_g = responseJSON.events_with_missing_fields) !== null && _g !== void 0 ? _g : {},\n eventsWithInvalidIdLengths: (_h = responseJSON.events_with_invalid_id_lengths) !== null && _h !== void 0 ? _h : {},\n epsThreshold: (_j = responseJSON.eps_threshold) !== null && _j !== void 0 ? _j : 0,\n exceededDailyQuotaDevices: (_k = responseJSON.exceeded_daily_quota_devices) !== null && _k !== void 0 ? _k : {},\n silencedDevices: (_l = responseJSON.silenced_devices) !== null && _l !== void 0 ? _l : [],\n silencedEvents: (_m = responseJSON.silenced_events) !== null && _m !== void 0 ? _m : [],\n throttledDevices: (_o = responseJSON.throttled_devices) !== null && _o !== void 0 ? _o : {},\n throttledEvents: (_p = responseJSON.throttled_events) !== null && _p !== void 0 ? _p : []\n }\n };\n case Status.PayloadTooLarge:\n return {\n status,\n statusCode,\n body: {\n error: (_q = responseJSON.error) !== null && _q !== void 0 ? _q : ""\n }\n };\n case Status.RateLimit:\n return {\n status,\n statusCode,\n body: {\n error: (_r = responseJSON.error) !== null && _r !== void 0 ? _r : "",\n epsThreshold: (_s = responseJSON.eps_threshold) !== null && _s !== void 0 ? _s : 0,\n throttledDevices: (_t = responseJSON.throttled_devices) !== null && _t !== void 0 ? _t : {},\n throttledUsers: (_u = responseJSON.throttled_users) !== null && _u !== void 0 ? _u : {},\n exceededDailyQuotaDevices: (_v = responseJSON.exceeded_daily_quota_devices) !== null && _v !== void 0 ? _v : {},\n exceededDailyQuotaUsers: (_w = responseJSON.exceeded_daily_quota_users) !== null && _w !== void 0 ? _w : {},\n throttledEvents: (_x = responseJSON.throttled_events) !== null && _x !== void 0 ? _x : []\n }\n };\n case Status.Timeout:\n default:\n return {\n status,\n statusCode\n };\n }\n };\n BaseTransport2.prototype.buildStatus = function(code) {\n if (code >= 200 && code < 300) {\n return Status.Success;\n }\n if (code === 429) {\n return Status.RateLimit;\n }\n if (code === 413) {\n return Status.PayloadTooLarge;\n }\n if (code === 408) {\n return Status.Timeout;\n }\n if (code >= 400 && code < 500) {\n return Status.Invalid;\n }\n if (code >= 500) {\n return Status.Failed;\n }\n return Status.Unknown;\n };\n return BaseTransport2;\n })()\n );\n\n // node_modules/@amplitude/analytics-connector/dist/analytics-connector.esm.js\n var ApplicationContextProviderImpl = (\n /** @class */\n (function() {\n function ApplicationContextProviderImpl2() {\n }\n ApplicationContextProviderImpl2.prototype.getApplicationContext = function() {\n return {\n versionName: this.versionName,\n language: getLanguage(),\n platform: "Web",\n os: void 0,\n deviceModel: void 0\n };\n };\n return ApplicationContextProviderImpl2;\n })()\n );\n var getLanguage = function() {\n return typeof navigator !== "undefined" && (navigator.languages && navigator.languages[0] || navigator.language) || "";\n };\n var EventBridgeImpl = (\n /** @class */\n (function() {\n function EventBridgeImpl2() {\n this.queue = [];\n }\n EventBridgeImpl2.prototype.logEvent = function(event) {\n if (!this.receiver) {\n if (this.queue.length < 512) {\n this.queue.push(event);\n }\n } else {\n this.receiver(event);\n }\n };\n EventBridgeImpl2.prototype.setEventReceiver = function(receiver) {\n this.receiver = receiver;\n if (this.queue.length > 0) {\n this.queue.forEach(function(event) {\n receiver(event);\n });\n this.queue = [];\n }\n };\n return EventBridgeImpl2;\n })()\n );\n var __assign2 = function() {\n __assign2 = Object.assign || function __assign3(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign2.apply(this, arguments);\n };\n function __values2(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n }\n function __read2(o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = {\n error\n };\n } finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n return ar;\n }\n var isEqual = function(obj1, obj2) {\n var e_1, _a;\n var primitive = ["string", "number", "boolean", "undefined"];\n var typeA = typeof obj1;\n var typeB = typeof obj2;\n if (typeA !== typeB) {\n return false;\n }\n try {\n for (var primitive_1 = __values2(primitive), primitive_1_1 = primitive_1.next(); !primitive_1_1.done; primitive_1_1 = primitive_1.next()) {\n var p = primitive_1_1.value;\n if (p === typeA) {\n return obj1 === obj2;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (primitive_1_1 && !primitive_1_1.done && (_a = primitive_1.return)) _a.call(primitive_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n if (obj1 == null && obj2 == null) {\n return true;\n } else if (obj1 == null || obj2 == null) {\n return false;\n }\n if (obj1.length !== obj2.length) {\n return false;\n }\n var isArrayA = Array.isArray(obj1);\n var isArrayB = Array.isArray(obj2);\n if (isArrayA !== isArrayB) {\n return false;\n }\n if (isArrayA && isArrayB) {\n for (var i = 0; i < obj1.length; i++) {\n if (!isEqual(obj1[i], obj2[i])) {\n return false;\n }\n }\n } else {\n var sorted1 = Object.keys(obj1).sort();\n var sorted2 = Object.keys(obj2).sort();\n if (!isEqual(sorted1, sorted2)) {\n return false;\n }\n var result_1 = true;\n Object.keys(obj1).forEach(function(key) {\n if (!isEqual(obj1[key], obj2[key])) {\n result_1 = false;\n }\n });\n return result_1;\n }\n return true;\n };\n var ID_OP_SET = "$set";\n var ID_OP_UNSET = "$unset";\n var ID_OP_CLEAR_ALL = "$clearAll";\n if (!Object.entries) {\n Object.entries = function(obj) {\n var ownProps = Object.keys(obj);\n var i = ownProps.length;\n var resArray = new Array(i);\n while (i--) {\n resArray[i] = [ownProps[i], obj[ownProps[i]]];\n }\n return resArray;\n };\n }\n var IdentityStoreImpl = (\n /** @class */\n (function() {\n function IdentityStoreImpl2() {\n this.identity = { userProperties: {} };\n this.listeners = /* @__PURE__ */ new Set();\n }\n IdentityStoreImpl2.prototype.editIdentity = function() {\n var self2 = this;\n var actingUserProperties = __assign2({}, this.identity.userProperties);\n var actingIdentity = __assign2(__assign2({}, this.identity), { userProperties: actingUserProperties });\n return {\n setUserId: function(userId) {\n actingIdentity.userId = userId;\n return this;\n },\n setDeviceId: function(deviceId) {\n actingIdentity.deviceId = deviceId;\n return this;\n },\n setUserProperties: function(userProperties) {\n actingIdentity.userProperties = userProperties;\n return this;\n },\n setOptOut: function(optOut) {\n actingIdentity.optOut = optOut;\n return this;\n },\n updateUserProperties: function(actions) {\n var e_1, _a, e_2, _b, e_3, _c;\n var actingProperties = actingIdentity.userProperties || {};\n try {\n for (var _d = __values2(Object.entries(actions)), _e = _d.next(); !_e.done; _e = _d.next()) {\n var _f = __read2(_e.value, 2), action = _f[0], properties = _f[1];\n switch (action) {\n case ID_OP_SET:\n try {\n for (var _g = (e_2 = void 0, __values2(Object.entries(properties))), _h = _g.next(); !_h.done; _h = _g.next()) {\n var _j = __read2(_h.value, 2), key = _j[0], value = _j[1];\n actingProperties[key] = value;\n }\n } catch (e_2_1) {\n e_2 = { error: e_2_1 };\n } finally {\n try {\n if (_h && !_h.done && (_b = _g.return)) _b.call(_g);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n break;\n case ID_OP_UNSET:\n try {\n for (var _k = (e_3 = void 0, __values2(Object.keys(properties))), _l = _k.next(); !_l.done; _l = _k.next()) {\n var key = _l.value;\n delete actingProperties[key];\n }\n } catch (e_3_1) {\n e_3 = { error: e_3_1 };\n } finally {\n try {\n if (_l && !_l.done && (_c = _k.return)) _c.call(_k);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n break;\n case ID_OP_CLEAR_ALL:\n actingProperties = {};\n break;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (_e && !_e.done && (_a = _d.return)) _a.call(_d);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n actingIdentity.userProperties = actingProperties;\n return this;\n },\n commit: function() {\n self2.setIdentity(actingIdentity);\n return this;\n }\n };\n };\n IdentityStoreImpl2.prototype.getIdentity = function() {\n return __assign2({}, this.identity);\n };\n IdentityStoreImpl2.prototype.setIdentity = function(identity) {\n var originalIdentity = __assign2({}, this.identity);\n this.identity = __assign2({}, identity);\n if (!isEqual(originalIdentity, this.identity)) {\n this.listeners.forEach(function(listener) {\n listener(identity);\n });\n }\n };\n IdentityStoreImpl2.prototype.addIdentityListener = function(listener) {\n this.listeners.add(listener);\n };\n IdentityStoreImpl2.prototype.removeIdentityListener = function(listener) {\n this.listeners.delete(listener);\n };\n return IdentityStoreImpl2;\n })()\n );\n var safeGlobal = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : self;\n var AnalyticsConnector = (\n /** @class */\n (function() {\n function AnalyticsConnector2() {\n this.identityStore = new IdentityStoreImpl();\n this.eventBridge = new EventBridgeImpl();\n this.applicationContextProvider = new ApplicationContextProviderImpl();\n }\n AnalyticsConnector2.getInstance = function(instanceName) {\n if (!safeGlobal["analyticsConnectorInstances"]) {\n safeGlobal["analyticsConnectorInstances"] = {};\n }\n if (!safeGlobal["analyticsConnectorInstances"][instanceName]) {\n safeGlobal["analyticsConnectorInstances"][instanceName] = new AnalyticsConnector2();\n }\n return safeGlobal["analyticsConnectorInstances"][instanceName];\n };\n return AnalyticsConnector2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/analytics-connector.js\n var getAnalyticsConnector = function(instanceName) {\n if (instanceName === void 0) {\n instanceName = "$default_instance";\n }\n return AnalyticsConnector.getInstance(instanceName);\n };\n var setConnectorUserId = function(userId, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setUserId(userId).commit();\n };\n var setConnectorDeviceId = function(deviceId, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setDeviceId(deviceId).commit();\n };\n var setConnectorOptOut = function(optOut, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setOptOut(optOut).commit();\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/global-scope.js\n var getGlobalScope = function() {\n if (typeof globalThis !== "undefined") {\n return globalThis;\n }\n if (typeof window !== "undefined") {\n return window;\n }\n if (typeof self !== "undefined") {\n return self;\n }\n if (typeof global !== "undefined") {\n return global;\n }\n return void 0;\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/query-params.js\n var getQueryParams = function() {\n var _a;\n var globalScope = getGlobalScope();\n if (!((_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.location) === null || _a === void 0 ? void 0 : _a.search)) {\n return {};\n }\n var pairs = globalScope.location.search.substring(1).split("&").filter(Boolean);\n var params = pairs.reduce(function(acc, curr) {\n var query = curr.split("=", 2);\n var key = tryDecodeURIComponent(query[0]);\n var value = tryDecodeURIComponent(query[1]);\n if (!value) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n return params;\n };\n var tryDecodeURIComponent = function(value) {\n if (value === void 0) {\n value = "";\n }\n try {\n return decodeURIComponent(value);\n } catch (_a) {\n return "";\n }\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/attribution/constants.js\n var UTM_CAMPAIGN = "utm_campaign";\n var UTM_CONTENT = "utm_content";\n var UTM_ID = "utm_id";\n var UTM_MEDIUM = "utm_medium";\n var UTM_SOURCE = "utm_source";\n var UTM_TERM = "utm_term";\n var DCLID = "dclid";\n var FBCLID = "fbclid";\n var GBRAID = "gbraid";\n var GCLID = "gclid";\n var KO_CLICK_ID = "ko_click_id";\n var LI_FAT_ID = "li_fat_id";\n var MSCLKID = "msclkid";\n var RDT_CID = "rtd_cid";\n var TTCLID = "ttclid";\n var TWCLID = "twclid";\n var WBRAID = "wbraid";\n var BASE_CAMPAIGN = {\n utm_campaign: void 0,\n utm_content: void 0,\n utm_id: void 0,\n utm_medium: void 0,\n utm_source: void 0,\n utm_term: void 0,\n referrer: void 0,\n referring_domain: void 0,\n dclid: void 0,\n gbraid: void 0,\n gclid: void 0,\n fbclid: void 0,\n ko_click_id: void 0,\n li_fat_id: void 0,\n msclkid: void 0,\n rtd_cid: void 0,\n ttclid: void 0,\n twclid: void 0,\n wbraid: void 0\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/attribution/campaign-parser.js\n var CampaignParser = (\n /** @class */\n (function() {\n function CampaignParser2() {\n }\n CampaignParser2.prototype.parse = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, __assign(__assign(__assign(__assign({}, BASE_CAMPAIGN), this.getUtmParam()), this.getReferrer()), this.getClickIds())];\n });\n });\n };\n CampaignParser2.prototype.getUtmParam = function() {\n var params = getQueryParams();\n var utmCampaign = params[UTM_CAMPAIGN];\n var utmContent = params[UTM_CONTENT];\n var utmId = params[UTM_ID];\n var utmMedium = params[UTM_MEDIUM];\n var utmSource = params[UTM_SOURCE];\n var utmTerm = params[UTM_TERM];\n return {\n utm_campaign: utmCampaign,\n utm_content: utmContent,\n utm_id: utmId,\n utm_medium: utmMedium,\n utm_source: utmSource,\n utm_term: utmTerm\n };\n };\n CampaignParser2.prototype.getReferrer = function() {\n var _a, _b;\n var data = {\n referrer: void 0,\n referring_domain: void 0\n };\n try {\n data.referrer = document.referrer || void 0;\n data.referring_domain = (_b = (_a = data.referrer) === null || _a === void 0 ? void 0 : _a.split("/")[2]) !== null && _b !== void 0 ? _b : void 0;\n } catch (_c) {\n }\n return data;\n };\n CampaignParser2.prototype.getClickIds = function() {\n var _a;\n var params = getQueryParams();\n return _a = {}, _a[DCLID] = params[DCLID], _a[FBCLID] = params[FBCLID], _a[GBRAID] = params[GBRAID], _a[GCLID] = params[GCLID], _a[KO_CLICK_ID] = params[KO_CLICK_ID], _a[LI_FAT_ID] = params[LI_FAT_ID], _a[MSCLKID] = params[MSCLKID], _a[RDT_CID] = params[RDT_CID], _a[TTCLID] = params[TTCLID], _a[TWCLID] = params[TWCLID], _a[WBRAID] = params[WBRAID], _a;\n };\n return CampaignParser2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/cookie-name.js\n var getCookieName = function(apiKey, postKey, limit) {\n if (postKey === void 0) {\n postKey = "";\n }\n if (limit === void 0) {\n limit = 10;\n }\n return [AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join("_");\n };\n var getOldCookieName = function(apiKey) {\n return "".concat(AMPLITUDE_PREFIX.toLowerCase(), "_").concat(apiKey.substring(0, 6));\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/default-tracking.js\n var isFileDownloadTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.fileDownloads) {\n return true;\n }\n return false;\n };\n var isFormInteractionTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.formInteractions) {\n return true;\n }\n return false;\n };\n var isPageViewTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if ((defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.pageViews) === true || (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.pageViews) && typeof defaultTracking.pageViews === "object") {\n return true;\n }\n return false;\n };\n var isSessionTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.sessions) {\n return true;\n }\n return false;\n };\n var getPageViewTrackingConfig = function(config) {\n var _a;\n var trackOn = ((_a = config.attribution) === null || _a === void 0 ? void 0 : _a.trackPageViews) ? "attribution" : function() {\n return false;\n };\n var trackHistoryChanges = void 0;\n var eventType = "Page View";\n var isDefaultPageViewTrackingEnabled = isPageViewTrackingEnabled(config.defaultTracking);\n if (isDefaultPageViewTrackingEnabled) {\n trackOn = void 0;\n eventType = void 0;\n if (config.defaultTracking && typeof config.defaultTracking === "object" && config.defaultTracking.pageViews && typeof config.defaultTracking.pageViews === "object") {\n if ("trackOn" in config.defaultTracking.pageViews) {\n trackOn = config.defaultTracking.pageViews.trackOn;\n }\n if ("trackHistoryChanges" in config.defaultTracking.pageViews) {\n trackHistoryChanges = config.defaultTracking.pageViews.trackHistoryChanges;\n }\n if ("eventType" in config.defaultTracking.pageViews && config.defaultTracking.pageViews.eventType) {\n eventType = config.defaultTracking.pageViews.eventType;\n }\n }\n }\n return {\n trackOn,\n trackHistoryChanges,\n eventType\n };\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/language.js\n var getLanguage2 = function() {\n var _a, _b, _c, _d;\n if (typeof navigator === "undefined")\n return "";\n var userLanguage = navigator.userLanguage;\n return (_d = (_c = (_b = (_a = navigator.languages) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : navigator.language) !== null && _c !== void 0 ? _c : userLanguage) !== null && _d !== void 0 ? _d : "";\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/plugins/identity.js\n var IdentityEventSender = (\n /** @class */\n (function() {\n function IdentityEventSender2() {\n this.name = "identity";\n this.type = PluginType.BEFORE;\n this.identityStore = getAnalyticsConnector().identityStore;\n }\n IdentityEventSender2.prototype.execute = function(context) {\n return __awaiter(this, void 0, void 0, function() {\n var userProperties;\n return __generator(this, function(_a) {\n userProperties = context.user_properties;\n if (userProperties) {\n this.identityStore.editIdentity().updateUserProperties(userProperties).commit();\n }\n return [2, context];\n });\n });\n };\n IdentityEventSender2.prototype.setup = function(config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n if (config.instanceName) {\n this.identityStore = getAnalyticsConnector(config.instanceName).identityStore;\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return IdentityEventSender2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/storage/cookie.js\n var CookieStorage = (\n /** @class */\n (function() {\n function CookieStorage2(options) {\n this.options = __assign({}, options);\n }\n CookieStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n var testStrorage, testKey, value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n if (!getGlobalScope()) {\n return [2, false];\n }\n CookieStorage2.testValue = String(Date.now());\n testStrorage = new CookieStorage2(this.options);\n testKey = "AMP_TEST";\n _b.label = 1;\n case 1:\n _b.trys.push([1, 4, 5, 7]);\n return [4, testStrorage.set(testKey, CookieStorage2.testValue)];\n case 2:\n _b.sent();\n return [4, testStrorage.get(testKey)];\n case 3:\n value = _b.sent();\n return [2, value === CookieStorage2.testValue];\n case 4:\n _a = _b.sent();\n return [2, false];\n case 5:\n return [4, testStrorage.remove(testKey)];\n case 6:\n _b.sent();\n return [\n 7\n /*endfinally*/\n ];\n case 7:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.getRaw(key)];\n case 1:\n value = _a.sent();\n if (!value) {\n return [2, void 0];\n }\n try {\n try {\n value = decodeURIComponent(atob(value));\n } catch (_b) {\n }\n return [2, JSON.parse(value)];\n } catch (_c) {\n return [2, void 0];\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.getRaw = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var globalScope, cookie, match;\n return __generator(this, function(_b) {\n globalScope = getGlobalScope();\n cookie = (_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.document.cookie.split("; ")) !== null && _a !== void 0 ? _a : [];\n match = cookie.find(function(c) {\n return c.indexOf(key + "=") === 0;\n });\n if (!match) {\n return [2, void 0];\n }\n return [2, match.substring(key.length + 1)];\n });\n });\n };\n CookieStorage2.prototype.set = function(key, value) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var expirationDays, expires, expireDate, date, str, globalScope;\n return __generator(this, function(_b) {\n try {\n expirationDays = (_a = this.options.expirationDays) !== null && _a !== void 0 ? _a : 0;\n expires = value !== null ? expirationDays : -1;\n expireDate = void 0;\n if (expires) {\n date = /* @__PURE__ */ new Date();\n date.setTime(date.getTime() + expires * 24 * 60 * 60 * 1e3);\n expireDate = date;\n }\n str = "".concat(key, "=").concat(btoa(encodeURIComponent(JSON.stringify(value))));\n if (expireDate) {\n str += "; expires=".concat(expireDate.toUTCString());\n }\n str += "; path=/";\n if (this.options.domain) {\n str += "; domain=".concat(this.options.domain);\n }\n if (this.options.secure) {\n str += "; Secure";\n }\n if (this.options.sameSite) {\n str += "; SameSite=".concat(this.options.sameSite);\n }\n globalScope = getGlobalScope();\n if (globalScope) {\n globalScope.document.cookie = str;\n }\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n CookieStorage2.prototype.remove = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.set(key, null)];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.reset = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return CookieStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/transports/fetch.js\n var FetchTransport = (\n /** @class */\n (function(_super) {\n __extends(FetchTransport2, _super);\n function FetchTransport2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FetchTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var options, response, responseText;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n if (typeof fetch === "undefined") {\n throw new Error("FetchTransport is not supported");\n }\n options = {\n headers: {\n "Content-Type": "application/json",\n Accept: "*/*"\n },\n body: JSON.stringify(payload),\n method: "POST"\n };\n return [4, fetch(serverUrl, options)];\n case 1:\n response = _a.sent();\n return [4, response.text()];\n case 2:\n responseText = _a.sent();\n try {\n return [2, this.buildResponse(JSON.parse(responseText))];\n } catch (_b) {\n return [2, this.buildResponse({ code: response.status })];\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n return FetchTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/utils.js\n var omitUndefined = function(input) {\n var obj = {};\n for (var key in input) {\n var val = input[key];\n if (val) {\n obj[key] = val;\n }\n }\n return obj;\n };\n\n // node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/page-view-tracking.js\n var pageViewTrackingPlugin = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var amplitude;\n var options = {};\n var globalScope = getGlobalScope();\n var loggerProvider = void 0;\n var pushState;\n var _a = __read(args, 2), clientOrOptions = _a[0], configOrUndefined = _a[1];\n if (clientOrOptions && "init" in clientOrOptions) {\n amplitude = clientOrOptions;\n if (configOrUndefined) {\n options = configOrUndefined;\n }\n } else if (clientOrOptions) {\n options = clientOrOptions;\n }\n var createPageViewEvent = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var _a2;\n var _b;\n var _c;\n return __generator(this, function(_d) {\n switch (_d.label) {\n case 0:\n _b = {\n event_type: (_c = options.eventType) !== null && _c !== void 0 ? _c : "Page View"\n };\n _a2 = [{}];\n return [4, getCampaignParams()];\n case 1:\n return [2, (_b.event_properties = __assign.apply(void 0, [__assign.apply(void 0, _a2.concat([_d.sent()])), { page_domain: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.hostname || ""\n ), page_location: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.href || ""\n ), page_path: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.pathname || ""\n ), page_title: (\n /* istanbul ignore next */\n typeof document !== "undefined" && document.title || ""\n ), page_url: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.href.split("?")[0] || ""\n ) }]), _b)];\n }\n });\n });\n };\n var shouldTrackOnPageLoad = function() {\n return typeof options.trackOn === "undefined" || typeof options.trackOn === "function" && options.trackOn();\n };\n var previousURL = typeof location !== "undefined" ? location.href : null;\n var trackHistoryPageView = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var newURL, shouldTrackPageView, _a2, _b, _c;\n return __generator(this, function(_d) {\n switch (_d.label) {\n case 0:\n newURL = location.href;\n shouldTrackPageView = shouldTrackHistoryPageView(options.trackHistoryChanges, newURL, previousURL || "") && shouldTrackOnPageLoad();\n previousURL = newURL;\n if (!shouldTrackPageView) return [3, 4];\n loggerProvider === null || loggerProvider === void 0 ? void 0 : loggerProvider.log("Tracking page view event");\n if (!(amplitude === null || amplitude === void 0)) return [3, 1];\n _a2 = void 0;\n return [3, 3];\n case 1:\n _c = (_b = amplitude).track;\n return [4, createPageViewEvent()];\n case 2:\n _a2 = _c.apply(_b, [_d.sent()]);\n _d.label = 3;\n case 3:\n _a2;\n _d.label = 4;\n case 4:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n var trackHistoryPageViewWrapper = function() {\n void trackHistoryPageView();\n };\n var plugin = {\n name: "page-view-tracking",\n type: PluginType.ENRICHMENT,\n setup: function(config, client) {\n return __awaiter(void 0, void 0, void 0, function() {\n var receivedType, _a2, _b;\n var _c, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n amplitude = amplitude !== null && amplitude !== void 0 ? amplitude : client;\n if (!amplitude) {\n receivedType = clientOrOptions ? "Options" : "undefined";\n config.loggerProvider.error("Argument of type \'".concat(receivedType, "\' is not assignable to parameter of type \'BrowserClient\'."));\n return [\n 2\n /*return*/\n ];\n }\n loggerProvider = config.loggerProvider;\n loggerProvider.log("Installing @amplitude/plugin-page-view-tracking-browser");\n options.trackOn = ((_c = config.attribution) === null || _c === void 0 ? void 0 : _c.trackPageViews) ? "attribution" : options.trackOn;\n if (!client && ((_d = config.attribution) === null || _d === void 0 ? void 0 : _d.trackPageViews)) {\n loggerProvider.warn("@amplitude/plugin-page-view-tracking-browser overrides page view tracking behavior defined in @amplitude/analytics-browser. Resolve by disabling page view tracking in @amplitude/analytics-browser.");\n config.attribution.trackPageViews = false;\n }\n if (options.trackHistoryChanges && globalScope) {\n globalScope.addEventListener("popstate", trackHistoryPageViewWrapper);\n pushState = globalScope.history.pushState;\n globalScope.history.pushState = new Proxy(globalScope.history.pushState, {\n apply: function(target, thisArg, _a3) {\n var _b2 = __read(_a3, 3), state = _b2[0], unused = _b2[1], url = _b2[2];\n target.apply(thisArg, [state, unused, url]);\n void trackHistoryPageView();\n }\n });\n }\n if (!shouldTrackOnPageLoad()) return [3, 2];\n loggerProvider.log("Tracking page view event");\n _b = (_a2 = amplitude).track;\n return [4, createPageViewEvent()];\n case 1:\n _b.apply(_a2, [_e.sent()]);\n _e.label = 2;\n case 2:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n },\n execute: function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n var pageViewEvent;\n return __generator(this, function(_a2) {\n switch (_a2.label) {\n case 0:\n if (!(options.trackOn === "attribution" && isCampaignEvent(event))) return [3, 2];\n loggerProvider === null || loggerProvider === void 0 ? void 0 : loggerProvider.log("Enriching campaign event to page view event with campaign parameters");\n return [4, createPageViewEvent()];\n case 1:\n pageViewEvent = _a2.sent();\n event.event_type = pageViewEvent.event_type;\n event.event_properties = __assign(__assign({}, event.event_properties), pageViewEvent.event_properties);\n _a2.label = 2;\n case 2:\n return [2, event];\n }\n });\n });\n },\n teardown: function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a2) {\n if (globalScope) {\n globalScope.removeEventListener("popstate", trackHistoryPageViewWrapper);\n if (pushState) {\n globalScope.history.pushState = pushState;\n }\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n }\n };\n plugin.__trackHistoryPageView = trackHistoryPageView;\n return plugin;\n };\n var getCampaignParams = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n _a = omitUndefined;\n return [4, new CampaignParser().parse()];\n case 1:\n return [2, _a.apply(void 0, [_b.sent()])];\n }\n });\n });\n };\n var isCampaignEvent = function(event) {\n if (event.event_type === "$identify" && event.user_properties) {\n var properties = event.user_properties;\n var $set = properties[IdentifyOperation.SET] || {};\n var $unset = properties[IdentifyOperation.UNSET] || {};\n var userProperties_1 = __spreadArray(__spreadArray([], __read(Object.keys($set)), false), __read(Object.keys($unset)), false);\n return Object.keys(BASE_CAMPAIGN).every(function(value) {\n return userProperties_1.includes(value);\n });\n }\n return false;\n };\n var shouldTrackHistoryPageView = function(trackingOption, newURL, oldURL) {\n switch (trackingOption) {\n case "pathOnly":\n return newURL.split("?")[0] !== oldURL.split("?")[0];\n default:\n return newURL !== oldURL;\n }\n };\n\n // node_modules/@amplitude/plugin-web-attribution-browser/lib/esm/helpers.js\n var getStorageKey = function(apiKey, postKey, limit) {\n if (postKey === void 0) {\n postKey = "";\n }\n if (limit === void 0) {\n limit = 10;\n }\n return [AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join("_");\n };\n var domainWithoutSubdomain = function(domain) {\n var parts = domain.split(".");\n if (parts.length <= 2) {\n return domain;\n }\n return parts.slice(parts.length - 2, parts.length).join(".");\n };\n var isNewCampaign = function(current, previous, options) {\n var _a;\n var referrer = current.referrer, referring_domain = current.referring_domain, currentCampaign = __rest(current, ["referrer", "referring_domain"]);\n var _b = previous || {}, _previous_referrer = _b.referrer, prevReferringDomain = _b.referring_domain, previousCampaign = __rest(_b, ["referrer", "referring_domain"]);\n if (current.referring_domain && ((_a = options.excludeReferrers) === null || _a === void 0 ? void 0 : _a.includes(current.referring_domain))) {\n return false;\n }\n var hasNewCampaign = JSON.stringify(currentCampaign) !== JSON.stringify(previousCampaign);\n var hasNewDomain = domainWithoutSubdomain(referring_domain || "") !== domainWithoutSubdomain(prevReferringDomain || "");\n return !previous || hasNewCampaign || hasNewDomain;\n };\n var createCampaignEvent = function(campaign, options) {\n var campaignParameters = __assign(__assign({}, BASE_CAMPAIGN), campaign);\n var identifyEvent = Object.entries(campaignParameters).reduce(function(identify2, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n identify2.setOnce("initial_".concat(key), (_b = value !== null && value !== void 0 ? value : options.initialEmptyValue) !== null && _b !== void 0 ? _b : "EMPTY");\n if (value) {\n return identify2.set(key, value);\n }\n return identify2.unset(key);\n }, new Identify());\n return createIdentifyEvent(identifyEvent);\n };\n\n // node_modules/@amplitude/plugin-web-attribution-browser/lib/esm/web-attribution.js\n var webAttributionPlugin = function() {\n var _this = this;\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var amplitude;\n var options = {};\n var _b = __read(args, 2), clientOrOptions = _b[0], configOrUndefined = _b[1];\n if (clientOrOptions && "init" in clientOrOptions) {\n amplitude = clientOrOptions;\n if (configOrUndefined) {\n options = configOrUndefined;\n }\n } else if (clientOrOptions) {\n options = clientOrOptions;\n }\n var excludeReferrers = (_a = options.excludeReferrers) !== null && _a !== void 0 ? _a : [];\n if (typeof location !== "undefined") {\n excludeReferrers.unshift(location.hostname);\n }\n options = __assign(__assign({ disabled: false, initialEmptyValue: "EMPTY", resetSessionOnNewCampaign: false }, options), { excludeReferrers });\n var plugin = {\n name: "web-attribution",\n type: PluginType.BEFORE,\n setup: function(config, client) {\n var _a2;\n return __awaiter(this, void 0, void 0, function() {\n var receivedType, storage, storageKey, _b2, currentCampaign, previousCampaign, pluginEnabledOverride, campaignEvent;\n return __generator(this, function(_c) {\n switch (_c.label) {\n case 0:\n amplitude = amplitude !== null && amplitude !== void 0 ? amplitude : client;\n if (!amplitude) {\n receivedType = clientOrOptions ? "Options" : "undefined";\n config.loggerProvider.error("Argument of type \'".concat(receivedType, "\' is not assignable to parameter of type \'BrowserClient\'."));\n return [\n 2\n /*return*/\n ];\n }\n if (options.disabled) {\n config.loggerProvider.log("@amplitude/plugin-web-attribution-browser is disabled. Attribution is not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n config.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser.");\n if (!client && !((_a2 = config.attribution) === null || _a2 === void 0 ? void 0 : _a2.disabled)) {\n config.loggerProvider.warn("@amplitude/plugin-web-attribution-browser overrides web attribution behavior defined in @amplitude/analytics-browser. Resolve by disabling web attribution tracking in @amplitude/analytics-browser.");\n config.attribution = {\n disabled: true\n };\n }\n storage = config.cookieStorage;\n storageKey = getStorageKey(config.apiKey, "MKTG");\n return [4, Promise.all([\n new CampaignParser().parse(),\n storage.get(storageKey)\n ])];\n case 1:\n _b2 = __read.apply(void 0, [_c.sent(), 2]), currentCampaign = _b2[0], previousCampaign = _b2[1];\n pluginEnabledOverride = this.__pluginEnabledOverride;\n if (pluginEnabledOverride !== null && pluginEnabledOverride !== void 0 ? pluginEnabledOverride : isNewCampaign(currentCampaign, previousCampaign, options)) {\n if (options.resetSessionOnNewCampaign) {\n amplitude.setSessionId(Date.now());\n config.loggerProvider.log("Created a new session for new campaign.");\n }\n config.loggerProvider.log("Tracking attribution.");\n campaignEvent = createCampaignEvent(currentCampaign, options);\n amplitude.track(campaignEvent);\n void storage.set(storageKey, currentCampaign);\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n },\n execute: function(event) {\n return __awaiter(_this, void 0, void 0, function() {\n return __generator(this, function(_a2) {\n return [2, event];\n });\n });\n }\n };\n plugin.__pluginEnabledOverride = void 0;\n return plugin;\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/storage/local-storage.js\n var MAX_ARRAY_LENGTH = 1e3;\n var LocalStorage = (\n /** @class */\n (function() {\n function LocalStorage2(config) {\n this.loggerProvider = config === null || config === void 0 ? void 0 : config.loggerProvider;\n }\n LocalStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n var random, testStorage, testKey, value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n if (!getGlobalScope()) {\n return [2, false];\n }\n random = String(Date.now());\n testStorage = new LocalStorage2();\n testKey = "AMP_TEST";\n _b.label = 1;\n case 1:\n _b.trys.push([1, 4, 5, 7]);\n return [4, testStorage.set(testKey, random)];\n case 2:\n _b.sent();\n return [4, testStorage.get(testKey)];\n case 3:\n value = _b.sent();\n return [2, value === random];\n case 4:\n _a = _b.sent();\n return [2, false];\n case 5:\n return [4, testStorage.remove(testKey)];\n case 6:\n _b.sent();\n return [\n 7\n /*endfinally*/\n ];\n case 7:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n LocalStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 3]);\n return [4, this.getRaw(key)];\n case 1:\n value = _b.sent();\n if (!value) {\n return [2, void 0];\n }\n return [2, JSON.parse(value)];\n case 2:\n _a = _b.sent();\n return [2, void 0];\n case 3:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n LocalStorage2.prototype.getRaw = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n return [2, ((_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.getItem(key)) || void 0];\n });\n });\n };\n LocalStorage2.prototype.set = function(key, value) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function() {\n var isExceededArraySize, serializedValue, droppedEventsCount;\n return __generator(this, function(_c) {\n isExceededArraySize = Array.isArray(value) && value.length > MAX_ARRAY_LENGTH;\n try {\n serializedValue = isExceededArraySize ? JSON.stringify(value.slice(0, MAX_ARRAY_LENGTH)) : JSON.stringify(value);\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.setItem(key, serializedValue);\n } catch (_d) {\n }\n if (isExceededArraySize) {\n droppedEventsCount = value.length - MAX_ARRAY_LENGTH;\n (_b = this.loggerProvider) === null || _b === void 0 ? void 0 : _b.error("Failed to save ".concat(droppedEventsCount, " events because the queue length exceeded ").concat(MAX_ARRAY_LENGTH, "."));\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n LocalStorage2.prototype.remove = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n try {\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.removeItem(key);\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n LocalStorage2.prototype.reset = function() {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n try {\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.clear();\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return LocalStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/transports/xhr.js\n var XHRTransport = (\n /** @class */\n (function(_super) {\n __extends(XHRTransport2, _super);\n function XHRTransport2() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.state = {\n done: 4\n };\n return _this;\n }\n XHRTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n return [2, new Promise(function(resolve, reject) {\n if (typeof XMLHttpRequest === "undefined") {\n reject(new Error("XHRTransport is not supported."));\n }\n var xhr = new XMLHttpRequest();\n xhr.open("POST", serverUrl, true);\n xhr.onreadystatechange = function() {\n if (xhr.readyState === _this.state.done) {\n try {\n var responsePayload = xhr.responseText;\n var parsedResponsePayload = JSON.parse(responsePayload);\n var result = _this.buildResponse(parsedResponsePayload);\n resolve(result);\n } catch (e) {\n reject(e);\n }\n }\n };\n xhr.setRequestHeader("Content-Type", "application/json");\n xhr.setRequestHeader("Accept", "*/*");\n xhr.send(JSON.stringify(payload));\n })];\n });\n });\n };\n return XHRTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/transports/send-beacon.js\n var SendBeaconTransport = (\n /** @class */\n (function(_super) {\n __extends(SendBeaconTransport2, _super);\n function SendBeaconTransport2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SendBeaconTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n return [2, new Promise(function(resolve, reject) {\n var globalScope = getGlobalScope();\n if (!(globalScope === null || globalScope === void 0 ? void 0 : globalScope.navigator.sendBeacon)) {\n throw new Error("SendBeaconTransport is not supported");\n }\n try {\n var data = JSON.stringify(payload);\n var success = globalScope.navigator.sendBeacon(serverUrl, JSON.stringify(payload));\n if (success) {\n return resolve(_this.buildResponse({\n code: 200,\n events_ingested: payload.events.length,\n payload_size_bytes: data.length,\n server_upload_time: Date.now()\n }));\n }\n return resolve(_this.buildResponse({ code: 500 }));\n } catch (e) {\n reject(e);\n }\n })];\n });\n });\n };\n return SendBeaconTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/config.js\n var getDefaultConfig2 = function() {\n var cookieStorage = new MemoryStorage();\n var trackingOptions = {\n deviceManufacturer: true,\n deviceModel: true,\n ipAddress: true,\n language: true,\n osName: true,\n osVersion: true,\n platform: true\n };\n return {\n cookieExpiration: 365,\n cookieSameSite: "Lax",\n cookieSecure: false,\n cookieStorage,\n cookieUpgrade: true,\n disableCookies: false,\n domain: "",\n sessionTimeout: 30 * 60 * 1e3,\n trackingOptions,\n transportProvider: new FetchTransport()\n };\n };\n var BrowserConfig = (\n /** @class */\n (function(_super) {\n __extends(BrowserConfig2, _super);\n function BrowserConfig2(apiKey, options) {\n var _this = this;\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n var defaultConfig = getDefaultConfig2();\n _this = _super.call(this, __assign(__assign({ flushIntervalMillis: 1e3, flushMaxRetries: 5, flushQueueSize: 30, transportProvider: defaultConfig.transportProvider }, options), { apiKey })) || this;\n _this._optOut = false;\n _this.cookieStorage = (_a = options === null || options === void 0 ? void 0 : options.cookieStorage) !== null && _a !== void 0 ? _a : defaultConfig.cookieStorage;\n _this.deviceId = options === null || options === void 0 ? void 0 : options.deviceId;\n _this.lastEventId = options === null || options === void 0 ? void 0 : options.lastEventId;\n _this.lastEventTime = options === null || options === void 0 ? void 0 : options.lastEventTime;\n _this.optOut = Boolean(options === null || options === void 0 ? void 0 : options.optOut);\n _this.sessionId = options === null || options === void 0 ? void 0 : options.sessionId;\n _this.userId = options === null || options === void 0 ? void 0 : options.userId;\n _this.appVersion = options === null || options === void 0 ? void 0 : options.appVersion;\n _this.attribution = options === null || options === void 0 ? void 0 : options.attribution;\n _this.cookieExpiration = (_b = options === null || options === void 0 ? void 0 : options.cookieExpiration) !== null && _b !== void 0 ? _b : defaultConfig.cookieExpiration;\n _this.cookieSameSite = (_c = options === null || options === void 0 ? void 0 : options.cookieSameSite) !== null && _c !== void 0 ? _c : defaultConfig.cookieSameSite;\n _this.cookieSecure = (_d = options === null || options === void 0 ? void 0 : options.cookieSecure) !== null && _d !== void 0 ? _d : defaultConfig.cookieSecure;\n _this.cookieUpgrade = (_e = options === null || options === void 0 ? void 0 : options.cookieUpgrade) !== null && _e !== void 0 ? _e : defaultConfig.cookieUpgrade;\n _this.defaultTracking = options === null || options === void 0 ? void 0 : options.defaultTracking;\n _this.disableCookies = (_f = options === null || options === void 0 ? void 0 : options.disableCookies) !== null && _f !== void 0 ? _f : defaultConfig.disableCookies;\n _this.defaultTracking = options === null || options === void 0 ? void 0 : options.defaultTracking;\n _this.domain = (_g = options === null || options === void 0 ? void 0 : options.domain) !== null && _g !== void 0 ? _g : defaultConfig.domain;\n _this.partnerId = options === null || options === void 0 ? void 0 : options.partnerId;\n _this.sessionTimeout = (_h = options === null || options === void 0 ? void 0 : options.sessionTimeout) !== null && _h !== void 0 ? _h : defaultConfig.sessionTimeout;\n _this.trackingOptions = (_j = options === null || options === void 0 ? void 0 : options.trackingOptions) !== null && _j !== void 0 ? _j : defaultConfig.trackingOptions;\n return _this;\n }\n Object.defineProperty(BrowserConfig2.prototype, "deviceId", {\n get: function() {\n return this._deviceId;\n },\n set: function(deviceId) {\n if (this._deviceId !== deviceId) {\n this._deviceId = deviceId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "userId", {\n get: function() {\n return this._userId;\n },\n set: function(userId) {\n if (this._userId !== userId) {\n this._userId = userId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "sessionId", {\n get: function() {\n return this._sessionId;\n },\n set: function(sessionId) {\n if (this._sessionId !== sessionId) {\n this._sessionId = sessionId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "optOut", {\n get: function() {\n return this._optOut;\n },\n set: function(optOut) {\n if (this._optOut !== optOut) {\n this._optOut = optOut;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "lastEventTime", {\n get: function() {\n return this._lastEventTime;\n },\n set: function(lastEventTime) {\n if (this._lastEventTime !== lastEventTime) {\n this._lastEventTime = lastEventTime;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "lastEventId", {\n get: function() {\n return this._lastEventId;\n },\n set: function(lastEventId) {\n if (this._lastEventId !== lastEventId) {\n this._lastEventId = lastEventId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n BrowserConfig2.prototype.updateStorage = function() {\n var _a;\n var cache = {\n deviceId: this._deviceId,\n userId: this._userId,\n sessionId: this._sessionId,\n optOut: this._optOut,\n lastEventTime: this._lastEventTime,\n lastEventId: this._lastEventId\n };\n void ((_a = this.cookieStorage) === null || _a === void 0 ? void 0 : _a.set(getCookieName(this.apiKey), cache));\n };\n return BrowserConfig2;\n })(Config)\n );\n var useBrowserConfig = function(apiKey, options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var defaultConfig, deviceId, lastEventId, lastEventTime, optOut, sessionId, userId, cookieStorage, domain, _a, _b, _c;\n var _d;\n var _e, _f;\n return __generator(this, function(_g) {\n switch (_g.label) {\n case 0:\n defaultConfig = getDefaultConfig2();\n deviceId = (_e = options === null || options === void 0 ? void 0 : options.deviceId) !== null && _e !== void 0 ? _e : UUID();\n lastEventId = options === null || options === void 0 ? void 0 : options.lastEventId;\n lastEventTime = options === null || options === void 0 ? void 0 : options.lastEventTime;\n optOut = options === null || options === void 0 ? void 0 : options.optOut;\n sessionId = options === null || options === void 0 ? void 0 : options.sessionId;\n userId = options === null || options === void 0 ? void 0 : options.userId;\n cookieStorage = options === null || options === void 0 ? void 0 : options.cookieStorage;\n domain = options === null || options === void 0 ? void 0 : options.domain;\n _a = BrowserConfig.bind;\n _b = [void 0, apiKey];\n _c = [__assign({}, options)];\n _d = { cookieStorage, deviceId, domain, lastEventId, lastEventTime, optOut, sessionId };\n return [4, createEventsStorage(options)];\n case 1:\n return [2, new (_a.apply(BrowserConfig, _b.concat([__assign.apply(void 0, _c.concat([(_d.storageProvider = _g.sent(), _d.trackingOptions = __assign(__assign({}, defaultConfig.trackingOptions), options === null || options === void 0 ? void 0 : options.trackingOptions), _d.transportProvider = (_f = options === null || options === void 0 ? void 0 : options.transportProvider) !== null && _f !== void 0 ? _f : createTransport(options === null || options === void 0 ? void 0 : options.transport), _d.userId = userId, _d)]))])))()];\n }\n });\n });\n };\n var createCookieStorage = function(overrides, baseConfig) {\n if (baseConfig === void 0) {\n baseConfig = getDefaultConfig2();\n }\n return __awaiter(void 0, void 0, void 0, function() {\n var options, cookieStorage, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n options = __assign(__assign({}, baseConfig), overrides);\n cookieStorage = overrides === null || overrides === void 0 ? void 0 : overrides.cookieStorage;\n _a = !cookieStorage;\n if (_a) return [3, 2];\n return [4, cookieStorage.isEnabled()];\n case 1:\n _a = !_b.sent();\n _b.label = 2;\n case 2:\n if (_a) {\n return [2, createFlexibleStorage(options)];\n }\n return [2, cookieStorage];\n }\n });\n });\n };\n var createFlexibleStorage = function(options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var storage, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n storage = new CookieStorage({\n domain: options.domain,\n expirationDays: options.cookieExpiration,\n sameSite: options.cookieSameSite,\n secure: options.cookieSecure\n });\n _a = options.disableCookies;\n if (_a) return [3, 2];\n return [4, storage.isEnabled()];\n case 1:\n _a = !_b.sent();\n _b.label = 2;\n case 2:\n if (!_a) return [3, 4];\n storage = new LocalStorage();\n return [4, storage.isEnabled()];\n case 3:\n if (!_b.sent()) {\n storage = new MemoryStorage();\n }\n _b.label = 4;\n case 4:\n return [2, storage];\n }\n });\n });\n };\n var createEventsStorage = function(overrides) {\n return __awaiter(void 0, void 0, void 0, function() {\n var hasStorageProviderProperty, loggerProvider, _a, _b, storage, _c, e_1_1;\n var e_1, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n hasStorageProviderProperty = overrides && Object.prototype.hasOwnProperty.call(overrides, "storageProvider");\n loggerProvider = overrides && overrides.loggerProvider;\n if (!(!hasStorageProviderProperty || overrides.storageProvider)) return [3, 9];\n _e.label = 1;\n case 1:\n _e.trys.push([1, 7, 8, 9]);\n _a = __values([overrides === null || overrides === void 0 ? void 0 : overrides.storageProvider, new LocalStorage({ loggerProvider })]), _b = _a.next();\n _e.label = 2;\n case 2:\n if (!!_b.done) return [3, 6];\n storage = _b.value;\n _c = storage;\n if (!_c) return [3, 4];\n return [4, storage.isEnabled()];\n case 3:\n _c = _e.sent();\n _e.label = 4;\n case 4:\n if (_c) {\n return [2, storage];\n }\n _e.label = 5;\n case 5:\n _b = _a.next();\n return [3, 2];\n case 6:\n return [3, 9];\n case 7:\n e_1_1 = _e.sent();\n e_1 = { error: e_1_1 };\n return [3, 9];\n case 8:\n try {\n if (_b && !_b.done && (_d = _a.return)) _d.call(_a);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 9:\n return [2, void 0];\n }\n });\n });\n };\n var createTransport = function(transport) {\n if (transport === TransportType.XHR) {\n return new XHRTransport();\n }\n if (transport === TransportType.SendBeacon) {\n return new SendBeaconTransport();\n }\n return getDefaultConfig2().transportProvider;\n };\n var getTopLevelDomain = function(url) {\n return __awaiter(void 0, void 0, void 0, function() {\n var host, parts, levels, storageKey, i, i, domain, options, storage, value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, new CookieStorage().isEnabled()];\n case 1:\n if (!_a.sent() || !url && typeof location === "undefined") {\n return [2, ""];\n }\n host = url !== null && url !== void 0 ? url : location.hostname;\n parts = host.split(".");\n levels = [];\n storageKey = "AMP_TLDTEST";\n for (i = parts.length - 2; i >= 0; --i) {\n levels.push(parts.slice(i).join("."));\n }\n i = 0;\n _a.label = 2;\n case 2:\n if (!(i < levels.length)) return [3, 7];\n domain = levels[i];\n options = { domain: "." + domain };\n storage = new CookieStorage(options);\n return [4, storage.set(storageKey, 1)];\n case 3:\n _a.sent();\n return [4, storage.get(storageKey)];\n case 4:\n value = _a.sent();\n if (!value) return [3, 6];\n return [4, storage.remove(storageKey)];\n case 5:\n _a.sent();\n return [2, "." + domain];\n case 6:\n i++;\n return [3, 2];\n case 7:\n return [2, ""];\n }\n });\n });\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/constants.js\n var DEFAULT_EVENT_PREFIX = "[Amplitude]";\n var DEFAULT_PAGE_VIEW_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Page Viewed");\n var DEFAULT_FORM_START_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Form Started");\n var DEFAULT_FORM_SUBMIT_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Form Submitted");\n var DEFAULT_FILE_DOWNLOAD_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " File Downloaded");\n var DEFAULT_SESSION_START_EVENT = "session_start";\n var DEFAULT_SESSION_END_EVENT = "session_end";\n var FILE_EXTENSION = "".concat(DEFAULT_EVENT_PREFIX, " File Extension");\n var FILE_NAME = "".concat(DEFAULT_EVENT_PREFIX, " File Name");\n var LINK_ID = "".concat(DEFAULT_EVENT_PREFIX, " Link ID");\n var LINK_TEXT = "".concat(DEFAULT_EVENT_PREFIX, " Link Text");\n var LINK_URL = "".concat(DEFAULT_EVENT_PREFIX, " Link URL");\n var FORM_ID = "".concat(DEFAULT_EVENT_PREFIX, " Form ID");\n var FORM_NAME = "".concat(DEFAULT_EVENT_PREFIX, " Form Name");\n var FORM_DESTINATION = "".concat(DEFAULT_EVENT_PREFIX, " Form Destination");\n\n // node_modules/@amplitude/analytics-browser/lib/esm/cookie-migration/index.js\n var parseLegacyCookies = function(apiKey, options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var storage, oldCookieName, cookies, _a, deviceId, userId, optOut, sessionId, lastEventTime, lastEventId;\n var _b;\n return __generator(this, function(_c) {\n switch (_c.label) {\n case 0:\n return [4, createCookieStorage(options)];\n case 1:\n storage = _c.sent();\n oldCookieName = getOldCookieName(apiKey);\n return [4, storage.getRaw(oldCookieName)];\n case 2:\n cookies = _c.sent();\n if (!cookies) {\n return [2, {\n optOut: false\n }];\n }\n if (!((_b = options.cookieUpgrade) !== null && _b !== void 0 ? _b : getDefaultConfig2().cookieUpgrade)) return [3, 4];\n return [4, storage.remove(oldCookieName)];\n case 3:\n _c.sent();\n _c.label = 4;\n case 4:\n _a = __read(cookies.split("."), 6), deviceId = _a[0], userId = _a[1], optOut = _a[2], sessionId = _a[3], lastEventTime = _a[4], lastEventId = _a[5];\n return [2, {\n deviceId,\n userId: decode(userId),\n sessionId: parseTime(sessionId),\n lastEventId: parseTime(lastEventId),\n lastEventTime: parseTime(lastEventTime),\n optOut: Boolean(optOut)\n }];\n }\n });\n });\n };\n var parseTime = function(num) {\n var integer = parseInt(num, 32);\n if (isNaN(integer)) {\n return void 0;\n }\n return integer;\n };\n var decode = function(value) {\n if (!atob || !escape || !value) {\n return void 0;\n }\n try {\n return decodeURIComponent(escape(atob(value)));\n } catch (_a) {\n return void 0;\n }\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js\n var import_ua_parser_js = __toESM(require_ua_parser());\n\n // node_modules/@amplitude/analytics-browser/lib/esm/version.js\n var VERSION = "1.13.4";\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js\n var BROWSER_PLATFORM = "Web";\n var IP_ADDRESS = "$remote";\n var Context = (\n /** @class */\n (function() {\n function Context2() {\n this.name = "context";\n this.type = PluginType.BEFORE;\n this.library = "amplitude-ts/".concat(VERSION);\n if (typeof navigator !== "undefined") {\n this.userAgent = navigator.userAgent;\n }\n this.uaResult = new import_ua_parser_js.default(this.userAgent).getResult();\n }\n Context2.prototype.setup = function(config) {\n this.config = config;\n return Promise.resolve(void 0);\n };\n Context2.prototype.execute = function(context) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function() {\n var time, osName, osVersion, deviceModel, deviceVendor, lastEventId, nextEventId, event;\n return __generator(this, function(_c) {\n time = (/* @__PURE__ */ new Date()).getTime();\n osName = this.uaResult.browser.name;\n osVersion = this.uaResult.browser.version;\n deviceModel = this.uaResult.device.model || this.uaResult.os.name;\n deviceVendor = this.uaResult.device.vendor;\n lastEventId = (_a = this.config.lastEventId) !== null && _a !== void 0 ? _a : -1;\n nextEventId = (_b = context.event_id) !== null && _b !== void 0 ? _b : lastEventId + 1;\n this.config.lastEventId = nextEventId;\n if (!context.time) {\n this.config.lastEventTime = time;\n }\n event = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ user_id: this.config.userId, device_id: this.config.deviceId, session_id: this.config.sessionId, time }, this.config.appVersion && { app_version: this.config.appVersion }), this.config.trackingOptions.platform && { platform: BROWSER_PLATFORM }), this.config.trackingOptions.osName && { os_name: osName }), this.config.trackingOptions.osVersion && { os_version: osVersion }), this.config.trackingOptions.deviceManufacturer && { device_manufacturer: deviceVendor }), this.config.trackingOptions.deviceModel && { device_model: deviceModel }), this.config.trackingOptions.language && { language: getLanguage2() }), this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS }), { insert_id: UUID(), partner_id: this.config.partnerId, plan: this.config.plan }), this.config.ingestionMetadata && {\n ingestion_metadata: {\n source_name: this.config.ingestionMetadata.sourceName,\n source_version: this.config.ingestionMetadata.sourceVersion\n }\n }), context), { event_id: nextEventId, library: this.library, user_agent: this.userAgent });\n return [2, event];\n });\n });\n };\n return Context2;\n })()\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/default-page-view-event-enrichment.js\n var eventPropertyMap = {\n page_domain: "".concat(DEFAULT_EVENT_PREFIX, " Page Domain"),\n page_location: "".concat(DEFAULT_EVENT_PREFIX, " Page Location"),\n page_path: "".concat(DEFAULT_EVENT_PREFIX, " Page Path"),\n page_title: "".concat(DEFAULT_EVENT_PREFIX, " Page Title"),\n page_url: "".concat(DEFAULT_EVENT_PREFIX, " Page URL")\n };\n var defaultPageViewEventEnrichment = function() {\n var name = "@amplitude/plugin-default-page-view-event-enrichment-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, void 0];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n if (event.event_type === DEFAULT_PAGE_VIEW_EVENT && event.event_properties) {\n event.event_properties = Object.entries(event.event_properties).reduce(function(acc, _a2) {\n var _b = __read(_a2, 2), key = _b[0], value = _b[1];\n var transformedPropertyName = eventPropertyMap[key];\n if (transformedPropertyName) {\n acc[transformedPropertyName] = value;\n } else {\n acc[key] = value;\n }\n return acc;\n }, {});\n }\n return [2, event];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/file-download-tracking.js\n var fileDownloadTracking = function() {\n var observer;\n var eventListeners = [];\n var addEventListener = function(element, type2, handler) {\n element.addEventListener(type2, handler);\n eventListeners.push({\n element,\n type: type2,\n handler\n });\n };\n var removeClickListeners = function() {\n eventListeners.forEach(function(_a) {\n var element = _a.element, type2 = _a.type, handler = _a.handler;\n element === null || element === void 0 ? void 0 : element.removeEventListener(type2, handler);\n });\n eventListeners = [];\n };\n var name = "@amplitude/plugin-file-download-tracking-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function(config, amplitude) {\n return __awaiter(void 0, void 0, void 0, function() {\n var addFileDownloadListener, ext, links;\n return __generator(this, function(_a) {\n if (!amplitude) {\n config.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n if (typeof document === "undefined") {\n return [\n 2\n /*return*/\n ];\n }\n addFileDownloadListener = function(a) {\n var url;\n try {\n url = new URL(a.href, window.location.href);\n } catch (_a2) {\n return;\n }\n var result = ext.exec(url.href);\n var fileExtension = result === null || result === void 0 ? void 0 : result[1];\n if (fileExtension) {\n addEventListener(a, "click", function() {\n var _a2;\n if (fileExtension) {\n amplitude.track(DEFAULT_FILE_DOWNLOAD_EVENT, (_a2 = {}, _a2[FILE_EXTENSION] = fileExtension, _a2[FILE_NAME] = url.pathname, _a2[LINK_ID] = a.id, _a2[LINK_TEXT] = a.text, _a2[LINK_URL] = a.href, _a2));\n }\n });\n }\n };\n ext = /\\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/;\n links = Array.from(document.getElementsByTagName("a"));\n links.forEach(addFileDownloadListener);\n if (typeof MutationObserver !== "undefined") {\n observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(node) {\n if (node.nodeName === "A") {\n addFileDownloadListener(node);\n }\n if ("querySelectorAll" in node && typeof node.querySelectorAll === "function") {\n Array.from(node.querySelectorAll("a")).map(addFileDownloadListener);\n }\n });\n });\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, event];\n });\n });\n };\n var teardown = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n observer === null || observer === void 0 ? void 0 : observer.disconnect();\n removeClickListeners();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute,\n teardown\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/form-interaction-tracking.js\n var formInteractionTracking = function() {\n var observer;\n var eventListeners = [];\n var addEventListener = function(element, type2, handler) {\n element.addEventListener(type2, handler);\n eventListeners.push({\n element,\n type: type2,\n handler\n });\n };\n var removeClickListeners = function() {\n eventListeners.forEach(function(_a) {\n var element = _a.element, type2 = _a.type, handler = _a.handler;\n element === null || element === void 0 ? void 0 : element.removeEventListener(type2, handler);\n });\n eventListeners = [];\n };\n var name = "@amplitude/plugin-form-interaction-tracking-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function(config, amplitude) {\n return __awaiter(void 0, void 0, void 0, function() {\n var addFormInteractionListener, forms;\n return __generator(this, function(_a) {\n if (!amplitude) {\n config.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n if (typeof document === "undefined") {\n return [\n 2\n /*return*/\n ];\n }\n addFormInteractionListener = function(form) {\n var hasFormChanged = false;\n addEventListener(form, "change", function() {\n var _a2;\n if (!hasFormChanged) {\n amplitude.track(DEFAULT_FORM_START_EVENT, (_a2 = {}, _a2[FORM_ID] = form.id, _a2[FORM_NAME] = form.name, _a2[FORM_DESTINATION] = form.action, _a2));\n }\n hasFormChanged = true;\n });\n addEventListener(form, "submit", function() {\n var _a2, _b;\n if (!hasFormChanged) {\n amplitude.track(DEFAULT_FORM_START_EVENT, (_a2 = {}, _a2[FORM_ID] = form.id, _a2[FORM_NAME] = form.name, _a2[FORM_DESTINATION] = form.action, _a2));\n }\n amplitude.track(DEFAULT_FORM_SUBMIT_EVENT, (_b = {}, _b[FORM_ID] = form.id, _b[FORM_NAME] = form.name, _b[FORM_DESTINATION] = form.action, _b));\n hasFormChanged = false;\n });\n };\n forms = Array.from(document.getElementsByTagName("form"));\n forms.forEach(addFormInteractionListener);\n if (typeof MutationObserver !== "undefined") {\n observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(node) {\n if (node.nodeName === "FORM") {\n addFormInteractionListener(node);\n }\n if ("querySelectorAll" in node && typeof node.querySelectorAll === "function") {\n Array.from(node.querySelectorAll("form")).map(addFormInteractionListener);\n }\n });\n });\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, event];\n });\n });\n };\n var teardown = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n observer === null || observer === void 0 ? void 0 : observer.disconnect();\n removeClickListeners();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute,\n teardown\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/utils/snippet-helper.js\n var convertProxyObjectToRealObject = function(instance, queue) {\n for (var i = 0; i < queue.length; i++) {\n var _a = queue[i], name_1 = _a.name, args = _a.args, resolve = _a.resolve;\n var fn = instance && instance[name_1];\n if (typeof fn === "function") {\n var result = fn.apply(instance, args);\n if (typeof resolve === "function") {\n resolve(result === null || result === void 0 ? void 0 : result.promise);\n }\n }\n }\n return instance;\n };\n var isInstanceProxy = function(instance) {\n var instanceProxy = instance;\n return instanceProxy && instanceProxy._q !== void 0;\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/browser-client.js\n var AmplitudeBrowser = (\n /** @class */\n (function(_super) {\n __extends(AmplitudeBrowser2, _super);\n function AmplitudeBrowser2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AmplitudeBrowser2.prototype.init = function(apiKey, userId, options) {\n if (apiKey === void 0) {\n apiKey = "";\n }\n return returnWrapper(this._init(__assign(__assign({}, options), { userId, apiKey })));\n };\n AmplitudeBrowser2.prototype._init = function(options) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _r, _s, _t, _u, _v, _w;\n return __awaiter(this, void 0, void 0, function() {\n var _x, _y, _z, legacyCookies, cookieStorage, previousCookies, queryParams, deviceId, sessionId, optOut, lastEventId, lastEventTime, userId, browserOptions, isNewSession, connector, webAttribution, pageViewTrackingOptions;\n var _this = this;\n return __generator(this, function(_0) {\n switch (_0.label) {\n case 0:\n if (this.initializing) {\n return [\n 2\n /*return*/\n ];\n }\n this.initializing = true;\n _x = options;\n if (!options.disableCookies) return [3, 1];\n _y = "";\n return [3, 5];\n case 1:\n if (!((_a = options.domain) !== null && _a !== void 0)) return [3, 2];\n _z = _a;\n return [3, 4];\n case 2:\n return [4, getTopLevelDomain()];\n case 3:\n _z = _0.sent();\n _0.label = 4;\n case 4:\n _y = _z;\n _0.label = 5;\n case 5:\n _x.domain = _y;\n return [4, parseLegacyCookies(options.apiKey, options)];\n case 6:\n legacyCookies = _0.sent();\n return [4, createCookieStorage(options)];\n case 7:\n cookieStorage = _0.sent();\n return [4, cookieStorage.get(getCookieName(options.apiKey))];\n case 8:\n previousCookies = _0.sent();\n queryParams = getQueryParams();\n deviceId = (_d = (_c = (_b = options.deviceId) !== null && _b !== void 0 ? _b : queryParams.deviceId) !== null && _c !== void 0 ? _c : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deviceId) !== null && _d !== void 0 ? _d : legacyCookies.deviceId;\n sessionId = (_e = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.sessionId) !== null && _e !== void 0 ? _e : legacyCookies.sessionId;\n optOut = (_g = (_f = options.optOut) !== null && _f !== void 0 ? _f : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.optOut) !== null && _g !== void 0 ? _g : legacyCookies.optOut;\n lastEventId = (_h = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.lastEventId) !== null && _h !== void 0 ? _h : legacyCookies.lastEventId;\n lastEventTime = (_j = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.lastEventTime) !== null && _j !== void 0 ? _j : legacyCookies.lastEventTime;\n userId = (_l = (_k = options.userId) !== null && _k !== void 0 ? _k : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.userId) !== null && _l !== void 0 ? _l : legacyCookies.userId;\n this.previousSessionDeviceId = (_m = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deviceId) !== null && _m !== void 0 ? _m : legacyCookies.deviceId;\n this.previousSessionUserId = (_o = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.userId) !== null && _o !== void 0 ? _o : legacyCookies.userId;\n return [4, useBrowserConfig(options.apiKey, __assign(__assign({}, options), { deviceId, sessionId, optOut, lastEventId, lastEventTime, userId, cookieStorage }))];\n case 9:\n browserOptions = _0.sent();\n return [4, _super.prototype._init.call(this, browserOptions)];\n case 10:\n _0.sent();\n isNewSession = false;\n if (\n // user has never sent an event\n !this.config.lastEventTime || // user has no previous session ID\n !this.config.sessionId || // has sent an event and has previous session but expired\n this.config.lastEventTime && Date.now() - this.config.lastEventTime > this.config.sessionTimeout\n ) {\n this.setSessionId((_r = (_p = options.sessionId) !== null && _p !== void 0 ? _p : this.config.sessionId) !== null && _r !== void 0 ? _r : Date.now());\n isNewSession = true;\n }\n connector = getAnalyticsConnector(options.instanceName);\n connector.identityStore.setIdentity({\n userId: this.config.userId,\n deviceId: this.config.deviceId\n });\n return [4, this.add(new Destination()).promise];\n case 11:\n _0.sent();\n return [4, this.add(new Context()).promise];\n case 12:\n _0.sent();\n return [4, this.add(new IdentityEventSender()).promise];\n case 13:\n _0.sent();\n if (!isFileDownloadTrackingEnabled(this.config.defaultTracking)) return [3, 15];\n return [4, this.add(fileDownloadTracking()).promise];\n case 14:\n _0.sent();\n _0.label = 15;\n case 15:\n if (!isFormInteractionTrackingEnabled(this.config.defaultTracking)) return [3, 17];\n return [4, this.add(formInteractionTracking()).promise];\n case 16:\n _0.sent();\n _0.label = 17;\n case 17:\n if (!!((_s = this.config.attribution) === null || _s === void 0 ? void 0 : _s.disabled)) return [3, 19];\n webAttribution = webAttributionPlugin({\n excludeReferrers: (_t = this.config.attribution) === null || _t === void 0 ? void 0 : _t.excludeReferrers,\n initialEmptyValue: (_u = this.config.attribution) === null || _u === void 0 ? void 0 : _u.initialEmptyValue,\n resetSessionOnNewCampaign: (_v = this.config.attribution) === null || _v === void 0 ? void 0 : _v.resetSessionOnNewCampaign\n });\n webAttribution.__pluginEnabledOverride = isNewSession || ((_w = this.config.attribution) === null || _w === void 0 ? void 0 : _w.trackNewCampaigns) ? void 0 : false;\n return [4, this.add(webAttribution).promise];\n case 18:\n _0.sent();\n _0.label = 19;\n case 19:\n pageViewTrackingOptions = getPageViewTrackingConfig(this.config);\n pageViewTrackingOptions.eventType = pageViewTrackingOptions.eventType || DEFAULT_PAGE_VIEW_EVENT;\n return [4, this.add(pageViewTrackingPlugin(pageViewTrackingOptions)).promise];\n case 20:\n _0.sent();\n return [4, this.add(defaultPageViewEventEnrichment()).promise];\n case 21:\n _0.sent();\n this.initializing = false;\n return [4, this.runQueuedFunctions("dispatchQ")];\n case 22:\n _0.sent();\n connector.eventBridge.setEventReceiver(function(event) {\n void _this.track(event.eventType, event.eventProperties);\n });\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeBrowser2.prototype.getUserId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.userId;\n };\n AmplitudeBrowser2.prototype.setUserId = function(userId) {\n if (!this.config) {\n this.q.push(this.setUserId.bind(this, userId));\n return;\n }\n if (userId !== this.config.userId || userId === void 0) {\n this.config.userId = userId;\n setConnectorUserId(userId, this.config.instanceName);\n }\n };\n AmplitudeBrowser2.prototype.getDeviceId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.deviceId;\n };\n AmplitudeBrowser2.prototype.setDeviceId = function(deviceId) {\n if (!this.config) {\n this.q.push(this.setDeviceId.bind(this, deviceId));\n return;\n }\n this.config.deviceId = deviceId;\n setConnectorDeviceId(deviceId, this.config.instanceName);\n };\n AmplitudeBrowser2.prototype.setOptOut = function(optOut) {\n setConnectorOptOut(optOut, this.config.instanceName);\n _super.prototype.setOptOut.call(this, optOut);\n };\n AmplitudeBrowser2.prototype.reset = function() {\n this.setDeviceId(UUID());\n this.setUserId(void 0);\n };\n AmplitudeBrowser2.prototype.getSessionId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.sessionId;\n };\n AmplitudeBrowser2.prototype.setSessionId = function(sessionId) {\n var _a;\n if (!this.config) {\n this.q.push(this.setSessionId.bind(this, sessionId));\n return;\n }\n if (sessionId === this.config.sessionId) {\n return;\n }\n var previousSessionId = this.getSessionId();\n var lastEventTime = this.config.lastEventTime;\n var lastEventId = (_a = this.config.lastEventId) !== null && _a !== void 0 ? _a : -1;\n this.config.sessionId = sessionId;\n this.config.lastEventTime = void 0;\n if (isSessionTrackingEnabled(this.config.defaultTracking)) {\n if (previousSessionId && lastEventTime) {\n this.track(DEFAULT_SESSION_END_EVENT, void 0, {\n device_id: this.previousSessionDeviceId,\n event_id: ++lastEventId,\n session_id: previousSessionId,\n time: lastEventTime + 1,\n user_id: this.previousSessionUserId\n });\n }\n this.config.lastEventTime = this.config.sessionId;\n this.track(DEFAULT_SESSION_START_EVENT, void 0, {\n event_id: ++lastEventId,\n session_id: this.config.sessionId,\n time: this.config.lastEventTime\n });\n }\n this.previousSessionDeviceId = this.config.deviceId;\n this.previousSessionUserId = this.config.userId;\n };\n AmplitudeBrowser2.prototype.extendSession = function() {\n if (!this.config) {\n this.q.push(this.extendSession.bind(this));\n return;\n }\n this.config.lastEventTime = Date.now();\n };\n AmplitudeBrowser2.prototype.setTransport = function(transport) {\n if (!this.config) {\n this.q.push(this.setTransport.bind(this, transport));\n return;\n }\n this.config.transportProvider = createTransport(transport);\n };\n AmplitudeBrowser2.prototype.identify = function(identify2, eventOptions) {\n if (isInstanceProxy(identify2)) {\n var queue = identify2._q;\n identify2._q = [];\n identify2 = convertProxyObjectToRealObject(new Identify(), queue);\n }\n if (eventOptions === null || eventOptions === void 0 ? void 0 : eventOptions.user_id) {\n this.setUserId(eventOptions.user_id);\n }\n if (eventOptions === null || eventOptions === void 0 ? void 0 : eventOptions.device_id) {\n this.setDeviceId(eventOptions.device_id);\n }\n return _super.prototype.identify.call(this, identify2, eventOptions);\n };\n AmplitudeBrowser2.prototype.groupIdentify = function(groupType, groupName, identify2, eventOptions) {\n if (isInstanceProxy(identify2)) {\n var queue = identify2._q;\n identify2._q = [];\n identify2 = convertProxyObjectToRealObject(new Identify(), queue);\n }\n return _super.prototype.groupIdentify.call(this, groupType, groupName, identify2, eventOptions);\n };\n AmplitudeBrowser2.prototype.revenue = function(revenue2, eventOptions) {\n if (isInstanceProxy(revenue2)) {\n var queue = revenue2._q;\n revenue2._q = [];\n revenue2 = convertProxyObjectToRealObject(new Revenue(), queue);\n }\n return _super.prototype.revenue.call(this, revenue2, eventOptions);\n };\n AmplitudeBrowser2.prototype.process = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var currentTime, lastEventTime, timeSinceLastEvent;\n return __generator(this, function(_a) {\n currentTime = Date.now();\n lastEventTime = this.config.lastEventTime || Date.now();\n timeSinceLastEvent = currentTime - lastEventTime;\n if (event.event_type !== DEFAULT_SESSION_START_EVENT && event.event_type !== DEFAULT_SESSION_END_EVENT && (!event.session_id || event.session_id === this.getSessionId()) && timeSinceLastEvent > this.config.sessionTimeout) {\n this.setSessionId(currentTime);\n }\n return [2, _super.prototype.process.call(this, event)];\n });\n });\n };\n return AmplitudeBrowser2;\n })(AmplitudeCore)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/browser-client-factory.js\n var createInstance = function() {\n var client = new AmplitudeBrowser();\n return {\n init: debugWrapper(client.init.bind(client), "init", getClientLogConfig(client), getClientStates(client, ["config"])),\n add: debugWrapper(client.add.bind(client), "add", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.plugins"])),\n remove: debugWrapper(client.remove.bind(client), "remove", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.plugins"])),\n track: debugWrapper(client.track.bind(client), "track", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n logEvent: debugWrapper(client.logEvent.bind(client), "logEvent", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n identify: debugWrapper(client.identify.bind(client), "identify", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n groupIdentify: debugWrapper(client.groupIdentify.bind(client), "groupIdentify", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n setGroup: debugWrapper(client.setGroup.bind(client), "setGroup", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n revenue: debugWrapper(client.revenue.bind(client), "revenue", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n flush: debugWrapper(client.flush.bind(client), "flush", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n getUserId: debugWrapper(client.getUserId.bind(client), "getUserId", getClientLogConfig(client), getClientStates(client, ["config", "config.userId"])),\n setUserId: debugWrapper(client.setUserId.bind(client), "setUserId", getClientLogConfig(client), getClientStates(client, ["config", "config.userId"])),\n getDeviceId: debugWrapper(client.getDeviceId.bind(client), "getDeviceId", getClientLogConfig(client), getClientStates(client, ["config", "config.deviceId"])),\n setDeviceId: debugWrapper(client.setDeviceId.bind(client), "setDeviceId", getClientLogConfig(client), getClientStates(client, ["config", "config.deviceId"])),\n reset: debugWrapper(client.reset.bind(client), "reset", getClientLogConfig(client), getClientStates(client, ["config", "config.userId", "config.deviceId"])),\n getSessionId: debugWrapper(client.getSessionId.bind(client), "getSessionId", getClientLogConfig(client), getClientStates(client, ["config"])),\n setSessionId: debugWrapper(client.setSessionId.bind(client), "setSessionId", getClientLogConfig(client), getClientStates(client, ["config"])),\n extendSession: debugWrapper(client.extendSession.bind(client), "extendSession", getClientLogConfig(client), getClientStates(client, ["config"])),\n setOptOut: debugWrapper(client.setOptOut.bind(client), "setOptOut", getClientLogConfig(client), getClientStates(client, ["config"])),\n setTransport: debugWrapper(client.setTransport.bind(client), "setTransport", getClientLogConfig(client), getClientStates(client, ["config"]))\n };\n };\n var browser_client_factory_default = createInstance();\n\n // node_modules/@amplitude/analytics-browser/lib/esm/index.js\n var add = browser_client_factory_default.add;\n var extendSession = browser_client_factory_default.extendSession;\n var flush = browser_client_factory_default.flush;\n var getDeviceId = browser_client_factory_default.getDeviceId;\n var getSessionId = browser_client_factory_default.getSessionId;\n var getUserId = browser_client_factory_default.getUserId;\n var groupIdentify = browser_client_factory_default.groupIdentify;\n var identify = browser_client_factory_default.identify;\n var init = browser_client_factory_default.init;\n var logEvent = browser_client_factory_default.logEvent;\n var remove = browser_client_factory_default.remove;\n var reset = browser_client_factory_default.reset;\n var revenue = browser_client_factory_default.revenue;\n var setDeviceId = browser_client_factory_default.setDeviceId;\n var setGroup = browser_client_factory_default.setGroup;\n var setOptOut = browser_client_factory_default.setOptOut;\n var setSessionId = browser_client_factory_default.setSessionId;\n var setTransport = browser_client_factory_default.setTransport;\n var setUserId = browser_client_factory_default.setUserId;\n var track = browser_client_factory_default.track;\n\n // packages/dev-tools/client/tracking.ts\n var dispatch = (eventName) => {\n window.dispatchEvent(\n new CustomEvent(`builderdevtools`, { detail: { eventName } })\n );\n };\n async function loadUserDataFromLocal() {\n return apiLocalConfig();\n }\n var initTracking = async () => {\n const url = new URL(window.location.href);\n const hash = url.hash;\n const userIdHash = `#${CONNECTED_USER_ID_QS}=`;\n const uniqueId = Math.random().toString(36).substring(2, 15);\n const localConfig = await loadUserDataFromLocal();\n init("f1d2eb79aecd01b28c8a371ea5d1751c", localConfig?.userId || uniqueId, {\n logLevel: esm_exports.LogLevel.None,\n serverUrl: AMPLITUDE_PROXY_URL,\n flushIntervalMillis: 500\n });\n const identifyObj = new Identify();\n identify(identifyObj, {\n device_id: localConfig?.deviceId,\n user_id: localConfig?.userId || uniqueId\n });\n let builderUserId = `anonymous`;\n if (hash.startsWith(userIdHash)) {\n builderUserId = hash.slice(userIdHash.length);\n if (builderUserId) {\n setBuilderUserId(builderUserId);\n url.hash = "";\n window.history.replaceState({}, "", url.href);\n }\n }\n dispatch("init");\n };\n var setBuilderUserId = (builderUserId) => {\n if (typeof builderUserId === "string" && builderUserId.length > 0) {\n const t = getTracking();\n setTracking({\n ...t,\n builderUserId\n });\n }\n };\n var getTracking = () => {\n const ls = localStorage.getItem(TRACKING_KEY);\n if (ls) {\n try {\n let t = JSON.parse(ls);\n if (!t.ctas || typeof t.ctas !== "object") {\n t = setTracking({\n ...t,\n ctas: {}\n });\n }\n if (t.menuOpenedTs) {\n t = setTracking({\n ...t,\n ctas: {\n ...t.ctas,\n menuOpened: t.menuOpenedTs\n }\n });\n delete t.menuOpenedTs;\n }\n return t;\n } catch (e) {\n console.error(e);\n }\n }\n return setTracking({\n firstVisitTs: Date.now(),\n ctas: {},\n builderUserId: ""\n });\n };\n var setTracking = (t) => {\n try {\n localStorage.setItem(TRACKING_KEY, JSON.stringify(t));\n } catch (e) {\n console.error(e);\n }\n return t;\n };\n var hasCTA = (ctaName) => {\n const t = getTracking();\n return !!t.ctas[ctaName];\n };\n var setCTA = (ctaName) => {\n const t = getTracking();\n return setTracking({\n ...t,\n ctas: {\n ...t.ctas,\n [ctaName]: Date.now()\n }\n });\n };\n var TRACKING_KEY = "builderDevtools";\n\n // packages/dev-tools/client/menu/pages/component-input.ts\n function initComponentInputSection(shadow) {\n initRegisterInput(shadow);\n initComponentOpenSource(shadow);\n initComponentInputName(shadow);\n initComponentInputType(shadow);\n }\n function initRegisterInput(shadow) {\n const inputReg = shadow.getElementById("input-register");\n inputReg.addEventListener("change", async (ev) => {\n ev.stopPropagation();\n const inputName = shadow.getElementById("input-name");\n const nav = shadow.querySelector(".nav-cmp-input");\n nav.classList.add("input-loading");\n nav.classList.remove("input-enabled");\n const cmpId = inputName.dataset.id;\n const propName = inputName.dataset.prop;\n const registry = await apiSetComponentInput({\n cmpId,\n name: propName,\n registerInput: inputReg.checked\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentInput(shadow, cmpId, propName);\n renderComponentDetail(shadow, cmpId);\n nav.classList.remove("input-loading");\n });\n }\n function initComponentOpenSource(shadow) {\n const openSourceBtn = shadow.getElementById(\n "input-open-source"\n );\n openSourceBtn.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const cmp = APP_STATE.components.find((c) => c.id === target?.dataset.id);\n if (cmp) {\n apiLaunchEditor({ filePath: cmp.filePath });\n }\n });\n }\n function initComponentInputName(shadow) {\n const inputName = shadow.getElementById("input-name");\n const inputWrapper = inputName.closest(".ui-text-input");\n let initInputName = "";\n let savedTmr;\n inputName.addEventListener("focus", (ev) => {\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n ev.stopPropagation();\n initInputName = inputName.value;\n });\n inputName.addEventListener("blur", async (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (inputName.value !== initInputName) {\n if (inputName.value.trim().length < 3) {\n inputName.value = initInputName;\n return;\n }\n inputWrapper.classList.add("saved");\n savedTmr = setTimeout(() => {\n inputWrapper.classList.remove("saved");\n }, 3e3);\n const cmpId = inputName.dataset.id;\n const name = inputName.dataset.prop;\n const registry = await apiSetComponentInput({\n cmpId,\n name,\n friendlyName: inputName.value\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentList(shadow);\n renderComponentDetail(shadow, cmpId);\n renderComponentInput(shadow, cmpId, name);\n }\n });\n inputName.addEventListener("keyup", (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (ev.key === "Escape") {\n inputName.value = initInputName;\n inputName.blur();\n } else if (ev.key === "Enter") {\n inputName.blur();\n }\n });\n }\n function initComponentInputType(shadow) {\n const inputType = shadow.getElementById("input-type");\n inputType.addEventListener("change", async (ev) => {\n ev.stopPropagation();\n const cmpId = inputType.dataset.id;\n const name = inputType.dataset.prop;\n const registry = await apiSetComponentInput({\n cmpId,\n name,\n type: inputType.value\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentList(shadow);\n renderComponentDetail(shadow, cmpId);\n renderComponentInput(shadow, cmpId, name);\n });\n }\n function renderComponentInput(shadow, cmpId, propName) {\n const cmp = APP_STATE.components.find((c) => c.id === cmpId);\n if (!cmp) {\n return null;\n }\n const regInput = cmp.inputs.find((i) => i.name === propName);\n if (!regInput) {\n return null;\n }\n const nav = shadow.querySelector(".nav-cmp-input");\n if (regInput.isRegistered) {\n nav.classList.add("input-enabled");\n } else {\n nav.classList.remove("input-enabled");\n }\n const inputReg = shadow.getElementById("input-register");\n inputReg.checked = !!regInput.isRegistered;\n const title = shadow.getElementById("cmp-input-title");\n title.innerText = cmp.name + ": " + (regInput.friendlyName || regInput.name);\n const openSource = shadow.getElementById("input-open-source");\n openSource.innerText = `Open ${cmp.displayFilePath}`;\n openSource.dataset.id = cmp.id;\n const propNameText = shadow.getElementById("cmp-prop-name");\n propNameText.innerText = regInput.name;\n const propType = shadow.getElementById("cmp-prop-type");\n propType.innerText = getPrimitiveType(regInput.type);\n const inputName = shadow.getElementById("input-name");\n inputName.dataset.id = cmp.id;\n inputName.dataset.prop = regInput.name;\n inputName.value = regInput.friendlyName || regInput.name;\n renderInputTypeSelect(shadow, cmp, regInput);\n return regInput;\n }\n function renderInputTypeSelect(shadow, cmp, cmpInput) {\n const typeSelect = shadow.getElementById("input-type");\n typeSelect.dataset.id = cmp.id;\n typeSelect.dataset.prop = cmpInput.name;\n typeSelect.innerHTML = "";\n const inputType = cmpInput.type;\n const isString = STRING_TYPES.includes(inputType);\n const isNumber = NUMBER_TYPES.includes(inputType);\n const isBoolean = BOOLEAN_TYPES.includes(inputType);\n const isArray = ARRAY_TYPES.includes(inputType);\n const isObject = OBJECT_TYPES.includes(inputType);\n INPUT_TYPES.forEach((t) => {\n const option = document.createElement("option");\n option.value = t.value;\n option.innerText = t.text;\n option.disabled = STRING_TYPES.includes(t.value) && !isString || NUMBER_TYPES.includes(t.value) && !isNumber || BOOLEAN_TYPES.includes(t.value) && !isBoolean || ARRAY_TYPES.includes(t.value) && !isArray || OBJECT_TYPES.includes(t.value) && !isObject;\n typeSelect.appendChild(option);\n });\n typeSelect.value = inputType;\n }\n\n // packages/dev-tools/client/menu/pages/component-detail.ts\n function initComponentDetailSection(shadow) {\n initRegisterComponent(shadow);\n initComponentName(shadow);\n initComponentOpenSource2(shadow);\n initComponentInputList(shadow);\n initInputReload(shadow);\n }\n function initRegisterComponent(shadow) {\n const cmpReg = shadow.getElementById("cmp-register");\n cmpReg.addEventListener("change", (ev) => {\n ev.stopPropagation();\n loadComponentDetail(shadow, "update");\n });\n }\n async function loadComponentDetail(shadow, opt) {\n const cmpDetail = shadow.querySelector(".nav-cmp-detail");\n const cmpError = shadow.getElementById("cmp-error");\n const cmpReg = shadow.getElementById("cmp-register");\n const regSwitchLabel = cmpReg.closest(".ui-switch");\n cmpDetail.classList.remove("cmp-enabled");\n if (cmpReg.checked) {\n cmpDetail.classList.add("cmp-loading");\n }\n try {\n const cmpId = cmpReg.dataset.id;\n let registry;\n if (opt === "load") {\n registry = await apiLoadComponent({ cmpId });\n } else if (cmpReg.checked) {\n registry = await apiRegisterComponent({ cmpId });\n dispatch("registryUpdate");\n track("interaction", {\n type: "click",\n name: "register component",\n detail: cmpId\n });\n } else {\n registry = await apiUnregisterComponent({ cmpId });\n dispatch("registryUpdate");\n track("interaction", {\n type: "click",\n name: "unregister component",\n detail: cmpId\n });\n }\n updateAppState(registry);\n renderComponentList(shadow);\n const cmp = renderComponentDetail(shadow, cmpId);\n if (opt === "update" && cmp) {\n if (cmpReg.checked) {\n cmpDetail.classList.add("cmp-enabled");\n showToast(\n shadow,\n `<strong>${cmp.name}</strong> is now registered in <strong>${APP_STATE.registryDisplayPath}</strong> and available for use in the Builder Visual Editor`\n );\n } else {\n showToast(\n shadow,\n `<strong>${cmp.name}</strong> has been unregistered from <strong>${APP_STATE.registryDisplayPath}</strong> and removed from the Builder Visual Editor`\n );\n }\n }\n } catch (e) {\n console.error(e);\n cmpError.innerHTML = `<p class="error">Error loading components</p><p class="error">${e.message || e}</p>`;\n regSwitchLabel.style.display = "none";\n }\n cmpDetail.classList.remove("cmp-loading");\n }\n function initComponentName(shadow) {\n const cmpName = shadow.getElementById("cmp-name");\n const inputWrapper = cmpName.closest(".ui-text-input");\n let initComponentName2 = "";\n let savedTmr;\n cmpName.addEventListener("focus", (ev) => {\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n ev.stopPropagation();\n initComponentName2 = cmpName.value;\n });\n cmpName.addEventListener("blur", async (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (cmpName.value !== initComponentName2) {\n if (cmpName.value.trim().length < 3) {\n cmpName.value = initComponentName2;\n return;\n }\n inputWrapper.classList.add("saved");\n savedTmr = setTimeout(() => {\n inputWrapper.classList.remove("saved");\n }, 3e3);\n const cmpId = cmpName.dataset.id;\n const registry = await apiSetComponentInfo({\n cmpId,\n name: cmpName.value\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentList(shadow);\n renderComponentDetail(shadow, cmpId);\n }\n });\n cmpName.addEventListener("keyup", (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (ev.key === "Escape") {\n cmpName.value = initComponentName2;\n cmpName.blur();\n } else if (ev.key === "Enter") {\n cmpName.blur();\n }\n });\n }\n function renderComponentDetail(shadow, cmpId) {\n const cmp = APP_STATE.components.find((c) => c.id === cmpId);\n if (!cmp) {\n return null;\n }\n const cmpReg = shadow.getElementById("cmp-register");\n const cmpError = shadow.getElementById("cmp-error");\n const regSwitchLabel = cmpReg.closest(".ui-switch");\n regSwitchLabel.style.display = "";\n cmpError.innerHTML = "";\n cmpReg.dataset.id = cmp.id;\n cmpReg.checked = !!cmp.isRegistered;\n const cmpDetail = shadow.querySelector(".nav-cmp-detail");\n if (cmp.isRegistered) {\n cmpDetail.classList.add("cmp-enabled");\n } else {\n cmpDetail.classList.remove("cmp-enabled");\n }\n const cmpName = shadow.getElementById("cmp-name");\n cmpName.dataset.id = cmp.id;\n cmpName.value = cmp.name;\n const openSource = shadow.getElementById("cmp-open-source");\n openSource.innerText = `Open ${cmp.displayFilePath}`;\n openSource.dataset.id = cmp.id;\n const title = shadow.getElementById("cmp-detail-title");\n title.innerText = `${cmp.name} Component`;\n renderComponentDetailInputs(shadow, cmp);\n return cmp;\n }\n function initComponentOpenSource2(shadow) {\n const openSourceBtn = shadow.getElementById(\n "cmp-open-source"\n );\n openSourceBtn.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const cmp = APP_STATE.components.find((c) => c.id === target?.dataset.id);\n if (cmp) {\n apiLaunchEditor({ filePath: cmp.filePath });\n track("interaction", {\n type: "click",\n name: "open component source file",\n detail: cmp.filePath\n });\n }\n });\n }\n function initInputReload(shadow) {\n const reloadBtn = shadow.getElementById(\n "btn-inputs-reload"\n );\n reloadBtn.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n loadComponentDetail(shadow, "load");\n });\n }\n function initComponentInputList(shadow) {\n const cmpInputList = shadow.getElementById(\n "cmp-detail-inputs"\n );\n cmpInputList.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const button = target?.closest("button");\n const cmpId = button?.dataset.id;\n const propName = button?.dataset.propName;\n const cmpInput = renderComponentInput(shadow, cmpId, propName);\n if (cmpInput) {\n goToSection(shadow, "nav-cmp-input");\n }\n });\n }\n function renderComponentDetailInputs(shadow, cmp) {\n const cmpInputList = shadow.getElementById(\n "cmp-detail-inputs"\n );\n const filteredInputList = cmp.inputs.filter((input) => !input.hideFromUI);\n if (filteredInputList.length > 0) {\n cmpInputList.innerHTML = "";\n filteredInputList.forEach((input) => {\n cmpInputList.appendChild(renderComponentDetailInputItem(cmp, input));\n });\n } else {\n cmpInputList.innerHTML = `<p class="cmp-inputs-empty">${cmp.name} component does not have any props</p>`;\n }\n }\n function renderComponentDetailInputItem(cmp, cmpInput) {\n const item = document.createElement("button");\n item.dataset.id = cmp.id;\n item.dataset.propName = cmpInput.name;\n item.className = "cmp-input-item nav-list-item";\n if (!cmpInput.isRegistered) {\n item.classList.add("cmp-input-item-unregistered");\n }\n const itemIcon = document.createElement("span");\n const type = getPrimitiveType(cmpInput.type);\n itemIcon.className = `nav-list-item-icon input-icon input-icon-${type}`;\n item.appendChild(itemIcon);\n const itemName = document.createElement("span");\n itemName.innerText = cmpInput.friendlyName || cmpInput.name;\n item.appendChild(itemName);\n const itemNote = document.createElement("span");\n itemNote.className = "nav-list-item-note";\n itemNote.innerText = cmpInput.type;\n item.appendChild(itemNote);\n return item;\n }\n\n // packages/dev-tools/client/menu/pages/component-list.ts\n function initComponentListSection(shadow) {\n const openRegistryFile = shadow.getElementById("open-builder-registry");\n openRegistryFile.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n apiLaunchEditor({ filePath: APP_STATE.registryPath, line: 1, column: 1 });\n });\n const cmpList = shadow.getElementById("cmp-list");\n cmpList.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const cmpId = target?.dataset.id;\n const cmp = APP_STATE.components.find((c) => c.id === cmpId);\n if (cmp) {\n const cmpDetail = shadow.querySelector(\n ".nav-cmp-detail .section-content"\n );\n cmpDetail.scrollTop = 0;\n renderComponentDetail(shadow, cmp.id);\n goToSection(shadow, "nav-cmp-detail");\n if (cmp.isRegistered) {\n loadComponentDetail(shadow, "load");\n }\n }\n });\n const searchInput = shadow.getElementById(\n "component-search"\n );\n const clearSearchButton = shadow.getElementById(\n "clear-search"\n );\n searchInput?.addEventListener("input", (event) => {\n const searchTerm = event.target.value.toLowerCase();\n const filteredComponents = searchTerm ? APP_STATE.components.filter(\n (component) => component.name.toLowerCase().includes(searchTerm) || component.displayFilePath?.toLowerCase().includes(searchTerm)\n ) : APP_STATE.components;\n renderComponentList(shadow, filteredComponents);\n clearSearchButton.style.display = searchTerm ? "flex" : "none";\n });\n clearSearchButton?.addEventListener("click", () => {\n searchInput.value = "";\n renderComponentList(shadow);\n clearSearchButton.style.display = "none";\n });\n searchInput?.addEventListener("keydown", (event) => {\n if (event.key === "Escape") {\n searchInput.value = "";\n renderComponentList(shadow);\n clearSearchButton.style.display = "none";\n }\n });\n }\n function loadComponentsSection(shadow) {\n const loadRegistry = apiRegistry();\n renderComponents(shadow, loadRegistry);\n }\n async function renderComponents(shadow, loadRegistry) {\n const cmpList = shadow.getElementById("cmp-list");\n const cmpListSection = shadow.querySelector(".nav-cmp-list");\n cmpListSection.classList.add("nav-loading");\n const openRegistryFile = shadow.getElementById("open-builder-registry");\n try {\n const registry = await loadRegistry;\n updateAppState(registry);\n renderComponentList(shadow);\n if (APP_STATE.registryDisplayPath) {\n openRegistryFile.innerText = "Open " + registry.registryDisplayPath;\n } else {\n openRegistryFile.innerText = "";\n }\n } catch (e) {\n cmpList.innerHTML = `<p class="error">Error loading components</p><p class="error">${e.message || e}</p>`;\n console.error(e);\n }\n cmpListSection.classList.remove("nav-loading");\n }\n function renderComponentList(shadow, filteredComponents) {\n const cmpList = shadow.getElementById("cmp-list");\n cmpList.innerHTML = "";\n const componentsToRender = filteredComponents || APP_STATE.components;\n const registered = componentsToRender.filter((c) => c.isRegistered);\n const unregistered = componentsToRender.filter((c) => !c.isRegistered);\n if (filteredComponents && filteredComponents.length === 0) {\n const noResults = document.createElement("p");\n noResults.className = "no-results";\n noResults.innerText = "No matching components found";\n cmpList.appendChild(noResults);\n return;\n }\n renderComponentListSection(cmpList, "Registered Components", registered);\n renderComponentListSection(cmpList, "Unregistered Components", unregistered);\n }\n function renderComponentListSection(cmpList, listTitle, cmps) {\n if (cmps.length > 0) {\n const cmpsTitle = document.createElement("h4");\n cmpsTitle.innerText = listTitle;\n cmpList.appendChild(cmpsTitle);\n cmps.forEach((c) => {\n cmpList.appendChild(renderComponentListItem(c));\n });\n }\n }\n function renderComponentListItem(cmp) {\n const searchTerm = document.getElementById("component-search")?.value.toLowerCase();\n const item = document.createElement("button");\n item.dataset.id = cmp.id;\n item.className = "cmp-item nav-list-item";\n if (cmp.isRegistered) {\n item.classList.add("registered");\n }\n const itemIcon = document.createElement("span");\n itemIcon.className = "nav-list-item-icon";\n if (cmp.image) {\n itemIcon.style.backgroundImage = `url(${cmp.image})`;\n }\n item.appendChild(itemIcon);\n const itemName = document.createElement("span");\n itemName.className = "nav-list-item-name";\n itemName.innerHTML = highlightMatches(cmp.name, searchTerm);\n item.appendChild(itemName);\n const itemNote = document.createElement("span");\n itemNote.className = "nav-list-item-note";\n itemNote.innerHTML = highlightMatches(cmp.displayFilePath || "", searchTerm);\n item.appendChild(itemNote);\n return item;\n }\n function highlightMatches(text, searchTerm) {\n if (!searchTerm) return text;\n const regex = new RegExp(`(${searchTerm})`, "gi");\n return text.replace(regex, \'<span class="search-highlight">$1</span>\');\n }\n\n // packages/dev-tools/client/menu/toggle/menu-toggle.ts\n var initMenuToggle = (shadow) => {\n shadow.querySelector(".menu-toggle").addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, true);\n });\n shadow.getElementById("close").addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n });\n shadow.getElementById("hit").addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n });\n initBackButtons(shadow);\n shadow.addEventListener("click", (ev) => ev.stopPropagation());\n checkCTAs(shadow);\n };\n var openMenu = (shadow, openDevToolsMenu) => {\n if (openDevToolsMenu) {\n document.body.classList.add("builder-no-scroll");\n shadow.host.classList.add("show-builder-menu");\n dispatch("menuOpen");\n setCTA("menuOpened");\n track("interaction", {\n type: "click",\n name: "open dev-tools menu"\n });\n } else {\n document.body.classList.remove("builder-no-scroll");\n shadow.host.classList.remove("show-builder-menu");\n dispatch("menuClose");\n setTimeout(() => {\n goToSection(shadow, "nav-home");\n }, 300);\n }\n apiDevToolsEnabled(openDevToolsMenu);\n };\n var checkCTAs = (shadow) => {\n if (!hasCTA("menuOpened")) {\n menuToggleToolTipCta(shadow);\n return;\n }\n const t = getTracking();\n const minutesSinceFirstVisit = (Date.now() - t.firstVisitTs) / 1e3 / 60;\n if (minutesSinceFirstVisit < 10) {\n return;\n }\n if (!hasCTA("feedback")) {\n setCTA("feedback");\n feedbackToolTipCta(shadow);\n return;\n }\n };\n var menuToggleToolTipCta = (shadow) => {\n const tooltip = document.createElement("a");\n tooltip.classList.add("menu-toggle-tooltip");\n tooltip.href = `#open-dev-tools`;\n tooltip.innerHTML = `\n <div class="menu-toggle-tooltip-content">\n <h3>Open Builder Devtools</h3>\n <p>Start registering your components</p>\n </div>\n `;\n shadow.appendChild(tooltip);\n setTimeout(() => {\n tooltip.classList.add("menu-toggle-tooltip-show");\n tooltip.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n tooltip.classList.remove("menu-toggle-tooltip-show");\n openMenu(shadow, true);\n });\n }, 1e3);\n };\n var feedbackToolTipCta = (shadow) => {\n const tooltip = document.createElement("a");\n tooltip.classList.add("menu-toggle-tooltip");\n tooltip.href = `https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform`;\n tooltip.target = "_blank";\n tooltip.innerHTML = `\n <div class="menu-toggle-tooltip-content">\n <h3>How\'s Devtools working for you?</h3>\n <p>We\'d love your feedback!</p>\n </div>\n `;\n shadow.appendChild(tooltip);\n setTimeout(() => {\n tooltip.classList.add("menu-toggle-tooltip-show");\n tooltip.addEventListener("click", () => {\n tooltip.classList.remove("menu-toggle-tooltip-show");\n });\n }, 1e3);\n };\n\n // packages/dev-tools/client/menu/pages/home.ts\n function initHomeSection(shadow) {\n const goToBuilder = shadow.getElementById("go-to-builder");\n goToBuilder.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n window.open(getEditorUrl(), "builder");\n });\n const componentsLink = shadow.getElementById("components-link");\n componentsLink.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const cmpList = shadow.querySelector(\n ".nav-cmp-list .section-content"\n );\n cmpList.scrollTop = 0;\n goToSection(shadow, "nav-cmp-list");\n loadComponentsSection(shadow);\n });\n const settingsLink = shadow.getElementById("settings-link");\n settingsLink.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n goToSection(shadow, "nav-settings");\n });\n const addPageLink = shadow.getElementById("add-page-link");\n addPageLink.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n window.open(getBuilderContentUrl(), "builder");\n });\n const importFromFigma = shadow.getElementById("import-from-figma");\n importFromFigma.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n window.open(\n "https://www.figma.com/community/plugin/747985167520967365/builder-io-ai-powered-figma-to-code-react-vue-tailwind-more"\n );\n });\n }\n\n // packages/dev-tools/client/menu/pages/settings.ts\n function initSettingsSection(shadow) {\n const s = shadow.getElementById("enable-edit");\n s.addEventListener("change", (ev) => {\n ev.stopPropagation();\n enableEdit(s.checked);\n });\n s.checked = isEditEnabled();\n enableEdit(s.checked);\n }\n\n // packages/dev-tools/client/menu/index.ts\n var BuilderDevToolsMenu = class extends HTMLElement {\n constructor() {\n super();\n }\n connectedCallback() {\n const shadow = this.attachShadow({ mode: "open" });\n shadow.innerHTML = `<style>/* packages/dev-tools/client/common.css */\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n:host {\n --background-color: rgba(40, 40, 40, 1);\n --primary-color: rgba(72, 161, 255, 1);\n --primary-color-subdued: rgb(72, 161, 255, 0.6);\n --primary-color-highlight: rgb(126, 188, 255);\n --primary-contrast-color: white;\n --edit-color: #1d74e2;\n --edit-color-highlight: #1c6bd1;\n --edit-color-alpha: rgb(72, 161, 255, 0.15);\n --error-color: #ff2b55;\n --text-color: white;\n --text-color-highlight: white;\n --border-color: #454545;\n --button-background-color-hover: rgba(255, 255, 255, 0.1);\n --menu-width: 320px;\n --transition-time: 150ms;\n --font-family:\n ui-sans-serif,\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n "Helvetica Neue",\n Arial,\n "Noto Sans",\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji";\n font-family: var(--font-family);\n line-height: 1.6;\n}\nbutton {\n cursor: pointer;\n color: var(--text-color);\n -webkit-tap-highlight-color: transparent;\n}\ninput,\nselect,\nbutton {\n font-family: var(--font-family);\n}\n\n/* packages/dev-tools/client/menu/toggle/menu-toggle.css */\n.menu-toggle {\n position: absolute;\n right: 0;\n bottom: 0;\n pointer-events: auto;\n padding: 8px;\n background: transparent;\n border: none;\n appearance: none;\n}\n.menu-toggle div {\n position: relative;\n width: 64px;\n height: 64px;\n pointer-events: none;\n border-radius: 50%;\n background: black;\n border: 1px solid white;\n box-shadow: rgba(0, 0, 0, 33%) 0px 0 8px;\n}\n.menu-toggle:hover div {\n background-color: var(--background-color);\n border: 1px solid rgb(220, 220, 220);\n}\n.menu-toggle svg {\n position: absolute;\n top: 15px;\n left: 15px;\n width: 33px;\n height: 32px;\n}\ndiv.highlight-bg {\n position: absolute;\n top: -1px;\n left: -1px;\n background-color: rgb(26, 26, 26);\n pointer-events: none;\n transition: all 400ms ease-out;\n opacity: 0;\n}\n.menu-toggle-highlight-no-transition div.highlight-bg {\n transition: none;\n}\n.menu-toggle-highlight div.highlight-bg {\n opacity: 1;\n}\n.menu-toggle-tooltip {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 382px;\n height: 72px;\n padding: 0;\n text-align: left;\n appearance: none;\n background-color: transparent;\n border: none;\n pointer-events: none;\n transform: translate3d(320px, 0, 0);\n opacity: 0;\n transition: all 150ms ease-in-out;\n color: white;\n}\n.menu-toggle-tooltip.menu-toggle-tooltip-show {\n pointer-events: auto;\n opacity: 1;\n transform: translate3d(0, 0, 0);\n}\n.menu-toggle-tooltip-content {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 10px;\n right: 95px;\n padding: 8px 12px;\n background-color: var(--primary-color);\n box-shadow: rgba(0, 0, 0, 33%) 0px 0 20px;\n border-radius: 2px;\n}\n.menu-toggle-tooltip-content::before {\n content: "";\n position: absolute;\n bottom: 15px;\n right: -6px;\n width: 30px;\n height: 30px;\n background-color: var(--primary-color);\n transform: rotate(45deg);\n}\n.menu-toggle-tooltip:hover .menu-toggle-tooltip-content,\n.menu-toggle-tooltip:hover .menu-toggle-tooltip-content::before {\n background-color: var(--primary-color-highlight);\n}\n.menu-toggle-tooltip-content h3 {\n margin: 0;\n font-size: 16px;\n}\n.menu-toggle-tooltip-content p {\n margin: 0;\n font-size: 12px;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-page.css */\nsection {\n position: absolute;\n display: grid;\n grid-template-rows: 64px auto 64px;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n padding: 0;\n pointer-events: none;\n}\n.section-content {\n margin: 0;\n padding: 0 0 10px 0;\n font-weight: 300;\n transform: translate3d(105%, 0, 0);\n transition: transform var(--transition-time) ease-in-out;\n overflow-y: auto;\n}\n.section-content .error {\n color: var(--error-color);\n font-weight: bold;\n}\nsection a {\n text-decoration: none;\n color: var(--text-color);\n}\nsection h3,\nsection p {\n margin-left: 16px;\n margin-right: 16px;\n}\n.info {\n font-size: 12px;\n}\nul.list {\n list-style: none;\n padding: 0;\n margin: 0;\n}\nul.list li {\n display: block;\n padding: 0;\n margin: 0;\n}\nul.list a,\nul.list button {\n display: grid;\n grid-template-columns: 24px auto;\n grid-gap: 16px;\n padding: 12px;\n margin: 8px 0;\n border: none;\n background: transparent;\n appearance: none;\n width: 100%;\n font-weight: 300;\n text-align: left;\n text-decoration: none;\n color: var(--text-color);\n}\nul.list a:hover,\nul.list button:hover {\n text-decoration: none;\n color: var(--text-color);\n background-color: var(--button-background-color-hover);\n}\nul.list a span,\nul.list button span {\n display: block;\n font-size: 16px;\n font-weight: 500;\n line-height: 1.5;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-header.css */\nheader {\n position: relative;\n display: grid;\n grid-template-columns: 44px 1fr;\n gap: 8px;\n padding-left: 8px;\n border-bottom: 1px solid var(--border-color);\n transition: opacity var(--transition-time) ease-in-out;\n opacity: 0;\n pointer-events: none;\n}\nheader > div {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.nav-home header > div {\n margin-right: 56px;\n}\nheader h2 {\n margin: 7px 0 0 0;\n font-size: 18px;\n font-weight: 500;\n line-height: 1.5;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\nheader p {\n margin: 2px 0 0 0;\n font-size: 12px;\n font-weight: 300;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\nheader p button {\n display: block;\n margin: 0;\n padding: 0;\n width: 100%;\n text-align: left;\n font-size: 12px;\n font-weight: 300;\n text-decoration: none;\n appearance: none;\n text-align: left;\n background-color: transparent;\n border: none;\n color: var(--primary-color);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\nheader p button:hover {\n text-decoration: underline;\n color: var(--primary-color);\n}\n.builder-logo {\n margin: 12px 0 0 8px;\n}\n#close {\n display: block;\n position: absolute;\n appearance: none;\n background: transparent;\n border: none;\n border-radius: 50%;\n margin: 0;\n padding: 0;\n right: 4px;\n top: 8px;\n width: 48px;\n height: 48px;\n z-index: 1;\n opacity: 0.7;\n}\n#close:hover {\n opacity: 1;\n background-color: var(--button-background-color-hover);\n}\n#close svg {\n position: absolute;\n top: 12px;\n left: 12px;\n width: 24px;\n height: 24px;\n fill: currentColor;\n pointer-events: none;\n}\n.back-button {\n position: relative;\n display: block;\n margin: 7px 0 0 -2px;\n width: 48px;\n height: 48px;\n background: transparent;\n border: none;\n appearance: none;\n border-radius: 50%;\n}\n.back-button:hover {\n background-color: var(--button-background-color-hover);\n}\n.back-button svg {\n position: absolute;\n top: 12px;\n left: 12px;\n width: 24px;\n height: 24px;\n fill: currentColor;\n pointer-events: none;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-footer.css */\nfooter {\n border-top: 1px solid var(--border-color);\n transition: opacity var(--transition-time) ease-in-out;\n opacity: 0;\n pointer-events: none;\n}\nsection.nav-cmp-list {\n grid-template-rows: 64px auto 120px;\n}\nfooter a {\n text-decoration: underline;\n color: var(--primary-color);\n}\nfooter a:hover {\n color: var(--primary-color);\n text-decoration: none;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-nav-list.css */\n.nav-list {\n padding: 2px 0;\n}\n.nav-loading {\n pointer-events: none;\n}\n.nav-loading-icon {\n position: absolute;\n display: inline-block;\n top: 170px;\n left: 0;\n width: 100%;\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n opacity: 0;\n transition: all 50ms ease-in-out;\n transition-delay: 50ms;\n pointer-events: none;\n}\n.nav-loading .nav-loading-icon {\n opacity: 0.5;\n}\n.nav-list h4 {\n margin: 8px 8px 8px 10px;\n font-size: 14px;\n font-weight: 600;\n}\n.nav-list .nav-list-item + h4 {\n margin-top: 30px;\n}\n.nav-list-item {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 8px;\n position: relative;\n margin: 2px 0;\n padding: 8px 28px 8px 46px;\n width: 100%;\n font-size: 14px;\n font-weight: 300;\n text-align: left;\n border: none;\n background: transparent;\n appearance: none;\n}\n.nav-list-item:hover {\n background-color: var(--button-background-color-hover);\n}\n.nav-list-item-icon {\n position: absolute;\n top: 4px;\n left: 10px;\n width: 24px;\n height: 24px;\n object-fit: contain;\n filter: invert(100%);\n background-size: 24px 24px;\n background-repeat: no-repeat;\n background-position: center center;\n}\n.nav-list-item span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n pointer-events: none;\n}\n.nav-list-item::after {\n display: block;\n position: absolute;\n content: "";\n background-image: url(\'data:image/svg+xml,<svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L1 13" stroke="%23F2F2F2" stroke-opacity="0.5" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>\');\n background-repeat: no-repeat;\n background-position: 12px 9px;\n top: 0;\n right: 0;\n width: 32px;\n height: 32px;\n pointer-events: none;\n}\n.nav-list-item-note {\n opacity: 0;\n font-size: 12px;\n padding-top: 1px;\n text-align: right;\n}\n.nav-list-item:hover .nav-list-item-note {\n opacity: 0.5;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-select.css */\n.ui-select {\n display: block;\n margin: 8px 0 16px 0;\n padding: 8px 16px 8px 16px;\n cursor: pointer;\n}\n.ui-select h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.ui-select p {\n margin: 8px 0 8px 0;\n font-size: 12px;\n font-weight: 300;\n}\n.ui-select .select {\n position: relative;\n margin: 8px 0 8px 0;\n border-radius: 4px;\n padding: 0;\n line-height: 1.1;\n overflow: hidden;\n border: 1px solid var(--border-color);\n}\n.ui-select select {\n appearance: none;\n background-color: transparent;\n border: none;\n outline: none;\n padding: 8px 32px 8px 8px;\n margin: 0;\n width: 100%;\n font-size: 14px;\n cursor: pointer;\n text-overflow: ellipsis;\n opacity: 0.6;\n color: var(--text-color);\n}\n.ui-select .select::after {\n content: "";\n top: 6px;\n right: 5px;\n width: 24px;\n height: 24px;\n position: absolute;\n background-image: url(\'data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23F2F2F2" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/></svg>\');\n background-repeat: no-repeat;\n background-position: center;\n pointer-events: none;\n opacity: 0.6;\n}\n.ui-select .select:hover {\n border-color: var(--primary-color-subdued);\n}\n.ui-text-input .select:focus-within {\n border-color: var(--primary-color);\n}\n.ui-text-input .select:focus-within select {\n opacity: 1;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-spinner.css */\n.spinner:after {\n content: " ";\n display: block;\n width: 32px;\n height: 32px;\n margin: 0 auto;\n pointer-events: auto;\n border-radius: 50%;\n border: 3px solid var(--text-color);\n border-color: var(--text-color) transparent var(--text-color) transparent;\n animation: spinner 750ms linear infinite;\n}\n@keyframes spinner {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n/* packages/dev-tools/client/menu/ui/ui-switch.css */\n.ui-switch {\n display: grid;\n grid-template-columns: auto 48px;\n grid-gap: 20px;\n margin: 8px 0 16px 0;\n padding: 8px 0 8px 16px;\n cursor: pointer;\n}\n.ui-switch > * {\n pointer-events: none;\n}\n.ui-switch input {\n display: none;\n visibility: hidden;\n}\n.ui-switch .switcher {\n display: inline-block;\n border-radius: 100px;\n width: 35px;\n height: 14px;\n background-color: #ccc;\n position: relative;\n top: 6px;\n vertical-align: middle;\n cursor: pointer;\n}\n.ui-switch input[type=checkbox]:checked + .switcher {\n background-color: var(--primary-color-subdued);\n}\n.ui-switch .switcher:before {\n content: "";\n display: block;\n width: 20px;\n height: 20px;\n background-color: var(--text-color);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n position: absolute;\n top: -3px;\n left: 0;\n margin-right: 0;\n transition: all 150ms;\n}\n.ui-switch input[type=checkbox]:checked + .switcher:before {\n left: 100%;\n margin-left: -20px;\n background-color: var(--primary-color);\n}\n.ui-switch h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.ui-switch p {\n margin: 4px 0 0 0;\n font-size: 12px;\n font-weight: 300;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-text-input.css */\n.ui-text-input {\n display: block;\n margin: 8px 0 16px 0;\n padding: 8px 16px 8px 16px;\n cursor: pointer;\n}\n.ui-text-input h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.ui-text-input p {\n margin: 8px 0 8px 0;\n font-size: 12px;\n font-weight: 300;\n}\n.ui-text-input .input {\n position: relative;\n margin: 8px 0 8px 0;\n border: 1px solid var(--border-color);\n border-radius: 4px;\n background: transparent;\n padding: 2px;\n overflow: hidden;\n}\n.ui-text-input input {\n display: block;\n width: 235px;\n font-size: 14px;\n border: none;\n background: transparent;\n padding: 6px;\n appearance: none;\n color: var(--text-color);\n opacity: 0.6;\n outline: none;\n}\n.ui-text-input .input:hover {\n border-color: var(--primary-color-subdued);\n}\n.ui-text-input .input:focus-within {\n border-color: var(--primary-color);\n}\n.ui-text-input .input:focus-within input {\n opacity: 1;\n}\n.ui-text-input .input::after {\n content: "";\n position: absolute;\n top: 5px;\n right: 14px;\n width: 8px;\n height: 17px;\n border: 2px solid rgba(51, 181, 51, 1);\n border-top: none;\n border-left: none;\n transform: rotate(45deg);\n opacity: 0;\n transition: opacity 80ms ease-in-out;\n pointer-events: none;\n}\n.ui-text-input.saved .input::after {\n opacity: 1;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-toast.css */\n.ui-toast {\n position: fixed;\n bottom: 8px;\n left: 8px;\n right: 8px;\n padding: 6px 12px;\n font-size: 14px;\n border-radius: 4px;\n transform: translate3d(0, 150%, 0);\n opacity: 0;\n transition: all var(--transition-time) ease-in-out;\n background-color: var(--primary-color-subdued);\n color: var(--text-color);\n pointer-events: none;\n}\n.ui-toast.ui-toast-show {\n transform: translate3d(0, 0, 0);\n opacity: 1;\n pointer-events: auto;\n}\n\n/* packages/dev-tools/client/menu/nav.css */\n[data-view=nav-home] .nav-home .section-content,\n[data-view=nav-cmp-list] .nav-cmp-list .section-content,\n[data-view=nav-cmp-detail] .nav-cmp-detail .section-content,\n[data-view=nav-cmp-input] .nav-cmp-input .section-content,\n[data-view=nav-settings] .nav-settings .section-content {\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n}\n[data-view=nav-home] .nav-home header,\n[data-view=nav-home] .nav-home footer,\n[data-view=nav-cmp-list] .nav-cmp-list header,\n[data-view=nav-cmp-list] .nav-cmp-list footer,\n[data-view=nav-cmp-detail] .nav-cmp-detail header,\n[data-view=nav-cmp-detail] .nav-cmp-detail footer,\n[data-view=nav-cmp-input] .nav-cmp-input header,\n[data-view=nav-cmp-input] .nav-cmp-input footer,\n[data-view=nav-settings] .nav-settings header,\n[data-view=nav-settings] .nav-settings footer {\n opacity: 1;\n pointer-events: auto;\n}\n[data-view=nav-cmp-list] .nav-home .section-content,\n[data-view=nav-cmp-detail] .nav-home .section-content,\n[data-view=nav-cmp-detail] .nav-cmp-list .section-content,\n[data-view=nav-cmp-input] .nav-home .section-content,\n[data-view=nav-cmp-input] .nav-cmp-list .section-content,\n[data-view=nav-cmp-input] .nav-cmp-detail .section-content,\n[data-view=nav-settings] .nav-home .section-content {\n transform: translate3d(-105%, 0, 0);\n}\n\n/* packages/dev-tools/client/menu/pages/component-list.css */\n.cmp-item .nav-list-item-icon {\n background-image: url(\'data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20.83 16.809C20.94 16.561 21 16.289 21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L7.988 3.99001M5.441 5.44801L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L18.544 18.56" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.532 10.538L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.27002 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 3L21 21" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>\');\n opacity: 0.3;\n}\n.cmp-item.registered .nav-list-item-icon {\n background-image: url(\'data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /></svg>\');\n opacity: 0.8;\n}\n.search-highlight {\n background-color: var(--primary-color-alpha);\n padding: 0 2px;\n border-radius: 2px;\n font-weight: 500;\n}\n.search-container {\n position: sticky;\n top: 0;\n z-index: 10;\n padding: 12px 16px;\n background: var(--background-color);\n border-bottom: 1px solid var(--border-color);\n}\n.search-input-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n}\n.search-icon {\n position: absolute;\n left: 12px;\n color: var(--text-color-secondary);\n pointer-events: none;\n}\n.component-search-input {\n width: 100%;\n height: 36px;\n padding: 8px 36px;\n border: 1px solid var(--border-color);\n border-radius: 6px;\n background: var(--input-background);\n color: var(--text-color);\n font-size: 14px;\n transition: border-color 0.2s, box-shadow 0.2s;\n}\n.component-search-input:focus {\n outline: none;\n border-color: var(--primary-color);\n box-shadow: 0 0 0 2px var(--primary-color-alpha);\n}\n.component-search-input::placeholder {\n color: var(--text-color-tertiary);\n}\n.clear-search-button {\n position: absolute;\n right: 8px;\n padding: 4px;\n color: var(--text-color-secondary);\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.2s, background-color 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.clear-search-button:hover {\n background-color: var(--hover-color);\n}\n.component-search-input:not(:placeholder-shown) + .clear-search-button {\n opacity: 1;\n}\n.no-results {\n padding: 32px 16px;\n text-align: center;\n color: var(--text-color-secondary);\n font-size: 14px;\n}\n\n/* packages/dev-tools/client/menu/pages/component-detail.css */\n#cmp-detail {\n position: relative;\n}\n.cmp-loading {\n pointer-events: none !important;\n}\n.cmp-loading-icon {\n position: absolute;\n display: inline-block;\n top: 170px;\n left: 0;\n width: 100%;\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n opacity: 0;\n transition: all 50ms ease-in-out;\n transition-delay: 50ms;\n pointer-events: none;\n}\n.cmp-loading .cmp-loading-icon {\n opacity: 0.5;\n}\n.cmp-cover {\n position: absolute;\n top: 160px;\n left: 0;\n width: 100%;\n height: 100vh;\n background: var(--background-color);\n transform: translate3d(0, 0, 0);\n pointer-events: none;\n display: none;\n}\n[data-view=nav-cmp-detail] .cmp-cover {\n display: block;\n pointer-events: auto;\n}\n.cmp-enabled .cmp-cover {\n transform: translate3d(0, 105%, 0);\n pointer-events: none;\n}\n.section-ready .cmp-cover {\n transition: all var(--transition-time) ease-in-out;\n}\n.cmp-detail-inputs-container {\n margin: 8px 0 16px 0;\n padding: 0;\n}\n.cmp-detail-inputs-container h3 {\n margin: 0 0 6px 0;\n padding-left: 16px;\n padding-right: 8px;\n font-size: 14px;\n font-weight: 500;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.cmp-detail-inputs-reload {\n font-weight: 300;\n font-size: 0.9em;\n text-decoration: none;\n appearance: none;\n text-align: left;\n background-color: transparent;\n border: none;\n color: var(--primary-color);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.cmp-detail-inputs-reload:hover {\n text-decoration: underline;\n color: var(--primary-color);\n}\n.cmp-detail-inputs-container .cmp-inputs-empty {\n padding: 0;\n margin-top: 12px;\n font-size: 12px;\n font-weight: 300;\n opacity: 0.5;\n font-style: italic;\n}\n.cmp-detail-inputs-container .nav-list-item-icon {\n opacity: 0.8;\n background-size: 20px 20px;\n background-position: 4px center;\n}\n.input-icon {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path></svg>\');\n}\n.input-icon-array {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-6a2 2 0 1 1 4 0v6"></path> <path d="M10 13h4"></path></svg>\');\n}\n.input-icon-boolean {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16h2a2 2 0 1 0 0 -4h-2h2a2 2 0 1 0 0 -4h-2v8z"></path></svg>\');\n}\n.input-icon-number {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-8l4 8v-8"></path></svg>\');\n}\n.input-icon-object {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"></path></svg>\');\n}\n.input-icon-string {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"></path></svg>\');\n}\n.cmp-input-item-unregistered {\n opacity: 0.4;\n}\n.cmp-input-item-unregistered .input-icon::after {\n content: "";\n position: absolute;\n top: 11px;\n left: 4px;\n width: 20px;\n height: 2px;\n background-color: black;\n transform: rotate(-45deg);\n}\n\n/* packages/dev-tools/client/menu/pages/component-input.css */\n.cmp-prop-info {\n border-bottom: 1px solid var(--border-color);\n}\n.cmp-input-readonly {\n margin: 16px 0;\n padding: 0 16px;\n display: grid;\n grid-template-columns: 50% 50%;\n gap: 12px;\n}\n.cmp-input-readonly h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.cmp-input-readonly span {\n margin-top: 2px;\n font-size: 12px;\n font-weight: 300;\n opacity: 0.8;\n}\n.cmp-input-detail {\n margin: 16px 0;\n}\n.cmp-input-detail a {\n color: var(--primary-color);\n text-decoration: none;\n}\n.cmp-input-detail a:hover {\n text-decoration: underline;\n}\n.input-cover {\n position: absolute;\n top: 175px;\n left: 0;\n width: 100%;\n height: 100%;\n background: var(--background-color);\n transform: translate3d(0, 0, 0);\n transition: all var(--transition-time) ease-in-out;\n pointer-events: auto;\n}\n.input-enabled .input-cover {\n transform: translate3d(0, 105%, 0);\n pointer-events: none;\n}\n.input-loading-icon {\n position: absolute;\n display: inline-block;\n top: 190px;\n left: 0;\n width: 100%;\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n opacity: 0;\n transition: all 50ms ease-in-out;\n transition-delay: 50ms;\n pointer-events: none;\n}\n.input-loading .input-loading-icon {\n opacity: 0.5;\n}\n\n/* packages/dev-tools/client/menu/menu.css */\n:host {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 2147483646;\n user-select: none;\n pointer-events: none;\n color: var(--text-color);\n}\naside {\n position: absolute;\n top: 0;\n right: 0;\n width: var(--menu-width);\n height: 100%;\n transform: translate3d(105%, 0, 0);\n transition: transform var(--transition-time) ease-in-out;\n background: var(--background-color);\n box-shadow: #000000c9 5px 0 20px;\n overflow: hidden;\n z-index: 1;\n}\n:host(.show-builder-menu) aside {\n pointer-events: auto;\n transform: translate3d(0, 0, 0);\n}\n#hit {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: none;\n}\n:host(.show-builder-menu) #hit {\n display: block;\n pointer-events: auto;\n}\n#version {\n position: absolute;\n bottom: 6px;\n right: 6px;\n font-size: 8px;\n color: #9b9b9b;\n}</style><div id="hit"></div> <aside data-view="nav-home"> <section class="nav-home"> <header> <svg class="builder-logo" viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> <div> <h2 class="builder-home-title">Builder Devtools</h2> <p><button id="go-to-builder">Go to Builder</button></p> </div> <button id="close" aria-label="Close Menu"> <svg viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M18 6l-12 12" /> <path d="M6 6l12 12" /> </svg> </button> </header> <div class="section-content"> <ul class="list"> <li> <button id="components-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Components</span> </button> </li> <li> <button id="settings-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Settings</span> </button> </li> <li> <button id="add-page-link"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M14 3v4a1 1 0 0 0 1 1h4" /> <path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /> <path d="M12 11l0 6" /> <path d="M9 14l6 0" /> </svg> <span>Add Builder Page</span> </button> </li> <li> <button id="import-from-figma"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-figma" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M15 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" /> <path d="M6 3m0 3a3 3 0 0 1 3 -3h6a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-6a3 3 0 0 1 -3 -3z" /> <path d="M9 9a3 3 0 0 0 0 6h3m-3 0a3 3 0 1 0 3 3v-15" /> </svg> <span>Import From Figma</span> </button> </li> </ul> </div> <footer> <ul class="list"> <li> <a href="https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform" target="_blank" > <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M11.013 17.0114L10.013 18.0114L2.513 10.5834C2.0183 10.102 1.62864 9.52342 1.36854 8.88404C1.10845 8.24466 0.983558 7.55836 1.00173 6.86834C1.01991 6.17832 1.18076 5.49954 1.47415 4.87474C1.76755 4.24994 2.18713 3.69266 2.70648 3.23799C3.22583 2.78331 3.8337 2.4411 4.49181 2.23289C5.14991 2.02468 5.844 1.95499 6.53036 2.02821C7.21673 2.10143 7.8805 2.31596 8.47987 2.65831C9.07925 3.00066 9.60124 3.46341 10.013 4.01741C10.8086 2.95654 11.9931 2.2552 13.3059 2.06766C14.6186 1.88012 15.9521 2.22176 17.013 3.01741C18.0739 3.81306 18.7752 4.99755 18.9627 6.3103C19.1503 7.62305 18.8086 8.95654 18.013 10.0174" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> <path d="M18.2006 19.8175L16.0286 20.9555C15.9642 20.989 15.8917 21.004 15.8192 20.9987C15.7467 20.9934 15.6771 20.9681 15.6182 20.9256C15.5593 20.8831 15.5134 20.825 15.4855 20.7579C15.4577 20.6907 15.4491 20.6172 15.4606 20.5455L15.8756 18.1345L14.1186 16.4275C14.0662 16.3768 14.0291 16.3123 14.0115 16.2416C13.9939 16.1708 13.9966 16.0965 14.0192 16.0271C14.0418 15.9578 14.0835 15.8962 14.1394 15.8494C14.1954 15.8026 14.2634 15.7725 14.3356 15.7625L16.7636 15.4105L17.8496 13.2175C17.8821 13.1521 17.9322 13.0972 17.9942 13.0588C18.0562 13.0204 18.1277 13 18.2006 13C18.2736 13 18.3451 13.0204 18.4071 13.0588C18.4691 13.0972 18.5191 13.1521 18.5516 13.2175L19.6376 15.4105L22.0656 15.7625C22.1377 15.7728 22.2054 15.8031 22.2611 15.85C22.3168 15.8968 22.3583 15.9583 22.3809 16.0275C22.4034 16.0967 22.4062 16.1708 22.3888 16.2415C22.3715 16.3122 22.3347 16.3766 22.2826 16.4275L20.5256 18.1345L20.9396 20.5445C20.9521 20.6163 20.9441 20.6902 20.9166 20.7578C20.8891 20.8254 20.8433 20.8839 20.7842 20.9267C20.7252 20.9695 20.6553 20.9949 20.5825 21C20.5098 21.005 20.4371 20.9896 20.3726 20.9555L18.2006 19.8175Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Give Feedback</span> </a> </li> </ul> <div id="version"></div> </footer> </section> <section class="nav-cmp-list"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div class="search-container"> <div class="search-input-wrapper"> <svg class="search-icon" viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M15.5 15.5L20 20M10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 13.866 13.866 17 10 17Z" /> </svg> <input type="text" id="component-search" class="component-search-input" placeholder="Search components..." autocomplete="off" spellcheck="false" /> <button id="clear-search" class="clear-search-button" type="button" aria-label="Clear search" > <svg viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M6 6l12 12M6 18L18 6" /> </svg> </button> </div> </div> <div> <h2>Custom Components</h2> <p> <button id="open-builder-registry"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-list" class="cmp-list nav-list"></div> </div> <div class="nav-loading-icon spinner"></div> <footer> <p class="info"> Expand on Builder\'s selection of built-in blocks by <a target="_blank" href="https://www.builder.io/c/docs/custom-components-intro" >registering components</a > from your codebase. This way, teammates can drag and drop your components within Builder\'s Visual Editor just like any other block. </p> </footer> </section> <section class="nav-cmp-detail"> <header> <button class="back-button" data-back="nav-cmp-list"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-detail-title"></h2> <p> <button id="cmp-open-source"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-error"></div> <label class="ui-switch"> <div> <h3>Register Component</h3> <p> Registers this component so it can be used within Builder Visual CMS </p> </div> <input type="checkbox" role="switch" id="cmp-register" /> <span class="switcher"></span> </label> <div id="cmp-detail"> <label class="ui-text-input"> <h3>Component Name</h3> <div class="input"> <input type="text" id="cmp-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="2" maxlength="30" required placeholder="e.g. My Counter" /> </div> <p> Unique name to identify this custom component within Builder. Press ESC to cancel </p> </label> <div class="cmp-detail-inputs-container"> <h3> <span>Builder Inputs (Props)</span> <button class="cmp-detail-inputs-reload" id="btn-inputs-reload"> Reload </button> </h3> <div id="cmp-detail-inputs"></div> </div> </div> </div> <div class="cmp-cover"></div> <div class="cmp-loading-icon spinner"></div> </section> <section class="nav-cmp-input"> <header> <button class="back-button" data-back="nav-cmp-detail"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-input-title"></h2> <p> <button id="input-open-source"></button> </p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable Input</h3> <p>Add this component prop as a Builder input</p> </div> <input type="checkbox" role="switch" id="input-register" /> <span class="switcher"></span> </label> <div class="cmp-prop-info"> <div class="cmp-input-readonly"> <h3>Prop Name</h3> <span id="cmp-prop-name"></span> </div> <div class="cmp-input-readonly"> <h3>Prop Type</h3> <span id="cmp-prop-type"></span> </div> </div> <div class="cmp-input-detail"> <label class="ui-text-input"> <h3>Builder Input Name</h3> <div class="input"> <input type="text" id="input-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="1" maxlength="30" required placeholder="e.g. Text" /> </div> <p> Friendly name to identify this component prop as a Builder input. Press ESC to cancel </p> </label> <label class="ui-select"> <h3>Builder Input Type</h3> <div class="select"> <select id="input-type"></select> </div> <p> Correlate to what editing UI is appropriate for this Builder input. <a href="https://www.builder.io/c/docs/custom-components-input-types" target="_blank" >Read more about input types.</a > </p> </label> </div> <div class="input-cover"></div> <div class="input-loading-icon spinner"></div> </div> </section> <section class="nav-settings"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2>Settings</h2> <p>Configure Builder\'s Devtools</p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable edit button in UI</h3> <p>Enables the edit button so you can edit content in Builder</p> </div> <input type="checkbox" role="switch" id="enable-edit" /> <span class="switcher"></span> </label> </div> </section> <div class="ui-toast" id="toast"></div> </aside> <button class="menu-toggle" aria-label="Toggle Builder Devtools"> <div> <div class="highlight-bg"></div> <svg viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> </div> </button>`;\n initMenuToggle(shadow);\n initHomeSection(shadow);\n initComponentListSection(shadow);\n initComponentDetailSection(shadow);\n initComponentInputSection(shadow);\n initSettingsSection(shadow);\n this.setAttribute("aria-hidden", "true");\n shadow.getElementById("version").textContent = "v1.18.44-dev.202512111107.bf5b095a5";\n }\n highlightOpener() {\n const menuToggle = this.shadowRoot.querySelector(".menu-toggle");\n menuToggle.classList.add("menu-toggle-highlight");\n menuToggle.classList.add("menu-toggle-highlight-no-transition");\n setTimeout(() => {\n menuToggle.classList.remove("menu-toggle-highlight-no-transition");\n setTimeout(() => {\n menuToggle.classList.remove("menu-toggle-highlight");\n }, 20);\n }, 20);\n }\n };\n\n // packages/dev-tools/client/setup-ui/overview.ts\n var STEP_CSS = `<style>/* packages/dev-tools/client/setup-ui/styles.css */\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\nhtml,\nbody,\n:host {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n z-index: 2147483646;\n margin: 0;\n padding: 0;\n line-height: 1.8;\n font-family:\n ui-sans-serif,\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n "Helvetica Neue",\n Arial,\n "Noto Sans",\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji";\n background-color: rgba(37, 37, 37, 1);\n color: white;\n transition: opacity 250ms ease-in-out;\n}\n:host([aria-hidden="true"]) {\n opacity: 0;\n pointer-events: none;\n}\nmain {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n}\nh1 {\n margin-top: 0;\n font-size: 24px;\n font-weight: 300;\n line-height: 1.4;\n}\np {\n margin: 20px 0;\n font-weight: 300;\n}\nbutton {\n cursor: pointer;\n}\naside {\n position: absolute;\n top: 0;\n left: 0;\n width: 350px;\n height: 100vh;\n padding: 60px 0 0 50px;\n background-color: rgba(18, 18, 18, 1);\n}\naside ul {\n margin: 30px 0 0 0px;\n padding: 0;\n list-style: none;\n}\naside li {\n position: relative;\n margin: 0;\n padding: 20px 10px;\n font-weight: 300;\n}\naside li.highlight {\n color: rgba(72, 161, 255, 1);\n}\naside li.active {\n font-weight: 700;\n}\naside li .circle {\n position: absolute;\n top: 20px;\n left: 10px;\n width: 24px;\n height: 24px;\n border: 3px solid white;\n border-radius: 50%;\n font-size: 14px;\n}\naside li.highlight .circle {\n border-color: rgba(72, 161, 255, 1);\n}\naside li.active .circle::after {\n content: "";\n position: absolute;\n top: 3px;\n left: 3px;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n background-color: rgba(72, 161, 255, 1);\n}\naside li.completed .circle {\n background-color: rgba(72, 161, 255, 1);\n}\naside li.completed .circle::after {\n content: "";\n position: absolute;\n top: 2px;\n left: 6px;\n width: 6px;\n height: 13px;\n border: 3px solid black;\n border-top: none;\n border-left: none;\n transform: rotate(45deg);\n}\naside li .line {\n position: absolute;\n top: 44px;\n left: 21px;\n width: 3px;\n height: 45px;\n background-color: white;\n}\naside li.completed .line {\n background-color: rgba(72, 161, 255, 1);\n}\naside li span {\n display: block;\n margin-left: 44px;\n}\nnav {\n margin-top: 30px;\n}\nsection {\n position: absolute;\n top: 135px;\n left: 350px;\n padding: 0 80px 0 140px;\n transition: opacity 150ms ease-in-out;\n}\nsection[aria-hidden=true] {\n pointer-events: none;\n opacity: 0;\n}\nsection h1,\nsection p {\n min-width: 300px;\n max-width: 600px;\n}\n.button {\n position: relative;\n display: inline-block;\n color: white;\n background-color: rgba(72, 161, 255, 1);\n border-radius: 4px;\n text-decoration: none;\n padding: 10px 40px 10px 20px;\n white-space: nowrap;\n}\n.button:hover {\n background-color: rgba(72, 161, 255, 0.85);\n}\n#button-icon {\n position: absolute;\n top: 1px;\n right: 5px;\n bottom: 0;\n width: 30px;\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="white" stroke-linecap="square" stroke-miterlimit="10" stroke-width="48" d="M184 112l144 144-144 144"/></svg>\');\n background-repeat: no-repeat;\n background-position: center;\n background-size: 24px 24px;\n}\n.button[aria-disabled=true] {\n opacity: 0.9;\n background-color: rgba(255, 255, 255, 0.3);\n pointer-events: none;\n padding-right: 60px;\n}\n.button[aria-disabled=true] #button-icon {\n top: 21px;\n right: 29px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background: white;\n color: white;\n animation: dot-flashing 0.5s infinite linear alternate;\n animation-delay: 0.25s;\n}\n.button[aria-disabled=true] #button-icon::before,\n.button[aria-disabled=true] #button-icon::after {\n content: "";\n display: inline-block;\n position: absolute;\n top: 0;\n}\n.button[aria-disabled=true] #button-icon::before {\n left: -12px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background-color: white;\n color: white;\n animation: dot-flashing 0.5s infinite alternate;\n animation-delay: 0s;\n}\n.button[aria-disabled=true] #button-icon::after {\n left: 12px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background-color: white;\n color: white;\n animation: dot-flashing 0.5s infinite alternate;\n animation-delay: 0.5s;\n}\n@keyframes dot-flashing {\n 0% {\n background-color: white;\n }\n 50%, 100% {\n background-color: rgba(255, 255, 255, 0.3);\n }\n}\n.logo {\n margin-left: 9px;\n background: url(\'data:image/svg+xml,<svg viewBox="0 0 150 32" fill="none" xmlns="http://www.w3.org/2000/svg" > <g clip-path="url(%23clip0_4_304)"> <path d="M27.9858 8.99927C27.9872 10.3415 27.688 11.667 27.1101 12.8783C26.5321 14.0896 25.6902 15.156 24.6462 15.9989V15.9989L0.634502 2.36355C0.542657 2.31119 0.457444 2.24796 0.380701 2.17523C0.260289 2.05715 0.164605 1.91624 0.0992389 1.76075C0.0338732 1.60525 0.000136546 1.43828 0 1.26959C0 0.932873 0.133698 0.609948 0.371683 0.371854C0.609667 0.13376 0.932443 0 1.269 0L18.9906 0C21.3763 0 23.6642 0.948135 25.3512 2.63583C27.0381 4.32352 27.9858 6.61252 27.9858 8.99927V8.99927Z" fill="%2318B4F4" /> <path d="M27.9858 22.9986C27.9861 24.1806 27.7536 25.351 27.3017 26.4431C26.8498 27.5352 26.1873 28.5275 25.352 29.3634C24.5167 30.1993 23.5249 30.8624 22.4335 31.3147C21.342 31.7671 20.1721 32 18.9907 32H1.26906C1.01802 31.9973 0.77343 31.9202 0.566221 31.7784C0.359012 31.6366 0.198499 31.4364 0.104989 31.2034C0.0114791 30.9703 -0.0108254 30.7147 0.0408974 30.4689C0.0926201 30.2231 0.216046 29.9982 0.395559 29.8226V29.8226C0.467112 29.7508 0.547407 29.6882 0.634555 29.6364L10.0844 24.2703L24.6441 16.001C25.688 16.8438 26.53 17.9097 27.1083 19.1206C27.6866 20.3315 27.9864 21.6566 27.9858 22.9986V22.9986Z" fill="%23FD6B3C" /> <path d="M24.6461 15.9989L10.0843 24.2703L0.634458 29.6365C0.54372 29.6868 0.459841 29.7487 0.384888 29.8205C3.98804 26.1233 6.00266 21.1627 5.99812 15.9989C6.0049 10.8346 3.99085 5.87268 0.387003 2.17523C0.463746 2.24796 0.548959 2.31119 0.640803 2.36355L24.6461 15.9989Z" fill="%23A97FF2" /> <path d="M47.6659 11.7352C51.8177 11.7352 54.1632 15.0531 54.1632 19.0714C54.1632 23.0896 51.8177 26.3821 47.6659 26.3821C45.5086 26.3821 43.8589 25.5188 42.9473 24.0545L42.5709 26.052H39.9736V6.77115H43.1884V13.8914C43.971 12.6959 45.5086 11.7352 47.6659 11.7352ZM47.0187 23.5488C49.4446 23.5488 50.9547 21.5809 50.9547 19.0714C50.9547 16.5089 49.4446 14.5664 47.0187 14.5664C44.5928 14.5664 43.0806 16.5047 43.0806 19.0714C43.0806 21.583 44.5653 23.5488 47.0187 23.5488V23.5488Z" fill="white" /> <path d="M65.4595 20.2859V12.0611H68.668V20.123C68.668 23.7202 67.0246 26.3821 62.4943 26.3821C57.9639 26.3821 56.3206 23.7117 56.3206 20.123V12.0611H59.529V20.2859C59.529 22.4696 60.5527 23.5488 62.49 23.5488C64.4274 23.5488 65.4595 22.4696 65.4595 20.2859Z" fill="white" /> <path d="M71.2355 7.74451C71.2247 7.46284 71.2724 7.18199 71.3755 6.91968C71.4787 6.65737 71.6351 6.41929 71.8348 6.22047C72.0345 6.02165 72.2732 5.8664 72.5359 5.76452C72.7986 5.66264 73.0796 5.61633 73.3611 5.62853C74.5793 5.62853 75.4571 6.50666 75.4571 7.75509C75.4571 9.00352 74.5793 9.8224 73.3611 9.8224C72.1428 9.8224 71.2355 8.9612 71.2355 7.74451Z" fill="white" /> <path d="M128.476 7.74451C128.465 7.46376 128.513 7.18383 128.615 6.92227C128.718 6.66071 128.873 6.42315 129.072 6.22449C129.27 6.02583 129.508 5.87035 129.769 5.7678C130.031 5.66524 130.31 5.61783 130.591 5.62852C131.809 5.62852 132.687 6.50666 132.687 7.75509C132.687 9.00352 131.809 9.8224 130.591 9.8224C129.373 9.8224 128.476 8.9612 128.476 7.74451Z" fill="white" /> <path d="M122.302 24.1031C122.291 23.8223 122.339 23.5422 122.441 23.2805C122.543 23.0188 122.699 22.7811 122.897 22.5824C123.096 22.3837 123.334 22.2282 123.595 22.1258C123.857 22.0233 124.137 21.9761 124.417 21.9872C125.636 21.9872 126.513 22.8653 126.513 24.1031C126.513 25.341 125.636 26.1726 124.417 26.1726C123.199 26.1726 122.302 25.3219 122.302 24.1031Z" fill="white" /> <path d="M74.9516 12.059H71.7432V26.0583H74.9516V12.059Z" fill="white" /> <path d="M78.16 26.0583V6.77115H81.3685V26.0626L78.16 26.0583Z" fill="white" /> <path d="M94.6063 6.77115H97.8148V26.0626H95.2239L94.8474 24.0651C93.9591 25.523 92.3094 26.3927 90.131 26.3927C86.0046 26.3927 83.6591 23.0748 83.6591 19.0819C83.6591 15.0891 86.0046 11.7458 90.131 11.7458C92.3137 11.7458 93.8238 12.7149 94.6063 13.902V6.77115ZM90.7993 14.5707C88.3734 14.5707 86.8633 16.5131 86.8633 19.0756C86.8633 21.5851 88.3734 23.553 90.7993 23.553C93.2252 23.553 94.7354 21.5851 94.7354 19.0756C94.7396 16.5047 93.257 14.5664 90.8036 14.5664L90.7993 14.5707Z" fill="white" /> <path d="M113.479 22.2284C112.482 24.7359 110.162 26.3821 107.117 26.3821C102.887 26.3821 100.137 23.225 100.137 19.0439C100.137 14.9706 102.942 11.7353 107.093 11.7353C111.245 11.7353 113.969 14.8902 113.969 18.991C113.982 19.3255 113.953 19.6604 113.883 19.9876H103.288C103.53 22.2009 104.959 23.6292 107.197 23.6292C108.735 23.6292 110.001 22.8738 110.594 21.473L113.479 22.2284ZM103.341 17.6156H110.784C110.513 15.6731 109.166 14.3506 107.089 14.3506C105.012 14.3506 103.665 15.7006 103.341 17.6156V17.6156Z" fill="white" /> <path d="M123.779 14.9452C123.538 14.9117 123.295 14.8933 123.051 14.8902C120.786 14.8902 119.439 16.0772 119.439 18.7751V26.0583H116.23V12.0611H118.821L119.195 14.0014C119.707 13.1127 120.887 11.9257 123.322 11.9257C123.455 11.9257 123.779 11.9532 123.779 11.9532V14.9452Z" fill="white" /> <path d="M132.192 12.059H128.984V26.0583H132.192V12.059Z" fill="white" /> <path d="M134.483 19.0714C134.483 15.1335 137.287 11.7353 141.735 11.7353C146.183 11.7353 149.015 15.1335 149.015 19.0714C149.015 23.0092 146.213 26.3821 141.735 26.3821C137.258 26.3821 134.483 23.0092 134.483 19.0714ZM141.735 23.5488C144.083 23.5488 145.806 21.7692 145.806 19.0714C145.806 16.3735 144.083 14.5664 141.735 14.5664C139.387 14.5664 137.687 16.346 137.687 19.0714C137.687 21.7968 139.417 23.5488 141.735 23.5488V23.5488Z" fill="white" /> </g> <defs> <clipPath id="clip0_4_304"> <rect width="149.015" height="32" fill="white" /> </clipPath> </defs> </svg>\');\n background-repeat: no-repeat;\n width: 150px;\n height: 32px;\n}\n@media (max-width: 840px) {\n aside {\n width: 250px;\n padding: 60px 0 0 20px;\n }\n section {\n left: 250px;\n padding: 0 80px;\n }\n}\n@media (max-width: 590px) {\n aside {\n width: 230px;\n padding: 60px 0 0 10px;\n }\n section {\n left: 230px;\n padding: 0 40px;\n }\n}\n#modified-files-message a {\n color: #cbcbcb;\n font-weight: 300;\n text-decoration: underline;\n}\n#modified-files-message a:hover {\n color: white;\n text-decoration: none;\n}\n#restart-warning {\n border-radius: 4px;\n padding: 8px 16px;\n border: 1px solid #fd6b3c;\n background: rgba(253, 107, 60, 0.1);\n}\n#react-router-steps {\n margin: 0px;\n margin-bottom: 5px;\n padding: 0px 20px;\n}\n#need-help {\n color: #48a1ff;\n text-decoration: none;\n}\n#router-message {\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #48a1ff;\n}\n#router-finish-button {\n margin-top: 12px;\n}\n#router-checkbox-div {\n display: flex;\n align-items: center;\n}\n#router-checkbox {\n margin-right: 10px;\n width: 15px;\n height: 15px;\n}\n#success-title {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n#success-title .check-icon {\n display: inline-block;\n width: 24px;\n height: 24px;\n border: 2px solid #28a745;\n border-radius: 50%;\n position: relative;\n}\n#success-title .check-icon::before {\n content: "";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 6px;\n height: 12px;\n border: solid #28a745;\n border-width: 0 2px 2px 0;\n transform: translate(-50%, -60%) rotate(45deg);\n}\n</style>`;\n var BuilderOverviewStep = class extends HTMLElement {\n constructor() {\n super();\n }\n connectedCallback() {\n const shadow = this.attachShadow({ mode: "open" });\n shadow.innerHTML = STEP_CSS + `<main>\n <aside>\n <div class="logo"></div>\n\n <ul>\n <li class="highlight active">\n <div class="circle"></div>\n <div class="line"></div>\n <span>Connect Builder.io</span>\n </li>\n <li>\n <div class="circle"></div>\n <div class="line"></div>\n <span>Update App</span>\n </li>\n <li>\n <div class="circle"></div>\n <span>Setup Complete</span>\n </li>\n </ul>\n </aside>\n\n <section>\n <h1>Integrate Builder.io with your project</h1>\n\n <p>\n First, let\'s connect to your Builder.io space to continue with the\n integration\n </p>\n\n <nav>\n <a class="button next-step" href="#">\n <span id="button-text">Get Started</span>\n <span id="button-icon"></span>\n </a>\n </nav>\n </section>\n</main>\n`;\n setBuilderHead();\n const authPath = new URL(BUILDER_AUTH_CONNECT_PATH, DEV_TOOLS_URL);\n authPath.searchParams.set(PREVIEW_URL_QS, location.href);\n const nextStepLinks = shadow.querySelectorAll(".next-step");\n for (const nextStepLink of nextStepLinks) {\n nextStepLink.setAttribute("href", authPath.href);\n }\n track("overview step viewed");\n }\n };\n var setBuilderHead = () => {\n let favicon = document.head.querySelector(\n "link[rel=\'icon\'], link[rel=\'icon shortcut\']"\n );\n if (favicon) {\n favicon.href = "https://cdn.builder.io/favicon.ico";\n favicon.removeAttribute("type");\n } else {\n favicon = document.createElement("link");\n favicon.rel = "icon";\n favicon.href = "https://cdn.builder.io/favicon.ico";\n document.head.appendChild(favicon);\n }\n };\n\n // packages/dev-tools/client/setup-ui/index.ts\n var checkBuilderIntegration = async () => {\n const validatedBuilder = await apiValidateBuilder();\n if (!validatedBuilder.isValid) {\n showOverviewStep();\n }\n };\n var showOverviewStep = () => {\n if (!customElements.get("builder-dev-tools-overview")) {\n customElements.define("builder-dev-tools-overview", BuilderOverviewStep);\n }\n let overview = document.querySelector(\n "builder-dev-tools-overview"\n );\n if (!overview) {\n overview = document.createElement(\n "builder-dev-tools-overview"\n );\n overview.setAttribute("aria-hidden", "true");\n document.body.appendChild(overview);\n }\n setTimeout(() => {\n overview.removeAttribute("aria-hidden");\n }, 32);\n };\n\n // packages/dev-tools/client/index.ts\n var initDevToolsApp = () => {\n try {\n if (!customElements.get("builder-dev-tools-edit")) {\n customElements.define(\n "builder-dev-tools-edit",\n BuilderDevToolsEditButton\n );\n }\n if (!customElements.get("builder-dev-tools-menu")) {\n customElements.define("builder-dev-tools-menu", BuilderDevToolsMenu);\n }\n let menu = document.querySelector("builder-dev-tools-menu");\n if (!menu) {\n menu = document.createElement("builder-dev-tools-menu");\n menu.setAttribute("data-version", "1.18.44-dev.202512111107.bf5b095a5");\n document.body.appendChild(menu);\n }\n let editButton = document.querySelector("builder-dev-tools-edit");\n if (!editButton) {\n editButton = document.createElement("builder-dev-tools-edit");\n document.body.appendChild(editButton);\n }\n let builderStyles = document.getElementById("builder-dev-tools-style");\n if (!builderStyles) {\n builderStyles = document.createElement("style");\n builderStyles.id = "builder-dev-tools-style";\n builderStyles.innerHTML = `.builder-no-scroll{overflow:hidden !important}`;\n document.head.appendChild(builderStyles);\n }\n checkBuilderIntegration();\n initTracking();\n } catch (e) {\n console.error("Builder Devtools:", e);\n }\n };\n if (window.location === window.parent.location) {\n console.debug(`Builder.io Devtools v${"1.18.44-dev.202512111107.bf5b095a5"}`);\n initDevToolsApp();\n }\n})();');
|
|
2354
|
+
return updateClientRuntimeVariables(ctx, '"use strict";\n(() => {\n var __create = Object.create;\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __getProtoOf = Object.getPrototypeOf;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n };\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === "object" || typeof from === "function") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. "__esModule" has not been set), then set\n // "default" to the CommonJS "module.exports" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,\n mod\n ));\n\n // node_modules/@amplitude/ua-parser-js/src/ua-parser.js\n var require_ua_parser = __commonJS({\n "node_modules/@amplitude/ua-parser-js/src/ua-parser.js"(exports, module) {\n (function(window2, undefined2) {\n "use strict";\n var LIBVERSION = "0.7.33", EMPTY = "", UNKNOWN = "?", FUNC_TYPE = "function", UNDEF_TYPE = "undefined", OBJ_TYPE = "object", STR_TYPE = "string", MAJOR = "major", MODEL = "model", NAME = "name", TYPE = "type", VENDOR = "vendor", VERSION2 = "version", ARCHITECTURE = "architecture", CONSOLE = "console", MOBILE = "mobile", TABLET = "tablet", SMARTTV = "smarttv", WEARABLE = "wearable", EMBEDDED = "embedded", UA_MAX_LENGTH = 350;\n var AMAZON = "Amazon", APPLE = "Apple", ASUS = "ASUS", BLACKBERRY = "BlackBerry", BROWSER = "Browser", CHROME = "Chrome", EDGE = "Edge", FIREFOX = "Firefox", GOOGLE = "Google", HUAWEI = "Huawei", LG = "LG", MICROSOFT = "Microsoft", MOTOROLA = "Motorola", OPERA = "Opera", SAMSUNG = "Samsung", SHARP = "Sharp", SONY = "Sony", XIAOMI = "Xiaomi", ZEBRA = "Zebra", FACEBOOK = "Facebook";\n var extend = function(regexes2, extensions) {\n var mergedRegexes = {};\n for (var i in regexes2) {\n if (extensions[i] && extensions[i].length % 2 === 0) {\n mergedRegexes[i] = extensions[i].concat(regexes2[i]);\n } else {\n mergedRegexes[i] = regexes2[i];\n }\n }\n return mergedRegexes;\n }, enumerize = function(arr) {\n var enums = {};\n for (var i = 0; i < arr.length; i++) {\n enums[arr[i].toUpperCase()] = arr[i];\n }\n return enums;\n }, has = function(str1, str2) {\n return typeof str1 === STR_TYPE ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false;\n }, lowerize = function(str) {\n return str.toLowerCase();\n }, majorize = function(version) {\n return typeof version === STR_TYPE ? version.replace(/[^\\d\\.]/g, EMPTY).split(".")[0] : undefined2;\n }, trim = function(str, len) {\n if (typeof str === STR_TYPE) {\n str = str.replace(/^\\s\\s*/, EMPTY);\n return typeof len === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);\n }\n };\n var rgxMapper = function(ua, arrays) {\n var i = 0, j, k, p, q, matches, match;\n while (i < arrays.length && !matches) {\n var regex = arrays[i], props = arrays[i + 1];\n j = k = 0;\n while (j < regex.length && !matches) {\n matches = regex[j++].exec(ua);\n if (!!matches) {\n for (p = 0; p < props.length; p++) {\n match = matches[++k];\n q = props[p];\n if (typeof q === OBJ_TYPE && q.length > 0) {\n if (q.length === 2) {\n if (typeof q[1] == FUNC_TYPE) {\n this[q[0]] = q[1].call(this, match);\n } else {\n this[q[0]] = q[1];\n }\n } else if (q.length === 3) {\n if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {\n this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined2;\n } else {\n this[q[0]] = match ? match.replace(q[1], q[2]) : undefined2;\n }\n } else if (q.length === 4) {\n this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined2;\n }\n } else {\n this[q] = match ? match : undefined2;\n }\n }\n }\n }\n i += 2;\n }\n }, strMapper = function(str, map) {\n for (var i in map) {\n if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {\n for (var j = 0; j < map[i].length; j++) {\n if (has(map[i][j], str)) {\n return i === UNKNOWN ? undefined2 : i;\n }\n }\n } else if (has(map[i], str)) {\n return i === UNKNOWN ? undefined2 : i;\n }\n }\n return str;\n };\n var oldSafariMap = {\n "1.0": "/8",\n 1.2: "/1",\n 1.3: "/3",\n "2.0": "/412",\n "2.0.2": "/416",\n "2.0.3": "/417",\n "2.0.4": "/419",\n "?": "/"\n }, windowsVersionMap = {\n ME: "4.90",\n "NT 3.11": "NT3.51",\n "NT 4.0": "NT4.0",\n 2e3: "NT 5.0",\n XP: ["NT 5.1", "NT 5.2"],\n Vista: "NT 6.0",\n 7: "NT 6.1",\n 8: "NT 6.2",\n 8.1: "NT 6.3",\n 10: ["NT 6.4", "NT 10.0"],\n RT: "ARM"\n };\n var regexes = {\n browser: [\n [\n /\\b(?:crmo|crios)\\/([\\w\\.]+)/i\n // Chrome for Android/iOS\n ],\n [VERSION2, [NAME, "Chrome"]],\n [\n /edg(?:e|ios|a)?\\/([\\w\\.]+)/i\n // Microsoft Edge\n ],\n [VERSION2, [NAME, "Edge"]],\n [\n // Presto based\n /(opera mini)\\/([-\\w\\.]+)/i,\n // Opera Mini\n /(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i,\n // Opera Mobi/Tablet\n /(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i\n // Opera\n ],\n [NAME, VERSION2],\n [\n /opios[\\/ ]+([\\w\\.]+)/i\n // Opera mini on iphone >= 8.0\n ],\n [VERSION2, [NAME, OPERA + " Mini"]],\n [\n /\\bopr\\/([\\w\\.]+)/i\n // Opera Webkit\n ],\n [VERSION2, [NAME, OPERA]],\n [\n // Mixed\n /(kindle)\\/([\\w\\.]+)/i,\n // Kindle\n /(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i,\n // Lunascape/Maxthon/Netfront/Jasmine/Blazer\n // Trident based\n /(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i,\n // Avant/IEMobile/SlimBrowser\n /(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i,\n // Baidu Browser\n /(?:ms|\\()(ie) ([\\w\\.]+)/i,\n // Internet Explorer\n // Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon\n /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\\/([-\\w\\.]+)/i,\n // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ\n /(weibo)__([\\d\\.]+)/i\n // Weibo\n ],\n [NAME, VERSION2],\n [\n /(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i\n // UCBrowser\n ],\n [VERSION2, [NAME, "UC" + BROWSER]],\n [\n /microm.+\\bqbcore\\/([\\w\\.]+)/i,\n // WeChat Desktop for Windows Built-in Browser\n /\\bqbcore\\/([\\w\\.]+).+microm/i\n ],\n [VERSION2, [NAME, "WeChat(Win) Desktop"]],\n [\n /micromessenger\\/([\\w\\.]+)/i\n // WeChat\n ],\n [VERSION2, [NAME, "WeChat"]],\n [\n /konqueror\\/([\\w\\.]+)/i\n // Konqueror\n ],\n [VERSION2, [NAME, "Konqueror"]],\n [\n /trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i\n // IE11\n ],\n [VERSION2, [NAME, "IE"]],\n [\n /yabrowser\\/([\\w\\.]+)/i\n // Yandex\n ],\n [VERSION2, [NAME, "Yandex"]],\n [\n /(avast|avg)\\/([\\w\\.]+)/i\n // Avast/AVG Secure Browser\n ],\n [[NAME, /(.+)/, "$1 Secure " + BROWSER], VERSION2],\n [\n /\\bfocus\\/([\\w\\.]+)/i\n // Firefox Focus\n ],\n [VERSION2, [NAME, FIREFOX + " Focus"]],\n [\n /\\bopt\\/([\\w\\.]+)/i\n // Opera Touch\n ],\n [VERSION2, [NAME, OPERA + " Touch"]],\n [\n /coc_coc\\w+\\/([\\w\\.]+)/i\n // Coc Coc Browser\n ],\n [VERSION2, [NAME, "Coc Coc"]],\n [\n /dolfin\\/([\\w\\.]+)/i\n // Dolphin\n ],\n [VERSION2, [NAME, "Dolphin"]],\n [\n /coast\\/([\\w\\.]+)/i\n // Opera Coast\n ],\n [VERSION2, [NAME, OPERA + " Coast"]],\n [\n /miuibrowser\\/([\\w\\.]+)/i\n // MIUI Browser\n ],\n [VERSION2, [NAME, "MIUI " + BROWSER]],\n [\n /fxios\\/([-\\w\\.]+)/i\n // Firefox for iOS\n ],\n [VERSION2, [NAME, FIREFOX]],\n [\n /\\bqihu|(qi?ho?o?|360)browser/i\n // 360\n ],\n [[NAME, "360 " + BROWSER]],\n [/(oculus|samsung|sailfish|huawei)browser\\/([\\w\\.]+)/i],\n [[NAME, /(.+)/, "$1 " + BROWSER], VERSION2],\n [\n // Oculus/Samsung/Sailfish/Huawei Browser\n /(comodo_dragon)\\/([\\w\\.]+)/i\n // Comodo Dragon\n ],\n [[NAME, /_/g, " "], VERSION2],\n [\n /(electron)\\/([\\w\\.]+) safari/i,\n // Electron-based App\n /(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i,\n // Tesla\n /m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i\n // QQBrowser/Baidu App/2345 Browser\n ],\n [NAME, VERSION2],\n [\n /(metasr)[\\/ ]?([\\w\\.]+)/i,\n // SouGouBrowser\n /(lbbrowser)/i,\n // LieBao Browser\n /\\[(linkedin)app\\]/i\n // LinkedIn App for iOS & Android\n ],\n [NAME],\n [\n // WebView\n /((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i\n // Facebook App for iOS & Android\n ],\n [[NAME, FACEBOOK], VERSION2],\n [\n /safari (line)\\/([\\w\\.]+)/i,\n // Line App for iOS\n /\\b(line)\\/([\\w\\.]+)\\/iab/i,\n // Line App for Android\n /(chromium|instagram)[\\/ ]([-\\w\\.]+)/i\n // Chromium/Instagram\n ],\n [NAME, VERSION2],\n [\n /\\bgsa\\/([\\w\\.]+) .*safari\\//i\n // Google Search Appliance on iOS\n ],\n [VERSION2, [NAME, "GSA"]],\n [\n /headlesschrome(?:\\/([\\w\\.]+)| )/i\n // Chrome Headless\n ],\n [VERSION2, [NAME, CHROME + " Headless"]],\n [\n / wv\\).+(chrome)\\/([\\w\\.]+)/i\n // Chrome WebView\n ],\n [[NAME, CHROME + " WebView"], VERSION2],\n [\n /droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i\n // Android Browser\n ],\n [VERSION2, [NAME, "Android " + BROWSER]],\n [\n /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i\n // Chrome/OmniWeb/Arora/Tizen/Nokia\n ],\n [NAME, VERSION2],\n [\n /version\\/([\\w\\.\\,]+) .*mobile\\/\\w+ (safari)/i\n // Mobile Safari\n ],\n [VERSION2, [NAME, "Mobile Safari"]],\n [\n /version\\/([\\w(\\.|\\,)]+) .*(mobile ?safari|safari)/i\n // Safari & Safari Mobile\n ],\n [VERSION2, NAME],\n [\n /webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i\n // Safari < 3.0\n ],\n [NAME, [VERSION2, strMapper, oldSafariMap]],\n [/(webkit|khtml)\\/([\\w\\.]+)/i],\n [NAME, VERSION2],\n [\n // Gecko based\n /(navigator|netscape\\d?)\\/([-\\w\\.]+)/i\n // Netscape\n ],\n [[NAME, "Netscape"], VERSION2],\n [\n /mobile vr; rv:([\\w\\.]+)\\).+firefox/i\n // Firefox Reality\n ],\n [VERSION2, [NAME, FIREFOX + " Reality"]],\n [\n /ekiohf.+(flow)\\/([\\w\\.]+)/i,\n // Flow\n /(swiftfox)/i,\n // Swiftfox\n /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,\n // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar\n /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,\n // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix\n /(firefox)\\/([\\w\\.]+)/i,\n // Other Firefox-based\n /(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i,\n // Mozilla\n // Other\n /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,\n // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser\n /(links) \\(([\\w\\.]+)/i\n // Links\n ],\n [NAME, VERSION2],\n [\n /(cobalt)\\/([\\w\\.]+)/i\n // Cobalt\n ],\n [NAME, [VERSION2, /master.|lts./, ""]]\n ],\n cpu: [\n [\n /(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i\n // AMD64 (x64)\n ],\n [[ARCHITECTURE, "amd64"]],\n [\n /(ia32(?=;))/i\n // IA32 (quicktime)\n ],\n [[ARCHITECTURE, lowerize]],\n [\n /((?:i[346]|x)86)[;\\)]/i\n // IA32 (x86)\n ],\n [[ARCHITECTURE, "ia32"]],\n [\n /\\b(aarch64|arm(v?8e?l?|_?64))\\b/i\n // ARM64\n ],\n [[ARCHITECTURE, "arm64"]],\n [\n /\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i\n // ARMHF\n ],\n [[ARCHITECTURE, "armhf"]],\n [\n // PocketPC mistakenly identified as PowerPC\n /windows (ce|mobile); ppc;/i\n ],\n [[ARCHITECTURE, "arm"]],\n [\n /((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i\n // PowerPC\n ],\n [[ARCHITECTURE, /ower/, EMPTY, lowerize]],\n [\n /(sun4\\w)[;\\)]/i\n // SPARC\n ],\n [[ARCHITECTURE, "sparc"]],\n [\n /((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i\n // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC\n ],\n [[ARCHITECTURE, lowerize]]\n ],\n device: [\n [\n //////////////////////////\n // MOBILES & TABLETS\n // Ordered by popularity\n /////////////////////////\n // Samsung\n /\\b(sch-i[89]0\\d|shw-m380s|sm-[ptx]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i\n ],\n [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]],\n [\n /\\b((?:s[cgp]h|gt|sm)-\\w+|galaxy nexus)/i,\n /samsung[- ]([-\\w]+)/i,\n /sec-(sgh\\w+)/i\n ],\n [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]],\n [\n // Apple\n /((ipod|iphone)\\d+,\\d+)/i\n // iPod/iPhone model\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]],\n [\n /(ipad\\d+,\\d+)/i\n // iPad model\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, TABLET]],\n [\n /\\((ip(?:hone|od)[\\w ]*);/i\n // iPod/iPhone\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]],\n [\n /\\((ipad);[-\\w\\),; ]+apple/i,\n // iPad\n /applecoremedia\\/[\\w\\.]+ \\((ipad)/i,\n /\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, TABLET]],\n [/(macintosh);/i],\n [MODEL, [VENDOR, APPLE]],\n [\n // Huawei\n /\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i\n ],\n [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]],\n [\n /(?:huawei|honor)([-\\w ]+)[;\\)]/i,\n /\\b(nexus 6p|\\w{2,4}e?-[atu]?[ln][\\dx][012359c][adn]?)\\b(?!.+d\\/s)/i\n ],\n [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]],\n [\n // Xiaomi\n /\\b(poco[\\w ]+)(?: bui|\\))/i,\n // Xiaomi POCO\n /\\b; (\\w+) build\\/hm\\1/i,\n // Xiaomi Hongmi \'numeric\' models\n /\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i,\n // Xiaomi Hongmi\n /\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i,\n // Xiaomi Redmi\n /\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i\n // Xiaomi Mi\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, XIAOMI],\n [TYPE, MOBILE]\n ],\n [\n /\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i\n // Mi Pad tablets\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, XIAOMI],\n [TYPE, TABLET]\n ],\n [\n // OPPO\n /; (\\w+) bui.+ oppo/i,\n /\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i\n ],\n [MODEL, [VENDOR, "OPPO"], [TYPE, MOBILE]],\n [\n // Vivo\n /vivo (\\w+)(?: bui|\\))/i,\n /\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i\n ],\n [MODEL, [VENDOR, "Vivo"], [TYPE, MOBILE]],\n [\n // Realme\n /\\b(rmx[12]\\d{3})(?: bui|;|\\))/i\n ],\n [MODEL, [VENDOR, "Realme"], [TYPE, MOBILE]],\n [\n // Motorola\n /\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,\n /\\bmot(?:orola)?[- ](\\w*)/i,\n /((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i\n ],\n [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]],\n [/\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i],\n [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]],\n [\n // LG\n /((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i\n ],\n [MODEL, [VENDOR, LG], [TYPE, TABLET]],\n [\n /(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,\n /\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,\n /\\blg-?([\\d\\w]+) bui/i\n ],\n [MODEL, [VENDOR, LG], [TYPE, MOBILE]],\n [\n // Lenovo\n /(ideatab[-\\w ]+)/i,\n /lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i\n ],\n [MODEL, [VENDOR, "Lenovo"], [TYPE, TABLET]],\n [\n // Nokia\n /(?:maemo|nokia).*(n900|lumia \\d+)/i,\n /nokia[-_ ]?([-\\w\\.]*)/i\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, "Nokia"],\n [TYPE, MOBILE]\n ],\n [\n // Google\n /(pixel c)\\b/i\n // Google Pixel C\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]],\n [\n /droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i\n // Google Pixel\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]],\n [\n // Sony\n /droid.+ (a?\\d[0-2]{2}so|[c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i\n ],\n [MODEL, [VENDOR, SONY], [TYPE, MOBILE]],\n [/sony tablet [ps]/i, /\\b(?:sony)?sgp\\w+(?: bui|\\))/i],\n [\n [MODEL, "Xperia Tablet"],\n [VENDOR, SONY],\n [TYPE, TABLET]\n ],\n [\n // OnePlus\n / (kb2005|in20[12]5|be20[12][59])\\b/i,\n /(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i\n ],\n [MODEL, [VENDOR, "OnePlus"], [TYPE, MOBILE]],\n [\n // Amazon\n /(alexa)webm/i,\n /(kf[a-z]{2}wi)( bui|\\))/i,\n // Kindle Fire without Silk\n /(kf[a-z]+)( bui|\\)).+silk\\//i\n // Kindle Fire HD\n ],\n [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]],\n [\n /((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i\n // Fire Phone\n ],\n [\n [MODEL, /(.+)/g, "Fire Phone $1"],\n [VENDOR, AMAZON],\n [TYPE, MOBILE]\n ],\n [\n // BlackBerry\n /(playbook);[-\\w\\),; ]+(rim)/i\n // BlackBerry PlayBook\n ],\n [MODEL, VENDOR, [TYPE, TABLET]],\n [\n /\\b((?:bb[a-f]|st[hv])100-\\d)/i,\n /\\(bb10; (\\w+)/i\n // BlackBerry 10\n ],\n [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]],\n [\n // Asus\n /(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i\n ],\n [MODEL, [VENDOR, ASUS], [TYPE, TABLET]],\n [/ (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i],\n [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]],\n [\n // HTC\n /(nexus 9)/i\n // HTC Nexus 9\n ],\n [MODEL, [VENDOR, "HTC"], [TYPE, TABLET]],\n [\n /(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i,\n // HTC\n // ZTE\n /(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,\n /(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\\w]*)/i\n // Alcatel/GeeksPhone/Nexian/Panasonic/Sony\n ],\n [VENDOR, [MODEL, /_/g, " "], [TYPE, MOBILE]],\n [\n // Acer\n /droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i\n ],\n [MODEL, [VENDOR, "Acer"], [TYPE, TABLET]],\n [\n // Meizu\n /droid.+; (m[1-5] note) bui/i,\n /\\bmz-([-\\w]{2,})/i\n ],\n [MODEL, [VENDOR, "Meizu"], [TYPE, MOBILE]],\n [\n // Sharp\n /\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i\n ],\n [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]],\n [\n // MIXED\n /(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,\n // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron\n /(hp) ([\\w ]+\\w)/i,\n // HP iPAQ\n /(asus)-?(\\w+)/i,\n // Asus\n /(microsoft); (lumia[\\w ]+)/i,\n // Microsoft Lumia\n /(lenovo)[-_ ]?([-\\w]+)/i,\n // Lenovo\n /(jolla)/i,\n // Jolla\n /(oppo) ?([\\w ]+) bui/i\n // OPPO\n ],\n [VENDOR, MODEL, [TYPE, MOBILE]],\n [\n /(archos) (gamepad2?)/i,\n // Archos\n /(hp).+(touchpad(?!.+tablet)|tablet)/i,\n // HP TouchPad\n /(kindle)\\/([\\w\\.]+)/i,\n // Kindle\n /(nook)[\\w ]+build\\/(\\w+)/i,\n // Nook\n /(dell) (strea[kpr\\d ]*[\\dko])/i,\n // Dell Streak\n /(le[- ]+pan)[- ]+(\\w{1,9}) bui/i,\n // Le Pan Tablets\n /(trinity)[- ]*(t\\d{3}) bui/i,\n // Trinity Tablets\n /(gigaset)[- ]+(q\\w{1,9}) bui/i,\n // Gigaset Tablets\n /(vodafone) ([\\w ]+)(?:\\)| bui)/i\n // Vodafone\n ],\n [VENDOR, MODEL, [TYPE, TABLET]],\n [\n /(surface duo)/i\n // Surface Duo\n ],\n [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]],\n [\n /droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i\n // Fairphone\n ],\n [MODEL, [VENDOR, "Fairphone"], [TYPE, MOBILE]],\n [\n /(u304aa)/i\n // AT&T\n ],\n [MODEL, [VENDOR, "AT&T"], [TYPE, MOBILE]],\n [\n /\\bsie-(\\w*)/i\n // Siemens\n ],\n [MODEL, [VENDOR, "Siemens"], [TYPE, MOBILE]],\n [\n /\\b(rct\\w+) b/i\n // RCA Tablets\n ],\n [MODEL, [VENDOR, "RCA"], [TYPE, TABLET]],\n [\n /\\b(venue[\\d ]{2,7}) b/i\n // Dell Venue Tablets\n ],\n [MODEL, [VENDOR, "Dell"], [TYPE, TABLET]],\n [\n /\\b(q(?:mv|ta)\\w+) b/i\n // Verizon Tablet\n ],\n [MODEL, [VENDOR, "Verizon"], [TYPE, TABLET]],\n [\n /\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i\n // Barnes & Noble Tablet\n ],\n [MODEL, [VENDOR, "Barnes & Noble"], [TYPE, TABLET]],\n [/\\b(tm\\d{3}\\w+) b/i],\n [MODEL, [VENDOR, "NuVision"], [TYPE, TABLET]],\n [\n /\\b(k88) b/i\n // ZTE K Series Tablet\n ],\n [MODEL, [VENDOR, "ZTE"], [TYPE, TABLET]],\n [\n /\\b(nx\\d{3}j) b/i\n // ZTE Nubia\n ],\n [MODEL, [VENDOR, "ZTE"], [TYPE, MOBILE]],\n [\n /\\b(gen\\d{3}) b.+49h/i\n // Swiss GEN Mobile\n ],\n [MODEL, [VENDOR, "Swiss"], [TYPE, MOBILE]],\n [\n /\\b(zur\\d{3}) b/i\n // Swiss ZUR Tablet\n ],\n [MODEL, [VENDOR, "Swiss"], [TYPE, TABLET]],\n [\n /\\b((zeki)?tb.*\\b) b/i\n // Zeki Tablets\n ],\n [MODEL, [VENDOR, "Zeki"], [TYPE, TABLET]],\n [\n /\\b([yr]\\d{2}) b/i,\n /\\b(dragon[- ]+touch |dt)(\\w{5}) b/i\n // Dragon Touch Tablet\n ],\n [[VENDOR, "Dragon Touch"], MODEL, [TYPE, TABLET]],\n [\n /\\b(ns-?\\w{0,9}) b/i\n // Insignia Tablets\n ],\n [MODEL, [VENDOR, "Insignia"], [TYPE, TABLET]],\n [\n /\\b((nxa|next)-?\\w{0,9}) b/i\n // NextBook Tablets\n ],\n [MODEL, [VENDOR, "NextBook"], [TYPE, TABLET]],\n [\n /\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i\n // Voice Xtreme Phones\n ],\n [[VENDOR, "Voice"], MODEL, [TYPE, MOBILE]],\n [\n /\\b(lvtel\\-)?(v1[12]) b/i\n // LvTel Phones\n ],\n [[VENDOR, "LvTel"], MODEL, [TYPE, MOBILE]],\n [\n /\\b(ph-1) /i\n // Essential PH-1\n ],\n [MODEL, [VENDOR, "Essential"], [TYPE, MOBILE]],\n [\n /\\b(v(100md|700na|7011|917g).*\\b) b/i\n // Envizen Tablets\n ],\n [MODEL, [VENDOR, "Envizen"], [TYPE, TABLET]],\n [\n /\\b(trio[-\\w\\. ]+) b/i\n // MachSpeed Tablets\n ],\n [MODEL, [VENDOR, "MachSpeed"], [TYPE, TABLET]],\n [\n /\\btu_(1491) b/i\n // Rotor Tablets\n ],\n [MODEL, [VENDOR, "Rotor"], [TYPE, TABLET]],\n [\n /(shield[\\w ]+) b/i\n // Nvidia Shield Tablets\n ],\n [MODEL, [VENDOR, "Nvidia"], [TYPE, TABLET]],\n [\n /(sprint) (\\w+)/i\n // Sprint Phones\n ],\n [VENDOR, MODEL, [TYPE, MOBILE]],\n [\n /(kin\\.[onetw]{3})/i\n // Microsoft Kin\n ],\n [\n [MODEL, /\\./g, " "],\n [VENDOR, MICROSOFT],\n [TYPE, MOBILE]\n ],\n [\n /droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i\n // Zebra\n ],\n [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]],\n [/droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i],\n [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]],\n [\n ///////////////////\n // CONSOLES\n ///////////////////\n /(ouya)/i,\n // Ouya\n /(nintendo) ([wids3utch]+)/i\n // Nintendo\n ],\n [VENDOR, MODEL, [TYPE, CONSOLE]],\n [\n /droid.+; (shield) bui/i\n // Nvidia\n ],\n [MODEL, [VENDOR, "Nvidia"], [TYPE, CONSOLE]],\n [\n /(playstation [345portablevi]+)/i\n // Playstation\n ],\n [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]],\n [\n /\\b(xbox(?: one)?(?!; xbox))[\\); ]/i\n // Microsoft Xbox\n ],\n [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]],\n [\n ///////////////////\n // SMARTTVS\n ///////////////////\n /smart-tv.+(samsung)/i\n // Samsung\n ],\n [VENDOR, [TYPE, SMARTTV]],\n [/hbbtv.+maple;(\\d+)/i],\n [\n [MODEL, /^/, "SmartTV"],\n [VENDOR, SAMSUNG],\n [TYPE, SMARTTV]\n ],\n [\n /(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i\n // LG SmartTV\n ],\n [\n [VENDOR, LG],\n [TYPE, SMARTTV]\n ],\n [\n /(apple) ?tv/i\n // Apple TV\n ],\n [VENDOR, [MODEL, APPLE + " TV"], [TYPE, SMARTTV]],\n [\n /crkey/i\n // Google Chromecast\n ],\n [\n [MODEL, CHROME + "cast"],\n [VENDOR, GOOGLE],\n [TYPE, SMARTTV]\n ],\n [\n /droid.+aft(\\w)( bui|\\))/i\n // Fire TV\n ],\n [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]],\n [\n /\\(dtv[\\);].+(aquos)/i,\n /(aquos-tv[\\w ]+)\\)/i\n // Sharp\n ],\n [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],\n [\n /(bravia[\\w ]+)( bui|\\))/i\n // Sony\n ],\n [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]],\n [\n /(mitv-\\w{5}) bui/i\n // Xiaomi\n ],\n [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]],\n [\n /\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i,\n // Roku\n /hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w ]*; *(\\w[^;]*);([^;]*)/i\n // HbbTV devices\n ],\n [\n [VENDOR, trim],\n [MODEL, trim],\n [TYPE, SMARTTV]\n ],\n [\n /\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i\n // SmartTV from Unidentified Vendors\n ],\n [[TYPE, SMARTTV]],\n [\n ///////////////////\n // WEARABLES\n ///////////////////\n /((pebble))app/i\n // Pebble\n ],\n [VENDOR, MODEL, [TYPE, WEARABLE]],\n [\n /droid.+; (glass) \\d/i\n // Google Glass\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]],\n [/droid.+; (wt63?0{2,3})\\)/i],\n [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]],\n [\n /(quest( 2)?)/i\n // Oculus Quest\n ],\n [MODEL, [VENDOR, FACEBOOK], [TYPE, WEARABLE]],\n [\n ///////////////////\n // EMBEDDED\n ///////////////////\n /(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i\n // Tesla\n ],\n [VENDOR, [TYPE, EMBEDDED]],\n [\n ////////////////////\n // MIXED (GENERIC)\n ///////////////////\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i\n // Android Phones from Unidentified Vendors\n ],\n [MODEL, [TYPE, MOBILE]],\n [\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i\n // Android Tablets from Unidentified Vendors\n ],\n [MODEL, [TYPE, TABLET]],\n [\n /\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i\n // Unidentifiable Tablet\n ],\n [[TYPE, TABLET]],\n [\n /(phone|mobile(?:[;\\/]| [ \\w\\/\\.]*safari)|pda(?=.+windows ce))/i\n // Unidentifiable Mobile\n ],\n [[TYPE, MOBILE]],\n [\n /(android[-\\w\\. ]{0,9});.+buil/i\n // Generic Android Device\n ],\n [MODEL, [VENDOR, "Generic"]]\n ],\n engine: [\n [\n /windows.+ edge\\/([\\w\\.]+)/i\n // EdgeHTML\n ],\n [VERSION2, [NAME, EDGE + "HTML"]],\n [\n /webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i\n // Blink\n ],\n [VERSION2, [NAME, "Blink"]],\n [\n /(presto)\\/([\\w\\.]+)/i,\n // Presto\n /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i,\n // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna\n /ekioh(flow)\\/([\\w\\.]+)/i,\n // Flow\n /(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i,\n // KHTML/Tasman/Links\n /(icab)[\\/ ]([23]\\.[\\d\\.]+)/i\n // iCab\n ],\n [NAME, VERSION2],\n [\n /rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i\n // Gecko\n ],\n [VERSION2, NAME]\n ],\n os: [\n [\n // Windows\n /microsoft (windows) (vista|xp)/i\n // Windows (iTunes)\n ],\n [NAME, VERSION2],\n [\n /(windows) nt 6\\.2; (arm)/i,\n // Windows RT\n /(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i,\n // Windows Phone\n /(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i\n ],\n [NAME, [VERSION2, strMapper, windowsVersionMap]],\n [/(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i],\n [\n [NAME, "Windows"],\n [VERSION2, strMapper, windowsVersionMap]\n ],\n [\n // iOS/macOS\n /ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i,\n // iOS\n /cfnetwork\\/.+darwin/i\n ],\n [\n [VERSION2, /_/g, "."],\n [NAME, "iOS"]\n ],\n [\n /(mac os x) ?([\\w\\. ]*)/i,\n /(macintosh|mac_powerpc\\b)(?!.+haiku)/i\n // Mac OS\n ],\n [\n [NAME, "Mac OS"],\n [VERSION2, /_/g, "."]\n ],\n [\n // Mobile OSes\n /droid ([\\w\\.]+)\\b.+(android[- ]x86|harmonyos)/i\n // Android-x86/HarmonyOS\n ],\n [VERSION2, NAME],\n [\n // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS\n /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,\n /(blackberry)\\w*\\/([\\w\\.]*)/i,\n // Blackberry\n /(tizen|kaios)[\\/ ]([\\w\\.]+)/i,\n // Tizen/KaiOS\n /\\((series40);/i\n // Series 40\n ],\n [NAME, VERSION2],\n [\n /\\(bb(10);/i\n // BlackBerry 10\n ],\n [VERSION2, [NAME, BLACKBERRY]],\n [\n /(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i\n // Symbian\n ],\n [VERSION2, [NAME, "Symbian"]],\n [\n /mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i\n // Firefox OS\n ],\n [VERSION2, [NAME, FIREFOX + " OS"]],\n [\n /web0s;.+rt(tv)/i,\n /\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i\n // WebOS\n ],\n [VERSION2, [NAME, "webOS"]],\n [\n // Google Chromecast\n /crkey\\/([\\d\\.]+)/i\n // Google Chromecast\n ],\n [VERSION2, [NAME, CHROME + "cast"]],\n [\n /(cros) [\\w]+ ([\\w\\.]+\\w)/i\n // Chromium OS\n ],\n [[NAME, "Chromium OS"], VERSION2],\n [\n // Console\n /(nintendo|playstation) ([wids345portablevuch]+)/i,\n // Nintendo/Playstation\n /(xbox); +xbox ([^\\);]+)/i,\n // Microsoft Xbox (360, One, X, S, Series X, Series S)\n // Other\n /\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i,\n // Joli/Palm\n /(mint)[\\/\\(\\) ]?(\\w*)/i,\n // Mint\n /(mageia|vectorlinux)[; ]/i,\n // Mageia/VectorLinux\n /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,\n // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire\n /(hurd|linux) ?([\\w\\.]*)/i,\n // Hurd/Linux\n /(gnu) ?([\\w\\.]*)/i,\n // GNU\n /\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i,\n // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly\n /(haiku) (\\w+)/i\n // Haiku\n ],\n [NAME, VERSION2],\n [\n /(sunos) ?([\\w\\.\\d]*)/i\n // Solaris\n ],\n [[NAME, "Solaris"], VERSION2],\n [\n /((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i,\n // Solaris\n /(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i,\n // AIX\n /\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,\n // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX\n /(unix) ?([\\w\\.]*)/i\n // UNIX\n ],\n [NAME, VERSION2]\n ]\n };\n var UAParser2 = function(ua, extensions) {\n if (typeof ua === OBJ_TYPE) {\n extensions = ua;\n ua = undefined2;\n }\n if (!(this instanceof UAParser2)) {\n return new UAParser2(ua, extensions).getResult();\n }\n var _ua = ua || (typeof window2 !== UNDEF_TYPE && window2.navigator && window2.navigator.userAgent ? window2.navigator.userAgent : EMPTY);\n var _rgxmap = extensions ? extend(regexes, extensions) : regexes;\n this.getBrowser = function() {\n var _browser = {};\n _browser[NAME] = undefined2;\n _browser[VERSION2] = undefined2;\n rgxMapper.call(_browser, _ua, _rgxmap.browser);\n _browser.major = majorize(_browser.version);\n return _browser;\n };\n this.getCPU = function() {\n var _cpu = {};\n _cpu[ARCHITECTURE] = undefined2;\n rgxMapper.call(_cpu, _ua, _rgxmap.cpu);\n return _cpu;\n };\n this.getDevice = function() {\n var _device = {};\n _device[VENDOR] = undefined2;\n _device[MODEL] = undefined2;\n _device[TYPE] = undefined2;\n rgxMapper.call(_device, _ua, _rgxmap.device);\n return _device;\n };\n this.getEngine = function() {\n var _engine = {};\n _engine[NAME] = undefined2;\n _engine[VERSION2] = undefined2;\n rgxMapper.call(_engine, _ua, _rgxmap.engine);\n return _engine;\n };\n this.getOS = function() {\n var _os = {};\n _os[NAME] = undefined2;\n _os[VERSION2] = undefined2;\n rgxMapper.call(_os, _ua, _rgxmap.os);\n return _os;\n };\n this.getResult = function() {\n return {\n ua: this.getUA(),\n browser: this.getBrowser(),\n engine: this.getEngine(),\n os: this.getOS(),\n device: this.getDevice(),\n cpu: this.getCPU()\n };\n };\n this.getUA = function() {\n return _ua;\n };\n this.setUA = function(ua2) {\n _ua = typeof ua2 === STR_TYPE && ua2.length > UA_MAX_LENGTH ? trim(ua2, UA_MAX_LENGTH) : ua2;\n return this;\n };\n this.setUA(_ua);\n return this;\n };\n UAParser2.VERSION = LIBVERSION;\n UAParser2.BROWSER = enumerize([NAME, VERSION2, MAJOR]);\n UAParser2.CPU = enumerize([ARCHITECTURE]);\n UAParser2.DEVICE = enumerize([\n MODEL,\n VENDOR,\n TYPE,\n CONSOLE,\n MOBILE,\n SMARTTV,\n TABLET,\n WEARABLE,\n EMBEDDED\n ]);\n UAParser2.ENGINE = UAParser2.OS = enumerize([NAME, VERSION2]);\n if (typeof exports !== UNDEF_TYPE) {\n if (typeof module !== UNDEF_TYPE && module.exports) {\n exports = module.exports = UAParser2;\n }\n exports.UAParser = UAParser2;\n } else {\n if (typeof define === FUNC_TYPE && define.amd) {\n define(function() {\n return UAParser2;\n });\n } else if (typeof window2 !== UNDEF_TYPE) {\n window2.UAParser = UAParser2;\n }\n }\n var $ = typeof window2 !== UNDEF_TYPE && (window2.jQuery || window2.Zepto);\n if ($ && !$.ua) {\n var parser = new UAParser2();\n $.ua = parser.getResult();\n $.ua.get = function() {\n return parser.getUA();\n };\n $.ua.set = function(ua) {\n parser.setUA(ua);\n var result = parser.getResult();\n for (var prop in result) {\n $.ua[prop] = result[prop];\n }\n };\n }\n })(typeof window === "object" ? window : exports);\n }\n });\n\n // packages/dev-tools/client/utils.ts\n var goToSection = (shadow, view) => {\n closeToasts(shadow);\n const aside = shadow.querySelector("aside");\n aside.dataset.view = view;\n aside.classList.remove("section-ready");\n setTimeout(() => {\n aside.classList.add("section-ready");\n }, 200);\n };\n var initBackButtons = (shadow) => {\n Array.from(shadow.querySelectorAll(".back-button")).forEach((elm) => {\n elm.addEventListener("click", (ev) => {\n closeToasts(shadow);\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n goToSection(shadow, target?.dataset.back || "nav-home");\n });\n });\n };\n var showToast = (shadow, html) => {\n closeToasts(shadow);\n const aside = shadow.querySelector("aside");\n const toast = document.createElement("div");\n toast.className = `ui-toast`;\n toast.innerHTML = html;\n aside.appendChild(toast);\n setTimeout(() => {\n toast.classList.add("ui-toast-show");\n setTimeout(() => {\n toast.classList.remove("ui-toast-show");\n setTimeout(() => {\n toast.remove();\n }, 500);\n }, 4e3);\n }, 30);\n };\n var closeToasts = (shadow) => {\n const aside = shadow.querySelector("aside");\n const existing = Array.from(aside.querySelectorAll(".ui-toast"));\n existing.forEach((el) => {\n el.classList.remove("ui-toast-show");\n });\n };\n var isEditEnabled = () => {\n const key = getDisableEditKey();\n return localStorage.getItem(key) !== "true";\n };\n var enableEdit = (enable) => {\n const key = getDisableEditKey();\n if (enable) {\n localStorage.removeItem(key);\n } else {\n localStorage.setItem(key, "true");\n }\n };\n var getDisableEditKey = () => getLocalStorageKey("disableEdit");\n var getLocalStorageKey = (name) => `builder.__LOCAL_APP_ID__.${name}`;\n var getEditorUrl = () => {\n const contentElm = document.body.querySelector("[builder-content-id]");\n const contentId = contentElm?.getAttribute("builder-content-id");\n return getBuilderContentUrl(contentId);\n };\n var getBuilderContentUrl = (contentId, blockId) => {\n let pathname = "/content";\n if (contentId) {\n pathname += "/" + contentId + "/edit";\n }\n const url = new URL(pathname, "https://builder.io");\n if (contentId && blockId) {\n url.searchParams.set("selectedBlock", blockId);\n }\n const previewUrl = new URL(location.pathname, location.href);\n url.searchParams.set("overridePreviewUrl", previewUrl.href);\n return url.href;\n };\n var DEV_TOOLS_URL = "__DEV_TOOLS_URL__";\n var APP_STATE = {\n components: [],\n registryPath: "",\n registryDisplayPath: "",\n frameworks: [],\n dependencies: [],\n publicApiKey: void 0,\n devToolsVersion: ""\n };\n var updateAppState = (registry) => {\n APP_STATE.components = registry.components;\n APP_STATE.registryPath = registry.registryPath;\n APP_STATE.registryDisplayPath = registry.registryDisplayPath;\n APP_STATE.dependencies = registry.dependencies;\n APP_STATE.publicApiKey = registry.publicApiKey;\n };\n\n // packages/dev-tools/client/edit-button/document-listeners.ts\n function initDocumentListeners(editButton) {\n let lastBlockId = null;\n const menu = document.querySelector(\n "builder-dev-tools-menu"\n );\n const hideEditButton = () => {\n editButton.hide();\n };\n const onPointerOver = (ev) => {\n const hoverElm = ev.target;\n if (!hoverElm) {\n hideEditButton();\n return;\n }\n if (hoverElm.closest("builder-dev-tools-edit")) {\n return;\n }\n const contentElm = hoverElm.closest("[builder-content-id]");\n const blockElm = hoverElm.closest("[builder-id]");\n if (!contentElm || !blockElm) {\n editButton.hide();\n return;\n }\n const blockId = editButton.show(contentElm, blockElm);\n if (!blockId || blockId === lastBlockId) {\n return;\n }\n menu.highlightOpener();\n lastBlockId = blockId;\n };\n document.addEventListener("pointerover", onPointerOver, { passive: true });\n document.addEventListener("pointerleave", hideEditButton, {\n passive: true\n });\n document.addEventListener("pointercancel", hideEditButton, {\n passive: true\n });\n document.addEventListener("visibilitychange", hideEditButton, {\n passive: true\n });\n window.addEventListener("popstate", hideEditButton, { passive: true });\n const originalPushState = history.pushState;\n history.pushState = function(...args) {\n editButton.hide();\n originalPushState.apply(this, args);\n };\n const originalReplaceState = history.replaceState;\n history.replaceState = function(...args) {\n editButton.hide();\n originalReplaceState.apply(this, args);\n };\n }\n\n // packages/dev-tools/client/edit-button/index.ts\n var BuilderDevToolsEditButton = class extends HTMLElement {\n openInBuilder = null;\n block = null;\n constructor() {\n super();\n }\n connectedCallback() {\n this.setAttribute("aria-hidden", "true");\n const shadow = this.attachShadow({ mode: "open" });\n shadow.innerHTML = \'<style>/* packages/dev-tools/client/common.css */\\n*,\\n*::before,\\n*::after {\\n box-sizing: border-box;\\n}\\n:host {\\n --background-color: rgba(40, 40, 40, 1);\\n --primary-color: rgba(72, 161, 255, 1);\\n --primary-color-subdued: rgb(72, 161, 255, 0.6);\\n --primary-color-highlight: rgb(126, 188, 255);\\n --primary-contrast-color: white;\\n --edit-color: #1d74e2;\\n --edit-color-highlight: #1c6bd1;\\n --edit-color-alpha: rgb(72, 161, 255, 0.15);\\n --error-color: #ff2b55;\\n --text-color: white;\\n --text-color-highlight: white;\\n --border-color: #454545;\\n --button-background-color-hover: rgba(255, 255, 255, 0.1);\\n --menu-width: 320px;\\n --transition-time: 150ms;\\n --font-family:\\n ui-sans-serif,\\n system-ui,\\n -apple-system,\\n BlinkMacSystemFont,\\n "Segoe UI",\\n Roboto,\\n "Helvetica Neue",\\n Arial,\\n "Noto Sans",\\n sans-serif,\\n "Apple Color Emoji",\\n "Segoe UI Emoji",\\n "Segoe UI Symbol",\\n "Noto Color Emoji";\\n font-family: var(--font-family);\\n line-height: 1.6;\\n}\\nbutton {\\n cursor: pointer;\\n color: var(--text-color);\\n -webkit-tap-highlight-color: transparent;\\n}\\ninput,\\nselect,\\nbutton {\\n font-family: var(--font-family);\\n}\\n\\n/* packages/dev-tools/client/edit-button/edit-button.css */\\n:host {\\n display: none;\\n position: absolute;\\n top: 0;\\n left: 0;\\n width: 100%;\\n height: 100%;\\n z-index: 2147483646;\\n user-select: none;\\n pointer-events: none;\\n color: var(--text-color);\\n}\\n#content-highlight,\\n#block {\\n position: absolute;\\n}\\n#content-highlight {\\n border: 3px solid var(--primary-color);\\n background-color: var(--primary-color-alpha);\\n}\\na {\\n position: absolute;\\n top: -33px;\\n left: 0;\\n display: block;\\n padding: 5px 10px 8px 10px;\\n pointer-events: auto;\\n z-index: 100;\\n text-decoration: none;\\n}\\na:hover {\\n text-decoration: none;\\n}\\na span {\\n display: block;\\n padding: 3px 6px;\\n font-size: 10px;\\n font-weight: 300;\\n border-radius: 3px;\\n text-align: center;\\n text-decoration: none;\\n pointer-events: none;\\n background-color: var(--edit-color);\\n color: var(--text-color);\\n white-space: nowrap;\\n}\\na:hover span {\\n background-color: var(--edit-color-highlight);\\n}\\na:hover ~ .outline {\\n border-color: var(--edit-color-highlight);\\n}\\n#open-in-editor {\\n display: none;\\n}\\n.outline {\\n position: absolute;\\n top: 0;\\n left: 0;\\n width: 100%;\\n height: 100%;\\n border: 1px solid var(--edit-color);\\n background-color: var(--edit-color-alpha);\\n}</style><div id="block"> <a id="open-in-builder" target="builder"><span>Open In Builder</span></a> <a id="open-in-editor" href="#open-in-editor"><span>Open In Editor</span></a> <div class="outline"></div> </div>\';\n this.openInBuilder = shadow.getElementById(\n "open-in-builder"\n );\n this.block = shadow.getElementById("block");\n initDocumentListeners(this);\n }\n show(contentElm, blockElm) {\n if (!isEditEnabled()) {\n this.hide();\n return null;\n }\n const contentId = contentElm.getAttribute("builder-content-id");\n const blockId = blockElm.getAttribute("builder-id");\n if (!contentId || !blockId) {\n this.hide();\n return null;\n }\n const block = this.block;\n const openInBuilder = this.openInBuilder;\n const builderRect = blockElm.getBoundingClientRect();\n block.style.top = builderRect.top + window.scrollY - 1 + "px";\n block.style.left = builderRect.left + window.scrollX + "px";\n block.style.width = builderRect.width + "px";\n block.style.height = builderRect.height + 1 + "px";\n const openInBuilderRect = openInBuilder.getBoundingClientRect();\n if (openInBuilderRect.width > builderRect.width) {\n const diff = openInBuilderRect.width - builderRect.width;\n openInBuilder.style.left = diff / 2 * -1 + "px";\n } else {\n openInBuilder.style.left = "";\n }\n openInBuilder.href = getBuilderContentUrl(contentId, blockId);\n this.style.display = "block";\n return blockId;\n }\n hide() {\n this.style.display = "";\n }\n };\n\n // packages/dev-tools/common/constants.ts\n var PREVIEW_URL_QS = `preview-url`;\n var CONNECTED_USER_ID_QS = "_b-uid";\n var BUILDER_AUTH_CONNECT_PATH = "/~builder-connect";\n var DEV_TOOLS_API_PATH = "/~builder-dev-tools";\n var AMPLITUDE_PROXY_URL = "https://cdn.builder.io/api/v1/proxy-api?url=https://api2.amplitude.com/2/httpapi";\n\n // packages/dev-tools/client/client-api.ts\n var apiValidateBuilder = () => apiFetch({\n type: "validateBuilder"\n });\n var apiLaunchEditor = (file) => apiFetch({\n type: "launchEditor",\n data: file\n });\n var apiRegistry = (opts) => apiFetch({\n type: "getRegistry",\n data: opts\n });\n var apiLoadComponent = (opts) => apiFetch({\n type: "loadComponent",\n data: opts\n });\n var apiRegisterComponent = (opts) => apiFetch({\n type: "registerComponent",\n data: opts\n });\n var apiSetComponentInfo = (opts) => apiFetch({\n type: "setComponentInfo",\n data: opts\n });\n var apiSetComponentInput = (opts) => apiFetch({\n type: "setComponentInput",\n data: opts\n });\n var apiUnregisterComponent = (opts) => apiFetch({\n type: "unregisterComponent",\n data: opts\n });\n var apiDevToolsEnabled = (enabled) => apiFetch({\n type: "enableDevTools",\n data: { enabled }\n });\n var apiLocalConfig = () => apiFetch({ type: "localConfig" });\n var apiFetch = async (data) => {\n const url = new URL(DEV_TOOLS_API_PATH, DEV_TOOLS_URL);\n let rsp;\n try {\n rsp = await fetch(url, {\n method: "POST",\n body: JSON.stringify(data)\n });\n } catch (e) {\n console.error(`Devtools Fetch Error, ${url.href}`, e);\n throw new Error(`Builder Devtools Fetch Error`);\n }\n const contentType = rsp.headers.get("content-type") || "";\n if (contentType.includes("application/json")) {\n const r = await rsp.json();\n if (rsp.ok) {\n return r.data;\n }\n if (Array.isArray(r.errors) && r.errors.length > 0) {\n r.errors.forEach((e) => console.error(e));\n throw new Error(`Builder Devtools Fetch Error: ${r.errors[0]}`);\n }\n }\n throw new Error(\n `Builder Devtools Fetch Error: ${rsp.status}, ${await rsp.text()}`\n );\n };\n\n // packages/dev-tools/common/ast/component-input-types.ts\n var INPUT_TYPES = [\n { value: "boolean", text: "boolean" },\n { value: "color", text: "color (provides a color in hex or rgb)" },\n { value: "date", text: "date (same format as the Date constructor)" },\n { value: "email", text: "email" },\n { value: "file", text: "file (uploads a file and provides a url)" },\n { value: "list", text: "list (collection of items)" },\n { value: "longText", text: "longText (multiline text editor)" },\n { value: "number", text: "number" },\n { value: "object", text: "object (set of specific names and values)" },\n { value: "richText", text: "richText (provides value as html)" },\n { value: "string", text: "string" }\n ];\n var STRING_TYPES = [\n "color",\n "date",\n "email",\n "file",\n "longText",\n "richText",\n "string"\n ];\n var NUMBER_TYPES = ["number"];\n var BOOLEAN_TYPES = ["boolean"];\n var ARRAY_TYPES = ["list"];\n var OBJECT_TYPES = ["object"];\n function getPrimitiveType(t) {\n if (STRING_TYPES.includes(t)) {\n return "string";\n } else if (NUMBER_TYPES.includes(t)) {\n return "number";\n } else if (BOOLEAN_TYPES.includes(t)) {\n return "boolean";\n } else if (ARRAY_TYPES.includes(t)) {\n return "array";\n } else if (OBJECT_TYPES.includes(t)) {\n return "object";\n } else {\n return "string";\n }\n }\n var PROP_BLACKLIST = new Set(\n [\n "about",\n "accessKey",\n "accessKeyLabel",\n "asChild",\n "autoCapitalize",\n "autoCorrect",\n "autoFocus",\n "autoSave",\n "blur",\n "contentEditable",\n "contextMenu",\n "dangerouslySetInnerHTML",\n "datatype",\n "defaultChecked",\n "defaultValue",\n "dir",\n "draggable",\n "enterKeyHint",\n "focus",\n "form",\n "formAction",\n "formEncType",\n "formMethod",\n "formNoValidate",\n "formTarget",\n "inlist",\n "innerText",\n "inputMode",\n "is",\n "isContentEditable",\n "itemID",\n "itemProp",\n "itemRef",\n "itemScope",\n "itemType",\n "lang",\n "nonce",\n "offsetHeight",\n "offsetLeft",\n "offsetTop",\n "offsetWidth",\n "outerText",\n "prefix",\n "property",\n "radioGroup",\n "rel",\n "resource",\n "results",\n "rev",\n "role",\n "security",\n "slot",\n "spellCheck",\n "suppressContentEditableWarning",\n "suppressHydrationWarning",\n "tabIndex",\n "translate",\n "typeof",\n "unselectable",\n "vocab"\n ].map((s) => s.toLowerCase())\n );\n\n // node_modules/tslib/tslib.es6.mjs\n var extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {\n d2.__proto__ = b2;\n } || function(d2, b2) {\n for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];\n };\n return extendStatics(d, b);\n };\n function __extends(d, b) {\n if (typeof b !== "function" && b !== null)\n throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n }\n var __assign = function() {\n __assign = Object.assign || function __assign3(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === "function")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n }\n function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function(resolve) {\n resolve(value);\n });\n }\n return new (P || (P = Promise))(function(resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator["throw"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n }\n function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() {\n if (t[0] & 1) throw t[1];\n return t[1];\n }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);\n return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {\n return this;\n }), g;\n function verb(n) {\n return function(v) {\n return step([n, v]);\n };\n }\n function step(op) {\n if (f) throw new TypeError("Generator is already executing.");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return { value: op[1], done: false };\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return { value: op[0] ? op[1] : void 0, done: true };\n }\n }\n function __values(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function() {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n }\n function __read(o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = { error };\n } finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n return ar;\n }\n function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n }\n\n // node_modules/@amplitude/analytics-types/lib/esm/index.js\n var esm_exports = {};\n __export(esm_exports, {\n IdentifyOperation: () => IdentifyOperation,\n LogLevel: () => LogLevel,\n PluginType: () => PluginType,\n RevenueProperty: () => RevenueProperty,\n ServerZone: () => ServerZone,\n SpecialEventType: () => SpecialEventType,\n Status: () => Status,\n TransportType: () => TransportType\n });\n\n // node_modules/@amplitude/analytics-types/lib/esm/event.js\n var IdentifyOperation;\n (function(IdentifyOperation2) {\n IdentifyOperation2["SET"] = "$set";\n IdentifyOperation2["SET_ONCE"] = "$setOnce";\n IdentifyOperation2["ADD"] = "$add";\n IdentifyOperation2["APPEND"] = "$append";\n IdentifyOperation2["PREPEND"] = "$prepend";\n IdentifyOperation2["REMOVE"] = "$remove";\n IdentifyOperation2["PREINSERT"] = "$preInsert";\n IdentifyOperation2["POSTINSERT"] = "$postInsert";\n IdentifyOperation2["UNSET"] = "$unset";\n IdentifyOperation2["CLEAR_ALL"] = "$clearAll";\n })(IdentifyOperation || (IdentifyOperation = {}));\n var RevenueProperty;\n (function(RevenueProperty2) {\n RevenueProperty2["REVENUE_PRODUCT_ID"] = "$productId";\n RevenueProperty2["REVENUE_QUANTITY"] = "$quantity";\n RevenueProperty2["REVENUE_PRICE"] = "$price";\n RevenueProperty2["REVENUE_TYPE"] = "$revenueType";\n RevenueProperty2["REVENUE_CURRENCY"] = "$currency";\n RevenueProperty2["REVENUE"] = "$revenue";\n })(RevenueProperty || (RevenueProperty = {}));\n var SpecialEventType;\n (function(SpecialEventType2) {\n SpecialEventType2["IDENTIFY"] = "$identify";\n SpecialEventType2["GROUP_IDENTIFY"] = "$groupidentify";\n SpecialEventType2["REVENUE"] = "revenue_amount";\n })(SpecialEventType || (SpecialEventType = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/logger.js\n var LogLevel;\n (function(LogLevel2) {\n LogLevel2[LogLevel2["None"] = 0] = "None";\n LogLevel2[LogLevel2["Error"] = 1] = "Error";\n LogLevel2[LogLevel2["Warn"] = 2] = "Warn";\n LogLevel2[LogLevel2["Verbose"] = 3] = "Verbose";\n LogLevel2[LogLevel2["Debug"] = 4] = "Debug";\n })(LogLevel || (LogLevel = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/plugin.js\n var PluginType;\n (function(PluginType2) {\n PluginType2["BEFORE"] = "before";\n PluginType2["ENRICHMENT"] = "enrichment";\n PluginType2["DESTINATION"] = "destination";\n })(PluginType || (PluginType = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/server-zone.js\n var ServerZone;\n (function(ServerZone2) {\n ServerZone2["US"] = "US";\n ServerZone2["EU"] = "EU";\n ServerZone2["STAGING"] = "STAGING";\n })(ServerZone || (ServerZone = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/status.js\n var Status;\n (function(Status2) {\n Status2["Unknown"] = "unknown";\n Status2["Skipped"] = "skipped";\n Status2["Success"] = "success";\n Status2["RateLimit"] = "rate_limit";\n Status2["PayloadTooLarge"] = "payload_too_large";\n Status2["Invalid"] = "invalid";\n Status2["Failed"] = "failed";\n Status2["Timeout"] = "Timeout";\n Status2["SystemError"] = "SystemError";\n })(Status || (Status = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/transport.js\n var TransportType;\n (function(TransportType2) {\n TransportType2["XHR"] = "xhr";\n TransportType2["SendBeacon"] = "beacon";\n TransportType2["Fetch"] = "fetch";\n })(TransportType || (TransportType = {}));\n\n // node_modules/@amplitude/analytics-core/lib/esm/constants.js\n var UNSET_VALUE = "-";\n var AMPLITUDE_PREFIX = "AMP";\n var STORAGE_PREFIX = "".concat(AMPLITUDE_PREFIX, "_unsent");\n var AMPLITUDE_SERVER_URL = "https://api2.amplitude.com/2/httpapi";\n var EU_AMPLITUDE_SERVER_URL = "https://api.eu.amplitude.com/2/httpapi";\n var AMPLITUDE_BATCH_SERVER_URL = "https://api2.amplitude.com/batch";\n var EU_AMPLITUDE_BATCH_SERVER_URL = "https://api.eu.amplitude.com/batch";\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js\n var MAX_PROPERTY_KEYS = 1e3;\n var isValidObject = function(properties) {\n if (Object.keys(properties).length > MAX_PROPERTY_KEYS) {\n return false;\n }\n for (var key in properties) {\n var value = properties[key];\n if (!isValidProperties(key, value))\n return false;\n }\n return true;\n };\n var isValidProperties = function(property, value) {\n var e_1, _a;\n if (typeof property !== "string")\n return false;\n if (Array.isArray(value)) {\n var isValid = true;\n try {\n for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {\n var valueElement = value_1_1.value;\n if (Array.isArray(valueElement)) {\n return false;\n } else if (typeof valueElement === "object") {\n isValid = isValid && isValidObject(valueElement);\n } else if (!["number", "string"].includes(typeof valueElement)) {\n return false;\n }\n if (!isValid) {\n return false;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n } else if (value === null || value === void 0) {\n return false;\n } else if (typeof value === "object") {\n return isValidObject(value);\n } else if (!["number", "string", "boolean"].includes(typeof value)) {\n return false;\n }\n return true;\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/identify.js\n var Identify = (\n /** @class */\n (function() {\n function Identify2() {\n this._propertySet = /* @__PURE__ */ new Set();\n this._properties = {};\n }\n Identify2.prototype.getUserProperties = function() {\n return __assign({}, this._properties);\n };\n Identify2.prototype.set = function(property, value) {\n this._safeSet(IdentifyOperation.SET, property, value);\n return this;\n };\n Identify2.prototype.setOnce = function(property, value) {\n this._safeSet(IdentifyOperation.SET_ONCE, property, value);\n return this;\n };\n Identify2.prototype.append = function(property, value) {\n this._safeSet(IdentifyOperation.APPEND, property, value);\n return this;\n };\n Identify2.prototype.prepend = function(property, value) {\n this._safeSet(IdentifyOperation.PREPEND, property, value);\n return this;\n };\n Identify2.prototype.postInsert = function(property, value) {\n this._safeSet(IdentifyOperation.POSTINSERT, property, value);\n return this;\n };\n Identify2.prototype.preInsert = function(property, value) {\n this._safeSet(IdentifyOperation.PREINSERT, property, value);\n return this;\n };\n Identify2.prototype.remove = function(property, value) {\n this._safeSet(IdentifyOperation.REMOVE, property, value);\n return this;\n };\n Identify2.prototype.add = function(property, value) {\n this._safeSet(IdentifyOperation.ADD, property, value);\n return this;\n };\n Identify2.prototype.unset = function(property) {\n this._safeSet(IdentifyOperation.UNSET, property, UNSET_VALUE);\n return this;\n };\n Identify2.prototype.clearAll = function() {\n this._properties = {};\n this._properties[IdentifyOperation.CLEAR_ALL] = UNSET_VALUE;\n return this;\n };\n Identify2.prototype._safeSet = function(operation, property, value) {\n if (this._validate(operation, property, value)) {\n var userPropertyMap = this._properties[operation];\n if (userPropertyMap === void 0) {\n userPropertyMap = {};\n this._properties[operation] = userPropertyMap;\n }\n userPropertyMap[property] = value;\n this._propertySet.add(property);\n return true;\n }\n return false;\n };\n Identify2.prototype._validate = function(operation, property, value) {\n if (this._properties[IdentifyOperation.CLEAR_ALL] !== void 0) {\n return false;\n }\n if (this._propertySet.has(property)) {\n return false;\n }\n if (operation === IdentifyOperation.ADD) {\n return typeof value === "number";\n }\n if (operation !== IdentifyOperation.UNSET && operation !== IdentifyOperation.REMOVE) {\n return isValidProperties(property, value);\n }\n return true;\n };\n return Identify2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js\n var createTrackEvent = function(eventInput, eventProperties, eventOptions) {\n var baseEvent = typeof eventInput === "string" ? { event_type: eventInput } : eventInput;\n return __assign(__assign(__assign({}, baseEvent), eventOptions), eventProperties && { event_properties: eventProperties });\n };\n var createIdentifyEvent = function(identify2, eventOptions) {\n var identifyEvent = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.IDENTIFY, user_properties: identify2.getUserProperties() });\n return identifyEvent;\n };\n var createGroupIdentifyEvent = function(groupType, groupName, identify2, eventOptions) {\n var _a;\n var groupIdentify2 = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.GROUP_IDENTIFY, group_properties: identify2.getUserProperties(), groups: (_a = {}, _a[groupType] = groupName, _a) });\n return groupIdentify2;\n };\n var createGroupEvent = function(groupType, groupName, eventOptions) {\n var _a;\n var identify2 = new Identify();\n identify2.set(groupType, groupName);\n var groupEvent = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.IDENTIFY, user_properties: identify2.getUserProperties(), groups: (_a = {}, _a[groupType] = groupName, _a) });\n return groupEvent;\n };\n var createRevenueEvent = function(revenue2, eventOptions) {\n return __assign(__assign({}, eventOptions), { event_type: SpecialEventType.REVENUE, event_properties: revenue2.getEventProperties() });\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js\n var buildResult = function(event, code, message) {\n if (code === void 0) {\n code = 0;\n }\n if (message === void 0) {\n message = Status.Unknown;\n }\n return { event, code, message };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/timeline.js\n var Timeline = (\n /** @class */\n (function() {\n function Timeline2(client) {\n this.client = client;\n this.queue = [];\n this.applying = false;\n this.plugins = [];\n }\n Timeline2.prototype.register = function(plugin, config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, plugin.setup(config, this.client)];\n case 1:\n _a.sent();\n this.plugins.push(plugin);\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.deregister = function(pluginName, config) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var index, plugin;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n index = this.plugins.findIndex(function(plugin2) {\n return plugin2.name === pluginName;\n });\n if (index === -1) {\n config.loggerProvider.warn("Plugin with name ".concat(pluginName, " does not exist, skipping deregistration"));\n return [\n 2\n /*return*/\n ];\n }\n plugin = this.plugins[index];\n this.plugins.splice(index, 1);\n return [4, (_a = plugin.teardown) === null || _a === void 0 ? void 0 : _a.call(plugin)];\n case 1:\n _b.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.reset = function(client) {\n this.applying = false;\n var plugins = this.plugins;\n plugins.map(function(plugin) {\n var _a;\n return (_a = plugin.teardown) === null || _a === void 0 ? void 0 : _a.call(plugin);\n });\n this.plugins = [];\n this.client = client;\n };\n Timeline2.prototype.push = function(event) {\n var _this = this;\n return new Promise(function(resolve) {\n _this.queue.push([event, resolve]);\n _this.scheduleApply(0);\n });\n };\n Timeline2.prototype.scheduleApply = function(timeout) {\n var _this = this;\n if (this.applying)\n return;\n this.applying = true;\n setTimeout(function() {\n void _this.apply(_this.queue.shift()).then(function() {\n _this.applying = false;\n if (_this.queue.length > 0) {\n _this.scheduleApply(0);\n }\n });\n }, timeout);\n };\n Timeline2.prototype.apply = function(item) {\n return __awaiter(this, void 0, void 0, function() {\n var _a, event, _b, resolve, before, before_1, before_1_1, plugin, e, e_1_1, enrichment, enrichment_1, enrichment_1_1, plugin, e, e_2_1, destination, executeDestinations;\n var e_1, _c, e_2, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n if (!item) {\n return [\n 2\n /*return*/\n ];\n }\n _a = __read(item, 1), event = _a[0];\n _b = __read(item, 2), resolve = _b[1];\n before = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.BEFORE;\n });\n _e.label = 1;\n case 1:\n _e.trys.push([1, 6, 7, 8]);\n before_1 = __values(before), before_1_1 = before_1.next();\n _e.label = 2;\n case 2:\n if (!!before_1_1.done) return [3, 5];\n plugin = before_1_1.value;\n return [4, plugin.execute(__assign({}, event))];\n case 3:\n e = _e.sent();\n if (e === null) {\n resolve({ event, code: 0, message: "" });\n return [\n 2\n /*return*/\n ];\n } else {\n event = e;\n }\n _e.label = 4;\n case 4:\n before_1_1 = before_1.next();\n return [3, 2];\n case 5:\n return [3, 8];\n case 6:\n e_1_1 = _e.sent();\n e_1 = { error: e_1_1 };\n return [3, 8];\n case 7:\n try {\n if (before_1_1 && !before_1_1.done && (_c = before_1.return)) _c.call(before_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 8:\n enrichment = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.ENRICHMENT;\n });\n _e.label = 9;\n case 9:\n _e.trys.push([9, 14, 15, 16]);\n enrichment_1 = __values(enrichment), enrichment_1_1 = enrichment_1.next();\n _e.label = 10;\n case 10:\n if (!!enrichment_1_1.done) return [3, 13];\n plugin = enrichment_1_1.value;\n return [4, plugin.execute(__assign({}, event))];\n case 11:\n e = _e.sent();\n if (e === null) {\n resolve({ event, code: 0, message: "" });\n return [\n 2\n /*return*/\n ];\n } else {\n event = e;\n }\n _e.label = 12;\n case 12:\n enrichment_1_1 = enrichment_1.next();\n return [3, 10];\n case 13:\n return [3, 16];\n case 14:\n e_2_1 = _e.sent();\n e_2 = { error: e_2_1 };\n return [3, 16];\n case 15:\n try {\n if (enrichment_1_1 && !enrichment_1_1.done && (_d = enrichment_1.return)) _d.call(enrichment_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 16:\n destination = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.DESTINATION;\n });\n executeDestinations = destination.map(function(plugin2) {\n var eventClone = __assign({}, event);\n return plugin2.execute(eventClone).catch(function(e2) {\n return buildResult(eventClone, 0, String(e2));\n });\n });\n void Promise.all(executeDestinations).then(function(_a2) {\n var _b2 = __read(_a2, 1), result = _b2[0];\n resolve(result);\n });\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.flush = function() {\n return __awaiter(this, void 0, void 0, function() {\n var queue, destination, executeDestinations;\n var _this = this;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n queue = this.queue;\n this.queue = [];\n return [4, Promise.all(queue.map(function(item) {\n return _this.apply(item);\n }))];\n case 1:\n _a.sent();\n destination = this.plugins.filter(function(plugin) {\n return plugin.type === PluginType.DESTINATION;\n });\n executeDestinations = destination.map(function(plugin) {\n return plugin.flush && plugin.flush();\n });\n return [4, Promise.all(executeDestinations)];\n case 2:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n return Timeline2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/messages.js\n var SUCCESS_MESSAGE = "Event tracked successfully";\n var UNEXPECTED_ERROR_MESSAGE = "Unexpected error occurred";\n var MAX_RETRIES_EXCEEDED_MESSAGE = "Event rejected due to exceeded retry count";\n var OPT_OUT_MESSAGE = "Event skipped due to optOut config";\n var MISSING_API_KEY_MESSAGE = "Event rejected due to missing API key";\n var INVALID_API_KEY = "Invalid API key";\n var CLIENT_NOT_INITIALIZED = "Client not initialized";\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js\n var returnWrapper = function(awaitable) {\n return {\n promise: awaitable || Promise.resolve()\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/core-client.js\n var AmplitudeCore = (\n /** @class */\n (function() {\n function AmplitudeCore2(name) {\n if (name === void 0) {\n name = "$default";\n }\n this.initializing = false;\n this.q = [];\n this.dispatchQ = [];\n this.logEvent = this.track.bind(this);\n this.timeline = new Timeline(this);\n this.name = name;\n }\n AmplitudeCore2.prototype._init = function(config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n this.config = config;\n this.timeline.reset(this);\n return [4, this.runQueuedFunctions("q")];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.runQueuedFunctions = function(queueName) {\n return __awaiter(this, void 0, void 0, function() {\n var queuedFunctions, queuedFunctions_1, queuedFunctions_1_1, queuedFunction, e_1_1;\n var e_1, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n queuedFunctions = this[queueName];\n this[queueName] = [];\n _b.label = 1;\n case 1:\n _b.trys.push([1, 6, 7, 8]);\n queuedFunctions_1 = __values(queuedFunctions), queuedFunctions_1_1 = queuedFunctions_1.next();\n _b.label = 2;\n case 2:\n if (!!queuedFunctions_1_1.done) return [3, 5];\n queuedFunction = queuedFunctions_1_1.value;\n return [4, queuedFunction()];\n case 3:\n _b.sent();\n _b.label = 4;\n case 4:\n queuedFunctions_1_1 = queuedFunctions_1.next();\n return [3, 2];\n case 5:\n return [3, 8];\n case 6:\n e_1_1 = _b.sent();\n e_1 = { error: e_1_1 };\n return [3, 8];\n case 7:\n try {\n if (queuedFunctions_1_1 && !queuedFunctions_1_1.done && (_a = queuedFunctions_1.return)) _a.call(queuedFunctions_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 8:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.track = function(eventInput, eventProperties, eventOptions) {\n var event = createTrackEvent(eventInput, eventProperties, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.identify = function(identify2, eventOptions) {\n var event = createIdentifyEvent(identify2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.groupIdentify = function(groupType, groupName, identify2, eventOptions) {\n var event = createGroupIdentifyEvent(groupType, groupName, identify2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.setGroup = function(groupType, groupName, eventOptions) {\n var event = createGroupEvent(groupType, groupName, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.revenue = function(revenue2, eventOptions) {\n var event = createRevenueEvent(revenue2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.add = function(plugin) {\n if (!this.config) {\n this.q.push(this.add.bind(this, plugin));\n return returnWrapper();\n }\n return returnWrapper(this.timeline.register(plugin, this.config));\n };\n AmplitudeCore2.prototype.remove = function(pluginName) {\n if (!this.config) {\n this.q.push(this.remove.bind(this, pluginName));\n return returnWrapper();\n }\n return returnWrapper(this.timeline.deregister(pluginName, this.config));\n };\n AmplitudeCore2.prototype.dispatchWithCallback = function(event, callback) {\n if (!this.config) {\n return callback(buildResult(event, 0, CLIENT_NOT_INITIALIZED));\n }\n void this.process(event).then(callback);\n };\n AmplitudeCore2.prototype.dispatch = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n if (!this.config) {\n return [2, new Promise(function(resolve) {\n _this.dispatchQ.push(_this.dispatchWithCallback.bind(_this, event, resolve));\n })];\n }\n return [2, this.process(event)];\n });\n });\n };\n AmplitudeCore2.prototype.process = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var result, e_2, message, result;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n if (this.config.optOut) {\n return [2, buildResult(event, 0, OPT_OUT_MESSAGE)];\n }\n return [4, this.timeline.push(event)];\n case 1:\n result = _a.sent();\n result.code === 200 ? this.config.loggerProvider.log(result.message) : this.config.loggerProvider.error(result.message);\n return [2, result];\n case 2:\n e_2 = _a.sent();\n this.config.loggerProvider.error(e_2);\n message = String(e_2);\n result = buildResult(event, 0, message);\n return [2, result];\n case 3:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.setOptOut = function(optOut) {\n if (!this.config) {\n this.q.push(this.setOptOut.bind(this, Boolean(optOut)));\n return;\n }\n this.config.optOut = Boolean(optOut);\n };\n AmplitudeCore2.prototype.flush = function() {\n return returnWrapper(this.timeline.flush());\n };\n return AmplitudeCore2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/revenue.js\n var Revenue = (\n /** @class */\n (function() {\n function Revenue2() {\n this.productId = "";\n this.quantity = 1;\n this.price = 0;\n }\n Revenue2.prototype.setProductId = function(productId) {\n this.productId = productId;\n return this;\n };\n Revenue2.prototype.setQuantity = function(quantity) {\n if (quantity > 0) {\n this.quantity = quantity;\n }\n return this;\n };\n Revenue2.prototype.setPrice = function(price) {\n this.price = price;\n return this;\n };\n Revenue2.prototype.setRevenueType = function(revenueType) {\n this.revenueType = revenueType;\n return this;\n };\n Revenue2.prototype.setCurrency = function(currency) {\n this.currency = currency;\n return this;\n };\n Revenue2.prototype.setRevenue = function(revenue2) {\n this.revenue = revenue2;\n return this;\n };\n Revenue2.prototype.setEventProperties = function(properties) {\n if (isValidObject(properties)) {\n this.properties = properties;\n }\n return this;\n };\n Revenue2.prototype.getEventProperties = function() {\n var eventProperties = this.properties ? __assign({}, this.properties) : {};\n eventProperties[RevenueProperty.REVENUE_PRODUCT_ID] = this.productId;\n eventProperties[RevenueProperty.REVENUE_QUANTITY] = this.quantity;\n eventProperties[RevenueProperty.REVENUE_PRICE] = this.price;\n eventProperties[RevenueProperty.REVENUE_TYPE] = this.revenueType;\n eventProperties[RevenueProperty.REVENUE_CURRENCY] = this.currency;\n eventProperties[RevenueProperty.REVENUE] = this.revenue;\n return eventProperties;\n };\n return Revenue2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js\n var chunk = function(arr, size) {\n var chunkSize = Math.max(size, 1);\n return arr.reduce(function(chunks, element, index) {\n var chunkIndex = Math.floor(index / chunkSize);\n if (!chunks[chunkIndex]) {\n chunks[chunkIndex] = [];\n }\n chunks[chunkIndex].push(element);\n return chunks;\n }, []);\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/logger.js\n var PREFIX = "Amplitude Logger ";\n var Logger = (\n /** @class */\n (function() {\n function Logger2() {\n this.logLevel = LogLevel.None;\n }\n Logger2.prototype.disable = function() {\n this.logLevel = LogLevel.None;\n };\n Logger2.prototype.enable = function(logLevel) {\n if (logLevel === void 0) {\n logLevel = LogLevel.Warn;\n }\n this.logLevel = logLevel;\n };\n Logger2.prototype.log = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Verbose) {\n return;\n }\n console.log("".concat(PREFIX, "[Log]: ").concat(args.join(" ")));\n };\n Logger2.prototype.warn = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Warn) {\n return;\n }\n console.warn("".concat(PREFIX, "[Warn]: ").concat(args.join(" ")));\n };\n Logger2.prototype.error = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Error) {\n return;\n }\n console.error("".concat(PREFIX, "[Error]: ").concat(args.join(" ")));\n };\n Logger2.prototype.debug = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Debug) {\n return;\n }\n console.log("".concat(PREFIX, "[Debug]: ").concat(args.join(" ")));\n };\n return Logger2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/config.js\n var getDefaultConfig = function() {\n return {\n flushMaxRetries: 12,\n flushQueueSize: 200,\n flushIntervalMillis: 1e4,\n instanceName: "$default_instance",\n logLevel: LogLevel.Warn,\n loggerProvider: new Logger(),\n optOut: false,\n serverUrl: AMPLITUDE_SERVER_URL,\n serverZone: ServerZone.US,\n useBatch: false\n };\n };\n var Config = (\n /** @class */\n (function() {\n function Config2(options) {\n var _a, _b, _c, _d;\n this._optOut = false;\n var defaultConfig = getDefaultConfig();\n this.apiKey = options.apiKey;\n this.flushIntervalMillis = (_a = options.flushIntervalMillis) !== null && _a !== void 0 ? _a : defaultConfig.flushIntervalMillis;\n this.flushMaxRetries = options.flushMaxRetries || defaultConfig.flushMaxRetries;\n this.flushQueueSize = options.flushQueueSize || defaultConfig.flushQueueSize;\n this.instanceName = options.instanceName || defaultConfig.instanceName;\n this.loggerProvider = options.loggerProvider || defaultConfig.loggerProvider;\n this.logLevel = (_b = options.logLevel) !== null && _b !== void 0 ? _b : defaultConfig.logLevel;\n this.minIdLength = options.minIdLength;\n this.plan = options.plan;\n this.ingestionMetadata = options.ingestionMetadata;\n this.optOut = (_c = options.optOut) !== null && _c !== void 0 ? _c : defaultConfig.optOut;\n this.serverUrl = options.serverUrl;\n this.serverZone = options.serverZone || defaultConfig.serverZone;\n this.storageProvider = options.storageProvider;\n this.transportProvider = options.transportProvider;\n this.useBatch = (_d = options.useBatch) !== null && _d !== void 0 ? _d : defaultConfig.useBatch;\n this.loggerProvider.enable(this.logLevel);\n var serverConfig = createServerConfig(options.serverUrl, options.serverZone, options.useBatch);\n this.serverZone = serverConfig.serverZone;\n this.serverUrl = serverConfig.serverUrl;\n }\n Object.defineProperty(Config2.prototype, "optOut", {\n get: function() {\n return this._optOut;\n },\n set: function(optOut) {\n this._optOut = optOut;\n },\n enumerable: false,\n configurable: true\n });\n return Config2;\n })()\n );\n var getServerUrl = function(serverZone, useBatch) {\n if (serverZone === ServerZone.EU) {\n return useBatch ? EU_AMPLITUDE_BATCH_SERVER_URL : EU_AMPLITUDE_SERVER_URL;\n }\n return useBatch ? AMPLITUDE_BATCH_SERVER_URL : AMPLITUDE_SERVER_URL;\n };\n var createServerConfig = function(serverUrl, serverZone, useBatch) {\n if (serverUrl === void 0) {\n serverUrl = "";\n }\n if (serverZone === void 0) {\n serverZone = getDefaultConfig().serverZone;\n }\n if (useBatch === void 0) {\n useBatch = getDefaultConfig().useBatch;\n }\n if (serverUrl) {\n return { serverUrl, serverZone: void 0 };\n }\n var _serverZone = ["US", "EU"].includes(serverZone) ? serverZone : getDefaultConfig().serverZone;\n return {\n serverZone: _serverZone,\n serverUrl: getServerUrl(_serverZone, useBatch)\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js\n function getErrorMessage(error) {\n if (error instanceof Error)\n return error.message;\n return String(error);\n }\n function getResponseBodyString(res) {\n var responseBodyString = "";\n try {\n if ("body" in res) {\n responseBodyString = JSON.stringify(res.body);\n }\n } catch (_a) {\n }\n return responseBodyString;\n }\n var Destination = (\n /** @class */\n (function() {\n function Destination2() {\n this.name = "amplitude";\n this.type = PluginType.DESTINATION;\n this.retryTimeout = 1e3;\n this.throttleTimeout = 3e4;\n this.storageKey = "";\n this.scheduled = null;\n this.queue = [];\n }\n Destination2.prototype.setup = function(config) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var unsent;\n var _this = this;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n this.config = config;\n this.storageKey = "".concat(STORAGE_PREFIX, "_").concat(this.config.apiKey.substring(0, 10));\n return [4, (_a = this.config.storageProvider) === null || _a === void 0 ? void 0 : _a.get(this.storageKey)];\n case 1:\n unsent = _b.sent();\n this.saveEvents();\n if (unsent && unsent.length > 0) {\n void Promise.all(unsent.map(function(event) {\n return _this.execute(event);\n })).catch();\n }\n return [2, Promise.resolve(void 0)];\n }\n });\n });\n };\n Destination2.prototype.execute = function(event) {\n var _this = this;\n return new Promise(function(resolve) {\n var context = {\n event,\n attempts: 0,\n callback: function(result) {\n return resolve(result);\n },\n timeout: 0\n };\n void _this.addToQueue(context);\n });\n };\n Destination2.prototype.addToQueue = function() {\n var _this = this;\n var list = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n list[_i] = arguments[_i];\n }\n var tryable = list.filter(function(context) {\n if (context.attempts < _this.config.flushMaxRetries) {\n context.attempts += 1;\n return true;\n }\n void _this.fulfillRequest([context], 500, MAX_RETRIES_EXCEEDED_MESSAGE);\n return false;\n });\n tryable.forEach(function(context) {\n _this.queue = _this.queue.concat(context);\n if (context.timeout === 0) {\n _this.schedule(_this.config.flushIntervalMillis);\n return;\n }\n setTimeout(function() {\n context.timeout = 0;\n _this.schedule(0);\n }, context.timeout);\n });\n this.saveEvents();\n };\n Destination2.prototype.schedule = function(timeout) {\n var _this = this;\n if (this.scheduled)\n return;\n this.scheduled = setTimeout(function() {\n void _this.flush(true).then(function() {\n if (_this.queue.length > 0) {\n _this.schedule(timeout);\n }\n });\n }, timeout);\n };\n Destination2.prototype.flush = function(useRetry) {\n if (useRetry === void 0) {\n useRetry = false;\n }\n return __awaiter(this, void 0, void 0, function() {\n var list, later, batches;\n var _this = this;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n list = [];\n later = [];\n this.queue.forEach(function(context) {\n return context.timeout === 0 ? list.push(context) : later.push(context);\n });\n this.queue = later;\n if (this.scheduled) {\n clearTimeout(this.scheduled);\n this.scheduled = null;\n }\n batches = chunk(list, this.config.flushQueueSize);\n return [4, Promise.all(batches.map(function(batch) {\n return _this.send(batch, useRetry);\n }))];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Destination2.prototype.send = function(list, useRetry) {\n if (useRetry === void 0) {\n useRetry = true;\n }\n return __awaiter(this, void 0, void 0, function() {\n var payload, serverUrl, res, e_1, errorMessage;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n if (!this.config.apiKey) {\n return [2, this.fulfillRequest(list, 400, MISSING_API_KEY_MESSAGE)];\n }\n payload = {\n api_key: this.config.apiKey,\n events: list.map(function(context) {\n var _a2 = context.event, extra = _a2.extra, eventWithoutExtra = __rest(_a2, ["extra"]);\n return eventWithoutExtra;\n }),\n options: {\n min_id_length: this.config.minIdLength\n }\n };\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n serverUrl = createServerConfig(this.config.serverUrl, this.config.serverZone, this.config.useBatch).serverUrl;\n return [4, this.config.transportProvider.send(serverUrl, payload)];\n case 2:\n res = _a.sent();\n if (res === null) {\n this.fulfillRequest(list, 0, UNEXPECTED_ERROR_MESSAGE);\n return [\n 2\n /*return*/\n ];\n }\n if (!useRetry) {\n if ("body" in res) {\n this.fulfillRequest(list, res.statusCode, "".concat(res.status, ": ").concat(getResponseBodyString(res)));\n } else {\n this.fulfillRequest(list, res.statusCode, res.status);\n }\n return [\n 2\n /*return*/\n ];\n }\n this.handleResponse(res, list);\n return [3, 4];\n case 3:\n e_1 = _a.sent();\n this.config.loggerProvider.error(e_1);\n errorMessage = getErrorMessage(e_1);\n this.fulfillRequest(list, 0, errorMessage);\n return [3, 4];\n case 4:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Destination2.prototype.handleResponse = function(res, list) {\n var status = res.status;\n switch (status) {\n case Status.Success: {\n this.handleSuccessResponse(res, list);\n break;\n }\n case Status.Invalid: {\n this.handleInvalidResponse(res, list);\n break;\n }\n case Status.PayloadTooLarge: {\n this.handlePayloadTooLargeResponse(res, list);\n break;\n }\n case Status.RateLimit: {\n this.handleRateLimitResponse(res, list);\n break;\n }\n default: {\n this.config.loggerProvider.warn(`{code: 0, error: "Status \'`.concat(status, "\' provided for ").concat(list.length, \' events"}\'));\n this.handleOtherResponse(list);\n break;\n }\n }\n };\n Destination2.prototype.handleSuccessResponse = function(res, list) {\n this.fulfillRequest(list, res.statusCode, SUCCESS_MESSAGE);\n };\n Destination2.prototype.handleInvalidResponse = function(res, list) {\n var _this = this;\n if (res.body.missingField || res.body.error.startsWith(INVALID_API_KEY)) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n var dropIndex = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(Object.values(res.body.eventsWithInvalidFields)), false), __read(Object.values(res.body.eventsWithMissingFields)), false), __read(Object.values(res.body.eventsWithInvalidIdLengths)), false), __read(res.body.silencedEvents), false).flat();\n var dropIndexSet = new Set(dropIndex);\n var retry = list.filter(function(context, index) {\n if (dropIndexSet.has(index)) {\n _this.fulfillRequest([context], res.statusCode, res.body.error);\n return;\n }\n return true;\n });\n if (retry.length > 0) {\n this.config.loggerProvider.warn(getResponseBodyString(res));\n }\n this.addToQueue.apply(this, __spreadArray([], __read(retry), false));\n };\n Destination2.prototype.handlePayloadTooLargeResponse = function(res, list) {\n if (list.length === 1) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n this.config.loggerProvider.warn(getResponseBodyString(res));\n this.config.flushQueueSize /= 2;\n this.addToQueue.apply(this, __spreadArray([], __read(list), false));\n };\n Destination2.prototype.handleRateLimitResponse = function(res, list) {\n var _this = this;\n var dropUserIds = Object.keys(res.body.exceededDailyQuotaUsers);\n var dropDeviceIds = Object.keys(res.body.exceededDailyQuotaDevices);\n var throttledIndex = res.body.throttledEvents;\n var dropUserIdsSet = new Set(dropUserIds);\n var dropDeviceIdsSet = new Set(dropDeviceIds);\n var throttledIndexSet = new Set(throttledIndex);\n var retry = list.filter(function(context, index) {\n if (context.event.user_id && dropUserIdsSet.has(context.event.user_id) || context.event.device_id && dropDeviceIdsSet.has(context.event.device_id)) {\n _this.fulfillRequest([context], res.statusCode, res.body.error);\n return;\n }\n if (throttledIndexSet.has(index)) {\n context.timeout = _this.throttleTimeout;\n }\n return true;\n });\n if (retry.length > 0) {\n this.config.loggerProvider.warn(getResponseBodyString(res));\n }\n this.addToQueue.apply(this, __spreadArray([], __read(retry), false));\n };\n Destination2.prototype.handleOtherResponse = function(list) {\n var _this = this;\n this.addToQueue.apply(this, __spreadArray([], __read(list.map(function(context) {\n context.timeout = context.attempts * _this.retryTimeout;\n return context;\n })), false));\n };\n Destination2.prototype.fulfillRequest = function(list, code, message) {\n this.saveEvents();\n list.forEach(function(context) {\n return context.callback(buildResult(context.event, code, message));\n });\n };\n Destination2.prototype.saveEvents = function() {\n if (!this.config.storageProvider) {\n return;\n }\n var events = Array.from(this.queue.map(function(context) {\n return context.event;\n }));\n void this.config.storageProvider.set(this.storageKey, events);\n };\n return Destination2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js\n var getStacktrace = function(ignoreDepth) {\n if (ignoreDepth === void 0) {\n ignoreDepth = 0;\n }\n var trace = new Error().stack || "";\n return trace.split("\\n").slice(2 + ignoreDepth).map(function(text) {\n return text.trim();\n });\n };\n var getClientLogConfig = function(client) {\n return function() {\n var _a = __assign({}, client.config), logger = _a.loggerProvider, logLevel = _a.logLevel;\n return {\n logger,\n logLevel\n };\n };\n };\n var getValueByStringPath = function(obj, path) {\n var e_1, _a;\n path = path.replace(/\\[(\\w+)\\]/g, ".$1");\n path = path.replace(/^\\./, "");\n try {\n for (var _b = __values(path.split(".")), _c = _b.next(); !_c.done; _c = _b.next()) {\n var attr = _c.value;\n if (attr in obj) {\n obj = obj[attr];\n } else {\n return;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n return obj;\n };\n var getClientStates = function(client, paths) {\n return function() {\n var e_2, _a;\n var res = {};\n try {\n for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {\n var path = paths_1_1.value;\n res[path] = getValueByStringPath(client, path);\n }\n } catch (e_2_1) {\n e_2 = { error: e_2_1 };\n } finally {\n try {\n if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n return res;\n };\n };\n var debugWrapper = function(fn, fnName, getLogConfig, getStates, fnContext) {\n if (fnContext === void 0) {\n fnContext = null;\n }\n return function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = getLogConfig(), logger = _a.logger, logLevel = _a.logLevel;\n if (logLevel && logLevel < LogLevel.Debug || !logLevel || !logger) {\n return fn.apply(fnContext, args);\n }\n var debugContext = {\n type: "invoke public method",\n name: fnName,\n args,\n stacktrace: getStacktrace(1),\n time: {\n start: (/* @__PURE__ */ new Date()).toISOString()\n },\n states: {}\n };\n if (getStates && debugContext.states) {\n debugContext.states.before = getStates();\n }\n var result = fn.apply(fnContext, args);\n if (result && result.promise) {\n result.promise.then(function() {\n if (getStates && debugContext.states) {\n debugContext.states.after = getStates();\n }\n if (debugContext.time) {\n debugContext.time.end = (/* @__PURE__ */ new Date()).toISOString();\n }\n logger.debug(JSON.stringify(debugContext, null, 2));\n });\n } else {\n if (getStates && debugContext.states) {\n debugContext.states.after = getStates();\n }\n if (debugContext.time) {\n debugContext.time.end = (/* @__PURE__ */ new Date()).toISOString();\n }\n logger.debug(JSON.stringify(debugContext, null, 2));\n }\n return result;\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js\n var UUID = function(a) {\n return a ? (\n // a random number from 0 to 15\n (a ^ // unless b is 8,\n Math.random() * // in which case\n 16 >> // a random number from\n a / 4).toString(16)\n ) : (\n // or otherwise a concatenated string:\n (String(1e7) + // 10000000 +\n String(-1e3) + // -1000 +\n String(-4e3) + // -4000 +\n String(-8e3) + // -80000000 +\n String(-1e11)).replace(\n // replacing\n /[018]/g,\n // zeroes, ones, and eights with\n UUID\n )\n );\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/storage/memory.js\n var MemoryStorage = (\n /** @class */\n (function() {\n function MemoryStorage2() {\n this.memoryStorage = /* @__PURE__ */ new Map();\n }\n MemoryStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, true];\n });\n });\n };\n MemoryStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, this.memoryStorage.get(key)];\n });\n });\n };\n MemoryStorage2.prototype.getRaw = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.get(key)];\n case 1:\n value = _a.sent();\n return [2, value ? JSON.stringify(value) : void 0];\n }\n });\n });\n };\n MemoryStorage2.prototype.set = function(key, value) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.set(key, value);\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n MemoryStorage2.prototype.remove = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.delete(key);\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n MemoryStorage2.prototype.reset = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.clear();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return MemoryStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/transports/base.js\n var BaseTransport = (\n /** @class */\n (function() {\n function BaseTransport2() {\n }\n BaseTransport2.prototype.send = function(_serverUrl, _payload) {\n return Promise.resolve(null);\n };\n BaseTransport2.prototype.buildResponse = function(responseJSON) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;\n if (typeof responseJSON !== "object") {\n return null;\n }\n var statusCode = responseJSON.code || 0;\n var status = this.buildStatus(statusCode);\n switch (status) {\n case Status.Success:\n return {\n status,\n statusCode,\n body: {\n eventsIngested: (_a = responseJSON.events_ingested) !== null && _a !== void 0 ? _a : 0,\n payloadSizeBytes: (_b = responseJSON.payload_size_bytes) !== null && _b !== void 0 ? _b : 0,\n serverUploadTime: (_c = responseJSON.server_upload_time) !== null && _c !== void 0 ? _c : 0\n }\n };\n case Status.Invalid:\n return {\n status,\n statusCode,\n body: {\n error: (_d = responseJSON.error) !== null && _d !== void 0 ? _d : "",\n missingField: (_e = responseJSON.missing_field) !== null && _e !== void 0 ? _e : "",\n eventsWithInvalidFields: (_f = responseJSON.events_with_invalid_fields) !== null && _f !== void 0 ? _f : {},\n eventsWithMissingFields: (_g = responseJSON.events_with_missing_fields) !== null && _g !== void 0 ? _g : {},\n eventsWithInvalidIdLengths: (_h = responseJSON.events_with_invalid_id_lengths) !== null && _h !== void 0 ? _h : {},\n epsThreshold: (_j = responseJSON.eps_threshold) !== null && _j !== void 0 ? _j : 0,\n exceededDailyQuotaDevices: (_k = responseJSON.exceeded_daily_quota_devices) !== null && _k !== void 0 ? _k : {},\n silencedDevices: (_l = responseJSON.silenced_devices) !== null && _l !== void 0 ? _l : [],\n silencedEvents: (_m = responseJSON.silenced_events) !== null && _m !== void 0 ? _m : [],\n throttledDevices: (_o = responseJSON.throttled_devices) !== null && _o !== void 0 ? _o : {},\n throttledEvents: (_p = responseJSON.throttled_events) !== null && _p !== void 0 ? _p : []\n }\n };\n case Status.PayloadTooLarge:\n return {\n status,\n statusCode,\n body: {\n error: (_q = responseJSON.error) !== null && _q !== void 0 ? _q : ""\n }\n };\n case Status.RateLimit:\n return {\n status,\n statusCode,\n body: {\n error: (_r = responseJSON.error) !== null && _r !== void 0 ? _r : "",\n epsThreshold: (_s = responseJSON.eps_threshold) !== null && _s !== void 0 ? _s : 0,\n throttledDevices: (_t = responseJSON.throttled_devices) !== null && _t !== void 0 ? _t : {},\n throttledUsers: (_u = responseJSON.throttled_users) !== null && _u !== void 0 ? _u : {},\n exceededDailyQuotaDevices: (_v = responseJSON.exceeded_daily_quota_devices) !== null && _v !== void 0 ? _v : {},\n exceededDailyQuotaUsers: (_w = responseJSON.exceeded_daily_quota_users) !== null && _w !== void 0 ? _w : {},\n throttledEvents: (_x = responseJSON.throttled_events) !== null && _x !== void 0 ? _x : []\n }\n };\n case Status.Timeout:\n default:\n return {\n status,\n statusCode\n };\n }\n };\n BaseTransport2.prototype.buildStatus = function(code) {\n if (code >= 200 && code < 300) {\n return Status.Success;\n }\n if (code === 429) {\n return Status.RateLimit;\n }\n if (code === 413) {\n return Status.PayloadTooLarge;\n }\n if (code === 408) {\n return Status.Timeout;\n }\n if (code >= 400 && code < 500) {\n return Status.Invalid;\n }\n if (code >= 500) {\n return Status.Failed;\n }\n return Status.Unknown;\n };\n return BaseTransport2;\n })()\n );\n\n // node_modules/@amplitude/analytics-connector/dist/analytics-connector.esm.js\n var ApplicationContextProviderImpl = (\n /** @class */\n (function() {\n function ApplicationContextProviderImpl2() {\n }\n ApplicationContextProviderImpl2.prototype.getApplicationContext = function() {\n return {\n versionName: this.versionName,\n language: getLanguage(),\n platform: "Web",\n os: void 0,\n deviceModel: void 0\n };\n };\n return ApplicationContextProviderImpl2;\n })()\n );\n var getLanguage = function() {\n return typeof navigator !== "undefined" && (navigator.languages && navigator.languages[0] || navigator.language) || "";\n };\n var EventBridgeImpl = (\n /** @class */\n (function() {\n function EventBridgeImpl2() {\n this.queue = [];\n }\n EventBridgeImpl2.prototype.logEvent = function(event) {\n if (!this.receiver) {\n if (this.queue.length < 512) {\n this.queue.push(event);\n }\n } else {\n this.receiver(event);\n }\n };\n EventBridgeImpl2.prototype.setEventReceiver = function(receiver) {\n this.receiver = receiver;\n if (this.queue.length > 0) {\n this.queue.forEach(function(event) {\n receiver(event);\n });\n this.queue = [];\n }\n };\n return EventBridgeImpl2;\n })()\n );\n var __assign2 = function() {\n __assign2 = Object.assign || function __assign3(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign2.apply(this, arguments);\n };\n function __values2(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n }\n function __read2(o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = {\n error\n };\n } finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n return ar;\n }\n var isEqual = function(obj1, obj2) {\n var e_1, _a;\n var primitive = ["string", "number", "boolean", "undefined"];\n var typeA = typeof obj1;\n var typeB = typeof obj2;\n if (typeA !== typeB) {\n return false;\n }\n try {\n for (var primitive_1 = __values2(primitive), primitive_1_1 = primitive_1.next(); !primitive_1_1.done; primitive_1_1 = primitive_1.next()) {\n var p = primitive_1_1.value;\n if (p === typeA) {\n return obj1 === obj2;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (primitive_1_1 && !primitive_1_1.done && (_a = primitive_1.return)) _a.call(primitive_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n if (obj1 == null && obj2 == null) {\n return true;\n } else if (obj1 == null || obj2 == null) {\n return false;\n }\n if (obj1.length !== obj2.length) {\n return false;\n }\n var isArrayA = Array.isArray(obj1);\n var isArrayB = Array.isArray(obj2);\n if (isArrayA !== isArrayB) {\n return false;\n }\n if (isArrayA && isArrayB) {\n for (var i = 0; i < obj1.length; i++) {\n if (!isEqual(obj1[i], obj2[i])) {\n return false;\n }\n }\n } else {\n var sorted1 = Object.keys(obj1).sort();\n var sorted2 = Object.keys(obj2).sort();\n if (!isEqual(sorted1, sorted2)) {\n return false;\n }\n var result_1 = true;\n Object.keys(obj1).forEach(function(key) {\n if (!isEqual(obj1[key], obj2[key])) {\n result_1 = false;\n }\n });\n return result_1;\n }\n return true;\n };\n var ID_OP_SET = "$set";\n var ID_OP_UNSET = "$unset";\n var ID_OP_CLEAR_ALL = "$clearAll";\n if (!Object.entries) {\n Object.entries = function(obj) {\n var ownProps = Object.keys(obj);\n var i = ownProps.length;\n var resArray = new Array(i);\n while (i--) {\n resArray[i] = [ownProps[i], obj[ownProps[i]]];\n }\n return resArray;\n };\n }\n var IdentityStoreImpl = (\n /** @class */\n (function() {\n function IdentityStoreImpl2() {\n this.identity = { userProperties: {} };\n this.listeners = /* @__PURE__ */ new Set();\n }\n IdentityStoreImpl2.prototype.editIdentity = function() {\n var self2 = this;\n var actingUserProperties = __assign2({}, this.identity.userProperties);\n var actingIdentity = __assign2(__assign2({}, this.identity), { userProperties: actingUserProperties });\n return {\n setUserId: function(userId) {\n actingIdentity.userId = userId;\n return this;\n },\n setDeviceId: function(deviceId) {\n actingIdentity.deviceId = deviceId;\n return this;\n },\n setUserProperties: function(userProperties) {\n actingIdentity.userProperties = userProperties;\n return this;\n },\n setOptOut: function(optOut) {\n actingIdentity.optOut = optOut;\n return this;\n },\n updateUserProperties: function(actions) {\n var e_1, _a, e_2, _b, e_3, _c;\n var actingProperties = actingIdentity.userProperties || {};\n try {\n for (var _d = __values2(Object.entries(actions)), _e = _d.next(); !_e.done; _e = _d.next()) {\n var _f = __read2(_e.value, 2), action = _f[0], properties = _f[1];\n switch (action) {\n case ID_OP_SET:\n try {\n for (var _g = (e_2 = void 0, __values2(Object.entries(properties))), _h = _g.next(); !_h.done; _h = _g.next()) {\n var _j = __read2(_h.value, 2), key = _j[0], value = _j[1];\n actingProperties[key] = value;\n }\n } catch (e_2_1) {\n e_2 = { error: e_2_1 };\n } finally {\n try {\n if (_h && !_h.done && (_b = _g.return)) _b.call(_g);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n break;\n case ID_OP_UNSET:\n try {\n for (var _k = (e_3 = void 0, __values2(Object.keys(properties))), _l = _k.next(); !_l.done; _l = _k.next()) {\n var key = _l.value;\n delete actingProperties[key];\n }\n } catch (e_3_1) {\n e_3 = { error: e_3_1 };\n } finally {\n try {\n if (_l && !_l.done && (_c = _k.return)) _c.call(_k);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n break;\n case ID_OP_CLEAR_ALL:\n actingProperties = {};\n break;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (_e && !_e.done && (_a = _d.return)) _a.call(_d);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n actingIdentity.userProperties = actingProperties;\n return this;\n },\n commit: function() {\n self2.setIdentity(actingIdentity);\n return this;\n }\n };\n };\n IdentityStoreImpl2.prototype.getIdentity = function() {\n return __assign2({}, this.identity);\n };\n IdentityStoreImpl2.prototype.setIdentity = function(identity) {\n var originalIdentity = __assign2({}, this.identity);\n this.identity = __assign2({}, identity);\n if (!isEqual(originalIdentity, this.identity)) {\n this.listeners.forEach(function(listener) {\n listener(identity);\n });\n }\n };\n IdentityStoreImpl2.prototype.addIdentityListener = function(listener) {\n this.listeners.add(listener);\n };\n IdentityStoreImpl2.prototype.removeIdentityListener = function(listener) {\n this.listeners.delete(listener);\n };\n return IdentityStoreImpl2;\n })()\n );\n var safeGlobal = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : self;\n var AnalyticsConnector = (\n /** @class */\n (function() {\n function AnalyticsConnector2() {\n this.identityStore = new IdentityStoreImpl();\n this.eventBridge = new EventBridgeImpl();\n this.applicationContextProvider = new ApplicationContextProviderImpl();\n }\n AnalyticsConnector2.getInstance = function(instanceName) {\n if (!safeGlobal["analyticsConnectorInstances"]) {\n safeGlobal["analyticsConnectorInstances"] = {};\n }\n if (!safeGlobal["analyticsConnectorInstances"][instanceName]) {\n safeGlobal["analyticsConnectorInstances"][instanceName] = new AnalyticsConnector2();\n }\n return safeGlobal["analyticsConnectorInstances"][instanceName];\n };\n return AnalyticsConnector2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/analytics-connector.js\n var getAnalyticsConnector = function(instanceName) {\n if (instanceName === void 0) {\n instanceName = "$default_instance";\n }\n return AnalyticsConnector.getInstance(instanceName);\n };\n var setConnectorUserId = function(userId, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setUserId(userId).commit();\n };\n var setConnectorDeviceId = function(deviceId, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setDeviceId(deviceId).commit();\n };\n var setConnectorOptOut = function(optOut, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setOptOut(optOut).commit();\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/global-scope.js\n var getGlobalScope = function() {\n if (typeof globalThis !== "undefined") {\n return globalThis;\n }\n if (typeof window !== "undefined") {\n return window;\n }\n if (typeof self !== "undefined") {\n return self;\n }\n if (typeof global !== "undefined") {\n return global;\n }\n return void 0;\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/query-params.js\n var getQueryParams = function() {\n var _a;\n var globalScope = getGlobalScope();\n if (!((_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.location) === null || _a === void 0 ? void 0 : _a.search)) {\n return {};\n }\n var pairs = globalScope.location.search.substring(1).split("&").filter(Boolean);\n var params = pairs.reduce(function(acc, curr) {\n var query = curr.split("=", 2);\n var key = tryDecodeURIComponent(query[0]);\n var value = tryDecodeURIComponent(query[1]);\n if (!value) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n return params;\n };\n var tryDecodeURIComponent = function(value) {\n if (value === void 0) {\n value = "";\n }\n try {\n return decodeURIComponent(value);\n } catch (_a) {\n return "";\n }\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/attribution/constants.js\n var UTM_CAMPAIGN = "utm_campaign";\n var UTM_CONTENT = "utm_content";\n var UTM_ID = "utm_id";\n var UTM_MEDIUM = "utm_medium";\n var UTM_SOURCE = "utm_source";\n var UTM_TERM = "utm_term";\n var DCLID = "dclid";\n var FBCLID = "fbclid";\n var GBRAID = "gbraid";\n var GCLID = "gclid";\n var KO_CLICK_ID = "ko_click_id";\n var LI_FAT_ID = "li_fat_id";\n var MSCLKID = "msclkid";\n var RDT_CID = "rtd_cid";\n var TTCLID = "ttclid";\n var TWCLID = "twclid";\n var WBRAID = "wbraid";\n var BASE_CAMPAIGN = {\n utm_campaign: void 0,\n utm_content: void 0,\n utm_id: void 0,\n utm_medium: void 0,\n utm_source: void 0,\n utm_term: void 0,\n referrer: void 0,\n referring_domain: void 0,\n dclid: void 0,\n gbraid: void 0,\n gclid: void 0,\n fbclid: void 0,\n ko_click_id: void 0,\n li_fat_id: void 0,\n msclkid: void 0,\n rtd_cid: void 0,\n ttclid: void 0,\n twclid: void 0,\n wbraid: void 0\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/attribution/campaign-parser.js\n var CampaignParser = (\n /** @class */\n (function() {\n function CampaignParser2() {\n }\n CampaignParser2.prototype.parse = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, __assign(__assign(__assign(__assign({}, BASE_CAMPAIGN), this.getUtmParam()), this.getReferrer()), this.getClickIds())];\n });\n });\n };\n CampaignParser2.prototype.getUtmParam = function() {\n var params = getQueryParams();\n var utmCampaign = params[UTM_CAMPAIGN];\n var utmContent = params[UTM_CONTENT];\n var utmId = params[UTM_ID];\n var utmMedium = params[UTM_MEDIUM];\n var utmSource = params[UTM_SOURCE];\n var utmTerm = params[UTM_TERM];\n return {\n utm_campaign: utmCampaign,\n utm_content: utmContent,\n utm_id: utmId,\n utm_medium: utmMedium,\n utm_source: utmSource,\n utm_term: utmTerm\n };\n };\n CampaignParser2.prototype.getReferrer = function() {\n var _a, _b;\n var data = {\n referrer: void 0,\n referring_domain: void 0\n };\n try {\n data.referrer = document.referrer || void 0;\n data.referring_domain = (_b = (_a = data.referrer) === null || _a === void 0 ? void 0 : _a.split("/")[2]) !== null && _b !== void 0 ? _b : void 0;\n } catch (_c) {\n }\n return data;\n };\n CampaignParser2.prototype.getClickIds = function() {\n var _a;\n var params = getQueryParams();\n return _a = {}, _a[DCLID] = params[DCLID], _a[FBCLID] = params[FBCLID], _a[GBRAID] = params[GBRAID], _a[GCLID] = params[GCLID], _a[KO_CLICK_ID] = params[KO_CLICK_ID], _a[LI_FAT_ID] = params[LI_FAT_ID], _a[MSCLKID] = params[MSCLKID], _a[RDT_CID] = params[RDT_CID], _a[TTCLID] = params[TTCLID], _a[TWCLID] = params[TWCLID], _a[WBRAID] = params[WBRAID], _a;\n };\n return CampaignParser2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/cookie-name.js\n var getCookieName = function(apiKey, postKey, limit) {\n if (postKey === void 0) {\n postKey = "";\n }\n if (limit === void 0) {\n limit = 10;\n }\n return [AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join("_");\n };\n var getOldCookieName = function(apiKey) {\n return "".concat(AMPLITUDE_PREFIX.toLowerCase(), "_").concat(apiKey.substring(0, 6));\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/default-tracking.js\n var isFileDownloadTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.fileDownloads) {\n return true;\n }\n return false;\n };\n var isFormInteractionTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.formInteractions) {\n return true;\n }\n return false;\n };\n var isPageViewTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if ((defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.pageViews) === true || (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.pageViews) && typeof defaultTracking.pageViews === "object") {\n return true;\n }\n return false;\n };\n var isSessionTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.sessions) {\n return true;\n }\n return false;\n };\n var getPageViewTrackingConfig = function(config) {\n var _a;\n var trackOn = ((_a = config.attribution) === null || _a === void 0 ? void 0 : _a.trackPageViews) ? "attribution" : function() {\n return false;\n };\n var trackHistoryChanges = void 0;\n var eventType = "Page View";\n var isDefaultPageViewTrackingEnabled = isPageViewTrackingEnabled(config.defaultTracking);\n if (isDefaultPageViewTrackingEnabled) {\n trackOn = void 0;\n eventType = void 0;\n if (config.defaultTracking && typeof config.defaultTracking === "object" && config.defaultTracking.pageViews && typeof config.defaultTracking.pageViews === "object") {\n if ("trackOn" in config.defaultTracking.pageViews) {\n trackOn = config.defaultTracking.pageViews.trackOn;\n }\n if ("trackHistoryChanges" in config.defaultTracking.pageViews) {\n trackHistoryChanges = config.defaultTracking.pageViews.trackHistoryChanges;\n }\n if ("eventType" in config.defaultTracking.pageViews && config.defaultTracking.pageViews.eventType) {\n eventType = config.defaultTracking.pageViews.eventType;\n }\n }\n }\n return {\n trackOn,\n trackHistoryChanges,\n eventType\n };\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/language.js\n var getLanguage2 = function() {\n var _a, _b, _c, _d;\n if (typeof navigator === "undefined")\n return "";\n var userLanguage = navigator.userLanguage;\n return (_d = (_c = (_b = (_a = navigator.languages) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : navigator.language) !== null && _c !== void 0 ? _c : userLanguage) !== null && _d !== void 0 ? _d : "";\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/plugins/identity.js\n var IdentityEventSender = (\n /** @class */\n (function() {\n function IdentityEventSender2() {\n this.name = "identity";\n this.type = PluginType.BEFORE;\n this.identityStore = getAnalyticsConnector().identityStore;\n }\n IdentityEventSender2.prototype.execute = function(context) {\n return __awaiter(this, void 0, void 0, function() {\n var userProperties;\n return __generator(this, function(_a) {\n userProperties = context.user_properties;\n if (userProperties) {\n this.identityStore.editIdentity().updateUserProperties(userProperties).commit();\n }\n return [2, context];\n });\n });\n };\n IdentityEventSender2.prototype.setup = function(config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n if (config.instanceName) {\n this.identityStore = getAnalyticsConnector(config.instanceName).identityStore;\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return IdentityEventSender2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/storage/cookie.js\n var CookieStorage = (\n /** @class */\n (function() {\n function CookieStorage2(options) {\n this.options = __assign({}, options);\n }\n CookieStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n var testStrorage, testKey, value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n if (!getGlobalScope()) {\n return [2, false];\n }\n CookieStorage2.testValue = String(Date.now());\n testStrorage = new CookieStorage2(this.options);\n testKey = "AMP_TEST";\n _b.label = 1;\n case 1:\n _b.trys.push([1, 4, 5, 7]);\n return [4, testStrorage.set(testKey, CookieStorage2.testValue)];\n case 2:\n _b.sent();\n return [4, testStrorage.get(testKey)];\n case 3:\n value = _b.sent();\n return [2, value === CookieStorage2.testValue];\n case 4:\n _a = _b.sent();\n return [2, false];\n case 5:\n return [4, testStrorage.remove(testKey)];\n case 6:\n _b.sent();\n return [\n 7\n /*endfinally*/\n ];\n case 7:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.getRaw(key)];\n case 1:\n value = _a.sent();\n if (!value) {\n return [2, void 0];\n }\n try {\n try {\n value = decodeURIComponent(atob(value));\n } catch (_b) {\n }\n return [2, JSON.parse(value)];\n } catch (_c) {\n return [2, void 0];\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.getRaw = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var globalScope, cookie, match;\n return __generator(this, function(_b) {\n globalScope = getGlobalScope();\n cookie = (_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.document.cookie.split("; ")) !== null && _a !== void 0 ? _a : [];\n match = cookie.find(function(c) {\n return c.indexOf(key + "=") === 0;\n });\n if (!match) {\n return [2, void 0];\n }\n return [2, match.substring(key.length + 1)];\n });\n });\n };\n CookieStorage2.prototype.set = function(key, value) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var expirationDays, expires, expireDate, date, str, globalScope;\n return __generator(this, function(_b) {\n try {\n expirationDays = (_a = this.options.expirationDays) !== null && _a !== void 0 ? _a : 0;\n expires = value !== null ? expirationDays : -1;\n expireDate = void 0;\n if (expires) {\n date = /* @__PURE__ */ new Date();\n date.setTime(date.getTime() + expires * 24 * 60 * 60 * 1e3);\n expireDate = date;\n }\n str = "".concat(key, "=").concat(btoa(encodeURIComponent(JSON.stringify(value))));\n if (expireDate) {\n str += "; expires=".concat(expireDate.toUTCString());\n }\n str += "; path=/";\n if (this.options.domain) {\n str += "; domain=".concat(this.options.domain);\n }\n if (this.options.secure) {\n str += "; Secure";\n }\n if (this.options.sameSite) {\n str += "; SameSite=".concat(this.options.sameSite);\n }\n globalScope = getGlobalScope();\n if (globalScope) {\n globalScope.document.cookie = str;\n }\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n CookieStorage2.prototype.remove = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.set(key, null)];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.reset = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return CookieStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/transports/fetch.js\n var FetchTransport = (\n /** @class */\n (function(_super) {\n __extends(FetchTransport2, _super);\n function FetchTransport2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FetchTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var options, response, responseText;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n if (typeof fetch === "undefined") {\n throw new Error("FetchTransport is not supported");\n }\n options = {\n headers: {\n "Content-Type": "application/json",\n Accept: "*/*"\n },\n body: JSON.stringify(payload),\n method: "POST"\n };\n return [4, fetch(serverUrl, options)];\n case 1:\n response = _a.sent();\n return [4, response.text()];\n case 2:\n responseText = _a.sent();\n try {\n return [2, this.buildResponse(JSON.parse(responseText))];\n } catch (_b) {\n return [2, this.buildResponse({ code: response.status })];\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n return FetchTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/utils.js\n var omitUndefined = function(input) {\n var obj = {};\n for (var key in input) {\n var val = input[key];\n if (val) {\n obj[key] = val;\n }\n }\n return obj;\n };\n\n // node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/page-view-tracking.js\n var pageViewTrackingPlugin = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var amplitude;\n var options = {};\n var globalScope = getGlobalScope();\n var loggerProvider = void 0;\n var pushState;\n var _a = __read(args, 2), clientOrOptions = _a[0], configOrUndefined = _a[1];\n if (clientOrOptions && "init" in clientOrOptions) {\n amplitude = clientOrOptions;\n if (configOrUndefined) {\n options = configOrUndefined;\n }\n } else if (clientOrOptions) {\n options = clientOrOptions;\n }\n var createPageViewEvent = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var _a2;\n var _b;\n var _c;\n return __generator(this, function(_d) {\n switch (_d.label) {\n case 0:\n _b = {\n event_type: (_c = options.eventType) !== null && _c !== void 0 ? _c : "Page View"\n };\n _a2 = [{}];\n return [4, getCampaignParams()];\n case 1:\n return [2, (_b.event_properties = __assign.apply(void 0, [__assign.apply(void 0, _a2.concat([_d.sent()])), { page_domain: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.hostname || ""\n ), page_location: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.href || ""\n ), page_path: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.pathname || ""\n ), page_title: (\n /* istanbul ignore next */\n typeof document !== "undefined" && document.title || ""\n ), page_url: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.href.split("?")[0] || ""\n ) }]), _b)];\n }\n });\n });\n };\n var shouldTrackOnPageLoad = function() {\n return typeof options.trackOn === "undefined" || typeof options.trackOn === "function" && options.trackOn();\n };\n var previousURL = typeof location !== "undefined" ? location.href : null;\n var trackHistoryPageView = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var newURL, shouldTrackPageView, _a2, _b, _c;\n return __generator(this, function(_d) {\n switch (_d.label) {\n case 0:\n newURL = location.href;\n shouldTrackPageView = shouldTrackHistoryPageView(options.trackHistoryChanges, newURL, previousURL || "") && shouldTrackOnPageLoad();\n previousURL = newURL;\n if (!shouldTrackPageView) return [3, 4];\n loggerProvider === null || loggerProvider === void 0 ? void 0 : loggerProvider.log("Tracking page view event");\n if (!(amplitude === null || amplitude === void 0)) return [3, 1];\n _a2 = void 0;\n return [3, 3];\n case 1:\n _c = (_b = amplitude).track;\n return [4, createPageViewEvent()];\n case 2:\n _a2 = _c.apply(_b, [_d.sent()]);\n _d.label = 3;\n case 3:\n _a2;\n _d.label = 4;\n case 4:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n var trackHistoryPageViewWrapper = function() {\n void trackHistoryPageView();\n };\n var plugin = {\n name: "page-view-tracking",\n type: PluginType.ENRICHMENT,\n setup: function(config, client) {\n return __awaiter(void 0, void 0, void 0, function() {\n var receivedType, _a2, _b;\n var _c, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n amplitude = amplitude !== null && amplitude !== void 0 ? amplitude : client;\n if (!amplitude) {\n receivedType = clientOrOptions ? "Options" : "undefined";\n config.loggerProvider.error("Argument of type \'".concat(receivedType, "\' is not assignable to parameter of type \'BrowserClient\'."));\n return [\n 2\n /*return*/\n ];\n }\n loggerProvider = config.loggerProvider;\n loggerProvider.log("Installing @amplitude/plugin-page-view-tracking-browser");\n options.trackOn = ((_c = config.attribution) === null || _c === void 0 ? void 0 : _c.trackPageViews) ? "attribution" : options.trackOn;\n if (!client && ((_d = config.attribution) === null || _d === void 0 ? void 0 : _d.trackPageViews)) {\n loggerProvider.warn("@amplitude/plugin-page-view-tracking-browser overrides page view tracking behavior defined in @amplitude/analytics-browser. Resolve by disabling page view tracking in @amplitude/analytics-browser.");\n config.attribution.trackPageViews = false;\n }\n if (options.trackHistoryChanges && globalScope) {\n globalScope.addEventListener("popstate", trackHistoryPageViewWrapper);\n pushState = globalScope.history.pushState;\n globalScope.history.pushState = new Proxy(globalScope.history.pushState, {\n apply: function(target, thisArg, _a3) {\n var _b2 = __read(_a3, 3), state = _b2[0], unused = _b2[1], url = _b2[2];\n target.apply(thisArg, [state, unused, url]);\n void trackHistoryPageView();\n }\n });\n }\n if (!shouldTrackOnPageLoad()) return [3, 2];\n loggerProvider.log("Tracking page view event");\n _b = (_a2 = amplitude).track;\n return [4, createPageViewEvent()];\n case 1:\n _b.apply(_a2, [_e.sent()]);\n _e.label = 2;\n case 2:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n },\n execute: function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n var pageViewEvent;\n return __generator(this, function(_a2) {\n switch (_a2.label) {\n case 0:\n if (!(options.trackOn === "attribution" && isCampaignEvent(event))) return [3, 2];\n loggerProvider === null || loggerProvider === void 0 ? void 0 : loggerProvider.log("Enriching campaign event to page view event with campaign parameters");\n return [4, createPageViewEvent()];\n case 1:\n pageViewEvent = _a2.sent();\n event.event_type = pageViewEvent.event_type;\n event.event_properties = __assign(__assign({}, event.event_properties), pageViewEvent.event_properties);\n _a2.label = 2;\n case 2:\n return [2, event];\n }\n });\n });\n },\n teardown: function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a2) {\n if (globalScope) {\n globalScope.removeEventListener("popstate", trackHistoryPageViewWrapper);\n if (pushState) {\n globalScope.history.pushState = pushState;\n }\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n }\n };\n plugin.__trackHistoryPageView = trackHistoryPageView;\n return plugin;\n };\n var getCampaignParams = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n _a = omitUndefined;\n return [4, new CampaignParser().parse()];\n case 1:\n return [2, _a.apply(void 0, [_b.sent()])];\n }\n });\n });\n };\n var isCampaignEvent = function(event) {\n if (event.event_type === "$identify" && event.user_properties) {\n var properties = event.user_properties;\n var $set = properties[IdentifyOperation.SET] || {};\n var $unset = properties[IdentifyOperation.UNSET] || {};\n var userProperties_1 = __spreadArray(__spreadArray([], __read(Object.keys($set)), false), __read(Object.keys($unset)), false);\n return Object.keys(BASE_CAMPAIGN).every(function(value) {\n return userProperties_1.includes(value);\n });\n }\n return false;\n };\n var shouldTrackHistoryPageView = function(trackingOption, newURL, oldURL) {\n switch (trackingOption) {\n case "pathOnly":\n return newURL.split("?")[0] !== oldURL.split("?")[0];\n default:\n return newURL !== oldURL;\n }\n };\n\n // node_modules/@amplitude/plugin-web-attribution-browser/lib/esm/helpers.js\n var getStorageKey = function(apiKey, postKey, limit) {\n if (postKey === void 0) {\n postKey = "";\n }\n if (limit === void 0) {\n limit = 10;\n }\n return [AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join("_");\n };\n var domainWithoutSubdomain = function(domain) {\n var parts = domain.split(".");\n if (parts.length <= 2) {\n return domain;\n }\n return parts.slice(parts.length - 2, parts.length).join(".");\n };\n var isNewCampaign = function(current, previous, options) {\n var _a;\n var referrer = current.referrer, referring_domain = current.referring_domain, currentCampaign = __rest(current, ["referrer", "referring_domain"]);\n var _b = previous || {}, _previous_referrer = _b.referrer, prevReferringDomain = _b.referring_domain, previousCampaign = __rest(_b, ["referrer", "referring_domain"]);\n if (current.referring_domain && ((_a = options.excludeReferrers) === null || _a === void 0 ? void 0 : _a.includes(current.referring_domain))) {\n return false;\n }\n var hasNewCampaign = JSON.stringify(currentCampaign) !== JSON.stringify(previousCampaign);\n var hasNewDomain = domainWithoutSubdomain(referring_domain || "") !== domainWithoutSubdomain(prevReferringDomain || "");\n return !previous || hasNewCampaign || hasNewDomain;\n };\n var createCampaignEvent = function(campaign, options) {\n var campaignParameters = __assign(__assign({}, BASE_CAMPAIGN), campaign);\n var identifyEvent = Object.entries(campaignParameters).reduce(function(identify2, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n identify2.setOnce("initial_".concat(key), (_b = value !== null && value !== void 0 ? value : options.initialEmptyValue) !== null && _b !== void 0 ? _b : "EMPTY");\n if (value) {\n return identify2.set(key, value);\n }\n return identify2.unset(key);\n }, new Identify());\n return createIdentifyEvent(identifyEvent);\n };\n\n // node_modules/@amplitude/plugin-web-attribution-browser/lib/esm/web-attribution.js\n var webAttributionPlugin = function() {\n var _this = this;\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var amplitude;\n var options = {};\n var _b = __read(args, 2), clientOrOptions = _b[0], configOrUndefined = _b[1];\n if (clientOrOptions && "init" in clientOrOptions) {\n amplitude = clientOrOptions;\n if (configOrUndefined) {\n options = configOrUndefined;\n }\n } else if (clientOrOptions) {\n options = clientOrOptions;\n }\n var excludeReferrers = (_a = options.excludeReferrers) !== null && _a !== void 0 ? _a : [];\n if (typeof location !== "undefined") {\n excludeReferrers.unshift(location.hostname);\n }\n options = __assign(__assign({ disabled: false, initialEmptyValue: "EMPTY", resetSessionOnNewCampaign: false }, options), { excludeReferrers });\n var plugin = {\n name: "web-attribution",\n type: PluginType.BEFORE,\n setup: function(config, client) {\n var _a2;\n return __awaiter(this, void 0, void 0, function() {\n var receivedType, storage, storageKey, _b2, currentCampaign, previousCampaign, pluginEnabledOverride, campaignEvent;\n return __generator(this, function(_c) {\n switch (_c.label) {\n case 0:\n amplitude = amplitude !== null && amplitude !== void 0 ? amplitude : client;\n if (!amplitude) {\n receivedType = clientOrOptions ? "Options" : "undefined";\n config.loggerProvider.error("Argument of type \'".concat(receivedType, "\' is not assignable to parameter of type \'BrowserClient\'."));\n return [\n 2\n /*return*/\n ];\n }\n if (options.disabled) {\n config.loggerProvider.log("@amplitude/plugin-web-attribution-browser is disabled. Attribution is not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n config.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser.");\n if (!client && !((_a2 = config.attribution) === null || _a2 === void 0 ? void 0 : _a2.disabled)) {\n config.loggerProvider.warn("@amplitude/plugin-web-attribution-browser overrides web attribution behavior defined in @amplitude/analytics-browser. Resolve by disabling web attribution tracking in @amplitude/analytics-browser.");\n config.attribution = {\n disabled: true\n };\n }\n storage = config.cookieStorage;\n storageKey = getStorageKey(config.apiKey, "MKTG");\n return [4, Promise.all([\n new CampaignParser().parse(),\n storage.get(storageKey)\n ])];\n case 1:\n _b2 = __read.apply(void 0, [_c.sent(), 2]), currentCampaign = _b2[0], previousCampaign = _b2[1];\n pluginEnabledOverride = this.__pluginEnabledOverride;\n if (pluginEnabledOverride !== null && pluginEnabledOverride !== void 0 ? pluginEnabledOverride : isNewCampaign(currentCampaign, previousCampaign, options)) {\n if (options.resetSessionOnNewCampaign) {\n amplitude.setSessionId(Date.now());\n config.loggerProvider.log("Created a new session for new campaign.");\n }\n config.loggerProvider.log("Tracking attribution.");\n campaignEvent = createCampaignEvent(currentCampaign, options);\n amplitude.track(campaignEvent);\n void storage.set(storageKey, currentCampaign);\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n },\n execute: function(event) {\n return __awaiter(_this, void 0, void 0, function() {\n return __generator(this, function(_a2) {\n return [2, event];\n });\n });\n }\n };\n plugin.__pluginEnabledOverride = void 0;\n return plugin;\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/storage/local-storage.js\n var MAX_ARRAY_LENGTH = 1e3;\n var LocalStorage = (\n /** @class */\n (function() {\n function LocalStorage2(config) {\n this.loggerProvider = config === null || config === void 0 ? void 0 : config.loggerProvider;\n }\n LocalStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n var random, testStorage, testKey, value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n if (!getGlobalScope()) {\n return [2, false];\n }\n random = String(Date.now());\n testStorage = new LocalStorage2();\n testKey = "AMP_TEST";\n _b.label = 1;\n case 1:\n _b.trys.push([1, 4, 5, 7]);\n return [4, testStorage.set(testKey, random)];\n case 2:\n _b.sent();\n return [4, testStorage.get(testKey)];\n case 3:\n value = _b.sent();\n return [2, value === random];\n case 4:\n _a = _b.sent();\n return [2, false];\n case 5:\n return [4, testStorage.remove(testKey)];\n case 6:\n _b.sent();\n return [\n 7\n /*endfinally*/\n ];\n case 7:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n LocalStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 3]);\n return [4, this.getRaw(key)];\n case 1:\n value = _b.sent();\n if (!value) {\n return [2, void 0];\n }\n return [2, JSON.parse(value)];\n case 2:\n _a = _b.sent();\n return [2, void 0];\n case 3:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n LocalStorage2.prototype.getRaw = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n return [2, ((_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.getItem(key)) || void 0];\n });\n });\n };\n LocalStorage2.prototype.set = function(key, value) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function() {\n var isExceededArraySize, serializedValue, droppedEventsCount;\n return __generator(this, function(_c) {\n isExceededArraySize = Array.isArray(value) && value.length > MAX_ARRAY_LENGTH;\n try {\n serializedValue = isExceededArraySize ? JSON.stringify(value.slice(0, MAX_ARRAY_LENGTH)) : JSON.stringify(value);\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.setItem(key, serializedValue);\n } catch (_d) {\n }\n if (isExceededArraySize) {\n droppedEventsCount = value.length - MAX_ARRAY_LENGTH;\n (_b = this.loggerProvider) === null || _b === void 0 ? void 0 : _b.error("Failed to save ".concat(droppedEventsCount, " events because the queue length exceeded ").concat(MAX_ARRAY_LENGTH, "."));\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n LocalStorage2.prototype.remove = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n try {\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.removeItem(key);\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n LocalStorage2.prototype.reset = function() {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n try {\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.clear();\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return LocalStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/transports/xhr.js\n var XHRTransport = (\n /** @class */\n (function(_super) {\n __extends(XHRTransport2, _super);\n function XHRTransport2() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.state = {\n done: 4\n };\n return _this;\n }\n XHRTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n return [2, new Promise(function(resolve, reject) {\n if (typeof XMLHttpRequest === "undefined") {\n reject(new Error("XHRTransport is not supported."));\n }\n var xhr = new XMLHttpRequest();\n xhr.open("POST", serverUrl, true);\n xhr.onreadystatechange = function() {\n if (xhr.readyState === _this.state.done) {\n try {\n var responsePayload = xhr.responseText;\n var parsedResponsePayload = JSON.parse(responsePayload);\n var result = _this.buildResponse(parsedResponsePayload);\n resolve(result);\n } catch (e) {\n reject(e);\n }\n }\n };\n xhr.setRequestHeader("Content-Type", "application/json");\n xhr.setRequestHeader("Accept", "*/*");\n xhr.send(JSON.stringify(payload));\n })];\n });\n });\n };\n return XHRTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/transports/send-beacon.js\n var SendBeaconTransport = (\n /** @class */\n (function(_super) {\n __extends(SendBeaconTransport2, _super);\n function SendBeaconTransport2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SendBeaconTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n return [2, new Promise(function(resolve, reject) {\n var globalScope = getGlobalScope();\n if (!(globalScope === null || globalScope === void 0 ? void 0 : globalScope.navigator.sendBeacon)) {\n throw new Error("SendBeaconTransport is not supported");\n }\n try {\n var data = JSON.stringify(payload);\n var success = globalScope.navigator.sendBeacon(serverUrl, JSON.stringify(payload));\n if (success) {\n return resolve(_this.buildResponse({\n code: 200,\n events_ingested: payload.events.length,\n payload_size_bytes: data.length,\n server_upload_time: Date.now()\n }));\n }\n return resolve(_this.buildResponse({ code: 500 }));\n } catch (e) {\n reject(e);\n }\n })];\n });\n });\n };\n return SendBeaconTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/config.js\n var getDefaultConfig2 = function() {\n var cookieStorage = new MemoryStorage();\n var trackingOptions = {\n deviceManufacturer: true,\n deviceModel: true,\n ipAddress: true,\n language: true,\n osName: true,\n osVersion: true,\n platform: true\n };\n return {\n cookieExpiration: 365,\n cookieSameSite: "Lax",\n cookieSecure: false,\n cookieStorage,\n cookieUpgrade: true,\n disableCookies: false,\n domain: "",\n sessionTimeout: 30 * 60 * 1e3,\n trackingOptions,\n transportProvider: new FetchTransport()\n };\n };\n var BrowserConfig = (\n /** @class */\n (function(_super) {\n __extends(BrowserConfig2, _super);\n function BrowserConfig2(apiKey, options) {\n var _this = this;\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n var defaultConfig = getDefaultConfig2();\n _this = _super.call(this, __assign(__assign({ flushIntervalMillis: 1e3, flushMaxRetries: 5, flushQueueSize: 30, transportProvider: defaultConfig.transportProvider }, options), { apiKey })) || this;\n _this._optOut = false;\n _this.cookieStorage = (_a = options === null || options === void 0 ? void 0 : options.cookieStorage) !== null && _a !== void 0 ? _a : defaultConfig.cookieStorage;\n _this.deviceId = options === null || options === void 0 ? void 0 : options.deviceId;\n _this.lastEventId = options === null || options === void 0 ? void 0 : options.lastEventId;\n _this.lastEventTime = options === null || options === void 0 ? void 0 : options.lastEventTime;\n _this.optOut = Boolean(options === null || options === void 0 ? void 0 : options.optOut);\n _this.sessionId = options === null || options === void 0 ? void 0 : options.sessionId;\n _this.userId = options === null || options === void 0 ? void 0 : options.userId;\n _this.appVersion = options === null || options === void 0 ? void 0 : options.appVersion;\n _this.attribution = options === null || options === void 0 ? void 0 : options.attribution;\n _this.cookieExpiration = (_b = options === null || options === void 0 ? void 0 : options.cookieExpiration) !== null && _b !== void 0 ? _b : defaultConfig.cookieExpiration;\n _this.cookieSameSite = (_c = options === null || options === void 0 ? void 0 : options.cookieSameSite) !== null && _c !== void 0 ? _c : defaultConfig.cookieSameSite;\n _this.cookieSecure = (_d = options === null || options === void 0 ? void 0 : options.cookieSecure) !== null && _d !== void 0 ? _d : defaultConfig.cookieSecure;\n _this.cookieUpgrade = (_e = options === null || options === void 0 ? void 0 : options.cookieUpgrade) !== null && _e !== void 0 ? _e : defaultConfig.cookieUpgrade;\n _this.defaultTracking = options === null || options === void 0 ? void 0 : options.defaultTracking;\n _this.disableCookies = (_f = options === null || options === void 0 ? void 0 : options.disableCookies) !== null && _f !== void 0 ? _f : defaultConfig.disableCookies;\n _this.defaultTracking = options === null || options === void 0 ? void 0 : options.defaultTracking;\n _this.domain = (_g = options === null || options === void 0 ? void 0 : options.domain) !== null && _g !== void 0 ? _g : defaultConfig.domain;\n _this.partnerId = options === null || options === void 0 ? void 0 : options.partnerId;\n _this.sessionTimeout = (_h = options === null || options === void 0 ? void 0 : options.sessionTimeout) !== null && _h !== void 0 ? _h : defaultConfig.sessionTimeout;\n _this.trackingOptions = (_j = options === null || options === void 0 ? void 0 : options.trackingOptions) !== null && _j !== void 0 ? _j : defaultConfig.trackingOptions;\n return _this;\n }\n Object.defineProperty(BrowserConfig2.prototype, "deviceId", {\n get: function() {\n return this._deviceId;\n },\n set: function(deviceId) {\n if (this._deviceId !== deviceId) {\n this._deviceId = deviceId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "userId", {\n get: function() {\n return this._userId;\n },\n set: function(userId) {\n if (this._userId !== userId) {\n this._userId = userId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "sessionId", {\n get: function() {\n return this._sessionId;\n },\n set: function(sessionId) {\n if (this._sessionId !== sessionId) {\n this._sessionId = sessionId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "optOut", {\n get: function() {\n return this._optOut;\n },\n set: function(optOut) {\n if (this._optOut !== optOut) {\n this._optOut = optOut;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "lastEventTime", {\n get: function() {\n return this._lastEventTime;\n },\n set: function(lastEventTime) {\n if (this._lastEventTime !== lastEventTime) {\n this._lastEventTime = lastEventTime;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "lastEventId", {\n get: function() {\n return this._lastEventId;\n },\n set: function(lastEventId) {\n if (this._lastEventId !== lastEventId) {\n this._lastEventId = lastEventId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n BrowserConfig2.prototype.updateStorage = function() {\n var _a;\n var cache = {\n deviceId: this._deviceId,\n userId: this._userId,\n sessionId: this._sessionId,\n optOut: this._optOut,\n lastEventTime: this._lastEventTime,\n lastEventId: this._lastEventId\n };\n void ((_a = this.cookieStorage) === null || _a === void 0 ? void 0 : _a.set(getCookieName(this.apiKey), cache));\n };\n return BrowserConfig2;\n })(Config)\n );\n var useBrowserConfig = function(apiKey, options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var defaultConfig, deviceId, lastEventId, lastEventTime, optOut, sessionId, userId, cookieStorage, domain, _a, _b, _c;\n var _d;\n var _e, _f;\n return __generator(this, function(_g) {\n switch (_g.label) {\n case 0:\n defaultConfig = getDefaultConfig2();\n deviceId = (_e = options === null || options === void 0 ? void 0 : options.deviceId) !== null && _e !== void 0 ? _e : UUID();\n lastEventId = options === null || options === void 0 ? void 0 : options.lastEventId;\n lastEventTime = options === null || options === void 0 ? void 0 : options.lastEventTime;\n optOut = options === null || options === void 0 ? void 0 : options.optOut;\n sessionId = options === null || options === void 0 ? void 0 : options.sessionId;\n userId = options === null || options === void 0 ? void 0 : options.userId;\n cookieStorage = options === null || options === void 0 ? void 0 : options.cookieStorage;\n domain = options === null || options === void 0 ? void 0 : options.domain;\n _a = BrowserConfig.bind;\n _b = [void 0, apiKey];\n _c = [__assign({}, options)];\n _d = { cookieStorage, deviceId, domain, lastEventId, lastEventTime, optOut, sessionId };\n return [4, createEventsStorage(options)];\n case 1:\n return [2, new (_a.apply(BrowserConfig, _b.concat([__assign.apply(void 0, _c.concat([(_d.storageProvider = _g.sent(), _d.trackingOptions = __assign(__assign({}, defaultConfig.trackingOptions), options === null || options === void 0 ? void 0 : options.trackingOptions), _d.transportProvider = (_f = options === null || options === void 0 ? void 0 : options.transportProvider) !== null && _f !== void 0 ? _f : createTransport(options === null || options === void 0 ? void 0 : options.transport), _d.userId = userId, _d)]))])))()];\n }\n });\n });\n };\n var createCookieStorage = function(overrides, baseConfig) {\n if (baseConfig === void 0) {\n baseConfig = getDefaultConfig2();\n }\n return __awaiter(void 0, void 0, void 0, function() {\n var options, cookieStorage, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n options = __assign(__assign({}, baseConfig), overrides);\n cookieStorage = overrides === null || overrides === void 0 ? void 0 : overrides.cookieStorage;\n _a = !cookieStorage;\n if (_a) return [3, 2];\n return [4, cookieStorage.isEnabled()];\n case 1:\n _a = !_b.sent();\n _b.label = 2;\n case 2:\n if (_a) {\n return [2, createFlexibleStorage(options)];\n }\n return [2, cookieStorage];\n }\n });\n });\n };\n var createFlexibleStorage = function(options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var storage, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n storage = new CookieStorage({\n domain: options.domain,\n expirationDays: options.cookieExpiration,\n sameSite: options.cookieSameSite,\n secure: options.cookieSecure\n });\n _a = options.disableCookies;\n if (_a) return [3, 2];\n return [4, storage.isEnabled()];\n case 1:\n _a = !_b.sent();\n _b.label = 2;\n case 2:\n if (!_a) return [3, 4];\n storage = new LocalStorage();\n return [4, storage.isEnabled()];\n case 3:\n if (!_b.sent()) {\n storage = new MemoryStorage();\n }\n _b.label = 4;\n case 4:\n return [2, storage];\n }\n });\n });\n };\n var createEventsStorage = function(overrides) {\n return __awaiter(void 0, void 0, void 0, function() {\n var hasStorageProviderProperty, loggerProvider, _a, _b, storage, _c, e_1_1;\n var e_1, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n hasStorageProviderProperty = overrides && Object.prototype.hasOwnProperty.call(overrides, "storageProvider");\n loggerProvider = overrides && overrides.loggerProvider;\n if (!(!hasStorageProviderProperty || overrides.storageProvider)) return [3, 9];\n _e.label = 1;\n case 1:\n _e.trys.push([1, 7, 8, 9]);\n _a = __values([overrides === null || overrides === void 0 ? void 0 : overrides.storageProvider, new LocalStorage({ loggerProvider })]), _b = _a.next();\n _e.label = 2;\n case 2:\n if (!!_b.done) return [3, 6];\n storage = _b.value;\n _c = storage;\n if (!_c) return [3, 4];\n return [4, storage.isEnabled()];\n case 3:\n _c = _e.sent();\n _e.label = 4;\n case 4:\n if (_c) {\n return [2, storage];\n }\n _e.label = 5;\n case 5:\n _b = _a.next();\n return [3, 2];\n case 6:\n return [3, 9];\n case 7:\n e_1_1 = _e.sent();\n e_1 = { error: e_1_1 };\n return [3, 9];\n case 8:\n try {\n if (_b && !_b.done && (_d = _a.return)) _d.call(_a);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 9:\n return [2, void 0];\n }\n });\n });\n };\n var createTransport = function(transport) {\n if (transport === TransportType.XHR) {\n return new XHRTransport();\n }\n if (transport === TransportType.SendBeacon) {\n return new SendBeaconTransport();\n }\n return getDefaultConfig2().transportProvider;\n };\n var getTopLevelDomain = function(url) {\n return __awaiter(void 0, void 0, void 0, function() {\n var host, parts, levels, storageKey, i, i, domain, options, storage, value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, new CookieStorage().isEnabled()];\n case 1:\n if (!_a.sent() || !url && typeof location === "undefined") {\n return [2, ""];\n }\n host = url !== null && url !== void 0 ? url : location.hostname;\n parts = host.split(".");\n levels = [];\n storageKey = "AMP_TLDTEST";\n for (i = parts.length - 2; i >= 0; --i) {\n levels.push(parts.slice(i).join("."));\n }\n i = 0;\n _a.label = 2;\n case 2:\n if (!(i < levels.length)) return [3, 7];\n domain = levels[i];\n options = { domain: "." + domain };\n storage = new CookieStorage(options);\n return [4, storage.set(storageKey, 1)];\n case 3:\n _a.sent();\n return [4, storage.get(storageKey)];\n case 4:\n value = _a.sent();\n if (!value) return [3, 6];\n return [4, storage.remove(storageKey)];\n case 5:\n _a.sent();\n return [2, "." + domain];\n case 6:\n i++;\n return [3, 2];\n case 7:\n return [2, ""];\n }\n });\n });\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/constants.js\n var DEFAULT_EVENT_PREFIX = "[Amplitude]";\n var DEFAULT_PAGE_VIEW_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Page Viewed");\n var DEFAULT_FORM_START_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Form Started");\n var DEFAULT_FORM_SUBMIT_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Form Submitted");\n var DEFAULT_FILE_DOWNLOAD_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " File Downloaded");\n var DEFAULT_SESSION_START_EVENT = "session_start";\n var DEFAULT_SESSION_END_EVENT = "session_end";\n var FILE_EXTENSION = "".concat(DEFAULT_EVENT_PREFIX, " File Extension");\n var FILE_NAME = "".concat(DEFAULT_EVENT_PREFIX, " File Name");\n var LINK_ID = "".concat(DEFAULT_EVENT_PREFIX, " Link ID");\n var LINK_TEXT = "".concat(DEFAULT_EVENT_PREFIX, " Link Text");\n var LINK_URL = "".concat(DEFAULT_EVENT_PREFIX, " Link URL");\n var FORM_ID = "".concat(DEFAULT_EVENT_PREFIX, " Form ID");\n var FORM_NAME = "".concat(DEFAULT_EVENT_PREFIX, " Form Name");\n var FORM_DESTINATION = "".concat(DEFAULT_EVENT_PREFIX, " Form Destination");\n\n // node_modules/@amplitude/analytics-browser/lib/esm/cookie-migration/index.js\n var parseLegacyCookies = function(apiKey, options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var storage, oldCookieName, cookies, _a, deviceId, userId, optOut, sessionId, lastEventTime, lastEventId;\n var _b;\n return __generator(this, function(_c) {\n switch (_c.label) {\n case 0:\n return [4, createCookieStorage(options)];\n case 1:\n storage = _c.sent();\n oldCookieName = getOldCookieName(apiKey);\n return [4, storage.getRaw(oldCookieName)];\n case 2:\n cookies = _c.sent();\n if (!cookies) {\n return [2, {\n optOut: false\n }];\n }\n if (!((_b = options.cookieUpgrade) !== null && _b !== void 0 ? _b : getDefaultConfig2().cookieUpgrade)) return [3, 4];\n return [4, storage.remove(oldCookieName)];\n case 3:\n _c.sent();\n _c.label = 4;\n case 4:\n _a = __read(cookies.split("."), 6), deviceId = _a[0], userId = _a[1], optOut = _a[2], sessionId = _a[3], lastEventTime = _a[4], lastEventId = _a[5];\n return [2, {\n deviceId,\n userId: decode(userId),\n sessionId: parseTime(sessionId),\n lastEventId: parseTime(lastEventId),\n lastEventTime: parseTime(lastEventTime),\n optOut: Boolean(optOut)\n }];\n }\n });\n });\n };\n var parseTime = function(num) {\n var integer = parseInt(num, 32);\n if (isNaN(integer)) {\n return void 0;\n }\n return integer;\n };\n var decode = function(value) {\n if (!atob || !escape || !value) {\n return void 0;\n }\n try {\n return decodeURIComponent(escape(atob(value)));\n } catch (_a) {\n return void 0;\n }\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js\n var import_ua_parser_js = __toESM(require_ua_parser());\n\n // node_modules/@amplitude/analytics-browser/lib/esm/version.js\n var VERSION = "1.13.4";\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js\n var BROWSER_PLATFORM = "Web";\n var IP_ADDRESS = "$remote";\n var Context = (\n /** @class */\n (function() {\n function Context2() {\n this.name = "context";\n this.type = PluginType.BEFORE;\n this.library = "amplitude-ts/".concat(VERSION);\n if (typeof navigator !== "undefined") {\n this.userAgent = navigator.userAgent;\n }\n this.uaResult = new import_ua_parser_js.default(this.userAgent).getResult();\n }\n Context2.prototype.setup = function(config) {\n this.config = config;\n return Promise.resolve(void 0);\n };\n Context2.prototype.execute = function(context) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function() {\n var time, osName, osVersion, deviceModel, deviceVendor, lastEventId, nextEventId, event;\n return __generator(this, function(_c) {\n time = (/* @__PURE__ */ new Date()).getTime();\n osName = this.uaResult.browser.name;\n osVersion = this.uaResult.browser.version;\n deviceModel = this.uaResult.device.model || this.uaResult.os.name;\n deviceVendor = this.uaResult.device.vendor;\n lastEventId = (_a = this.config.lastEventId) !== null && _a !== void 0 ? _a : -1;\n nextEventId = (_b = context.event_id) !== null && _b !== void 0 ? _b : lastEventId + 1;\n this.config.lastEventId = nextEventId;\n if (!context.time) {\n this.config.lastEventTime = time;\n }\n event = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ user_id: this.config.userId, device_id: this.config.deviceId, session_id: this.config.sessionId, time }, this.config.appVersion && { app_version: this.config.appVersion }), this.config.trackingOptions.platform && { platform: BROWSER_PLATFORM }), this.config.trackingOptions.osName && { os_name: osName }), this.config.trackingOptions.osVersion && { os_version: osVersion }), this.config.trackingOptions.deviceManufacturer && { device_manufacturer: deviceVendor }), this.config.trackingOptions.deviceModel && { device_model: deviceModel }), this.config.trackingOptions.language && { language: getLanguage2() }), this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS }), { insert_id: UUID(), partner_id: this.config.partnerId, plan: this.config.plan }), this.config.ingestionMetadata && {\n ingestion_metadata: {\n source_name: this.config.ingestionMetadata.sourceName,\n source_version: this.config.ingestionMetadata.sourceVersion\n }\n }), context), { event_id: nextEventId, library: this.library, user_agent: this.userAgent });\n return [2, event];\n });\n });\n };\n return Context2;\n })()\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/default-page-view-event-enrichment.js\n var eventPropertyMap = {\n page_domain: "".concat(DEFAULT_EVENT_PREFIX, " Page Domain"),\n page_location: "".concat(DEFAULT_EVENT_PREFIX, " Page Location"),\n page_path: "".concat(DEFAULT_EVENT_PREFIX, " Page Path"),\n page_title: "".concat(DEFAULT_EVENT_PREFIX, " Page Title"),\n page_url: "".concat(DEFAULT_EVENT_PREFIX, " Page URL")\n };\n var defaultPageViewEventEnrichment = function() {\n var name = "@amplitude/plugin-default-page-view-event-enrichment-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, void 0];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n if (event.event_type === DEFAULT_PAGE_VIEW_EVENT && event.event_properties) {\n event.event_properties = Object.entries(event.event_properties).reduce(function(acc, _a2) {\n var _b = __read(_a2, 2), key = _b[0], value = _b[1];\n var transformedPropertyName = eventPropertyMap[key];\n if (transformedPropertyName) {\n acc[transformedPropertyName] = value;\n } else {\n acc[key] = value;\n }\n return acc;\n }, {});\n }\n return [2, event];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/file-download-tracking.js\n var fileDownloadTracking = function() {\n var observer;\n var eventListeners = [];\n var addEventListener = function(element, type2, handler) {\n element.addEventListener(type2, handler);\n eventListeners.push({\n element,\n type: type2,\n handler\n });\n };\n var removeClickListeners = function() {\n eventListeners.forEach(function(_a) {\n var element = _a.element, type2 = _a.type, handler = _a.handler;\n element === null || element === void 0 ? void 0 : element.removeEventListener(type2, handler);\n });\n eventListeners = [];\n };\n var name = "@amplitude/plugin-file-download-tracking-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function(config, amplitude) {\n return __awaiter(void 0, void 0, void 0, function() {\n var addFileDownloadListener, ext, links;\n return __generator(this, function(_a) {\n if (!amplitude) {\n config.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n if (typeof document === "undefined") {\n return [\n 2\n /*return*/\n ];\n }\n addFileDownloadListener = function(a) {\n var url;\n try {\n url = new URL(a.href, window.location.href);\n } catch (_a2) {\n return;\n }\n var result = ext.exec(url.href);\n var fileExtension = result === null || result === void 0 ? void 0 : result[1];\n if (fileExtension) {\n addEventListener(a, "click", function() {\n var _a2;\n if (fileExtension) {\n amplitude.track(DEFAULT_FILE_DOWNLOAD_EVENT, (_a2 = {}, _a2[FILE_EXTENSION] = fileExtension, _a2[FILE_NAME] = url.pathname, _a2[LINK_ID] = a.id, _a2[LINK_TEXT] = a.text, _a2[LINK_URL] = a.href, _a2));\n }\n });\n }\n };\n ext = /\\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/;\n links = Array.from(document.getElementsByTagName("a"));\n links.forEach(addFileDownloadListener);\n if (typeof MutationObserver !== "undefined") {\n observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(node) {\n if (node.nodeName === "A") {\n addFileDownloadListener(node);\n }\n if ("querySelectorAll" in node && typeof node.querySelectorAll === "function") {\n Array.from(node.querySelectorAll("a")).map(addFileDownloadListener);\n }\n });\n });\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, event];\n });\n });\n };\n var teardown = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n observer === null || observer === void 0 ? void 0 : observer.disconnect();\n removeClickListeners();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute,\n teardown\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/form-interaction-tracking.js\n var formInteractionTracking = function() {\n var observer;\n var eventListeners = [];\n var addEventListener = function(element, type2, handler) {\n element.addEventListener(type2, handler);\n eventListeners.push({\n element,\n type: type2,\n handler\n });\n };\n var removeClickListeners = function() {\n eventListeners.forEach(function(_a) {\n var element = _a.element, type2 = _a.type, handler = _a.handler;\n element === null || element === void 0 ? void 0 : element.removeEventListener(type2, handler);\n });\n eventListeners = [];\n };\n var name = "@amplitude/plugin-form-interaction-tracking-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function(config, amplitude) {\n return __awaiter(void 0, void 0, void 0, function() {\n var addFormInteractionListener, forms;\n return __generator(this, function(_a) {\n if (!amplitude) {\n config.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n if (typeof document === "undefined") {\n return [\n 2\n /*return*/\n ];\n }\n addFormInteractionListener = function(form) {\n var hasFormChanged = false;\n addEventListener(form, "change", function() {\n var _a2;\n if (!hasFormChanged) {\n amplitude.track(DEFAULT_FORM_START_EVENT, (_a2 = {}, _a2[FORM_ID] = form.id, _a2[FORM_NAME] = form.name, _a2[FORM_DESTINATION] = form.action, _a2));\n }\n hasFormChanged = true;\n });\n addEventListener(form, "submit", function() {\n var _a2, _b;\n if (!hasFormChanged) {\n amplitude.track(DEFAULT_FORM_START_EVENT, (_a2 = {}, _a2[FORM_ID] = form.id, _a2[FORM_NAME] = form.name, _a2[FORM_DESTINATION] = form.action, _a2));\n }\n amplitude.track(DEFAULT_FORM_SUBMIT_EVENT, (_b = {}, _b[FORM_ID] = form.id, _b[FORM_NAME] = form.name, _b[FORM_DESTINATION] = form.action, _b));\n hasFormChanged = false;\n });\n };\n forms = Array.from(document.getElementsByTagName("form"));\n forms.forEach(addFormInteractionListener);\n if (typeof MutationObserver !== "undefined") {\n observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(node) {\n if (node.nodeName === "FORM") {\n addFormInteractionListener(node);\n }\n if ("querySelectorAll" in node && typeof node.querySelectorAll === "function") {\n Array.from(node.querySelectorAll("form")).map(addFormInteractionListener);\n }\n });\n });\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, event];\n });\n });\n };\n var teardown = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n observer === null || observer === void 0 ? void 0 : observer.disconnect();\n removeClickListeners();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute,\n teardown\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/utils/snippet-helper.js\n var convertProxyObjectToRealObject = function(instance, queue) {\n for (var i = 0; i < queue.length; i++) {\n var _a = queue[i], name_1 = _a.name, args = _a.args, resolve = _a.resolve;\n var fn = instance && instance[name_1];\n if (typeof fn === "function") {\n var result = fn.apply(instance, args);\n if (typeof resolve === "function") {\n resolve(result === null || result === void 0 ? void 0 : result.promise);\n }\n }\n }\n return instance;\n };\n var isInstanceProxy = function(instance) {\n var instanceProxy = instance;\n return instanceProxy && instanceProxy._q !== void 0;\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/browser-client.js\n var AmplitudeBrowser = (\n /** @class */\n (function(_super) {\n __extends(AmplitudeBrowser2, _super);\n function AmplitudeBrowser2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AmplitudeBrowser2.prototype.init = function(apiKey, userId, options) {\n if (apiKey === void 0) {\n apiKey = "";\n }\n return returnWrapper(this._init(__assign(__assign({}, options), { userId, apiKey })));\n };\n AmplitudeBrowser2.prototype._init = function(options) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _r, _s, _t, _u, _v, _w;\n return __awaiter(this, void 0, void 0, function() {\n var _x, _y, _z, legacyCookies, cookieStorage, previousCookies, queryParams, deviceId, sessionId, optOut, lastEventId, lastEventTime, userId, browserOptions, isNewSession, connector, webAttribution, pageViewTrackingOptions;\n var _this = this;\n return __generator(this, function(_0) {\n switch (_0.label) {\n case 0:\n if (this.initializing) {\n return [\n 2\n /*return*/\n ];\n }\n this.initializing = true;\n _x = options;\n if (!options.disableCookies) return [3, 1];\n _y = "";\n return [3, 5];\n case 1:\n if (!((_a = options.domain) !== null && _a !== void 0)) return [3, 2];\n _z = _a;\n return [3, 4];\n case 2:\n return [4, getTopLevelDomain()];\n case 3:\n _z = _0.sent();\n _0.label = 4;\n case 4:\n _y = _z;\n _0.label = 5;\n case 5:\n _x.domain = _y;\n return [4, parseLegacyCookies(options.apiKey, options)];\n case 6:\n legacyCookies = _0.sent();\n return [4, createCookieStorage(options)];\n case 7:\n cookieStorage = _0.sent();\n return [4, cookieStorage.get(getCookieName(options.apiKey))];\n case 8:\n previousCookies = _0.sent();\n queryParams = getQueryParams();\n deviceId = (_d = (_c = (_b = options.deviceId) !== null && _b !== void 0 ? _b : queryParams.deviceId) !== null && _c !== void 0 ? _c : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deviceId) !== null && _d !== void 0 ? _d : legacyCookies.deviceId;\n sessionId = (_e = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.sessionId) !== null && _e !== void 0 ? _e : legacyCookies.sessionId;\n optOut = (_g = (_f = options.optOut) !== null && _f !== void 0 ? _f : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.optOut) !== null && _g !== void 0 ? _g : legacyCookies.optOut;\n lastEventId = (_h = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.lastEventId) !== null && _h !== void 0 ? _h : legacyCookies.lastEventId;\n lastEventTime = (_j = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.lastEventTime) !== null && _j !== void 0 ? _j : legacyCookies.lastEventTime;\n userId = (_l = (_k = options.userId) !== null && _k !== void 0 ? _k : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.userId) !== null && _l !== void 0 ? _l : legacyCookies.userId;\n this.previousSessionDeviceId = (_m = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deviceId) !== null && _m !== void 0 ? _m : legacyCookies.deviceId;\n this.previousSessionUserId = (_o = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.userId) !== null && _o !== void 0 ? _o : legacyCookies.userId;\n return [4, useBrowserConfig(options.apiKey, __assign(__assign({}, options), { deviceId, sessionId, optOut, lastEventId, lastEventTime, userId, cookieStorage }))];\n case 9:\n browserOptions = _0.sent();\n return [4, _super.prototype._init.call(this, browserOptions)];\n case 10:\n _0.sent();\n isNewSession = false;\n if (\n // user has never sent an event\n !this.config.lastEventTime || // user has no previous session ID\n !this.config.sessionId || // has sent an event and has previous session but expired\n this.config.lastEventTime && Date.now() - this.config.lastEventTime > this.config.sessionTimeout\n ) {\n this.setSessionId((_r = (_p = options.sessionId) !== null && _p !== void 0 ? _p : this.config.sessionId) !== null && _r !== void 0 ? _r : Date.now());\n isNewSession = true;\n }\n connector = getAnalyticsConnector(options.instanceName);\n connector.identityStore.setIdentity({\n userId: this.config.userId,\n deviceId: this.config.deviceId\n });\n return [4, this.add(new Destination()).promise];\n case 11:\n _0.sent();\n return [4, this.add(new Context()).promise];\n case 12:\n _0.sent();\n return [4, this.add(new IdentityEventSender()).promise];\n case 13:\n _0.sent();\n if (!isFileDownloadTrackingEnabled(this.config.defaultTracking)) return [3, 15];\n return [4, this.add(fileDownloadTracking()).promise];\n case 14:\n _0.sent();\n _0.label = 15;\n case 15:\n if (!isFormInteractionTrackingEnabled(this.config.defaultTracking)) return [3, 17];\n return [4, this.add(formInteractionTracking()).promise];\n case 16:\n _0.sent();\n _0.label = 17;\n case 17:\n if (!!((_s = this.config.attribution) === null || _s === void 0 ? void 0 : _s.disabled)) return [3, 19];\n webAttribution = webAttributionPlugin({\n excludeReferrers: (_t = this.config.attribution) === null || _t === void 0 ? void 0 : _t.excludeReferrers,\n initialEmptyValue: (_u = this.config.attribution) === null || _u === void 0 ? void 0 : _u.initialEmptyValue,\n resetSessionOnNewCampaign: (_v = this.config.attribution) === null || _v === void 0 ? void 0 : _v.resetSessionOnNewCampaign\n });\n webAttribution.__pluginEnabledOverride = isNewSession || ((_w = this.config.attribution) === null || _w === void 0 ? void 0 : _w.trackNewCampaigns) ? void 0 : false;\n return [4, this.add(webAttribution).promise];\n case 18:\n _0.sent();\n _0.label = 19;\n case 19:\n pageViewTrackingOptions = getPageViewTrackingConfig(this.config);\n pageViewTrackingOptions.eventType = pageViewTrackingOptions.eventType || DEFAULT_PAGE_VIEW_EVENT;\n return [4, this.add(pageViewTrackingPlugin(pageViewTrackingOptions)).promise];\n case 20:\n _0.sent();\n return [4, this.add(defaultPageViewEventEnrichment()).promise];\n case 21:\n _0.sent();\n this.initializing = false;\n return [4, this.runQueuedFunctions("dispatchQ")];\n case 22:\n _0.sent();\n connector.eventBridge.setEventReceiver(function(event) {\n void _this.track(event.eventType, event.eventProperties);\n });\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeBrowser2.prototype.getUserId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.userId;\n };\n AmplitudeBrowser2.prototype.setUserId = function(userId) {\n if (!this.config) {\n this.q.push(this.setUserId.bind(this, userId));\n return;\n }\n if (userId !== this.config.userId || userId === void 0) {\n this.config.userId = userId;\n setConnectorUserId(userId, this.config.instanceName);\n }\n };\n AmplitudeBrowser2.prototype.getDeviceId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.deviceId;\n };\n AmplitudeBrowser2.prototype.setDeviceId = function(deviceId) {\n if (!this.config) {\n this.q.push(this.setDeviceId.bind(this, deviceId));\n return;\n }\n this.config.deviceId = deviceId;\n setConnectorDeviceId(deviceId, this.config.instanceName);\n };\n AmplitudeBrowser2.prototype.setOptOut = function(optOut) {\n setConnectorOptOut(optOut, this.config.instanceName);\n _super.prototype.setOptOut.call(this, optOut);\n };\n AmplitudeBrowser2.prototype.reset = function() {\n this.setDeviceId(UUID());\n this.setUserId(void 0);\n };\n AmplitudeBrowser2.prototype.getSessionId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.sessionId;\n };\n AmplitudeBrowser2.prototype.setSessionId = function(sessionId) {\n var _a;\n if (!this.config) {\n this.q.push(this.setSessionId.bind(this, sessionId));\n return;\n }\n if (sessionId === this.config.sessionId) {\n return;\n }\n var previousSessionId = this.getSessionId();\n var lastEventTime = this.config.lastEventTime;\n var lastEventId = (_a = this.config.lastEventId) !== null && _a !== void 0 ? _a : -1;\n this.config.sessionId = sessionId;\n this.config.lastEventTime = void 0;\n if (isSessionTrackingEnabled(this.config.defaultTracking)) {\n if (previousSessionId && lastEventTime) {\n this.track(DEFAULT_SESSION_END_EVENT, void 0, {\n device_id: this.previousSessionDeviceId,\n event_id: ++lastEventId,\n session_id: previousSessionId,\n time: lastEventTime + 1,\n user_id: this.previousSessionUserId\n });\n }\n this.config.lastEventTime = this.config.sessionId;\n this.track(DEFAULT_SESSION_START_EVENT, void 0, {\n event_id: ++lastEventId,\n session_id: this.config.sessionId,\n time: this.config.lastEventTime\n });\n }\n this.previousSessionDeviceId = this.config.deviceId;\n this.previousSessionUserId = this.config.userId;\n };\n AmplitudeBrowser2.prototype.extendSession = function() {\n if (!this.config) {\n this.q.push(this.extendSession.bind(this));\n return;\n }\n this.config.lastEventTime = Date.now();\n };\n AmplitudeBrowser2.prototype.setTransport = function(transport) {\n if (!this.config) {\n this.q.push(this.setTransport.bind(this, transport));\n return;\n }\n this.config.transportProvider = createTransport(transport);\n };\n AmplitudeBrowser2.prototype.identify = function(identify2, eventOptions) {\n if (isInstanceProxy(identify2)) {\n var queue = identify2._q;\n identify2._q = [];\n identify2 = convertProxyObjectToRealObject(new Identify(), queue);\n }\n if (eventOptions === null || eventOptions === void 0 ? void 0 : eventOptions.user_id) {\n this.setUserId(eventOptions.user_id);\n }\n if (eventOptions === null || eventOptions === void 0 ? void 0 : eventOptions.device_id) {\n this.setDeviceId(eventOptions.device_id);\n }\n return _super.prototype.identify.call(this, identify2, eventOptions);\n };\n AmplitudeBrowser2.prototype.groupIdentify = function(groupType, groupName, identify2, eventOptions) {\n if (isInstanceProxy(identify2)) {\n var queue = identify2._q;\n identify2._q = [];\n identify2 = convertProxyObjectToRealObject(new Identify(), queue);\n }\n return _super.prototype.groupIdentify.call(this, groupType, groupName, identify2, eventOptions);\n };\n AmplitudeBrowser2.prototype.revenue = function(revenue2, eventOptions) {\n if (isInstanceProxy(revenue2)) {\n var queue = revenue2._q;\n revenue2._q = [];\n revenue2 = convertProxyObjectToRealObject(new Revenue(), queue);\n }\n return _super.prototype.revenue.call(this, revenue2, eventOptions);\n };\n AmplitudeBrowser2.prototype.process = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var currentTime, lastEventTime, timeSinceLastEvent;\n return __generator(this, function(_a) {\n currentTime = Date.now();\n lastEventTime = this.config.lastEventTime || Date.now();\n timeSinceLastEvent = currentTime - lastEventTime;\n if (event.event_type !== DEFAULT_SESSION_START_EVENT && event.event_type !== DEFAULT_SESSION_END_EVENT && (!event.session_id || event.session_id === this.getSessionId()) && timeSinceLastEvent > this.config.sessionTimeout) {\n this.setSessionId(currentTime);\n }\n return [2, _super.prototype.process.call(this, event)];\n });\n });\n };\n return AmplitudeBrowser2;\n })(AmplitudeCore)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/browser-client-factory.js\n var createInstance = function() {\n var client = new AmplitudeBrowser();\n return {\n init: debugWrapper(client.init.bind(client), "init", getClientLogConfig(client), getClientStates(client, ["config"])),\n add: debugWrapper(client.add.bind(client), "add", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.plugins"])),\n remove: debugWrapper(client.remove.bind(client), "remove", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.plugins"])),\n track: debugWrapper(client.track.bind(client), "track", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n logEvent: debugWrapper(client.logEvent.bind(client), "logEvent", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n identify: debugWrapper(client.identify.bind(client), "identify", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n groupIdentify: debugWrapper(client.groupIdentify.bind(client), "groupIdentify", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n setGroup: debugWrapper(client.setGroup.bind(client), "setGroup", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n revenue: debugWrapper(client.revenue.bind(client), "revenue", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n flush: debugWrapper(client.flush.bind(client), "flush", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n getUserId: debugWrapper(client.getUserId.bind(client), "getUserId", getClientLogConfig(client), getClientStates(client, ["config", "config.userId"])),\n setUserId: debugWrapper(client.setUserId.bind(client), "setUserId", getClientLogConfig(client), getClientStates(client, ["config", "config.userId"])),\n getDeviceId: debugWrapper(client.getDeviceId.bind(client), "getDeviceId", getClientLogConfig(client), getClientStates(client, ["config", "config.deviceId"])),\n setDeviceId: debugWrapper(client.setDeviceId.bind(client), "setDeviceId", getClientLogConfig(client), getClientStates(client, ["config", "config.deviceId"])),\n reset: debugWrapper(client.reset.bind(client), "reset", getClientLogConfig(client), getClientStates(client, ["config", "config.userId", "config.deviceId"])),\n getSessionId: debugWrapper(client.getSessionId.bind(client), "getSessionId", getClientLogConfig(client), getClientStates(client, ["config"])),\n setSessionId: debugWrapper(client.setSessionId.bind(client), "setSessionId", getClientLogConfig(client), getClientStates(client, ["config"])),\n extendSession: debugWrapper(client.extendSession.bind(client), "extendSession", getClientLogConfig(client), getClientStates(client, ["config"])),\n setOptOut: debugWrapper(client.setOptOut.bind(client), "setOptOut", getClientLogConfig(client), getClientStates(client, ["config"])),\n setTransport: debugWrapper(client.setTransport.bind(client), "setTransport", getClientLogConfig(client), getClientStates(client, ["config"]))\n };\n };\n var browser_client_factory_default = createInstance();\n\n // node_modules/@amplitude/analytics-browser/lib/esm/index.js\n var add = browser_client_factory_default.add;\n var extendSession = browser_client_factory_default.extendSession;\n var flush = browser_client_factory_default.flush;\n var getDeviceId = browser_client_factory_default.getDeviceId;\n var getSessionId = browser_client_factory_default.getSessionId;\n var getUserId = browser_client_factory_default.getUserId;\n var groupIdentify = browser_client_factory_default.groupIdentify;\n var identify = browser_client_factory_default.identify;\n var init = browser_client_factory_default.init;\n var logEvent = browser_client_factory_default.logEvent;\n var remove = browser_client_factory_default.remove;\n var reset = browser_client_factory_default.reset;\n var revenue = browser_client_factory_default.revenue;\n var setDeviceId = browser_client_factory_default.setDeviceId;\n var setGroup = browser_client_factory_default.setGroup;\n var setOptOut = browser_client_factory_default.setOptOut;\n var setSessionId = browser_client_factory_default.setSessionId;\n var setTransport = browser_client_factory_default.setTransport;\n var setUserId = browser_client_factory_default.setUserId;\n var track = browser_client_factory_default.track;\n\n // packages/dev-tools/client/tracking.ts\n var dispatch = (eventName) => {\n window.dispatchEvent(\n new CustomEvent(`builderdevtools`, { detail: { eventName } })\n );\n };\n async function loadUserDataFromLocal() {\n return apiLocalConfig();\n }\n var initTracking = async () => {\n const url = new URL(window.location.href);\n const hash = url.hash;\n const userIdHash = `#${CONNECTED_USER_ID_QS}=`;\n const uniqueId = Math.random().toString(36).substring(2, 15);\n const localConfig = await loadUserDataFromLocal();\n init("f1d2eb79aecd01b28c8a371ea5d1751c", localConfig?.userId || uniqueId, {\n logLevel: esm_exports.LogLevel.None,\n serverUrl: AMPLITUDE_PROXY_URL,\n flushIntervalMillis: 500\n });\n const identifyObj = new Identify();\n identify(identifyObj, {\n device_id: localConfig?.deviceId,\n user_id: localConfig?.userId || uniqueId\n });\n let builderUserId = `anonymous`;\n if (hash.startsWith(userIdHash)) {\n builderUserId = hash.slice(userIdHash.length);\n if (builderUserId) {\n setBuilderUserId(builderUserId);\n url.hash = "";\n window.history.replaceState({}, "", url.href);\n }\n }\n dispatch("init");\n };\n var setBuilderUserId = (builderUserId) => {\n if (typeof builderUserId === "string" && builderUserId.length > 0) {\n const t = getTracking();\n setTracking({\n ...t,\n builderUserId\n });\n }\n };\n var getTracking = () => {\n const ls = localStorage.getItem(TRACKING_KEY);\n if (ls) {\n try {\n let t = JSON.parse(ls);\n if (!t.ctas || typeof t.ctas !== "object") {\n t = setTracking({\n ...t,\n ctas: {}\n });\n }\n if (t.menuOpenedTs) {\n t = setTracking({\n ...t,\n ctas: {\n ...t.ctas,\n menuOpened: t.menuOpenedTs\n }\n });\n delete t.menuOpenedTs;\n }\n return t;\n } catch (e) {\n console.error(e);\n }\n }\n return setTracking({\n firstVisitTs: Date.now(),\n ctas: {},\n builderUserId: ""\n });\n };\n var setTracking = (t) => {\n try {\n localStorage.setItem(TRACKING_KEY, JSON.stringify(t));\n } catch (e) {\n console.error(e);\n }\n return t;\n };\n var hasCTA = (ctaName) => {\n const t = getTracking();\n return !!t.ctas[ctaName];\n };\n var setCTA = (ctaName) => {\n const t = getTracking();\n return setTracking({\n ...t,\n ctas: {\n ...t.ctas,\n [ctaName]: Date.now()\n }\n });\n };\n var TRACKING_KEY = "builderDevtools";\n\n // packages/dev-tools/client/menu/pages/component-input.ts\n function initComponentInputSection(shadow) {\n initRegisterInput(shadow);\n initComponentOpenSource(shadow);\n initComponentInputName(shadow);\n initComponentInputType(shadow);\n }\n function initRegisterInput(shadow) {\n const inputReg = shadow.getElementById("input-register");\n inputReg.addEventListener("change", async (ev) => {\n ev.stopPropagation();\n const inputName = shadow.getElementById("input-name");\n const nav = shadow.querySelector(".nav-cmp-input");\n nav.classList.add("input-loading");\n nav.classList.remove("input-enabled");\n const cmpId = inputName.dataset.id;\n const propName = inputName.dataset.prop;\n const registry = await apiSetComponentInput({\n cmpId,\n name: propName,\n registerInput: inputReg.checked\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentInput(shadow, cmpId, propName);\n renderComponentDetail(shadow, cmpId);\n nav.classList.remove("input-loading");\n });\n }\n function initComponentOpenSource(shadow) {\n const openSourceBtn = shadow.getElementById(\n "input-open-source"\n );\n openSourceBtn.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const cmp = APP_STATE.components.find((c) => c.id === target?.dataset.id);\n if (cmp) {\n apiLaunchEditor({ filePath: cmp.filePath });\n }\n });\n }\n function initComponentInputName(shadow) {\n const inputName = shadow.getElementById("input-name");\n const inputWrapper = inputName.closest(".ui-text-input");\n let initInputName = "";\n let savedTmr;\n inputName.addEventListener("focus", (ev) => {\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n ev.stopPropagation();\n initInputName = inputName.value;\n });\n inputName.addEventListener("blur", async (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (inputName.value !== initInputName) {\n if (inputName.value.trim().length < 3) {\n inputName.value = initInputName;\n return;\n }\n inputWrapper.classList.add("saved");\n savedTmr = setTimeout(() => {\n inputWrapper.classList.remove("saved");\n }, 3e3);\n const cmpId = inputName.dataset.id;\n const name = inputName.dataset.prop;\n const registry = await apiSetComponentInput({\n cmpId,\n name,\n friendlyName: inputName.value\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentList(shadow);\n renderComponentDetail(shadow, cmpId);\n renderComponentInput(shadow, cmpId, name);\n }\n });\n inputName.addEventListener("keyup", (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (ev.key === "Escape") {\n inputName.value = initInputName;\n inputName.blur();\n } else if (ev.key === "Enter") {\n inputName.blur();\n }\n });\n }\n function initComponentInputType(shadow) {\n const inputType = shadow.getElementById("input-type");\n inputType.addEventListener("change", async (ev) => {\n ev.stopPropagation();\n const cmpId = inputType.dataset.id;\n const name = inputType.dataset.prop;\n const registry = await apiSetComponentInput({\n cmpId,\n name,\n type: inputType.value\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentList(shadow);\n renderComponentDetail(shadow, cmpId);\n renderComponentInput(shadow, cmpId, name);\n });\n }\n function renderComponentInput(shadow, cmpId, propName) {\n const cmp = APP_STATE.components.find((c) => c.id === cmpId);\n if (!cmp) {\n return null;\n }\n const regInput = cmp.inputs.find((i) => i.name === propName);\n if (!regInput) {\n return null;\n }\n const nav = shadow.querySelector(".nav-cmp-input");\n if (regInput.isRegistered) {\n nav.classList.add("input-enabled");\n } else {\n nav.classList.remove("input-enabled");\n }\n const inputReg = shadow.getElementById("input-register");\n inputReg.checked = !!regInput.isRegistered;\n const title = shadow.getElementById("cmp-input-title");\n title.innerText = cmp.name + ": " + (regInput.friendlyName || regInput.name);\n const openSource = shadow.getElementById("input-open-source");\n openSource.innerText = `Open ${cmp.displayFilePath}`;\n openSource.dataset.id = cmp.id;\n const propNameText = shadow.getElementById("cmp-prop-name");\n propNameText.innerText = regInput.name;\n const propType = shadow.getElementById("cmp-prop-type");\n propType.innerText = getPrimitiveType(regInput.type);\n const inputName = shadow.getElementById("input-name");\n inputName.dataset.id = cmp.id;\n inputName.dataset.prop = regInput.name;\n inputName.value = regInput.friendlyName || regInput.name;\n renderInputTypeSelect(shadow, cmp, regInput);\n return regInput;\n }\n function renderInputTypeSelect(shadow, cmp, cmpInput) {\n const typeSelect = shadow.getElementById("input-type");\n typeSelect.dataset.id = cmp.id;\n typeSelect.dataset.prop = cmpInput.name;\n typeSelect.innerHTML = "";\n const inputType = cmpInput.type;\n const isString = STRING_TYPES.includes(inputType);\n const isNumber = NUMBER_TYPES.includes(inputType);\n const isBoolean = BOOLEAN_TYPES.includes(inputType);\n const isArray = ARRAY_TYPES.includes(inputType);\n const isObject = OBJECT_TYPES.includes(inputType);\n INPUT_TYPES.forEach((t) => {\n const option = document.createElement("option");\n option.value = t.value;\n option.innerText = t.text;\n option.disabled = STRING_TYPES.includes(t.value) && !isString || NUMBER_TYPES.includes(t.value) && !isNumber || BOOLEAN_TYPES.includes(t.value) && !isBoolean || ARRAY_TYPES.includes(t.value) && !isArray || OBJECT_TYPES.includes(t.value) && !isObject;\n typeSelect.appendChild(option);\n });\n typeSelect.value = inputType;\n }\n\n // packages/dev-tools/client/menu/pages/component-detail.ts\n function initComponentDetailSection(shadow) {\n initRegisterComponent(shadow);\n initComponentName(shadow);\n initComponentOpenSource2(shadow);\n initComponentInputList(shadow);\n initInputReload(shadow);\n }\n function initRegisterComponent(shadow) {\n const cmpReg = shadow.getElementById("cmp-register");\n cmpReg.addEventListener("change", (ev) => {\n ev.stopPropagation();\n loadComponentDetail(shadow, "update");\n });\n }\n async function loadComponentDetail(shadow, opt) {\n const cmpDetail = shadow.querySelector(".nav-cmp-detail");\n const cmpError = shadow.getElementById("cmp-error");\n const cmpReg = shadow.getElementById("cmp-register");\n const regSwitchLabel = cmpReg.closest(".ui-switch");\n cmpDetail.classList.remove("cmp-enabled");\n if (cmpReg.checked) {\n cmpDetail.classList.add("cmp-loading");\n }\n try {\n const cmpId = cmpReg.dataset.id;\n let registry;\n if (opt === "load") {\n registry = await apiLoadComponent({ cmpId });\n } else if (cmpReg.checked) {\n registry = await apiRegisterComponent({ cmpId });\n dispatch("registryUpdate");\n track("interaction", {\n type: "click",\n name: "register component",\n detail: cmpId\n });\n } else {\n registry = await apiUnregisterComponent({ cmpId });\n dispatch("registryUpdate");\n track("interaction", {\n type: "click",\n name: "unregister component",\n detail: cmpId\n });\n }\n updateAppState(registry);\n renderComponentList(shadow);\n const cmp = renderComponentDetail(shadow, cmpId);\n if (opt === "update" && cmp) {\n if (cmpReg.checked) {\n cmpDetail.classList.add("cmp-enabled");\n showToast(\n shadow,\n `<strong>${cmp.name}</strong> is now registered in <strong>${APP_STATE.registryDisplayPath}</strong> and available for use in the Builder Visual Editor`\n );\n } else {\n showToast(\n shadow,\n `<strong>${cmp.name}</strong> has been unregistered from <strong>${APP_STATE.registryDisplayPath}</strong> and removed from the Builder Visual Editor`\n );\n }\n }\n } catch (e) {\n console.error(e);\n cmpError.innerHTML = `<p class="error">Error loading components</p><p class="error">${e.message || e}</p>`;\n regSwitchLabel.style.display = "none";\n }\n cmpDetail.classList.remove("cmp-loading");\n }\n function initComponentName(shadow) {\n const cmpName = shadow.getElementById("cmp-name");\n const inputWrapper = cmpName.closest(".ui-text-input");\n let initComponentName2 = "";\n let savedTmr;\n cmpName.addEventListener("focus", (ev) => {\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n ev.stopPropagation();\n initComponentName2 = cmpName.value;\n });\n cmpName.addEventListener("blur", async (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (cmpName.value !== initComponentName2) {\n if (cmpName.value.trim().length < 3) {\n cmpName.value = initComponentName2;\n return;\n }\n inputWrapper.classList.add("saved");\n savedTmr = setTimeout(() => {\n inputWrapper.classList.remove("saved");\n }, 3e3);\n const cmpId = cmpName.dataset.id;\n const registry = await apiSetComponentInfo({\n cmpId,\n name: cmpName.value\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentList(shadow);\n renderComponentDetail(shadow, cmpId);\n }\n });\n cmpName.addEventListener("keyup", (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (ev.key === "Escape") {\n cmpName.value = initComponentName2;\n cmpName.blur();\n } else if (ev.key === "Enter") {\n cmpName.blur();\n }\n });\n }\n function renderComponentDetail(shadow, cmpId) {\n const cmp = APP_STATE.components.find((c) => c.id === cmpId);\n if (!cmp) {\n return null;\n }\n const cmpReg = shadow.getElementById("cmp-register");\n const cmpError = shadow.getElementById("cmp-error");\n const regSwitchLabel = cmpReg.closest(".ui-switch");\n regSwitchLabel.style.display = "";\n cmpError.innerHTML = "";\n cmpReg.dataset.id = cmp.id;\n cmpReg.checked = !!cmp.isRegistered;\n const cmpDetail = shadow.querySelector(".nav-cmp-detail");\n if (cmp.isRegistered) {\n cmpDetail.classList.add("cmp-enabled");\n } else {\n cmpDetail.classList.remove("cmp-enabled");\n }\n const cmpName = shadow.getElementById("cmp-name");\n cmpName.dataset.id = cmp.id;\n cmpName.value = cmp.name;\n const openSource = shadow.getElementById("cmp-open-source");\n openSource.innerText = `Open ${cmp.displayFilePath}`;\n openSource.dataset.id = cmp.id;\n const title = shadow.getElementById("cmp-detail-title");\n title.innerText = `${cmp.name} Component`;\n renderComponentDetailInputs(shadow, cmp);\n return cmp;\n }\n function initComponentOpenSource2(shadow) {\n const openSourceBtn = shadow.getElementById(\n "cmp-open-source"\n );\n openSourceBtn.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const cmp = APP_STATE.components.find((c) => c.id === target?.dataset.id);\n if (cmp) {\n apiLaunchEditor({ filePath: cmp.filePath });\n track("interaction", {\n type: "click",\n name: "open component source file",\n detail: cmp.filePath\n });\n }\n });\n }\n function initInputReload(shadow) {\n const reloadBtn = shadow.getElementById(\n "btn-inputs-reload"\n );\n reloadBtn.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n loadComponentDetail(shadow, "load");\n });\n }\n function initComponentInputList(shadow) {\n const cmpInputList = shadow.getElementById(\n "cmp-detail-inputs"\n );\n cmpInputList.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const button = target?.closest("button");\n const cmpId = button?.dataset.id;\n const propName = button?.dataset.propName;\n const cmpInput = renderComponentInput(shadow, cmpId, propName);\n if (cmpInput) {\n goToSection(shadow, "nav-cmp-input");\n }\n });\n }\n function renderComponentDetailInputs(shadow, cmp) {\n const cmpInputList = shadow.getElementById(\n "cmp-detail-inputs"\n );\n const filteredInputList = cmp.inputs.filter((input) => !input.hideFromUI);\n if (filteredInputList.length > 0) {\n cmpInputList.innerHTML = "";\n filteredInputList.forEach((input) => {\n cmpInputList.appendChild(renderComponentDetailInputItem(cmp, input));\n });\n } else {\n cmpInputList.innerHTML = `<p class="cmp-inputs-empty">${cmp.name} component does not have any props</p>`;\n }\n }\n function renderComponentDetailInputItem(cmp, cmpInput) {\n const item = document.createElement("button");\n item.dataset.id = cmp.id;\n item.dataset.propName = cmpInput.name;\n item.className = "cmp-input-item nav-list-item";\n if (!cmpInput.isRegistered) {\n item.classList.add("cmp-input-item-unregistered");\n }\n const itemIcon = document.createElement("span");\n const type = getPrimitiveType(cmpInput.type);\n itemIcon.className = `nav-list-item-icon input-icon input-icon-${type}`;\n item.appendChild(itemIcon);\n const itemName = document.createElement("span");\n itemName.innerText = cmpInput.friendlyName || cmpInput.name;\n item.appendChild(itemName);\n const itemNote = document.createElement("span");\n itemNote.className = "nav-list-item-note";\n itemNote.innerText = cmpInput.type;\n item.appendChild(itemNote);\n return item;\n }\n\n // packages/dev-tools/client/menu/pages/component-list.ts\n function initComponentListSection(shadow) {\n const openRegistryFile = shadow.getElementById("open-builder-registry");\n openRegistryFile.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n apiLaunchEditor({ filePath: APP_STATE.registryPath, line: 1, column: 1 });\n });\n const cmpList = shadow.getElementById("cmp-list");\n cmpList.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const cmpId = target?.dataset.id;\n const cmp = APP_STATE.components.find((c) => c.id === cmpId);\n if (cmp) {\n const cmpDetail = shadow.querySelector(\n ".nav-cmp-detail .section-content"\n );\n cmpDetail.scrollTop = 0;\n renderComponentDetail(shadow, cmp.id);\n goToSection(shadow, "nav-cmp-detail");\n if (cmp.isRegistered) {\n loadComponentDetail(shadow, "load");\n }\n }\n });\n const searchInput = shadow.getElementById(\n "component-search"\n );\n const clearSearchButton = shadow.getElementById(\n "clear-search"\n );\n searchInput?.addEventListener("input", (event) => {\n const searchTerm = event.target.value.toLowerCase();\n const filteredComponents = searchTerm ? APP_STATE.components.filter(\n (component) => component.name.toLowerCase().includes(searchTerm) || component.displayFilePath?.toLowerCase().includes(searchTerm)\n ) : APP_STATE.components;\n renderComponentList(shadow, filteredComponents);\n clearSearchButton.style.display = searchTerm ? "flex" : "none";\n });\n clearSearchButton?.addEventListener("click", () => {\n searchInput.value = "";\n renderComponentList(shadow);\n clearSearchButton.style.display = "none";\n });\n searchInput?.addEventListener("keydown", (event) => {\n if (event.key === "Escape") {\n searchInput.value = "";\n renderComponentList(shadow);\n clearSearchButton.style.display = "none";\n }\n });\n }\n function loadComponentsSection(shadow) {\n const loadRegistry = apiRegistry();\n renderComponents(shadow, loadRegistry);\n }\n async function renderComponents(shadow, loadRegistry) {\n const cmpList = shadow.getElementById("cmp-list");\n const cmpListSection = shadow.querySelector(".nav-cmp-list");\n cmpListSection.classList.add("nav-loading");\n const openRegistryFile = shadow.getElementById("open-builder-registry");\n try {\n const registry = await loadRegistry;\n updateAppState(registry);\n renderComponentList(shadow);\n if (APP_STATE.registryDisplayPath) {\n openRegistryFile.innerText = "Open " + registry.registryDisplayPath;\n } else {\n openRegistryFile.innerText = "";\n }\n } catch (e) {\n cmpList.innerHTML = `<p class="error">Error loading components</p><p class="error">${e.message || e}</p>`;\n console.error(e);\n }\n cmpListSection.classList.remove("nav-loading");\n }\n function renderComponentList(shadow, filteredComponents) {\n const cmpList = shadow.getElementById("cmp-list");\n cmpList.innerHTML = "";\n const componentsToRender = filteredComponents || APP_STATE.components;\n const registered = componentsToRender.filter((c) => c.isRegistered);\n const unregistered = componentsToRender.filter((c) => !c.isRegistered);\n if (filteredComponents && filteredComponents.length === 0) {\n const noResults = document.createElement("p");\n noResults.className = "no-results";\n noResults.innerText = "No matching components found";\n cmpList.appendChild(noResults);\n return;\n }\n renderComponentListSection(cmpList, "Registered Components", registered);\n renderComponentListSection(cmpList, "Unregistered Components", unregistered);\n }\n function renderComponentListSection(cmpList, listTitle, cmps) {\n if (cmps.length > 0) {\n const cmpsTitle = document.createElement("h4");\n cmpsTitle.innerText = listTitle;\n cmpList.appendChild(cmpsTitle);\n cmps.forEach((c) => {\n cmpList.appendChild(renderComponentListItem(c));\n });\n }\n }\n function renderComponentListItem(cmp) {\n const searchTerm = document.getElementById("component-search")?.value.toLowerCase();\n const item = document.createElement("button");\n item.dataset.id = cmp.id;\n item.className = "cmp-item nav-list-item";\n if (cmp.isRegistered) {\n item.classList.add("registered");\n }\n const itemIcon = document.createElement("span");\n itemIcon.className = "nav-list-item-icon";\n if (cmp.image) {\n itemIcon.style.backgroundImage = `url(${cmp.image})`;\n }\n item.appendChild(itemIcon);\n const itemName = document.createElement("span");\n itemName.className = "nav-list-item-name";\n itemName.innerHTML = highlightMatches(cmp.name, searchTerm);\n item.appendChild(itemName);\n const itemNote = document.createElement("span");\n itemNote.className = "nav-list-item-note";\n itemNote.innerHTML = highlightMatches(cmp.displayFilePath || "", searchTerm);\n item.appendChild(itemNote);\n return item;\n }\n function highlightMatches(text, searchTerm) {\n if (!searchTerm) return text;\n const regex = new RegExp(`(${searchTerm})`, "gi");\n return text.replace(regex, \'<span class="search-highlight">$1</span>\');\n }\n\n // packages/dev-tools/client/menu/toggle/menu-toggle.ts\n var initMenuToggle = (shadow) => {\n shadow.querySelector(".menu-toggle").addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, true);\n });\n shadow.getElementById("close").addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n });\n shadow.getElementById("hit").addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n });\n initBackButtons(shadow);\n shadow.addEventListener("click", (ev) => ev.stopPropagation());\n checkCTAs(shadow);\n };\n var openMenu = (shadow, openDevToolsMenu) => {\n if (openDevToolsMenu) {\n document.body.classList.add("builder-no-scroll");\n shadow.host.classList.add("show-builder-menu");\n dispatch("menuOpen");\n setCTA("menuOpened");\n track("interaction", {\n type: "click",\n name: "open dev-tools menu"\n });\n } else {\n document.body.classList.remove("builder-no-scroll");\n shadow.host.classList.remove("show-builder-menu");\n dispatch("menuClose");\n setTimeout(() => {\n goToSection(shadow, "nav-home");\n }, 300);\n }\n apiDevToolsEnabled(openDevToolsMenu);\n };\n var checkCTAs = (shadow) => {\n if (!hasCTA("menuOpened")) {\n menuToggleToolTipCta(shadow);\n return;\n }\n const t = getTracking();\n const minutesSinceFirstVisit = (Date.now() - t.firstVisitTs) / 1e3 / 60;\n if (minutesSinceFirstVisit < 10) {\n return;\n }\n if (!hasCTA("feedback")) {\n setCTA("feedback");\n feedbackToolTipCta(shadow);\n return;\n }\n };\n var menuToggleToolTipCta = (shadow) => {\n const tooltip = document.createElement("a");\n tooltip.classList.add("menu-toggle-tooltip");\n tooltip.href = `#open-dev-tools`;\n tooltip.innerHTML = `\n <div class="menu-toggle-tooltip-content">\n <h3>Open Builder Devtools</h3>\n <p>Start registering your components</p>\n </div>\n `;\n shadow.appendChild(tooltip);\n setTimeout(() => {\n tooltip.classList.add("menu-toggle-tooltip-show");\n tooltip.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n tooltip.classList.remove("menu-toggle-tooltip-show");\n openMenu(shadow, true);\n });\n }, 1e3);\n };\n var feedbackToolTipCta = (shadow) => {\n const tooltip = document.createElement("a");\n tooltip.classList.add("menu-toggle-tooltip");\n tooltip.href = `https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform`;\n tooltip.target = "_blank";\n tooltip.innerHTML = `\n <div class="menu-toggle-tooltip-content">\n <h3>How\'s Devtools working for you?</h3>\n <p>We\'d love your feedback!</p>\n </div>\n `;\n shadow.appendChild(tooltip);\n setTimeout(() => {\n tooltip.classList.add("menu-toggle-tooltip-show");\n tooltip.addEventListener("click", () => {\n tooltip.classList.remove("menu-toggle-tooltip-show");\n });\n }, 1e3);\n };\n\n // packages/dev-tools/client/menu/pages/home.ts\n function initHomeSection(shadow) {\n const goToBuilder = shadow.getElementById("go-to-builder");\n goToBuilder.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n window.open(getEditorUrl(), "builder");\n });\n const componentsLink = shadow.getElementById("components-link");\n componentsLink.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const cmpList = shadow.querySelector(\n ".nav-cmp-list .section-content"\n );\n cmpList.scrollTop = 0;\n goToSection(shadow, "nav-cmp-list");\n loadComponentsSection(shadow);\n });\n const settingsLink = shadow.getElementById("settings-link");\n settingsLink.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n goToSection(shadow, "nav-settings");\n });\n const addPageLink = shadow.getElementById("add-page-link");\n addPageLink.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n window.open(getBuilderContentUrl(), "builder");\n });\n const importFromFigma = shadow.getElementById("import-from-figma");\n importFromFigma.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n window.open(\n "https://www.figma.com/community/plugin/747985167520967365/builder-io-ai-powered-figma-to-code-react-vue-tailwind-more"\n );\n });\n }\n\n // packages/dev-tools/client/menu/pages/settings.ts\n function initSettingsSection(shadow) {\n const s = shadow.getElementById("enable-edit");\n s.addEventListener("change", (ev) => {\n ev.stopPropagation();\n enableEdit(s.checked);\n });\n s.checked = isEditEnabled();\n enableEdit(s.checked);\n }\n\n // packages/dev-tools/client/menu/index.ts\n var BuilderDevToolsMenu = class extends HTMLElement {\n constructor() {\n super();\n }\n connectedCallback() {\n const shadow = this.attachShadow({ mode: "open" });\n shadow.innerHTML = `<style>/* packages/dev-tools/client/common.css */\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n:host {\n --background-color: rgba(40, 40, 40, 1);\n --primary-color: rgba(72, 161, 255, 1);\n --primary-color-subdued: rgb(72, 161, 255, 0.6);\n --primary-color-highlight: rgb(126, 188, 255);\n --primary-contrast-color: white;\n --edit-color: #1d74e2;\n --edit-color-highlight: #1c6bd1;\n --edit-color-alpha: rgb(72, 161, 255, 0.15);\n --error-color: #ff2b55;\n --text-color: white;\n --text-color-highlight: white;\n --border-color: #454545;\n --button-background-color-hover: rgba(255, 255, 255, 0.1);\n --menu-width: 320px;\n --transition-time: 150ms;\n --font-family:\n ui-sans-serif,\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n "Helvetica Neue",\n Arial,\n "Noto Sans",\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji";\n font-family: var(--font-family);\n line-height: 1.6;\n}\nbutton {\n cursor: pointer;\n color: var(--text-color);\n -webkit-tap-highlight-color: transparent;\n}\ninput,\nselect,\nbutton {\n font-family: var(--font-family);\n}\n\n/* packages/dev-tools/client/menu/toggle/menu-toggle.css */\n.menu-toggle {\n position: absolute;\n right: 0;\n bottom: 0;\n pointer-events: auto;\n padding: 8px;\n background: transparent;\n border: none;\n appearance: none;\n}\n.menu-toggle div {\n position: relative;\n width: 64px;\n height: 64px;\n pointer-events: none;\n border-radius: 50%;\n background: black;\n border: 1px solid white;\n box-shadow: rgba(0, 0, 0, 33%) 0px 0 8px;\n}\n.menu-toggle:hover div {\n background-color: var(--background-color);\n border: 1px solid rgb(220, 220, 220);\n}\n.menu-toggle svg {\n position: absolute;\n top: 15px;\n left: 15px;\n width: 33px;\n height: 32px;\n}\ndiv.highlight-bg {\n position: absolute;\n top: -1px;\n left: -1px;\n background-color: rgb(26, 26, 26);\n pointer-events: none;\n transition: all 400ms ease-out;\n opacity: 0;\n}\n.menu-toggle-highlight-no-transition div.highlight-bg {\n transition: none;\n}\n.menu-toggle-highlight div.highlight-bg {\n opacity: 1;\n}\n.menu-toggle-tooltip {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 382px;\n height: 72px;\n padding: 0;\n text-align: left;\n appearance: none;\n background-color: transparent;\n border: none;\n pointer-events: none;\n transform: translate3d(320px, 0, 0);\n opacity: 0;\n transition: all 150ms ease-in-out;\n color: white;\n}\n.menu-toggle-tooltip.menu-toggle-tooltip-show {\n pointer-events: auto;\n opacity: 1;\n transform: translate3d(0, 0, 0);\n}\n.menu-toggle-tooltip-content {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 10px;\n right: 95px;\n padding: 8px 12px;\n background-color: var(--primary-color);\n box-shadow: rgba(0, 0, 0, 33%) 0px 0 20px;\n border-radius: 2px;\n}\n.menu-toggle-tooltip-content::before {\n content: "";\n position: absolute;\n bottom: 15px;\n right: -6px;\n width: 30px;\n height: 30px;\n background-color: var(--primary-color);\n transform: rotate(45deg);\n}\n.menu-toggle-tooltip:hover .menu-toggle-tooltip-content,\n.menu-toggle-tooltip:hover .menu-toggle-tooltip-content::before {\n background-color: var(--primary-color-highlight);\n}\n.menu-toggle-tooltip-content h3 {\n margin: 0;\n font-size: 16px;\n}\n.menu-toggle-tooltip-content p {\n margin: 0;\n font-size: 12px;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-page.css */\nsection {\n position: absolute;\n display: grid;\n grid-template-rows: 64px auto 64px;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n padding: 0;\n pointer-events: none;\n}\n.section-content {\n margin: 0;\n padding: 0 0 10px 0;\n font-weight: 300;\n transform: translate3d(105%, 0, 0);\n transition: transform var(--transition-time) ease-in-out;\n overflow-y: auto;\n}\n.section-content .error {\n color: var(--error-color);\n font-weight: bold;\n}\nsection a {\n text-decoration: none;\n color: var(--text-color);\n}\nsection h3,\nsection p {\n margin-left: 16px;\n margin-right: 16px;\n}\n.info {\n font-size: 12px;\n}\nul.list {\n list-style: none;\n padding: 0;\n margin: 0;\n}\nul.list li {\n display: block;\n padding: 0;\n margin: 0;\n}\nul.list a,\nul.list button {\n display: grid;\n grid-template-columns: 24px auto;\n grid-gap: 16px;\n padding: 12px;\n margin: 8px 0;\n border: none;\n background: transparent;\n appearance: none;\n width: 100%;\n font-weight: 300;\n text-align: left;\n text-decoration: none;\n color: var(--text-color);\n}\nul.list a:hover,\nul.list button:hover {\n text-decoration: none;\n color: var(--text-color);\n background-color: var(--button-background-color-hover);\n}\nul.list a span,\nul.list button span {\n display: block;\n font-size: 16px;\n font-weight: 500;\n line-height: 1.5;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-header.css */\nheader {\n position: relative;\n display: grid;\n grid-template-columns: 44px 1fr;\n gap: 8px;\n padding-left: 8px;\n border-bottom: 1px solid var(--border-color);\n transition: opacity var(--transition-time) ease-in-out;\n opacity: 0;\n pointer-events: none;\n}\nheader > div {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.nav-home header > div {\n margin-right: 56px;\n}\nheader h2 {\n margin: 7px 0 0 0;\n font-size: 18px;\n font-weight: 500;\n line-height: 1.5;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\nheader p {\n margin: 2px 0 0 0;\n font-size: 12px;\n font-weight: 300;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\nheader p button {\n display: block;\n margin: 0;\n padding: 0;\n width: 100%;\n text-align: left;\n font-size: 12px;\n font-weight: 300;\n text-decoration: none;\n appearance: none;\n text-align: left;\n background-color: transparent;\n border: none;\n color: var(--primary-color);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\nheader p button:hover {\n text-decoration: underline;\n color: var(--primary-color);\n}\n.builder-logo {\n margin: 12px 0 0 8px;\n}\n#close {\n display: block;\n position: absolute;\n appearance: none;\n background: transparent;\n border: none;\n border-radius: 50%;\n margin: 0;\n padding: 0;\n right: 4px;\n top: 8px;\n width: 48px;\n height: 48px;\n z-index: 1;\n opacity: 0.7;\n}\n#close:hover {\n opacity: 1;\n background-color: var(--button-background-color-hover);\n}\n#close svg {\n position: absolute;\n top: 12px;\n left: 12px;\n width: 24px;\n height: 24px;\n fill: currentColor;\n pointer-events: none;\n}\n.back-button {\n position: relative;\n display: block;\n margin: 7px 0 0 -2px;\n width: 48px;\n height: 48px;\n background: transparent;\n border: none;\n appearance: none;\n border-radius: 50%;\n}\n.back-button:hover {\n background-color: var(--button-background-color-hover);\n}\n.back-button svg {\n position: absolute;\n top: 12px;\n left: 12px;\n width: 24px;\n height: 24px;\n fill: currentColor;\n pointer-events: none;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-footer.css */\nfooter {\n border-top: 1px solid var(--border-color);\n transition: opacity var(--transition-time) ease-in-out;\n opacity: 0;\n pointer-events: none;\n}\nsection.nav-cmp-list {\n grid-template-rows: 64px auto 120px;\n}\nfooter a {\n text-decoration: underline;\n color: var(--primary-color);\n}\nfooter a:hover {\n color: var(--primary-color);\n text-decoration: none;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-nav-list.css */\n.nav-list {\n padding: 2px 0;\n}\n.nav-loading {\n pointer-events: none;\n}\n.nav-loading-icon {\n position: absolute;\n display: inline-block;\n top: 170px;\n left: 0;\n width: 100%;\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n opacity: 0;\n transition: all 50ms ease-in-out;\n transition-delay: 50ms;\n pointer-events: none;\n}\n.nav-loading .nav-loading-icon {\n opacity: 0.5;\n}\n.nav-list h4 {\n margin: 8px 8px 8px 10px;\n font-size: 14px;\n font-weight: 600;\n}\n.nav-list .nav-list-item + h4 {\n margin-top: 30px;\n}\n.nav-list-item {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 8px;\n position: relative;\n margin: 2px 0;\n padding: 8px 28px 8px 46px;\n width: 100%;\n font-size: 14px;\n font-weight: 300;\n text-align: left;\n border: none;\n background: transparent;\n appearance: none;\n}\n.nav-list-item:hover {\n background-color: var(--button-background-color-hover);\n}\n.nav-list-item-icon {\n position: absolute;\n top: 4px;\n left: 10px;\n width: 24px;\n height: 24px;\n object-fit: contain;\n filter: invert(100%);\n background-size: 24px 24px;\n background-repeat: no-repeat;\n background-position: center center;\n}\n.nav-list-item span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n pointer-events: none;\n}\n.nav-list-item::after {\n display: block;\n position: absolute;\n content: "";\n background-image: url(\'data:image/svg+xml,<svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L1 13" stroke="%23F2F2F2" stroke-opacity="0.5" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>\');\n background-repeat: no-repeat;\n background-position: 12px 9px;\n top: 0;\n right: 0;\n width: 32px;\n height: 32px;\n pointer-events: none;\n}\n.nav-list-item-note {\n opacity: 0;\n font-size: 12px;\n padding-top: 1px;\n text-align: right;\n}\n.nav-list-item:hover .nav-list-item-note {\n opacity: 0.5;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-select.css */\n.ui-select {\n display: block;\n margin: 8px 0 16px 0;\n padding: 8px 16px 8px 16px;\n cursor: pointer;\n}\n.ui-select h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.ui-select p {\n margin: 8px 0 8px 0;\n font-size: 12px;\n font-weight: 300;\n}\n.ui-select .select {\n position: relative;\n margin: 8px 0 8px 0;\n border-radius: 4px;\n padding: 0;\n line-height: 1.1;\n overflow: hidden;\n border: 1px solid var(--border-color);\n}\n.ui-select select {\n appearance: none;\n background-color: transparent;\n border: none;\n outline: none;\n padding: 8px 32px 8px 8px;\n margin: 0;\n width: 100%;\n font-size: 14px;\n cursor: pointer;\n text-overflow: ellipsis;\n opacity: 0.6;\n color: var(--text-color);\n}\n.ui-select .select::after {\n content: "";\n top: 6px;\n right: 5px;\n width: 24px;\n height: 24px;\n position: absolute;\n background-image: url(\'data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23F2F2F2" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/></svg>\');\n background-repeat: no-repeat;\n background-position: center;\n pointer-events: none;\n opacity: 0.6;\n}\n.ui-select .select:hover {\n border-color: var(--primary-color-subdued);\n}\n.ui-text-input .select:focus-within {\n border-color: var(--primary-color);\n}\n.ui-text-input .select:focus-within select {\n opacity: 1;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-spinner.css */\n.spinner:after {\n content: " ";\n display: block;\n width: 32px;\n height: 32px;\n margin: 0 auto;\n pointer-events: auto;\n border-radius: 50%;\n border: 3px solid var(--text-color);\n border-color: var(--text-color) transparent var(--text-color) transparent;\n animation: spinner 750ms linear infinite;\n}\n@keyframes spinner {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n/* packages/dev-tools/client/menu/ui/ui-switch.css */\n.ui-switch {\n display: grid;\n grid-template-columns: auto 48px;\n grid-gap: 20px;\n margin: 8px 0 16px 0;\n padding: 8px 0 8px 16px;\n cursor: pointer;\n}\n.ui-switch > * {\n pointer-events: none;\n}\n.ui-switch input {\n display: none;\n visibility: hidden;\n}\n.ui-switch .switcher {\n display: inline-block;\n border-radius: 100px;\n width: 35px;\n height: 14px;\n background-color: #ccc;\n position: relative;\n top: 6px;\n vertical-align: middle;\n cursor: pointer;\n}\n.ui-switch input[type=checkbox]:checked + .switcher {\n background-color: var(--primary-color-subdued);\n}\n.ui-switch .switcher:before {\n content: "";\n display: block;\n width: 20px;\n height: 20px;\n background-color: var(--text-color);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n position: absolute;\n top: -3px;\n left: 0;\n margin-right: 0;\n transition: all 150ms;\n}\n.ui-switch input[type=checkbox]:checked + .switcher:before {\n left: 100%;\n margin-left: -20px;\n background-color: var(--primary-color);\n}\n.ui-switch h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.ui-switch p {\n margin: 4px 0 0 0;\n font-size: 12px;\n font-weight: 300;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-text-input.css */\n.ui-text-input {\n display: block;\n margin: 8px 0 16px 0;\n padding: 8px 16px 8px 16px;\n cursor: pointer;\n}\n.ui-text-input h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.ui-text-input p {\n margin: 8px 0 8px 0;\n font-size: 12px;\n font-weight: 300;\n}\n.ui-text-input .input {\n position: relative;\n margin: 8px 0 8px 0;\n border: 1px solid var(--border-color);\n border-radius: 4px;\n background: transparent;\n padding: 2px;\n overflow: hidden;\n}\n.ui-text-input input {\n display: block;\n width: 235px;\n font-size: 14px;\n border: none;\n background: transparent;\n padding: 6px;\n appearance: none;\n color: var(--text-color);\n opacity: 0.6;\n outline: none;\n}\n.ui-text-input .input:hover {\n border-color: var(--primary-color-subdued);\n}\n.ui-text-input .input:focus-within {\n border-color: var(--primary-color);\n}\n.ui-text-input .input:focus-within input {\n opacity: 1;\n}\n.ui-text-input .input::after {\n content: "";\n position: absolute;\n top: 5px;\n right: 14px;\n width: 8px;\n height: 17px;\n border: 2px solid rgba(51, 181, 51, 1);\n border-top: none;\n border-left: none;\n transform: rotate(45deg);\n opacity: 0;\n transition: opacity 80ms ease-in-out;\n pointer-events: none;\n}\n.ui-text-input.saved .input::after {\n opacity: 1;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-toast.css */\n.ui-toast {\n position: fixed;\n bottom: 8px;\n left: 8px;\n right: 8px;\n padding: 6px 12px;\n font-size: 14px;\n border-radius: 4px;\n transform: translate3d(0, 150%, 0);\n opacity: 0;\n transition: all var(--transition-time) ease-in-out;\n background-color: var(--primary-color-subdued);\n color: var(--text-color);\n pointer-events: none;\n}\n.ui-toast.ui-toast-show {\n transform: translate3d(0, 0, 0);\n opacity: 1;\n pointer-events: auto;\n}\n\n/* packages/dev-tools/client/menu/nav.css */\n[data-view=nav-home] .nav-home .section-content,\n[data-view=nav-cmp-list] .nav-cmp-list .section-content,\n[data-view=nav-cmp-detail] .nav-cmp-detail .section-content,\n[data-view=nav-cmp-input] .nav-cmp-input .section-content,\n[data-view=nav-settings] .nav-settings .section-content {\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n}\n[data-view=nav-home] .nav-home header,\n[data-view=nav-home] .nav-home footer,\n[data-view=nav-cmp-list] .nav-cmp-list header,\n[data-view=nav-cmp-list] .nav-cmp-list footer,\n[data-view=nav-cmp-detail] .nav-cmp-detail header,\n[data-view=nav-cmp-detail] .nav-cmp-detail footer,\n[data-view=nav-cmp-input] .nav-cmp-input header,\n[data-view=nav-cmp-input] .nav-cmp-input footer,\n[data-view=nav-settings] .nav-settings header,\n[data-view=nav-settings] .nav-settings footer {\n opacity: 1;\n pointer-events: auto;\n}\n[data-view=nav-cmp-list] .nav-home .section-content,\n[data-view=nav-cmp-detail] .nav-home .section-content,\n[data-view=nav-cmp-detail] .nav-cmp-list .section-content,\n[data-view=nav-cmp-input] .nav-home .section-content,\n[data-view=nav-cmp-input] .nav-cmp-list .section-content,\n[data-view=nav-cmp-input] .nav-cmp-detail .section-content,\n[data-view=nav-settings] .nav-home .section-content {\n transform: translate3d(-105%, 0, 0);\n}\n\n/* packages/dev-tools/client/menu/pages/component-list.css */\n.cmp-item .nav-list-item-icon {\n background-image: url(\'data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20.83 16.809C20.94 16.561 21 16.289 21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L7.988 3.99001M5.441 5.44801L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L18.544 18.56" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.532 10.538L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.27002 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 3L21 21" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>\');\n opacity: 0.3;\n}\n.cmp-item.registered .nav-list-item-icon {\n background-image: url(\'data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /></svg>\');\n opacity: 0.8;\n}\n.search-highlight {\n background-color: var(--primary-color-alpha);\n padding: 0 2px;\n border-radius: 2px;\n font-weight: 500;\n}\n.search-container {\n position: sticky;\n top: 0;\n z-index: 10;\n padding: 12px 16px;\n background: var(--background-color);\n border-bottom: 1px solid var(--border-color);\n}\n.search-input-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n}\n.search-icon {\n position: absolute;\n left: 12px;\n color: var(--text-color-secondary);\n pointer-events: none;\n}\n.component-search-input {\n width: 100%;\n height: 36px;\n padding: 8px 36px;\n border: 1px solid var(--border-color);\n border-radius: 6px;\n background: var(--input-background);\n color: var(--text-color);\n font-size: 14px;\n transition: border-color 0.2s, box-shadow 0.2s;\n}\n.component-search-input:focus {\n outline: none;\n border-color: var(--primary-color);\n box-shadow: 0 0 0 2px var(--primary-color-alpha);\n}\n.component-search-input::placeholder {\n color: var(--text-color-tertiary);\n}\n.clear-search-button {\n position: absolute;\n right: 8px;\n padding: 4px;\n color: var(--text-color-secondary);\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.2s, background-color 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.clear-search-button:hover {\n background-color: var(--hover-color);\n}\n.component-search-input:not(:placeholder-shown) + .clear-search-button {\n opacity: 1;\n}\n.no-results {\n padding: 32px 16px;\n text-align: center;\n color: var(--text-color-secondary);\n font-size: 14px;\n}\n\n/* packages/dev-tools/client/menu/pages/component-detail.css */\n#cmp-detail {\n position: relative;\n}\n.cmp-loading {\n pointer-events: none !important;\n}\n.cmp-loading-icon {\n position: absolute;\n display: inline-block;\n top: 170px;\n left: 0;\n width: 100%;\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n opacity: 0;\n transition: all 50ms ease-in-out;\n transition-delay: 50ms;\n pointer-events: none;\n}\n.cmp-loading .cmp-loading-icon {\n opacity: 0.5;\n}\n.cmp-cover {\n position: absolute;\n top: 160px;\n left: 0;\n width: 100%;\n height: 100vh;\n background: var(--background-color);\n transform: translate3d(0, 0, 0);\n pointer-events: none;\n display: none;\n}\n[data-view=nav-cmp-detail] .cmp-cover {\n display: block;\n pointer-events: auto;\n}\n.cmp-enabled .cmp-cover {\n transform: translate3d(0, 105%, 0);\n pointer-events: none;\n}\n.section-ready .cmp-cover {\n transition: all var(--transition-time) ease-in-out;\n}\n.cmp-detail-inputs-container {\n margin: 8px 0 16px 0;\n padding: 0;\n}\n.cmp-detail-inputs-container h3 {\n margin: 0 0 6px 0;\n padding-left: 16px;\n padding-right: 8px;\n font-size: 14px;\n font-weight: 500;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.cmp-detail-inputs-reload {\n font-weight: 300;\n font-size: 0.9em;\n text-decoration: none;\n appearance: none;\n text-align: left;\n background-color: transparent;\n border: none;\n color: var(--primary-color);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.cmp-detail-inputs-reload:hover {\n text-decoration: underline;\n color: var(--primary-color);\n}\n.cmp-detail-inputs-container .cmp-inputs-empty {\n padding: 0;\n margin-top: 12px;\n font-size: 12px;\n font-weight: 300;\n opacity: 0.5;\n font-style: italic;\n}\n.cmp-detail-inputs-container .nav-list-item-icon {\n opacity: 0.8;\n background-size: 20px 20px;\n background-position: 4px center;\n}\n.input-icon {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path></svg>\');\n}\n.input-icon-array {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-6a2 2 0 1 1 4 0v6"></path> <path d="M10 13h4"></path></svg>\');\n}\n.input-icon-boolean {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16h2a2 2 0 1 0 0 -4h-2h2a2 2 0 1 0 0 -4h-2v8z"></path></svg>\');\n}\n.input-icon-number {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-8l4 8v-8"></path></svg>\');\n}\n.input-icon-object {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"></path></svg>\');\n}\n.input-icon-string {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"></path></svg>\');\n}\n.cmp-input-item-unregistered {\n opacity: 0.4;\n}\n.cmp-input-item-unregistered .input-icon::after {\n content: "";\n position: absolute;\n top: 11px;\n left: 4px;\n width: 20px;\n height: 2px;\n background-color: black;\n transform: rotate(-45deg);\n}\n\n/* packages/dev-tools/client/menu/pages/component-input.css */\n.cmp-prop-info {\n border-bottom: 1px solid var(--border-color);\n}\n.cmp-input-readonly {\n margin: 16px 0;\n padding: 0 16px;\n display: grid;\n grid-template-columns: 50% 50%;\n gap: 12px;\n}\n.cmp-input-readonly h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.cmp-input-readonly span {\n margin-top: 2px;\n font-size: 12px;\n font-weight: 300;\n opacity: 0.8;\n}\n.cmp-input-detail {\n margin: 16px 0;\n}\n.cmp-input-detail a {\n color: var(--primary-color);\n text-decoration: none;\n}\n.cmp-input-detail a:hover {\n text-decoration: underline;\n}\n.input-cover {\n position: absolute;\n top: 175px;\n left: 0;\n width: 100%;\n height: 100%;\n background: var(--background-color);\n transform: translate3d(0, 0, 0);\n transition: all var(--transition-time) ease-in-out;\n pointer-events: auto;\n}\n.input-enabled .input-cover {\n transform: translate3d(0, 105%, 0);\n pointer-events: none;\n}\n.input-loading-icon {\n position: absolute;\n display: inline-block;\n top: 190px;\n left: 0;\n width: 100%;\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n opacity: 0;\n transition: all 50ms ease-in-out;\n transition-delay: 50ms;\n pointer-events: none;\n}\n.input-loading .input-loading-icon {\n opacity: 0.5;\n}\n\n/* packages/dev-tools/client/menu/menu.css */\n:host {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 2147483646;\n user-select: none;\n pointer-events: none;\n color: var(--text-color);\n}\naside {\n position: absolute;\n top: 0;\n right: 0;\n width: var(--menu-width);\n height: 100%;\n transform: translate3d(105%, 0, 0);\n transition: transform var(--transition-time) ease-in-out;\n background: var(--background-color);\n box-shadow: #000000c9 5px 0 20px;\n overflow: hidden;\n z-index: 1;\n}\n:host(.show-builder-menu) aside {\n pointer-events: auto;\n transform: translate3d(0, 0, 0);\n}\n#hit {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: none;\n}\n:host(.show-builder-menu) #hit {\n display: block;\n pointer-events: auto;\n}\n#version {\n position: absolute;\n bottom: 6px;\n right: 6px;\n font-size: 8px;\n color: #9b9b9b;\n}</style><div id="hit"></div> <aside data-view="nav-home"> <section class="nav-home"> <header> <svg class="builder-logo" viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> <div> <h2 class="builder-home-title">Builder Devtools</h2> <p><button id="go-to-builder">Go to Builder</button></p> </div> <button id="close" aria-label="Close Menu"> <svg viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M18 6l-12 12" /> <path d="M6 6l12 12" /> </svg> </button> </header> <div class="section-content"> <ul class="list"> <li> <button id="components-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Components</span> </button> </li> <li> <button id="settings-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Settings</span> </button> </li> <li> <button id="add-page-link"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M14 3v4a1 1 0 0 0 1 1h4" /> <path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /> <path d="M12 11l0 6" /> <path d="M9 14l6 0" /> </svg> <span>Add Builder Page</span> </button> </li> <li> <button id="import-from-figma"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-figma" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M15 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" /> <path d="M6 3m0 3a3 3 0 0 1 3 -3h6a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-6a3 3 0 0 1 -3 -3z" /> <path d="M9 9a3 3 0 0 0 0 6h3m-3 0a3 3 0 1 0 3 3v-15" /> </svg> <span>Import From Figma</span> </button> </li> </ul> </div> <footer> <ul class="list"> <li> <a href="https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform" target="_blank" > <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M11.013 17.0114L10.013 18.0114L2.513 10.5834C2.0183 10.102 1.62864 9.52342 1.36854 8.88404C1.10845 8.24466 0.983558 7.55836 1.00173 6.86834C1.01991 6.17832 1.18076 5.49954 1.47415 4.87474C1.76755 4.24994 2.18713 3.69266 2.70648 3.23799C3.22583 2.78331 3.8337 2.4411 4.49181 2.23289C5.14991 2.02468 5.844 1.95499 6.53036 2.02821C7.21673 2.10143 7.8805 2.31596 8.47987 2.65831C9.07925 3.00066 9.60124 3.46341 10.013 4.01741C10.8086 2.95654 11.9931 2.2552 13.3059 2.06766C14.6186 1.88012 15.9521 2.22176 17.013 3.01741C18.0739 3.81306 18.7752 4.99755 18.9627 6.3103C19.1503 7.62305 18.8086 8.95654 18.013 10.0174" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> <path d="M18.2006 19.8175L16.0286 20.9555C15.9642 20.989 15.8917 21.004 15.8192 20.9987C15.7467 20.9934 15.6771 20.9681 15.6182 20.9256C15.5593 20.8831 15.5134 20.825 15.4855 20.7579C15.4577 20.6907 15.4491 20.6172 15.4606 20.5455L15.8756 18.1345L14.1186 16.4275C14.0662 16.3768 14.0291 16.3123 14.0115 16.2416C13.9939 16.1708 13.9966 16.0965 14.0192 16.0271C14.0418 15.9578 14.0835 15.8962 14.1394 15.8494C14.1954 15.8026 14.2634 15.7725 14.3356 15.7625L16.7636 15.4105L17.8496 13.2175C17.8821 13.1521 17.9322 13.0972 17.9942 13.0588C18.0562 13.0204 18.1277 13 18.2006 13C18.2736 13 18.3451 13.0204 18.4071 13.0588C18.4691 13.0972 18.5191 13.1521 18.5516 13.2175L19.6376 15.4105L22.0656 15.7625C22.1377 15.7728 22.2054 15.8031 22.2611 15.85C22.3168 15.8968 22.3583 15.9583 22.3809 16.0275C22.4034 16.0967 22.4062 16.1708 22.3888 16.2415C22.3715 16.3122 22.3347 16.3766 22.2826 16.4275L20.5256 18.1345L20.9396 20.5445C20.9521 20.6163 20.9441 20.6902 20.9166 20.7578C20.8891 20.8254 20.8433 20.8839 20.7842 20.9267C20.7252 20.9695 20.6553 20.9949 20.5825 21C20.5098 21.005 20.4371 20.9896 20.3726 20.9555L18.2006 19.8175Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Give Feedback</span> </a> </li> </ul> <div id="version"></div> </footer> </section> <section class="nav-cmp-list"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div class="search-container"> <div class="search-input-wrapper"> <svg class="search-icon" viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M15.5 15.5L20 20M10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 13.866 13.866 17 10 17Z" /> </svg> <input type="text" id="component-search" class="component-search-input" placeholder="Search components..." autocomplete="off" spellcheck="false" /> <button id="clear-search" class="clear-search-button" type="button" aria-label="Clear search" > <svg viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M6 6l12 12M6 18L18 6" /> </svg> </button> </div> </div> <div> <h2>Custom Components</h2> <p> <button id="open-builder-registry"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-list" class="cmp-list nav-list"></div> </div> <div class="nav-loading-icon spinner"></div> <footer> <p class="info"> Expand on Builder\'s selection of built-in blocks by <a target="_blank" href="https://www.builder.io/c/docs/custom-components-intro" >registering components</a > from your codebase. This way, teammates can drag and drop your components within Builder\'s Visual Editor just like any other block. </p> </footer> </section> <section class="nav-cmp-detail"> <header> <button class="back-button" data-back="nav-cmp-list"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-detail-title"></h2> <p> <button id="cmp-open-source"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-error"></div> <label class="ui-switch"> <div> <h3>Register Component</h3> <p> Registers this component so it can be used within Builder Visual CMS </p> </div> <input type="checkbox" role="switch" id="cmp-register" /> <span class="switcher"></span> </label> <div id="cmp-detail"> <label class="ui-text-input"> <h3>Component Name</h3> <div class="input"> <input type="text" id="cmp-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="2" maxlength="30" required placeholder="e.g. My Counter" /> </div> <p> Unique name to identify this custom component within Builder. Press ESC to cancel </p> </label> <div class="cmp-detail-inputs-container"> <h3> <span>Builder Inputs (Props)</span> <button class="cmp-detail-inputs-reload" id="btn-inputs-reload"> Reload </button> </h3> <div id="cmp-detail-inputs"></div> </div> </div> </div> <div class="cmp-cover"></div> <div class="cmp-loading-icon spinner"></div> </section> <section class="nav-cmp-input"> <header> <button class="back-button" data-back="nav-cmp-detail"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-input-title"></h2> <p> <button id="input-open-source"></button> </p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable Input</h3> <p>Add this component prop as a Builder input</p> </div> <input type="checkbox" role="switch" id="input-register" /> <span class="switcher"></span> </label> <div class="cmp-prop-info"> <div class="cmp-input-readonly"> <h3>Prop Name</h3> <span id="cmp-prop-name"></span> </div> <div class="cmp-input-readonly"> <h3>Prop Type</h3> <span id="cmp-prop-type"></span> </div> </div> <div class="cmp-input-detail"> <label class="ui-text-input"> <h3>Builder Input Name</h3> <div class="input"> <input type="text" id="input-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="1" maxlength="30" required placeholder="e.g. Text" /> </div> <p> Friendly name to identify this component prop as a Builder input. Press ESC to cancel </p> </label> <label class="ui-select"> <h3>Builder Input Type</h3> <div class="select"> <select id="input-type"></select> </div> <p> Correlate to what editing UI is appropriate for this Builder input. <a href="https://www.builder.io/c/docs/custom-components-input-types" target="_blank" >Read more about input types.</a > </p> </label> </div> <div class="input-cover"></div> <div class="input-loading-icon spinner"></div> </div> </section> <section class="nav-settings"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2>Settings</h2> <p>Configure Builder\'s Devtools</p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable edit button in UI</h3> <p>Enables the edit button so you can edit content in Builder</p> </div> <input type="checkbox" role="switch" id="enable-edit" /> <span class="switcher"></span> </label> </div> </section> <div class="ui-toast" id="toast"></div> </aside> <button class="menu-toggle" aria-label="Toggle Builder Devtools"> <div> <div class="highlight-bg"></div> <svg viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> </div> </button>`;\n initMenuToggle(shadow);\n initHomeSection(shadow);\n initComponentListSection(shadow);\n initComponentDetailSection(shadow);\n initComponentInputSection(shadow);\n initSettingsSection(shadow);\n this.setAttribute("aria-hidden", "true");\n shadow.getElementById("version").textContent = "v1.18.44-dev.202512111428.dadde891f";\n }\n highlightOpener() {\n const menuToggle = this.shadowRoot.querySelector(".menu-toggle");\n menuToggle.classList.add("menu-toggle-highlight");\n menuToggle.classList.add("menu-toggle-highlight-no-transition");\n setTimeout(() => {\n menuToggle.classList.remove("menu-toggle-highlight-no-transition");\n setTimeout(() => {\n menuToggle.classList.remove("menu-toggle-highlight");\n }, 20);\n }, 20);\n }\n };\n\n // packages/dev-tools/client/setup-ui/overview.ts\n var STEP_CSS = `<style>/* packages/dev-tools/client/setup-ui/styles.css */\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\nhtml,\nbody,\n:host {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n z-index: 2147483646;\n margin: 0;\n padding: 0;\n line-height: 1.8;\n font-family:\n ui-sans-serif,\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n "Helvetica Neue",\n Arial,\n "Noto Sans",\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji";\n background-color: rgba(37, 37, 37, 1);\n color: white;\n transition: opacity 250ms ease-in-out;\n}\n:host([aria-hidden="true"]) {\n opacity: 0;\n pointer-events: none;\n}\nmain {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n}\nh1 {\n margin-top: 0;\n font-size: 24px;\n font-weight: 300;\n line-height: 1.4;\n}\np {\n margin: 20px 0;\n font-weight: 300;\n}\nbutton {\n cursor: pointer;\n}\naside {\n position: absolute;\n top: 0;\n left: 0;\n width: 350px;\n height: 100vh;\n padding: 60px 0 0 50px;\n background-color: rgba(18, 18, 18, 1);\n}\naside ul {\n margin: 30px 0 0 0px;\n padding: 0;\n list-style: none;\n}\naside li {\n position: relative;\n margin: 0;\n padding: 20px 10px;\n font-weight: 300;\n}\naside li.highlight {\n color: rgba(72, 161, 255, 1);\n}\naside li.active {\n font-weight: 700;\n}\naside li .circle {\n position: absolute;\n top: 20px;\n left: 10px;\n width: 24px;\n height: 24px;\n border: 3px solid white;\n border-radius: 50%;\n font-size: 14px;\n}\naside li.highlight .circle {\n border-color: rgba(72, 161, 255, 1);\n}\naside li.active .circle::after {\n content: "";\n position: absolute;\n top: 3px;\n left: 3px;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n background-color: rgba(72, 161, 255, 1);\n}\naside li.completed .circle {\n background-color: rgba(72, 161, 255, 1);\n}\naside li.completed .circle::after {\n content: "";\n position: absolute;\n top: 2px;\n left: 6px;\n width: 6px;\n height: 13px;\n border: 3px solid black;\n border-top: none;\n border-left: none;\n transform: rotate(45deg);\n}\naside li .line {\n position: absolute;\n top: 44px;\n left: 21px;\n width: 3px;\n height: 45px;\n background-color: white;\n}\naside li.completed .line {\n background-color: rgba(72, 161, 255, 1);\n}\naside li span {\n display: block;\n margin-left: 44px;\n}\nnav {\n margin-top: 30px;\n}\nsection {\n position: absolute;\n top: 135px;\n left: 350px;\n padding: 0 80px 0 140px;\n transition: opacity 150ms ease-in-out;\n}\nsection[aria-hidden=true] {\n pointer-events: none;\n opacity: 0;\n}\nsection h1,\nsection p {\n min-width: 300px;\n max-width: 600px;\n}\n.button {\n position: relative;\n display: inline-block;\n color: white;\n background-color: rgba(72, 161, 255, 1);\n border-radius: 4px;\n text-decoration: none;\n padding: 10px 40px 10px 20px;\n white-space: nowrap;\n}\n.button:hover {\n background-color: rgba(72, 161, 255, 0.85);\n}\n#button-icon {\n position: absolute;\n top: 1px;\n right: 5px;\n bottom: 0;\n width: 30px;\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="white" stroke-linecap="square" stroke-miterlimit="10" stroke-width="48" d="M184 112l144 144-144 144"/></svg>\');\n background-repeat: no-repeat;\n background-position: center;\n background-size: 24px 24px;\n}\n.button[aria-disabled=true] {\n opacity: 0.9;\n background-color: rgba(255, 255, 255, 0.3);\n pointer-events: none;\n padding-right: 60px;\n}\n.button[aria-disabled=true] #button-icon {\n top: 21px;\n right: 29px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background: white;\n color: white;\n animation: dot-flashing 0.5s infinite linear alternate;\n animation-delay: 0.25s;\n}\n.button[aria-disabled=true] #button-icon::before,\n.button[aria-disabled=true] #button-icon::after {\n content: "";\n display: inline-block;\n position: absolute;\n top: 0;\n}\n.button[aria-disabled=true] #button-icon::before {\n left: -12px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background-color: white;\n color: white;\n animation: dot-flashing 0.5s infinite alternate;\n animation-delay: 0s;\n}\n.button[aria-disabled=true] #button-icon::after {\n left: 12px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background-color: white;\n color: white;\n animation: dot-flashing 0.5s infinite alternate;\n animation-delay: 0.5s;\n}\n@keyframes dot-flashing {\n 0% {\n background-color: white;\n }\n 50%, 100% {\n background-color: rgba(255, 255, 255, 0.3);\n }\n}\n.logo {\n margin-left: 9px;\n background: url(\'data:image/svg+xml,<svg viewBox="0 0 150 32" fill="none" xmlns="http://www.w3.org/2000/svg" > <g clip-path="url(%23clip0_4_304)"> <path d="M27.9858 8.99927C27.9872 10.3415 27.688 11.667 27.1101 12.8783C26.5321 14.0896 25.6902 15.156 24.6462 15.9989V15.9989L0.634502 2.36355C0.542657 2.31119 0.457444 2.24796 0.380701 2.17523C0.260289 2.05715 0.164605 1.91624 0.0992389 1.76075C0.0338732 1.60525 0.000136546 1.43828 0 1.26959C0 0.932873 0.133698 0.609948 0.371683 0.371854C0.609667 0.13376 0.932443 0 1.269 0L18.9906 0C21.3763 0 23.6642 0.948135 25.3512 2.63583C27.0381 4.32352 27.9858 6.61252 27.9858 8.99927V8.99927Z" fill="%2318B4F4" /> <path d="M27.9858 22.9986C27.9861 24.1806 27.7536 25.351 27.3017 26.4431C26.8498 27.5352 26.1873 28.5275 25.352 29.3634C24.5167 30.1993 23.5249 30.8624 22.4335 31.3147C21.342 31.7671 20.1721 32 18.9907 32H1.26906C1.01802 31.9973 0.77343 31.9202 0.566221 31.7784C0.359012 31.6366 0.198499 31.4364 0.104989 31.2034C0.0114791 30.9703 -0.0108254 30.7147 0.0408974 30.4689C0.0926201 30.2231 0.216046 29.9982 0.395559 29.8226V29.8226C0.467112 29.7508 0.547407 29.6882 0.634555 29.6364L10.0844 24.2703L24.6441 16.001C25.688 16.8438 26.53 17.9097 27.1083 19.1206C27.6866 20.3315 27.9864 21.6566 27.9858 22.9986V22.9986Z" fill="%23FD6B3C" /> <path d="M24.6461 15.9989L10.0843 24.2703L0.634458 29.6365C0.54372 29.6868 0.459841 29.7487 0.384888 29.8205C3.98804 26.1233 6.00266 21.1627 5.99812 15.9989C6.0049 10.8346 3.99085 5.87268 0.387003 2.17523C0.463746 2.24796 0.548959 2.31119 0.640803 2.36355L24.6461 15.9989Z" fill="%23A97FF2" /> <path d="M47.6659 11.7352C51.8177 11.7352 54.1632 15.0531 54.1632 19.0714C54.1632 23.0896 51.8177 26.3821 47.6659 26.3821C45.5086 26.3821 43.8589 25.5188 42.9473 24.0545L42.5709 26.052H39.9736V6.77115H43.1884V13.8914C43.971 12.6959 45.5086 11.7352 47.6659 11.7352ZM47.0187 23.5488C49.4446 23.5488 50.9547 21.5809 50.9547 19.0714C50.9547 16.5089 49.4446 14.5664 47.0187 14.5664C44.5928 14.5664 43.0806 16.5047 43.0806 19.0714C43.0806 21.583 44.5653 23.5488 47.0187 23.5488V23.5488Z" fill="white" /> <path d="M65.4595 20.2859V12.0611H68.668V20.123C68.668 23.7202 67.0246 26.3821 62.4943 26.3821C57.9639 26.3821 56.3206 23.7117 56.3206 20.123V12.0611H59.529V20.2859C59.529 22.4696 60.5527 23.5488 62.49 23.5488C64.4274 23.5488 65.4595 22.4696 65.4595 20.2859Z" fill="white" /> <path d="M71.2355 7.74451C71.2247 7.46284 71.2724 7.18199 71.3755 6.91968C71.4787 6.65737 71.6351 6.41929 71.8348 6.22047C72.0345 6.02165 72.2732 5.8664 72.5359 5.76452C72.7986 5.66264 73.0796 5.61633 73.3611 5.62853C74.5793 5.62853 75.4571 6.50666 75.4571 7.75509C75.4571 9.00352 74.5793 9.8224 73.3611 9.8224C72.1428 9.8224 71.2355 8.9612 71.2355 7.74451Z" fill="white" /> <path d="M128.476 7.74451C128.465 7.46376 128.513 7.18383 128.615 6.92227C128.718 6.66071 128.873 6.42315 129.072 6.22449C129.27 6.02583 129.508 5.87035 129.769 5.7678C130.031 5.66524 130.31 5.61783 130.591 5.62852C131.809 5.62852 132.687 6.50666 132.687 7.75509C132.687 9.00352 131.809 9.8224 130.591 9.8224C129.373 9.8224 128.476 8.9612 128.476 7.74451Z" fill="white" /> <path d="M122.302 24.1031C122.291 23.8223 122.339 23.5422 122.441 23.2805C122.543 23.0188 122.699 22.7811 122.897 22.5824C123.096 22.3837 123.334 22.2282 123.595 22.1258C123.857 22.0233 124.137 21.9761 124.417 21.9872C125.636 21.9872 126.513 22.8653 126.513 24.1031C126.513 25.341 125.636 26.1726 124.417 26.1726C123.199 26.1726 122.302 25.3219 122.302 24.1031Z" fill="white" /> <path d="M74.9516 12.059H71.7432V26.0583H74.9516V12.059Z" fill="white" /> <path d="M78.16 26.0583V6.77115H81.3685V26.0626L78.16 26.0583Z" fill="white" /> <path d="M94.6063 6.77115H97.8148V26.0626H95.2239L94.8474 24.0651C93.9591 25.523 92.3094 26.3927 90.131 26.3927C86.0046 26.3927 83.6591 23.0748 83.6591 19.0819C83.6591 15.0891 86.0046 11.7458 90.131 11.7458C92.3137 11.7458 93.8238 12.7149 94.6063 13.902V6.77115ZM90.7993 14.5707C88.3734 14.5707 86.8633 16.5131 86.8633 19.0756C86.8633 21.5851 88.3734 23.553 90.7993 23.553C93.2252 23.553 94.7354 21.5851 94.7354 19.0756C94.7396 16.5047 93.257 14.5664 90.8036 14.5664L90.7993 14.5707Z" fill="white" /> <path d="M113.479 22.2284C112.482 24.7359 110.162 26.3821 107.117 26.3821C102.887 26.3821 100.137 23.225 100.137 19.0439C100.137 14.9706 102.942 11.7353 107.093 11.7353C111.245 11.7353 113.969 14.8902 113.969 18.991C113.982 19.3255 113.953 19.6604 113.883 19.9876H103.288C103.53 22.2009 104.959 23.6292 107.197 23.6292C108.735 23.6292 110.001 22.8738 110.594 21.473L113.479 22.2284ZM103.341 17.6156H110.784C110.513 15.6731 109.166 14.3506 107.089 14.3506C105.012 14.3506 103.665 15.7006 103.341 17.6156V17.6156Z" fill="white" /> <path d="M123.779 14.9452C123.538 14.9117 123.295 14.8933 123.051 14.8902C120.786 14.8902 119.439 16.0772 119.439 18.7751V26.0583H116.23V12.0611H118.821L119.195 14.0014C119.707 13.1127 120.887 11.9257 123.322 11.9257C123.455 11.9257 123.779 11.9532 123.779 11.9532V14.9452Z" fill="white" /> <path d="M132.192 12.059H128.984V26.0583H132.192V12.059Z" fill="white" /> <path d="M134.483 19.0714C134.483 15.1335 137.287 11.7353 141.735 11.7353C146.183 11.7353 149.015 15.1335 149.015 19.0714C149.015 23.0092 146.213 26.3821 141.735 26.3821C137.258 26.3821 134.483 23.0092 134.483 19.0714ZM141.735 23.5488C144.083 23.5488 145.806 21.7692 145.806 19.0714C145.806 16.3735 144.083 14.5664 141.735 14.5664C139.387 14.5664 137.687 16.346 137.687 19.0714C137.687 21.7968 139.417 23.5488 141.735 23.5488V23.5488Z" fill="white" /> </g> <defs> <clipPath id="clip0_4_304"> <rect width="149.015" height="32" fill="white" /> </clipPath> </defs> </svg>\');\n background-repeat: no-repeat;\n width: 150px;\n height: 32px;\n}\n@media (max-width: 840px) {\n aside {\n width: 250px;\n padding: 60px 0 0 20px;\n }\n section {\n left: 250px;\n padding: 0 80px;\n }\n}\n@media (max-width: 590px) {\n aside {\n width: 230px;\n padding: 60px 0 0 10px;\n }\n section {\n left: 230px;\n padding: 0 40px;\n }\n}\n#modified-files-message a {\n color: #cbcbcb;\n font-weight: 300;\n text-decoration: underline;\n}\n#modified-files-message a:hover {\n color: white;\n text-decoration: none;\n}\n#restart-warning {\n border-radius: 4px;\n padding: 8px 16px;\n border: 1px solid #fd6b3c;\n background: rgba(253, 107, 60, 0.1);\n}\n#react-router-steps {\n margin: 0px;\n margin-bottom: 5px;\n padding: 0px 20px;\n}\n#need-help {\n color: #48a1ff;\n text-decoration: none;\n}\n#router-message {\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #48a1ff;\n}\n#router-finish-button {\n margin-top: 12px;\n}\n#router-checkbox-div {\n display: flex;\n align-items: center;\n}\n#router-checkbox {\n margin-right: 10px;\n width: 15px;\n height: 15px;\n}\n#success-title {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n#success-title .check-icon {\n display: inline-block;\n width: 24px;\n height: 24px;\n border: 2px solid #28a745;\n border-radius: 50%;\n position: relative;\n}\n#success-title .check-icon::before {\n content: "";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 6px;\n height: 12px;\n border: solid #28a745;\n border-width: 0 2px 2px 0;\n transform: translate(-50%, -60%) rotate(45deg);\n}\n</style>`;\n var BuilderOverviewStep = class extends HTMLElement {\n constructor() {\n super();\n }\n connectedCallback() {\n const shadow = this.attachShadow({ mode: "open" });\n shadow.innerHTML = STEP_CSS + `<main>\n <aside>\n <div class="logo"></div>\n\n <ul>\n <li class="highlight active">\n <div class="circle"></div>\n <div class="line"></div>\n <span>Connect Builder.io</span>\n </li>\n <li>\n <div class="circle"></div>\n <div class="line"></div>\n <span>Update App</span>\n </li>\n <li>\n <div class="circle"></div>\n <span>Setup Complete</span>\n </li>\n </ul>\n </aside>\n\n <section>\n <h1>Integrate Builder.io with your project</h1>\n\n <p>\n First, let\'s connect to your Builder.io space to continue with the\n integration\n </p>\n\n <nav>\n <a class="button next-step" href="#">\n <span id="button-text">Get Started</span>\n <span id="button-icon"></span>\n </a>\n </nav>\n </section>\n</main>\n`;\n setBuilderHead();\n const authPath = new URL(BUILDER_AUTH_CONNECT_PATH, DEV_TOOLS_URL);\n authPath.searchParams.set(PREVIEW_URL_QS, location.href);\n const nextStepLinks = shadow.querySelectorAll(".next-step");\n for (const nextStepLink of nextStepLinks) {\n nextStepLink.setAttribute("href", authPath.href);\n }\n track("overview step viewed");\n }\n };\n var setBuilderHead = () => {\n let favicon = document.head.querySelector(\n "link[rel=\'icon\'], link[rel=\'icon shortcut\']"\n );\n if (favicon) {\n favicon.href = "https://cdn.builder.io/favicon.ico";\n favicon.removeAttribute("type");\n } else {\n favicon = document.createElement("link");\n favicon.rel = "icon";\n favicon.href = "https://cdn.builder.io/favicon.ico";\n document.head.appendChild(favicon);\n }\n };\n\n // packages/dev-tools/client/setup-ui/index.ts\n var checkBuilderIntegration = async () => {\n const validatedBuilder = await apiValidateBuilder();\n if (!validatedBuilder.isValid) {\n showOverviewStep();\n }\n };\n var showOverviewStep = () => {\n if (!customElements.get("builder-dev-tools-overview")) {\n customElements.define("builder-dev-tools-overview", BuilderOverviewStep);\n }\n let overview = document.querySelector(\n "builder-dev-tools-overview"\n );\n if (!overview) {\n overview = document.createElement(\n "builder-dev-tools-overview"\n );\n overview.setAttribute("aria-hidden", "true");\n document.body.appendChild(overview);\n }\n setTimeout(() => {\n overview.removeAttribute("aria-hidden");\n }, 32);\n };\n\n // packages/dev-tools/client/index.ts\n var initDevToolsApp = () => {\n try {\n if (!customElements.get("builder-dev-tools-edit")) {\n customElements.define(\n "builder-dev-tools-edit",\n BuilderDevToolsEditButton\n );\n }\n if (!customElements.get("builder-dev-tools-menu")) {\n customElements.define("builder-dev-tools-menu", BuilderDevToolsMenu);\n }\n let menu = document.querySelector("builder-dev-tools-menu");\n if (!menu) {\n menu = document.createElement("builder-dev-tools-menu");\n menu.setAttribute("data-version", "1.18.44-dev.202512111428.dadde891f");\n document.body.appendChild(menu);\n }\n let editButton = document.querySelector("builder-dev-tools-edit");\n if (!editButton) {\n editButton = document.createElement("builder-dev-tools-edit");\n document.body.appendChild(editButton);\n }\n let builderStyles = document.getElementById("builder-dev-tools-style");\n if (!builderStyles) {\n builderStyles = document.createElement("style");\n builderStyles.id = "builder-dev-tools-style";\n builderStyles.innerHTML = `.builder-no-scroll{overflow:hidden !important}`;\n document.head.appendChild(builderStyles);\n }\n checkBuilderIntegration();\n initTracking();\n } catch (e) {\n console.error("Builder Devtools:", e);\n }\n };\n if (window.location === window.parent.location) {\n console.debug(`Builder.io Devtools v${"1.18.44-dev.202512111428.dadde891f"}`);\n initDevToolsApp();\n }\n})();');
|
|
1413
2355
|
}
|
|
1414
2356
|
async function getConnectedStepHtml(ctx) {
|
|
1415
2357
|
return updateClientRuntimeVariables(ctx, '<!doctype html>\n<html lang="en" dir="ltr">\n <head>\n <meta charset="utf-8" />\n <script>\n (function (window) {\n if (window.location !== window.top.location) {\n window.top.location = window.location;\n }\n })(this);\n </script>\n <title>Successfully Connected With Builder.io</title>\n <style>/* packages/dev-tools/client/setup-ui/styles.css */\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\nhtml,\nbody,\n:host {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n z-index: 2147483646;\n margin: 0;\n padding: 0;\n line-height: 1.8;\n font-family:\n ui-sans-serif,\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n "Helvetica Neue",\n Arial,\n "Noto Sans",\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji";\n background-color: rgba(37, 37, 37, 1);\n color: white;\n transition: opacity 250ms ease-in-out;\n}\n:host([aria-hidden="true"]) {\n opacity: 0;\n pointer-events: none;\n}\nmain {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n}\nh1 {\n margin-top: 0;\n font-size: 24px;\n font-weight: 300;\n line-height: 1.4;\n}\np {\n margin: 20px 0;\n font-weight: 300;\n}\nbutton {\n cursor: pointer;\n}\naside {\n position: absolute;\n top: 0;\n left: 0;\n width: 350px;\n height: 100vh;\n padding: 60px 0 0 50px;\n background-color: rgba(18, 18, 18, 1);\n}\naside ul {\n margin: 30px 0 0 0px;\n padding: 0;\n list-style: none;\n}\naside li {\n position: relative;\n margin: 0;\n padding: 20px 10px;\n font-weight: 300;\n}\naside li.highlight {\n color: rgba(72, 161, 255, 1);\n}\naside li.active {\n font-weight: 700;\n}\naside li .circle {\n position: absolute;\n top: 20px;\n left: 10px;\n width: 24px;\n height: 24px;\n border: 3px solid white;\n border-radius: 50%;\n font-size: 14px;\n}\naside li.highlight .circle {\n border-color: rgba(72, 161, 255, 1);\n}\naside li.active .circle::after {\n content: "";\n position: absolute;\n top: 3px;\n left: 3px;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n background-color: rgba(72, 161, 255, 1);\n}\naside li.completed .circle {\n background-color: rgba(72, 161, 255, 1);\n}\naside li.completed .circle::after {\n content: "";\n position: absolute;\n top: 2px;\n left: 6px;\n width: 6px;\n height: 13px;\n border: 3px solid black;\n border-top: none;\n border-left: none;\n transform: rotate(45deg);\n}\naside li .line {\n position: absolute;\n top: 44px;\n left: 21px;\n width: 3px;\n height: 45px;\n background-color: white;\n}\naside li.completed .line {\n background-color: rgba(72, 161, 255, 1);\n}\naside li span {\n display: block;\n margin-left: 44px;\n}\nnav {\n margin-top: 30px;\n}\nsection {\n position: absolute;\n top: 135px;\n left: 350px;\n padding: 0 80px 0 140px;\n transition: opacity 150ms ease-in-out;\n}\nsection[aria-hidden=true] {\n pointer-events: none;\n opacity: 0;\n}\nsection h1,\nsection p {\n min-width: 300px;\n max-width: 600px;\n}\n.button {\n position: relative;\n display: inline-block;\n color: white;\n background-color: rgba(72, 161, 255, 1);\n border-radius: 4px;\n text-decoration: none;\n padding: 10px 40px 10px 20px;\n white-space: nowrap;\n}\n.button:hover {\n background-color: rgba(72, 161, 255, 0.85);\n}\n#button-icon {\n position: absolute;\n top: 1px;\n right: 5px;\n bottom: 0;\n width: 30px;\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="white" stroke-linecap="square" stroke-miterlimit="10" stroke-width="48" d="M184 112l144 144-144 144"/></svg>\');\n background-repeat: no-repeat;\n background-position: center;\n background-size: 24px 24px;\n}\n.button[aria-disabled=true] {\n opacity: 0.9;\n background-color: rgba(255, 255, 255, 0.3);\n pointer-events: none;\n padding-right: 60px;\n}\n.button[aria-disabled=true] #button-icon {\n top: 21px;\n right: 29px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background: white;\n color: white;\n animation: dot-flashing 0.5s infinite linear alternate;\n animation-delay: 0.25s;\n}\n.button[aria-disabled=true] #button-icon::before,\n.button[aria-disabled=true] #button-icon::after {\n content: "";\n display: inline-block;\n position: absolute;\n top: 0;\n}\n.button[aria-disabled=true] #button-icon::before {\n left: -12px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background-color: white;\n color: white;\n animation: dot-flashing 0.5s infinite alternate;\n animation-delay: 0s;\n}\n.button[aria-disabled=true] #button-icon::after {\n left: 12px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background-color: white;\n color: white;\n animation: dot-flashing 0.5s infinite alternate;\n animation-delay: 0.5s;\n}\n@keyframes dot-flashing {\n 0% {\n background-color: white;\n }\n 50%, 100% {\n background-color: rgba(255, 255, 255, 0.3);\n }\n}\n.logo {\n margin-left: 9px;\n background: url(\'data:image/svg+xml,<svg viewBox="0 0 150 32" fill="none" xmlns="http://www.w3.org/2000/svg" > <g clip-path="url(%23clip0_4_304)"> <path d="M27.9858 8.99927C27.9872 10.3415 27.688 11.667 27.1101 12.8783C26.5321 14.0896 25.6902 15.156 24.6462 15.9989V15.9989L0.634502 2.36355C0.542657 2.31119 0.457444 2.24796 0.380701 2.17523C0.260289 2.05715 0.164605 1.91624 0.0992389 1.76075C0.0338732 1.60525 0.000136546 1.43828 0 1.26959C0 0.932873 0.133698 0.609948 0.371683 0.371854C0.609667 0.13376 0.932443 0 1.269 0L18.9906 0C21.3763 0 23.6642 0.948135 25.3512 2.63583C27.0381 4.32352 27.9858 6.61252 27.9858 8.99927V8.99927Z" fill="%2318B4F4" /> <path d="M27.9858 22.9986C27.9861 24.1806 27.7536 25.351 27.3017 26.4431C26.8498 27.5352 26.1873 28.5275 25.352 29.3634C24.5167 30.1993 23.5249 30.8624 22.4335 31.3147C21.342 31.7671 20.1721 32 18.9907 32H1.26906C1.01802 31.9973 0.77343 31.9202 0.566221 31.7784C0.359012 31.6366 0.198499 31.4364 0.104989 31.2034C0.0114791 30.9703 -0.0108254 30.7147 0.0408974 30.4689C0.0926201 30.2231 0.216046 29.9982 0.395559 29.8226V29.8226C0.467112 29.7508 0.547407 29.6882 0.634555 29.6364L10.0844 24.2703L24.6441 16.001C25.688 16.8438 26.53 17.9097 27.1083 19.1206C27.6866 20.3315 27.9864 21.6566 27.9858 22.9986V22.9986Z" fill="%23FD6B3C" /> <path d="M24.6461 15.9989L10.0843 24.2703L0.634458 29.6365C0.54372 29.6868 0.459841 29.7487 0.384888 29.8205C3.98804 26.1233 6.00266 21.1627 5.99812 15.9989C6.0049 10.8346 3.99085 5.87268 0.387003 2.17523C0.463746 2.24796 0.548959 2.31119 0.640803 2.36355L24.6461 15.9989Z" fill="%23A97FF2" /> <path d="M47.6659 11.7352C51.8177 11.7352 54.1632 15.0531 54.1632 19.0714C54.1632 23.0896 51.8177 26.3821 47.6659 26.3821C45.5086 26.3821 43.8589 25.5188 42.9473 24.0545L42.5709 26.052H39.9736V6.77115H43.1884V13.8914C43.971 12.6959 45.5086 11.7352 47.6659 11.7352ZM47.0187 23.5488C49.4446 23.5488 50.9547 21.5809 50.9547 19.0714C50.9547 16.5089 49.4446 14.5664 47.0187 14.5664C44.5928 14.5664 43.0806 16.5047 43.0806 19.0714C43.0806 21.583 44.5653 23.5488 47.0187 23.5488V23.5488Z" fill="white" /> <path d="M65.4595 20.2859V12.0611H68.668V20.123C68.668 23.7202 67.0246 26.3821 62.4943 26.3821C57.9639 26.3821 56.3206 23.7117 56.3206 20.123V12.0611H59.529V20.2859C59.529 22.4696 60.5527 23.5488 62.49 23.5488C64.4274 23.5488 65.4595 22.4696 65.4595 20.2859Z" fill="white" /> <path d="M71.2355 7.74451C71.2247 7.46284 71.2724 7.18199 71.3755 6.91968C71.4787 6.65737 71.6351 6.41929 71.8348 6.22047C72.0345 6.02165 72.2732 5.8664 72.5359 5.76452C72.7986 5.66264 73.0796 5.61633 73.3611 5.62853C74.5793 5.62853 75.4571 6.50666 75.4571 7.75509C75.4571 9.00352 74.5793 9.8224 73.3611 9.8224C72.1428 9.8224 71.2355 8.9612 71.2355 7.74451Z" fill="white" /> <path d="M128.476 7.74451C128.465 7.46376 128.513 7.18383 128.615 6.92227C128.718 6.66071 128.873 6.42315 129.072 6.22449C129.27 6.02583 129.508 5.87035 129.769 5.7678C130.031 5.66524 130.31 5.61783 130.591 5.62852C131.809 5.62852 132.687 6.50666 132.687 7.75509C132.687 9.00352 131.809 9.8224 130.591 9.8224C129.373 9.8224 128.476 8.9612 128.476 7.74451Z" fill="white" /> <path d="M122.302 24.1031C122.291 23.8223 122.339 23.5422 122.441 23.2805C122.543 23.0188 122.699 22.7811 122.897 22.5824C123.096 22.3837 123.334 22.2282 123.595 22.1258C123.857 22.0233 124.137 21.9761 124.417 21.9872C125.636 21.9872 126.513 22.8653 126.513 24.1031C126.513 25.341 125.636 26.1726 124.417 26.1726C123.199 26.1726 122.302 25.3219 122.302 24.1031Z" fill="white" /> <path d="M74.9516 12.059H71.7432V26.0583H74.9516V12.059Z" fill="white" /> <path d="M78.16 26.0583V6.77115H81.3685V26.0626L78.16 26.0583Z" fill="white" /> <path d="M94.6063 6.77115H97.8148V26.0626H95.2239L94.8474 24.0651C93.9591 25.523 92.3094 26.3927 90.131 26.3927C86.0046 26.3927 83.6591 23.0748 83.6591 19.0819C83.6591 15.0891 86.0046 11.7458 90.131 11.7458C92.3137 11.7458 93.8238 12.7149 94.6063 13.902V6.77115ZM90.7993 14.5707C88.3734 14.5707 86.8633 16.5131 86.8633 19.0756C86.8633 21.5851 88.3734 23.553 90.7993 23.553C93.2252 23.553 94.7354 21.5851 94.7354 19.0756C94.7396 16.5047 93.257 14.5664 90.8036 14.5664L90.7993 14.5707Z" fill="white" /> <path d="M113.479 22.2284C112.482 24.7359 110.162 26.3821 107.117 26.3821C102.887 26.3821 100.137 23.225 100.137 19.0439C100.137 14.9706 102.942 11.7353 107.093 11.7353C111.245 11.7353 113.969 14.8902 113.969 18.991C113.982 19.3255 113.953 19.6604 113.883 19.9876H103.288C103.53 22.2009 104.959 23.6292 107.197 23.6292C108.735 23.6292 110.001 22.8738 110.594 21.473L113.479 22.2284ZM103.341 17.6156H110.784C110.513 15.6731 109.166 14.3506 107.089 14.3506C105.012 14.3506 103.665 15.7006 103.341 17.6156V17.6156Z" fill="white" /> <path d="M123.779 14.9452C123.538 14.9117 123.295 14.8933 123.051 14.8902C120.786 14.8902 119.439 16.0772 119.439 18.7751V26.0583H116.23V12.0611H118.821L119.195 14.0014C119.707 13.1127 120.887 11.9257 123.322 11.9257C123.455 11.9257 123.779 11.9532 123.779 11.9532V14.9452Z" fill="white" /> <path d="M132.192 12.059H128.984V26.0583H132.192V12.059Z" fill="white" /> <path d="M134.483 19.0714C134.483 15.1335 137.287 11.7353 141.735 11.7353C146.183 11.7353 149.015 15.1335 149.015 19.0714C149.015 23.0092 146.213 26.3821 141.735 26.3821C137.258 26.3821 134.483 23.0092 134.483 19.0714ZM141.735 23.5488C144.083 23.5488 145.806 21.7692 145.806 19.0714C145.806 16.3735 144.083 14.5664 141.735 14.5664C139.387 14.5664 137.687 16.346 137.687 19.0714C137.687 21.7968 139.417 23.5488 141.735 23.5488V23.5488Z" fill="white" /> </g> <defs> <clipPath id="clip0_4_304"> <rect width="149.015" height="32" fill="white" /> </clipPath> </defs> </svg>\');\n background-repeat: no-repeat;\n width: 150px;\n height: 32px;\n}\n@media (max-width: 840px) {\n aside {\n width: 250px;\n padding: 60px 0 0 20px;\n }\n section {\n left: 250px;\n padding: 0 80px;\n }\n}\n@media (max-width: 590px) {\n aside {\n width: 230px;\n padding: 60px 0 0 10px;\n }\n section {\n left: 230px;\n padding: 0 40px;\n }\n}\n#modified-files-message a {\n color: #cbcbcb;\n font-weight: 300;\n text-decoration: underline;\n}\n#modified-files-message a:hover {\n color: white;\n text-decoration: none;\n}\n#restart-warning {\n border-radius: 4px;\n padding: 8px 16px;\n border: 1px solid #fd6b3c;\n background: rgba(253, 107, 60, 0.1);\n}\n#react-router-steps {\n margin: 0px;\n margin-bottom: 5px;\n padding: 0px 20px;\n}\n#need-help {\n color: #48a1ff;\n text-decoration: none;\n}\n#router-message {\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #48a1ff;\n}\n#router-finish-button {\n margin-top: 12px;\n}\n#router-checkbox-div {\n display: flex;\n align-items: center;\n}\n#router-checkbox {\n margin-right: 10px;\n width: 15px;\n height: 15px;\n}\n#success-title {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n#success-title .check-icon {\n display: inline-block;\n width: 24px;\n height: 24px;\n border: 2px solid #28a745;\n border-radius: 50%;\n position: relative;\n}\n#success-title .check-icon::before {\n content: "";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 6px;\n height: 12px;\n border: solid #28a745;\n border-width: 0 2px 2px 0;\n transform: translate(-50%, -60%) rotate(45deg);\n}\n</style>\n <link rel="icon shortcut" href="https://cdn.builder.io/favicon.ico" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n </head>\n <body>\n <main>\n <aside>\n <div class="logo"></div>\n\n <ul>\n <li class="highlight completed">\n <div class="circle"></div>\n <div class="line"></div>\n <span>Connect Builder.io</span>\n </li>\n <li id="step-update-app" class="highlight active">\n <div class="circle"></div>\n <div class="line"></div>\n <span>Update App</span>\n </li>\n <li id="step-setup-complete">\n <div class="circle"></div>\n <span>Setup Complete</span>\n </li>\n </ul>\n </aside>\n\n <section id="updating" aria-hidden="false">\n <h1>Updating App to include Builder.io</h1>\n <p>\n We\'re making some updates so Builder can be used within this\n project.<br />\n This usually takes less than a minute to complete.\n </p>\n\n <nav>\n <p>\n <a id="completing" class="button" aria-disabled="true" href="#">\n <span id="button-text">Updating</span>\n <span id="button-icon"></span>\n </a>\n </p>\n </nav>\n </section>\n\n <section id="success" aria-hidden="true">\n <h1 id="success-title">\n Connection Successful\n <div class="check-icon"></div>\n </h1>\n\n <p>\n Your project is now ready to work with Builder! You can close this tab\n and return to Builder or your development project to continue.\n </p>\n\n <div id="modified-files-message" hidden>\n <p>\n We\'ve made a few updates to your app to help integrate Builder.io:\n </p>\n <ul id="modified-files-list"></ul>\n </div>\n\n <p id="restart-warning" hidden>\n Please restart the dev server to ensure the changes take effect, then\n reload this page.\n </p>\n\n <div id="router-message" hidden>\n <!-- Route message for react -->\n <div id="react-message-section" hidden>\n <span\n >Next, add the following path and component in your React app\n routing setup</span\n >\n <ol id="react-router-steps">\n <li>\n Update path to <strong>\'/builder-demo\'</strong> or\n <strong>\'/*\'</strong>\n </li>\n <li>\n Add <strong>\'BuilderPage\'</strong> component from\n <code>builder-page</code> file\n </li>\n </ol>\n </div>\n\n <!-- Route message for angular -->\n <div id="angular-message-section" hidden>\n <span\n >Next, add the following path for Builder page in your Angular\n routes</span\n >\n <ol id="angular-router-steps">\n <li>\n Update path to <strong>\'builder-demo\'</strong> or\n <strong>\'**\'</strong>\n </li>\n <li>\n Add <strong>\'BuilderPage\'</strong> component from\n <code>builder-page.component</code> file\n </li>\n </ol>\n </div>\n\n <a id="need-help" href="#" hidden>\n <span id="help-text">Need help?</span>\n <span id="help-icon"></span>\n </a>\n <div id="router-checkbox-div"></div>\n </div>\n <div id="router-finish-button" hidden>\n <a class="button next-step" href="#">\n <span id="button-text">Finish</span>\n <span id="button-icon"></span>\n </a>\n </div>\n\n <nav id="go-to-app" hidden>\n <p hidden>Your new app is ready for Builder content! Let\'s go!</p>\n <p>\n <a class="button next-step" href="#">\n <span id="button-text">Go</span>\n <span id="button-icon"></span>\n </a>\n </p>\n </nav>\n </section>\n\n <section id="error" aria-hidden="true">\n <h1>Oops!</h1>\n <p>Looks like we tripped up on an issue!</p>\n <ul id="error-messages"></ul>\n </section>\n\n <section id="restart-server" aria-hidden="true">\n <h1>Please Restart Your Dev Server</h1>\n <p>\n We\'ve made updates to your application, please restart your dev server\n to ensure the changes take effect.\n </p>\n <p>\n <a id="completing" class="button" aria-disabled="true" href="#">\n <span id="button-text">Please restart your dev server</span>\n <span id="button-icon"></span>\n </a>\n </p>\n </section>\n </main>\n <script>"use strict";\n(() => {\n var __create = Object.create;\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __getProtoOf = Object.getPrototypeOf;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === "object" || typeof from === "function") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. "__esModule" has not been set), then set\n // "default" to the CommonJS "module.exports" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,\n mod\n ));\n\n // node_modules/@amplitude/ua-parser-js/src/ua-parser.js\n var require_ua_parser = __commonJS({\n "node_modules/@amplitude/ua-parser-js/src/ua-parser.js"(exports, module) {\n (function(window2, undefined2) {\n "use strict";\n var LIBVERSION = "0.7.33", EMPTY = "", UNKNOWN = "?", FUNC_TYPE = "function", UNDEF_TYPE = "undefined", OBJ_TYPE = "object", STR_TYPE = "string", MAJOR = "major", MODEL = "model", NAME = "name", TYPE = "type", VENDOR = "vendor", VERSION2 = "version", ARCHITECTURE = "architecture", CONSOLE = "console", MOBILE = "mobile", TABLET = "tablet", SMARTTV = "smarttv", WEARABLE = "wearable", EMBEDDED = "embedded", UA_MAX_LENGTH = 350;\n var AMAZON = "Amazon", APPLE = "Apple", ASUS = "ASUS", BLACKBERRY = "BlackBerry", BROWSER = "Browser", CHROME = "Chrome", EDGE = "Edge", FIREFOX = "Firefox", GOOGLE = "Google", HUAWEI = "Huawei", LG = "LG", MICROSOFT = "Microsoft", MOTOROLA = "Motorola", OPERA = "Opera", SAMSUNG = "Samsung", SHARP = "Sharp", SONY = "Sony", XIAOMI = "Xiaomi", ZEBRA = "Zebra", FACEBOOK = "Facebook";\n var extend = function(regexes2, extensions) {\n var mergedRegexes = {};\n for (var i in regexes2) {\n if (extensions[i] && extensions[i].length % 2 === 0) {\n mergedRegexes[i] = extensions[i].concat(regexes2[i]);\n } else {\n mergedRegexes[i] = regexes2[i];\n }\n }\n return mergedRegexes;\n }, enumerize = function(arr) {\n var enums = {};\n for (var i = 0; i < arr.length; i++) {\n enums[arr[i].toUpperCase()] = arr[i];\n }\n return enums;\n }, has = function(str1, str2) {\n return typeof str1 === STR_TYPE ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false;\n }, lowerize = function(str) {\n return str.toLowerCase();\n }, majorize = function(version) {\n return typeof version === STR_TYPE ? version.replace(/[^\\d\\.]/g, EMPTY).split(".")[0] : undefined2;\n }, trim = function(str, len) {\n if (typeof str === STR_TYPE) {\n str = str.replace(/^\\s\\s*/, EMPTY);\n return typeof len === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);\n }\n };\n var rgxMapper = function(ua, arrays) {\n var i = 0, j, k, p, q, matches, match;\n while (i < arrays.length && !matches) {\n var regex = arrays[i], props = arrays[i + 1];\n j = k = 0;\n while (j < regex.length && !matches) {\n matches = regex[j++].exec(ua);\n if (!!matches) {\n for (p = 0; p < props.length; p++) {\n match = matches[++k];\n q = props[p];\n if (typeof q === OBJ_TYPE && q.length > 0) {\n if (q.length === 2) {\n if (typeof q[1] == FUNC_TYPE) {\n this[q[0]] = q[1].call(this, match);\n } else {\n this[q[0]] = q[1];\n }\n } else if (q.length === 3) {\n if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {\n this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined2;\n } else {\n this[q[0]] = match ? match.replace(q[1], q[2]) : undefined2;\n }\n } else if (q.length === 4) {\n this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined2;\n }\n } else {\n this[q] = match ? match : undefined2;\n }\n }\n }\n }\n i += 2;\n }\n }, strMapper = function(str, map) {\n for (var i in map) {\n if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {\n for (var j = 0; j < map[i].length; j++) {\n if (has(map[i][j], str)) {\n return i === UNKNOWN ? undefined2 : i;\n }\n }\n } else if (has(map[i], str)) {\n return i === UNKNOWN ? undefined2 : i;\n }\n }\n return str;\n };\n var oldSafariMap = {\n "1.0": "/8",\n 1.2: "/1",\n 1.3: "/3",\n "2.0": "/412",\n "2.0.2": "/416",\n "2.0.3": "/417",\n "2.0.4": "/419",\n "?": "/"\n }, windowsVersionMap = {\n ME: "4.90",\n "NT 3.11": "NT3.51",\n "NT 4.0": "NT4.0",\n 2e3: "NT 5.0",\n XP: ["NT 5.1", "NT 5.2"],\n Vista: "NT 6.0",\n 7: "NT 6.1",\n 8: "NT 6.2",\n 8.1: "NT 6.3",\n 10: ["NT 6.4", "NT 10.0"],\n RT: "ARM"\n };\n var regexes = {\n browser: [\n [\n /\\b(?:crmo|crios)\\/([\\w\\.]+)/i\n // Chrome for Android/iOS\n ],\n [VERSION2, [NAME, "Chrome"]],\n [\n /edg(?:e|ios|a)?\\/([\\w\\.]+)/i\n // Microsoft Edge\n ],\n [VERSION2, [NAME, "Edge"]],\n [\n // Presto based\n /(opera mini)\\/([-\\w\\.]+)/i,\n // Opera Mini\n /(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i,\n // Opera Mobi/Tablet\n /(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i\n // Opera\n ],\n [NAME, VERSION2],\n [\n /opios[\\/ ]+([\\w\\.]+)/i\n // Opera mini on iphone >= 8.0\n ],\n [VERSION2, [NAME, OPERA + " Mini"]],\n [\n /\\bopr\\/([\\w\\.]+)/i\n // Opera Webkit\n ],\n [VERSION2, [NAME, OPERA]],\n [\n // Mixed\n /(kindle)\\/([\\w\\.]+)/i,\n // Kindle\n /(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i,\n // Lunascape/Maxthon/Netfront/Jasmine/Blazer\n // Trident based\n /(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i,\n // Avant/IEMobile/SlimBrowser\n /(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i,\n // Baidu Browser\n /(?:ms|\\()(ie) ([\\w\\.]+)/i,\n // Internet Explorer\n // Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon\n /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\\/([-\\w\\.]+)/i,\n // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ\n /(weibo)__([\\d\\.]+)/i\n // Weibo\n ],\n [NAME, VERSION2],\n [\n /(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i\n // UCBrowser\n ],\n [VERSION2, [NAME, "UC" + BROWSER]],\n [\n /microm.+\\bqbcore\\/([\\w\\.]+)/i,\n // WeChat Desktop for Windows Built-in Browser\n /\\bqbcore\\/([\\w\\.]+).+microm/i\n ],\n [VERSION2, [NAME, "WeChat(Win) Desktop"]],\n [\n /micromessenger\\/([\\w\\.]+)/i\n // WeChat\n ],\n [VERSION2, [NAME, "WeChat"]],\n [\n /konqueror\\/([\\w\\.]+)/i\n // Konqueror\n ],\n [VERSION2, [NAME, "Konqueror"]],\n [\n /trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i\n // IE11\n ],\n [VERSION2, [NAME, "IE"]],\n [\n /yabrowser\\/([\\w\\.]+)/i\n // Yandex\n ],\n [VERSION2, [NAME, "Yandex"]],\n [\n /(avast|avg)\\/([\\w\\.]+)/i\n // Avast/AVG Secure Browser\n ],\n [[NAME, /(.+)/, "$1 Secure " + BROWSER], VERSION2],\n [\n /\\bfocus\\/([\\w\\.]+)/i\n // Firefox Focus\n ],\n [VERSION2, [NAME, FIREFOX + " Focus"]],\n [\n /\\bopt\\/([\\w\\.]+)/i\n // Opera Touch\n ],\n [VERSION2, [NAME, OPERA + " Touch"]],\n [\n /coc_coc\\w+\\/([\\w\\.]+)/i\n // Coc Coc Browser\n ],\n [VERSION2, [NAME, "Coc Coc"]],\n [\n /dolfin\\/([\\w\\.]+)/i\n // Dolphin\n ],\n [VERSION2, [NAME, "Dolphin"]],\n [\n /coast\\/([\\w\\.]+)/i\n // Opera Coast\n ],\n [VERSION2, [NAME, OPERA + " Coast"]],\n [\n /miuibrowser\\/([\\w\\.]+)/i\n // MIUI Browser\n ],\n [VERSION2, [NAME, "MIUI " + BROWSER]],\n [\n /fxios\\/([-\\w\\.]+)/i\n // Firefox for iOS\n ],\n [VERSION2, [NAME, FIREFOX]],\n [\n /\\bqihu|(qi?ho?o?|360)browser/i\n // 360\n ],\n [[NAME, "360 " + BROWSER]],\n [/(oculus|samsung|sailfish|huawei)browser\\/([\\w\\.]+)/i],\n [[NAME, /(.+)/, "$1 " + BROWSER], VERSION2],\n [\n // Oculus/Samsung/Sailfish/Huawei Browser\n /(comodo_dragon)\\/([\\w\\.]+)/i\n // Comodo Dragon\n ],\n [[NAME, /_/g, " "], VERSION2],\n [\n /(electron)\\/([\\w\\.]+) safari/i,\n // Electron-based App\n /(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i,\n // Tesla\n /m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i\n // QQBrowser/Baidu App/2345 Browser\n ],\n [NAME, VERSION2],\n [\n /(metasr)[\\/ ]?([\\w\\.]+)/i,\n // SouGouBrowser\n /(lbbrowser)/i,\n // LieBao Browser\n /\\[(linkedin)app\\]/i\n // LinkedIn App for iOS & Android\n ],\n [NAME],\n [\n // WebView\n /((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i\n // Facebook App for iOS & Android\n ],\n [[NAME, FACEBOOK], VERSION2],\n [\n /safari (line)\\/([\\w\\.]+)/i,\n // Line App for iOS\n /\\b(line)\\/([\\w\\.]+)\\/iab/i,\n // Line App for Android\n /(chromium|instagram)[\\/ ]([-\\w\\.]+)/i\n // Chromium/Instagram\n ],\n [NAME, VERSION2],\n [\n /\\bgsa\\/([\\w\\.]+) .*safari\\//i\n // Google Search Appliance on iOS\n ],\n [VERSION2, [NAME, "GSA"]],\n [\n /headlesschrome(?:\\/([\\w\\.]+)| )/i\n // Chrome Headless\n ],\n [VERSION2, [NAME, CHROME + " Headless"]],\n [\n / wv\\).+(chrome)\\/([\\w\\.]+)/i\n // Chrome WebView\n ],\n [[NAME, CHROME + " WebView"], VERSION2],\n [\n /droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i\n // Android Browser\n ],\n [VERSION2, [NAME, "Android " + BROWSER]],\n [\n /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i\n // Chrome/OmniWeb/Arora/Tizen/Nokia\n ],\n [NAME, VERSION2],\n [\n /version\\/([\\w\\.\\,]+) .*mobile\\/\\w+ (safari)/i\n // Mobile Safari\n ],\n [VERSION2, [NAME, "Mobile Safari"]],\n [\n /version\\/([\\w(\\.|\\,)]+) .*(mobile ?safari|safari)/i\n // Safari & Safari Mobile\n ],\n [VERSION2, NAME],\n [\n /webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i\n // Safari < 3.0\n ],\n [NAME, [VERSION2, strMapper, oldSafariMap]],\n [/(webkit|khtml)\\/([\\w\\.]+)/i],\n [NAME, VERSION2],\n [\n // Gecko based\n /(navigator|netscape\\d?)\\/([-\\w\\.]+)/i\n // Netscape\n ],\n [[NAME, "Netscape"], VERSION2],\n [\n /mobile vr; rv:([\\w\\.]+)\\).+firefox/i\n // Firefox Reality\n ],\n [VERSION2, [NAME, FIREFOX + " Reality"]],\n [\n /ekiohf.+(flow)\\/([\\w\\.]+)/i,\n // Flow\n /(swiftfox)/i,\n // Swiftfox\n /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,\n // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar\n /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,\n // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix\n /(firefox)\\/([\\w\\.]+)/i,\n // Other Firefox-based\n /(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i,\n // Mozilla\n // Other\n /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,\n // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser\n /(links) \\(([\\w\\.]+)/i\n // Links\n ],\n [NAME, VERSION2],\n [\n /(cobalt)\\/([\\w\\.]+)/i\n // Cobalt\n ],\n [NAME, [VERSION2, /master.|lts./, ""]]\n ],\n cpu: [\n [\n /(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i\n // AMD64 (x64)\n ],\n [[ARCHITECTURE, "amd64"]],\n [\n /(ia32(?=;))/i\n // IA32 (quicktime)\n ],\n [[ARCHITECTURE, lowerize]],\n [\n /((?:i[346]|x)86)[;\\)]/i\n // IA32 (x86)\n ],\n [[ARCHITECTURE, "ia32"]],\n [\n /\\b(aarch64|arm(v?8e?l?|_?64))\\b/i\n // ARM64\n ],\n [[ARCHITECTURE, "arm64"]],\n [\n /\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i\n // ARMHF\n ],\n [[ARCHITECTURE, "armhf"]],\n [\n // PocketPC mistakenly identified as PowerPC\n /windows (ce|mobile); ppc;/i\n ],\n [[ARCHITECTURE, "arm"]],\n [\n /((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i\n // PowerPC\n ],\n [[ARCHITECTURE, /ower/, EMPTY, lowerize]],\n [\n /(sun4\\w)[;\\)]/i\n // SPARC\n ],\n [[ARCHITECTURE, "sparc"]],\n [\n /((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i\n // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC\n ],\n [[ARCHITECTURE, lowerize]]\n ],\n device: [\n [\n //////////////////////////\n // MOBILES & TABLETS\n // Ordered by popularity\n /////////////////////////\n // Samsung\n /\\b(sch-i[89]0\\d|shw-m380s|sm-[ptx]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i\n ],\n [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]],\n [\n /\\b((?:s[cgp]h|gt|sm)-\\w+|galaxy nexus)/i,\n /samsung[- ]([-\\w]+)/i,\n /sec-(sgh\\w+)/i\n ],\n [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]],\n [\n // Apple\n /((ipod|iphone)\\d+,\\d+)/i\n // iPod/iPhone model\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]],\n [\n /(ipad\\d+,\\d+)/i\n // iPad model\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, TABLET]],\n [\n /\\((ip(?:hone|od)[\\w ]*);/i\n // iPod/iPhone\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]],\n [\n /\\((ipad);[-\\w\\),; ]+apple/i,\n // iPad\n /applecoremedia\\/[\\w\\.]+ \\((ipad)/i,\n /\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, TABLET]],\n [/(macintosh);/i],\n [MODEL, [VENDOR, APPLE]],\n [\n // Huawei\n /\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i\n ],\n [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]],\n [\n /(?:huawei|honor)([-\\w ]+)[;\\)]/i,\n /\\b(nexus 6p|\\w{2,4}e?-[atu]?[ln][\\dx][012359c][adn]?)\\b(?!.+d\\/s)/i\n ],\n [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]],\n [\n // Xiaomi\n /\\b(poco[\\w ]+)(?: bui|\\))/i,\n // Xiaomi POCO\n /\\b; (\\w+) build\\/hm\\1/i,\n // Xiaomi Hongmi \'numeric\' models\n /\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i,\n // Xiaomi Hongmi\n /\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i,\n // Xiaomi Redmi\n /\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i\n // Xiaomi Mi\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, XIAOMI],\n [TYPE, MOBILE]\n ],\n [\n /\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i\n // Mi Pad tablets\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, XIAOMI],\n [TYPE, TABLET]\n ],\n [\n // OPPO\n /; (\\w+) bui.+ oppo/i,\n /\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i\n ],\n [MODEL, [VENDOR, "OPPO"], [TYPE, MOBILE]],\n [\n // Vivo\n /vivo (\\w+)(?: bui|\\))/i,\n /\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i\n ],\n [MODEL, [VENDOR, "Vivo"], [TYPE, MOBILE]],\n [\n // Realme\n /\\b(rmx[12]\\d{3})(?: bui|;|\\))/i\n ],\n [MODEL, [VENDOR, "Realme"], [TYPE, MOBILE]],\n [\n // Motorola\n /\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,\n /\\bmot(?:orola)?[- ](\\w*)/i,\n /((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i\n ],\n [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]],\n [/\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i],\n [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]],\n [\n // LG\n /((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i\n ],\n [MODEL, [VENDOR, LG], [TYPE, TABLET]],\n [\n /(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,\n /\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,\n /\\blg-?([\\d\\w]+) bui/i\n ],\n [MODEL, [VENDOR, LG], [TYPE, MOBILE]],\n [\n // Lenovo\n /(ideatab[-\\w ]+)/i,\n /lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i\n ],\n [MODEL, [VENDOR, "Lenovo"], [TYPE, TABLET]],\n [\n // Nokia\n /(?:maemo|nokia).*(n900|lumia \\d+)/i,\n /nokia[-_ ]?([-\\w\\.]*)/i\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, "Nokia"],\n [TYPE, MOBILE]\n ],\n [\n // Google\n /(pixel c)\\b/i\n // Google Pixel C\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]],\n [\n /droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i\n // Google Pixel\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]],\n [\n // Sony\n /droid.+ (a?\\d[0-2]{2}so|[c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i\n ],\n [MODEL, [VENDOR, SONY], [TYPE, MOBILE]],\n [/sony tablet [ps]/i, /\\b(?:sony)?sgp\\w+(?: bui|\\))/i],\n [\n [MODEL, "Xperia Tablet"],\n [VENDOR, SONY],\n [TYPE, TABLET]\n ],\n [\n // OnePlus\n / (kb2005|in20[12]5|be20[12][59])\\b/i,\n /(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i\n ],\n [MODEL, [VENDOR, "OnePlus"], [TYPE, MOBILE]],\n [\n // Amazon\n /(alexa)webm/i,\n /(kf[a-z]{2}wi)( bui|\\))/i,\n // Kindle Fire without Silk\n /(kf[a-z]+)( bui|\\)).+silk\\//i\n // Kindle Fire HD\n ],\n [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]],\n [\n /((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i\n // Fire Phone\n ],\n [\n [MODEL, /(.+)/g, "Fire Phone $1"],\n [VENDOR, AMAZON],\n [TYPE, MOBILE]\n ],\n [\n // BlackBerry\n /(playbook);[-\\w\\),; ]+(rim)/i\n // BlackBerry PlayBook\n ],\n [MODEL, VENDOR, [TYPE, TABLET]],\n [\n /\\b((?:bb[a-f]|st[hv])100-\\d)/i,\n /\\(bb10; (\\w+)/i\n // BlackBerry 10\n ],\n [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]],\n [\n // Asus\n /(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i\n ],\n [MODEL, [VENDOR, ASUS], [TYPE, TABLET]],\n [/ (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i],\n [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]],\n [\n // HTC\n /(nexus 9)/i\n // HTC Nexus 9\n ],\n [MODEL, [VENDOR, "HTC"], [TYPE, TABLET]],\n [\n /(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i,\n // HTC\n // ZTE\n /(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,\n /(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\\w]*)/i\n // Alcatel/GeeksPhone/Nexian/Panasonic/Sony\n ],\n [VENDOR, [MODEL, /_/g, " "], [TYPE, MOBILE]],\n [\n // Acer\n /droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i\n ],\n [MODEL, [VENDOR, "Acer"], [TYPE, TABLET]],\n [\n // Meizu\n /droid.+; (m[1-5] note) bui/i,\n /\\bmz-([-\\w]{2,})/i\n ],\n [MODEL, [VENDOR, "Meizu"], [TYPE, MOBILE]],\n [\n // Sharp\n /\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i\n ],\n [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]],\n [\n // MIXED\n /(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,\n // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron\n /(hp) ([\\w ]+\\w)/i,\n // HP iPAQ\n /(asus)-?(\\w+)/i,\n // Asus\n /(microsoft); (lumia[\\w ]+)/i,\n // Microsoft Lumia\n /(lenovo)[-_ ]?([-\\w]+)/i,\n // Lenovo\n /(jolla)/i,\n // Jolla\n /(oppo) ?([\\w ]+) bui/i\n // OPPO\n ],\n [VENDOR, MODEL, [TYPE, MOBILE]],\n [\n /(archos) (gamepad2?)/i,\n // Archos\n /(hp).+(touchpad(?!.+tablet)|tablet)/i,\n // HP TouchPad\n /(kindle)\\/([\\w\\.]+)/i,\n // Kindle\n /(nook)[\\w ]+build\\/(\\w+)/i,\n // Nook\n /(dell) (strea[kpr\\d ]*[\\dko])/i,\n // Dell Streak\n /(le[- ]+pan)[- ]+(\\w{1,9}) bui/i,\n // Le Pan Tablets\n /(trinity)[- ]*(t\\d{3}) bui/i,\n // Trinity Tablets\n /(gigaset)[- ]+(q\\w{1,9}) bui/i,\n // Gigaset Tablets\n /(vodafone) ([\\w ]+)(?:\\)| bui)/i\n // Vodafone\n ],\n [VENDOR, MODEL, [TYPE, TABLET]],\n [\n /(surface duo)/i\n // Surface Duo\n ],\n [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]],\n [\n /droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i\n // Fairphone\n ],\n [MODEL, [VENDOR, "Fairphone"], [TYPE, MOBILE]],\n [\n /(u304aa)/i\n // AT&T\n ],\n [MODEL, [VENDOR, "AT&T"], [TYPE, MOBILE]],\n [\n /\\bsie-(\\w*)/i\n // Siemens\n ],\n [MODEL, [VENDOR, "Siemens"], [TYPE, MOBILE]],\n [\n /\\b(rct\\w+) b/i\n // RCA Tablets\n ],\n [MODEL, [VENDOR, "RCA"], [TYPE, TABLET]],\n [\n /\\b(venue[\\d ]{2,7}) b/i\n // Dell Venue Tablets\n ],\n [MODEL, [VENDOR, "Dell"], [TYPE, TABLET]],\n [\n /\\b(q(?:mv|ta)\\w+) b/i\n // Verizon Tablet\n ],\n [MODEL, [VENDOR, "Verizon"], [TYPE, TABLET]],\n [\n /\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i\n // Barnes & Noble Tablet\n ],\n [MODEL, [VENDOR, "Barnes & Noble"], [TYPE, TABLET]],\n [/\\b(tm\\d{3}\\w+) b/i],\n [MODEL, [VENDOR, "NuVision"], [TYPE, TABLET]],\n [\n /\\b(k88) b/i\n // ZTE K Series Tablet\n ],\n [MODEL, [VENDOR, "ZTE"], [TYPE, TABLET]],\n [\n /\\b(nx\\d{3}j) b/i\n // ZTE Nubia\n ],\n [MODEL, [VENDOR, "ZTE"], [TYPE, MOBILE]],\n [\n /\\b(gen\\d{3}) b.+49h/i\n // Swiss GEN Mobile\n ],\n [MODEL, [VENDOR, "Swiss"], [TYPE, MOBILE]],\n [\n /\\b(zur\\d{3}) b/i\n // Swiss ZUR Tablet\n ],\n [MODEL, [VENDOR, "Swiss"], [TYPE, TABLET]],\n [\n /\\b((zeki)?tb.*\\b) b/i\n // Zeki Tablets\n ],\n [MODEL, [VENDOR, "Zeki"], [TYPE, TABLET]],\n [\n /\\b([yr]\\d{2}) b/i,\n /\\b(dragon[- ]+touch |dt)(\\w{5}) b/i\n // Dragon Touch Tablet\n ],\n [[VENDOR, "Dragon Touch"], MODEL, [TYPE, TABLET]],\n [\n /\\b(ns-?\\w{0,9}) b/i\n // Insignia Tablets\n ],\n [MODEL, [VENDOR, "Insignia"], [TYPE, TABLET]],\n [\n /\\b((nxa|next)-?\\w{0,9}) b/i\n // NextBook Tablets\n ],\n [MODEL, [VENDOR, "NextBook"], [TYPE, TABLET]],\n [\n /\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i\n // Voice Xtreme Phones\n ],\n [[VENDOR, "Voice"], MODEL, [TYPE, MOBILE]],\n [\n /\\b(lvtel\\-)?(v1[12]) b/i\n // LvTel Phones\n ],\n [[VENDOR, "LvTel"], MODEL, [TYPE, MOBILE]],\n [\n /\\b(ph-1) /i\n // Essential PH-1\n ],\n [MODEL, [VENDOR, "Essential"], [TYPE, MOBILE]],\n [\n /\\b(v(100md|700na|7011|917g).*\\b) b/i\n // Envizen Tablets\n ],\n [MODEL, [VENDOR, "Envizen"], [TYPE, TABLET]],\n [\n /\\b(trio[-\\w\\. ]+) b/i\n // MachSpeed Tablets\n ],\n [MODEL, [VENDOR, "MachSpeed"], [TYPE, TABLET]],\n [\n /\\btu_(1491) b/i\n // Rotor Tablets\n ],\n [MODEL, [VENDOR, "Rotor"], [TYPE, TABLET]],\n [\n /(shield[\\w ]+) b/i\n // Nvidia Shield Tablets\n ],\n [MODEL, [VENDOR, "Nvidia"], [TYPE, TABLET]],\n [\n /(sprint) (\\w+)/i\n // Sprint Phones\n ],\n [VENDOR, MODEL, [TYPE, MOBILE]],\n [\n /(kin\\.[onetw]{3})/i\n // Microsoft Kin\n ],\n [\n [MODEL, /\\./g, " "],\n [VENDOR, MICROSOFT],\n [TYPE, MOBILE]\n ],\n [\n /droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i\n // Zebra\n ],\n [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]],\n [/droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i],\n [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]],\n [\n ///////////////////\n // CONSOLES\n ///////////////////\n /(ouya)/i,\n // Ouya\n /(nintendo) ([wids3utch]+)/i\n // Nintendo\n ],\n [VENDOR, MODEL, [TYPE, CONSOLE]],\n [\n /droid.+; (shield) bui/i\n // Nvidia\n ],\n [MODEL, [VENDOR, "Nvidia"], [TYPE, CONSOLE]],\n [\n /(playstation [345portablevi]+)/i\n // Playstation\n ],\n [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]],\n [\n /\\b(xbox(?: one)?(?!; xbox))[\\); ]/i\n // Microsoft Xbox\n ],\n [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]],\n [\n ///////////////////\n // SMARTTVS\n ///////////////////\n /smart-tv.+(samsung)/i\n // Samsung\n ],\n [VENDOR, [TYPE, SMARTTV]],\n [/hbbtv.+maple;(\\d+)/i],\n [\n [MODEL, /^/, "SmartTV"],\n [VENDOR, SAMSUNG],\n [TYPE, SMARTTV]\n ],\n [\n /(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i\n // LG SmartTV\n ],\n [\n [VENDOR, LG],\n [TYPE, SMARTTV]\n ],\n [\n /(apple) ?tv/i\n // Apple TV\n ],\n [VENDOR, [MODEL, APPLE + " TV"], [TYPE, SMARTTV]],\n [\n /crkey/i\n // Google Chromecast\n ],\n [\n [MODEL, CHROME + "cast"],\n [VENDOR, GOOGLE],\n [TYPE, SMARTTV]\n ],\n [\n /droid.+aft(\\w)( bui|\\))/i\n // Fire TV\n ],\n [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]],\n [\n /\\(dtv[\\);].+(aquos)/i,\n /(aquos-tv[\\w ]+)\\)/i\n // Sharp\n ],\n [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],\n [\n /(bravia[\\w ]+)( bui|\\))/i\n // Sony\n ],\n [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]],\n [\n /(mitv-\\w{5}) bui/i\n // Xiaomi\n ],\n [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]],\n [\n /\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i,\n // Roku\n /hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w ]*; *(\\w[^;]*);([^;]*)/i\n // HbbTV devices\n ],\n [\n [VENDOR, trim],\n [MODEL, trim],\n [TYPE, SMARTTV]\n ],\n [\n /\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i\n // SmartTV from Unidentified Vendors\n ],\n [[TYPE, SMARTTV]],\n [\n ///////////////////\n // WEARABLES\n ///////////////////\n /((pebble))app/i\n // Pebble\n ],\n [VENDOR, MODEL, [TYPE, WEARABLE]],\n [\n /droid.+; (glass) \\d/i\n // Google Glass\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]],\n [/droid.+; (wt63?0{2,3})\\)/i],\n [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]],\n [\n /(quest( 2)?)/i\n // Oculus Quest\n ],\n [MODEL, [VENDOR, FACEBOOK], [TYPE, WEARABLE]],\n [\n ///////////////////\n // EMBEDDED\n ///////////////////\n /(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i\n // Tesla\n ],\n [VENDOR, [TYPE, EMBEDDED]],\n [\n ////////////////////\n // MIXED (GENERIC)\n ///////////////////\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i\n // Android Phones from Unidentified Vendors\n ],\n [MODEL, [TYPE, MOBILE]],\n [\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i\n // Android Tablets from Unidentified Vendors\n ],\n [MODEL, [TYPE, TABLET]],\n [\n /\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i\n // Unidentifiable Tablet\n ],\n [[TYPE, TABLET]],\n [\n /(phone|mobile(?:[;\\/]| [ \\w\\/\\.]*safari)|pda(?=.+windows ce))/i\n // Unidentifiable Mobile\n ],\n [[TYPE, MOBILE]],\n [\n /(android[-\\w\\. ]{0,9});.+buil/i\n // Generic Android Device\n ],\n [MODEL, [VENDOR, "Generic"]]\n ],\n engine: [\n [\n /windows.+ edge\\/([\\w\\.]+)/i\n // EdgeHTML\n ],\n [VERSION2, [NAME, EDGE + "HTML"]],\n [\n /webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i\n // Blink\n ],\n [VERSION2, [NAME, "Blink"]],\n [\n /(presto)\\/([\\w\\.]+)/i,\n // Presto\n /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i,\n // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna\n /ekioh(flow)\\/([\\w\\.]+)/i,\n // Flow\n /(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i,\n // KHTML/Tasman/Links\n /(icab)[\\/ ]([23]\\.[\\d\\.]+)/i\n // iCab\n ],\n [NAME, VERSION2],\n [\n /rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i\n // Gecko\n ],\n [VERSION2, NAME]\n ],\n os: [\n [\n // Windows\n /microsoft (windows) (vista|xp)/i\n // Windows (iTunes)\n ],\n [NAME, VERSION2],\n [\n /(windows) nt 6\\.2; (arm)/i,\n // Windows RT\n /(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i,\n // Windows Phone\n /(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i\n ],\n [NAME, [VERSION2, strMapper, windowsVersionMap]],\n [/(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i],\n [\n [NAME, "Windows"],\n [VERSION2, strMapper, windowsVersionMap]\n ],\n [\n // iOS/macOS\n /ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i,\n // iOS\n /cfnetwork\\/.+darwin/i\n ],\n [\n [VERSION2, /_/g, "."],\n [NAME, "iOS"]\n ],\n [\n /(mac os x) ?([\\w\\. ]*)/i,\n /(macintosh|mac_powerpc\\b)(?!.+haiku)/i\n // Mac OS\n ],\n [\n [NAME, "Mac OS"],\n [VERSION2, /_/g, "."]\n ],\n [\n // Mobile OSes\n /droid ([\\w\\.]+)\\b.+(android[- ]x86|harmonyos)/i\n // Android-x86/HarmonyOS\n ],\n [VERSION2, NAME],\n [\n // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS\n /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,\n /(blackberry)\\w*\\/([\\w\\.]*)/i,\n // Blackberry\n /(tizen|kaios)[\\/ ]([\\w\\.]+)/i,\n // Tizen/KaiOS\n /\\((series40);/i\n // Series 40\n ],\n [NAME, VERSION2],\n [\n /\\(bb(10);/i\n // BlackBerry 10\n ],\n [VERSION2, [NAME, BLACKBERRY]],\n [\n /(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i\n // Symbian\n ],\n [VERSION2, [NAME, "Symbian"]],\n [\n /mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i\n // Firefox OS\n ],\n [VERSION2, [NAME, FIREFOX + " OS"]],\n [\n /web0s;.+rt(tv)/i,\n /\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i\n // WebOS\n ],\n [VERSION2, [NAME, "webOS"]],\n [\n // Google Chromecast\n /crkey\\/([\\d\\.]+)/i\n // Google Chromecast\n ],\n [VERSION2, [NAME, CHROME + "cast"]],\n [\n /(cros) [\\w]+ ([\\w\\.]+\\w)/i\n // Chromium OS\n ],\n [[NAME, "Chromium OS"], VERSION2],\n [\n // Console\n /(nintendo|playstation) ([wids345portablevuch]+)/i,\n // Nintendo/Playstation\n /(xbox); +xbox ([^\\);]+)/i,\n // Microsoft Xbox (360, One, X, S, Series X, Series S)\n // Other\n /\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i,\n // Joli/Palm\n /(mint)[\\/\\(\\) ]?(\\w*)/i,\n // Mint\n /(mageia|vectorlinux)[; ]/i,\n // Mageia/VectorLinux\n /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,\n // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire\n /(hurd|linux) ?([\\w\\.]*)/i,\n // Hurd/Linux\n /(gnu) ?([\\w\\.]*)/i,\n // GNU\n /\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i,\n // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly\n /(haiku) (\\w+)/i\n // Haiku\n ],\n [NAME, VERSION2],\n [\n /(sunos) ?([\\w\\.\\d]*)/i\n // Solaris\n ],\n [[NAME, "Solaris"], VERSION2],\n [\n /((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i,\n // Solaris\n /(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i,\n // AIX\n /\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,\n // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX\n /(unix) ?([\\w\\.]*)/i\n // UNIX\n ],\n [NAME, VERSION2]\n ]\n };\n var UAParser2 = function(ua, extensions) {\n if (typeof ua === OBJ_TYPE) {\n extensions = ua;\n ua = undefined2;\n }\n if (!(this instanceof UAParser2)) {\n return new UAParser2(ua, extensions).getResult();\n }\n var _ua = ua || (typeof window2 !== UNDEF_TYPE && window2.navigator && window2.navigator.userAgent ? window2.navigator.userAgent : EMPTY);\n var _rgxmap = extensions ? extend(regexes, extensions) : regexes;\n this.getBrowser = function() {\n var _browser = {};\n _browser[NAME] = undefined2;\n _browser[VERSION2] = undefined2;\n rgxMapper.call(_browser, _ua, _rgxmap.browser);\n _browser.major = majorize(_browser.version);\n return _browser;\n };\n this.getCPU = function() {\n var _cpu = {};\n _cpu[ARCHITECTURE] = undefined2;\n rgxMapper.call(_cpu, _ua, _rgxmap.cpu);\n return _cpu;\n };\n this.getDevice = function() {\n var _device = {};\n _device[VENDOR] = undefined2;\n _device[MODEL] = undefined2;\n _device[TYPE] = undefined2;\n rgxMapper.call(_device, _ua, _rgxmap.device);\n return _device;\n };\n this.getEngine = function() {\n var _engine = {};\n _engine[NAME] = undefined2;\n _engine[VERSION2] = undefined2;\n rgxMapper.call(_engine, _ua, _rgxmap.engine);\n return _engine;\n };\n this.getOS = function() {\n var _os = {};\n _os[NAME] = undefined2;\n _os[VERSION2] = undefined2;\n rgxMapper.call(_os, _ua, _rgxmap.os);\n return _os;\n };\n this.getResult = function() {\n return {\n ua: this.getUA(),\n browser: this.getBrowser(),\n engine: this.getEngine(),\n os: this.getOS(),\n device: this.getDevice(),\n cpu: this.getCPU()\n };\n };\n this.getUA = function() {\n return _ua;\n };\n this.setUA = function(ua2) {\n _ua = typeof ua2 === STR_TYPE && ua2.length > UA_MAX_LENGTH ? trim(ua2, UA_MAX_LENGTH) : ua2;\n return this;\n };\n this.setUA(_ua);\n return this;\n };\n UAParser2.VERSION = LIBVERSION;\n UAParser2.BROWSER = enumerize([NAME, VERSION2, MAJOR]);\n UAParser2.CPU = enumerize([ARCHITECTURE]);\n UAParser2.DEVICE = enumerize([\n MODEL,\n VENDOR,\n TYPE,\n CONSOLE,\n MOBILE,\n SMARTTV,\n TABLET,\n WEARABLE,\n EMBEDDED\n ]);\n UAParser2.ENGINE = UAParser2.OS = enumerize([NAME, VERSION2]);\n if (typeof exports !== UNDEF_TYPE) {\n if (typeof module !== UNDEF_TYPE && module.exports) {\n exports = module.exports = UAParser2;\n }\n exports.UAParser = UAParser2;\n } else {\n if (typeof define === FUNC_TYPE && define.amd) {\n define(function() {\n return UAParser2;\n });\n } else if (typeof window2 !== UNDEF_TYPE) {\n window2.UAParser = UAParser2;\n }\n }\n var $ = typeof window2 !== UNDEF_TYPE && (window2.jQuery || window2.Zepto);\n if ($ && !$.ua) {\n var parser = new UAParser2();\n $.ua = parser.getResult();\n $.ua.get = function() {\n return parser.getUA();\n };\n $.ua.set = function(ua) {\n parser.setUA(ua);\n var result = parser.getResult();\n for (var prop in result) {\n $.ua[prop] = result[prop];\n }\n };\n }\n })(typeof window === "object" ? window : exports);\n }\n });\n\n // packages/dev-tools/common/constants.ts\n var PUBLIC_API_KEY_QS = `api-key`;\n var PRIVATE_AUTH_KEY_QS = `p-key`;\n var PREVIEW_URL_QS = `preview-url`;\n var USER_ID_QS = `user-id`;\n var CONNECTED_USER_ID_QS = "_b-uid";\n var FRAMEWORK_QS = `framework`;\n var PLATFORM_QS = `platform`;\n var NODE_VERSION_QS = `node`;\n var DEV_TOOLS_API_PATH = "/~builder-dev-tools";\n var SPACE_KIND_QS = `kind`;\n\n // packages/dev-tools/client/utils.ts\n var DEV_TOOLS_URL = "__DEV_TOOLS_URL__";\n\n // packages/dev-tools/client/client-api.ts\n var apiConnectBuilder = (publicApiKey, privateAuthKey, kind) => apiFetch({\n type: "connectBuilder",\n data: {\n publicApiKey,\n privateAuthKey,\n kind\n }\n });\n var apiValidateBuilder = () => apiFetch({\n type: "validateBuilder"\n });\n var apiLaunchEditor = (file) => apiFetch({\n type: "launchEditor",\n data: file\n });\n var apiFetch = async (data) => {\n const url = new URL(DEV_TOOLS_API_PATH, DEV_TOOLS_URL);\n let rsp;\n try {\n rsp = await fetch(url, {\n method: "POST",\n body: JSON.stringify(data)\n });\n } catch (e) {\n console.error(`Devtools Fetch Error, ${url.href}`, e);\n throw new Error(`Builder Devtools Fetch Error`);\n }\n const contentType = rsp.headers.get("content-type") || "";\n if (contentType.includes("application/json")) {\n const r = await rsp.json();\n if (rsp.ok) {\n return r.data;\n }\n if (Array.isArray(r.errors) && r.errors.length > 0) {\n r.errors.forEach((e) => console.error(e));\n throw new Error(`Builder Devtools Fetch Error: ${r.errors[0]}`);\n }\n }\n throw new Error(\n `Builder Devtools Fetch Error: ${rsp.status}, ${await rsp.text()}`\n );\n };\n\n // node_modules/tslib/tslib.es6.mjs\n var extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {\n d2.__proto__ = b2;\n } || function(d2, b2) {\n for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];\n };\n return extendStatics(d, b);\n };\n function __extends(d, b) {\n if (typeof b !== "function" && b !== null)\n throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n }\n var __assign = function() {\n __assign = Object.assign || function __assign3(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === "function")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n }\n function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function(resolve) {\n resolve(value);\n });\n }\n return new (P || (P = Promise))(function(resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator["throw"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n }\n function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() {\n if (t[0] & 1) throw t[1];\n return t[1];\n }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);\n return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {\n return this;\n }), g;\n function verb(n) {\n return function(v) {\n return step([n, v]);\n };\n }\n function step(op) {\n if (f) throw new TypeError("Generator is already executing.");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return { value: op[1], done: false };\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return { value: op[0] ? op[1] : void 0, done: true };\n }\n }\n function __values(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function() {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n }\n function __read(o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = { error };\n } finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n return ar;\n }\n function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n }\n\n // node_modules/@amplitude/analytics-types/lib/esm/event.js\n var IdentifyOperation;\n (function(IdentifyOperation2) {\n IdentifyOperation2["SET"] = "$set";\n IdentifyOperation2["SET_ONCE"] = "$setOnce";\n IdentifyOperation2["ADD"] = "$add";\n IdentifyOperation2["APPEND"] = "$append";\n IdentifyOperation2["PREPEND"] = "$prepend";\n IdentifyOperation2["REMOVE"] = "$remove";\n IdentifyOperation2["PREINSERT"] = "$preInsert";\n IdentifyOperation2["POSTINSERT"] = "$postInsert";\n IdentifyOperation2["UNSET"] = "$unset";\n IdentifyOperation2["CLEAR_ALL"] = "$clearAll";\n })(IdentifyOperation || (IdentifyOperation = {}));\n var RevenueProperty;\n (function(RevenueProperty2) {\n RevenueProperty2["REVENUE_PRODUCT_ID"] = "$productId";\n RevenueProperty2["REVENUE_QUANTITY"] = "$quantity";\n RevenueProperty2["REVENUE_PRICE"] = "$price";\n RevenueProperty2["REVENUE_TYPE"] = "$revenueType";\n RevenueProperty2["REVENUE_CURRENCY"] = "$currency";\n RevenueProperty2["REVENUE"] = "$revenue";\n })(RevenueProperty || (RevenueProperty = {}));\n var SpecialEventType;\n (function(SpecialEventType2) {\n SpecialEventType2["IDENTIFY"] = "$identify";\n SpecialEventType2["GROUP_IDENTIFY"] = "$groupidentify";\n SpecialEventType2["REVENUE"] = "revenue_amount";\n })(SpecialEventType || (SpecialEventType = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/logger.js\n var LogLevel;\n (function(LogLevel2) {\n LogLevel2[LogLevel2["None"] = 0] = "None";\n LogLevel2[LogLevel2["Error"] = 1] = "Error";\n LogLevel2[LogLevel2["Warn"] = 2] = "Warn";\n LogLevel2[LogLevel2["Verbose"] = 3] = "Verbose";\n LogLevel2[LogLevel2["Debug"] = 4] = "Debug";\n })(LogLevel || (LogLevel = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/plugin.js\n var PluginType;\n (function(PluginType2) {\n PluginType2["BEFORE"] = "before";\n PluginType2["ENRICHMENT"] = "enrichment";\n PluginType2["DESTINATION"] = "destination";\n })(PluginType || (PluginType = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/server-zone.js\n var ServerZone;\n (function(ServerZone2) {\n ServerZone2["US"] = "US";\n ServerZone2["EU"] = "EU";\n ServerZone2["STAGING"] = "STAGING";\n })(ServerZone || (ServerZone = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/status.js\n var Status;\n (function(Status2) {\n Status2["Unknown"] = "unknown";\n Status2["Skipped"] = "skipped";\n Status2["Success"] = "success";\n Status2["RateLimit"] = "rate_limit";\n Status2["PayloadTooLarge"] = "payload_too_large";\n Status2["Invalid"] = "invalid";\n Status2["Failed"] = "failed";\n Status2["Timeout"] = "Timeout";\n Status2["SystemError"] = "SystemError";\n })(Status || (Status = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/transport.js\n var TransportType;\n (function(TransportType2) {\n TransportType2["XHR"] = "xhr";\n TransportType2["SendBeacon"] = "beacon";\n TransportType2["Fetch"] = "fetch";\n })(TransportType || (TransportType = {}));\n\n // node_modules/@amplitude/analytics-core/lib/esm/constants.js\n var UNSET_VALUE = "-";\n var AMPLITUDE_PREFIX = "AMP";\n var STORAGE_PREFIX = "".concat(AMPLITUDE_PREFIX, "_unsent");\n var AMPLITUDE_SERVER_URL = "https://api2.amplitude.com/2/httpapi";\n var EU_AMPLITUDE_SERVER_URL = "https://api.eu.amplitude.com/2/httpapi";\n var AMPLITUDE_BATCH_SERVER_URL = "https://api2.amplitude.com/batch";\n var EU_AMPLITUDE_BATCH_SERVER_URL = "https://api.eu.amplitude.com/batch";\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js\n var MAX_PROPERTY_KEYS = 1e3;\n var isValidObject = function(properties) {\n if (Object.keys(properties).length > MAX_PROPERTY_KEYS) {\n return false;\n }\n for (var key in properties) {\n var value = properties[key];\n if (!isValidProperties(key, value))\n return false;\n }\n return true;\n };\n var isValidProperties = function(property, value) {\n var e_1, _a;\n if (typeof property !== "string")\n return false;\n if (Array.isArray(value)) {\n var isValid = true;\n try {\n for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {\n var valueElement = value_1_1.value;\n if (Array.isArray(valueElement)) {\n return false;\n } else if (typeof valueElement === "object") {\n isValid = isValid && isValidObject(valueElement);\n } else if (!["number", "string"].includes(typeof valueElement)) {\n return false;\n }\n if (!isValid) {\n return false;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n } else if (value === null || value === void 0) {\n return false;\n } else if (typeof value === "object") {\n return isValidObject(value);\n } else if (!["number", "string", "boolean"].includes(typeof value)) {\n return false;\n }\n return true;\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/identify.js\n var Identify = (\n /** @class */\n (function() {\n function Identify2() {\n this._propertySet = /* @__PURE__ */ new Set();\n this._properties = {};\n }\n Identify2.prototype.getUserProperties = function() {\n return __assign({}, this._properties);\n };\n Identify2.prototype.set = function(property, value) {\n this._safeSet(IdentifyOperation.SET, property, value);\n return this;\n };\n Identify2.prototype.setOnce = function(property, value) {\n this._safeSet(IdentifyOperation.SET_ONCE, property, value);\n return this;\n };\n Identify2.prototype.append = function(property, value) {\n this._safeSet(IdentifyOperation.APPEND, property, value);\n return this;\n };\n Identify2.prototype.prepend = function(property, value) {\n this._safeSet(IdentifyOperation.PREPEND, property, value);\n return this;\n };\n Identify2.prototype.postInsert = function(property, value) {\n this._safeSet(IdentifyOperation.POSTINSERT, property, value);\n return this;\n };\n Identify2.prototype.preInsert = function(property, value) {\n this._safeSet(IdentifyOperation.PREINSERT, property, value);\n return this;\n };\n Identify2.prototype.remove = function(property, value) {\n this._safeSet(IdentifyOperation.REMOVE, property, value);\n return this;\n };\n Identify2.prototype.add = function(property, value) {\n this._safeSet(IdentifyOperation.ADD, property, value);\n return this;\n };\n Identify2.prototype.unset = function(property) {\n this._safeSet(IdentifyOperation.UNSET, property, UNSET_VALUE);\n return this;\n };\n Identify2.prototype.clearAll = function() {\n this._properties = {};\n this._properties[IdentifyOperation.CLEAR_ALL] = UNSET_VALUE;\n return this;\n };\n Identify2.prototype._safeSet = function(operation, property, value) {\n if (this._validate(operation, property, value)) {\n var userPropertyMap = this._properties[operation];\n if (userPropertyMap === void 0) {\n userPropertyMap = {};\n this._properties[operation] = userPropertyMap;\n }\n userPropertyMap[property] = value;\n this._propertySet.add(property);\n return true;\n }\n return false;\n };\n Identify2.prototype._validate = function(operation, property, value) {\n if (this._properties[IdentifyOperation.CLEAR_ALL] !== void 0) {\n return false;\n }\n if (this._propertySet.has(property)) {\n return false;\n }\n if (operation === IdentifyOperation.ADD) {\n return typeof value === "number";\n }\n if (operation !== IdentifyOperation.UNSET && operation !== IdentifyOperation.REMOVE) {\n return isValidProperties(property, value);\n }\n return true;\n };\n return Identify2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js\n var createTrackEvent = function(eventInput, eventProperties, eventOptions) {\n var baseEvent = typeof eventInput === "string" ? { event_type: eventInput } : eventInput;\n return __assign(__assign(__assign({}, baseEvent), eventOptions), eventProperties && { event_properties: eventProperties });\n };\n var createIdentifyEvent = function(identify2, eventOptions) {\n var identifyEvent = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.IDENTIFY, user_properties: identify2.getUserProperties() });\n return identifyEvent;\n };\n var createGroupIdentifyEvent = function(groupType, groupName, identify2, eventOptions) {\n var _a;\n var groupIdentify2 = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.GROUP_IDENTIFY, group_properties: identify2.getUserProperties(), groups: (_a = {}, _a[groupType] = groupName, _a) });\n return groupIdentify2;\n };\n var createGroupEvent = function(groupType, groupName, eventOptions) {\n var _a;\n var identify2 = new Identify();\n identify2.set(groupType, groupName);\n var groupEvent = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.IDENTIFY, user_properties: identify2.getUserProperties(), groups: (_a = {}, _a[groupType] = groupName, _a) });\n return groupEvent;\n };\n var createRevenueEvent = function(revenue2, eventOptions) {\n return __assign(__assign({}, eventOptions), { event_type: SpecialEventType.REVENUE, event_properties: revenue2.getEventProperties() });\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js\n var buildResult = function(event, code, message) {\n if (code === void 0) {\n code = 0;\n }\n if (message === void 0) {\n message = Status.Unknown;\n }\n return { event, code, message };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/timeline.js\n var Timeline = (\n /** @class */\n (function() {\n function Timeline2(client) {\n this.client = client;\n this.queue = [];\n this.applying = false;\n this.plugins = [];\n }\n Timeline2.prototype.register = function(plugin, config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, plugin.setup(config, this.client)];\n case 1:\n _a.sent();\n this.plugins.push(plugin);\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.deregister = function(pluginName, config) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var index, plugin;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n index = this.plugins.findIndex(function(plugin2) {\n return plugin2.name === pluginName;\n });\n if (index === -1) {\n config.loggerProvider.warn("Plugin with name ".concat(pluginName, " does not exist, skipping deregistration"));\n return [\n 2\n /*return*/\n ];\n }\n plugin = this.plugins[index];\n this.plugins.splice(index, 1);\n return [4, (_a = plugin.teardown) === null || _a === void 0 ? void 0 : _a.call(plugin)];\n case 1:\n _b.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.reset = function(client) {\n this.applying = false;\n var plugins = this.plugins;\n plugins.map(function(plugin) {\n var _a;\n return (_a = plugin.teardown) === null || _a === void 0 ? void 0 : _a.call(plugin);\n });\n this.plugins = [];\n this.client = client;\n };\n Timeline2.prototype.push = function(event) {\n var _this = this;\n return new Promise(function(resolve) {\n _this.queue.push([event, resolve]);\n _this.scheduleApply(0);\n });\n };\n Timeline2.prototype.scheduleApply = function(timeout) {\n var _this = this;\n if (this.applying)\n return;\n this.applying = true;\n setTimeout(function() {\n void _this.apply(_this.queue.shift()).then(function() {\n _this.applying = false;\n if (_this.queue.length > 0) {\n _this.scheduleApply(0);\n }\n });\n }, timeout);\n };\n Timeline2.prototype.apply = function(item) {\n return __awaiter(this, void 0, void 0, function() {\n var _a, event, _b, resolve, before, before_1, before_1_1, plugin, e, e_1_1, enrichment, enrichment_1, enrichment_1_1, plugin, e, e_2_1, destination, executeDestinations;\n var e_1, _c, e_2, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n if (!item) {\n return [\n 2\n /*return*/\n ];\n }\n _a = __read(item, 1), event = _a[0];\n _b = __read(item, 2), resolve = _b[1];\n before = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.BEFORE;\n });\n _e.label = 1;\n case 1:\n _e.trys.push([1, 6, 7, 8]);\n before_1 = __values(before), before_1_1 = before_1.next();\n _e.label = 2;\n case 2:\n if (!!before_1_1.done) return [3, 5];\n plugin = before_1_1.value;\n return [4, plugin.execute(__assign({}, event))];\n case 3:\n e = _e.sent();\n if (e === null) {\n resolve({ event, code: 0, message: "" });\n return [\n 2\n /*return*/\n ];\n } else {\n event = e;\n }\n _e.label = 4;\n case 4:\n before_1_1 = before_1.next();\n return [3, 2];\n case 5:\n return [3, 8];\n case 6:\n e_1_1 = _e.sent();\n e_1 = { error: e_1_1 };\n return [3, 8];\n case 7:\n try {\n if (before_1_1 && !before_1_1.done && (_c = before_1.return)) _c.call(before_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 8:\n enrichment = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.ENRICHMENT;\n });\n _e.label = 9;\n case 9:\n _e.trys.push([9, 14, 15, 16]);\n enrichment_1 = __values(enrichment), enrichment_1_1 = enrichment_1.next();\n _e.label = 10;\n case 10:\n if (!!enrichment_1_1.done) return [3, 13];\n plugin = enrichment_1_1.value;\n return [4, plugin.execute(__assign({}, event))];\n case 11:\n e = _e.sent();\n if (e === null) {\n resolve({ event, code: 0, message: "" });\n return [\n 2\n /*return*/\n ];\n } else {\n event = e;\n }\n _e.label = 12;\n case 12:\n enrichment_1_1 = enrichment_1.next();\n return [3, 10];\n case 13:\n return [3, 16];\n case 14:\n e_2_1 = _e.sent();\n e_2 = { error: e_2_1 };\n return [3, 16];\n case 15:\n try {\n if (enrichment_1_1 && !enrichment_1_1.done && (_d = enrichment_1.return)) _d.call(enrichment_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 16:\n destination = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.DESTINATION;\n });\n executeDestinations = destination.map(function(plugin2) {\n var eventClone = __assign({}, event);\n return plugin2.execute(eventClone).catch(function(e2) {\n return buildResult(eventClone, 0, String(e2));\n });\n });\n void Promise.all(executeDestinations).then(function(_a2) {\n var _b2 = __read(_a2, 1), result = _b2[0];\n resolve(result);\n });\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.flush = function() {\n return __awaiter(this, void 0, void 0, function() {\n var queue, destination, executeDestinations;\n var _this = this;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n queue = this.queue;\n this.queue = [];\n return [4, Promise.all(queue.map(function(item) {\n return _this.apply(item);\n }))];\n case 1:\n _a.sent();\n destination = this.plugins.filter(function(plugin) {\n return plugin.type === PluginType.DESTINATION;\n });\n executeDestinations = destination.map(function(plugin) {\n return plugin.flush && plugin.flush();\n });\n return [4, Promise.all(executeDestinations)];\n case 2:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n return Timeline2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/messages.js\n var SUCCESS_MESSAGE = "Event tracked successfully";\n var UNEXPECTED_ERROR_MESSAGE = "Unexpected error occurred";\n var MAX_RETRIES_EXCEEDED_MESSAGE = "Event rejected due to exceeded retry count";\n var OPT_OUT_MESSAGE = "Event skipped due to optOut config";\n var MISSING_API_KEY_MESSAGE = "Event rejected due to missing API key";\n var INVALID_API_KEY = "Invalid API key";\n var CLIENT_NOT_INITIALIZED = "Client not initialized";\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js\n var returnWrapper = function(awaitable) {\n return {\n promise: awaitable || Promise.resolve()\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/core-client.js\n var AmplitudeCore = (\n /** @class */\n (function() {\n function AmplitudeCore2(name) {\n if (name === void 0) {\n name = "$default";\n }\n this.initializing = false;\n this.q = [];\n this.dispatchQ = [];\n this.logEvent = this.track.bind(this);\n this.timeline = new Timeline(this);\n this.name = name;\n }\n AmplitudeCore2.prototype._init = function(config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n this.config = config;\n this.timeline.reset(this);\n return [4, this.runQueuedFunctions("q")];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.runQueuedFunctions = function(queueName) {\n return __awaiter(this, void 0, void 0, function() {\n var queuedFunctions, queuedFunctions_1, queuedFunctions_1_1, queuedFunction, e_1_1;\n var e_1, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n queuedFunctions = this[queueName];\n this[queueName] = [];\n _b.label = 1;\n case 1:\n _b.trys.push([1, 6, 7, 8]);\n queuedFunctions_1 = __values(queuedFunctions), queuedFunctions_1_1 = queuedFunctions_1.next();\n _b.label = 2;\n case 2:\n if (!!queuedFunctions_1_1.done) return [3, 5];\n queuedFunction = queuedFunctions_1_1.value;\n return [4, queuedFunction()];\n case 3:\n _b.sent();\n _b.label = 4;\n case 4:\n queuedFunctions_1_1 = queuedFunctions_1.next();\n return [3, 2];\n case 5:\n return [3, 8];\n case 6:\n e_1_1 = _b.sent();\n e_1 = { error: e_1_1 };\n return [3, 8];\n case 7:\n try {\n if (queuedFunctions_1_1 && !queuedFunctions_1_1.done && (_a = queuedFunctions_1.return)) _a.call(queuedFunctions_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 8:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.track = function(eventInput, eventProperties, eventOptions) {\n var event = createTrackEvent(eventInput, eventProperties, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.identify = function(identify2, eventOptions) {\n var event = createIdentifyEvent(identify2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.groupIdentify = function(groupType, groupName, identify2, eventOptions) {\n var event = createGroupIdentifyEvent(groupType, groupName, identify2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.setGroup = function(groupType, groupName, eventOptions) {\n var event = createGroupEvent(groupType, groupName, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.revenue = function(revenue2, eventOptions) {\n var event = createRevenueEvent(revenue2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.add = function(plugin) {\n if (!this.config) {\n this.q.push(this.add.bind(this, plugin));\n return returnWrapper();\n }\n return returnWrapper(this.timeline.register(plugin, this.config));\n };\n AmplitudeCore2.prototype.remove = function(pluginName) {\n if (!this.config) {\n this.q.push(this.remove.bind(this, pluginName));\n return returnWrapper();\n }\n return returnWrapper(this.timeline.deregister(pluginName, this.config));\n };\n AmplitudeCore2.prototype.dispatchWithCallback = function(event, callback) {\n if (!this.config) {\n return callback(buildResult(event, 0, CLIENT_NOT_INITIALIZED));\n }\n void this.process(event).then(callback);\n };\n AmplitudeCore2.prototype.dispatch = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n if (!this.config) {\n return [2, new Promise(function(resolve) {\n _this.dispatchQ.push(_this.dispatchWithCallback.bind(_this, event, resolve));\n })];\n }\n return [2, this.process(event)];\n });\n });\n };\n AmplitudeCore2.prototype.process = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var result, e_2, message, result;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n if (this.config.optOut) {\n return [2, buildResult(event, 0, OPT_OUT_MESSAGE)];\n }\n return [4, this.timeline.push(event)];\n case 1:\n result = _a.sent();\n result.code === 200 ? this.config.loggerProvider.log(result.message) : this.config.loggerProvider.error(result.message);\n return [2, result];\n case 2:\n e_2 = _a.sent();\n this.config.loggerProvider.error(e_2);\n message = String(e_2);\n result = buildResult(event, 0, message);\n return [2, result];\n case 3:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.setOptOut = function(optOut) {\n if (!this.config) {\n this.q.push(this.setOptOut.bind(this, Boolean(optOut)));\n return;\n }\n this.config.optOut = Boolean(optOut);\n };\n AmplitudeCore2.prototype.flush = function() {\n return returnWrapper(this.timeline.flush());\n };\n return AmplitudeCore2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/revenue.js\n var Revenue = (\n /** @class */\n (function() {\n function Revenue2() {\n this.productId = "";\n this.quantity = 1;\n this.price = 0;\n }\n Revenue2.prototype.setProductId = function(productId) {\n this.productId = productId;\n return this;\n };\n Revenue2.prototype.setQuantity = function(quantity) {\n if (quantity > 0) {\n this.quantity = quantity;\n }\n return this;\n };\n Revenue2.prototype.setPrice = function(price) {\n this.price = price;\n return this;\n };\n Revenue2.prototype.setRevenueType = function(revenueType) {\n this.revenueType = revenueType;\n return this;\n };\n Revenue2.prototype.setCurrency = function(currency) {\n this.currency = currency;\n return this;\n };\n Revenue2.prototype.setRevenue = function(revenue2) {\n this.revenue = revenue2;\n return this;\n };\n Revenue2.prototype.setEventProperties = function(properties) {\n if (isValidObject(properties)) {\n this.properties = properties;\n }\n return this;\n };\n Revenue2.prototype.getEventProperties = function() {\n var eventProperties = this.properties ? __assign({}, this.properties) : {};\n eventProperties[RevenueProperty.REVENUE_PRODUCT_ID] = this.productId;\n eventProperties[RevenueProperty.REVENUE_QUANTITY] = this.quantity;\n eventProperties[RevenueProperty.REVENUE_PRICE] = this.price;\n eventProperties[RevenueProperty.REVENUE_TYPE] = this.revenueType;\n eventProperties[RevenueProperty.REVENUE_CURRENCY] = this.currency;\n eventProperties[RevenueProperty.REVENUE] = this.revenue;\n return eventProperties;\n };\n return Revenue2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js\n var chunk = function(arr, size) {\n var chunkSize = Math.max(size, 1);\n return arr.reduce(function(chunks, element, index) {\n var chunkIndex = Math.floor(index / chunkSize);\n if (!chunks[chunkIndex]) {\n chunks[chunkIndex] = [];\n }\n chunks[chunkIndex].push(element);\n return chunks;\n }, []);\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/logger.js\n var PREFIX = "Amplitude Logger ";\n var Logger = (\n /** @class */\n (function() {\n function Logger2() {\n this.logLevel = LogLevel.None;\n }\n Logger2.prototype.disable = function() {\n this.logLevel = LogLevel.None;\n };\n Logger2.prototype.enable = function(logLevel) {\n if (logLevel === void 0) {\n logLevel = LogLevel.Warn;\n }\n this.logLevel = logLevel;\n };\n Logger2.prototype.log = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Verbose) {\n return;\n }\n console.log("".concat(PREFIX, "[Log]: ").concat(args.join(" ")));\n };\n Logger2.prototype.warn = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Warn) {\n return;\n }\n console.warn("".concat(PREFIX, "[Warn]: ").concat(args.join(" ")));\n };\n Logger2.prototype.error = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Error) {\n return;\n }\n console.error("".concat(PREFIX, "[Error]: ").concat(args.join(" ")));\n };\n Logger2.prototype.debug = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Debug) {\n return;\n }\n console.log("".concat(PREFIX, "[Debug]: ").concat(args.join(" ")));\n };\n return Logger2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/config.js\n var getDefaultConfig = function() {\n return {\n flushMaxRetries: 12,\n flushQueueSize: 200,\n flushIntervalMillis: 1e4,\n instanceName: "$default_instance",\n logLevel: LogLevel.Warn,\n loggerProvider: new Logger(),\n optOut: false,\n serverUrl: AMPLITUDE_SERVER_URL,\n serverZone: ServerZone.US,\n useBatch: false\n };\n };\n var Config = (\n /** @class */\n (function() {\n function Config2(options) {\n var _a, _b, _c, _d;\n this._optOut = false;\n var defaultConfig = getDefaultConfig();\n this.apiKey = options.apiKey;\n this.flushIntervalMillis = (_a = options.flushIntervalMillis) !== null && _a !== void 0 ? _a : defaultConfig.flushIntervalMillis;\n this.flushMaxRetries = options.flushMaxRetries || defaultConfig.flushMaxRetries;\n this.flushQueueSize = options.flushQueueSize || defaultConfig.flushQueueSize;\n this.instanceName = options.instanceName || defaultConfig.instanceName;\n this.loggerProvider = options.loggerProvider || defaultConfig.loggerProvider;\n this.logLevel = (_b = options.logLevel) !== null && _b !== void 0 ? _b : defaultConfig.logLevel;\n this.minIdLength = options.minIdLength;\n this.plan = options.plan;\n this.ingestionMetadata = options.ingestionMetadata;\n this.optOut = (_c = options.optOut) !== null && _c !== void 0 ? _c : defaultConfig.optOut;\n this.serverUrl = options.serverUrl;\n this.serverZone = options.serverZone || defaultConfig.serverZone;\n this.storageProvider = options.storageProvider;\n this.transportProvider = options.transportProvider;\n this.useBatch = (_d = options.useBatch) !== null && _d !== void 0 ? _d : defaultConfig.useBatch;\n this.loggerProvider.enable(this.logLevel);\n var serverConfig = createServerConfig(options.serverUrl, options.serverZone, options.useBatch);\n this.serverZone = serverConfig.serverZone;\n this.serverUrl = serverConfig.serverUrl;\n }\n Object.defineProperty(Config2.prototype, "optOut", {\n get: function() {\n return this._optOut;\n },\n set: function(optOut) {\n this._optOut = optOut;\n },\n enumerable: false,\n configurable: true\n });\n return Config2;\n })()\n );\n var getServerUrl = function(serverZone, useBatch) {\n if (serverZone === ServerZone.EU) {\n return useBatch ? EU_AMPLITUDE_BATCH_SERVER_URL : EU_AMPLITUDE_SERVER_URL;\n }\n return useBatch ? AMPLITUDE_BATCH_SERVER_URL : AMPLITUDE_SERVER_URL;\n };\n var createServerConfig = function(serverUrl, serverZone, useBatch) {\n if (serverUrl === void 0) {\n serverUrl = "";\n }\n if (serverZone === void 0) {\n serverZone = getDefaultConfig().serverZone;\n }\n if (useBatch === void 0) {\n useBatch = getDefaultConfig().useBatch;\n }\n if (serverUrl) {\n return { serverUrl, serverZone: void 0 };\n }\n var _serverZone = ["US", "EU"].includes(serverZone) ? serverZone : getDefaultConfig().serverZone;\n return {\n serverZone: _serverZone,\n serverUrl: getServerUrl(_serverZone, useBatch)\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js\n function getErrorMessage(error) {\n if (error instanceof Error)\n return error.message;\n return String(error);\n }\n function getResponseBodyString(res) {\n var responseBodyString = "";\n try {\n if ("body" in res) {\n responseBodyString = JSON.stringify(res.body);\n }\n } catch (_a) {\n }\n return responseBodyString;\n }\n var Destination = (\n /** @class */\n (function() {\n function Destination2() {\n this.name = "amplitude";\n this.type = PluginType.DESTINATION;\n this.retryTimeout = 1e3;\n this.throttleTimeout = 3e4;\n this.storageKey = "";\n this.scheduled = null;\n this.queue = [];\n }\n Destination2.prototype.setup = function(config) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var unsent;\n var _this = this;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n this.config = config;\n this.storageKey = "".concat(STORAGE_PREFIX, "_").concat(this.config.apiKey.substring(0, 10));\n return [4, (_a = this.config.storageProvider) === null || _a === void 0 ? void 0 : _a.get(this.storageKey)];\n case 1:\n unsent = _b.sent();\n this.saveEvents();\n if (unsent && unsent.length > 0) {\n void Promise.all(unsent.map(function(event) {\n return _this.execute(event);\n })).catch();\n }\n return [2, Promise.resolve(void 0)];\n }\n });\n });\n };\n Destination2.prototype.execute = function(event) {\n var _this = this;\n return new Promise(function(resolve) {\n var context = {\n event,\n attempts: 0,\n callback: function(result) {\n return resolve(result);\n },\n timeout: 0\n };\n void _this.addToQueue(context);\n });\n };\n Destination2.prototype.addToQueue = function() {\n var _this = this;\n var list = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n list[_i] = arguments[_i];\n }\n var tryable = list.filter(function(context) {\n if (context.attempts < _this.config.flushMaxRetries) {\n context.attempts += 1;\n return true;\n }\n void _this.fulfillRequest([context], 500, MAX_RETRIES_EXCEEDED_MESSAGE);\n return false;\n });\n tryable.forEach(function(context) {\n _this.queue = _this.queue.concat(context);\n if (context.timeout === 0) {\n _this.schedule(_this.config.flushIntervalMillis);\n return;\n }\n setTimeout(function() {\n context.timeout = 0;\n _this.schedule(0);\n }, context.timeout);\n });\n this.saveEvents();\n };\n Destination2.prototype.schedule = function(timeout) {\n var _this = this;\n if (this.scheduled)\n return;\n this.scheduled = setTimeout(function() {\n void _this.flush(true).then(function() {\n if (_this.queue.length > 0) {\n _this.schedule(timeout);\n }\n });\n }, timeout);\n };\n Destination2.prototype.flush = function(useRetry) {\n if (useRetry === void 0) {\n useRetry = false;\n }\n return __awaiter(this, void 0, void 0, function() {\n var list, later, batches;\n var _this = this;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n list = [];\n later = [];\n this.queue.forEach(function(context) {\n return context.timeout === 0 ? list.push(context) : later.push(context);\n });\n this.queue = later;\n if (this.scheduled) {\n clearTimeout(this.scheduled);\n this.scheduled = null;\n }\n batches = chunk(list, this.config.flushQueueSize);\n return [4, Promise.all(batches.map(function(batch) {\n return _this.send(batch, useRetry);\n }))];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Destination2.prototype.send = function(list, useRetry) {\n if (useRetry === void 0) {\n useRetry = true;\n }\n return __awaiter(this, void 0, void 0, function() {\n var payload, serverUrl, res, e_1, errorMessage;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n if (!this.config.apiKey) {\n return [2, this.fulfillRequest(list, 400, MISSING_API_KEY_MESSAGE)];\n }\n payload = {\n api_key: this.config.apiKey,\n events: list.map(function(context) {\n var _a2 = context.event, extra = _a2.extra, eventWithoutExtra = __rest(_a2, ["extra"]);\n return eventWithoutExtra;\n }),\n options: {\n min_id_length: this.config.minIdLength\n }\n };\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n serverUrl = createServerConfig(this.config.serverUrl, this.config.serverZone, this.config.useBatch).serverUrl;\n return [4, this.config.transportProvider.send(serverUrl, payload)];\n case 2:\n res = _a.sent();\n if (res === null) {\n this.fulfillRequest(list, 0, UNEXPECTED_ERROR_MESSAGE);\n return [\n 2\n /*return*/\n ];\n }\n if (!useRetry) {\n if ("body" in res) {\n this.fulfillRequest(list, res.statusCode, "".concat(res.status, ": ").concat(getResponseBodyString(res)));\n } else {\n this.fulfillRequest(list, res.statusCode, res.status);\n }\n return [\n 2\n /*return*/\n ];\n }\n this.handleResponse(res, list);\n return [3, 4];\n case 3:\n e_1 = _a.sent();\n this.config.loggerProvider.error(e_1);\n errorMessage = getErrorMessage(e_1);\n this.fulfillRequest(list, 0, errorMessage);\n return [3, 4];\n case 4:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Destination2.prototype.handleResponse = function(res, list) {\n var status = res.status;\n switch (status) {\n case Status.Success: {\n this.handleSuccessResponse(res, list);\n break;\n }\n case Status.Invalid: {\n this.handleInvalidResponse(res, list);\n break;\n }\n case Status.PayloadTooLarge: {\n this.handlePayloadTooLargeResponse(res, list);\n break;\n }\n case Status.RateLimit: {\n this.handleRateLimitResponse(res, list);\n break;\n }\n default: {\n this.config.loggerProvider.warn(`{code: 0, error: "Status \'`.concat(status, "\' provided for ").concat(list.length, \' events"}\'));\n this.handleOtherResponse(list);\n break;\n }\n }\n };\n Destination2.prototype.handleSuccessResponse = function(res, list) {\n this.fulfillRequest(list, res.statusCode, SUCCESS_MESSAGE);\n };\n Destination2.prototype.handleInvalidResponse = function(res, list) {\n var _this = this;\n if (res.body.missingField || res.body.error.startsWith(INVALID_API_KEY)) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n var dropIndex = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(Object.values(res.body.eventsWithInvalidFields)), false), __read(Object.values(res.body.eventsWithMissingFields)), false), __read(Object.values(res.body.eventsWithInvalidIdLengths)), false), __read(res.body.silencedEvents), false).flat();\n var dropIndexSet = new Set(dropIndex);\n var retry = list.filter(function(context, index) {\n if (dropIndexSet.has(index)) {\n _this.fulfillRequest([context], res.statusCode, res.body.error);\n return;\n }\n return true;\n });\n if (retry.length > 0) {\n this.config.loggerProvider.warn(getResponseBodyString(res));\n }\n this.addToQueue.apply(this, __spreadArray([], __read(retry), false));\n };\n Destination2.prototype.handlePayloadTooLargeResponse = function(res, list) {\n if (list.length === 1) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n this.config.loggerProvider.warn(getResponseBodyString(res));\n this.config.flushQueueSize /= 2;\n this.addToQueue.apply(this, __spreadArray([], __read(list), false));\n };\n Destination2.prototype.handleRateLimitResponse = function(res, list) {\n var _this = this;\n var dropUserIds = Object.keys(res.body.exceededDailyQuotaUsers);\n var dropDeviceIds = Object.keys(res.body.exceededDailyQuotaDevices);\n var throttledIndex = res.body.throttledEvents;\n var dropUserIdsSet = new Set(dropUserIds);\n var dropDeviceIdsSet = new Set(dropDeviceIds);\n var throttledIndexSet = new Set(throttledIndex);\n var retry = list.filter(function(context, index) {\n if (context.event.user_id && dropUserIdsSet.has(context.event.user_id) || context.event.device_id && dropDeviceIdsSet.has(context.event.device_id)) {\n _this.fulfillRequest([context], res.statusCode, res.body.error);\n return;\n }\n if (throttledIndexSet.has(index)) {\n context.timeout = _this.throttleTimeout;\n }\n return true;\n });\n if (retry.length > 0) {\n this.config.loggerProvider.warn(getResponseBodyString(res));\n }\n this.addToQueue.apply(this, __spreadArray([], __read(retry), false));\n };\n Destination2.prototype.handleOtherResponse = function(list) {\n var _this = this;\n this.addToQueue.apply(this, __spreadArray([], __read(list.map(function(context) {\n context.timeout = context.attempts * _this.retryTimeout;\n return context;\n })), false));\n };\n Destination2.prototype.fulfillRequest = function(list, code, message) {\n this.saveEvents();\n list.forEach(function(context) {\n return context.callback(buildResult(context.event, code, message));\n });\n };\n Destination2.prototype.saveEvents = function() {\n if (!this.config.storageProvider) {\n return;\n }\n var events = Array.from(this.queue.map(function(context) {\n return context.event;\n }));\n void this.config.storageProvider.set(this.storageKey, events);\n };\n return Destination2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js\n var getStacktrace = function(ignoreDepth) {\n if (ignoreDepth === void 0) {\n ignoreDepth = 0;\n }\n var trace = new Error().stack || "";\n return trace.split("\\n").slice(2 + ignoreDepth).map(function(text) {\n return text.trim();\n });\n };\n var getClientLogConfig = function(client) {\n return function() {\n var _a = __assign({}, client.config), logger = _a.loggerProvider, logLevel = _a.logLevel;\n return {\n logger,\n logLevel\n };\n };\n };\n var getValueByStringPath = function(obj, path) {\n var e_1, _a;\n path = path.replace(/\\[(\\w+)\\]/g, ".$1");\n path = path.replace(/^\\./, "");\n try {\n for (var _b = __values(path.split(".")), _c = _b.next(); !_c.done; _c = _b.next()) {\n var attr = _c.value;\n if (attr in obj) {\n obj = obj[attr];\n } else {\n return;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n return obj;\n };\n var getClientStates = function(client, paths) {\n return function() {\n var e_2, _a;\n var res = {};\n try {\n for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {\n var path = paths_1_1.value;\n res[path] = getValueByStringPath(client, path);\n }\n } catch (e_2_1) {\n e_2 = { error: e_2_1 };\n } finally {\n try {\n if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n return res;\n };\n };\n var debugWrapper = function(fn, fnName, getLogConfig, getStates, fnContext) {\n if (fnContext === void 0) {\n fnContext = null;\n }\n return function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = getLogConfig(), logger = _a.logger, logLevel = _a.logLevel;\n if (logLevel && logLevel < LogLevel.Debug || !logLevel || !logger) {\n return fn.apply(fnContext, args);\n }\n var debugContext = {\n type: "invoke public method",\n name: fnName,\n args,\n stacktrace: getStacktrace(1),\n time: {\n start: (/* @__PURE__ */ new Date()).toISOString()\n },\n states: {}\n };\n if (getStates && debugContext.states) {\n debugContext.states.before = getStates();\n }\n var result = fn.apply(fnContext, args);\n if (result && result.promise) {\n result.promise.then(function() {\n if (getStates && debugContext.states) {\n debugContext.states.after = getStates();\n }\n if (debugContext.time) {\n debugContext.time.end = (/* @__PURE__ */ new Date()).toISOString();\n }\n logger.debug(JSON.stringify(debugContext, null, 2));\n });\n } else {\n if (getStates && debugContext.states) {\n debugContext.states.after = getStates();\n }\n if (debugContext.time) {\n debugContext.time.end = (/* @__PURE__ */ new Date()).toISOString();\n }\n logger.debug(JSON.stringify(debugContext, null, 2));\n }\n return result;\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js\n var UUID = function(a) {\n return a ? (\n // a random number from 0 to 15\n (a ^ // unless b is 8,\n Math.random() * // in which case\n 16 >> // a random number from\n a / 4).toString(16)\n ) : (\n // or otherwise a concatenated string:\n (String(1e7) + // 10000000 +\n String(-1e3) + // -1000 +\n String(-4e3) + // -4000 +\n String(-8e3) + // -80000000 +\n String(-1e11)).replace(\n // replacing\n /[018]/g,\n // zeroes, ones, and eights with\n UUID\n )\n );\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/storage/memory.js\n var MemoryStorage = (\n /** @class */\n (function() {\n function MemoryStorage2() {\n this.memoryStorage = /* @__PURE__ */ new Map();\n }\n MemoryStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, true];\n });\n });\n };\n MemoryStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, this.memoryStorage.get(key)];\n });\n });\n };\n MemoryStorage2.prototype.getRaw = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.get(key)];\n case 1:\n value = _a.sent();\n return [2, value ? JSON.stringify(value) : void 0];\n }\n });\n });\n };\n MemoryStorage2.prototype.set = function(key, value) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.set(key, value);\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n MemoryStorage2.prototype.remove = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.delete(key);\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n MemoryStorage2.prototype.reset = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.clear();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return MemoryStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/transports/base.js\n var BaseTransport = (\n /** @class */\n (function() {\n function BaseTransport2() {\n }\n BaseTransport2.prototype.send = function(_serverUrl, _payload) {\n return Promise.resolve(null);\n };\n BaseTransport2.prototype.buildResponse = function(responseJSON) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;\n if (typeof responseJSON !== "object") {\n return null;\n }\n var statusCode = responseJSON.code || 0;\n var status = this.buildStatus(statusCode);\n switch (status) {\n case Status.Success:\n return {\n status,\n statusCode,\n body: {\n eventsIngested: (_a = responseJSON.events_ingested) !== null && _a !== void 0 ? _a : 0,\n payloadSizeBytes: (_b = responseJSON.payload_size_bytes) !== null && _b !== void 0 ? _b : 0,\n serverUploadTime: (_c = responseJSON.server_upload_time) !== null && _c !== void 0 ? _c : 0\n }\n };\n case Status.Invalid:\n return {\n status,\n statusCode,\n body: {\n error: (_d = responseJSON.error) !== null && _d !== void 0 ? _d : "",\n missingField: (_e = responseJSON.missing_field) !== null && _e !== void 0 ? _e : "",\n eventsWithInvalidFields: (_f = responseJSON.events_with_invalid_fields) !== null && _f !== void 0 ? _f : {},\n eventsWithMissingFields: (_g = responseJSON.events_with_missing_fields) !== null && _g !== void 0 ? _g : {},\n eventsWithInvalidIdLengths: (_h = responseJSON.events_with_invalid_id_lengths) !== null && _h !== void 0 ? _h : {},\n epsThreshold: (_j = responseJSON.eps_threshold) !== null && _j !== void 0 ? _j : 0,\n exceededDailyQuotaDevices: (_k = responseJSON.exceeded_daily_quota_devices) !== null && _k !== void 0 ? _k : {},\n silencedDevices: (_l = responseJSON.silenced_devices) !== null && _l !== void 0 ? _l : [],\n silencedEvents: (_m = responseJSON.silenced_events) !== null && _m !== void 0 ? _m : [],\n throttledDevices: (_o = responseJSON.throttled_devices) !== null && _o !== void 0 ? _o : {},\n throttledEvents: (_p = responseJSON.throttled_events) !== null && _p !== void 0 ? _p : []\n }\n };\n case Status.PayloadTooLarge:\n return {\n status,\n statusCode,\n body: {\n error: (_q = responseJSON.error) !== null && _q !== void 0 ? _q : ""\n }\n };\n case Status.RateLimit:\n return {\n status,\n statusCode,\n body: {\n error: (_r = responseJSON.error) !== null && _r !== void 0 ? _r : "",\n epsThreshold: (_s = responseJSON.eps_threshold) !== null && _s !== void 0 ? _s : 0,\n throttledDevices: (_t = responseJSON.throttled_devices) !== null && _t !== void 0 ? _t : {},\n throttledUsers: (_u = responseJSON.throttled_users) !== null && _u !== void 0 ? _u : {},\n exceededDailyQuotaDevices: (_v = responseJSON.exceeded_daily_quota_devices) !== null && _v !== void 0 ? _v : {},\n exceededDailyQuotaUsers: (_w = responseJSON.exceeded_daily_quota_users) !== null && _w !== void 0 ? _w : {},\n throttledEvents: (_x = responseJSON.throttled_events) !== null && _x !== void 0 ? _x : []\n }\n };\n case Status.Timeout:\n default:\n return {\n status,\n statusCode\n };\n }\n };\n BaseTransport2.prototype.buildStatus = function(code) {\n if (code >= 200 && code < 300) {\n return Status.Success;\n }\n if (code === 429) {\n return Status.RateLimit;\n }\n if (code === 413) {\n return Status.PayloadTooLarge;\n }\n if (code === 408) {\n return Status.Timeout;\n }\n if (code >= 400 && code < 500) {\n return Status.Invalid;\n }\n if (code >= 500) {\n return Status.Failed;\n }\n return Status.Unknown;\n };\n return BaseTransport2;\n })()\n );\n\n // node_modules/@amplitude/analytics-connector/dist/analytics-connector.esm.js\n var ApplicationContextProviderImpl = (\n /** @class */\n (function() {\n function ApplicationContextProviderImpl2() {\n }\n ApplicationContextProviderImpl2.prototype.getApplicationContext = function() {\n return {\n versionName: this.versionName,\n language: getLanguage(),\n platform: "Web",\n os: void 0,\n deviceModel: void 0\n };\n };\n return ApplicationContextProviderImpl2;\n })()\n );\n var getLanguage = function() {\n return typeof navigator !== "undefined" && (navigator.languages && navigator.languages[0] || navigator.language) || "";\n };\n var EventBridgeImpl = (\n /** @class */\n (function() {\n function EventBridgeImpl2() {\n this.queue = [];\n }\n EventBridgeImpl2.prototype.logEvent = function(event) {\n if (!this.receiver) {\n if (this.queue.length < 512) {\n this.queue.push(event);\n }\n } else {\n this.receiver(event);\n }\n };\n EventBridgeImpl2.prototype.setEventReceiver = function(receiver) {\n this.receiver = receiver;\n if (this.queue.length > 0) {\n this.queue.forEach(function(event) {\n receiver(event);\n });\n this.queue = [];\n }\n };\n return EventBridgeImpl2;\n })()\n );\n var __assign2 = function() {\n __assign2 = Object.assign || function __assign3(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign2.apply(this, arguments);\n };\n function __values2(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n }\n function __read2(o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = {\n error\n };\n } finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n return ar;\n }\n var isEqual = function(obj1, obj2) {\n var e_1, _a;\n var primitive = ["string", "number", "boolean", "undefined"];\n var typeA = typeof obj1;\n var typeB = typeof obj2;\n if (typeA !== typeB) {\n return false;\n }\n try {\n for (var primitive_1 = __values2(primitive), primitive_1_1 = primitive_1.next(); !primitive_1_1.done; primitive_1_1 = primitive_1.next()) {\n var p = primitive_1_1.value;\n if (p === typeA) {\n return obj1 === obj2;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (primitive_1_1 && !primitive_1_1.done && (_a = primitive_1.return)) _a.call(primitive_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n if (obj1 == null && obj2 == null) {\n return true;\n } else if (obj1 == null || obj2 == null) {\n return false;\n }\n if (obj1.length !== obj2.length) {\n return false;\n }\n var isArrayA = Array.isArray(obj1);\n var isArrayB = Array.isArray(obj2);\n if (isArrayA !== isArrayB) {\n return false;\n }\n if (isArrayA && isArrayB) {\n for (var i = 0; i < obj1.length; i++) {\n if (!isEqual(obj1[i], obj2[i])) {\n return false;\n }\n }\n } else {\n var sorted1 = Object.keys(obj1).sort();\n var sorted2 = Object.keys(obj2).sort();\n if (!isEqual(sorted1, sorted2)) {\n return false;\n }\n var result_1 = true;\n Object.keys(obj1).forEach(function(key) {\n if (!isEqual(obj1[key], obj2[key])) {\n result_1 = false;\n }\n });\n return result_1;\n }\n return true;\n };\n var ID_OP_SET = "$set";\n var ID_OP_UNSET = "$unset";\n var ID_OP_CLEAR_ALL = "$clearAll";\n if (!Object.entries) {\n Object.entries = function(obj) {\n var ownProps = Object.keys(obj);\n var i = ownProps.length;\n var resArray = new Array(i);\n while (i--) {\n resArray[i] = [ownProps[i], obj[ownProps[i]]];\n }\n return resArray;\n };\n }\n var IdentityStoreImpl = (\n /** @class */\n (function() {\n function IdentityStoreImpl2() {\n this.identity = { userProperties: {} };\n this.listeners = /* @__PURE__ */ new Set();\n }\n IdentityStoreImpl2.prototype.editIdentity = function() {\n var self2 = this;\n var actingUserProperties = __assign2({}, this.identity.userProperties);\n var actingIdentity = __assign2(__assign2({}, this.identity), { userProperties: actingUserProperties });\n return {\n setUserId: function(userId) {\n actingIdentity.userId = userId;\n return this;\n },\n setDeviceId: function(deviceId) {\n actingIdentity.deviceId = deviceId;\n return this;\n },\n setUserProperties: function(userProperties) {\n actingIdentity.userProperties = userProperties;\n return this;\n },\n setOptOut: function(optOut) {\n actingIdentity.optOut = optOut;\n return this;\n },\n updateUserProperties: function(actions) {\n var e_1, _a, e_2, _b, e_3, _c;\n var actingProperties = actingIdentity.userProperties || {};\n try {\n for (var _d = __values2(Object.entries(actions)), _e = _d.next(); !_e.done; _e = _d.next()) {\n var _f = __read2(_e.value, 2), action = _f[0], properties = _f[1];\n switch (action) {\n case ID_OP_SET:\n try {\n for (var _g = (e_2 = void 0, __values2(Object.entries(properties))), _h = _g.next(); !_h.done; _h = _g.next()) {\n var _j = __read2(_h.value, 2), key = _j[0], value = _j[1];\n actingProperties[key] = value;\n }\n } catch (e_2_1) {\n e_2 = { error: e_2_1 };\n } finally {\n try {\n if (_h && !_h.done && (_b = _g.return)) _b.call(_g);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n break;\n case ID_OP_UNSET:\n try {\n for (var _k = (e_3 = void 0, __values2(Object.keys(properties))), _l = _k.next(); !_l.done; _l = _k.next()) {\n var key = _l.value;\n delete actingProperties[key];\n }\n } catch (e_3_1) {\n e_3 = { error: e_3_1 };\n } finally {\n try {\n if (_l && !_l.done && (_c = _k.return)) _c.call(_k);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n break;\n case ID_OP_CLEAR_ALL:\n actingProperties = {};\n break;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (_e && !_e.done && (_a = _d.return)) _a.call(_d);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n actingIdentity.userProperties = actingProperties;\n return this;\n },\n commit: function() {\n self2.setIdentity(actingIdentity);\n return this;\n }\n };\n };\n IdentityStoreImpl2.prototype.getIdentity = function() {\n return __assign2({}, this.identity);\n };\n IdentityStoreImpl2.prototype.setIdentity = function(identity) {\n var originalIdentity = __assign2({}, this.identity);\n this.identity = __assign2({}, identity);\n if (!isEqual(originalIdentity, this.identity)) {\n this.listeners.forEach(function(listener) {\n listener(identity);\n });\n }\n };\n IdentityStoreImpl2.prototype.addIdentityListener = function(listener) {\n this.listeners.add(listener);\n };\n IdentityStoreImpl2.prototype.removeIdentityListener = function(listener) {\n this.listeners.delete(listener);\n };\n return IdentityStoreImpl2;\n })()\n );\n var safeGlobal = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : self;\n var AnalyticsConnector = (\n /** @class */\n (function() {\n function AnalyticsConnector2() {\n this.identityStore = new IdentityStoreImpl();\n this.eventBridge = new EventBridgeImpl();\n this.applicationContextProvider = new ApplicationContextProviderImpl();\n }\n AnalyticsConnector2.getInstance = function(instanceName) {\n if (!safeGlobal["analyticsConnectorInstances"]) {\n safeGlobal["analyticsConnectorInstances"] = {};\n }\n if (!safeGlobal["analyticsConnectorInstances"][instanceName]) {\n safeGlobal["analyticsConnectorInstances"][instanceName] = new AnalyticsConnector2();\n }\n return safeGlobal["analyticsConnectorInstances"][instanceName];\n };\n return AnalyticsConnector2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/analytics-connector.js\n var getAnalyticsConnector = function(instanceName) {\n if (instanceName === void 0) {\n instanceName = "$default_instance";\n }\n return AnalyticsConnector.getInstance(instanceName);\n };\n var setConnectorUserId = function(userId, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setUserId(userId).commit();\n };\n var setConnectorDeviceId = function(deviceId, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setDeviceId(deviceId).commit();\n };\n var setConnectorOptOut = function(optOut, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setOptOut(optOut).commit();\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/global-scope.js\n var getGlobalScope = function() {\n if (typeof globalThis !== "undefined") {\n return globalThis;\n }\n if (typeof window !== "undefined") {\n return window;\n }\n if (typeof self !== "undefined") {\n return self;\n }\n if (typeof global !== "undefined") {\n return global;\n }\n return void 0;\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/query-params.js\n var getQueryParams = function() {\n var _a;\n var globalScope = getGlobalScope();\n if (!((_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.location) === null || _a === void 0 ? void 0 : _a.search)) {\n return {};\n }\n var pairs = globalScope.location.search.substring(1).split("&").filter(Boolean);\n var params = pairs.reduce(function(acc, curr) {\n var query = curr.split("=", 2);\n var key = tryDecodeURIComponent(query[0]);\n var value = tryDecodeURIComponent(query[1]);\n if (!value) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n return params;\n };\n var tryDecodeURIComponent = function(value) {\n if (value === void 0) {\n value = "";\n }\n try {\n return decodeURIComponent(value);\n } catch (_a) {\n return "";\n }\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/attribution/constants.js\n var UTM_CAMPAIGN = "utm_campaign";\n var UTM_CONTENT = "utm_content";\n var UTM_ID = "utm_id";\n var UTM_MEDIUM = "utm_medium";\n var UTM_SOURCE = "utm_source";\n var UTM_TERM = "utm_term";\n var DCLID = "dclid";\n var FBCLID = "fbclid";\n var GBRAID = "gbraid";\n var GCLID = "gclid";\n var KO_CLICK_ID = "ko_click_id";\n var LI_FAT_ID = "li_fat_id";\n var MSCLKID = "msclkid";\n var RDT_CID = "rtd_cid";\n var TTCLID = "ttclid";\n var TWCLID = "twclid";\n var WBRAID = "wbraid";\n var BASE_CAMPAIGN = {\n utm_campaign: void 0,\n utm_content: void 0,\n utm_id: void 0,\n utm_medium: void 0,\n utm_source: void 0,\n utm_term: void 0,\n referrer: void 0,\n referring_domain: void 0,\n dclid: void 0,\n gbraid: void 0,\n gclid: void 0,\n fbclid: void 0,\n ko_click_id: void 0,\n li_fat_id: void 0,\n msclkid: void 0,\n rtd_cid: void 0,\n ttclid: void 0,\n twclid: void 0,\n wbraid: void 0\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/attribution/campaign-parser.js\n var CampaignParser = (\n /** @class */\n (function() {\n function CampaignParser2() {\n }\n CampaignParser2.prototype.parse = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, __assign(__assign(__assign(__assign({}, BASE_CAMPAIGN), this.getUtmParam()), this.getReferrer()), this.getClickIds())];\n });\n });\n };\n CampaignParser2.prototype.getUtmParam = function() {\n var params = getQueryParams();\n var utmCampaign = params[UTM_CAMPAIGN];\n var utmContent = params[UTM_CONTENT];\n var utmId = params[UTM_ID];\n var utmMedium = params[UTM_MEDIUM];\n var utmSource = params[UTM_SOURCE];\n var utmTerm = params[UTM_TERM];\n return {\n utm_campaign: utmCampaign,\n utm_content: utmContent,\n utm_id: utmId,\n utm_medium: utmMedium,\n utm_source: utmSource,\n utm_term: utmTerm\n };\n };\n CampaignParser2.prototype.getReferrer = function() {\n var _a, _b;\n var data = {\n referrer: void 0,\n referring_domain: void 0\n };\n try {\n data.referrer = document.referrer || void 0;\n data.referring_domain = (_b = (_a = data.referrer) === null || _a === void 0 ? void 0 : _a.split("/")[2]) !== null && _b !== void 0 ? _b : void 0;\n } catch (_c) {\n }\n return data;\n };\n CampaignParser2.prototype.getClickIds = function() {\n var _a;\n var params = getQueryParams();\n return _a = {}, _a[DCLID] = params[DCLID], _a[FBCLID] = params[FBCLID], _a[GBRAID] = params[GBRAID], _a[GCLID] = params[GCLID], _a[KO_CLICK_ID] = params[KO_CLICK_ID], _a[LI_FAT_ID] = params[LI_FAT_ID], _a[MSCLKID] = params[MSCLKID], _a[RDT_CID] = params[RDT_CID], _a[TTCLID] = params[TTCLID], _a[TWCLID] = params[TWCLID], _a[WBRAID] = params[WBRAID], _a;\n };\n return CampaignParser2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/cookie-name.js\n var getCookieName = function(apiKey, postKey, limit) {\n if (postKey === void 0) {\n postKey = "";\n }\n if (limit === void 0) {\n limit = 10;\n }\n return [AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join("_");\n };\n var getOldCookieName = function(apiKey) {\n return "".concat(AMPLITUDE_PREFIX.toLowerCase(), "_").concat(apiKey.substring(0, 6));\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/default-tracking.js\n var isFileDownloadTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.fileDownloads) {\n return true;\n }\n return false;\n };\n var isFormInteractionTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.formInteractions) {\n return true;\n }\n return false;\n };\n var isPageViewTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if ((defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.pageViews) === true || (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.pageViews) && typeof defaultTracking.pageViews === "object") {\n return true;\n }\n return false;\n };\n var isSessionTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.sessions) {\n return true;\n }\n return false;\n };\n var getPageViewTrackingConfig = function(config) {\n var _a;\n var trackOn = ((_a = config.attribution) === null || _a === void 0 ? void 0 : _a.trackPageViews) ? "attribution" : function() {\n return false;\n };\n var trackHistoryChanges = void 0;\n var eventType = "Page View";\n var isDefaultPageViewTrackingEnabled = isPageViewTrackingEnabled(config.defaultTracking);\n if (isDefaultPageViewTrackingEnabled) {\n trackOn = void 0;\n eventType = void 0;\n if (config.defaultTracking && typeof config.defaultTracking === "object" && config.defaultTracking.pageViews && typeof config.defaultTracking.pageViews === "object") {\n if ("trackOn" in config.defaultTracking.pageViews) {\n trackOn = config.defaultTracking.pageViews.trackOn;\n }\n if ("trackHistoryChanges" in config.defaultTracking.pageViews) {\n trackHistoryChanges = config.defaultTracking.pageViews.trackHistoryChanges;\n }\n if ("eventType" in config.defaultTracking.pageViews && config.defaultTracking.pageViews.eventType) {\n eventType = config.defaultTracking.pageViews.eventType;\n }\n }\n }\n return {\n trackOn,\n trackHistoryChanges,\n eventType\n };\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/language.js\n var getLanguage2 = function() {\n var _a, _b, _c, _d;\n if (typeof navigator === "undefined")\n return "";\n var userLanguage = navigator.userLanguage;\n return (_d = (_c = (_b = (_a = navigator.languages) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : navigator.language) !== null && _c !== void 0 ? _c : userLanguage) !== null && _d !== void 0 ? _d : "";\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/plugins/identity.js\n var IdentityEventSender = (\n /** @class */\n (function() {\n function IdentityEventSender2() {\n this.name = "identity";\n this.type = PluginType.BEFORE;\n this.identityStore = getAnalyticsConnector().identityStore;\n }\n IdentityEventSender2.prototype.execute = function(context) {\n return __awaiter(this, void 0, void 0, function() {\n var userProperties;\n return __generator(this, function(_a) {\n userProperties = context.user_properties;\n if (userProperties) {\n this.identityStore.editIdentity().updateUserProperties(userProperties).commit();\n }\n return [2, context];\n });\n });\n };\n IdentityEventSender2.prototype.setup = function(config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n if (config.instanceName) {\n this.identityStore = getAnalyticsConnector(config.instanceName).identityStore;\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return IdentityEventSender2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/storage/cookie.js\n var CookieStorage = (\n /** @class */\n (function() {\n function CookieStorage2(options) {\n this.options = __assign({}, options);\n }\n CookieStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n var testStrorage, testKey, value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n if (!getGlobalScope()) {\n return [2, false];\n }\n CookieStorage2.testValue = String(Date.now());\n testStrorage = new CookieStorage2(this.options);\n testKey = "AMP_TEST";\n _b.label = 1;\n case 1:\n _b.trys.push([1, 4, 5, 7]);\n return [4, testStrorage.set(testKey, CookieStorage2.testValue)];\n case 2:\n _b.sent();\n return [4, testStrorage.get(testKey)];\n case 3:\n value = _b.sent();\n return [2, value === CookieStorage2.testValue];\n case 4:\n _a = _b.sent();\n return [2, false];\n case 5:\n return [4, testStrorage.remove(testKey)];\n case 6:\n _b.sent();\n return [\n 7\n /*endfinally*/\n ];\n case 7:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.getRaw(key)];\n case 1:\n value = _a.sent();\n if (!value) {\n return [2, void 0];\n }\n try {\n try {\n value = decodeURIComponent(atob(value));\n } catch (_b) {\n }\n return [2, JSON.parse(value)];\n } catch (_c) {\n return [2, void 0];\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.getRaw = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var globalScope, cookie, match;\n return __generator(this, function(_b) {\n globalScope = getGlobalScope();\n cookie = (_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.document.cookie.split("; ")) !== null && _a !== void 0 ? _a : [];\n match = cookie.find(function(c) {\n return c.indexOf(key + "=") === 0;\n });\n if (!match) {\n return [2, void 0];\n }\n return [2, match.substring(key.length + 1)];\n });\n });\n };\n CookieStorage2.prototype.set = function(key, value) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var expirationDays, expires, expireDate, date, str, globalScope;\n return __generator(this, function(_b) {\n try {\n expirationDays = (_a = this.options.expirationDays) !== null && _a !== void 0 ? _a : 0;\n expires = value !== null ? expirationDays : -1;\n expireDate = void 0;\n if (expires) {\n date = /* @__PURE__ */ new Date();\n date.setTime(date.getTime() + expires * 24 * 60 * 60 * 1e3);\n expireDate = date;\n }\n str = "".concat(key, "=").concat(btoa(encodeURIComponent(JSON.stringify(value))));\n if (expireDate) {\n str += "; expires=".concat(expireDate.toUTCString());\n }\n str += "; path=/";\n if (this.options.domain) {\n str += "; domain=".concat(this.options.domain);\n }\n if (this.options.secure) {\n str += "; Secure";\n }\n if (this.options.sameSite) {\n str += "; SameSite=".concat(this.options.sameSite);\n }\n globalScope = getGlobalScope();\n if (globalScope) {\n globalScope.document.cookie = str;\n }\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n CookieStorage2.prototype.remove = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.set(key, null)];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.reset = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return CookieStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/transports/fetch.js\n var FetchTransport = (\n /** @class */\n (function(_super) {\n __extends(FetchTransport2, _super);\n function FetchTransport2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FetchTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var options, response, responseText;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n if (typeof fetch === "undefined") {\n throw new Error("FetchTransport is not supported");\n }\n options = {\n headers: {\n "Content-Type": "application/json",\n Accept: "*/*"\n },\n body: JSON.stringify(payload),\n method: "POST"\n };\n return [4, fetch(serverUrl, options)];\n case 1:\n response = _a.sent();\n return [4, response.text()];\n case 2:\n responseText = _a.sent();\n try {\n return [2, this.buildResponse(JSON.parse(responseText))];\n } catch (_b) {\n return [2, this.buildResponse({ code: response.status })];\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n return FetchTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/utils.js\n var omitUndefined = function(input) {\n var obj = {};\n for (var key in input) {\n var val = input[key];\n if (val) {\n obj[key] = val;\n }\n }\n return obj;\n };\n\n // node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/page-view-tracking.js\n var pageViewTrackingPlugin = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var amplitude;\n var options = {};\n var globalScope = getGlobalScope();\n var loggerProvider = void 0;\n var pushState;\n var _a = __read(args, 2), clientOrOptions = _a[0], configOrUndefined = _a[1];\n if (clientOrOptions && "init" in clientOrOptions) {\n amplitude = clientOrOptions;\n if (configOrUndefined) {\n options = configOrUndefined;\n }\n } else if (clientOrOptions) {\n options = clientOrOptions;\n }\n var createPageViewEvent = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var _a2;\n var _b;\n var _c;\n return __generator(this, function(_d) {\n switch (_d.label) {\n case 0:\n _b = {\n event_type: (_c = options.eventType) !== null && _c !== void 0 ? _c : "Page View"\n };\n _a2 = [{}];\n return [4, getCampaignParams()];\n case 1:\n return [2, (_b.event_properties = __assign.apply(void 0, [__assign.apply(void 0, _a2.concat([_d.sent()])), { page_domain: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.hostname || ""\n ), page_location: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.href || ""\n ), page_path: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.pathname || ""\n ), page_title: (\n /* istanbul ignore next */\n typeof document !== "undefined" && document.title || ""\n ), page_url: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.href.split("?")[0] || ""\n ) }]), _b)];\n }\n });\n });\n };\n var shouldTrackOnPageLoad = function() {\n return typeof options.trackOn === "undefined" || typeof options.trackOn === "function" && options.trackOn();\n };\n var previousURL = typeof location !== "undefined" ? location.href : null;\n var trackHistoryPageView = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var newURL, shouldTrackPageView, _a2, _b, _c;\n return __generator(this, function(_d) {\n switch (_d.label) {\n case 0:\n newURL = location.href;\n shouldTrackPageView = shouldTrackHistoryPageView(options.trackHistoryChanges, newURL, previousURL || "") && shouldTrackOnPageLoad();\n previousURL = newURL;\n if (!shouldTrackPageView) return [3, 4];\n loggerProvider === null || loggerProvider === void 0 ? void 0 : loggerProvider.log("Tracking page view event");\n if (!(amplitude === null || amplitude === void 0)) return [3, 1];\n _a2 = void 0;\n return [3, 3];\n case 1:\n _c = (_b = amplitude).track;\n return [4, createPageViewEvent()];\n case 2:\n _a2 = _c.apply(_b, [_d.sent()]);\n _d.label = 3;\n case 3:\n _a2;\n _d.label = 4;\n case 4:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n var trackHistoryPageViewWrapper = function() {\n void trackHistoryPageView();\n };\n var plugin = {\n name: "page-view-tracking",\n type: PluginType.ENRICHMENT,\n setup: function(config, client) {\n return __awaiter(void 0, void 0, void 0, function() {\n var receivedType, _a2, _b;\n var _c, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n amplitude = amplitude !== null && amplitude !== void 0 ? amplitude : client;\n if (!amplitude) {\n receivedType = clientOrOptions ? "Options" : "undefined";\n config.loggerProvider.error("Argument of type \'".concat(receivedType, "\' is not assignable to parameter of type \'BrowserClient\'."));\n return [\n 2\n /*return*/\n ];\n }\n loggerProvider = config.loggerProvider;\n loggerProvider.log("Installing @amplitude/plugin-page-view-tracking-browser");\n options.trackOn = ((_c = config.attribution) === null || _c === void 0 ? void 0 : _c.trackPageViews) ? "attribution" : options.trackOn;\n if (!client && ((_d = config.attribution) === null || _d === void 0 ? void 0 : _d.trackPageViews)) {\n loggerProvider.warn("@amplitude/plugin-page-view-tracking-browser overrides page view tracking behavior defined in @amplitude/analytics-browser. Resolve by disabling page view tracking in @amplitude/analytics-browser.");\n config.attribution.trackPageViews = false;\n }\n if (options.trackHistoryChanges && globalScope) {\n globalScope.addEventListener("popstate", trackHistoryPageViewWrapper);\n pushState = globalScope.history.pushState;\n globalScope.history.pushState = new Proxy(globalScope.history.pushState, {\n apply: function(target, thisArg, _a3) {\n var _b2 = __read(_a3, 3), state = _b2[0], unused = _b2[1], url = _b2[2];\n target.apply(thisArg, [state, unused, url]);\n void trackHistoryPageView();\n }\n });\n }\n if (!shouldTrackOnPageLoad()) return [3, 2];\n loggerProvider.log("Tracking page view event");\n _b = (_a2 = amplitude).track;\n return [4, createPageViewEvent()];\n case 1:\n _b.apply(_a2, [_e.sent()]);\n _e.label = 2;\n case 2:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n },\n execute: function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n var pageViewEvent;\n return __generator(this, function(_a2) {\n switch (_a2.label) {\n case 0:\n if (!(options.trackOn === "attribution" && isCampaignEvent(event))) return [3, 2];\n loggerProvider === null || loggerProvider === void 0 ? void 0 : loggerProvider.log("Enriching campaign event to page view event with campaign parameters");\n return [4, createPageViewEvent()];\n case 1:\n pageViewEvent = _a2.sent();\n event.event_type = pageViewEvent.event_type;\n event.event_properties = __assign(__assign({}, event.event_properties), pageViewEvent.event_properties);\n _a2.label = 2;\n case 2:\n return [2, event];\n }\n });\n });\n },\n teardown: function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a2) {\n if (globalScope) {\n globalScope.removeEventListener("popstate", trackHistoryPageViewWrapper);\n if (pushState) {\n globalScope.history.pushState = pushState;\n }\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n }\n };\n plugin.__trackHistoryPageView = trackHistoryPageView;\n return plugin;\n };\n var getCampaignParams = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n _a = omitUndefined;\n return [4, new CampaignParser().parse()];\n case 1:\n return [2, _a.apply(void 0, [_b.sent()])];\n }\n });\n });\n };\n var isCampaignEvent = function(event) {\n if (event.event_type === "$identify" && event.user_properties) {\n var properties = event.user_properties;\n var $set = properties[IdentifyOperation.SET] || {};\n var $unset = properties[IdentifyOperation.UNSET] || {};\n var userProperties_1 = __spreadArray(__spreadArray([], __read(Object.keys($set)), false), __read(Object.keys($unset)), false);\n return Object.keys(BASE_CAMPAIGN).every(function(value) {\n return userProperties_1.includes(value);\n });\n }\n return false;\n };\n var shouldTrackHistoryPageView = function(trackingOption, newURL, oldURL) {\n switch (trackingOption) {\n case "pathOnly":\n return newURL.split("?")[0] !== oldURL.split("?")[0];\n default:\n return newURL !== oldURL;\n }\n };\n\n // node_modules/@amplitude/plugin-web-attribution-browser/lib/esm/helpers.js\n var getStorageKey = function(apiKey, postKey, limit) {\n if (postKey === void 0) {\n postKey = "";\n }\n if (limit === void 0) {\n limit = 10;\n }\n return [AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join("_");\n };\n var domainWithoutSubdomain = function(domain) {\n var parts = domain.split(".");\n if (parts.length <= 2) {\n return domain;\n }\n return parts.slice(parts.length - 2, parts.length).join(".");\n };\n var isNewCampaign = function(current, previous, options) {\n var _a;\n var referrer = current.referrer, referring_domain = current.referring_domain, currentCampaign = __rest(current, ["referrer", "referring_domain"]);\n var _b = previous || {}, _previous_referrer = _b.referrer, prevReferringDomain = _b.referring_domain, previousCampaign = __rest(_b, ["referrer", "referring_domain"]);\n if (current.referring_domain && ((_a = options.excludeReferrers) === null || _a === void 0 ? void 0 : _a.includes(current.referring_domain))) {\n return false;\n }\n var hasNewCampaign = JSON.stringify(currentCampaign) !== JSON.stringify(previousCampaign);\n var hasNewDomain = domainWithoutSubdomain(referring_domain || "") !== domainWithoutSubdomain(prevReferringDomain || "");\n return !previous || hasNewCampaign || hasNewDomain;\n };\n var createCampaignEvent = function(campaign, options) {\n var campaignParameters = __assign(__assign({}, BASE_CAMPAIGN), campaign);\n var identifyEvent = Object.entries(campaignParameters).reduce(function(identify2, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n identify2.setOnce("initial_".concat(key), (_b = value !== null && value !== void 0 ? value : options.initialEmptyValue) !== null && _b !== void 0 ? _b : "EMPTY");\n if (value) {\n return identify2.set(key, value);\n }\n return identify2.unset(key);\n }, new Identify());\n return createIdentifyEvent(identifyEvent);\n };\n\n // node_modules/@amplitude/plugin-web-attribution-browser/lib/esm/web-attribution.js\n var webAttributionPlugin = function() {\n var _this = this;\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var amplitude;\n var options = {};\n var _b = __read(args, 2), clientOrOptions = _b[0], configOrUndefined = _b[1];\n if (clientOrOptions && "init" in clientOrOptions) {\n amplitude = clientOrOptions;\n if (configOrUndefined) {\n options = configOrUndefined;\n }\n } else if (clientOrOptions) {\n options = clientOrOptions;\n }\n var excludeReferrers = (_a = options.excludeReferrers) !== null && _a !== void 0 ? _a : [];\n if (typeof location !== "undefined") {\n excludeReferrers.unshift(location.hostname);\n }\n options = __assign(__assign({ disabled: false, initialEmptyValue: "EMPTY", resetSessionOnNewCampaign: false }, options), { excludeReferrers });\n var plugin = {\n name: "web-attribution",\n type: PluginType.BEFORE,\n setup: function(config, client) {\n var _a2;\n return __awaiter(this, void 0, void 0, function() {\n var receivedType, storage, storageKey, _b2, currentCampaign, previousCampaign, pluginEnabledOverride, campaignEvent;\n return __generator(this, function(_c) {\n switch (_c.label) {\n case 0:\n amplitude = amplitude !== null && amplitude !== void 0 ? amplitude : client;\n if (!amplitude) {\n receivedType = clientOrOptions ? "Options" : "undefined";\n config.loggerProvider.error("Argument of type \'".concat(receivedType, "\' is not assignable to parameter of type \'BrowserClient\'."));\n return [\n 2\n /*return*/\n ];\n }\n if (options.disabled) {\n config.loggerProvider.log("@amplitude/plugin-web-attribution-browser is disabled. Attribution is not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n config.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser.");\n if (!client && !((_a2 = config.attribution) === null || _a2 === void 0 ? void 0 : _a2.disabled)) {\n config.loggerProvider.warn("@amplitude/plugin-web-attribution-browser overrides web attribution behavior defined in @amplitude/analytics-browser. Resolve by disabling web attribution tracking in @amplitude/analytics-browser.");\n config.attribution = {\n disabled: true\n };\n }\n storage = config.cookieStorage;\n storageKey = getStorageKey(config.apiKey, "MKTG");\n return [4, Promise.all([\n new CampaignParser().parse(),\n storage.get(storageKey)\n ])];\n case 1:\n _b2 = __read.apply(void 0, [_c.sent(), 2]), currentCampaign = _b2[0], previousCampaign = _b2[1];\n pluginEnabledOverride = this.__pluginEnabledOverride;\n if (pluginEnabledOverride !== null && pluginEnabledOverride !== void 0 ? pluginEnabledOverride : isNewCampaign(currentCampaign, previousCampaign, options)) {\n if (options.resetSessionOnNewCampaign) {\n amplitude.setSessionId(Date.now());\n config.loggerProvider.log("Created a new session for new campaign.");\n }\n config.loggerProvider.log("Tracking attribution.");\n campaignEvent = createCampaignEvent(currentCampaign, options);\n amplitude.track(campaignEvent);\n void storage.set(storageKey, currentCampaign);\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n },\n execute: function(event) {\n return __awaiter(_this, void 0, void 0, function() {\n return __generator(this, function(_a2) {\n return [2, event];\n });\n });\n }\n };\n plugin.__pluginEnabledOverride = void 0;\n return plugin;\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/storage/local-storage.js\n var MAX_ARRAY_LENGTH = 1e3;\n var LocalStorage = (\n /** @class */\n (function() {\n function LocalStorage2(config) {\n this.loggerProvider = config === null || config === void 0 ? void 0 : config.loggerProvider;\n }\n LocalStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n var random, testStorage, testKey, value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n if (!getGlobalScope()) {\n return [2, false];\n }\n random = String(Date.now());\n testStorage = new LocalStorage2();\n testKey = "AMP_TEST";\n _b.label = 1;\n case 1:\n _b.trys.push([1, 4, 5, 7]);\n return [4, testStorage.set(testKey, random)];\n case 2:\n _b.sent();\n return [4, testStorage.get(testKey)];\n case 3:\n value = _b.sent();\n return [2, value === random];\n case 4:\n _a = _b.sent();\n return [2, false];\n case 5:\n return [4, testStorage.remove(testKey)];\n case 6:\n _b.sent();\n return [\n 7\n /*endfinally*/\n ];\n case 7:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n LocalStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 3]);\n return [4, this.getRaw(key)];\n case 1:\n value = _b.sent();\n if (!value) {\n return [2, void 0];\n }\n return [2, JSON.parse(value)];\n case 2:\n _a = _b.sent();\n return [2, void 0];\n case 3:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n LocalStorage2.prototype.getRaw = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n return [2, ((_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.getItem(key)) || void 0];\n });\n });\n };\n LocalStorage2.prototype.set = function(key, value) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function() {\n var isExceededArraySize, serializedValue, droppedEventsCount;\n return __generator(this, function(_c) {\n isExceededArraySize = Array.isArray(value) && value.length > MAX_ARRAY_LENGTH;\n try {\n serializedValue = isExceededArraySize ? JSON.stringify(value.slice(0, MAX_ARRAY_LENGTH)) : JSON.stringify(value);\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.setItem(key, serializedValue);\n } catch (_d) {\n }\n if (isExceededArraySize) {\n droppedEventsCount = value.length - MAX_ARRAY_LENGTH;\n (_b = this.loggerProvider) === null || _b === void 0 ? void 0 : _b.error("Failed to save ".concat(droppedEventsCount, " events because the queue length exceeded ").concat(MAX_ARRAY_LENGTH, "."));\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n LocalStorage2.prototype.remove = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n try {\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.removeItem(key);\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n LocalStorage2.prototype.reset = function() {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n try {\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.clear();\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return LocalStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/transports/xhr.js\n var XHRTransport = (\n /** @class */\n (function(_super) {\n __extends(XHRTransport2, _super);\n function XHRTransport2() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.state = {\n done: 4\n };\n return _this;\n }\n XHRTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n return [2, new Promise(function(resolve, reject) {\n if (typeof XMLHttpRequest === "undefined") {\n reject(new Error("XHRTransport is not supported."));\n }\n var xhr = new XMLHttpRequest();\n xhr.open("POST", serverUrl, true);\n xhr.onreadystatechange = function() {\n if (xhr.readyState === _this.state.done) {\n try {\n var responsePayload = xhr.responseText;\n var parsedResponsePayload = JSON.parse(responsePayload);\n var result = _this.buildResponse(parsedResponsePayload);\n resolve(result);\n } catch (e) {\n reject(e);\n }\n }\n };\n xhr.setRequestHeader("Content-Type", "application/json");\n xhr.setRequestHeader("Accept", "*/*");\n xhr.send(JSON.stringify(payload));\n })];\n });\n });\n };\n return XHRTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/transports/send-beacon.js\n var SendBeaconTransport = (\n /** @class */\n (function(_super) {\n __extends(SendBeaconTransport2, _super);\n function SendBeaconTransport2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SendBeaconTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n return [2, new Promise(function(resolve, reject) {\n var globalScope = getGlobalScope();\n if (!(globalScope === null || globalScope === void 0 ? void 0 : globalScope.navigator.sendBeacon)) {\n throw new Error("SendBeaconTransport is not supported");\n }\n try {\n var data = JSON.stringify(payload);\n var success = globalScope.navigator.sendBeacon(serverUrl, JSON.stringify(payload));\n if (success) {\n return resolve(_this.buildResponse({\n code: 200,\n events_ingested: payload.events.length,\n payload_size_bytes: data.length,\n server_upload_time: Date.now()\n }));\n }\n return resolve(_this.buildResponse({ code: 500 }));\n } catch (e) {\n reject(e);\n }\n })];\n });\n });\n };\n return SendBeaconTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/config.js\n var getDefaultConfig2 = function() {\n var cookieStorage = new MemoryStorage();\n var trackingOptions = {\n deviceManufacturer: true,\n deviceModel: true,\n ipAddress: true,\n language: true,\n osName: true,\n osVersion: true,\n platform: true\n };\n return {\n cookieExpiration: 365,\n cookieSameSite: "Lax",\n cookieSecure: false,\n cookieStorage,\n cookieUpgrade: true,\n disableCookies: false,\n domain: "",\n sessionTimeout: 30 * 60 * 1e3,\n trackingOptions,\n transportProvider: new FetchTransport()\n };\n };\n var BrowserConfig = (\n /** @class */\n (function(_super) {\n __extends(BrowserConfig2, _super);\n function BrowserConfig2(apiKey, options) {\n var _this = this;\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n var defaultConfig = getDefaultConfig2();\n _this = _super.call(this, __assign(__assign({ flushIntervalMillis: 1e3, flushMaxRetries: 5, flushQueueSize: 30, transportProvider: defaultConfig.transportProvider }, options), { apiKey })) || this;\n _this._optOut = false;\n _this.cookieStorage = (_a = options === null || options === void 0 ? void 0 : options.cookieStorage) !== null && _a !== void 0 ? _a : defaultConfig.cookieStorage;\n _this.deviceId = options === null || options === void 0 ? void 0 : options.deviceId;\n _this.lastEventId = options === null || options === void 0 ? void 0 : options.lastEventId;\n _this.lastEventTime = options === null || options === void 0 ? void 0 : options.lastEventTime;\n _this.optOut = Boolean(options === null || options === void 0 ? void 0 : options.optOut);\n _this.sessionId = options === null || options === void 0 ? void 0 : options.sessionId;\n _this.userId = options === null || options === void 0 ? void 0 : options.userId;\n _this.appVersion = options === null || options === void 0 ? void 0 : options.appVersion;\n _this.attribution = options === null || options === void 0 ? void 0 : options.attribution;\n _this.cookieExpiration = (_b = options === null || options === void 0 ? void 0 : options.cookieExpiration) !== null && _b !== void 0 ? _b : defaultConfig.cookieExpiration;\n _this.cookieSameSite = (_c = options === null || options === void 0 ? void 0 : options.cookieSameSite) !== null && _c !== void 0 ? _c : defaultConfig.cookieSameSite;\n _this.cookieSecure = (_d = options === null || options === void 0 ? void 0 : options.cookieSecure) !== null && _d !== void 0 ? _d : defaultConfig.cookieSecure;\n _this.cookieUpgrade = (_e = options === null || options === void 0 ? void 0 : options.cookieUpgrade) !== null && _e !== void 0 ? _e : defaultConfig.cookieUpgrade;\n _this.defaultTracking = options === null || options === void 0 ? void 0 : options.defaultTracking;\n _this.disableCookies = (_f = options === null || options === void 0 ? void 0 : options.disableCookies) !== null && _f !== void 0 ? _f : defaultConfig.disableCookies;\n _this.defaultTracking = options === null || options === void 0 ? void 0 : options.defaultTracking;\n _this.domain = (_g = options === null || options === void 0 ? void 0 : options.domain) !== null && _g !== void 0 ? _g : defaultConfig.domain;\n _this.partnerId = options === null || options === void 0 ? void 0 : options.partnerId;\n _this.sessionTimeout = (_h = options === null || options === void 0 ? void 0 : options.sessionTimeout) !== null && _h !== void 0 ? _h : defaultConfig.sessionTimeout;\n _this.trackingOptions = (_j = options === null || options === void 0 ? void 0 : options.trackingOptions) !== null && _j !== void 0 ? _j : defaultConfig.trackingOptions;\n return _this;\n }\n Object.defineProperty(BrowserConfig2.prototype, "deviceId", {\n get: function() {\n return this._deviceId;\n },\n set: function(deviceId) {\n if (this._deviceId !== deviceId) {\n this._deviceId = deviceId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "userId", {\n get: function() {\n return this._userId;\n },\n set: function(userId) {\n if (this._userId !== userId) {\n this._userId = userId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "sessionId", {\n get: function() {\n return this._sessionId;\n },\n set: function(sessionId) {\n if (this._sessionId !== sessionId) {\n this._sessionId = sessionId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "optOut", {\n get: function() {\n return this._optOut;\n },\n set: function(optOut) {\n if (this._optOut !== optOut) {\n this._optOut = optOut;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "lastEventTime", {\n get: function() {\n return this._lastEventTime;\n },\n set: function(lastEventTime) {\n if (this._lastEventTime !== lastEventTime) {\n this._lastEventTime = lastEventTime;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "lastEventId", {\n get: function() {\n return this._lastEventId;\n },\n set: function(lastEventId) {\n if (this._lastEventId !== lastEventId) {\n this._lastEventId = lastEventId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n BrowserConfig2.prototype.updateStorage = function() {\n var _a;\n var cache = {\n deviceId: this._deviceId,\n userId: this._userId,\n sessionId: this._sessionId,\n optOut: this._optOut,\n lastEventTime: this._lastEventTime,\n lastEventId: this._lastEventId\n };\n void ((_a = this.cookieStorage) === null || _a === void 0 ? void 0 : _a.set(getCookieName(this.apiKey), cache));\n };\n return BrowserConfig2;\n })(Config)\n );\n var useBrowserConfig = function(apiKey, options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var defaultConfig, deviceId, lastEventId, lastEventTime, optOut, sessionId, userId, cookieStorage, domain, _a, _b, _c;\n var _d;\n var _e, _f;\n return __generator(this, function(_g) {\n switch (_g.label) {\n case 0:\n defaultConfig = getDefaultConfig2();\n deviceId = (_e = options === null || options === void 0 ? void 0 : options.deviceId) !== null && _e !== void 0 ? _e : UUID();\n lastEventId = options === null || options === void 0 ? void 0 : options.lastEventId;\n lastEventTime = options === null || options === void 0 ? void 0 : options.lastEventTime;\n optOut = options === null || options === void 0 ? void 0 : options.optOut;\n sessionId = options === null || options === void 0 ? void 0 : options.sessionId;\n userId = options === null || options === void 0 ? void 0 : options.userId;\n cookieStorage = options === null || options === void 0 ? void 0 : options.cookieStorage;\n domain = options === null || options === void 0 ? void 0 : options.domain;\n _a = BrowserConfig.bind;\n _b = [void 0, apiKey];\n _c = [__assign({}, options)];\n _d = { cookieStorage, deviceId, domain, lastEventId, lastEventTime, optOut, sessionId };\n return [4, createEventsStorage(options)];\n case 1:\n return [2, new (_a.apply(BrowserConfig, _b.concat([__assign.apply(void 0, _c.concat([(_d.storageProvider = _g.sent(), _d.trackingOptions = __assign(__assign({}, defaultConfig.trackingOptions), options === null || options === void 0 ? void 0 : options.trackingOptions), _d.transportProvider = (_f = options === null || options === void 0 ? void 0 : options.transportProvider) !== null && _f !== void 0 ? _f : createTransport(options === null || options === void 0 ? void 0 : options.transport), _d.userId = userId, _d)]))])))()];\n }\n });\n });\n };\n var createCookieStorage = function(overrides, baseConfig) {\n if (baseConfig === void 0) {\n baseConfig = getDefaultConfig2();\n }\n return __awaiter(void 0, void 0, void 0, function() {\n var options, cookieStorage, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n options = __assign(__assign({}, baseConfig), overrides);\n cookieStorage = overrides === null || overrides === void 0 ? void 0 : overrides.cookieStorage;\n _a = !cookieStorage;\n if (_a) return [3, 2];\n return [4, cookieStorage.isEnabled()];\n case 1:\n _a = !_b.sent();\n _b.label = 2;\n case 2:\n if (_a) {\n return [2, createFlexibleStorage(options)];\n }\n return [2, cookieStorage];\n }\n });\n });\n };\n var createFlexibleStorage = function(options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var storage, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n storage = new CookieStorage({\n domain: options.domain,\n expirationDays: options.cookieExpiration,\n sameSite: options.cookieSameSite,\n secure: options.cookieSecure\n });\n _a = options.disableCookies;\n if (_a) return [3, 2];\n return [4, storage.isEnabled()];\n case 1:\n _a = !_b.sent();\n _b.label = 2;\n case 2:\n if (!_a) return [3, 4];\n storage = new LocalStorage();\n return [4, storage.isEnabled()];\n case 3:\n if (!_b.sent()) {\n storage = new MemoryStorage();\n }\n _b.label = 4;\n case 4:\n return [2, storage];\n }\n });\n });\n };\n var createEventsStorage = function(overrides) {\n return __awaiter(void 0, void 0, void 0, function() {\n var hasStorageProviderProperty, loggerProvider, _a, _b, storage, _c, e_1_1;\n var e_1, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n hasStorageProviderProperty = overrides && Object.prototype.hasOwnProperty.call(overrides, "storageProvider");\n loggerProvider = overrides && overrides.loggerProvider;\n if (!(!hasStorageProviderProperty || overrides.storageProvider)) return [3, 9];\n _e.label = 1;\n case 1:\n _e.trys.push([1, 7, 8, 9]);\n _a = __values([overrides === null || overrides === void 0 ? void 0 : overrides.storageProvider, new LocalStorage({ loggerProvider })]), _b = _a.next();\n _e.label = 2;\n case 2:\n if (!!_b.done) return [3, 6];\n storage = _b.value;\n _c = storage;\n if (!_c) return [3, 4];\n return [4, storage.isEnabled()];\n case 3:\n _c = _e.sent();\n _e.label = 4;\n case 4:\n if (_c) {\n return [2, storage];\n }\n _e.label = 5;\n case 5:\n _b = _a.next();\n return [3, 2];\n case 6:\n return [3, 9];\n case 7:\n e_1_1 = _e.sent();\n e_1 = { error: e_1_1 };\n return [3, 9];\n case 8:\n try {\n if (_b && !_b.done && (_d = _a.return)) _d.call(_a);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 9:\n return [2, void 0];\n }\n });\n });\n };\n var createTransport = function(transport) {\n if (transport === TransportType.XHR) {\n return new XHRTransport();\n }\n if (transport === TransportType.SendBeacon) {\n return new SendBeaconTransport();\n }\n return getDefaultConfig2().transportProvider;\n };\n var getTopLevelDomain = function(url) {\n return __awaiter(void 0, void 0, void 0, function() {\n var host, parts, levels, storageKey, i, i, domain, options, storage, value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, new CookieStorage().isEnabled()];\n case 1:\n if (!_a.sent() || !url && typeof location === "undefined") {\n return [2, ""];\n }\n host = url !== null && url !== void 0 ? url : location.hostname;\n parts = host.split(".");\n levels = [];\n storageKey = "AMP_TLDTEST";\n for (i = parts.length - 2; i >= 0; --i) {\n levels.push(parts.slice(i).join("."));\n }\n i = 0;\n _a.label = 2;\n case 2:\n if (!(i < levels.length)) return [3, 7];\n domain = levels[i];\n options = { domain: "." + domain };\n storage = new CookieStorage(options);\n return [4, storage.set(storageKey, 1)];\n case 3:\n _a.sent();\n return [4, storage.get(storageKey)];\n case 4:\n value = _a.sent();\n if (!value) return [3, 6];\n return [4, storage.remove(storageKey)];\n case 5:\n _a.sent();\n return [2, "." + domain];\n case 6:\n i++;\n return [3, 2];\n case 7:\n return [2, ""];\n }\n });\n });\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/constants.js\n var DEFAULT_EVENT_PREFIX = "[Amplitude]";\n var DEFAULT_PAGE_VIEW_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Page Viewed");\n var DEFAULT_FORM_START_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Form Started");\n var DEFAULT_FORM_SUBMIT_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Form Submitted");\n var DEFAULT_FILE_DOWNLOAD_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " File Downloaded");\n var DEFAULT_SESSION_START_EVENT = "session_start";\n var DEFAULT_SESSION_END_EVENT = "session_end";\n var FILE_EXTENSION = "".concat(DEFAULT_EVENT_PREFIX, " File Extension");\n var FILE_NAME = "".concat(DEFAULT_EVENT_PREFIX, " File Name");\n var LINK_ID = "".concat(DEFAULT_EVENT_PREFIX, " Link ID");\n var LINK_TEXT = "".concat(DEFAULT_EVENT_PREFIX, " Link Text");\n var LINK_URL = "".concat(DEFAULT_EVENT_PREFIX, " Link URL");\n var FORM_ID = "".concat(DEFAULT_EVENT_PREFIX, " Form ID");\n var FORM_NAME = "".concat(DEFAULT_EVENT_PREFIX, " Form Name");\n var FORM_DESTINATION = "".concat(DEFAULT_EVENT_PREFIX, " Form Destination");\n\n // node_modules/@amplitude/analytics-browser/lib/esm/cookie-migration/index.js\n var parseLegacyCookies = function(apiKey, options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var storage, oldCookieName, cookies, _a, deviceId, userId, optOut, sessionId, lastEventTime, lastEventId;\n var _b;\n return __generator(this, function(_c) {\n switch (_c.label) {\n case 0:\n return [4, createCookieStorage(options)];\n case 1:\n storage = _c.sent();\n oldCookieName = getOldCookieName(apiKey);\n return [4, storage.getRaw(oldCookieName)];\n case 2:\n cookies = _c.sent();\n if (!cookies) {\n return [2, {\n optOut: false\n }];\n }\n if (!((_b = options.cookieUpgrade) !== null && _b !== void 0 ? _b : getDefaultConfig2().cookieUpgrade)) return [3, 4];\n return [4, storage.remove(oldCookieName)];\n case 3:\n _c.sent();\n _c.label = 4;\n case 4:\n _a = __read(cookies.split("."), 6), deviceId = _a[0], userId = _a[1], optOut = _a[2], sessionId = _a[3], lastEventTime = _a[4], lastEventId = _a[5];\n return [2, {\n deviceId,\n userId: decode(userId),\n sessionId: parseTime(sessionId),\n lastEventId: parseTime(lastEventId),\n lastEventTime: parseTime(lastEventTime),\n optOut: Boolean(optOut)\n }];\n }\n });\n });\n };\n var parseTime = function(num) {\n var integer = parseInt(num, 32);\n if (isNaN(integer)) {\n return void 0;\n }\n return integer;\n };\n var decode = function(value) {\n if (!atob || !escape || !value) {\n return void 0;\n }\n try {\n return decodeURIComponent(escape(atob(value)));\n } catch (_a) {\n return void 0;\n }\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js\n var import_ua_parser_js = __toESM(require_ua_parser());\n\n // node_modules/@amplitude/analytics-browser/lib/esm/version.js\n var VERSION = "1.13.4";\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js\n var BROWSER_PLATFORM = "Web";\n var IP_ADDRESS = "$remote";\n var Context = (\n /** @class */\n (function() {\n function Context2() {\n this.name = "context";\n this.type = PluginType.BEFORE;\n this.library = "amplitude-ts/".concat(VERSION);\n if (typeof navigator !== "undefined") {\n this.userAgent = navigator.userAgent;\n }\n this.uaResult = new import_ua_parser_js.default(this.userAgent).getResult();\n }\n Context2.prototype.setup = function(config) {\n this.config = config;\n return Promise.resolve(void 0);\n };\n Context2.prototype.execute = function(context) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function() {\n var time, osName, osVersion, deviceModel, deviceVendor, lastEventId, nextEventId, event;\n return __generator(this, function(_c) {\n time = (/* @__PURE__ */ new Date()).getTime();\n osName = this.uaResult.browser.name;\n osVersion = this.uaResult.browser.version;\n deviceModel = this.uaResult.device.model || this.uaResult.os.name;\n deviceVendor = this.uaResult.device.vendor;\n lastEventId = (_a = this.config.lastEventId) !== null && _a !== void 0 ? _a : -1;\n nextEventId = (_b = context.event_id) !== null && _b !== void 0 ? _b : lastEventId + 1;\n this.config.lastEventId = nextEventId;\n if (!context.time) {\n this.config.lastEventTime = time;\n }\n event = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ user_id: this.config.userId, device_id: this.config.deviceId, session_id: this.config.sessionId, time }, this.config.appVersion && { app_version: this.config.appVersion }), this.config.trackingOptions.platform && { platform: BROWSER_PLATFORM }), this.config.trackingOptions.osName && { os_name: osName }), this.config.trackingOptions.osVersion && { os_version: osVersion }), this.config.trackingOptions.deviceManufacturer && { device_manufacturer: deviceVendor }), this.config.trackingOptions.deviceModel && { device_model: deviceModel }), this.config.trackingOptions.language && { language: getLanguage2() }), this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS }), { insert_id: UUID(), partner_id: this.config.partnerId, plan: this.config.plan }), this.config.ingestionMetadata && {\n ingestion_metadata: {\n source_name: this.config.ingestionMetadata.sourceName,\n source_version: this.config.ingestionMetadata.sourceVersion\n }\n }), context), { event_id: nextEventId, library: this.library, user_agent: this.userAgent });\n return [2, event];\n });\n });\n };\n return Context2;\n })()\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/default-page-view-event-enrichment.js\n var eventPropertyMap = {\n page_domain: "".concat(DEFAULT_EVENT_PREFIX, " Page Domain"),\n page_location: "".concat(DEFAULT_EVENT_PREFIX, " Page Location"),\n page_path: "".concat(DEFAULT_EVENT_PREFIX, " Page Path"),\n page_title: "".concat(DEFAULT_EVENT_PREFIX, " Page Title"),\n page_url: "".concat(DEFAULT_EVENT_PREFIX, " Page URL")\n };\n var defaultPageViewEventEnrichment = function() {\n var name = "@amplitude/plugin-default-page-view-event-enrichment-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, void 0];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n if (event.event_type === DEFAULT_PAGE_VIEW_EVENT && event.event_properties) {\n event.event_properties = Object.entries(event.event_properties).reduce(function(acc, _a2) {\n var _b = __read(_a2, 2), key = _b[0], value = _b[1];\n var transformedPropertyName = eventPropertyMap[key];\n if (transformedPropertyName) {\n acc[transformedPropertyName] = value;\n } else {\n acc[key] = value;\n }\n return acc;\n }, {});\n }\n return [2, event];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/file-download-tracking.js\n var fileDownloadTracking = function() {\n var observer;\n var eventListeners = [];\n var addEventListener = function(element, type2, handler) {\n element.addEventListener(type2, handler);\n eventListeners.push({\n element,\n type: type2,\n handler\n });\n };\n var removeClickListeners = function() {\n eventListeners.forEach(function(_a) {\n var element = _a.element, type2 = _a.type, handler = _a.handler;\n element === null || element === void 0 ? void 0 : element.removeEventListener(type2, handler);\n });\n eventListeners = [];\n };\n var name = "@amplitude/plugin-file-download-tracking-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function(config, amplitude) {\n return __awaiter(void 0, void 0, void 0, function() {\n var addFileDownloadListener, ext, links;\n return __generator(this, function(_a) {\n if (!amplitude) {\n config.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n if (typeof document === "undefined") {\n return [\n 2\n /*return*/\n ];\n }\n addFileDownloadListener = function(a) {\n var url;\n try {\n url = new URL(a.href, window.location.href);\n } catch (_a2) {\n return;\n }\n var result = ext.exec(url.href);\n var fileExtension = result === null || result === void 0 ? void 0 : result[1];\n if (fileExtension) {\n addEventListener(a, "click", function() {\n var _a2;\n if (fileExtension) {\n amplitude.track(DEFAULT_FILE_DOWNLOAD_EVENT, (_a2 = {}, _a2[FILE_EXTENSION] = fileExtension, _a2[FILE_NAME] = url.pathname, _a2[LINK_ID] = a.id, _a2[LINK_TEXT] = a.text, _a2[LINK_URL] = a.href, _a2));\n }\n });\n }\n };\n ext = /\\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/;\n links = Array.from(document.getElementsByTagName("a"));\n links.forEach(addFileDownloadListener);\n if (typeof MutationObserver !== "undefined") {\n observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(node) {\n if (node.nodeName === "A") {\n addFileDownloadListener(node);\n }\n if ("querySelectorAll" in node && typeof node.querySelectorAll === "function") {\n Array.from(node.querySelectorAll("a")).map(addFileDownloadListener);\n }\n });\n });\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, event];\n });\n });\n };\n var teardown = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n observer === null || observer === void 0 ? void 0 : observer.disconnect();\n removeClickListeners();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute,\n teardown\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/form-interaction-tracking.js\n var formInteractionTracking = function() {\n var observer;\n var eventListeners = [];\n var addEventListener = function(element, type2, handler) {\n element.addEventListener(type2, handler);\n eventListeners.push({\n element,\n type: type2,\n handler\n });\n };\n var removeClickListeners = function() {\n eventListeners.forEach(function(_a) {\n var element = _a.element, type2 = _a.type, handler = _a.handler;\n element === null || element === void 0 ? void 0 : element.removeEventListener(type2, handler);\n });\n eventListeners = [];\n };\n var name = "@amplitude/plugin-form-interaction-tracking-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function(config, amplitude) {\n return __awaiter(void 0, void 0, void 0, function() {\n var addFormInteractionListener, forms;\n return __generator(this, function(_a) {\n if (!amplitude) {\n config.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n if (typeof document === "undefined") {\n return [\n 2\n /*return*/\n ];\n }\n addFormInteractionListener = function(form) {\n var hasFormChanged = false;\n addEventListener(form, "change", function() {\n var _a2;\n if (!hasFormChanged) {\n amplitude.track(DEFAULT_FORM_START_EVENT, (_a2 = {}, _a2[FORM_ID] = form.id, _a2[FORM_NAME] = form.name, _a2[FORM_DESTINATION] = form.action, _a2));\n }\n hasFormChanged = true;\n });\n addEventListener(form, "submit", function() {\n var _a2, _b;\n if (!hasFormChanged) {\n amplitude.track(DEFAULT_FORM_START_EVENT, (_a2 = {}, _a2[FORM_ID] = form.id, _a2[FORM_NAME] = form.name, _a2[FORM_DESTINATION] = form.action, _a2));\n }\n amplitude.track(DEFAULT_FORM_SUBMIT_EVENT, (_b = {}, _b[FORM_ID] = form.id, _b[FORM_NAME] = form.name, _b[FORM_DESTINATION] = form.action, _b));\n hasFormChanged = false;\n });\n };\n forms = Array.from(document.getElementsByTagName("form"));\n forms.forEach(addFormInteractionListener);\n if (typeof MutationObserver !== "undefined") {\n observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(node) {\n if (node.nodeName === "FORM") {\n addFormInteractionListener(node);\n }\n if ("querySelectorAll" in node && typeof node.querySelectorAll === "function") {\n Array.from(node.querySelectorAll("form")).map(addFormInteractionListener);\n }\n });\n });\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, event];\n });\n });\n };\n var teardown = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n observer === null || observer === void 0 ? void 0 : observer.disconnect();\n removeClickListeners();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute,\n teardown\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/utils/snippet-helper.js\n var convertProxyObjectToRealObject = function(instance, queue) {\n for (var i = 0; i < queue.length; i++) {\n var _a = queue[i], name_1 = _a.name, args = _a.args, resolve = _a.resolve;\n var fn = instance && instance[name_1];\n if (typeof fn === "function") {\n var result = fn.apply(instance, args);\n if (typeof resolve === "function") {\n resolve(result === null || result === void 0 ? void 0 : result.promise);\n }\n }\n }\n return instance;\n };\n var isInstanceProxy = function(instance) {\n var instanceProxy = instance;\n return instanceProxy && instanceProxy._q !== void 0;\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/browser-client.js\n var AmplitudeBrowser = (\n /** @class */\n (function(_super) {\n __extends(AmplitudeBrowser2, _super);\n function AmplitudeBrowser2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AmplitudeBrowser2.prototype.init = function(apiKey, userId, options) {\n if (apiKey === void 0) {\n apiKey = "";\n }\n return returnWrapper(this._init(__assign(__assign({}, options), { userId, apiKey })));\n };\n AmplitudeBrowser2.prototype._init = function(options) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _r, _s, _t, _u, _v, _w;\n return __awaiter(this, void 0, void 0, function() {\n var _x, _y, _z, legacyCookies, cookieStorage, previousCookies, queryParams, deviceId, sessionId, optOut, lastEventId, lastEventTime, userId, browserOptions, isNewSession, connector, webAttribution, pageViewTrackingOptions;\n var _this = this;\n return __generator(this, function(_0) {\n switch (_0.label) {\n case 0:\n if (this.initializing) {\n return [\n 2\n /*return*/\n ];\n }\n this.initializing = true;\n _x = options;\n if (!options.disableCookies) return [3, 1];\n _y = "";\n return [3, 5];\n case 1:\n if (!((_a = options.domain) !== null && _a !== void 0)) return [3, 2];\n _z = _a;\n return [3, 4];\n case 2:\n return [4, getTopLevelDomain()];\n case 3:\n _z = _0.sent();\n _0.label = 4;\n case 4:\n _y = _z;\n _0.label = 5;\n case 5:\n _x.domain = _y;\n return [4, parseLegacyCookies(options.apiKey, options)];\n case 6:\n legacyCookies = _0.sent();\n return [4, createCookieStorage(options)];\n case 7:\n cookieStorage = _0.sent();\n return [4, cookieStorage.get(getCookieName(options.apiKey))];\n case 8:\n previousCookies = _0.sent();\n queryParams = getQueryParams();\n deviceId = (_d = (_c = (_b = options.deviceId) !== null && _b !== void 0 ? _b : queryParams.deviceId) !== null && _c !== void 0 ? _c : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deviceId) !== null && _d !== void 0 ? _d : legacyCookies.deviceId;\n sessionId = (_e = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.sessionId) !== null && _e !== void 0 ? _e : legacyCookies.sessionId;\n optOut = (_g = (_f = options.optOut) !== null && _f !== void 0 ? _f : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.optOut) !== null && _g !== void 0 ? _g : legacyCookies.optOut;\n lastEventId = (_h = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.lastEventId) !== null && _h !== void 0 ? _h : legacyCookies.lastEventId;\n lastEventTime = (_j = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.lastEventTime) !== null && _j !== void 0 ? _j : legacyCookies.lastEventTime;\n userId = (_l = (_k = options.userId) !== null && _k !== void 0 ? _k : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.userId) !== null && _l !== void 0 ? _l : legacyCookies.userId;\n this.previousSessionDeviceId = (_m = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deviceId) !== null && _m !== void 0 ? _m : legacyCookies.deviceId;\n this.previousSessionUserId = (_o = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.userId) !== null && _o !== void 0 ? _o : legacyCookies.userId;\n return [4, useBrowserConfig(options.apiKey, __assign(__assign({}, options), { deviceId, sessionId, optOut, lastEventId, lastEventTime, userId, cookieStorage }))];\n case 9:\n browserOptions = _0.sent();\n return [4, _super.prototype._init.call(this, browserOptions)];\n case 10:\n _0.sent();\n isNewSession = false;\n if (\n // user has never sent an event\n !this.config.lastEventTime || // user has no previous session ID\n !this.config.sessionId || // has sent an event and has previous session but expired\n this.config.lastEventTime && Date.now() - this.config.lastEventTime > this.config.sessionTimeout\n ) {\n this.setSessionId((_r = (_p = options.sessionId) !== null && _p !== void 0 ? _p : this.config.sessionId) !== null && _r !== void 0 ? _r : Date.now());\n isNewSession = true;\n }\n connector = getAnalyticsConnector(options.instanceName);\n connector.identityStore.setIdentity({\n userId: this.config.userId,\n deviceId: this.config.deviceId\n });\n return [4, this.add(new Destination()).promise];\n case 11:\n _0.sent();\n return [4, this.add(new Context()).promise];\n case 12:\n _0.sent();\n return [4, this.add(new IdentityEventSender()).promise];\n case 13:\n _0.sent();\n if (!isFileDownloadTrackingEnabled(this.config.defaultTracking)) return [3, 15];\n return [4, this.add(fileDownloadTracking()).promise];\n case 14:\n _0.sent();\n _0.label = 15;\n case 15:\n if (!isFormInteractionTrackingEnabled(this.config.defaultTracking)) return [3, 17];\n return [4, this.add(formInteractionTracking()).promise];\n case 16:\n _0.sent();\n _0.label = 17;\n case 17:\n if (!!((_s = this.config.attribution) === null || _s === void 0 ? void 0 : _s.disabled)) return [3, 19];\n webAttribution = webAttributionPlugin({\n excludeReferrers: (_t = this.config.attribution) === null || _t === void 0 ? void 0 : _t.excludeReferrers,\n initialEmptyValue: (_u = this.config.attribution) === null || _u === void 0 ? void 0 : _u.initialEmptyValue,\n resetSessionOnNewCampaign: (_v = this.config.attribution) === null || _v === void 0 ? void 0 : _v.resetSessionOnNewCampaign\n });\n webAttribution.__pluginEnabledOverride = isNewSession || ((_w = this.config.attribution) === null || _w === void 0 ? void 0 : _w.trackNewCampaigns) ? void 0 : false;\n return [4, this.add(webAttribution).promise];\n case 18:\n _0.sent();\n _0.label = 19;\n case 19:\n pageViewTrackingOptions = getPageViewTrackingConfig(this.config);\n pageViewTrackingOptions.eventType = pageViewTrackingOptions.eventType || DEFAULT_PAGE_VIEW_EVENT;\n return [4, this.add(pageViewTrackingPlugin(pageViewTrackingOptions)).promise];\n case 20:\n _0.sent();\n return [4, this.add(defaultPageViewEventEnrichment()).promise];\n case 21:\n _0.sent();\n this.initializing = false;\n return [4, this.runQueuedFunctions("dispatchQ")];\n case 22:\n _0.sent();\n connector.eventBridge.setEventReceiver(function(event) {\n void _this.track(event.eventType, event.eventProperties);\n });\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeBrowser2.prototype.getUserId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.userId;\n };\n AmplitudeBrowser2.prototype.setUserId = function(userId) {\n if (!this.config) {\n this.q.push(this.setUserId.bind(this, userId));\n return;\n }\n if (userId !== this.config.userId || userId === void 0) {\n this.config.userId = userId;\n setConnectorUserId(userId, this.config.instanceName);\n }\n };\n AmplitudeBrowser2.prototype.getDeviceId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.deviceId;\n };\n AmplitudeBrowser2.prototype.setDeviceId = function(deviceId) {\n if (!this.config) {\n this.q.push(this.setDeviceId.bind(this, deviceId));\n return;\n }\n this.config.deviceId = deviceId;\n setConnectorDeviceId(deviceId, this.config.instanceName);\n };\n AmplitudeBrowser2.prototype.setOptOut = function(optOut) {\n setConnectorOptOut(optOut, this.config.instanceName);\n _super.prototype.setOptOut.call(this, optOut);\n };\n AmplitudeBrowser2.prototype.reset = function() {\n this.setDeviceId(UUID());\n this.setUserId(void 0);\n };\n AmplitudeBrowser2.prototype.getSessionId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.sessionId;\n };\n AmplitudeBrowser2.prototype.setSessionId = function(sessionId) {\n var _a;\n if (!this.config) {\n this.q.push(this.setSessionId.bind(this, sessionId));\n return;\n }\n if (sessionId === this.config.sessionId) {\n return;\n }\n var previousSessionId = this.getSessionId();\n var lastEventTime = this.config.lastEventTime;\n var lastEventId = (_a = this.config.lastEventId) !== null && _a !== void 0 ? _a : -1;\n this.config.sessionId = sessionId;\n this.config.lastEventTime = void 0;\n if (isSessionTrackingEnabled(this.config.defaultTracking)) {\n if (previousSessionId && lastEventTime) {\n this.track(DEFAULT_SESSION_END_EVENT, void 0, {\n device_id: this.previousSessionDeviceId,\n event_id: ++lastEventId,\n session_id: previousSessionId,\n time: lastEventTime + 1,\n user_id: this.previousSessionUserId\n });\n }\n this.config.lastEventTime = this.config.sessionId;\n this.track(DEFAULT_SESSION_START_EVENT, void 0, {\n event_id: ++lastEventId,\n session_id: this.config.sessionId,\n time: this.config.lastEventTime\n });\n }\n this.previousSessionDeviceId = this.config.deviceId;\n this.previousSessionUserId = this.config.userId;\n };\n AmplitudeBrowser2.prototype.extendSession = function() {\n if (!this.config) {\n this.q.push(this.extendSession.bind(this));\n return;\n }\n this.config.lastEventTime = Date.now();\n };\n AmplitudeBrowser2.prototype.setTransport = function(transport) {\n if (!this.config) {\n this.q.push(this.setTransport.bind(this, transport));\n return;\n }\n this.config.transportProvider = createTransport(transport);\n };\n AmplitudeBrowser2.prototype.identify = function(identify2, eventOptions) {\n if (isInstanceProxy(identify2)) {\n var queue = identify2._q;\n identify2._q = [];\n identify2 = convertProxyObjectToRealObject(new Identify(), queue);\n }\n if (eventOptions === null || eventOptions === void 0 ? void 0 : eventOptions.user_id) {\n this.setUserId(eventOptions.user_id);\n }\n if (eventOptions === null || eventOptions === void 0 ? void 0 : eventOptions.device_id) {\n this.setDeviceId(eventOptions.device_id);\n }\n return _super.prototype.identify.call(this, identify2, eventOptions);\n };\n AmplitudeBrowser2.prototype.groupIdentify = function(groupType, groupName, identify2, eventOptions) {\n if (isInstanceProxy(identify2)) {\n var queue = identify2._q;\n identify2._q = [];\n identify2 = convertProxyObjectToRealObject(new Identify(), queue);\n }\n return _super.prototype.groupIdentify.call(this, groupType, groupName, identify2, eventOptions);\n };\n AmplitudeBrowser2.prototype.revenue = function(revenue2, eventOptions) {\n if (isInstanceProxy(revenue2)) {\n var queue = revenue2._q;\n revenue2._q = [];\n revenue2 = convertProxyObjectToRealObject(new Revenue(), queue);\n }\n return _super.prototype.revenue.call(this, revenue2, eventOptions);\n };\n AmplitudeBrowser2.prototype.process = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var currentTime, lastEventTime, timeSinceLastEvent;\n return __generator(this, function(_a) {\n currentTime = Date.now();\n lastEventTime = this.config.lastEventTime || Date.now();\n timeSinceLastEvent = currentTime - lastEventTime;\n if (event.event_type !== DEFAULT_SESSION_START_EVENT && event.event_type !== DEFAULT_SESSION_END_EVENT && (!event.session_id || event.session_id === this.getSessionId()) && timeSinceLastEvent > this.config.sessionTimeout) {\n this.setSessionId(currentTime);\n }\n return [2, _super.prototype.process.call(this, event)];\n });\n });\n };\n return AmplitudeBrowser2;\n })(AmplitudeCore)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/browser-client-factory.js\n var createInstance = function() {\n var client = new AmplitudeBrowser();\n return {\n init: debugWrapper(client.init.bind(client), "init", getClientLogConfig(client), getClientStates(client, ["config"])),\n add: debugWrapper(client.add.bind(client), "add", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.plugins"])),\n remove: debugWrapper(client.remove.bind(client), "remove", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.plugins"])),\n track: debugWrapper(client.track.bind(client), "track", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n logEvent: debugWrapper(client.logEvent.bind(client), "logEvent", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n identify: debugWrapper(client.identify.bind(client), "identify", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n groupIdentify: debugWrapper(client.groupIdentify.bind(client), "groupIdentify", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n setGroup: debugWrapper(client.setGroup.bind(client), "setGroup", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n revenue: debugWrapper(client.revenue.bind(client), "revenue", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n flush: debugWrapper(client.flush.bind(client), "flush", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n getUserId: debugWrapper(client.getUserId.bind(client), "getUserId", getClientLogConfig(client), getClientStates(client, ["config", "config.userId"])),\n setUserId: debugWrapper(client.setUserId.bind(client), "setUserId", getClientLogConfig(client), getClientStates(client, ["config", "config.userId"])),\n getDeviceId: debugWrapper(client.getDeviceId.bind(client), "getDeviceId", getClientLogConfig(client), getClientStates(client, ["config", "config.deviceId"])),\n setDeviceId: debugWrapper(client.setDeviceId.bind(client), "setDeviceId", getClientLogConfig(client), getClientStates(client, ["config", "config.deviceId"])),\n reset: debugWrapper(client.reset.bind(client), "reset", getClientLogConfig(client), getClientStates(client, ["config", "config.userId", "config.deviceId"])),\n getSessionId: debugWrapper(client.getSessionId.bind(client), "getSessionId", getClientLogConfig(client), getClientStates(client, ["config"])),\n setSessionId: debugWrapper(client.setSessionId.bind(client), "setSessionId", getClientLogConfig(client), getClientStates(client, ["config"])),\n extendSession: debugWrapper(client.extendSession.bind(client), "extendSession", getClientLogConfig(client), getClientStates(client, ["config"])),\n setOptOut: debugWrapper(client.setOptOut.bind(client), "setOptOut", getClientLogConfig(client), getClientStates(client, ["config"])),\n setTransport: debugWrapper(client.setTransport.bind(client), "setTransport", getClientLogConfig(client), getClientStates(client, ["config"]))\n };\n };\n var browser_client_factory_default = createInstance();\n\n // node_modules/@amplitude/analytics-browser/lib/esm/index.js\n var add = browser_client_factory_default.add;\n var extendSession = browser_client_factory_default.extendSession;\n var flush = browser_client_factory_default.flush;\n var getDeviceId = browser_client_factory_default.getDeviceId;\n var getSessionId = browser_client_factory_default.getSessionId;\n var getUserId = browser_client_factory_default.getUserId;\n var groupIdentify = browser_client_factory_default.groupIdentify;\n var identify = browser_client_factory_default.identify;\n var init = browser_client_factory_default.init;\n var logEvent = browser_client_factory_default.logEvent;\n var remove = browser_client_factory_default.remove;\n var reset = browser_client_factory_default.reset;\n var revenue = browser_client_factory_default.revenue;\n var setDeviceId = browser_client_factory_default.setDeviceId;\n var setGroup = browser_client_factory_default.setGroup;\n var setOptOut = browser_client_factory_default.setOptOut;\n var setSessionId = browser_client_factory_default.setSessionId;\n var setTransport = browser_client_factory_default.setTransport;\n var setUserId = browser_client_factory_default.setUserId;\n var track = browser_client_factory_default.track;\n\n // packages/dev-tools/client/setup-ui/connected.ts\n var showSection = (sectionId, delay) => {\n setTimeout(() => {\n const sections = Array.from(document.querySelectorAll("section"));\n for (const section of sections) {\n section.setAttribute("aria-hidden", String(section.id !== sectionId));\n }\n }, delay);\n };\n var showSuccess = (confetti) => {\n showSection("success", 500);\n if (confetti) {\n celebrate();\n }\n setTimeout(stepViewContent, 500);\n };\n var stepViewContent = () => {\n const stepUpdateApp = document.getElementById("step-update-app");\n stepUpdateApp.className = "highlight completed";\n const stepViewContent2 = document.getElementById("step-setup-complete");\n stepViewContent2.className = "highlight active";\n };\n var showErrors = (errors = []) => {\n showSection("error", 500);\n const msgsUl = document.getElementById("error-messages");\n msgsUl.innerHTML = "";\n for (const error of errors) {\n const li = document.createElement("li");\n li.textContent = error;\n msgsUl.appendChild(li);\n }\n document.title = `Error Connecting`;\n };\n var showRestartServer = () => {\n showSection("restart-server", 500);\n document.title = `Restart Dev Server`;\n };\n var init2 = async () => {\n const pageUrl = new URL(location.href);\n const previewUrl = pageUrl.searchParams.get(PREVIEW_URL_QS);\n const publicApiKey = pageUrl.searchParams.get(PUBLIC_API_KEY_QS);\n const privateAuthKey = pageUrl.searchParams.get(PRIVATE_AUTH_KEY_QS);\n const builderUserId = pageUrl.searchParams.get(USER_ID_QS);\n const framework = pageUrl.searchParams.get(FRAMEWORK_QS) || "unknown";\n const platform = pageUrl.searchParams.get(PLATFORM_QS);\n const nodeVersion = pageUrl.searchParams.get(NODE_VERSION_QS);\n const spaceKind = pageUrl.searchParams.get(SPACE_KIND_QS) || null;\n try {\n console.info(\n `framework: ${framework}, platform: ${platform}, node: ${nodeVersion}`\n );\n const cleanedUrl = new URL(location.pathname, location.origin);\n if (publicApiKey) {\n setGroup("organization", publicApiKey);\n setGroup("space", publicApiKey);\n }\n if (!previewUrl) {\n window.history.replaceState({}, "", cleanedUrl.href);\n showErrors(["Missing preview url"]);\n track("integration failed", {\n url: cleanedUrl.href,\n message: "missing preview url",\n framework\n });\n return;\n }\n cleanedUrl.searchParams.set(PREVIEW_URL_QS, previewUrl);\n cleanedUrl.searchParams.set(USER_ID_QS, builderUserId);\n window.history.replaceState({}, "", cleanedUrl.href);\n if (publicApiKey && privateAuthKey) {\n let connectedAttempts = 0;\n const checkConnected = async () => {\n connectedAttempts++;\n try {\n const connectedBuilder = await apiConnectBuilder(\n publicApiKey,\n privateAuthKey,\n spaceKind\n );\n if (connectedBuilder.success) {\n const appLinkUrl = updateAppLinkUrl(\n previewUrl,\n connectedBuilder.pathname,\n builderUserId\n );\n track("site integrated", {\n url: appLinkUrl,\n position: framework\n });\n if (connectedBuilder.modifiedFiles.length > 0) {\n const ul = document.getElementById("modified-files-list");\n connectedBuilder.modifiedFiles.forEach((m) => {\n const li = document.createElement("li");\n const a = document.createElement("a");\n a.textContent = m.displayFilePath || m.filePath;\n a.href = `~launch#${m.displayFilePath}`;\n a.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n apiLaunchEditor({\n filePath: m.filePath\n });\n });\n li.appendChild(a);\n ul.appendChild(li);\n });\n const modifiedFilesMessage = document.getElementById(\n "modified-files-message"\n );\n modifiedFilesMessage.removeAttribute("hidden");\n }\n if (spaceKind !== "vcp" && (connectedBuilder.platform.os === "win32" || framework === "@remix-run/react")) {\n const restartWarning = document.getElementById("restart-warning");\n restartWarning.removeAttribute("hidden");\n } else if (spaceKind !== "vcp" && (framework === "react" || framework === "@angular/core")) {\n const routeMessage = document.getElementById("router-message");\n routeMessage.removeAttribute("hidden");\n if (framework === "@angular/core") {\n track("angular framework", {});\n const angularRouterMessageSection = document.getElementById(\n "angular-message-section"\n );\n angularRouterMessageSection?.removeAttribute("hidden");\n }\n if (framework === "react") {\n track("react framework", {});\n const reactRouterMessageSection = document.getElementById(\n "react-message-section"\n );\n reactRouterMessageSection?.removeAttribute("hidden");\n }\n const routeCheckboxDiv = document.getElementById(\n "router-checkbox-div"\n );\n const routeCheckbox = document.createElement("input");\n routeCheckbox.type = "checkbox";\n routeCheckbox.id = "router-checkbox";\n const label = document.createElement("label");\n label.htmlFor = "router-checkbox";\n label.textContent = `I\'ve updated my router files`;\n routeCheckboxDiv.appendChild(routeCheckbox);\n routeCheckboxDiv.appendChild(label);\n const finishButton = document.getElementById(\n "router-finish-button"\n );\n routeCheckbox.addEventListener("change", function() {\n if (routeCheckbox.checked) {\n finishButton.removeAttribute("hidden");\n } else {\n finishButton.setAttribute("hidden", "true");\n }\n });\n } else {\n const goToApp = document.getElementById("go-to-app");\n goToApp.removeAttribute("hidden");\n if (spaceKind !== "vcp") {\n const firstParagraph = goToApp.querySelector("p");\n if (firstParagraph) {\n firstParagraph.removeAttribute("hidden");\n }\n const buttonText = goToApp.querySelector("#button-text");\n if (buttonText) {\n buttonText.textContent = "Go to your app";\n }\n }\n }\n setTimeout(() => {\n showSuccess(true);\n }, 500);\n } else {\n track("integration failed", {\n path: connectedBuilder.pathname,\n message: "error connecting to Builder.io",\n position: framework\n });\n showErrors([`Error connecting to Builder.io`]);\n }\n } catch (e) {\n const err = String(e.message || e);\n if (err.includes("Fetch Error")) {\n if (connectedAttempts > 3) {\n showRestartServer();\n }\n setTimeout(checkConnected, 1e3);\n } else {\n showErrors([err]);\n }\n }\n };\n checkConnected();\n } else {\n const validatedBuilder = await apiValidateBuilder();\n if (validatedBuilder.isValid) {\n updateAppLinkUrl(previewUrl, validatedBuilder.pathname, builderUserId);\n const goToApp = document.getElementById("go-to-app");\n goToApp.removeAttribute("hidden");\n showSuccess(false);\n } else {\n showErrors([`Error connecting to Builder.io`]);\n }\n }\n } catch (e) {\n track("integration failed", {\n message: "uncaught error",\n details: String(e),\n position: JSON.stringify({ framework, platform, nodeVersion })\n });\n console.error("integrationFailed", e);\n const err = String(e);\n if (err.includes("Fetch Error")) {\n showRestartServer();\n } else {\n showErrors([err]);\n }\n }\n };\n var updateAppLinkUrl = (previewUrl, pathname, builderUserId) => {\n const appUrl = new URL(pathname, previewUrl);\n if (builderUserId) {\n appUrl.hash = `${CONNECTED_USER_ID_QS}=${builderUserId}`;\n }\n const nextStepLinks = document.querySelectorAll(".next-step");\n for (const nextStepLink of nextStepLinks) {\n nextStepLink.setAttribute("href", appUrl.href);\n }\n console.debug("App Url", appUrl.href);\n return appUrl.href;\n };\n var loadConfetti = () => {\n return new Promise((resolve, reject) => {\n if (globalThis.confetti) {\n return resolve(globalThis.confetti);\n }\n const script = document.createElement("script");\n script.src = "https://cdn.jsdelivr.net/npm/canvas-confetti@1.5.1/dist/confetti.browser.min.js";\n script.onload = () => resolve(globalThis.confetti);\n script.onerror = reject;\n document.head.appendChild(script);\n script.remove();\n });\n };\n var celebrate = async () => {\n const defaults = {\n spread: 360,\n ticks: 50,\n gravity: 0,\n decay: 0.95,\n startVelocity: 30,\n colors: ["19b4f4", "a97ff2", "fd6b3c", "ffffff"]\n };\n const confettiPromise = loadConfetti();\n const shoot = async () => {\n const buttonIcon = document.getElementById("button-icon");\n const iconRect = buttonIcon.getBoundingClientRect();\n const iconX = window.scrollX + iconRect.left;\n const iconY = window.scrollY + iconRect.top;\n const origin = {\n x: iconX / window.innerWidth,\n y: iconY / window.innerHeight\n };\n const confetti = await confettiPromise;\n confetti({\n ...defaults,\n origin,\n scalar: 1.2\n });\n confetti({\n ...defaults,\n origin,\n scalar: 0.75\n });\n };\n setTimeout(shoot, 500);\n setTimeout(shoot, 650);\n setTimeout(shoot, 800);\n setTimeout(shoot, 950);\n };\n init2();\n})();\n</script>\n </body>\n</html>\n');
|
|
@@ -6844,11 +7786,11 @@ async function createNextDevToolsSys(sys2) {
|
|
|
6844
7786
|
addExternalPackage: (pkgName) => {
|
|
6845
7787
|
externalPackages[sys2.join(rootDir, pkgName, "index.ts")] = `export * from "${pkgName}";`;
|
|
6846
7788
|
},
|
|
6847
|
-
readFileSync: (
|
|
6848
|
-
existsSync: (
|
|
6849
|
-
readdirSync: (
|
|
6850
|
-
const realFiles = sys2.readdirSync(
|
|
6851
|
-
if (
|
|
7789
|
+
readFileSync: (path3) => externalPackages[path3] ?? sys2.readFileSync(path3),
|
|
7790
|
+
existsSync: (path3) => !!externalPackages[path3] || sys2.existsSync(path3),
|
|
7791
|
+
readdirSync: (path3) => {
|
|
7792
|
+
const realFiles = sys2.readdirSync(path3);
|
|
7793
|
+
if (path3 === rootDir) {
|
|
6852
7794
|
return [
|
|
6853
7795
|
...realFiles,
|
|
6854
7796
|
...Object.keys(externalPackages).map(
|
|
@@ -6858,9 +7800,9 @@ async function createNextDevToolsSys(sys2) {
|
|
|
6858
7800
|
}
|
|
6859
7801
|
return realFiles;
|
|
6860
7802
|
},
|
|
6861
|
-
readdir: async (
|
|
6862
|
-
const realFiles = await sys2.readdir(
|
|
6863
|
-
if (
|
|
7803
|
+
readdir: async (path3) => {
|
|
7804
|
+
const realFiles = await sys2.readdir(path3);
|
|
7805
|
+
if (path3 === rootDir) {
|
|
6864
7806
|
return [
|
|
6865
7807
|
...realFiles,
|
|
6866
7808
|
...Object.keys(externalPackages).map(
|
|
@@ -8692,11 +9634,11 @@ async function createRemixDevToolsSys(sys2) {
|
|
|
8692
9634
|
addExternalPackage: (pkgName) => {
|
|
8693
9635
|
externalPackages[sys2.join(rootDir, pkgName, "index.ts")] = `export * from "${pkgName}";`;
|
|
8694
9636
|
},
|
|
8695
|
-
readFileSync: (
|
|
8696
|
-
existsSync: (
|
|
8697
|
-
readdirSync: (
|
|
8698
|
-
const realFiles = sys2.readdirSync(
|
|
8699
|
-
if (
|
|
9637
|
+
readFileSync: (path3) => externalPackages[path3] ?? sys2.readFileSync(path3),
|
|
9638
|
+
existsSync: (path3) => !!externalPackages[path3] || sys2.existsSync(path3),
|
|
9639
|
+
readdirSync: (path3) => {
|
|
9640
|
+
const realFiles = sys2.readdirSync(path3);
|
|
9641
|
+
if (path3 === rootDir) {
|
|
8700
9642
|
return [
|
|
8701
9643
|
...realFiles,
|
|
8702
9644
|
...Object.keys(externalPackages).map(
|
|
@@ -8706,9 +9648,9 @@ async function createRemixDevToolsSys(sys2) {
|
|
|
8706
9648
|
}
|
|
8707
9649
|
return realFiles;
|
|
8708
9650
|
},
|
|
8709
|
-
readdir: async (
|
|
8710
|
-
const realFiles = await sys2.readdir(
|
|
8711
|
-
if (
|
|
9651
|
+
readdir: async (path3) => {
|
|
9652
|
+
const realFiles = await sys2.readdir(path3);
|
|
9653
|
+
if (path3 === rootDir) {
|
|
8712
9654
|
return [
|
|
8713
9655
|
...realFiles,
|
|
8714
9656
|
...Object.keys(externalPackages).map(
|
|
@@ -9892,11 +10834,11 @@ async function createReactDevToolsSys(sys2) {
|
|
|
9892
10834
|
addExternalPackage: (pkgName) => {
|
|
9893
10835
|
externalPackages[sys2.join(rootDir, pkgName, "index.ts")] = `export * from "${pkgName}";`;
|
|
9894
10836
|
},
|
|
9895
|
-
readFileSync: (
|
|
9896
|
-
existsSync: (
|
|
9897
|
-
readdirSync: (
|
|
9898
|
-
const realFiles = sys2.readdirSync(
|
|
9899
|
-
if (
|
|
10837
|
+
readFileSync: (path3) => externalPackages[path3] ?? sys2.readFileSync(path3),
|
|
10838
|
+
existsSync: (path3) => !!externalPackages[path3] || sys2.existsSync(path3),
|
|
10839
|
+
readdirSync: (path3) => {
|
|
10840
|
+
const realFiles = sys2.readdirSync(path3);
|
|
10841
|
+
if (path3 === rootDir) {
|
|
9900
10842
|
return [
|
|
9901
10843
|
...realFiles,
|
|
9902
10844
|
...Object.keys(externalPackages).map(
|
|
@@ -9906,9 +10848,9 @@ async function createReactDevToolsSys(sys2) {
|
|
|
9906
10848
|
}
|
|
9907
10849
|
return realFiles;
|
|
9908
10850
|
},
|
|
9909
|
-
readdir: async (
|
|
9910
|
-
const realFiles = await sys2.readdir(
|
|
9911
|
-
if (
|
|
10851
|
+
readdir: async (path3) => {
|
|
10852
|
+
const realFiles = await sys2.readdir(path3);
|
|
10853
|
+
if (path3 === rootDir) {
|
|
9912
10854
|
return [
|
|
9913
10855
|
...realFiles,
|
|
9914
10856
|
...Object.keys(externalPackages).map(
|
|
@@ -10833,7 +11775,7 @@ var init_angular_app_module_imports = __esm({
|
|
|
10833
11775
|
});
|
|
10834
11776
|
|
|
10835
11777
|
// packages/dev-tools/core/adapters/angular/angular-app-routes-update.ts
|
|
10836
|
-
async function angularAddRoute(sys2,
|
|
11778
|
+
async function angularAddRoute(sys2, path3, componentName, componentPath) {
|
|
10837
11779
|
const fileExtension = sys2.typescriptEnabled ? ".ts" : ".js";
|
|
10838
11780
|
const fileName = `app.routes${fileExtension}`;
|
|
10839
11781
|
const appRoutesPath = sys2.join(sys2.appDir, fileName);
|
|
@@ -10846,11 +11788,11 @@ async function angularAddRoute(sys2, path2, componentName, componentPath) {
|
|
|
10846
11788
|
}
|
|
10847
11789
|
const exportKey = Object.keys(mod.exports)[0];
|
|
10848
11790
|
const routes = mod.exports[exportKey];
|
|
10849
|
-
if (routes.find((r) => r.path ===
|
|
11791
|
+
if (routes.find((r) => r.path === path3)) {
|
|
10850
11792
|
return;
|
|
10851
11793
|
}
|
|
10852
11794
|
const newEntry = sys2.magicast.builders.raw("{}");
|
|
10853
|
-
newEntry.path =
|
|
11795
|
+
newEntry.path = path3;
|
|
10854
11796
|
newEntry.component = sys2.magicast.builders.raw(componentName);
|
|
10855
11797
|
routes.push(newEntry);
|
|
10856
11798
|
if (mod.imports.$items.find((i) => i.imported === componentName)) {
|
|
@@ -12858,11 +13800,11 @@ async function createAngularDevToolsSys(sys2) {
|
|
|
12858
13800
|
addExternalPackage: (pkgName) => {
|
|
12859
13801
|
externalPackages[sys2.join(rootDir, pkgName, "index.ts")] = `export * from "${pkgName}";`;
|
|
12860
13802
|
},
|
|
12861
|
-
readFileSync: (
|
|
12862
|
-
existsSync: (
|
|
12863
|
-
readdirSync: (
|
|
12864
|
-
const realFiles = sys2.readdirSync(
|
|
12865
|
-
if (
|
|
13803
|
+
readFileSync: (path3) => externalPackages[path3] ?? sys2.readFileSync(path3),
|
|
13804
|
+
existsSync: (path3) => !!externalPackages[path3] || sys2.existsSync(path3),
|
|
13805
|
+
readdirSync: (path3) => {
|
|
13806
|
+
const realFiles = sys2.readdirSync(path3);
|
|
13807
|
+
if (path3 === rootDir) {
|
|
12866
13808
|
return [
|
|
12867
13809
|
...realFiles,
|
|
12868
13810
|
...Object.keys(externalPackages).map(
|
|
@@ -12872,9 +13814,9 @@ async function createAngularDevToolsSys(sys2) {
|
|
|
12872
13814
|
}
|
|
12873
13815
|
return realFiles;
|
|
12874
13816
|
},
|
|
12875
|
-
readdir: async (
|
|
12876
|
-
const realFiles = await sys2.readdir(
|
|
12877
|
-
if (
|
|
13817
|
+
readdir: async (path3) => {
|
|
13818
|
+
const realFiles = await sys2.readdir(path3);
|
|
13819
|
+
if (path3 === rootDir) {
|
|
12878
13820
|
return [
|
|
12879
13821
|
...realFiles,
|
|
12880
13822
|
...Object.keys(externalPackages).map(
|
|
@@ -13479,11 +14421,11 @@ async function createVueDevToolsSys(sys2) {
|
|
|
13479
14421
|
addExternalPackage: (pkgName) => {
|
|
13480
14422
|
externalPackages[sys2.join(rootDir, pkgName, "index.ts")] = `export * from "${pkgName}";`;
|
|
13481
14423
|
},
|
|
13482
|
-
readFileSync: (
|
|
13483
|
-
existsSync: (
|
|
13484
|
-
readdirSync: (
|
|
13485
|
-
const realFiles = sys2.readdirSync(
|
|
13486
|
-
if (
|
|
14424
|
+
readFileSync: (path3) => externalPackages[path3] ?? sys2.readFileSync(path3),
|
|
14425
|
+
existsSync: (path3) => !!externalPackages[path3] || sys2.existsSync(path3),
|
|
14426
|
+
readdirSync: (path3) => {
|
|
14427
|
+
const realFiles = sys2.readdirSync(path3);
|
|
14428
|
+
if (path3 === rootDir) {
|
|
13487
14429
|
return [
|
|
13488
14430
|
...realFiles,
|
|
13489
14431
|
...Object.keys(externalPackages).map(
|
|
@@ -13493,9 +14435,9 @@ async function createVueDevToolsSys(sys2) {
|
|
|
13493
14435
|
}
|
|
13494
14436
|
return realFiles;
|
|
13495
14437
|
},
|
|
13496
|
-
readdir: async (
|
|
13497
|
-
const realFiles = await sys2.readdir(
|
|
13498
|
-
if (
|
|
14438
|
+
readdir: async (path3) => {
|
|
14439
|
+
const realFiles = await sys2.readdir(path3);
|
|
14440
|
+
if (path3 === rootDir) {
|
|
13499
14441
|
return [
|
|
13500
14442
|
...realFiles,
|
|
13501
14443
|
...Object.keys(externalPackages).map(
|
|
@@ -14039,7 +14981,7 @@ var require_core = __commonJS({
|
|
|
14039
14981
|
const o2 = {};
|
|
14040
14982
|
const vs = s2.split("|");
|
|
14041
14983
|
const key_id = vs[1];
|
|
14042
|
-
let keys =
|
|
14984
|
+
let keys = decode2(values, key_id);
|
|
14043
14985
|
const n = vs.length;
|
|
14044
14986
|
if (n - 2 === 1 && !Array.isArray(keys)) {
|
|
14045
14987
|
keys = [keys];
|
|
@@ -14047,7 +14989,7 @@ var require_core = __commonJS({
|
|
|
14047
14989
|
for (let i = 2; i < n; i++) {
|
|
14048
14990
|
const k3 = keys[i - 2];
|
|
14049
14991
|
let v = vs[i];
|
|
14050
|
-
v =
|
|
14992
|
+
v = decode2(values, v);
|
|
14051
14993
|
o2[k3] = v;
|
|
14052
14994
|
}
|
|
14053
14995
|
return o2;
|
|
@@ -14061,12 +15003,12 @@ var require_core = __commonJS({
|
|
|
14061
15003
|
const xs = new Array(n);
|
|
14062
15004
|
for (let i = 0; i < n; i++) {
|
|
14063
15005
|
let v = vs[i + 1];
|
|
14064
|
-
v =
|
|
15006
|
+
v = decode2(values, v);
|
|
14065
15007
|
xs[i] = v;
|
|
14066
15008
|
}
|
|
14067
15009
|
return xs;
|
|
14068
15010
|
}
|
|
14069
|
-
function
|
|
15011
|
+
function decode2(values, key) {
|
|
14070
15012
|
if (key === "" || key === "_") {
|
|
14071
15013
|
return null;
|
|
14072
15014
|
}
|
|
@@ -14097,10 +15039,10 @@ var require_core = __commonJS({
|
|
|
14097
15039
|
}
|
|
14098
15040
|
return (0, debug_1.throwUnknownDataType)(v);
|
|
14099
15041
|
}
|
|
14100
|
-
exports2.decode =
|
|
15042
|
+
exports2.decode = decode2;
|
|
14101
15043
|
function decompress2(c) {
|
|
14102
15044
|
const [values, root] = c;
|
|
14103
|
-
return
|
|
15045
|
+
return decode2(values, root);
|
|
14104
15046
|
}
|
|
14105
15047
|
exports2.decompress = decompress2;
|
|
14106
15048
|
}
|
|
@@ -15774,11 +16716,11 @@ var init_lib = __esm({
|
|
|
15774
16716
|
}
|
|
15775
16717
|
}
|
|
15776
16718
|
},
|
|
15777
|
-
addToPath: function addToPath(
|
|
15778
|
-
var last =
|
|
16719
|
+
addToPath: function addToPath(path3, added, removed, oldPosInc) {
|
|
16720
|
+
var last = path3.lastComponent;
|
|
15779
16721
|
if (last && last.added === added && last.removed === removed) {
|
|
15780
16722
|
return {
|
|
15781
|
-
oldPos:
|
|
16723
|
+
oldPos: path3.oldPos + oldPosInc,
|
|
15782
16724
|
lastComponent: {
|
|
15783
16725
|
count: last.count + 1,
|
|
15784
16726
|
added,
|
|
@@ -15788,7 +16730,7 @@ var init_lib = __esm({
|
|
|
15788
16730
|
};
|
|
15789
16731
|
} else {
|
|
15790
16732
|
return {
|
|
15791
|
-
oldPos:
|
|
16733
|
+
oldPos: path3.oldPos + oldPosInc,
|
|
15792
16734
|
lastComponent: {
|
|
15793
16735
|
count: 1,
|
|
15794
16736
|
added,
|
|
@@ -15836,8 +16778,8 @@ var init_lib = __esm({
|
|
|
15836
16778
|
tokenize: function tokenize(value) {
|
|
15837
16779
|
return value.split("");
|
|
15838
16780
|
},
|
|
15839
|
-
join: function
|
|
15840
|
-
return
|
|
16781
|
+
join: function join2(chars2) {
|
|
16782
|
+
return chars2.join("");
|
|
15841
16783
|
}
|
|
15842
16784
|
};
|
|
15843
16785
|
characterDiff = new Diff();
|
|
@@ -16199,11 +17141,11 @@ async function killProcess(sys2, procOrPid, abortSignal, timeout = 5e3) {
|
|
|
16199
17141
|
try {
|
|
16200
17142
|
await Promise.race([
|
|
16201
17143
|
await new Promise(
|
|
16202
|
-
(
|
|
17144
|
+
(resolve4, reject) => (0, import_tree_kill.default)(pid, "SIGTERM", (err) => {
|
|
16203
17145
|
if (err) {
|
|
16204
17146
|
reject(err);
|
|
16205
17147
|
} else {
|
|
16206
|
-
|
|
17148
|
+
resolve4();
|
|
16207
17149
|
}
|
|
16208
17150
|
})
|
|
16209
17151
|
),
|
|
@@ -16226,11 +17168,11 @@ async function killProcess(sys2, procOrPid, abortSignal, timeout = 5e3) {
|
|
|
16226
17168
|
try {
|
|
16227
17169
|
await Promise.race([
|
|
16228
17170
|
await new Promise(
|
|
16229
|
-
(
|
|
17171
|
+
(resolve4, reject) => (0, import_tree_kill.default)(pid, "SIGKILL", (err2) => {
|
|
16230
17172
|
if (err2) {
|
|
16231
17173
|
reject(err2);
|
|
16232
17174
|
} else {
|
|
16233
|
-
|
|
17175
|
+
resolve4();
|
|
16234
17176
|
}
|
|
16235
17177
|
})
|
|
16236
17178
|
),
|
|
@@ -17474,7 +18416,7 @@ var require_braces = __commonJS({
|
|
|
17474
18416
|
var require_constants2 = __commonJS({
|
|
17475
18417
|
"node_modules/micromatch/node_modules/picomatch/lib/constants.js"(exports2, module2) {
|
|
17476
18418
|
"use strict";
|
|
17477
|
-
var
|
|
18419
|
+
var path3 = require("path");
|
|
17478
18420
|
var WIN_SLASH = "\\\\/";
|
|
17479
18421
|
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
17480
18422
|
var DOT_LITERAL = "\\.";
|
|
@@ -17644,13 +18586,13 @@ var require_constants2 = __commonJS({
|
|
|
17644
18586
|
/* | */
|
|
17645
18587
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
17646
18588
|
/* \uFEFF */
|
|
17647
|
-
SEP:
|
|
18589
|
+
SEP: path3.sep,
|
|
17648
18590
|
/**
|
|
17649
18591
|
* Create EXTGLOB_CHARS
|
|
17650
18592
|
*/
|
|
17651
|
-
extglobChars(
|
|
18593
|
+
extglobChars(chars2) {
|
|
17652
18594
|
return {
|
|
17653
|
-
"!": { type: "negate", open: "(?:(?!(?:", close: `))${
|
|
18595
|
+
"!": { type: "negate", open: "(?:(?!(?:", close: `))${chars2.STAR})` },
|
|
17654
18596
|
"?": { type: "qmark", open: "(?:", close: ")?" },
|
|
17655
18597
|
"+": { type: "plus", open: "(?:", close: ")+" },
|
|
17656
18598
|
"*": { type: "star", open: "(?:", close: ")*" },
|
|
@@ -17671,7 +18613,7 @@ var require_constants2 = __commonJS({
|
|
|
17671
18613
|
var require_utils2 = __commonJS({
|
|
17672
18614
|
"node_modules/micromatch/node_modules/picomatch/lib/utils.js"(exports2) {
|
|
17673
18615
|
"use strict";
|
|
17674
|
-
var
|
|
18616
|
+
var path3 = require("path");
|
|
17675
18617
|
var win32 = process.platform === "win32";
|
|
17676
18618
|
var {
|
|
17677
18619
|
REGEX_BACKSLASH,
|
|
@@ -17700,7 +18642,7 @@ var require_utils2 = __commonJS({
|
|
|
17700
18642
|
if (options && typeof options.windows === "boolean") {
|
|
17701
18643
|
return options.windows;
|
|
17702
18644
|
}
|
|
17703
|
-
return win32 === true ||
|
|
18645
|
+
return win32 === true || path3.sep === "\\";
|
|
17704
18646
|
};
|
|
17705
18647
|
exports2.escapeLast = (input, char, lastIdx) => {
|
|
17706
18648
|
const idx = input.lastIndexOf(char, lastIdx);
|
|
@@ -18248,7 +19190,7 @@ var require_parse3 = __commonJS({
|
|
|
18248
19190
|
};
|
|
18249
19191
|
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
18250
19192
|
let backslashes = false;
|
|
18251
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m2, esc,
|
|
19193
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m2, esc, chars2, first, rest, index) => {
|
|
18252
19194
|
if (first === "\\") {
|
|
18253
19195
|
backslashes = true;
|
|
18254
19196
|
return m2;
|
|
@@ -18260,10 +19202,10 @@ var require_parse3 = __commonJS({
|
|
|
18260
19202
|
if (index === 0) {
|
|
18261
19203
|
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
|
18262
19204
|
}
|
|
18263
|
-
return QMARK.repeat(
|
|
19205
|
+
return QMARK.repeat(chars2.length);
|
|
18264
19206
|
}
|
|
18265
19207
|
if (first === ".") {
|
|
18266
|
-
return DOT_LITERAL.repeat(
|
|
19208
|
+
return DOT_LITERAL.repeat(chars2.length);
|
|
18267
19209
|
}
|
|
18268
19210
|
if (first === "*") {
|
|
18269
19211
|
if (esc) {
|
|
@@ -18835,7 +19777,7 @@ var require_parse3 = __commonJS({
|
|
|
18835
19777
|
var require_picomatch = __commonJS({
|
|
18836
19778
|
"node_modules/micromatch/node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
|
|
18837
19779
|
"use strict";
|
|
18838
|
-
var
|
|
19780
|
+
var path3 = require("path");
|
|
18839
19781
|
var scan = require_scan();
|
|
18840
19782
|
var parse = require_parse3();
|
|
18841
19783
|
var utils = require_utils2();
|
|
@@ -18920,7 +19862,7 @@ var require_picomatch = __commonJS({
|
|
|
18920
19862
|
};
|
|
18921
19863
|
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
18922
19864
|
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
18923
|
-
return regex.test(
|
|
19865
|
+
return regex.test(path3.basename(input));
|
|
18924
19866
|
};
|
|
18925
19867
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
18926
19868
|
picomatch.parse = (pattern, options) => {
|
|
@@ -20317,7 +21259,7 @@ var require_follow_redirects = __commonJS({
|
|
|
20317
21259
|
removeMatchingHeaders(/^content-/i, this._options.headers);
|
|
20318
21260
|
}
|
|
20319
21261
|
var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
|
|
20320
|
-
var currentUrlParts =
|
|
21262
|
+
var currentUrlParts = parseUrl2(this._currentUrl);
|
|
20321
21263
|
var currentHost = currentHostHeader || currentUrlParts.host;
|
|
20322
21264
|
var currentUrl = /^\w+:/.test(location) ? this._currentUrl : url.format(Object.assign(currentUrlParts, { host: currentHost }));
|
|
20323
21265
|
var redirectUrl = resolveUrl(location, currentUrl);
|
|
@@ -20356,7 +21298,7 @@ var require_follow_redirects = __commonJS({
|
|
|
20356
21298
|
if (isURL(input)) {
|
|
20357
21299
|
input = spreadUrlObject(input);
|
|
20358
21300
|
} else if (isString2(input)) {
|
|
20359
|
-
input = spreadUrlObject(
|
|
21301
|
+
input = spreadUrlObject(parseUrl2(input));
|
|
20360
21302
|
} else {
|
|
20361
21303
|
callback = options;
|
|
20362
21304
|
options = validateUrl(input);
|
|
@@ -20392,7 +21334,7 @@ var require_follow_redirects = __commonJS({
|
|
|
20392
21334
|
}
|
|
20393
21335
|
function noop() {
|
|
20394
21336
|
}
|
|
20395
|
-
function
|
|
21337
|
+
function parseUrl2(input) {
|
|
20396
21338
|
var parsed;
|
|
20397
21339
|
if (useNativeURL) {
|
|
20398
21340
|
parsed = new URL2(input);
|
|
@@ -20405,7 +21347,7 @@ var require_follow_redirects = __commonJS({
|
|
|
20405
21347
|
return parsed;
|
|
20406
21348
|
}
|
|
20407
21349
|
function resolveUrl(relative, base) {
|
|
20408
|
-
return useNativeURL ? new URL2(relative, base) :
|
|
21350
|
+
return useNativeURL ? new URL2(relative, base) : parseUrl2(url.resolve(base, relative));
|
|
20409
21351
|
}
|
|
20410
21352
|
function validateUrl(input) {
|
|
20411
21353
|
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
@@ -21637,7 +22579,7 @@ var require_cookie = __commonJS({
|
|
|
21637
22579
|
var obj = {};
|
|
21638
22580
|
var len = str.length;
|
|
21639
22581
|
if (len < 2) return obj;
|
|
21640
|
-
var dec = opt && opt.decode ||
|
|
22582
|
+
var dec = opt && opt.decode || decode2;
|
|
21641
22583
|
var index = 0;
|
|
21642
22584
|
var eqIdx = 0;
|
|
21643
22585
|
var endIdx = 0;
|
|
@@ -21768,15 +22710,15 @@ var require_cookie = __commonJS({
|
|
|
21768
22710
|
}
|
|
21769
22711
|
return str;
|
|
21770
22712
|
}
|
|
21771
|
-
function
|
|
22713
|
+
function decode2(str) {
|
|
21772
22714
|
return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
|
|
21773
22715
|
}
|
|
21774
22716
|
function isDate(val) {
|
|
21775
22717
|
return __toString.call(val) === "[object Date]";
|
|
21776
22718
|
}
|
|
21777
|
-
function tryDecode(str,
|
|
22719
|
+
function tryDecode(str, decode3) {
|
|
21778
22720
|
try {
|
|
21779
|
-
return
|
|
22721
|
+
return decode3(str);
|
|
21780
22722
|
} catch (e2) {
|
|
21781
22723
|
return str;
|
|
21782
22724
|
}
|
|
@@ -22403,8 +23345,8 @@ var init_parseUtil = __esm({
|
|
|
22403
23345
|
init_errors2();
|
|
22404
23346
|
init_en();
|
|
22405
23347
|
makeIssue = (params) => {
|
|
22406
|
-
const { data, path:
|
|
22407
|
-
const fullPath = [...
|
|
23348
|
+
const { data, path: path3, errorMaps, issueData } = params;
|
|
23349
|
+
const fullPath = [...path3, ...issueData.path || []];
|
|
22408
23350
|
const fullIssue = {
|
|
22409
23351
|
...issueData,
|
|
22410
23352
|
path: fullPath
|
|
@@ -22712,11 +23654,11 @@ var init_types2 = __esm({
|
|
|
22712
23654
|
init_parseUtil();
|
|
22713
23655
|
init_util();
|
|
22714
23656
|
ParseInputLazyPath = class {
|
|
22715
|
-
constructor(parent, value,
|
|
23657
|
+
constructor(parent, value, path3, key) {
|
|
22716
23658
|
this._cachedPath = [];
|
|
22717
23659
|
this.parent = parent;
|
|
22718
23660
|
this.data = value;
|
|
22719
|
-
this._path =
|
|
23661
|
+
this._path = path3;
|
|
22720
23662
|
this._key = key;
|
|
22721
23663
|
}
|
|
22722
23664
|
get path() {
|
|
@@ -29244,8 +30186,8 @@ var require_resolve = __commonJS({
|
|
|
29244
30186
|
}
|
|
29245
30187
|
return count;
|
|
29246
30188
|
}
|
|
29247
|
-
function getFullPath(resolver, id = "",
|
|
29248
|
-
if (
|
|
30189
|
+
function getFullPath(resolver, id = "", normalize2) {
|
|
30190
|
+
if (normalize2 !== false)
|
|
29249
30191
|
id = normalizeId(id);
|
|
29250
30192
|
const p2 = resolver.parse(id);
|
|
29251
30193
|
return _getFullPath(resolver, p2);
|
|
@@ -29993,7 +30935,7 @@ var require_compile2 = __commonJS({
|
|
|
29993
30935
|
const schOrFunc = root.refs[ref];
|
|
29994
30936
|
if (schOrFunc)
|
|
29995
30937
|
return schOrFunc;
|
|
29996
|
-
let _sch =
|
|
30938
|
+
let _sch = resolve4.call(this, root, ref);
|
|
29997
30939
|
if (_sch === void 0) {
|
|
29998
30940
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
29999
30941
|
const { schemaId } = this.opts;
|
|
@@ -30020,7 +30962,7 @@ var require_compile2 = __commonJS({
|
|
|
30020
30962
|
function sameSchemaEnv(s1, s2) {
|
|
30021
30963
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
30022
30964
|
}
|
|
30023
|
-
function
|
|
30965
|
+
function resolve4(root, ref) {
|
|
30024
30966
|
let sch;
|
|
30025
30967
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
30026
30968
|
ref = sch;
|
|
@@ -30418,8 +31360,8 @@ var require_schemes = __commonJS({
|
|
|
30418
31360
|
wsComponents.secure = void 0;
|
|
30419
31361
|
}
|
|
30420
31362
|
if (wsComponents.resourceName) {
|
|
30421
|
-
const [
|
|
30422
|
-
wsComponents.path =
|
|
31363
|
+
const [path3, query] = wsComponents.resourceName.split("?");
|
|
31364
|
+
wsComponents.path = path3 && path3 !== "/" ? path3 : void 0;
|
|
30423
31365
|
wsComponents.query = query;
|
|
30424
31366
|
wsComponents.resourceName = void 0;
|
|
30425
31367
|
}
|
|
@@ -30529,7 +31471,7 @@ var require_fast_uri = __commonJS({
|
|
|
30529
31471
|
"use strict";
|
|
30530
31472
|
var { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = require_utils3();
|
|
30531
31473
|
var SCHEMES = require_schemes();
|
|
30532
|
-
function
|
|
31474
|
+
function normalize2(uri, options) {
|
|
30533
31475
|
if (typeof uri === "string") {
|
|
30534
31476
|
uri = serialize(parse(uri, options), options);
|
|
30535
31477
|
} else if (typeof uri === "object") {
|
|
@@ -30537,7 +31479,7 @@ var require_fast_uri = __commonJS({
|
|
|
30537
31479
|
}
|
|
30538
31480
|
return uri;
|
|
30539
31481
|
}
|
|
30540
|
-
function
|
|
31482
|
+
function resolve4(baseURI, relativeURI, options) {
|
|
30541
31483
|
const schemelessOptions = Object.assign({ scheme: "null" }, options);
|
|
30542
31484
|
const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
30543
31485
|
return serialize(resolved, { ...schemelessOptions, skipEscape: true });
|
|
@@ -30767,8 +31709,8 @@ var require_fast_uri = __commonJS({
|
|
|
30767
31709
|
}
|
|
30768
31710
|
var fastUri = {
|
|
30769
31711
|
SCHEMES,
|
|
30770
|
-
normalize,
|
|
30771
|
-
resolve,
|
|
31712
|
+
normalize: normalize2,
|
|
31713
|
+
resolve: resolve4,
|
|
30772
31714
|
resolveComponents,
|
|
30773
31715
|
equal,
|
|
30774
31716
|
serialize,
|
|
@@ -33735,12 +34677,12 @@ var require_dist2 = __commonJS({
|
|
|
33735
34677
|
throw new Error(`Unknown format "${name}"`);
|
|
33736
34678
|
return f;
|
|
33737
34679
|
};
|
|
33738
|
-
function addFormats(ajv, list,
|
|
34680
|
+
function addFormats(ajv, list, fs2, exportName) {
|
|
33739
34681
|
var _a;
|
|
33740
34682
|
var _b;
|
|
33741
34683
|
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
33742
34684
|
for (const f of list)
|
|
33743
|
-
ajv.addFormat(f,
|
|
34685
|
+
ajv.addFormat(f, fs2[f]);
|
|
33744
34686
|
}
|
|
33745
34687
|
module2.exports = exports2 = formatsPlugin;
|
|
33746
34688
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -33771,8 +34713,8 @@ var require_windows = __commonJS({
|
|
|
33771
34713
|
"node_modules/isexe/windows.js"(exports2, module2) {
|
|
33772
34714
|
module2.exports = isexe;
|
|
33773
34715
|
isexe.sync = sync;
|
|
33774
|
-
var
|
|
33775
|
-
function checkPathExt(
|
|
34716
|
+
var fs2 = require("fs");
|
|
34717
|
+
function checkPathExt(path3, options) {
|
|
33776
34718
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
33777
34719
|
if (!pathext) {
|
|
33778
34720
|
return true;
|
|
@@ -33783,25 +34725,25 @@ var require_windows = __commonJS({
|
|
|
33783
34725
|
}
|
|
33784
34726
|
for (var i = 0; i < pathext.length; i++) {
|
|
33785
34727
|
var p2 = pathext[i].toLowerCase();
|
|
33786
|
-
if (p2 &&
|
|
34728
|
+
if (p2 && path3.substr(-p2.length).toLowerCase() === p2) {
|
|
33787
34729
|
return true;
|
|
33788
34730
|
}
|
|
33789
34731
|
}
|
|
33790
34732
|
return false;
|
|
33791
34733
|
}
|
|
33792
|
-
function checkStat(stat2,
|
|
34734
|
+
function checkStat(stat2, path3, options) {
|
|
33793
34735
|
if (!stat2.isSymbolicLink() && !stat2.isFile()) {
|
|
33794
34736
|
return false;
|
|
33795
34737
|
}
|
|
33796
|
-
return checkPathExt(
|
|
34738
|
+
return checkPathExt(path3, options);
|
|
33797
34739
|
}
|
|
33798
|
-
function isexe(
|
|
33799
|
-
|
|
33800
|
-
cb(er, er ? false : checkStat(stat2,
|
|
34740
|
+
function isexe(path3, options, cb) {
|
|
34741
|
+
fs2.stat(path3, function(er, stat2) {
|
|
34742
|
+
cb(er, er ? false : checkStat(stat2, path3, options));
|
|
33801
34743
|
});
|
|
33802
34744
|
}
|
|
33803
|
-
function sync(
|
|
33804
|
-
return checkStat(
|
|
34745
|
+
function sync(path3, options) {
|
|
34746
|
+
return checkStat(fs2.statSync(path3), path3, options);
|
|
33805
34747
|
}
|
|
33806
34748
|
}
|
|
33807
34749
|
});
|
|
@@ -33811,14 +34753,14 @@ var require_mode = __commonJS({
|
|
|
33811
34753
|
"node_modules/isexe/mode.js"(exports2, module2) {
|
|
33812
34754
|
module2.exports = isexe;
|
|
33813
34755
|
isexe.sync = sync;
|
|
33814
|
-
var
|
|
33815
|
-
function isexe(
|
|
33816
|
-
|
|
34756
|
+
var fs2 = require("fs");
|
|
34757
|
+
function isexe(path3, options, cb) {
|
|
34758
|
+
fs2.stat(path3, function(er, stat2) {
|
|
33817
34759
|
cb(er, er ? false : checkStat(stat2, options));
|
|
33818
34760
|
});
|
|
33819
34761
|
}
|
|
33820
|
-
function sync(
|
|
33821
|
-
return checkStat(
|
|
34762
|
+
function sync(path3, options) {
|
|
34763
|
+
return checkStat(fs2.statSync(path3), options);
|
|
33822
34764
|
}
|
|
33823
34765
|
function checkStat(stat2, options) {
|
|
33824
34766
|
return stat2.isFile() && checkMode(stat2, options);
|
|
@@ -33842,7 +34784,7 @@ var require_mode = __commonJS({
|
|
|
33842
34784
|
// node_modules/isexe/index.js
|
|
33843
34785
|
var require_isexe = __commonJS({
|
|
33844
34786
|
"node_modules/isexe/index.js"(exports2, module2) {
|
|
33845
|
-
var
|
|
34787
|
+
var fs2 = require("fs");
|
|
33846
34788
|
var core;
|
|
33847
34789
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
33848
34790
|
core = require_windows();
|
|
@@ -33851,7 +34793,7 @@ var require_isexe = __commonJS({
|
|
|
33851
34793
|
}
|
|
33852
34794
|
module2.exports = isexe;
|
|
33853
34795
|
isexe.sync = sync;
|
|
33854
|
-
function isexe(
|
|
34796
|
+
function isexe(path3, options, cb) {
|
|
33855
34797
|
if (typeof options === "function") {
|
|
33856
34798
|
cb = options;
|
|
33857
34799
|
options = {};
|
|
@@ -33860,17 +34802,17 @@ var require_isexe = __commonJS({
|
|
|
33860
34802
|
if (typeof Promise !== "function") {
|
|
33861
34803
|
throw new TypeError("callback not provided");
|
|
33862
34804
|
}
|
|
33863
|
-
return new Promise(function(
|
|
33864
|
-
isexe(
|
|
34805
|
+
return new Promise(function(resolve4, reject) {
|
|
34806
|
+
isexe(path3, options || {}, function(er, is) {
|
|
33865
34807
|
if (er) {
|
|
33866
34808
|
reject(er);
|
|
33867
34809
|
} else {
|
|
33868
|
-
|
|
34810
|
+
resolve4(is);
|
|
33869
34811
|
}
|
|
33870
34812
|
});
|
|
33871
34813
|
});
|
|
33872
34814
|
}
|
|
33873
|
-
core(
|
|
34815
|
+
core(path3, options || {}, function(er, is) {
|
|
33874
34816
|
if (er) {
|
|
33875
34817
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
33876
34818
|
er = null;
|
|
@@ -33880,9 +34822,9 @@ var require_isexe = __commonJS({
|
|
|
33880
34822
|
cb(er, is);
|
|
33881
34823
|
});
|
|
33882
34824
|
}
|
|
33883
|
-
function sync(
|
|
34825
|
+
function sync(path3, options) {
|
|
33884
34826
|
try {
|
|
33885
|
-
return core.sync(
|
|
34827
|
+
return core.sync(path3, options || {});
|
|
33886
34828
|
} catch (er) {
|
|
33887
34829
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
33888
34830
|
return false;
|
|
@@ -33898,7 +34840,7 @@ var require_isexe = __commonJS({
|
|
|
33898
34840
|
var require_which = __commonJS({
|
|
33899
34841
|
"node_modules/which/which.js"(exports2, module2) {
|
|
33900
34842
|
var isWindows2 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
33901
|
-
var
|
|
34843
|
+
var path3 = require("path");
|
|
33902
34844
|
var COLON = isWindows2 ? ";" : ":";
|
|
33903
34845
|
var isexe = require_isexe();
|
|
33904
34846
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -33930,28 +34872,28 @@ var require_which = __commonJS({
|
|
|
33930
34872
|
if (!opt)
|
|
33931
34873
|
opt = {};
|
|
33932
34874
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
33933
|
-
const
|
|
33934
|
-
const step = (i) => new Promise((
|
|
34875
|
+
const found2 = [];
|
|
34876
|
+
const step = (i) => new Promise((resolve4, reject) => {
|
|
33935
34877
|
if (i === pathEnv.length)
|
|
33936
|
-
return opt.all &&
|
|
34878
|
+
return opt.all && found2.length ? resolve4(found2) : reject(getNotFoundError(cmd));
|
|
33937
34879
|
const ppRaw = pathEnv[i];
|
|
33938
34880
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
33939
|
-
const pCmd =
|
|
34881
|
+
const pCmd = path3.join(pathPart, cmd);
|
|
33940
34882
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
33941
|
-
|
|
34883
|
+
resolve4(subStep(p2, i, 0));
|
|
33942
34884
|
});
|
|
33943
|
-
const subStep = (p2, i, ii) => new Promise((
|
|
34885
|
+
const subStep = (p2, i, ii) => new Promise((resolve4, reject) => {
|
|
33944
34886
|
if (ii === pathExt.length)
|
|
33945
|
-
return
|
|
34887
|
+
return resolve4(step(i + 1));
|
|
33946
34888
|
const ext = pathExt[ii];
|
|
33947
34889
|
isexe(p2 + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
33948
34890
|
if (!er && is) {
|
|
33949
34891
|
if (opt.all)
|
|
33950
|
-
|
|
34892
|
+
found2.push(p2 + ext);
|
|
33951
34893
|
else
|
|
33952
|
-
return
|
|
34894
|
+
return resolve4(p2 + ext);
|
|
33953
34895
|
}
|
|
33954
|
-
return
|
|
34896
|
+
return resolve4(subStep(p2, i, ii + 1));
|
|
33955
34897
|
});
|
|
33956
34898
|
});
|
|
33957
34899
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -33959,11 +34901,11 @@ var require_which = __commonJS({
|
|
|
33959
34901
|
var whichSync = (cmd, opt) => {
|
|
33960
34902
|
opt = opt || {};
|
|
33961
34903
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
33962
|
-
const
|
|
34904
|
+
const found2 = [];
|
|
33963
34905
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
33964
34906
|
const ppRaw = pathEnv[i];
|
|
33965
34907
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
33966
|
-
const pCmd =
|
|
34908
|
+
const pCmd = path3.join(pathPart, cmd);
|
|
33967
34909
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
33968
34910
|
for (let j2 = 0; j2 < pathExt.length; j2++) {
|
|
33969
34911
|
const cur = p2 + pathExt[j2];
|
|
@@ -33971,7 +34913,7 @@ var require_which = __commonJS({
|
|
|
33971
34913
|
const is = isexe.sync(cur, { pathExt: pathExtExe });
|
|
33972
34914
|
if (is) {
|
|
33973
34915
|
if (opt.all)
|
|
33974
|
-
|
|
34916
|
+
found2.push(cur);
|
|
33975
34917
|
else
|
|
33976
34918
|
return cur;
|
|
33977
34919
|
}
|
|
@@ -33979,8 +34921,8 @@ var require_which = __commonJS({
|
|
|
33979
34921
|
}
|
|
33980
34922
|
}
|
|
33981
34923
|
}
|
|
33982
|
-
if (opt.all &&
|
|
33983
|
-
return
|
|
34924
|
+
if (opt.all && found2.length)
|
|
34925
|
+
return found2;
|
|
33984
34926
|
if (opt.nothrow)
|
|
33985
34927
|
return null;
|
|
33986
34928
|
throw getNotFoundError(cmd);
|
|
@@ -34011,7 +34953,7 @@ var require_path_key = __commonJS({
|
|
|
34011
34953
|
var require_resolveCommand = __commonJS({
|
|
34012
34954
|
"node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
|
|
34013
34955
|
"use strict";
|
|
34014
|
-
var
|
|
34956
|
+
var path3 = require("path");
|
|
34015
34957
|
var which = require_which();
|
|
34016
34958
|
var getPathKey = require_path_key();
|
|
34017
34959
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -34029,7 +34971,7 @@ var require_resolveCommand = __commonJS({
|
|
|
34029
34971
|
try {
|
|
34030
34972
|
resolved = which.sync(parsed.command, {
|
|
34031
34973
|
path: env[getPathKey({ env })],
|
|
34032
|
-
pathExt: withoutPathExt ?
|
|
34974
|
+
pathExt: withoutPathExt ? path3.delimiter : void 0
|
|
34033
34975
|
});
|
|
34034
34976
|
} catch (e2) {
|
|
34035
34977
|
} finally {
|
|
@@ -34038,7 +34980,7 @@ var require_resolveCommand = __commonJS({
|
|
|
34038
34980
|
}
|
|
34039
34981
|
}
|
|
34040
34982
|
if (resolved) {
|
|
34041
|
-
resolved =
|
|
34983
|
+
resolved = path3.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
34042
34984
|
}
|
|
34043
34985
|
return resolved;
|
|
34044
34986
|
}
|
|
@@ -34092,8 +35034,8 @@ var require_shebang_command = __commonJS({
|
|
|
34092
35034
|
if (!match) {
|
|
34093
35035
|
return null;
|
|
34094
35036
|
}
|
|
34095
|
-
const [
|
|
34096
|
-
const binary =
|
|
35037
|
+
const [path3, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
35038
|
+
const binary = path3.split("/").pop();
|
|
34097
35039
|
if (binary === "env") {
|
|
34098
35040
|
return argument;
|
|
34099
35041
|
}
|
|
@@ -34106,16 +35048,16 @@ var require_shebang_command = __commonJS({
|
|
|
34106
35048
|
var require_readShebang = __commonJS({
|
|
34107
35049
|
"node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
|
|
34108
35050
|
"use strict";
|
|
34109
|
-
var
|
|
35051
|
+
var fs2 = require("fs");
|
|
34110
35052
|
var shebangCommand = require_shebang_command();
|
|
34111
35053
|
function readShebang(command) {
|
|
34112
35054
|
const size = 150;
|
|
34113
35055
|
const buffer = Buffer.alloc(size);
|
|
34114
35056
|
let fd;
|
|
34115
35057
|
try {
|
|
34116
|
-
fd =
|
|
34117
|
-
|
|
34118
|
-
|
|
35058
|
+
fd = fs2.openSync(command, "r");
|
|
35059
|
+
fs2.readSync(fd, buffer, 0, size, 0);
|
|
35060
|
+
fs2.closeSync(fd);
|
|
34119
35061
|
} catch (e2) {
|
|
34120
35062
|
}
|
|
34121
35063
|
return shebangCommand(buffer.toString());
|
|
@@ -34128,7 +35070,7 @@ var require_readShebang = __commonJS({
|
|
|
34128
35070
|
var require_parse4 = __commonJS({
|
|
34129
35071
|
"node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
|
|
34130
35072
|
"use strict";
|
|
34131
|
-
var
|
|
35073
|
+
var path3 = require("path");
|
|
34132
35074
|
var resolveCommand = require_resolveCommand();
|
|
34133
35075
|
var escape2 = require_escape();
|
|
34134
35076
|
var readShebang = require_readShebang();
|
|
@@ -34153,7 +35095,7 @@ var require_parse4 = __commonJS({
|
|
|
34153
35095
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
34154
35096
|
if (parsed.options.forceShell || needsShell) {
|
|
34155
35097
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
34156
|
-
parsed.command =
|
|
35098
|
+
parsed.command = path3.normalize(parsed.command);
|
|
34157
35099
|
parsed.command = escape2.command(parsed.command);
|
|
34158
35100
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
34159
35101
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -34370,8 +35312,8 @@ var require_package = __commonJS({
|
|
|
34370
35312
|
// node_modules/dotenv/lib/main.js
|
|
34371
35313
|
var require_main = __commonJS({
|
|
34372
35314
|
"node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
34373
|
-
var
|
|
34374
|
-
var
|
|
35315
|
+
var fs2 = require("fs");
|
|
35316
|
+
var path3 = require("path");
|
|
34375
35317
|
var os = require("os");
|
|
34376
35318
|
var crypto4 = require("crypto");
|
|
34377
35319
|
var packageJson = require_package();
|
|
@@ -34463,14 +35405,14 @@ var require_main = __commonJS({
|
|
|
34463
35405
|
return { ciphertext, key };
|
|
34464
35406
|
}
|
|
34465
35407
|
function _vaultPath(options) {
|
|
34466
|
-
let dotenvPath =
|
|
35408
|
+
let dotenvPath = path3.resolve(process.cwd(), ".env");
|
|
34467
35409
|
if (options && options.path && options.path.length > 0) {
|
|
34468
35410
|
dotenvPath = options.path;
|
|
34469
35411
|
}
|
|
34470
35412
|
return dotenvPath.endsWith(".vault") ? dotenvPath : `${dotenvPath}.vault`;
|
|
34471
35413
|
}
|
|
34472
35414
|
function _resolveHome(envPath) {
|
|
34473
|
-
return envPath[0] === "~" ?
|
|
35415
|
+
return envPath[0] === "~" ? path3.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
34474
35416
|
}
|
|
34475
35417
|
function _configVault(options) {
|
|
34476
35418
|
_log("Loading env from encrypted .env.vault");
|
|
@@ -34483,7 +35425,7 @@ var require_main = __commonJS({
|
|
|
34483
35425
|
return { parsed };
|
|
34484
35426
|
}
|
|
34485
35427
|
function configDotenv(options) {
|
|
34486
|
-
let dotenvPath =
|
|
35428
|
+
let dotenvPath = path3.resolve(process.cwd(), ".env");
|
|
34487
35429
|
let encoding = "utf8";
|
|
34488
35430
|
const debug2 = Boolean(options && options.debug);
|
|
34489
35431
|
if (options) {
|
|
@@ -34499,7 +35441,7 @@ var require_main = __commonJS({
|
|
|
34499
35441
|
}
|
|
34500
35442
|
}
|
|
34501
35443
|
try {
|
|
34502
|
-
const parsed = DotenvModule.parse(
|
|
35444
|
+
const parsed = DotenvModule.parse(fs2.readFileSync(dotenvPath, { encoding }));
|
|
34503
35445
|
let processEnv = process.env;
|
|
34504
35446
|
if (options && options.processEnv != null) {
|
|
34505
35447
|
processEnv = options.processEnv;
|
|
@@ -34518,7 +35460,7 @@ var require_main = __commonJS({
|
|
|
34518
35460
|
if (_dotenvKey(options).length === 0) {
|
|
34519
35461
|
return DotenvModule.configDotenv(options);
|
|
34520
35462
|
}
|
|
34521
|
-
if (!
|
|
35463
|
+
if (!fs2.existsSync(vaultPath)) {
|
|
34522
35464
|
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
34523
35465
|
return DotenvModule.configDotenv(options);
|
|
34524
35466
|
}
|
|
@@ -35078,11 +36020,11 @@ function parseCallExpression(sys2, node, sourceFile, typeChecker) {
|
|
|
35078
36020
|
import_typescript12.default.isTaggedTemplateExpression(node2) && import_typescript12.default.isIdentifier(node2.tag) && (node2.tag.escapedText === "html" || node2.tag.escapedText === "tmpl")
|
|
35079
36021
|
) {
|
|
35080
36022
|
if (import_typescript12.default.isTemplateExpression(node2.template)) {
|
|
35081
|
-
const
|
|
36023
|
+
const found2 = node2.template.templateSpans.find(
|
|
35082
36024
|
(a) => import_typescript12.default.isIdentifier(a.expression) && isCapitalized(a.expression.text) && getExportStatement2(a.expression)
|
|
35083
36025
|
);
|
|
35084
|
-
if (
|
|
35085
|
-
builderName =
|
|
36026
|
+
if (found2 && import_typescript12.default.isIdentifier(found2.expression)) {
|
|
36027
|
+
builderName = found2.expression.text;
|
|
35086
36028
|
return;
|
|
35087
36029
|
}
|
|
35088
36030
|
}
|
|
@@ -35388,7 +36330,7 @@ async function getFigmaAuth(sys2) {
|
|
|
35388
36330
|
sys: sys2,
|
|
35389
36331
|
name: "Figma",
|
|
35390
36332
|
initialPort: DEFAULT_FIGMA_PORT,
|
|
35391
|
-
requestListener: async (port, req, res,
|
|
36333
|
+
requestListener: async (port, req, res, resolve4, reject) => {
|
|
35392
36334
|
const url = new URL(req.url || "", `http://localhost:${port}`);
|
|
35393
36335
|
if (url.pathname === "/figma-connect") {
|
|
35394
36336
|
const code = url.searchParams.get("code");
|
|
@@ -35422,7 +36364,7 @@ async function getFigmaAuth(sys2) {
|
|
|
35422
36364
|
"The CLI has authenticated correctly with Figma"
|
|
35423
36365
|
),
|
|
35424
36366
|
() => {
|
|
35425
|
-
|
|
36367
|
+
resolve4({
|
|
35426
36368
|
...data,
|
|
35427
36369
|
oauth: true
|
|
35428
36370
|
});
|
|
@@ -35454,7 +36396,7 @@ async function getBuilderAuth(sys2, preferSpaceId) {
|
|
|
35454
36396
|
sys: sys2,
|
|
35455
36397
|
name: "Builder.io",
|
|
35456
36398
|
initialPort: DEFAULT_BUILDER_PORT,
|
|
35457
|
-
requestListener: async (port, req, res,
|
|
36399
|
+
requestListener: async (port, req, res, resolve4) => {
|
|
35458
36400
|
const url = new URL(req.url || "", `http://localhost:${port}`);
|
|
35459
36401
|
if (url.pathname === BUILDER_AUTH_RETURN_PATH) {
|
|
35460
36402
|
res.end(
|
|
@@ -35463,7 +36405,7 @@ async function getBuilderAuth(sys2, preferSpaceId) {
|
|
|
35463
36405
|
"The CLI has authenticated correctly with Builder.io"
|
|
35464
36406
|
),
|
|
35465
36407
|
() => {
|
|
35466
|
-
|
|
36408
|
+
resolve4({
|
|
35467
36409
|
privateKey: url.searchParams.get("p-key") || "",
|
|
35468
36410
|
spaceId: url.searchParams.get("api-key") || "",
|
|
35469
36411
|
spaceName: url.searchParams.get("org-name") || "",
|
|
@@ -35558,17 +36500,17 @@ function loadCredentials(sys2) {
|
|
|
35558
36500
|
return {};
|
|
35559
36501
|
}
|
|
35560
36502
|
async function createAuthServer(opts) {
|
|
35561
|
-
let
|
|
36503
|
+
let resolve4;
|
|
35562
36504
|
let reject;
|
|
35563
36505
|
let s2;
|
|
35564
36506
|
const promise = new Promise((re, rej) => {
|
|
35565
|
-
|
|
36507
|
+
resolve4 = re;
|
|
35566
36508
|
reject = rej;
|
|
35567
36509
|
});
|
|
35568
36510
|
let currentPort = opts.initialPort;
|
|
35569
36511
|
let attempt = 0;
|
|
35570
36512
|
const server = (0, import_http.createServer)(
|
|
35571
|
-
(req, res) => opts.requestListener(currentPort, req, res,
|
|
36513
|
+
(req, res) => opts.requestListener(currentPort, req, res, resolve4, reject)
|
|
35572
36514
|
);
|
|
35573
36515
|
const closeServer = () => {
|
|
35574
36516
|
clearHooks();
|
|
@@ -36009,8 +36951,8 @@ async function getRequestBody(request2) {
|
|
|
36009
36951
|
return body;
|
|
36010
36952
|
}
|
|
36011
36953
|
function getNodeHttpUrl(req) {
|
|
36012
|
-
const
|
|
36013
|
-
return new URL(
|
|
36954
|
+
const path3 = req.url || "/";
|
|
36955
|
+
return new URL(path3, `http://${req.headers.host}`);
|
|
36014
36956
|
}
|
|
36015
36957
|
var init_request_handler = __esm({
|
|
36016
36958
|
"packages/dev-tools/server/request-handler.ts"() {
|
|
@@ -36037,7 +36979,7 @@ async function createDevToolsHttpServer(ctx) {
|
|
|
36037
36979
|
handleDevRequest(ctx, server, request2, response2);
|
|
36038
36980
|
});
|
|
36039
36981
|
const shutdownServer = () => {
|
|
36040
|
-
return new Promise((
|
|
36982
|
+
return new Promise((resolve4, reject) => {
|
|
36041
36983
|
if (server.listening) {
|
|
36042
36984
|
ctx.debug(`closing devtools server on port ${port}`);
|
|
36043
36985
|
server.close((err) => {
|
|
@@ -36049,12 +36991,12 @@ async function createDevToolsHttpServer(ctx) {
|
|
|
36049
36991
|
if (ctx) {
|
|
36050
36992
|
ctx.debug(`closed devtools server on port ${port}`);
|
|
36051
36993
|
}
|
|
36052
|
-
|
|
36994
|
+
resolve4();
|
|
36053
36995
|
}
|
|
36054
36996
|
});
|
|
36055
36997
|
} else {
|
|
36056
36998
|
ctx.debug(`devtools server on port ${port} not listening`);
|
|
36057
|
-
|
|
36999
|
+
resolve4();
|
|
36058
37000
|
}
|
|
36059
37001
|
});
|
|
36060
37002
|
};
|
|
@@ -36075,15 +37017,15 @@ async function createDevToolsHttpServer(ctx) {
|
|
|
36075
37017
|
await shutdownServer();
|
|
36076
37018
|
}
|
|
36077
37019
|
};
|
|
36078
|
-
return new Promise((
|
|
37020
|
+
return new Promise((resolve4) => {
|
|
36079
37021
|
server.listen(port, () => {
|
|
36080
37022
|
ctx.debug(`started devtools server on port ${port}`);
|
|
36081
|
-
|
|
37023
|
+
resolve4(globalThis.__builderDevToolsServer);
|
|
36082
37024
|
});
|
|
36083
37025
|
});
|
|
36084
37026
|
}
|
|
36085
37027
|
function setupDevToolsPort(ctx) {
|
|
36086
|
-
return new Promise((
|
|
37028
|
+
return new Promise((resolve4) => {
|
|
36087
37029
|
const port = ctx.port;
|
|
36088
37030
|
try {
|
|
36089
37031
|
const options = {
|
|
@@ -36095,15 +37037,15 @@ function setupDevToolsPort(ctx) {
|
|
|
36095
37037
|
(0, import_node_http2.request)(options, (res) => {
|
|
36096
37038
|
res.on("end", () => {
|
|
36097
37039
|
ctx.debug(`${DEV_TOOLS_SERVER_CLOSE_PATH} - Response ended`);
|
|
36098
|
-
|
|
37040
|
+
resolve4(port);
|
|
36099
37041
|
});
|
|
36100
37042
|
}).on("error", (error) => {
|
|
36101
37043
|
ctx.debug(`${DEV_TOOLS_SERVER_CLOSE_PATH} - No response ${error}`);
|
|
36102
|
-
|
|
37044
|
+
resolve4(port);
|
|
36103
37045
|
}).end();
|
|
36104
37046
|
} catch (e2) {
|
|
36105
37047
|
ctx.debug(`${DEV_TOOLS_SERVER_CLOSE_PATH} - Error ${e2}`);
|
|
36106
|
-
|
|
37048
|
+
resolve4(port);
|
|
36107
37049
|
}
|
|
36108
37050
|
});
|
|
36109
37051
|
}
|