@soomo/react-text-annotator 3.0.0-staging.4 → 3.0.0-staging.40

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.
Files changed (77) hide show
  1. package/dist/TextAnnotator.d.ts +3 -3
  2. package/dist/TextAnnotator.d.ts.map +1 -1
  3. package/dist/TextAnnotatorPlugin.d.ts +1 -2
  4. package/dist/TextAnnotatorPlugin.d.ts.map +1 -1
  5. package/dist/TextAnnotatorPopup/TextAnnotatorPopup.d.ts +16 -0
  6. package/dist/TextAnnotatorPopup/TextAnnotatorPopup.d.ts.map +1 -0
  7. package/dist/TextAnnotatorPopup/index.d.ts +2 -0
  8. package/dist/TextAnnotatorPopup/index.d.ts.map +1 -0
  9. package/dist/hooks/index.d.ts +3 -0
  10. package/dist/hooks/index.d.ts.map +1 -0
  11. package/dist/hooks/useAnnouncePopupNavigation.d.ts +10 -0
  12. package/dist/hooks/useAnnouncePopupNavigation.d.ts.map +1 -0
  13. package/dist/hooks/useRestoreSelectionCaret.d.ts +13 -0
  14. package/dist/hooks/useRestoreSelectionCaret.d.ts.map +1 -0
  15. package/dist/index.d.ts +7 -2
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/react-text-annotator.css +31 -1
  18. package/dist/react-text-annotator.es.js +14 -4
  19. package/dist/react-text-annotator.es.js.map +1 -1
  20. package/dist/react-text-annotator.es11.js +459 -861
  21. package/dist/react-text-annotator.es11.js.map +1 -1
  22. package/dist/react-text-annotator.es12.js +64 -2
  23. package/dist/react-text-annotator.es12.js.map +1 -1
  24. package/dist/react-text-annotator.es13.js +45 -2
  25. package/dist/react-text-annotator.es13.js.map +1 -1
  26. package/dist/react-text-annotator.es14.js +1444 -107
  27. package/dist/react-text-annotator.es14.js.map +1 -1
  28. package/dist/react-text-annotator.es16.js +228 -45
  29. package/dist/react-text-annotator.es16.js.map +1 -1
  30. package/dist/react-text-annotator.es17.js +565 -16
  31. package/dist/react-text-annotator.es17.js.map +1 -1
  32. package/dist/react-text-annotator.es18.js +5 -0
  33. package/dist/react-text-annotator.es18.js.map +1 -0
  34. package/dist/{react-text-annotator.es10.js → react-text-annotator.es19.js} +7 -11
  35. package/dist/{react-text-annotator.es10.js.map → react-text-annotator.es19.js.map} +1 -1
  36. package/dist/react-text-annotator.es2.js +2 -2
  37. package/dist/react-text-annotator.es20.js +901 -0
  38. package/dist/react-text-annotator.es20.js.map +1 -0
  39. package/dist/react-text-annotator.es21.js +117 -0
  40. package/dist/react-text-annotator.es21.js.map +1 -0
  41. package/dist/{react-text-annotator.es15.js → react-text-annotator.es22.js} +1 -1
  42. package/dist/{react-text-annotator.es15.js.map → react-text-annotator.es22.js.map} +1 -1
  43. package/dist/react-text-annotator.es23.js +61 -0
  44. package/dist/react-text-annotator.es23.js.map +1 -0
  45. package/dist/react-text-annotator.es24.js +23 -0
  46. package/dist/react-text-annotator.es24.js.map +1 -0
  47. package/dist/react-text-annotator.es25.js +5 -0
  48. package/dist/react-text-annotator.es25.js.map +1 -0
  49. package/dist/react-text-annotator.es26.js +5 -0
  50. package/dist/react-text-annotator.es26.js.map +1 -0
  51. package/dist/react-text-annotator.es27.js +130 -0
  52. package/dist/react-text-annotator.es27.js.map +1 -0
  53. package/dist/react-text-annotator.es28.js +155 -0
  54. package/dist/react-text-annotator.es28.js.map +1 -0
  55. package/dist/react-text-annotator.es29.js +314 -0
  56. package/dist/react-text-annotator.es29.js.map +1 -0
  57. package/dist/react-text-annotator.es3.js +2 -2
  58. package/dist/react-text-annotator.es30.js +152 -0
  59. package/dist/react-text-annotator.es30.js.map +1 -0
  60. package/dist/react-text-annotator.es31.js +563 -0
  61. package/dist/react-text-annotator.es31.js.map +1 -0
  62. package/dist/react-text-annotator.es4.js +29 -27
  63. package/dist/react-text-annotator.es4.js.map +1 -1
  64. package/dist/react-text-annotator.es5.js +38 -48
  65. package/dist/react-text-annotator.es5.js.map +1 -1
  66. package/dist/react-text-annotator.es6.js +25 -10
  67. package/dist/react-text-annotator.es6.js.map +1 -1
  68. package/dist/react-text-annotator.es7.js +134 -1
  69. package/dist/react-text-annotator.es7.js.map +1 -1
  70. package/dist/react-text-annotator.es8.js +177 -486
  71. package/dist/react-text-annotator.es8.js.map +1 -1
  72. package/dist/react-text-annotator.es9.js +10 -2
  73. package/dist/react-text-annotator.es9.js.map +1 -1
  74. package/dist/tei/TEIAnnotator.d.ts +2 -2
  75. package/package.json +23 -15
  76. package/dist/TextAnnotatorPopup.d.ts +0 -14
  77. package/dist/TextAnnotatorPopup.d.ts.map +0 -1
