@panneau/core 4.1.1 → 5.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +83 -0
  2. package/dist/definition/abilities.d.ts +21 -0
  3. package/dist/definition/abilities.d.ts.map +1 -0
  4. package/dist/definition/abilities.js +47 -0
  5. package/dist/definition/abilities.js.map +1 -0
  6. package/dist/definition/form.d.ts +31 -0
  7. package/dist/definition/form.d.ts.map +1 -0
  8. package/dist/definition/form.js +54 -0
  9. package/dist/definition/form.js.map +1 -0
  10. package/dist/definition/list.d.ts +44 -0
  11. package/dist/definition/list.d.ts.map +1 -0
  12. package/dist/definition/list.js +70 -0
  13. package/dist/definition/list.js.map +1 -0
  14. package/dist/definition/resource.d.ts +21 -0
  15. package/dist/definition/resource.d.ts.map +1 -0
  16. package/dist/definition/resource.js +24 -0
  17. package/dist/definition/resource.js.map +1 -0
  18. package/dist/form/form.d.ts +148 -0
  19. package/dist/form/form.d.ts.map +1 -0
  20. package/dist/form/form.js +239 -0
  21. package/dist/form/form.js.map +1 -0
  22. package/dist/form/messages.d.ts +7 -0
  23. package/dist/form/messages.d.ts.map +1 -0
  24. package/dist/form/messages.js +25 -0
  25. package/dist/form/messages.js.map +1 -0
  26. package/dist/form/problem.d.ts +16 -0
  27. package/dist/form/problem.d.ts.map +1 -0
  28. package/dist/form/problem.js +34 -0
  29. package/dist/form/problem.js.map +1 -0
  30. package/dist/form/selectors.d.ts +16 -0
  31. package/dist/form/selectors.d.ts.map +1 -0
  32. package/dist/form/selectors.js +27 -0
  33. package/dist/form/selectors.js.map +1 -0
  34. package/dist/form/store.d.ts +19 -0
  35. package/dist/form/store.d.ts.map +1 -0
  36. package/dist/form/store.js +29 -0
  37. package/dist/form/store.js.map +1 -0
  38. package/dist/index.d.ts +17 -692
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +17 -536
  41. package/dist/list/list.d.ts +68 -0
  42. package/dist/list/list.d.ts.map +1 -0
  43. package/dist/list/list.js +191 -0
  44. package/dist/list/list.js.map +1 -0
  45. package/dist/list/router.d.ts +26 -0
  46. package/dist/list/router.d.ts.map +1 -0
  47. package/dist/list/router.js +54 -0
  48. package/dist/list/router.js.map +1 -0
  49. package/dist/plugins.d.ts +73 -0
  50. package/dist/plugins.d.ts.map +1 -0
  51. package/dist/plugins.js +54 -0
  52. package/dist/plugins.js.map +1 -0
  53. package/dist/react/provider.d.ts +38 -0
  54. package/dist/react/provider.d.ts.map +1 -0
  55. package/dist/react/provider.js +63 -0
  56. package/dist/react/provider.js.map +1 -0
  57. package/dist/react/useForm.d.ts +26 -0
  58. package/dist/react/useForm.d.ts.map +1 -0
  59. package/dist/react/useForm.js +115 -0
  60. package/dist/react/useForm.js.map +1 -0
  61. package/dist/react/useList.d.ts +11 -0
  62. package/dist/react/useList.d.ts.map +1 -0
  63. package/dist/react/useList.js +47 -0
  64. package/dist/react/useList.js.map +1 -0
  65. package/dist/values.d.ts +12 -0
  66. package/dist/values.d.ts.map +1 -0
  67. package/dist/values.js +44 -0
  68. package/dist/values.js.map +1 -0
  69. package/package.json +19 -81
  70. package/dist/contexts.d.ts +0 -667
  71. package/dist/contexts.js +0 -1772
  72. package/dist/hooks.d.ts +0 -512
  73. package/dist/hooks.js +0 -2146
  74. package/dist/utils.d.ts +0 -457
  75. package/dist/utils.js +0 -557
