@annotorious/react 3.1.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/annotorious-react.es10.js +5 -5
- package/dist/annotorious-react.es10.js.map +1 -1
- package/dist/annotorious-react.es11.js +8 -3
- package/dist/annotorious-react.es11.js.map +1 -1
- package/dist/annotorious-react.es12.js +266 -8
- package/dist/annotorious-react.es12.js.map +1 -1
- package/dist/annotorious-react.es13.js +7 -264
- package/dist/annotorious-react.es13.js.map +1 -1
- package/dist/annotorious-react.es14.js +195 -7
- package/dist/annotorious-react.es14.js.map +1 -1
- package/dist/annotorious-react.es15.js +379 -185
- package/dist/annotorious-react.es15.js.map +1 -1
- package/dist/annotorious-react.es16.js +13 -390
- package/dist/annotorious-react.es16.js.map +1 -1
- package/dist/annotorious-react.es17.js +128 -10
- package/dist/annotorious-react.es17.js.map +1 -1
- package/dist/annotorious-react.es18.js +6 -7
- package/dist/annotorious-react.es18.js.map +1 -1
- package/dist/annotorious-react.es19.js +2 -2
- package/dist/annotorious-react.es19.js.map +1 -1
- package/dist/annotorious-react.es2.js +19 -19
- package/dist/annotorious-react.es2.js.map +1 -1
- package/dist/annotorious-react.es20.js +9 -31
- package/dist/annotorious-react.es20.js.map +1 -1
- package/dist/annotorious-react.es21.js +125 -405
- package/dist/annotorious-react.es21.js.map +1 -1
- package/dist/annotorious-react.es22.js +456 -119
- package/dist/annotorious-react.es22.js.map +1 -1
- package/dist/annotorious-react.es4.js +33 -33
- package/dist/annotorious-react.es4.js.map +1 -1
- package/dist/annotorious-react.es5.js +22 -22
- package/dist/annotorious-react.es5.js.map +1 -1
- package/dist/annotorious-react.es8.js +14 -14
- package/dist/annotorious-react.es8.js.map +1 -1
- package/dist/annotorious-react.es9.js +43 -43
- package/dist/annotorious-react.es9.js.map +1 -1
- package/package.json +5 -5
- package/dist/annotorious-react.es23.js +0 -5
- package/dist/annotorious-react.es23.js.map +0 -1
- package/dist/annotorious-react.es24.js +0 -5
- package/dist/annotorious-react.es24.js.map +0 -1
- package/dist/annotorious-react.es25.js +0 -10
- package/dist/annotorious-react.es25.js.map +0 -1
- package/dist/annotorious-react.es26.js +0 -5
- package/dist/annotorious-react.es26.js.map +0 -1
- package/dist/annotorious-react.es27.js +0 -14
- package/dist/annotorious-react.es27.js.map +0 -1
- package/dist/annotorious-react.es28.js +0 -129
- package/dist/annotorious-react.es28.js.map +0 -1
- package/dist/annotorious-react.es29.js +0 -469
- package/dist/annotorious-react.es29.js.map +0 -1
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { useAnnotator as
|
|
1
|
+
import { jsxs as h, jsx as O } from "react/jsx-runtime";
|
|
2
|
+
import { useState as A, useRef as D, useEffect as L } from "react";
|
|
3
|
+
import g from "openseadragon";
|
|
4
|
+
import { useAnnotator as P, useSelection as S } from "./annotorious-react.es2.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
/* empty css */
|
|
7
7
|
import "@annotorious/core";
|
|
8
8
|
import "@annotorious/annotorious";
|
|
9
|
-
import { toClientRects as
|
|
10
|
-
import { useFloating as
|
|
11
|
-
import { useViewer as
|
|
12
|
-
import { inline as
|
|
13
|
-
import { autoUpdate as
|
|
14
|
-
import
|
|
15
|
-
const
|
|
16
|
-
const { minX: d, minY: a, maxX: o, maxY:
|
|
9
|
+
import { toClientRects as b } from "./annotorious-react.es13.js";
|
|
10
|
+
import { useFloating as U, FloatingArrow as F } from "./annotorious-react.es12.js";
|
|
11
|
+
import { useViewer as M } from "./annotorious-react.es8.js";
|
|
12
|
+
import { inline as V, offset as j, flip as z, shift as H, arrow as T } from "./annotorious-react.es14.js";
|
|
13
|
+
import { autoUpdate as X } from "./annotorious-react.es15.js";
|
|
14
|
+
import w from "./annotorious-react.es16.js";
|
|
15
|
+
const Y = (n, r) => {
|
|
16
|
+
const { minX: d, minY: a, maxX: o, maxY: l } = r.bounds, { top: s, left: p } = n.element.getBoundingClientRect(), t = n.viewport.imageToViewerElementCoordinates(new g.Point(d, a)), m = n.viewport.imageToViewerElementCoordinates(new g.Point(o, l));
|
|
17
17
|
return new DOMRect(
|
|
18
|
-
t.x +
|
|
18
|
+
t.x + p,
|
|
19
19
|
t.y + s,
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
m.x - t.x,
|
|
21
|
+
m.y - t.y
|
|
22
22
|
);
|
|
23
|
-
},
|
|
23
|
+
}, oe = (n) => {
|
|
24
24
|
var u, f;
|
|
25
|
-
const r =
|
|
25
|
+
const r = P(), [d, a] = A(!1), o = M(), l = D(null), { selected: s, event: p } = S(), t = (u = s[0]) == null ? void 0 : u.annotation, m = (f = s[0]) == null ? void 0 : f.editable, { refs: c, floatingStyles: y, context: v } = U({
|
|
26
26
|
open: d,
|
|
27
27
|
onOpenChange: a,
|
|
28
28
|
placement: n.placement,
|
|
29
29
|
middleware: [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
V(),
|
|
31
|
+
j(10),
|
|
32
|
+
z({ crossAxis: !0 }),
|
|
33
|
+
H({
|
|
34
34
|
crossAxis: !0,
|
|
35
35
|
boundary: o == null ? void 0 : o.element,
|
|
36
36
|
padding: { right: 5, left: 5, top: 10, bottom: 10 }
|
|
37
37
|
}),
|
|
38
|
-
|
|
39
|
-
element:
|
|
38
|
+
T({
|
|
39
|
+
element: l,
|
|
40
40
|
padding: 5
|
|
41
41
|
})
|
|
42
42
|
],
|
|
43
|
-
whileElementsMounted:
|
|
43
|
+
whileElementsMounted: X
|
|
44
44
|
});
|
|
45
|
-
|
|
45
|
+
L(() => {
|
|
46
46
|
if (s.length === 0)
|
|
47
47
|
a(!1);
|
|
48
48
|
else {
|
|
49
49
|
const e = () => {
|
|
50
50
|
if (!o.element) return;
|
|
51
|
-
const i =
|
|
51
|
+
const i = Y(o, t.target.selector.geometry);
|
|
52
52
|
c.setReference({
|
|
53
53
|
getBoundingClientRect: () => i,
|
|
54
|
-
getClientRects: () =>
|
|
54
|
+
getClientRects: () => b(i)
|
|
55
55
|
});
|
|
56
56
|
};
|
|
57
57
|
return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), o.addHandler("update-viewport", e), e(), a(!0), () => {
|
|
@@ -59,8 +59,8 @@ const X = (n, r) => {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
}, [n.popup, s, o]);
|
|
62
|
-
const
|
|
63
|
-
const i = e.id ||
|
|
62
|
+
const x = (e) => {
|
|
63
|
+
const i = e.id || w();
|
|
64
64
|
r.state.store.addBody({
|
|
65
65
|
...e,
|
|
66
66
|
id: i,
|
|
@@ -68,46 +68,46 @@ const X = (n, r) => {
|
|
|
68
68
|
created: e.created || /* @__PURE__ */ new Date(),
|
|
69
69
|
creator: r.getUser()
|
|
70
70
|
});
|
|
71
|
-
},
|
|
71
|
+
}, R = (e) => {
|
|
72
72
|
r.state.store.deleteBody({ id: e, annotation: t.id });
|
|
73
|
-
},
|
|
74
|
-
const C = i.id ||
|
|
73
|
+
}, B = (e, i) => {
|
|
74
|
+
const C = i.id || w(), E = {
|
|
75
75
|
updated: /* @__PURE__ */ new Date(),
|
|
76
76
|
updatedBy: r.getUser(),
|
|
77
77
|
...i,
|
|
78
78
|
id: C,
|
|
79
79
|
annotation: t.id
|
|
80
80
|
};
|
|
81
|
-
r.state.store.updateBody(e,
|
|
81
|
+
r.state.store.updateBody(e, E);
|
|
82
82
|
};
|
|
83
|
-
return d && t ? /* @__PURE__ */
|
|
83
|
+
return d && t ? /* @__PURE__ */ h(
|
|
84
84
|
"div",
|
|
85
85
|
{
|
|
86
86
|
className: "a9s-popup a9s-image-popup",
|
|
87
87
|
ref: c.setFloating,
|
|
88
88
|
style: y,
|
|
89
89
|
children: [
|
|
90
|
-
n.arrow && /* @__PURE__ */
|
|
91
|
-
|
|
90
|
+
n.arrow && /* @__PURE__ */ O(
|
|
91
|
+
F,
|
|
92
92
|
{
|
|
93
|
-
ref:
|
|
93
|
+
ref: l,
|
|
94
94
|
context: v,
|
|
95
95
|
...n.arrowProps || {}
|
|
96
96
|
}
|
|
97
97
|
),
|
|
98
98
|
n.popup({
|
|
99
99
|
annotation: t,
|
|
100
|
-
editable:
|
|
101
|
-
event:
|
|
102
|
-
onCreateBody:
|
|
103
|
-
onDeleteBody:
|
|
104
|
-
onUpdateBody:
|
|
100
|
+
editable: m,
|
|
101
|
+
event: p,
|
|
102
|
+
onCreateBody: x,
|
|
103
|
+
onDeleteBody: R,
|
|
104
|
+
onUpdateBody: B
|
|
105
105
|
})
|
|
106
106
|
]
|
|
107
107
|
}
|
|
108
108
|
) : null;
|
|
109
109
|
};
|
|
110
110
|
export {
|
|
111
|
-
|
|
111
|
+
oe as OpenSeadragonAnnotationPopup
|
|
112
112
|
};
|
|
113
113
|
//# sourceMappingURL=annotorious-react.es9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es9.js","sources":["../src/openseadragon/OpenSeadragonAnnotationPopup.tsx"],"sourcesContent":["import { ReactNode, useEffect, useRef, useState } from 'react';\nimport OpenSeadragon from 'openseadragon';\nimport { v4 as uuidv4 } from 'uuid';\nimport { useAnnotator, useSelection, useViewer} from '@annotorious/react';\nimport type { PopupProps } from '@annotorious/react';\nimport type { AnnotationBody, Annotator, Geometry, ImageAnnotation } from '@annotorious/annotorious';\nimport { toClientRects } from '../utils/toClientRects';\nimport {\n useFloating,\n arrow,\n shift,\n inline,\n autoUpdate,\n flip,\n offset,\n FloatingArrow,\n FloatingArrowProps,\n Placement\n} from '@floating-ui/react';\n\nconst toDOMRect = (viewer: OpenSeadragon.Viewer, geometry: Geometry) => {\n const { minX, minY, maxX, maxY } = geometry.bounds;\n\n const { top, left } = viewer.element.getBoundingClientRect();\n\n const topLeft = viewer.viewport.imageToViewerElementCoordinates(new OpenSeadragon.Point(minX, minY));\n const bottomRight = viewer.viewport.imageToViewerElementCoordinates(new OpenSeadragon.Point(maxX, maxY));\n\n return new DOMRect(\n topLeft.x + left,\n topLeft.y + top,\n bottomRight.x - topLeft.x,\n bottomRight.y - topLeft.y\n );\n}\n\ninterface OpenSeadragonAnnotationPopupProps {\n\n arrow?: boolean;\n\n arrowProps?: Omit<FloatingArrowProps, 'context' | 'ref'>;\n\n placement?: Placement;\n\n popup: (props: PopupProps) => ReactNode;\n\n}\n\nexport const OpenSeadragonAnnotationPopup = (props: OpenSeadragonAnnotationPopupProps) => {\n \n const anno = useAnnotator<Annotator<ImageAnnotation>>();\n\n const [isOpen, setIsOpen] = useState(false);\n\n const viewer = useViewer();\n\n const arrowRef = useRef(null);\n\n const { selected, event } = useSelection();\n\n const annotation = selected[0]?.annotation;\n\n const editable = selected[0]?.editable;\n\n const { refs, floatingStyles, context } = useFloating({\n open: isOpen,\n onOpenChange: setIsOpen,\n placement: props.placement,\n middleware: [\n inline(), \n offset(10),\n flip({ crossAxis: true }),\n shift({ \n crossAxis: true,\n boundary: viewer?.element,\n padding: { right: 5, left: 5, top: 10, bottom: 10 }\n }),\n arrow({\n element: arrowRef,\n padding: 5\n })\n ],\n whileElementsMounted: autoUpdate\n });\n\n useEffect(() => {\n if (selected.length === 0) {\n setIsOpen(false);\n } else { \n const setPosition = () => { \n // This avoids issues when new viewer instances are mounted/unmounted \n // while the popup is open\n if (!viewer.element) return;\n\n const rect = toDOMRect(viewer, annotation.target.selector.geometry);\n \n refs.setReference({\n getBoundingClientRect: () => rect,\n getClientRects: () => toClientRects(rect)\n });\n }\n\n window.addEventListener('scroll', setPosition, true);\n window.addEventListener('resize', setPosition);\n viewer.addHandler('update-viewport', setPosition);\n\n setPosition();\n\n setIsOpen(true);\n\n return () => {\n window.removeEventListener('scroll', setPosition, true);\n window.removeEventListener('resize', setPosition);\n viewer.removeHandler('update-viewport', setPosition);\n };\n }\n }, [props.popup, selected, viewer]);\n\n const onCreateBody = (body: Partial<AnnotationBody>) => {\n const id = body.id || uuidv4();\n \n anno.state.store.addBody({\n ...body,\n id,\n annotation: annotation.id,\n created: body.created || new Date(),\n creator: anno.getUser()\n });\n }\n\n const onDeleteBody = (id: string) => {\n anno.state.store.deleteBody({ id, annotation: annotation.id });\n }\n\n const onUpdateBody = (current: AnnotationBody, next: AnnotationBody) => {\n const id = next.id || uuidv4();\n\n const updated: AnnotationBody = {\n updated: new Date(),\n updatedBy: anno.getUser(),\n ...next,\n id,\n annotation: annotation.id\n }\n\n anno.state.store.updateBody(current, updated);\n }\n\n return (isOpen && annotation) ? (\n <div\n className=\"a9s-popup a9s-image-popup\"\n ref={refs.setFloating}\n style={floatingStyles}>\n \n {props.arrow && (\n <FloatingArrow \n ref={arrowRef} \n context={context} \n {...(props.arrowProps || {})} />\n )}\n\n {props.popup({ \n annotation, \n editable, \n event,\n onCreateBody,\n onDeleteBody,\n onUpdateBody\n })}\n </div>\n ) : null;\n\n}"],"names":["toDOMRect","viewer","geometry","minX","minY","maxX","maxY","top","left","topLeft","OpenSeadragon","bottomRight","OpenSeadragonAnnotationPopup","props","anno","useAnnotator","isOpen","setIsOpen","useState","useViewer","arrowRef","useRef","selected","event","useSelection","annotation","_a","editable","_b","refs","floatingStyles","context","useFloating","inline","offset","flip","shift","arrow","autoUpdate","useEffect","setPosition","rect","toClientRects","onCreateBody","body","id","uuidv4","onDeleteBody","onUpdateBody","current","next","updated","jsxs","jsx","FloatingArrow"],"mappings":";;;;;;;;;;;;;;AAoBA,MAAMA,IAAY,CAACC,GAA8BC,MAAuB;AACtE,QAAM,EAAE,MAAAC,GAAM,MAAAC,GAAM,MAAAC,GAAM,MAAAC,EAAA,IAASJ,EAAS,QAEtC,EAAE,KAAAK,GAAK,MAAAC,EAAA,IAASP,EAAO,QAAQ,sBAAsB,GAErDQ,IAAUR,EAAO,SAAS,gCAAgC,IAAIS,EAAc,MAAMP,GAAMC,CAAI,CAAC,GAC7FO,IAAcV,EAAO,SAAS,gCAAgC,IAAIS,EAAc,MAAML,GAAMC,CAAI,CAAC;AAEvG,SAAO,IAAI;AAAA,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ReactNode, useEffect, useRef, useState } from 'react';\nimport OpenSeadragon from 'openseadragon';\nimport { v4 as uuidv4 } from 'uuid';\nimport { useAnnotator, useSelection, useViewer} from '@annotorious/react';\nimport type { PopupProps } from '@annotorious/react';\nimport type { AnnotationBody, Annotator, Geometry, ImageAnnotation } from '@annotorious/annotorious';\nimport { toClientRects } from '../utils/toClientRects';\nimport {\n useFloating,\n arrow,\n shift,\n inline,\n autoUpdate,\n flip,\n offset,\n FloatingArrow,\n FloatingArrowProps,\n Placement\n} from '@floating-ui/react';\n\nconst toDOMRect = (viewer: OpenSeadragon.Viewer, geometry: Geometry) => {\n const { minX, minY, maxX, maxY } = geometry.bounds;\n\n const { top, left } = viewer.element.getBoundingClientRect();\n\n const topLeft = viewer.viewport.imageToViewerElementCoordinates(new OpenSeadragon.Point(minX, minY));\n const bottomRight = viewer.viewport.imageToViewerElementCoordinates(new OpenSeadragon.Point(maxX, maxY));\n\n return new DOMRect(\n topLeft.x + left,\n topLeft.y + top,\n bottomRight.x - topLeft.x,\n bottomRight.y - topLeft.y\n );\n}\n\ninterface OpenSeadragonAnnotationPopupProps {\n\n arrow?: boolean;\n\n arrowProps?: Omit<FloatingArrowProps, 'context' | 'ref'>;\n\n placement?: Placement;\n\n popup: (props: PopupProps) => ReactNode;\n\n}\n\nexport const OpenSeadragonAnnotationPopup = (props: OpenSeadragonAnnotationPopupProps) => {\n \n const anno = useAnnotator<Annotator<ImageAnnotation>>();\n\n const [isOpen, setIsOpen] = useState(false);\n\n const viewer = useViewer();\n\n const arrowRef = useRef(null);\n\n const { selected, event } = useSelection();\n\n const annotation = selected[0]?.annotation;\n\n const editable = selected[0]?.editable;\n\n const { refs, floatingStyles, context } = useFloating({\n open: isOpen,\n onOpenChange: setIsOpen,\n placement: props.placement,\n middleware: [\n inline(), \n offset(10),\n flip({ crossAxis: true }),\n shift({ \n crossAxis: true,\n boundary: viewer?.element,\n padding: { right: 5, left: 5, top: 10, bottom: 10 }\n }),\n arrow({\n element: arrowRef,\n padding: 5\n })\n ],\n whileElementsMounted: autoUpdate\n });\n\n useEffect(() => {\n if (selected.length === 0) {\n setIsOpen(false);\n } else { \n const setPosition = () => { \n // This avoids issues when new viewer instances are mounted/unmounted \n // while the popup is open\n if (!viewer.element) return;\n\n const rect = toDOMRect(viewer, annotation.target.selector.geometry);\n \n refs.setReference({\n getBoundingClientRect: () => rect,\n getClientRects: () => toClientRects(rect)\n });\n }\n\n window.addEventListener('scroll', setPosition, true);\n window.addEventListener('resize', setPosition);\n viewer.addHandler('update-viewport', setPosition);\n\n setPosition();\n\n setIsOpen(true);\n\n return () => {\n window.removeEventListener('scroll', setPosition, true);\n window.removeEventListener('resize', setPosition);\n viewer.removeHandler('update-viewport', setPosition);\n };\n }\n }, [props.popup, selected, viewer]);\n\n const onCreateBody = (body: Partial<AnnotationBody>) => {\n const id = body.id || uuidv4();\n \n anno.state.store.addBody({\n ...body,\n id,\n annotation: annotation.id,\n created: body.created || new Date(),\n creator: anno.getUser()\n });\n }\n\n const onDeleteBody = (id: string) => {\n anno.state.store.deleteBody({ id, annotation: annotation.id });\n }\n\n const onUpdateBody = (current: AnnotationBody, next: AnnotationBody) => {\n const id = next.id || uuidv4();\n\n const updated: AnnotationBody = {\n updated: new Date(),\n updatedBy: anno.getUser(),\n ...next,\n id,\n annotation: annotation.id\n }\n\n anno.state.store.updateBody(current, updated);\n }\n\n return (isOpen && annotation) ? (\n <div\n className=\"a9s-popup a9s-image-popup\"\n ref={refs.setFloating}\n style={floatingStyles}>\n \n {props.arrow && (\n <FloatingArrow \n ref={arrowRef} \n context={context} \n {...(props.arrowProps || {})} />\n )}\n\n {props.popup({ \n annotation, \n editable, \n event,\n onCreateBody,\n onDeleteBody,\n onUpdateBody\n })}\n </div>\n ) : null;\n\n}"],"names":["toDOMRect","viewer","geometry","minX","minY","maxX","maxY","top","left","topLeft","OpenSeadragon","bottomRight","OpenSeadragonAnnotationPopup","props","anno","useAnnotator","isOpen","setIsOpen","useState","useViewer","arrowRef","useRef","selected","event","useSelection","annotation","_a","editable","_b","refs","floatingStyles","context","useFloating","inline","offset","flip","shift","arrow","autoUpdate","useEffect","setPosition","rect","toClientRects","onCreateBody","body","id","uuidv4","onDeleteBody","onUpdateBody","current","next","updated","jsxs","jsx","FloatingArrow"],"mappings":";;;;;;;;;;;;;;AAoBA,MAAMA,IAAY,CAACC,GAA8BC,MAAuB;AACtE,QAAM,EAAE,MAAAC,GAAM,MAAAC,GAAM,MAAAC,GAAM,MAAAC,EAAA,IAASJ,EAAS,QAEtC,EAAE,KAAAK,GAAK,MAAAC,EAAA,IAASP,EAAO,QAAQ,sBAAsB,GAErDQ,IAAUR,EAAO,SAAS,gCAAgC,IAAIS,EAAc,MAAMP,GAAMC,CAAI,CAAC,GAC7FO,IAAcV,EAAO,SAAS,gCAAgC,IAAIS,EAAc,MAAML,GAAMC,CAAI,CAAC;AAEvG,SAAO,IAAI;AAAA,IACTG,EAAQ,IAAID;AAAA,IACZC,EAAQ,IAAIF;AAAA,IACZI,EAAY,IAAKF,EAAQ;AAAA,IACzBE,EAAY,IAAIF,EAAQ;AAAA,EAC1B;AACF,GAcaG,KAA+B,CAACC,MAA6C;;AAExF,QAAMC,IAAOC,EAAyC,GAEhD,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GAEpCjB,IAASkB,EAAU,GAEnBC,IAAWC,EAAO,IAAI,GAEtB,EAAE,UAAAC,GAAU,OAAAC,EAAM,IAAIC,EAAa,GAEnCC,KAAaC,IAAAJ,EAAS,CAAC,MAAV,gBAAAI,EAAa,YAE1BC,KAAWC,IAAAN,EAAS,CAAC,MAAV,gBAAAM,EAAa,UAExB,EAAE,MAAAC,GAAM,gBAAAC,GAAgB,SAAAC,EAAA,IAAYC,EAAY;AAAA,IACpD,MAAMhB;AAAA,IACN,cAAcC;AAAA,IACd,WAAWJ,EAAM;AAAA,IACjB,YAAY;AAAA,MACVoB,EAAO;AAAA,MACPC,EAAO,EAAE;AAAA,MACTC,EAAK,EAAE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K,QAAQ;AAAA,IAAA,CACvB;AAAA,EACH,GAEMiC,IAAe,CAACF,MAAe;AAC9B,IAAA/B,EAAA,MAAM,MAAM,WAAW,EAAE,IAAA+B,GAAI,YAAYpB,EAAW,IAAI;AAAA,EAC/D,GAEMuB,IAAe,CAACC,GAAyBC,MAAyB;AAChE,UAAAL,IAAKK,EAAK,MAAMJ,EAAO,GAEvBK,IAA0B;AAAA,MAC9B,6BAAa,KAAK;AAAA,MAClB,WAAWrC,EAAK,QAAQ;AAAA,MACxB,GAAGoC;AAAA,MACH,IAAAL;AAAA,MACA,YAAYpB,EAAW;AAAA,IACzB;AAEA,IAAAX,EAAK,MAAM,MAAM,WAAWmC,GAASE,CAAO;AAAA,EAC9C;AAEA,SAAQnC,KAAUS,IAChB,gBAAA2B;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,KAAKvB,EAAK;AAAA,MACV,OAAOC;AAAA,MAEN,UAAA;AAAA,QAAAjB,EAAM,SACL,gBAAAwC;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,KAAKlC;AAAA,YACL,SAAAW;AAAA,YACC,GAAIlB,EAAM,cAAc,CAAA;AAAA,UAAC;AAAA,QAAI;AAAA,QAGjCA,EAAM,MAAM;AAAA,UACX,YAAAY;AAAA,UACA,UAAAE;AAAA,UACA,OAAAJ;AAAA,UACA,cAAAoB;AAAA,UACA,cAAAI;AAAA,UACA,cAAAC;AAAA,QACD,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAED;AAEN;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@annotorious/react",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Annotorious React bindings",
|
|
5
5
|
"author": "Rainer Simon",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@types/react-dom": "^19.0.3",
|
|
31
31
|
"@vitejs/plugin-react": "^4.3.4",
|
|
32
32
|
"typescript": "5.7.3",
|
|
33
|
-
"vite": "^
|
|
33
|
+
"vite": "^5.4.14",
|
|
34
34
|
"vite-plugin-dts": "^4.5.0",
|
|
35
35
|
"vite-tsconfig-paths": "^5.1.4"
|
|
36
36
|
},
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@annotorious/annotorious": "3.1.
|
|
49
|
-
"@annotorious/core": "3.1.
|
|
50
|
-
"@annotorious/openseadragon": "3.1.
|
|
48
|
+
"@annotorious/annotorious": "3.1.2",
|
|
49
|
+
"@annotorious/core": "3.1.2",
|
|
50
|
+
"@annotorious/openseadragon": "3.1.2",
|
|
51
51
|
"@floating-ui/react": "^0.27.3",
|
|
52
52
|
"zustand": "^5.0.3"
|
|
53
53
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es23.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es24.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const i = [];
|
|
2
|
-
for (let n = 0; n < 256; ++n)
|
|
3
|
-
i.push((n + 256).toString(16).slice(1));
|
|
4
|
-
function c(n, u = 0) {
|
|
5
|
-
return (i[n[u + 0]] + i[n[u + 1]] + i[n[u + 2]] + i[n[u + 3]] + "-" + i[n[u + 4]] + i[n[u + 5]] + "-" + i[n[u + 6]] + i[n[u + 7]] + "-" + i[n[u + 8]] + i[n[u + 9]] + "-" + i[n[u + 10]] + i[n[u + 11]] + i[n[u + 12]] + i[n[u + 13]] + i[n[u + 14]] + i[n[u + 15]]).toLowerCase();
|
|
6
|
-
}
|
|
7
|
-
export {
|
|
8
|
-
c as unsafeStringify
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=annotorious-react.es25.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es25.js","sources":["../node_modules/uuid/dist/esm-browser/stringify.js"],"sourcesContent":["import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;\n"],"names":["byteToHex","i","unsafeStringify","arr","offset"],"mappings":"AACA,MAAMA,IAAY,CAAE;AACpB,SAASC,IAAI,GAAGA,IAAI,KAAK,EAAEA;AACvB,EAAAD,EAAU,MAAMC,IAAI,KAAO,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;AAE7C,SAASC,EAAgBC,GAAKC,IAAS,GAAG;AAC7C,UAAQJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IAC7BJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAC1BJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAC1BJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAC1BJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAC1BJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAC1BJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,GAAG,YAAa;AAClD;","x_google_ignoreList":[0]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es26.js","sources":["../node_modules/uuid/dist/esm-browser/native.js"],"sourcesContent":["const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default { randomUUID };\n"],"names":["randomUUID","native"],"mappings":"AAAA,MAAMA,IAAa,OAAO,SAAW,OAAe,OAAO,cAAc,OAAO,WAAW,KAAK,MAAM,GACvFC,IAAA,EAAE,YAAAD,EAAY;","x_google_ignoreList":[0]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
let t;
|
|
2
|
-
const e = new Uint8Array(16);
|
|
3
|
-
function o() {
|
|
4
|
-
if (!t) {
|
|
5
|
-
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
6
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
7
|
-
t = crypto.getRandomValues.bind(crypto);
|
|
8
|
-
}
|
|
9
|
-
return t(e);
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
o as default
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=annotorious-react.es27.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es27.js","sources":["../node_modules/uuid/dist/esm-browser/rng.js"],"sourcesContent":["let getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n if (!getRandomValues) {\n if (typeof crypto === 'undefined' || !crypto.getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n getRandomValues = crypto.getRandomValues.bind(crypto);\n }\n return getRandomValues(rnds8);\n}\n"],"names":["getRandomValues","rnds8","rng"],"mappings":"AAAA,IAAIA;AACJ,MAAMC,IAAQ,IAAI,WAAW,EAAE;AAChB,SAASC,IAAM;AAC1B,MAAI,CAACF,GAAiB;AAClB,QAAI,OAAO,SAAW,OAAe,CAAC,OAAO;AACzC,YAAM,IAAI,MAAM,0GAA0G;AAE9H,IAAAA,IAAkB,OAAO,gBAAgB,KAAK,MAAM;AAAA,EAC5D;AACI,SAAOA,EAAgBC,CAAK;AAChC;","x_google_ignoreList":[0]}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
const l = Math.min, a = Math.max, P = Math.round, M = Math.floor, O = (t) => ({
|
|
2
|
-
x: t,
|
|
3
|
-
y: t
|
|
4
|
-
}), m = {
|
|
5
|
-
left: "right",
|
|
6
|
-
right: "left",
|
|
7
|
-
bottom: "top",
|
|
8
|
-
top: "bottom"
|
|
9
|
-
}, p = {
|
|
10
|
-
start: "end",
|
|
11
|
-
end: "start"
|
|
12
|
-
};
|
|
13
|
-
function S(t, n, e) {
|
|
14
|
-
return a(t, l(n, e));
|
|
15
|
-
}
|
|
16
|
-
function w(t, n) {
|
|
17
|
-
return typeof t == "function" ? t(n) : t;
|
|
18
|
-
}
|
|
19
|
-
function f(t) {
|
|
20
|
-
return t.split("-")[0];
|
|
21
|
-
}
|
|
22
|
-
function g(t) {
|
|
23
|
-
return t.split("-")[1];
|
|
24
|
-
}
|
|
25
|
-
function h(t) {
|
|
26
|
-
return t === "x" ? "y" : "x";
|
|
27
|
-
}
|
|
28
|
-
function x(t) {
|
|
29
|
-
return t === "y" ? "height" : "width";
|
|
30
|
-
}
|
|
31
|
-
function b(t) {
|
|
32
|
-
return ["top", "bottom"].includes(f(t)) ? "y" : "x";
|
|
33
|
-
}
|
|
34
|
-
function d(t) {
|
|
35
|
-
return h(b(t));
|
|
36
|
-
}
|
|
37
|
-
function j(t, n, e) {
|
|
38
|
-
e === void 0 && (e = !1);
|
|
39
|
-
const r = g(t), o = d(t), i = x(o);
|
|
40
|
-
let c = o === "x" ? r === (e ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
|
|
41
|
-
return n.reference[i] > n.floating[i] && (c = u(c)), [c, u(c)];
|
|
42
|
-
}
|
|
43
|
-
function C(t) {
|
|
44
|
-
const n = u(t);
|
|
45
|
-
return [s(t), n, s(n)];
|
|
46
|
-
}
|
|
47
|
-
function s(t) {
|
|
48
|
-
return t.replace(/start|end/g, (n) => p[n]);
|
|
49
|
-
}
|
|
50
|
-
function A(t, n, e) {
|
|
51
|
-
const r = ["left", "right"], o = ["right", "left"], i = ["top", "bottom"], c = ["bottom", "top"];
|
|
52
|
-
switch (t) {
|
|
53
|
-
case "top":
|
|
54
|
-
case "bottom":
|
|
55
|
-
return e ? n ? o : r : n ? r : o;
|
|
56
|
-
case "left":
|
|
57
|
-
case "right":
|
|
58
|
-
return n ? i : c;
|
|
59
|
-
default:
|
|
60
|
-
return [];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function L(t, n, e, r) {
|
|
64
|
-
const o = g(t);
|
|
65
|
-
let i = A(f(t), e === "start", r);
|
|
66
|
-
return o && (i = i.map((c) => c + "-" + o), n && (i = i.concat(i.map(s)))), i;
|
|
67
|
-
}
|
|
68
|
-
function u(t) {
|
|
69
|
-
return t.replace(/left|right|bottom|top/g, (n) => m[n]);
|
|
70
|
-
}
|
|
71
|
-
function y(t) {
|
|
72
|
-
return {
|
|
73
|
-
top: 0,
|
|
74
|
-
right: 0,
|
|
75
|
-
bottom: 0,
|
|
76
|
-
left: 0,
|
|
77
|
-
...t
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function E(t) {
|
|
81
|
-
return typeof t != "number" ? y(t) : {
|
|
82
|
-
top: t,
|
|
83
|
-
right: t,
|
|
84
|
-
bottom: t,
|
|
85
|
-
left: t
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
function R(t) {
|
|
89
|
-
const {
|
|
90
|
-
x: n,
|
|
91
|
-
y: e,
|
|
92
|
-
width: r,
|
|
93
|
-
height: o
|
|
94
|
-
} = t;
|
|
95
|
-
return {
|
|
96
|
-
width: r,
|
|
97
|
-
height: o,
|
|
98
|
-
top: e,
|
|
99
|
-
left: n,
|
|
100
|
-
right: n + r,
|
|
101
|
-
bottom: e + o,
|
|
102
|
-
x: n,
|
|
103
|
-
y: e
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
export {
|
|
107
|
-
S as clamp,
|
|
108
|
-
O as createCoords,
|
|
109
|
-
w as evaluate,
|
|
110
|
-
y as expandPaddingObject,
|
|
111
|
-
M as floor,
|
|
112
|
-
g as getAlignment,
|
|
113
|
-
d as getAlignmentAxis,
|
|
114
|
-
j as getAlignmentSides,
|
|
115
|
-
x as getAxisLength,
|
|
116
|
-
C as getExpandedPlacements,
|
|
117
|
-
s as getOppositeAlignmentPlacement,
|
|
118
|
-
h as getOppositeAxis,
|
|
119
|
-
L as getOppositeAxisPlacements,
|
|
120
|
-
u as getOppositePlacement,
|
|
121
|
-
E as getPaddingObject,
|
|
122
|
-
f as getSide,
|
|
123
|
-
b as getSideAxis,
|
|
124
|
-
a as max,
|
|
125
|
-
l as min,
|
|
126
|
-
R as rectToClientRect,
|
|
127
|
-
P as round
|
|
128
|
-
};
|
|
129
|
-
//# sourceMappingURL=annotorious-react.es28.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es28.js","sources":["../../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs"],"sourcesContent":["/**\n * Custom positioning reference element.\n * @see https://floating-ui.com/docs/virtual-elements\n */\n\nconst sides = ['top', 'right', 'bottom', 'left'];\nconst alignments = ['start', 'end'];\nconst placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + \"-\" + alignments[0], side + \"-\" + alignments[1]), []);\nconst min = Math.min;\nconst max = Math.max;\nconst round = Math.round;\nconst floor = Math.floor;\nconst createCoords = v => ({\n x: v,\n y: v\n});\nconst oppositeSideMap = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nconst oppositeAlignmentMap = {\n start: 'end',\n end: 'start'\n};\nfunction clamp(start, value, end) {\n return max(start, min(value, end));\n}\nfunction evaluate(value, param) {\n return typeof value === 'function' ? value(param) : value;\n}\nfunction getSide(placement) {\n return placement.split('-')[0];\n}\nfunction getAlignment(placement) {\n return placement.split('-')[1];\n}\nfunction getOppositeAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}\nfunction getAxisLength(axis) {\n return axis === 'y' ? 'height' : 'width';\n}\nfunction getSideAxis(placement) {\n return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';\n}\nfunction getAlignmentAxis(placement) {\n return getOppositeAxis(getSideAxis(placement));\n}\nfunction getAlignmentSides(placement, rects, rtl) {\n if (rtl === void 0) {\n rtl = false;\n }\n const alignment = getAlignment(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const length = getAxisLength(alignmentAxis);\n let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';\n if (rects.reference[length] > rects.floating[length]) {\n mainAlignmentSide = getOppositePlacement(mainAlignmentSide);\n }\n return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];\n}\nfunction getExpandedPlacements(placement) {\n const oppositePlacement = getOppositePlacement(placement);\n return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];\n}\nfunction getOppositeAlignmentPlacement(placement) {\n return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);\n}\nfunction getSideList(side, isStart, rtl) {\n const lr = ['left', 'right'];\n const rl = ['right', 'left'];\n const tb = ['top', 'bottom'];\n const bt = ['bottom', 'top'];\n switch (side) {\n case 'top':\n case 'bottom':\n if (rtl) return isStart ? rl : lr;\n return isStart ? lr : rl;\n case 'left':\n case 'right':\n return isStart ? tb : bt;\n default:\n return [];\n }\n}\nfunction getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {\n const alignment = getAlignment(placement);\n let list = getSideList(getSide(placement), direction === 'start', rtl);\n if (alignment) {\n list = list.map(side => side + \"-\" + alignment);\n if (flipAlignment) {\n list = list.concat(list.map(getOppositeAlignmentPlacement));\n }\n }\n return list;\n}\nfunction getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);\n}\nfunction expandPaddingObject(padding) {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n ...padding\n };\n}\nfunction getPaddingObject(padding) {\n return typeof padding !== 'number' ? expandPaddingObject(padding) : {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding\n };\n}\nfunction rectToClientRect(rect) {\n const {\n x,\n y,\n width,\n height\n } = rect;\n return {\n width,\n height,\n top: y,\n left: x,\n right: x + width,\n bottom: y + height,\n x,\n y\n };\n}\n\nexport { alignments, clamp, createCoords, evaluate, expandPaddingObject, floor, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, round, sides };\n"],"names":["min","max","round","floor","createCoords","v","oppositeSideMap","oppositeAlignmentMap","clamp","start","value","end","evaluate","param","getSide","placement","getAlignment","getOppositeAxis","axis","getAxisLength","getSideAxis","getAlignmentAxis","getAlignmentSides","rects","rtl","alignment","alignmentAxis","length","mainAlignmentSide","getOppositePlacement","getExpandedPlacements","oppositePlacement","getOppositeAlignmentPlacement","getSideList","side","isStart","lr","rl","tb","bt","getOppositeAxisPlacements","flipAlignment","direction","list","expandPaddingObject","padding","getPaddingObject","rectToClientRect","rect","x","y","width","height"],"mappings":"AAQK,MAACA,IAAM,KAAK,KACXC,IAAM,KAAK,KACXC,IAAQ,KAAK,OACbC,IAAQ,KAAK,OACbC,IAAe,CAAAC,OAAM;AAAA,EACzB,GAAGA;AAAA,EACH,GAAGA;AACL,IACMC,IAAkB;AAAA,EACtB,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AACP,GACMC,IAAuB;AAAA,EAC3B,OAAO;AAAA,EACP,KAAK;AACP;AACA,SAASC,EAAMC,GAAOC,GAAOC,GAAK;AAChC,SAAOV,EAAIQ,GAAOT,EAAIU,GAAOC,CAAG,CAAC;AACnC;AACA,SAASC,EAASF,GAAOG,GAAO;AAC9B,SAAO,OAAOH,KAAU,aAAaA,EAAMG,CAAK,IAAIH;AACtD;AACA,SAASI,EAAQC,GAAW;AAC1B,SAAOA,EAAU,MAAM,GAAG,EAAE,CAAC;AAC/B;AACA,SAASC,EAAaD,GAAW;AAC/B,SAAOA,EAAU,MAAM,GAAG,EAAE,CAAC;AAC/B;AACA,SAASE,EAAgBC,GAAM;AAC7B,SAAOA,MAAS,MAAM,MAAM;AAC9B;AACA,SAASC,EAAcD,GAAM;AAC3B,SAAOA,MAAS,MAAM,WAAW;AACnC;AACA,SAASE,EAAYL,GAAW;AAC9B,SAAO,CAAC,OAAO,QAAQ,EAAE,SAASD,EAAQC,CAAS,CAAC,IAAI,MAAM;AAChE;AACA,SAASM,EAAiBN,GAAW;AACnC,SAAOE,EAAgBG,EAAYL,CAAS,CAAC;AAC/C;AACA,SAASO,EAAkBP,GAAWQ,GAAOC,GAAK;AAChD,EAAIA,MAAQ,WACVA,IAAM;AA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