@@ -0,0 +1,130 @@
1
+ import { isShadowRoot, isHTMLElement } from "./react-text-annotator.es28.js";
2
+ function activeElement(doc) {
3
+ let activeElement2 = doc.activeElement;
4
+ while (((_activeElement = activeElement2) == null || (_activeElement = _activeElement.shadowRoot) == null ? void 0 : _activeElement.activeElement) != null) {
5
+ var _activeElement;
6
+ activeElement2 = activeElement2.shadowRoot.activeElement;
7
+ }
8
+ return activeElement2;
9
+ }
10
+ function contains(parent, child) {
11
+ if (!parent || !child) {
12
+ return false;
13
+ }
14
+ const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();
15
+ if (parent.contains(child)) {
16
+ return true;
17
+ }
18
+ if (rootNode && isShadowRoot(rootNode)) {
19
+ let next = child;
20
+ while (next) {
21
+ if (parent === next) {
22
+ return true;
23
+ }
24
+ next = next.parentNode || next.host;
25
+ }
26
+ }
27
+ return false;
28
+ }
29
+ function getPlatform() {
30
+ const uaData = navigator.userAgentData;
31
+ if (uaData != null && uaData.platform) {
32
+ return uaData.platform;
33
+ }
34
+ return navigator.platform;
35
+ }
36
+ function getUserAgent() {
37
+ const uaData = navigator.userAgentData;
38
+ if (uaData && Array.isArray(uaData.brands)) {
39
+ return uaData.brands.map((_ref) => {
40
+ let {
41
+ brand,
42
+ version
43
+ } = _ref;
44
+ return brand + "/" + version;
45
+ }).join(" ");
46
+ }
47
+ return navigator.userAgent;
48
+ }
49
+ function isVirtualClick(event) {
50
+ if (event.mozInputSource === 0 && event.isTrusted) {
51
+ return true;
52
+ }
53
+ if (isAndroid() && event.pointerType) {
54
+ return event.type === "click" && event.buttons === 1;
55
+ }
56
+ return event.detail === 0 && !event.pointerType;
57
+ }
58
+ function isVirtualPointerEvent(event) {
59
+ if (isJSDOM()) return false;
60
+ return !isAndroid() && event.width === 0 && event.height === 0 || isAndroid() && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
61
+ event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "touch";
62
+ }
63
+ function isSafari() {
64
+ return /apple/i.test(navigator.vendor);
65
+ }
66
+ function isAndroid() {
67
+ const re = /android/i;
68
+ return re.test(getPlatform()) || re.test(getUserAgent());
69
+ }
70
+ function isJSDOM() {
71
+ return getUserAgent().includes("jsdom/");
72
+ }
73
+ function isReactEvent(event) {
74
+ return "nativeEvent" in event;
75
+ }
76
+ function isRootElement(element) {
77
+ return element.matches("html,body");
78
+ }
79
+ function getDocument(node) {
80
+ return (node == null ? void 0 : node.ownerDocument) || document;
81
+ }
82
+ function isEventTargetWithin(event, node) {
83
+ if (node == null) {
84
+ return false;
85
+ }
86
+ if ("composedPath" in event) {
87
+ return event.composedPath().includes(node);
88
+ }
89
+ const e = event;
90
+ return e.target != null && node.contains(e.target);
91
+ }
92
+ function getTarget(event) {
93
+ if ("composedPath" in event) {
94
+ return event.composedPath()[0];
95
+ }
96
+ return event.target;
97
+ }
98
+ const TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
99
+ function isTypeableElement(element) {
100
+ return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
101
+ }
102
+ function stopEvent(event) {
103
+ event.preventDefault();
104
+ event.stopPropagation();
105
+ }
106
+ function isTypeableCombobox(element) {
107
+ if (!element) return false;
108
+ return element.getAttribute("role") === "combobox" && isTypeableElement(element);
109
+ }
110
+ export {
111
+ TYPEABLE_SELECTOR,
112
+ activeElement,
113
+ contains,
114
+ getDocument,
115
+ getPlatform,
116
+ getTarget,
117
+ getUserAgent,
118
+ isAndroid,
119
+ isEventTargetWithin,
120
+ isJSDOM,
121
+ isReactEvent,
122
+ isRootElement,
123
+ isSafari,
124
+ isTypeableCombobox,
125
+ isTypeableElement,
126
+ isVirtualClick,
127
+ isVirtualPointerEvent,
128
+ stopEvent
129
+ };
130
+ //# sourceMappingURL=react-text-annotator.es27.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-text-annotator.es27.js","sources":["../../../node_modules/@floating-ui/react/dist/floating-ui.react.utils.mjs"],"sourcesContent":["import { isShadowRoot, isHTMLElement } from '@floating-ui/utils/dom';\n\nfunction activeElement(doc) {\n let activeElement = doc.activeElement;\n while (((_activeElement = activeElement) == null || (_activeElement = _activeElement.shadowRoot) == null ? void 0 : _activeElement.activeElement) != null) {\n var _activeElement;\n activeElement = activeElement.shadowRoot.activeElement;\n }\n return activeElement;\n}\nfunction contains(parent, child) {\n if (!parent || !child) {\n return false;\n }\n const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();\n\n // First, attempt with faster native method\n if (parent.contains(child)) {\n return true;\n }\n\n // then fallback to custom implementation with Shadow DOM support\n if (rootNode && isShadowRoot(rootNode)) {\n let next = child;\n while (next) {\n if (parent === next) {\n return true;\n }\n // @ts-ignore\n next = next.parentNode || next.host;\n }\n }\n\n // Give up, the result is false\n return false;\n}\n// Avoid Chrome DevTools blue warning.\nfunction getPlatform() {\n const uaData = navigator.userAgentData;\n if (uaData != null && uaData.platform) {\n return uaData.platform;\n }\n return navigator.platform;\n}\nfunction getUserAgent() {\n const uaData = navigator.userAgentData;\n if (uaData && Array.isArray(uaData.brands)) {\n return uaData.brands.map(_ref => {\n let {\n brand,\n version\n } = _ref;\n return brand + \"/\" + version;\n }).join(' ');\n }\n return navigator.userAgent;\n}\n\n// License: https://github.com/adobe/react-spectrum/blob/b35d5c02fe900badccd0cf1a8f23bb593419f238/packages/@react-aria/utils/src/isVirtualEvent.ts\nfunction isVirtualClick(event) {\n // FIXME: Firefox is now emitting a deprecation warning for `mozInputSource`.\n // Try to find a workaround for this. `react-aria` source still has the check.\n if (event.mozInputSource === 0 && event.isTrusted) {\n return true;\n }\n if (isAndroid() && event.pointerType) {\n return event.type === 'click' && event.buttons === 1;\n }\n return event.detail === 0 && !event.pointerType;\n}\nfunction isVirtualPointerEvent(event) {\n if (isJSDOM()) return false;\n return !isAndroid() && event.width === 0 && event.height === 0 || isAndroid() && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'mouse' ||\n // iOS VoiceOver returns 0.333• for width/height.\n event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'touch';\n}\nfunction isSafari() {\n // Chrome DevTools does not complain about navigator.vendor\n return /apple/i.test(navigator.vendor);\n}\nfunction isAndroid() {\n const re = /android/i;\n return re.test(getPlatform()) || re.test(getUserAgent());\n}\nfunction isMac() {\n return getPlatform().toLowerCase().startsWith('mac') && !navigator.maxTouchPoints;\n}\nfunction isJSDOM() {\n return getUserAgent().includes('jsdom/');\n}\nfunction isMouseLikePointerType(pointerType, strict) {\n // On some Linux machines with Chromium, mouse inputs return a `pointerType`\n // of \"pen\": https://github.com/floating-ui/floating-ui/issues/2015\n const values = ['mouse', 'pen'];\n if (!strict) {\n values.push('', undefined);\n }\n return values.includes(pointerType);\n}\nfunction isReactEvent(event) {\n return 'nativeEvent' in event;\n}\nfunction isRootElement(element) {\n return element.matches('html,body');\n}\nfunction getDocument(node) {\n return (node == null ? void 0 : node.ownerDocument) || document;\n}\nfunction isEventTargetWithin(event, node) {\n if (node == null) {\n return false;\n }\n if ('composedPath' in event) {\n return event.composedPath().includes(node);\n }\n\n // TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't\n const e = event;\n return e.target != null && node.contains(e.target);\n}\nfunction getTarget(event) {\n if ('composedPath' in event) {\n return event.composedPath()[0];\n }\n\n // TS thinks `event` is of type never as it assumes all browsers support\n // `composedPath()`, but browsers without shadow DOM don't.\n return event.target;\n}\nconst TYPEABLE_SELECTOR = \"input:not([type='hidden']):not([disabled]),\" + \"[contenteditable]:not([contenteditable='false']),textarea:not([disabled])\";\nfunction isTypeableElement(element) {\n return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);\n}\nfunction stopEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\nfunction isTypeableCombobox(element) {\n if (!element) return false;\n return element.getAttribute('role') === 'combobox' && isTypeableElement(element);\n}\n\nexport { TYPEABLE_SELECTOR, activeElement, contains, getDocument, getPlatform, getTarget, getUserAgent, isAndroid, isEventTargetWithin, isJSDOM, isMac, isMouseLikePointerType, isReactEvent, isRootElement, isSafari, isTypeableCombobox, isTypeableElement, isVirtualClick, isVirtualPointerEvent, stopEvent };\n"],"names":["activeElement"],"mappings":";AAEA,SAAS,cAAc,KAAK;AAC1B,MAAIA,iBAAgB,IAAI;AACxB,WAAS,iBAAiBA,mBAAkB,SAAS,iBAAiB,eAAe,eAAe,OAAO,SAAS,eAAe,kBAAkB,MAAM;AACzJ,QAAI;AACJ,IAAAA,iBAAgBA,eAAc,WAAW;AAAA,EAC1C;AACD,SAAOA;AACT;AACA,SAAS,SAAS,QAAQ,OAAO;AAC/B,MAAI,CAAC,UAAU,CAAC,OAAO;AACrB,WAAO;AAAA,EACR;AACD,QAAM,WAAW,MAAM,eAAe,OAAO,SAAS,MAAM;AAG5D,MAAI,OAAO,SAAS,KAAK,GAAG;AAC1B,WAAO;AAAA,EACR;AAGD,MAAI,YAAY,aAAa,QAAQ,GAAG;AACtC,QAAI,OAAO;AACX,WAAO,MAAM;AACX,UAAI,WAAW,MAAM;AACnB,eAAO;AAAA,MACR;AAED,aAAO,KAAK,cAAc,KAAK;AAAA,IAChC;AAAA,EACF;AAGD,SAAO;AACT;AAEA,SAAS,cAAc;AACrB,QAAM,SAAS,UAAU;AACzB,MAAI,U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,QAAQ,WAAW;AACpC;AACA,SAAS,YAAY,MAAM;AACzB,UAAQ,QAAQ,OAAO,SAAS,KAAK,kBAAkB;AACzD;AACA,SAAS,oBAAoB,OAAO,MAAM;AACxC,MAAI,QAAQ,MAAM;AAChB,WAAO;AAAA,EACR;AACD,MAAI,kBAAkB,OAAO;AAC3B,WAAO,MAAM,aAAY,EAAG,SAAS,IAAI;AAAA,EAC1C;AAGD,QAAM,IAAI;AACV,SAAO,EAAE,UAAU,QAAQ,KAAK,SAAS,EAAE,MAAM;AACnD;AACA,SAAS,UAAU,OAAO;AACxB,MAAI,kBAAkB,OAAO;AAC3B,WAAO,MAAM,eAAe,CAAC;AAAA,EAC9B;AAID,SAAO,MAAM;AACf;AACK,MAAC,oBAAoB;AAC1B,SAAS,kBAAkB,SAAS;AAClC,SAAO,cAAc,OAAO,KAAK,QAAQ,QAAQ,iBAAiB;AACpE;AACA,SAAS,UAAU,OAAO;AACxB,QAAM,eAAc;AACpB,QAAM,gBAAe;AACvB;AACA,SAAS,mBAAmB,SAAS;AACnC,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,QAAQ,aAAa,MAAM,MAAM,cAAc,kBAAkB,OAAO;AACjF;","x_google_ignoreList":[0]}
@@ -0,0 +1,155 @@
1
+ function getNodeName(node) {
2
+ if (isNode(node)) {
3
+ return (node.nodeName || "").toLowerCase();
4
+ }
5
+ return "#document";
6
+ }
7
+ function getWindow(node) {
8
+ var _node$ownerDocument;
9
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
10
+ }
11
+ function getDocumentElement(node) {
12
+ var _ref;
13
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
14
+ }
15
+ function isNode(value) {
16
+ return value instanceof Node || value instanceof getWindow(value).Node;
17
+ }
18
+ function isElement(value) {
19
+ return value instanceof Element || value instanceof getWindow(value).Element;
20
+ }
21
+ function isHTMLElement(value) {
22
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
23
+ }
24
+ function isShadowRoot(value) {
25
+ if (typeof ShadowRoot === "undefined") {
26
+ return false;
27
+ }
28
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
29
+ }
30
+ function isOverflowElement(element) {
31
+ const {
32
+ overflow,
33
+ overflowX,
34
+ overflowY,
35
+ display
36
+ } = getComputedStyle(element);
37
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
38
+ }
39
+ function isTableElement(element) {
40
+ return ["table", "td", "th"].includes(getNodeName(element));
41
+ }
42
+ function isTopLayer(element) {
43
+ return [":popover-open", ":modal"].some((selector) => {
44
+ try {
45
+ return element.matches(selector);
46
+ } catch (e) {
47
+ return false;
48
+ }
49
+ });
50
+ }
51
+ function isContainingBlock(elementOrCss) {
52
+ const webkit = isWebKit();
53
+ const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
54
+ return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
55
+ }
56
+ function getContainingBlock(element) {
57
+ let currentNode = getParentNode(element);
58
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
59
+ if (isContainingBlock(currentNode)) {
60
+ return currentNode;
61
+ } else if (isTopLayer(currentNode)) {
62
+ return null;
63
+ }
64
+ currentNode = getParentNode(currentNode);
65
+ }
66
+ return null;
67
+ }
68
+ function isWebKit() {
69
+ if (typeof CSS === "undefined" || !CSS.supports) return false;
70
+ return CSS.supports("-webkit-backdrop-filter", "none");
71
+ }
72
+ function isLastTraversableNode(node) {
73
+ return ["html", "body", "#document"].includes(getNodeName(node));
74
+ }
75
+ function getComputedStyle(element) {
76
+ return getWindow(element).getComputedStyle(element);
77
+ }
78
+ function getNodeScroll(element) {
79
+ if (isElement(element)) {
80
+ return {
81
+ scrollLeft: element.scrollLeft,
82
+ scrollTop: element.scrollTop
83
+ };
84
+ }
85
+ return {
86
+ scrollLeft: element.scrollX,
87
+ scrollTop: element.scrollY
88
+ };
89
+ }
90
+ function getParentNode(node) {
91
+ if (getNodeName(node) === "html") {
92
+ return node;
93
+ }
94
+ const result = (
95
+ // Step into the shadow DOM of the parent of a slotted node.
96
+ node.assignedSlot || // DOM Element detected.
97
+ node.parentNode || // ShadowRoot detected.
98
+ isShadowRoot(node) && node.host || // Fallback.
99
+ getDocumentElement(node)
100
+ );
101
+ return isShadowRoot(result) ? result.host : result;
102
+ }
103
+ function getNearestOverflowAncestor(node) {
104
+ const parentNode = getParentNode(node);
105
+ if (isLastTraversableNode(parentNode)) {
106
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
107
+ }
108
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
109
+ return parentNode;
110
+ }
111
+ return getNearestOverflowAncestor(parentNode);
112
+ }
113
+ function getOverflowAncestors(node, list, traverseIframes) {
114
+ var _node$ownerDocument2;
115
+ if (list === void 0) {
116
+ list = [];
117
+ }
118
+ if (traverseIframes === void 0) {
119
+ traverseIframes = true;
120
+ }
121
+ const scrollableAncestor = getNearestOverflowAncestor(node);
122
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
123
+ const win = getWindow(scrollableAncestor);
124
+ if (isBody) {
125
+ const frameElement = getFrameElement(win);
126
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
127
+ }
128
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
129
+ }
130
+ function getFrameElement(win) {
131
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
132
+ }
133
+ export {
134
+ getComputedStyle,
135
+ getContainingBlock,
136
+ getDocumentElement,
137
+ getFrameElement,
138
+ getNearestOverflowAncestor,
139
+ getNodeName,
140
+ getNodeScroll,
141
+ getOverflowAncestors,
142
+ getParentNode,
143
+ getWindow,
144
+ isContainingBlock,
145
+ isElement,
146
+ isHTMLElement,
147
+ isLastTraversableNode,
148
+ isNode,
149
+ isOverflowElement,
150
+ isShadowRoot,
151
+ isTableElement,
152
+ isTopLayer,
153
+ isWebKit
154
+ };
155
+ //# sourceMappingURL=react-text-annotator.es28.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-text-annotator.es28.js","sources":["../../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs"],"sourcesContent":["function getNodeName(node) {\n if (isNode(node)) {\n return (node.nodeName || '').toLowerCase();\n }\n // Mocked nodes in testing environments may not be instances of Node. By\n // returning `#document` an infinite loop won't occur.\n // https://github.com/floating-ui/floating-ui/issues/2317\n return '#document';\n}\nfunction getWindow(node) {\n var _node$ownerDocument;\n return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;\n}\nfunction getDocumentElement(node) {\n var _ref;\n return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;\n}\nfunction isNode(value) {\n return value instanceof Node || value instanceof getWindow(value).Node;\n}\nfunction isElement(value) {\n return value instanceof Element || value instanceof getWindow(value).Element;\n}\nfunction isHTMLElement(value) {\n return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;\n}\nfunction isShadowRoot(value) {\n // Browsers without `ShadowRoot` support.\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;\n}\nfunction isOverflowElement(element) {\n const {\n overflow,\n overflowX,\n overflowY,\n display\n } = getComputedStyle(element);\n return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);\n}\nfunction isTableElement(element) {\n return ['table', 'td', 'th'].includes(getNodeName(element));\n}\nfunction isTopLayer(element) {\n return [':popover-open', ':modal'].some(selector => {\n try {\n return element.matches(selector);\n } catch (e) {\n return false;\n }\n });\n}\nfunction isContainingBlock(elementOrCss) {\n const webkit = isWebKit();\n const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));\n}\nfunction getContainingBlock(element) {\n let currentNode = getParentNode(element);\n while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {\n if (isContainingBlock(currentNode)) {\n return currentNode;\n } else if (isTopLayer(currentNode)) {\n return null;\n }\n currentNode = getParentNode(currentNode);\n }\n return null;\n}\nfunction isWebKit() {\n if (typeof CSS === 'undefined' || !CSS.supports) return false;\n return CSS.supports('-webkit-backdrop-filter', 'none');\n}\nfunction isLastTraversableNode(node) {\n return ['html', 'body', '#document'].includes(getNodeName(node));\n}\nfunction getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}\nfunction getNodeScroll(element) {\n if (isElement(element)) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n }\n return {\n scrollLeft: element.scrollX,\n scrollTop: element.scrollY\n };\n}\nfunction getParentNode(node) {\n if (getNodeName(node) === 'html') {\n return node;\n }\n const result =\n // Step into the shadow DOM of the parent of a slotted node.\n node.assignedSlot ||\n // DOM Element detected.\n node.parentNode ||\n // ShadowRoot detected.\n isShadowRoot(node) && node.host ||\n // Fallback.\n getDocumentElement(node);\n return isShadowRoot(result) ? result.host : result;\n}\nfunction getNearestOverflowAncestor(node) {\n const parentNode = getParentNode(node);\n if (isLastTraversableNode(parentNode)) {\n return node.ownerDocument ? node.ownerDocument.body : node.body;\n }\n if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {\n return parentNode;\n }\n return getNearestOverflowAncestor(parentNode);\n}\nfunction getOverflowAncestors(node, list, traverseIframes) {\n var _node$ownerDocument2;\n if (list === void 0) {\n list = [];\n }\n if (traverseIframes === void 0) {\n traverseIframes = true;\n }\n const scrollableAncestor = getNearestOverflowAncestor(node);\n const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);\n const win = getWindow(scrollableAncestor);\n if (isBody) {\n const frameElement = getFrameElement(win);\n return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);\n }\n return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));\n}\nfunction getFrameElement(win) {\n return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;\n}\n\nexport { getComputedStyle, getContainingBlock, getDocumentElement, getFrameElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };\n"],"names":[],"mappings":"AAAA,SAAS,YAAY,MAAM;AACzB,MAAI,OAAO,IAAI,GAAG;AAChB,YAAQ,KAAK,YAAY,IAAI,YAAW;AAAA,EACzC;AAID,SAAO;AACT;AACA,SAAS,UAAU,MAAM;AACvB,MAAI;AACJ,UAAQ,QAAQ,SAAS,sBAAsB,KAAK,kBAAkB,OAAO,SAAS,oBAAoB,gBAAgB;AAC5H;AACA,SAAS,mBAAmB,MAAM;AAChC,MAAI;AACJ,UAAQ,QAAQ,OAAO,IAAI,IAAI,KAAK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AM;AACxC,QAAM,aAAa,cAAc,IAAI;AACrC,MAAI,sBAAsB,UAAU,GAAG;AACrC,WAAO,KAAK,gBAAgB,KAAK,cAAc,OAAO,KAAK;AAAA,EAC5D;AACD,MAAI,cAAc,UAAU,KAAK,kBAAkB,UAAU,GAAG;AAC9D,WAAO;AAAA,EACR;AACD,SAAO,2BAA2B,UAAU;AAC9C;AACA,SAAS,qBAAqB,MAAM,MAAM,iBAAiB;AACzD,MAAI;AACJ,MAAI,SAAS,QAAQ;AACnB,WAAO,CAAA;AAAA,EACR;AACD,MAAI,oBAAoB,QAAQ;AAC9B,sBAAkB;AAAA,EACnB;AACD,QAAM,qBAAqB,2BAA2B,IAAI;AAC1D,QAAM,SAAS,yBAAyB,uBAAuB,KAAK,kBAAkB,OAAO,SAAS,qBAAqB;AAC3H,QAAM,MAAM,UAAU,kBAAkB;AACxC,MAAI,QAAQ;AACV,UAAM,eAAe,gBAAgB,GAAG;AACxC,WAAO,KAAK,OAAO,KAAK,IAAI,kBAAkB,CAAE,GAAE,kBAAkB,kBAAkB,IAAI,qBAAqB,CAAE,GAAE,gBAAgB,kBAAkB,qBAAqB,YAAY,IAAI,CAAA,CAAE;AAAA,EAC7L;AACD,SAAO,KAAK,OAAO,oBAAoB,qBAAqB,oBAAoB,CAAE,GAAE,eAAe,CAAC;AACtG;AACA,SAAS,gBAAgB,KAAK;AAC5B,SAAO,IAAI,UAAU,OAAO,eAAe,IAAI,MAAM,IAAI,IAAI,eAAe;AAC9E;","x_google_ignoreList":[0]}
@@ -0,0 +1,314 @@
1
+ /*!
2
+ * tabbable 6.2.0
3
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
4
+ */
5
+ var candidateSelectors = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"];
6
+ var candidateSelector = /* @__PURE__ */ candidateSelectors.join(",");
7
+ var NoElement = typeof Element === "undefined";
8
+ var matches = NoElement ? function() {
9
+ } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
10
+ var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) {
11
+ var _element$getRootNode;
12
+ return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);
13
+ } : function(element) {
14
+ return element === null || element === void 0 ? void 0 : element.ownerDocument;
15
+ };
16
+ var isInert = function isInert2(node, lookUp) {
17
+ var _node$getAttribute;
18
+ if (lookUp === void 0) {
19
+ lookUp = true;
20
+ }
21
+ var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, "inert");
22
+ var inert = inertAtt === "" || inertAtt === "true";
23
+ var result = inert || lookUp && node && isInert2(node.parentNode);
24
+ return result;
25
+ };
26
+ var isContentEditable = function isContentEditable2(node) {
27
+ var _node$getAttribute2;
28
+ var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, "contenteditable");
29
+ return attValue === "" || attValue === "true";
30
+ };
31
+ var getCandidates = function getCandidates2(el, includeContainer, filter) {
32
+ if (isInert(el)) {
33
+ return [];
34
+ }
35
+ var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
36
+ if (includeContainer && matches.call(el, candidateSelector)) {
37
+ candidates.unshift(el);
38
+ }
39
+ candidates = candidates.filter(filter);
40
+ return candidates;
41
+ };
42
+ var getCandidatesIteratively = function getCandidatesIteratively2(elements, includeContainer, options) {
43
+ var candidates = [];
44
+ var elementsToCheck = Array.from(elements);
45
+ while (elementsToCheck.length) {
46
+ var element = elementsToCheck.shift();
47
+ if (isInert(element, false)) {
48
+ continue;
49
+ }
50
+ if (element.tagName === "SLOT") {
51
+ var assigned = element.assignedElements();
52
+ var content = assigned.length ? assigned : element.children;
53
+ var nestedCandidates = getCandidatesIteratively2(content, true, options);
54
+ if (options.flatten) {
55
+ candidates.push.apply(candidates, nestedCandidates);
56
+ } else {
57
+ candidates.push({
58
+ scopeParent: element,
59
+ candidates: nestedCandidates
60
+ });
61
+ }
62
+ } else {
63
+ var validCandidate = matches.call(element, candidateSelector);
64
+ if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
65
+ candidates.push(element);
66
+ }
67
+ var shadowRoot = element.shadowRoot || // check for an undisclosed shadow
68
+ typeof options.getShadowRoot === "function" && options.getShadowRoot(element);
69
+ var validShadowRoot = !isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
70
+ if (shadowRoot && validShadowRoot) {
71
+ var _nestedCandidates = getCandidatesIteratively2(shadowRoot === true ? element.children : shadowRoot.children, true, options);
72
+ if (options.flatten) {
73
+ candidates.push.apply(candidates, _nestedCandidates);
74
+ } else {
75
+ candidates.push({
76
+ scopeParent: element,
77
+ candidates: _nestedCandidates
78
+ });
79
+ }
80
+ } else {
81
+ elementsToCheck.unshift.apply(elementsToCheck, element.children);
82
+ }
83
+ }
84
+ }
85
+ return candidates;
86
+ };
87
+ var hasTabIndex = function hasTabIndex2(node) {
88
+ return !isNaN(parseInt(node.getAttribute("tabindex"), 10));
89
+ };
90
+ var getTabIndex = function getTabIndex2(node) {
91
+ if (!node) {
92
+ throw new Error("No node provided");
93
+ }
94
+ if (node.tabIndex < 0) {
95
+ if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {
96
+ return 0;
97
+ }
98
+ }
99
+ return node.tabIndex;
100
+ };
101
+ var getSortOrderTabIndex = function getSortOrderTabIndex2(node, isScope) {
102
+ var tabIndex = getTabIndex(node);
103
+ if (tabIndex < 0 && isScope && !hasTabIndex(node)) {
104
+ return 0;
105
+ }
106
+ return tabIndex;
107
+ };
108
+ var sortOrderedTabbables = function sortOrderedTabbables2(a, b) {
109
+ return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
110
+ };
111
+ var isInput = function isInput2(node) {
112
+ return node.tagName === "INPUT";
113
+ };
114
+ var isHiddenInput = function isHiddenInput2(node) {
115
+ return isInput(node) && node.type === "hidden";
116
+ };
117
+ var isDetailsWithSummary = function isDetailsWithSummary2(node) {
118
+ var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) {
119
+ return child.tagName === "SUMMARY";
120
+ });
121
+ return r;
122
+ };
123
+ var getCheckedRadio = function getCheckedRadio2(nodes, form) {
124
+ for (var i = 0; i < nodes.length; i++) {
125
+ if (nodes[i].checked && nodes[i].form === form) {
126
+ return nodes[i];
127
+ }
128
+ }
129
+ };
130
+ var isTabbableRadio = function isTabbableRadio2(node) {
131
+ if (!node.name) {
132
+ return true;
133
+ }
134
+ var radioScope = node.form || getRootNode(node);
135
+ var queryRadios = function queryRadios2(name) {
136
+ return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
137
+ };
138
+ var radioSet;
139
+ if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") {
140
+ radioSet = queryRadios(window.CSS.escape(node.name));
141
+ } else {
142
+ try {
143
+ radioSet = queryRadios(node.name);
144
+ } catch (err) {
145
+ console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message);
146
+ return false;
147
+ }
148
+ }
149
+ var checked = getCheckedRadio(radioSet, node.form);
150
+ return !checked || checked === node;
151
+ };
152
+ var isRadio = function isRadio2(node) {
153
+ return isInput(node) && node.type === "radio";
154
+ };
155
+ var isNonTabbableRadio = function isNonTabbableRadio2(node) {
156
+ return isRadio(node) && !isTabbableRadio(node);
157
+ };
158
+ var isNodeAttached = function isNodeAttached2(node) {
159
+ var _nodeRoot;
160
+ var nodeRoot = node && getRootNode(node);
161
+ var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;
162
+ var attached = false;
163
+ if (nodeRoot && nodeRoot !== node) {
164
+ var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
165
+ attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node));
166
+ while (!attached && nodeRootHost) {
167
+ var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
168
+ nodeRoot = getRootNode(nodeRootHost);
169
+ nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;
170
+ attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));
171
+ }
172
+ }
173
+ return attached;
174
+ };
175
+ var isZeroArea = function isZeroArea2(node) {
176
+ var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
177
+ return width === 0 && height === 0;
178
+ };
179
+ var isHidden = function isHidden2(node, _ref) {
180
+ var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot;
181
+ if (getComputedStyle(node).visibility === "hidden") {
182
+ return true;
183
+ }
184
+ var isDirectSummary = matches.call(node, "details>summary:first-of-type");
185
+ var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
186
+ if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
187
+ return true;
188
+ }
189
+ if (!displayCheck || displayCheck === "full" || displayCheck === "legacy-full") {
190
+ if (typeof getShadowRoot === "function") {
191
+ var originalNode = node;
192
+ while (node) {
193
+ var parentElement = node.parentElement;
194
+ var rootNode = getRootNode(node);
195
+ if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) {
196
+ return isZeroArea(node);
197
+ } else if (node.assignedSlot) {
198
+ node = node.assignedSlot;
199
+ } else if (!parentElement && rootNode !== node.ownerDocument) {
200
+ node = rootNode.host;
201
+ } else {
202
+ node = parentElement;
203
+ }
204
+ }
205
+ node = originalNode;
206
+ }
207
+ if (isNodeAttached(node)) {
208
+ return !node.getClientRects().length;
209
+ }
210
+ if (displayCheck !== "legacy-full") {
211
+ return true;
212
+ }
213
+ } else if (displayCheck === "non-zero-area") {
214
+ return isZeroArea(node);
215
+ }
216
+ return false;
217
+ };
218
+ var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
219
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
220
+ var parentNode = node.parentElement;
221
+ while (parentNode) {
222
+ if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
223
+ for (var i = 0; i < parentNode.children.length; i++) {
224
+ var child = parentNode.children.item(i);
225
+ if (child.tagName === "LEGEND") {
226
+ return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node);
227
+ }
228
+ }
229
+ return true;
230
+ }
231
+ parentNode = parentNode.parentElement;
232
+ }
233
+ }
234
+ return false;
235
+ };
236
+ var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) {
237
+ if (node.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
238
+ // because we're limited in the type of selectors we can use in JSDom (see related
239
+ // note related to `candidateSelectors`)
240
+ isInert(node) || isHiddenInput(node) || isHidden(node, options) || // For a details element with a summary, the summary element gets the focus
241
+ isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
242
+ return false;
243
+ }
244
+ return true;
245
+ };
246
+ var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) {
247
+ if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
248
+ return false;
249
+ }
250
+ return true;
251
+ };
252
+ var isValidShadowRootTabbable = function isValidShadowRootTabbable2(shadowHostNode) {
253
+ var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10);
254
+ if (isNaN(tabIndex) || tabIndex >= 0) {
255
+ return true;
256
+ }
257
+ return false;
258
+ };
259
+ var sortByOrder = function sortByOrder2(candidates) {
260
+ var regularTabbables = [];
261
+ var orderedTabbables = [];
262
+ candidates.forEach(function(item, i) {
263
+ var isScope = !!item.scopeParent;
264
+ var element = isScope ? item.scopeParent : item;
265
+ var candidateTabindex = getSortOrderTabIndex(element, isScope);
266
+ var elements = isScope ? sortByOrder2(item.candidates) : element;
267
+ if (candidateTabindex === 0) {
268
+ isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
269
+ } else {
270
+ orderedTabbables.push({
271
+ documentOrder: i,
272
+ tabIndex: candidateTabindex,
273
+ item,
274
+ isScope,
275
+ content: elements
276
+ });
277
+ }
278
+ });
279
+ return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) {
280
+ sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
281
+ return acc;
282
+ }, []).concat(regularTabbables);
283
+ };
284
+ var tabbable = function tabbable2(container, options) {
285
+ options = options || {};
286
+ var candidates;
287
+ if (options.getShadowRoot) {
288
+ candidates = getCandidatesIteratively([container], options.includeContainer, {
289
+ filter: isNodeMatchingSelectorTabbable.bind(null, options),
290
+ flatten: false,
291
+ getShadowRoot: options.getShadowRoot,
292
+ shadowRootFilter: isValidShadowRootTabbable
293
+ });
294
+ } else {
295
+ candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
296
+ }
297
+ return sortByOrder(candidates);
298
+ };
299
+ var isTabbable = function isTabbable2(node, options) {
300
+ options = options || {};
301
+ if (!node) {
302
+ throw new Error("No node provided");
303
+ }
304
+ if (matches.call(node, candidateSelector) === false) {
305
+ return false;
306
+ }
307
+ return isNodeMatchingSelectorTabbable(options, node);
308
+ };
309
+ export {
310
+ getTabIndex,
311
+ isTabbable,
312
+ tabbable
313
+ };
314
+ //# sourceMappingURL=react-text-annotator.es29.js.map