package/dist/hooks.js DELETED
@@ -1,2146 +0,0 @@
1
- import { c } from 'react/compiler-runtime';
2
- import { useRef, useEffect, useState } from 'react';
3
- import { EventsManager, MediasParser } from '@panneau/core';
4
- import { createUseEvent, loadPackage } from '@panneau/core/utils';
5
- import { getCsrfToken, postJSON, getCSRFHeaders } from '@folklore/fetch';
6
- import get from 'lodash-es/get';
7
- import isArray from 'lodash-es/isArray';
8
- import isObject from 'lodash-es/isObject';
9
- import isString from 'lodash-es/isString';
10
- import { useFieldsManager, usePanneauResources, useResource, useUrlGenerator, useRoutes } from '@panneau/core/contexts';
11
- import isEqual from 'lodash-es/isEqual';
12
- import dayjs from 'dayjs';
13
- import { useIntl } from 'react-intl';
14
- import { match } from 'css-mediaquery';
15
-
16
- function useAnimationFrame(onFrame, t0) {
17
- const $ = c(8);
18
- let t1;
19
- if ($[0] !== t0) {
20
- t1 = t0 === undefined ? {} : t0;
21
- $[0] = t0;
22
- $[1] = t1;
23
- } else {
24
- t1 = $[1];
25
- }
26
- const {
27
- disabled: t2
28
- } = t1;
29
- const disabled = t2 === undefined ? false : t2;
30
- const requestRef = useRef(null);
31
- const startTimeRef = useRef(null);
32
- const onFrameRef = useRef(onFrame);
33
- let t3;
34
- let t4;
35
- if ($[2] !== onFrame) {
36
- t3 = () => {
37
- onFrameRef.current = onFrame;
38
- };
39
- t4 = [onFrame];
40
- $[2] = onFrame;
41
- $[3] = t3;
42
- $[4] = t4;
43
- } else {
44
- t3 = $[3];
45
- t4 = $[4];
46
- }
47
- useEffect(t3, t4);
48
- let t5;
49
- let t6;
50
- if ($[5] !== disabled) {
51
- t5 = () => {
52
- if (disabled) {
53
- return _temp$2;
54
- }
55
- startTimeRef.current = null;
56
- const callback = time => {
57
- if (startTimeRef.current === null) {
58
- startTimeRef.current = time;
59
- }
60
- const progress = time - startTimeRef.current;
61
- onFrameRef.current(progress);
62
- requestRef.current = requestAnimationFrame(callback);
63
- };
64
- requestRef.current = requestAnimationFrame(callback);
65
- return () => {
66
- if (requestRef.current !== null) {
67
- cancelAnimationFrame(requestRef.current);
68
- requestRef.current = null;
69
- }
70
- };
71
- };
72
- t6 = [disabled];
73
- $[5] = disabled;
74
- $[6] = t5;
75
- $[7] = t6;
76
- } else {
77
- t5 = $[6];
78
- t6 = $[7];
79
- }
80
- useEffect(t5, t6);
81
- }
82
- function _temp$2() {}
83
-
84
- function useFormattedDate(t0) {
85
- const $ = c(7);
86
- let t1;
87
- if ($[0] !== t0) {
88
- t1 = t0 === undefined ? {} : t0;
89
- $[0] = t0;
90
- $[1] = t1;
91
- } else {
92
- t1 = $[1];
93
- }
94
- const {
95
- format: t2,
96
- showToday: t3
97
- } = t1;
98
- const format = t2 === undefined ? null : t2;
99
- const showToday = t3 === undefined ? true : t3;
100
- const intl = useIntl();
101
- let t4;
102
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
103
- t4 = dayjs();
104
- $[2] = t4;
105
- } else {
106
- t4 = $[2];
107
- }
108
- const today = t4;
109
- let t5;
110
- if ($[3] !== format || $[4] !== intl || $[5] !== showToday) {
111
- t5 = date => {
112
- const dateToFormat = dayjs(date);
113
- if (showToday && dateToFormat.format("YYYY-MM-DD") === today.format("YYYY-MM-DD")) {
114
- return intl.formatMessage({
115
- id: "v4Qtl9"
116
- });
117
- }
118
- return intl.formatDate(dateToFormat.toDate(), {
119
- year: "numeric",
120
- month: "long",
121
- day: "2-digit",
122
- ...format
123
- });
124
- };
125
- $[3] = format;
126
- $[4] = intl;
127
- $[5] = showToday;
128
- $[6] = t5;
129
- } else {
130
- t5 = $[6];
131
- }
132
- return t5;
133
- }
134
- function useFormattedTime(t0) {
135
- const $ = c(8);
136
- let t1;
137
- if ($[0] !== t0) {
138
- t1 = t0 === undefined ? {} : t0;
139
- $[0] = t0;
140
- $[1] = t1;
141
- } else {
142
- t1 = $[1];
143
- }
144
- const {
145
- format: t2,
146
- showNow: t3,
147
- timeGap: t4
148
- } = t1;
149
- const format = t2 === undefined ? null : t2;
150
- const showNow = t3 === undefined ? true : t3;
151
- const timeGap = t4 === undefined ? 2 : t4;
152
- const intl = useIntl();
153
- let t5;
154
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
155
- t5 = dayjs();
156
- $[2] = t5;
157
- } else {
158
- t5 = $[2];
159
- }
160
- const now = t5;
161
- let t6;
162
- if ($[3] !== format || $[4] !== intl || $[5] !== showNow || $[6] !== timeGap) {
163
- t6 = date => {
164
- const dateToFormat = dayjs(date);
165
- if (showNow && dateToFormat.format("YYYY-MM-DD") === now.format("YYYY-MM-DD") && dateToFormat.hour() === now.hour() && dateToFormat.minute() > now.minute() - timeGap && dateToFormat.minute() < now.minute() + timeGap) {
166
- return intl.formatMessage({
167
- id: "3na7F8"
168
- });
169
- }
170
- return intl.formatTime(dateToFormat.toDate(), {
171
- hour: "numeric",
172
- minute: "numeric",
173
- ...format
174
- });
175
- };
176
- $[3] = format;
177
- $[4] = intl;
178
- $[5] = showNow;
179
- $[6] = timeGap;
180
- $[7] = t6;
181
- } else {
182
- t6 = $[7];
183
- }
184
- return t6;
185
- }
186
-
187
- const eventsManager$1 = typeof document !== 'undefined' ? new EventsManager(document) : null;
188
- const useDocumentEvent = createUseEvent(eventsManager$1);
189
-
190
- // prettier-ignore
191
- function getFieldsPropsFromFields(fields, {
192
- value,
193
- errors,
194
- onChange,
195
- ...props
196
- }, locales = []) {
197
- return (fields || []).reduce((allFields, field) => {
198
- const {
199
- name = isString(field) ? field : null,
200
- fields: fieldFields = null,
201
- component = null
202
- } = isObject(field) ? field : {};
203
- const fieldErrors = errors !== null ? errors[name] || [] : [];
204
- const finalErrors = component === 'localized' ? (locales || []).reduce((previousErrors, locale) => {
205
- const items = errors !== null ? get(errors, `${name}.${locale}`, []) || [] : [];
206
- const finalItems = isArray(items) ? items : [items];
207
- const finalPrevious = isArray(previousErrors) ? previousErrors : [];
208
- return [...finalPrevious, ...finalItems];
209
- }, fieldErrors) : fieldErrors;
210
- let subfieldErrors = errors;
211
- if (errors !== null && name !== null) {
212
- subfieldErrors = Object.keys(errors).reduce((acc, key) => {
213
- if (key === name) {
214
- acc[key] = errors[key];
215
- }
216
- if (key.startsWith(`${name}.`) || key.startsWith(`${name}[`)) {
217
- const finalKey = key.substring(name.length + 1);
218
- acc[finalKey] = errors[key];
219
- }
220
- return acc;
221
- }, {});
222
- }
223
- return [...allFields, {
224
- ...(isObject(field) ? field : null),
225
- name,
226
- component,
227
- value: value !== null && name !== null ? value[name] ?? null : null,
228
- errors: finalErrors.length > 0 ? finalErrors : null,
229
- onChange: fieldValue => onChange(name, fieldValue),
230
- fields: fieldFields !== null && isArray(fieldFields) ? getFieldsPropsFromFields(fieldFields, {
231
- value: value !== null && name !== null && isObject(value[name]) ? value[name] : null,
232
- errors: subfieldErrors,
233
- onChange
234
- }, locales) : null,
235
- ...props
236
- }];
237
- }, []);
238
- }
239
- function useForm(t0) {
240
- const $ = c(51);
241
- let t1;
242
- if ($[0] !== t0) {
243
- t1 = t0 === undefined ? {} : t0;
244
- $[0] = t0;
245
- $[1] = t1;
246
- } else {
247
- t1 = $[1];
248
- }
249
- const opts = t1;
250
- const {
251
- fields: t2,
252
- action: t3,
253
- postForm: t4,
254
- initialErrors: t5,
255
- errors: t6,
256
- setErrors: t7,
257
- initialGeneralError: t8,
258
- generalError: t9,
259
- setGeneralError: t10,
260
- initialValue: t11,
261
- value: t12,
262
- setValue: t13,
263
- withoutDefault: t14,
264
- withoutPropagation: t15,
265
- onComplete: t16,
266
- onError: t17,
267
- locales: t18
268
- } = opts;
269
- let t19;
270
- if ($[2] !== t2) {
271
- t19 = t2 === undefined ? [] : t2;
272
- $[2] = t2;
273
- $[3] = t19;
274
- } else {
275
- t19 = $[3];
276
- }
277
- const fields = t19;
278
- const action = t3 === undefined ? null : t3;
279
- const postForm = t4 === undefined ? null : t4;
280
- const initialErrors = t5 === undefined ? null : t5;
281
- const providedErrors = t6 === undefined ? null : t6;
282
- const setProvidedErrors = t7 === undefined ? null : t7;
283
- const initialGeneralError = t8 === undefined ? null : t8;
284
- const providedGeneralError = t9 === undefined ? null : t9;
285
- const setProvidedGeneralError = t10 === undefined ? null : t10;
286
- const initialValue = t11 === undefined ? null : t11;
287
- const providedValue = t12 === undefined ? null : t12;
288
- const setProvidedValue = t13 === undefined ? null : t13;
289
- const withoutDefault = t14 === undefined ? true : t14;
290
- const withoutPropagation = t15 === undefined ? true : t15;
291
- const onComplete = t16 === undefined ? null : t16;
292
- const onError = t17 === undefined ? null : t17;
293
- let t20;
294
- if ($[4] !== t18) {
295
- t20 = t18 === undefined ? [] : t18;
296
- $[4] = t18;
297
- $[5] = t20;
298
- } else {
299
- t20 = $[5];
300
- }
301
- const locales = t20;
302
- const [stateValue, setStateValue] = useState(initialValue || providedValue);
303
- const [stateErrors, setStateErrors] = useState(initialErrors || providedErrors);
304
- const [stateGeneralError, setStateGeneralError] = useState(initialGeneralError || providedGeneralError);
305
- let t21;
306
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
307
- t21 = {
308
- success: false,
309
- loading: false,
310
- error: false
311
- };
312
- $[6] = t21;
313
- } else {
314
- t21 = $[6];
315
- }
316
- const [requestState, setRequestState] = useState(t21);
317
- const [response, setResponse] = useState(null);
318
- const hasProvidedValue = setProvidedValue !== null;
319
- const value = hasProvidedValue ? providedValue : stateValue;
320
- const setValue = hasProvidedValue ? setProvidedValue : setStateValue;
321
- const hasProvidedErrors = setProvidedErrors !== null;
322
- const errors = hasProvidedErrors ? providedErrors : stateErrors;
323
- const setErrors = hasProvidedErrors ? setProvidedErrors : setStateErrors;
324
- const hasProvidedGeneralError = setProvidedGeneralError !== null;
325
- const generalError = hasProvidedGeneralError ? providedGeneralError : stateGeneralError;
326
- const setGeneralError = hasProvidedGeneralError ? setProvidedGeneralError : setStateGeneralError;
327
- let t22;
328
- if ($[7] !== errors || $[8] !== requestState || $[9] !== setErrors || $[10] !== setValue || $[11] !== value) {
329
- t22 = (fieldName, fieldValue) => {
330
- const {
331
- loading: t23,
332
- success: t24,
333
- error: t25
334
- } = requestState || {};
335
- const loading = t23 === undefined ? false : t23;
336
- const success = t24 === undefined ? false : t24;
337
- const requestError = t25 === undefined ? false : t25;
338
- const fieldErrors = errors !== null ? errors[fieldName] || null : null;
339
- if (fieldErrors !== null) {
340
- setErrors({
341
- ...errors,
342
- [fieldName]: null
343
- });
344
- }
345
- if (!loading && (success !== false || requestError !== false)) {
346
- setRequestState({
347
- success: false,
348
- loading: false,
349
- error: false
350
- });
351
- }
352
- setValue({
353
- ...(value || {}),
354
- [fieldName]: fieldValue
355
- });
356
- };
357
- $[7] = errors;
358
- $[8] = requestState;
359
- $[9] = setErrors;
360
- $[10] = setValue;
361
- $[11] = value;
362
- $[12] = t22;
363
- } else {
364
- t22 = $[12];
365
- }
366
- const onFieldChange = t22;
367
- let t23;
368
- if ($[13] !== errors || $[14] !== fields || $[15] !== locales || $[16] !== onFieldChange || $[17] !== value) {
369
- t23 = getFieldsPropsFromFields(fields, {
370
- value,
371
- errors,
372
- onChange: onFieldChange
373
- }, locales);
374
- $[13] = errors;
375
- $[14] = fields;
376
- $[15] = locales;
377
- $[16] = onFieldChange;
378
- $[17] = value;
379
- $[18] = t23;
380
- } else {
381
- t23 = $[18];
382
- }
383
- const fieldsProps = t23;
384
- let t24;
385
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
386
- t24 = getCsrfToken();
387
- $[19] = t24;
388
- } else {
389
- t24 = $[19];
390
- }
391
- const csrfToken = t24;
392
- let t25;
393
- if ($[20] !== onError || $[21] !== setErrors || $[22] !== setGeneralError) {
394
- t25 = error => {
395
- setRequestState({
396
- success: false,
397
- loading: false,
398
- error: true
399
- });
400
- if (error.name === "ValidationError") {
401
- const {
402
- errors: t26
403
- } = error.getResponseData();
404
- const validationErrors = t26 === undefined ? null : t26;
405
- setErrors(validationErrors || null);
406
- } else {
407
- setGeneralError(error.message);
408
- }
409
- if (onError !== null) {
410
- onError(error);
411
- }
412
- };
413
- $[20] = onError;
414
- $[21] = setErrors;
415
- $[22] = setGeneralError;
416
- $[23] = t25;
417
- } else {
418
- t25 = $[23];
419
- }
420
- const onSubmitError = t25;
421
- let t26;
422
- if ($[24] !== onComplete) {
423
- t26 = resp => {
424
- setRequestState({
425
- success: true,
426
- loading: false,
427
- error: false
428
- });
429
- setResponse(resp);
430
- if (onComplete !== null) {
431
- onComplete(resp);
432
- }
433
- };
434
- $[24] = onComplete;
435
- $[25] = t26;
436
- } else {
437
- t26 = $[25];
438
- }
439
- const onSubmitSuccess = t26;
440
- let t27;
441
- if ($[26] !== postForm) {
442
- t27 = (postAction, postData) => postForm !== null ? postForm(postAction, postData) : postJSON(postAction, postData, {
443
- credentials: "include",
444
- headers: getCSRFHeaders()
445
- });
446
- $[26] = postForm;
447
- $[27] = t27;
448
- } else {
449
- t27 = $[27];
450
- }
451
- const finalPostForm = t27;
452
- let t28;
453
- if ($[28] !== action || $[29] !== finalPostForm || $[30] !== onSubmitError || $[31] !== onSubmitSuccess || $[32] !== setErrors || $[33] !== setGeneralError || $[34] !== value) {
454
- t28 = t29 => {
455
- const submitValue = t29 === undefined ? value : t29;
456
- setRequestState({
457
- success: false,
458
- loading: true,
459
- error: false
460
- });
461
- setGeneralError(null);
462
- setErrors(null);
463
- finalPostForm(action, {
464
- ...(submitValue || {}),
465
- _token: csrfToken
466
- }).then(onSubmitSuccess).catch(onSubmitError);
467
- };
468
- $[28] = action;
469
- $[29] = finalPostForm;
470
- $[30] = onSubmitError;
471
- $[31] = onSubmitSuccess;
472
- $[32] = setErrors;
473
- $[33] = setGeneralError;
474
- $[34] = value;
475
- $[35] = t28;
476
- } else {
477
- t28 = $[35];
478
- }
479
- const submit = t28;
480
- let t29;
481
- if ($[36] !== submit || $[37] !== withoutDefault || $[38] !== withoutPropagation) {
482
- t29 = e => {
483
- if (withoutDefault) {
484
- e.preventDefault();
485
- }
486
- if (withoutPropagation) {
487
- e.stopPropagation();
488
- }
489
- submit();
490
- };
491
- $[36] = submit;
492
- $[37] = withoutDefault;
493
- $[38] = withoutPropagation;
494
- $[39] = t29;
495
- } else {
496
- t29 = $[39];
497
- }
498
- const onSubmit = t29;
499
- let status = null;
500
- if (requestState.loading) {
501
- status = "loading";
502
- } else {
503
- if (requestState.success) {
504
- status = "success";
505
- } else {
506
- if (requestState.error) {
507
- status = "error";
508
- }
509
- }
510
- }
511
- let t30;
512
- if ($[40] !== errors || $[41] !== fieldsProps || $[42] !== generalError || $[43] !== onSubmit || $[44] !== requestState || $[45] !== response || $[46] !== setValue || $[47] !== status || $[48] !== submit || $[49] !== value) {
513
- t30 = {
514
- value,
515
- setValue,
516
- csrfToken,
517
- submit,
518
- onSubmit,
519
- ...requestState,
520
- status,
521
- response,
522
- fields: fieldsProps,
523
- errors,
524
- generalError
525
- };
526
- $[40] = errors;
527
- $[41] = fieldsProps;
528
- $[42] = generalError;
529
- $[43] = onSubmit;
530
- $[44] = requestState;
531
- $[45] = response;
532
- $[46] = setValue;
533
- $[47] = status;
534
- $[48] = submit;
535
- $[49] = value;
536
- $[50] = t30;
537
- } else {
538
- t30 = $[50];
539
- }
540
- return t30;
541
- }
542
-
543
- function buildThresholdArray() {
544
- return [0, 1.0];
545
- }
546
- const observersCache = new Map();
547
-
548
- // Give each root element a unique id so observers with different roots are not shared
549
- const rootIds = new WeakMap();
550
- let lastRootId = 0;
551
- function getRootId(root) {
552
- if (!rootIds.has(root)) {
553
- lastRootId += 1;
554
- rootIds.set(root, lastRootId);
555
- }
556
- return rootIds.get(root);
557
- }
558
- function getOptionsKey({
559
- root = null,
560
- rootMargin,
561
- threshold = null
562
- }) {
563
- const rootKey = root !== null ? getRootId(root) : null;
564
- return `root_${rootKey}_rootMargin_${rootMargin || null}_threshold_${threshold}`;
565
- }
566
- function createObserver(Observer, options = {}) {
567
- let subscribers = [];
568
- const addSubscriber = (element, callback) => {
569
- const currentSubscriber = subscribers.find(it => it.element === element) || null;
570
- if (currentSubscriber !== null) {
571
- return subscribers.map(it => it.element === element && it.callbacks.indexOf(callback) === -1 ? {
572
- ...it,
573
- callbacks: [...it.callbacks, callback]
574
- } : it).filter(it => it.callbacks.length > 0);
575
- }
576
- return [...subscribers, {
577
- element,
578
- callbacks: [callback]
579
- }];
580
- };
581
- const removeSubscriber = (element, callback) => subscribers.map(it => it.element === element ? {
582
- ...it,
583
- callbacks: it.callbacks.filter(subCallback => subCallback !== callback)
584
- } : it).filter(it => it.callbacks.length > 0);
585
- const onUpdate = entries => {
586
- entries.forEach(entry => {
587
- subscribers.forEach(({
588
- element,
589
- callbacks
590
- }) => {
591
- if (element === entry.target) {
592
- callbacks.forEach(callback => {
593
- callback(entry);
594
- });
595
- }
596
- });
597
- });
598
- };
599
- const observer = new Observer(onUpdate, options);
600
- const unsubscribe = (element, callback = null) => {
601
- subscribers = removeSubscriber(element, callback);
602
- if (typeof observer.unobserve === 'undefined') {
603
- observer.disconnect();
604
- subscribers.forEach(subscriber => {
605
- observer.observe(subscriber.element);
606
- });
607
- return;
608
- }
609
- const currentSubscriber = subscribers.find(it => it.element === element) || null;
610
- if (currentSubscriber === null) {
611
- observer.unobserve(element);
612
- }
613
- };
614
- const subscribe = (element, callback) => {
615
- const currentSubscriber = subscribers.find(it => it.element === element) || null;
616
- subscribers = addSubscriber(element, callback);
617
- if (currentSubscriber === null) {
618
- observer.observe(element);
619
- }
620
- };
621
- return {
622
- subscribe,
623
- unsubscribe,
624
- observer
625
- };
626
- }
627
- function getObserver(Observer, options = {}) {
628
- if (Observer === null) {
629
- throw new Error('Observer constructor is null');
630
- }
631
- const observerKey = getOptionsKey(options);
632
- if (!observersCache.has(Observer)) {
633
- observersCache.set(Observer, {});
634
- }
635
- const observers = observersCache.get(Observer);
636
- if (typeof observers[observerKey] === 'undefined') {
637
- observers[observerKey] = createObserver(Observer, options);
638
- observersCache.set(Observer, observers);
639
- }
640
- return observers[observerKey];
641
- }
642
- function useObserver(Observer, t0, t1) {
643
- const $ = c(14);
644
- let t2;
645
- if ($[0] !== t0) {
646
- t2 = t0 === undefined ? {} : t0;
647
- $[0] = t0;
648
- $[1] = t2;
649
- } else {
650
- t2 = $[1];
651
- }
652
- const opts = t2;
653
- let t3;
654
- if ($[2] !== t1) {
655
- t3 = t1 === undefined ? {} : t1;
656
- $[2] = t1;
657
- $[3] = t3;
658
- } else {
659
- t3 = $[3];
660
- }
661
- const initialEntry = t3;
662
- const {
663
- root: t4,
664
- rootMargin: t5,
665
- threshold: t6,
666
- disabled: t7
667
- } = opts;
668
- const root = t4 === undefined ? null : t4;
669
- const rootMargin = t5 === undefined ? null : t5;
670
- const threshold = t6 === undefined ? null : t6;
671
- const disabled = t7 === undefined ? false : t7;
672
- const [entry, setEntry] = useState(initialEntry);
673
- const nodeRef = useRef(null);
674
- const subscriptionRef = useRef(null);
675
- let t8;
676
- if ($[4] !== Observer || $[5] !== disabled || $[6] !== root || $[7] !== rootMargin || $[8] !== threshold) {
677
- t8 = () => {
678
- const {
679
- current: nodeElement
680
- } = nodeRef;
681
- const {
682
- current: currentSubscription
683
- } = subscriptionRef;
684
- if (currentSubscription !== null && currentSubscription.element === nodeElement && currentSubscription.Observer === Observer && currentSubscription.disabled === disabled && currentSubscription.root === root && currentSubscription.rootMargin === rootMargin && currentSubscription.threshold === threshold) {
685
- return;
686
- }
687
- if (currentSubscription !== null && currentSubscription.unsubscribe !== null && currentSubscription.element !== null) {
688
- currentSubscription.unsubscribe(currentSubscription.element, currentSubscription.callback);
689
- }
690
- const callback = newEntry => setEntry(newEntry);
691
- let unsubscribe = null;
692
- if (!disabled && nodeElement !== null && Observer !== null) {
693
- const newOpts = {};
694
- if (root !== null) {
695
- newOpts.root = root;
696
- }
697
- if (rootMargin !== null) {
698
- newOpts.rootMargin = rootMargin;
699
- }
700
- if (threshold !== null) {
701
- newOpts.threshold = threshold;
702
- }
703
- const {
704
- subscribe,
705
- unsubscribe: localUnsubscribe
706
- } = getObserver(Observer, newOpts);
707
- unsubscribe = localUnsubscribe;
708
- subscribe(nodeElement, callback);
709
- }
710
- subscriptionRef.current = {
711
- element: nodeElement,
712
- Observer,
713
- disabled,
714
- root,
715
- rootMargin,
716
- threshold,
717
- unsubscribe,
718
- callback
719
- };
720
- };
721
- $[4] = Observer;
722
- $[5] = disabled;
723
- $[6] = root;
724
- $[7] = rootMargin;
725
- $[8] = threshold;
726
- $[9] = t8;
727
- } else {
728
- t8 = $[9];
729
- }
730
- useEffect(t8);
731
- let t10;
732
- let t9;
733
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
734
- t9 = () => () => {
735
- const {
736
- current: currentSubscription_0
737
- } = subscriptionRef;
738
- if (currentSubscription_0 !== null && currentSubscription_0.unsubscribe !== null && currentSubscription_0.element !== null) {
739
- currentSubscription_0.unsubscribe(currentSubscription_0.element, currentSubscription_0.callback);
740
- }
741
- subscriptionRef.current = null;
742
- };
743
- t10 = [];
744
- $[10] = t10;
745
- $[11] = t9;
746
- } else {
747
- t10 = $[10];
748
- t9 = $[11];
749
- }
750
- useEffect(t9, t10);
751
- let t11;
752
- if ($[12] !== entry) {
753
- t11 = {
754
- ref: nodeRef,
755
- entry
756
- };
757
- $[12] = entry;
758
- $[13] = t11;
759
- } else {
760
- t11 = $[13];
761
- }
762
- return t11;
763
- }
764
-
765
- /**
766
- * Intersection Observer
767
- */
768
- const thresholdArray = buildThresholdArray();
769
- const intersectionObserverInitialEntry = {
770
- target: null,
771
- time: null,
772
- isVisible: false,
773
- isIntersecting: false,
774
- intersectionRatio: 0,
775
- intersectionRect: null,
776
- boundingClientRect: null,
777
- rootBounds: null
778
- };
779
- function useIntersectionObserver(t0) {
780
- const $ = c(7);
781
- let t1;
782
- if ($[0] !== t0) {
783
- t1 = t0 === undefined ? {} : t0;
784
- $[0] = t0;
785
- $[1] = t1;
786
- } else {
787
- t1 = $[1];
788
- }
789
- const {
790
- root: t2,
791
- rootMargin: t3,
792
- threshold: t4,
793
- disabled: t5
794
- } = t1;
795
- const root = t2 === undefined ? null : t2;
796
- const rootMargin = t3 === undefined ? "0px" : t3;
797
- const threshold = t4 === undefined ? thresholdArray : t4;
798
- const disabled = t5 === undefined ? false : t5;
799
- let t6;
800
- if ($[2] !== disabled || $[3] !== root || $[4] !== rootMargin || $[5] !== threshold) {
801
- t6 = {
802
- root,
803
- rootMargin,
804
- threshold,
805
- disabled
806
- };
807
- $[2] = disabled;
808
- $[3] = root;
809
- $[4] = rootMargin;
810
- $[5] = threshold;
811
- $[6] = t6;
812
- } else {
813
- t6 = $[6];
814
- }
815
- return useObserver(typeof window !== "undefined" ? IntersectionObserver : null, t6, intersectionObserverInitialEntry);
816
- }
817
-
818
- /**
819
- * Resize Observer
820
- */
821
-
822
- const resizeObserverInitialEntry = {
823
- target: null,
824
- contentRect: null,
825
- contentBoxSize: null,
826
- borderBoxSize: null
827
- };
828
- function useResizeObserver(t0) {
829
- const $ = c(4);
830
- let t1;
831
- if ($[0] !== t0) {
832
- t1 = t0 === undefined ? {} : t0;
833
- $[0] = t0;
834
- $[1] = t1;
835
- } else {
836
- t1 = $[1];
837
- }
838
- const {
839
- disabled: t2
840
- } = t1;
841
- const disabled = t2 === undefined ? false : t2;
842
- let t3;
843
- if ($[2] !== disabled) {
844
- t3 = {
845
- disabled
846
- };
847
- $[2] = disabled;
848
- $[3] = t3;
849
- } else {
850
- t3 = $[3];
851
- }
852
- return useObserver(typeof window !== "undefined" ? ResizeObserver : null, t3, resizeObserverInitialEntry);
853
- }
854
-
855
- function useIsVisible(t0) {
856
- const $ = c(8);
857
- let t1;
858
- if ($[0] !== t0) {
859
- t1 = t0 === undefined ? {} : t0;
860
- $[0] = t0;
861
- $[1] = t1;
862
- } else {
863
- t1 = $[1];
864
- }
865
- const {
866
- rootMargin,
867
- threshold: t2,
868
- persist: t3
869
- } = t1;
870
- const threshold = t2 === undefined ? 1 : t2;
871
- const persist = t3 === undefined ? false : t3;
872
- let t4;
873
- if ($[2] !== rootMargin || $[3] !== threshold) {
874
- t4 = {
875
- rootMargin,
876
- threshold
877
- };
878
- $[2] = rootMargin;
879
- $[3] = threshold;
880
- $[4] = t4;
881
- } else {
882
- t4 = $[4];
883
- }
884
- const {
885
- ref,
886
- entry: t5
887
- } = useIntersectionObserver(t4);
888
- const {
889
- isIntersecting
890
- } = t5;
891
- const [wasIntersecting, setWasIntersecting] = useState(isIntersecting);
892
- if (isIntersecting && !wasIntersecting) {
893
- setWasIntersecting(true);
894
- }
895
- const hasIntersected = wasIntersecting || isIntersecting;
896
- const isVisible = !persist && isIntersecting || persist && hasIntersected;
897
- let t6;
898
- if ($[5] !== isVisible || $[6] !== ref) {
899
- t6 = {
900
- ref,
901
- visible: isVisible
902
- };
903
- $[5] = isVisible;
904
- $[6] = ref;
905
- $[7] = t6;
906
- } else {
907
- t6 = $[7];
908
- }
909
- return t6;
910
- }
911
-
912
- const KEYCODES = {
913
- ARROW_LEFT: 37,
914
- ARROW_UP: 38,
915
- ARROW_RIGHT: 39,
916
- ARROW_DOWN: 40,
917
- ESCAPE: 27,
918
- SPACE: 32
919
- };
920
- function useKeyboardKeys(t0, t1) {
921
- const $ = c(16);
922
- let t2;
923
- if ($[0] !== t0) {
924
- t2 = t0 === undefined ? {} : t0;
925
- $[0] = t0;
926
- $[1] = t2;
927
- } else {
928
- t2 = $[1];
929
- }
930
- const keys = t2;
931
- let t3;
932
- if ($[2] !== t1) {
933
- t3 = t1 === undefined ? {} : t1;
934
- $[2] = t1;
935
- $[3] = t3;
936
- } else {
937
- t3 = $[3];
938
- }
939
- const {
940
- eventName: t4
941
- } = t3;
942
- const eventName = t4 === undefined ? "keydown" : t4;
943
- let t5;
944
- if ($[4] !== keys) {
945
- t5 = Object.keys(keys);
946
- $[4] = keys;
947
- $[5] = t5;
948
- } else {
949
- t5 = $[5];
950
- }
951
- const keysNames = t5;
952
- let t6;
953
- if ($[6] !== keys || $[7] !== keysNames) {
954
- t6 = keysNames.map(key => keys[key]);
955
- $[6] = keys;
956
- $[7] = keysNames;
957
- $[8] = t6;
958
- } else {
959
- t6 = $[8];
960
- }
961
- const keysListeners = t6;
962
- let t7;
963
- if ($[9] !== eventName || $[10] !== keys) {
964
- t7 = () => {
965
- const onKeyDown = e => {
966
- const {
967
- keyCode
968
- } = e;
969
- if (typeof keys[keyCode] !== "undefined") {
970
- keys[keyCode](e);
971
- }
972
- };
973
- document.addEventListener(eventName, onKeyDown);
974
- return () => {
975
- document.removeEventListener(eventName, onKeyDown);
976
- };
977
- };
978
- $[9] = eventName;
979
- $[10] = keys;
980
- $[11] = t7;
981
- } else {
982
- t7 = $[11];
983
- }
984
- let t8;
985
- if ($[12] !== eventName || $[13] !== keysListeners || $[14] !== keysNames) {
986
- t8 = [...keysNames, ...keysListeners, eventName];
987
- $[12] = eventName;
988
- $[13] = keysListeners;
989
- $[14] = keysNames;
990
- $[15] = t8;
991
- } else {
992
- t8 = $[15];
993
- }
994
- useEffect(t7, t8);
995
- }
996
-
997
- const loadWebFontLoader = () => import('webfontloader');
998
- const fontsMap = {
999
- loading: [],
1000
- active: []
1001
- };
1002
- function isFontLoading(name) {
1003
- return fontsMap.loading.indexOf(name) !== -1;
1004
- }
1005
- function isFontActive(name) {
1006
- return fontsMap.active.indexOf(name) !== -1;
1007
- }
1008
- function addFontLoading(name) {
1009
- fontsMap.active = fontsMap.active.filter(it => it !== name);
1010
- fontsMap.loading = [...fontsMap.loading, name];
1011
- }
1012
- function removeFontLoading(name) {
1013
- fontsMap.loading = fontsMap.loading.filter(it => it !== name);
1014
- }
1015
- function addFontActive(name) {
1016
- fontsMap.loading = fontsMap.loading.filter(it => it !== name);
1017
- fontsMap.active = [...fontsMap.active, name];
1018
- }
1019
- function useLoadedFonts(fonts) {
1020
- const $ = c(5);
1021
- const [loaded, setLoaded] = useState(false);
1022
- let t0;
1023
- let t1;
1024
- if ($[0] !== fonts) {
1025
- t0 = () => {
1026
- const config = fonts.reduce(_temp$1, null);
1027
- const hasConfig = config !== null;
1028
- if (hasConfig && typeof window !== "undefined") {
1029
- loadPackage("webfontloader", loadWebFontLoader).then(t2 => {
1030
- const {
1031
- default: WebFont
1032
- } = t2;
1033
- return WebFont.load({
1034
- ...config,
1035
- timeout: 3000,
1036
- active: () => setLoaded(true),
1037
- fontloading: _temp2,
1038
- fontactive: _temp3,
1039
- fontinactive: _temp4
1040
- });
1041
- });
1042
- } else {
1043
- setLoaded(true);
1044
- }
1045
- };
1046
- t1 = [fonts, setLoaded];
1047
- $[0] = fonts;
1048
- $[1] = t0;
1049
- $[2] = t1;
1050
- } else {
1051
- t0 = $[1];
1052
- t1 = $[2];
1053
- }
1054
- useEffect(t0, t1);
1055
- let t2;
1056
- if ($[3] !== loaded) {
1057
- t2 = {
1058
- loaded
1059
- };
1060
- $[3] = loaded;
1061
- $[4] = t2;
1062
- } else {
1063
- t2 = $[4];
1064
- }
1065
- return t2;
1066
- }
1067
- function _temp4(name_2) {
1068
- return removeFontLoading(name_2);
1069
- }
1070
- function _temp3(name_1) {
1071
- return addFontActive(name_1);
1072
- }
1073
- function _temp2(name_0) {
1074
- return addFontLoading(name_0);
1075
- }
1076
- function _temp$1(newConfig, font) {
1077
- const {
1078
- type,
1079
- name
1080
- } = isObject(font) ? font : {
1081
- type: "system",
1082
- name: font
1083
- };
1084
- if ((type === "google" || type === "custom") && !isFontLoading(name) && !isFontActive(name)) {
1085
- return {
1086
- ...newConfig,
1087
- [type]: {
1088
- families: [...(newConfig !== null ? (newConfig[type] || {}).families || [] : []), name]
1089
- }
1090
- };
1091
- }
1092
- return newConfig;
1093
- }
1094
-
1095
- const progressSteps = [0.1, 0.25, 0.5, 0.75, 0.9];
1096
- function useMediaApi(t0) {
1097
- const $ = c(66);
1098
- let t1;
1099
- if ($[0] !== t0) {
1100
- t1 = t0 === undefined ? {} : t0;
1101
- $[0] = t0;
1102
- $[1] = t1;
1103
- } else {
1104
- t1 = $[1];
1105
- }
1106
- const {
1107
- url: t2,
1108
- initialMuted: t3,
1109
- onTimeUpdate: t4,
1110
- onProgressStep: t5,
1111
- onDurationChanged: t6,
1112
- onVolumeChanged: t7,
1113
- onPlay: t8,
1114
- onPause: t9,
1115
- onEnded: t10,
1116
- onSeeked: t11,
1117
- onLoadStart: t12,
1118
- onCanPlayThough: t13
1119
- } = t1;
1120
- const url = t2 === undefined ? null : t2;
1121
- const initialMuted = t3 === undefined ? false : t3;
1122
- const onTimeUpdate = t4 === undefined ? null : t4;
1123
- const onProgressStep = t5 === undefined ? null : t5;
1124
- const onDurationChanged = t6 === undefined ? null : t6;
1125
- const onVolumeChanged = t7 === undefined ? null : t7;
1126
- const onPlay = t8 === undefined ? null : t8;
1127
- const onPause = t9 === undefined ? null : t9;
1128
- const onEnded = t10 === undefined ? null : t10;
1129
- const onSeeked = t11 === undefined ? null : t11;
1130
- const onLoadStart = t12 === undefined ? null : t12;
1131
- const onCanPlayThough = t13 === undefined ? null : t13;
1132
- const ref = useRef(null);
1133
- const [muted, setMuted] = useState(initialMuted);
1134
- const [currentTime, setCurrentTime] = useState(null);
1135
- const [duration, setDuration] = useState(null);
1136
- const [playing, setPlaying] = useState(false);
1137
- const [ready, setReady] = useState(false);
1138
- const [initialPlay, setInitialPlay] = useState(true);
1139
- let t14;
1140
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1141
- t14 = {};
1142
- $[2] = t14;
1143
- } else {
1144
- t14 = $[2];
1145
- }
1146
- const progressStepsReached = useRef(t14);
1147
- const paused = !playing;
1148
- let t15;
1149
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
1150
- t15 = () => {
1151
- const {
1152
- current: media
1153
- } = ref;
1154
- if (media !== null) {
1155
- media.play();
1156
- }
1157
- };
1158
- $[3] = t15;
1159
- } else {
1160
- t15 = $[3];
1161
- }
1162
- const play = t15;
1163
- let t16;
1164
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
1165
- t16 = () => {
1166
- const {
1167
- current: media_0
1168
- } = ref;
1169
- if (media_0 !== null) {
1170
- media_0.pause();
1171
- }
1172
- };
1173
- $[4] = t16;
1174
- } else {
1175
- t16 = $[4];
1176
- }
1177
- const pause = t16;
1178
- let t17;
1179
- if ($[5] !== playing) {
1180
- t17 = () => {
1181
- const {
1182
- current: media_1
1183
- } = ref;
1184
- if (media_1 !== null) {
1185
- if (playing) {
1186
- media_1.pause();
1187
- } else {
1188
- media_1.play();
1189
- }
1190
- }
1191
- };
1192
- $[5] = playing;
1193
- $[6] = t17;
1194
- } else {
1195
- t17 = $[6];
1196
- }
1197
- const togglePlay = t17;
1198
- let t18;
1199
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
1200
- t18 = () => {
1201
- const {
1202
- current: media_2
1203
- } = ref;
1204
- if (media_2 !== null) {
1205
- media_2.pause();
1206
- media_2.currentTime = 0;
1207
- }
1208
- };
1209
- $[7] = t18;
1210
- } else {
1211
- t18 = $[7];
1212
- }
1213
- const stop = t18;
1214
- let t19;
1215
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1216
- t19 = time => {
1217
- const {
1218
- current: media_3
1219
- } = ref;
1220
- if (media_3 !== null) {
1221
- media_3.currentTime = time;
1222
- }
1223
- };
1224
- $[8] = t19;
1225
- } else {
1226
- t19 = $[8];
1227
- }
1228
- const seek = t19;
1229
- let t20;
1230
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1231
- t20 = () => {
1232
- const {
1233
- current: media_4
1234
- } = ref;
1235
- if (media_4 !== null) {
1236
- media_4.muted = true;
1237
- }
1238
- };
1239
- $[9] = t20;
1240
- } else {
1241
- t20 = $[9];
1242
- }
1243
- const mute = t20;
1244
- let t21;
1245
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1246
- t21 = () => {
1247
- const {
1248
- current: media_5
1249
- } = ref;
1250
- if (media_5 !== null) {
1251
- media_5.muted = false;
1252
- }
1253
- };
1254
- $[10] = t21;
1255
- } else {
1256
- t21 = $[10];
1257
- }
1258
- const unMute = t21;
1259
- let t22;
1260
- if ($[11] !== muted) {
1261
- t22 = () => {
1262
- const {
1263
- current: media_6
1264
- } = ref;
1265
- if (media_6 !== null) {
1266
- media_6.muted = !muted;
1267
- }
1268
- };
1269
- $[11] = muted;
1270
- $[12] = t22;
1271
- } else {
1272
- t22 = $[12];
1273
- }
1274
- const toggleMute = t22;
1275
- let t23;
1276
- if ($[13] !== initialPlay || $[14] !== onPlay) {
1277
- t23 = () => {
1278
- if (onPlay !== null) {
1279
- onPlay({
1280
- initial: initialPlay
1281
- });
1282
- }
1283
- if (initialPlay) {
1284
- setInitialPlay(false);
1285
- }
1286
- setPlaying(true);
1287
- };
1288
- $[13] = initialPlay;
1289
- $[14] = onPlay;
1290
- $[15] = t23;
1291
- } else {
1292
- t23 = $[15];
1293
- }
1294
- const onCustomPlay = t23;
1295
- let t24;
1296
- if ($[16] !== onPause) {
1297
- t24 = () => {
1298
- const {
1299
- current: media_7
1300
- } = ref;
1301
- setPlaying(false);
1302
- if (onPause !== null) {
1303
- onPause({
1304
- midway: media_7.currentTime > 0 && media_7.currentTime < media_7.duration
1305
- });
1306
- }
1307
- };
1308
- $[16] = onPause;
1309
- $[17] = t24;
1310
- } else {
1311
- t24 = $[17];
1312
- }
1313
- const onCustomPause = t24;
1314
- let t25;
1315
- if ($[18] !== onEnded) {
1316
- t25 = () => {
1317
- const {
1318
- current: media_8
1319
- } = ref;
1320
- media_8.currentTime = 0;
1321
- if (onEnded !== null) {
1322
- onEnded();
1323
- }
1324
- setInitialPlay(true);
1325
- };
1326
- $[18] = onEnded;
1327
- $[19] = t25;
1328
- } else {
1329
- t25 = $[19];
1330
- }
1331
- const onCustomEnded = t25;
1332
- let t26;
1333
- if ($[20] !== onProgressStep || $[21] !== onTimeUpdate) {
1334
- t26 = () => {
1335
- const {
1336
- current: media_9
1337
- } = ref;
1338
- setCurrentTime(media_9.currentTime);
1339
- if (onTimeUpdate !== null) {
1340
- onTimeUpdate(media_9.currentTime);
1341
- }
1342
- const progress = media_9.currentTime / media_9.duration;
1343
- const currentSteps = progressStepsReached.current;
1344
- const stepsToTrack = progressSteps.filter(step => progress > step && typeof currentSteps[step] === "undefined");
1345
- stepsToTrack.forEach(step_0 => {
1346
- if (onProgressStep !== null) {
1347
- onProgressStep(step_0);
1348
- }
1349
- currentSteps[step_0] = true;
1350
- });
1351
- };
1352
- $[20] = onProgressStep;
1353
- $[21] = onTimeUpdate;
1354
- $[22] = t26;
1355
- } else {
1356
- t26 = $[22];
1357
- }
1358
- const onCustomTimeUpdate = t26;
1359
- let t27;
1360
- if ($[23] !== onDurationChanged) {
1361
- t27 = () => {
1362
- const {
1363
- current: media_10
1364
- } = ref;
1365
- setDuration(media_10.duration);
1366
- if (onDurationChanged !== null) {
1367
- onDurationChanged(media_10.duration);
1368
- }
1369
- };
1370
- $[23] = onDurationChanged;
1371
- $[24] = t27;
1372
- } else {
1373
- t27 = $[24];
1374
- }
1375
- const onCustomDurationChange = t27;
1376
- let t28;
1377
- if ($[25] !== onSeeked) {
1378
- t28 = () => {
1379
- const {
1380
- current: media_11
1381
- } = ref;
1382
- if (onSeeked !== null) {
1383
- onSeeked(media_11.currentTime);
1384
- }
1385
- };
1386
- $[25] = onSeeked;
1387
- $[26] = t28;
1388
- } else {
1389
- t28 = $[26];
1390
- }
1391
- const onCustomSeeked = t28;
1392
- let t29;
1393
- if ($[27] !== onVolumeChanged) {
1394
- t29 = () => {
1395
- const {
1396
- current: media_12
1397
- } = ref;
1398
- setMuted(media_12.muted);
1399
- if (onVolumeChanged !== null) {
1400
- onVolumeChanged(media_12.muted, media_12.volume);
1401
- }
1402
- };
1403
- $[27] = onVolumeChanged;
1404
- $[28] = t29;
1405
- } else {
1406
- t29 = $[28];
1407
- }
1408
- const onCustomVolumeChange = t29;
1409
- let t30;
1410
- if ($[29] !== onLoadStart) {
1411
- t30 = () => {
1412
- setReady(false);
1413
- if (onLoadStart !== null) {
1414
- onLoadStart();
1415
- }
1416
- };
1417
- $[29] = onLoadStart;
1418
- $[30] = t30;
1419
- } else {
1420
- t30 = $[30];
1421
- }
1422
- const onCustomLoadStart = t30;
1423
- let t31;
1424
- if ($[31] !== onCanPlayThough) {
1425
- t31 = () => {
1426
- setReady(true);
1427
- if (onCanPlayThough !== null) {
1428
- onCanPlayThough();
1429
- }
1430
- };
1431
- $[31] = onCanPlayThough;
1432
- $[32] = t31;
1433
- } else {
1434
- t31 = $[32];
1435
- }
1436
- const onCustomCanPlayThrough = t31;
1437
- let t32;
1438
- if ($[33] !== onCustomCanPlayThrough || $[34] !== onCustomDurationChange || $[35] !== onCustomEnded || $[36] !== onCustomLoadStart || $[37] !== onCustomPause || $[38] !== onCustomPlay || $[39] !== onCustomSeeked || $[40] !== onCustomTimeUpdate || $[41] !== onCustomVolumeChange) {
1439
- t32 = {
1440
- timeupdate: onCustomTimeUpdate,
1441
- durationchange: onCustomDurationChange,
1442
- volumechange: onCustomVolumeChange,
1443
- play: onCustomPlay,
1444
- pause: onCustomPause,
1445
- ended: onCustomEnded,
1446
- seeked: onCustomSeeked,
1447
- loadstart: onCustomLoadStart,
1448
- canplaythrough: onCustomCanPlayThrough
1449
- };
1450
- $[33] = onCustomCanPlayThrough;
1451
- $[34] = onCustomDurationChange;
1452
- $[35] = onCustomEnded;
1453
- $[36] = onCustomLoadStart;
1454
- $[37] = onCustomPause;
1455
- $[38] = onCustomPlay;
1456
- $[39] = onCustomSeeked;
1457
- $[40] = onCustomTimeUpdate;
1458
- $[41] = onCustomVolumeChange;
1459
- $[42] = t32;
1460
- } else {
1461
- t32 = $[42];
1462
- }
1463
- const handlersRef = useRef(t32);
1464
- let t33;
1465
- let t34;
1466
- if ($[43] !== onCustomCanPlayThrough || $[44] !== onCustomDurationChange || $[45] !== onCustomEnded || $[46] !== onCustomLoadStart || $[47] !== onCustomPause || $[48] !== onCustomPlay || $[49] !== onCustomSeeked || $[50] !== onCustomTimeUpdate || $[51] !== onCustomVolumeChange) {
1467
- t33 = () => {
1468
- handlersRef.current = {
1469
- timeupdate: onCustomTimeUpdate,
1470
- durationchange: onCustomDurationChange,
1471
- volumechange: onCustomVolumeChange,
1472
- play: onCustomPlay,
1473
- pause: onCustomPause,
1474
- ended: onCustomEnded,
1475
- seeked: onCustomSeeked,
1476
- loadstart: onCustomLoadStart,
1477
- canplaythrough: onCustomCanPlayThrough
1478
- };
1479
- };
1480
- t34 = [onCustomTimeUpdate, onCustomDurationChange, onCustomVolumeChange, onCustomPlay, onCustomPause, onCustomEnded, onCustomSeeked, onCustomLoadStart, onCustomCanPlayThrough];
1481
- $[43] = onCustomCanPlayThrough;
1482
- $[44] = onCustomDurationChange;
1483
- $[45] = onCustomEnded;
1484
- $[46] = onCustomLoadStart;
1485
- $[47] = onCustomPause;
1486
- $[48] = onCustomPlay;
1487
- $[49] = onCustomSeeked;
1488
- $[50] = onCustomTimeUpdate;
1489
- $[51] = onCustomVolumeChange;
1490
- $[52] = t33;
1491
- $[53] = t34;
1492
- } else {
1493
- t33 = $[52];
1494
- t34 = $[53];
1495
- }
1496
- useEffect(t33, t34);
1497
- let t35;
1498
- if ($[54] === Symbol.for("react.memo_cache_sentinel")) {
1499
- t35 = () => {
1500
- const {
1501
- current: media_13
1502
- } = ref;
1503
- progressStepsReached.current = {};
1504
- const onMediaTimeUpdate = () => handlersRef.current.timeupdate();
1505
- const onMediaDurationChange = () => handlersRef.current.durationchange();
1506
- const onMediaVolumeChange = () => handlersRef.current.volumechange();
1507
- const onMediaPlay = () => handlersRef.current.play();
1508
- const onMediaPause = () => handlersRef.current.pause();
1509
- const onMediaEnded = () => handlersRef.current.ended();
1510
- const onMediaSeeked = () => handlersRef.current.seeked();
1511
- const onMediaLoadStart = () => handlersRef.current.loadstart();
1512
- const onMediaCanPlayThrough = () => handlersRef.current.canplaythrough();
1513
- if (media_13 !== null) {
1514
- media_13.addEventListener("timeupdate", onMediaTimeUpdate);
1515
- media_13.addEventListener("durationchange", onMediaDurationChange);
1516
- media_13.addEventListener("volumechange", onMediaVolumeChange);
1517
- media_13.addEventListener("play", onMediaPlay);
1518
- media_13.addEventListener("pause", onMediaPause);
1519
- media_13.addEventListener("ended", onMediaEnded);
1520
- media_13.addEventListener("seeked", onMediaSeeked);
1521
- media_13.addEventListener("loadstart", onMediaLoadStart);
1522
- media_13.addEventListener("canplaythrough", onMediaCanPlayThrough);
1523
- }
1524
- return () => {
1525
- if (media_13 !== null) {
1526
- media_13.removeEventListener("timeupdate", onMediaTimeUpdate);
1527
- media_13.removeEventListener("durationchange", onMediaDurationChange);
1528
- media_13.removeEventListener("volumechange", onMediaVolumeChange);
1529
- media_13.removeEventListener("play", onMediaPlay);
1530
- media_13.removeEventListener("pause", onMediaPause);
1531
- media_13.removeEventListener("ended", onMediaEnded);
1532
- media_13.removeEventListener("seeked", onMediaSeeked);
1533
- media_13.removeEventListener("loadstart", onMediaLoadStart);
1534
- media_13.removeEventListener("canplaythrough", onMediaCanPlayThrough);
1535
- }
1536
- };
1537
- };
1538
- $[54] = t35;
1539
- } else {
1540
- t35 = $[54];
1541
- }
1542
- let t36;
1543
- if ($[55] !== url) {
1544
- t36 = [url];
1545
- $[55] = url;
1546
- $[56] = t36;
1547
- } else {
1548
- t36 = $[56];
1549
- }
1550
- useEffect(t35, t36);
1551
- let t37;
1552
- if ($[57] !== currentTime || $[58] !== duration || $[59] !== muted || $[60] !== paused || $[61] !== playing || $[62] !== ready || $[63] !== toggleMute || $[64] !== togglePlay) {
1553
- t37 = {
1554
- ref,
1555
- play,
1556
- pause,
1557
- togglePlay,
1558
- stop,
1559
- seek,
1560
- mute,
1561
- unMute,
1562
- toggleMute,
1563
- muted,
1564
- currentTime,
1565
- duration,
1566
- playing,
1567
- paused,
1568
- ready
1569
- };
1570
- $[57] = currentTime;
1571
- $[58] = duration;
1572
- $[59] = muted;
1573
- $[60] = paused;
1574
- $[61] = playing;
1575
- $[62] = ready;
1576
- $[63] = toggleMute;
1577
- $[64] = togglePlay;
1578
- $[65] = t37;
1579
- } else {
1580
- t37 = $[65];
1581
- }
1582
- return t37;
1583
- }
1584
-
1585
- function useMediasParser() {
1586
- const $ = c(10);
1587
- const fieldsManager = useFieldsManager();
1588
- let t0;
1589
- if ($[0] !== fieldsManager) {
1590
- t0 = new MediasParser({
1591
- fieldsManager
1592
- });
1593
- $[0] = fieldsManager;
1594
- $[1] = t0;
1595
- } else {
1596
- t0 = $[1];
1597
- }
1598
- const parser = t0;
1599
- let t1;
1600
- if ($[2] !== parser) {
1601
- t1 = story => parser.toPath(story);
1602
- $[2] = parser;
1603
- $[3] = t1;
1604
- } else {
1605
- t1 = $[3];
1606
- }
1607
- const toPath = t1;
1608
- let t2;
1609
- if ($[4] !== parser) {
1610
- t2 = story_0 => parser.fromPath(story_0);
1611
- $[4] = parser;
1612
- $[5] = t2;
1613
- } else {
1614
- t2 = $[5];
1615
- }
1616
- const fromPath = t2;
1617
- let t3;
1618
- if ($[6] !== fromPath || $[7] !== parser || $[8] !== toPath) {
1619
- t3 = {
1620
- toPath,
1621
- fromPath,
1622
- parser
1623
- };
1624
- $[6] = fromPath;
1625
- $[7] = parser;
1626
- $[8] = toPath;
1627
- $[9] = t3;
1628
- } else {
1629
- t3 = $[9];
1630
- }
1631
- return t3;
1632
- }
1633
-
1634
- function useResourceTypeName(resource, t0) {
1635
- const $ = c(7);
1636
- const type = t0 === undefined ? null : t0;
1637
- let t1;
1638
- bb0: {
1639
- let t2;
1640
- if ($[0] !== resource) {
1641
- t2 = resource || {};
1642
- $[0] = resource;
1643
- $[1] = t2;
1644
- } else {
1645
- t2 = $[1];
1646
- }
1647
- const {
1648
- name: t3,
1649
- types: t4,
1650
- settings: t5
1651
- } = t2;
1652
- const resourceName = t3 === undefined ? null : t3;
1653
- let t6;
1654
- if ($[2] !== t4) {
1655
- t6 = t4 === undefined ? [] : t4;
1656
- $[2] = t4;
1657
- $[3] = t6;
1658
- } else {
1659
- t6 = $[3];
1660
- }
1661
- const types = t6;
1662
- const settings = t5 === undefined ? {} : t5;
1663
- const {
1664
- hideTypeNames: t7
1665
- } = settings || {};
1666
- const hideTypeNames = t7 === undefined ? false : t7;
1667
- if (hideTypeNames) {
1668
- t1 = null;
1669
- break bb0;
1670
- }
1671
- let t8;
1672
- if ($[4] !== type || $[5] !== types) {
1673
- t8 = type !== null && types !== null && types.length > 1 ? (types || []).find(t9 => {
1674
- const {
1675
- id: t10
1676
- } = t9;
1677
- const id = t10 === undefined ? null : t10;
1678
- return id === type;
1679
- }) || {} : {};
1680
- $[4] = type;
1681
- $[5] = types;
1682
- $[6] = t8;
1683
- } else {
1684
- t8 = $[6];
1685
- }
1686
- const {
1687
- name: t9
1688
- } = t8;
1689
- const name = t9 === undefined ? null : t9;
1690
- t1 = name === resourceName ? null : name;
1691
- }
1692
- const typeName = t1;
1693
- return typeName;
1694
- }
1695
-
1696
- function getResource(resources, resourceId) {
1697
- return resourceId !== null && !isObject(resourceId) ? resources.find(it => it.id === resourceId) || null : resourceId;
1698
- }
1699
- function useResourceUrlGenerator(t0) {
1700
- const $ = c(9);
1701
- const resourceId = t0 === undefined ? null : t0;
1702
- const resources = usePanneauResources();
1703
- const contextResource = useResource();
1704
- let t1;
1705
- if ($[0] !== contextResource || $[1] !== resourceId || $[2] !== resources) {
1706
- t1 = getResource(resources, resourceId) || contextResource;
1707
- $[0] = contextResource;
1708
- $[1] = resourceId;
1709
- $[2] = resources;
1710
- $[3] = t1;
1711
- } else {
1712
- t1 = $[3];
1713
- }
1714
- const resource = t1;
1715
- const route = useUrlGenerator();
1716
- const routes = useRoutes();
1717
- let t2;
1718
- if ($[4] !== resource || $[5] !== resources || $[6] !== route || $[7] !== routes) {
1719
- t2 = (routeResourceId, t3, t4) => {
1720
- const routeName = t3 === undefined ? null : t3;
1721
- const params = t4 === undefined ? null : t4;
1722
- const hasResourceId = isString(routeName);
1723
- const finalRouteName = hasResourceId ? routeName : routeResourceId;
1724
- const finalParams = hasResourceId ? params : routeName;
1725
- const finalResource = hasResourceId ? getResource(resources, routeResourceId) : resource;
1726
- const {
1727
- id: t5
1728
- } = finalResource || {};
1729
- const id = t5 === undefined ? null : t5;
1730
- const specificRouteName = `resources.${id}.${finalRouteName}`;
1731
- const hasSpecificRoute = typeof routes[specificRouteName] !== "undefined";
1732
- const finalRoute = id !== null ? route(hasSpecificRoute ? specificRouteName : `resources.${finalRouteName}`, hasSpecificRoute ? finalParams : {
1733
- ...finalParams,
1734
- resource: id
1735
- }) : null;
1736
- return finalRoute;
1737
- };
1738
- $[4] = resource;
1739
- $[5] = resources;
1740
- $[6] = route;
1741
- $[7] = routes;
1742
- $[8] = t2;
1743
- } else {
1744
- t2 = $[8];
1745
- }
1746
- const generateUrl = t2;
1747
- return generateUrl;
1748
- }
1749
-
1750
- function useQuery(t0, t1) {
1751
- const $ = c(15);
1752
- const initialBaseQuery = t0 === undefined ? null : t0;
1753
- const paginated = t1 === undefined ? true : t1;
1754
- const [stableBaseQuery, setStableBaseQuery] = useState(initialBaseQuery);
1755
- if (!isEqual(stableBaseQuery, initialBaseQuery)) {
1756
- setStableBaseQuery(initialBaseQuery);
1757
- }
1758
- let t2;
1759
- if ($[0] !== paginated || $[1] !== stableBaseQuery) {
1760
- t2 = paginated ? {
1761
- page: 1,
1762
- count: 10,
1763
- ...(stableBaseQuery || {})
1764
- } : stableBaseQuery || null;
1765
- $[0] = paginated;
1766
- $[1] = stableBaseQuery;
1767
- $[2] = t2;
1768
- } else {
1769
- t2 = $[2];
1770
- }
1771
- const initialQuery = t2;
1772
- const [query, setQuery] = useState(initialQuery);
1773
- let t3;
1774
- let t4;
1775
- if ($[3] !== initialQuery) {
1776
- t3 = () => {
1777
- setQuery(initialQuery);
1778
- };
1779
- t4 = [initialQuery, setQuery];
1780
- $[3] = initialQuery;
1781
- $[4] = t3;
1782
- $[5] = t4;
1783
- } else {
1784
- t3 = $[4];
1785
- t4 = $[5];
1786
- }
1787
- useEffect(t3, t4);
1788
- let t5;
1789
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1790
- t5 = newPage => {
1791
- if (newPage !== null) {
1792
- setQuery(prev => ({
1793
- ...(prev || {}),
1794
- page: newPage || 1
1795
- }));
1796
- }
1797
- };
1798
- $[6] = t5;
1799
- } else {
1800
- t5 = $[6];
1801
- }
1802
- const onPageChange = t5;
1803
- let t6;
1804
- if ($[7] !== initialQuery) {
1805
- t6 = newQuery => {
1806
- const finalQuery = newQuery !== null ? Object.keys(newQuery).reduce((currentQuery, key) => {
1807
- const val = newQuery[key];
1808
- return val !== null ? {
1809
- ...(currentQuery || {}),
1810
- [key]: val
1811
- } : currentQuery;
1812
- }, null) : null;
1813
- setQuery({
1814
- ...(initialQuery || {}),
1815
- ...(finalQuery || {})
1816
- });
1817
- };
1818
- $[7] = initialQuery;
1819
- $[8] = t6;
1820
- } else {
1821
- t6 = $[8];
1822
- }
1823
- const onQueryChange = t6;
1824
- let t7;
1825
- if ($[9] !== initialQuery) {
1826
- t7 = () => {
1827
- setQuery(initialQuery);
1828
- };
1829
- $[9] = initialQuery;
1830
- $[10] = t7;
1831
- } else {
1832
- t7 = $[10];
1833
- }
1834
- const onQueryReset = t7;
1835
- let t8;
1836
- if ($[11] !== onQueryChange || $[12] !== onQueryReset || $[13] !== query) {
1837
- t8 = {
1838
- query,
1839
- onPageChange,
1840
- onQueryChange,
1841
- onQueryReset
1842
- };
1843
- $[11] = onQueryChange;
1844
- $[12] = onQueryReset;
1845
- $[13] = query;
1846
- $[14] = t8;
1847
- } else {
1848
- t8 = $[14];
1849
- }
1850
- return t8;
1851
- }
1852
-
1853
- function useScreenSize(t0) {
1854
- const $ = c(20);
1855
- const {
1856
- width: t1,
1857
- height: t2,
1858
- landscape: t3,
1859
- screens: t4,
1860
- mediaType: t5,
1861
- media: t6
1862
- } = t0;
1863
- const width = t1 === undefined ? null : t1;
1864
- const height = t2 === undefined ? null : t2;
1865
- const landscape = t3 === undefined ? false : t3;
1866
- let t7;
1867
- if ($[0] !== t4) {
1868
- t7 = t4 === undefined ? [] : t4;
1869
- $[0] = t4;
1870
- $[1] = t7;
1871
- } else {
1872
- t7 = $[1];
1873
- }
1874
- const screens = t7;
1875
- const mediaType = t5 === undefined ? "screen" : t5;
1876
- const providedMedia = t6 === undefined ? null : t6;
1877
- let t8;
1878
- if ($[2] !== height || $[3] !== mediaType || $[4] !== providedMedia || $[5] !== width) {
1879
- t8 = providedMedia !== null ? providedMedia : {
1880
- type: mediaType,
1881
- width: `${width}px`,
1882
- height: `${height}px`
1883
- };
1884
- $[2] = height;
1885
- $[3] = mediaType;
1886
- $[4] = providedMedia;
1887
- $[5] = width;
1888
- $[6] = t8;
1889
- } else {
1890
- t8 = $[6];
1891
- }
1892
- const media = t8;
1893
- let t9;
1894
- if ($[7] !== media || $[8] !== screens) {
1895
- let t10;
1896
- if ($[10] !== media) {
1897
- t10 = t11 => {
1898
- const {
1899
- mediaQuery: t12
1900
- } = t11;
1901
- const mediaQuery = t12 === undefined ? null : t12;
1902
- return mediaQuery === null || match(mediaQuery, media);
1903
- };
1904
- $[10] = media;
1905
- $[11] = t10;
1906
- } else {
1907
- t10 = $[11];
1908
- }
1909
- t9 = [...screens].reverse().filter(t10);
1910
- $[7] = media;
1911
- $[8] = screens;
1912
- $[9] = t9;
1913
- } else {
1914
- t9 = $[9];
1915
- }
1916
- const matchingScreens = t9;
1917
- const t10 = matchingScreens.length > 0 ? matchingScreens[0].name : null;
1918
- let t11;
1919
- if ($[12] !== matchingScreens) {
1920
- t11 = [...matchingScreens].reverse().map(_temp);
1921
- $[12] = matchingScreens;
1922
- $[13] = t11;
1923
- } else {
1924
- t11 = $[13];
1925
- }
1926
- let t12;
1927
- if ($[14] !== height || $[15] !== landscape || $[16] !== t10 || $[17] !== t11 || $[18] !== width) {
1928
- t12 = {
1929
- screen: t10,
1930
- screens: t11,
1931
- width,
1932
- height,
1933
- landscape
1934
- };
1935
- $[14] = height;
1936
- $[15] = landscape;
1937
- $[16] = t10;
1938
- $[17] = t11;
1939
- $[18] = width;
1940
- $[19] = t12;
1941
- } else {
1942
- t12 = $[19];
1943
- }
1944
- return t12;
1945
- }
1946
- function _temp(t0) {
1947
- const {
1948
- name
1949
- } = t0;
1950
- return name;
1951
- }
1952
- function useScreenSizeFromElement(t0) {
1953
- const $ = c(28);
1954
- let t1;
1955
- if ($[0] !== t0) {
1956
- t1 = t0 === undefined ? {} : t0;
1957
- $[0] = t0;
1958
- $[1] = t1;
1959
- } else {
1960
- t1 = $[1];
1961
- }
1962
- let opts;
1963
- let t2;
1964
- let t3;
1965
- if ($[2] !== t1) {
1966
- ({
1967
- width: t2,
1968
- height: t3,
1969
- ...opts
1970
- } = t1);
1971
- $[2] = t1;
1972
- $[3] = opts;
1973
- $[4] = t2;
1974
- $[5] = t3;
1975
- } else {
1976
- opts = $[3];
1977
- t2 = $[4];
1978
- t3 = $[5];
1979
- }
1980
- const width = t2 === undefined ? null : t2;
1981
- const height = t3 === undefined ? null : t3;
1982
- const {
1983
- ref,
1984
- entry: t4
1985
- } = useResizeObserver();
1986
- const {
1987
- contentRect
1988
- } = t4;
1989
- let t5;
1990
- if ($[6] !== contentRect) {
1991
- t5 = contentRect || {};
1992
- $[6] = contentRect;
1993
- $[7] = t5;
1994
- } else {
1995
- t5 = $[7];
1996
- }
1997
- const {
1998
- width: t6,
1999
- height: t7
2000
- } = t5;
2001
- const calculatedWidth = t6 === undefined ? 0 : t6;
2002
- const calculatedHeight = t7 === undefined ? 0 : t7;
2003
- const semiFinalWidth = width !== null ? width : calculatedWidth;
2004
- const semiFinalHeight = height !== null ? height : calculatedHeight;
2005
- const landscape = semiFinalHeight > 0 && semiFinalWidth > semiFinalHeight;
2006
- let restOpts;
2007
- let t8;
2008
- if ($[8] !== opts) {
2009
- ({
2010
- withoutMaxSize: t8,
2011
- ...restOpts
2012
- } = opts);
2013
- $[8] = opts;
2014
- $[9] = restOpts;
2015
- $[10] = t8;
2016
- } else {
2017
- restOpts = $[9];
2018
- t8 = $[10];
2019
- }
2020
- const withoutMaxSize = t8 === undefined ? false : t8;
2021
- let t9;
2022
- if ($[11] !== landscape || $[12] !== semiFinalHeight || $[13] !== semiFinalWidth || $[14] !== withoutMaxSize) {
2023
- t9 = landscape && !withoutMaxSize ? Math.round(Math.max(320, 0.45 * semiFinalHeight)) : semiFinalWidth;
2024
- $[11] = landscape;
2025
- $[12] = semiFinalHeight;
2026
- $[13] = semiFinalWidth;
2027
- $[14] = withoutMaxSize;
2028
- $[15] = t9;
2029
- } else {
2030
- t9 = $[15];
2031
- }
2032
- let finalWidth = t9;
2033
- let t10;
2034
- if ($[16] !== landscape || $[17] !== semiFinalHeight || $[18] !== withoutMaxSize) {
2035
- t10 = landscape && !withoutMaxSize ? Math.round(Math.max(533, 0.75 * semiFinalHeight)) : semiFinalHeight;
2036
- $[16] = landscape;
2037
- $[17] = semiFinalHeight;
2038
- $[18] = withoutMaxSize;
2039
- $[19] = t10;
2040
- } else {
2041
- t10 = $[19];
2042
- }
2043
- let finalHeight = t10;
2044
- if (finalWidth % 2 === 1) {
2045
- finalWidth = finalWidth - 1;
2046
- }
2047
- if (finalHeight % 2 === 1) {
2048
- finalHeight = finalHeight - 1;
2049
- }
2050
- let t11;
2051
- if ($[20] !== finalHeight || $[21] !== finalWidth || $[22] !== landscape || $[23] !== restOpts) {
2052
- t11 = {
2053
- width: finalWidth,
2054
- height: finalHeight,
2055
- landscape,
2056
- ...restOpts
2057
- };
2058
- $[20] = finalHeight;
2059
- $[21] = finalWidth;
2060
- $[22] = landscape;
2061
- $[23] = restOpts;
2062
- $[24] = t11;
2063
- } else {
2064
- t11 = $[24];
2065
- }
2066
- const screenSize = useScreenSize(t11);
2067
- let t12;
2068
- if ($[25] !== ref || $[26] !== screenSize) {
2069
- t12 = {
2070
- ref,
2071
- screenSize
2072
- };
2073
- $[25] = ref;
2074
- $[26] = screenSize;
2075
- $[27] = t12;
2076
- } else {
2077
- t12 = $[27];
2078
- }
2079
- return t12;
2080
- }
2081
- function getWindowSize() {
2082
- return {
2083
- width: typeof window !== 'undefined' ? window.innerWidth : null,
2084
- height: typeof window !== 'undefined' ? window.innerHeight : null
2085
- };
2086
- }
2087
- function useScreenSizeFromWindow(t0) {
2088
- const $ = c(8);
2089
- let t1;
2090
- if ($[0] !== t0) {
2091
- t1 = t0 === undefined ? {} : t0;
2092
- $[0] = t0;
2093
- $[1] = t1;
2094
- } else {
2095
- t1 = $[1];
2096
- }
2097
- const opts = t1;
2098
- let t2;
2099
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
2100
- t2 = getWindowSize();
2101
- $[2] = t2;
2102
- } else {
2103
- t2 = $[2];
2104
- }
2105
- const [windowSize, setWindowSize] = useState(t2);
2106
- let t3;
2107
- let t4;
2108
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
2109
- t3 = () => {
2110
- const onResize = () => setWindowSize(getWindowSize());
2111
- if (typeof window !== "undefined") {
2112
- window.addEventListener("resize", onResize);
2113
- }
2114
- return () => {
2115
- if (typeof window !== "undefined") {
2116
- window.removeEventListener("resize", onResize);
2117
- }
2118
- };
2119
- };
2120
- t4 = [setWindowSize];
2121
- $[3] = t3;
2122
- $[4] = t4;
2123
- } else {
2124
- t3 = $[3];
2125
- t4 = $[4];
2126
- }
2127
- useEffect(t3, t4);
2128
- let t5;
2129
- if ($[5] !== opts || $[6] !== windowSize) {
2130
- t5 = {
2131
- ...opts,
2132
- ...windowSize
2133
- };
2134
- $[5] = opts;
2135
- $[6] = windowSize;
2136
- $[7] = t5;
2137
- } else {
2138
- t5 = $[7];
2139
- }
2140
- return useScreenSize(t5);
2141
- }
2142
-
2143
- const eventsManager = typeof window !== 'undefined' ? new EventsManager(window) : null;
2144
- const useWindowEvent = createUseEvent(eventsManager);
2145
-
2146
- export { KEYCODES, getObserver, useAnimationFrame, useDocumentEvent, useForm, useFormattedDate, useFormattedTime, useIntersectionObserver, useIsVisible, useKeyboardKeys, useLoadedFonts, useMediaApi, useMediasParser, useObserver, useQuery, useResizeObserver, useResourceTypeName, useResourceUrlGenerator, useScreenSizeFromElement, useScreenSizeFromWindow, useWindowEvent };