@soomo/react-text-annotator 3.0.0-staging.38 → 3.0.0-staging.39
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/{TextAnnotatorPopup.d.ts → TextAnnotatorPopup/TextAnnotatorPopup.d.ts} +3 -2
- package/dist/TextAnnotatorPopup/TextAnnotatorPopup.d.ts.map +1 -0
- package/dist/TextAnnotatorPopup/index.d.ts +2 -0
- package/dist/TextAnnotatorPopup/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useAnnouncePopupNavigation.d.ts +8 -0
- package/dist/hooks/useAnnouncePopupNavigation.d.ts.map +1 -0
- package/dist/hooks/useRestoreSelectionCaret.d.ts +13 -0
- package/dist/hooks/useRestoreSelectionCaret.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/react-text-annotator.css +30 -0
- package/dist/react-text-annotator.es.js +8 -4
- package/dist/react-text-annotator.es.js.map +1 -1
- package/dist/react-text-annotator.es11.js +445 -527
- package/dist/react-text-annotator.es11.js.map +1 -1
- package/dist/react-text-annotator.es12.js +60 -483
- package/dist/react-text-annotator.es12.js.map +1 -1
- package/dist/react-text-annotator.es13.js +38 -44
- package/dist/react-text-annotator.es13.js.map +1 -1
- package/dist/react-text-annotator.es14.js +1422 -118
- package/dist/react-text-annotator.es14.js.map +1 -1
- package/dist/react-text-annotator.es16.js +239 -29
- package/dist/react-text-annotator.es16.js.map +1 -1
- package/dist/react-text-annotator.es17.js +568 -897
- package/dist/react-text-annotator.es17.js.map +1 -1
- package/dist/react-text-annotator.es18.js +2 -2
- package/dist/react-text-annotator.es19.js +31 -2
- package/dist/react-text-annotator.es19.js.map +1 -1
- package/dist/react-text-annotator.es2.js +2 -2
- package/dist/react-text-annotator.es20.js +893 -109
- package/dist/react-text-annotator.es20.js.map +1 -1
- package/dist/react-text-annotator.es21.js +2 -309
- package/dist/react-text-annotator.es21.js.map +1 -1
- package/dist/react-text-annotator.es22.js +2 -58
- package/dist/react-text-annotator.es22.js.map +1 -1
- package/dist/react-text-annotator.es23.js +113 -19
- package/dist/react-text-annotator.es23.js.map +1 -1
- package/dist/react-text-annotator.es24.js +290 -130
- package/dist/react-text-annotator.es24.js.map +1 -1
- package/dist/react-text-annotator.es25.js +43 -545
- package/dist/react-text-annotator.es25.js.map +1 -1
- package/dist/react-text-annotator.es26.js +23 -0
- package/dist/react-text-annotator.es26.js.map +1 -0
- package/dist/react-text-annotator.es27.js +130 -0
- package/dist/react-text-annotator.es27.js.map +1 -0
- package/dist/react-text-annotator.es28.js +155 -0
- package/dist/react-text-annotator.es28.js.map +1 -0
- package/dist/react-text-annotator.es29.js +314 -0
- package/dist/react-text-annotator.es29.js.map +1 -0
- package/dist/react-text-annotator.es3.js +2 -2
- package/dist/react-text-annotator.es30.js +152 -0
- package/dist/react-text-annotator.es30.js.map +1 -0
- package/dist/react-text-annotator.es31.js +563 -0
- package/dist/react-text-annotator.es31.js.map +1 -0
- package/dist/react-text-annotator.es4.js +30 -23
- package/dist/react-text-annotator.es4.js.map +1 -1
- package/dist/react-text-annotator.es5.js +36 -78
- package/dist/react-text-annotator.es5.js.map +1 -1
- package/dist/react-text-annotator.es6.js +24 -178
- package/dist/react-text-annotator.es6.js.map +1 -1
- package/dist/react-text-annotator.es7.js +126 -10
- package/dist/react-text-annotator.es7.js.map +1 -1
- package/dist/react-text-annotator.es8.js +182 -0
- package/dist/react-text-annotator.es8.js.map +1 -0
- package/dist/react-text-annotator.es9.js +10 -670
- package/dist/react-text-annotator.es9.js.map +1 -1
- package/package.json +5 -3
- package/dist/TextAnnotatorPopup.d.ts.map +0 -1
- package/dist/react-text-annotator.es10.js +0 -244
- package/dist/react-text-annotator.es10.js.map +0 -1
- package/dist/react-text-annotator.es15.js +0 -5
- package/dist/react-text-annotator.es15.js.map +0 -1
|
@@ -1,901 +1,572 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
var assign = Object.assign;
|
|
168
|
-
var disabledDepth = 0;
|
|
169
|
-
var prevLog;
|
|
170
|
-
var prevInfo;
|
|
171
|
-
var prevWarn;
|
|
172
|
-
var prevError;
|
|
173
|
-
var prevGroup;
|
|
174
|
-
var prevGroupCollapsed;
|
|
175
|
-
var prevGroupEnd;
|
|
176
|
-
function disabledLog() {
|
|
177
|
-
}
|
|
178
|
-
disabledLog.__reactDisabledLog = true;
|
|
179
|
-
function disableLogs() {
|
|
180
|
-
{
|
|
181
|
-
if (disabledDepth === 0) {
|
|
182
|
-
prevLog = console.log;
|
|
183
|
-
prevInfo = console.info;
|
|
184
|
-
prevWarn = console.warn;
|
|
185
|
-
prevError = console.error;
|
|
186
|
-
prevGroup = console.group;
|
|
187
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
188
|
-
prevGroupEnd = console.groupEnd;
|
|
189
|
-
var props = {
|
|
190
|
-
configurable: true,
|
|
191
|
-
enumerable: true,
|
|
192
|
-
value: disabledLog,
|
|
193
|
-
writable: true
|
|
194
|
-
};
|
|
195
|
-
Object.defineProperties(console, {
|
|
196
|
-
info: props,
|
|
197
|
-
log: props,
|
|
198
|
-
warn: props,
|
|
199
|
-
error: props,
|
|
200
|
-
group: props,
|
|
201
|
-
groupCollapsed: props,
|
|
202
|
-
groupEnd: props
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
disabledDepth++;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
function reenableLogs() {
|
|
209
|
-
{
|
|
210
|
-
disabledDepth--;
|
|
211
|
-
if (disabledDepth === 0) {
|
|
212
|
-
var props = {
|
|
213
|
-
configurable: true,
|
|
214
|
-
enumerable: true,
|
|
215
|
-
writable: true
|
|
216
|
-
};
|
|
217
|
-
Object.defineProperties(console, {
|
|
218
|
-
log: assign({}, props, {
|
|
219
|
-
value: prevLog
|
|
220
|
-
}),
|
|
221
|
-
info: assign({}, props, {
|
|
222
|
-
value: prevInfo
|
|
223
|
-
}),
|
|
224
|
-
warn: assign({}, props, {
|
|
225
|
-
value: prevWarn
|
|
226
|
-
}),
|
|
227
|
-
error: assign({}, props, {
|
|
228
|
-
value: prevError
|
|
229
|
-
}),
|
|
230
|
-
group: assign({}, props, {
|
|
231
|
-
value: prevGroup
|
|
232
|
-
}),
|
|
233
|
-
groupCollapsed: assign({}, props, {
|
|
234
|
-
value: prevGroupCollapsed
|
|
235
|
-
}),
|
|
236
|
-
groupEnd: assign({}, props, {
|
|
237
|
-
value: prevGroupEnd
|
|
238
|
-
})
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
if (disabledDepth < 0) {
|
|
242
|
-
error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
247
|
-
var prefix;
|
|
248
|
-
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
249
|
-
{
|
|
250
|
-
if (prefix === void 0) {
|
|
251
|
-
try {
|
|
252
|
-
throw Error();
|
|
253
|
-
} catch (x) {
|
|
254
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
255
|
-
prefix = match && match[1] || "";
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
return "\n" + prefix + name;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
var reentry = false;
|
|
262
|
-
var componentFrameCache;
|
|
263
|
-
{
|
|
264
|
-
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
|
|
265
|
-
componentFrameCache = new PossiblyWeakMap();
|
|
266
|
-
}
|
|
267
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
268
|
-
if (!fn || reentry) {
|
|
269
|
-
return "";
|
|
270
|
-
}
|
|
271
|
-
{
|
|
272
|
-
var frame = componentFrameCache.get(fn);
|
|
273
|
-
if (frame !== void 0) {
|
|
274
|
-
return frame;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
var control;
|
|
278
|
-
reentry = true;
|
|
279
|
-
var previousPrepareStackTrace = Error.prepareStackTrace;
|
|
280
|
-
Error.prepareStackTrace = void 0;
|
|
281
|
-
var previousDispatcher;
|
|
282
|
-
{
|
|
283
|
-
previousDispatcher = ReactCurrentDispatcher.current;
|
|
284
|
-
ReactCurrentDispatcher.current = null;
|
|
285
|
-
disableLogs();
|
|
286
|
-
}
|
|
287
|
-
try {
|
|
288
|
-
if (construct) {
|
|
289
|
-
var Fake = function() {
|
|
290
|
-
throw Error();
|
|
291
|
-
};
|
|
292
|
-
Object.defineProperty(Fake.prototype, "props", {
|
|
293
|
-
set: function() {
|
|
294
|
-
throw Error();
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
if (typeof Reflect === "object" && Reflect.construct) {
|
|
298
|
-
try {
|
|
299
|
-
Reflect.construct(Fake, []);
|
|
300
|
-
} catch (x) {
|
|
301
|
-
control = x;
|
|
302
|
-
}
|
|
303
|
-
Reflect.construct(fn, [], Fake);
|
|
304
|
-
} else {
|
|
305
|
-
try {
|
|
306
|
-
Fake.call();
|
|
307
|
-
} catch (x) {
|
|
308
|
-
control = x;
|
|
309
|
-
}
|
|
310
|
-
fn.call(Fake.prototype);
|
|
311
|
-
}
|
|
312
|
-
} else {
|
|
313
|
-
try {
|
|
314
|
-
throw Error();
|
|
315
|
-
} catch (x) {
|
|
316
|
-
control = x;
|
|
317
|
-
}
|
|
318
|
-
fn();
|
|
319
|
-
}
|
|
320
|
-
} catch (sample) {
|
|
321
|
-
if (sample && control && typeof sample.stack === "string") {
|
|
322
|
-
var sampleLines = sample.stack.split("\n");
|
|
323
|
-
var controlLines = control.stack.split("\n");
|
|
324
|
-
var s = sampleLines.length - 1;
|
|
325
|
-
var c = controlLines.length - 1;
|
|
326
|
-
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
327
|
-
c--;
|
|
328
|
-
}
|
|
329
|
-
for (; s >= 1 && c >= 0; s--, c--) {
|
|
330
|
-
if (sampleLines[s] !== controlLines[c]) {
|
|
331
|
-
if (s !== 1 || c !== 1) {
|
|
332
|
-
do {
|
|
333
|
-
s--;
|
|
334
|
-
c--;
|
|
335
|
-
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
336
|
-
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
|
|
337
|
-
if (fn.displayName && _frame.includes("<anonymous>")) {
|
|
338
|
-
_frame = _frame.replace("<anonymous>", fn.displayName);
|
|
339
|
-
}
|
|
340
|
-
{
|
|
341
|
-
if (typeof fn === "function") {
|
|
342
|
-
componentFrameCache.set(fn, _frame);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
return _frame;
|
|
346
|
-
}
|
|
347
|
-
} while (s >= 1 && c >= 0);
|
|
348
|
-
}
|
|
349
|
-
break;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
} finally {
|
|
354
|
-
reentry = false;
|
|
355
|
-
{
|
|
356
|
-
ReactCurrentDispatcher.current = previousDispatcher;
|
|
357
|
-
reenableLogs();
|
|
358
|
-
}
|
|
359
|
-
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
360
|
-
}
|
|
361
|
-
var name = fn ? fn.displayName || fn.name : "";
|
|
362
|
-
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
|
363
|
-
{
|
|
364
|
-
if (typeof fn === "function") {
|
|
365
|
-
componentFrameCache.set(fn, syntheticFrame);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
return syntheticFrame;
|
|
369
|
-
}
|
|
370
|
-
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
371
|
-
{
|
|
372
|
-
return describeNativeComponentFrame(fn, false);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
function shouldConstruct(Component) {
|
|
376
|
-
var prototype = Component.prototype;
|
|
377
|
-
return !!(prototype && prototype.isReactComponent);
|
|
378
|
-
}
|
|
379
|
-
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
380
|
-
if (type == null) {
|
|
381
|
-
return "";
|
|
382
|
-
}
|
|
383
|
-
if (typeof type === "function") {
|
|
384
|
-
{
|
|
385
|
-
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
if (typeof type === "string") {
|
|
389
|
-
return describeBuiltInComponentFrame(type);
|
|
390
|
-
}
|
|
391
|
-
switch (type) {
|
|
392
|
-
case REACT_SUSPENSE_TYPE:
|
|
393
|
-
return describeBuiltInComponentFrame("Suspense");
|
|
394
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
395
|
-
return describeBuiltInComponentFrame("SuspenseList");
|
|
396
|
-
}
|
|
397
|
-
if (typeof type === "object") {
|
|
398
|
-
switch (type.$$typeof) {
|
|
399
|
-
case REACT_FORWARD_REF_TYPE:
|
|
400
|
-
return describeFunctionComponentFrame(type.render);
|
|
401
|
-
case REACT_MEMO_TYPE:
|
|
402
|
-
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
403
|
-
case REACT_LAZY_TYPE: {
|
|
404
|
-
var lazyComponent = type;
|
|
405
|
-
var payload = lazyComponent._payload;
|
|
406
|
-
var init = lazyComponent._init;
|
|
407
|
-
try {
|
|
408
|
-
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
409
|
-
} catch (x) {
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
return "";
|
|
415
|
-
}
|
|
416
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
417
|
-
var loggedTypeFailures = {};
|
|
418
|
-
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
419
|
-
function setCurrentlyValidatingElement(element) {
|
|
420
|
-
{
|
|
421
|
-
if (element) {
|
|
422
|
-
var owner = element._owner;
|
|
423
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
424
|
-
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
425
|
-
} else {
|
|
426
|
-
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
431
|
-
{
|
|
432
|
-
var has = Function.call.bind(hasOwnProperty);
|
|
433
|
-
for (var typeSpecName in typeSpecs) {
|
|
434
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
435
|
-
var error$1 = void 0;
|
|
436
|
-
try {
|
|
437
|
-
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
438
|
-
var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
439
|
-
err.name = "Invariant Violation";
|
|
440
|
-
throw err;
|
|
441
|
-
}
|
|
442
|
-
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
443
|
-
} catch (ex) {
|
|
444
|
-
error$1 = ex;
|
|
445
|
-
}
|
|
446
|
-
if (error$1 && !(error$1 instanceof Error)) {
|
|
447
|
-
setCurrentlyValidatingElement(element);
|
|
448
|
-
error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
|
|
449
|
-
setCurrentlyValidatingElement(null);
|
|
450
|
-
}
|
|
451
|
-
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
452
|
-
loggedTypeFailures[error$1.message] = true;
|
|
453
|
-
setCurrentlyValidatingElement(element);
|
|
454
|
-
error("Failed %s type: %s", location, error$1.message);
|
|
455
|
-
setCurrentlyValidatingElement(null);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
var isArrayImpl = Array.isArray;
|
|
462
|
-
function isArray(a) {
|
|
463
|
-
return isArrayImpl(a);
|
|
464
|
-
}
|
|
465
|
-
function typeName(value) {
|
|
466
|
-
{
|
|
467
|
-
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
|
|
468
|
-
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
469
|
-
return type;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
function willCoercionThrow(value) {
|
|
473
|
-
{
|
|
474
|
-
try {
|
|
475
|
-
testStringCoercion(value);
|
|
476
|
-
return false;
|
|
477
|
-
} catch (e) {
|
|
478
|
-
return true;
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
function testStringCoercion(value) {
|
|
483
|
-
return "" + value;
|
|
484
|
-
}
|
|
485
|
-
function checkKeyStringCoercion(value) {
|
|
486
|
-
{
|
|
487
|
-
if (willCoercionThrow(value)) {
|
|
488
|
-
error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
|
489
|
-
return testStringCoercion(value);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
494
|
-
var RESERVED_PROPS = {
|
|
495
|
-
key: true,
|
|
496
|
-
ref: true,
|
|
497
|
-
__self: true,
|
|
498
|
-
__source: true
|
|
499
|
-
};
|
|
500
|
-
var specialPropKeyWarningShown;
|
|
501
|
-
var specialPropRefWarningShown;
|
|
502
|
-
var didWarnAboutStringRefs;
|
|
503
|
-
{
|
|
504
|
-
didWarnAboutStringRefs = {};
|
|
505
|
-
}
|
|
506
|
-
function hasValidRef(config) {
|
|
507
|
-
{
|
|
508
|
-
if (hasOwnProperty.call(config, "ref")) {
|
|
509
|
-
var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
|
|
510
|
-
if (getter && getter.isReactWarning) {
|
|
511
|
-
return false;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
return config.ref !== void 0;
|
|
516
|
-
}
|
|
517
|
-
function hasValidKey(config) {
|
|
518
|
-
{
|
|
519
|
-
if (hasOwnProperty.call(config, "key")) {
|
|
520
|
-
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
521
|
-
if (getter && getter.isReactWarning) {
|
|
522
|
-
return false;
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
return config.key !== void 0;
|
|
527
|
-
}
|
|
528
|
-
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
529
|
-
{
|
|
530
|
-
if (typeof config.ref === "string" && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
531
|
-
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
532
|
-
if (!didWarnAboutStringRefs[componentName]) {
|
|
533
|
-
error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
|
534
|
-
didWarnAboutStringRefs[componentName] = true;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
|
540
|
-
{
|
|
541
|
-
var warnAboutAccessingKey = function() {
|
|
542
|
-
if (!specialPropKeyWarningShown) {
|
|
543
|
-
specialPropKeyWarningShown = true;
|
|
544
|
-
error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
|
|
545
|
-
}
|
|
546
|
-
};
|
|
547
|
-
warnAboutAccessingKey.isReactWarning = true;
|
|
548
|
-
Object.defineProperty(props, "key", {
|
|
549
|
-
get: warnAboutAccessingKey,
|
|
550
|
-
configurable: true
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
function defineRefPropWarningGetter(props, displayName) {
|
|
555
|
-
{
|
|
556
|
-
var warnAboutAccessingRef = function() {
|
|
557
|
-
if (!specialPropRefWarningShown) {
|
|
558
|
-
specialPropRefWarningShown = true;
|
|
559
|
-
error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
|
|
560
|
-
}
|
|
561
|
-
};
|
|
562
|
-
warnAboutAccessingRef.isReactWarning = true;
|
|
563
|
-
Object.defineProperty(props, "ref", {
|
|
564
|
-
get: warnAboutAccessingRef,
|
|
565
|
-
configurable: true
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
var ReactElement = function(type, key, ref, self, source, owner, props) {
|
|
570
|
-
var element = {
|
|
571
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
572
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
573
|
-
// Built-in properties that belong on the element
|
|
574
|
-
type,
|
|
575
|
-
key,
|
|
576
|
-
ref,
|
|
577
|
-
props,
|
|
578
|
-
// Record the component responsible for creating this element.
|
|
579
|
-
_owner: owner
|
|
580
|
-
};
|
|
581
|
-
{
|
|
582
|
-
element._store = {};
|
|
583
|
-
Object.defineProperty(element._store, "validated", {
|
|
584
|
-
configurable: false,
|
|
585
|
-
enumerable: false,
|
|
586
|
-
writable: true,
|
|
587
|
-
value: false
|
|
588
|
-
});
|
|
589
|
-
Object.defineProperty(element, "_self", {
|
|
590
|
-
configurable: false,
|
|
591
|
-
enumerable: false,
|
|
592
|
-
writable: false,
|
|
593
|
-
value: self
|
|
594
|
-
});
|
|
595
|
-
Object.defineProperty(element, "_source", {
|
|
596
|
-
configurable: false,
|
|
597
|
-
enumerable: false,
|
|
598
|
-
writable: false,
|
|
599
|
-
value: source
|
|
600
|
-
});
|
|
601
|
-
if (Object.freeze) {
|
|
602
|
-
Object.freeze(element.props);
|
|
603
|
-
Object.freeze(element);
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
return element;
|
|
607
|
-
};
|
|
608
|
-
function jsxDEV(type, config, maybeKey, source, self) {
|
|
609
|
-
{
|
|
610
|
-
var propName;
|
|
611
|
-
var props = {};
|
|
612
|
-
var key = null;
|
|
613
|
-
var ref = null;
|
|
614
|
-
if (maybeKey !== void 0) {
|
|
615
|
-
{
|
|
616
|
-
checkKeyStringCoercion(maybeKey);
|
|
617
|
-
}
|
|
618
|
-
key = "" + maybeKey;
|
|
619
|
-
}
|
|
620
|
-
if (hasValidKey(config)) {
|
|
621
|
-
{
|
|
622
|
-
checkKeyStringCoercion(config.key);
|
|
623
|
-
}
|
|
624
|
-
key = "" + config.key;
|
|
625
|
-
}
|
|
626
|
-
if (hasValidRef(config)) {
|
|
627
|
-
ref = config.ref;
|
|
628
|
-
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
629
|
-
}
|
|
630
|
-
for (propName in config) {
|
|
631
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
632
|
-
props[propName] = config[propName];
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
if (type && type.defaultProps) {
|
|
636
|
-
var defaultProps = type.defaultProps;
|
|
637
|
-
for (propName in defaultProps) {
|
|
638
|
-
if (props[propName] === void 0) {
|
|
639
|
-
props[propName] = defaultProps[propName];
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
if (key || ref) {
|
|
644
|
-
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
|
645
|
-
if (key) {
|
|
646
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
647
|
-
}
|
|
648
|
-
if (ref) {
|
|
649
|
-
defineRefPropWarningGetter(props, displayName);
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
656
|
-
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
657
|
-
function setCurrentlyValidatingElement$1(element) {
|
|
658
|
-
{
|
|
659
|
-
if (element) {
|
|
660
|
-
var owner = element._owner;
|
|
661
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
662
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
663
|
-
} else {
|
|
664
|
-
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
var propTypesMisspellWarningShown;
|
|
669
|
-
{
|
|
670
|
-
propTypesMisspellWarningShown = false;
|
|
671
|
-
}
|
|
672
|
-
function isValidElement(object) {
|
|
673
|
-
{
|
|
674
|
-
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
function getDeclarationErrorAddendum() {
|
|
678
|
-
{
|
|
679
|
-
if (ReactCurrentOwner$1.current) {
|
|
680
|
-
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
681
|
-
if (name) {
|
|
682
|
-
return "\n\nCheck the render method of `" + name + "`.";
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
return "";
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
function getSourceInfoErrorAddendum(source) {
|
|
689
|
-
{
|
|
690
|
-
return "";
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
var ownerHasKeyUseWarning = {};
|
|
694
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
695
|
-
{
|
|
696
|
-
var info = getDeclarationErrorAddendum();
|
|
697
|
-
if (!info) {
|
|
698
|
-
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
|
699
|
-
if (parentName) {
|
|
700
|
-
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
return info;
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
function validateExplicitKey(element, parentType) {
|
|
707
|
-
{
|
|
708
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
709
|
-
return;
|
|
710
|
-
}
|
|
711
|
-
element._store.validated = true;
|
|
712
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
713
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
714
|
-
return;
|
|
715
|
-
}
|
|
716
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
717
|
-
var childOwner = "";
|
|
718
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
719
|
-
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
720
|
-
}
|
|
721
|
-
setCurrentlyValidatingElement$1(element);
|
|
722
|
-
error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
723
|
-
setCurrentlyValidatingElement$1(null);
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
function validateChildKeys(node, parentType) {
|
|
727
|
-
{
|
|
728
|
-
if (typeof node !== "object") {
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
if (isArray(node)) {
|
|
732
|
-
for (var i = 0; i < node.length; i++) {
|
|
733
|
-
var child = node[i];
|
|
734
|
-
if (isValidElement(child)) {
|
|
735
|
-
validateExplicitKey(child, parentType);
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
} else if (isValidElement(node)) {
|
|
739
|
-
if (node._store) {
|
|
740
|
-
node._store.validated = true;
|
|
741
|
-
}
|
|
742
|
-
} else if (node) {
|
|
743
|
-
var iteratorFn = getIteratorFn(node);
|
|
744
|
-
if (typeof iteratorFn === "function") {
|
|
745
|
-
if (iteratorFn !== node.entries) {
|
|
746
|
-
var iterator = iteratorFn.call(node);
|
|
747
|
-
var step;
|
|
748
|
-
while (!(step = iterator.next()).done) {
|
|
749
|
-
if (isValidElement(step.value)) {
|
|
750
|
-
validateExplicitKey(step.value, parentType);
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
function validatePropTypes(element) {
|
|
759
|
-
{
|
|
760
|
-
var type = element.type;
|
|
761
|
-
if (type === null || type === void 0 || typeof type === "string") {
|
|
762
|
-
return;
|
|
763
|
-
}
|
|
764
|
-
var propTypes;
|
|
765
|
-
if (typeof type === "function") {
|
|
766
|
-
propTypes = type.propTypes;
|
|
767
|
-
} else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
768
|
-
// Inner props are checked in the reconciler.
|
|
769
|
-
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
770
|
-
propTypes = type.propTypes;
|
|
771
|
-
} else {
|
|
772
|
-
return;
|
|
773
|
-
}
|
|
774
|
-
if (propTypes) {
|
|
775
|
-
var name = getComponentNameFromType(type);
|
|
776
|
-
checkPropTypes(propTypes, element.props, "prop", name, element);
|
|
777
|
-
} else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
|
|
778
|
-
propTypesMisspellWarningShown = true;
|
|
779
|
-
var _name = getComponentNameFromType(type);
|
|
780
|
-
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
|
|
781
|
-
}
|
|
782
|
-
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
|
|
783
|
-
error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
function validateFragmentProps(fragment) {
|
|
788
|
-
{
|
|
789
|
-
var keys = Object.keys(fragment.props);
|
|
790
|
-
for (var i = 0; i < keys.length; i++) {
|
|
791
|
-
var key = keys[i];
|
|
792
|
-
if (key !== "children" && key !== "key") {
|
|
793
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
794
|
-
error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
|
|
795
|
-
setCurrentlyValidatingElement$1(null);
|
|
796
|
-
break;
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
if (fragment.ref !== null) {
|
|
800
|
-
setCurrentlyValidatingElement$1(fragment);
|
|
801
|
-
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
|
802
|
-
setCurrentlyValidatingElement$1(null);
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
var didWarnAboutKeySpread = {};
|
|
807
|
-
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
808
|
-
{
|
|
809
|
-
var validType = isValidElementType(type);
|
|
810
|
-
if (!validType) {
|
|
811
|
-
var info = "";
|
|
812
|
-
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
|
|
813
|
-
info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
|
|
814
|
-
}
|
|
815
|
-
var sourceInfo = getSourceInfoErrorAddendum();
|
|
816
|
-
if (sourceInfo) {
|
|
817
|
-
info += sourceInfo;
|
|
818
|
-
} else {
|
|
819
|
-
info += getDeclarationErrorAddendum();
|
|
820
|
-
}
|
|
821
|
-
var typeString;
|
|
822
|
-
if (type === null) {
|
|
823
|
-
typeString = "null";
|
|
824
|
-
} else if (isArray(type)) {
|
|
825
|
-
typeString = "array";
|
|
826
|
-
} else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
827
|
-
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
|
828
|
-
info = " Did you accidentally export a JSX literal instead of a component?";
|
|
829
|
-
} else {
|
|
830
|
-
typeString = typeof type;
|
|
831
|
-
}
|
|
832
|
-
error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
|
|
833
|
-
}
|
|
834
|
-
var element = jsxDEV(type, props, key, source, self);
|
|
835
|
-
if (element == null) {
|
|
836
|
-
return element;
|
|
837
|
-
}
|
|
838
|
-
if (validType) {
|
|
839
|
-
var children = props.children;
|
|
840
|
-
if (children !== void 0) {
|
|
841
|
-
if (isStaticChildren) {
|
|
842
|
-
if (isArray(children)) {
|
|
843
|
-
for (var i = 0; i < children.length; i++) {
|
|
844
|
-
validateChildKeys(children[i], type);
|
|
845
|
-
}
|
|
846
|
-
if (Object.freeze) {
|
|
847
|
-
Object.freeze(children);
|
|
848
|
-
}
|
|
849
|
-
} else {
|
|
850
|
-
error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
851
|
-
}
|
|
852
|
-
} else {
|
|
853
|
-
validateChildKeys(children, type);
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
{
|
|
858
|
-
if (hasOwnProperty.call(props, "key")) {
|
|
859
|
-
var componentName = getComponentNameFromType(type);
|
|
860
|
-
var keys = Object.keys(props).filter(function(k) {
|
|
861
|
-
return k !== "key";
|
|
862
|
-
});
|
|
863
|
-
var beforeExample = keys.length > 0 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
864
|
-
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
865
|
-
var afterExample = keys.length > 0 ? "{" + keys.join(": ..., ") + ": ...}" : "{}";
|
|
866
|
-
error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
|
867
|
-
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
|
872
|
-
validateFragmentProps(element);
|
|
873
|
-
} else {
|
|
874
|
-
validatePropTypes(element);
|
|
875
|
-
}
|
|
876
|
-
return element;
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
function jsxWithValidationStatic(type, props, key) {
|
|
880
|
-
{
|
|
881
|
-
return jsxWithValidation(type, props, key, true);
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
function jsxWithValidationDynamic(type, props, key) {
|
|
885
|
-
{
|
|
886
|
-
return jsxWithValidation(type, props, key, false);
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
var jsx = jsxWithValidationDynamic;
|
|
890
|
-
var jsxs = jsxWithValidationStatic;
|
|
891
|
-
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
892
|
-
reactJsxRuntime_development.jsx = jsx;
|
|
893
|
-
reactJsxRuntime_development.jsxs = jsxs;
|
|
894
|
-
})();
|
|
895
|
-
}
|
|
896
|
-
return reactJsxRuntime_development;
|
|
1
|
+
import { offset as offset$1, shift as shift$1, flip as flip$1, inline as inline$1, computePosition as computePosition$1 } from "./react-text-annotator.es31.js";
|
|
2
|
+
import { createCoords, rectToClientRect, round, floor, max, min } from "./react-text-annotator.es30.js";
|
|
3
|
+
import { getOverflowAncestors, isElement, getWindow, getFrameElement, getComputedStyle, getDocumentElement, isHTMLElement, isWebKit, isTopLayer, getNodeName, isOverflowElement, getNodeScroll, getParentNode, isLastTraversableNode, isTableElement, isContainingBlock, getContainingBlock } from "./react-text-annotator.es28.js";
|
|
4
|
+
function getCssDimensions(element) {
|
|
5
|
+
const css = getComputedStyle(element);
|
|
6
|
+
let width = parseFloat(css.width) || 0;
|
|
7
|
+
let height = parseFloat(css.height) || 0;
|
|
8
|
+
const hasOffset = isHTMLElement(element);
|
|
9
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
10
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
11
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
12
|
+
if (shouldFallback) {
|
|
13
|
+
width = offsetWidth;
|
|
14
|
+
height = offsetHeight;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
width,
|
|
18
|
+
height,
|
|
19
|
+
$: shouldFallback
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function unwrapElement(element) {
|
|
23
|
+
return !isElement(element) ? element.contextElement : element;
|
|
24
|
+
}
|
|
25
|
+
function getScale(element) {
|
|
26
|
+
const domElement = unwrapElement(element);
|
|
27
|
+
if (!isHTMLElement(domElement)) {
|
|
28
|
+
return createCoords(1);
|
|
29
|
+
}
|
|
30
|
+
const rect = domElement.getBoundingClientRect();
|
|
31
|
+
const {
|
|
32
|
+
width,
|
|
33
|
+
height,
|
|
34
|
+
$
|
|
35
|
+
} = getCssDimensions(domElement);
|
|
36
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
37
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
38
|
+
if (!x || !Number.isFinite(x)) {
|
|
39
|
+
x = 1;
|
|
40
|
+
}
|
|
41
|
+
if (!y || !Number.isFinite(y)) {
|
|
42
|
+
y = 1;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
x,
|
|
46
|
+
y
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const noOffsets = /* @__PURE__ */ createCoords(0);
|
|
50
|
+
function getVisualOffsets(element) {
|
|
51
|
+
const win = getWindow(element);
|
|
52
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
53
|
+
return noOffsets;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
x: win.visualViewport.offsetLeft,
|
|
57
|
+
y: win.visualViewport.offsetTop
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
61
|
+
if (isFixed === void 0) {
|
|
62
|
+
isFixed = false;
|
|
63
|
+
}
|
|
64
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return isFixed;
|
|
68
|
+
}
|
|
69
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
70
|
+
if (includeScale === void 0) {
|
|
71
|
+
includeScale = false;
|
|
72
|
+
}
|
|
73
|
+
if (isFixedStrategy === void 0) {
|
|
74
|
+
isFixedStrategy = false;
|
|
75
|
+
}
|
|
76
|
+
const clientRect = element.getBoundingClientRect();
|
|
77
|
+
const domElement = unwrapElement(element);
|
|
78
|
+
let scale = createCoords(1);
|
|
79
|
+
if (includeScale) {
|
|
80
|
+
if (offsetParent) {
|
|
81
|
+
if (isElement(offsetParent)) {
|
|
82
|
+
scale = getScale(offsetParent);
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
scale = getScale(element);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
89
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
90
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
91
|
+
let width = clientRect.width / scale.x;
|
|
92
|
+
let height = clientRect.height / scale.y;
|
|
93
|
+
if (domElement) {
|
|
94
|
+
const win = getWindow(domElement);
|
|
95
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
96
|
+
let currentWin = win;
|
|
97
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
98
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
99
|
+
const iframeScale = getScale(currentIFrame);
|
|
100
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
101
|
+
const css = getComputedStyle(currentIFrame);
|
|
102
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
103
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
104
|
+
x *= iframeScale.x;
|
|
105
|
+
y *= iframeScale.y;
|
|
106
|
+
width *= iframeScale.x;
|
|
107
|
+
height *= iframeScale.y;
|
|
108
|
+
x += left;
|
|
109
|
+
y += top;
|
|
110
|
+
currentWin = getWindow(currentIFrame);
|
|
111
|
+
currentIFrame = getFrameElement(currentWin);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return rectToClientRect({
|
|
115
|
+
width,
|
|
116
|
+
height,
|
|
117
|
+
x,
|
|
118
|
+
y
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
122
|
+
let {
|
|
123
|
+
elements,
|
|
124
|
+
rect,
|
|
125
|
+
offsetParent,
|
|
126
|
+
strategy
|
|
127
|
+
} = _ref;
|
|
128
|
+
const isFixed = strategy === "fixed";
|
|
129
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
130
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
131
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
132
|
+
return rect;
|
|
133
|
+
}
|
|
134
|
+
let scroll = {
|
|
135
|
+
scrollLeft: 0,
|
|
136
|
+
scrollTop: 0
|
|
137
|
+
};
|
|
138
|
+
let scale = createCoords(1);
|
|
139
|
+
const offsets = createCoords(0);
|
|
140
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
141
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
142
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
143
|
+
scroll = getNodeScroll(offsetParent);
|
|
144
|
+
}
|
|
145
|
+
if (isHTMLElement(offsetParent)) {
|
|
146
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
147
|
+
scale = getScale(offsetParent);
|
|
148
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
149
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
width: rect.width * scale.x,
|
|
154
|
+
height: rect.height * scale.y,
|
|
155
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
156
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function getClientRects(element) {
|
|
160
|
+
return Array.from(element.getClientRects());
|
|
897
161
|
}
|
|
162
|
+
function getWindowScrollBarX(element) {
|
|
163
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
164
|
+
}
|
|
165
|
+
function getDocumentRect(element) {
|
|
166
|
+
const html = getDocumentElement(element);
|
|
167
|
+
const scroll = getNodeScroll(element);
|
|
168
|
+
const body = element.ownerDocument.body;
|
|
169
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
170
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
171
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
172
|
+
const y = -scroll.scrollTop;
|
|
173
|
+
if (getComputedStyle(body).direction === "rtl") {
|
|
174
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
width,
|
|
178
|
+
height,
|
|
179
|
+
x,
|
|
180
|
+
y
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function getViewportRect(element, strategy) {
|
|
184
|
+
const win = getWindow(element);
|
|
185
|
+
const html = getDocumentElement(element);
|
|
186
|
+
const visualViewport = win.visualViewport;
|
|
187
|
+
let width = html.clientWidth;
|
|
188
|
+
let height = html.clientHeight;
|
|
189
|
+
let x = 0;
|
|
190
|
+
let y = 0;
|
|
191
|
+
if (visualViewport) {
|
|
192
|
+
width = visualViewport.width;
|
|
193
|
+
height = visualViewport.height;
|
|
194
|
+
const visualViewportBased = isWebKit();
|
|
195
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
196
|
+
x = visualViewport.offsetLeft;
|
|
197
|
+
y = visualViewport.offsetTop;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
width,
|
|
202
|
+
height,
|
|
203
|
+
x,
|
|
204
|
+
y
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
208
|
+
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
209
|
+
const top = clientRect.top + element.clientTop;
|
|
210
|
+
const left = clientRect.left + element.clientLeft;
|
|
211
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
212
|
+
const width = element.clientWidth * scale.x;
|
|
213
|
+
const height = element.clientHeight * scale.y;
|
|
214
|
+
const x = left * scale.x;
|
|
215
|
+
const y = top * scale.y;
|
|
216
|
+
return {
|
|
217
|
+
width,
|
|
218
|
+
height,
|
|
219
|
+
x,
|
|
220
|
+
y
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
224
|
+
let rect;
|
|
225
|
+
if (clippingAncestor === "viewport") {
|
|
226
|
+
rect = getViewportRect(element, strategy);
|
|
227
|
+
} else if (clippingAncestor === "document") {
|
|
228
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
229
|
+
} else if (isElement(clippingAncestor)) {
|
|
230
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
231
|
+
} else {
|
|
232
|
+
const visualOffsets = getVisualOffsets(element);
|
|
233
|
+
rect = {
|
|
234
|
+
...clippingAncestor,
|
|
235
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
236
|
+
y: clippingAncestor.y - visualOffsets.y
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
return rectToClientRect(rect);
|
|
240
|
+
}
|
|
241
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
242
|
+
const parentNode = getParentNode(element);
|
|
243
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
return getComputedStyle(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
247
|
+
}
|
|
248
|
+
function getClippingElementAncestors(element, cache) {
|
|
249
|
+
const cachedResult = cache.get(element);
|
|
250
|
+
if (cachedResult) {
|
|
251
|
+
return cachedResult;
|
|
252
|
+
}
|
|
253
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
254
|
+
let currentContainingBlockComputedStyle = null;
|
|
255
|
+
const elementIsFixed = getComputedStyle(element).position === "fixed";
|
|
256
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
257
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
258
|
+
const computedStyle = getComputedStyle(currentNode);
|
|
259
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
260
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
261
|
+
currentContainingBlockComputedStyle = null;
|
|
262
|
+
}
|
|
263
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
264
|
+
if (shouldDropCurrentNode) {
|
|
265
|
+
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
266
|
+
} else {
|
|
267
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
268
|
+
}
|
|
269
|
+
currentNode = getParentNode(currentNode);
|
|
270
|
+
}
|
|
271
|
+
cache.set(element, result);
|
|
272
|
+
return result;
|
|
273
|
+
}
|
|
274
|
+
function getClippingRect(_ref) {
|
|
275
|
+
let {
|
|
276
|
+
element,
|
|
277
|
+
boundary,
|
|
278
|
+
rootBoundary,
|
|
279
|
+
strategy
|
|
280
|
+
} = _ref;
|
|
281
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
282
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
283
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
284
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
285
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
286
|
+
accRect.top = max(rect.top, accRect.top);
|
|
287
|
+
accRect.right = min(rect.right, accRect.right);
|
|
288
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
289
|
+
accRect.left = max(rect.left, accRect.left);
|
|
290
|
+
return accRect;
|
|
291
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
292
|
+
return {
|
|
293
|
+
width: clippingRect.right - clippingRect.left,
|
|
294
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
295
|
+
x: clippingRect.left,
|
|
296
|
+
y: clippingRect.top
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function getDimensions(element) {
|
|
300
|
+
const {
|
|
301
|
+
width,
|
|
302
|
+
height
|
|
303
|
+
} = getCssDimensions(element);
|
|
304
|
+
return {
|
|
305
|
+
width,
|
|
306
|
+
height
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
310
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
311
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
312
|
+
const isFixed = strategy === "fixed";
|
|
313
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
314
|
+
let scroll = {
|
|
315
|
+
scrollLeft: 0,
|
|
316
|
+
scrollTop: 0
|
|
317
|
+
};
|
|
318
|
+
const offsets = createCoords(0);
|
|
319
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
320
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
321
|
+
scroll = getNodeScroll(offsetParent);
|
|
322
|
+
}
|
|
323
|
+
if (isOffsetParentAnElement) {
|
|
324
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
325
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
326
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
327
|
+
} else if (documentElement) {
|
|
328
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
const x = rect.left + scroll.scrollLeft - offsets.x;
|
|
332
|
+
const y = rect.top + scroll.scrollTop - offsets.y;
|
|
333
|
+
return {
|
|
334
|
+
x,
|
|
335
|
+
y,
|
|
336
|
+
width: rect.width,
|
|
337
|
+
height: rect.height
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
function isStaticPositioned(element) {
|
|
341
|
+
return getComputedStyle(element).position === "static";
|
|
342
|
+
}
|
|
343
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
344
|
+
if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
if (polyfill) {
|
|
348
|
+
return polyfill(element);
|
|
349
|
+
}
|
|
350
|
+
return element.offsetParent;
|
|
351
|
+
}
|
|
352
|
+
function getOffsetParent(element, polyfill) {
|
|
353
|
+
const win = getWindow(element);
|
|
354
|
+
if (isTopLayer(element)) {
|
|
355
|
+
return win;
|
|
356
|
+
}
|
|
357
|
+
if (!isHTMLElement(element)) {
|
|
358
|
+
let svgOffsetParent = getParentNode(element);
|
|
359
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
360
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
361
|
+
return svgOffsetParent;
|
|
362
|
+
}
|
|
363
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
364
|
+
}
|
|
365
|
+
return win;
|
|
366
|
+
}
|
|
367
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
368
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
369
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
370
|
+
}
|
|
371
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
372
|
+
return win;
|
|
373
|
+
}
|
|
374
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
375
|
+
}
|
|
376
|
+
const getElementRects = async function(data) {
|
|
377
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
378
|
+
const getDimensionsFn = this.getDimensions;
|
|
379
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
380
|
+
return {
|
|
381
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
382
|
+
floating: {
|
|
383
|
+
x: 0,
|
|
384
|
+
y: 0,
|
|
385
|
+
width: floatingDimensions.width,
|
|
386
|
+
height: floatingDimensions.height
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
function isRTL(element) {
|
|
391
|
+
return getComputedStyle(element).direction === "rtl";
|
|
392
|
+
}
|
|
393
|
+
const platform = {
|
|
394
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
395
|
+
getDocumentElement,
|
|
396
|
+
getClippingRect,
|
|
397
|
+
getOffsetParent,
|
|
398
|
+
getElementRects,
|
|
399
|
+
getClientRects,
|
|
400
|
+
getDimensions,
|
|
401
|
+
getScale,
|
|
402
|
+
isElement,
|
|
403
|
+
isRTL
|
|
404
|
+
};
|
|
405
|
+
function observeMove(element, onMove) {
|
|
406
|
+
let io = null;
|
|
407
|
+
let timeoutId;
|
|
408
|
+
const root = getDocumentElement(element);
|
|
409
|
+
function cleanup() {
|
|
410
|
+
var _io;
|
|
411
|
+
clearTimeout(timeoutId);
|
|
412
|
+
(_io = io) == null || _io.disconnect();
|
|
413
|
+
io = null;
|
|
414
|
+
}
|
|
415
|
+
function refresh(skip, threshold) {
|
|
416
|
+
if (skip === void 0) {
|
|
417
|
+
skip = false;
|
|
418
|
+
}
|
|
419
|
+
if (threshold === void 0) {
|
|
420
|
+
threshold = 1;
|
|
421
|
+
}
|
|
422
|
+
cleanup();
|
|
423
|
+
const {
|
|
424
|
+
left,
|
|
425
|
+
top,
|
|
426
|
+
width,
|
|
427
|
+
height
|
|
428
|
+
} = element.getBoundingClientRect();
|
|
429
|
+
if (!skip) {
|
|
430
|
+
onMove();
|
|
431
|
+
}
|
|
432
|
+
if (!width || !height) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
const insetTop = floor(top);
|
|
436
|
+
const insetRight = floor(root.clientWidth - (left + width));
|
|
437
|
+
const insetBottom = floor(root.clientHeight - (top + height));
|
|
438
|
+
const insetLeft = floor(left);
|
|
439
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
440
|
+
const options = {
|
|
441
|
+
rootMargin,
|
|
442
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
443
|
+
};
|
|
444
|
+
let isFirstUpdate = true;
|
|
445
|
+
function handleObserve(entries) {
|
|
446
|
+
const ratio = entries[0].intersectionRatio;
|
|
447
|
+
if (ratio !== threshold) {
|
|
448
|
+
if (!isFirstUpdate) {
|
|
449
|
+
return refresh();
|
|
450
|
+
}
|
|
451
|
+
if (!ratio) {
|
|
452
|
+
timeoutId = setTimeout(() => {
|
|
453
|
+
refresh(false, 1e-7);
|
|
454
|
+
}, 1e3);
|
|
455
|
+
} else {
|
|
456
|
+
refresh(false, ratio);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
isFirstUpdate = false;
|
|
460
|
+
}
|
|
461
|
+
try {
|
|
462
|
+
io = new IntersectionObserver(handleObserve, {
|
|
463
|
+
...options,
|
|
464
|
+
// Handle <iframe>s
|
|
465
|
+
root: root.ownerDocument
|
|
466
|
+
});
|
|
467
|
+
} catch (e) {
|
|
468
|
+
io = new IntersectionObserver(handleObserve, options);
|
|
469
|
+
}
|
|
470
|
+
io.observe(element);
|
|
471
|
+
}
|
|
472
|
+
refresh(true);
|
|
473
|
+
return cleanup;
|
|
474
|
+
}
|
|
475
|
+
function autoUpdate(reference, floating, update, options) {
|
|
476
|
+
if (options === void 0) {
|
|
477
|
+
options = {};
|
|
478
|
+
}
|
|
479
|
+
const {
|
|
480
|
+
ancestorScroll = true,
|
|
481
|
+
ancestorResize = true,
|
|
482
|
+
elementResize = typeof ResizeObserver === "function",
|
|
483
|
+
layoutShift = typeof IntersectionObserver === "function",
|
|
484
|
+
animationFrame = false
|
|
485
|
+
} = options;
|
|
486
|
+
const referenceEl = unwrapElement(reference);
|
|
487
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
|
|
488
|
+
ancestors.forEach((ancestor) => {
|
|
489
|
+
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
490
|
+
passive: true
|
|
491
|
+
});
|
|
492
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
|
493
|
+
});
|
|
494
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
495
|
+
let reobserveFrame = -1;
|
|
496
|
+
let resizeObserver = null;
|
|
497
|
+
if (elementResize) {
|
|
498
|
+
resizeObserver = new ResizeObserver((_ref) => {
|
|
499
|
+
let [firstEntry] = _ref;
|
|
500
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
501
|
+
resizeObserver.unobserve(floating);
|
|
502
|
+
cancelAnimationFrame(reobserveFrame);
|
|
503
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
504
|
+
var _resizeObserver;
|
|
505
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
update();
|
|
509
|
+
});
|
|
510
|
+
if (referenceEl && !animationFrame) {
|
|
511
|
+
resizeObserver.observe(referenceEl);
|
|
512
|
+
}
|
|
513
|
+
resizeObserver.observe(floating);
|
|
514
|
+
}
|
|
515
|
+
let frameId;
|
|
516
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
517
|
+
if (animationFrame) {
|
|
518
|
+
frameLoop();
|
|
519
|
+
}
|
|
520
|
+
function frameLoop() {
|
|
521
|
+
const nextRefRect = getBoundingClientRect(reference);
|
|
522
|
+
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
|
523
|
+
update();
|
|
524
|
+
}
|
|
525
|
+
prevRefRect = nextRefRect;
|
|
526
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
527
|
+
}
|
|
528
|
+
update();
|
|
529
|
+
return () => {
|
|
530
|
+
var _resizeObserver2;
|
|
531
|
+
ancestors.forEach((ancestor) => {
|
|
532
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
533
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
534
|
+
});
|
|
535
|
+
cleanupIo == null || cleanupIo();
|
|
536
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
537
|
+
resizeObserver = null;
|
|
538
|
+
if (animationFrame) {
|
|
539
|
+
cancelAnimationFrame(frameId);
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
const offset = offset$1;
|
|
544
|
+
const shift = shift$1;
|
|
545
|
+
const flip = flip$1;
|
|
546
|
+
const inline = inline$1;
|
|
547
|
+
const computePosition = (reference, floating, options) => {
|
|
548
|
+
const cache = /* @__PURE__ */ new Map();
|
|
549
|
+
const mergedOptions = {
|
|
550
|
+
platform,
|
|
551
|
+
...options
|
|
552
|
+
};
|
|
553
|
+
const platformWithCache = {
|
|
554
|
+
...mergedOptions.platform,
|
|
555
|
+
_c: cache
|
|
556
|
+
};
|
|
557
|
+
return computePosition$1(reference, floating, {
|
|
558
|
+
...mergedOptions,
|
|
559
|
+
platform: platformWithCache
|
|
560
|
+
});
|
|
561
|
+
};
|
|
898
562
|
export {
|
|
899
|
-
|
|
563
|
+
autoUpdate,
|
|
564
|
+
computePosition,
|
|
565
|
+
flip,
|
|
566
|
+
getOverflowAncestors,
|
|
567
|
+
inline,
|
|
568
|
+
offset,
|
|
569
|
+
platform,
|
|
570
|
+
shift
|
|
900
571
|
};
|
|
901
572
|
//# sourceMappingURL=react-text-annotator.es17.js.map
|