react-grab 0.0.30 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +101 -136
- package/dist/index.d.cts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.global.js +16 -31
- package/dist/index.js +101 -137
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var web = require('solid-js/web');
|
|
4
4
|
var solidJs = require('solid-js');
|
|
5
|
-
var modernScreenshot = require('modern-screenshot');
|
|
6
5
|
var bippy = require('bippy');
|
|
7
6
|
var source = require('bippy/dist/source');
|
|
8
7
|
var finder = require('@medv/finder');
|
|
@@ -831,7 +830,6 @@ var getHTMLSnippet = async (element) => {
|
|
|
831
830
|
};
|
|
832
831
|
const lines = [];
|
|
833
832
|
const selector = generateCSSSelector(element);
|
|
834
|
-
lines.push(`Locate this element in the codebase:`);
|
|
835
833
|
lines.push(`- selector: ${selector}`);
|
|
836
834
|
const rect = element.getBoundingClientRect();
|
|
837
835
|
lines.push(`- width: ${Math.round(rect.width)}`);
|
|
@@ -938,11 +936,13 @@ var getHTMLSnippet = async (element) => {
|
|
|
938
936
|
|
|
939
937
|
// src/utils/copy-content.ts
|
|
940
938
|
var waitForFocus = () => {
|
|
941
|
-
if (document.hasFocus())
|
|
939
|
+
if (document.hasFocus()) {
|
|
940
|
+
return new Promise((resolve) => setTimeout(resolve, 50));
|
|
941
|
+
}
|
|
942
942
|
return new Promise((resolve) => {
|
|
943
943
|
const onFocus = () => {
|
|
944
944
|
window.removeEventListener("focus", onFocus);
|
|
945
|
-
resolve
|
|
945
|
+
setTimeout(resolve, 50);
|
|
946
946
|
};
|
|
947
947
|
window.addEventListener("focus", onFocus);
|
|
948
948
|
window.focus();
|
|
@@ -961,21 +961,24 @@ var copyContent = async (content) => {
|
|
|
961
961
|
}
|
|
962
962
|
return true;
|
|
963
963
|
}
|
|
964
|
+
const mimeTypeMap = /* @__PURE__ */ new Map();
|
|
965
|
+
for (const contentPart of content) {
|
|
966
|
+
if (contentPart instanceof Blob) {
|
|
967
|
+
const mimeType = contentPart.type || "text/plain";
|
|
968
|
+
if (!mimeTypeMap.has(mimeType)) {
|
|
969
|
+
mimeTypeMap.set(mimeType, contentPart);
|
|
970
|
+
}
|
|
971
|
+
} else {
|
|
972
|
+
if (!mimeTypeMap.has("text/plain")) {
|
|
973
|
+
mimeTypeMap.set(
|
|
974
|
+
"text/plain",
|
|
975
|
+
new Blob([contentPart], { type: "text/plain" })
|
|
976
|
+
);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
}
|
|
964
980
|
await navigator.clipboard.write([
|
|
965
|
-
new ClipboardItem(
|
|
966
|
-
Object.fromEntries(
|
|
967
|
-
content.map((contentPart) => {
|
|
968
|
-
if (contentPart instanceof Blob) {
|
|
969
|
-
return [contentPart.type ?? "text/plain", contentPart];
|
|
970
|
-
} else {
|
|
971
|
-
return [
|
|
972
|
-
"text/plain",
|
|
973
|
-
new Blob([contentPart], { type: "text/plain" })
|
|
974
|
-
];
|
|
975
|
-
}
|
|
976
|
-
})
|
|
977
|
-
)
|
|
978
|
-
)
|
|
981
|
+
new ClipboardItem(Object.fromEntries(mimeTypeMap))
|
|
979
982
|
]);
|
|
980
983
|
return true;
|
|
981
984
|
} else if (content instanceof Blob) {
|
|
@@ -1093,57 +1096,14 @@ var removeNestedElements = (elements) => {
|
|
|
1093
1096
|
);
|
|
1094
1097
|
});
|
|
1095
1098
|
};
|
|
1096
|
-
var findBestParentElement = (elements, dragRect, isValidGrabbableElement2) => {
|
|
1097
|
-
if (elements.length <= 1) return null;
|
|
1098
|
-
const dragLeft = dragRect.x;
|
|
1099
|
-
const dragTop = dragRect.y;
|
|
1100
|
-
const dragRight = dragRect.x + dragRect.width;
|
|
1101
|
-
const dragBottom = dragRect.y + dragRect.height;
|
|
1102
|
-
let currentParent = elements[0];
|
|
1103
|
-
while (currentParent) {
|
|
1104
|
-
const parent = currentParent.parentElement;
|
|
1105
|
-
if (!parent) break;
|
|
1106
|
-
const parentRect = parent.getBoundingClientRect();
|
|
1107
|
-
const intersectionLeft = Math.max(dragLeft, parentRect.left);
|
|
1108
|
-
const intersectionTop = Math.max(dragTop, parentRect.top);
|
|
1109
|
-
const intersectionRight = Math.min(dragRight, parentRect.left + parentRect.width);
|
|
1110
|
-
const intersectionBottom = Math.min(dragBottom, parentRect.top + parentRect.height);
|
|
1111
|
-
const intersectionWidth = Math.max(0, intersectionRight - intersectionLeft);
|
|
1112
|
-
const intersectionHeight = Math.max(0, intersectionBottom - intersectionTop);
|
|
1113
|
-
const intersectionArea = intersectionWidth * intersectionHeight;
|
|
1114
|
-
const parentArea = Math.max(0, parentRect.width * parentRect.height);
|
|
1115
|
-
const hasMajorityCoverage = parentArea > 0 && intersectionArea / parentArea >= DRAG_COVERAGE_THRESHOLD;
|
|
1116
|
-
if (!hasMajorityCoverage) break;
|
|
1117
|
-
if (!isValidGrabbableElement2(parent)) {
|
|
1118
|
-
currentParent = parent;
|
|
1119
|
-
continue;
|
|
1120
|
-
}
|
|
1121
|
-
const allChildrenInParent = elements.every(
|
|
1122
|
-
(element) => parent.contains(element)
|
|
1123
|
-
);
|
|
1124
|
-
if (allChildrenInParent) {
|
|
1125
|
-
return parent;
|
|
1126
|
-
}
|
|
1127
|
-
currentParent = parent;
|
|
1128
|
-
}
|
|
1129
|
-
return null;
|
|
1130
|
-
};
|
|
1131
1099
|
var getElementsInDrag = (dragRect, isValidGrabbableElement2) => {
|
|
1132
1100
|
const elements = filterElementsInDrag(dragRect, isValidGrabbableElement2, true);
|
|
1133
1101
|
const uniqueElements = removeNestedElements(elements);
|
|
1134
|
-
const bestParent = findBestParentElement(uniqueElements, dragRect, isValidGrabbableElement2);
|
|
1135
|
-
if (bestParent) {
|
|
1136
|
-
return [bestParent];
|
|
1137
|
-
}
|
|
1138
1102
|
return uniqueElements;
|
|
1139
1103
|
};
|
|
1140
1104
|
var getElementsInDragLoose = (dragRect, isValidGrabbableElement2) => {
|
|
1141
1105
|
const elements = filterElementsInDrag(dragRect, isValidGrabbableElement2, false);
|
|
1142
1106
|
const uniqueElements = removeNestedElements(elements);
|
|
1143
|
-
const bestParent = findBestParentElement(uniqueElements, dragRect, isValidGrabbableElement2);
|
|
1144
|
-
if (bestParent) {
|
|
1145
|
-
return [bestParent];
|
|
1146
|
-
}
|
|
1147
1107
|
return uniqueElements;
|
|
1148
1108
|
};
|
|
1149
1109
|
|
|
@@ -1163,7 +1123,6 @@ var createElementBounds = (element) => {
|
|
|
1163
1123
|
|
|
1164
1124
|
// src/core.tsx
|
|
1165
1125
|
var PROGRESS_INDICATOR_DELAY_MS = 150;
|
|
1166
|
-
var QUICK_REPRESS_THRESHOLD_MS = 150;
|
|
1167
1126
|
var init = (rawOptions) => {
|
|
1168
1127
|
const options = {
|
|
1169
1128
|
enabled: true,
|
|
@@ -1171,7 +1130,17 @@ var init = (rawOptions) => {
|
|
|
1171
1130
|
...rawOptions
|
|
1172
1131
|
};
|
|
1173
1132
|
if (options.enabled === false) {
|
|
1174
|
-
return
|
|
1133
|
+
return {
|
|
1134
|
+
activate: () => {
|
|
1135
|
+
},
|
|
1136
|
+
deactivate: () => {
|
|
1137
|
+
},
|
|
1138
|
+
toggle: () => {
|
|
1139
|
+
},
|
|
1140
|
+
isActive: () => false,
|
|
1141
|
+
dispose: () => {
|
|
1142
|
+
}
|
|
1143
|
+
};
|
|
1175
1144
|
}
|
|
1176
1145
|
return solidJs.createRoot((dispose) => {
|
|
1177
1146
|
const OFFSCREEN_POSITION = -1e3;
|
|
@@ -1190,14 +1159,12 @@ var init = (rawOptions) => {
|
|
|
1190
1159
|
const [isActivated, setIsActivated] = solidJs.createSignal(false);
|
|
1191
1160
|
const [showProgressIndicator, setShowProgressIndicator] = solidJs.createSignal(false);
|
|
1192
1161
|
const [didJustDrag, setDidJustDrag] = solidJs.createSignal(false);
|
|
1193
|
-
const [isModifierHeld, setIsModifierHeld] = solidJs.createSignal(false);
|
|
1194
1162
|
const [copyStartX, setCopyStartX] = solidJs.createSignal(OFFSCREEN_POSITION);
|
|
1195
1163
|
const [copyStartY, setCopyStartY] = solidJs.createSignal(OFFSCREEN_POSITION);
|
|
1196
1164
|
let holdTimerId = null;
|
|
1197
1165
|
let progressAnimationId = null;
|
|
1198
1166
|
let progressDelayTimerId = null;
|
|
1199
1167
|
let keydownSpamTimerId = null;
|
|
1200
|
-
let lastDeactivationTime = null;
|
|
1201
1168
|
const isRendererActive = solidJs.createMemo(() => isActivated() && !isCopying());
|
|
1202
1169
|
const hasValidMousePosition = solidJs.createMemo(() => mouseX() > OFFSCREEN_POSITION && mouseY() > OFFSCREEN_POSITION);
|
|
1203
1170
|
const isTargetKeyCombination = (event) => (event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "c";
|
|
@@ -1259,6 +1226,19 @@ ${context}
|
|
|
1259
1226
|
});
|
|
1260
1227
|
};
|
|
1261
1228
|
const extractElementTagName = (element) => (element.tagName || "").toLowerCase();
|
|
1229
|
+
const notifyElementsSelected = (elements) => {
|
|
1230
|
+
try {
|
|
1231
|
+
const elementsPayload = elements.map((element) => ({
|
|
1232
|
+
tagName: extractElementTagName(element)
|
|
1233
|
+
}));
|
|
1234
|
+
window.dispatchEvent(new CustomEvent("react-grab:element-selected", {
|
|
1235
|
+
detail: {
|
|
1236
|
+
elements: elementsPayload
|
|
1237
|
+
}
|
|
1238
|
+
}));
|
|
1239
|
+
} catch {
|
|
1240
|
+
}
|
|
1241
|
+
};
|
|
1262
1242
|
const executeCopyOperation = async (positionX, positionY, operation) => {
|
|
1263
1243
|
setCopyStartX(positionX);
|
|
1264
1244
|
setCopyStartY(positionY);
|
|
@@ -1278,21 +1258,11 @@ ${context}
|
|
|
1278
1258
|
content,
|
|
1279
1259
|
computedStyles: extractRelevantComputedStyles(targetElement2)
|
|
1280
1260
|
}]);
|
|
1281
|
-
|
|
1282
|
-
try {
|
|
1283
|
-
const screenshotDataUrl = await modernScreenshot.domToPng(targetElement2);
|
|
1284
|
-
const response = await fetch(screenshotDataUrl);
|
|
1285
|
-
const pngBlob = await response.blob();
|
|
1286
|
-
const imagePngBlob = new Blob([pngBlob], {
|
|
1287
|
-
type: "image/png"
|
|
1288
|
-
});
|
|
1289
|
-
clipboardData.push(imagePngBlob);
|
|
1290
|
-
} catch {
|
|
1291
|
-
}
|
|
1292
|
-
await copyContent(clipboardData);
|
|
1261
|
+
await copyContent([plainTextContent, htmlContent]);
|
|
1293
1262
|
} catch {
|
|
1294
1263
|
}
|
|
1295
1264
|
showTemporarySuccessLabel(tagName ? `<${tagName}>` : "<element>", copyStartX(), copyStartY());
|
|
1265
|
+
notifyElementsSelected([targetElement2]);
|
|
1296
1266
|
};
|
|
1297
1267
|
const copyMultipleElementsToClipboard = async (targetElements) => {
|
|
1298
1268
|
if (targetElements.length === 0) return;
|
|
@@ -1301,31 +1271,18 @@ ${context}
|
|
|
1301
1271
|
}
|
|
1302
1272
|
try {
|
|
1303
1273
|
const elementSnippets = await Promise.all(targetElements.map((element) => getHTMLSnippet(element)));
|
|
1304
|
-
const
|
|
1305
|
-
const plainTextContent = wrapInSelectedElementTags(combinedContent);
|
|
1274
|
+
const plainTextContent = elementSnippets.filter((snippet) => snippet.trim()).map((snippet) => wrapInSelectedElementTags(snippet)).join("\n\n");
|
|
1306
1275
|
const structuredElements = elementSnippets.map((content, index) => ({
|
|
1307
1276
|
tagName: extractElementTagName(targetElements[index]),
|
|
1308
1277
|
content,
|
|
1309
1278
|
computedStyles: extractRelevantComputedStyles(targetElements[index])
|
|
1310
1279
|
}));
|
|
1311
1280
|
const htmlContent = createStructuredClipboardHtmlBlob(structuredElements);
|
|
1312
|
-
|
|
1313
|
-
if (targetElements.length > 0) {
|
|
1314
|
-
try {
|
|
1315
|
-
const screenshotDataUrl = await modernScreenshot.domToPng(targetElements[0]);
|
|
1316
|
-
const response = await fetch(screenshotDataUrl);
|
|
1317
|
-
const pngBlob = await response.blob();
|
|
1318
|
-
const imagePngBlob = new Blob([pngBlob], {
|
|
1319
|
-
type: "image/png"
|
|
1320
|
-
});
|
|
1321
|
-
clipboardData.push(imagePngBlob);
|
|
1322
|
-
} catch {
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
await copyContent(clipboardData);
|
|
1281
|
+
await copyContent([plainTextContent, htmlContent]);
|
|
1326
1282
|
} catch {
|
|
1327
1283
|
}
|
|
1328
1284
|
showTemporarySuccessLabel(`${targetElements.length} elements`, copyStartX(), copyStartY());
|
|
1285
|
+
notifyElementsSelected(targetElements);
|
|
1329
1286
|
};
|
|
1330
1287
|
const targetElement = solidJs.createMemo(() => {
|
|
1331
1288
|
if (!isRendererActive() || isDragging()) return null;
|
|
@@ -1437,12 +1394,9 @@ ${context}
|
|
|
1437
1394
|
setIsActivated(true);
|
|
1438
1395
|
document.body.style.cursor = "crosshair";
|
|
1439
1396
|
};
|
|
1440
|
-
const deactivateRenderer = (
|
|
1397
|
+
const deactivateRenderer = () => {
|
|
1441
1398
|
setIsHoldingKeys(false);
|
|
1442
1399
|
setIsActivated(false);
|
|
1443
|
-
if (shouldResetModifier) {
|
|
1444
|
-
setIsModifierHeld(false);
|
|
1445
|
-
}
|
|
1446
1400
|
document.body.style.cursor = "";
|
|
1447
1401
|
if (isDragging()) {
|
|
1448
1402
|
setIsDragging(false);
|
|
@@ -1451,60 +1405,46 @@ ${context}
|
|
|
1451
1405
|
if (holdTimerId) window.clearTimeout(holdTimerId);
|
|
1452
1406
|
if (keydownSpamTimerId) window.clearTimeout(keydownSpamTimerId);
|
|
1453
1407
|
stopProgressAnimation();
|
|
1454
|
-
lastDeactivationTime = Date.now();
|
|
1455
1408
|
};
|
|
1456
1409
|
const abortController = new AbortController();
|
|
1457
1410
|
const eventListenerSignal = abortController.signal;
|
|
1458
1411
|
window.addEventListener("keydown", (event) => {
|
|
1459
|
-
if (event.metaKey || event.ctrlKey) {
|
|
1460
|
-
setIsModifierHeld(true);
|
|
1461
|
-
}
|
|
1462
1412
|
if (event.key === "Escape" && isHoldingKeys()) {
|
|
1463
1413
|
deactivateRenderer();
|
|
1464
1414
|
return;
|
|
1465
1415
|
}
|
|
1466
1416
|
if (isKeyboardEventTriggeredByInput(event)) return;
|
|
1467
|
-
if (isTargetKeyCombination(event))
|
|
1468
|
-
|
|
1469
|
-
if (
|
|
1470
|
-
|
|
1471
|
-
if (wasRecentlyDeactivated && isModifierHeld()) {
|
|
1472
|
-
activateRenderer();
|
|
1473
|
-
options.onActivate?.();
|
|
1474
|
-
const element = getElementAtPosition(mouseX(), mouseY());
|
|
1475
|
-
if (element) {
|
|
1476
|
-
setLastGrabbedElement(element);
|
|
1477
|
-
void executeCopyOperation(mouseX(), mouseY(), () => copySingleElementToClipboard(element));
|
|
1478
|
-
}
|
|
1479
|
-
} else {
|
|
1480
|
-
startProgressAnimation();
|
|
1481
|
-
holdTimerId = window.setTimeout(() => {
|
|
1482
|
-
activateRenderer();
|
|
1483
|
-
options.onActivate?.();
|
|
1484
|
-
}, options.keyHoldDuration);
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
|
-
if (isActivated()) {
|
|
1488
|
-
if (keydownSpamTimerId) window.clearTimeout(keydownSpamTimerId);
|
|
1489
|
-
keydownSpamTimerId = window.setTimeout(() => {
|
|
1490
|
-
deactivateRenderer();
|
|
1491
|
-
}, 200);
|
|
1417
|
+
if (!isTargetKeyCombination(event)) return;
|
|
1418
|
+
if (isActivated()) {
|
|
1419
|
+
if (keydownSpamTimerId !== null) {
|
|
1420
|
+
window.clearTimeout(keydownSpamTimerId);
|
|
1492
1421
|
}
|
|
1422
|
+
keydownSpamTimerId = window.setTimeout(() => {
|
|
1423
|
+
deactivateRenderer();
|
|
1424
|
+
}, 200);
|
|
1425
|
+
return;
|
|
1493
1426
|
}
|
|
1427
|
+
if (event.repeat) return;
|
|
1428
|
+
if (holdTimerId !== null) {
|
|
1429
|
+
window.clearTimeout(holdTimerId);
|
|
1430
|
+
}
|
|
1431
|
+
if (!isHoldingKeys()) {
|
|
1432
|
+
setIsHoldingKeys(true);
|
|
1433
|
+
}
|
|
1434
|
+
startProgressAnimation();
|
|
1435
|
+
holdTimerId = window.setTimeout(() => {
|
|
1436
|
+
activateRenderer();
|
|
1437
|
+
options.onActivate?.();
|
|
1438
|
+
}, options.keyHoldDuration);
|
|
1494
1439
|
}, {
|
|
1495
1440
|
signal: eventListenerSignal
|
|
1496
1441
|
});
|
|
1497
1442
|
window.addEventListener("keyup", (event) => {
|
|
1443
|
+
if (!isHoldingKeys() && !isActivated()) return;
|
|
1498
1444
|
const isReleasingModifier = !event.metaKey && !event.ctrlKey;
|
|
1499
1445
|
const isReleasingC = event.key.toLowerCase() === "c";
|
|
1500
|
-
if (isReleasingModifier) {
|
|
1501
|
-
|
|
1502
|
-
}
|
|
1503
|
-
if (!isHoldingKeys() && !isActivated()) return;
|
|
1504
|
-
if (isReleasingC) {
|
|
1505
|
-
deactivateRenderer(false);
|
|
1506
|
-
} else if (isReleasingModifier) {
|
|
1507
|
-
deactivateRenderer(true);
|
|
1446
|
+
if (isReleasingC || isReleasingModifier) {
|
|
1447
|
+
deactivateRenderer();
|
|
1508
1448
|
}
|
|
1509
1449
|
}, {
|
|
1510
1450
|
signal: eventListenerSignal,
|
|
@@ -1635,11 +1575,36 @@ ${context}
|
|
|
1635
1575
|
return crosshairVisible();
|
|
1636
1576
|
}
|
|
1637
1577
|
}), rendererRoot);
|
|
1638
|
-
return
|
|
1578
|
+
return {
|
|
1579
|
+
activate: () => {
|
|
1580
|
+
if (!isActivated()) {
|
|
1581
|
+
activateRenderer();
|
|
1582
|
+
options.onActivate?.();
|
|
1583
|
+
}
|
|
1584
|
+
},
|
|
1585
|
+
deactivate: () => {
|
|
1586
|
+
if (isActivated()) {
|
|
1587
|
+
deactivateRenderer();
|
|
1588
|
+
}
|
|
1589
|
+
},
|
|
1590
|
+
toggle: () => {
|
|
1591
|
+
if (isActivated()) {
|
|
1592
|
+
deactivateRenderer();
|
|
1593
|
+
} else {
|
|
1594
|
+
activateRenderer();
|
|
1595
|
+
options.onActivate?.();
|
|
1596
|
+
}
|
|
1597
|
+
},
|
|
1598
|
+
isActive: () => isActivated(),
|
|
1599
|
+
dispose
|
|
1600
|
+
};
|
|
1639
1601
|
});
|
|
1640
1602
|
};
|
|
1641
1603
|
|
|
1642
1604
|
// src/index.ts
|
|
1643
|
-
|
|
1605
|
+
var globalApi = null;
|
|
1606
|
+
var getGlobalApi = () => globalApi;
|
|
1607
|
+
globalApi = init();
|
|
1644
1608
|
|
|
1609
|
+
exports.getGlobalApi = getGlobalApi;
|
|
1645
1610
|
exports.init = init;
|
package/dist/index.d.cts
CHANGED
|
@@ -3,6 +3,13 @@ interface Options {
|
|
|
3
3
|
keyHoldDuration?: number;
|
|
4
4
|
onActivate?: () => void;
|
|
5
5
|
}
|
|
6
|
+
interface ReactGrabAPI {
|
|
7
|
+
activate: () => void;
|
|
8
|
+
deactivate: () => void;
|
|
9
|
+
toggle: () => void;
|
|
10
|
+
isActive: () => boolean;
|
|
11
|
+
dispose: () => void;
|
|
12
|
+
}
|
|
6
13
|
interface OverlayBounds {
|
|
7
14
|
borderRadius: string;
|
|
8
15
|
height: number;
|
|
@@ -40,6 +47,8 @@ interface ReactGrabRendererProps {
|
|
|
40
47
|
crosshairVisible?: boolean;
|
|
41
48
|
}
|
|
42
49
|
|
|
43
|
-
declare const init: (rawOptions?: Options) =>
|
|
50
|
+
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
51
|
+
|
|
52
|
+
declare const getGlobalApi: () => ReactGrabAPI | null;
|
|
44
53
|
|
|
45
|
-
export { type Options, type OverlayBounds, type ReactGrabRendererProps, init };
|
|
54
|
+
export { type Options, type OverlayBounds, type ReactGrabAPI, type ReactGrabRendererProps, getGlobalApi, init };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,13 @@ interface Options {
|
|
|
3
3
|
keyHoldDuration?: number;
|
|
4
4
|
onActivate?: () => void;
|
|
5
5
|
}
|
|
6
|
+
interface ReactGrabAPI {
|
|
7
|
+
activate: () => void;
|
|
8
|
+
deactivate: () => void;
|
|
9
|
+
toggle: () => void;
|
|
10
|
+
isActive: () => boolean;
|
|
11
|
+
dispose: () => void;
|
|
12
|
+
}
|
|
6
13
|
interface OverlayBounds {
|
|
7
14
|
borderRadius: string;
|
|
8
15
|
height: number;
|
|
@@ -40,6 +47,8 @@ interface ReactGrabRendererProps {
|
|
|
40
47
|
crosshairVisible?: boolean;
|
|
41
48
|
}
|
|
42
49
|
|
|
43
|
-
declare const init: (rawOptions?: Options) =>
|
|
50
|
+
declare const init: (rawOptions?: Options) => ReactGrabAPI;
|
|
51
|
+
|
|
52
|
+
declare const getGlobalApi: () => ReactGrabAPI | null;
|
|
44
53
|
|
|
45
|
-
export { type Options, type OverlayBounds, type ReactGrabRendererProps, init };
|
|
54
|
+
export { type Options, type OverlayBounds, type ReactGrabAPI, type ReactGrabRendererProps, getGlobalApi, init };
|
package/dist/index.global.js
CHANGED
|
@@ -6,40 +6,25 @@ var ReactGrab=(function(exports){'use strict';/**
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
var Oo=(e,t)=>e===t;var ko=Symbol("solid-track"),pt={equals:Oo},Vn=Gn,ue=1,Xe=2,Yn={owned:null,cleanups:null,context:null,owner:null};var D=null,C=null,Me=null,U=null,Z=null,te=null,yt=0;function Ie(e,t){let n=U,r=D,o=e.length===0,s=t===void 0?r:t,a=o?Yn:{owned:null,cleanups:null,context:s?s.context:null,owner:s},i=o?e:()=>e(()=>ie(()=>Ne(a)));D=a,U=null;try{return Ce(i,!0)}finally{U=n,D=r;}}function I(e,t){t=t?Object.assign({},pt,t):pt;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},r=o=>(typeof o=="function"&&(o=o(n.value)),zn(n,o));return [qn.bind(n),r]}function ae(e,t,n){let r=zt(e,t,false,ue);Je(r);}function re(e,t,n){Vn=Mo;let r=zt(e,t,false,ue);(r.user=true),te?te.push(r):Je(r);}function Y(e,t,n){n=n?Object.assign({},pt,n):pt;let r=zt(e,t,true,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,Je(r),qn.bind(r)}function ie(e){if(U===null)return e();let t=U;U=null;try{return Me?Me.untrack(e):e()}finally{U=t;}}function Ae(e,t,n){let r=Array.isArray(e),o;return a=>{let i;if(r){i=Array(e.length);for(let u=0;u<e.length;u++)i[u]=e[u]();}else i=e();let l=ie(()=>t(i,o,a));return o=i,l}}function Wn(e){re(()=>ie(e));}function fe(e){return D===null||(D.cleanups===null?D.cleanups=[e]:D.cleanups.push(e)),e}I(false);function qn(){let e=C;if(this.sources&&(this.state))if((this.state)===ue)Je(this);else {let t=Z;Z=null,Ce(()=>bt(this),false),Z=t;}if(U){let t=this.observers?this.observers.length:0;U.sources?(U.sources.push(this),U.sourceSlots.push(t)):(U.sources=[this],U.sourceSlots=[t]),this.observers?(this.observers.push(U),this.observerSlots.push(U.sources.length-1)):(this.observers=[U],this.observerSlots=[U.sources.length-1]);}return e&&C.sources.has(this)?this.tValue:this.value}function zn(e,t,n){let r=e.value;if(!e.comparator||!e.comparator(r,t)){e.value=t;e.observers&&e.observers.length&&Ce(()=>{for(let o=0;o<e.observers.length;o+=1){let s=e.observers[o],a=C&&C.running;a&&C.disposed.has(s)||((a?!s.tState:!s.state)&&(s.pure?Z.push(s):te.push(s),s.observers&&Xn(s)),a?s.tState=ue:s.state=ue);}if(Z.length>1e6)throw Z=[],new Error},false);}return t}function Je(e){if(!e.fn)return;Ne(e);let t=yt;Bn(e,e.value,t);}function Bn(e,t,n){let r,o=D,s=U;U=D=e;try{r=e.fn(t);}catch(a){return e.pure&&((e.state=ue,e.owned&&e.owned.forEach(Ne),e.owned=null)),e.updatedAt=n+1,Gt(a)}finally{U=s,D=o;}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?zn(e,r):e.value=r,e.updatedAt=n);}function zt(e,t,n,r=ue,o){let s={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:D,context:D?D.context:null,pure:n};if(D===null||D!==Yn&&(D.owned?D.owned.push(s):D.owned=[s]),Me);return s}function Ke(e){let t=C;if((e.state)===0)return;if((e.state)===Xe)return bt(e);if(e.suspense&&ie(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<yt);){(e.state)&&n.push(e);}for(let r=n.length-1;r>=0;r--){if(e=n[r],t);if((e.state)===ue)Je(e);else if((e.state)===Xe){let o=Z;Z=null,Ce(()=>bt(e,n[0]),false),Z=o;}}}function Ce(e,t){if(Z)return e();let n=false;t||(Z=[]),te?n=true:te=[],yt++;try{let r=e();return Po(n),r}catch(r){n||(te=null),Z=null,Gt(r);}}function Po(e){if(Z&&(Gn(Z),Z=null),e)return;let n=te;te=null,n.length&&Ce(()=>Vn(n),false);}function Gn(e){for(let t=0;t<e.length;t++)Ke(e[t]);}function Mo(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:Ke(r);}for(t=0;t<n;t++)Ke(e[t]);}function bt(e,t){e.state=0;for(let r=0;r<e.sources.length;r+=1){let o=e.sources[r];if(o.sources){let s=o.state;s===ue?o!==t&&(!o.updatedAt||o.updatedAt<yt)&&Ke(o):s===Xe&&bt(o,t);}}}function Xn(e){for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(!r.state)&&(r.state=Xe,r.pure?Z.push(r):te.push(r),r.observers&&Xn(r));}}function Ne(e){let t;if(e.sources)for(;e.sources.length;){let n=e.sources.pop(),r=e.sourceSlots.pop(),o=n.observers;if(o&&o.length){let s=o.pop(),a=n.observerSlots.pop();r<o.length&&(s.sourceSlots[a]=r,o[r]=s,n.observerSlots[r]=a);}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)Ne(e.tOwned[t]);delete e.tOwned;}if(e.owned){for(t=e.owned.length-1;t>=0;t--)Ne(e.owned[t]);e.owned=null;}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null;}e.state=0;}function Lo(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function Gt(e,t=D){let r=Lo(e);throw r;}var Ho=Symbol("fallback");function Un(e){for(let t=0;t<e.length;t++)e[t]();}function Bo(e,t,n={}){let r=[],o=[],s=[],a=0,i=t.length>1?[]:null;return fe(()=>Un(s)),()=>{let l=e()||[],u=l.length,c,d;return l[ko],ie(()=>{let p,S,h,T,y,R,v,N,_;if(u===0)a!==0&&(Un(s),s=[],r=[],o=[],a=0,i&&(i=[])),n.fallback&&(r=[Ho],o[0]=Ie(O=>(s[0]=O,n.fallback())),a=1);else if(a===0){for(o=new Array(u),d=0;d<u;d++)r[d]=l[d],o[d]=Ie(g);a=u;}else {for(h=new Array(u),T=new Array(u),i&&(y=new Array(u)),R=0,v=Math.min(a,u);R<v&&r[R]===l[R];R++);for(v=a-1,N=u-1;v>=R&&N>=R&&r[v]===l[N];v--,N--)h[N]=o[v],T[N]=s[v],i&&(y[N]=i[v]);for(p=new Map,S=new Array(N+1),d=N;d>=R;d--)_=l[d],c=p.get(_),S[d]=c===void 0?-1:c,p.set(_,d);for(c=R;c<=v;c++)_=r[c],d=p.get(_),d!==void 0&&d!==-1?(h[d]=o[c],T[d]=s[c],i&&(y[d]=i[c]),d=S[d],p.set(_,d)):s[c]();for(d=R;d<u;d++)d in h?(o[d]=h[d],s[d]=T[d],i&&(i[d]=y[d],i[d](d))):o[d]=Ie(g);o=o.slice(0,a=u),r=l.slice(0);}return o});function g(p){if(s[d]=p,i){let[S,h]=I(d);return i[d]=h,t(l[d],S)}return t(l[d])}}}function P(e,t){return ie(()=>e(t||{}))}var Uo=e=>`Stale read from <${e}>.`;function wt(e){let t="fallback"in e&&{fallback:()=>e.fallback};return Y(Bo(()=>e.each,e.children,t||void 0))}function q(e){let t=e.keyed,n=Y(()=>e.when,void 0,void 0),r=t?n:Y(n,void 0,{equals:(o,s)=>!o==!s});return Y(()=>{let o=r();if(o){let s=e.children;return typeof s=="function"&&s.length>0?ie(()=>s(t?o:()=>{if(!ie(r))throw Uo("Show");return n()})):s}return e.fallback},void 0,void 0)}var He=e=>Y(()=>e());function Wo(e,t,n){let r=n.length,o=t.length,s=r,a=0,i=0,l=t[o-1].nextSibling,u=null;for(;a<o||i<s;){if(t[a]===n[i]){a++,i++;continue}for(;t[o-1]===n[s-1];)o--,s--;if(o===a){let c=s<r?i?n[i-1].nextSibling:n[s-i]:l;for(;i<s;)e.insertBefore(n[i++],c);}else if(s===i)for(;a<o;)(!u||!u.has(t[a]))&&t[a].remove(),a++;else if(t[a]===n[s-1]&&n[i]===t[o-1]){let c=t[--o].nextSibling;e.insertBefore(n[i++],t[a++].nextSibling),e.insertBefore(n[--s],c),t[o]=n[s];}else {if(!u){u=new Map;let d=i;for(;d<s;)u.set(n[d],d++);}let c=u.get(t[a]);if(c!=null)if(i<c&&c<s){let d=a,g=1,p;for(;++d<o&&d<s&&!((p=u.get(t[d]))==null||p!==c+g);)g++;if(g>c-i){let S=t[a];for(;i<c;)e.insertBefore(n[i++],S);}else e.replaceChild(n[i++],t[a++]);}else a++;else t[a++].remove();}}}function Jn(e,t,n,r={}){let o;return Ie(s=>{o=s,t===document?e():Te(t,e(),t.firstChild?null:void 0,n);},r.owner),()=>{o(),t.textContent="";}}function oe(e,t,n,r){let o,s=()=>{let i=document.createElement("template");return i.innerHTML=e,i.content.firstChild},a=()=>(o||(o=s())).cloneNode(true);return a.cloneNode=a,a}function qo(e,t,n){(e.removeAttribute(t));}function Ct(e,t,n){if(!t)return n?qo(e,"style"):t;let r=e.style;if(typeof t=="string")return r.cssText=t;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),t||(t={});let o,s;for(s in n)t[s]==null&&r.removeProperty(s),delete n[s];for(s in t)o=t[s],o!==n[s]&&(r.setProperty(s,o),n[s]=o);return n}function be(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t);}function _e(e,t,n){return ie(()=>e(t,n))}function Te(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return St(e,t,r,n);ae(o=>St(e,t(),o,n),r);}function St(e,t,n,r,o){for(;typeof n=="function";)n=n();if(t===n)return n;let a=typeof t,i=r!==void 0;if(e=i&&n[0]&&n[0].parentNode||e,a==="string"||a==="number"){if(a==="number"&&(t=t.toString(),t===n))return n;if(i){let l=n[0];l&&l.nodeType===3?l.data!==t&&(l.data=t):l=document.createTextNode(t),n=Le(e,n,r,l);}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t;}else if(t==null||a==="boolean"){n=Le(e,n,r);}else {if(a==="function")return ae(()=>{let l=t();for(;typeof l=="function";)l=l();n=St(e,l,n,r);}),()=>n;if(Array.isArray(t)){let l=[],u=n&&Array.isArray(n);if(Xt(l,t,n,o))return ae(()=>n=St(e,l,n,r,true)),()=>n;if(l.length===0){if(n=Le(e,n,r),i)return n}else u?n.length===0?Zn(e,l,r):Wo(e,n,l):(n&&Le(e),Zn(e,l));n=l;}else if(t.nodeType){if(Array.isArray(n)){if(i)return n=Le(e,n,r,t);Le(e,n,null,t);}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t;}}return n}function Xt(e,t,n,r){let o=false;for(let s=0,a=t.length;s<a;s++){let i=t[s],l=n&&n[e.length],u;if(!(i==null||i===true||i===false))if((u=typeof i)=="object"&&i.nodeType)e.push(i);else if(Array.isArray(i))o=Xt(e,i,l)||o;else if(u==="function")if(r){for(;typeof i=="function";)i=i();o=Xt(e,Array.isArray(i)?i:[i],Array.isArray(l)?l:[l])||o;}else e.push(i),o=true;else {let c=String(i);l&&l.nodeType===3&&l.data===c?e.push(l):e.push(document.createTextNode(c));}}return o}function Zn(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n);}function Le(e,t,n,r){if(n===void 0)return e.textContent="";let o=r||document.createTextNode("");if(t.length){let s=false;for(let a=t.length-1;a>=0;a--){let i=t[a];if(o!==i){let l=i.parentNode===e;!s&&!a?l?e.replaceChild(o,i):e.insertBefore(o,n):l&&i.remove();}else s=true;}}else e.insertBefore(o,n);return [o]}function zo(e,t){return e[13]=1,e[14]=t>>8,e[15]=t&255,e[16]=t>>8,e[17]=t&255,e}var ir=112,ar=72,lr=89,cr=115,Kt;function Go(){let e=new Int32Array(256);for(let t=0;t<256;t++){let n=t;for(let r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n;}return e}function Xo(e){let t=-1;Kt||(Kt=Go());for(let n=0;n<e.length;n++)t=Kt[(t^e[n])&255]^t>>>8;return t^-1}function Ko(e){let t=e.length-1;for(let n=t;n>=4;n--)if(e[n-4]===9&&e[n-3]===ir&&e[n-2]===ar&&e[n-1]===lr&&e[n]===cr)return n-3;return 0}function Zo(e,t,n=false){let r=new Uint8Array(13);t*=39.3701,r[0]=ir,r[1]=ar,r[2]=lr,r[3]=cr,r[4]=t>>>24,r[5]=t>>>16,r[6]=t>>>8,r[7]=t&255,r[8]=r[4],r[9]=r[5],r[10]=r[6],r[11]=r[7],r[12]=1;let o=Xo(r),s=new Uint8Array(4);if(s[0]=o>>>24,s[1]=o>>>16,s[2]=o>>>8,s[3]=o&255,n){let a=Ko(e);return e.set(r,a),e.set(s,a+13),e}else {let a=new Uint8Array(4);a[0]=0,a[1]=0,a[2]=0,a[3]=9;let i=new Uint8Array(54);return i.set(e,0),i.set(a,33),i.set(r,37),i.set(s,50),i}}var Jo="AAlwSFlz",Qo="AAAJcEhZ",es="AAAACXBI";function ts(e){let t=e.indexOf(Jo);return t===-1&&(t=e.indexOf(Qo)),t===-1&&(t=e.indexOf(es)),t}var ur="[modern-screenshot]",Fe=typeof window<"u",ns=Fe&&"Worker"in window,rs=Fe&&"atob"in window,os=Fe&&"btoa"in window,Jt=Fe?window.navigator?.userAgent:"",fr=Jt.includes("Chrome"),Tt=Jt.includes("AppleWebKit")&&!fr,Qt=Jt.includes("Firefox"),ss=e=>e&&"__CONTEXT__"in e,is=e=>e.constructor.name==="CSSFontFaceRule",as=e=>e.constructor.name==="CSSImportRule",ye=e=>e.nodeType===1,nt=e=>typeof e.className=="object",dr=e=>e.tagName==="image",ls=e=>e.tagName==="use",Qe=e=>ye(e)&&typeof e.style<"u"&&!nt(e),cs=e=>e.nodeType===8,us=e=>e.nodeType===3,je=e=>e.tagName==="IMG",Et=e=>e.tagName==="VIDEO",fs=e=>e.tagName==="CANVAS",ds=e=>e.tagName==="TEXTAREA",ms=e=>e.tagName==="INPUT",gs=e=>e.tagName==="STYLE",hs=e=>e.tagName==="SCRIPT",ps=e=>e.tagName==="SELECT",bs=e=>e.tagName==="SLOT",ys=e=>e.tagName==="IFRAME",ws=(...e)=>console.warn(ur,...e);function Ss(e){let t=e?.createElement?.("canvas");return t&&(t.height=t.width=1),!!t&&"toDataURL"in t&&!!t.toDataURL("image/webp").includes("image/webp")}var Zt=e=>e.startsWith("data:");function mr(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(Fe&&e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i)||!Fe)return e;let n=vt().implementation.createHTMLDocument(),r=n.createElement("base"),o=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(o),t&&(r.href=t),o.href=e,o.href}function vt(e){return (e&&ye(e)?e?.ownerDocument:e)??window.document}var xt="http://www.w3.org/2000/svg";function Cs(e,t,n){let r=vt(n).createElementNS(xt,"svg");return r.setAttributeNS(null,"width",e.toString()),r.setAttributeNS(null,"height",t.toString()),r.setAttributeNS(null,"viewBox",`0 0 ${e} ${t}`),r}function Ts(e,t){let n=new XMLSerializer().serializeToString(e);return t&&(n=n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,"")),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}function Es(e,t){return new Promise((n,r)=>{let o=new FileReader;o.onload=()=>n(o.result),o.onerror=()=>r(o.error),o.onabort=()=>r(new Error(`Failed read blob to ${t}`)),o.readAsDataURL(e);})}var vs=e=>Es(e,"dataUrl");function Be(e,t){let n=vt(t).createElement("img");return n.decoding="sync",n.loading="eager",n.src=e,n}function et(e,t){return new Promise(n=>{let{timeout:r,ownerDocument:o,onError:s,onWarn:a}=t??{},i=typeof e=="string"?Be(e,vt(o)):e,l=null,u=null;function c(){n(i),l&&clearTimeout(l),u?.();}if(r&&(l=setTimeout(c,r)),Et(i)){let d=i.currentSrc||i.src;if(!d)return i.poster?et(i.poster,t).then(n):c();if(i.readyState>=2)return c();let g=c,p=S=>{a?.("Failed video load",d,S),s?.(S),c();};u=()=>{i.removeEventListener("loadeddata",g),i.removeEventListener("error",p);},i.addEventListener("loadeddata",g,{once:true}),i.addEventListener("error",p,{once:true});}else {let d=dr(i)?i.href.baseVal:i.currentSrc||i.src;if(!d)return c();let g=async()=>{if(je(i)&&"decode"in i)try{await i.decode();}catch(S){a?.("Failed to decode image, trying to render anyway",i.dataset.originalSrc||d,S);}c();},p=S=>{a?.("Failed image load",i.dataset.originalSrc||d,S),c();};if(je(i)&&i.complete)return g();u=()=>{i.removeEventListener("load",g),i.removeEventListener("error",p);},i.addEventListener("load",g,{once:true}),i.addEventListener("error",p,{once:true});}})}async function xs(e,t){Qe(e)&&(je(e)||Et(e)?await et(e,t):await Promise.all(["img","video"].flatMap(n=>Array.from(e.querySelectorAll(n)).map(r=>et(r,t)))));}var gr=function(){let t=0,n=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return ()=>(t+=1,`u${n()}${t}`)}();function hr(e){return e?.split(",").map(t=>t.trim().replace(/"|'/g,"").toLowerCase()).filter(Boolean)}var er=0;function Rs(e){let t=`${ur}[#${er}]`;return er++,{time:n=>e&&console.time(`${t} ${n}`),timeEnd:n=>e&&console.timeEnd(`${t} ${n}`),warn:(...n)=>e&&ws(...n)}}function Ns(e){return {cache:e?"no-cache":"force-cache"}}async function Rt(e,t){return ss(e)?e:As(e,{...t,autoDestruct:true})}async function As(e,t){let{scale:n=1,workerUrl:r,workerNumber:o=1}=t||{},s=!!t?.debug,a=t?.features??true,i=e.ownerDocument??(Fe?window.document:void 0),l=e.ownerDocument?.defaultView??(Fe?window:void 0),u=new Map,c={width:0,height:0,quality:1,type:"image/png",scale:n,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:s,fetch:{requestInit:Ns(t?.fetch?.bypassingCache),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:false,...t?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:o,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:false,...t,__CONTEXT__:true,log:Rs(s),node:e,ownerDocument:i,ownerWindow:l,dpi:n===1?null:96*n,svgStyleElement:pr(i),svgDefsElement:i?.createElementNS(xt,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:ns&&r&&o?o:0})].map(()=>{try{let p=new Worker(r);return p.onmessage=async S=>{let{url:h,result:T}=S.data;T?u.get(h)?.resolve?.(T):u.get(h)?.reject?.(new Error(`Error receiving message from worker: ${h}`));},p.onmessageerror=S=>{let{url:h}=S.data;u.get(h)?.reject?.(new Error(`Error receiving message from worker: ${h}`));},p}catch(p){return c.log.warn("Failed to new Worker",p),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[Ss(i)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:u,drawImageCount:0,tasks:[],features:a,isEnable:p=>p==="restoreScrollPosition"?typeof a=="boolean"?false:a[p]??false:typeof a=="boolean"?a:a[p]??true,shadowRoots:[]};c.log.time("wait until load"),await xs(e,{timeout:c.timeout,onWarn:c.log.warn}),c.log.timeEnd("wait until load");let{width:d,height:g}=_s(e,c);return c.width=d,c.height=g,c}function pr(e){if(!e)return;let t=e.createElement("style"),n=t.ownerDocument.createTextNode(`
|
|
10
|
-
.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
`);return t.appendChild(n),t}function _s(e,t){let{width:n,height:r}=t;if(ye(e)&&(!n||!r)){let o=e.getBoundingClientRect();n=n||o.width||Number(e.getAttribute("width"))||0,r=r||o.height||Number(e.getAttribute("height"))||0;}return {width:n,height:r}}async function Fs(e,t){let{log:n,timeout:r,drawImageCount:o,drawImageInterval:s}=t;n.time("image to canvas");let a=await et(e,{timeout:r,onWarn:t.log.warn}),{canvas:i,context2d:l}=Os(e.ownerDocument,t),u=()=>{try{l?.drawImage(a,0,0,i.width,i.height);}catch(c){t.log.warn("Failed to drawImage",c);}};if(u(),t.isEnable("fixSvgXmlDecode"))for(let c=0;c<o;c++)await new Promise(d=>{setTimeout(()=>{l?.clearRect(0,0,i.width,i.height),u(),d();},c+s);});return t.drawImageCount=0,n.timeEnd("image to canvas"),i}function Os(e,t){let{width:n,height:r,scale:o,backgroundColor:s,maximumCanvasSize:a}=t,i=e.createElement("canvas");i.width=Math.floor(n*o),i.height=Math.floor(r*o),i.style.width=`${n}px`,i.style.height=`${r}px`,a&&(i.width>a||i.height>a)&&(i.width>a&&i.height>a?i.width>i.height?(i.height*=a/i.width,i.width=a):(i.width*=a/i.height,i.height=a):i.width>a?(i.height*=a/i.width,i.width=a):(i.width*=a/i.height,i.height=a));let l=i.getContext("2d");return l&&s&&(l.fillStyle=s,l.fillRect(0,0,i.width,i.height)),{canvas:i,context2d:l}}function br(e,t){if(e.ownerDocument)try{let s=e.toDataURL();if(s!=="data:,")return Be(s,e.ownerDocument)}catch(s){t.log.warn("Failed to clone canvas",s);}let n=e.cloneNode(false),r=e.getContext("2d"),o=n.getContext("2d");try{return r&&o&&o.putImageData(r.getImageData(0,0,e.width,e.height),0,0),n}catch(s){t.log.warn("Failed to clone canvas",s);}return n}function ks(e,t){try{if(e?.contentDocument?.body)return en(e.contentDocument.body,t)}catch(n){t.log.warn("Failed to clone iframe",n);}return e.cloneNode(false)}function Is(e){let t=e.cloneNode(false);return e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager"),t}async function $s(e,t){if(e.ownerDocument&&!e.currentSrc&&e.poster)return Be(e.poster,e.ownerDocument);let n=e.cloneNode(false);n.crossOrigin="anonymous",e.currentSrc&&e.currentSrc!==e.src&&(n.src=e.currentSrc);let r=n.ownerDocument;if(r){let o=true;if(await et(n,{onError:()=>o=false,onWarn:t.log.warn}),!o)return e.poster?Be(e.poster,e.ownerDocument):n;n.currentTime=e.currentTime,await new Promise(a=>{n.addEventListener("seeked",a,{once:true});});let s=r.createElement("canvas");s.width=e.offsetWidth,s.height=e.offsetHeight;try{let a=s.getContext("2d");a&&a.drawImage(n,0,0,s.width,s.height);}catch(a){return t.log.warn("Failed to clone video",a),e.poster?Be(e.poster,e.ownerDocument):n}return br(s,t)}return n}function Ps(e,t){return fs(e)?br(e,t):ys(e)?ks(e,t):je(e)?Is(e):Et(e)?$s(e,t):e.cloneNode(false)}function Ds(e){let t=e.sandbox;if(!t){let{ownerDocument:n}=e;try{n&&(t=n.createElement("iframe"),t.id=`__SANDBOX__${gr()}`,t.width="0",t.height="0",t.style.visibility="hidden",t.style.position="fixed",n.body.appendChild(t),t.srcdoc='<!DOCTYPE html><meta charset="UTF-8"><title></title><body>',e.sandbox=t);}catch(r){e.log.warn("Failed to getSandBox",r);}}return t}var Ms=["width","height","-webkit-text-fill-color"],Ls=["stroke","fill"];function yr(e,t,n){let{defaultComputedStyles:r}=n,o=e.nodeName.toLowerCase(),s=nt(e)&&o!=="svg",a=s?Ls.map(h=>[h,e.getAttribute(h)]).filter(([,h])=>h!==null):[],i=[s&&"svg",o,a.map((h,T)=>`${h}=${T}`).join(","),t].filter(Boolean).join(":");if(r.has(i))return r.get(i);let u=Ds(n)?.contentWindow;if(!u)return new Map;let c=u?.document,d,g;s?(d=c.createElementNS(xt,"svg"),g=d.ownerDocument.createElementNS(d.namespaceURI,o),a.forEach(([h,T])=>{g.setAttributeNS(null,h,T);}),d.appendChild(g)):d=g=c.createElement(o),g.textContent=" ",c.body.appendChild(d);let p=u.getComputedStyle(g,t),S=new Map;for(let h=p.length,T=0;T<h;T++){let y=p.item(T);Ms.includes(y)||S.set(y,p.getPropertyValue(y));}return c.body.removeChild(d),r.set(i,S),S}function wr(e,t,n){let r=new Map,o=[],s=new Map;if(n)for(let i of n)a(i);else for(let i=e.length,l=0;l<i;l++){let u=e.item(l);a(u);}for(let i=o.length,l=0;l<i;l++)s.get(o[l])?.forEach((u,c)=>r.set(c,u));function a(i){let l=e.getPropertyValue(i),u=e.getPropertyPriority(i),c=i.lastIndexOf("-"),d=c>-1?i.substring(0,c):void 0;if(d){let g=s.get(d);g||(g=new Map,s.set(d,g)),g.set(i,[l,u]);}t.get(i)===l&&!u||(d?o.push(d):r.set(i,[l,u]));}return r}function Hs(e,t,n,r){let{ownerWindow:o,includeStyleProperties:s,currentParentNodeStyle:a}=r,i=t.style,l=o.getComputedStyle(e),u=yr(e,null,r);a?.forEach((d,g)=>{u.delete(g);});let c=wr(l,u,s);c.delete("transition-property"),c.delete("all"),c.delete("d"),c.delete("content"),n&&(c.delete("margin-top"),c.delete("margin-right"),c.delete("margin-bottom"),c.delete("margin-left"),c.delete("margin-block-start"),c.delete("margin-block-end"),c.delete("margin-inline-start"),c.delete("margin-inline-end"),c.set("box-sizing",["border-box",""])),c.get("background-clip")?.[0]==="text"&&t.classList.add("______background-clip--text"),fr&&(c.has("font-kerning")||c.set("font-kerning",["normal",""]),(c.get("overflow-x")?.[0]==="hidden"||c.get("overflow-y")?.[0]==="hidden")&&c.get("text-overflow")?.[0]==="ellipsis"&&e.scrollWidth===e.clientWidth&&c.set("text-overflow",["clip",""]));for(let d=i.length,g=0;g<d;g++)i.removeProperty(i.item(g));return c.forEach(([d,g],p)=>{i.setProperty(p,d,g);}),c}function Bs(e,t){(ds(e)||ms(e)||ps(e))&&t.setAttribute("value",e.value);}var js=[":before",":after"],Us=[":-webkit-scrollbar",":-webkit-scrollbar-button",":-webkit-scrollbar-thumb",":-webkit-scrollbar-track",":-webkit-scrollbar-track-piece",":-webkit-scrollbar-corner",":-webkit-resizer"];function Vs(e,t,n,r,o){let{ownerWindow:s,svgStyleElement:a,svgStyles:i,currentNodeStyle:l}=r;if(!a||!s)return;function u(c){let d=s.getComputedStyle(e,c),g=d.getPropertyValue("content");if(!g||g==="none")return;o?.(g),g=g.replace(/(')|(")|(counter\(.+\))/g,"");let p=[gr()],S=yr(e,c,r);l?.forEach((v,N)=>{S.delete(N);});let h=wr(d,S,r.includeStyleProperties);h.delete("content"),h.delete("-webkit-locale"),h.get("background-clip")?.[0]==="text"&&t.classList.add("______background-clip--text");let T=[`content: '${g}';`];if(h.forEach(([v,N],_)=>{T.push(`${_}: ${v}${N?" !important":""};`);}),T.length===1)return;try{t.className=[t.className,...p].join(" ");}catch(v){r.log.warn("Failed to copyPseudoClass",v);return}let y=T.join(`
|
|
15
|
-
`),R=i.get(y);R||(R=[],i.set(y,R)),R.push(`.${p[0]}:${c}`);}js.forEach(u),n&&Us.forEach(u);}var tr=new Set(["symbol"]);async function nr(e,t,n,r,o){if(ye(n)&&(gs(n)||hs(n))||r.filter&&!r.filter(n))return;tr.has(t.nodeName)||tr.has(n.nodeName)?r.currentParentNodeStyle=void 0:r.currentParentNodeStyle=r.currentNodeStyle;let s=await en(n,r,false,o);r.isEnable("restoreScrollPosition")&&Ys(e,s),t.appendChild(s);}async function rr(e,t,n,r){let o=e.firstChild;ye(e)&&e.shadowRoot&&(o=e.shadowRoot?.firstChild,n.shadowRoots.push(e.shadowRoot));for(let s=o;s;s=s.nextSibling)if(!cs(s))if(ye(s)&&bs(s)&&typeof s.assignedNodes=="function"){let a=s.assignedNodes();for(let i=0;i<a.length;i++)await nr(e,t,a[i],n,r);}else await nr(e,t,s,n,r);}function Ys(e,t){if(!Qe(e)||!Qe(t))return;let{scrollTop:n,scrollLeft:r}=e;if(!n&&!r)return;let{transform:o}=t.style,s=new DOMMatrix(o),{a,b:i,c:l,d:u}=s;s.a=1,s.b=0,s.c=0,s.d=1,s.translateSelf(-r,-n),s.a=a,s.b=i,s.c=l,s.d=u,t.style.transform=s.toString();}function Ws(e,t){let{backgroundColor:n,width:r,height:o,style:s}=t,a=e.style;if(n&&a.setProperty("background-color",n,"important"),r&&a.setProperty("width",`${r}px`,"important"),o&&a.setProperty("height",`${o}px`,"important"),s)for(let i in s)a[i]=s[i];}var qs=/^[\w-:]+$/;async function en(e,t,n=false,r){let{ownerDocument:o,ownerWindow:s,fontFamilies:a,onCloneEachNode:i}=t;if(o&&us(e))return r&&/\S/.test(e.data)&&r(e.data),o.createTextNode(e.data);if(o&&s&&ye(e)&&(Qe(e)||nt(e))){let u=await Ps(e,t);if(t.isEnable("removeAbnormalAttributes")){let h=u.getAttributeNames();for(let T=h.length,y=0;y<T;y++){let R=h[y];qs.test(R)||u.removeAttribute(R);}}let c=t.currentNodeStyle=Hs(e,u,n,t);n&&Ws(u,t);let d=false;if(t.isEnable("copyScrollbar")){let h=[c.get("overflow-x")?.[0],c.get("overflow-y")?.[0]];d=h.includes("scroll")||(h.includes("auto")||h.includes("overlay"))&&(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth);}let g=c.get("text-transform")?.[0],p=hr(c.get("font-family")?.[0]),S=p?h=>{g==="uppercase"?h=h.toUpperCase():g==="lowercase"?h=h.toLowerCase():g==="capitalize"&&(h=h[0].toUpperCase()+h.substring(1)),p.forEach(T=>{let y=a.get(T);y||a.set(T,y=new Set),h.split("").forEach(R=>y.add(R));});}:void 0;return Vs(e,u,d,t,S),Bs(e,u),Et(e)||await rr(e,u,t,S),await i?.(u),u}let l=e.cloneNode(false);return await rr(e,l,t),await i?.(l),l}function zs(e){if(e.ownerDocument=void 0,e.ownerWindow=void 0,e.svgStyleElement=void 0,e.svgDefsElement=void 0,e.svgStyles.clear(),e.defaultComputedStyles.clear(),e.sandbox){try{e.sandbox.remove();}catch(t){e.log.warn("Failed to destroyContext",t);}e.sandbox=void 0;}e.workers=[],e.fontFamilies.clear(),e.fontCssTexts.clear(),e.requests.clear(),e.tasks=[],e.shadowRoots=[];}function Gs(e){let{url:t,timeout:n,responseType:r,...o}=e,s=new AbortController,a=n?setTimeout(()=>s.abort(),n):void 0;return fetch(t,{signal:s.signal,...o}).then(i=>{if(!i.ok)throw new Error("Failed fetch, not 2xx response",{cause:i});switch(r){case "arrayBuffer":return i.arrayBuffer();case "dataUrl":return i.blob().then(vs);case "text":default:return i.text()}}).finally(()=>clearTimeout(a))}function tt(e,t){let{url:n,requestType:r="text",responseType:o="text",imageDom:s}=t,a=n,{timeout:i,acceptOfImage:l,requests:u,fetchFn:c,fetch:{requestInit:d,bypassingCache:g,placeholderImage:p},font:S,workers:h,fontFamilies:T}=e;r==="image"&&(Tt||Qt)&&e.drawImageCount++;let y=u.get(n);if(!y){g&&g instanceof RegExp&&g.test(a)&&(a+=(/\?/.test(a)?"&":"?")+new Date().getTime());let R=r.startsWith("font")&&S&&S.minify,v=new Set;R&&r.split(";")[1].split(",").forEach(X=>{T.has(X)&&T.get(X).forEach(Q=>v.add(Q));});let N=R&&v.size,_={url:a,timeout:i,responseType:N?"arrayBuffer":o,headers:r==="image"?{accept:l}:void 0,...d};y={type:r,resolve:void 0,reject:void 0,response:null},y.response=(async()=>{if(c&&r==="image"){let O=await c(n);if(O)return O}return !Tt&&n.startsWith("http")&&h.length?new Promise((O,X)=>{h[u.size&h.length-1].postMessage({rawUrl:n,..._}),y.resolve=O,y.reject=X;}):Gs(_)})().catch(O=>{if(u.delete(n),r==="image"&&p)return e.log.warn("Failed to fetch image base64, trying to use placeholder image",a),typeof p=="string"?p:p(s);throw O}),u.set(n,y);}return y.response}async function Sr(e,t,n,r){if(!Cr(e))return e;for(let[o,s]of Xs(e,t))try{let a=await tt(n,{url:s,requestType:r?"image":"text",responseType:"dataUrl"});e=e.replace(Ks(o),`$1${a}$3`);}catch(a){n.log.warn("Failed to fetch css data url",o,a);}return e}function Cr(e){return /url\((['"]?)([^'"]+?)\1\)/.test(e)}var Tr=/url\((['"]?)([^'"]+?)\1\)/g;function Xs(e,t){let n=[];return e.replace(Tr,(r,o,s)=>(n.push([s,mr(s,t)]),r)),n.filter(([r])=>!Zt(r))}function Ks(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}var Zs=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function Js(e,t){return Zs.map(n=>{let r=e.getPropertyValue(n);return !r||r==="none"?null:((Tt||Qt)&&t.drawImageCount++,Sr(r,null,t,true).then(o=>{!o||r===o||e.setProperty(n,o,e.getPropertyPriority(n));}))}).filter(Boolean)}function Qs(e,t){if(je(e)){let n=e.currentSrc||e.src;if(!Zt(n))return [tt(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then(r=>{r&&(e.srcset="",e.dataset.originalSrc=n,e.src=r||"");})];(Tt||Qt)&&t.drawImageCount++;}else if(nt(e)&&!Zt(e.href.baseVal)){let n=e.href.baseVal;return [tt(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then(r=>{r&&(e.dataset.originalSrc=n,e.href.baseVal=r||"");})]}return []}function ei(e,t){let{ownerDocument:n,svgDefsElement:r}=t,o=e.getAttribute("href")??e.getAttribute("xlink:href");if(!o)return [];let[s,a]=o.split("#");if(a){let i=`#${a}`,l=t.shadowRoots.reduce((u,c)=>u??c.querySelector(`svg ${i}`),n?.querySelector(`svg ${i}`));if(s&&e.setAttribute("href",i),r?.querySelector(i))return [];if(l)return r?.appendChild(l.cloneNode(true)),[];if(s)return [tt(t,{url:s,responseType:"text"}).then(u=>{r?.insertAdjacentHTML("beforeend",u);})]}return []}function Er(e,t){let{tasks:n}=t;ye(e)&&((je(e)||dr(e))&&n.push(...Qs(e,t)),ls(e)&&n.push(...ei(e,t))),Qe(e)&&n.push(...Js(e.style,t)),e.childNodes.forEach(r=>{Er(r,t);});}async function ti(e,t){let{ownerDocument:n,svgStyleElement:r,fontFamilies:o,fontCssTexts:s,tasks:a,font:i}=t;if(!(!n||!r||!o.size))if(i&&i.cssText){let l=sr(i.cssText,t);r.appendChild(n.createTextNode(`${l}
|
|
16
|
-
`));}else {let l=Array.from(n.styleSheets).filter(c=>{try{return "cssRules"in c&&!!c.cssRules.length}catch(d){return t.log.warn(`Error while reading CSS rules from ${c.href}`,d),false}});await Promise.all(l.flatMap(c=>Array.from(c.cssRules).map(async(d,g)=>{if(as(d)){let p=g+1,S=d.href,h="";try{h=await tt(t,{url:S,requestType:"text",responseType:"text"});}catch(y){t.log.warn(`Error fetch remote css import from ${S}`,y);}let T=h.replace(Tr,(y,R,v)=>y.replace(v,mr(v,S)));for(let y of ri(T))try{c.insertRule(y,y.startsWith("@import")?p+=1:c.cssRules.length);}catch(R){t.log.warn("Error inserting rule from remote css import",{rule:y,error:R});}}}))),l.flatMap(c=>Array.from(c.cssRules)).filter(c=>is(c)&&Cr(c.style.getPropertyValue("src"))&&hr(c.style.getPropertyValue("font-family"))?.some(d=>o.has(d))).forEach(c=>{let d=c,g=s.get(d.cssText);g?r.appendChild(n.createTextNode(`${g}
|
|
17
|
-
`)):a.push(Sr(d.cssText,d.parentStyleSheet?d.parentStyleSheet.href:null,t).then(p=>{p=sr(p,t),s.set(d.cssText,p),r.appendChild(n.createTextNode(`${p}
|
|
18
|
-
`));}));});}}var ni=/(\/\*[\s\S]*?\*\/)/g,or=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function ri(e){if(e==null)return [];let t=[],n=e.replace(ni,"");for(;;){let s=or.exec(n);if(!s)break;t.push(s[0]);}n=n.replace(or,"");let r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let s=r.exec(n);if(s)o.lastIndex=r.lastIndex;else if(s=o.exec(n),s)r.lastIndex=o.lastIndex;else break;t.push(s[0]);}return t}var oi=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,si=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function sr(e,t){let{font:n}=t,r=n?n?.preferredFormat:void 0;return r?e.replace(si,o=>{for(;;){let[s,,a]=oi.exec(o)||[];if(!a)return "";if(a===r)return `src: ${s};`}}):e}async function ii(e,t){let n=await Rt(e,t);if(ye(n.node)&&nt(n.node))return n.node;let{ownerDocument:r,log:o,tasks:s,svgStyleElement:a,svgDefsElement:i,svgStyles:l,font:u,progress:c,autoDestruct:d,onCloneNode:g,onEmbedNode:p,onCreateForeignObjectSvg:S}=n;o.time("clone node");let h=await en(n.node,n,true);if(a&&r){let N="";l.forEach((_,O)=>{N+=`${_.join(`,
|
|
19
|
-
`)} {
|
|
20
|
-
${O}
|
|
21
|
-
}
|
|
22
|
-
`;}),a.appendChild(r.createTextNode(N));}o.timeEnd("clone node"),await g?.(h),u!==false&&ye(h)&&(o.time("embed web font"),await ti(h,n),o.timeEnd("embed web font")),o.time("embed node"),Er(h,n);let T=s.length,y=0,R=async()=>{for(;;){let N=s.pop();if(!N)break;try{await N;}catch(_){n.log.warn("Failed to run task",_);}c?.(++y,T);}};c?.(y,T),await Promise.all([...Array.from({length:4})].map(R)),o.timeEnd("embed node"),await p?.(h);let v=ai(h,n);return i&&v.insertBefore(i,v.children[0]),a&&v.insertBefore(a,v.children[0]),d&&zs(n),await S?.(v),v}function ai(e,t){let{width:n,height:r}=t,o=Cs(n,r,e.ownerDocument),s=o.ownerDocument.createElementNS(o.namespaceURI,"foreignObject");return s.setAttributeNS(null,"x","0%"),s.setAttributeNS(null,"y","0%"),s.setAttributeNS(null,"width","100%"),s.setAttributeNS(null,"height","100%"),s.append(e),o.appendChild(s),o}async function li(e,t){let n=await Rt(e,t),r=await ii(n),o=Ts(r,n.isEnable("removeControlCharacter"));n.autoDestruct||(n.svgStyleElement=pr(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(xt,"defs"),n.svgStyles.clear());let s=Be(o,r.ownerDocument);return await Fs(s,n)}async function ci(e,t){let n=await Rt(e,t),{log:r,quality:o,type:s,dpi:a}=n,i=await li(n);r.time("canvas to data url");let l=i.toDataURL(s,o);if(["image/png","image/jpeg"].includes(s)&&a&&rs&&os){let[u,c]=l.split(","),d=0,g=false;if(s==="image/png"){let v=ts(c);v>=0?(d=Math.ceil((v+28)/3)*4,g=true):d=33/3*4;}else s==="image/jpeg"&&(d=18/3*4);let p=c.substring(0,d),S=c.substring(d),h=window.atob(p),T=new Uint8Array(h.length);for(let v=0;v<T.length;v++)T[v]=h.charCodeAt(v);let y=s==="image/png"?Zo(T,a,g):zo(T,a),R=window.btoa(String.fromCharCode(...y));l=[u,",",R,S].join("");}return r.timeEnd("canvas to data url"),l}async function tn(e,t){return ci(await Rt(e,{...t,type:"image/png"}))}var ui=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"],fi=e=>!!e.tagName&&!e.tagName.startsWith("-")&&e.tagName.includes("-"),di=e=>Array.isArray(e),mi=(e,t=false)=>{let{composed:n,target:r}=e,o,s;if(r instanceof HTMLElement&&fi(r)&&n){let i=e.composedPath()[0];i instanceof HTMLElement&&(o=i.tagName,s=i.role);}else r instanceof HTMLElement&&(o=r.tagName,s=r.role);return di(t)?!!(o&&t&&t.some(a=>typeof o=="string"&&a.toLowerCase()===o.toLowerCase()||a===s)):!!(o&&t&&t)},vr=e=>mi(e,ui);var Ue="data-react-grab",xr=()=>{let e=document.querySelector(`[${Ue}]`);if(e){let s=e.shadowRoot?.querySelector(`[${Ue}]`);if(s instanceof HTMLDivElement&&e.shadowRoot)return s}let t=document.createElement("div");t.setAttribute(Ue,"true"),t.style.zIndex="2147483646",t.style.position="fixed",t.style.top="0",t.style.left="0";let n=t.attachShadow({mode:"open"}),r=document.createElement("div");return r.setAttribute(Ue,"true"),n.appendChild(r),(document.body??document.documentElement).appendChild(t),r};var ge=(e,t,n)=>e+(t-e)*n;var hi=oe("<div>"),Nt=e=>{let[t,n]=I(e.bounds.x),[r,o]=I(e.bounds.y),[s,a]=I(e.bounds.width),[i,l]=I(e.bounds.height),[u,c]=I(1),d=false,g=null,p=null,S=e.bounds,h=false,T=()=>e.lerpFactor!==void 0?e.lerpFactor:e.variant==="drag"?.7:.95,y=()=>{if(h)return;h=true;let N=()=>{let _=ge(t(),S.x,T()),O=ge(r(),S.y,T()),X=ge(s(),S.width,T()),Q=ge(i(),S.height,T());n(_),o(O),a(X),l(Q),Math.abs(_-S.x)<.5&&Math.abs(O-S.y)<.5&&Math.abs(X-S.width)<.5&&Math.abs(Q-S.height)<.5?(g=null,h=false):g=requestAnimationFrame(N);};g=requestAnimationFrame(N);};re(Ae(()=>e.bounds,N=>{if(S=N,!d){n(S.x),o(S.y),a(S.width),l(S.height),d=true;return}y();})),re(()=>{e.variant==="grabbed"&&e.createdAt&&(p=window.setTimeout(()=>{c(0);},1500));}),fe(()=>{g!==null&&(cancelAnimationFrame(g),g=null),p!==null&&(window.clearTimeout(p),p=null),h=false;});let R={position:"fixed","box-sizing":"border-box","pointer-events":e.variant==="drag"?"none":"auto","z-index":"2147483646"},v=()=>e.variant==="drag"?{border:"1px dashed rgba(210, 57, 192, 0.4)","background-color":"rgba(210, 57, 192, 0.05)","will-change":"transform, width, height",contain:"layout paint size",cursor:"crosshair"}:{border:"1px solid rgb(210, 57, 192)","background-color":"rgba(210, 57, 192, 0.2)",transition:e.variant==="grabbed"?"opacity 0.3s ease-out":void 0};return P(q,{get when(){return e.visible!==false},get children(){var N=hi();return ae(_=>Ct(N,{...R,...v(),top:`${r()}px`,left:`${t()}px`,width:`${s()}px`,height:`${i()}px`,"border-radius":e.bounds.borderRadius,transform:e.bounds.transform,opacity:u()},_)),N}})};var pi=oe('<span style="display:inline-block;width:8px;height:8px;border:1.5px solid rgb(210, 57, 192);border-top-color:transparent;border-radius:50%;margin-right:4px;vertical-align:middle">'),Rr=e=>{let t;return Wn(()=>{t&&t.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:600,easing:"linear",iterations:1/0});}),(()=>{var n=pi(),r=t;return typeof r=="function"?_e(r,n):t=n,ae(o=>Ct(n,{...e.style},o)),n})()};var At=(e,t,n,r)=>{let o=window.innerWidth,s=window.innerHeight,a=8,i=8,l=o-n-8,u=s-r-8,c=Math.max(a,Math.min(e,l)),d=Math.max(i,Math.min(t,u));return {left:c,top:d}};var bi=oe("<span style=display:inline-block;margin-right:4px;font-weight:600>\u2713"),yi=oe("<div style=margin-right:4px>Copied"),wi=oe(`<span style="font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;font-variant-numeric:tabular-nums">`),Si=oe("<div style=margin-left:4px>to clipboard"),Ci=oe(`<div style="position:fixed;padding:2px 6px;background-color:#fde7f7;color:#b21c8e;border:1px solid #f7c5ec;border-radius:4px;font-size:11px;font-weight:500;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;pointer-events:none;transition:opacity 0.2s ease-in-out;display:flex;align-items:center;max-width:calc(100vw - (16px + env(safe-area-inset-left) + env(safe-area-inset-right)));overflow:hidden;text-overflow:ellipsis;white-space:nowrap">`),nn=e=>{let[t,n]=I(0),[r,o]=I(0),s,a=e.x,i=e.y,l=e.x,u=e.y,c=null,d=false,g=()=>{a=ge(a,l,.3),i=ge(i,u,.3),o(R=>R+1),Math.abs(a-l)<.5&&Math.abs(i-u)<.5?c=null:c=requestAnimationFrame(g);},p=()=>{c===null&&(c=requestAnimationFrame(g));},S=()=>{if(l=e.x,u=e.y,!d){a=l,i=u,d=true,o(y=>y+1);return}p();};re(Ae(()=>e.visible,y=>{if(y!==false)requestAnimationFrame(()=>{n(1);});else {n(0);return}if(e.variant==="success"){let R=setTimeout(()=>{n(0);},1700);fe(()=>clearTimeout(R));}})),re(()=>{S();}),fe(()=>{c!==null&&(cancelAnimationFrame(c),c=null);});let h=()=>s?.getBoundingClientRect(),T=()=>{r();let y=h();if(!y)return {left:a,top:i};let R=window.innerWidth,v=window.innerHeight,N=[{left:Math.round(a)+14,top:Math.round(i)+14},{left:Math.round(a)-y.width-14,top:Math.round(i)+14},{left:Math.round(a)+14,top:Math.round(i)-y.height-14},{left:Math.round(a)-y.width-14,top:Math.round(i)-y.height-14}];for(let O of N){let X=O.left>=8&&O.left+y.width<=R-8,Q=O.top>=8&&O.top+y.height<=v-8;if(X&&Q)return O}let _=At(N[0].left,N[0].top,y.width,y.height);return _.left+=4,_.top+=4,_};return P(q,{get when(){return e.visible!==false},get children(){var y=Ci(),R=s;return typeof R=="function"?_e(R,y):s=y,Te(y,P(q,{get when(){return e.variant==="processing"},get children(){return P(Rr,{})}}),null),Te(y,P(q,{get when(){return e.variant==="success"},get children(){return bi()}}),null),Te(y,P(q,{get when(){return e.variant==="success"},get children(){return yi()}}),null),Te(y,P(q,{get when(){return e.variant==="processing"},children:"Grabbing\u2026"}),null),Te(y,P(q,{get when(){return e.variant!=="processing"},get children(){var v=wi();return Te(v,()=>e.text),v}}),null),Te(y,P(q,{get when(){return e.variant==="success"},get children(){return Si()}}),null),ae(v=>{var N=`${T().top}px`,_=`${T().left}px`,O=e.zIndex?.toString()??"2147483647",X=t();return N!==v.e&&be(y,"top",v.e=N),_!==v.t&&be(y,"left",v.t=_),O!==v.a&&be(y,"z-index",v.a=O),X!==v.o&&be(y,"opacity",v.o=X),v},{e:void 0,t:void 0,a:void 0,o:void 0}),y}})};var Ti=oe('<div style="position:fixed;z-index:2147483647;pointer-events:none;transition:opacity 0.1s ease-in-out"><div style="width:32px;height:2px;background-color:rgba(178, 28, 142, 0.2);border-radius:1px;overflow:hidden;position:relative"><div style="height:100%;background-color:#b21c8e;border-radius:1px;transition:width 0.05s cubic-bezier(0.165, 0.84, 0.44, 1)">'),Ei=e=>{let[t,n]=I(0);return re(Ae(()=>e,r=>{r!==false?requestAnimationFrame(()=>{n(1);}):n(0);})),t},Ar=e=>{let t=Ei(e.visible),n,r=()=>{let o=n?.getBoundingClientRect();if(!o)return {left:e.mouseX,top:e.mouseY};let s=window.innerHeight,a=e.mouseX-o.width/2,i=e.mouseY+14+o.height+8>s?e.mouseY-o.height-14:e.mouseY+14;return At(a,i,o.width,o.height)};return P(q,{get when(){return e.visible!==false},get children(){var o=Ti(),s=o.firstChild,a=s.firstChild,i=n;return typeof i=="function"?_e(i,o):n=o,ae(l=>{var u=`${r().top}px`,c=`${r().left}px`,d=t(),g=`${Math.min(100,Math.max(0,e.progress*100))}%`;return u!==l.e&&be(o,"top",l.e=u),c!==l.t&&be(o,"left",l.t=c),d!==l.a&&be(o,"opacity",l.a=d),g!==l.o&&be(a,"width",l.o=g),l},{e:void 0,t:void 0,a:void 0,o:void 0}),o}})};var vi=oe("<canvas style=position:fixed;top:0;left:0;pointer-events:none;z-index:2147483645>"),_r=e=>{let t,n=null,r=0,o=0,s=1,a=e.mouseX,i=e.mouseY,l=e.mouseX,u=e.mouseY,c=null,d=false,g=()=>{t&&(s=Math.max(window.devicePixelRatio||1,2),r=window.innerWidth,o=window.innerHeight,t.width=r*s,t.height=o*s,t.style.width=`${r}px`,t.style.height=`${o}px`,n=t.getContext("2d"),n&&n.scale(s,s));},p=()=>{n&&(n.clearRect(0,0,r,o),n.strokeStyle="rgba(210, 57, 192)",n.lineWidth=1,n.beginPath(),n.moveTo(a,0),n.lineTo(a,o),n.moveTo(0,i),n.lineTo(r,i),n.stroke());},S=()=>{a=ge(a,l,.3),i=ge(i,u,.3),p(),Math.abs(a-l)<.5&&Math.abs(i-u)<.5?c=null:c=requestAnimationFrame(S);},h=()=>{c===null&&(c=requestAnimationFrame(S));},T=()=>{if(l=e.mouseX,u=e.mouseY,!d){a=l,i=u,d=true,p();return}h();};return re(()=>{g(),p();let y=()=>{g(),p();};window.addEventListener("resize",y),fe(()=>{window.removeEventListener("resize",y),c!==null&&(cancelAnimationFrame(c),c=null);});}),re(()=>{T();}),P(q,{get when(){return e.visible!==false},get children(){var y=vi(),R=t;return typeof R=="function"?_e(R,y):t=y,y}})};var Fr=e=>[P(q,{get when(){return He(()=>!!e.selectionVisible)()&&e.selectionBounds},get children(){return P(Nt,{variant:"selection",get bounds(){return e.selectionBounds},get visible(){return e.selectionVisible}})}}),P(q,{get when(){return He(()=>e.crosshairVisible===true&&e.mouseX!==void 0)()&&e.mouseY!==void 0},get children(){return P(_r,{get mouseX(){return e.mouseX},get mouseY(){return e.mouseY},visible:true})}}),P(q,{get when(){return He(()=>!!e.dragVisible)()&&e.dragBounds},get children(){return P(Nt,{variant:"drag",get bounds(){return e.dragBounds},get visible(){return e.dragVisible}})}}),P(wt,{get each(){return e.grabbedBoxes??[]},children:t=>P(Nt,{variant:"grabbed",get bounds(){return t.bounds},get createdAt(){return t.createdAt}})}),P(wt,{get each(){return e.successLabels??[]},children:t=>P(nn,{variant:"success",get text(){return t.text},get x(){return t.x},get y(){return t.y}})}),P(q,{get when(){return He(()=>!!(e.labelVisible&&e.labelVariant&&e.labelText&&e.labelX!==void 0))()&&e.labelY!==void 0},get children(){return P(nn,{get variant(){return e.labelVariant},get text(){return e.labelText},get x(){return e.labelX},get y(){return e.labelY},get visible(){return e.labelVisible},get zIndex(){return e.labelZIndex}})}}),P(q,{get when(){return He(()=>!!(e.progressVisible&&e.progress!==void 0&&e.mouseX!==void 0))()&&e.mouseY!==void 0},get children(){return P(Ar,{get progress(){return e.progress},get mouseX(){return e.mouseX},get mouseY(){return e.mouseY},get visible(){return e.progressVisible}})}})];var Ir="0.5.14",ot=`bippy-${Ir}`,Or=Object.defineProperty,xi=Object.prototype.hasOwnProperty,rt=()=>{},$r=e=>{try{Function.prototype.toString.call(e).indexOf("^_^")>-1&&setTimeout(()=>{throw Error("React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build")});}catch{}},rn=(e=Ee())=>"getFiberRoots"in e,Pr=false,kr,Ot=(e=Ee())=>Pr?true:(typeof e.inject=="function"&&(kr=e.inject.toString()),!!kr?.includes("(injected)")),Ft=new Set,$e=new Set,Dr=e=>{let t=new Map,n=0,r={_instrumentationIsActive:false,_instrumentationSource:ot,checkDCE:$r,hasUnsupportedRendererAttached:false,inject(o){let s=++n;return t.set(s,o),$e.add(o),r._instrumentationIsActive||(r._instrumentationIsActive=true,Ft.forEach(a=>a())),s},on:rt,onCommitFiberRoot:rt,onCommitFiberUnmount:rt,onPostCommitFiberRoot:rt,renderers:t,supportsFiber:true,supportsFlight:true};try{Or(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__",{configurable:!0,enumerable:!0,get(){return r},set(a){if(a&&typeof a=="object"){let i=r.renderers;r=a,i.size>0&&(i.forEach((l,u)=>{$e.add(l),a.renderers.set(u,l);}),kt(e));}}});let o=window.hasOwnProperty,s=!1;Or(window,"hasOwnProperty",{configurable:!0,value:function(...a){try{if(!s&&a[0]==="__REACT_DEVTOOLS_GLOBAL_HOOK__")return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,s=!0,-0}catch{}return o.apply(this,a)},writable:!0});}catch{kt(e);}return r},kt=e=>{e&&Ft.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=$r,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=ot,t._instrumentationIsActive=!1;let n=rn(t);if(n||(t.on=rt),t.renderers.size){t._instrumentationIsActive=!0,Ft.forEach(s=>s());return}let r=t.inject,o=Ot(t);o&&!n&&(Pr=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=s=>{let a=r(s);return $e.add(s),o&&t.renderers.set(a,s),t._instrumentationIsActive=!0,Ft.forEach(i=>i()),a};}(t.renderers.size||t._instrumentationIsActive||Ot())&&e?.();}catch{}},on=()=>xi.call(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__"),Ee=e=>on()?(kt(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):Dr(e),Mr=()=>!!(typeof window<"u"&&(window.document?.createElement||window.navigator?.product==="ReactNative")),sn=()=>{try{Mr()&&Ee();}catch{}};sn();var It=0,$t=1;var Pt=5;var Dt=11,an=13,Lr=14,Mt=15,ln=16;var cn=19;var Lt=26,Ht=27,un=28,fn=30;var dn=e=>{switch(e.tag){case Pt:case Lt:case Ht:return true;default:return typeof e.type=="string"}},st=e=>{switch(e.tag){case $t:case Dt:case It:case Lr:case Mt:return true;default:return false}};function Ve(e,t,n=false){return e&&t(e)instanceof Promise?gn(e,t,n):mn(e,t,n)}var mn=(e,t,n=false)=>{if(!e)return null;if(t(e)===true)return e;let r=n?e.return:e.child;for(;r;){let o=mn(r,t,n);if(o)return o;r=n?null:r.sibling;}return null},gn=async(e,t,n=false)=>{if(!e)return null;if(await t(e)===true)return e;let r=n?e.return:e.child;for(;r;){let o=await gn(r,t,n);if(o)return o;r=n?null:r.sibling;}return null};var hn=e=>{let t=e;return typeof t=="function"?t:typeof t=="object"&&t?hn(t.type||t.render):null},Ye=e=>{let t=e;if(typeof t=="string")return t;if(typeof t!="function"&&!(typeof t=="object"&&t))return null;let n=t.displayName||t.name||null;if(n)return n;let r=hn(t);return r&&(r.displayName||r.name)||null};var pn=e=>{let t=e.alternate;if(!t)return e;if(t.actualStartTime&&e.actualStartTime)return t.actualStartTime>e.actualStartTime?t:e;for(let n of Bt){let r=Ve(n.current,o=>{if(o===e)return true});if(r)return r}return e};var bn=e=>{let t=Ee(e.onActive);t._instrumentationSource=e.name??ot;let n=t.onCommitFiberRoot;if(e.onCommitFiberRoot){let s=(a,i,l)=>{n!==s&&(n?.(a,i,l),e.onCommitFiberRoot?.(a,i,l));};t.onCommitFiberRoot=s;}let r=t.onCommitFiberUnmount;if(e.onCommitFiberUnmount){let s=(a,i)=>{t.onCommitFiberUnmount===s&&(r?.(a,i),e.onCommitFiberUnmount?.(a,i));};t.onCommitFiberUnmount=s;}let o=t.onPostCommitFiberRoot;if(e.onPostCommitFiberRoot){let s=(a,i)=>{t.onPostCommitFiberRoot===s&&(o?.(a,i),e.onPostCommitFiberRoot?.(a,i));};t.onPostCommitFiberRoot=s;}return t},it=e=>{let t=Ee();for(let n of t.renderers.values())try{let r=n.findFiberByHostInstance?.(e);if(r)return r}catch{}if(typeof e=="object"&&e){if("_reactRootContainer"in e)return e._reactRootContainer?._internalRoot?.current?.child;for(let n in e)if(n.startsWith("__reactContainer$")||n.startsWith("__reactInternalInstance$")||n.startsWith("__reactFiber"))return e[n]||null}return null},Bt=new Set;var $i=Object.create,qr=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,Di=Object.getOwnPropertyNames,Mi=Object.getPrototypeOf,Li=Object.prototype.hasOwnProperty,Hi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bi=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=Di(t),s=0,a=o.length,i;s<a;s++)i=o[s],!Li.call(e,i)&&i!==n&&qr(e,i,{get:(l=>t[l]).bind(null,i),enumerable:!(r=Pi(t,i))||r.enumerable});return e},ji=(e,t,n)=>(n=e==null?{}:$i(Mi(e)),Bi(qr(n,"default",{value:e,enumerable:true}),e)),Ui=()=>{let e=Ee();for(let t of [...Array.from($e),...Array.from(e.renderers.values())]){let n=t.currentDispatcherRef;if(n&&typeof n=="object")return "H"in n?n.H:n.current}return null},Hr=e=>{for(let t of $e){let n=t.currentDispatcherRef;n&&typeof n=="object"&&("H"in n?n.H=e:n.current=e);}},ve=e=>`
|
|
23
|
-
in ${e}`,Vi=(e,t)=>{let n=ve(e);return t&&(n+=` (at ${t})`),n},yn=false,wn=(e,t)=>{if(!e||yn)return "";let n=Error.prepareStackTrace;Error.prepareStackTrace=void 0,yn=true;let r=Ui();Hr(null);let o=console.error,s=console.warn;console.error=()=>{},console.warn=()=>{};try{let l={DetermineComponentFrameRoot(){let g;try{if(t){let p=function(){throw Error()};if(Object.defineProperty(p.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(p,[]);}catch(S){g=S;}Reflect.construct(e,[],p);}else {try{p.call();}catch(S){g=S;}e.call(p.prototype);}}else {try{throw Error()}catch(S){g=S;}let p=e();p&&typeof p.catch=="function"&&p.catch(()=>{});}}catch(p){if(p instanceof Error&&g instanceof Error&&typeof p.stack=="string")return [p.stack,g.stack]}return [null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot",Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name")?.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});let[c,d]=l.DetermineComponentFrameRoot();if(c&&d){let g=c.split(`
|
|
24
|
-
`),p=d.split(`
|
|
25
|
-
`),S=0,h=0;for(;S<g.length&&!g[S].includes("DetermineComponentFrameRoot");)S++;for(;h<p.length&&!p[h].includes("DetermineComponentFrameRoot");)h++;if(S===g.length||h===p.length)for(S=g.length-1,h=p.length-1;S>=1&&h>=0&&g[S]!==p[h];)h--;for(;S>=1&&h>=0;S--,h--)if(g[S]!==p[h]){if(S!==1||h!==1)do if(S--,h--,h<0||g[S]!==p[h]){let T=`
|
|
26
|
-
${g[S].replace(" at new "," at ")}`,y=Ye(e);return y&&T.includes("<anonymous>")&&(T=T.replace("<anonymous>",y)),T}while(S>=1&&h>=0);break}}}finally{yn=false,Error.prepareStackTrace=n,Hr(r),console.error=o,console.warn=s;}let a=e?Ye(e):"";return a?ve(a):""},Yi=(e,t)=>{let n=e.tag,r="";switch(n){case un:r=ve("Activity");break;case $t:r=wn(e.type,true);break;case Dt:r=wn(e.type.render,false);break;case It:case Mt:r=wn(e.type,false);break;case Pt:case Lt:case Ht:r=ve(e.type);break;case ln:r=ve("Lazy");break;case an:r=e.child!==t&&t!==null?ve("Suspense Fallback"):ve("Suspense");break;case cn:r=ve("SuspenseList");break;case fn:r=ve("ViewTransition");break;default:return ""}return r},Wi=e=>{try{let t="",n=e,r=null;do{t+=Yi(n,r);let o=n._debugInfo;if(o&&Array.isArray(o))for(let s=o.length-1;s>=0;s--){let a=o[s];typeof a.name=="string"&&(t+=Vi(a.name,a.env));}r=n,n=n.return;}while(n);return t}catch(t){return t instanceof Error?`
|
|
9
|
+
var Mr=(e,t)=>e===t;var Pr=Symbol("solid-track"),ot={equals:Mr},wn=vn,ce=1,Ge=2,Sn={owned:null,cleanups:null,context:null,owner:null};var P=null,p=null,Ie=null,G=null,K=null,ee=null,st=0;function Ae(e,t){let n=G,r=P,o=e.length===0,i=t===void 0?r:t,s=o?Sn:{owned:null,cleanups:null,context:i?i.context:null,owner:i},a=o?e:()=>e(()=>se(()=>ve(s)));P=s,G=null;try{return be(a,!0)}finally{G=n,P=r;}}function $(e,t){t=t?Object.assign({},ot,t):ot;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},r=o=>(typeof o=="function"&&(o=o(n.value)),xn(n,o));return [Cn.bind(n),r]}function ae(e,t,n){let r=At(e,t,false,ce);qe(r);}function ne(e,t,n){wn=jr;let r=At(e,t,false,ce);(r.user=true),ee?ee.push(r):qe(r);}function z(e,t,n){n=n?Object.assign({},ot,n):ot;let r=At(e,t,true,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,qe(r),Cn.bind(r)}function se(e){if(G===null)return e();let t=G;G=null;try{return Ie?Ie.untrack(e):e()}finally{G=t;}}function Ee(e,t,n){let r=Array.isArray(e),o;return s=>{let a;if(r){a=Array(e.length);for(let f=0;f<e.length;f++)a[f]=e[f]();}else a=e();let l=se(()=>t(a,o,s));return o=a,l}}function Tn(e){ne(()=>se(e));}function ue(e){return P===null||(P.cleanups===null?P.cleanups=[e]:P.cleanups.push(e)),e}$(false);function Cn(){let e=p;if(this.sources&&(this.state))if((this.state)===ce)qe(this);else {let t=K;K=null,be(()=>it(this),false),K=t;}if(G){let t=this.observers?this.observers.length:0;G.sources?(G.sources.push(this),G.sourceSlots.push(t)):(G.sources=[this],G.sourceSlots=[t]),this.observers?(this.observers.push(G),this.observerSlots.push(G.sources.length-1)):(this.observers=[G],this.observerSlots=[G.sources.length-1]);}return e&&p.sources.has(this)?this.tValue:this.value}function xn(e,t,n){let r=e.value;if(!e.comparator||!e.comparator(r,t)){e.value=t;e.observers&&e.observers.length&&be(()=>{for(let o=0;o<e.observers.length;o+=1){let i=e.observers[o],s=p&&p.running;s&&p.disposed.has(i)||((s?!i.tState:!i.state)&&(i.pure?K.push(i):ee.push(i),i.observers&&En(i)),s?i.tState=ce:i.state=ce);}if(K.length>1e6)throw K=[],new Error},false);}return t}function qe(e){if(!e.fn)return;ve(e);let t=st;pn(e,e.value,t);}function pn(e,t,n){let r,o=P,i=G;G=P=e;try{r=e.fn(t);}catch(s){return e.pure&&((e.state=ce,e.owned&&e.owned.forEach(ve),e.owned=null)),e.updatedAt=n+1,Ft(s)}finally{G=i,P=o;}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?xn(e,r):e.value=r,e.updatedAt=n);}function At(e,t,n,r=ce,o){let i={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:P,context:P?P.context:null,pure:n};if(P===null||P!==Sn&&(P.owned?P.owned.push(i):P.owned=[i]),Ie);return i}function Ue(e){let t=p;if((e.state)===0)return;if((e.state)===Ge)return it(e);if(e.suspense&&se(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<st);){(e.state)&&n.push(e);}for(let r=n.length-1;r>=0;r--){if(e=n[r],t);if((e.state)===ce)qe(e);else if((e.state)===Ge){let o=K;K=null,be(()=>it(e,n[0]),false),K=o;}}}function be(e,t){if(K)return e();let n=false;t||(K=[]),ee?n=true:ee=[],st++;try{let r=e();return Hr(n),r}catch(r){n||(ee=null),K=null,Ft(r);}}function Hr(e){if(K&&(vn(K),K=null),e)return;let n=ee;ee=null,n.length&&be(()=>wn(n),false);}function vn(e){for(let t=0;t<e.length;t++)Ue(e[t]);}function jr(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:Ue(r);}for(t=0;t<n;t++)Ue(e[t]);}function it(e,t){e.state=0;for(let r=0;r<e.sources.length;r+=1){let o=e.sources[r];if(o.sources){let i=o.state;i===ce?o!==t&&(!o.updatedAt||o.updatedAt<st)&&Ue(o):i===Ge&&it(o,t);}}}function En(e){for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(!r.state)&&(r.state=Ge,r.pure?K.push(r):ee.push(r),r.observers&&En(r));}}function ve(e){let t;if(e.sources)for(;e.sources.length;){let n=e.sources.pop(),r=e.sourceSlots.pop(),o=n.observers;if(o&&o.length){let i=o.pop(),s=n.observerSlots.pop();r<o.length&&(i.sourceSlots[s]=r,o[r]=i,n.observerSlots[r]=s);}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)ve(e.tOwned[t]);delete e.tOwned;}if(e.owned){for(t=e.owned.length-1;t>=0;t--)ve(e.owned[t]);e.owned=null;}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null;}e.state=0;}function Vr(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function Ft(e,t=P){let r=Vr(e);throw r;}var Yr=Symbol("fallback");function yn(e){for(let t=0;t<e.length;t++)e[t]();}function Gr(e,t,n={}){let r=[],o=[],i=[],s=0,a=t.length>1?[]:null;return ue(()=>yn(i)),()=>{let l=e()||[],f=l.length,m,g;return l[Pr],se(()=>{let x,S,C,N,T,A,R,_,O;if(f===0)s!==0&&(yn(i),i=[],r=[],o=[],s=0,a&&(a=[])),n.fallback&&(r=[Yr],o[0]=Ae(L=>(i[0]=L,n.fallback())),s=1);else if(s===0){for(o=new Array(f),g=0;g<f;g++)r[g]=l[g],o[g]=Ae(b);s=f;}else {for(C=new Array(f),N=new Array(f),a&&(T=new Array(f)),A=0,R=Math.min(s,f);A<R&&r[A]===l[A];A++);for(R=s-1,_=f-1;R>=A&&_>=A&&r[R]===l[_];R--,_--)C[_]=o[R],N[_]=i[R],a&&(T[_]=a[R]);for(x=new Map,S=new Array(_+1),g=_;g>=A;g--)O=l[g],m=x.get(O),S[g]=m===void 0?-1:m,x.set(O,g);for(m=A;m<=R;m++)O=r[m],g=x.get(O),g!==void 0&&g!==-1?(C[g]=o[m],N[g]=i[m],a&&(T[g]=a[m]),g=S[g],x.set(O,g)):i[m]();for(g=A;g<f;g++)g in C?(o[g]=C[g],i[g]=N[g],a&&(a[g]=T[g],a[g](g))):o[g]=Ae(b);o=o.slice(0,s=f),r=l.slice(0);}return o});function b(x){if(i[g]=x,a){let[S,C]=$(g);return a[g]=C,t(l[g],S)}return t(l[g])}}}function k(e,t){return se(()=>e(t||{}))}var zr=e=>`Stale read from <${e}>.`;function at(e){let t="fallback"in e&&{fallback:()=>e.fallback};return z(Gr(()=>e.each,e.children,t||void 0))}function q(e){let t=e.keyed,n=z(()=>e.when,void 0,void 0),r=t?n:z(n,void 0,{equals:(o,i)=>!o==!i});return z(()=>{let o=r();if(o){let i=e.children;return typeof i=="function"&&i.length>0?se(()=>i(t?o:()=>{if(!se(r))throw zr("Show");return n()})):i}return e.fallback},void 0,void 0)}var Pe=e=>z(()=>e());function Wr(e,t,n){let r=n.length,o=t.length,i=r,s=0,a=0,l=t[o-1].nextSibling,f=null;for(;s<o||a<i;){if(t[s]===n[a]){s++,a++;continue}for(;t[o-1]===n[i-1];)o--,i--;if(o===s){let m=i<r?a?n[a-1].nextSibling:n[i-a]:l;for(;a<i;)e.insertBefore(n[a++],m);}else if(i===a)for(;s<o;)(!f||!f.has(t[s]))&&t[s].remove(),s++;else if(t[s]===n[i-1]&&n[a]===t[o-1]){let m=t[--o].nextSibling;e.insertBefore(n[a++],t[s++].nextSibling),e.insertBefore(n[--i],m),t[o]=n[i];}else {if(!f){f=new Map;let g=a;for(;g<i;)f.set(n[g],g++);}let m=f.get(t[s]);if(m!=null)if(a<m&&m<i){let g=s,b=1,x;for(;++g<o&&g<i&&!((x=f.get(t[g]))==null||x!==m+b);)b++;if(b>m-a){let S=t[s];for(;a<m;)e.insertBefore(n[a++],S);}else e.replaceChild(n[a++],t[s++]);}else s++;else t[s++].remove();}}}function Nn(e,t,n,r={}){let o;return Ae(i=>{o=i,t===document?e():ye(t,e(),t.firstChild?null:void 0,n);},r.owner),()=>{o(),t.textContent="";}}function oe(e,t,n,r){let o,i=()=>{let a=document.createElement("template");return a.innerHTML=e,a.content.firstChild},s=()=>(o||(o=i())).cloneNode(true);return s.cloneNode=s,s}function Kr(e,t,n){(e.removeAttribute(t));}function ct(e,t,n){if(!t)return n?Kr(e,"style"):t;let r=e.style;if(typeof t=="string")return r.cssText=t;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),t||(t={});let o,i;for(i in n)t[i]==null&&r.removeProperty(i),delete n[i];for(i in t)o=t[i],o!==n[i]&&(r.setProperty(i,o),n[i]=o);return n}function pe(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t);}function Re(e,t,n){return se(()=>e(t,n))}function ye(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return lt(e,t,r,n);ae(o=>lt(e,t(),o,n),r);}function lt(e,t,n,r,o){for(;typeof n=="function";)n=n();if(t===n)return n;let s=typeof t,a=r!==void 0;if(e=a&&n[0]&&n[0].parentNode||e,s==="string"||s==="number"){if(s==="number"&&(t=t.toString(),t===n))return n;if(a){let l=n[0];l&&l.nodeType===3?l.data!==t&&(l.data=t):l=document.createTextNode(t),n=Me(e,n,r,l);}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t;}else if(t==null||s==="boolean"){n=Me(e,n,r);}else {if(s==="function")return ae(()=>{let l=t();for(;typeof l=="function";)l=l();n=lt(e,l,n,r);}),()=>n;if(Array.isArray(t)){let l=[],f=n&&Array.isArray(n);if($t(l,t,n,o))return ae(()=>n=lt(e,l,n,r,true)),()=>n;if(l.length===0){if(n=Me(e,n,r),a)return n}else f?n.length===0?On(e,l,r):Wr(e,n,l):(n&&Me(e),On(e,l));n=l;}else if(t.nodeType){if(Array.isArray(n)){if(a)return n=Me(e,n,r,t);Me(e,n,null,t);}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t;}}return n}function $t(e,t,n,r){let o=false;for(let i=0,s=t.length;i<s;i++){let a=t[i],l=n&&n[e.length],f;if(!(a==null||a===true||a===false))if((f=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))o=$t(e,a,l)||o;else if(f==="function")if(r){for(;typeof a=="function";)a=a();o=$t(e,Array.isArray(a)?a:[a],Array.isArray(l)?l:[l])||o;}else e.push(a),o=true;else {let m=String(a);l&&l.nodeType===3&&l.data===m?e.push(l):e.push(document.createTextNode(m));}}return o}function On(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n);}function Me(e,t,n,r){if(n===void 0)return e.textContent="";let o=r||document.createTextNode("");if(t.length){let i=false;for(let s=t.length-1;s>=0;s--){let a=t[s];if(o!==a){let l=a.parentNode===e;!i&&!s?l?e.replaceChild(o,a):e.insertBefore(o,n):l&&a.remove();}else i=true;}}else e.insertBefore(o,n);return [o]}var Zr=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"],Jr=e=>!!e.tagName&&!e.tagName.startsWith("-")&&e.tagName.includes("-"),Qr=e=>Array.isArray(e),eo=(e,t=false)=>{let{composed:n,target:r}=e,o,i;if(r instanceof HTMLElement&&Jr(r)&&n){let a=e.composedPath()[0];a instanceof HTMLElement&&(o=a.tagName,i=a.role);}else r instanceof HTMLElement&&(o=r.tagName,i=r.role);return Qr(t)?!!(o&&t&&t.some(s=>typeof o=="string"&&s.toLowerCase()===o.toLowerCase()||s===i)):!!(o&&t&&t)},An=e=>eo(e,Zr);var Le="data-react-grab",Fn=()=>{let e=document.querySelector(`[${Le}]`);if(e){let i=e.shadowRoot?.querySelector(`[${Le}]`);if(i instanceof HTMLDivElement&&e.shadowRoot)return i}let t=document.createElement("div");t.setAttribute(Le,"true"),t.style.zIndex="2147483646",t.style.position="fixed",t.style.top="0",t.style.left="0";let n=t.attachShadow({mode:"open"}),r=document.createElement("div");return r.setAttribute(Le,"true"),n.appendChild(r),(document.body??document.documentElement).appendChild(t),r};var me=(e,t,n)=>e+(t-e)*n;var no=oe("<div>"),ut=e=>{let[t,n]=$(e.bounds.x),[r,o]=$(e.bounds.y),[i,s]=$(e.bounds.width),[a,l]=$(e.bounds.height),[f,m]=$(1),g=false,b=null,x=null,S=e.bounds,C=false,N=()=>e.lerpFactor!==void 0?e.lerpFactor:e.variant==="drag"?.7:.95,T=()=>{if(C)return;C=true;let _=()=>{let O=me(t(),S.x,N()),L=me(r(),S.y,N()),re=me(i(),S.width,N()),ie=me(a(),S.height,N());n(O),o(L),s(re),l(ie),Math.abs(O-S.x)<.5&&Math.abs(L-S.y)<.5&&Math.abs(re-S.width)<.5&&Math.abs(ie-S.height)<.5?(b=null,C=false):b=requestAnimationFrame(_);};b=requestAnimationFrame(_);};ne(Ee(()=>e.bounds,_=>{if(S=_,!g){n(S.x),o(S.y),s(S.width),l(S.height),g=true;return}T();})),ne(()=>{e.variant==="grabbed"&&e.createdAt&&(x=window.setTimeout(()=>{m(0);},1500));}),ue(()=>{b!==null&&(cancelAnimationFrame(b),b=null),x!==null&&(window.clearTimeout(x),x=null),C=false;});let A={position:"fixed","box-sizing":"border-box","pointer-events":e.variant==="drag"?"none":"auto","z-index":"2147483646"},R=()=>e.variant==="drag"?{border:"1px dashed rgba(210, 57, 192, 0.4)","background-color":"rgba(210, 57, 192, 0.05)","will-change":"transform, width, height",contain:"layout paint size",cursor:"crosshair"}:{border:"1px solid rgb(210, 57, 192)","background-color":"rgba(210, 57, 192, 0.2)",transition:e.variant==="grabbed"?"opacity 0.3s ease-out":void 0};return k(q,{get when(){return e.visible!==false},get children(){var _=no();return ae(O=>ct(_,{...A,...R(),top:`${r()}px`,left:`${t()}px`,width:`${i()}px`,height:`${a()}px`,"border-radius":e.bounds.borderRadius,transform:e.bounds.transform,opacity:f()},O)),_}})};var ro=oe('<span style="display:inline-block;width:8px;height:8px;border:1.5px solid rgb(210, 57, 192);border-top-color:transparent;border-radius:50%;margin-right:4px;vertical-align:middle">'),$n=e=>{let t;return Tn(()=>{t&&t.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:600,easing:"linear",iterations:1/0});}),(()=>{var n=ro(),r=t;return typeof r=="function"?Re(r,n):t=n,ae(o=>ct(n,{...e.style},o)),n})()};var ft=(e,t,n,r)=>{let o=window.innerWidth,i=window.innerHeight,s=8,a=8,l=o-n-8,f=i-r-8,m=Math.max(s,Math.min(e,l)),g=Math.max(a,Math.min(t,f));return {left:m,top:g}};var oo=oe("<span style=display:inline-block;margin-right:4px;font-weight:600>\u2713"),io=oe("<div style=margin-right:4px>Copied"),so=oe(`<span style="font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;font-variant-numeric:tabular-nums">`),ao=oe("<div style=margin-left:4px>to clipboard"),lo=oe(`<div style="position:fixed;padding:2px 6px;background-color:#fde7f7;color:#b21c8e;border:1px solid #f7c5ec;border-radius:4px;font-size:11px;font-weight:500;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;pointer-events:none;transition:opacity 0.2s ease-in-out;display:flex;align-items:center;max-width:calc(100vw - (16px + env(safe-area-inset-left) + env(safe-area-inset-right)));overflow:hidden;text-overflow:ellipsis;white-space:nowrap">`),kt=e=>{let[t,n]=$(0),[r,o]=$(0),i,s=e.x,a=e.y,l=e.x,f=e.y,m=null,g=false,b=()=>{s=me(s,l,.3),a=me(a,f,.3),o(A=>A+1),Math.abs(s-l)<.5&&Math.abs(a-f)<.5?m=null:m=requestAnimationFrame(b);},x=()=>{m===null&&(m=requestAnimationFrame(b));},S=()=>{if(l=e.x,f=e.y,!g){s=l,a=f,g=true,o(T=>T+1);return}x();};ne(Ee(()=>e.visible,T=>{if(T!==false)requestAnimationFrame(()=>{n(1);});else {n(0);return}if(e.variant==="success"){let A=setTimeout(()=>{n(0);},1700);ue(()=>clearTimeout(A));}})),ne(()=>{S();}),ue(()=>{m!==null&&(cancelAnimationFrame(m),m=null);});let C=()=>i?.getBoundingClientRect(),N=()=>{r();let T=C();if(!T)return {left:s,top:a};let A=window.innerWidth,R=window.innerHeight,_=[{left:Math.round(s)+14,top:Math.round(a)+14},{left:Math.round(s)-T.width-14,top:Math.round(a)+14},{left:Math.round(s)+14,top:Math.round(a)-T.height-14},{left:Math.round(s)-T.width-14,top:Math.round(a)-T.height-14}];for(let L of _){let re=L.left>=8&&L.left+T.width<=A-8,ie=L.top>=8&&L.top+T.height<=R-8;if(re&&ie)return L}let O=ft(_[0].left,_[0].top,T.width,T.height);return O.left+=4,O.top+=4,O};return k(q,{get when(){return e.visible!==false},get children(){var T=lo(),A=i;return typeof A=="function"?Re(A,T):i=T,ye(T,k(q,{get when(){return e.variant==="processing"},get children(){return k($n,{})}}),null),ye(T,k(q,{get when(){return e.variant==="success"},get children(){return oo()}}),null),ye(T,k(q,{get when(){return e.variant==="success"},get children(){return io()}}),null),ye(T,k(q,{get when(){return e.variant==="processing"},children:"Grabbing\u2026"}),null),ye(T,k(q,{get when(){return e.variant!=="processing"},get children(){var R=so();return ye(R,()=>e.text),R}}),null),ye(T,k(q,{get when(){return e.variant==="success"},get children(){return ao()}}),null),ae(R=>{var _=`${N().top}px`,O=`${N().left}px`,L=e.zIndex?.toString()??"2147483647",re=t();return _!==R.e&&pe(T,"top",R.e=_),O!==R.t&&pe(T,"left",R.t=O),L!==R.a&&pe(T,"z-index",R.a=L),re!==R.o&&pe(T,"opacity",R.o=re),R},{e:void 0,t:void 0,a:void 0,o:void 0}),T}})};var co=oe('<div style="position:fixed;z-index:2147483647;pointer-events:none;transition:opacity 0.1s ease-in-out"><div style="width:32px;height:2px;background-color:rgba(178, 28, 142, 0.2);border-radius:1px;overflow:hidden;position:relative"><div style="height:100%;background-color:#b21c8e;border-radius:1px;transition:width 0.05s cubic-bezier(0.165, 0.84, 0.44, 1)">'),uo=e=>{let[t,n]=$(0);return ne(Ee(()=>e,r=>{r!==false?requestAnimationFrame(()=>{n(1);}):n(0);})),t},In=e=>{let t=uo(e.visible),n,r=()=>{let o=n?.getBoundingClientRect();if(!o)return {left:e.mouseX,top:e.mouseY};let i=window.innerHeight,s=e.mouseX-o.width/2,a=e.mouseY+14+o.height+8>i?e.mouseY-o.height-14:e.mouseY+14;return ft(s,a,o.width,o.height)};return k(q,{get when(){return e.visible!==false},get children(){var o=co(),i=o.firstChild,s=i.firstChild,a=n;return typeof a=="function"?Re(a,o):n=o,ae(l=>{var f=`${r().top}px`,m=`${r().left}px`,g=t(),b=`${Math.min(100,Math.max(0,e.progress*100))}%`;return f!==l.e&&pe(o,"top",l.e=f),m!==l.t&&pe(o,"left",l.t=m),g!==l.a&&pe(o,"opacity",l.a=g),b!==l.o&&pe(s,"width",l.o=b),l},{e:void 0,t:void 0,a:void 0,o:void 0}),o}})};var fo=oe("<canvas style=position:fixed;top:0;left:0;pointer-events:none;z-index:2147483645>"),Mn=e=>{let t,n=null,r=0,o=0,i=1,s=e.mouseX,a=e.mouseY,l=e.mouseX,f=e.mouseY,m=null,g=false,b=()=>{t&&(i=Math.max(window.devicePixelRatio||1,2),r=window.innerWidth,o=window.innerHeight,t.width=r*i,t.height=o*i,t.style.width=`${r}px`,t.style.height=`${o}px`,n=t.getContext("2d"),n&&n.scale(i,i));},x=()=>{n&&(n.clearRect(0,0,r,o),n.strokeStyle="rgba(210, 57, 192)",n.lineWidth=1,n.beginPath(),n.moveTo(s,0),n.lineTo(s,o),n.moveTo(0,a),n.lineTo(r,a),n.stroke());},S=()=>{s=me(s,l,.3),a=me(a,f,.3),x(),Math.abs(s-l)<.5&&Math.abs(a-f)<.5?m=null:m=requestAnimationFrame(S);},C=()=>{m===null&&(m=requestAnimationFrame(S));},N=()=>{if(l=e.mouseX,f=e.mouseY,!g){s=l,a=f,g=true,x();return}C();};return ne(()=>{b(),x();let T=()=>{b(),x();};window.addEventListener("resize",T),ue(()=>{window.removeEventListener("resize",T),m!==null&&(cancelAnimationFrame(m),m=null);});}),ne(()=>{N();}),k(q,{get when(){return e.visible!==false},get children(){var T=fo(),A=t;return typeof A=="function"?Re(A,T):t=T,T}})};var Pn=e=>[k(q,{get when(){return Pe(()=>!!e.selectionVisible)()&&e.selectionBounds},get children(){return k(ut,{variant:"selection",get bounds(){return e.selectionBounds},get visible(){return e.selectionVisible}})}}),k(q,{get when(){return Pe(()=>e.crosshairVisible===true&&e.mouseX!==void 0)()&&e.mouseY!==void 0},get children(){return k(Mn,{get mouseX(){return e.mouseX},get mouseY(){return e.mouseY},visible:true})}}),k(q,{get when(){return Pe(()=>!!e.dragVisible)()&&e.dragBounds},get children(){return k(ut,{variant:"drag",get bounds(){return e.dragBounds},get visible(){return e.dragVisible}})}}),k(at,{get each(){return e.grabbedBoxes??[]},children:t=>k(ut,{variant:"grabbed",get bounds(){return t.bounds},get createdAt(){return t.createdAt}})}),k(at,{get each(){return e.successLabels??[]},children:t=>k(kt,{variant:"success",get text(){return t.text},get x(){return t.x},get y(){return t.y}})}),k(q,{get when(){return Pe(()=>!!(e.labelVisible&&e.labelVariant&&e.labelText&&e.labelX!==void 0))()&&e.labelY!==void 0},get children(){return k(kt,{get variant(){return e.labelVariant},get text(){return e.labelText},get x(){return e.labelX},get y(){return e.labelY},get visible(){return e.labelVisible},get zIndex(){return e.labelZIndex}})}}),k(q,{get when(){return Pe(()=>!!(e.progressVisible&&e.progress!==void 0&&e.mouseX!==void 0))()&&e.mouseY!==void 0},get children(){return k(In,{get progress(){return e.progress},get mouseX(){return e.mouseX},get mouseY(){return e.mouseY},get visible(){return e.progressVisible}})}})];var Hn="0.5.14",We=`bippy-${Hn}`,Ln=Object.defineProperty,mo=Object.prototype.hasOwnProperty,Xe=()=>{},Bn=e=>{try{Function.prototype.toString.call(e).indexOf("^_^")>-1&&setTimeout(()=>{throw Error("React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build")});}catch{}},It=(e=we())=>"getFiberRoots"in e,jn=false,Dn,ht=(e=we())=>jn?true:(typeof e.inject=="function"&&(Dn=e.inject.toString()),!!Dn?.includes("(injected)")),mt=new Set,Fe=new Set,Vn=e=>{let t=new Map,n=0,r={_instrumentationIsActive:false,_instrumentationSource:We,checkDCE:Bn,hasUnsupportedRendererAttached:false,inject(o){let i=++n;return t.set(i,o),Fe.add(o),r._instrumentationIsActive||(r._instrumentationIsActive=true,mt.forEach(s=>s())),i},on:Xe,onCommitFiberRoot:Xe,onCommitFiberUnmount:Xe,onPostCommitFiberRoot:Xe,renderers:t,supportsFiber:true,supportsFlight:true};try{Ln(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__",{configurable:!0,enumerable:!0,get(){return r},set(s){if(s&&typeof s=="object"){let a=r.renderers;r=s,a.size>0&&(a.forEach((l,f)=>{Fe.add(l),s.renderers.set(f,l);}),gt(e));}}});let o=window.hasOwnProperty,i=!1;Ln(window,"hasOwnProperty",{configurable:!0,value:function(...s){try{if(!i&&s[0]==="__REACT_DEVTOOLS_GLOBAL_HOOK__")return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,i=!0,-0}catch{}return o.apply(this,s)},writable:!0});}catch{gt(e);}return r},gt=e=>{e&&mt.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=Bn,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=We,t._instrumentationIsActive=!1;let n=It(t);if(n||(t.on=Xe),t.renderers.size){t._instrumentationIsActive=!0,mt.forEach(i=>i());return}let r=t.inject,o=ht(t);o&&!n&&(jn=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=i=>{let s=r(i);return Fe.add(i),o&&t.renderers.set(s,i),t._instrumentationIsActive=!0,mt.forEach(a=>a()),s};}(t.renderers.size||t._instrumentationIsActive||ht())&&e?.();}catch{}},Mt=()=>mo.call(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__"),we=e=>Mt()?(gt(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):Vn(e),Yn=()=>!!(typeof window<"u"&&(window.document?.createElement||window.navigator?.product==="ReactNative")),Pt=()=>{try{Yn()&&we();}catch{}};Pt();var pt=0,bt=1;var yt=5;var wt=11,Lt=13,Gn=14,St=15,Dt=16;var Ht=19;var Tt=26,Ct=27,Bt=28,jt=30;var Vt=e=>{switch(e.tag){case yt:case Tt:case Ct:return true;default:return typeof e.type=="string"}},Ke=e=>{switch(e.tag){case bt:case wt:case pt:case Gn:case St:return true;default:return false}};function De(e,t,n=false){return e&&t(e)instanceof Promise?Gt(e,t,n):Yt(e,t,n)}var Yt=(e,t,n=false)=>{if(!e)return null;if(t(e)===true)return e;let r=n?e.return:e.child;for(;r;){let o=Yt(r,t,n);if(o)return o;r=n?null:r.sibling;}return null},Gt=async(e,t,n=false)=>{if(!e)return null;if(await t(e)===true)return e;let r=n?e.return:e.child;for(;r;){let o=await Gt(r,t,n);if(o)return o;r=n?null:r.sibling;}return null};var Ut=e=>{let t=e;return typeof t=="function"?t:typeof t=="object"&&t?Ut(t.type||t.render):null},He=e=>{let t=e;if(typeof t=="string")return t;if(typeof t!="function"&&!(typeof t=="object"&&t))return null;let n=t.displayName||t.name||null;if(n)return n;let r=Ut(t);return r&&(r.displayName||r.name)||null};var zt=e=>{let t=e.alternate;if(!t)return e;if(t.actualStartTime&&e.actualStartTime)return t.actualStartTime>e.actualStartTime?t:e;for(let n of xt){let r=De(n.current,o=>{if(o===e)return true});if(r)return r}return e};var qt=e=>{let t=we(e.onActive);t._instrumentationSource=e.name??We;let n=t.onCommitFiberRoot;if(e.onCommitFiberRoot){let i=(s,a,l)=>{n!==i&&(n?.(s,a,l),e.onCommitFiberRoot?.(s,a,l));};t.onCommitFiberRoot=i;}let r=t.onCommitFiberUnmount;if(e.onCommitFiberUnmount){let i=(s,a)=>{t.onCommitFiberUnmount===i&&(r?.(s,a),e.onCommitFiberUnmount?.(s,a));};t.onCommitFiberUnmount=i;}let o=t.onPostCommitFiberRoot;if(e.onPostCommitFiberRoot){let i=(s,a)=>{t.onPostCommitFiberRoot===i&&(o?.(s,a),e.onPostCommitFiberRoot?.(s,a));};t.onPostCommitFiberRoot=i;}return t},Ze=e=>{let t=we();for(let n of t.renderers.values())try{let r=n.findFiberByHostInstance?.(e);if(r)return r}catch{}if(typeof e=="object"&&e){if("_reactRootContainer"in e)return e._reactRootContainer?._internalRoot?.current?.child;for(let n in e)if(n.startsWith("__reactContainer$")||n.startsWith("__reactInternalInstance$")||n.startsWith("__reactFiber"))return e[n]||null}return null},xt=new Set;var Co=Object.create,Jn=Object.defineProperty,xo=Object.getOwnPropertyDescriptor,vo=Object.getOwnPropertyNames,Eo=Object.getPrototypeOf,Ro=Object.prototype.hasOwnProperty,Oo=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),No=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=vo(t),i=0,s=o.length,a;i<s;i++)a=o[i],!Ro.call(e,a)&&a!==n&&Jn(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=xo(t,a))||r.enumerable});return e},_o=(e,t,n)=>(n=e==null?{}:Co(Eo(e)),No(Jn(n,"default",{value:e,enumerable:true}),e)),Ao=()=>{let e=we();for(let t of [...Array.from(Fe),...Array.from(e.renderers.values())]){let n=t.currentDispatcherRef;if(n&&typeof n=="object")return "H"in n?n.H:n.current}return null},Un=e=>{for(let t of Fe){let n=t.currentDispatcherRef;n&&typeof n=="object"&&("H"in n?n.H=e:n.current=e);}},Se=e=>`
|
|
10
|
+
in ${e}`,Fo=(e,t)=>{let n=Se(e);return t&&(n+=` (at ${t})`),n},Xt=false,Wt=(e,t)=>{if(!e||Xt)return "";let n=Error.prepareStackTrace;Error.prepareStackTrace=void 0,Xt=true;let r=Ao();Un(null);let o=console.error,i=console.warn;console.error=()=>{},console.warn=()=>{};try{let l={DetermineComponentFrameRoot(){let b;try{if(t){let x=function(){throw Error()};if(Object.defineProperty(x.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(x,[]);}catch(S){b=S;}Reflect.construct(e,[],x);}else {try{x.call();}catch(S){b=S;}e.call(x.prototype);}}else {try{throw Error()}catch(S){b=S;}let x=e();x&&typeof x.catch=="function"&&x.catch(()=>{});}}catch(x){if(x instanceof Error&&b instanceof Error&&typeof x.stack=="string")return [x.stack,b.stack]}return [null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot",Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name")?.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});let[m,g]=l.DetermineComponentFrameRoot();if(m&&g){let b=m.split(`
|
|
11
|
+
`),x=g.split(`
|
|
12
|
+
`),S=0,C=0;for(;S<b.length&&!b[S].includes("DetermineComponentFrameRoot");)S++;for(;C<x.length&&!x[C].includes("DetermineComponentFrameRoot");)C++;if(S===b.length||C===x.length)for(S=b.length-1,C=x.length-1;S>=1&&C>=0&&b[S]!==x[C];)C--;for(;S>=1&&C>=0;S--,C--)if(b[S]!==x[C]){if(S!==1||C!==1)do if(S--,C--,C<0||b[S]!==x[C]){let N=`
|
|
13
|
+
${b[S].replace(" at new "," at ")}`,T=He(e);return T&&N.includes("<anonymous>")&&(N=N.replace("<anonymous>",T)),N}while(S>=1&&C>=0);break}}}finally{Xt=false,Error.prepareStackTrace=n,Un(r),console.error=o,console.warn=i;}let s=e?He(e):"";return s?Se(s):""},$o=(e,t)=>{let n=e.tag,r="";switch(n){case Bt:r=Se("Activity");break;case bt:r=Wt(e.type,true);break;case wt:r=Wt(e.type.render,false);break;case pt:case St:r=Wt(e.type,false);break;case yt:case Tt:case Ct:r=Se(e.type);break;case Dt:r=Se("Lazy");break;case Lt:r=e.child!==t&&t!==null?Se("Suspense Fallback"):Se("Suspense");break;case Ht:r=Se("SuspenseList");break;case jt:r=Se("ViewTransition");break;default:return ""}return r},ko=e=>{try{let t="",n=e,r=null;do{t+=$o(n,r);let o=n._debugInfo;if(o&&Array.isArray(o))for(let i=o.length-1;i>=0;i--){let s=o[i];typeof s.name=="string"&&(t+=Fo(s.name,s.env));}r=n,n=n.return;}while(n);return t}catch(t){return t instanceof Error?`
|
|
27
14
|
Error generating stack: ${t.message}
|
|
28
|
-
${t.stack}`:""}},
|
|
15
|
+
${t.stack}`:""}},Io=e=>{let t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;let n=e;if(!n)return "";Error.prepareStackTrace=t,n.startsWith(`Error: react-stack-top-frame
|
|
29
16
|
`)&&(n=n.slice(29));let r=n.indexOf(`
|
|
30
17
|
`);if(r!==-1&&(n=n.slice(r+1)),r=Math.max(n.indexOf("react_stack_bottom_frame"),n.indexOf("react-stack-bottom-frame")),r!==-1&&(r=n.lastIndexOf(`
|
|
31
|
-
`,r)),r!==-1)n=n.slice(0,r);else return "";return n},
|
|
32
|
-
`),r=[];for(let o of n)if(/^\s*at\s+/.test(o)){let
|
|
33
|
-
`).filter(r=>!!r.match(
|
|
34
|
-
`).filter(r=>!r.match(
|
|
35
|
-
`),r;for(let s=n.length-1;s>=0&&!r;s--){let a=n[s].match(Zi);a&&(r=a[1]||a[2]);}if(!r)return null;let o=Zr.test(r);if(!(Ki.test(r)||o||r.startsWith("/"))){let s=e.split("/");s[s.length-1]=r,r=s.join("/");}return r},ta=e=>({file:e.file,mappings:(0, Kr.decode)(e.mappings),names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,version:3}),na=e=>{let t=e.sections.map(({map:r,offset:o})=>({map:{...r,mappings:(0, Kr.decode)(r.mappings)},offset:o})),n=new Set;for(let r of t)for(let o of r.map.sources)n.add(o);return {file:e.file,mappings:[],names:[],sections:t,sourceRoot:void 0,sources:Array.from(n),sourcesContent:void 0,version:3}},Vr=e=>{if(!e)return false;let t=e.trim();if(!t)return false;let n=t.match(Zr);if(!n)return true;let r=n[0].toLowerCase();return r==="http:"||r==="https:"},ra=async(e,t=fetch)=>{if(!Vr(e))return null;let n;try{n=await(await t(e)).text();}catch{return null}if(!n)return null;let r=ea(e,n);if(!r||!Vr(r))return null;try{let o=await t(r),s=await o.json();return "sections"in s?na(s):ta(s)}catch{return null}},oa=async(e,t=true,n)=>{if(t&&at.has(e)){let s=at.get(e);if(s==null)return null;if(Ji(s)){let a=s.deref();if(a)return a;at.delete(e);}else return s}if(t&&jt.has(e))return jt.get(e);let r=ra(e,n);t&&jt.set(e,r);let o=await r;return t&&jt.delete(e),t&&(o===null?at.set(e,null):at.set(e,Jr?new WeakRef(o):o)),o},Yr=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,sa=["rsc://","file:///","webpack://","node:","turbopack://","metro://"],Wr="about://React/",ia=["<anonymous>","eval",""],aa=/\.(jsx|tsx|ts|js)$/,la=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,ca=/^\?[\w~.\-]+(?:=[^&#]*)?(?:&[\w~.\-]+(?:=[^&#]*)?)*$/,ua=e=>e._debugStack instanceof Error&&typeof e._debugStack?.stack=="string",fa=e=>{let t=e._debugSource;return t?typeof t=="object"&&!!t&&"fileName"in t&&typeof t.fileName=="string"&&"lineNumber"in t&&typeof t.lineNumber=="number":false},da=async(e,t=true,n)=>{if(fa(e))return e._debugSource||null;let r=Qr(e);return eo(r,void 0,t,n)},Qr=e=>ua(e)?qi(e._debugStack.stack):Wi(e),ma=async(e,t=true,n)=>{let r=await eo(e,1,t,n);return !r||r.length===0?null:r[0]},eo=async(e,t=1,n=true,r)=>{let o=Gr(e,{slice:t??1}),s=[];for(let a of o){if(!a?.file)continue;let i=await oa(a.file,n,r);if(i&&typeof a.line=="number"&&typeof a.col=="number"){let l=Qi(i,a.line,a.col);if(l){s.push(l);continue}}s.push({fileName:a.file,lineNumber:a.line,columnNumber:a.col,functionName:a.function});}return s},We=e=>{if(!e||ia.includes(e))return "";let t=e;if(t.startsWith(Wr)){let r=t.slice(Wr.length),o=r.indexOf("/"),s=r.indexOf(":");t=o!==-1&&(s===-1||o<s)?r.slice(o+1):r;}for(let r of sa)if(t.startsWith(r)){t=t.slice(r.length),r==="file:///"&&(t=`/${t.replace(/^\/+/,"")}`);break}if(Yr.test(t)){let r=t.match(Yr);r&&(t=t.slice(r[0].length));}let n=t.indexOf("?");if(n!==-1){let r=t.slice(n);ca.test(r)&&(t=t.slice(0,n));}return t},Cn=e=>{let t=We(e);return !(!t||!aa.test(t)||la.test(t))},ga=async(e,t=true,n)=>{let r=Ve(e,a=>{if(st(a))return true},true);if(r){let a=await da(r,t,n);if(a?.fileName){let i=We(a.fileName);if(Cn(i))return {fileName:i,lineNumber:a.lineNumber,columnNumber:a.columnNumber,functionName:a.functionName}}}let o=Gr(Qr(e),{includeInElement:false}),s=null;for(;o.length;){let a=o.pop();if(!a||!a.raw||!a.file)continue;let i=await ma(a.raw,t,n);if(i)return {fileName:We(i.fileName),lineNumber:i.lineNumber,columnNumber:i.columnNumber,functionName:i.functionName};s={fileName:We(a.file),lineNumber:a.line,columnNumber:a.col,functionName:a.function};}return s},to=async(e,t=true,n)=>{let r=it(e);if(!r||!dn(r))return null;let o=pn(r);return o?ga(o,t,n):null};var ha=new Set(["role","name","aria-label","rel","href"]);function pa(e,t){let n=ha.has(e);n||=e.startsWith("data-")&<(e);let r=lt(t)&&t.length<100;return r||=t.startsWith("#")&<(t.slice(1)),n&&r}function ba(e){return lt(e)}function ya(e){return lt(e)}function wa(e){return true}function ro(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(e.tagName.toLowerCase()==="html")return "html";let n={root:document.body,idName:ba,className:ya,tagName:wa,attr:pa,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},r=new Date,o={...n,...t},s=va(o.root,n),a,i=0;for(let u of Sa(e,o,s)){if(new Date().getTime()-r.getTime()>o.timeoutMs||i>=o.maxNumberOfPathChecks){let d=Ta(e,s);if(!d)throw new Error(`Timeout: Can't find a unique selector after ${o.timeoutMs}ms`);return ct(d)}if(i++,vn(u,s)){a=u;break}}if(!a)throw new Error("Selector was not found.");let l=[...io(a,e,o,s,r)];return l.sort(Tn),l.length>0?ct(l[0]):ct(a)}function*Sa(e,t,n){let r=[],o=[],s=e,a=0;for(;s&&s!==n;){let i=Ca(s,t);for(let l of i)l.level=a;if(r.push(i),s=s.parentElement,a++,o.push(...so(r)),a>=t.seedMinLength){o.sort(Tn);for(let l of o)yield l;o=[];}}o.sort(Tn);for(let i of o)yield i;}function lt(e){if(/^[a-z\-]{3,}$/i.test(e)){let t=e.split(/-|[A-Z]/);for(let n of t)if(n.length<=2||/[^aeiou]{4,}/i.test(n))return false;return true}return false}function Ca(e,t){let n=[],r=e.getAttribute("id");r&&t.idName(r)&&n.push({name:"#"+CSS.escape(r),penalty:0});for(let a=0;a<e.classList.length;a++){let i=e.classList[a];t.className(i)&&n.push({name:"."+CSS.escape(i),penalty:1});}for(let a=0;a<e.attributes.length;a++){let i=e.attributes[a];t.attr(i.name,i.value)&&n.push({name:`[${CSS.escape(i.name)}="${CSS.escape(i.value)}"]`,penalty:2});}let o=e.tagName.toLowerCase();if(t.tagName(o)){n.push({name:o,penalty:5});let a=En(e,o);a!==void 0&&n.push({name:oo(o,a),penalty:10});}let s=En(e);return s!==void 0&&n.push({name:Ea(o,s),penalty:50}),n}function ct(e){let t=e[0],n=t.name;for(let r=1;r<e.length;r++){let o=e[r].level||0;t.level===o-1?n=`${e[r].name} > ${n}`:n=`${e[r].name} ${n}`,t=e[r];}return n}function no(e){return e.map(t=>t.penalty).reduce((t,n)=>t+n,0)}function Tn(e,t){return no(e)-no(t)}function En(e,t){let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let o=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&(t===void 0||r.tagName.toLowerCase()===t)&&o++,r!==e);)r=r.nextSibling;return o}function Ta(e,t){let n=0,r=e,o=[];for(;r&&r!==t;){let s=r.tagName.toLowerCase(),a=En(r,s);if(a===void 0)return;o.push({name:oo(s,a),penalty:NaN,level:n}),r=r.parentElement,n++;}if(vn(o,t))return o}function Ea(e,t){return e==="html"?"html":`${e}:nth-child(${t})`}function oo(e,t){return e==="html"?"html":`${e}:nth-of-type(${t})`}function*so(e,t=[]){if(e.length>0)for(let n of e[0])yield*so(e.slice(1,e.length),t.concat(n));else yield t;}function va(e,t){return e.nodeType===Node.DOCUMENT_NODE?e:e===t.root?e.ownerDocument:e}function vn(e,t){let n=ct(e);switch(t.querySelectorAll(n).length){case 0:throw new Error(`Can't select any node with this selector: ${n}`);case 1:return true;default:return false}}function*io(e,t,n,r,o){if(e.length>2&&e.length>n.optimizedMinLength)for(let s=1;s<e.length-1;s++){if(new Date().getTime()-o.getTime()>n.timeoutMs)return;let i=[...e];i.splice(s,1),vn(i,r)&&r.querySelector(ct(i))===t&&(yield i,yield*io(i,t,n,r,o));}}bn({onCommitFiberRoot(e,t){Bt.add(t);}});var xa=e=>ro(e),xn=async e=>{let t=(m,f)=>m.length>f?`${m.substring(0,f)}...`:m,n=m=>!!(m.startsWith("_")||m.includes("Provider")&&m.includes("Context")),r=m=>{let f=it(m);if(!f)return null;let b=null;return Ve(f,E=>{if(st(E)){let F=Ye(E);if(F&&!n(F))return b=F,true}return false},true),b},o=async m=>{let f=await to(m);if(!f)return null;let b=We(f.fileName);return Cn(b)?`${b}:${f.lineNumber}:${f.columnNumber}`:null},s=new Set(["article","aside","footer","form","header","main","nav","section"]),a=m=>{let f=m.tagName.toLowerCase();if(s.has(f)||m.id)return true;if(m.className&&typeof m.className=="string"){let b=m.className.trim();if(b&&b.length>0)return true}return Array.from(m.attributes).some(b=>b.name.startsWith("data-"))},i=(m,f=10)=>{let b=[],E=m.parentElement,F=0;for(;E&&F<f&&E.tagName!=="BODY"&&!(a(E)&&(b.push(E),b.length>=3));)E=E.parentElement,F++;return b.reverse()},l=(m,f=false)=>{let b=m.tagName.toLowerCase(),E=[];if(m.id&&E.push(`id="${m.id}"`),m.className&&typeof m.className=="string"){let k=m.className.trim().split(/\s+/);if(k.length>0&&k[0]){let j=f?k.slice(0,3):k,B=t(j.join(" "),30);E.push(`class="${B}"`);}}let F=Array.from(m.attributes).filter(k=>k.name.startsWith("data-")),H=f?F.slice(0,1):F;for(let k of H)E.push(`${k.name}="${t(k.value,20)}"`);let M=m.getAttribute("aria-label");return M&&!f&&E.push(`aria-label="${t(M,20)}"`),E.length>0?`<${b} ${E.join(" ")}>`:`<${b}>`},u=m=>`</${m.tagName.toLowerCase()}>`,c=m=>{let f=(m.textContent||"").trim().replace(/\s+/g," ");return t(f,60)},d=m=>{if(m.id)return `#${m.id}`;if(m.className&&typeof m.className=="string"){let f=m.className.trim().split(/\s+/);if(f.length>0&&f[0])return `.${f[0]}`}return null},g=[],p=xa(e);g.push("Locate this element in the codebase:"),g.push(`- selector: ${p}`);let S=e.getBoundingClientRect();g.push(`- width: ${Math.round(S.width)}`),g.push(`- height: ${Math.round(S.height)}`),g.push("HTML snippet:"),g.push("```html");let h=i(e),T=h.map(m=>r(m)),y=r(e),R=await Promise.all(h.map(m=>o(m))),v=await o(e);for(let m=0;m<h.length;m++){let f=" ".repeat(m),b=T[m],E=R[m];b&&E&&(m===0||T[m-1]!==b)&&g.push(`${f}<${b} source="${E}">`),g.push(`${f}${l(h[m],true)}`);}let N=e.parentElement,_=-1;if(N){let m=Array.from(N.children);if(_=m.indexOf(e),_>0){let f=m[_-1];if(d(f)&&_<=2){let E=" ".repeat(h.length);g.push(`${E} ${l(f,true)}`),g.push(`${E} </${f.tagName.toLowerCase()}>`);}else if(_>0){let E=" ".repeat(h.length);g.push(`${E} ... (${_} element${_===1?"":"s"})`);}}}let O=" ".repeat(h.length),X=h.length>0?T[T.length-1]:null,Q=y&&v&&y!==X;Q&&g.push(`${O} <${y} used-at="${v}">`),g.push(`${O} <!-- IMPORTANT: selected element -->`);let le=c(e),xe=e.children.length,x=`${O}${Q?" ":" "}`;if(le&&xe===0&&le.length<40?g.push(`${x}${l(e)}${le}${u(e)}`):(g.push(`${x}${l(e)}`),le&&g.push(`${x} ${le}`),xe>0&&g.push(`${x} ... (${xe} element${xe===1?"":"s"})`),g.push(`${x}${u(e)}`)),Q&&g.push(`${O} </${y}>`),N&&_>=0){let m=Array.from(N.children),f=m.length-_-1;if(f>0){let b=m[_+1];d(b)&&f<=2?(g.push(`${O} ${l(b,true)}`),g.push(`${O} </${b.tagName.toLowerCase()}>`)):g.push(`${O} ... (${f} element${f===1?"":"s"})`);}}for(let m=h.length-1;m>=0;m--){let f=" ".repeat(m);g.push(`${f}${u(h[m])}`);let b=T[m],E=R[m];b&&E&&(m===h.length-1||T[m+1]!==b)&&g.push(`${f}</${b}>`);}return g.push("```"),g.join(`
|
|
36
|
-
`)};var
|
|
37
|
-
${
|
|
38
|
-
</selected_element>`,
|
|
18
|
+
`,r)),r!==-1)n=n.slice(0,r);else return "";return n},Mo=/(^|@)\S+:\d+/,Qn=/^\s*at .*(\S+:\d+|\(native\))/m,Po=/^(eval@)?(\[native code\])?$/;var er=(e,t)=>{if(t?.includeInElement!==false){let n=e.split(`
|
|
19
|
+
`),r=[];for(let o of n)if(/^\s*at\s+/.test(o)){let i=zn(o,void 0)[0];i&&r.push(i);}else if(/^\s*in\s+/.test(o)){let i=o.replace(/^\s*in\s+/,"").replace(/\s*\(at .*\)$/,"");r.push({function:i,raw:o});}else if(o.match(Mo)){let i=qn(o,void 0)[0];i&&r.push(i);}return Kt(r,t)}return e.match(Qn)?zn(e,t):qn(e,t)},tr=e=>{if(!e.includes(":"))return [e,void 0,void 0];let t=/(.+?)(?::(\d+))?(?::(\d+))?$/,n=t.exec(e.replace(/[()]/g,""));return [n[1],n[2]||void 0,n[3]||void 0]},Kt=(e,t)=>t&&t.slice!=null?Array.isArray(t.slice)?e.slice(t.slice[0],t.slice[1]):e.slice(0,t.slice):e;var zn=(e,t)=>Kt(e.split(`
|
|
20
|
+
`).filter(r=>!!r.match(Qn)),t).map(r=>{let o=r;o.includes("(eval ")&&(o=o.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));let i=o.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),s=i.match(/ (\(.+\)$)/);i=s?i.replace(s[0],""):i;let a=tr(s?s[1]:i),l=s&&i||void 0,f=["eval","<anonymous>"].includes(a[0])?void 0:a[0];return {function:l,file:f,line:a[1]?+a[1]:void 0,col:a[2]?+a[2]:void 0,raw:o}});var qn=(e,t)=>Kt(e.split(`
|
|
21
|
+
`).filter(r=>!r.match(Po)),t).map(r=>{let o=r;if(o.includes(" > eval")&&(o=o.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),!o.includes("@")&&!o.includes(":"))return {function:o};{let i=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,s=o.match(i),a=s&&s[1]?s[1]:void 0,l=tr(o.replace(i,""));return {function:a,file:l[0],line:l[1]?+l[1]:void 0,col:l[2]?+l[2]:void 0,raw:o}}});var Lo=Oo((e,t)=>{(function(n,r){typeof e=="object"&&t!==void 0?r(e):typeof define=="function"&&define.amd?define(["exports"],r):(n=typeof globalThis<"u"?globalThis:n||self,r(n.sourcemapCodec={}));})(void 0,function(n){let r=44,o=59,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=new Uint8Array(64),a=new Uint8Array(128);for(let w=0;w<i.length;w++){let u=i.charCodeAt(w);s[w]=u,a[u]=w;}function l(w,u){let c=0,d=0,y=0;do{let D=w.next();y=a[D],c|=(y&31)<<d,d+=5;}while(y&32);let E=c&1;return c>>>=1,E&&(c=-2147483648|-c),u+c}function f(w,u,c){let d=u-c;d=d<0?-d<<1|1:d<<1;do{let y=d&31;d>>>=5,d>0&&(y|=32),w.write(s[y]);}while(d>0);return u}function m(w,u){return w.pos>=u?false:w.peek()!==r}let g=1024*16,b=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(w){return Buffer.from(w.buffer,w.byteOffset,w.byteLength).toString()}}:{decode(w){let u="";for(let c=0;c<w.length;c++)u+=String.fromCharCode(w[c]);return u}};class x{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(g);}write(u){let{buffer:c}=this;c[this.pos++]=u,this.pos===g&&(this.out+=b.decode(c),this.pos=0);}flush(){let{buffer:u,out:c,pos:d}=this;return d>0?c+b.decode(u.subarray(0,d)):c}}class S{constructor(u){this.pos=0,this.buffer=u;}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(u){let{buffer:c,pos:d}=this,y=c.indexOf(u,d);return y===-1?c.length:y}}let C=[];function N(w){let{length:u}=w,c=new S(w),d=[],y=[],E=0;for(;c.pos<u;c.pos++){E=l(c,E);let D=l(c,0);if(!m(c,u)){let U=y.pop();U[2]=E,U[3]=D;continue}let I=l(c,0),M=l(c,0),B=M&1,H=B?[E,D,0,0,I,l(c,0)]:[E,D,0,0,I],j=C;if(m(c,u)){j=[];do{let U=l(c,0);j.push(U);}while(m(c,u))}H.vars=j,d.push(H),y.push(H);}return d}function T(w){let u=new x;for(let c=0;c<w.length;)c=A(w,c,u,[0]);return u.flush()}function A(w,u,c,d){let y=w[u],{0:E,1:D,2:I,3:M,4:B,vars:H}=y;u>0&&c.write(r),d[0]=f(c,E,d[0]),f(c,D,0),f(c,B,0);let j=y.length===6?1:0;f(c,j,0),y.length===6&&f(c,y[5],0);for(let U of H)f(c,U,0);for(u++;u<w.length;){let U=w[u],{0:F,1:V}=U;if(F>I||F===I&&V>=M)break;u=A(w,u,c,d);}return c.write(r),d[0]=f(c,I,d[0]),f(c,M,0),u}function R(w){let{length:u}=w,c=new S(w),d=[],y=[],E=0,D=0,I=0,M=0,B=0,H=0,j=0,U=0;do{let F=c.indexOf(";"),V=0;for(;c.pos<F;c.pos++){if(V=l(c,V),!m(c,F)){let te=y.pop();te[2]=E,te[3]=V;continue}let J=l(c,0),$e=J&1,Oe=J&2,Ce=J&4,je=null,ke=C,ge;if($e){let te=l(c,D);I=l(c,D===te?I:0),D=te,ge=[E,V,0,0,te,I];}else ge=[E,V,0,0];if(ge.isScope=!!Ce,Oe){let te=M,de=B;M=l(c,M);let xe=te===M;B=l(c,xe?B:0),H=l(c,xe&&de===B?H:0),je=[M,B,H];}if(ge.callsite=je,m(c,F)){ke=[];do{j=E,U=V;let te=l(c,0),de;if(te<-1){de=[[l(c,0)]];for(let xe=-1;xe>te;xe--){let Ve=j;j=l(c,j),U=l(c,j===Ve?U:0);let Et=l(c,0);de.push([Et,j,U]);}}else de=[[te]];ke.push(de);}while(m(c,F))}ge.bindings=ke,d.push(ge),y.push(ge);}E++,c.pos=F+1;}while(c.pos<u);return d}function _(w){if(w.length===0)return "";let u=new x;for(let c=0;c<w.length;)c=O(w,c,u,[0,0,0,0,0,0,0]);return u.flush()}function O(w,u,c,d){let y=w[u],{0:E,1:D,2:I,3:M,isScope:B,callsite:H,bindings:j}=y;d[0]<E?(L(c,d[0],E),d[0]=E,d[1]=0):u>0&&c.write(r),d[1]=f(c,y[1],d[1]);let U=(y.length===6?1:0)|(H?2:0)|(B?4:0);if(f(c,U,0),y.length===6){let{4:F,5:V}=y;F!==d[2]&&(d[3]=0),d[2]=f(c,F,d[2]),d[3]=f(c,V,d[3]);}if(H){let{0:F,1:V,2:J}=y.callsite;F===d[4]?V!==d[5]&&(d[6]=0):(d[5]=0,d[6]=0),d[4]=f(c,F,d[4]),d[5]=f(c,V,d[5]),d[6]=f(c,J,d[6]);}if(j)for(let F of j){F.length>1&&f(c,-F.length,0);let V=F[0][0];f(c,V,0);let J=E,$e=D;for(let Oe=1;Oe<F.length;Oe++){let Ce=F[Oe];J=f(c,Ce[1],J),$e=f(c,Ce[2],$e),f(c,Ce[0],0);}}for(u++;u<w.length;){let F=w[u],{0:V,1:J}=F;if(V>I||V===I&&J>=M)break;u=O(w,u,c,d);}return d[0]<I?(L(c,d[0],I),d[0]=I,d[1]=0):c.write(r),d[1]=f(c,M,d[1]),u}function L(w,u,c){do w.write(o);while(++u<c)}function re(w){let{length:u}=w,c=new S(w),d=[],y=0,E=0,D=0,I=0,M=0;do{let B=c.indexOf(";"),H=[],j=true,U=0;for(y=0;c.pos<B;){let F;y=l(c,y),y<U&&(j=false),U=y,m(c,B)?(E=l(c,E),D=l(c,D),I=l(c,I),m(c,B)?(M=l(c,M),F=[y,E,D,I,M]):F=[y,E,D,I]):F=[y],H.push(F),c.pos++;}j||ie(H),d.push(H),c.pos=B+1;}while(c.pos<=u);return d}function ie(w){w.sort(le);}function le(w,u){return w[0]-u[0]}function Te(w){let u=new x,c=0,d=0,y=0,E=0;for(let D=0;D<w.length;D++){let I=w[D];if(D>0&&u.write(o),I.length===0)continue;let M=0;for(let B=0;B<I.length;B++){let H=I[B];B>0&&u.write(r),M=f(u,H[0],M),H.length!==1&&(c=f(u,H[1],c),d=f(u,H[2],d),y=f(u,H[3],y),H.length!==4&&(E=f(u,H[4],E)));}}return u.flush()}n.decode=re,n.decodeGeneratedRanges=R,n.decodeOriginalScopes=N,n.encode=Te,n.encodeGeneratedRanges=_,n.encodeOriginalScopes=T,Object.defineProperty(n,"__esModule",{value:true});});}),nr=_o(Lo()),rr=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,Do=/^data:application\/json[^,]+base64,/,Ho=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/,or=typeof WeakRef<"u",Je=new Map,vt=new Map,Bo=e=>or&&e instanceof WeakRef,Xn=(e,t,n,r)=>{if(n<0||n>=e.length)return null;let o=e[n];if(!o||o.length===0)return null;let i=null;for(let m of o)if(m[0]<=r)i=m;else break;if(!i||i.length<4)return null;let[,s,a,l]=i;if(s===void 0||a===void 0||l===void 0)return null;let f=t[s];return f?{columnNumber:l,fileName:f,lineNumber:a+1}:null},jo=(e,t,n)=>{if(e.sections){let r=null;for(let s of e.sections)if(t>s.offset.line||t===s.offset.line&&n>=s.offset.column)r=s;else break;if(!r)return null;let o=t-r.offset.line,i=t===r.offset.line?n-r.offset.column:n;return Xn(r.map.mappings,r.map.sources,o,i)}return Xn(e.mappings,e.sources,t-1,n)},Vo=(e,t)=>{let n=t.split(`
|
|
22
|
+
`),r;for(let i=n.length-1;i>=0&&!r;i--){let s=n[i].match(Ho);s&&(r=s[1]||s[2]);}if(!r)return null;let o=rr.test(r);if(!(Do.test(r)||o||r.startsWith("/"))){let i=e.split("/");i[i.length-1]=r,r=i.join("/");}return r},Yo=e=>({file:e.file,mappings:(0, nr.decode)(e.mappings),names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,version:3}),Go=e=>{let t=e.sections.map(({map:r,offset:o})=>({map:{...r,mappings:(0, nr.decode)(r.mappings)},offset:o})),n=new Set;for(let r of t)for(let o of r.map.sources)n.add(o);return {file:e.file,mappings:[],names:[],sections:t,sourceRoot:void 0,sources:Array.from(n),sourcesContent:void 0,version:3}},Wn=e=>{if(!e)return false;let t=e.trim();if(!t)return false;let n=t.match(rr);if(!n)return true;let r=n[0].toLowerCase();return r==="http:"||r==="https:"},Uo=async(e,t=fetch)=>{if(!Wn(e))return null;let n;try{n=await(await t(e)).text();}catch{return null}if(!n)return null;let r=Vo(e,n);if(!r||!Wn(r))return null;try{let o=await t(r),i=await o.json();return "sections"in i?Go(i):Yo(i)}catch{return null}},zo=async(e,t=true,n)=>{if(t&&Je.has(e)){let i=Je.get(e);if(i==null)return null;if(Bo(i)){let s=i.deref();if(s)return s;Je.delete(e);}else return i}if(t&&vt.has(e))return vt.get(e);let r=Uo(e,n);t&&vt.set(e,r);let o=await r;return t&&vt.delete(e),t&&(o===null?Je.set(e,null):Je.set(e,or?new WeakRef(o):o)),o},Kn=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,qo=["rsc://","file:///","webpack://","node:","turbopack://","metro://"],Zn="about://React/",Xo=["<anonymous>","eval",""],Wo=/\.(jsx|tsx|ts|js)$/,Ko=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,Zo=/^\?[\w~.\-]+(?:=[^&#]*)?(?:&[\w~.\-]+(?:=[^&#]*)?)*$/,Jo=e=>e._debugStack instanceof Error&&typeof e._debugStack?.stack=="string",Qo=e=>{let t=e._debugSource;return t?typeof t=="object"&&!!t&&"fileName"in t&&typeof t.fileName=="string"&&"lineNumber"in t&&typeof t.lineNumber=="number":false},ei=async(e,t=true,n)=>{if(Qo(e))return e._debugSource||null;let r=ir(e);return sr(r,void 0,t,n)},ir=e=>Jo(e)?Io(e._debugStack.stack):ko(e),ti=async(e,t=true,n)=>{let r=await sr(e,1,t,n);return !r||r.length===0?null:r[0]},sr=async(e,t=1,n=true,r)=>{let o=er(e,{slice:t??1}),i=[];for(let s of o){if(!s?.file)continue;let a=await zo(s.file,n,r);if(a&&typeof s.line=="number"&&typeof s.col=="number"){let l=jo(a,s.line,s.col);if(l){i.push(l);continue}}i.push({fileName:s.file,lineNumber:s.line,columnNumber:s.col,functionName:s.function});}return i},Be=e=>{if(!e||Xo.includes(e))return "";let t=e;if(t.startsWith(Zn)){let r=t.slice(Zn.length),o=r.indexOf("/"),i=r.indexOf(":");t=o!==-1&&(i===-1||o<i)?r.slice(o+1):r;}for(let r of qo)if(t.startsWith(r)){t=t.slice(r.length),r==="file:///"&&(t=`/${t.replace(/^\/+/,"")}`);break}if(Kn.test(t)){let r=t.match(Kn);r&&(t=t.slice(r[0].length));}let n=t.indexOf("?");if(n!==-1){let r=t.slice(n);Zo.test(r)&&(t=t.slice(0,n));}return t},Zt=e=>{let t=Be(e);return !(!t||!Wo.test(t)||Ko.test(t))},ni=async(e,t=true,n)=>{let r=De(e,s=>{if(Ke(s))return true},true);if(r){let s=await ei(r,t,n);if(s?.fileName){let a=Be(s.fileName);if(Zt(a))return {fileName:a,lineNumber:s.lineNumber,columnNumber:s.columnNumber,functionName:s.functionName}}}let o=er(ir(e),{includeInElement:false}),i=null;for(;o.length;){let s=o.pop();if(!s||!s.raw||!s.file)continue;let a=await ti(s.raw,t,n);if(a)return {fileName:Be(a.fileName),lineNumber:a.lineNumber,columnNumber:a.columnNumber,functionName:a.functionName};i={fileName:Be(s.file),lineNumber:s.line,columnNumber:s.col,functionName:s.function};}return i},ar=async(e,t=true,n)=>{let r=Ze(e);if(!r||!Vt(r))return null;let o=zt(r);return o?ni(o,t,n):null};var ri=new Set(["role","name","aria-label","rel","href"]);function oi(e,t){let n=ri.has(e);n||=e.startsWith("data-")&&Qe(e);let r=Qe(t)&&t.length<100;return r||=t.startsWith("#")&&Qe(t.slice(1)),n&&r}function ii(e){return Qe(e)}function si(e){return Qe(e)}function ai(e){return true}function cr(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(e.tagName.toLowerCase()==="html")return "html";let n={root:document.body,idName:ii,className:si,tagName:ai,attr:oi,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},r=new Date,o={...n,...t},i=di(o.root,n),s,a=0;for(let f of li(e,o,i)){if(new Date().getTime()-r.getTime()>o.timeoutMs||a>=o.maxNumberOfPathChecks){let g=ui(e,i);if(!g)throw new Error(`Timeout: Can't find a unique selector after ${o.timeoutMs}ms`);return et(g)}if(a++,en(f,i)){s=f;break}}if(!s)throw new Error("Selector was not found.");let l=[...dr(s,e,o,i,r)];return l.sort(Jt),l.length>0?et(l[0]):et(s)}function*li(e,t,n){let r=[],o=[],i=e,s=0;for(;i&&i!==n;){let a=ci(i,t);for(let l of a)l.level=s;if(r.push(a),i=i.parentElement,s++,o.push(...fr(r)),s>=t.seedMinLength){o.sort(Jt);for(let l of o)yield l;o=[];}}o.sort(Jt);for(let a of o)yield a;}function Qe(e){if(/^[a-z\-]{3,}$/i.test(e)){let t=e.split(/-|[A-Z]/);for(let n of t)if(n.length<=2||/[^aeiou]{4,}/i.test(n))return false;return true}return false}function ci(e,t){let n=[],r=e.getAttribute("id");r&&t.idName(r)&&n.push({name:"#"+CSS.escape(r),penalty:0});for(let s=0;s<e.classList.length;s++){let a=e.classList[s];t.className(a)&&n.push({name:"."+CSS.escape(a),penalty:1});}for(let s=0;s<e.attributes.length;s++){let a=e.attributes[s];t.attr(a.name,a.value)&&n.push({name:`[${CSS.escape(a.name)}="${CSS.escape(a.value)}"]`,penalty:2});}let o=e.tagName.toLowerCase();if(t.tagName(o)){n.push({name:o,penalty:5});let s=Qt(e,o);s!==void 0&&n.push({name:ur(o,s),penalty:10});}let i=Qt(e);return i!==void 0&&n.push({name:fi(o,i),penalty:50}),n}function et(e){let t=e[0],n=t.name;for(let r=1;r<e.length;r++){let o=e[r].level||0;t.level===o-1?n=`${e[r].name} > ${n}`:n=`${e[r].name} ${n}`,t=e[r];}return n}function lr(e){return e.map(t=>t.penalty).reduce((t,n)=>t+n,0)}function Jt(e,t){return lr(e)-lr(t)}function Qt(e,t){let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let o=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&(t===void 0||r.tagName.toLowerCase()===t)&&o++,r!==e);)r=r.nextSibling;return o}function ui(e,t){let n=0,r=e,o=[];for(;r&&r!==t;){let i=r.tagName.toLowerCase(),s=Qt(r,i);if(s===void 0)return;o.push({name:ur(i,s),penalty:NaN,level:n}),r=r.parentElement,n++;}if(en(o,t))return o}function fi(e,t){return e==="html"?"html":`${e}:nth-child(${t})`}function ur(e,t){return e==="html"?"html":`${e}:nth-of-type(${t})`}function*fr(e,t=[]){if(e.length>0)for(let n of e[0])yield*fr(e.slice(1,e.length),t.concat(n));else yield t;}function di(e,t){return e.nodeType===Node.DOCUMENT_NODE?e:e===t.root?e.ownerDocument:e}function en(e,t){let n=et(e);switch(t.querySelectorAll(n).length){case 0:throw new Error(`Can't select any node with this selector: ${n}`);case 1:return true;default:return false}}function*dr(e,t,n,r,o){if(e.length>2&&e.length>n.optimizedMinLength)for(let i=1;i<e.length-1;i++){if(new Date().getTime()-o.getTime()>n.timeoutMs)return;let a=[...e];a.splice(i,1),en(a,r)&&r.querySelector(et(a))===t&&(yield a,yield*dr(a,t,n,r,o));}}qt({onCommitFiberRoot(e,t){xt.add(t);}});var mi=e=>cr(e),tn=async e=>{let t=(u,c)=>u.length>c?`${u.substring(0,c)}...`:u,n=u=>!!(u.startsWith("_")||u.includes("Provider")&&u.includes("Context")),r=u=>{let c=Ze(u);if(!c)return null;let d=null;return De(c,y=>{if(Ke(y)){let E=He(y);if(E&&!n(E))return d=E,true}return false},true),d},o=async u=>{let c=await ar(u);if(!c)return null;let d=Be(c.fileName);return Zt(d)?`${d}:${c.lineNumber}:${c.columnNumber}`:null},i=new Set(["article","aside","footer","form","header","main","nav","section"]),s=u=>{let c=u.tagName.toLowerCase();if(i.has(c)||u.id)return true;if(u.className&&typeof u.className=="string"){let d=u.className.trim();if(d&&d.length>0)return true}return Array.from(u.attributes).some(d=>d.name.startsWith("data-"))},a=(u,c=10)=>{let d=[],y=u.parentElement,E=0;for(;y&&E<c&&y.tagName!=="BODY"&&!(s(y)&&(d.push(y),d.length>=3));)y=y.parentElement,E++;return d.reverse()},l=(u,c=false)=>{let d=u.tagName.toLowerCase(),y=[];if(u.id&&y.push(`id="${u.id}"`),u.className&&typeof u.className=="string"){let M=u.className.trim().split(/\s+/);if(M.length>0&&M[0]){let B=c?M.slice(0,3):M,H=t(B.join(" "),30);y.push(`class="${H}"`);}}let E=Array.from(u.attributes).filter(M=>M.name.startsWith("data-")),D=c?E.slice(0,1):E;for(let M of D)y.push(`${M.name}="${t(M.value,20)}"`);let I=u.getAttribute("aria-label");return I&&!c&&y.push(`aria-label="${t(I,20)}"`),y.length>0?`<${d} ${y.join(" ")}>`:`<${d}>`},f=u=>`</${u.tagName.toLowerCase()}>`,m=u=>{let c=(u.textContent||"").trim().replace(/\s+/g," ");return t(c,60)},g=u=>{if(u.id)return `#${u.id}`;if(u.className&&typeof u.className=="string"){let c=u.className.trim().split(/\s+/);if(c.length>0&&c[0])return `.${c[0]}`}return null},b=[],x=mi(e);b.push(`- selector: ${x}`);let S=e.getBoundingClientRect();b.push(`- width: ${Math.round(S.width)}`),b.push(`- height: ${Math.round(S.height)}`),b.push("HTML snippet:"),b.push("```html");let C=a(e),N=C.map(u=>r(u)),T=r(e),A=await Promise.all(C.map(u=>o(u))),R=await o(e);for(let u=0;u<C.length;u++){let c=" ".repeat(u),d=N[u],y=A[u];d&&y&&(u===0||N[u-1]!==d)&&b.push(`${c}<${d} source="${y}">`),b.push(`${c}${l(C[u],true)}`);}let _=e.parentElement,O=-1;if(_){let u=Array.from(_.children);if(O=u.indexOf(e),O>0){let c=u[O-1];if(g(c)&&O<=2){let y=" ".repeat(C.length);b.push(`${y} ${l(c,true)}`),b.push(`${y} </${c.tagName.toLowerCase()}>`);}else if(O>0){let y=" ".repeat(C.length);b.push(`${y} ... (${O} element${O===1?"":"s"})`);}}}let L=" ".repeat(C.length),re=C.length>0?N[N.length-1]:null,ie=T&&R&&T!==re;ie&&b.push(`${L} <${T} used-at="${R}">`),b.push(`${L} <!-- IMPORTANT: selected element -->`);let le=m(e),Te=e.children.length,w=`${L}${ie?" ":" "}`;if(le&&Te===0&&le.length<40?b.push(`${w}${l(e)}${le}${f(e)}`):(b.push(`${w}${l(e)}`),le&&b.push(`${w} ${le}`),Te>0&&b.push(`${w} ... (${Te} element${Te===1?"":"s"})`),b.push(`${w}${f(e)}`)),ie&&b.push(`${L} </${T}>`),_&&O>=0){let u=Array.from(_.children),c=u.length-O-1;if(c>0){let d=u[O+1];g(d)&&c<=2?(b.push(`${L} ${l(d,true)}`),b.push(`${L} </${d.tagName.toLowerCase()}>`)):b.push(`${L} ... (${c} element${c===1?"":"s"})`);}}for(let u=C.length-1;u>=0;u--){let c=" ".repeat(u);b.push(`${c}${f(C[u])}`);let d=N[u],y=A[u];d&&y&&(u===C.length-1||N[u+1]!==d)&&b.push(`${c}</${d}>`);}return b.push("```"),b.join(`
|
|
23
|
+
`)};var hi=()=>document.hasFocus()?new Promise(e=>setTimeout(e,50)):new Promise(e=>{let t=()=>{window.removeEventListener("focus",t),setTimeout(e,50);};window.addEventListener("focus",t),window.focus();}),nn=async e=>{await hi();try{if(Array.isArray(e)){if(!navigator?.clipboard?.write){for(let n of e)if(typeof n=="string"){let r=mr(n);if(!r)return r}return !0}let t=new Map;for(let n of e)if(n instanceof Blob){let r=n.type||"text/plain";t.has(r)||t.set(r,n);}else t.has("text/plain")||t.set("text/plain",new Blob([n],{type:"text/plain"}));return await navigator.clipboard.write([new ClipboardItem(Object.fromEntries(t))]),!0}else {if(e instanceof Blob)return await navigator.clipboard.write([new ClipboardItem({[e.type]:e})]),!0;try{return await navigator.clipboard.writeText(String(e)),!0}catch{return mr(e)}}}catch{return false}},mr=e=>{if(!document.execCommand)return false;let t=document.createElement("textarea");t.value=String(e),t.style.clipPath="inset(50%)",t.ariaHidden="true",(document.body||document.documentElement).append(t);try{return t.select(),document.execCommand("copy")}finally{t.remove();}};var hr=(e,t=window.getComputedStyle(e))=>t.display!=="none"&&t.visibility!=="hidden"&&t.opacity!=="0";var tt=e=>{if(e.closest(`[${Le}]`))return false;let t=window.getComputedStyle(e);return !(!hr(e,t)||t.pointerEvents==="none")};var rn=(e,t)=>{let n=document.elementsFromPoint(e,t);for(let r of n)if(tt(r))return r;return null};var gr=(e,t,n)=>{let r=[],o=Array.from(document.querySelectorAll("*")),i=e.x,s=e.y,a=e.x+e.width,l=e.y+e.height;for(let f of o){if(!n){let C=(f.tagName||"").toUpperCase();if(C==="HTML"||C==="BODY")continue}if(!t(f))continue;let m=f.getBoundingClientRect(),g=m.left,b=m.top,x=m.left+m.width,S=m.top+m.height;if(n){let C=Math.max(i,g),N=Math.max(s,b),T=Math.min(a,x),A=Math.min(l,S),R=Math.max(0,T-C),_=Math.max(0,A-N),O=R*_,L=Math.max(0,m.width*m.height);L>0&&O/L>=.75&&r.push(f);}else g<a&&x>i&&b<l&&S>s&&r.push(f);}return r},pr=e=>e.filter(t=>!e.some(n=>n!==t&&n.contains(t)));var br=(e,t)=>{let n=gr(e,t,true);return pr(n)},yr=(e,t)=>{let n=gr(e,t,false);return pr(n)};var on=e=>{let t=e.getBoundingClientRect(),n=window.getComputedStyle(e);return {borderRadius:n.borderRadius||"0px",height:t.height,transform:n.transform||"none",width:t.width,x:t.left,y:t.top}};var gi=150,wr=e=>{let t={enabled:true,keyHoldDuration:300,...e};return t.enabled===false?{activate:()=>{},deactivate:()=>{},toggle:()=>{},isActive:()=>false,dispose:()=>{}}:Ae(n=>{let[o,i]=$(false),[s,a]=$(-1e3),[l,f]=$(-1e3),[m,g]=$(false),[b,x]=$(-1e3),[S,C]=$(-1e3),[N,T]=$(false),[A,R]=$(null),[_,O]=$(null),[L,re]=$(0),[ie,le]=$([]),[Te,w]=$([]),[u,c]=$(false),[d,y]=$(false),[E,D]=$(false),[I,M]=$(-1e3),[B,H]=$(-1e3),j=null,U=null,F=null,V=null,J=z(()=>u()&&!N()),$e=z(()=>s()>-1e3&&l()>-1e3),Oe=h=>(h.metaKey||h.ctrlKey)&&h.key.toLowerCase()==="c",Ce=h=>{let v=`grabbed-${Date.now()}-${Math.random()}`,Y=Date.now(),W={id:v,bounds:h,createdAt:Y},Z=ie();le([...Z,W]),setTimeout(()=>{le(Q=>Q.filter(rt=>rt.id!==v));},1700);},je=(h,v,Y)=>{let W=`success-${Date.now()}-${Math.random()}`;w(Z=>[...Z,{id:W,text:h,x:v,y:Y}]),setTimeout(()=>{w(Z=>Z.filter(Q=>Q.id!==W));},1700);},ke=h=>`<selected_element>
|
|
24
|
+
${h}
|
|
25
|
+
</selected_element>`,ge=h=>{let v=window.getComputedStyle(h),Y=h.getBoundingClientRect();return {width:`${Math.round(Y.width)}px`,height:`${Math.round(Y.height)}px`,paddingTop:v.paddingTop,paddingRight:v.paddingRight,paddingBottom:v.paddingBottom,paddingLeft:v.paddingLeft,background:v.background,opacity:v.opacity}},te=h=>{let v={elements:h.map(Z=>({tagName:Z.tagName,content:Z.content,computedStyles:Z.computedStyles}))},W=`<div data-react-grab="${btoa(JSON.stringify(v))}"></div>`;return new Blob([W],{type:"text/html"})},de=h=>(h.tagName||"").toLowerCase(),xe=h=>{try{let v=h.map(Y=>({tagName:de(Y)}));window.dispatchEvent(new CustomEvent("react-grab:element-selected",{detail:{elements:v}}));}catch{}},Ve=async(h,v,Y)=>{M(h),H(v),T(true),await Y().finally(()=>{T(false);});},Et=async h=>{let v=de(h);Ce(on(h));try{let Y=await tn(h),W=ke(Y),Z=te([{tagName:v,content:Y,computedStyles:ge(h)}]);await nn([W,Z]);}catch{}je(v?`<${v}>`:"<element>",I(),B()),xe([h]);},sn=async h=>{if(h.length!==0){for(let v of h)Ce(on(v));try{let v=await Promise.all(h.map(Q=>tn(Q))),Y=v.filter(Q=>Q.trim()).map(Q=>ke(Q)).join(`
|
|
39
26
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
`),K=Se(L),J=A.map((De,Ge)=>({tagName:ze(w[Ge]),content:De,computedStyles:Re(w[Ge])})),se=dt(J),Pe=[K,se];if(w.length>0)try{let De=await tn(w[0]),Yt=await(await fetch(De)).blob(),Ao=new Blob([Yt],{type:"image/png"});Pe.push(Ao);}catch{}await Rn(Pe);}catch{}ne(`${w.length} elements`,j(),W());}},Oe=Y(()=>!me()||c()?null:Ut(a(),l())),po=Y(()=>{let w=Oe();if(!w)return;let A=w.getBoundingClientRect(),L=window.getComputedStyle(w);return {borderRadius:L.borderRadius||"0px",height:A.height,transform:L.transform||"none",width:A.width,x:A.left,y:A.top}}),gt=2,Fn=(w,A)=>({x:Math.abs(w-g()),y:Math.abs(A-S())}),On=Y(()=>{if(!c())return false;let w=Fn(a(),l());return w.x>gt||w.y>gt}),kn=(w,A)=>{let L=Math.min(g(),w),K=Math.min(S(),A),J=Math.abs(w-g()),se=Math.abs(A-S());return {x:L,y:K,width:J,height:se}},bo=Y(()=>{if(!On())return;let w=kn(a(),l());return {borderRadius:"0px",height:w.height,transform:"none",width:w.width,x:w.x,y:w.y}}),yo=Y(()=>{let w=Oe();return w?`<${ze(w)}>`:"<element>"}),In=Y(()=>T()?{x:j(),y:W()}:{x:a(),y:l()}),wo=Y(()=>!!(Oe()&&Oe()===R()));re(Ae(()=>[Oe(),R()],([w,A])=>{A&&w&&A!==w&&v(null);}));let $n=Y(()=>{let w=N();if(O(),w===null)return 0;let A=Date.now()-w;return Math.min(A/t.keyHoldDuration,1)}),So=()=>{_(Date.now()),E(false),ee=window.setTimeout(()=>{E(true),ee=null;},Na);let w=()=>{if(N()===null)return;X(L=>L+1),$n()<1&&(V=requestAnimationFrame(w));};w();},Vt=()=>{V!==null&&(cancelAnimationFrame(V),V=null),ee!==null&&(window.clearTimeout(ee),ee=null),_(null),E(false);},Pn=()=>{Vt(),f(true),document.body.style.cursor="crosshair";},ht=(w=true)=>{s(false),f(false),w&&k(false),document.body.style.cursor="",c()&&(d(false),document.body.style.userSelect=""),$&&window.clearTimeout($),ce&&window.clearTimeout(ce),Vt(),we=Date.now();},Dn=new AbortController,ke=Dn.signal;window.addEventListener("keydown",w=>{if((w.metaKey||w.ctrlKey)&&k(true),w.key==="Escape"&&o()){ht();return}if(!vr(w)&&qe(w)){let A=we!==null&&Date.now()-we<Aa;if(!o())if(s(true),A&&M()){Pn(),t.onActivate?.();let L=Ut(a(),l());L&&(v(L),mt(a(),l(),()=>An(L)));}else So(),$=window.setTimeout(()=>{Pn(),t.onActivate?.();},t.keyHoldDuration);m()&&(ce&&window.clearTimeout(ce),ce=window.setTimeout(()=>{ht();},200));}},{signal:ke}),window.addEventListener("keyup",w=>{let A=!w.metaKey&&!w.ctrlKey,L=w.key.toLowerCase()==="c";A&&k(false),!(!o()&&!m())&&(L?ht(false):A&&ht(true));},{signal:ke,capture:true}),window.addEventListener("mousemove",w=>{i(w.clientX),u(w.clientY);},{signal:ke}),window.addEventListener("mousedown",w=>{!me()||T()||(w.preventDefault(),d(true),p(w.clientX),h(w.clientY),document.body.style.userSelect="none");},{signal:ke}),window.addEventListener("mouseup",w=>{if(!c())return;let A=Fn(w.clientX,w.clientY),L=A.x>gt||A.y>gt;if(d(false),document.body.style.userSelect="",L){H(true);let K=kn(w.clientX,w.clientY),J=mo(K,ut);if(J.length>0)mt(w.clientX,w.clientY,()=>_n(J));else {let se=go(K,ut);se.length>0&&mt(w.clientX,w.clientY,()=>_n(se));}}else {let K=Ut(w.clientX,w.clientY);if(!K)return;v(K),mt(w.clientX,w.clientY,()=>An(K));}},{signal:ke}),window.addEventListener("click",w=>{F()&&(w.preventDefault(),w.stopPropagation(),H(false));},{signal:ke,capture:true}),document.addEventListener("visibilitychange",()=>{document.hidden&&le([]);},{signal:ke}),fe(()=>{Dn.abort(),$&&window.clearTimeout($),ce&&window.clearTimeout(ce),Vt(),document.body.style.userSelect="",document.body.style.cursor="";});let Co=xr(),To=Y(()=>false),Eo=Y(()=>me()&&On()),vo=Y(()=>T()?"processing":"hover"),xo=Y(()=>me()&&!c()&&(!!Oe()&&!wo()||!Oe())||T()),Ro=Y(()=>o()&&b()&&ft()),No=Y(()=>me()&&!c());return Jn(()=>P(Fr,{get selectionVisible(){return To()},get selectionBounds(){return po()},get dragVisible(){return Eo()},get dragBounds(){return bo()},get grabbedBoxes(){return Q()},get successLabels(){return xe()},get labelVariant(){return vo()},get labelText(){return yo()},get labelX(){return In().x},get labelY(){return In().y},get labelVisible(){return xo()},get progressVisible(){return Ro()},get progress(){return $n()},get mouseX(){return a()},get mouseY(){return l()},get crosshairVisible(){return No()}}),Co),n})};ho();/*! Bundled license information:
|
|
27
|
+
`),W=v.map((Q,rt)=>({tagName:de(h[rt]),content:Q,computedStyles:ge(h[rt])})),Z=te(W);await nn([Y,Z]);}catch{}je(`${h.length} elements`,I(),B()),xe(h);}},Ne=z(()=>!J()||m()?null:rn(s(),l())),Tr=z(()=>{let h=Ne();if(!h)return;let v=h.getBoundingClientRect(),Y=window.getComputedStyle(h);return {borderRadius:Y.borderRadius||"0px",height:v.height,transform:Y.transform||"none",width:v.width,x:v.left,y:v.top}}),nt=2,an=(h,v)=>({x:Math.abs(h-b()),y:Math.abs(v-S())}),ln=z(()=>{if(!m())return false;let h=an(s(),l());return h.x>nt||h.y>nt}),cn=(h,v)=>{let Y=Math.min(b(),h),W=Math.min(S(),v),Z=Math.abs(h-b()),Q=Math.abs(v-S());return {x:Y,y:W,width:Z,height:Q}},Cr=z(()=>{if(!ln())return;let h=cn(s(),l());return {borderRadius:"0px",height:h.height,transform:"none",width:h.width,x:h.x,y:h.y}}),xr=z(()=>{let h=Ne();return h?`<${de(h)}>`:"<element>"}),un=z(()=>N()?{x:I(),y:B()}:{x:s(),y:l()}),vr=z(()=>!!(Ne()&&Ne()===A()));ne(Ee(()=>[Ne(),A()],([h,v])=>{v&&h&&v!==h&&R(null);}));let fn=z(()=>{let h=_();if(L(),h===null)return 0;let v=Date.now()-h;return Math.min(v/t.keyHoldDuration,1)}),Er=()=>{O(Date.now()),y(false),F=window.setTimeout(()=>{y(true),F=null;},gi);let h=()=>{if(_()===null)return;re(Y=>Y+1),fn()<1&&(U=requestAnimationFrame(h));};h();},Rt=()=>{U!==null&&(cancelAnimationFrame(U),U=null),F!==null&&(window.clearTimeout(F),F=null),O(null),y(false);},Ot=()=>{Rt(),c(true),document.body.style.cursor="crosshair";},Ye=()=>{i(false),c(false),document.body.style.cursor="",m()&&(g(false),document.body.style.userSelect=""),j&&window.clearTimeout(j),V&&window.clearTimeout(V),Rt();},dn=new AbortController,_e=dn.signal;window.addEventListener("keydown",h=>{if(h.key==="Escape"&&o()){Ye();return}if(!An(h)&&Oe(h)){if(u()){V!==null&&window.clearTimeout(V),V=window.setTimeout(()=>{Ye();},200);return}h.repeat||(j!==null&&window.clearTimeout(j),o()||i(true),Er(),j=window.setTimeout(()=>{Ot(),t.onActivate?.();},t.keyHoldDuration));}},{signal:_e}),window.addEventListener("keyup",h=>{if(!o()&&!u())return;let v=!h.metaKey&&!h.ctrlKey;(h.key.toLowerCase()==="c"||v)&&Ye();},{signal:_e,capture:true}),window.addEventListener("mousemove",h=>{a(h.clientX),f(h.clientY);},{signal:_e}),window.addEventListener("mousedown",h=>{!J()||N()||(h.preventDefault(),g(true),x(h.clientX),C(h.clientY),document.body.style.userSelect="none");},{signal:_e}),window.addEventListener("mouseup",h=>{if(!m())return;let v=an(h.clientX,h.clientY),Y=v.x>nt||v.y>nt;if(g(false),document.body.style.userSelect="",Y){D(true);let W=cn(h.clientX,h.clientY),Z=br(W,tt);if(Z.length>0)Ve(h.clientX,h.clientY,()=>sn(Z));else {let Q=yr(W,tt);Q.length>0&&Ve(h.clientX,h.clientY,()=>sn(Q));}}else {let W=rn(h.clientX,h.clientY);if(!W)return;R(W),Ve(h.clientX,h.clientY,()=>Et(W));}},{signal:_e}),window.addEventListener("click",h=>{E()&&(h.preventDefault(),h.stopPropagation(),D(false));},{signal:_e,capture:true}),document.addEventListener("visibilitychange",()=>{document.hidden&&le([]);},{signal:_e}),ue(()=>{dn.abort(),j&&window.clearTimeout(j),V&&window.clearTimeout(V),Rt(),document.body.style.userSelect="",document.body.style.cursor="";});let Rr=Fn(),Or=z(()=>false),Nr=z(()=>J()&&ln()),_r=z(()=>N()?"processing":"hover"),Ar=z(()=>J()&&!m()&&(!!Ne()&&!vr()||!Ne())||N()),Fr=z(()=>o()&&d()&&$e()),$r=z(()=>J()&&!m());return Nn(()=>k(Pn,{get selectionVisible(){return Or()},get selectionBounds(){return Tr()},get dragVisible(){return Nr()},get dragBounds(){return Cr()},get grabbedBoxes(){return ie()},get successLabels(){return Te()},get labelVariant(){return _r()},get labelText(){return xr()},get labelX(){return un().x},get labelY(){return un().y},get labelVisible(){return Ar()},get progressVisible(){return Fr()},get progress(){return fn()},get mouseX(){return s()},get mouseY(){return l()},get crosshairVisible(){return $r()}}),Rr),{activate:()=>{u()||(Ot(),t.onActivate?.());},deactivate:()=>{u()&&Ye();},toggle:()=>{u()?Ye():(Ot(),t.onActivate?.());},isActive:()=>u(),dispose:n}})};var Sr=null,gl=()=>Sr;Sr=wr();/*! Bundled license information:
|
|
43
28
|
|
|
44
29
|
bippy/dist/rdt-hook-DAGphl8S.js:
|
|
45
30
|
(**
|
|
@@ -100,4 +85,4 @@ bippy/dist/source.js:
|
|
|
100
85
|
* This source code is licensed under the MIT license found in the
|
|
101
86
|
* LICENSE file in the root directory of this source tree.
|
|
102
87
|
*)
|
|
103
|
-
*/exports.init=
|
|
88
|
+
*/exports.getGlobalApi=gl;exports.init=wr;return exports;})({});
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { render, createComponent, memo, template, effect, style, insert, setStyleProperty, use } from 'solid-js/web';
|
|
2
2
|
import { createRoot, createSignal, createMemo, createEffect, on, onCleanup, Show, For, onMount } from 'solid-js';
|
|
3
|
-
import { domToPng } from 'modern-screenshot';
|
|
4
3
|
import { instrument, _fiberRoots, getFiberFromHostInstance, traverseFiber, isCompositeFiber, getDisplayName } from 'bippy';
|
|
5
4
|
import { getSourceFromHostInstance, normalizeFileName, isSourceFile } from 'bippy/dist/source';
|
|
6
5
|
import { finder } from '@medv/finder';
|
|
@@ -829,7 +828,6 @@ var getHTMLSnippet = async (element) => {
|
|
|
829
828
|
};
|
|
830
829
|
const lines = [];
|
|
831
830
|
const selector = generateCSSSelector(element);
|
|
832
|
-
lines.push(`Locate this element in the codebase:`);
|
|
833
831
|
lines.push(`- selector: ${selector}`);
|
|
834
832
|
const rect = element.getBoundingClientRect();
|
|
835
833
|
lines.push(`- width: ${Math.round(rect.width)}`);
|
|
@@ -936,11 +934,13 @@ var getHTMLSnippet = async (element) => {
|
|
|
936
934
|
|
|
937
935
|
// src/utils/copy-content.ts
|
|
938
936
|
var waitForFocus = () => {
|
|
939
|
-
if (document.hasFocus())
|
|
937
|
+
if (document.hasFocus()) {
|
|
938
|
+
return new Promise((resolve) => setTimeout(resolve, 50));
|
|
939
|
+
}
|
|
940
940
|
return new Promise((resolve) => {
|
|
941
941
|
const onFocus = () => {
|
|
942
942
|
window.removeEventListener("focus", onFocus);
|
|
943
|
-
resolve
|
|
943
|
+
setTimeout(resolve, 50);
|
|
944
944
|
};
|
|
945
945
|
window.addEventListener("focus", onFocus);
|
|
946
946
|
window.focus();
|
|
@@ -959,21 +959,24 @@ var copyContent = async (content) => {
|
|
|
959
959
|
}
|
|
960
960
|
return true;
|
|
961
961
|
}
|
|
962
|
+
const mimeTypeMap = /* @__PURE__ */ new Map();
|
|
963
|
+
for (const contentPart of content) {
|
|
964
|
+
if (contentPart instanceof Blob) {
|
|
965
|
+
const mimeType = contentPart.type || "text/plain";
|
|
966
|
+
if (!mimeTypeMap.has(mimeType)) {
|
|
967
|
+
mimeTypeMap.set(mimeType, contentPart);
|
|
968
|
+
}
|
|
969
|
+
} else {
|
|
970
|
+
if (!mimeTypeMap.has("text/plain")) {
|
|
971
|
+
mimeTypeMap.set(
|
|
972
|
+
"text/plain",
|
|
973
|
+
new Blob([contentPart], { type: "text/plain" })
|
|
974
|
+
);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
}
|
|
962
978
|
await navigator.clipboard.write([
|
|
963
|
-
new ClipboardItem(
|
|
964
|
-
Object.fromEntries(
|
|
965
|
-
content.map((contentPart) => {
|
|
966
|
-
if (contentPart instanceof Blob) {
|
|
967
|
-
return [contentPart.type ?? "text/plain", contentPart];
|
|
968
|
-
} else {
|
|
969
|
-
return [
|
|
970
|
-
"text/plain",
|
|
971
|
-
new Blob([contentPart], { type: "text/plain" })
|
|
972
|
-
];
|
|
973
|
-
}
|
|
974
|
-
})
|
|
975
|
-
)
|
|
976
|
-
)
|
|
979
|
+
new ClipboardItem(Object.fromEntries(mimeTypeMap))
|
|
977
980
|
]);
|
|
978
981
|
return true;
|
|
979
982
|
} else if (content instanceof Blob) {
|
|
@@ -1091,57 +1094,14 @@ var removeNestedElements = (elements) => {
|
|
|
1091
1094
|
);
|
|
1092
1095
|
});
|
|
1093
1096
|
};
|
|
1094
|
-
var findBestParentElement = (elements, dragRect, isValidGrabbableElement2) => {
|
|
1095
|
-
if (elements.length <= 1) return null;
|
|
1096
|
-
const dragLeft = dragRect.x;
|
|
1097
|
-
const dragTop = dragRect.y;
|
|
1098
|
-
const dragRight = dragRect.x + dragRect.width;
|
|
1099
|
-
const dragBottom = dragRect.y + dragRect.height;
|
|
1100
|
-
let currentParent = elements[0];
|
|
1101
|
-
while (currentParent) {
|
|
1102
|
-
const parent = currentParent.parentElement;
|
|
1103
|
-
if (!parent) break;
|
|
1104
|
-
const parentRect = parent.getBoundingClientRect();
|
|
1105
|
-
const intersectionLeft = Math.max(dragLeft, parentRect.left);
|
|
1106
|
-
const intersectionTop = Math.max(dragTop, parentRect.top);
|
|
1107
|
-
const intersectionRight = Math.min(dragRight, parentRect.left + parentRect.width);
|
|
1108
|
-
const intersectionBottom = Math.min(dragBottom, parentRect.top + parentRect.height);
|
|
1109
|
-
const intersectionWidth = Math.max(0, intersectionRight - intersectionLeft);
|
|
1110
|
-
const intersectionHeight = Math.max(0, intersectionBottom - intersectionTop);
|
|
1111
|
-
const intersectionArea = intersectionWidth * intersectionHeight;
|
|
1112
|
-
const parentArea = Math.max(0, parentRect.width * parentRect.height);
|
|
1113
|
-
const hasMajorityCoverage = parentArea > 0 && intersectionArea / parentArea >= DRAG_COVERAGE_THRESHOLD;
|
|
1114
|
-
if (!hasMajorityCoverage) break;
|
|
1115
|
-
if (!isValidGrabbableElement2(parent)) {
|
|
1116
|
-
currentParent = parent;
|
|
1117
|
-
continue;
|
|
1118
|
-
}
|
|
1119
|
-
const allChildrenInParent = elements.every(
|
|
1120
|
-
(element) => parent.contains(element)
|
|
1121
|
-
);
|
|
1122
|
-
if (allChildrenInParent) {
|
|
1123
|
-
return parent;
|
|
1124
|
-
}
|
|
1125
|
-
currentParent = parent;
|
|
1126
|
-
}
|
|
1127
|
-
return null;
|
|
1128
|
-
};
|
|
1129
1097
|
var getElementsInDrag = (dragRect, isValidGrabbableElement2) => {
|
|
1130
1098
|
const elements = filterElementsInDrag(dragRect, isValidGrabbableElement2, true);
|
|
1131
1099
|
const uniqueElements = removeNestedElements(elements);
|
|
1132
|
-
const bestParent = findBestParentElement(uniqueElements, dragRect, isValidGrabbableElement2);
|
|
1133
|
-
if (bestParent) {
|
|
1134
|
-
return [bestParent];
|
|
1135
|
-
}
|
|
1136
1100
|
return uniqueElements;
|
|
1137
1101
|
};
|
|
1138
1102
|
var getElementsInDragLoose = (dragRect, isValidGrabbableElement2) => {
|
|
1139
1103
|
const elements = filterElementsInDrag(dragRect, isValidGrabbableElement2, false);
|
|
1140
1104
|
const uniqueElements = removeNestedElements(elements);
|
|
1141
|
-
const bestParent = findBestParentElement(uniqueElements, dragRect, isValidGrabbableElement2);
|
|
1142
|
-
if (bestParent) {
|
|
1143
|
-
return [bestParent];
|
|
1144
|
-
}
|
|
1145
1105
|
return uniqueElements;
|
|
1146
1106
|
};
|
|
1147
1107
|
|
|
@@ -1161,7 +1121,6 @@ var createElementBounds = (element) => {
|
|
|
1161
1121
|
|
|
1162
1122
|
// src/core.tsx
|
|
1163
1123
|
var PROGRESS_INDICATOR_DELAY_MS = 150;
|
|
1164
|
-
var QUICK_REPRESS_THRESHOLD_MS = 150;
|
|
1165
1124
|
var init = (rawOptions) => {
|
|
1166
1125
|
const options = {
|
|
1167
1126
|
enabled: true,
|
|
@@ -1169,7 +1128,17 @@ var init = (rawOptions) => {
|
|
|
1169
1128
|
...rawOptions
|
|
1170
1129
|
};
|
|
1171
1130
|
if (options.enabled === false) {
|
|
1172
|
-
return
|
|
1131
|
+
return {
|
|
1132
|
+
activate: () => {
|
|
1133
|
+
},
|
|
1134
|
+
deactivate: () => {
|
|
1135
|
+
},
|
|
1136
|
+
toggle: () => {
|
|
1137
|
+
},
|
|
1138
|
+
isActive: () => false,
|
|
1139
|
+
dispose: () => {
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1173
1142
|
}
|
|
1174
1143
|
return createRoot((dispose) => {
|
|
1175
1144
|
const OFFSCREEN_POSITION = -1e3;
|
|
@@ -1188,14 +1157,12 @@ var init = (rawOptions) => {
|
|
|
1188
1157
|
const [isActivated, setIsActivated] = createSignal(false);
|
|
1189
1158
|
const [showProgressIndicator, setShowProgressIndicator] = createSignal(false);
|
|
1190
1159
|
const [didJustDrag, setDidJustDrag] = createSignal(false);
|
|
1191
|
-
const [isModifierHeld, setIsModifierHeld] = createSignal(false);
|
|
1192
1160
|
const [copyStartX, setCopyStartX] = createSignal(OFFSCREEN_POSITION);
|
|
1193
1161
|
const [copyStartY, setCopyStartY] = createSignal(OFFSCREEN_POSITION);
|
|
1194
1162
|
let holdTimerId = null;
|
|
1195
1163
|
let progressAnimationId = null;
|
|
1196
1164
|
let progressDelayTimerId = null;
|
|
1197
1165
|
let keydownSpamTimerId = null;
|
|
1198
|
-
let lastDeactivationTime = null;
|
|
1199
1166
|
const isRendererActive = createMemo(() => isActivated() && !isCopying());
|
|
1200
1167
|
const hasValidMousePosition = createMemo(() => mouseX() > OFFSCREEN_POSITION && mouseY() > OFFSCREEN_POSITION);
|
|
1201
1168
|
const isTargetKeyCombination = (event) => (event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "c";
|
|
@@ -1257,6 +1224,19 @@ ${context}
|
|
|
1257
1224
|
});
|
|
1258
1225
|
};
|
|
1259
1226
|
const extractElementTagName = (element) => (element.tagName || "").toLowerCase();
|
|
1227
|
+
const notifyElementsSelected = (elements) => {
|
|
1228
|
+
try {
|
|
1229
|
+
const elementsPayload = elements.map((element) => ({
|
|
1230
|
+
tagName: extractElementTagName(element)
|
|
1231
|
+
}));
|
|
1232
|
+
window.dispatchEvent(new CustomEvent("react-grab:element-selected", {
|
|
1233
|
+
detail: {
|
|
1234
|
+
elements: elementsPayload
|
|
1235
|
+
}
|
|
1236
|
+
}));
|
|
1237
|
+
} catch {
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1260
1240
|
const executeCopyOperation = async (positionX, positionY, operation) => {
|
|
1261
1241
|
setCopyStartX(positionX);
|
|
1262
1242
|
setCopyStartY(positionY);
|
|
@@ -1276,21 +1256,11 @@ ${context}
|
|
|
1276
1256
|
content,
|
|
1277
1257
|
computedStyles: extractRelevantComputedStyles(targetElement2)
|
|
1278
1258
|
}]);
|
|
1279
|
-
|
|
1280
|
-
try {
|
|
1281
|
-
const screenshotDataUrl = await domToPng(targetElement2);
|
|
1282
|
-
const response = await fetch(screenshotDataUrl);
|
|
1283
|
-
const pngBlob = await response.blob();
|
|
1284
|
-
const imagePngBlob = new Blob([pngBlob], {
|
|
1285
|
-
type: "image/png"
|
|
1286
|
-
});
|
|
1287
|
-
clipboardData.push(imagePngBlob);
|
|
1288
|
-
} catch {
|
|
1289
|
-
}
|
|
1290
|
-
await copyContent(clipboardData);
|
|
1259
|
+
await copyContent([plainTextContent, htmlContent]);
|
|
1291
1260
|
} catch {
|
|
1292
1261
|
}
|
|
1293
1262
|
showTemporarySuccessLabel(tagName ? `<${tagName}>` : "<element>", copyStartX(), copyStartY());
|
|
1263
|
+
notifyElementsSelected([targetElement2]);
|
|
1294
1264
|
};
|
|
1295
1265
|
const copyMultipleElementsToClipboard = async (targetElements) => {
|
|
1296
1266
|
if (targetElements.length === 0) return;
|
|
@@ -1299,31 +1269,18 @@ ${context}
|
|
|
1299
1269
|
}
|
|
1300
1270
|
try {
|
|
1301
1271
|
const elementSnippets = await Promise.all(targetElements.map((element) => getHTMLSnippet(element)));
|
|
1302
|
-
const
|
|
1303
|
-
const plainTextContent = wrapInSelectedElementTags(combinedContent);
|
|
1272
|
+
const plainTextContent = elementSnippets.filter((snippet) => snippet.trim()).map((snippet) => wrapInSelectedElementTags(snippet)).join("\n\n");
|
|
1304
1273
|
const structuredElements = elementSnippets.map((content, index) => ({
|
|
1305
1274
|
tagName: extractElementTagName(targetElements[index]),
|
|
1306
1275
|
content,
|
|
1307
1276
|
computedStyles: extractRelevantComputedStyles(targetElements[index])
|
|
1308
1277
|
}));
|
|
1309
1278
|
const htmlContent = createStructuredClipboardHtmlBlob(structuredElements);
|
|
1310
|
-
|
|
1311
|
-
if (targetElements.length > 0) {
|
|
1312
|
-
try {
|
|
1313
|
-
const screenshotDataUrl = await domToPng(targetElements[0]);
|
|
1314
|
-
const response = await fetch(screenshotDataUrl);
|
|
1315
|
-
const pngBlob = await response.blob();
|
|
1316
|
-
const imagePngBlob = new Blob([pngBlob], {
|
|
1317
|
-
type: "image/png"
|
|
1318
|
-
});
|
|
1319
|
-
clipboardData.push(imagePngBlob);
|
|
1320
|
-
} catch {
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
await copyContent(clipboardData);
|
|
1279
|
+
await copyContent([plainTextContent, htmlContent]);
|
|
1324
1280
|
} catch {
|
|
1325
1281
|
}
|
|
1326
1282
|
showTemporarySuccessLabel(`${targetElements.length} elements`, copyStartX(), copyStartY());
|
|
1283
|
+
notifyElementsSelected(targetElements);
|
|
1327
1284
|
};
|
|
1328
1285
|
const targetElement = createMemo(() => {
|
|
1329
1286
|
if (!isRendererActive() || isDragging()) return null;
|
|
@@ -1435,12 +1392,9 @@ ${context}
|
|
|
1435
1392
|
setIsActivated(true);
|
|
1436
1393
|
document.body.style.cursor = "crosshair";
|
|
1437
1394
|
};
|
|
1438
|
-
const deactivateRenderer = (
|
|
1395
|
+
const deactivateRenderer = () => {
|
|
1439
1396
|
setIsHoldingKeys(false);
|
|
1440
1397
|
setIsActivated(false);
|
|
1441
|
-
if (shouldResetModifier) {
|
|
1442
|
-
setIsModifierHeld(false);
|
|
1443
|
-
}
|
|
1444
1398
|
document.body.style.cursor = "";
|
|
1445
1399
|
if (isDragging()) {
|
|
1446
1400
|
setIsDragging(false);
|
|
@@ -1449,60 +1403,46 @@ ${context}
|
|
|
1449
1403
|
if (holdTimerId) window.clearTimeout(holdTimerId);
|
|
1450
1404
|
if (keydownSpamTimerId) window.clearTimeout(keydownSpamTimerId);
|
|
1451
1405
|
stopProgressAnimation();
|
|
1452
|
-
lastDeactivationTime = Date.now();
|
|
1453
1406
|
};
|
|
1454
1407
|
const abortController = new AbortController();
|
|
1455
1408
|
const eventListenerSignal = abortController.signal;
|
|
1456
1409
|
window.addEventListener("keydown", (event) => {
|
|
1457
|
-
if (event.metaKey || event.ctrlKey) {
|
|
1458
|
-
setIsModifierHeld(true);
|
|
1459
|
-
}
|
|
1460
1410
|
if (event.key === "Escape" && isHoldingKeys()) {
|
|
1461
1411
|
deactivateRenderer();
|
|
1462
1412
|
return;
|
|
1463
1413
|
}
|
|
1464
1414
|
if (isKeyboardEventTriggeredByInput(event)) return;
|
|
1465
|
-
if (isTargetKeyCombination(event))
|
|
1466
|
-
|
|
1467
|
-
if (
|
|
1468
|
-
|
|
1469
|
-
if (wasRecentlyDeactivated && isModifierHeld()) {
|
|
1470
|
-
activateRenderer();
|
|
1471
|
-
options.onActivate?.();
|
|
1472
|
-
const element = getElementAtPosition(mouseX(), mouseY());
|
|
1473
|
-
if (element) {
|
|
1474
|
-
setLastGrabbedElement(element);
|
|
1475
|
-
void executeCopyOperation(mouseX(), mouseY(), () => copySingleElementToClipboard(element));
|
|
1476
|
-
}
|
|
1477
|
-
} else {
|
|
1478
|
-
startProgressAnimation();
|
|
1479
|
-
holdTimerId = window.setTimeout(() => {
|
|
1480
|
-
activateRenderer();
|
|
1481
|
-
options.onActivate?.();
|
|
1482
|
-
}, options.keyHoldDuration);
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
if (isActivated()) {
|
|
1486
|
-
if (keydownSpamTimerId) window.clearTimeout(keydownSpamTimerId);
|
|
1487
|
-
keydownSpamTimerId = window.setTimeout(() => {
|
|
1488
|
-
deactivateRenderer();
|
|
1489
|
-
}, 200);
|
|
1415
|
+
if (!isTargetKeyCombination(event)) return;
|
|
1416
|
+
if (isActivated()) {
|
|
1417
|
+
if (keydownSpamTimerId !== null) {
|
|
1418
|
+
window.clearTimeout(keydownSpamTimerId);
|
|
1490
1419
|
}
|
|
1420
|
+
keydownSpamTimerId = window.setTimeout(() => {
|
|
1421
|
+
deactivateRenderer();
|
|
1422
|
+
}, 200);
|
|
1423
|
+
return;
|
|
1491
1424
|
}
|
|
1425
|
+
if (event.repeat) return;
|
|
1426
|
+
if (holdTimerId !== null) {
|
|
1427
|
+
window.clearTimeout(holdTimerId);
|
|
1428
|
+
}
|
|
1429
|
+
if (!isHoldingKeys()) {
|
|
1430
|
+
setIsHoldingKeys(true);
|
|
1431
|
+
}
|
|
1432
|
+
startProgressAnimation();
|
|
1433
|
+
holdTimerId = window.setTimeout(() => {
|
|
1434
|
+
activateRenderer();
|
|
1435
|
+
options.onActivate?.();
|
|
1436
|
+
}, options.keyHoldDuration);
|
|
1492
1437
|
}, {
|
|
1493
1438
|
signal: eventListenerSignal
|
|
1494
1439
|
});
|
|
1495
1440
|
window.addEventListener("keyup", (event) => {
|
|
1441
|
+
if (!isHoldingKeys() && !isActivated()) return;
|
|
1496
1442
|
const isReleasingModifier = !event.metaKey && !event.ctrlKey;
|
|
1497
1443
|
const isReleasingC = event.key.toLowerCase() === "c";
|
|
1498
|
-
if (isReleasingModifier) {
|
|
1499
|
-
|
|
1500
|
-
}
|
|
1501
|
-
if (!isHoldingKeys() && !isActivated()) return;
|
|
1502
|
-
if (isReleasingC) {
|
|
1503
|
-
deactivateRenderer(false);
|
|
1504
|
-
} else if (isReleasingModifier) {
|
|
1505
|
-
deactivateRenderer(true);
|
|
1444
|
+
if (isReleasingC || isReleasingModifier) {
|
|
1445
|
+
deactivateRenderer();
|
|
1506
1446
|
}
|
|
1507
1447
|
}, {
|
|
1508
1448
|
signal: eventListenerSignal,
|
|
@@ -1633,11 +1573,35 @@ ${context}
|
|
|
1633
1573
|
return crosshairVisible();
|
|
1634
1574
|
}
|
|
1635
1575
|
}), rendererRoot);
|
|
1636
|
-
return
|
|
1576
|
+
return {
|
|
1577
|
+
activate: () => {
|
|
1578
|
+
if (!isActivated()) {
|
|
1579
|
+
activateRenderer();
|
|
1580
|
+
options.onActivate?.();
|
|
1581
|
+
}
|
|
1582
|
+
},
|
|
1583
|
+
deactivate: () => {
|
|
1584
|
+
if (isActivated()) {
|
|
1585
|
+
deactivateRenderer();
|
|
1586
|
+
}
|
|
1587
|
+
},
|
|
1588
|
+
toggle: () => {
|
|
1589
|
+
if (isActivated()) {
|
|
1590
|
+
deactivateRenderer();
|
|
1591
|
+
} else {
|
|
1592
|
+
activateRenderer();
|
|
1593
|
+
options.onActivate?.();
|
|
1594
|
+
}
|
|
1595
|
+
},
|
|
1596
|
+
isActive: () => isActivated(),
|
|
1597
|
+
dispose
|
|
1598
|
+
};
|
|
1637
1599
|
});
|
|
1638
1600
|
};
|
|
1639
1601
|
|
|
1640
1602
|
// src/index.ts
|
|
1641
|
-
|
|
1603
|
+
var globalApi = null;
|
|
1604
|
+
var getGlobalApi = () => globalApi;
|
|
1605
|
+
globalApi = init();
|
|
1642
1606
|
|
|
1643
|
-
export { init };
|
|
1607
|
+
export { getGlobalApi, init };
|