@enableai-base/grid-layout 1.0.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.
@@ -0,0 +1,3645 @@
1
+ /**
2
+ * @enableai-base/grid-layout v1.0.0
3
+ * (c) 2024-present Enableai
4
+ * @license Proprietary
5
+ **/
6
+ 'use strict';
7
+
8
+ Object.defineProperty(exports, '__esModule', { value: true });
9
+
10
+ var antd = require('antd');
11
+ var reactHooks = require('@enableai-sdk-common/react-hooks');
12
+ var jsBase64 = require('js-base64');
13
+ var icons = require('@ant-design/icons');
14
+ var ui = require('@enableai-base/ui');
15
+ var proComponents = require('@ant-design/pro-components');
16
+ var core = require('@enableai-base/core');
17
+ var dayjs = require('dayjs');
18
+ var ReactMonacoEditor = require('@monaco-editor/react');
19
+ var baseModal = require('@enableai-sdk-ui/base-modal');
20
+ var lodash = require('lodash');
21
+ var ReactGridLayout = require('react-grid-layout');
22
+
23
+ class ObjectURLManager {
24
+ constructor() {
25
+ this.store = [];
26
+ }
27
+ /**
28
+ * 为指定的 Blob 或 MediaSource 创建对象 URL 并存储。
29
+ *
30
+ * @param {Blob | MediaSource} obj - 需要创建对象 URL 的数据对象。
31
+ * @returns {string} 创建的对象 URL。
32
+ */
33
+ create(obj) {
34
+ const src = window.URL.createObjectURL(obj);
35
+ this.store.push(src);
36
+ return src;
37
+ }
38
+ /**
39
+ * 撤销所有已创建的对象 URL,释放内存。
40
+ */
41
+ destroy() {
42
+ this.store.forEach((url) => window.URL.revokeObjectURL(url));
43
+ this.store = [];
44
+ }
45
+ }
46
+
47
+ function getDefaultExportFromCjs (x) {
48
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
49
+ }
50
+
51
+ var react = {exports: {}};
52
+
53
+ var react_production = {};
54
+
55
+ /**
56
+ * @license React
57
+ * react.production.js
58
+ *
59
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
60
+ *
61
+ * This source code is licensed under the MIT license found in the
62
+ * LICENSE file in the root directory of this source tree.
63
+ */
64
+
65
+ var hasRequiredReact_production;
66
+
67
+ function requireReact_production () {
68
+ if (hasRequiredReact_production) return react_production;
69
+ hasRequiredReact_production = 1;
70
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
71
+ REACT_PORTAL_TYPE = Symbol.for("react.portal"),
72
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
73
+ REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
74
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
75
+ REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
76
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
77
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
78
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
79
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
80
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
81
+ MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
82
+ function getIteratorFn(maybeIterable) {
83
+ if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
84
+ maybeIterable =
85
+ (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
86
+ maybeIterable["@@iterator"];
87
+ return "function" === typeof maybeIterable ? maybeIterable : null;
88
+ }
89
+ var ReactNoopUpdateQueue = {
90
+ isMounted: function () {
91
+ return false;
92
+ },
93
+ enqueueForceUpdate: function () {},
94
+ enqueueReplaceState: function () {},
95
+ enqueueSetState: function () {}
96
+ },
97
+ assign = Object.assign,
98
+ emptyObject = {};
99
+ function Component(props, context, updater) {
100
+ this.props = props;
101
+ this.context = context;
102
+ this.refs = emptyObject;
103
+ this.updater = updater || ReactNoopUpdateQueue;
104
+ }
105
+ Component.prototype.isReactComponent = {};
106
+ Component.prototype.setState = function (partialState, callback) {
107
+ if (
108
+ "object" !== typeof partialState &&
109
+ "function" !== typeof partialState &&
110
+ null != partialState
111
+ )
112
+ throw Error(
113
+ "takes an object of state variables to update or a function which returns an object of state variables."
114
+ );
115
+ this.updater.enqueueSetState(this, partialState, callback, "setState");
116
+ };
117
+ Component.prototype.forceUpdate = function (callback) {
118
+ this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
119
+ };
120
+ function ComponentDummy() {}
121
+ ComponentDummy.prototype = Component.prototype;
122
+ function PureComponent(props, context, updater) {
123
+ this.props = props;
124
+ this.context = context;
125
+ this.refs = emptyObject;
126
+ this.updater = updater || ReactNoopUpdateQueue;
127
+ }
128
+ var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy());
129
+ pureComponentPrototype.constructor = PureComponent;
130
+ assign(pureComponentPrototype, Component.prototype);
131
+ pureComponentPrototype.isPureReactComponent = true;
132
+ var isArrayImpl = Array.isArray,
133
+ ReactSharedInternals = { H: null, A: null, T: null, S: null, V: null },
134
+ hasOwnProperty = Object.prototype.hasOwnProperty;
135
+ function ReactElement(type, key, self, source, owner, props) {
136
+ self = props.ref;
137
+ return {
138
+ $$typeof: REACT_ELEMENT_TYPE,
139
+ type: type,
140
+ key: key,
141
+ ref: void 0 !== self ? self : null,
142
+ props: props
143
+ };
144
+ }
145
+ function cloneAndReplaceKey(oldElement, newKey) {
146
+ return ReactElement(
147
+ oldElement.type,
148
+ newKey,
149
+ void 0,
150
+ void 0,
151
+ void 0,
152
+ oldElement.props
153
+ );
154
+ }
155
+ function isValidElement(object) {
156
+ return (
157
+ "object" === typeof object &&
158
+ null !== object &&
159
+ object.$$typeof === REACT_ELEMENT_TYPE
160
+ );
161
+ }
162
+ function escape(key) {
163
+ var escaperLookup = { "=": "=0", ":": "=2" };
164
+ return (
165
+ "$" +
166
+ key.replace(/[=:]/g, function (match) {
167
+ return escaperLookup[match];
168
+ })
169
+ );
170
+ }
171
+ var userProvidedKeyEscapeRegex = /\/+/g;
172
+ function getElementKey(element, index) {
173
+ return "object" === typeof element && null !== element && null != element.key
174
+ ? escape("" + element.key)
175
+ : index.toString(36);
176
+ }
177
+ function noop$1() {}
178
+ function resolveThenable(thenable) {
179
+ switch (thenable.status) {
180
+ case "fulfilled":
181
+ return thenable.value;
182
+ case "rejected":
183
+ throw thenable.reason;
184
+ default:
185
+ switch (
186
+ ("string" === typeof thenable.status
187
+ ? thenable.then(noop$1, noop$1)
188
+ : ((thenable.status = "pending"),
189
+ thenable.then(
190
+ function (fulfilledValue) {
191
+ "pending" === thenable.status &&
192
+ ((thenable.status = "fulfilled"),
193
+ (thenable.value = fulfilledValue));
194
+ },
195
+ function (error) {
196
+ "pending" === thenable.status &&
197
+ ((thenable.status = "rejected"), (thenable.reason = error));
198
+ }
199
+ )),
200
+ thenable.status)
201
+ ) {
202
+ case "fulfilled":
203
+ return thenable.value;
204
+ case "rejected":
205
+ throw thenable.reason;
206
+ }
207
+ }
208
+ throw thenable;
209
+ }
210
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
211
+ var type = typeof children;
212
+ if ("undefined" === type || "boolean" === type) children = null;
213
+ var invokeCallback = false;
214
+ if (null === children) invokeCallback = true;
215
+ else
216
+ switch (type) {
217
+ case "bigint":
218
+ case "string":
219
+ case "number":
220
+ invokeCallback = true;
221
+ break;
222
+ case "object":
223
+ switch (children.$$typeof) {
224
+ case REACT_ELEMENT_TYPE:
225
+ case REACT_PORTAL_TYPE:
226
+ invokeCallback = true;
227
+ break;
228
+ case REACT_LAZY_TYPE:
229
+ return (
230
+ (invokeCallback = children._init),
231
+ mapIntoArray(
232
+ invokeCallback(children._payload),
233
+ array,
234
+ escapedPrefix,
235
+ nameSoFar,
236
+ callback
237
+ )
238
+ );
239
+ }
240
+ }
241
+ if (invokeCallback)
242
+ return (
243
+ (callback = callback(children)),
244
+ (invokeCallback =
245
+ "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar),
246
+ isArrayImpl(callback)
247
+ ? ((escapedPrefix = ""),
248
+ null != invokeCallback &&
249
+ (escapedPrefix =
250
+ invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
251
+ mapIntoArray(callback, array, escapedPrefix, "", function (c) {
252
+ return c;
253
+ }))
254
+ : null != callback &&
255
+ (isValidElement(callback) &&
256
+ (callback = cloneAndReplaceKey(
257
+ callback,
258
+ escapedPrefix +
259
+ (null == callback.key ||
260
+ (children && children.key === callback.key)
261
+ ? ""
262
+ : ("" + callback.key).replace(
263
+ userProvidedKeyEscapeRegex,
264
+ "$&/"
265
+ ) + "/") +
266
+ invokeCallback
267
+ )),
268
+ array.push(callback)),
269
+ 1
270
+ );
271
+ invokeCallback = 0;
272
+ var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
273
+ if (isArrayImpl(children))
274
+ for (var i = 0; i < children.length; i++)
275
+ (nameSoFar = children[i]),
276
+ (type = nextNamePrefix + getElementKey(nameSoFar, i)),
277
+ (invokeCallback += mapIntoArray(
278
+ nameSoFar,
279
+ array,
280
+ escapedPrefix,
281
+ type,
282
+ callback
283
+ ));
284
+ else if (((i = getIteratorFn(children)), "function" === typeof i))
285
+ for (
286
+ children = i.call(children), i = 0;
287
+ !(nameSoFar = children.next()).done;
288
+
289
+ )
290
+ (nameSoFar = nameSoFar.value),
291
+ (type = nextNamePrefix + getElementKey(nameSoFar, i++)),
292
+ (invokeCallback += mapIntoArray(
293
+ nameSoFar,
294
+ array,
295
+ escapedPrefix,
296
+ type,
297
+ callback
298
+ ));
299
+ else if ("object" === type) {
300
+ if ("function" === typeof children.then)
301
+ return mapIntoArray(
302
+ resolveThenable(children),
303
+ array,
304
+ escapedPrefix,
305
+ nameSoFar,
306
+ callback
307
+ );
308
+ array = String(children);
309
+ throw Error(
310
+ "Objects are not valid as a React child (found: " +
311
+ ("[object Object]" === array
312
+ ? "object with keys {" + Object.keys(children).join(", ") + "}"
313
+ : array) +
314
+ "). If you meant to render a collection of children, use an array instead."
315
+ );
316
+ }
317
+ return invokeCallback;
318
+ }
319
+ function mapChildren(children, func, context) {
320
+ if (null == children) return children;
321
+ var result = [],
322
+ count = 0;
323
+ mapIntoArray(children, result, "", "", function (child) {
324
+ return func.call(context, child, count++);
325
+ });
326
+ return result;
327
+ }
328
+ function lazyInitializer(payload) {
329
+ if (-1 === payload._status) {
330
+ var ctor = payload._result;
331
+ ctor = ctor();
332
+ ctor.then(
333
+ function (moduleObject) {
334
+ if (0 === payload._status || -1 === payload._status)
335
+ (payload._status = 1), (payload._result = moduleObject);
336
+ },
337
+ function (error) {
338
+ if (0 === payload._status || -1 === payload._status)
339
+ (payload._status = 2), (payload._result = error);
340
+ }
341
+ );
342
+ -1 === payload._status && ((payload._status = 0), (payload._result = ctor));
343
+ }
344
+ if (1 === payload._status) return payload._result.default;
345
+ throw payload._result;
346
+ }
347
+ var reportGlobalError =
348
+ "function" === typeof reportError
349
+ ? reportError
350
+ : function (error) {
351
+ if (
352
+ "object" === typeof window &&
353
+ "function" === typeof window.ErrorEvent
354
+ ) {
355
+ var event = new window.ErrorEvent("error", {
356
+ bubbles: true,
357
+ cancelable: true,
358
+ message:
359
+ "object" === typeof error &&
360
+ null !== error &&
361
+ "string" === typeof error.message
362
+ ? String(error.message)
363
+ : String(error),
364
+ error: error
365
+ });
366
+ if (!window.dispatchEvent(event)) return;
367
+ } else if (
368
+ "object" === typeof process &&
369
+ "function" === typeof process.emit
370
+ ) {
371
+ process.emit("uncaughtException", error);
372
+ return;
373
+ }
374
+ console.error(error);
375
+ };
376
+ function noop() {}
377
+ react_production.Children = {
378
+ map: mapChildren,
379
+ forEach: function (children, forEachFunc, forEachContext) {
380
+ mapChildren(
381
+ children,
382
+ function () {
383
+ forEachFunc.apply(this, arguments);
384
+ },
385
+ forEachContext
386
+ );
387
+ },
388
+ count: function (children) {
389
+ var n = 0;
390
+ mapChildren(children, function () {
391
+ n++;
392
+ });
393
+ return n;
394
+ },
395
+ toArray: function (children) {
396
+ return (
397
+ mapChildren(children, function (child) {
398
+ return child;
399
+ }) || []
400
+ );
401
+ },
402
+ only: function (children) {
403
+ if (!isValidElement(children))
404
+ throw Error(
405
+ "React.Children.only expected to receive a single React element child."
406
+ );
407
+ return children;
408
+ }
409
+ };
410
+ react_production.Component = Component;
411
+ react_production.Fragment = REACT_FRAGMENT_TYPE;
412
+ react_production.Profiler = REACT_PROFILER_TYPE;
413
+ react_production.PureComponent = PureComponent;
414
+ react_production.StrictMode = REACT_STRICT_MODE_TYPE;
415
+ react_production.Suspense = REACT_SUSPENSE_TYPE;
416
+ react_production.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
417
+ ReactSharedInternals;
418
+ react_production.__COMPILER_RUNTIME = {
419
+ __proto__: null,
420
+ c: function (size) {
421
+ return ReactSharedInternals.H.useMemoCache(size);
422
+ }
423
+ };
424
+ react_production.cache = function (fn) {
425
+ return function () {
426
+ return fn.apply(null, arguments);
427
+ };
428
+ };
429
+ react_production.cloneElement = function (element, config, children) {
430
+ if (null === element || void 0 === element)
431
+ throw Error(
432
+ "The argument must be a React element, but you passed " + element + "."
433
+ );
434
+ var props = assign({}, element.props),
435
+ key = element.key,
436
+ owner = void 0;
437
+ if (null != config)
438
+ for (propName in (void 0 !== config.ref && (owner = void 0),
439
+ void 0 !== config.key && (key = "" + config.key),
440
+ config))
441
+ !hasOwnProperty.call(config, propName) ||
442
+ "key" === propName ||
443
+ "__self" === propName ||
444
+ "__source" === propName ||
445
+ ("ref" === propName && void 0 === config.ref) ||
446
+ (props[propName] = config[propName]);
447
+ var propName = arguments.length - 2;
448
+ if (1 === propName) props.children = children;
449
+ else if (1 < propName) {
450
+ for (var childArray = Array(propName), i = 0; i < propName; i++)
451
+ childArray[i] = arguments[i + 2];
452
+ props.children = childArray;
453
+ }
454
+ return ReactElement(element.type, key, void 0, void 0, owner, props);
455
+ };
456
+ react_production.createContext = function (defaultValue) {
457
+ defaultValue = {
458
+ $$typeof: REACT_CONTEXT_TYPE,
459
+ _currentValue: defaultValue,
460
+ _currentValue2: defaultValue,
461
+ _threadCount: 0,
462
+ Provider: null,
463
+ Consumer: null
464
+ };
465
+ defaultValue.Provider = defaultValue;
466
+ defaultValue.Consumer = {
467
+ $$typeof: REACT_CONSUMER_TYPE,
468
+ _context: defaultValue
469
+ };
470
+ return defaultValue;
471
+ };
472
+ react_production.createElement = function (type, config, children) {
473
+ var propName,
474
+ props = {},
475
+ key = null;
476
+ if (null != config)
477
+ for (propName in (void 0 !== config.key && (key = "" + config.key), config))
478
+ hasOwnProperty.call(config, propName) &&
479
+ "key" !== propName &&
480
+ "__self" !== propName &&
481
+ "__source" !== propName &&
482
+ (props[propName] = config[propName]);
483
+ var childrenLength = arguments.length - 2;
484
+ if (1 === childrenLength) props.children = children;
485
+ else if (1 < childrenLength) {
486
+ for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
487
+ childArray[i] = arguments[i + 2];
488
+ props.children = childArray;
489
+ }
490
+ if (type && type.defaultProps)
491
+ for (propName in ((childrenLength = type.defaultProps), childrenLength))
492
+ void 0 === props[propName] &&
493
+ (props[propName] = childrenLength[propName]);
494
+ return ReactElement(type, key, void 0, void 0, null, props);
495
+ };
496
+ react_production.createRef = function () {
497
+ return { current: null };
498
+ };
499
+ react_production.forwardRef = function (render) {
500
+ return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
501
+ };
502
+ react_production.isValidElement = isValidElement;
503
+ react_production.lazy = function (ctor) {
504
+ return {
505
+ $$typeof: REACT_LAZY_TYPE,
506
+ _payload: { _status: -1, _result: ctor },
507
+ _init: lazyInitializer
508
+ };
509
+ };
510
+ react_production.memo = function (type, compare) {
511
+ return {
512
+ $$typeof: REACT_MEMO_TYPE,
513
+ type: type,
514
+ compare: void 0 === compare ? null : compare
515
+ };
516
+ };
517
+ react_production.startTransition = function (scope) {
518
+ var prevTransition = ReactSharedInternals.T,
519
+ currentTransition = {};
520
+ ReactSharedInternals.T = currentTransition;
521
+ try {
522
+ var returnValue = scope(),
523
+ onStartTransitionFinish = ReactSharedInternals.S;
524
+ null !== onStartTransitionFinish &&
525
+ onStartTransitionFinish(currentTransition, returnValue);
526
+ "object" === typeof returnValue &&
527
+ null !== returnValue &&
528
+ "function" === typeof returnValue.then &&
529
+ returnValue.then(noop, reportGlobalError);
530
+ } catch (error) {
531
+ reportGlobalError(error);
532
+ } finally {
533
+ ReactSharedInternals.T = prevTransition;
534
+ }
535
+ };
536
+ react_production.unstable_useCacheRefresh = function () {
537
+ return ReactSharedInternals.H.useCacheRefresh();
538
+ };
539
+ react_production.use = function (usable) {
540
+ return ReactSharedInternals.H.use(usable);
541
+ };
542
+ react_production.useActionState = function (action, initialState, permalink) {
543
+ return ReactSharedInternals.H.useActionState(action, initialState, permalink);
544
+ };
545
+ react_production.useCallback = function (callback, deps) {
546
+ return ReactSharedInternals.H.useCallback(callback, deps);
547
+ };
548
+ react_production.useContext = function (Context) {
549
+ return ReactSharedInternals.H.useContext(Context);
550
+ };
551
+ react_production.useDebugValue = function () {};
552
+ react_production.useDeferredValue = function (value, initialValue) {
553
+ return ReactSharedInternals.H.useDeferredValue(value, initialValue);
554
+ };
555
+ react_production.useEffect = function (create, createDeps, update) {
556
+ var dispatcher = ReactSharedInternals.H;
557
+ if ("function" === typeof update)
558
+ throw Error(
559
+ "useEffect CRUD overload is not enabled in this build of React."
560
+ );
561
+ return dispatcher.useEffect(create, createDeps);
562
+ };
563
+ react_production.useId = function () {
564
+ return ReactSharedInternals.H.useId();
565
+ };
566
+ react_production.useImperativeHandle = function (ref, create, deps) {
567
+ return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
568
+ };
569
+ react_production.useInsertionEffect = function (create, deps) {
570
+ return ReactSharedInternals.H.useInsertionEffect(create, deps);
571
+ };
572
+ react_production.useLayoutEffect = function (create, deps) {
573
+ return ReactSharedInternals.H.useLayoutEffect(create, deps);
574
+ };
575
+ react_production.useMemo = function (create, deps) {
576
+ return ReactSharedInternals.H.useMemo(create, deps);
577
+ };
578
+ react_production.useOptimistic = function (passthrough, reducer) {
579
+ return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
580
+ };
581
+ react_production.useReducer = function (reducer, initialArg, init) {
582
+ return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
583
+ };
584
+ react_production.useRef = function (initialValue) {
585
+ return ReactSharedInternals.H.useRef(initialValue);
586
+ };
587
+ react_production.useState = function (initialState) {
588
+ return ReactSharedInternals.H.useState(initialState);
589
+ };
590
+ react_production.useSyncExternalStore = function (
591
+ subscribe,
592
+ getSnapshot,
593
+ getServerSnapshot
594
+ ) {
595
+ return ReactSharedInternals.H.useSyncExternalStore(
596
+ subscribe,
597
+ getSnapshot,
598
+ getServerSnapshot
599
+ );
600
+ };
601
+ react_production.useTransition = function () {
602
+ return ReactSharedInternals.H.useTransition();
603
+ };
604
+ react_production.version = "19.1.1";
605
+ return react_production;
606
+ }
607
+
608
+ var react_development = {exports: {}};
609
+
610
+ /**
611
+ * @license React
612
+ * react.development.js
613
+ *
614
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
615
+ *
616
+ * This source code is licensed under the MIT license found in the
617
+ * LICENSE file in the root directory of this source tree.
618
+ */
619
+ react_development.exports;
620
+
621
+ var hasRequiredReact_development;
622
+
623
+ function requireReact_development () {
624
+ if (hasRequiredReact_development) return react_development.exports;
625
+ hasRequiredReact_development = 1;
626
+ (function (module, exports) {
627
+ "production" !== process.env.NODE_ENV &&
628
+ (function () {
629
+ function defineDeprecationWarning(methodName, info) {
630
+ Object.defineProperty(Component.prototype, methodName, {
631
+ get: function () {
632
+ console.warn(
633
+ "%s(...) is deprecated in plain JavaScript React classes. %s",
634
+ info[0],
635
+ info[1]
636
+ );
637
+ }
638
+ });
639
+ }
640
+ function getIteratorFn(maybeIterable) {
641
+ if (null === maybeIterable || "object" !== typeof maybeIterable)
642
+ return null;
643
+ maybeIterable =
644
+ (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
645
+ maybeIterable["@@iterator"];
646
+ return "function" === typeof maybeIterable ? maybeIterable : null;
647
+ }
648
+ function warnNoop(publicInstance, callerName) {
649
+ publicInstance =
650
+ ((publicInstance = publicInstance.constructor) &&
651
+ (publicInstance.displayName || publicInstance.name)) ||
652
+ "ReactClass";
653
+ var warningKey = publicInstance + "." + callerName;
654
+ didWarnStateUpdateForUnmountedComponent[warningKey] ||
655
+ (console.error(
656
+ "Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",
657
+ callerName,
658
+ publicInstance
659
+ ),
660
+ (didWarnStateUpdateForUnmountedComponent[warningKey] = true));
661
+ }
662
+ function Component(props, context, updater) {
663
+ this.props = props;
664
+ this.context = context;
665
+ this.refs = emptyObject;
666
+ this.updater = updater || ReactNoopUpdateQueue;
667
+ }
668
+ function ComponentDummy() {}
669
+ function PureComponent(props, context, updater) {
670
+ this.props = props;
671
+ this.context = context;
672
+ this.refs = emptyObject;
673
+ this.updater = updater || ReactNoopUpdateQueue;
674
+ }
675
+ function testStringCoercion(value) {
676
+ return "" + value;
677
+ }
678
+ function checkKeyStringCoercion(value) {
679
+ try {
680
+ testStringCoercion(value);
681
+ var JSCompiler_inline_result = !1;
682
+ } catch (e) {
683
+ JSCompiler_inline_result = true;
684
+ }
685
+ if (JSCompiler_inline_result) {
686
+ JSCompiler_inline_result = console;
687
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
688
+ var JSCompiler_inline_result$jscomp$0 =
689
+ ("function" === typeof Symbol &&
690
+ Symbol.toStringTag &&
691
+ value[Symbol.toStringTag]) ||
692
+ value.constructor.name ||
693
+ "Object";
694
+ JSCompiler_temp_const.call(
695
+ JSCompiler_inline_result,
696
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
697
+ JSCompiler_inline_result$jscomp$0
698
+ );
699
+ return testStringCoercion(value);
700
+ }
701
+ }
702
+ function getComponentNameFromType(type) {
703
+ if (null == type) return null;
704
+ if ("function" === typeof type)
705
+ return type.$$typeof === REACT_CLIENT_REFERENCE
706
+ ? null
707
+ : type.displayName || type.name || null;
708
+ if ("string" === typeof type) return type;
709
+ switch (type) {
710
+ case REACT_FRAGMENT_TYPE:
711
+ return "Fragment";
712
+ case REACT_PROFILER_TYPE:
713
+ return "Profiler";
714
+ case REACT_STRICT_MODE_TYPE:
715
+ return "StrictMode";
716
+ case REACT_SUSPENSE_TYPE:
717
+ return "Suspense";
718
+ case REACT_SUSPENSE_LIST_TYPE:
719
+ return "SuspenseList";
720
+ case REACT_ACTIVITY_TYPE:
721
+ return "Activity";
722
+ }
723
+ if ("object" === typeof type)
724
+ switch (
725
+ ("number" === typeof type.tag &&
726
+ console.error(
727
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
728
+ ),
729
+ type.$$typeof)
730
+ ) {
731
+ case REACT_PORTAL_TYPE:
732
+ return "Portal";
733
+ case REACT_CONTEXT_TYPE:
734
+ return (type.displayName || "Context") + ".Provider";
735
+ case REACT_CONSUMER_TYPE:
736
+ return (type._context.displayName || "Context") + ".Consumer";
737
+ case REACT_FORWARD_REF_TYPE:
738
+ var innerType = type.render;
739
+ type = type.displayName;
740
+ type ||
741
+ ((type = innerType.displayName || innerType.name || ""),
742
+ (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
743
+ return type;
744
+ case REACT_MEMO_TYPE:
745
+ return (
746
+ (innerType = type.displayName || null),
747
+ null !== innerType
748
+ ? innerType
749
+ : getComponentNameFromType(type.type) || "Memo"
750
+ );
751
+ case REACT_LAZY_TYPE:
752
+ innerType = type._payload;
753
+ type = type._init;
754
+ try {
755
+ return getComponentNameFromType(type(innerType));
756
+ } catch (x) {}
757
+ }
758
+ return null;
759
+ }
760
+ function getTaskName(type) {
761
+ if (type === REACT_FRAGMENT_TYPE) return "<>";
762
+ if (
763
+ "object" === typeof type &&
764
+ null !== type &&
765
+ type.$$typeof === REACT_LAZY_TYPE
766
+ )
767
+ return "<...>";
768
+ try {
769
+ var name = getComponentNameFromType(type);
770
+ return name ? "<" + name + ">" : "<...>";
771
+ } catch (x) {
772
+ return "<...>";
773
+ }
774
+ }
775
+ function getOwner() {
776
+ var dispatcher = ReactSharedInternals.A;
777
+ return null === dispatcher ? null : dispatcher.getOwner();
778
+ }
779
+ function UnknownOwner() {
780
+ return Error("react-stack-top-frame");
781
+ }
782
+ function hasValidKey(config) {
783
+ if (hasOwnProperty.call(config, "key")) {
784
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
785
+ if (getter && getter.isReactWarning) return false;
786
+ }
787
+ return void 0 !== config.key;
788
+ }
789
+ function defineKeyPropWarningGetter(props, displayName) {
790
+ function warnAboutAccessingKey() {
791
+ specialPropKeyWarningShown ||
792
+ ((specialPropKeyWarningShown = true),
793
+ console.error(
794
+ "%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://react.dev/link/special-props)",
795
+ displayName
796
+ ));
797
+ }
798
+ warnAboutAccessingKey.isReactWarning = true;
799
+ Object.defineProperty(props, "key", {
800
+ get: warnAboutAccessingKey,
801
+ configurable: true
802
+ });
803
+ }
804
+ function elementRefGetterWithDeprecationWarning() {
805
+ var componentName = getComponentNameFromType(this.type);
806
+ didWarnAboutElementRef[componentName] ||
807
+ ((didWarnAboutElementRef[componentName] = true),
808
+ console.error(
809
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
810
+ ));
811
+ componentName = this.props.ref;
812
+ return void 0 !== componentName ? componentName : null;
813
+ }
814
+ function ReactElement(
815
+ type,
816
+ key,
817
+ self,
818
+ source,
819
+ owner,
820
+ props,
821
+ debugStack,
822
+ debugTask
823
+ ) {
824
+ self = props.ref;
825
+ type = {
826
+ $$typeof: REACT_ELEMENT_TYPE,
827
+ type: type,
828
+ key: key,
829
+ props: props,
830
+ _owner: owner
831
+ };
832
+ null !== (void 0 !== self ? self : null)
833
+ ? Object.defineProperty(type, "ref", {
834
+ enumerable: false,
835
+ get: elementRefGetterWithDeprecationWarning
836
+ })
837
+ : Object.defineProperty(type, "ref", { enumerable: false, value: null });
838
+ type._store = {};
839
+ Object.defineProperty(type._store, "validated", {
840
+ configurable: false,
841
+ enumerable: false,
842
+ writable: true,
843
+ value: 0
844
+ });
845
+ Object.defineProperty(type, "_debugInfo", {
846
+ configurable: false,
847
+ enumerable: false,
848
+ writable: true,
849
+ value: null
850
+ });
851
+ Object.defineProperty(type, "_debugStack", {
852
+ configurable: false,
853
+ enumerable: false,
854
+ writable: true,
855
+ value: debugStack
856
+ });
857
+ Object.defineProperty(type, "_debugTask", {
858
+ configurable: false,
859
+ enumerable: false,
860
+ writable: true,
861
+ value: debugTask
862
+ });
863
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
864
+ return type;
865
+ }
866
+ function cloneAndReplaceKey(oldElement, newKey) {
867
+ newKey = ReactElement(
868
+ oldElement.type,
869
+ newKey,
870
+ void 0,
871
+ void 0,
872
+ oldElement._owner,
873
+ oldElement.props,
874
+ oldElement._debugStack,
875
+ oldElement._debugTask
876
+ );
877
+ oldElement._store &&
878
+ (newKey._store.validated = oldElement._store.validated);
879
+ return newKey;
880
+ }
881
+ function isValidElement(object) {
882
+ return (
883
+ "object" === typeof object &&
884
+ null !== object &&
885
+ object.$$typeof === REACT_ELEMENT_TYPE
886
+ );
887
+ }
888
+ function escape(key) {
889
+ var escaperLookup = { "=": "=0", ":": "=2" };
890
+ return (
891
+ "$" +
892
+ key.replace(/[=:]/g, function (match) {
893
+ return escaperLookup[match];
894
+ })
895
+ );
896
+ }
897
+ function getElementKey(element, index) {
898
+ return "object" === typeof element &&
899
+ null !== element &&
900
+ null != element.key
901
+ ? (checkKeyStringCoercion(element.key), escape("" + element.key))
902
+ : index.toString(36);
903
+ }
904
+ function noop$1() {}
905
+ function resolveThenable(thenable) {
906
+ switch (thenable.status) {
907
+ case "fulfilled":
908
+ return thenable.value;
909
+ case "rejected":
910
+ throw thenable.reason;
911
+ default:
912
+ switch (
913
+ ("string" === typeof thenable.status
914
+ ? thenable.then(noop$1, noop$1)
915
+ : ((thenable.status = "pending"),
916
+ thenable.then(
917
+ function (fulfilledValue) {
918
+ "pending" === thenable.status &&
919
+ ((thenable.status = "fulfilled"),
920
+ (thenable.value = fulfilledValue));
921
+ },
922
+ function (error) {
923
+ "pending" === thenable.status &&
924
+ ((thenable.status = "rejected"),
925
+ (thenable.reason = error));
926
+ }
927
+ )),
928
+ thenable.status)
929
+ ) {
930
+ case "fulfilled":
931
+ return thenable.value;
932
+ case "rejected":
933
+ throw thenable.reason;
934
+ }
935
+ }
936
+ throw thenable;
937
+ }
938
+ function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
939
+ var type = typeof children;
940
+ if ("undefined" === type || "boolean" === type) children = null;
941
+ var invokeCallback = false;
942
+ if (null === children) invokeCallback = true;
943
+ else
944
+ switch (type) {
945
+ case "bigint":
946
+ case "string":
947
+ case "number":
948
+ invokeCallback = true;
949
+ break;
950
+ case "object":
951
+ switch (children.$$typeof) {
952
+ case REACT_ELEMENT_TYPE:
953
+ case REACT_PORTAL_TYPE:
954
+ invokeCallback = true;
955
+ break;
956
+ case REACT_LAZY_TYPE:
957
+ return (
958
+ (invokeCallback = children._init),
959
+ mapIntoArray(
960
+ invokeCallback(children._payload),
961
+ array,
962
+ escapedPrefix,
963
+ nameSoFar,
964
+ callback
965
+ )
966
+ );
967
+ }
968
+ }
969
+ if (invokeCallback) {
970
+ invokeCallback = children;
971
+ callback = callback(invokeCallback);
972
+ var childKey =
973
+ "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
974
+ isArrayImpl(callback)
975
+ ? ((escapedPrefix = ""),
976
+ null != childKey &&
977
+ (escapedPrefix =
978
+ childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
979
+ mapIntoArray(callback, array, escapedPrefix, "", function (c) {
980
+ return c;
981
+ }))
982
+ : null != callback &&
983
+ (isValidElement(callback) &&
984
+ (null != callback.key &&
985
+ ((invokeCallback && invokeCallback.key === callback.key) ||
986
+ checkKeyStringCoercion(callback.key)),
987
+ (escapedPrefix = cloneAndReplaceKey(
988
+ callback,
989
+ escapedPrefix +
990
+ (null == callback.key ||
991
+ (invokeCallback && invokeCallback.key === callback.key)
992
+ ? ""
993
+ : ("" + callback.key).replace(
994
+ userProvidedKeyEscapeRegex,
995
+ "$&/"
996
+ ) + "/") +
997
+ childKey
998
+ )),
999
+ "" !== nameSoFar &&
1000
+ null != invokeCallback &&
1001
+ isValidElement(invokeCallback) &&
1002
+ null == invokeCallback.key &&
1003
+ invokeCallback._store &&
1004
+ !invokeCallback._store.validated &&
1005
+ (escapedPrefix._store.validated = 2),
1006
+ (callback = escapedPrefix)),
1007
+ array.push(callback));
1008
+ return 1;
1009
+ }
1010
+ invokeCallback = 0;
1011
+ childKey = "" === nameSoFar ? "." : nameSoFar + ":";
1012
+ if (isArrayImpl(children))
1013
+ for (var i = 0; i < children.length; i++)
1014
+ (nameSoFar = children[i]),
1015
+ (type = childKey + getElementKey(nameSoFar, i)),
1016
+ (invokeCallback += mapIntoArray(
1017
+ nameSoFar,
1018
+ array,
1019
+ escapedPrefix,
1020
+ type,
1021
+ callback
1022
+ ));
1023
+ else if (((i = getIteratorFn(children)), "function" === typeof i))
1024
+ for (
1025
+ i === children.entries &&
1026
+ (didWarnAboutMaps ||
1027
+ console.warn(
1028
+ "Using Maps as children is not supported. Use an array of keyed ReactElements instead."
1029
+ ),
1030
+ (didWarnAboutMaps = true)),
1031
+ children = i.call(children),
1032
+ i = 0;
1033
+ !(nameSoFar = children.next()).done;
1034
+
1035
+ )
1036
+ (nameSoFar = nameSoFar.value),
1037
+ (type = childKey + getElementKey(nameSoFar, i++)),
1038
+ (invokeCallback += mapIntoArray(
1039
+ nameSoFar,
1040
+ array,
1041
+ escapedPrefix,
1042
+ type,
1043
+ callback
1044
+ ));
1045
+ else if ("object" === type) {
1046
+ if ("function" === typeof children.then)
1047
+ return mapIntoArray(
1048
+ resolveThenable(children),
1049
+ array,
1050
+ escapedPrefix,
1051
+ nameSoFar,
1052
+ callback
1053
+ );
1054
+ array = String(children);
1055
+ throw Error(
1056
+ "Objects are not valid as a React child (found: " +
1057
+ ("[object Object]" === array
1058
+ ? "object with keys {" + Object.keys(children).join(", ") + "}"
1059
+ : array) +
1060
+ "). If you meant to render a collection of children, use an array instead."
1061
+ );
1062
+ }
1063
+ return invokeCallback;
1064
+ }
1065
+ function mapChildren(children, func, context) {
1066
+ if (null == children) return children;
1067
+ var result = [],
1068
+ count = 0;
1069
+ mapIntoArray(children, result, "", "", function (child) {
1070
+ return func.call(context, child, count++);
1071
+ });
1072
+ return result;
1073
+ }
1074
+ function lazyInitializer(payload) {
1075
+ if (-1 === payload._status) {
1076
+ var ctor = payload._result;
1077
+ ctor = ctor();
1078
+ ctor.then(
1079
+ function (moduleObject) {
1080
+ if (0 === payload._status || -1 === payload._status)
1081
+ (payload._status = 1), (payload._result = moduleObject);
1082
+ },
1083
+ function (error) {
1084
+ if (0 === payload._status || -1 === payload._status)
1085
+ (payload._status = 2), (payload._result = error);
1086
+ }
1087
+ );
1088
+ -1 === payload._status &&
1089
+ ((payload._status = 0), (payload._result = ctor));
1090
+ }
1091
+ if (1 === payload._status)
1092
+ return (
1093
+ (ctor = payload._result),
1094
+ void 0 === ctor &&
1095
+ console.error(
1096
+ "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",
1097
+ ctor
1098
+ ),
1099
+ "default" in ctor ||
1100
+ console.error(
1101
+ "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",
1102
+ ctor
1103
+ ),
1104
+ ctor.default
1105
+ );
1106
+ throw payload._result;
1107
+ }
1108
+ function resolveDispatcher() {
1109
+ var dispatcher = ReactSharedInternals.H;
1110
+ null === dispatcher &&
1111
+ console.error(
1112
+ "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
1113
+ );
1114
+ return dispatcher;
1115
+ }
1116
+ function noop() {}
1117
+ function enqueueTask(task) {
1118
+ if (null === enqueueTaskImpl)
1119
+ try {
1120
+ var requireString = ("require" + Math.random()).slice(0, 7);
1121
+ enqueueTaskImpl = (module && module[requireString]).call(
1122
+ module,
1123
+ "timers"
1124
+ ).setImmediate;
1125
+ } catch (_err) {
1126
+ enqueueTaskImpl = function (callback) {
1127
+ false === didWarnAboutMessageChannel &&
1128
+ ((didWarnAboutMessageChannel = true),
1129
+ "undefined" === typeof MessageChannel &&
1130
+ console.error(
1131
+ "This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."
1132
+ ));
1133
+ var channel = new MessageChannel();
1134
+ channel.port1.onmessage = callback;
1135
+ channel.port2.postMessage(void 0);
1136
+ };
1137
+ }
1138
+ return enqueueTaskImpl(task);
1139
+ }
1140
+ function aggregateErrors(errors) {
1141
+ return 1 < errors.length && "function" === typeof AggregateError
1142
+ ? new AggregateError(errors)
1143
+ : errors[0];
1144
+ }
1145
+ function popActScope(prevActQueue, prevActScopeDepth) {
1146
+ prevActScopeDepth !== actScopeDepth - 1 &&
1147
+ console.error(
1148
+ "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
1149
+ );
1150
+ actScopeDepth = prevActScopeDepth;
1151
+ }
1152
+ function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
1153
+ var queue = ReactSharedInternals.actQueue;
1154
+ if (null !== queue)
1155
+ if (0 !== queue.length)
1156
+ try {
1157
+ flushActQueue(queue);
1158
+ enqueueTask(function () {
1159
+ return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
1160
+ });
1161
+ return;
1162
+ } catch (error) {
1163
+ ReactSharedInternals.thrownErrors.push(error);
1164
+ }
1165
+ else ReactSharedInternals.actQueue = null;
1166
+ 0 < ReactSharedInternals.thrownErrors.length
1167
+ ? ((queue = aggregateErrors(ReactSharedInternals.thrownErrors)),
1168
+ (ReactSharedInternals.thrownErrors.length = 0),
1169
+ reject(queue))
1170
+ : resolve(returnValue);
1171
+ }
1172
+ function flushActQueue(queue) {
1173
+ if (!isFlushing) {
1174
+ isFlushing = true;
1175
+ var i = 0;
1176
+ try {
1177
+ for (; i < queue.length; i++) {
1178
+ var callback = queue[i];
1179
+ do {
1180
+ ReactSharedInternals.didUsePromise = !1;
1181
+ var continuation = callback(!1);
1182
+ if (null !== continuation) {
1183
+ if (ReactSharedInternals.didUsePromise) {
1184
+ queue[i] = callback;
1185
+ queue.splice(0, i);
1186
+ return;
1187
+ }
1188
+ callback = continuation;
1189
+ } else break;
1190
+ } while (1);
1191
+ }
1192
+ queue.length = 0;
1193
+ } catch (error) {
1194
+ queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
1195
+ } finally {
1196
+ isFlushing = false;
1197
+ }
1198
+ }
1199
+ }
1200
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1201
+ "function" ===
1202
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
1203
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
1204
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
1205
+ REACT_PORTAL_TYPE = Symbol.for("react.portal"),
1206
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
1207
+ REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
1208
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler");
1209
+ var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
1210
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
1211
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
1212
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
1213
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
1214
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
1215
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
1216
+ REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
1217
+ MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
1218
+ didWarnStateUpdateForUnmountedComponent = {},
1219
+ ReactNoopUpdateQueue = {
1220
+ isMounted: function () {
1221
+ return false;
1222
+ },
1223
+ enqueueForceUpdate: function (publicInstance) {
1224
+ warnNoop(publicInstance, "forceUpdate");
1225
+ },
1226
+ enqueueReplaceState: function (publicInstance) {
1227
+ warnNoop(publicInstance, "replaceState");
1228
+ },
1229
+ enqueueSetState: function (publicInstance) {
1230
+ warnNoop(publicInstance, "setState");
1231
+ }
1232
+ },
1233
+ assign = Object.assign,
1234
+ emptyObject = {};
1235
+ Object.freeze(emptyObject);
1236
+ Component.prototype.isReactComponent = {};
1237
+ Component.prototype.setState = function (partialState, callback) {
1238
+ if (
1239
+ "object" !== typeof partialState &&
1240
+ "function" !== typeof partialState &&
1241
+ null != partialState
1242
+ )
1243
+ throw Error(
1244
+ "takes an object of state variables to update or a function which returns an object of state variables."
1245
+ );
1246
+ this.updater.enqueueSetState(this, partialState, callback, "setState");
1247
+ };
1248
+ Component.prototype.forceUpdate = function (callback) {
1249
+ this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
1250
+ };
1251
+ var deprecatedAPIs = {
1252
+ isMounted: [
1253
+ "isMounted",
1254
+ "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
1255
+ ],
1256
+ replaceState: [
1257
+ "replaceState",
1258
+ "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
1259
+ ]
1260
+ },
1261
+ fnName;
1262
+ for (fnName in deprecatedAPIs)
1263
+ deprecatedAPIs.hasOwnProperty(fnName) &&
1264
+ defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
1265
+ ComponentDummy.prototype = Component.prototype;
1266
+ deprecatedAPIs = PureComponent.prototype = new ComponentDummy();
1267
+ deprecatedAPIs.constructor = PureComponent;
1268
+ assign(deprecatedAPIs, Component.prototype);
1269
+ deprecatedAPIs.isPureReactComponent = true;
1270
+ var isArrayImpl = Array.isArray,
1271
+ REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
1272
+ ReactSharedInternals = {
1273
+ H: null,
1274
+ A: null,
1275
+ T: null,
1276
+ S: null,
1277
+ V: null,
1278
+ actQueue: null,
1279
+ isBatchingLegacy: false,
1280
+ didScheduleLegacyUpdate: false,
1281
+ didUsePromise: false,
1282
+ thrownErrors: [],
1283
+ getCurrentStack: null,
1284
+ recentlyCreatedOwnerStacks: 0
1285
+ },
1286
+ hasOwnProperty = Object.prototype.hasOwnProperty,
1287
+ createTask = console.createTask
1288
+ ? console.createTask
1289
+ : function () {
1290
+ return null;
1291
+ };
1292
+ deprecatedAPIs = {
1293
+ react_stack_bottom_frame: function (callStackForError) {
1294
+ return callStackForError();
1295
+ }
1296
+ };
1297
+ var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
1298
+ var didWarnAboutElementRef = {};
1299
+ var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(
1300
+ deprecatedAPIs,
1301
+ UnknownOwner
1302
+ )();
1303
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
1304
+ var didWarnAboutMaps = false,
1305
+ userProvidedKeyEscapeRegex = /\/+/g,
1306
+ reportGlobalError =
1307
+ "function" === typeof reportError
1308
+ ? reportError
1309
+ : function (error) {
1310
+ if (
1311
+ "object" === typeof window &&
1312
+ "function" === typeof window.ErrorEvent
1313
+ ) {
1314
+ var event = new window.ErrorEvent("error", {
1315
+ bubbles: true,
1316
+ cancelable: true,
1317
+ message:
1318
+ "object" === typeof error &&
1319
+ null !== error &&
1320
+ "string" === typeof error.message
1321
+ ? String(error.message)
1322
+ : String(error),
1323
+ error: error
1324
+ });
1325
+ if (!window.dispatchEvent(event)) return;
1326
+ } else if (
1327
+ "object" === typeof process &&
1328
+ "function" === typeof process.emit
1329
+ ) {
1330
+ process.emit("uncaughtException", error);
1331
+ return;
1332
+ }
1333
+ console.error(error);
1334
+ },
1335
+ didWarnAboutMessageChannel = false,
1336
+ enqueueTaskImpl = null,
1337
+ actScopeDepth = 0,
1338
+ didWarnNoAwaitAct = false,
1339
+ isFlushing = false,
1340
+ queueSeveralMicrotasks =
1341
+ "function" === typeof queueMicrotask
1342
+ ? function (callback) {
1343
+ queueMicrotask(function () {
1344
+ return queueMicrotask(callback);
1345
+ });
1346
+ }
1347
+ : enqueueTask;
1348
+ deprecatedAPIs = Object.freeze({
1349
+ __proto__: null,
1350
+ c: function (size) {
1351
+ return resolveDispatcher().useMemoCache(size);
1352
+ }
1353
+ });
1354
+ exports.Children = {
1355
+ map: mapChildren,
1356
+ forEach: function (children, forEachFunc, forEachContext) {
1357
+ mapChildren(
1358
+ children,
1359
+ function () {
1360
+ forEachFunc.apply(this, arguments);
1361
+ },
1362
+ forEachContext
1363
+ );
1364
+ },
1365
+ count: function (children) {
1366
+ var n = 0;
1367
+ mapChildren(children, function () {
1368
+ n++;
1369
+ });
1370
+ return n;
1371
+ },
1372
+ toArray: function (children) {
1373
+ return (
1374
+ mapChildren(children, function (child) {
1375
+ return child;
1376
+ }) || []
1377
+ );
1378
+ },
1379
+ only: function (children) {
1380
+ if (!isValidElement(children))
1381
+ throw Error(
1382
+ "React.Children.only expected to receive a single React element child."
1383
+ );
1384
+ return children;
1385
+ }
1386
+ };
1387
+ exports.Component = Component;
1388
+ exports.Fragment = REACT_FRAGMENT_TYPE;
1389
+ exports.Profiler = REACT_PROFILER_TYPE;
1390
+ exports.PureComponent = PureComponent;
1391
+ exports.StrictMode = REACT_STRICT_MODE_TYPE;
1392
+ exports.Suspense = REACT_SUSPENSE_TYPE;
1393
+ exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
1394
+ ReactSharedInternals;
1395
+ exports.__COMPILER_RUNTIME = deprecatedAPIs;
1396
+ exports.act = function (callback) {
1397
+ var prevActQueue = ReactSharedInternals.actQueue,
1398
+ prevActScopeDepth = actScopeDepth;
1399
+ actScopeDepth++;
1400
+ var queue = (ReactSharedInternals.actQueue =
1401
+ null !== prevActQueue ? prevActQueue : []),
1402
+ didAwaitActCall = false;
1403
+ try {
1404
+ var result = callback();
1405
+ } catch (error) {
1406
+ ReactSharedInternals.thrownErrors.push(error);
1407
+ }
1408
+ if (0 < ReactSharedInternals.thrownErrors.length)
1409
+ throw (
1410
+ (popActScope(prevActQueue, prevActScopeDepth),
1411
+ (callback = aggregateErrors(ReactSharedInternals.thrownErrors)),
1412
+ (ReactSharedInternals.thrownErrors.length = 0),
1413
+ callback)
1414
+ );
1415
+ if (
1416
+ null !== result &&
1417
+ "object" === typeof result &&
1418
+ "function" === typeof result.then
1419
+ ) {
1420
+ var thenable = result;
1421
+ queueSeveralMicrotasks(function () {
1422
+ didAwaitActCall ||
1423
+ didWarnNoAwaitAct ||
1424
+ ((didWarnNoAwaitAct = true),
1425
+ console.error(
1426
+ "You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"
1427
+ ));
1428
+ });
1429
+ return {
1430
+ then: function (resolve, reject) {
1431
+ didAwaitActCall = true;
1432
+ thenable.then(
1433
+ function (returnValue) {
1434
+ popActScope(prevActQueue, prevActScopeDepth);
1435
+ if (0 === prevActScopeDepth) {
1436
+ try {
1437
+ flushActQueue(queue),
1438
+ enqueueTask(function () {
1439
+ return recursivelyFlushAsyncActWork(
1440
+ returnValue,
1441
+ resolve,
1442
+ reject
1443
+ );
1444
+ });
1445
+ } catch (error$0) {
1446
+ ReactSharedInternals.thrownErrors.push(error$0);
1447
+ }
1448
+ if (0 < ReactSharedInternals.thrownErrors.length) {
1449
+ var _thrownError = aggregateErrors(
1450
+ ReactSharedInternals.thrownErrors
1451
+ );
1452
+ ReactSharedInternals.thrownErrors.length = 0;
1453
+ reject(_thrownError);
1454
+ }
1455
+ } else resolve(returnValue);
1456
+ },
1457
+ function (error) {
1458
+ popActScope(prevActQueue, prevActScopeDepth);
1459
+ 0 < ReactSharedInternals.thrownErrors.length
1460
+ ? ((error = aggregateErrors(
1461
+ ReactSharedInternals.thrownErrors
1462
+ )),
1463
+ (ReactSharedInternals.thrownErrors.length = 0),
1464
+ reject(error))
1465
+ : reject(error);
1466
+ }
1467
+ );
1468
+ }
1469
+ };
1470
+ }
1471
+ var returnValue$jscomp$0 = result;
1472
+ popActScope(prevActQueue, prevActScopeDepth);
1473
+ 0 === prevActScopeDepth &&
1474
+ (flushActQueue(queue),
1475
+ 0 !== queue.length &&
1476
+ queueSeveralMicrotasks(function () {
1477
+ didAwaitActCall ||
1478
+ didWarnNoAwaitAct ||
1479
+ ((didWarnNoAwaitAct = true),
1480
+ console.error(
1481
+ "A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"
1482
+ ));
1483
+ }),
1484
+ (ReactSharedInternals.actQueue = null));
1485
+ if (0 < ReactSharedInternals.thrownErrors.length)
1486
+ throw (
1487
+ ((callback = aggregateErrors(ReactSharedInternals.thrownErrors)),
1488
+ (ReactSharedInternals.thrownErrors.length = 0),
1489
+ callback)
1490
+ );
1491
+ return {
1492
+ then: function (resolve, reject) {
1493
+ didAwaitActCall = true;
1494
+ 0 === prevActScopeDepth
1495
+ ? ((ReactSharedInternals.actQueue = queue),
1496
+ enqueueTask(function () {
1497
+ return recursivelyFlushAsyncActWork(
1498
+ returnValue$jscomp$0,
1499
+ resolve,
1500
+ reject
1501
+ );
1502
+ }))
1503
+ : resolve(returnValue$jscomp$0);
1504
+ }
1505
+ };
1506
+ };
1507
+ exports.cache = function (fn) {
1508
+ return function () {
1509
+ return fn.apply(null, arguments);
1510
+ };
1511
+ };
1512
+ exports.captureOwnerStack = function () {
1513
+ var getCurrentStack = ReactSharedInternals.getCurrentStack;
1514
+ return null === getCurrentStack ? null : getCurrentStack();
1515
+ };
1516
+ exports.cloneElement = function (element, config, children) {
1517
+ if (null === element || void 0 === element)
1518
+ throw Error(
1519
+ "The argument must be a React element, but you passed " +
1520
+ element +
1521
+ "."
1522
+ );
1523
+ var props = assign({}, element.props),
1524
+ key = element.key,
1525
+ owner = element._owner;
1526
+ if (null != config) {
1527
+ var JSCompiler_inline_result;
1528
+ a: {
1529
+ if (
1530
+ hasOwnProperty.call(config, "ref") &&
1531
+ (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(
1532
+ config,
1533
+ "ref"
1534
+ ).get) &&
1535
+ JSCompiler_inline_result.isReactWarning
1536
+ ) {
1537
+ JSCompiler_inline_result = false;
1538
+ break a;
1539
+ }
1540
+ JSCompiler_inline_result = void 0 !== config.ref;
1541
+ }
1542
+ JSCompiler_inline_result && (owner = getOwner());
1543
+ hasValidKey(config) &&
1544
+ (checkKeyStringCoercion(config.key), (key = "" + config.key));
1545
+ for (propName in config)
1546
+ !hasOwnProperty.call(config, propName) ||
1547
+ "key" === propName ||
1548
+ "__self" === propName ||
1549
+ "__source" === propName ||
1550
+ ("ref" === propName && void 0 === config.ref) ||
1551
+ (props[propName] = config[propName]);
1552
+ }
1553
+ var propName = arguments.length - 2;
1554
+ if (1 === propName) props.children = children;
1555
+ else if (1 < propName) {
1556
+ JSCompiler_inline_result = Array(propName);
1557
+ for (var i = 0; i < propName; i++)
1558
+ JSCompiler_inline_result[i] = arguments[i + 2];
1559
+ props.children = JSCompiler_inline_result;
1560
+ }
1561
+ props = ReactElement(
1562
+ element.type,
1563
+ key,
1564
+ void 0,
1565
+ void 0,
1566
+ owner,
1567
+ props,
1568
+ element._debugStack,
1569
+ element._debugTask
1570
+ );
1571
+ for (key = 2; key < arguments.length; key++)
1572
+ (owner = arguments[key]),
1573
+ isValidElement(owner) && owner._store && (owner._store.validated = 1);
1574
+ return props;
1575
+ };
1576
+ exports.createContext = function (defaultValue) {
1577
+ defaultValue = {
1578
+ $$typeof: REACT_CONTEXT_TYPE,
1579
+ _currentValue: defaultValue,
1580
+ _currentValue2: defaultValue,
1581
+ _threadCount: 0,
1582
+ Provider: null,
1583
+ Consumer: null
1584
+ };
1585
+ defaultValue.Provider = defaultValue;
1586
+ defaultValue.Consumer = {
1587
+ $$typeof: REACT_CONSUMER_TYPE,
1588
+ _context: defaultValue
1589
+ };
1590
+ defaultValue._currentRenderer = null;
1591
+ defaultValue._currentRenderer2 = null;
1592
+ return defaultValue;
1593
+ };
1594
+ exports.createElement = function (type, config, children) {
1595
+ for (var i = 2; i < arguments.length; i++) {
1596
+ var node = arguments[i];
1597
+ isValidElement(node) && node._store && (node._store.validated = 1);
1598
+ }
1599
+ i = {};
1600
+ node = null;
1601
+ if (null != config)
1602
+ for (propName in (didWarnAboutOldJSXRuntime ||
1603
+ !("__self" in config) ||
1604
+ "key" in config ||
1605
+ ((didWarnAboutOldJSXRuntime = true),
1606
+ console.warn(
1607
+ "Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
1608
+ )),
1609
+ hasValidKey(config) &&
1610
+ (checkKeyStringCoercion(config.key), (node = "" + config.key)),
1611
+ config))
1612
+ hasOwnProperty.call(config, propName) &&
1613
+ "key" !== propName &&
1614
+ "__self" !== propName &&
1615
+ "__source" !== propName &&
1616
+ (i[propName] = config[propName]);
1617
+ var childrenLength = arguments.length - 2;
1618
+ if (1 === childrenLength) i.children = children;
1619
+ else if (1 < childrenLength) {
1620
+ for (
1621
+ var childArray = Array(childrenLength), _i = 0;
1622
+ _i < childrenLength;
1623
+ _i++
1624
+ )
1625
+ childArray[_i] = arguments[_i + 2];
1626
+ Object.freeze && Object.freeze(childArray);
1627
+ i.children = childArray;
1628
+ }
1629
+ if (type && type.defaultProps)
1630
+ for (propName in ((childrenLength = type.defaultProps), childrenLength))
1631
+ void 0 === i[propName] && (i[propName] = childrenLength[propName]);
1632
+ node &&
1633
+ defineKeyPropWarningGetter(
1634
+ i,
1635
+ "function" === typeof type
1636
+ ? type.displayName || type.name || "Unknown"
1637
+ : type
1638
+ );
1639
+ var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
1640
+ return ReactElement(
1641
+ type,
1642
+ node,
1643
+ void 0,
1644
+ void 0,
1645
+ getOwner(),
1646
+ i,
1647
+ propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
1648
+ propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
1649
+ );
1650
+ };
1651
+ exports.createRef = function () {
1652
+ var refObject = { current: null };
1653
+ Object.seal(refObject);
1654
+ return refObject;
1655
+ };
1656
+ exports.forwardRef = function (render) {
1657
+ null != render && render.$$typeof === REACT_MEMO_TYPE
1658
+ ? console.error(
1659
+ "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
1660
+ )
1661
+ : "function" !== typeof render
1662
+ ? console.error(
1663
+ "forwardRef requires a render function but was given %s.",
1664
+ null === render ? "null" : typeof render
1665
+ )
1666
+ : 0 !== render.length &&
1667
+ 2 !== render.length &&
1668
+ console.error(
1669
+ "forwardRef render functions accept exactly two parameters: props and ref. %s",
1670
+ 1 === render.length
1671
+ ? "Did you forget to use the ref parameter?"
1672
+ : "Any additional parameter will be undefined."
1673
+ );
1674
+ null != render &&
1675
+ null != render.defaultProps &&
1676
+ console.error(
1677
+ "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
1678
+ );
1679
+ var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render: render },
1680
+ ownName;
1681
+ Object.defineProperty(elementType, "displayName", {
1682
+ enumerable: false,
1683
+ configurable: true,
1684
+ get: function () {
1685
+ return ownName;
1686
+ },
1687
+ set: function (name) {
1688
+ ownName = name;
1689
+ render.name ||
1690
+ render.displayName ||
1691
+ (Object.defineProperty(render, "name", { value: name }),
1692
+ (render.displayName = name));
1693
+ }
1694
+ });
1695
+ return elementType;
1696
+ };
1697
+ exports.isValidElement = isValidElement;
1698
+ exports.lazy = function (ctor) {
1699
+ return {
1700
+ $$typeof: REACT_LAZY_TYPE,
1701
+ _payload: { _status: -1, _result: ctor },
1702
+ _init: lazyInitializer
1703
+ };
1704
+ };
1705
+ exports.memo = function (type, compare) {
1706
+ null == type &&
1707
+ console.error(
1708
+ "memo: The first argument must be a component. Instead received: %s",
1709
+ null === type ? "null" : typeof type
1710
+ );
1711
+ compare = {
1712
+ $$typeof: REACT_MEMO_TYPE,
1713
+ type: type,
1714
+ compare: void 0 === compare ? null : compare
1715
+ };
1716
+ var ownName;
1717
+ Object.defineProperty(compare, "displayName", {
1718
+ enumerable: false,
1719
+ configurable: true,
1720
+ get: function () {
1721
+ return ownName;
1722
+ },
1723
+ set: function (name) {
1724
+ ownName = name;
1725
+ type.name ||
1726
+ type.displayName ||
1727
+ (Object.defineProperty(type, "name", { value: name }),
1728
+ (type.displayName = name));
1729
+ }
1730
+ });
1731
+ return compare;
1732
+ };
1733
+ exports.startTransition = function (scope) {
1734
+ var prevTransition = ReactSharedInternals.T,
1735
+ currentTransition = {};
1736
+ ReactSharedInternals.T = currentTransition;
1737
+ currentTransition._updatedFibers = new Set();
1738
+ try {
1739
+ var returnValue = scope(),
1740
+ onStartTransitionFinish = ReactSharedInternals.S;
1741
+ null !== onStartTransitionFinish &&
1742
+ onStartTransitionFinish(currentTransition, returnValue);
1743
+ "object" === typeof returnValue &&
1744
+ null !== returnValue &&
1745
+ "function" === typeof returnValue.then &&
1746
+ returnValue.then(noop, reportGlobalError);
1747
+ } catch (error) {
1748
+ reportGlobalError(error);
1749
+ } finally {
1750
+ null === prevTransition &&
1751
+ currentTransition._updatedFibers &&
1752
+ ((scope = currentTransition._updatedFibers.size),
1753
+ currentTransition._updatedFibers.clear(),
1754
+ 10 < scope &&
1755
+ console.warn(
1756
+ "Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."
1757
+ )),
1758
+ (ReactSharedInternals.T = prevTransition);
1759
+ }
1760
+ };
1761
+ exports.unstable_useCacheRefresh = function () {
1762
+ return resolveDispatcher().useCacheRefresh();
1763
+ };
1764
+ exports.use = function (usable) {
1765
+ return resolveDispatcher().use(usable);
1766
+ };
1767
+ exports.useActionState = function (action, initialState, permalink) {
1768
+ return resolveDispatcher().useActionState(
1769
+ action,
1770
+ initialState,
1771
+ permalink
1772
+ );
1773
+ };
1774
+ exports.useCallback = function (callback, deps) {
1775
+ return resolveDispatcher().useCallback(callback, deps);
1776
+ };
1777
+ exports.useContext = function (Context) {
1778
+ var dispatcher = resolveDispatcher();
1779
+ Context.$$typeof === REACT_CONSUMER_TYPE &&
1780
+ console.error(
1781
+ "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
1782
+ );
1783
+ return dispatcher.useContext(Context);
1784
+ };
1785
+ exports.useDebugValue = function (value, formatterFn) {
1786
+ return resolveDispatcher().useDebugValue(value, formatterFn);
1787
+ };
1788
+ exports.useDeferredValue = function (value, initialValue) {
1789
+ return resolveDispatcher().useDeferredValue(value, initialValue);
1790
+ };
1791
+ exports.useEffect = function (create, createDeps, update) {
1792
+ null == create &&
1793
+ console.warn(
1794
+ "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1795
+ );
1796
+ var dispatcher = resolveDispatcher();
1797
+ if ("function" === typeof update)
1798
+ throw Error(
1799
+ "useEffect CRUD overload is not enabled in this build of React."
1800
+ );
1801
+ return dispatcher.useEffect(create, createDeps);
1802
+ };
1803
+ exports.useId = function () {
1804
+ return resolveDispatcher().useId();
1805
+ };
1806
+ exports.useImperativeHandle = function (ref, create, deps) {
1807
+ return resolveDispatcher().useImperativeHandle(ref, create, deps);
1808
+ };
1809
+ exports.useInsertionEffect = function (create, deps) {
1810
+ null == create &&
1811
+ console.warn(
1812
+ "React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1813
+ );
1814
+ return resolveDispatcher().useInsertionEffect(create, deps);
1815
+ };
1816
+ exports.useLayoutEffect = function (create, deps) {
1817
+ null == create &&
1818
+ console.warn(
1819
+ "React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
1820
+ );
1821
+ return resolveDispatcher().useLayoutEffect(create, deps);
1822
+ };
1823
+ exports.useMemo = function (create, deps) {
1824
+ return resolveDispatcher().useMemo(create, deps);
1825
+ };
1826
+ exports.useOptimistic = function (passthrough, reducer) {
1827
+ return resolveDispatcher().useOptimistic(passthrough, reducer);
1828
+ };
1829
+ exports.useReducer = function (reducer, initialArg, init) {
1830
+ return resolveDispatcher().useReducer(reducer, initialArg, init);
1831
+ };
1832
+ exports.useRef = function (initialValue) {
1833
+ return resolveDispatcher().useRef(initialValue);
1834
+ };
1835
+ exports.useState = function (initialState) {
1836
+ return resolveDispatcher().useState(initialState);
1837
+ };
1838
+ exports.useSyncExternalStore = function (
1839
+ subscribe,
1840
+ getSnapshot,
1841
+ getServerSnapshot
1842
+ ) {
1843
+ return resolveDispatcher().useSyncExternalStore(
1844
+ subscribe,
1845
+ getSnapshot,
1846
+ getServerSnapshot
1847
+ );
1848
+ };
1849
+ exports.useTransition = function () {
1850
+ return resolveDispatcher().useTransition();
1851
+ };
1852
+ exports.version = "19.1.1";
1853
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1854
+ "function" ===
1855
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
1856
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1857
+ })();
1858
+ } (react_development, react_development.exports));
1859
+ return react_development.exports;
1860
+ }
1861
+
1862
+ if (process.env.NODE_ENV === 'production') {
1863
+ react.exports = requireReact_production();
1864
+ } else {
1865
+ react.exports = requireReact_development();
1866
+ }
1867
+
1868
+ var reactExports = react.exports;
1869
+ var React = /*@__PURE__*/getDefaultExportFromCjs(reactExports);
1870
+
1871
+ const AttachmentPreview = ({ path, s3PathParser }) => {
1872
+ const mode = "light";
1873
+ const [iframeSrc, setIframeSrc] = reactExports.useState("");
1874
+ reactHooks.useMount(() => {
1875
+ s3PathParser(path).then((realPath) => {
1876
+ setIframeSrc(
1877
+ window.location.origin + "/api/proxy/kkfileview/onlinePreview?url=" + encodeURIComponent(jsBase64.Base64.encode(realPath))
1878
+ );
1879
+ });
1880
+ });
1881
+ if (!iframeSrc) return /* @__PURE__ */ React.createElement(antd.Spin, null);
1882
+ return /* @__PURE__ */ React.createElement(AttachmentPreviewInner, { iframeSrc, mode });
1883
+ };
1884
+ const styleId = "iframe-style-id";
1885
+ const AttachmentPreviewInner = ({ iframeSrc, mode }) => {
1886
+ const iframeRef = reactExports.useRef(null);
1887
+ const getStyleElement = reactExports.useCallback(() => {
1888
+ const iframe = iframeRef.current;
1889
+ if (!iframe) return;
1890
+ const iframeDocument = iframe.contentDocument || iframe.contentWindow?.document;
1891
+ if (!iframeDocument) return;
1892
+ let style = iframeDocument.getElementById(styleId);
1893
+ if (!style) {
1894
+ style = iframeDocument.createElement("style");
1895
+ style.id = styleId;
1896
+ iframeDocument.head.appendChild(style);
1897
+ }
1898
+ return style;
1899
+ }, []);
1900
+ const applyStyles = reactExports.useCallback(() => {
1901
+ const isDark = mode === "dark";
1902
+ const style = getStyleElement();
1903
+ if (!style) return;
1904
+ const iframe = iframeRef.current;
1905
+ if (!iframe) return;
1906
+ const iframeDocument = iframe.contentDocument || iframe.contentWindow?.document;
1907
+ if (!iframeDocument) return;
1908
+ const textData = iframeDocument.getElementById("textData");
1909
+ if (textData) {
1910
+ style.innerHTML = `
1911
+ .panel-heading {
1912
+ display: none;
1913
+ }
1914
+ body, .container, .panel-heading, .panel-body, .divContent {
1915
+ background-color: ${isDark ? "#1F1F1F" : "#F5F5F5"} !important;
1916
+ color: ${isDark ? "rgba(255, 255, 255, 0.85)" : "rgba(0, 0, 0, 0.88)"} !important;
1917
+ }
1918
+ `;
1919
+ }
1920
+ }, [mode, getStyleElement]);
1921
+ reactExports.useEffect(() => {
1922
+ const iframe = iframeRef.current;
1923
+ if (!iframe) return;
1924
+ iframe.addEventListener("load", applyStyles);
1925
+ return () => iframe.removeEventListener("load", applyStyles);
1926
+ }, [iframeSrc]);
1927
+ reactExports.useEffect(() => {
1928
+ const iframe = iframeRef.current;
1929
+ if (!iframe) return;
1930
+ applyStyles();
1931
+ }, [applyStyles]);
1932
+ if (!iframeSrc) return null;
1933
+ return /* @__PURE__ */ React.createElement("iframe", { ref: iframeRef, src: iframeSrc, style: { width: "100%", height: "100%", border: "none" } });
1934
+ };
1935
+
1936
+ const AttachmentEditor = ({
1937
+ value,
1938
+ s3PathParser,
1939
+ uploadFunction,
1940
+ onChange,
1941
+ onPreview,
1942
+ disabled
1943
+ }) => {
1944
+ const file = reactExports.useMemo(() => value?.at(0), [value]);
1945
+ if (!file)
1946
+ return /* @__PURE__ */ React.createElement(
1947
+ ui.UploadList,
1948
+ {
1949
+ disabled,
1950
+ uploadFunction,
1951
+ maxCount: 1,
1952
+ onChange,
1953
+ onPreview
1954
+ }
1955
+ );
1956
+ else {
1957
+ if (!s3PathParser) throw new Error("[AttachmentEditor] s3PathParser is required");
1958
+ return /* @__PURE__ */ React.createElement("div", { style: { width: "100%", height: "100%", position: "relative" } }, /* @__PURE__ */ React.createElement(
1959
+ antd.Button,
1960
+ {
1961
+ color: "default",
1962
+ variant: "filled",
1963
+ shape: "circle",
1964
+ disabled,
1965
+ style: { position: "absolute", right: 10, top: 10, color: "var(--ant-color-text-secondary)" },
1966
+ size: "small",
1967
+ icon: /* @__PURE__ */ React.createElement(icons.DeleteOutlined, null),
1968
+ onClick: () => onChange?.([])
1969
+ }
1970
+ ), /* @__PURE__ */ React.createElement(AttachmentPreview, { path: file.path, s3PathParser }));
1971
+ }
1972
+ };
1973
+
1974
+ function findAvailablePosition(layout, newW, newH, cols = 12) {
1975
+ if (layout.length === 0) return { x: 0, y: 0 };
1976
+ const maxY = Math.max(...layout.map((item) => item.y + item.h), 0);
1977
+ for (let y = 0; y <= maxY + 10; y++) {
1978
+ for (let x = 0; x <= cols - newW; x++) {
1979
+ const newItem = { x, y, w: newW, h: newH };
1980
+ const overlap = layout.some((item) => isOverlap(item, newItem));
1981
+ if (!overlap) {
1982
+ return { x, y };
1983
+ }
1984
+ }
1985
+ }
1986
+ return { x: 0, y: maxY + 1 };
1987
+ }
1988
+ function isOverlap(a, b) {
1989
+ return !(a.x + a.w <= b.x || // a 在 b 左边
1990
+ b.x + b.w <= a.x || // b 在 a 左边
1991
+ a.y + a.h <= b.y || // a 在 b 上方
1992
+ b.y + b.h <= a.y);
1993
+ }
1994
+ function generateCrossDashedBase64(width, height, x, y, padding = 1) {
1995
+ const lineColor = "rgba(160, 160, 160, 0.25)";
1996
+ const lineWidth = 2;
1997
+ const dashPattern = [10, 5];
1998
+ const canvas = document.createElement("canvas");
1999
+ canvas.width = width;
2000
+ canvas.height = height;
2001
+ const ctx = canvas.getContext("2d");
2002
+ if (!ctx) return;
2003
+ ctx.strokeStyle = lineColor;
2004
+ ctx.lineWidth = lineWidth;
2005
+ ctx.setLineDash(dashPattern);
2006
+ const start = padding;
2007
+ const endX = x - padding;
2008
+ const endY = y - padding;
2009
+ ctx.beginPath();
2010
+ ctx.moveTo(start, start);
2011
+ ctx.lineTo(endX, start);
2012
+ ctx.moveTo(endX, start);
2013
+ ctx.lineTo(endX, endY);
2014
+ ctx.moveTo(endX, endY);
2015
+ ctx.lineTo(start, endY);
2016
+ ctx.moveTo(start, endY);
2017
+ ctx.lineTo(start, start);
2018
+ ctx.stroke();
2019
+ const base64 = canvas.toDataURL("image/png");
2020
+ return base64;
2021
+ }
2022
+
2023
+ const Dashboard = ({
2024
+ dashboardData,
2025
+ cols = 12,
2026
+ gapX = 10,
2027
+ gapY = 10,
2028
+ rowHeight = 50,
2029
+ children,
2030
+ onLayoutChange,
2031
+ onDrop,
2032
+ droppingItem,
2033
+ mode = "editable"
2034
+ }) => {
2035
+ const CustomReactGridLayout = reactExports.useMemo(() => ReactGridLayout.WidthProvider(ReactGridLayout), []);
2036
+ const innerOnLayoutChange = reactExports.useCallback(
2037
+ (layout) => {
2038
+ const layoutsBefore = dashboardData ?? [];
2039
+ if (layout.length !== layoutsBefore.length) return;
2040
+ const isStatic = layout.every((item, index) => lodash.isMatch(item, layoutsBefore[index]));
2041
+ if (isStatic) return;
2042
+ onLayoutChange?.(layout);
2043
+ },
2044
+ [dashboardData, onLayoutChange]
2045
+ );
2046
+ const gridImgRef = reactExports.useRef({
2047
+ width: 0,
2048
+ height: 0,
2049
+ gapX,
2050
+ gapY,
2051
+ url: ""
2052
+ });
2053
+ const containerRef = reactExports.useRef(null);
2054
+ const innerRef = reactExports.useRef(null);
2055
+ const [showScroll, setShowScroll] = reactExports.useState(false);
2056
+ const [resizing, setResizing] = reactExports.useState(false);
2057
+ const onDragStart = () => {
2058
+ const gridImg = gridImgRef.current;
2059
+ const widthProvider = innerRef.current;
2060
+ const elementRef = widthProvider?.elementRef?.current;
2061
+ if (!elementRef) return;
2062
+ setResizing(true);
2063
+ setShowScroll(true);
2064
+ const width = (elementRef.clientWidth - gapX) / cols;
2065
+ const height = rowHeight + gapY;
2066
+ const gX = width - gapX;
2067
+ const gY = rowHeight;
2068
+ let imageUrl = gridImg.url;
2069
+ if (gridImg.width !== width || gridImg.height !== height || gridImg.gapX !== gX || gridImg.gapY !== gY) {
2070
+ const imageBase64 = generateCrossDashedBase64(width, height, gX, gY);
2071
+ if (!imageBase64) return;
2072
+ imageUrl = imageBase64;
2073
+ gridImgRef.current = { width, height, gapX: gX, gapY: gY, url: imageBase64 };
2074
+ }
2075
+ elementRef.style.backgroundImage = `url(${imageUrl})`;
2076
+ elementRef.style.backgroundPosition = `${gapX}px ${gapY}px`;
2077
+ elementRef.style.backgroundSize = `${width}px ${height}px`;
2078
+ };
2079
+ const onDragStop = () => {
2080
+ const widthProvider = innerRef.current;
2081
+ const elementRef = widthProvider?.elementRef?.current;
2082
+ const container = containerRef.current;
2083
+ if (!elementRef || !container) return;
2084
+ setResizing(false);
2085
+ elementRef.style.backgroundImage = "";
2086
+ if (container.clientHeight < elementRef.clientHeight - 40) {
2087
+ setShowScroll(true);
2088
+ } else {
2089
+ setShowScroll(false);
2090
+ }
2091
+ };
2092
+ return /* @__PURE__ */ React.createElement("div", { className: `dashboard-container ${showScroll ? "show-scroll" : ""}`, ref: containerRef }, /* @__PURE__ */ React.createElement(
2093
+ CustomReactGridLayout,
2094
+ {
2095
+ isDroppable: true,
2096
+ onDrop: (...props) => {
2097
+ const widthProvider = innerRef.current;
2098
+ const elementRef = widthProvider?.elementRef?.current;
2099
+ elementRef.style.backgroundImage = "";
2100
+ onDrop?.(...props);
2101
+ },
2102
+ droppingItem,
2103
+ isDraggable: mode === "editable",
2104
+ ref: innerRef,
2105
+ className: `dashboard-layout ${resizing ? "dashboard-item-resizing" : ""}`,
2106
+ cols,
2107
+ rowHeight,
2108
+ margin: [gapX, gapY],
2109
+ containerPadding: [gapX, gapY],
2110
+ layout: dashboardData,
2111
+ useCSSTransforms: true,
2112
+ allowOverlap: false,
2113
+ onDragStart,
2114
+ onDragStop,
2115
+ onResizeStart: onDragStart,
2116
+ onResizeStop: onDragStop,
2117
+ resizeHandle: mode === "editable" && /* @__PURE__ */ React.createElement("div", { className: "resize-handle" }),
2118
+ style: { minHeight: "100%" },
2119
+ onLayoutChange: innerOnLayoutChange
2120
+ },
2121
+ children
2122
+ ));
2123
+ };
2124
+
2125
+ const DashboardItem = ({
2126
+ id,
2127
+ className = "",
2128
+ isActive = false,
2129
+ title,
2130
+ menuItems = [],
2131
+ children,
2132
+ style,
2133
+ onSelect,
2134
+ onMouseDown,
2135
+ onMouseUp,
2136
+ onMenuClick,
2137
+ mode = "editable"
2138
+ }, ref) => {
2139
+ const hasMenu = !!menuItems?.length;
2140
+ const titleInfo = reactExports.useMemo(() => {
2141
+ if (typeof title === "string") {
2142
+ return /* @__PURE__ */ React.createElement("span", { className: "title-text" }, title);
2143
+ } else {
2144
+ return title;
2145
+ }
2146
+ }, [title]);
2147
+ return /* @__PURE__ */ React.createElement(
2148
+ "div",
2149
+ {
2150
+ ref,
2151
+ className: `dashboard-item ${isActive ? "isActive" : ""} ${className} ${mode}`,
2152
+ style,
2153
+ onMouseDown: (e) => onSelect?.(e, id)
2154
+ },
2155
+ /* @__PURE__ */ React.createElement(antd.Flex, { className: `item-head`, onMouseDown, onMouseUp }, /* @__PURE__ */ React.createElement(antd.Flex, { className: "head-inner", align: "center", justify: "space-between" }, /* @__PURE__ */ React.createElement(antd.Flex, { className: "head-title", align: "center" }, titleInfo), hasMenu && mode === "editable" && /* @__PURE__ */ React.createElement(antd.Flex, { className: "head-menu" }, /* @__PURE__ */ React.createElement(
2156
+ antd.Dropdown,
2157
+ {
2158
+ trigger: ["click"],
2159
+ placement: "bottomRight",
2160
+ popupRender: (menu) => /* @__PURE__ */ React.createElement("div", { onMouseDown: (e) => e.stopPropagation(), onPointerDown: (e) => e.stopPropagation() }, menu),
2161
+ menu: {
2162
+ items: menuItems,
2163
+ onClick: (info) => {
2164
+ if (onMenuClick) onMenuClick(info, id);
2165
+ }
2166
+ }
2167
+ },
2168
+ /* @__PURE__ */ React.createElement(
2169
+ antd.Button,
2170
+ {
2171
+ type: "default",
2172
+ size: "small",
2173
+ icon: /* @__PURE__ */ React.createElement(icons.MoreOutlined, null),
2174
+ onMouseDown: (e) => {
2175
+ e.stopPropagation();
2176
+ if (onSelect) onSelect(e, id);
2177
+ }
2178
+ }
2179
+ )
2180
+ ))), mode === "editable" && /* @__PURE__ */ React.createElement("div", { className: `drag-icon` }, /* @__PURE__ */ React.createElement(icons.HolderOutlined, { rotate: 90 }))),
2181
+ /* @__PURE__ */ React.createElement(antd.Flex, { className: "item-body", align: "center", justify: "center" }, children)
2182
+ );
2183
+ };
2184
+ var DashboardItem$1 = reactExports.forwardRef(DashboardItem);
2185
+
2186
+ const { createUseContext, Provider: DetailsDrawerProvider } = reactHooks.createContextWithProvider(
2187
+ ({ uploadFunction, columnsData, onClick, onPreview }) => {
2188
+ return {
2189
+ uploadFunction,
2190
+ columnsData,
2191
+ onClick,
2192
+ onPreview
2193
+ };
2194
+ }
2195
+ );
2196
+ const useDetailsDrawerContext = createUseContext();
2197
+
2198
+ const RowLabel = ({ columnData }) => {
2199
+ const { onClick: onClickTab } = useDetailsDrawerContext();
2200
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, onClickTab ? /* @__PURE__ */ React.createElement("button", { className: "text-btn-container title-container", onClick: (e) => onClickTab(e, columnData.field) }, /* @__PURE__ */ React.createElement("div", { className: "icon-wrapper" }, /* @__PURE__ */ React.createElement(ui.IconFont, { name: core.TOOL_ICON[columnData.tool], size: 16, color: "#000" })), /* @__PURE__ */ React.createElement(antd.Typography.Text, { className: "text-content" }, columnData.title || ""), /* @__PURE__ */ React.createElement("div", { className: "arrow-icon" }, /* @__PURE__ */ React.createElement(icons.CaretDownOutlined, null))) : /* @__PURE__ */ React.createElement(antd.Flex, { align: "center", gap: 4, className: "title-container" }, /* @__PURE__ */ React.createElement("div", { className: "icon-wrapper" }, /* @__PURE__ */ React.createElement(ui.IconFont, { name: core.TOOL_ICON[columnData.tool], size: 16, color: "#000" })), /* @__PURE__ */ React.createElement(antd.Typography.Text, { className: "text-content" }, columnData.title || "")));
2201
+ };
2202
+
2203
+ const NormalAvatar = (props) => {
2204
+ const { id, name, avatar, request } = props;
2205
+ const backgroundColor = reactExports.useMemo(() => name === "\u65E0" ? "#D9D9D9" : core.getColorByStr(name?.slice(-2) || ""), [name]);
2206
+ return /* @__PURE__ */ React.createElement(antd.Flex, { align: "center", gap: 8 }, /* @__PURE__ */ React.createElement(
2207
+ antd.Popover,
2208
+ {
2209
+ content: id !== "-2" ? /* @__PURE__ */ React.createElement(ui.AvatarPopoverContent, { id, column: { request } }) : null,
2210
+ placement: "top",
2211
+ autoAdjustOverflow: false,
2212
+ mouseEnterDelay: 0.3,
2213
+ mouseLeaveDelay: 0.3,
2214
+ arrow: { pointAtCenter: true },
2215
+ getPopupContainer: () => document.body
2216
+ },
2217
+ /* @__PURE__ */ React.createElement(antd.Flex, { align: "center", gap: 4 }, avatar ? /* @__PURE__ */ React.createElement(antd.Avatar, { src: avatar }, name?.slice(-2)) : /* @__PURE__ */ React.createElement(antd.Avatar, { style: { backgroundColor } }, name?.slice(-2)), /* @__PURE__ */ React.createElement("span", null, name))
2218
+ ));
2219
+ };
2220
+ const FormAvatar = (props) => {
2221
+ return /* @__PURE__ */ React.createElement(antd.Flex, { align: "center", gap: 8, justify: "flex-start", wrap: "wrap" }, props.value?.map((item, index) => /* @__PURE__ */ React.createElement(NormalAvatar, { key: index, ...item, request: props.request })) || []);
2222
+ };
2223
+
2224
+ const FormDateTimePicker = ({
2225
+ value,
2226
+ onChange,
2227
+ format = "YYYY-MM-DD",
2228
+ placeholder,
2229
+ disabled
2230
+ }) => {
2231
+ const { baseFormat, showGmt8 } = core.parseDateFormat(format);
2232
+ const showTimeConfig = core.inferShowTimeFromFormat(baseFormat);
2233
+ return /* @__PURE__ */ React.createElement(
2234
+ antd.DatePicker,
2235
+ {
2236
+ value: value ? dayjs(value) : void 0,
2237
+ format: (date) => {
2238
+ if (!date) return "";
2239
+ const text = date.format(baseFormat);
2240
+ return showGmt8 ? `${text} (${core.TZ_LABEL})` : text;
2241
+ },
2242
+ placeholder: placeholder ?? (showGmt8 ? `${baseFormat} (${core.TZ_LABEL})` : baseFormat),
2243
+ showTime: showTimeConfig,
2244
+ disabled,
2245
+ style: { width: "100%" },
2246
+ onChange: (date) => {
2247
+ onChange?.(date?.format(baseFormat) ?? void 0);
2248
+ }
2249
+ }
2250
+ );
2251
+ };
2252
+
2253
+ const FormInputNumber = ({
2254
+ value,
2255
+ onChange,
2256
+ format = "one_decimal_decimal",
2257
+ placeholder,
2258
+ disabled
2259
+ }) => {
2260
+ const [focused, setFocused] = reactExports.useState(false);
2261
+ const [innerValue, setInnerValue] = reactExports.useState("");
2262
+ reactExports.useEffect(() => {
2263
+ if (!focused) {
2264
+ setInnerValue(core.formatValue(value ?? "", format));
2265
+ } else {
2266
+ setInnerValue(value?.toString() ?? "");
2267
+ }
2268
+ }, [value, focused, format]);
2269
+ const handleBlur = () => {
2270
+ setFocused(false);
2271
+ const num = Number(innerValue.replace(/,/g, "").replace("%", ""));
2272
+ onChange?.(Number.isNaN(num) ? void 0 : num);
2273
+ };
2274
+ return /* @__PURE__ */ React.createElement(
2275
+ antd.Input,
2276
+ {
2277
+ value: innerValue,
2278
+ placeholder,
2279
+ disabled,
2280
+ onFocus: () => {
2281
+ setFocused(true);
2282
+ setInnerValue(value?.toString() ?? "");
2283
+ },
2284
+ onBlur: handleBlur,
2285
+ onChange: (e) => {
2286
+ const val = e.target.value;
2287
+ setInnerValue(val);
2288
+ }
2289
+ }
2290
+ );
2291
+ };
2292
+
2293
+ ReactMonacoEditor.loader.config({
2294
+ paths: {
2295
+ // vs: '/monaco-assets/vs',
2296
+ }
2297
+ // 'vs/nls': { availableLanguages: { '*': 'zh-cn' } },
2298
+ });
2299
+ const JsonEditor = ({ value, onChange, dark, disabled }) => {
2300
+ const monacoRef = reactExports.useRef(null);
2301
+ const monacoEditorRef = reactExports.useRef(null);
2302
+ const format = reactExports.useCallback(() => {
2303
+ monacoEditorRef.current?.getAction("editor.action.formatDocument")?.run();
2304
+ }, []);
2305
+ const options = reactExports.useMemo(() => {
2306
+ return {
2307
+ lineNumbers: "off",
2308
+ minimap: { enabled: false },
2309
+ readOnly: !!disabled
2310
+ };
2311
+ }, [disabled]);
2312
+ return /* @__PURE__ */ React.createElement(
2313
+ ReactMonacoEditor,
2314
+ {
2315
+ height: "100%",
2316
+ width: "100%",
2317
+ defaultLanguage: "json",
2318
+ value,
2319
+ loading: /* @__PURE__ */ React.createElement(antd.Spin, null),
2320
+ theme: dark ? "vs-dark" : "light",
2321
+ onChange,
2322
+ options,
2323
+ beforeMount: (monaco) => {
2324
+ monacoRef.current = monaco;
2325
+ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
2326
+ validate: true,
2327
+ schemas: [
2328
+ {
2329
+ uri: "test-schema",
2330
+ fileMatch: ["*"],
2331
+ schema: {
2332
+ $schema: "http://json-schema.org/draft-07/schema#",
2333
+ type: "object"
2334
+ }
2335
+ }
2336
+ ]
2337
+ });
2338
+ format();
2339
+ },
2340
+ onMount: (monacoEditor) => {
2341
+ monacoEditorRef.current = monacoEditor;
2342
+ format();
2343
+ }
2344
+ }
2345
+ );
2346
+ };
2347
+
2348
+ const FormJsonEditor = (props) => {
2349
+ return /* @__PURE__ */ React.createElement(
2350
+ "div",
2351
+ {
2352
+ style: {
2353
+ minHeight: 100,
2354
+ height: 100,
2355
+ maxHeight: 200
2356
+ }
2357
+ },
2358
+ /* @__PURE__ */ React.createElement(JsonEditor, { ...props })
2359
+ );
2360
+ };
2361
+
2362
+ const FormLinkEdit = (props) => {
2363
+ return /* @__PURE__ */ React.createElement(ui.LinkEdit, { popoverStyles: { width: 440 }, placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9", ...props });
2364
+ };
2365
+
2366
+ const FormMultiSelect = (props) => {
2367
+ return /* @__PURE__ */ React.createElement(
2368
+ ui.Select,
2369
+ {
2370
+ width: 440,
2371
+ ...props,
2372
+ placeholder: props.placeholder || "\u8BF7\u9009\u62E9",
2373
+ multiple: true,
2374
+ tagAreaStyle: { cursor: "pointer" }
2375
+ }
2376
+ );
2377
+ };
2378
+
2379
+ const FormSingleSelect = (props) => {
2380
+ return /* @__PURE__ */ React.createElement(
2381
+ ui.Select,
2382
+ {
2383
+ width: 440,
2384
+ ...props,
2385
+ multiple: false,
2386
+ placeholder: props.placeholder || "\u8BF7\u9009\u62E9",
2387
+ tagAreaStyle: { cursor: "pointer" }
2388
+ }
2389
+ );
2390
+ };
2391
+
2392
+ const FormTimeLen = (props) => {
2393
+ const { value, onChange, ...fieldProps } = props;
2394
+ const [inner, setInner] = reactExports.useState("");
2395
+ reactExports.useEffect(() => {
2396
+ if (value === void 0 || value === null) {
2397
+ setInner("");
2398
+ } else {
2399
+ setInner(core.formatDuration(Number(value)));
2400
+ }
2401
+ }, [value]);
2402
+ return /* @__PURE__ */ React.createElement(
2403
+ antd.Input,
2404
+ {
2405
+ ...fieldProps,
2406
+ value: inner,
2407
+ onFocus: () => {
2408
+ setInner(value != null ? String(value) : "");
2409
+ },
2410
+ onChange: (e) => setInner(e.target.value),
2411
+ onBlur: () => {
2412
+ const seconds = Number(inner);
2413
+ if (!isNaN(seconds)) {
2414
+ onChange?.(seconds);
2415
+ setInner(core.formatTime(seconds));
2416
+ } else {
2417
+ setInner(value != null ? core.formatTime(Number(value)) : "");
2418
+ }
2419
+ }
2420
+ }
2421
+ );
2422
+ };
2423
+
2424
+ const FormUpload = (props) => {
2425
+ const { uploadFunction, onPreview } = useDetailsDrawerContext();
2426
+ const { format } = props;
2427
+ let accept = "";
2428
+ if (format === "image") accept = "image/*";
2429
+ if (format === "document")
2430
+ accept = "application/pdf,application/msword,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.presentationml.presentation";
2431
+ if (format === "video") accept = "video/*";
2432
+ return /* @__PURE__ */ React.createElement(
2433
+ ui.UploadList,
2434
+ {
2435
+ uploadFunction,
2436
+ maxCount: 1,
2437
+ accept,
2438
+ onPreview,
2439
+ ...props
2440
+ }
2441
+ );
2442
+ };
2443
+
2444
+ const FeatureRowFields = ({ currentColumn }) => {
2445
+ const { Component, isPure } = reactExports.useMemo(() => {
2446
+ let DefaultComponent = proComponents.ProFormText;
2447
+ let isPure2 = false;
2448
+ if (currentColumn.tool === 29) {
2449
+ DefaultComponent = FormSingleSelect;
2450
+ isPure2 = true;
2451
+ } else if (currentColumn.tool === 30) {
2452
+ DefaultComponent = FormMultiSelect;
2453
+ isPure2 = true;
2454
+ } else if (currentColumn.tool === 36) {
2455
+ DefaultComponent = FormDateTimePicker;
2456
+ isPure2 = true;
2457
+ } else if (currentColumn.tool === 31) {
2458
+ DefaultComponent = FormInputNumber;
2459
+ isPure2 = true;
2460
+ } else if (currentColumn.tool === 34) {
2461
+ DefaultComponent = FormJsonEditor;
2462
+ isPure2 = true;
2463
+ } else if (currentColumn.tool === 28) {
2464
+ DefaultComponent = proComponents.ProFormText;
2465
+ } else if (currentColumn.tool === 32) {
2466
+ DefaultComponent = FormUpload;
2467
+ isPure2 = true;
2468
+ } else if (currentColumn.tool === 35) {
2469
+ DefaultComponent = proComponents.ProFormText;
2470
+ } else if (currentColumn.tool === 33) {
2471
+ DefaultComponent = FormLinkEdit;
2472
+ isPure2 = true;
2473
+ } else if (currentColumn.tool === 39) {
2474
+ DefaultComponent = proComponents.ProFormText;
2475
+ } else if (currentColumn.tool === 37) {
2476
+ DefaultComponent = FormTimeLen;
2477
+ isPure2 = true;
2478
+ } else if (currentColumn.tool === 38) {
2479
+ DefaultComponent = FormAvatar;
2480
+ isPure2 = true;
2481
+ }
2482
+ return {
2483
+ Component: DefaultComponent,
2484
+ isPure: isPure2
2485
+ };
2486
+ }, [currentColumn.tool]);
2487
+ const props = {
2488
+ name: currentColumn.field,
2489
+ disabled: currentColumn.freeze,
2490
+ label: /* @__PURE__ */ React.createElement(RowLabel, { columnData: currentColumn })
2491
+ };
2492
+ const fieldProps = {
2493
+ options: currentColumn.options,
2494
+ format: currentColumn.fmt,
2495
+ disabled: currentColumn.freeze,
2496
+ request: currentColumn.request
2497
+ };
2498
+ if (currentColumn.tool === 39) {
2499
+ return null;
2500
+ }
2501
+ return isPure ? /* @__PURE__ */ React.createElement(proComponents.ProForm.Item, { key: currentColumn.field, ...props }, /* @__PURE__ */ React.createElement(Component, { ...fieldProps })) : /* @__PURE__ */ React.createElement(Component, { key: currentColumn.field, ...props, fieldProps });
2502
+ };
2503
+
2504
+ const FeatureRowField = ({ columnId, columnsData }) => {
2505
+ const currentColumn = reactExports.useMemo(() => {
2506
+ const value = columnsData.find((item) => item.field === columnId);
2507
+ return value;
2508
+ }, [columnsData, columnId]);
2509
+ if (!currentColumn) return null;
2510
+ return /* @__PURE__ */ React.createElement(FeatureRowFields, { currentColumn });
2511
+ };
2512
+
2513
+ const FeatureRowSkeleton = () => {
2514
+ return /* @__PURE__ */ React.createElement(antd.Flex, { align: "center", gap: 12, style: { padding: "8px 0" } }, /* @__PURE__ */ React.createElement(antd.Skeleton.Avatar, { active: true, size: "small", shape: "square" }), /* @__PURE__ */ React.createElement(antd.Skeleton.Input, { active: true, size: "small", style: { width: 80 } }), /* @__PURE__ */ React.createElement(antd.Skeleton.Input, { active: true, size: "small", style: { width: 240 } }));
2515
+ };
2516
+ const DrawerForm = ({ form, initialValues, columnsData, onChange, loading }) => {
2517
+ const debounceChange = reactHooks.useDebounce(onChange, 500);
2518
+ if (loading) {
2519
+ return /* @__PURE__ */ React.createElement(antd.Flex, { className: "info-card", gap: 12, vertical: true, style: { padding: 16, width: "100%" } }, Array.from({ length: 10 }).map((_, i) => /* @__PURE__ */ React.createElement(FeatureRowSkeleton, { key: i })));
2520
+ }
2521
+ return /* @__PURE__ */ React.createElement(
2522
+ proComponents.ProForm,
2523
+ {
2524
+ form,
2525
+ className: "row-setting-form",
2526
+ formKey: "row-setting-form",
2527
+ layout: "horizontal",
2528
+ style: { width: "100%" },
2529
+ submitter: {
2530
+ render: false
2531
+ },
2532
+ initialValues,
2533
+ onValuesChange: debounceChange
2534
+ },
2535
+ /* @__PURE__ */ React.createElement(antd.Flex, { className: "info-card", gap: 12, vertical: true }, Object.entries(initialValues).map(([key]) => /* @__PURE__ */ React.createElement(FeatureRowField, { key, columnId: key, columnsData })))
2536
+ );
2537
+ };
2538
+
2539
+ const DetailsDrawer = ({
2540
+ isOpen = false,
2541
+ width = "650px",
2542
+ placement = "right",
2543
+ className,
2544
+ form,
2545
+ initialValues,
2546
+ columnsData,
2547
+ defaultActiveKey,
2548
+ onClick,
2549
+ onChange,
2550
+ onClose,
2551
+ uploadFunction,
2552
+ onPreview,
2553
+ historyNode,
2554
+ closeIcon,
2555
+ loading,
2556
+ ...rest
2557
+ }) => {
2558
+ const tabItems = [
2559
+ {
2560
+ key: "detail",
2561
+ label: "\u8BE6\u60C5",
2562
+ children: /* @__PURE__ */ React.createElement(
2563
+ DrawerForm,
2564
+ {
2565
+ form,
2566
+ initialValues,
2567
+ columnsData,
2568
+ onChange,
2569
+ loading
2570
+ }
2571
+ )
2572
+ },
2573
+ { key: "history", label: "\u5386\u53F2", children: historyNode }
2574
+ ];
2575
+ return /* @__PURE__ */ React.createElement(
2576
+ DetailsDrawerProvider,
2577
+ {
2578
+ uploadFunction,
2579
+ onPreview,
2580
+ columnsData,
2581
+ onClick
2582
+ },
2583
+ /* @__PURE__ */ React.createElement(
2584
+ antd.Drawer,
2585
+ {
2586
+ ...rest,
2587
+ open: isOpen,
2588
+ onClose,
2589
+ closeIcon,
2590
+ width,
2591
+ placement,
2592
+ className: `custom-drawer ${className}`,
2593
+ style: {
2594
+ mask: "rgba(0,0,0,0)"
2595
+ },
2596
+ styles: {
2597
+ body: {
2598
+ padding: 0,
2599
+ overflow: "hidden"
2600
+ }
2601
+ }
2602
+ },
2603
+ /* @__PURE__ */ React.createElement(antd.Flex, { vertical: true, onClick: (e) => e.stopPropagation(), style: { height: "100%" } }, /* @__PURE__ */ React.createElement("div", { className: "drawer-header-container" }, /* @__PURE__ */ React.createElement(
2604
+ antd.Tabs,
2605
+ {
2606
+ defaultActiveKey,
2607
+ items: tabItems,
2608
+ className: "custom-tabs",
2609
+ style: { height: "100%" }
2610
+ }
2611
+ )))
2612
+ )
2613
+ );
2614
+ };
2615
+
2616
+ const DrawerTitle = ({ onClose, isLast, isNext, onLastClick, onNextClick }) => {
2617
+ return /* @__PURE__ */ React.createElement(antd.Flex, { className: "drawer-title-container", justify: "space-between", align: "center", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React.createElement(antd.Flex, { className: "nav-arrows", gap: 4 }, /* @__PURE__ */ React.createElement(antd.Tooltip, { title: "\u4E0A\u4E00\u9898" }, /* @__PURE__ */ React.createElement(
2618
+ antd.Button,
2619
+ {
2620
+ size: "small",
2621
+ type: "text",
2622
+ icon: /* @__PURE__ */ React.createElement(icons.UpOutlined, { size: 20 }),
2623
+ onClick: onLastClick,
2624
+ disabled: !isLast
2625
+ }
2626
+ )), /* @__PURE__ */ React.createElement(antd.Tooltip, { title: "\u4E0B\u4E00\u9898" }, /* @__PURE__ */ React.createElement(
2627
+ antd.Button,
2628
+ {
2629
+ size: "small",
2630
+ type: "text",
2631
+ icon: /* @__PURE__ */ React.createElement(icons.DownOutlined, { size: 20 }),
2632
+ onClick: onNextClick,
2633
+ disabled: !isNext
2634
+ }
2635
+ ))), /* @__PURE__ */ React.createElement(
2636
+ antd.Button,
2637
+ {
2638
+ className: "close-btn",
2639
+ size: "small",
2640
+ type: "text",
2641
+ icon: /* @__PURE__ */ React.createElement(icons.CloseOutlined, { size: 20 }),
2642
+ onClick: onClose
2643
+ }
2644
+ ));
2645
+ };
2646
+
2647
+ const SearchPagination = ({ selectIndex, total, onClickArrow }) => {
2648
+ return /* @__PURE__ */ React.createElement(antd.Flex, { className: "search-suffix", align: "center" }, /* @__PURE__ */ React.createElement(
2649
+ antd.Button,
2650
+ {
2651
+ type: "link",
2652
+ className: "arrow-icon",
2653
+ icon: /* @__PURE__ */ React.createElement(icons.LeftOutlined, { size: 12 }),
2654
+ onClick: () => onClickArrow("left"),
2655
+ onMouseDown: (e) => e.preventDefault()
2656
+ }
2657
+ ), /* @__PURE__ */ React.createElement(antd.Flex, { className: "suffix-number", align: "center", justify: "center" }, `${selectIndex} / ${total}`), /* @__PURE__ */ React.createElement(
2658
+ antd.Button,
2659
+ {
2660
+ type: "link",
2661
+ className: "arrow-icon",
2662
+ icon: /* @__PURE__ */ React.createElement(icons.RightOutlined, { size: 12 }),
2663
+ onClick: () => onClickArrow("right"),
2664
+ onMouseDown: (e) => e.preventDefault()
2665
+ }
2666
+ ));
2667
+ };
2668
+
2669
+ const SearchModal = ({
2670
+ offsetParent,
2671
+ width = 400,
2672
+ isLoading = false,
2673
+ isOpen = false,
2674
+ position,
2675
+ placeholder = "\u5728\u6570\u636E\u8868\u4E2D\u67E5\u627E",
2676
+ searchValue,
2677
+ searchTotal = 0,
2678
+ suffix,
2679
+ onClose,
2680
+ onPositionChange,
2681
+ onSearchChange,
2682
+ onPageChange
2683
+ }) => {
2684
+ const inputRef = reactExports.useRef(null);
2685
+ const [selectIndex, setSelectIndex] = reactExports.useState(searchTotal > 0 ? 1 : 0);
2686
+ reactExports.useEffect(() => {
2687
+ if (searchTotal <= 0) {
2688
+ setSelectIndex(0);
2689
+ } else {
2690
+ setSelectIndex((prev) => {
2691
+ if (prev === 0 || prev > searchTotal) {
2692
+ return 1;
2693
+ }
2694
+ return prev;
2695
+ });
2696
+ }
2697
+ }, [searchTotal]);
2698
+ const onClickArrow = (type) => {
2699
+ if (searchTotal <= 0) return;
2700
+ const delta = type === "right" ? 1 : -1;
2701
+ const newIndex = (selectIndex - 1 + delta + searchTotal) % searchTotal + 1;
2702
+ if (newIndex !== selectIndex) {
2703
+ setSelectIndex(newIndex);
2704
+ if (onPageChange) onPageChange(newIndex);
2705
+ }
2706
+ };
2707
+ reactExports.useEffect(() => {
2708
+ if (!isOpen) return;
2709
+ requestAnimationFrame(() => {
2710
+ inputRef.current?.focus({
2711
+ cursor: "end"
2712
+ // 光标在末尾
2713
+ });
2714
+ });
2715
+ }, [isOpen]);
2716
+ return /* @__PURE__ */ React.createElement(
2717
+ baseModal.BaseModal,
2718
+ {
2719
+ offsetParent,
2720
+ width,
2721
+ open: isOpen,
2722
+ onClose,
2723
+ value: position,
2724
+ onChange: onPositionChange,
2725
+ className: "search-modal"
2726
+ },
2727
+ /* @__PURE__ */ React.createElement(
2728
+ baseModal.DragDiv,
2729
+ {
2730
+ className: "search-modal-container",
2731
+ onDrag: (dx, dy) => onPositionChange(({ x, y }) => ({ x: x + dx, y: y + dy }))
2732
+ },
2733
+ /* @__PURE__ */ React.createElement(
2734
+ antd.Flex,
2735
+ {
2736
+ className: "no-move",
2737
+ justify: "center",
2738
+ align: "center",
2739
+ gap: 8,
2740
+ flex: 1,
2741
+ onMouseDown: (e) => e.stopPropagation()
2742
+ },
2743
+ /* @__PURE__ */ React.createElement(
2744
+ antd.Input,
2745
+ {
2746
+ ref: inputRef,
2747
+ className: "search-input",
2748
+ value: searchValue,
2749
+ onChange: onSearchChange,
2750
+ placeholder,
2751
+ prefix: isLoading ? /* @__PURE__ */ React.createElement(icons.LoadingOutlined, { spin: true }) : /* @__PURE__ */ React.createElement(icons.SearchOutlined, null),
2752
+ suffix: suffix ? suffix : /* @__PURE__ */ React.createElement(SearchPagination, { selectIndex, total: searchTotal, onClickArrow })
2753
+ }
2754
+ ),
2755
+ /* @__PURE__ */ React.createElement(antd.Button, { className: "search-close", type: "text", icon: /* @__PURE__ */ React.createElement(icons.CloseOutlined, { size: 16 }), onClick: onClose })
2756
+ )
2757
+ )
2758
+ );
2759
+ };
2760
+
2761
+ const Operator = {
2762
+ "EQUAL": "equal",
2763
+ "NOT_EQUAL": "not_equal",
2764
+ "GREATER_THAN": "greater_than",
2765
+ "GREATER_THAN_OR_EQUAL": "greater_than_or_equal",
2766
+ "LESS_THAN": "less_than",
2767
+ "LESS_THAN_OR_EQUAL": "less_than_or_equal",
2768
+ "BEFORE": "before",
2769
+ "AFTER": "after",
2770
+ "LIKE": "like",
2771
+ "NOT_LIKE": "not_like",
2772
+ "EMPTY": "empty",
2773
+ "NOT_EMPTY": "not_empty"
2774
+ };
2775
+
2776
+ const getDateRangeByOption = (type, operator) => {
2777
+ const now = dayjs();
2778
+ const dayStart = (d) => d.startOf("day");
2779
+ const dayEnd = (d) => d.endOf("day");
2780
+ switch (type) {
2781
+ case "today": {
2782
+ const start = dayStart(now);
2783
+ const end = dayEnd(now);
2784
+ if (operator === "equal") return [start, end];
2785
+ if (operator === "before") return [void 0, start];
2786
+ return [end, void 0];
2787
+ }
2788
+ case "yesterday": {
2789
+ const d = now.subtract(1, "day");
2790
+ const start = dayStart(d);
2791
+ const end = dayEnd(d);
2792
+ if (operator === "equal") return [start, end];
2793
+ if (operator === "before") return [void 0, start];
2794
+ return [end, void 0];
2795
+ }
2796
+ case "tomorrow": {
2797
+ const d = now.add(1, "day");
2798
+ const start = dayStart(d);
2799
+ const end = dayEnd(d);
2800
+ if (operator === "equal") return [start, end];
2801
+ if (operator === "before") return [void 0, start];
2802
+ return [end, void 0];
2803
+ }
2804
+ case "this_week":
2805
+ return [now.startOf("week"), now.endOf("week")];
2806
+ case "last_week": {
2807
+ const d = now.subtract(1, "week");
2808
+ return [d.startOf("week"), d.endOf("week")];
2809
+ }
2810
+ case "this_month":
2811
+ return [now.startOf("month"), now.endOf("month")];
2812
+ case "last_month": {
2813
+ const d = now.subtract(1, "month");
2814
+ return [d.startOf("month"), d.endOf("month")];
2815
+ }
2816
+ case "last_7_days":
2817
+ return [dayStart(now.subtract(6, "day")), dayEnd(now)];
2818
+ case "next_7_days":
2819
+ return [dayStart(now), dayEnd(now.add(6, "day"))];
2820
+ case "last_30_days":
2821
+ return [dayStart(now.subtract(29, "day")), dayEnd(now)];
2822
+ case "next_30_days":
2823
+ return [dayStart(now), dayEnd(now.add(29, "day"))];
2824
+ default:
2825
+ return void 0;
2826
+ }
2827
+ };
2828
+ const getDateBySpecific = (value, operator) => {
2829
+ const startOfDay = value.startOf("day");
2830
+ const endOfDay = value.endOf("day");
2831
+ switch (operator) {
2832
+ case "equal":
2833
+ return [startOfDay, endOfDay];
2834
+ case "before":
2835
+ return [void 0, startOfDay];
2836
+ case "after":
2837
+ return [endOfDay, void 0];
2838
+ default:
2839
+ return [void 0, void 0];
2840
+ }
2841
+ };
2842
+
2843
+ const getOperatorOptions = (config) => {
2844
+ if (config.numberSelect || config.time) {
2845
+ return [
2846
+ { label: "\u7B49\u4E8E", value: "equal" },
2847
+ { label: "\u4E0D\u7B49\u4E8E", value: "not_equal" },
2848
+ { label: "\u5927\u4E8E", value: "greater_than" },
2849
+ { label: "\u5927\u4E8E\u6216\u7B49\u4E8E", value: "greater_than_or_equal" },
2850
+ { label: "\u5C0F\u4E8E", value: "less_than" },
2851
+ { label: "\u5C0F\u4E8E\u6216\u7B49\u4E8E", value: "less_than_or_equal" },
2852
+ { label: "\u4E3A\u7A7A", value: "empty" },
2853
+ { label: "\u4E0D\u4E3A\u7A7A", value: "not_empty" }
2854
+ ];
2855
+ } else if (config.date) {
2856
+ return [
2857
+ { label: "\u7B49\u4E8E", value: "equal" },
2858
+ { label: "\u65E9\u4E8E", value: "before" },
2859
+ { label: "\u665A\u4E8E", value: "after" },
2860
+ { label: "\u4E3A\u7A7A", value: "empty" },
2861
+ { label: "\u4E0D\u4E3A\u7A7A", value: "not_empty" }
2862
+ ];
2863
+ } else {
2864
+ return [
2865
+ { label: "\u7B49\u4E8E", value: "equal" },
2866
+ { label: "\u4E0D\u7B49\u4E8E", value: "not_equal" },
2867
+ { label: "\u5305\u542B", value: "like" },
2868
+ { label: "\u4E0D\u5305\u542B", value: "not_like" },
2869
+ { label: "\u4E3A\u7A7A", value: "empty" },
2870
+ { label: "\u4E0D\u4E3A\u7A7A", value: "not_empty" }
2871
+ ];
2872
+ }
2873
+ };
2874
+ const FilterTypeSelect = ({ listIndex, value, form, tableConfig, onChange }) => {
2875
+ const operatorOptions = reactExports.useMemo(() => {
2876
+ if (!tableConfig) return [];
2877
+ return getOperatorOptions(tableConfig);
2878
+ }, [tableConfig]);
2879
+ const handleChange = (type) => {
2880
+ const oldValue = form.getFieldValue(["filters", listIndex, "value"]);
2881
+ const isTimeBeforeOrAfter = type === "before" || type === "after";
2882
+ if (isTimeBeforeOrAfter && !["specific", "today", "tomorrow", "yesterday"].includes(oldValue)) {
2883
+ const oldData = form.getFieldValue(["filters", listIndex]);
2884
+ form.setFieldValue(["filters", listIndex], {
2885
+ ...oldData,
2886
+ value: "specific",
2887
+ date: void 0
2888
+ });
2889
+ onChange(type);
2890
+ } else if (type === "empty" || type === "not_empty") {
2891
+ const oldData = form.getFieldValue(["filters", listIndex]);
2892
+ form.setFieldValue(["filters", listIndex], {
2893
+ ...oldData,
2894
+ value: void 0,
2895
+ date: void 0
2896
+ });
2897
+ onChange(type);
2898
+ } else {
2899
+ onChange(type);
2900
+ }
2901
+ };
2902
+ return /* @__PURE__ */ React.createElement(
2903
+ antd.Select,
2904
+ {
2905
+ value,
2906
+ className: "filter-form-operator",
2907
+ popupMatchSelectWidth: 200,
2908
+ options: operatorOptions,
2909
+ onChange: handleChange
2910
+ }
2911
+ );
2912
+ };
2913
+
2914
+ const FilterDatePicker = ({ value, columnConfig, onChange }) => {
2915
+ const [date, setDate] = reactExports.useState(value ? dayjs(value) : void 0);
2916
+ const formatType = reactExports.useMemo(() => {
2917
+ const type = columnConfig?.dateFormat;
2918
+ if (!type) {
2919
+ return "YYYY/MM/DD";
2920
+ } else {
2921
+ return type.split(" ")[0] || "YYYY/MM/DD";
2922
+ }
2923
+ }, [columnConfig?.dateFormat]);
2924
+ const handleSelectDate = (_date) => {
2925
+ setDate(_date);
2926
+ onChange(_date);
2927
+ };
2928
+ return /* @__PURE__ */ React.createElement(
2929
+ antd.DatePicker,
2930
+ {
2931
+ format: formatType,
2932
+ allowClear: false,
2933
+ value: date,
2934
+ onChange: handleSelectDate,
2935
+ placeholder: formatType,
2936
+ suffixIcon: void 0
2937
+ }
2938
+ );
2939
+ };
2940
+
2941
+ const options = [
2942
+ { label: "\u5177\u4F53\u65E5\u671F", value: "specific" },
2943
+ { label: "\u4ECA\u5929", value: "today" },
2944
+ { label: "\u660E\u5929", value: "tomorrow" },
2945
+ { label: "\u6628\u5929", value: "yesterday" },
2946
+ { label: "\u672C\u5468", value: "this_week" },
2947
+ { label: "\u4E0A\u5468", value: "last_week" },
2948
+ { label: "\u672C\u6708", value: "this_month" },
2949
+ { label: "\u4E0A\u6708", value: "last_month" },
2950
+ { label: "\u8FC7\u53BB 7 \u5929\u5185", value: "last_7_days" },
2951
+ { label: "\u672A\u6765 7 \u5929\u5185", value: "next_7_days" },
2952
+ { label: "\u8FC7\u53BB 30 \u5929\u5185", value: "last_30_days" },
2953
+ { label: "\u672A\u6765 30 \u5929\u5185", value: "next_30_days" }
2954
+ ];
2955
+ const FilterDateSelect = ({ form, listIndex, value, operator, onChange }) => {
2956
+ const filterOptions = reactExports.useMemo(() => {
2957
+ return operator === "before" || operator === "after" ? options.filter((item) => ["specific", "today", "tomorrow", "yesterday"].includes(item.value)) : options;
2958
+ }, [operator]);
2959
+ const handleChange = (value2) => {
2960
+ if (value2 !== "specific") {
2961
+ const oldData = form.getFieldValue(["filters", listIndex]);
2962
+ form.setFieldValue(["filters", listIndex], {
2963
+ ...oldData,
2964
+ value: value2,
2965
+ date: void 0
2966
+ });
2967
+ }
2968
+ onChange(value2);
2969
+ };
2970
+ reactHooks.useMount(() => {
2971
+ if (value === void 0) {
2972
+ onChange("specific");
2973
+ }
2974
+ });
2975
+ return /* @__PURE__ */ React.createElement(
2976
+ antd.Select,
2977
+ {
2978
+ className: "form-date-type",
2979
+ placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F",
2980
+ options: filterOptions,
2981
+ popupMatchSelectWidth: 200,
2982
+ value,
2983
+ onChange: handleChange
2984
+ }
2985
+ );
2986
+ };
2987
+
2988
+ const FilterFileSelect = ({ value, onChange }) => {
2989
+ const handleSelectChange = (value2) => {
2990
+ onChange(value2);
2991
+ };
2992
+ return /* @__PURE__ */ React.createElement(
2993
+ antd.Select,
2994
+ {
2995
+ placeholder: "\u8BF7\u9009\u62E9\u6587\u4EF6\u7C7B\u578B",
2996
+ onChange: handleSelectChange,
2997
+ value,
2998
+ options: [
2999
+ {
3000
+ label: "\u56FE\u7247",
3001
+ value: "image"
3002
+ },
3003
+ {
3004
+ label: "\u6587\u6863",
3005
+ value: "document"
3006
+ },
3007
+ {
3008
+ label: "\u89C6\u9891",
3009
+ value: "video"
3010
+ }
3011
+ ]
3012
+ }
3013
+ );
3014
+ };
3015
+
3016
+ const FilterInput = ({ onChange, value }) => {
3017
+ return /* @__PURE__ */ React.createElement(antd.Input, { placeholder: "\u8BF7\u8F93\u5165", onChange: (e) => onChange(e.target?.value), value });
3018
+ };
3019
+
3020
+ const sanitizeInput = (value) => {
3021
+ let sanitized = value.replace(/[^\d.-]/g, "");
3022
+ const parts = sanitized.split(".");
3023
+ if (parts.length > 2) sanitized = parts[0] + "." + parts.slice(1).join("");
3024
+ if (sanitized.includes("-") && sanitized.indexOf("-") > 0) sanitized = sanitized.replace(/-/g, "");
3025
+ return sanitized;
3026
+ };
3027
+ const getSliceNumber = (rawValue) => {
3028
+ const [intPart, decimalPart] = rawValue.split(".");
3029
+ if (decimalPart && decimalPart.length > 9) {
3030
+ const fixedValue = `${intPart}.${decimalPart.slice(0, 9)}`;
3031
+ return fixedValue;
3032
+ }
3033
+ return rawValue;
3034
+ };
3035
+ const FilterNumber = ({ onChange, value }) => {
3036
+ const [rawValue, setRawValue] = reactExports.useState(value || "");
3037
+ const debounceOnChange = reactHooks.useDebounce((value2) => {
3038
+ onChange(value2);
3039
+ }, 500);
3040
+ const onChangeInput = (e) => {
3041
+ const input = sanitizeInput(e.target.value);
3042
+ setRawValue(input);
3043
+ if (rawValue !== input) {
3044
+ debounceOnChange(getSliceNumber(input));
3045
+ }
3046
+ };
3047
+ reactExports.useEffect(() => {
3048
+ if (value === void 0) {
3049
+ setRawValue("");
3050
+ }
3051
+ }, [value]);
3052
+ const onBlur = () => {
3053
+ if (!rawValue) return;
3054
+ const newValue = getSliceNumber(rawValue);
3055
+ setRawValue(newValue);
3056
+ if (rawValue !== newValue) {
3057
+ debounceOnChange(getSliceNumber(newValue));
3058
+ }
3059
+ };
3060
+ return /* @__PURE__ */ React.createElement(antd.Input, { placeholder: "\u8BF7\u8F93\u5165", value: rawValue, onBlur, onChange: onChangeInput });
3061
+ };
3062
+
3063
+ const FilterPeopleAvatar = ({ avatar, label }) => {
3064
+ const backgroundColor = reactExports.useMemo(() => label === "\u65E0" ? "#D9D9D9" : core.getColorByStr(label?.slice(-2) || ""), [label]);
3065
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, avatar ? /* @__PURE__ */ React.createElement(antd.Avatar, { src: avatar, size: "small", style: { marginRight: 8 } }, label?.slice(-2)) : /* @__PURE__ */ React.createElement(
3066
+ antd.Avatar,
3067
+ {
3068
+ style: {
3069
+ backgroundColor,
3070
+ marginRight: 8
3071
+ },
3072
+ size: "small"
3073
+ },
3074
+ label?.slice(-2)
3075
+ ));
3076
+ };
3077
+ const TagRender = ({ label, closable, onClose }) => {
3078
+ const onPreventMouseDown = (event) => {
3079
+ event.preventDefault();
3080
+ event.stopPropagation();
3081
+ };
3082
+ return /* @__PURE__ */ React.createElement(antd.Tag, { onMouseDown: onPreventMouseDown, closable, onClose, bordered: false }, /* @__PURE__ */ React.createElement(
3083
+ "span",
3084
+ {
3085
+ style: {
3086
+ display: "inline-block",
3087
+ maxWidth: 80,
3088
+ overflow: "hidden",
3089
+ textOverflow: "ellipsis",
3090
+ whiteSpace: "nowrap",
3091
+ verticalAlign: "middle"
3092
+ }
3093
+ },
3094
+ label
3095
+ ));
3096
+ };
3097
+ const FilterPeopleSelect = ({ columnId, columnConfig, value, onChange }) => {
3098
+ const fetchRef = reactExports.useRef(0);
3099
+ const [fetching, setFetching] = reactExports.useState(false);
3100
+ const [options, setOptions] = reactExports.useState([]);
3101
+ const inputRef = reactExports.useRef(null);
3102
+ const [name, setName] = reactExports.useState("");
3103
+ const handleSelectChange = (val) => {
3104
+ onChange(val);
3105
+ };
3106
+ const debounceFetcher = reactExports.useMemo(() => {
3107
+ const loadOptions = (value2) => {
3108
+ if (!columnConfig.requestPeople) {
3109
+ setOptions([]);
3110
+ return;
3111
+ }
3112
+ fetchRef.current += 1;
3113
+ const fetchId = fetchRef.current;
3114
+ setOptions([]);
3115
+ setFetching(true);
3116
+ columnConfig.requestPeople(value2).then((data) => {
3117
+ if (fetchId !== fetchRef.current) {
3118
+ return;
3119
+ }
3120
+ const newOptions = data.map((item) => ({
3121
+ value: item.value,
3122
+ label: /* @__PURE__ */ React.createElement(antd.Flex, { align: "center", justify: "center" }, /* @__PURE__ */ React.createElement(FilterPeopleAvatar, { label: item.label, avatar: item.avatar }), /* @__PURE__ */ React.createElement(
3123
+ "span",
3124
+ {
3125
+ style: {
3126
+ overflow: "hidden",
3127
+ textOverflow: "ellipsis",
3128
+ whiteSpace: "nowrap",
3129
+ flex: 1
3130
+ }
3131
+ },
3132
+ item.label
3133
+ )),
3134
+ data: item
3135
+ }));
3136
+ setOptions(newOptions);
3137
+ setFetching(false);
3138
+ });
3139
+ };
3140
+ return lodash.debounce(loadOptions, 300);
3141
+ }, [columnConfig]);
3142
+ const onNameChange = (event) => {
3143
+ setName(event.target.value);
3144
+ debounceFetcher(event.target.value);
3145
+ };
3146
+ reactExports.useEffect(() => {
3147
+ debounceFetcher();
3148
+ }, [columnId, debounceFetcher]);
3149
+ const onOpenChange = (open) => {
3150
+ if (!open) {
3151
+ setName("");
3152
+ debounceFetcher();
3153
+ }
3154
+ };
3155
+ return /* @__PURE__ */ React.createElement(
3156
+ antd.Select,
3157
+ {
3158
+ mode: "multiple",
3159
+ maxTagCount: 1,
3160
+ showSearch: false,
3161
+ placeholder: "\u8BF7\u9009\u62E9\u9009\u9879",
3162
+ value,
3163
+ options,
3164
+ onChange: handleSelectChange,
3165
+ filterOption: false,
3166
+ notFoundContent: fetching ? /* @__PURE__ */ React.createElement(antd.Spin, { size: "small" }) : "\u6682\u65E0\u6570\u636E",
3167
+ tagRender: (props) => {
3168
+ return /* @__PURE__ */ React.createElement(TagRender, { ...props });
3169
+ },
3170
+ onOpenChange,
3171
+ popupRender: (menu) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(antd.Space, { style: { padding: "4px 0px 0px" } }, /* @__PURE__ */ React.createElement(
3172
+ antd.Input,
3173
+ {
3174
+ placeholder: "\u641C\u7D22\u6210\u5458",
3175
+ variant: "borderless",
3176
+ ref: inputRef,
3177
+ value: name,
3178
+ onChange: onNameChange,
3179
+ onKeyDown: (e) => e.stopPropagation()
3180
+ }
3181
+ )), /* @__PURE__ */ React.createElement(antd.Divider, { style: { margin: "8px 0" } }), menu)
3182
+ }
3183
+ );
3184
+ };
3185
+
3186
+ const FilterSelect = ({ tableConfig, columnConfig, value, onChange }) => {
3187
+ const mode = reactExports.useMemo(() => {
3188
+ const custom = tableConfig?.customOptions;
3189
+ return typeof custom === "object" && custom.multiSelect ? "multiple" : "single";
3190
+ }, [tableConfig]);
3191
+ const options = reactExports.useMemo(() => Array.isArray(columnConfig["options"]) ? columnConfig["options"] : [], [columnConfig]);
3192
+ const handleChange = (value2) => {
3193
+ if (mode === "single") {
3194
+ onChange(value2.slice(value2.length - 1));
3195
+ } else {
3196
+ onChange(value2);
3197
+ }
3198
+ };
3199
+ return /* @__PURE__ */ React.createElement(
3200
+ antd.Select,
3201
+ {
3202
+ mode: "multiple",
3203
+ value,
3204
+ maxTagCount: 1,
3205
+ placeholder: "\u8BF7\u9009\u62E9\u9009\u9879",
3206
+ onChange: handleChange,
3207
+ options
3208
+ }
3209
+ );
3210
+ };
3211
+
3212
+ const FilterValue = ({ form, columnId, tableConfig, columnConfig, listIndex }) => {
3213
+ const Component = reactExports.useMemo(() => {
3214
+ let DefaultComponent;
3215
+ if (tableConfig.customOptions) {
3216
+ DefaultComponent = FilterSelect;
3217
+ } else if (tableConfig.date) {
3218
+ DefaultComponent = FilterDateSelect;
3219
+ } else if (tableConfig.numberSelect || tableConfig.time) {
3220
+ DefaultComponent = FilterNumber;
3221
+ } else if (tableConfig.people) {
3222
+ DefaultComponent = FilterPeopleSelect;
3223
+ } else if (tableConfig.file) {
3224
+ DefaultComponent = FilterFileSelect;
3225
+ } else {
3226
+ DefaultComponent = FilterInput;
3227
+ }
3228
+ return DefaultComponent;
3229
+ }, [tableConfig]);
3230
+ const props = { form, columnId, columnConfig, tableConfig, listIndex };
3231
+ return /* @__PURE__ */ React.createElement(antd.Flex, { className: "filter-value-box", gap: 8 }, /* @__PURE__ */ React.createElement(proComponents.ProFormItem, { name: "value", className: tableConfig.date ? "" : "item-value" }, /* @__PURE__ */ React.createElement(Component, { ...props })), tableConfig.date && /* @__PURE__ */ React.createElement(proComponents.ProFormDependency, { name: ["value"] }, ({ value }) => {
3232
+ if (value !== "specific") return null;
3233
+ return /* @__PURE__ */ React.createElement(proComponents.ProFormItem, { name: "date", className: "item-value" }, /* @__PURE__ */ React.createElement(FilterDatePicker, { ...props }));
3234
+ }));
3235
+ };
3236
+
3237
+ const FilterGroup = ({ form, columnId, columnData, listIndex, tools }) => {
3238
+ const columnConfig = reactExports.useMemo(() => {
3239
+ return columnData.find((item) => item.id === columnId);
3240
+ }, [columnData, columnId]);
3241
+ const tableConfig = reactExports.useMemo(() => {
3242
+ if (!columnConfig || !columnConfig["type"]) return;
3243
+ return tools.find((item) => item.value === Number(columnConfig["type"]))?.table;
3244
+ }, [columnConfig, tools]);
3245
+ if (!tableConfig) return;
3246
+ const props = { form, columnId, columnConfig, tableConfig, listIndex };
3247
+ return /* @__PURE__ */ React.createElement(antd.Flex, { className: "filter-item-config", gap: 8 }, /* @__PURE__ */ React.createElement(proComponents.ProFormItem, { name: "operator" }, /* @__PURE__ */ React.createElement(FilterTypeSelect, { ...props })), /* @__PURE__ */ React.createElement(proComponents.ProFormDependency, { name: ["operator"] }, ({ operator }) => {
3248
+ if (operator === "empty" || operator === "not_empty") return null;
3249
+ return /* @__PURE__ */ React.createElement(FilterValue, { ...props, operator });
3250
+ }));
3251
+ };
3252
+
3253
+ const FilterTitle = ({ filterCount }) => {
3254
+ return /* @__PURE__ */ React.createElement(antd.Flex, { align: "center", gap: 8, className: "filter-title-wrap" }, /* @__PURE__ */ React.createElement(antd.Typography.Text, null, "\u8BBE\u7F6E\u7B5B\u9009\u6761\u4EF6"), /* @__PURE__ */ React.createElement(antd.Flex, { className: "filter-type-container", align: "center", gap: 8, style: { display: filterCount > 1 ? "" : "none" } }, /* @__PURE__ */ React.createElement(antd.Typography.Text, null, "\u7B26\u5408\u4EE5\u4E0B"), /* @__PURE__ */ React.createElement(proComponents.ProFormItem, { name: "filterType", className: "filter-type-item" }, /* @__PURE__ */ React.createElement(
3255
+ antd.Select,
3256
+ {
3257
+ size: "small",
3258
+ options: [
3259
+ { label: "\u6240\u6709", value: "all" },
3260
+ { label: "\u4EFB\u4E00", value: "any" }
3261
+ ]
3262
+ }
3263
+ )), /* @__PURE__ */ React.createElement(antd.Typography.Text, null, "\u6761\u4EF6")), /* @__PURE__ */ React.createElement(antd.Tooltip, { placement: "top", title: "\u5F53\u524D\u7B5B\u9009\u64CD\u4F5C\u4E0D\u5F71\u54CD\u5176\u4ED6\u534F\u4F5C\u8005" }, /* @__PURE__ */ React.createElement(icons.QuestionCircleOutlined, null)));
3264
+ };
3265
+
3266
+ const FilterOperator = {
3267
+ "EQUAl": "equal",
3268
+ "NOT_EQUAL": "not_equal",
3269
+ "LIKE": "like",
3270
+ "NOT_LIKE": "not_like",
3271
+ "EMPTY": "empty",
3272
+ "NOT_EMPTY": "not_empty",
3273
+ "BETWEEN": "between",
3274
+ "GREATER_THAN": "greater_than",
3275
+ "GREATER_THAN_OR_EQUAL": "greater_than_or_equal",
3276
+ "LESS_THAN": "less_than",
3277
+ "LESS_THAN_OR_EQUAL": "less_than_or_equal"
3278
+ };
3279
+
3280
+ const TableFilterForm = ({ initialValues, columnData, tools, onValuesChange }) => {
3281
+ const [form] = antd.Form.useForm();
3282
+ const outputValues = reactExports.useRef(initialValues);
3283
+ const actionRef = reactExports.useRef(void 0);
3284
+ const [filterCount, setFilterCount] = reactExports.useState(initialValues?.filters.length ?? 0);
3285
+ const updateFilterCount = () => {
3286
+ const values = form.getFieldsValue();
3287
+ setFilterCount(values.filters?.length ?? 0);
3288
+ };
3289
+ const filedOptions = reactExports.useMemo(
3290
+ () => columnData.map((column) => ({
3291
+ value: column.id,
3292
+ label: column.label
3293
+ })),
3294
+ [columnData]
3295
+ );
3296
+ const onDebounceChange = reactExports.useMemo(
3297
+ () => lodash.debounce(() => {
3298
+ const allValues = form.getFieldsValue();
3299
+ const lastDate = {
3300
+ filterType: allValues.filterType,
3301
+ filters: []
3302
+ };
3303
+ allValues.filters.forEach((filter) => {
3304
+ const columnConfig = columnData.find((item) => item.id === filter.columnId);
3305
+ const tableConfig = columnConfig ? tools.find((item) => item.value === Number(columnConfig["type"]))?.table : void 0;
3306
+ const newFilter = {
3307
+ columnId: filter.columnId,
3308
+ operator: filter.operator
3309
+ };
3310
+ const operator = filter.operator;
3311
+ if (filter.value) {
3312
+ newFilter.value = filter.value;
3313
+ if (tableConfig?.date) {
3314
+ if (operator === "equal" || operator === "before" || operator === "after") {
3315
+ newFilter.operator = "between";
3316
+ }
3317
+ if (filter.date) {
3318
+ const date = filter.date;
3319
+ newFilter.value = getDateBySpecific(date, operator);
3320
+ lastDate.filters.push(newFilter);
3321
+ } else {
3322
+ const type = filter.value;
3323
+ newFilter.value = getDateRangeByOption(type, operator);
3324
+ if (newFilter.value) {
3325
+ lastDate.filters.push(newFilter);
3326
+ }
3327
+ }
3328
+ } else {
3329
+ lastDate.filters.push(newFilter);
3330
+ }
3331
+ } else if (operator === "empty" || operator === "not_empty") {
3332
+ lastDate.filters.push(newFilter);
3333
+ }
3334
+ });
3335
+ if (!lodash.isEqual(lastDate, outputValues.current)) {
3336
+ outputValues.current = lastDate;
3337
+ onValuesChange?.(lastDate);
3338
+ }
3339
+ }, 500),
3340
+ [columnData, form, onValuesChange, tools]
3341
+ );
3342
+ const onAddList = () => {
3343
+ const defaultColumnId = columnData[0]?.id || "";
3344
+ actionRef.current?.add({
3345
+ columnId: defaultColumnId,
3346
+ operator: "equal"
3347
+ });
3348
+ updateFilterCount();
3349
+ };
3350
+ const onDeleteList = (index) => {
3351
+ actionRef.current?.remove(index);
3352
+ updateFilterCount();
3353
+ onDebounceChange();
3354
+ };
3355
+ const onListChange = (index, values) => {
3356
+ const filters = form.getFieldValue("filters") || [];
3357
+ if (values.columnId) {
3358
+ values["operator"] = "equal";
3359
+ values["value"] = void 0;
3360
+ }
3361
+ const newFilters = filters.map((item, i) => i === index ? lodash.omitBy({ ...item, ...values }, lodash.isUndefined) : item);
3362
+ form.setFieldValue("filters", newFilters);
3363
+ };
3364
+ return /* @__PURE__ */ React.createElement(
3365
+ proComponents.ProForm,
3366
+ {
3367
+ className: "filter-form",
3368
+ form,
3369
+ submitter: false,
3370
+ initialValues: {
3371
+ filterType: "all",
3372
+ ...initialValues
3373
+ },
3374
+ onValuesChange: onDebounceChange
3375
+ },
3376
+ /* @__PURE__ */ React.createElement(FilterTitle, { filterCount }),
3377
+ /* @__PURE__ */ React.createElement(
3378
+ proComponents.ProFormList,
3379
+ {
3380
+ actionRef,
3381
+ className: "filter-form-list",
3382
+ name: "filters",
3383
+ copyIconProps: false,
3384
+ creatorButtonProps: false,
3385
+ deleteIconProps: false,
3386
+ itemContainerRender: (doms) => {
3387
+ return /* @__PURE__ */ React.createElement(proComponents.ProForm.Group, null, doms);
3388
+ }
3389
+ },
3390
+ (_, listIndex, operator) => {
3391
+ return /* @__PURE__ */ React.createElement(antd.Flex, { gap: 4, align: "center" }, /* @__PURE__ */ React.createElement(antd.Flex, { className: "filter-form-item", gap: 16 }, /* @__PURE__ */ React.createElement(proComponents.ProFormItem, { name: ["columnId"], className: "filter-item-id" }, /* @__PURE__ */ React.createElement(
3392
+ antd.Select,
3393
+ {
3394
+ className: "filter-item-id-select",
3395
+ placeholder: "\u8BF7\u9009\u62E9\u5B57\u6BB5",
3396
+ options: filedOptions,
3397
+ popupMatchSelectWidth: 200,
3398
+ onChange: (columnId) => onListChange(listIndex, { columnId })
3399
+ }
3400
+ )), /* @__PURE__ */ React.createElement(proComponents.ProFormDependency, { name: ["columnId"] }, ({ columnId }) => {
3401
+ return /* @__PURE__ */ React.createElement(
3402
+ FilterGroup,
3403
+ {
3404
+ form,
3405
+ columnId: columnId ?? columnData[0]?.id,
3406
+ columnData,
3407
+ listIndex,
3408
+ tools,
3409
+ operator
3410
+ }
3411
+ );
3412
+ })), /* @__PURE__ */ React.createElement(antd.Button, { type: "text", size: "small", icon: /* @__PURE__ */ React.createElement(icons.CloseOutlined, null), onClick: () => onDeleteList(listIndex) }));
3413
+ }
3414
+ ),
3415
+ /* @__PURE__ */ React.createElement(antd.Flex, { align: "center", gap: 8, className: "filter-action-wrap" }, /* @__PURE__ */ React.createElement(antd.Button, { type: "text", icon: /* @__PURE__ */ React.createElement(icons.PlusOutlined, null), size: "small", onClick: onAddList }, "\u6DFB\u52A0\u6761\u4EF6"))
3416
+ );
3417
+ };
3418
+
3419
+ const FilterModal = ({
3420
+ offsetParent,
3421
+ width = 520,
3422
+ isOpen = false,
3423
+ position,
3424
+ initialValues,
3425
+ columnData,
3426
+ tools,
3427
+ onClose,
3428
+ onPositionChange,
3429
+ onValuesChange
3430
+ }) => {
3431
+ return /* @__PURE__ */ React.createElement(
3432
+ baseModal.BaseModal,
3433
+ {
3434
+ offsetParent,
3435
+ width,
3436
+ open: isOpen,
3437
+ onClose,
3438
+ value: position,
3439
+ onChange: onPositionChange,
3440
+ className: "filter-modal"
3441
+ },
3442
+ /* @__PURE__ */ React.createElement(antd.Flex, { className: "filter-container", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React.createElement(
3443
+ TableFilterForm,
3444
+ {
3445
+ initialValues,
3446
+ columnData,
3447
+ tools,
3448
+ onValuesChange
3449
+ }
3450
+ ))
3451
+ );
3452
+ };
3453
+
3454
+ const dateValues = [
3455
+ "today",
3456
+ "tomorrow",
3457
+ "yesterday",
3458
+ "this_week",
3459
+ "last_week",
3460
+ "this_month",
3461
+ "last_month",
3462
+ "last_7_days",
3463
+ "next_7_days",
3464
+ "last_30_days",
3465
+ "next_30_days"
3466
+ ];
3467
+ function resolveDateRange(value, now = dayjs()) {
3468
+ switch (value) {
3469
+ case "today": {
3470
+ return [now.startOf("day"), now.endOf("day")];
3471
+ }
3472
+ case "tomorrow": {
3473
+ const d = now.add(1, "day");
3474
+ return [d.startOf("day"), d.endOf("day")];
3475
+ }
3476
+ case "yesterday": {
3477
+ const d = now.subtract(1, "day");
3478
+ return [d.startOf("day"), d.endOf("day")];
3479
+ }
3480
+ case "this_week": {
3481
+ return [now.startOf("week"), now.endOf("week")];
3482
+ }
3483
+ case "last_week": {
3484
+ const d = now.subtract(1, "week");
3485
+ return [d.startOf("week"), d.endOf("week")];
3486
+ }
3487
+ case "this_month": {
3488
+ return [now.startOf("month"), now.endOf("month")];
3489
+ }
3490
+ case "last_month": {
3491
+ const d = now.subtract(1, "month");
3492
+ return [d.startOf("month"), d.endOf("month")];
3493
+ }
3494
+ case "last_7_days": {
3495
+ return [now.subtract(7, "day").startOf("day"), now.endOf("day")];
3496
+ }
3497
+ case "next_7_days": {
3498
+ return [now.startOf("day"), now.add(7, "day").endOf("day")];
3499
+ }
3500
+ case "last_30_days": {
3501
+ return [now.subtract(30, "day").startOf("day"), now.endOf("day")];
3502
+ }
3503
+ case "next_30_days": {
3504
+ return [now.startOf("day"), now.add(30, "day").endOf("day")];
3505
+ }
3506
+ case "specific":
3507
+ default:
3508
+ return void 0;
3509
+ }
3510
+ }
3511
+
3512
+ const MARGIN = 8;
3513
+ const defaultAdjustOptions = {
3514
+ left: true,
3515
+ right: true,
3516
+ top: true,
3517
+ bottom: true
3518
+ };
3519
+ function adjustPositionToViewport(position, modalRect, options = {}) {
3520
+ const { left, right, top, bottom } = {
3521
+ ...defaultAdjustOptions,
3522
+ ...options
3523
+ };
3524
+ const viewportWidth = window.innerWidth;
3525
+ const viewportHeight = window.innerHeight;
3526
+ let x = position.x;
3527
+ let y = position.y;
3528
+ if (right && x + modalRect.width > viewportWidth - MARGIN) {
3529
+ x = viewportWidth - modalRect.width - MARGIN;
3530
+ }
3531
+ if (left && x < MARGIN) {
3532
+ x = MARGIN;
3533
+ }
3534
+ if (bottom && y + modalRect.height > viewportHeight - MARGIN) {
3535
+ y = viewportHeight - modalRect.height - MARGIN;
3536
+ }
3537
+ if (top && y < MARGIN) {
3538
+ y = MARGIN;
3539
+ }
3540
+ return { x, y };
3541
+ }
3542
+ const useModalPosition = (contentRef, position, setPosition, adjustOptions) => {
3543
+ reactExports.useLayoutEffect(() => {
3544
+ if (!contentRef.current) return;
3545
+ const adjustPosition = () => {
3546
+ const rect = contentRef.current.getBoundingClientRect();
3547
+ const adjusted = adjustPositionToViewport(position, rect, adjustOptions);
3548
+ if (adjusted.x !== position.x || adjusted.y !== position.y) {
3549
+ setPosition(adjusted);
3550
+ }
3551
+ };
3552
+ adjustPosition();
3553
+ const resizeObserver = new ResizeObserver(() => {
3554
+ adjustPosition();
3555
+ });
3556
+ resizeObserver.observe(contentRef.current);
3557
+ return () => {
3558
+ resizeObserver.disconnect();
3559
+ };
3560
+ }, [contentRef, position, setPosition, adjustOptions]);
3561
+ };
3562
+
3563
+ const TableMenuModal = ({
3564
+ offsetParent,
3565
+ width = 180,
3566
+ isOpen = false,
3567
+ position,
3568
+ menuItems,
3569
+ onClose,
3570
+ onClick,
3571
+ onPositionChange
3572
+ }) => {
3573
+ const contentRef = reactExports.useRef(null);
3574
+ useModalPosition(contentRef, position, onPositionChange);
3575
+ return /* @__PURE__ */ React.createElement(
3576
+ baseModal.BaseModal,
3577
+ {
3578
+ offsetParent,
3579
+ width,
3580
+ open: isOpen,
3581
+ onClose,
3582
+ value: position,
3583
+ onChange: onPositionChange,
3584
+ className: "table-menu-modal"
3585
+ },
3586
+ /* @__PURE__ */ React.createElement(antd.Flex, { className: "menu-container", gap: 6, ref: contentRef }, /* @__PURE__ */ React.createElement(
3587
+ antd.Menu,
3588
+ {
3589
+ selectable: false,
3590
+ onClick,
3591
+ mode: "vertical",
3592
+ items: menuItems,
3593
+ getPopupContainer: (node) => node.parentNode
3594
+ }
3595
+ ))
3596
+ );
3597
+ };
3598
+
3599
+ exports.AttachmentEditor = AttachmentEditor;
3600
+ exports.AttachmentPreview = AttachmentPreview;
3601
+ exports.Dashboard = Dashboard;
3602
+ exports.DashboardItem = DashboardItem$1;
3603
+ exports.DetailsDrawer = DetailsDrawer;
3604
+ exports.DrawerForm = DrawerForm;
3605
+ exports.DrawerTitle = DrawerTitle;
3606
+ exports.FeatureRowField = FeatureRowField;
3607
+ exports.FeatureRowFields = FeatureRowFields;
3608
+ exports.FilterDatePicker = FilterDatePicker;
3609
+ exports.FilterDateSelect = FilterDateSelect;
3610
+ exports.FilterFileSelect = FilterFileSelect;
3611
+ exports.FilterGroup = FilterGroup;
3612
+ exports.FilterInput = FilterInput;
3613
+ exports.FilterModal = FilterModal;
3614
+ exports.FilterNumber = FilterNumber;
3615
+ exports.FilterOperator = FilterOperator;
3616
+ exports.FilterPeopleSelect = FilterPeopleSelect;
3617
+ exports.FilterSelect = FilterSelect;
3618
+ exports.FilterTitle = FilterTitle;
3619
+ exports.FilterTypeSelect = FilterTypeSelect;
3620
+ exports.FilterValue = FilterValue;
3621
+ exports.FormAvatar = FormAvatar;
3622
+ exports.FormDateTimePicker = FormDateTimePicker;
3623
+ exports.FormInputNumber = FormInputNumber;
3624
+ exports.FormJsonEditor = FormJsonEditor;
3625
+ exports.FormLinkEdit = FormLinkEdit;
3626
+ exports.FormMultiSelect = FormMultiSelect;
3627
+ exports.FormSingleSelect = FormSingleSelect;
3628
+ exports.FormTimeLen = FormTimeLen;
3629
+ exports.FormUpload = FormUpload;
3630
+ exports.JsonEditor = JsonEditor;
3631
+ exports.ObjectURLManager = ObjectURLManager;
3632
+ exports.Operator = Operator;
3633
+ exports.RowLabel = RowLabel;
3634
+ exports.SearchModal = SearchModal;
3635
+ exports.TableFilterForm = TableFilterForm;
3636
+ exports.TableMenuModal = TableMenuModal;
3637
+ exports.adjustPositionToViewport = adjustPositionToViewport;
3638
+ exports.dateValues = dateValues;
3639
+ exports.findAvailablePosition = findAvailablePosition;
3640
+ exports.generateCrossDashedBase64 = generateCrossDashedBase64;
3641
+ exports.getDateBySpecific = getDateBySpecific;
3642
+ exports.getDateRangeByOption = getDateRangeByOption;
3643
+ exports.resolveDateRange = resolveDateRange;
3644
+ exports.useDetailsDrawerContext = useDetailsDrawerContext;
3645
+ exports.useModalPosition = useModalPosition;