@uibot/page-annotation 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{SOURCE.md → README.md} +17 -15
- package/dist/{vendor → core}/composer.d.ts +1 -1
- package/dist/{vendor → core}/geometry.d.ts +1 -1
- package/dist/core/index.d.ts +10 -0
- package/dist/core/inject.d.ts +1 -0
- package/dist/{vendor → core}/marks.d.ts +23 -23
- package/dist/{vendor → core}/model.d.ts +18 -18
- package/dist/{vendor → core}/normalize.d.ts +1 -1
- package/dist/{vendor → core}/runtime/capture.d.ts +2 -2
- package/dist/core/runtime/entry.d.ts +3 -0
- package/dist/{vendor → core}/runtime/in-page-host.d.ts +1 -1
- package/dist/core/runtime/index.d.ts +10 -0
- package/dist/{vendor → core}/runtime/overlay-marks.d.ts +1 -1
- package/dist/{vendor → core}/runtime/overlay.d.ts +2 -2
- package/dist/{vendor → core}/runtime/performance.d.ts +2 -2
- package/dist/{vendor → core}/runtime/ports.d.ts +2 -2
- package/dist/{vendor → core}/runtime/protocol.d.ts +16 -16
- package/dist/core/runtime/styles.d.ts +2 -0
- package/dist/{vendor → core}/select.d.ts +2 -2
- package/dist/{vendor → core}/store.d.ts +1 -1
- package/dist/{vendor → core}/theme.d.ts +1 -1
- package/dist/{vendor → core}/types.d.ts +1 -1
- package/dist/guest.d.ts +21 -0
- package/dist/guest.js +2 -0
- package/dist/host.d.ts +1 -1
- package/dist/host.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +13 -13
- package/dist/uibot/controller.d.ts +2 -2
- package/dist/uibot/format.d.ts +1 -1
- package/dist/uibot/inject.d.ts +1 -1
- package/dist/uibot/overlay-adapter.d.ts +1 -1
- package/dist/uibot/theme.d.ts +1 -1
- package/dist/uibot/validation.d.ts +1 -1
- package/package.json +10 -3
- package/dist/vendor/index.d.ts +0 -10
- package/dist/vendor/inject.d.ts +0 -2
- package/dist/vendor/runtime/entry.d.ts +0 -3
- package/dist/vendor/runtime/index.d.ts +0 -10
- package/dist/vendor/runtime/styles.d.ts +0 -2
- /package/dist/{vendor → core}/runtime/overlay-drag.d.ts +0 -0
- /package/dist/{vendor → core}/runtime/scheduler.d.ts +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type { WebAnnotationDraft } from
|
|
2
|
-
import type { AnnotationTheme } from
|
|
1
|
+
import type { WebAnnotationDraft } from "../model.js";
|
|
2
|
+
import type { AnnotationTheme } from "../theme.js";
|
|
3
3
|
/** Stable host/runtime contract. Keep browser and UI adapters behind this surface. */
|
|
4
4
|
export declare const ANNOTATION_ACTIONS: {
|
|
5
|
-
readonly start:
|
|
6
|
-
readonly teardown:
|
|
7
|
-
readonly save:
|
|
8
|
-
readonly enrich:
|
|
9
|
-
readonly closed:
|
|
10
|
-
readonly list:
|
|
11
|
-
readonly update:
|
|
12
|
-
readonly remove:
|
|
13
|
-
readonly clear:
|
|
14
|
-
readonly changed:
|
|
15
|
-
readonly reveal:
|
|
5
|
+
readonly start: "annotation:start";
|
|
6
|
+
readonly teardown: "annotation:teardown";
|
|
7
|
+
readonly save: "annotation:save";
|
|
8
|
+
readonly enrich: "annotation:enrich";
|
|
9
|
+
readonly closed: "annotation:overlay-closed";
|
|
10
|
+
readonly list: "annotation:list";
|
|
11
|
+
readonly update: "annotation:update";
|
|
12
|
+
readonly remove: "annotation:remove";
|
|
13
|
+
readonly clear: "annotation:clear";
|
|
14
|
+
readonly changed: "annotation:changed";
|
|
15
|
+
readonly reveal: "annotation:reveal";
|
|
16
16
|
};
|
|
17
17
|
export type AnnotationAction = (typeof ANNOTATION_ACTIONS)[keyof typeof ANNOTATION_ACTIONS];
|
|
18
18
|
export interface AnnotationRuntimeOptions {
|
|
@@ -39,8 +39,8 @@ export type AnnotationRuntimeControlMessage = {
|
|
|
39
39
|
};
|
|
40
40
|
export declare function isAnnotationRuntimeControlMessage(message: unknown): message is AnnotationRuntimeControlMessage;
|
|
41
41
|
/** Guest console / snapshot marks. Keep these host-local — not page content. */
|
|
42
|
-
export declare const ANNOTATION_CHANGED_MARK = "
|
|
43
|
-
export declare const ANNOTATION_CLOSED_MARK = "
|
|
44
|
-
export declare const ANNOTATION_CAPTURE_MARK = "
|
|
42
|
+
export declare const ANNOTATION_CHANGED_MARK = "__uibot-annotation:changed";
|
|
43
|
+
export declare const ANNOTATION_CLOSED_MARK = "__uibot-annotation:closed";
|
|
44
|
+
export declare const ANNOTATION_CAPTURE_MARK = "__uibot-annotation:capture";
|
|
45
45
|
/** Page identity shared by storage, overlay and chrome grouping. */
|
|
46
46
|
export declare function normalizePageUrl(url: string): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** Static Shadow DOM stylesheet kept separate from overlay state and event orchestration. */
|
|
2
|
+
export declare const ANNOTATION_OVERLAY_STYLES = "\n *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",system-ui,sans-serif;}\n .hl{position:fixed;border:2px solid var(--pa-accent, #7c2d34);background:var(--pa-accent-soft, rgba(124,45,52,0.10));border-radius:4px;\n pointer-events:none;transition:all .04s linear;z-index:1;box-shadow:0 0 0 1px var(--pa-outline, rgba(255,255,255,0.4));}\n .tag{position:fixed;background:var(--pa-accent, #7c2d34);color:var(--pa-accent-contrast, #f1f0ed);font-size:11px;line-height:1.4;font-weight:500;\n padding:2px 7px;border-radius:5px;pointer-events:none;white-space:nowrap;z-index:2;}\n .bar{position:fixed;top:14px;left:50%;transform:translateX(-50%);background:var(--pa-surface, rgba(23,23,26,0.94));\n color:var(--pa-surface-contrast, #fff);font-size:12.5px;padding:6px 6px 6px 8px;border-radius:999px;pointer-events:auto;\n z-index:5;display:flex;gap:8px;align-items:center;box-shadow:0 8px 24px var(--pa-shadow, rgba(0,0,0,0.28));}\n .bar .grip{display:flex;align-items:center;justify-content:center;width:18px;height:22px;padding:0;\n border:none;background:transparent;color:var(--pa-muted, rgba(255,255,255,0.72));cursor:grab;touch-action:none;}\n .bar .grip:hover,.bar .grip.dragging{color:var(--pa-surface-contrast, #fff);background:transparent;}\n .bar .grip.dragging{cursor:grabbing;}\n .bar button{background:var(--pa-hover, rgba(255,255,255,0.14));color:var(--pa-surface-contrast, #fff);border:none;border-radius:999px;\n padding:4px 11px;font-size:12px;cursor:pointer;transition:background .12s;}\n .bar button:hover{background:var(--pa-hover, rgba(255,255,255,0.26));}\n .bar button.exit{width:28px;height:28px;padding:0;display:flex;align-items:center;justify-content:center;}\n\n @keyframes uibotpop{from{opacity:0;transform:translateY(4px) scale(.98);}to{opacity:1;transform:none;}}\n\n .dd{position:relative;}\n .dd-btn{width:100%;display:flex;align-items:center;gap:6px;border:1px solid var(--pa-border, #e6d6bf);border-radius:9px;\n padding:7px 10px;font-size:12.5px;color:var(--pa-popover-contrast, #3b3024);background:var(--pa-popover, #fff);cursor:pointer;transition:border-color .12s,box-shadow .12s;}\n .dd-btn:hover{border-color:var(--pa-border, #d2bd9c);}\n .dd-btn.open{border-color:var(--pa-accent, #7c2d34);box-shadow:0 0 0 3px var(--pa-focus, rgba(124,45,52,0.14));}\n .dd-btn .v{flex:1;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:flex;align-items:center;gap:6px;}\n .dd-btn .chev{font-size:9px;color:var(--pa-muted, #b69b73);transition:transform .12s;}\n .dd-btn.open .chev{transform:rotate(180deg);}\n .dd-menu{position:absolute;left:0;right:0;top:calc(100% + 4px);background:var(--pa-popover, #fff);border:1px solid var(--pa-border, #ecdcc4);\n border-radius:10px;box-shadow:0 10px 28px var(--pa-shadow, rgba(60,40,15,0.18));padding:4px;z-index:10;max-height:208px;overflow:auto;}\n .dd-item{width:100%;display:flex;align-items:center;gap:7px;text-align:left;border:none;background:transparent;\n border-radius:7px;padding:7px 9px;font-size:12.5px;color:var(--pa-popover-contrast, #3b3024);cursor:pointer;}\n .dd-item:hover{background:var(--pa-hover, #f6ecdb);}\n .dd-item.sel{background:var(--pa-selected, #f1f0ed);color:var(--pa-accent-contrast, #7c2d34);font-weight:500;}\n .swatch{width:8px;height:8px;border-radius:50%;flex-shrink:0;}\n\n .toast{position:fixed;bottom:22px;left:50%;transform:translateX(-50%);color:var(--pa-surface-contrast, #fff);font-size:12.5px;\n padding:8px 16px;border-radius:999px;pointer-events:none;z-index:7;box-shadow:0 6px 20px var(--pa-shadow, rgba(0,0,0,0.2));}\n .pin{position:fixed;width:21px;height:21px;border-radius:50% 50% 50% 2px;background:var(--pa-accent, #7c2d34);color:var(--pa-accent-contrast, #f1f0ed);\n font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center;\n pointer-events:none;z-index:3;box-shadow:0 2px 6px var(--pa-shadow, rgba(0,0,0,0.3));}\n .pin.marker{pointer-events:auto;cursor:pointer;transition:transform .1s;}\n .pin.marker:hover{transform:scale(1.18);}\n .flash{position:fixed;border:3px solid var(--pa-accent, #7c2d34);border-radius:4px;pointer-events:none;z-index:4;\n animation:uibotflash 1.2s ease-out forwards;}\n @keyframes uibotflash{0%{box-shadow:0 0 0 5px var(--pa-accent-halo, rgba(124,45,52,0.45));}100%{box-shadow:0 0 0 5px var(--pa-accent-halo, rgba(124,45,52,0));}}\n .selbox{position:fixed;border:2px solid var(--pa-accent, #7c2d34);border-radius:4px;pointer-events:none;z-index:2;\n box-shadow:0 0 0 1px var(--pa-outline, rgba(241,240,237,0.35));background:var(--pa-accent-soft, rgba(124,45,52,0.06));}\n .pin.active{background:var(--pa-accent, #7c2d34);}\n .region-box{position:fixed;border:2px solid var(--pa-accent, #7c2d34);background:var(--pa-accent-soft, rgba(124,45,52,.10));pointer-events:none;z-index:3;display:none;}\n .region-size{position:absolute;right:0;bottom:-24px;background:var(--pa-surface, #17171a);color:var(--pa-surface-contrast, #f1f0ed);border-radius:999px;padding:3px 7px;font-size:11px;white-space:nowrap;}\n .sr-live{position:fixed;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}\n .mark-layer{position:fixed;inset:0;pointer-events:none;z-index:4;}\n .mark-layer .mark-svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible;}\n .mark-text{position:fixed;font-size:15px;font-weight:700;line-height:1.2;pointer-events:none;white-space:pre;\n text-shadow:0 1px 2px var(--pa-shadow, rgba(0,0,0,.75)),0 0 8px var(--pa-shadow, rgba(0,0,0,.45));z-index:4;}\n .mark-text.editing{pointer-events:auto;min-width:72px;background:var(--pa-surface, rgba(23,23,26,.9));border:1px solid var(--pa-border, rgba(255,255,255,.24));\n border-radius:6px;padding:4px 8px;outline:none;font:inherit;}\n .mark-dock{position:fixed;top:58px;left:50%;transform:translateX(-50%);background:var(--pa-surface, rgba(23,23,26,0.94));color:var(--pa-surface-contrast, #fff);\n padding:6px 8px;border-radius:14px;pointer-events:auto;z-index:5;display:flex;gap:8px;align-items:center;\n flex-wrap:wrap;max-width:calc(100vw - 16px);box-shadow:0 8px 24px var(--pa-shadow, rgba(0,0,0,0.28));}\n .mark-dock[hidden]{display:none;}\n .mark-seg{display:flex;background:var(--pa-field, rgba(255,255,255,0.12));border-radius:999px;padding:2px;gap:2px;}\n .mark-seg button{width:28px;height:26px;padding:0;display:flex;align-items:center;justify-content:center;\n background:transparent;border:none;color:var(--pa-muted, rgba(255,255,255,.72));border-radius:999px;cursor:pointer;}\n .mark-seg button.on{background:var(--pa-selected, #f1f0ed);color:var(--pa-accent-contrast, #17171a);}\n .mark-colors{display:flex;gap:5px;align-items:center;}\n .mark-color{width:16px;height:16px;border-radius:50%;border:2px solid transparent;padding:0;cursor:pointer;\n box-shadow:inset 0 0 0 1px var(--pa-shadow, rgba(0,0,0,.28));}\n .mark-color.on{border-color:var(--pa-surface-contrast, #fff);}\n .mark-size{display:flex;align-items:center;gap:2px;background:var(--pa-field, rgba(255,255,255,0.12));border-radius:999px;padding:2px 4px;}\n .mark-size button{width:22px;height:22px;padding:0;border:none;border-radius:999px;background:transparent;\n color:var(--pa-surface-contrast, #fff);cursor:pointer;font-size:14px;line-height:1;}\n .mark-size button:hover:not(:disabled){background:var(--pa-hover, rgba(255,255,255,0.16));}\n .mark-size button:disabled{opacity:.34;cursor:default;}\n .mark-size .v{min-width:22px;text-align:center;font-size:11px;font-variant-numeric:tabular-nums;color:var(--pa-surface-contrast, #f1f0ed);}\n .mark-comment{width:120px;height:28px;border:1px solid var(--pa-border, rgba(255,255,255,.18));background:var(--pa-field, rgba(0,0,0,.25));\n color:var(--pa-surface-contrast, #f1f0ed);border-radius:8px;padding:0 8px;font-size:12px;outline:none;}\n .mark-save{width:28px;height:28px;border:none;border-radius:50%;background:var(--pa-selected, #f1f0ed);color:var(--pa-accent-contrast, #17171a);cursor:pointer;font-size:15px;}\n .mark-save:disabled{opacity:.45;cursor:default;}\n :host(.capturing) .bar,:host(.capturing) .mark-dock,:host(.capturing) .epanel,:host(.capturing) .pin,\n :host(.capturing) .toast,:host(.capturing) .hl,:host(.capturing) .tag,:host(.capturing) .region-box,\n :host(.capturing) .region-size{visibility:hidden!important;}\n\n .seg{display:flex;background:var(--pa-field, rgba(255,255,255,0.12));border-radius:999px;padding:2px;}\n .seg button{background:transparent;border:none;color:var(--pa-muted, rgba(255,255,255,0.72));padding:3px 12px;\n border-radius:999px;font-size:12px;cursor:pointer;transition:background .12s,color .12s;}\n .seg button.on{background:var(--pa-selected, #f1f0ed);color:var(--pa-accent-contrast, #17171a);font-weight:600;}\n\n .epanel{position:fixed;width:340px;max-width:94vw;background:var(--pa-surface, #17171a);border:1px solid var(--pa-border, #3a352f);\n border-radius:16px;box-shadow:0 18px 48px var(--pa-shadow, rgba(0,0,0,0.5));pointer-events:auto;z-index:6;\n color:var(--pa-surface-contrast, #f1f0ed);overflow:hidden;animation:uibotpop .12s ease-out;}\n .epanel .etop{display:flex;align-items:center;gap:9px;padding:11px 13px;border-bottom:1px solid var(--pa-border, #332f29);}\n .epanel .etop .ico{flex-shrink:0;color:var(--pa-muted, #b9b1a4);font-size:15px;}\n .epanel .etop input{flex:1;background:transparent;border:none;outline:none;color:var(--pa-surface-contrast, #ece7df);font-size:13.5px;}\n .epanel .etop input::placeholder{color:var(--pa-muted, #8a8275);}\n .epanel .etop textarea{flex:1;background:transparent;border:none;outline:none;color:var(--pa-surface-contrast, #ece7df);font-size:13.5px;\n resize:none;font-family:inherit;line-height:1.45;max-height:96px;padding:0;}\n .epanel .etop textarea::placeholder{color:var(--pa-muted, #8a8275);}\n .epanel .ehead{display:flex;align-items:center;padding:8px 14px 4px;color:var(--pa-surface-contrast, #cfc8bb);font-size:12.5px;cursor:move;user-select:none;}\n .epanel .ehead .tg{font-family:ui-monospace,Menlo,monospace;color:var(--pa-surface-contrast, #e7e0d4);}\n .epanel .ehead .grip{margin-left:auto;color:var(--pa-muted, #6f685c);letter-spacing:2px;font-size:12px;}\n .erows{max-height:46vh;overflow:auto;padding:2px 0 4px;}\n .erow{display:flex;align-items:center;gap:10px;padding:6px 14px;}\n .erow>span.lb{width:64px;flex-shrink:0;font-size:12.5px;color:var(--pa-muted, #a9a194);}\n .erow .ctl{flex:1;min-width:0;}\n .efield{width:100%;display:flex;align-items:center;gap:8px;background:var(--pa-field, #1d1b19);border:1px solid var(--pa-border, #3a352f);\n border-radius:9px;padding:7px 10px;transition:border-color .12s;}\n .efield:focus-within{border-color:var(--pa-accent, #7c2d34);}\n .efield input{flex:1;min-width:0;background:transparent;border:none;outline:none;color:var(--pa-surface-contrast, #ece7df);\n font-size:12.5px;font-family:ui-monospace,Menlo,monospace;}\n .sw{width:22px;height:22px;border-radius:50%;flex-shrink:0;border:1px solid var(--pa-border, rgba(255,255,255,0.28));cursor:pointer;\n background-image:linear-gradient(45deg,var(--pa-checker, #555) 25%,transparent 25%),linear-gradient(-45deg,var(--pa-checker, #555) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--pa-checker, #555) 75%),linear-gradient(-45deg,transparent 75%,var(--pa-checker, #555) 75%);\n background-size:8px 8px;background-position:0 0,0 4px,4px -4px,-4px 0;position:relative;overflow:hidden;}\n .sw i{position:absolute;inset:0;border-radius:50%;}\n .sw:focus-within{outline:2px solid var(--pa-selected, #f1f0ed);outline-offset:2px;}\n .color-hit{position:absolute;inset:0;width:100%!important;height:100%;opacity:0;cursor:pointer;pointer-events:auto;}\n .stepper{display:grid;grid-template-columns:30px minmax(48px,1fr) auto 30px;align-items:center;gap:4px;padding:3px;}\n .stepper button{width:30px;height:30px;border:0;border-radius:7px;background:var(--pa-field, #2b2723);color:var(--pa-surface-contrast, #ece7df);cursor:pointer;\n display:flex;align-items:center;justify-content:center;transition:background .12s,color .12s;}\n .stepper button:hover:not(:disabled){background:var(--pa-hover, #3b352e);color:var(--pa-surface-contrast, #fff);}\n .stepper button:disabled{opacity:.34;cursor:default;}\n .stepper button svg{width:14px;height:14px;pointer-events:none;}\n .stepper input[type=number]{width:100%;text-align:center;font-variant-numeric:tabular-nums;appearance:textfield;}\n .stepper input[type=number]::-webkit-inner-spin-button,.stepper input[type=number]::-webkit-outer-spin-button{appearance:none;margin:0;}\n .stepper .unit{min-width:18px;color:var(--pa-muted, #8a8275);font-size:11px;text-align:left;}\n .ebar{display:flex;align-items:center;padding:11px 14px;border-top:1px solid var(--pa-border, #332f29);gap:10px;}\n .ebar .cancel{background:transparent;border:1px solid var(--pa-border, #4a443c);color:var(--pa-surface-contrast, #cfc8bb);border-radius:999px;\n padding:6px 16px;font-size:13px;cursor:pointer;transition:background .12s;}\n .ebar .cancel:hover{background:var(--pa-hover, rgba(255,255,255,0.06));}\n .ebar .ok{margin-left:auto;width:36px;height:36px;border-radius:50%;background:var(--pa-selected, #f1f0ed);color:var(--pa-accent-contrast, #17171a);border:none;\n cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:17px;line-height:1;transition:background .12s;}\n .ebar .ok:hover{background:var(--pa-hover, #f0ece4);}\n .ebar .ok:disabled{opacity:.55;cursor:default;}\n .epanel .dd-btn{background:var(--pa-field, #1d1b19);border-color:var(--pa-border, #3a352f);color:var(--pa-surface-contrast, #ece7df);}\n .epanel .dd-btn:hover{border-color:var(--pa-border, #5a5347);}\n .epanel .dd-btn.open{border-color:var(--pa-accent, #7c2d34);box-shadow:0 0 0 3px var(--pa-focus, rgba(124,45,52,0.18));}\n .epanel .dd-btn .chev{color:var(--pa-muted, #8a8275);}\n .epanel .dd-menu{background:var(--pa-field, #2b2723);border-color:var(--pa-border, #3a352f);}\n .epanel .dd-item{color:var(--pa-surface-contrast, #ece7df);}\n .epanel .dd-item:hover{background:var(--pa-hover, #37322b);}\n .epanel .dd-item.sel{background:var(--pa-selected, #3f372c);color:var(--pa-accent-contrast, #f1f0ed);}\n .quick-target{padding:10px 14px 0;color:var(--pa-muted, #a9a194);font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}\n .quick-more{background:transparent;border:0;color:var(--pa-surface-contrast, #cfc8bb);cursor:pointer;padding:8px 14px;text-align:left;font-size:12px;}\n .advanced{border-top:1px solid var(--pa-border, #332f29);padding:4px 0;}\n .advanced[hidden]{display:none;}\n .advanced textarea{width:100%;min-height:54px;resize:vertical;background:var(--pa-field, #1d1b19);border:1px solid var(--pa-border, #3a352f);border-radius:9px;color:var(--pa-surface-contrast, #ece7df);padding:8px;font-size:12px;}\n .advanced select{width:100%;min-height:34px;background:var(--pa-field, #1d1b19);border:1px solid var(--pa-border, #3a352f);border-radius:9px;color:var(--pa-surface-contrast, #ece7df);padding:6px 8px;}\n @media (prefers-reduced-motion: reduce){\n *,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important;}\n }\n";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WebPageAnnotation } from
|
|
2
|
-
export declare function isActiveAnnotation(annotation: Pick<WebPageAnnotation,
|
|
1
|
+
import type { WebPageAnnotation } from "./model.js";
|
|
2
|
+
export declare function isActiveAnnotation(annotation: Pick<WebPageAnnotation, "status">): boolean;
|
|
3
3
|
export declare function sortAnnotations(items: readonly WebPageAnnotation[]): WebPageAnnotation[];
|
|
4
4
|
export declare function selectExecutableAnnotations(items: readonly WebPageAnnotation[]): WebPageAnnotation[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Host-local presentation only. Values never become document content or authority. */
|
|
2
|
-
export declare const ANNOTATION_THEME_TOKENS: readonly [
|
|
2
|
+
export declare const ANNOTATION_THEME_TOKENS: readonly ["--pa-accent", "--pa-accent-soft", "--pa-outline", "--pa-accent-contrast", "--pa-surface", "--pa-surface-contrast", "--pa-shadow", "--pa-muted", "--pa-hover", "--pa-border", "--pa-popover-contrast", "--pa-popover", "--pa-focus", "--pa-selected", "--pa-accent-halo", "--pa-field", "--pa-checker", "--pa-success", "--pa-success-contrast", "--pa-danger", "--pa-danger-contrast", "--pa-color-default"];
|
|
3
3
|
export type AnnotationTheme = Partial<Record<(typeof ANNOTATION_THEME_TOKENS)[number], string>>;
|
|
4
4
|
export declare const ANNOTATION_THEME_MAX_BYTES = 8192;
|
|
5
5
|
/** Bounded, self-contained CSS colours. References, URLs and declaration syntax are rejected. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { AnnotationEdit, AnnotationGeometry, AnnotationPageContext, AnnotationPriority, AnnotationSourceLocation, AnnotationStatus, AnnotationType, PageRect, PromptMode, SelectorStrategy, WebAnnotationDraft as AnnotationDraft, WebAnnotationElementTarget as AnnotationElementTarget, WebAnnotationRegionTarget as AnnotationRegionTarget, WebAnnotationTarget as AnnotationTarget, WebPageAnnotation as PageAnnotation, } from
|
|
1
|
+
export type { AnnotationEdit, AnnotationGeometry, AnnotationPageContext, AnnotationPriority, AnnotationSourceLocation, AnnotationStatus, AnnotationType, PageRect, PromptMode, SelectorStrategy, WebAnnotationDraft as AnnotationDraft, WebAnnotationElementTarget as AnnotationElementTarget, WebAnnotationRegionTarget as AnnotationRegionTarget, WebAnnotationTarget as AnnotationTarget, WebPageAnnotation as PageAnnotation, } from "./model.js";
|
package/dist/guest.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scripts a desktop host evaluates in a guest page (e.g. Electron `executeJavaScript`) to run the
|
|
3
|
+
* annotator there. The guest reports through console marks; the host polls the snapshot and drives
|
|
4
|
+
* the bridge. Everything crossing into the page is JSON-encoded.
|
|
5
|
+
*/
|
|
6
|
+
import { type AnnotationTheme } from "./core/theme.js";
|
|
7
|
+
import { ANNOTATION_CAPTURE_MARK, ANNOTATION_CHANGED_MARK, ANNOTATION_CLOSED_MARK } from "./core/runtime/protocol.js";
|
|
8
|
+
import { ANNOTATOR_IIFE } from "./core/inject.js";
|
|
9
|
+
export { ANNOTATION_CAPTURE_MARK, ANNOTATION_CHANGED_MARK, ANNOTATION_CLOSED_MARK, ANNOTATOR_IIFE };
|
|
10
|
+
/** Starts the annotator; `theme` is sanitised, and omitted or empty keeps the default palette. */
|
|
11
|
+
export declare function annotatorBootScript(theme?: AnnotationTheme): string;
|
|
12
|
+
export declare function annotatorTeardownScript(): string;
|
|
13
|
+
export declare function annotatorSnapshotScript(): string;
|
|
14
|
+
export declare function annotatorUpdateScript(id: string, comment: string): string;
|
|
15
|
+
export declare function annotatorRemoveScript(id: string): string;
|
|
16
|
+
export declare function annotatorClearScript(): string;
|
|
17
|
+
export declare function annotatorCaptureSpecScript(): string;
|
|
18
|
+
export declare function annotatorCaptureDoneScript(): string;
|
|
19
|
+
export declare function isAnnotatorClosedConsole(message: string): boolean;
|
|
20
|
+
export declare function isAnnotatorChangedConsole(message: string): boolean;
|
|
21
|
+
export declare function isAnnotatorCaptureConsole(message: string): boolean;
|
package/dist/guest.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var v=["--pa-accent","--pa-accent-soft","--pa-outline","--pa-accent-contrast","--pa-surface","--pa-surface-contrast","--pa-shadow","--pa-muted","--pa-hover","--pa-border","--pa-popover-contrast","--pa-popover","--pa-focus","--pa-selected","--pa-accent-halo","--pa-field","--pa-checker","--pa-success","--pa-success-contrast","--pa-danger","--pa-danger-contrast","--pa-color-default"],E=8192;function u(e){if(typeof e!=="string"||e.length>256||!e.trim())return!1;if(/[;{}\\<>!@'"]/.test(e)||[...e].some((i)=>i.charCodeAt(0)<32)||/url\s*\(|var\s*\(|\/\*|\*\//i.test(e))return!1;let t=e.trim();if(/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i.test(t))return!0;if(new Set("aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato transparent turquoise violet wheat white whitesmoke yellow yellowgreen".split(" ")).has(t.toLowerCase()))return!0;let n=t.match(/^(rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\(([^()]+)\)$/i);if(n){let i=(n[1]??"").toLowerCase(),d=(n[2]??"").trim(),o=d.includes(",");if(o&&(!/^(rgb|rgba|hsl|hsla)$/.test(i)||d.includes("/")))return!1;let p=d.split("/");if(p.length>2)return!1;let c=o?d.split(",").map((l)=>l.trim()):(p[0]??"").trim().split(/\s+/),f=o?c[3]:p[1]?.trim();if(c.length!==3&&!(o&&c.length===4))return!1;let h=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?%?$/i;if(f!==void 0&&!h.test(f)&&!(f==="none"&&!o))return!1;return c.slice(0,3).every((l,b)=>{if(l==="none")return!o;let A=/^(hsl|hsla|hwb)$/.test(i)?b===0:/^(lch|oklch)$/.test(i)&&b===2;return h.test(l)||A&&/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(deg|rad|grad|turn)$/i.test(l)})}let a=t.match(/^color\((srgb|srgb-linear|display-p3|a98-rgb|prophoto-rgb|rec2020|xyz|xyz-d50|xyz-d65) ([^()]+)\)$/i);if(a)return u(`rgb(${a[2]})`);let s=t.match(/^color-mix\(in srgb, (.+) (\d+(?:\.\d+)?)%, (.+)\)$/i);return!!s&&Number(s[2])<=100&&u(s[1])&&u(s[3])}function g(e){if(!e||typeof e!=="object"||Array.isArray(e))return{};try{if(new TextEncoder().encode(JSON.stringify(e)).length>8192)return{}}catch{return{}}let t={};for(let r of v){let n=Object.hasOwn(e,r)?e[r]:void 0;if(u(n))t[r]=n.trim()}return t}function N(e,t){let r=g(t);for(let n of v){let a=r[n];if(a===void 0)e.style.removeProperty(n);else e.style.setProperty(n,a)}}var x={start:"annotation:start",teardown:"annotation:teardown",save:"annotation:save",enrich:"annotation:enrich",closed:"annotation:overlay-closed",list:"annotation:list",update:"annotation:update",remove:"annotation:remove",clear:"annotation:clear",changed:"annotation:changed",reveal:"annotation:reveal"};function S(e){if(!e||typeof e!=="object")return!1;let t=e.action;return t===x.teardown||t===x.changed}var y="__uibot-annotation:changed",m="__uibot-annotation:closed",w="__uibot-annotation:capture";function M(e){try{let t=new URL(e);return t.hash="",t.toString()}catch{return e}}var k='(()=>{var{defineProperty:st,getOwnPropertyNames:Rn,getOwnPropertyDescriptor:Ln}=Object,_n=Object.prototype.hasOwnProperty;function Pn(e){return this[e]}var On=(e)=>{var t=(zt??=new WeakMap).get(e),o;if(t)return t;if(t=st({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var i of Rn(e))if(!_n.call(t,i))st(t,i,{get:Pn.bind(e,i),enumerable:!(o=Ln(e,i))||o.enumerable})}return zt.set(e,t),t},zt;var In=(e)=>e;function $n(e,t){this[e]=In.bind(null,t)}var zn=(e,t)=>{for(var o in t)st(e,o,{get:t[o],enumerable:!0,configurable:!0,set:$n.bind(t,o)})};var No={};zn(No,{bootUIBotAnnotator:()=>pn});function Dn(e){return e.startsWith("data:image/")&&e.length<=1500000}function Hn(e){if(e.kind==="region")return`\u533A\u57DF ${Math.round(e.rect.width)}\xD7${Math.round(e.rect.height)}`;let t=e.textContent?.replace(/\\s+/g," ").trim();if(t){let o=t.length>28?`${t.slice(0,28)}\u2026`:t;return`${e.tagName}\u300C${o}\u300D`}return e.cssSelector||e.tagName}function Dt(e){return{id:e.id,comment:e.comment,pageUrl:e.pageUrl,...e.pageContext.title?{pageTitle:e.pageContext.title}:{},targetLabel:Hn(e.target),type:e.type,priority:e.priority,...e.screenshot&&Dn(e.screenshot)?{screenshot:e.screenshot}:{}}}var He=[{id:"red",value:"#ef4444",label:"\u7EA2"},{id:"orange",value:"#f97316",label:"\u6A59"},{id:"yellow",value:"#eab308",label:"\u9EC4"},{id:"green",value:"#22c55e",label:"\u7EFF"},{id:"blue",value:"#3b82f6",label:"\u84DD"},{id:"white",value:"#f8fafc",label:"\u767D"}],Ht=12,Bt=48,lt=4,ct=16;function Ge(e){let t=Math.round(e/4)*4;return Math.min(48,Math.max(12,t))}function Bn(e,t){let o=Ge(t),i=Math.max(1,[...e].length);return{width:Math.max(o,i*o),height:Math.ceil(o*1.35)}}var Wn=new Set(He.map((e)=>e.value));function Fn(e){return Wn.has(e)}function Wt(){return He[0].value}function re(e){return typeof e==="number"&&Number.isFinite(e)}function Un(e){if(!e||typeof e!=="object"||Array.isArray(e))return null;let t=e;if(typeof t.color!=="string"||!Fn(t.color))return null;if(t.kind==="rect"){if(!re(t.x)||!re(t.y)||!re(t.width)||!re(t.height))return null;if(t.width<8||t.height<8)return null;return{kind:"rect",color:t.color,x:t.x,y:t.y,width:t.width,height:t.height}}if(t.kind==="arrow"){if(!re(t.x1)||!re(t.y1)||!re(t.x2)||!re(t.y2))return null;return{kind:"arrow",color:t.color,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}}if(t.kind==="text"){if(!re(t.x)||!re(t.y)||typeof t.text!=="string")return null;let o=t.text.trim();if(!o)return null;let i=t.fontSize===void 0?16:re(t.fontSize)?Ge(t.fontSize):null;if(i==null)return null;return{kind:"text",color:t.color,x:t.x,y:t.y,text:o,fontSize:i}}return null}function Ft(e){if(e===void 0)return;if(!Array.isArray(e))return;let t=[];for(let o of e){let i=Un(o);if(!i)return;t.push(i)}return t}function Ut(e){if(e.length===0)return"\u533A\u57DF\u6807\u6CE8";let t=e.filter((c)=>c.kind==="rect").length,o=e.filter((c)=>c.kind==="arrow").length,i=e.filter((c)=>c.kind==="text"),s=[];if(t)s.push(`${t} \u4E2A\u6846`);if(o)s.push(`${o} \u4E2A\u7BAD\u5934`);if(i.length){let c=i.map((l)=>l.text.trim()).filter(Boolean).slice(0,3).map((l)=>`\u300C${l.length>16?`${l.slice(0,16)}\u2026`:l}\u300D`);s.push(c.length?`\u6587\u672C ${c.join(" ")}`:`${i.length} \u5904\u6587\u672C`)}return`\u533A\u57DF\u6807\u6CE8\uFF08${s.join("\uFF0C")}\uFF09`}function Be(e,t=16){if(e.length===0)return null;let{POSITIVE_INFINITY:o,POSITIVE_INFINITY:i,NEGATIVE_INFINITY:s,NEGATIVE_INFINITY:c}=Number;for(let l of e)if(l.kind==="rect")o=Math.min(o,l.x),i=Math.min(i,l.y),s=Math.max(s,l.x+l.width),c=Math.max(c,l.y+l.height);else if(l.kind==="arrow")o=Math.min(o,l.x1,l.x2),i=Math.min(i,l.y1,l.y2),s=Math.max(s,l.x1,l.x2),c=Math.max(c,l.y1,l.y2);else{let g=Bn(l.text,l.fontSize);o=Math.min(o,l.x),i=Math.min(i,l.y),s=Math.max(s,l.x+g.width),c=Math.max(c,l.y+g.height)}return{x:o-t,y:i-t,width:Math.max(8,s-o+t*2),height:Math.max(8,c-i+t*2)}}function Vt(e,t,o){return e.map((i)=>{if(i.kind==="rect")return{...i,x:i.x+t,y:i.y+o};if(i.kind==="arrow")return{...i,x1:i.x1+t,y1:i.y1+o,x2:i.x2+t,y2:i.y2+o};return{...i,x:i.x+t,y:i.y+o,fontSize:i.fontSize}})}function dt(e,t){let o=Math.max(0,Math.min(e.x,t.width)),i=Math.max(0,Math.min(e.y,t.height)),s=Math.min(e.width,t.width-o),c=Math.min(e.height,t.height-i);if(s<8||c<8)return null;return{x:o,y:i,width:s,height:c}}var Vn=["open","processing","done","verified","ignored"],jn=["bug","style","copywriting","feature","interaction","data","other"],Yn=["low","medium","high","blocker"],Kn=["testid","id","aria","class","text","path"],Xn=["light","dark","unknown"],Gn=["react","vue","angular","svelte","nextjs","nuxt","unknown"];function X(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ve(e,t){return typeof e==="string"&&t.includes(e)}function he(e){return typeof e==="number"&&Number.isFinite(e)}function be(e){return he(e)&&e>0}function ut(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function Yt(e){return X(e)&&Object.values(e).every((t)=>typeof t==="string")}function B(e){return e===void 0||typeof e==="string"}function Kt(e){if(!X(e)||!he(e.x)||!he(e.y)||!be(e.width)||!be(e.height))return;return{x:e.x,y:e.y,width:e.width,height:e.height}}function pt(e){if(!X(e)||!be(e.width)||!be(e.height))return;return{width:e.width,height:e.height}}function ft(e){if(!X(e)||!he(e.x)||!he(e.y))return;return{x:e.x,y:e.y}}function jt(e){if(!X(e)||typeof e.fileName!=="string"||!be(e.lineNumber))return;if(e.columnNumber!==void 0&&(!he(e.columnNumber)||e.columnNumber<0))return;if(!B(e.componentName))return;return{fileName:e.fileName,lineNumber:e.lineNumber,...e.columnNumber===void 0?{}:{columnNumber:e.columnNumber},...e.componentName===void 0?{}:{componentName:e.componentName}}}function qn(e){let t=Kt(e.boundingBox);if(typeof e.tagName!=="string"||!e.tagName||typeof e.cssSelector!=="string"||!e.cssSelector||typeof e.xpath!=="string"||!e.xpath||!Yt(e.attributes)||!t||!ut(e.domPath))return;if(!B(e.textContent)||e.breadcrumb!==void 0&&!ut(e.breadcrumb))return;if(e.selectorStrategy!==void 0&&!ve(e.selectorStrategy,Kn))return;if(!B(e.region))return;let o;if(e.accessibility!==void 0){if(!X(e.accessibility)||!B(e.accessibility.role)||!B(e.accessibility.name)||!B(e.accessibility.ariaLabel))return;o={...e.accessibility.role===void 0?{}:{role:e.accessibility.role},...e.accessibility.name===void 0?{}:{name:e.accessibility.name},...e.accessibility.ariaLabel===void 0?{}:{ariaLabel:e.accessibility.ariaLabel}}}let i=e.sourceLocation===void 0?void 0:jt(e.sourceLocation);if(e.sourceLocation!==void 0&&!i)return;let s;if(e.sourceStack!==void 0){if(!Array.isArray(e.sourceStack))return;let c=e.sourceStack.map(jt);if(c.some((l)=>!l))return;s=c.filter((l)=>Boolean(l))}return{kind:"element",tagName:e.tagName,cssSelector:e.cssSelector,xpath:e.xpath,...e.textContent===void 0?{}:{textContent:e.textContent},attributes:{...e.attributes},boundingBox:t,domPath:[...e.domPath],...o?{accessibility:o}:{},...e.selectorStrategy===void 0?{}:{selectorStrategy:e.selectorStrategy},...e.region===void 0?{}:{region:e.region},...e.breadcrumb===void 0?{}:{breadcrumb:[...e.breadcrumb]},...i?{sourceLocation:i}:{},...s?{sourceStack:s}:{}}}function Zn(e){let t=Kt(e.rect),o=pt(e.viewport),i=ft(e.scroll);if(!t||t.width<8||t.height<8||!o||!i||!be(e.devicePixelRatio))return;if(e.breadcrumb!==void 0&&!ut(e.breadcrumb))return;let s;if(e.topLevelElements!==void 0){if(!Array.isArray(e.topLevelElements))return;s=[];for(let l of e.topLevelElements){if(!X(l)||typeof l.tagName!=="string"||!l.tagName||!B(l.text)||!B(l.role))return;s.push({tagName:l.tagName,...l.text===void 0?{}:{text:l.text},...l.role===void 0?{}:{role:l.role}})}}let c=e.marks===void 0?void 0:Ft(e.marks);if(e.marks!==void 0&&!c)return;return{kind:"region",rect:t,viewport:o,scroll:i,devicePixelRatio:e.devicePixelRatio,...e.breadcrumb===void 0?{}:{breadcrumb:[...e.breadcrumb]},...s?{topLevelElements:s}:{},...c?.length?{marks:c}:{}}}function Jn(e){if(!X(e))return{ok:!1,reason:"target is not an object",raw:e};if(e.kind==="region"){let t=Zn(e);return t?{ok:!0,value:t}:{ok:!1,reason:"invalid region target",raw:e}}if(e.kind==="element"||e.kind===void 0){let t=qn(e);return t?{ok:!0,value:t}:{ok:!1,reason:"invalid element target",raw:e}}return{ok:!1,reason:`unknown target kind: ${String(e.kind)}`,raw:e}}function Qn(e){if(!X(e))return;let t=pt(e.viewport),o=ft(e.scroll);if(!t||!o||!be(e.devicePixelRatio)||!X(e.center)||!he(e.center.x)||!he(e.center.y)||typeof e.visible!=="boolean"||!B(e.positioning))return;return{viewport:t,scroll:o,devicePixelRatio:e.devicePixelRatio,center:{x:e.center.x,y:e.center.y},visible:e.visible,...e.positioning===void 0?{}:{positioning:e.positioning}}}function eo(e){if(!X(e))return;let{url:t,origin:o,path:i,title:s,capturedAt:c,query:l,hash:g,referrer:y,language:A,userAgent:E,uiState:M}=e,R=pt(e.viewport),_=ft(e.scroll);if(!R||!X(e.viewport)||!be(e.viewport.devicePixelRatio)||!_)return;if(typeof t!=="string"||!t||typeof o!=="string"||!o||typeof i!=="string"||!i||typeof s!=="string"||typeof c!=="string"||!c)return;if(!B(l)||!B(g)||!B(y)||!B(A)||!B(E)||!B(M))return;if(e.theme!==void 0&&!ve(e.theme,Xn))return;if(e.framework!==void 0&&!ve(e.framework,Gn))return;return{url:t,origin:o,path:i,title:s,viewport:{...R,devicePixelRatio:e.viewport.devicePixelRatio},scroll:_,capturedAt:c,...l===void 0?{}:{query:l},...g===void 0?{}:{hash:g},...y===void 0?{}:{referrer:y},...e.theme===void 0?{}:{theme:e.theme},...e.framework===void 0?{}:{framework:e.framework},...A===void 0?{}:{language:A},...E===void 0?{}:{userAgent:E},...M===void 0?{}:{uiState:M}}}function to(e){if(e===void 0)return[];if(!Array.isArray(e))return;let t=[];for(let o of e){if(!X(o)||!ve(o.kind,["style","text"])||typeof o.label!=="string"||!B(o.property)||typeof o.before!=="string"||typeof o.after!=="string")return;t.push({kind:o.kind,label:o.label,before:o.before,after:o.after,...o.property===void 0?{}:{property:o.property}})}return t}function mt(e){if(!X(e))return{ok:!1,reason:"annotation is not an object",raw:e};let{id:t,pageUrl:o,comment:i,createdAt:s,updatedAt:c}=e;if(!ve(e.status,Vn))return{ok:!1,reason:"invalid status",raw:e};if(!ve(e.type,jn))return{ok:!1,reason:"invalid type",raw:e};if(!ve(e.priority,Yn))return{ok:!1,reason:"invalid priority",raw:e};if(typeof t!=="string"||!t)return{ok:!1,reason:"invalid id",raw:e};if(typeof o!=="string"||!o)return{ok:!1,reason:"invalid pageUrl",raw:e};if(typeof i!=="string"||!i)return{ok:!1,reason:"invalid comment",raw:e};if(typeof s!=="string"||!s)return{ok:!1,reason:"invalid createdAt",raw:e};if(typeof c!=="string"||!c)return{ok:!1,reason:"invalid updatedAt",raw:e};if(!B(e.expectedResult)||!B(e.preserve)||!B(e.screenshot))return{ok:!1,reason:"invalid optional annotation text",raw:e};if(!Yt(e.styleSummary))return{ok:!1,reason:"invalid styleSummary",raw:e};let l=Qn(e.geometry);if(!l)return{ok:!1,reason:"invalid geometry",raw:e};let g=eo(e.pageContext);if(!g)return{ok:!1,reason:"invalid pageContext",raw:e};let y=to(e.edits);if(!y)return{ok:!1,reason:"invalid edits",raw:e};let A=Jn(e.target);if(!A.ok)return A;return{ok:!0,value:{id:t,pageUrl:o,status:e.status,type:e.type,priority:e.priority,comment:i,target:A.value,styleSummary:{...e.styleSummary},geometry:l,pageContext:g,createdAt:s,updatedAt:c,...e.expectedResult===void 0?{}:{expectedResult:e.expectedResult},...e.preserve===void 0?{}:{preserve:e.preserve},...e.screenshot===void 0?{}:{screenshot:e.screenshot},...y.length?{edits:y}:{}}}}var H={start:"annotation:start",teardown:"annotation:teardown",save:"annotation:save",enrich:"annotation:enrich",closed:"annotation:overlay-closed",list:"annotation:list",update:"annotation:update",remove:"annotation:remove",clear:"annotation:clear",changed:"annotation:changed",reveal:"annotation:reveal"};var Xt="__uibot-annotation:changed";var Gt="__uibot-annotation:capture";function xe(e){try{let t=new URL(e);return t.hash="",t.toString()}catch{return e}}function qt(e){return new Date(e()).toISOString()}function no(e,t){return`ann_${e().toString(36)}_${Math.floor(t()*1e9).toString(36)}`}function Zt(e={}){let t=e.now??Date.now,o=e.random??Math.random,i=new Map;return{list(s){let c=xe(s);return[...i.values()].filter((l)=>xe(l.pageUrl)===c)},listAll(){return[...i.values()]},save(s,c){let l=qt(t),g={...s,id:no(t,o),pageUrl:xe(c??s.pageContext.url),status:"open",createdAt:l,updatedAt:l},y=mt(g);if(!y.ok)throw Error(`\u6807\u6CE8\u6570\u636E\u65E0\u6548\uFF1A${y.reason}`);return i.set(y.value.id,y.value),y.value},update(s,c){let l=i.get(s);if(!l)return null;let g={...l,...c,id:l.id,updatedAt:qt(t)},y=mt(g);if(!y.ok)throw Error(`\u6807\u6CE8\u6570\u636E\u65E0\u6548\uFF1A${y.reason}`);return i.set(s,y.value),y.value},remove(s){return i.delete(s)},clear(s){let c=xe(s),l=0;for(let[g,y]of i)if(xe(y.pageUrl)===c)i.delete(g),l+=1;return l},clearAll(){let s=i.size;return i.clear(),s}}}function Ae(){let e=globalThis;return e.__uibotPageAnnotationStore??=Zt(),e.__uibotPageAnnotationStore}function gt(){let e=globalThis;return e.__uibotAnnotationListeners??=[],e.__uibotAnnotationListeners}function qe(e){for(let t of[...gt()])t(e)}function We(e){let t=globalThis,o=Ae().list(e).map(Dt);t.__uibotAnnotationSnapshot=JSON.stringify({pageUrl:xe(e),items:o});try{console.debug(Xt)}catch{}}function oo(e){let t=Ae();if(e.action===H.list)return{success:!0,data:t.list(e.pageUrl)};if(e.action===H.save){let o=t.save(e.data);return qe({action:H.changed}),We(o.pageUrl),{success:!0,data:o}}if(e.action===H.enrich)return{success:!0};if(e.action===H.closed)return{success:!0};return{success:!1,error:"unknown-action"}}function ro(){let e=globalThis;e.__uibotAnnotationBridge={snapshot(){return e.__uibotAnnotationSnapshot??JSON.stringify({pageUrl:"",items:[]})},update(t,o){let i=Ae().update(t,{comment:o});if(!i)return!1;return qe({action:H.changed}),We(i.pageUrl),!0},remove(t){let o=Ae().listAll().find((i)=>i.id===t);if(!o)return!1;return Ae().remove(t),qe({action:H.changed}),We(o.pageUrl),!0},clear(){let t=[...new Set(Ae().listAll().map((o)=>o.pageUrl))];if(Ae().clearAll(),qe({action:H.changed}),t.length===0)return We(typeof location>"u"?"":location.href),!0;for(let o of t)We(o);return!0}}}function Jt(){return ro(),{sendMessage(e){try{return Promise.resolve(oo(e))}catch(t){return Promise.resolve({success:!1,error:t instanceof Error?t.message:String(t)})}},subscribe(e){return gt().push(e),()=>{let t=gt(),o=t.indexOf(e);if(o>=0)t.splice(o,1)}}}}var Qt=["--pa-accent","--pa-accent-soft","--pa-outline","--pa-accent-contrast","--pa-surface","--pa-surface-contrast","--pa-shadow","--pa-muted","--pa-hover","--pa-border","--pa-popover-contrast","--pa-popover","--pa-focus","--pa-selected","--pa-accent-halo","--pa-field","--pa-checker","--pa-success","--pa-success-contrast","--pa-danger","--pa-danger-contrast","--pa-color-default"];function Ze(e){if(typeof e!=="string"||e.length>256||!e.trim())return!1;if(/[;{}\\\\<>!@\'"]/.test(e)||[...e].some((l)=>l.charCodeAt(0)<32)||/url\\s*\\(|var\\s*\\(|\\/\\*|\\*\\//i.test(e))return!1;let t=e.trim();if(/^#(?:[\\da-f]{3,4}|[\\da-f]{6}|[\\da-f]{8})$/i.test(t))return!0;if(new Set("aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato transparent turquoise violet wheat white whitesmoke yellow yellowgreen".split(" ")).has(t.toLowerCase()))return!0;let i=t.match(/^(rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\\(([^()]+)\\)$/i);if(i){let l=(i[1]??"").toLowerCase(),g=(i[2]??"").trim(),y=g.includes(",");if(y&&(!/^(rgb|rgba|hsl|hsla)$/.test(l)||g.includes("/")))return!1;let A=g.split("/");if(A.length>2)return!1;let E=y?g.split(",").map((_)=>_.trim()):(A[0]??"").trim().split(/\\s+/),M=y?E[3]:A[1]?.trim();if(E.length!==3&&!(y&&E.length===4))return!1;let R=/^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?%?$/i;if(M!==void 0&&!R.test(M)&&!(M==="none"&&!y))return!1;return E.slice(0,3).every((_,N)=>{if(_==="none")return!y;let L=/^(hsl|hsla|hwb)$/.test(l)?N===0:/^(lch|oklch)$/.test(l)&&N===2;return R.test(_)||L&&/^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(deg|rad|grad|turn)$/i.test(_)})}let s=t.match(/^color\\((srgb|srgb-linear|display-p3|a98-rgb|prophoto-rgb|rec2020|xyz|xyz-d50|xyz-d65) ([^()]+)\\)$/i);if(s)return Ze(`rgb(${s[2]})`);let c=t.match(/^color-mix\\(in srgb, (.+) (\\d+(?:\\.\\d+)?)%, (.+)\\)$/i);return!!c&&Number(c[2])<=100&&Ze(c[1])&&Ze(c[3])}function io(e){if(!e||typeof e!=="object"||Array.isArray(e))return{};try{if(new TextEncoder().encode(JSON.stringify(e)).length>8192)return{}}catch{return{}}let t={};for(let o of Qt){let i=Object.hasOwn(e,o)?e[o]:void 0;if(Ze(i))t[o]=i.trim()}return t}function en(e,t){let o=io(t);for(let i of Qt){let s=o[i];if(s===void 0)e.style.removeProperty(i);else e.style.setProperty(i,s)}}var ao=["color","backgroundColor","fontSize","fontWeight","fontFamily","lineHeight","margin","padding","border","borderRadius","width","height","display","position","zIndex","flexDirection","justifyContent","alignItems","gap","overflow","opacity","transform"];function ht(e){if(typeof CSS<"u"&&typeof CSS.escape==="function")return CSS.escape(e);return e.replace(/([^a-zA-Z0-9_-])/g,"\\\\$1")}function tn(e){return e.replace(/\\\\/g,"\\\\\\\\").replace(/"/g,"\\\\\\"").replace(/[\\n\\r\\f]/g,"\\\\a ")}function nn(e){if(!e||e.length>40)return!1;if(/^(css-|sc-|jss|makeStyles|emotion-|_)/i.test(e))return!1;if(/[0-9a-f]{6,}/.test(e))return!1;return!0}function on(e){if(!e||e.length>40)return!1;if(/[0-9a-f]{8,}/.test(e))return!1;if(/^(radix-|headlessui-|mui-|:r)/i.test(e))return!1;return!0}function so(e){let t=[],o=e;while(o&&o.nodeType===1&&o!==document.documentElement){let i=o.tagName.toLowerCase();if(o.id&&on(o.id)){t.unshift(`#${ht(o.id)}`);break}let s=o.parentElement;if(s){let c=Array.from(s.children).filter((g)=>g.tagName===o.tagName),l=c.indexOf(o)+1;t.unshift(c.length>1?`${i}:nth-of-type(${l})`:i)}else t.unshift(i);o=s}return t.join(" > ")}function lo(e){let t=e.tagName.toLowerCase();for(let s of["data-testid","data-cy","data-qa"]){let c=e.getAttribute(s);if(c)return{selector:`${t}[${s}="${tn(c)}"]`,strategy:"testid"}}if(e.id&&on(e.id)){let s=`#${ht(e.id)}`;if(document.querySelectorAll(s).length===1)return{selector:s,strategy:"id"}}let o=e.getAttribute("aria-label");if(o){let s=`${t}[aria-label="${tn(o)}"]`;if(document.querySelectorAll(s).length===1)return{selector:s,strategy:"aria"}}let i=Array.from(e.classList).filter(nn);if(i.length){let s=`${t}.${i.map(ht).join(".")}`;if(document.querySelectorAll(s).length===1)return{selector:s,strategy:"class"}}return{selector:so(e),strategy:"path"}}function co(e){let t=[],o=e;while(o&&o.nodeType===1){let i=1,s=o.previousElementSibling;while(s){if(s.tagName===o.tagName)i+=1;s=s.previousElementSibling}t.unshift(`${o.tagName.toLowerCase()}[${i}]`),o=o.parentElement}return`/${t.join("/")}`}function uo(e){let t=[],o=e,i=0;while(o&&o.nodeType===1&&i<6){let s=o.tagName.toLowerCase(),c=o.id?`#${o.id}`:"",l=Array.from(o.classList).filter(nn).slice(0,2);t.unshift(`${s}${c}${l.length?`.${l.join(".")}`:""}`),o=o.parentElement,i+=1}return t}function po(e){let t={};for(let o of Array.from(e.attributes)){if(o.name==="style")continue;t[o.name]=o.value.length>200?o.value.slice(0,200):o.value}return t}function fo(e){let t=getComputedStyle(e),o={};for(let i of ao){let s=t.getPropertyValue(i.replace(/[A-Z]/g,(c)=>`-${c.toLowerCase()}`));if(s)o[i]=s.trim()}return o}function mo(){let e=window;if(e.__NEXT_DATA__)return"nextjs";if(e.__NUXT__)return"nuxt";if(document.querySelector("[ng-version]"))return"angular";if(document.querySelector("[data-reactroot]")||e.React||e.__REACT_DEVTOOLS_GLOBAL_HOOK__)return"react";if(e.__VUE__||document.querySelector("[data-v-app]"))return"vue";if(document.querySelector("[data-svelte-h]"))return"svelte";return"unknown"}function bt(){let e=window.location,t=document.documentElement.classList.contains("dark")||Boolean(window.matchMedia?.("(prefers-color-scheme: dark)").matches);return{url:e.href,origin:e.origin,path:e.pathname,query:e.search||void 0,hash:e.hash||void 0,title:document.title,referrer:document.referrer||void 0,viewport:{width:window.innerWidth,height:window.innerHeight,devicePixelRatio:window.devicePixelRatio||1},scroll:{x:window.scrollX,y:window.scrollY},theme:t?"dark":"light",framework:mo(),language:document.documentElement.lang||navigator.language,userAgent:navigator.userAgent,capturedAt:new Date().toISOString()}}function go(e){let t=e.getBoundingClientRect(),o=getComputedStyle(e);return{viewport:{width:window.innerWidth,height:window.innerHeight},scroll:{x:window.scrollX,y:window.scrollY},devicePixelRatio:window.devicePixelRatio||1,center:{x:Math.round(t.left+t.width/2),y:Math.round(t.top+t.height/2)},visible:t.width>0&&t.height>0&&o.display!=="none"&&o.visibility!=="hidden",positioning:o.position}}function ke(e,t){let o=e.replace(/\\s+/g," ").trim();return o.length>t?`${o.slice(0,t)}\u2026`:o}function ho(e){let t=e.tagName.toLowerCase(),o=(e.getAttribute("role")||"").toLowerCase();if(t==="main"||o==="main")return"\u4E3B\u5185\u5BB9\u533A";if(t==="nav"||o==="navigation")return"\u5BFC\u822A/\u83DC\u5355";if(t==="header"||o==="banner")return"\u9875\u5934";if(t==="footer"||o==="contentinfo")return"\u9875\u811A";if(t==="aside"||o==="complementary")return"\u4FA7\u8FB9\u680F";if(t==="dialog"||o==="dialog"||o==="alertdialog")return"\u5F39\u7A97";if(t==="form")return"\u8868\u5355";if(t==="table")return"\u8868\u683C";if(t==="tr")return"\u8868\u683C\u884C";if(t==="th"||t==="td")return"\u5355\u5143\u683C";if(t==="li")return"\u5217\u8868\u9879";if(t==="ul"||t==="ol")return"\u5217\u8868";if(t==="section"||t==="article"){let c=e.querySelector("h1,h2,h3,h4,h5,h6"),g=(e.getAttribute("aria-label")||c?.textContent||"").replace(/\\s+/g," ").trim();return g?`\u533A\u5757\u300C${ke(g,16)}\u300D`:"\u533A\u5757"}let i=Array.from(e.classList).find((c)=>/card|modal|dialog|drawer|side-?bar|menu|panel|toolbar|tabs?|header|footer|nav|hero|banner|widget|popover|dropdown/i.test(c));if(!i)return null;return`${/card/i.test(i)?"\u5361\u7247":/modal|dialog/i.test(i)?"\u5F39\u7A97":/drawer/i.test(i)?"\u62BD\u5C49":/side-?bar/i.test(i)?"\u4FA7\u8FB9\u680F":/toolbar/i.test(i)?"\u5DE5\u5177\u680F":/menu/i.test(i)?"\u83DC\u5355":/tab/i.test(i)?"\u6807\u7B7E\u9875":/panel/i.test(i)?"\u9762\u677F":/nav/i.test(i)?"\u5BFC\u822A":/header/i.test(i)?"\u9875\u5934":/footer/i.test(i)?"\u9875\u811A":/popover|dropdown/i.test(i)?"\u6D6E\u5C42":/hero|banner/i.test(i)?"\u6A2A\u5E45":"\u533A\u5757"}(.${i})`}function bo(e){let t=[],o=e.parentElement;while(o&&o.nodeType===1&&o!==document.body&&o!==document.documentElement){let E=ho(o);if(E&&t[t.length-1]!==E)t.push(E);o=o.parentElement}t.reverse();let i=e.getBoundingClientRect(),s=i.left+i.width/2,c=i.top+i.height/2,l=window.innerWidth||1,g=window.innerHeight||1,y=s<l/3?"\u9760\u5DE6":s>l*2/3?"\u9760\u53F3":"\u6C34\u5E73\u5C45\u4E2D",A=c<g/3?"\u9760\u4E0A":c>g*2/3?"\u9760\u4E0B":"\u5782\u76F4\u5C45\u4E2D";return{region:`${y} \xB7 ${A}`,breadcrumb:t.slice(-5)}}function xt(e){let t=e.getBoundingClientRect(),{selector:o,strategy:i}=lo(e),s=(e.textContent||"").replace(/\\s+/g," ").trim(),c=bo(e);return{comment:"",type:"style",priority:"medium",target:{kind:"element",tagName:e.tagName.toLowerCase(),cssSelector:o,xpath:co(e),textContent:s?s.slice(0,200):void 0,attributes:po(e),boundingBox:{x:Math.round(t.left+window.scrollX),y:Math.round(t.top+window.scrollY),width:Math.round(t.width),height:Math.round(t.height)},domPath:uo(e),accessibility:{role:e.getAttribute("role")||void 0,ariaLabel:e.getAttribute("aria-label")||void 0},selectorStrategy:i,region:c.region,breadcrumb:c.breadcrumb},styleSummary:fo(e),geometry:go(e),pageContext:bt()}}function xo(e,t,o,i,s=8){let c=Math.max(s,i.width-o.width-s),l=Math.max(s,i.height-o.height-s);return{left:Math.min(Math.max(e,s),c),top:Math.min(Math.max(t,s),l)}}function yt(e,t){let o=!1,i=null,s=0,c=0,l=0,g=0;function y(){return{width:window.innerWidth,height:window.innerHeight}}function A(N,L){let de=e.getBoundingClientRect(),q=xo(N,L,{width:de.width,height:de.height},y());e.style.left=`${q.left}px`,e.style.top=`${q.top}px`,e.style.right="auto",e.style.transform="none"}function E(N){if(N.button!==0)return;N.preventDefault(),N.stopPropagation(),o=!0,i=N.pointerId,t.setPointerCapture?.(N.pointerId);let L=e.getBoundingClientRect();s=N.clientX,c=N.clientY,l=L.left,g=L.top,A(l,g),t.classList.add("dragging")}function M(N){if(!o||i!=null&&N.pointerId!==i)return;N.preventDefault(),A(l+N.clientX-s,g+N.clientY-c)}function R(N){if(!o||i!=null&&N.pointerId!==i)return;o=!1,i=null,t.classList.remove("dragging");try{t.releasePointerCapture?.(N.pointerId)}catch{}}function _(){let N=e.getBoundingClientRect();A(N.left,N.top)}return t.addEventListener("pointerdown",E),t.addEventListener("pointermove",M),t.addEventListener("pointerup",R),t.addEventListener("pointercancel",R),window.addEventListener("resize",_),()=>{t.removeEventListener("pointerdown",E),t.removeEventListener("pointermove",M),t.removeEventListener("pointerup",R),t.removeEventListener("pointercancel",R),window.removeEventListener("resize",_)}}function rn(e){if(e?.isConnected)e.remove()}function ce(e,t){let o=document.createElementNS("http://www.w3.org/2000/svg",e);for(let[i,s]of Object.entries(t))o.setAttribute(i,s);return o}function yo(e){let t=ce("svg",{viewBox:"0 0 16 16",width:"14",height:"14"});if(t.setAttribute("aria-hidden","true"),e==="rect")t.appendChild(ce("rect",{x:"3",y:"4",width:"10",height:"8",rx:"1.5",fill:"none",stroke:"currentColor","stroke-width":"1.6"}));else if(e==="arrow")t.appendChild(ce("path",{d:"M3 13 L12 4 M8 4 h4 v4",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"}));else t.appendChild(ce("path",{d:"M4 13 L8 3 L12 13 M5.5 10 h5",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"}));return t}function an(e,t){let o=!1,i="rect",s=Wt(),c=ct,l=[],g=null,y=null,A=null,E=document.createElement("div");E.className="mark-layer";let M=ce("svg",{class:"mark-svg"});M.setAttribute("width","100%"),M.setAttribute("height","100%"),E.appendChild(M),e.appendChild(E);let R=document.createElement("div");R.className="mark-dock",R.hidden=!0;let _=document.createElement("div");_.className="mark-seg";let N=new Map;for(let p of["rect","arrow","text"]){let h=document.createElement("button");h.type="button",h.dataset.mark=p,h.setAttribute("aria-label",p==="rect"?"\u6846\u9009":p==="arrow"?"\u7BAD\u5934":"\u6587\u672C"),h.title=h.getAttribute("aria-label")??p,h.appendChild(yo(p)),h.addEventListener("click",()=>{i=p,oe(),j()}),N.set(p,h),_.appendChild(h)}let L=document.createElement("div");L.className="mark-colors",L.setAttribute("role","radiogroup"),L.setAttribute("aria-label","\u6279\u6CE8\u989C\u8272");let de=[];for(let p of He){let h=document.createElement("button");h.type="button",h.className="mark-color",h.style.background=p.value,h.setAttribute("aria-label",p.label),h.title=p.label,h.addEventListener("click",()=>{s=p.value,Ee()}),de.push(h),L.appendChild(h)}let q=document.createElement("div");q.className="mark-size",q.setAttribute("aria-label","\u5B57\u53F7");let V=document.createElement("button");V.type="button",V.setAttribute("aria-label","\u51CF\u5C0F\u5B57\u53F7"),V.title="\u51CF\u5C0F\u5B57\u53F7",V.textContent="\u2212";let we=document.createElement("span");we.className="v";let Z=document.createElement("button");Z.type="button",Z.setAttribute("aria-label","\u589E\u5927\u5B57\u53F7"),Z.title="\u589E\u5927\u5B57\u53F7",Z.textContent="+",q.append(V,we,Z);let J=document.createElement("input");J.type="text",J.className="mark-comment",J.placeholder="\u8BF4\u660E\uFF08\u53EF\u9009\uFF09",J.setAttribute("aria-label","\u533A\u57DF\u6807\u6CE8\u8BF4\u660E");let W=document.createElement("button");W.type="button",W.className="mark-save",W.textContent="\u2713",W.title="\u4FDD\u5B58\u533A\u57DF\u6807\u6CE8",W.setAttribute("aria-label","\u4FDD\u5B58\u533A\u57DF\u6807\u6CE8"),W.disabled=!0,W.addEventListener("click",()=>{if(!l.length||W.disabled)return;t.onSave({marks:l.map((p)=>({...p})),comment:J.value.trim()})}),R.append(_,L,q,J,W),e.appendChild(R);function oe(){for(let[p,h]of N)h.classList.toggle("on",p===i)}function Ee(){de.forEach((p,h)=>{p.classList.toggle("on",He[h]?.value===s)})}function Q(p){if(c=Ge(p),we.textContent=String(c),V.disabled=c<=Ht,Z.disabled=c>=Bt,A){A.style.fontSize=`${c}px`;return}for(let h=l.length-1;h>=0;h-=1){let x=l[h];if(x?.kind!=="text")continue;l[h]={...x,fontSize:c},P();break}}function ee(p){p.preventDefault()}V.addEventListener("mousedown",ee),Z.addEventListener("mousedown",ee),V.addEventListener("click",()=>Q(c-lt)),Z.addEventListener("click",()=>Q(c+lt));function te(){W.disabled=l.length===0,t.onBusyChange?.(!1)}function j(){g=null,y=null,P()}function Fe(){ie(!0)}function ie(p){let h=A;if(!h)return;A=null,h.removeEventListener("blur",Fe);let x=h.value.trim(),v=Number.parseFloat(h.dataset.x??"0"),D=Number.parseFloat(h.dataset.y??"0");if(rn(h),p&&x)l.push({kind:"text",color:s,x:v,y:D,text:x,fontSize:c});P(),te()}function P(){M.replaceChildren();for(let x of[...E.querySelectorAll(".mark-text")]){if(x===A)continue;rn(x)}let p=ce("defs",{});M.appendChild(p),(y?[...l,y]:l).forEach((x,v)=>{if(x.kind==="rect"){M.appendChild(ce("rect",{x:String(x.x),y:String(x.y),width:String(x.width),height:String(x.height),fill:"none",stroke:x.color,"stroke-width":"3",rx:"2"}));return}if(x.kind==="arrow"){let Y=`uibot-arrow-${v}`,pe=ce("marker",{id:Y,markerWidth:"8",markerHeight:"8",refX:"6",refY:"4",orient:"auto",markerUnits:"strokeWidth"});pe.appendChild(ce("path",{d:"M0,0 L8,4 L0,8 z",fill:x.color})),p.appendChild(pe),M.appendChild(ce("line",{x1:String(x.x1),y1:String(x.y1),x2:String(x.x2),y2:String(x.y2),stroke:x.color,"stroke-width":"3","stroke-linecap":"round","marker-end":`url(#${Y})`}));return}let D=document.createElement("div");D.className="mark-text",D.textContent=x.text,D.style.left=`${x.x}px`,D.style.top=`${x.y}px`,D.style.color=x.color,D.style.fontSize=`${x.fontSize}px`,E.appendChild(D)})}return oe(),Ee(),Q(c),P(),{setActive(p){if(o=p,R.hidden=!p,E.classList.toggle("on",p),!p)ie(!1),l.length=0,J.value="",i="rect",Q(ct),j(),te(),oe()},isActive:()=>o,tool:()=>i,getMarks:()=>l.map((p)=>({...p})),addRect(p){if(!o)return;l.push({kind:"rect",color:s,...p}),P(),te()},handlePointerDown(p){if(!o||p.button!==0||A)return!1;if(p.target instanceof Node&&R.contains(p.target))return!1;return g={x:p.clientX,y:p.clientY},y=null,!0},handlePointerMove(p){if(!o||!g||i==="text")return!1;let h=Math.min(g.x,p.clientX),x=Math.min(g.y,p.clientY),v=Math.abs(p.clientX-g.x),D=Math.abs(p.clientY-g.y);return y=i==="arrow"?{kind:"arrow",color:s,x1:g.x,y1:g.y,x2:p.clientX,y2:p.clientY}:{kind:"rect",color:s,x:h,y:x,width:v,height:D},P(),!0},handlePointerUp(p){if(!o||p.button!==0)return!1;if(i==="text"){let x=g;if(g=null,!x)return!1;return ie(!1),A=document.createElement("input"),A.className="mark-text editing",A.dataset.x=String(p.clientX),A.dataset.y=String(p.clientY),A.style.left=`${p.clientX}px`,A.style.top=`${p.clientY}px`,A.style.color=s,A.style.fontSize=`${c}px`,A.placeholder="\u8F93\u5165\u6587\u5B57",A.addEventListener("keydown",(v)=>{if(v.key==="Enter")v.preventDefault(),ie(!0);else if(v.key==="Escape")v.preventDefault(),ie(!1)}),A.addEventListener("blur",Fe),E.appendChild(A),A.focus(),!0}if(!g)return!1;let h=g;if(g=null,i==="arrow"){let x=p.clientX-h.x,v=p.clientY-h.y;if(Math.hypot(x,v)<8)return j(),!0;l.push({kind:"arrow",color:s,x1:h.x,y1:h.y,x2:p.clientX,y2:p.clientY})}else{let x={x:Math.min(h.x,p.clientX),y:Math.min(h.y,p.clientY),width:Math.abs(p.clientX-h.x),height:Math.abs(p.clientY-h.y)};if(x.width<8||x.height<8)return j(),!0;l.push({kind:"rect",color:s,...x})}return y=null,P(),te(),!0},handlePointerCancel(){if(!o)return;j()},captureRect(){return Be(l,16)},setCapturing(p){R.hidden=p||!o},setBusy(p){W.disabled=p||l.length===0,W.textContent=p?"\u2026":"\u2713",J.disabled=p},clear(){ie(!1),l.length=0,J.value="",j(),te()},detach(){ie(!1),E.remove(),R.remove()}}}var vo=()=>globalThis.performance?.now()??Date.now();function sn(e,t=vo){let o=t(),i=(s,c,l)=>{e?.({stage:s,durationMs:Math.max(0,t()-c),outcome:l})};return{markFromStart(s,c="success"){i(s,o,c)},start(s){let c=t(),l=!1;return(g="success")=>{if(l)return;l=!0,i(s,c,g)}}}}function Ao(){return{requestIdleCallback:typeof window.requestIdleCallback==="function"?(e,t)=>window.requestIdleCallback(()=>e(),t):void 0,cancelIdleCallback:typeof window.cancelIdleCallback==="function"?(e)=>window.cancelIdleCallback(e):void 0,setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:(e)=>window.clearTimeout(e)}}function ln(e,t=Ao()){let o=!0,i=()=>{if(!o)return;o=!1,e()};if(t.requestIdleCallback){let c=t.requestIdleCallback(i,{timeout:120});return()=>{if(!o)return;o=!1,t.cancelIdleCallback?.(c)}}let s=t.setTimeout(i,0);return()=>{if(!o)return;o=!1,t.clearTimeout(s)}}var cn=`\n *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,sans-serif;}\n .hl{position:fixed;border:2px solid var(--pa-accent, #7c2d34);background:var(--pa-accent-soft, rgba(124,45,52,0.10));border-radius:4px;\n pointer-events:none;transition:all .04s linear;z-index:1;box-shadow:0 0 0 1px var(--pa-outline, rgba(255,255,255,0.4));}\n .tag{position:fixed;background:var(--pa-accent, #7c2d34);color:var(--pa-accent-contrast, #f1f0ed);font-size:11px;line-height:1.4;font-weight:500;\n padding:2px 7px;border-radius:5px;pointer-events:none;white-space:nowrap;z-index:2;}\n .bar{position:fixed;top:14px;left:50%;transform:translateX(-50%);background:var(--pa-surface, rgba(23,23,26,0.94));\n color:var(--pa-surface-contrast, #fff);font-size:12.5px;padding:6px 6px 6px 8px;border-radius:999px;pointer-events:auto;\n z-index:5;display:flex;gap:8px;align-items:center;box-shadow:0 8px 24px var(--pa-shadow, rgba(0,0,0,0.28));}\n .bar .grip{display:flex;align-items:center;justify-content:center;width:18px;height:22px;padding:0;\n border:none;background:transparent;color:var(--pa-muted, rgba(255,255,255,0.72));cursor:grab;touch-action:none;}\n .bar .grip:hover,.bar .grip.dragging{color:var(--pa-surface-contrast, #fff);background:transparent;}\n .bar .grip.dragging{cursor:grabbing;}\n .bar button{background:var(--pa-hover, rgba(255,255,255,0.14));color:var(--pa-surface-contrast, #fff);border:none;border-radius:999px;\n padding:4px 11px;font-size:12px;cursor:pointer;transition:background .12s;}\n .bar button:hover{background:var(--pa-hover, rgba(255,255,255,0.26));}\n .bar button.exit{width:28px;height:28px;padding:0;display:flex;align-items:center;justify-content:center;}\n\n @keyframes uibotpop{from{opacity:0;transform:translateY(4px) scale(.98);}to{opacity:1;transform:none;}}\n\n .dd{position:relative;}\n .dd-btn{width:100%;display:flex;align-items:center;gap:6px;border:1px solid var(--pa-border, #e6d6bf);border-radius:9px;\n padding:7px 10px;font-size:12.5px;color:var(--pa-popover-contrast, #3b3024);background:var(--pa-popover, #fff);cursor:pointer;transition:border-color .12s,box-shadow .12s;}\n .dd-btn:hover{border-color:var(--pa-border, #d2bd9c);}\n .dd-btn.open{border-color:var(--pa-accent, #7c2d34);box-shadow:0 0 0 3px var(--pa-focus, rgba(124,45,52,0.14));}\n .dd-btn .v{flex:1;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:flex;align-items:center;gap:6px;}\n .dd-btn .chev{font-size:9px;color:var(--pa-muted, #b69b73);transition:transform .12s;}\n .dd-btn.open .chev{transform:rotate(180deg);}\n .dd-menu{position:absolute;left:0;right:0;top:calc(100% + 4px);background:var(--pa-popover, #fff);border:1px solid var(--pa-border, #ecdcc4);\n border-radius:10px;box-shadow:0 10px 28px var(--pa-shadow, rgba(60,40,15,0.18));padding:4px;z-index:10;max-height:208px;overflow:auto;}\n .dd-item{width:100%;display:flex;align-items:center;gap:7px;text-align:left;border:none;background:transparent;\n border-radius:7px;padding:7px 9px;font-size:12.5px;color:var(--pa-popover-contrast, #3b3024);cursor:pointer;}\n .dd-item:hover{background:var(--pa-hover, #f6ecdb);}\n .dd-item.sel{background:var(--pa-selected, #f1f0ed);color:var(--pa-accent-contrast, #7c2d34);font-weight:500;}\n .swatch{width:8px;height:8px;border-radius:50%;flex-shrink:0;}\n\n .toast{position:fixed;bottom:22px;left:50%;transform:translateX(-50%);color:var(--pa-surface-contrast, #fff);font-size:12.5px;\n padding:8px 16px;border-radius:999px;pointer-events:none;z-index:7;box-shadow:0 6px 20px var(--pa-shadow, rgba(0,0,0,0.2));}\n .pin{position:fixed;width:21px;height:21px;border-radius:50% 50% 50% 2px;background:var(--pa-accent, #7c2d34);color:var(--pa-accent-contrast, #f1f0ed);\n font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center;\n pointer-events:none;z-index:3;box-shadow:0 2px 6px var(--pa-shadow, rgba(0,0,0,0.3));}\n .pin.marker{pointer-events:auto;cursor:pointer;transition:transform .1s;}\n .pin.marker:hover{transform:scale(1.18);}\n .flash{position:fixed;border:3px solid var(--pa-accent, #7c2d34);border-radius:4px;pointer-events:none;z-index:4;\n animation:uibotflash 1.2s ease-out forwards;}\n @keyframes uibotflash{0%{box-shadow:0 0 0 5px var(--pa-accent-halo, rgba(124,45,52,0.45));}100%{box-shadow:0 0 0 5px var(--pa-accent-halo, rgba(124,45,52,0));}}\n .selbox{position:fixed;border:2px solid var(--pa-accent, #7c2d34);border-radius:4px;pointer-events:none;z-index:2;\n box-shadow:0 0 0 1px var(--pa-outline, rgba(241,240,237,0.35));background:var(--pa-accent-soft, rgba(124,45,52,0.06));}\n .pin.active{background:var(--pa-accent, #7c2d34);}\n .region-box{position:fixed;border:2px solid var(--pa-accent, #7c2d34);background:var(--pa-accent-soft, rgba(124,45,52,.10));pointer-events:none;z-index:3;display:none;}\n .region-size{position:absolute;right:0;bottom:-24px;background:var(--pa-surface, #17171a);color:var(--pa-surface-contrast, #f1f0ed);border-radius:999px;padding:3px 7px;font-size:11px;white-space:nowrap;}\n .sr-live{position:fixed;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}\n .mark-layer{position:fixed;inset:0;pointer-events:none;z-index:4;}\n .mark-layer .mark-svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible;}\n .mark-text{position:fixed;font-size:15px;font-weight:700;line-height:1.2;pointer-events:none;white-space:pre;\n text-shadow:0 1px 2px var(--pa-shadow, rgba(0,0,0,.75)),0 0 8px var(--pa-shadow, rgba(0,0,0,.45));z-index:4;}\n .mark-text.editing{pointer-events:auto;min-width:72px;background:var(--pa-surface, rgba(23,23,26,.9));border:1px solid var(--pa-border, rgba(255,255,255,.24));\n border-radius:6px;padding:4px 8px;outline:none;font:inherit;}\n .mark-dock{position:fixed;top:58px;left:50%;transform:translateX(-50%);background:var(--pa-surface, rgba(23,23,26,0.94));color:var(--pa-surface-contrast, #fff);\n padding:6px 8px;border-radius:14px;pointer-events:auto;z-index:5;display:flex;gap:8px;align-items:center;\n flex-wrap:wrap;max-width:calc(100vw - 16px);box-shadow:0 8px 24px var(--pa-shadow, rgba(0,0,0,0.28));}\n .mark-dock[hidden]{display:none;}\n .mark-seg{display:flex;background:var(--pa-field, rgba(255,255,255,0.12));border-radius:999px;padding:2px;gap:2px;}\n .mark-seg button{width:28px;height:26px;padding:0;display:flex;align-items:center;justify-content:center;\n background:transparent;border:none;color:var(--pa-muted, rgba(255,255,255,.72));border-radius:999px;cursor:pointer;}\n .mark-seg button.on{background:var(--pa-selected, #f1f0ed);color:var(--pa-accent-contrast, #17171a);}\n .mark-colors{display:flex;gap:5px;align-items:center;}\n .mark-color{width:16px;height:16px;border-radius:50%;border:2px solid transparent;padding:0;cursor:pointer;\n box-shadow:inset 0 0 0 1px var(--pa-shadow, rgba(0,0,0,.28));}\n .mark-color.on{border-color:var(--pa-surface-contrast, #fff);}\n .mark-size{display:flex;align-items:center;gap:2px;background:var(--pa-field, rgba(255,255,255,0.12));border-radius:999px;padding:2px 4px;}\n .mark-size button{width:22px;height:22px;padding:0;border:none;border-radius:999px;background:transparent;\n color:var(--pa-surface-contrast, #fff);cursor:pointer;font-size:14px;line-height:1;}\n .mark-size button:hover:not(:disabled){background:var(--pa-hover, rgba(255,255,255,0.16));}\n .mark-size button:disabled{opacity:.34;cursor:default;}\n .mark-size .v{min-width:22px;text-align:center;font-size:11px;font-variant-numeric:tabular-nums;color:var(--pa-surface-contrast, #f1f0ed);}\n .mark-comment{width:120px;height:28px;border:1px solid var(--pa-border, rgba(255,255,255,.18));background:var(--pa-field, rgba(0,0,0,.25));\n color:var(--pa-surface-contrast, #f1f0ed);border-radius:8px;padding:0 8px;font-size:12px;outline:none;}\n .mark-save{width:28px;height:28px;border:none;border-radius:50%;background:var(--pa-selected, #f1f0ed);color:var(--pa-accent-contrast, #17171a);cursor:pointer;font-size:15px;}\n .mark-save:disabled{opacity:.45;cursor:default;}\n :host(.capturing) .bar,:host(.capturing) .mark-dock,:host(.capturing) .epanel,:host(.capturing) .pin,\n :host(.capturing) .toast,:host(.capturing) .hl,:host(.capturing) .tag,:host(.capturing) .region-box,\n :host(.capturing) .region-size{visibility:hidden!important;}\n\n .seg{display:flex;background:var(--pa-field, rgba(255,255,255,0.12));border-radius:999px;padding:2px;}\n .seg button{background:transparent;border:none;color:var(--pa-muted, rgba(255,255,255,0.72));padding:3px 12px;\n border-radius:999px;font-size:12px;cursor:pointer;transition:background .12s,color .12s;}\n .seg button.on{background:var(--pa-selected, #f1f0ed);color:var(--pa-accent-contrast, #17171a);font-weight:600;}\n\n .epanel{position:fixed;width:340px;max-width:94vw;background:var(--pa-surface, #17171a);border:1px solid var(--pa-border, #3a352f);\n border-radius:16px;box-shadow:0 18px 48px var(--pa-shadow, rgba(0,0,0,0.5));pointer-events:auto;z-index:6;\n color:var(--pa-surface-contrast, #f1f0ed);overflow:hidden;animation:uibotpop .12s ease-out;}\n .epanel .etop{display:flex;align-items:center;gap:9px;padding:11px 13px;border-bottom:1px solid var(--pa-border, #332f29);}\n .epanel .etop .ico{flex-shrink:0;color:var(--pa-muted, #b9b1a4);font-size:15px;}\n .epanel .etop input{flex:1;background:transparent;border:none;outline:none;color:var(--pa-surface-contrast, #ece7df);font-size:13.5px;}\n .epanel .etop input::placeholder{color:var(--pa-muted, #8a8275);}\n .epanel .etop textarea{flex:1;background:transparent;border:none;outline:none;color:var(--pa-surface-contrast, #ece7df);font-size:13.5px;\n resize:none;font-family:inherit;line-height:1.45;max-height:96px;padding:0;}\n .epanel .etop textarea::placeholder{color:var(--pa-muted, #8a8275);}\n .epanel .ehead{display:flex;align-items:center;padding:8px 14px 4px;color:var(--pa-surface-contrast, #cfc8bb);font-size:12.5px;cursor:move;user-select:none;}\n .epanel .ehead .tg{font-family:ui-monospace,Menlo,monospace;color:var(--pa-surface-contrast, #e7e0d4);}\n .epanel .ehead .grip{margin-left:auto;color:var(--pa-muted, #6f685c);letter-spacing:2px;font-size:12px;}\n .erows{max-height:46vh;overflow:auto;padding:2px 0 4px;}\n .erow{display:flex;align-items:center;gap:10px;padding:6px 14px;}\n .erow>span.lb{width:64px;flex-shrink:0;font-size:12.5px;color:var(--pa-muted, #a9a194);}\n .erow .ctl{flex:1;min-width:0;}\n .efield{width:100%;display:flex;align-items:center;gap:8px;background:var(--pa-field, #1d1b19);border:1px solid var(--pa-border, #3a352f);\n border-radius:9px;padding:7px 10px;transition:border-color .12s;}\n .efield:focus-within{border-color:var(--pa-accent, #7c2d34);}\n .efield input{flex:1;min-width:0;background:transparent;border:none;outline:none;color:var(--pa-surface-contrast, #ece7df);\n font-size:12.5px;font-family:ui-monospace,Menlo,monospace;}\n .sw{width:22px;height:22px;border-radius:50%;flex-shrink:0;border:1px solid var(--pa-border, rgba(255,255,255,0.28));cursor:pointer;\n background-image:linear-gradient(45deg,var(--pa-checker, #555) 25%,transparent 25%),linear-gradient(-45deg,var(--pa-checker, #555) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--pa-checker, #555) 75%),linear-gradient(-45deg,transparent 75%,var(--pa-checker, #555) 75%);\n background-size:8px 8px;background-position:0 0,0 4px,4px -4px,-4px 0;position:relative;overflow:hidden;}\n .sw i{position:absolute;inset:0;border-radius:50%;}\n .sw:focus-within{outline:2px solid var(--pa-selected, #f1f0ed);outline-offset:2px;}\n .color-hit{position:absolute;inset:0;width:100%!important;height:100%;opacity:0;cursor:pointer;pointer-events:auto;}\n .stepper{display:grid;grid-template-columns:30px minmax(48px,1fr) auto 30px;align-items:center;gap:4px;padding:3px;}\n .stepper button{width:30px;height:30px;border:0;border-radius:7px;background:var(--pa-field, #2b2723);color:var(--pa-surface-contrast, #ece7df);cursor:pointer;\n display:flex;align-items:center;justify-content:center;transition:background .12s,color .12s;}\n .stepper button:hover:not(:disabled){background:var(--pa-hover, #3b352e);color:var(--pa-surface-contrast, #fff);}\n .stepper button:disabled{opacity:.34;cursor:default;}\n .stepper button svg{width:14px;height:14px;pointer-events:none;}\n .stepper input[type=number]{width:100%;text-align:center;font-variant-numeric:tabular-nums;appearance:textfield;}\n .stepper input[type=number]::-webkit-inner-spin-button,.stepper input[type=number]::-webkit-outer-spin-button{appearance:none;margin:0;}\n .stepper .unit{min-width:18px;color:var(--pa-muted, #8a8275);font-size:11px;text-align:left;}\n .ebar{display:flex;align-items:center;padding:11px 14px;border-top:1px solid var(--pa-border, #332f29);gap:10px;}\n .ebar .cancel{background:transparent;border:1px solid var(--pa-border, #4a443c);color:var(--pa-surface-contrast, #cfc8bb);border-radius:999px;\n padding:6px 16px;font-size:13px;cursor:pointer;transition:background .12s;}\n .ebar .cancel:hover{background:var(--pa-hover, rgba(255,255,255,0.06));}\n .ebar .ok{margin-left:auto;width:36px;height:36px;border-radius:50%;background:var(--pa-selected, #f1f0ed);color:var(--pa-accent-contrast, #17171a);border:none;\n cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:17px;line-height:1;transition:background .12s;}\n .ebar .ok:hover{background:var(--pa-hover, #f0ece4);}\n .ebar .ok:disabled{opacity:.55;cursor:default;}\n .epanel .dd-btn{background:var(--pa-field, #1d1b19);border-color:var(--pa-border, #3a352f);color:var(--pa-surface-contrast, #ece7df);}\n .epanel .dd-btn:hover{border-color:var(--pa-border, #5a5347);}\n .epanel .dd-btn.open{border-color:var(--pa-accent, #7c2d34);box-shadow:0 0 0 3px var(--pa-focus, rgba(124,45,52,0.18));}\n .epanel .dd-btn .chev{color:var(--pa-muted, #8a8275);}\n .epanel .dd-menu{background:var(--pa-field, #2b2723);border-color:var(--pa-border, #3a352f);}\n .epanel .dd-item{color:var(--pa-surface-contrast, #ece7df);}\n .epanel .dd-item:hover{background:var(--pa-hover, #37322b);}\n .epanel .dd-item.sel{background:var(--pa-selected, #3f372c);color:var(--pa-accent-contrast, #f1f0ed);}\n .quick-target{padding:10px 14px 0;color:var(--pa-muted, #a9a194);font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}\n .quick-more{background:transparent;border:0;color:var(--pa-surface-contrast, #cfc8bb);cursor:pointer;padding:8px 14px;text-align:left;font-size:12px;}\n .advanced{border-top:1px solid var(--pa-border, #332f29);padding:4px 0;}\n .advanced[hidden]{display:none;}\n .advanced textarea{width:100%;min-height:54px;resize:vertical;background:var(--pa-field, #1d1b19);border:1px solid var(--pa-border, #3a352f);border-radius:9px;color:var(--pa-surface-contrast, #ece7df);padding:8px;font-size:12px;}\n .advanced select{width:100%;min-height:34px;background:var(--pa-field, #1d1b19);border:1px solid var(--pa-border, #3a352f);border-radius:9px;color:var(--pa-surface-contrast, #ece7df);padding:6px 8px;}\n @media (prefers-reduced-motion: reduce){\n *,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important;}\n }\n`;function dn(e){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("viewBox","0 0 16 16"),t.setAttribute("width","14"),t.setAttribute("height","14"),t.setAttribute("aria-hidden","true"),e(t),t}function ko(){return dn((e)=>{for(let[t,o]of[[5.5,3],[10.5,3],[5.5,8],[10.5,8],[5.5,13],[10.5,13]]){let i=document.createElementNS("http://www.w3.org/2000/svg","circle");i.setAttribute("cx",String(t)),i.setAttribute("cy",String(o)),i.setAttribute("r","1.15"),i.setAttribute("fill","currentColor"),e.appendChild(i)}})}function wo(){return dn((e)=>{let t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","M4 4l8 8M12 4l-8 8"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","1.8"),t.setAttribute("stroke-linecap","round"),e.appendChild(t)})}function un(e,t){let o=e.annotationRegionV2!==!1,i="__uibotAnnotatorActive",s=window;if(s.__uibotAnnotatorActive)return;s.__uibotAnnotatorActive=!0;let c=sn(t.recordPerformance?.bind(t)),l=()=>{return},g=document.createElement("div");g.id="__uibot-annotator-host",g.style.cssText="position:fixed;inset:0;z-index:2147483646;pointer-events:none;color-scheme:dark;",en(g,e.theme);let y=g.attachShadow({mode:"open"});(document.documentElement||document.body).appendChild(g);let A=document.createElement("style");A.textContent=cn,y.appendChild(A);let E=document.createElement("div");y.appendChild(E);let M=document.createElement("div");M.className="hl",M.style.display="none";let R=document.createElement("div");R.className="tag",R.style.display="none";let _=document.createElement("div");_.className="selbox",_.style.display="none";let N=document.createElement("div");N.className="pin active",N.style.display="none";let L=document.createElement("div");L.className="region-box";let de=document.createElement("span");de.className="region-size",L.appendChild(de);let q=document.createElement("div");q.className="sr-live",q.setAttribute("aria-live","polite"),E.append(M,R,_,N,L,q);let V=null;function we(n,r){V=n,N.textContent=String(r),J()}function Z(){V=null,_.style.display="none",N.style.display="none"}function J(){if(!V)return;let n=V.getBoundingClientRect();_.style.display="block",_.style.left=`${n.left-1}px`,_.style.top=`${n.top-1}px`,_.style.width=`${n.width+2}px`,_.style.height=`${n.height+2}px`,N.style.display="flex",N.style.left=`${Math.max(2,n.left-6)}px`,N.style.top=`${Math.max(2,n.top-6)}px`}let W=document.createElement("div");W.className="bar";let oe=document.createElement("button");oe.type="button",oe.className="grip",oe.setAttribute("aria-label","\u62D6\u52A8\u5DE5\u5177\u680F"),oe.title="\u62D6\u52A8",oe.appendChild(ko());let Ee=document.createElement("div");Ee.className="seg";let Q=document.createElement("button");Q.type="button",Q.dataset.tool="element",Q.textContent="\u5143\u7D20",Q.className="on";let ee=document.createElement("button");ee.type="button",ee.dataset.tool="region",ee.textContent="\u533A\u57DF",ee.disabled=!o,ee.title=o?"\u6846\u9009\u533A\u57DF":"\u533A\u57DF\u6807\u6CE8\u5DF2\u5173\u95ED";let te=document.createElement("button");te.type="button",te.dataset.tool="adjust",te.textContent="\u8C03\u6574",Ee.append(Q,ee,te);let j=document.createElement("button");j.type="button",j.className="exit",j.setAttribute("aria-label","\u9000\u51FA"),j.title="\u9000\u51FA",j.appendChild(wo()),W.append(oe,Ee,j),E.appendChild(W);let Fe=yt(W,oe),ie={current:()=>{return}},P=an(E,{onSave:(n)=>ie.current(n)}),p="element",h="hovering",x=null,v=null,D=null,Y=!1,pe=null,fe=null;function Je(){if(pe&&fe!=null)try{pe.releasePointerCapture?.(fe)}catch{}pe=null,fe=null}function Qe(){Je(),D=null,Y=!1,v=null,L.style.display="none"}function Ne(n){if(n==="region"&&!o)return;if(n===p)return;Mt(!0),p=n,Q.classList.toggle("on",p==="element"),ee.classList.toggle("on",p==="region"),te.classList.toggle("on",p==="adjust"),tt(),L.style.display="none",v=null,D=null,Y=!1,Je(),P.setActive(p==="region")}Q.addEventListener("click",()=>Ne("element")),ee.addEventListener("click",()=>Ne("region")),te.addEventListener("click",()=>Ne("adjust"));function ae(n,r,a){return Math.min(a,Math.max(r,n))}function To(n,r){let a=ae(n.x,0,window.innerWidth),u=ae(n.y,0,window.innerHeight),f=ae(r.x,0,window.innerWidth),m=ae(r.y,0,window.innerHeight),d={x:Math.min(a,f),y:Math.min(u,m),width:Math.abs(f-a),height:Math.abs(m-u)};return d.width>=8&&d.height>=8?d:null}function et(n){L.style.display="block",L.style.left=`${n.x}px`,L.style.top=`${n.y}px`,L.style.width=`${n.width}px`,L.style.height=`${n.height}px`,de.textContent=`${Math.round(n.width)} \xD7 ${Math.round(n.height)}`,q.textContent=`\u533A\u57DF x ${Math.round(n.x)}\uFF0Cy ${Math.round(n.y)}\uFF0C\u5BBD ${Math.round(n.width)}\uFF0C\u9AD8 ${Math.round(n.height)}`}function fn(n){let r=[[n.x+n.width/2,n.y+n.height/2],[n.x+1,n.y+1],[n.x+n.width-1,n.y+n.height-1]],a=[];return r.forEach(([u,f])=>{let m=document.elementFromPoint(u,f);if(!m||Ye(m)||a.some((d)=>d.tagName===m.tagName.toLowerCase()))return;a.push({tagName:m.tagName.toLowerCase(),...ke(m.textContent||"",60)?{text:ke(m.textContent||"",60)}:{},...m.getAttribute("role")?{role:m.getAttribute("role")}:{}})}),a}function vt(n,r=[]){let a={x:Math.round(n.x+window.scrollX),y:Math.round(n.y+window.scrollY),width:Math.round(n.width),height:Math.round(n.height)},u={width:window.innerWidth,height:window.innerHeight},f={x:window.scrollX,y:window.scrollY},m=Vt(r,window.scrollX,window.scrollY);return{comment:"",type:"other",priority:"medium",target:{kind:"region",rect:a,viewport:u,scroll:f,devicePixelRatio:window.devicePixelRatio||1,topLevelElements:fn(n),...m.length?{marks:m}:{}},styleSummary:{},geometry:{viewport:u,scroll:f,devicePixelRatio:window.devicePixelRatio||1,center:{x:Math.round(n.x+n.width/2),y:Math.round(n.y+n.height/2)},visible:!0},pageContext:bt()}}function At(n){let r=n.getBoundingClientRect();M.style.display="block",M.style.left=`${r.left}px`,M.style.top=`${r.top}px`,M.style.width=`${r.width}px`,M.style.height=`${r.height}px`;let a=Array.from(n.classList).slice(0,2).join(".");R.textContent=`${n.tagName.toLowerCase()}${a?"."+a:""} \xB7 ${Math.round(r.width)}\xD7${Math.round(r.height)}`,R.style.display="block";let u=r.top>22?r.top-20:r.bottom+4;R.style.left=`${Math.max(2,r.left)}px`,R.style.top=`${u}px`}function tt(){M.style.display="none",R.style.display="none"}function Me(n){let r=document.createElement("div");r.className="toast",r.style.background="var(--pa-success, #15803d)",r.style.color="var(--pa-success-contrast, #fff)",r.textContent=n,E.appendChild(r),setTimeout(()=>r.remove(),1600)}let kt={blocker:0,high:1,medium:2,low:3},Te=[];function mn(n){let r=n.getBoundingClientRect(),a=document.createElement("div");a.className="flash",a.style.left=`${r.left-2}px`,a.style.top=`${r.top-2}px`,a.style.width=`${r.width+4}px`,a.style.height=`${r.height+4}px`,E.appendChild(a),setTimeout(()=>a.remove(),1300)}function nt(n,r){let a=n.kind==="element"?document.querySelector(n.cssSelector):null;if(n.kind==="element"&&!a){r.style.display="none";return}let u=a?.getBoundingClientRect()??{left:n.kind==="region"?n.rect.x-window.scrollX:0,top:n.kind==="region"?n.rect.y-window.scrollY:0,width:n.kind==="region"?n.rect.width:0,height:n.kind==="region"?n.rect.height:0};if(u.width===0&&u.height===0){r.style.display="none";return}r.style.display="flex",r.style.left=`${Math.max(2,u.left-6)}px`,r.style.top=`${Math.max(2,u.top-6)}px`}function wt(){for(let n of Te)n.pinEl.remove();Te=[]}function gn(n){wt(),n.filter((a)=>a.status==="open"||a.status==="processing").sort((a,u)=>(kt[a.priority]??9)-(kt[u.priority]??9)||(a.createdAt||"").localeCompare(u.createdAt||"")).forEach((a,u)=>{if(!a.target||a.target.kind==="element"&&!a.target.cssSelector)return;let f=document.createElement("div");f.className="pin marker",f.textContent=String(u+1),f.title=a.comment||"",f.addEventListener("click",(m)=>{m.stopPropagation();let d=a.target.kind==="element"?document.querySelector(a.target.cssSelector):null;if(d)d.scrollIntoView({block:"center"}),mn(d),Me(a.comment?`#${u+1} ${a.comment}`:`#${u+1}`),nt(a.target,f);else if(a.target.kind==="region")window.scrollTo({top:Math.max(0,a.target.rect.y-window.innerHeight/2),left:a.target.rect.x}),et({x:a.target.rect.x-window.scrollX,y:a.target.rect.y-window.scrollY,width:a.target.rect.width,height:a.target.rect.height}),setTimeout(()=>{if(!v)L.style.display="none"},1300),Me(a.comment?`#${u+1} ${a.comment}`:`#${u+1}`);else G(`#${u+1} \u5143\u7D20\u672A\u627E\u5230\uFF08\u9875\u9762\u53EF\u80FD\u5DF2\u53D8\u5316\uFF09`)}),E.appendChild(f),Te.push({target:a.target,pinEl:f}),nt(a.target,f)})}async function Re(){let n=c.start("markers_loaded");try{let r=await t.sendMessage({action:H.list,pageUrl:location.href});if(r&&r.success&&Array.isArray(r.data))gn(r.data),n("success");else n("failure")}catch{n("failure")}}let me=[];function hn(n,r,a){let u=r,f=document.createElement("div");f.className="dd";let m=document.createElement("button");m.type="button",m.className="dd-btn";let d=document.createElement("span");d.className="v";let b=document.createElement("span");b.className="chev",b.textContent="\u25BE",m.append(d,b);let k=document.createElement("div");k.className="dd-menu",k.style.display="none";function O(){let C=n.find((I)=>I.value===u);if(d.textContent="",C?.color){let I=document.createElement("span");I.className="swatch",I.style.background=C.color,d.appendChild(I)}d.appendChild(document.createTextNode(C?.label??"")),Array.from(k.children).forEach((I,S)=>{I.classList.toggle("sel",n[S].value===u)})}function w(){k.style.display="none",m.classList.remove("open")}function z(){for(let C of me)C();k.style.display="block",m.classList.add("open")}return me.push(w),n.forEach((C)=>{let I=document.createElement("button");if(I.type="button",I.className="dd-item",C.color){let S=document.createElement("span");S.className="swatch",S.style.background=C.color,I.appendChild(S)}I.appendChild(document.createTextNode(C.label)),I.addEventListener("click",(S)=>{S.stopPropagation(),u=C.value,O(),w(),a?.(u)}),k.appendChild(I)}),m.addEventListener("click",(C)=>{C.stopPropagation(),k.style.display==="none"?z():w()}),f.append(m,k),O(),{el:f,get:()=>u,close:w}}let bn=[{value:"style",label:"\u6837\u5F0F\u95EE\u9898"},{value:"copywriting",label:"\u6587\u6848\u4FEE\u6539"},{value:"bug",label:"Bug"},{value:"feature",label:"\u529F\u80FD\u5EFA\u8BAE"},{value:"interaction",label:"\u4EA4\u4E92\u95EE\u9898"},{value:"data",label:"\u6570\u636E\u95EE\u9898"},{value:"other",label:"\u5176\u4ED6"}],xn=[{value:"low",label:"\u4F4E",color:"var(--pa-muted, #737373)"},{value:"medium",label:"\u4E2D",color:"var(--pa-surface-contrast, #17171a)"},{value:"high",label:"\u9AD8",color:"var(--pa-accent, #7c2d34)"},{value:"blocker",label:"\u963B\u585E",color:"var(--pa-danger, #5c151c)"}],F=null,K=null,Le=null,_e=null,Pe=null,Oe=null,se=null;function Et(n){let r=document.createElement("button");return r.type="button",r.className="ok",r.dataset.icon="confirm",r.textContent="\u2713",r.title=n,r.setAttribute("aria-label",n),r}function Ce(n,r){if(!n)return;n.textContent=r?"\u2026":"\u2713",n.toggleAttribute("aria-busy",r),n.disabled=r}function ot(){F?.remove(),F=null,K=Le=_e=se=null,Pe=Oe=null,me.length=0,Z(),L.style.display="none",h="hovering",x=null,v=null,Y=!1}function Nt(n,r){if(r&&!o)return;if(h="editing",x=n,v=r??null,tt(),n)we(n,Te.length+1);else Z();if(r)et(r);let a=n?.getBoundingClientRect(),u=a?{left:a.left,top:a.top,right:a.right,bottom:a.bottom}:r?{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height}:{left:8,top:80,right:8,bottom:80};me.length=0,F=document.createElement("div"),F.className="epanel",F.setAttribute("role","dialog"),F.setAttribute("aria-modal","true"),F.setAttribute("aria-label",r?"\u65B0\u5EFA\u533A\u57DF\u6807\u6CE8":"\u65B0\u5EFA\u5143\u7D20\u6807\u6CE8"),F.addEventListener("click",()=>{for(let T of me)T()});let f=document.createElement("div");f.className="quick-target",f.textContent=r?`\u533A\u57DF ${Math.round(r.width)}\xD7${Math.round(r.height)}`:`${n.tagName.toLowerCase()}\u300C${ke(n.textContent||"",28)}\u300D`;let m=document.createElement("div");m.className="etop",K=document.createElement("textarea"),K.rows=3,K.placeholder="\u54EA\u91CC\u4E0D\u5BF9\uFF1F\u8BF4\u660E\u671F\u671B\u5373\u53EF\uFF0C\u4F8B\u5982\uFF1A\u79FB\u52A8\u7AEF\u6309\u94AE\u6587\u5B57\u6362\u884C\uFF1B\u80FD\u653E\u4E0B\u65F6\u4FDD\u6301\u5355\u884C\uFF0C\u4E14\u5361\u7247\u9AD8\u5EA6\u4E0D\u53D8\u3002",K.addEventListener("input",()=>{if(K.style.height="auto",K.style.height=`${Math.min(Math.max(K.scrollHeight,72),144)}px`,se)se.disabled=!K.value.trim()}),m.append(K);let d=document.createElement("button");d.type="button",d.dataset.action="more",d.className="quick-more",d.textContent="\u66F4\u591A\u8BBE\u7F6E \u25BE",d.setAttribute("aria-expanded","false");let b=document.createElement("div");b.className="advanced",b.id="__uibot-annotation-advanced",b.hidden=!0,d.setAttribute("aria-controls",b.id);let k=(T,ue)=>{let le=document.createElement("label");le.className="erow";let U=document.createElement("span");U.className="lb",U.textContent=T;let ge=document.createElement("div");return ge.className="ctl",ge.append(ue),le.append(U,ge),le};Le=document.createElement("textarea"),Le.placeholder="\u4F8B\u5982\uFF1A\u5BBD\u5EA6\u8DB3\u591F\u65F6\u4FDD\u6301\u5355\u884C",_e=document.createElement("textarea"),_e.placeholder="\u4F8B\u5982\uFF1A\u5361\u7247\u9AD8\u5EA6\u548C\u70B9\u51FB\u884C\u4E3A\u4E0D\u53D8",Pe=document.createElement("select");for(let T of bn)Pe.add(new Option(T.label,T.value,!1,T.value==="other"));Oe=document.createElement("select");for(let T of xn)Oe.add(new Option(T.label,T.value,!1,T.value==="medium"));b.append(k("\u671F\u671B\u7ED3\u679C\uFF08\u53EF\u9009\uFF09",Le),k("\u4FDD\u62A4\u8303\u56F4\uFF08\u53EF\u9009\uFF09",_e),k("\u7C7B\u578B",Pe),k("\u4F18\u5148\u7EA7",Oe)),d.addEventListener("click",(T)=>{T.stopPropagation(),b.hidden=!b.hidden,d.textContent=b.hidden?"\u66F4\u591A\u8BBE\u7F6E \u25BE":"\u6536\u8D77\u8BBE\u7F6E \u25B4",d.setAttribute("aria-expanded",String(!b.hidden))});let O=document.createElement("div");O.className="ebar";let w=document.createElement("button");w.type="button",w.className="cancel",w.textContent="\u53D6\u6D88",w.addEventListener("click",ot),se=Et("\u4FDD\u5B58\u6807\u6CE8"),se.dataset.action="save",se.disabled=!0,se.addEventListener("click",()=>void Tt()),O.append(w,se),F.append(f,m,d,b,O),F.addEventListener("keydown",(T)=>{if(T.key==="Enter"&&(T.ctrlKey||T.metaKey)){if(T.preventDefault(),!se?.disabled)Tt();return}if(T.key!=="Tab")return;let ue=[...F.querySelectorAll("button:not([disabled]),textarea:not([disabled]),select:not([disabled]),input:not([disabled])")].filter((at)=>!at.closest("[hidden]"));if(!ue.length)return;let le=ue[0],U=ue[ue.length-1],ge=y.activeElement;if(T.shiftKey&&ge===le)T.preventDefault(),U.focus();else if(!T.shiftKey&&ge===U)T.preventDefault(),le.focus()}),E.appendChild(F);let z=340,C=u.left,I=u.bottom+10;if(C+z>window.innerWidth-8)C=window.innerWidth-z-8;if(C<8)C=8;let S=F.offsetHeight||300;if(I+S>window.innerHeight-8)I=Math.max(8,u.top-S-10);F.style.left=`${C}px`,F.style.top=`${I}px`,K.focus()}async function Tt(){if(!x&&!v||!K)return;if(v&&!o){G("\u533A\u57DF\u6807\u6CE8\u5DF2\u5173\u95ED\uFF0C\u8BF7\u6539\u7528\u5143\u7D20\u6807\u6CE8");return}let n=K.value.trim();if(!n){G("\u8BF7\u5148\u586B\u5199\u6807\u6CE8\u5185\u5BB9"),K.focus();return}let r=v?vt(v):xt(x);r.comment=n,r.type=Pe?.value??"other",r.priority=Oe?.value??"medium";let a=Le?.value.trim();if(a)r.expectedResult=a;let u=_e?.value.trim();if(u)r.preserve=u;g.style.visibility="hidden";let f=se;Ce(f,!0);let m=c.start("save_durable");try{let d=await t.sendMessage({action:H.save,data:r});if(g.style.visibility="visible",d&&d.success){m("success"),ot(),Re(),Me("\u5DF2\u4FDD\u5B58");let b=d.data?.id;if(b)t.sendMessage({action:H.enrich,annotationId:b,data:r}).catch(()=>{})}else m("failure"),console.error("[uibot annotation] save rejected:",d),G(d?.error?`\u4FDD\u5B58\u5931\u8D25\uFF1A${d.error}`:"\u4FDD\u5B58\u5931\u8D25"),Ce(f,!1)}catch(d){m("failure"),g.style.visibility="visible",console.error("[uibot annotation] save threw:",d);let b=d instanceof Error?d.message:String(d);G(/context invalidated/i.test(b)?"\u8BF7\u5237\u65B0\u9875\u9762\u540E\u91CD\u65B0\u6807\u6CE8":`\u4FDD\u5B58\u5931\u8D25\uFF1A${b}`),Ce(f,!1)}}async function yn(){return new Promise((n)=>{let r=!1,a=(u)=>{if(r)return;r=!0,n(u)};s.__uibotAnnotationCaptureDone=()=>a(!0),window.setTimeout(()=>a(!1),4000)})}async function vn(n){if(!o){G("\u533A\u57DF\u6807\u6CE8\u5DF2\u5173\u95ED\uFF0C\u8BF7\u6539\u7528\u5143\u7D20\u6807\u6CE8");return}let r=Be(n.marks,0),a=r?dt(r,{width:window.innerWidth,height:window.innerHeight}):null;if(!a){G("\u8BF7\u5148\u6846\u9009\u533A\u57DF\u6216\u6DFB\u52A0\u7BAD\u5934/\u6587\u672C");return}let u=n.comment.trim()||Ut(n.marks),f=vt(a,n.marks);f.comment=u,P.setBusy(!0),g.classList.add("capturing"),P.setCapturing(!0);let m=c.start("save_durable");try{let d=await t.sendMessage({action:H.save,data:f});if(d&&d.success){m("success");let b=d.data?.id,k=dt(Be(n.marks,16)??a,{width:window.innerWidth,height:window.innerHeight}),O=!0;if(b&&k){s.__uibotAnnotationCapture={id:b,...k},await new Promise((w)=>{requestAnimationFrame(()=>requestAnimationFrame(()=>w()))});try{console.debug(Gt)}catch{}O=await yn()}if(P.clear(),P.setBusy(!1),Re(),O)Me("\u5DF2\u4FDD\u5B58");else G("\u6807\u6CE8\u5DF2\u4FDD\u5B58\uFF0C\u622A\u56FE\u672A\u5B8C\u6210");if(b)t.sendMessage({action:H.enrich,annotationId:b,data:f}).catch(()=>{})}else m("failure"),G(d?.error?`\u4FDD\u5B58\u5931\u8D25\uFF1A${d.error}`:"\u4FDD\u5B58\u5931\u8D25"),P.setBusy(!1)}catch(d){m("failure");let b=d instanceof Error?d.message:String(d);G(/context invalidated/i.test(b)?"\u8BF7\u5237\u65B0\u9875\u9762\u540E\u91CD\u65B0\u6807\u6CE8":`\u4FDD\u5B58\u5931\u8D25\uFF1A${b}`),P.setBusy(!1)}finally{g.classList.remove("capturing"),P.setCapturing(!1),delete s.__uibotAnnotationCapture,delete s.__uibotAnnotationCaptureDone}}ie.current=(n)=>{vn(n)};function G(n){let r=document.createElement("div");r.className="toast",r.style.background="var(--pa-danger, #b91c1c)",r.style.color="var(--pa-danger-contrast, #fff)",r.textContent=n,E.appendChild(r),setTimeout(()=>r.remove(),1800)}let ne=null,Ue=null,Se=null,Ie=null,ye=[],$e=[];function An(n){let r=n.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/);if(!r){let u=document.createElement("span");if(u.style.color=n,!u.style.color)u.style.color="var(--pa-color-default, #000000)";y.appendChild(u);let f=getComputedStyle(u).color;u.remove();let m=document.createElement("canvas").getContext("2d");if(!m)return"#000000";if(m.fillStyle=f,/^#[0-9a-f]{6}$/i.test(m.fillStyle))return m.fillStyle;m.fillRect(0,0,1,1);let d=m.getImageData(0,0,1,1).data;return`#${[d[0],d[1],d[2]].map((b)=>(b??0).toString(16).padStart(2,"0")).join("")}`}let a=(u)=>Math.max(0,Math.min(255,Number.parseInt(u,10))).toString(16).padStart(2,"0");return`#${a(r[1])}${a(r[2])}${a(r[3])}`}function ze(n,r,a){n.style.setProperty(r,a)}function rt(n,r){let a=n.style.getPropertyValue(r);$e.push(()=>{if(a)n.style.setProperty(r,a);else n.style.removeProperty(r)})}function Ve(n){let r=document.createElement("div");r.className="erow";let a=document.createElement("span");a.className="lb",a.textContent=n;let u=document.createElement("div");return u.className="ctl",r.append(a,u),{row:r,ctl:u}}function Ct(n,r,a,u){let f=u.getPropertyValue(a).trim();rt(n,a);let{row:m,ctl:d}=Ve(r),b=document.createElement("div");b.className="efield";let k=document.createElement("label");k.className="sw";let O=document.createElement("i");O.style.background=f,k.appendChild(O);let w=document.createElement("input");w.value=f;let z=document.createElement("input");return z.type="color",z.value=An(f),z.className="color-hit",z.setAttribute("aria-label",`\u9009\u62E9${r}`),z.addEventListener("input",()=>{w.value=z.value,O.style.background=z.value,ze(n,a,z.value)}),w.addEventListener("input",()=>{O.style.background=w.value,ze(n,a,w.value)}),k.appendChild(z),b.append(k,w),d.appendChild(b),ye.push({kind:"style",label:r,property:a,before:f,read:()=>w.value.trim()}),m}function St(n){let r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 16 16"),r.setAttribute("aria-hidden","true");let a=document.createElementNS("http://www.w3.org/2000/svg","path");if(a.setAttribute("d","M3 8h10"),a.setAttribute("fill","none"),a.setAttribute("stroke","currentColor"),a.setAttribute("stroke-width","1.8"),a.setAttribute("stroke-linecap","round"),r.appendChild(a),n==="plus"){let u=a.cloneNode();u.setAttribute("d","M8 3v10"),r.appendChild(u)}return r}function je(n,r,a,u,f){let m=u.getPropertyValue(a).trim();rt(n,a);let{row:d,ctl:b}=Ve(r),k=document.createElement("div");k.className="efield stepper";let O=document.createElement("button");O.type="button",O.setAttribute("aria-label",`\u964D\u4F4E${r}`),O.appendChild(St("minus"));let w=document.createElement("input");w.type="number",w.min=String(f.min),w.max=String(f.max),w.step=String(f.step),w.setAttribute("aria-label",r);let z=document.createElement("span");z.className="unit",z.textContent=f.unit;let C=document.createElement("button");C.type="button",C.setAttribute("aria-label",`\u63D0\u9AD8${r}`),C.appendChild(St("plus"));let I=Math.max(0,(String(f.step).split(".")[1]||"").length),S=(U)=>{let ge=ae(Number.isFinite(U)?U:f.min,f.min,f.max),at=Math.round(ge/f.step)*f.step;return Number(at.toFixed(I))},T=S(f.fromCss(m)),ue=()=>{w.value=String(T),O.disabled=T<=f.min,C.disabled=T>=f.max,ze(n,a,f.toCss(T))},le=(U)=>{T=S(U),ue()};return w.value=String(T),w.addEventListener("input",()=>{let U=Number(w.value);if(Number.isFinite(U))T=U,ze(n,a,f.toCss(ae(U,f.min,f.max)))}),w.addEventListener("change",()=>le(Number(w.value))),O.addEventListener("click",()=>le(T-f.step)),C.addEventListener("click",()=>le(T+f.step)),ue(),k.append(O,w,z,C),b.appendChild(k),ye.push({kind:"style",label:r,property:a,before:m,read:()=>f.toCss(T)}),d}function kn(n){let r=n.textContent||"",a=r.replace(/\\s+/g," ").trim();$e.push(()=>{n.textContent=r});let{row:u,ctl:f}=Ve("\u6587\u6848"),m=document.createElement("div");m.className="efield";let d=document.createElement("input");return d.value=a,m.appendChild(d),f.appendChild(m),d.addEventListener("input",()=>{n.textContent=d.value}),ye.push({kind:"text",label:"\u6587\u6848",before:a,read:()=>d.value.trim()}),u}function wn(n,r){let a=r.getPropertyValue("font-weight").trim()||"400";rt(n,"font-weight");let{row:u,ctl:f}=Ve("\u5B57\u91CD"),m=[{value:"300",label:"\u7EC6 300"},{value:"400",label:"\u5E38\u89C4 400"},{value:"500",label:"\u4E2D 500"},{value:"600",label:"\u534A\u7C97 600"},{value:"700",label:"\u7C97 700"}],d=m.some((k)=>k.value===a)?a:"400",b=hn(m,d,(k)=>ze(n,"font-weight",k));return f.appendChild(b.el),ye.push({kind:"style",label:"\u5B57\u91CD",property:"font-weight",before:a,read:()=>b.get()}),u}let De=()=>{return};function it(n){if(n)$e.forEach((r)=>{try{r()}catch{}});$e.length=0,ye=[],De(),De=()=>{return},ne?.remove(),ne=null,Ue=null,Se=Ie=null,me.length=0,Z(),h="hovering",x=null}function Mt(n){if(F)ot();if(ne)it(n)}function En(n){h="editing",x=n,Ue=n,tt(),we(n,Te.length+1),ye=[],$e.length=0,me.length=0;let r=getComputedStyle(n),a=n.getBoundingClientRect();ne=document.createElement("div"),ne.className="epanel",ne.addEventListener("click",()=>{for(let S of me)S()});let u=document.createElement("div");u.className="etop";let f=document.createElement("span");f.className="ico",f.textContent="\u2699",Se=document.createElement("input"),Se.placeholder="\u7528\u4E00\u53E5\u8BDD\u63CF\u8FF0\u60F3\u8981\u7684\u4FEE\u6539\uFF08\u53EF\u9009\uFF09",u.append(f,Se);let m=document.createElement("div");m.className="ehead";let d=document.createElement("span");d.className="tg",d.textContent=n.tagName.toLowerCase();let b=document.createElement("span");b.className="grip",b.textContent="\u283F",m.append(d,b);let k=document.createElement("div");if(k.className="erows",n.children.length===0&&(n.textContent||"").trim())k.appendChild(kn(n));k.appendChild(Ct(n,"\u6587\u5B57\u989C\u8272","color",r)),k.appendChild(Ct(n,"\u80CC\u666F","background-color",r)),k.appendChild(je(n,"\u4E0D\u900F\u660E\u5EA6","opacity",r,{min:0,max:100,step:5,unit:"%",fromCss:(S)=>Number.parseFloat(S||"1")*100,toCss:(S)=>String(S/100)})),k.appendChild(je(n,"\u5B57\u53F7","font-size",r,{min:8,max:96,step:1,unit:"px",fromCss:(S)=>Number.parseFloat(S||"16"),toCss:(S)=>`${S}px`})),k.appendChild(wn(n,r)),k.appendChild(je(n,"\u5706\u89D2","border-radius",r,{min:0,max:96,step:1,unit:"px",fromCss:(S)=>Number.parseFloat(S||"0"),toCss:(S)=>`${S}px`})),k.appendChild(je(n,"\u5185\u8FB9\u8DDD","padding",r,{min:0,max:96,step:1,unit:"px",fromCss:(S)=>Number.parseFloat(S||"0"),toCss:(S)=>`${S}px`}));let O=document.createElement("div");O.className="ebar";let w=document.createElement("button");w.type="button",w.className="cancel",w.textContent="\u53D6\u6D88",w.addEventListener("click",()=>it(!0)),Ie=Et("\u4FDD\u5B58\u4FEE\u6539"),Ie.addEventListener("click",()=>void Tn()),O.append(w,Ie),ne.append(u,m,k,O),E.appendChild(ne),De(),De=yt(ne,m);let z=340,C=a.right+12;if(C+z>window.innerWidth-8)C=Math.max(8,a.left-z-12);if(C<8)C=8;let I=Math.max(8,Math.min(a.top,window.innerHeight-(ne.offsetHeight||360)-8));ne.style.left=`${C}px`,ne.style.top=`${I}px`,Se.focus()}function Nn(n){return n.map((r)=>`${r.label} ${ke(r.before,24)}\u2192${ke(r.after,24)}`).join("\uFF1B")}async function Tn(){if(!Ue)return;let n=Ue,r=[];for(let d of ye){let b=d.read();if(b!==d.before)r.push({kind:d.kind,label:d.label,property:d.property,before:d.before,after:b})}let a=Se?.value.trim()||"";if(r.length===0&&!a){G("\u672A\u505A\u4EFB\u4F55\u4FEE\u6539");return}let u=xt(n);u.type="style",u.edits=r;let f=Nn(r);if(u.comment=a||(f?`\u53EF\u89C6\u5316\u4FEE\u6539\uFF1A${f}`:"\u53EF\u89C6\u5316\u4FEE\u6539"),a&&f)u.expectedResult=f;g.style.visibility="hidden";let m=Ie;Ce(m,!0);try{let d=await t.sendMessage({action:H.save,data:u});if(g.style.visibility="visible",d&&d.success){it(!1),Re(),Me("\u5DF2\u4FDD\u5B58");let b=d.data?.id;if(b)t.sendMessage({action:H.enrich,annotationId:b,data:u}).catch(()=>{})}else console.error("[uibot annotation] edit save rejected:",d),G(d?.error?`\u4FDD\u5B58\u5931\u8D25\uFF1A${d.error}`:"\u4FDD\u5B58\u5931\u8D25"),Ce(m,!1)}catch(d){g.style.visibility="visible";let b=d instanceof Error?d.message:String(d);G(/context invalidated/i.test(b)?"\u8BF7\u5237\u65B0\u9875\u9762\u540E\u91CD\u8BD5":`\u4FDD\u5B58\u5931\u8D25\uFF1A${b}`),Ce(m,!1)}}function Ye(n){return n instanceof Node&&g.contains(n)}function Rt(n){if(h!=="hovering"||p==="region")return;let r=n.target;if(!r||Ye(r)||r===g)return;x=r,At(r)}function Lt(n){if(Ye(n.target))return;let r=n.target;if(!r)return;if(n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation?.(),h==="hovering"){if(p==="adjust")En(r);else if(p==="element")Nt(r)}}function Cn(){let n=y.activeElement;return n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLElement&&n.isContentEditable}function _t(n){if(Cn()||n.target instanceof HTMLInputElement||n.target instanceof HTMLTextAreaElement||n.target instanceof HTMLElement&&n.target.isContentEditable)return;if(h==="hovering"&&!Y){if(n.key.toLowerCase()==="e")Ne("element");if(o&&n.key.toLowerCase()==="r")Ne("region");if(n.key.toLowerCase()==="a")Ne("adjust")}if(o&&p==="region"&&Y&&v&&h==="hovering"){if(n.key==="Enter"){n.preventDefault(),Y=!1,Nt(null,v);return}if(n.key.startsWith("Arrow")){n.preventDefault();let a=n.shiftKey?10:1,u=n.key.replace("Arrow","").toLowerCase();if(n.altKey){let f=u==="left"?-a:u==="right"?a:0,m=u==="up"?-a:u==="down"?a:0;v={...v,width:ae(v.width+f,8,window.innerWidth-v.x),height:ae(v.height+m,8,window.innerHeight-v.y)}}else{let f=u==="left"?-a:u==="right"?a:0,m=u==="up"?-a:u==="down"?a:0;v={...v,x:ae(v.x+f,0,window.innerWidth-v.width),y:ae(v.y+m,0,window.innerHeight-v.height)}}et(v);return}}if(n.key!=="Escape")return;if(P.isActive()&&(P.getMarks().length>0||D||Y)){P.clear(),Qe();return}if(D||Y){D=null,Y=!1,v=null,L.style.display="none";return}if(h==="editing")Mt(!0);else Xe(!0)}function Pt(n){if(!o||p!=="region"||h!=="hovering"||Ye(n.target))return;let r=n;if(!P.handlePointerDown(r))return;r.preventDefault(),r.stopPropagation(),pe=r.target instanceof Element?r.target:null,fe=r.pointerId;try{pe?.setPointerCapture?.(r.pointerId)}catch{}D={x:r.clientX,y:r.clientY},v=null,Y=!1}function Ot(n){if(!o||p!=="region"||h!=="hovering")return;let r=n;if(!P.handlePointerMove(r))return;r.preventDefault()}function It(n){if(!o||p!=="region"||h!=="hovering")return;let r=n;if(r.button!==0||fe!=null&&r.pointerId!==fe)return;if(P.handlePointerUp(r))r.preventDefault(),r.stopPropagation();Je(),D=null,L.style.display="none"}function $t(n){let r=n;if(fe!=null&&r.pointerId!==fe)return;P.handlePointerCancel(),Qe()}ee.addEventListener("keydown",(n)=>{if(!o||n.key!=="Enter"||p!=="region")return;n.preventDefault(),n.stopPropagation();let r=Math.min(160,window.innerWidth),a=Math.min(96,window.innerHeight);v={x:Math.round((window.innerWidth-r)/2),y:Math.round((window.innerHeight-a)/2),width:r,height:a},Y=!1,P.addRect(v),L.style.display="none"});function Ke(){if(D)Qe();if(h==="hovering"&&x)At(x);if(V)J();for(let n of Te)nt(n.target,n.pinEl)}document.addEventListener("mousemove",Rt,!0),document.addEventListener("click",Lt,!0),document.addEventListener("keydown",_t,!0),document.addEventListener("pointerdown",Pt,!0),document.addEventListener("pointermove",Ot,!0),document.addEventListener("pointerup",It,!0),document.addEventListener("pointercancel",$t,!0),window.addEventListener("scroll",Ke,!0),window.addEventListener("resize",Ke,!0),j.addEventListener("click",()=>Xe(!0));function Xe(n){let r=c.start("overlay_exit");if(l(),Fe(),De(),P.detach(),document.removeEventListener("mousemove",Rt,!0),document.removeEventListener("click",Lt,!0),document.removeEventListener("keydown",_t,!0),document.removeEventListener("pointerdown",Pt,!0),document.removeEventListener("pointermove",Ot,!0),document.removeEventListener("pointerup",It,!0),document.removeEventListener("pointercancel",$t,!0),window.removeEventListener("scroll",Ke,!0),window.removeEventListener("resize",Ke,!0),Mn(),wt(),g.remove(),delete s.__uibotAnnotatorActive,delete s.__uibotAnnotatorTeardown,r("success"),n)try{t.sendMessage({action:H.closed}).catch(()=>{}),s.__uibotAnnotationClosed?.()}catch{}}function Sn(n){if(n.action===H.teardown)Xe(!1);else if(n.action===H.changed)Re()}let Mn=t.subscribe(Sn);s.__uibotAnnotatorTeardown=()=>Xe(!1),c.markFromStart("overlay_ready"),l=ln(()=>{Re()})}function Eo(){let e=globalThis.__uibotAnnotationTheme;return e&&typeof e==="object"?e:void 0}function pn(e={}){let t=e.theme??Eo();un({annotationRegionV2:e.annotationRegionV2!==!1,...t?{theme:t}:{}},Jt())}pn({annotationRegionV2:!0});})();';function I(e){let t=g(e);return`${Object.keys(t).length?`window.__uibotAnnotationTheme=${JSON.stringify(t)};`:""}${k};window.__uibotAnnotationClosed=function(){console.debug(${JSON.stringify(m)})};true`}function P(){return"try{window.__uibotAnnotatorTeardown&&window.__uibotAnnotatorTeardown()}catch(e){};true"}function R(){return"window.__uibotAnnotationSnapshot||null"}function j(e,t){return`window.__uibotAnnotationBridge&&window.__uibotAnnotationBridge.update(${JSON.stringify(e)},${JSON.stringify(t)})`}function B(e){return`window.__uibotAnnotationBridge&&window.__uibotAnnotationBridge.remove(${JSON.stringify(e)})`}function D(){return"window.__uibotAnnotationBridge&&window.__uibotAnnotationBridge.clear()"}function q(){return"window.__uibotAnnotationCapture||null"}function H(){return"try{window.__uibotAnnotationCaptureDone&&window.__uibotAnnotationCaptureDone()}catch(e){};true"}function U(e){return e.includes(m)}function Y(e){return e.includes(y)}function W(e){return e.includes(w)}export{w as ANNOTATION_CAPTURE_MARK,y as ANNOTATION_CHANGED_MARK,m as ANNOTATION_CLOSED_MARK,k as ANNOTATOR_IIFE,I as annotatorBootScript,H as annotatorCaptureDoneScript,q as annotatorCaptureSpecScript,D as annotatorClearScript,B as annotatorRemoveScript,R as annotatorSnapshotScript,P as annotatorTeardownScript,j as annotatorUpdateScript,W as isAnnotatorCaptureConsole,Y as isAnnotatorChangedConsole,U as isAnnotatorClosedConsole};
|
package/dist/host.d.ts
CHANGED
package/dist/host.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var B="uibot.annotation.host.v1",V="uibot.annotation.page.v1",we=1048576,U=20,j=262144,q=2;function v(e){if(!e||typeof e!=="object"||Array.isArray(e))return!1;try{return new TextEncoder().encode(JSON.stringify(e)).length<=1048576}catch{return!1}}var z=["--pa-accent","--pa-accent-soft","--pa-outline","--pa-accent-contrast","--pa-surface","--pa-surface-contrast","--pa-shadow","--pa-muted","--pa-hover","--pa-border","--pa-popover-contrast","--pa-popover","--pa-focus","--pa-selected","--pa-accent-halo","--pa-field","--pa-checker","--pa-success","--pa-success-contrast","--pa-danger","--pa-danger-contrast","--pa-color-default"],Te=8192;function w(e){if(typeof e!=="string"||e.length>256||!e.trim())return!1;if(/[;{}\\<>!@'"]/.test(e)||[...e].some((o)=>o.charCodeAt(0)<32)||/url\s*\(|var\s*\(|\/\*|\*\//i.test(e))return!1;let t=e.trim();if(/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i.test(t))return!0;if(new Set("aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato transparent turquoise violet wheat white whitesmoke yellow yellowgreen".split(" ")).has(t.toLowerCase()))return!0;let r=t.match(/^(rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\(([^()]+)\)$/i);if(r){let o=(r[1]??"").toLowerCase(),s=(r[2]??"").trim(),l=s.includes(",");if(l&&(!/^(rgb|rgba|hsl|hsla)$/.test(o)||s.includes("/")))return!1;let u=s.split("/");if(u.length>2)return!1;let g=l?s.split(",").map((y)=>y.trim()):(u[0]??"").trim().split(/\s+/),f=l?g[3]:u[1]?.trim();if(g.length!==3&&!(l&&g.length===4))return!1;let c=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?%?$/i;if(f!==void 0&&!c.test(f)&&!(f==="none"&&!l))return!1;return g.slice(0,3).every((y,S)=>{if(y==="none")return!l;let p=/^(hsl|hsla|hwb)$/.test(o)?S===0:/^(lch|oklch)$/.test(o)&&S===2;return c.test(y)||p&&/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(deg|rad|grad|turn)$/i.test(y)})}let i=t.match(/^color\((srgb|srgb-linear|display-p3|a98-rgb|prophoto-rgb|rec2020|xyz|xyz-d50|xyz-d65) ([^()]+)\)$/i);if(i)return w(`rgb(${i[2]})`);let a=t.match(/^color-mix\(in srgb, (.+) (\d+(?:\.\d+)?)%, (.+)\)$/i);return!!a&&Number(a[2])<=100&&w(a[1])&&w(a[3])}function R(e){if(!e||typeof e!=="object"||Array.isArray(e))return{};try{if(new TextEncoder().encode(JSON.stringify(e)).length>8192)return{}}catch{return{}}let t={};for(let n of z){let r=Object.hasOwn(e,n)?e[n]:void 0;if(w(r))t[n]=r.trim()}return t}function De(e,t){let n=R(t);for(let r of z){let i=n[r];if(i===void 0)e.style.removeProperty(r);else e.style.setProperty(r,i)}}var ae={spec:["html","markdown","zip"],prototype:["html","zip"],deck:["html","pptx","zip"],poster:["html","zip"]},kt=Array.from(new Set(Object.values(ae).flat()));var Rt=Object.freeze([Object.freeze({name:"manifest",summary:"Describe query operations and list the derived resource index.",positionals:Object.freeze([]),options:Object.freeze([])}),Object.freeze({name:"search",summary:"Search resources with deterministic bilingual ranking and reasons.",positionals:Object.freeze([Object.freeze({name:"text",property:"text",type:"string",required:!1})]),options:Object.freeze([Object.freeze({name:"kind",property:"kinds",type:"resource-kind",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"tag",property:"tags",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"category",property:"categories",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"capability",property:"capabilities",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"maturity",property:"maturities",type:"resource-maturity",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"limit",property:"limit",type:"positive-integer"})])}),Object.freeze({name:"get",summary:"Resolve one canonical resource id or unambiguous alias.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])}),Object.freeze({name:"build",summary:"Plan dependency closure and gaps without writing or installing.",positionals:Object.freeze([Object.freeze({name:"root",property:"roots",type:"string",required:!0,variadic:!0})]),options:Object.freeze([])})]);var P={count:20,messageBytes:1048576,screenshotBytes:262144,screenshots:2,comment:4000,selector:2000,edits:20};function E(e){if(!e||typeof e!=="object"||Array.isArray(e))throw Error("Invalid annotation object");return e}function I(e,t){if(Object.keys(e).some((n)=>!t.includes(n)))throw Error("Unknown annotation field")}function C(e,t,n=!1){if(typeof e!=="string"||!n&&!e.trim()||e.length>t||Array.from(e).some((r)=>{let i=r.charCodeAt(0);return i===127||i<32&&i!==9&&i!==10&&i!==13}))throw Error("Invalid annotation text");return e}function W(e){let t=E(e);I(t,["x","y","width","height"]);for(let n of["x","y","width","height"])if(typeof t[n]!=="number"||!Number.isFinite(t[n])||Math.abs(t[n])>1e7)throw Error("Invalid annotation coordinates");if(t.width<0||t.height<0)throw Error("Invalid annotation dimensions");return{x:t.x,y:t.y,width:t.width,height:t.height}}function H(e){if(!Array.isArray(e)||!e.length||e.length>P.count)throw Error("Expected 1 to 20 annotations");if(new TextEncoder().encode(JSON.stringify(e)).length>P.messageBytes)throw Error("Annotations exceed the message budget");let t=0,n=new Set;return e.map((r)=>{let i=E(r);I(i,["id","comment","target","type","priority","edits","screenshot"]);let a=C(i.id,100);if(!/^[a-zA-Z0-9_-]+$/.test(a)||n.has(a))throw Error("Invalid or duplicate annotation ID");n.add(a);let o=C(i.comment,P.comment).trim();if(!["bug","style","copywriting","feature","interaction","data","other"].includes(i.type)||!["low","medium","high","blocker"].includes(i.priority))throw Error("Invalid annotation classification");let s=E(i.target),l;if(s.kind==="element"){I(s,["kind","cssSelector","xpath","tagName","textContent","boundingBox","uibotId"]);let f=C(s.tagName,80);if(!/^[a-zA-Z][a-zA-Z0-9:_-]*$/.test(f))throw Error("Invalid annotation tag");let c=s.uibotId===void 0?void 0:C(s.uibotId,200);if(c!==void 0&&!/^[\w:.-]+$/.test(c))throw Error("Invalid annotation element ID");l={kind:"element",cssSelector:C(s.cssSelector,P.selector),xpath:C(s.xpath,P.selector,!0),tagName:f,boundingBox:W(s.boundingBox),...s.textContent===void 0?{}:{textContent:C(s.textContent,1000,!0)},...c===void 0?{}:{uibotId:c}}}else if(s.kind==="region")I(s,["kind","rect"]),l={kind:"region",rect:W(s.rect)};else throw Error("Invalid annotation target");let u;if(i.edits!==void 0){if(!Array.isArray(i.edits)||i.edits.length>P.edits)throw Error("Invalid annotation edits");u=i.edits.map((f)=>{let c=E(f);if(I(c,["kind","label","property","before","after"]),c.kind!=="style"&&c.kind!=="text")throw Error("Invalid annotation edit kind");let y=c.property===void 0?void 0:C(c.property,100);if(y!==void 0&&!/^[-a-zA-Z][\w-]*$/.test(y))throw Error("Invalid annotation style property");return{kind:c.kind,label:C(c.label,200),before:C(c.before,4000,!0),after:C(c.after,4000,!0),...y===void 0?{}:{property:y}}})}let g;if(i.screenshot!==void 0){if(g=C(i.screenshot,P.screenshotBytes),!/^data:image\/(png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(g)||++t>P.screenshots)throw Error("Invalid annotation screenshot")}return{id:a,comment:o,type:i.type,priority:i.priority,target:l,...u?{edits:u}:{},...g?{screenshot:g}:{}}})}function vn(e){let t={blocker:0,high:1,medium:2,low:3};return[...e].sort((n,r)=>t[n.priority]-t[r.priority]||n.createdAt.localeCompare(r.createdAt))}function wn(e,t){if(e.target.kind==="region")return`${t==="zh"?"\u533A\u57DF":"Region"} ${Math.round(e.target.rect.width)}\xD7${Math.round(e.target.rect.height)}`;return`${e.target.tagName}\u300C${(e.target.textContent??e.target.cssSelector).slice(0,48)}\u300D`}function K(e){let t=e.target;return{id:e.id,comment:e.comment.trim(),type:e.type,priority:e.priority,target:t.kind==="region"?{kind:"region",rect:t.rect}:{kind:"element",cssSelector:t.cssSelector,xpath:t.xpath,tagName:t.tagName,...t.textContent?{textContent:t.textContent}:{},boundingBox:t.boundingBox,...t.attributes["data-uibot-id"]?{uibotId:t.attributes["data-uibot-id"]}:{}},...e.edits?.length?{edits:e.edits.map((n)=>({kind:n.kind,label:n.label,before:n.before,after:n.after,...n.property?{property:n.property}:{}}))}:{},...e.screenshot?{screenshot:e.screenshot}:{}}}var Y=[{id:"red",value:"#ef4444",label:"\u7EA2"},{id:"orange",value:"#f97316",label:"\u6A59"},{id:"yellow",value:"#eab308",label:"\u9EC4"},{id:"green",value:"#22c55e",label:"\u7EFF"},{id:"blue",value:"#3b82f6",label:"\u84DD"},{id:"white",value:"#f8fafc",label:"\u767D"}],Tn=12,Dn=48,On=4,Nn=16;function G(e){let t=Math.round(e/4)*4;return Math.min(48,Math.max(12,t))}function se(e,t){let n=G(t),r=Math.max(1,[...e].length);return{width:Math.max(n,r*n),height:Math.ceil(n*1.35)}}var le=new Set(Y.map((e)=>e.value));function ce(e){return le.has(e)}function _n(){return Y[0].value}function b(e){return typeof e==="number"&&Number.isFinite(e)}function de(e){if(!e||typeof e!=="object"||Array.isArray(e))return null;let t=e;if(typeof t.color!=="string"||!ce(t.color))return null;if(t.kind==="rect"){if(!b(t.x)||!b(t.y)||!b(t.width)||!b(t.height))return null;if(t.width<8||t.height<8)return null;return{kind:"rect",color:t.color,x:t.x,y:t.y,width:t.width,height:t.height}}if(t.kind==="arrow"){if(!b(t.x1)||!b(t.y1)||!b(t.x2)||!b(t.y2))return null;return{kind:"arrow",color:t.color,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}}if(t.kind==="text"){if(!b(t.x)||!b(t.y)||typeof t.text!=="string")return null;let n=t.text.trim();if(!n)return null;let r=t.fontSize===void 0?16:b(t.fontSize)?G(t.fontSize):null;if(r==null)return null;return{kind:"text",color:t.color,x:t.x,y:t.y,text:n,fontSize:r}}return null}function J(e){if(e===void 0)return;if(!Array.isArray(e))return;let t=[];for(let n of e){let r=de(n);if(!r)return;t.push(r)}return t}function Mn(e){if(e.length===0)return"\u533A\u57DF\u6807\u6CE8";let t=e.filter((a)=>a.kind==="rect").length,n=e.filter((a)=>a.kind==="arrow").length,r=e.filter((a)=>a.kind==="text"),i=[];if(t)i.push(`${t} \u4E2A\u6846`);if(n)i.push(`${n} \u4E2A\u7BAD\u5934`);if(r.length){let a=r.map((o)=>o.text.trim()).filter(Boolean).slice(0,3).map((o)=>`\u300C${o.length>16?`${o.slice(0,16)}\u2026`:o}\u300D`);i.push(a.length?`\u6587\u672C ${a.join(" ")}`:`${r.length} \u5904\u6587\u672C`)}return`\u533A\u57DF\u6807\u6CE8\uFF08${i.join("\uFF0C")}\uFF09`}function Fn(e,t=16){if(e.length===0)return null;let{POSITIVE_INFINITY:n,POSITIVE_INFINITY:r,NEGATIVE_INFINITY:i,NEGATIVE_INFINITY:a}=Number;for(let o of e)if(o.kind==="rect")n=Math.min(n,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x+o.width),a=Math.max(a,o.y+o.height);else if(o.kind==="arrow")n=Math.min(n,o.x1,o.x2),r=Math.min(r,o.y1,o.y2),i=Math.max(i,o.x1,o.x2),a=Math.max(a,o.y1,o.y2);else{let s=se(o.text,o.fontSize);n=Math.min(n,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x+s.width),a=Math.max(a,o.y+s.height)}return{x:n-t,y:r-t,width:Math.max(8,i-n+t*2),height:Math.max(8,a-r+t*2)}}function Ln(e,t,n){return e.map((r)=>{if(r.kind==="rect")return{...r,x:r.x+t,y:r.y+n};if(r.kind==="arrow")return{...r,x1:r.x1+t,y1:r.y1+n,x2:r.x2+t,y2:r.y2+n};return{...r,x:r.x+t,y:r.y+n,fontSize:r.fontSize}})}function Bn(e,t){let n=Math.max(0,Math.min(e.x,t.width)),r=Math.max(0,Math.min(e.y,t.height)),i=Math.min(e.width,t.width-n),a=Math.min(e.height,t.height-r);if(i<8||a<8)return null;return{x:n,y:r,width:i,height:a}}var Z={blocker:0,high:1,medium:2,low:3};function T(e){return e.status==="open"||e.status==="processing"}function D(e){return[...e].sort((t,n)=>Z[t.priority]-Z[n.priority]||t.createdAt.localeCompare(n.createdAt))}function Un(e){return D(e.filter(T))}var ue=["open","processing","done","verified","ignored"],pe=["bug","style","copywriting","feature","interaction","data","other"],X=["low","medium","high","blocker"],ge=["testid","id","aria","class","text","path"],me=["light","dark","unknown"],fe=["react","vue","angular","svelte","nextjs","nuxt","unknown"],ye=["target-location","screenshot","context-bundle","dom-snapshot","style-snapshot"],Ce=["inline","exported-file","url","none"];function m(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function x(e,t){return typeof e==="string"&&t.includes(e)}function h(e){return typeof e==="number"&&Number.isFinite(e)}function A(e){return h(e)&&e>0}function N(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function ee(e){return m(e)&&Object.values(e).every((t)=>typeof t==="string")}function d(e){return e===void 0||typeof e==="string"}function te(e){if(!m(e)||!h(e.x)||!h(e.y)||!A(e.width)||!A(e.height))return;return{x:e.x,y:e.y,width:e.width,height:e.height}}function _(e){if(!m(e)||!A(e.width)||!A(e.height))return;return{width:e.width,height:e.height}}function M(e){if(!m(e)||!h(e.x)||!h(e.y))return;return{x:e.x,y:e.y}}function Q(e){if(!m(e)||typeof e.fileName!=="string"||!A(e.lineNumber))return;if(e.columnNumber!==void 0&&(!h(e.columnNumber)||e.columnNumber<0))return;if(!d(e.componentName))return;return{fileName:e.fileName,lineNumber:e.lineNumber,...e.columnNumber===void 0?{}:{columnNumber:e.columnNumber},...e.componentName===void 0?{}:{componentName:e.componentName}}}function be(e){let t=te(e.boundingBox);if(typeof e.tagName!=="string"||!e.tagName||typeof e.cssSelector!=="string"||!e.cssSelector||typeof e.xpath!=="string"||!e.xpath||!ee(e.attributes)||!t||!N(e.domPath))return;if(!d(e.textContent)||e.breadcrumb!==void 0&&!N(e.breadcrumb))return;if(e.selectorStrategy!==void 0&&!x(e.selectorStrategy,ge))return;if(!d(e.region))return;let n;if(e.accessibility!==void 0){if(!m(e.accessibility)||!d(e.accessibility.role)||!d(e.accessibility.name)||!d(e.accessibility.ariaLabel))return;n={...e.accessibility.role===void 0?{}:{role:e.accessibility.role},...e.accessibility.name===void 0?{}:{name:e.accessibility.name},...e.accessibility.ariaLabel===void 0?{}:{ariaLabel:e.accessibility.ariaLabel}}}let r=e.sourceLocation===void 0?void 0:Q(e.sourceLocation);if(e.sourceLocation!==void 0&&!r)return;let i;if(e.sourceStack!==void 0){if(!Array.isArray(e.sourceStack))return;let a=e.sourceStack.map(Q);if(a.some((o)=>!o))return;i=a.filter((o)=>Boolean(o))}return{kind:"element",tagName:e.tagName,cssSelector:e.cssSelector,xpath:e.xpath,...e.textContent===void 0?{}:{textContent:e.textContent},attributes:{...e.attributes},boundingBox:t,domPath:[...e.domPath],...n?{accessibility:n}:{},...e.selectorStrategy===void 0?{}:{selectorStrategy:e.selectorStrategy},...e.region===void 0?{}:{region:e.region},...e.breadcrumb===void 0?{}:{breadcrumb:[...e.breadcrumb]},...r?{sourceLocation:r}:{},...i?{sourceStack:i}:{}}}function xe(e){let t=te(e.rect),n=_(e.viewport),r=M(e.scroll);if(!t||t.width<8||t.height<8||!n||!r||!A(e.devicePixelRatio))return;if(e.breadcrumb!==void 0&&!N(e.breadcrumb))return;let i;if(e.topLevelElements!==void 0){if(!Array.isArray(e.topLevelElements))return;i=[];for(let o of e.topLevelElements){if(!m(o)||typeof o.tagName!=="string"||!o.tagName||!d(o.text)||!d(o.role))return;i.push({tagName:o.tagName,...o.text===void 0?{}:{text:o.text},...o.role===void 0?{}:{role:o.role}})}}let a=e.marks===void 0?void 0:J(e.marks);if(e.marks!==void 0&&!a)return;return{kind:"region",rect:t,viewport:n,scroll:r,devicePixelRatio:e.devicePixelRatio,...e.breadcrumb===void 0?{}:{breadcrumb:[...e.breadcrumb]},...i?{topLevelElements:i}:{},...a?.length?{marks:a}:{}}}function he(e){if(!m(e))return{ok:!1,reason:"target is not an object",raw:e};if(e.kind==="region"){let t=xe(e);return t?{ok:!0,value:t}:{ok:!1,reason:"invalid region target",raw:e}}if(e.kind==="element"||e.kind===void 0){let t=be(e);return t?{ok:!0,value:t}:{ok:!1,reason:"invalid element target",raw:e}}return{ok:!1,reason:`unknown target kind: ${String(e.kind)}`,raw:e}}function ke(e){if(!m(e))return;let t=_(e.viewport),n=M(e.scroll);if(!t||!n||!A(e.devicePixelRatio)||!m(e.center)||!h(e.center.x)||!h(e.center.y)||typeof e.visible!=="boolean"||!d(e.positioning))return;return{viewport:t,scroll:n,devicePixelRatio:e.devicePixelRatio,center:{x:e.center.x,y:e.center.y},visible:e.visible,...e.positioning===void 0?{}:{positioning:e.positioning}}}function ne(e){if(!m(e))return;let{url:t,origin:n,path:r,title:i,capturedAt:a,query:o,hash:s,referrer:l,language:u,userAgent:g,uiState:f}=e,c=_(e.viewport),y=M(e.scroll);if(!c||!m(e.viewport)||!A(e.viewport.devicePixelRatio)||!y)return;if(typeof t!=="string"||!t||typeof n!=="string"||!n||typeof r!=="string"||!r||typeof i!=="string"||typeof a!=="string"||!a)return;if(!d(o)||!d(s)||!d(l)||!d(u)||!d(g)||!d(f))return;if(e.theme!==void 0&&!x(e.theme,me))return;if(e.framework!==void 0&&!x(e.framework,fe))return;return{url:t,origin:n,path:r,title:i,viewport:{...c,devicePixelRatio:e.viewport.devicePixelRatio},scroll:y,capturedAt:a,...o===void 0?{}:{query:o},...s===void 0?{}:{hash:s},...l===void 0?{}:{referrer:l},...e.theme===void 0?{}:{theme:e.theme},...e.framework===void 0?{}:{framework:e.framework},...u===void 0?{}:{language:u},...g===void 0?{}:{userAgent:g},...f===void 0?{}:{uiState:f}}}function Pe(e){if(e===void 0)return[];if(!Array.isArray(e))return;let t=[];for(let n of e){if(!m(n)||!x(n.kind,["style","text"])||typeof n.label!=="string"||!d(n.property)||typeof n.before!=="string"||typeof n.after!=="string")return;t.push({kind:n.kind,label:n.label,before:n.before,after:n.after,...n.property===void 0?{}:{property:n.property}})}return t}function Ae(e){if(!Array.isArray(e))return;let t=[];for(let n of e){if(!m(n)||!x(n.kind,ye)||!x(n.availability,Ce)||typeof n.label!=="string"||!n.label||!d(n.annotationId)||!d(n.reference))return;if(n.availability!=="none"&&!n.reference?.trim())return;t.push({kind:n.kind,availability:n.availability,label:n.label,...n.annotationId===void 0?{}:{annotationId:n.annotationId},...n.reference===void 0?{}:{reference:n.reference}})}return t}function F(e){if(!m(e))return{ok:!1,reason:"annotation is not an object",raw:e};let{id:t,pageUrl:n,comment:r,createdAt:i,updatedAt:a}=e;if(!x(e.status,ue))return{ok:!1,reason:"invalid status",raw:e};if(!x(e.type,pe))return{ok:!1,reason:"invalid type",raw:e};if(!x(e.priority,X))return{ok:!1,reason:"invalid priority",raw:e};if(typeof t!=="string"||!t)return{ok:!1,reason:"invalid id",raw:e};if(typeof n!=="string"||!n)return{ok:!1,reason:"invalid pageUrl",raw:e};if(typeof r!=="string"||!r)return{ok:!1,reason:"invalid comment",raw:e};if(typeof i!=="string"||!i)return{ok:!1,reason:"invalid createdAt",raw:e};if(typeof a!=="string"||!a)return{ok:!1,reason:"invalid updatedAt",raw:e};if(!d(e.expectedResult)||!d(e.preserve)||!d(e.screenshot))return{ok:!1,reason:"invalid optional annotation text",raw:e};if(!ee(e.styleSummary))return{ok:!1,reason:"invalid styleSummary",raw:e};let o=ke(e.geometry);if(!o)return{ok:!1,reason:"invalid geometry",raw:e};let s=ne(e.pageContext);if(!s)return{ok:!1,reason:"invalid pageContext",raw:e};let l=Pe(e.edits);if(!l)return{ok:!1,reason:"invalid edits",raw:e};let u=he(e.target);if(!u.ok)return u;return{ok:!0,value:{id:t,pageUrl:n,status:e.status,type:e.type,priority:e.priority,comment:r,target:u.value,styleSummary:{...e.styleSummary},geometry:o,pageContext:s,createdAt:i,updatedAt:a,...e.expectedResult===void 0?{}:{expectedResult:e.expectedResult},...e.preserve===void 0?{}:{preserve:e.preserve},...e.screenshot===void 0?{}:{screenshot:e.screenshot},...l.length?{edits:l}:{}}}}function Re(e){let t=[],n=[];return e.forEach((r,i)=>{let a=F(r);if(a.ok)t.push(a.value);else n.push({index:i,reason:a.reason,raw:a.raw})}),{annotations:D(t),failures:n}}function Wn(e){if(!m(e)||!Array.isArray(e.annotations))return{ok:!1,reason:"context annotations are missing",raw:e};if(e.version!=="1.0"&&e.version!=="2.0")return{ok:!1,reason:`unsupported context version: ${String(e.version)}`,raw:e};let t=Re(e.annotations),[n]=t.failures;if(n)return{ok:!1,reason:`invalid annotation at index ${n.index}`,raw:e};let r=e.version==="2.0";if(r){if(e.schema!=="infoos/web-annotation-context"||typeof e.contextId!=="string"||!e.contextId||typeof e.createdAt!=="string"||!e.createdAt||!x(e.scope,["active","all"])||!m(e.summary)||!h(e.summary.totalAnnotations)||e.summary.totalAnnotations<0||!h(e.summary.activeAnnotations)||e.summary.activeAnnotations<0||!h(e.summary.includedAnnotations)||e.summary.includedAnnotations<0||e.summary.topPriority!==void 0&&!x(e.summary.topPriority,X))return{ok:!1,reason:"invalid v2 context metadata",raw:e}}let i=r?Ae(e.evidence):[];if(!i)return{ok:!1,reason:"invalid context evidence",raw:e};let a=r?e.scope:"all",o=t.annotations,s=a==="active"?o.filter(T):o,l=e.page===void 0?void 0:ne(e.page);if(e.page!==void 0&&!l)return{ok:!1,reason:"invalid context page",raw:e};return{ok:!0,value:{schema:"infoos/web-annotation-context",version:"2.0",contextId:typeof e.contextId==="string"?e.contextId:`ctx_${Date.now()}`,createdAt:typeof e.createdAt==="string"?e.createdAt:new Date().toISOString(),scope:a,...l?{page:l}:{},summary:{totalAnnotations:o.length,activeAnnotations:o.filter(T).length,includedAnnotations:s.length,topPriority:D(s)[0]?.priority},evidence:i,annotations:s}}}function Ie(e){return typeof e==="string"&&e.length<=j&&/^data:image\/(png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(e)}function re(e){if(!Array.isArray(e)||e.length>U||!v({items:e}))return null;let t=[],n=0,r=new Set;for(let i of e){let a=F(i);if(!a.ok)return null;let o=a.value;if(!/^[a-zA-Z0-9_-]{1,100}$/.test(o.id)||r.has(o.id)||!o.comment.trim()||o.comment.length>4000)return null;if(r.add(o.id),o.target.kind==="element"&&(o.target.cssSelector.length>2000||o.target.xpath.length>2000||(o.target.textContent?.length??0)>1000))return null;if(o.screenshot!==void 0&&(!Ie(o.screenshot)||++n>q))return null;if((o.edits?.length??0)>20||o.edits?.some((s)=>s.before.length>4000||s.after.length>4000))return null;t.push(o)}try{if(t.length)H(t.map(K))}catch{return null}return t}function er(e){let t=e.ownerWindow??window,n=e.nonce??crypto.randomUUID(),r={enabled:!1,locked:!1,locale:"zh",items:[],theme:R(e.theme)},i=!1,a=!1,o=!1,s,l=(p)=>{if(o===!p)return;o=!p,e.onResponsiveChange?.(p)},u=()=>{if(s!==void 0)t.clearTimeout(s);if(s=void 0,!r.enabled||a||i){if(!r.enabled||a)l(!0);return}s=t.setTimeout(()=>{if(s=void 0,!a&&r.enabled&&!i)l(!1)},e.handshakeTimeoutMs??2500)},g=(p)=>{if(!i)e.iframe.contentWindow?.postMessage({...p,source:B,nonce:n},"*")},f=()=>g({action:"sync",...r}),c=(p)=>{if(i||p.source!==e.iframe.contentWindow||!v(p.data))return;let k=p.data;if(k.source!==V||k.nonce!==n)return;if(k.action==="ready"){a=!0,u();return}if(k.action==="closed"){e.onClose();return}if(k.action!=="snapshot"||r.locked||!r.enabled)return;let L=re(k.items);if(L)e.onChange(L)};t.addEventListener("message",c);let y=()=>{if(a=!1,r.enabled||r.items.length)f();u()};e.iframe.addEventListener("load",y);let S=t.setInterval(()=>{if(!a&&r.enabled)f()},400);return{update(p){let k=r.enabled;if(r={...r,...p,theme:Object.hasOwn(p,"theme")?R(p.theme):r.theme??{}},f(),k!==r.enabled)u()},reveal(p){if(r.items.some((k)=>k.id===p))g({action:"reveal",id:p})},dispose(){if(i)return;if(g({action:"sync",enabled:!1,locked:!0,items:[],locale:r.locale}),i=!0,t.clearInterval(S),s!==void 0)t.clearTimeout(s);t.removeEventListener("message",c),e.iframe.removeEventListener("load",y)}}}var Se={primaryContrast:["--primary-foreground","#fafafa"],surface:["--card","#ffffff"],foreground:["--card-foreground","#18181b"],popover:["--popover","#ffffff"],popoverContrast:["--popover-foreground","#18181b"],border:["--border","#e4e4e7"],muted:["--muted-foreground","#71717a"],field:["--muted","#f4f4f5"],hover:["--accent","#f4f4f5"],focus:["--ring","#a1a1aa"],danger:["--destructive","#dc2626"]},O={accent:"#18181b",contrast:"#fafafa",selected:"#3f3f46",outline:"rgba(255, 255, 255, 0.6)"};function ve(e){let t=e.ownerDocument.defaultView?.getComputedStyle(e),n=(i)=>{let[a,o]=Se[i],s=t?.getPropertyValue(a).trim()??"";return R({"--pa-accent":s})["--pa-accent"]??o},r=O.accent;return R({"--pa-accent":r,"--pa-accent-contrast":O.contrast,"--pa-accent-soft":`color-mix(in srgb, ${r} 10%, transparent)`,"--pa-accent-halo":`color-mix(in srgb, ${r} 45%, transparent)`,"--pa-surface":n("surface"),"--pa-surface-contrast":n("foreground"),"--pa-popover":n("popover"),"--pa-popover-contrast":n("popoverContrast"),"--pa-border":n("border"),"--pa-muted":n("muted"),"--pa-field":n("field"),"--pa-hover":n("hover"),"--pa-selected":O.selected,"--pa-focus":n("focus"),"--pa-outline":O.outline,"--pa-shadow":"#00000033","--pa-checker":n("muted"),"--pa-danger":n("danger"),"--pa-danger-contrast":n("primaryContrast"),"--pa-success":"#15803d","--pa-success-contrast":"#ffffff","--pa-color-default":n("foreground")})}function rr(e,t){let n=e.ownerDocument.defaultView;if(!n)return()=>{};let r=()=>t(ve(e)),i=new n.MutationObserver(r);i.observe(e,{attributes:!0,attributeFilter:["class","style"]});let a=n.matchMedia("(prefers-color-scheme: dark)");return a.addEventListener("change",r),()=>{i.disconnect(),a.removeEventListener("change",r)}}export{B as ANNOTATION_HOST_SOURCE,U as ANNOTATION_MAX_ITEMS,we as ANNOTATION_MAX_MESSAGE_BYTES,q as ANNOTATION_MAX_SCREENSHOTS,V as ANNOTATION_PAGE_SOURCE,j as ANNOTATION_SCREENSHOT_MAX_BYTES,Te as ANNOTATION_THEME_MAX_BYTES,z as ANNOTATION_THEME_TOKENS,De as applyAnnotationTheme,v as boundedMessage,er as createAnnotationController,w as isAnnotationThemeColor,rr as observeStudioAnnotationTheme,re as parseAnnotationItems,ve as resolveStudioAnnotationTheme,Ie as validScreenshot,R as validateAnnotationTheme};
|
|
2
|
+
var V="uibot.annotation.host.v1",B="uibot.annotation.page.v1",we=1048576,U=20,j=262144,q=2;function v(e){if(!e||typeof e!=="object"||Array.isArray(e))return!1;try{return new TextEncoder().encode(JSON.stringify(e)).length<=1048576}catch{return!1}}var H=["--pa-accent","--pa-accent-soft","--pa-outline","--pa-accent-contrast","--pa-surface","--pa-surface-contrast","--pa-shadow","--pa-muted","--pa-hover","--pa-border","--pa-popover-contrast","--pa-popover","--pa-focus","--pa-selected","--pa-accent-halo","--pa-field","--pa-checker","--pa-success","--pa-success-contrast","--pa-danger","--pa-danger-contrast","--pa-color-default"],Te=8192;function w(e){if(typeof e!=="string"||e.length>256||!e.trim())return!1;if(/[;{}\\<>!@'"]/.test(e)||[...e].some((o)=>o.charCodeAt(0)<32)||/url\s*\(|var\s*\(|\/\*|\*\//i.test(e))return!1;let t=e.trim();if(/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i.test(t))return!0;if(new Set("aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato transparent turquoise violet wheat white whitesmoke yellow yellowgreen".split(" ")).has(t.toLowerCase()))return!0;let r=t.match(/^(rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\(([^()]+)\)$/i);if(r){let o=(r[1]??"").toLowerCase(),s=(r[2]??"").trim(),l=s.includes(",");if(l&&(!/^(rgb|rgba|hsl|hsla)$/.test(o)||s.includes("/")))return!1;let u=s.split("/");if(u.length>2)return!1;let g=l?s.split(",").map((y)=>y.trim()):(u[0]??"").trim().split(/\s+/),f=l?g[3]:u[1]?.trim();if(g.length!==3&&!(l&&g.length===4))return!1;let c=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?%?$/i;if(f!==void 0&&!c.test(f)&&!(f==="none"&&!l))return!1;return g.slice(0,3).every((y,S)=>{if(y==="none")return!l;let p=/^(hsl|hsla|hwb)$/.test(o)?S===0:/^(lch|oklch)$/.test(o)&&S===2;return c.test(y)||p&&/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(deg|rad|grad|turn)$/i.test(y)})}let i=t.match(/^color\((srgb|srgb-linear|display-p3|a98-rgb|prophoto-rgb|rec2020|xyz|xyz-d50|xyz-d65) ([^()]+)\)$/i);if(i)return w(`rgb(${i[2]})`);let a=t.match(/^color-mix\(in srgb, (.+) (\d+(?:\.\d+)?)%, (.+)\)$/i);return!!a&&Number(a[2])<=100&&w(a[1])&&w(a[3])}function R(e){if(!e||typeof e!=="object"||Array.isArray(e))return{};try{if(new TextEncoder().encode(JSON.stringify(e)).length>8192)return{}}catch{return{}}let t={};for(let n of H){let r=Object.hasOwn(e,n)?e[n]:void 0;if(w(r))t[n]=r.trim()}return t}function De(e,t){let n=R(t);for(let r of H){let i=n[r];if(i===void 0)e.style.removeProperty(r);else e.style.setProperty(r,i)}}var ae={spec:["html","markdown","zip"],prototype:["html","zip"],deck:["html","pptx","zip"],poster:["html","zip"]},Rt=Array.from(new Set(Object.values(ae).flat()));var vt=Object.freeze([Object.freeze({name:"manifest",summary:"Describe query operations and list the derived resource index.",positionals:Object.freeze([]),options:Object.freeze([])}),Object.freeze({name:"search",summary:"Search resources with deterministic bilingual ranking and reasons.",positionals:Object.freeze([Object.freeze({name:"text",property:"text",type:"string",required:!1})]),options:Object.freeze([Object.freeze({name:"kind",property:"kinds",type:"resource-kind",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"tag",property:"tags",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"category",property:"categories",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"capability",property:"capabilities",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"maturity",property:"maturities",type:"resource-maturity",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"limit",property:"limit",type:"positive-integer"})])}),Object.freeze({name:"get",summary:"Resolve one canonical resource id or unambiguous alias.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])}),Object.freeze({name:"build",summary:"Plan dependency closure and gaps without writing or installing.",positionals:Object.freeze([Object.freeze({name:"root",property:"roots",type:"string",required:!0,variadic:!0})]),options:Object.freeze([])})]);var P={count:20,messageBytes:1048576,screenshotBytes:262144,screenshots:2,comment:4000,selector:2000,edits:20};function E(e){if(!e||typeof e!=="object"||Array.isArray(e))throw Error("Invalid annotation object");return e}function I(e,t){if(Object.keys(e).some((n)=>!t.includes(n)))throw Error("Unknown annotation field")}function C(e,t,n=!1){if(typeof e!=="string"||!n&&!e.trim()||e.length>t||Array.from(e).some((r)=>{let i=r.charCodeAt(0);return i===127||i<32&&i!==9&&i!==10&&i!==13}))throw Error("Invalid annotation text");return e}function z(e){let t=E(e);I(t,["x","y","width","height"]);for(let n of["x","y","width","height"])if(typeof t[n]!=="number"||!Number.isFinite(t[n])||Math.abs(t[n])>1e7)throw Error("Invalid annotation coordinates");if(t.width<0||t.height<0)throw Error("Invalid annotation dimensions");return{x:t.x,y:t.y,width:t.width,height:t.height}}function W(e){if(!Array.isArray(e)||!e.length||e.length>P.count)throw Error("Expected 1 to 20 annotations");if(new TextEncoder().encode(JSON.stringify(e)).length>P.messageBytes)throw Error("Annotations exceed the message budget");let t=0,n=new Set;return e.map((r)=>{let i=E(r);I(i,["id","comment","target","type","priority","edits","screenshot"]);let a=C(i.id,100);if(!/^[a-zA-Z0-9_-]+$/.test(a)||n.has(a))throw Error("Invalid or duplicate annotation ID");n.add(a);let o=C(i.comment,P.comment).trim();if(!["bug","style","copywriting","feature","interaction","data","other"].includes(i.type)||!["low","medium","high","blocker"].includes(i.priority))throw Error("Invalid annotation classification");let s=E(i.target),l;if(s.kind==="element"){I(s,["kind","cssSelector","xpath","tagName","textContent","boundingBox","uibotId"]);let f=C(s.tagName,80);if(!/^[a-zA-Z][a-zA-Z0-9:_-]*$/.test(f))throw Error("Invalid annotation tag");let c=s.uibotId===void 0?void 0:C(s.uibotId,200);if(c!==void 0&&!/^[\w:.-]+$/.test(c))throw Error("Invalid annotation element ID");l={kind:"element",cssSelector:C(s.cssSelector,P.selector),xpath:C(s.xpath,P.selector,!0),tagName:f,boundingBox:z(s.boundingBox),...s.textContent===void 0?{}:{textContent:C(s.textContent,1000,!0)},...c===void 0?{}:{uibotId:c}}}else if(s.kind==="region")I(s,["kind","rect"]),l={kind:"region",rect:z(s.rect)};else throw Error("Invalid annotation target");let u;if(i.edits!==void 0){if(!Array.isArray(i.edits)||i.edits.length>P.edits)throw Error("Invalid annotation edits");u=i.edits.map((f)=>{let c=E(f);if(I(c,["kind","label","property","before","after"]),c.kind!=="style"&&c.kind!=="text")throw Error("Invalid annotation edit kind");let y=c.property===void 0?void 0:C(c.property,100);if(y!==void 0&&!/^[-a-zA-Z][\w-]*$/.test(y))throw Error("Invalid annotation style property");return{kind:c.kind,label:C(c.label,200),before:C(c.before,4000,!0),after:C(c.after,4000,!0),...y===void 0?{}:{property:y}}})}let g;if(i.screenshot!==void 0){if(g=C(i.screenshot,P.screenshotBytes),!/^data:image\/(png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(g)||++t>P.screenshots)throw Error("Invalid annotation screenshot")}return{id:a,comment:o,type:i.type,priority:i.priority,target:l,...u?{edits:u}:{},...g?{screenshot:g}:{}}})}function Dn(e){let t={blocker:0,high:1,medium:2,low:3};return[...e].sort((n,r)=>t[n.priority]-t[r.priority]||n.createdAt.localeCompare(r.createdAt))}function On(e,t){if(e.target.kind==="region")return`${t==="zh"?"\u533A\u57DF":"Region"} ${Math.round(e.target.rect.width)}\xD7${Math.round(e.target.rect.height)}`;return`${e.target.tagName}\u300C${(e.target.textContent??e.target.cssSelector).slice(0,48)}\u300D`}function K(e){let t=e.target;return{id:e.id,comment:e.comment.trim(),type:e.type,priority:e.priority,target:t.kind==="region"?{kind:"region",rect:t.rect}:{kind:"element",cssSelector:t.cssSelector,xpath:t.xpath,tagName:t.tagName,...t.textContent?{textContent:t.textContent}:{},boundingBox:t.boundingBox,...t.attributes["data-uibot-id"]?{uibotId:t.attributes["data-uibot-id"]}:{}},...e.edits?.length?{edits:e.edits.map((n)=>({kind:n.kind,label:n.label,before:n.before,after:n.after,...n.property?{property:n.property}:{}}))}:{},...e.screenshot?{screenshot:e.screenshot}:{}}}var Y=[{id:"red",value:"#ef4444",label:"\u7EA2"},{id:"orange",value:"#f97316",label:"\u6A59"},{id:"yellow",value:"#eab308",label:"\u9EC4"},{id:"green",value:"#22c55e",label:"\u7EFF"},{id:"blue",value:"#3b82f6",label:"\u84DD"},{id:"white",value:"#f8fafc",label:"\u767D"}],_n=12,Mn=48,Fn=4,Ln=16;function G(e){let t=Math.round(e/4)*4;return Math.min(48,Math.max(12,t))}function se(e,t){let n=G(t),r=Math.max(1,[...e].length);return{width:Math.max(n,r*n),height:Math.ceil(n*1.35)}}var le=new Set(Y.map((e)=>e.value));function ce(e){return le.has(e)}function Vn(){return Y[0].value}function b(e){return typeof e==="number"&&Number.isFinite(e)}function de(e){if(!e||typeof e!=="object"||Array.isArray(e))return null;let t=e;if(typeof t.color!=="string"||!ce(t.color))return null;if(t.kind==="rect"){if(!b(t.x)||!b(t.y)||!b(t.width)||!b(t.height))return null;if(t.width<8||t.height<8)return null;return{kind:"rect",color:t.color,x:t.x,y:t.y,width:t.width,height:t.height}}if(t.kind==="arrow"){if(!b(t.x1)||!b(t.y1)||!b(t.x2)||!b(t.y2))return null;return{kind:"arrow",color:t.color,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}}if(t.kind==="text"){if(!b(t.x)||!b(t.y)||typeof t.text!=="string")return null;let n=t.text.trim();if(!n)return null;let r=t.fontSize===void 0?16:b(t.fontSize)?G(t.fontSize):null;if(r==null)return null;return{kind:"text",color:t.color,x:t.x,y:t.y,text:n,fontSize:r}}return null}function J(e){if(e===void 0)return;if(!Array.isArray(e))return;let t=[];for(let n of e){let r=de(n);if(!r)return;t.push(r)}return t}function Bn(e){if(e.length===0)return"\u533A\u57DF\u6807\u6CE8";let t=e.filter((a)=>a.kind==="rect").length,n=e.filter((a)=>a.kind==="arrow").length,r=e.filter((a)=>a.kind==="text"),i=[];if(t)i.push(`${t} \u4E2A\u6846`);if(n)i.push(`${n} \u4E2A\u7BAD\u5934`);if(r.length){let a=r.map((o)=>o.text.trim()).filter(Boolean).slice(0,3).map((o)=>`\u300C${o.length>16?`${o.slice(0,16)}\u2026`:o}\u300D`);i.push(a.length?`\u6587\u672C ${a.join(" ")}`:`${r.length} \u5904\u6587\u672C`)}return`\u533A\u57DF\u6807\u6CE8\uFF08${i.join("\uFF0C")}\uFF09`}function Un(e,t=16){if(e.length===0)return null;let{POSITIVE_INFINITY:n,POSITIVE_INFINITY:r,NEGATIVE_INFINITY:i,NEGATIVE_INFINITY:a}=Number;for(let o of e)if(o.kind==="rect")n=Math.min(n,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x+o.width),a=Math.max(a,o.y+o.height);else if(o.kind==="arrow")n=Math.min(n,o.x1,o.x2),r=Math.min(r,o.y1,o.y2),i=Math.max(i,o.x1,o.x2),a=Math.max(a,o.y1,o.y2);else{let s=se(o.text,o.fontSize);n=Math.min(n,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x+s.width),a=Math.max(a,o.y+s.height)}return{x:n-t,y:r-t,width:Math.max(8,i-n+t*2),height:Math.max(8,a-r+t*2)}}function jn(e,t,n){return e.map((r)=>{if(r.kind==="rect")return{...r,x:r.x+t,y:r.y+n};if(r.kind==="arrow")return{...r,x1:r.x1+t,y1:r.y1+n,x2:r.x2+t,y2:r.y2+n};return{...r,x:r.x+t,y:r.y+n,fontSize:r.fontSize}})}function qn(e,t){let n=Math.max(0,Math.min(e.x,t.width)),r=Math.max(0,Math.min(e.y,t.height)),i=Math.min(e.width,t.width-n),a=Math.min(e.height,t.height-r);if(i<8||a<8)return null;return{x:n,y:r,width:i,height:a}}var Z={blocker:0,high:1,medium:2,low:3};function T(e){return e.status==="open"||e.status==="processing"}function D(e){return[...e].sort((t,n)=>Z[t.priority]-Z[n.priority]||t.createdAt.localeCompare(n.createdAt))}function zn(e){return D(e.filter(T))}var ue=["open","processing","done","verified","ignored"],pe=["bug","style","copywriting","feature","interaction","data","other"],X=["low","medium","high","blocker"],ge=["testid","id","aria","class","text","path"],me=["light","dark","unknown"],fe=["react","vue","angular","svelte","nextjs","nuxt","unknown"],ye=["target-location","screenshot","context-bundle","dom-snapshot","style-snapshot"],Ce=["inline","exported-file","url","none"];function m(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function x(e,t){return typeof e==="string"&&t.includes(e)}function h(e){return typeof e==="number"&&Number.isFinite(e)}function A(e){return h(e)&&e>0}function N(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function ee(e){return m(e)&&Object.values(e).every((t)=>typeof t==="string")}function d(e){return e===void 0||typeof e==="string"}function te(e){if(!m(e)||!h(e.x)||!h(e.y)||!A(e.width)||!A(e.height))return;return{x:e.x,y:e.y,width:e.width,height:e.height}}function _(e){if(!m(e)||!A(e.width)||!A(e.height))return;return{width:e.width,height:e.height}}function M(e){if(!m(e)||!h(e.x)||!h(e.y))return;return{x:e.x,y:e.y}}function Q(e){if(!m(e)||typeof e.fileName!=="string"||!A(e.lineNumber))return;if(e.columnNumber!==void 0&&(!h(e.columnNumber)||e.columnNumber<0))return;if(!d(e.componentName))return;return{fileName:e.fileName,lineNumber:e.lineNumber,...e.columnNumber===void 0?{}:{columnNumber:e.columnNumber},...e.componentName===void 0?{}:{componentName:e.componentName}}}function be(e){let t=te(e.boundingBox);if(typeof e.tagName!=="string"||!e.tagName||typeof e.cssSelector!=="string"||!e.cssSelector||typeof e.xpath!=="string"||!e.xpath||!ee(e.attributes)||!t||!N(e.domPath))return;if(!d(e.textContent)||e.breadcrumb!==void 0&&!N(e.breadcrumb))return;if(e.selectorStrategy!==void 0&&!x(e.selectorStrategy,ge))return;if(!d(e.region))return;let n;if(e.accessibility!==void 0){if(!m(e.accessibility)||!d(e.accessibility.role)||!d(e.accessibility.name)||!d(e.accessibility.ariaLabel))return;n={...e.accessibility.role===void 0?{}:{role:e.accessibility.role},...e.accessibility.name===void 0?{}:{name:e.accessibility.name},...e.accessibility.ariaLabel===void 0?{}:{ariaLabel:e.accessibility.ariaLabel}}}let r=e.sourceLocation===void 0?void 0:Q(e.sourceLocation);if(e.sourceLocation!==void 0&&!r)return;let i;if(e.sourceStack!==void 0){if(!Array.isArray(e.sourceStack))return;let a=e.sourceStack.map(Q);if(a.some((o)=>!o))return;i=a.filter((o)=>Boolean(o))}return{kind:"element",tagName:e.tagName,cssSelector:e.cssSelector,xpath:e.xpath,...e.textContent===void 0?{}:{textContent:e.textContent},attributes:{...e.attributes},boundingBox:t,domPath:[...e.domPath],...n?{accessibility:n}:{},...e.selectorStrategy===void 0?{}:{selectorStrategy:e.selectorStrategy},...e.region===void 0?{}:{region:e.region},...e.breadcrumb===void 0?{}:{breadcrumb:[...e.breadcrumb]},...r?{sourceLocation:r}:{},...i?{sourceStack:i}:{}}}function xe(e){let t=te(e.rect),n=_(e.viewport),r=M(e.scroll);if(!t||t.width<8||t.height<8||!n||!r||!A(e.devicePixelRatio))return;if(e.breadcrumb!==void 0&&!N(e.breadcrumb))return;let i;if(e.topLevelElements!==void 0){if(!Array.isArray(e.topLevelElements))return;i=[];for(let o of e.topLevelElements){if(!m(o)||typeof o.tagName!=="string"||!o.tagName||!d(o.text)||!d(o.role))return;i.push({tagName:o.tagName,...o.text===void 0?{}:{text:o.text},...o.role===void 0?{}:{role:o.role}})}}let a=e.marks===void 0?void 0:J(e.marks);if(e.marks!==void 0&&!a)return;return{kind:"region",rect:t,viewport:n,scroll:r,devicePixelRatio:e.devicePixelRatio,...e.breadcrumb===void 0?{}:{breadcrumb:[...e.breadcrumb]},...i?{topLevelElements:i}:{},...a?.length?{marks:a}:{}}}function he(e){if(!m(e))return{ok:!1,reason:"target is not an object",raw:e};if(e.kind==="region"){let t=xe(e);return t?{ok:!0,value:t}:{ok:!1,reason:"invalid region target",raw:e}}if(e.kind==="element"||e.kind===void 0){let t=be(e);return t?{ok:!0,value:t}:{ok:!1,reason:"invalid element target",raw:e}}return{ok:!1,reason:`unknown target kind: ${String(e.kind)}`,raw:e}}function ke(e){if(!m(e))return;let t=_(e.viewport),n=M(e.scroll);if(!t||!n||!A(e.devicePixelRatio)||!m(e.center)||!h(e.center.x)||!h(e.center.y)||typeof e.visible!=="boolean"||!d(e.positioning))return;return{viewport:t,scroll:n,devicePixelRatio:e.devicePixelRatio,center:{x:e.center.x,y:e.center.y},visible:e.visible,...e.positioning===void 0?{}:{positioning:e.positioning}}}function ne(e){if(!m(e))return;let{url:t,origin:n,path:r,title:i,capturedAt:a,query:o,hash:s,referrer:l,language:u,userAgent:g,uiState:f}=e,c=_(e.viewport),y=M(e.scroll);if(!c||!m(e.viewport)||!A(e.viewport.devicePixelRatio)||!y)return;if(typeof t!=="string"||!t||typeof n!=="string"||!n||typeof r!=="string"||!r||typeof i!=="string"||typeof a!=="string"||!a)return;if(!d(o)||!d(s)||!d(l)||!d(u)||!d(g)||!d(f))return;if(e.theme!==void 0&&!x(e.theme,me))return;if(e.framework!==void 0&&!x(e.framework,fe))return;return{url:t,origin:n,path:r,title:i,viewport:{...c,devicePixelRatio:e.viewport.devicePixelRatio},scroll:y,capturedAt:a,...o===void 0?{}:{query:o},...s===void 0?{}:{hash:s},...l===void 0?{}:{referrer:l},...e.theme===void 0?{}:{theme:e.theme},...e.framework===void 0?{}:{framework:e.framework},...u===void 0?{}:{language:u},...g===void 0?{}:{userAgent:g},...f===void 0?{}:{uiState:f}}}function Pe(e){if(e===void 0)return[];if(!Array.isArray(e))return;let t=[];for(let n of e){if(!m(n)||!x(n.kind,["style","text"])||typeof n.label!=="string"||!d(n.property)||typeof n.before!=="string"||typeof n.after!=="string")return;t.push({kind:n.kind,label:n.label,before:n.before,after:n.after,...n.property===void 0?{}:{property:n.property}})}return t}function Ae(e){if(!Array.isArray(e))return;let t=[];for(let n of e){if(!m(n)||!x(n.kind,ye)||!x(n.availability,Ce)||typeof n.label!=="string"||!n.label||!d(n.annotationId)||!d(n.reference))return;if(n.availability!=="none"&&!n.reference?.trim())return;t.push({kind:n.kind,availability:n.availability,label:n.label,...n.annotationId===void 0?{}:{annotationId:n.annotationId},...n.reference===void 0?{}:{reference:n.reference}})}return t}function F(e){if(!m(e))return{ok:!1,reason:"annotation is not an object",raw:e};let{id:t,pageUrl:n,comment:r,createdAt:i,updatedAt:a}=e;if(!x(e.status,ue))return{ok:!1,reason:"invalid status",raw:e};if(!x(e.type,pe))return{ok:!1,reason:"invalid type",raw:e};if(!x(e.priority,X))return{ok:!1,reason:"invalid priority",raw:e};if(typeof t!=="string"||!t)return{ok:!1,reason:"invalid id",raw:e};if(typeof n!=="string"||!n)return{ok:!1,reason:"invalid pageUrl",raw:e};if(typeof r!=="string"||!r)return{ok:!1,reason:"invalid comment",raw:e};if(typeof i!=="string"||!i)return{ok:!1,reason:"invalid createdAt",raw:e};if(typeof a!=="string"||!a)return{ok:!1,reason:"invalid updatedAt",raw:e};if(!d(e.expectedResult)||!d(e.preserve)||!d(e.screenshot))return{ok:!1,reason:"invalid optional annotation text",raw:e};if(!ee(e.styleSummary))return{ok:!1,reason:"invalid styleSummary",raw:e};let o=ke(e.geometry);if(!o)return{ok:!1,reason:"invalid geometry",raw:e};let s=ne(e.pageContext);if(!s)return{ok:!1,reason:"invalid pageContext",raw:e};let l=Pe(e.edits);if(!l)return{ok:!1,reason:"invalid edits",raw:e};let u=he(e.target);if(!u.ok)return u;return{ok:!0,value:{id:t,pageUrl:n,status:e.status,type:e.type,priority:e.priority,comment:r,target:u.value,styleSummary:{...e.styleSummary},geometry:o,pageContext:s,createdAt:i,updatedAt:a,...e.expectedResult===void 0?{}:{expectedResult:e.expectedResult},...e.preserve===void 0?{}:{preserve:e.preserve},...e.screenshot===void 0?{}:{screenshot:e.screenshot},...l.length?{edits:l}:{}}}}function Re(e){let t=[],n=[];return e.forEach((r,i)=>{let a=F(r);if(a.ok)t.push(a.value);else n.push({index:i,reason:a.reason,raw:a.raw})}),{annotations:D(t),failures:n}}function Yn(e){if(!m(e)||!Array.isArray(e.annotations))return{ok:!1,reason:"context annotations are missing",raw:e};if(e.version!=="1.0"&&e.version!=="2.0")return{ok:!1,reason:`unsupported context version: ${String(e.version)}`,raw:e};let t=Re(e.annotations),[n]=t.failures;if(n)return{ok:!1,reason:`invalid annotation at index ${n.index}`,raw:e};let r=e.version==="2.0";if(r){if(e.schema!=="uibot/web-annotation-context"||typeof e.contextId!=="string"||!e.contextId||typeof e.createdAt!=="string"||!e.createdAt||!x(e.scope,["active","all"])||!m(e.summary)||!h(e.summary.totalAnnotations)||e.summary.totalAnnotations<0||!h(e.summary.activeAnnotations)||e.summary.activeAnnotations<0||!h(e.summary.includedAnnotations)||e.summary.includedAnnotations<0||e.summary.topPriority!==void 0&&!x(e.summary.topPriority,X))return{ok:!1,reason:"invalid v2 context metadata",raw:e}}let i=r?Ae(e.evidence):[];if(!i)return{ok:!1,reason:"invalid context evidence",raw:e};let a=r?e.scope:"all",o=t.annotations,s=a==="active"?o.filter(T):o,l=e.page===void 0?void 0:ne(e.page);if(e.page!==void 0&&!l)return{ok:!1,reason:"invalid context page",raw:e};return{ok:!0,value:{schema:"uibot/web-annotation-context",version:"2.0",contextId:typeof e.contextId==="string"?e.contextId:`ctx_${Date.now()}`,createdAt:typeof e.createdAt==="string"?e.createdAt:new Date().toISOString(),scope:a,...l?{page:l}:{},summary:{totalAnnotations:o.length,activeAnnotations:o.filter(T).length,includedAnnotations:s.length,topPriority:D(s)[0]?.priority},evidence:i,annotations:s}}}function Ie(e){return typeof e==="string"&&e.length<=j&&/^data:image\/(png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(e)}function re(e){if(!Array.isArray(e)||e.length>U||!v({items:e}))return null;let t=[],n=0,r=new Set;for(let i of e){let a=F(i);if(!a.ok)return null;let o=a.value;if(!/^[a-zA-Z0-9_-]{1,100}$/.test(o.id)||r.has(o.id)||!o.comment.trim()||o.comment.length>4000)return null;if(r.add(o.id),o.target.kind==="element"&&(o.target.cssSelector.length>2000||o.target.xpath.length>2000||(o.target.textContent?.length??0)>1000))return null;if(o.screenshot!==void 0&&(!Ie(o.screenshot)||++n>q))return null;if((o.edits?.length??0)>20||o.edits?.some((s)=>s.before.length>4000||s.after.length>4000))return null;t.push(o)}try{if(t.length)W(t.map(K))}catch{return null}return t}function or(e){let t=e.ownerWindow??window,n=e.nonce??crypto.randomUUID(),r={enabled:!1,locked:!1,locale:"zh",items:[],theme:R(e.theme)},i=!1,a=!1,o=!1,s,l=(p)=>{if(o===!p)return;o=!p,e.onResponsiveChange?.(p)},u=()=>{if(s!==void 0)t.clearTimeout(s);if(s=void 0,!r.enabled||a||i){if(!r.enabled||a)l(!0);return}s=t.setTimeout(()=>{if(s=void 0,!a&&r.enabled&&!i)l(!1)},e.handshakeTimeoutMs??2500)},g=(p)=>{if(!i)e.iframe.contentWindow?.postMessage({...p,source:V,nonce:n},"*")},f=()=>g({action:"sync",...r}),c=(p)=>{if(i||p.source!==e.iframe.contentWindow||!v(p.data))return;let k=p.data;if(k.source!==B||k.nonce!==n)return;if(k.action==="ready"){a=!0,u();return}if(k.action==="closed"){e.onClose();return}if(k.action!=="snapshot"||r.locked||!r.enabled)return;let L=re(k.items);if(L)e.onChange(L)};t.addEventListener("message",c);let y=()=>{if(a=!1,r.enabled||r.items.length)f();u()};e.iframe.addEventListener("load",y);let S=t.setInterval(()=>{if(!a&&r.enabled)f()},400);return{update(p){let k=r.enabled;if(r={...r,...p,theme:Object.hasOwn(p,"theme")?R(p.theme):r.theme??{}},f(),k!==r.enabled)u()},reveal(p){if(r.items.some((k)=>k.id===p))g({action:"reveal",id:p})},dispose(){if(i)return;if(g({action:"sync",enabled:!1,locked:!0,items:[],locale:r.locale}),i=!0,t.clearInterval(S),s!==void 0)t.clearTimeout(s);t.removeEventListener("message",c),e.iframe.removeEventListener("load",y)}}}var Se={primaryContrast:["--primary-foreground","#fafafa"],surface:["--card","#ffffff"],foreground:["--card-foreground","#18181b"],popover:["--popover","#ffffff"],popoverContrast:["--popover-foreground","#18181b"],border:["--border","#e4e4e7"],muted:["--muted-foreground","#71717a"],field:["--muted","#f4f4f5"],hover:["--accent","#f4f4f5"],focus:["--ring","#a1a1aa"],danger:["--destructive","#dc2626"]},O={accent:"#18181b",contrast:"#fafafa",selected:"#3f3f46",outline:"rgba(255, 255, 255, 0.6)"};function ve(e){let t=e.ownerDocument.defaultView?.getComputedStyle(e),n=(i)=>{let[a,o]=Se[i],s=t?.getPropertyValue(a).trim()??"";return R({"--pa-accent":s})["--pa-accent"]??o},r=O.accent;return R({"--pa-accent":r,"--pa-accent-contrast":O.contrast,"--pa-accent-soft":`color-mix(in srgb, ${r} 10%, transparent)`,"--pa-accent-halo":`color-mix(in srgb, ${r} 45%, transparent)`,"--pa-surface":n("surface"),"--pa-surface-contrast":n("foreground"),"--pa-popover":n("popover"),"--pa-popover-contrast":n("popoverContrast"),"--pa-border":n("border"),"--pa-muted":n("muted"),"--pa-field":n("field"),"--pa-hover":n("hover"),"--pa-selected":O.selected,"--pa-focus":n("focus"),"--pa-outline":O.outline,"--pa-shadow":"#00000033","--pa-checker":n("muted"),"--pa-danger":n("danger"),"--pa-danger-contrast":n("primaryContrast"),"--pa-success":"#15803d","--pa-success-contrast":"#ffffff","--pa-color-default":n("foreground")})}function sr(e,t){let n=e.ownerDocument.defaultView;if(!n)return()=>{};let r=()=>t(ve(e)),i=new n.MutationObserver(r);i.observe(e,{attributes:!0,attributeFilter:["class","style"]});let a=n.matchMedia("(prefers-color-scheme: dark)");return a.addEventListener("change",r),()=>{i.disconnect(),a.removeEventListener("change",r)}}export{V as ANNOTATION_HOST_SOURCE,U as ANNOTATION_MAX_ITEMS,we as ANNOTATION_MAX_MESSAGE_BYTES,q as ANNOTATION_MAX_SCREENSHOTS,B as ANNOTATION_PAGE_SOURCE,j as ANNOTATION_SCREENSHOT_MAX_BYTES,Te as ANNOTATION_THEME_MAX_BYTES,H as ANNOTATION_THEME_TOKENS,De as applyAnnotationTheme,v as boundedMessage,or as createAnnotationController,w as isAnnotationThemeColor,sr as observeStudioAnnotationTheme,re as parseAnnotationItems,ve as resolveStudioAnnotationTheme,Ie as validScreenshot,R as validateAnnotationTheme};
|
package/dist/index.d.ts
CHANGED