PageSourceSearch

https://app.formstatus.co/build/assets/New-a7ry3TPX.js

js formstatus.co collected 2026-09-24 09:07:10 UTC 97,639 bytes, 2,625 lines download raw bytes

1import { aj as warningOnce, h as _toConsumableArray, z as _inherits, a1 as _createSuper, E as _classCallCheck, n as _defineProperty, a6 as _assertThisInitialized, B as _createClass, i as _objectWithoutProperties, m as classNames, R as React, g as _extends, q as _objectSpread2, r as reactExports, K as _typeof, f as unit, M as clearFix, N as textEllipsis, ak as blue, o as resetComponent, e as ConfigContext, w as CSSMotion, O as CSSMotionList, v as useComponentConfig, D as DisabledContext, l as localeValues, P as reactDomExports, G, X, j as jsxRuntimeExports, A as At, S as Se } from "./app-DJioUbN4.js";
2import StepTwoForm from "./StepTwoForm-DitYLuMi.js";
3import StepThreeForm from "./StepThreeForm-DyhKMsbw.js";
4import { i as initFadeMotion, M as Modal } from "./index-CJi8uQVF.js";
5import { S as Switch } from "./index-BUJ9CxXV.js";
6import { _ as _asyncToGenerator, a as _regeneratorRuntime } from "./asyncToGenerator-DBQnNTOo.js";
7import { p as pickAttrs } from "./pickAttrs-odLRUG6a.js";
8import { K as Keyframe, j as initCollapseMotion, a as useMergedState, u as useLocale } from "./ContextIsolator-B0hFr7x3.js";
9import { g as genCollapseMotion } from "./collapse-DdhdDMvL.js";
10import { g as genStyleHooks, m as merge, I as Icon, c as cloneElement } from "./reactNode-B_hytNsN.js";
11import { o as omit, R as RefIcon$6 } from "./compact-item-DGA2vHNm.js";
12import { B as Button } from "./button-CEU8hL_t.js";
13import { R as RefIcon$3 } from "./DeleteOutlined-BLwVDHNA.js";
14import { R as RefIcon$4 } from "./DownloadOutlined-CzZUsYXW.js";
15import { R as RefIcon$5 } from "./EyeOutlined-CZWGjvEz.js";
16import { P as Progress } from "./progress-BbC-NL-8.js";
17import { T as Tooltip } from "./index-Bm7egiKX.js";
18import { u as useForceUpdate } from "./useForceUpdate-D5eV3kSs.js";
19import { s as staticMethods } from "./index-Sv55INy7.js";
20import { T as Typography } from "./index-CFq58Aey.js";
21import { A as AuthenticatedLayout } from "./AuthenticatedLayout-BHFGLD_a.js";
22import "./index-VUzZCm9g.js";
23import "./CheckCircleFilled-B2LmPAOx.js";
24import "./CloseCircleFilled-CjLMhGFe.js";
25import "./ExclamationCircleFilled-Ka7CpAGL.js";
26import "./InfoCircleFilled-ClfJNR-1.js";
27import "./callSuper-CrMXBRqw.js";
28import "./ActionButton-G_xxefOE.js";
29import "./Skeleton-CedpGP7a.js";
30import "./index-uI8lezvp.js";
31import "./zoom-B_eM1mkQ.js";
32import "./useClosable-Bpa2dDe5.js";
33import "./extendsObject-2rRqFlJz.js";
34import "./PurePanel-CAWogl25.js";
35import "./CheckOutlined-B5v3icNn.js";
36import "./index-CePQiBE9.js";
37import "./colors-DhNuxP_h.js";
38import "./context-BgWH0adB.js";
39import "./styleChecker-C1aHGQEm.js";
40import "./TextArea-CJdPGunb.js";
41import "./getAllowClear-BrssXZkv.js";
42import "./logo-DZUjIKjN.js";
43import "./Modal-1kAAfUhb.js";
44import "./transition-Mw8jrymF.js";
45import "./index-DZL9fRVq.js";
46import "./index-B9sJjom6.js";
47import "./shouldDisableButton-ti8szdbp.js";
48import "./index-CS_oGK2Z.js";
49const attrAccept = function(file, acceptedFiles) {
50  if (file && acceptedFiles) {
51    var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(",");
52    var fileName = file.name || "";
53    var mimeType = file.type || "";
54    var baseMimeType = mimeType.replace(/\/.*$/, "");
55    return acceptedFilesArray.some(function(type) {
56      var validType = type.trim();
57      if (/^\*(\/\*)?$/.test(type)) {
58        return true;
59      }
60      if (validType.charAt(0) === ".") {
61        var lowerFileName = fileName.toLowerCase();
62        var lowerType = validType.toLowerCase();
63        var affixList = [lowerType];
64        if (lowerType === ".jpg" || lowerType === ".jpeg") {
65          affixList = [".jpg", ".jpeg"];
66        }
67        return affixList.some(function(affix) {
68          return lowerFileName.endsWith(affix);
69        });
70      }
71      if (/\/\*$/.test(validType)) {
72        return baseMimeType === validType.replace(/\/.*$/, "");
73      }
74      if (mimeType === validType) {
75        return true;
76      }
77      if (/^\w+$/.test(validType)) {
78        warningOnce(false, "Upload takes an invalidate 'accept' type '".concat(validType, "'.Skip for check."));
79        return true;
80      }
81      return false;
82    });
83  }
84  return true;
85};
86function getError(option, xhr) {
87  var msg = "cannot ".concat(option.method, " ").concat(option.action, " ").concat(xhr.status, "'");
88  var err = new Error(msg);
89  err.status = xhr.status;
90  err.method = option.method;
91  err.url = option.action;
92  return err;
93}
94function getBody(xhr) {
95  var text = xhr.responseText || xhr.response;
96  if (!text) {
97    return text;
98  }
99  try {
100    return JSON.parse(text);
101  } catch (e) {
102    return text;
103  }
104}
105function upload(option) {
106  var xhr = new XMLHttpRequest();
107  if (option.onProgress && xhr.upload) {
108    xhr.upload.onprogress = function progress(e) {
109      if (e.total > 0) {
110        e.percent = e.loaded / e.total * 100;
111      }
112      option.onProgress(e);
113    };
114  }
115  var formData = new FormData();
116  if (option.data) {
117    Object.keys(option.data).forEach(function(key) {
118      var value = option.data[key];
119      if (Array.isArray(value)) {
120        value.forEach(function(item) {
121          formData.append("".concat(key, "[]"), item);
122        });
123        return;
124      }
125      formData.append(key, value);
126    });
127  }
128  if (option.file instanceof Blob) {
129    formData.append(option.filename, option.file, option.file.name);
130  } else {
131    formData.append(option.filename, option.file);
132  }
133  xhr.onerror = function error(e) {
134    option.onError(e);
135  };
136  xhr.onload = function onload() {
137    if (xhr.status < 200 || xhr.status >= 300) {
138      return option.onError(getError(option, xhr), getBody(xhr));
139    }
140    return option.onSuccess(getBody(xhr), xhr);
141  };
142  xhr.open(option.method, option.action, true);
143  if (option.withCredentials && "withCredentials" in xhr) {
144    xhr.withCredentials = true;
145  }
146  var headers = option.headers || {};
147  if (headers["X-Requested-With"] !== null) {
148    xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
149  }
150  Object.keys(headers).forEach(function(h) {
151    if (headers[h] !== null) {
152      xhr.setRequestHeader(h, headers[h]);
153    }
154  });
155  xhr.send(formData);
156  return {
157    abort: function abort() {
158      xhr.abort();
159    }
160  };
161}
162var traverseFileTree = /* @__PURE__ */ function() {
163  var _ref = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee4(files, isAccepted) {
164    var flattenFileList, progressFileList, readDirectory, _readDirectory, readFile, _readFile, _traverseFileTree, wipIndex;
165    return _regeneratorRuntime().wrap(function _callee4$(_context4) {
166      while (1) switch (_context4.prev = _context4.next) {
167        case 0:
168          _readFile = function _readFile3() {
169            _readFile = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3(item) {
170              return _regeneratorRuntime().wrap(function _callee3$(_context3) {
171                while (1) switch (_context3.prev = _context3.next) {
172                  case 0:
173                    return _context3.abrupt("return", new Promise(function(reslove) {
174                      item.file(function(file) {
175                        if (isAccepted(file)) {
176                          if (item.fullPath && !file.webkitRelativePath) {
177                            Object.defineProperties(file, {
178                              webkitRelativePath: {
179                                writable: true
180                              }
181                            });
182                            file.webkitRelativePath = item.fullPath.replace(/^\//, "");
183                            Object.defineProperties(file, {
184                              webkitRelativePath: {
185                                writable: false
186                              }
187                            });
188                          }
189                          reslove(file);
190                        } else {
191                          reslove(null);
192                        }
193                      });
194                    }));
195                  case 1:
196                  case "end":
197                    return _context3.stop();
198                }
199              }, _callee3);
200            }));
201            return _readFile.apply(this, arguments);
202          };
203          readFile = function _readFile2(_x4) {
204            return _readFile.apply(this, arguments);
205          };
206          _readDirectory = function _readDirectory3() {
207            _readDirectory = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2(directory) {
208              var dirReader, entries, results, n, i;
209              return _regeneratorRuntime().wrap(function _callee2$(_context2) {
210                while (1) switch (_context2.prev = _context2.next) {
211                  case 0:
212                    dirReader = directory.createReader();
213                    entries = [];
214                  case 2:
215                    _context2.next = 5;
216                    return new Promise(function(resolve) {
217                      dirReader.readEntries(resolve, function() {
218                        return resolve([]);
219                      });
220                    });
221                  case 5:
222                    results = _context2.sent;
223                    n = results.length;
224                    if (n) {
225                      _context2.next = 9;
226                      break;
227                    }
228                    return _context2.abrupt("break", 12);
229                  case 9:
230                    for (i = 0; i < n; i++) {
231                      entries.push(results[i]);
232                    }
233                    _context2.next = 2;
234                    break;
235                  case 12:
236                    return _context2.abrupt("return", entries);
237                  case 13:
238                  case "end":
239                    return _context2.stop();
240                }
241              }, _callee2);
242            }));
243            return _readDirectory.apply(this, arguments);
244          };
245          readDirectory = function _readDirectory2(_x3) {
246            return _readDirectory.apply(this, arguments);
247          };
248          flattenFileList = [];
249          progressFileList = [];
250          files.forEach(function(file) {
251            return progressFileList.push(file.webkitGetAsEntry());
252          });
253          _traverseFileTree = /* @__PURE__ */ function() {
254            var _ref2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(item, path) {
255              var _file, entries;
256              return _regeneratorRuntime().wrap(function _callee$(_context) {
257                while (1) switch (_context.prev = _context.next) {
258                  case 0:
259                    if (item) {
260                      _context.next = 2;
261                      break;
262                    }
263                    return _context.abrupt("return");
264                  case 2:
265                    item.path = path || "";
266                    if (!item.isFile) {
267                      _context.next = 10;
268                      break;
269                    }
270                    _context.next = 6;
271                    return readFile(item);
272                  case 6:
273                    _file = _context.sent;
274                    if (_file) {
275                      flattenFileList.push(_file);
276                    }
277                    _context.next = 15;
278                    break;
279                  case 10:
280                    if (!item.isDirectory) {
281                      _context.next = 15;
282                      break;
283                    }
284                    _context.next = 13;
285                    return readDirectory(item);
286                  case 13:
287                    entries = _context.sent;
288                    progressFileList.push.apply(progressFileList, _toConsumableArray(entries));
289                  case 15:
290                  case "end":
291                    return _context.stop();
292                }
293              }, _callee);
294            }));
295            return function _traverseFileTree2(_x5, _x6) {
296              return _ref2.apply(this, arguments);
297            };
298          }();
299          wipIndex = 0;
300        case 9:
301          if (!(wipIndex < progressFileList.length)) {
302            _context4.next = 15;
303            break;
304          }
305          _context4.next = 12;
306          return _traverseFileTree(progressFileList[wipIndex]);
307        case 12:
308          wipIndex++;
309          _context4.next = 9;
310          break;
311        case 15:
312          return _context4.abrupt("return", flattenFileList);
313        case 16:
314        case "end":
315          return _context4.stop();
316      }
317    }, _callee4);
318  }));
319  return function traverseFileTree2(_x, _x2) {
320    return _ref.apply(this, arguments);
321  };
322}();
323var now = +/* @__PURE__ */ new Date();
324var index = 0;
325function uid() {
326  return "rc-upload-".concat(now, "-").concat(++index);
327}
328var _excluded = ["component", "prefixCls", "className", "classNames", "disabled", "id", "name", "style", "styles", "multiple", "accept", "capture", "children", "directory", "folder", "openFileDialogOnClick", "onMouseEnter", "onMouseLeave", "hasControlInside"];
329var AjaxUploader = /* @__PURE__ */ function(_Component) {
330  _inherits(AjaxUploader2, _Component);
331  var _super = _createSuper(AjaxUploader2);
332  function AjaxUploader2() {
333    var _this;
334    _classCallCheck(this, AjaxUploader2);
335    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
336      args[_key] = arguments[_key];
337    }
338    _this = _super.call.apply(_super, [this].concat(args));
339    _defineProperty(_assertThisInitialized(_this), "state", {
340      uid: uid()
341    });
342    _defineProperty(_assertThisInitialized(_this), "reqs", {});
343    _defineProperty(_assertThisInitialized(_this), "fileInput", void 0);
344    _defineProperty(_assertThisInitialized(_this), "_isMounted", void 0);
345    _defineProperty(_assertThisInitialized(_this), "onChange", function(e) {
346      var _this$props = _this.props, accept = _this$props.accept, directory = _this$props.directory;
347      var files = e.target.files;
348      var acceptedFiles = _toConsumableArray(files).filter(function(file) {
349        return !directory || attrAccept(file, accept);
350      });
351      _this.uploadFiles(acceptedFiles);
352      _this.reset();
353    });
354    _defineProperty(_assertThisInitialized(_this), "onClick", function(event) {
355      var el = _this.fileInput;
356      if (!el) {
357        return;
358      }
359      var target = event.target;
360      var onClick = _this.props.onClick;
361      if (target && target.tagName === "BUTTON") {
362        var parent = el.parentNode;
363        parent.focus();
364        target.blur();
365      }
366      el.click();
367      if (onClick) {
368        onClick(event);
369      }
370    });
371    _defineProperty(_assertThisInitialized(_this), "onKeyDown", function(e) {
372      if (e.key === "Enter") {
373        _this.onClick(e);
374      }
375    });
376    _defineProperty(_assertThisInitialized(_this), "onDataTransferFiles", /* @__P
376URE__ */ function() {
377      var _ref = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(dataTransfer, existFileCallback) {
378        var _this$props2, multiple, accept, directory, items, files, acceptFiles;
379        return _regeneratorRuntime().wrap(function _callee$(_context) {
380          while (1) switch (_context.prev = _context.next) {
381            case 0:
382              _this$props2 = _this.props, multiple = _this$props2.multiple, accept = _this$props2.accept, directory = _this$props2.directory;
383              items = _toConsumableArray(dataTransfer.items || []);
384              files = _toConsumableArray(dataTransfer.files || []);
385              if (files.length > 0 || items.some(function(item) {
386                return item.kind === "file";
387              })) {
388                existFileCallback === null || existFileCallback === void 0 || existFileCallback();
389              }
390              if (!directory) {
391                _context.next = 11;
392                break;
393              }
394              _context.next = 7;
395              return traverseFileTree(Array.prototype.slice.call(items), function(_file) {
396                return attrAccept(_file, _this.props.accept);
397              });
398            case 7:
399              files = _context.sent;
400              _this.uploadFiles(files);
401              _context.next = 14;
402              break;
403            case 11:
404              acceptFiles = _toConsumableArray(files).filter(function(file) {
405                return attrAccept(file, accept);
406              });
407              if (multiple === false) {
408                acceptFiles = files.slice(0, 1);
409              }
410              _this.uploadFiles(acceptFiles);
411            case 14:
412            case "end":
413              return _context.stop();
414          }
415        }, _callee);
416      }));
417      return function(_x, _x2) {
418        return _ref.apply(this, arguments);
419      };
420    }());
421    _defineProperty(_assertThisInitialized(_this), "onFilePaste", /* @__PURE__ */ function() {
422      var _ref2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2(e) {
423        var pastable, clipboardData;
424        return _regeneratorRuntime().wrap(function _callee2$(_context2) {
425          while (1) switch (_context2.prev = _context2.next) {
426            case 0:
427              pastable = _this.props.pastable;
428              if (pastable) {
429                _context2.next = 3;
430                break;
431              }
432              return _context2.abrupt("return");
433            case 3:
434              if (!(e.type === "paste")) {
435                _context2.next = 6;
436                break;
437              }
438              clipboardData = e.clipboardData;
439              return _context2.abrupt("return", _this.onDataTransferFiles(clipboardData, function() {
440                e.preventDefault();
441              }));
442            case 6:
443            case "end":
444              return _context2.stop();
445          }
446        }, _callee2);
447      }));
448      return function(_x3) {
449        return _ref2.apply(this, arguments);
450      };
451    }());
452    _defineProperty(_assertThisInitialized(_this), "onFileDragOver", function(e) {
453      e.preventDefault();
454    });
455    _defineProperty(_assertThisInitialized(_this), "onFileDrop", /* @__PURE__ */ function() {
456      var _ref3 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3(e) {
457        var dataTransfer;
458        return _regeneratorRuntime().wrap(function _callee3$(_context3) {
459          while (1) switch (_context3.prev = _context3.next) {
460            case 0:
461              e.preventDefault();
462              if (!(e.type === "drop")) {
463                _context3.next = 4;
464                break;
465              }
466              dataTransfer = e.dataTransfer;
467              return _context3.abrupt("return", _this.onDataTransferFiles(dataTransfer));
468            case 4:
469            case "end":
470              return _context3.stop();
471          }
472        }, _callee3);
473      }));
474      return function(_x4) {
475        return _ref3.apply(this, arguments);
476      };
477    }());
478    _defineProperty(_assertThisInitialized(_this), "uploadFiles", function(files) {
479      var originFiles = _toConsumableArray(files);
480      var postFiles = originFiles.map(function(file) {
481        file.uid = uid();
482        return _this.processFile(file, originFiles);
483      });
484      Promise.all(postFiles).then(function(fileList) {
485        var onBatchStart = _this.props.onBatchStart;
486        onBatchStart === null || onBatchStart === void 0 || onBatchStart(fileList.map(function(_ref4) {
487          var origin = _ref4.origin, parsedFile = _ref4.parsedFile;
488          return {
489            file: origin,
490            parsedFile
491          };
492        }));
493        fileList.filter(function(file) {
494          return file.parsedFile !== null;
495        }
495).forEach(function(file) {
496          _this.post(file);
497        });
498      });
499    });
500    _defineProperty(_assertThisInitialized(_this), "processFile", /* @__PURE__ */ function() {
501      var _ref5 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee4(file, fileList) {
502        var beforeUpload, transformedFile, action, mergedAction, data, mergedData, parsedData, parsedFile, mergedParsedFile;
503        return _regeneratorRuntime().wrap(function _callee4$(_context4) {
504          while (1) switch (_context4.prev = _context4.next) {
505            case 0:
506              beforeUpload = _this.props.beforeUpload;
507              transformedFile = file;
508              if (!beforeUpload) {
509                _context4.next = 14;
510                break;
511              }
512              _context4.prev = 3;
513              _context4.next = 6;
514              return beforeUpload(file, fileList);
515            case 6:
516              transformedFile = _context4.sent;
517              _context4.next = 12;
518              break;
519            case 9:
520              _context4.prev = 9;
521              _context4.t0 = _context4["catch"](3);
522              transformedFile = false;
523            case 12:
524              if (!(transformedFile === false)) {
525                _context4.next = 14;
526                break;
527              }
528              return _context4.abrupt("return", {
529                origin: file,
530                parsedFile: null,
531                action: null,
532                data: null
533              });
534            case 14:
535              action = _this.props.action;
536              if (!(typeof action === "function")) {
537                _context4.next = 21;
538                break;
539              }
540              _context4.next = 18;
541              return action(file);
542            case 18:
543              mergedAction = _context4.sent;
544              _context4.next = 22;
545              break;
546            case 21:
547              mergedAction = action;
548            case 22:
549              data = _this.props.data;
550              if (!(typeof data === "function")) {
551                _context4.next = 29;
552                break;
553              }
554              _context4.next = 26;
555              return data(file);
556            case 26:
557              mergedData = _context4.sent;
558              _context4.next = 30;
559              break;
560            case 29:
561              mergedData = data;
562            case 30:
563              parsedData = // string type is from legacy `transformFile`.
564              // Not sure if this will work since no related test case works with it
565              (_typeof(transformedFile) === "object" || typeof transformedFile === "string") && transformedFile ? transformedFile : file;
566              if (parsedData instanceof File) {
567                parsedFile = parsedData;
568              } else {
569                parsedFile = new File([parsedData], file.name, {
570                  type: file.type
571                });
572              }
573              mergedParsedFile = parsedFile;
574              mergedParsedFile.uid = file.uid;
575              return _context4.abrupt("return", {
576                origin: file,
577                data: mergedData,
578                parsedFile: mergedParsedFile,
579                action: mergedAction
580              });
581            case 35:
582            case "end":
583              return _context4.stop();
584          }
585        }, _callee4, null, [[3, 9]]);
586      }));
587      return function(_x5, _x6) {
588        return _ref5.apply(this, arguments);
589      };
590    }());
591    _defineProperty(_assertThisInitialized(_this), "saveFileInput", function(node) {
592      _this.fileInput = node;
593    });
594    return _this;
595  }
596  _createClass(AjaxUploader2, [{
597    key: "componentDidMount",
598    value: function componentDidMount() {
599      this._isMounted = true;
600      var pastable = this.props.pastable;
601      if (pastable) {
602        document.addEventListener("paste", this.onFilePaste);
603      }
604    }
605  }, {
606    key: "componentWillUnmount",
607    value: function componentWillUnmount() {
608      this._isMounted = false;
609      this.abort();
610      document.removeEventListener("paste", this.onFilePaste);
611    }
612  }, {
613    key: "componentDidUpdate",
614    value: function componentDidUpdate(prevProps) {
615      var pastable = this.props.pastable;
616      if (pastable && !prevProps.pastable) {
617        document.addEventListener("paste", this.onFilePaste);
618      } else if (!pastable && prevProps.pastable) {
619        document.removeEventListener("paste", this.onFilePaste);
620      }
621    }
622  }, {
623    key: "post",
624    value: function post(_ref6) {
625      var _this2 = this;
626      var data = _ref6.data, origin = _ref6.origin, action = _ref6.action, parsedFile = _ref6.parsedFile;
627      if (!this._isMounted) {
628        return;
629      }
630      var _this$props3 = this.props, onStart = _this$props3.onStart, customRequest = _this$props3.customRequest, name = _this$props3.name, headers = _this$props3.headers, withCredentials = _this$props3.withCredentials, method = _this$props3.method;
631      var uid2 = origin.uid;
632      var request = customRequest || upload;
633      var requestOption = {
634        action,
635        filename: name,
636        data,
637        file: parsedFile,
638        headers,
639        withCredentials,
640        method: method || "post",
641        onProgress: function onProgress(e) {
642          var onProgress2 = _this2.props.onProgress;
643          onProgress2 === null || onProgress2 === void 0 || onProgress2(e, parsedFile);
644        },
645        onSuccess: function onSuccess(ret, xhr) {
646          var onSuccess2 = _this2.props.onSuccess;
647          onSuccess2 === null || onSuccess2 === void 0 || onSuccess2(ret, parsedFile, xhr);
648          delete _this2.reqs[uid2];
649        },
650        onError: function onError(err, ret) {
651          var onError2 = _this2.props.onError;
652          onError2 === null || onError2 === void 0 || onError2(err, ret, parsedFile);
653          delete _this2.reqs[uid2];
654        }
655      };
656      onStart(origin);
657      this.reqs[uid2] = request(requestOption, {
658        defaultRequest: upload
659      });
660    }
661  }, {
662    key: "reset",
663    value: function reset() {
664      this.setState({
665        uid: uid()
666      });
667    }
668  }, {
669    key: "abort",
670    value: function abort(file) {
671      var reqs = this.reqs;
672      if (file) {
673        var uid2 = file.uid ? file.uid : file;
674        if (reqs[uid2] && reqs[uid2].abort) {
675          reqs[uid2].abort();
676        }
677        delete reqs[uid2];
678      } else {
679        Object.keys(reqs).forEach(function(uid3) {
680          if (reqs[uid3] && reqs[uid3].abort) {
681            reqs[uid3].abort();
682          }
683          delete reqs[uid3];
684        });
685      }
686    }
687  }, {
688    key: "render",
689    value: function render3() {
690      var _this$props4 = this.props, Tag = _this$props4.component, prefixCls = _this$props4.prefixCls, className = _this$props4.className, _this$props4$classNam = _this$props4.classNames, classNames$1 = _this$props4$classNam === void 0 ? {} : _this$props4$classNam, disabled = _this$props4.disabled, id = _this$props4.id, name = _this$props4.name, style = _this$props4.style, _this$props4$styles = _this$props4.styles, styles = _this$props4$styles === void 0 ? {} : _this$props4$styles, multiple = _this$props4.multiple, accept = _this$props4.accept, capture = _this$props4.capture, children = _this$props4.children, directory = _this$props4.directory, folder = _this$props4.folder, openFileDialogOnClick = _this$props4.openFileDialogOnClick, onMouseEnter = _this$props4.onMouseEnter, onMouseLeave = _this$props4.onMouseLeave, hasControlInside = _this$props4.hasControlInside, otherProps = _objectWithoutProperties(_this$props4, _excluded);
691      var cls = classNames(_defineProperty(_defineProperty(_defineProperty({}, prefixCls, true), "".concat(prefixCls, "-disabled"), disabled), className, className));
692      var dirProps = directory || folder ? {
693        directory: "directory",
694        webkitdirectory: "webkitdirectory"
695      } : {};
696      var events = disabled ? {} : {
697        onClick: openFileDialogOnClick ? this.onClick : function() {
698        },
699        onKeyDown: openFileDialogOnClick ? this.onKeyDown : function() {
700        },
701        onMouseEnter,
702        onMouseLeave,
703        onDrop: this.onFileDrop,
704        onDragOver: this.onFileDragOver,
705        tabIndex: hasControlInside ? void 0 : "0"
706      };
707      return /* @__PURE__ */ React.createElement(Tag, _extends({}, events, {
708        className: cls,
709        role: hasControlInside ? void 0 : "button",
710        style
711      }), /* @__PURE__ */ React.createElement("input", _extends({}, pickAttrs(otherProps, {
712        aria: true,
713        data: true
714      }), {
715        id,
716        name,
717        disabled,
718        type: "file",
719        ref: this.saveFileInput,
720        onClick: function onClick(e) {
721          return e.stopPropagation();
722        },
723        key: this.state.uid,
724        style: _objectSpread2({
725          display: "none"
726        }, styles.input),
727        className: classNames$1.input,
728        accept
729      }, dirProps, {
730        multiple,
731        onChange: this.onChange
732      }, capture != null ? {
733        capture
734      } : {})), children);
735    }
736  }]);
737  return AjaxUploader2;
738}(reactExports.Component);
739function empty() {
740}
741var Upload$2 = /* @__PURE__ */ function(_Component) {
742  _inherits(Upload2, _Component);
743  var _super = _createSuper(Upload2);
744  function Upload2() {
745    var _this;
746    _classCallCheck(this, Upload2);
747    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
748      args[_key] = arguments[_key];
749    }
750    _this = _super.call.apply(_super, [this].concat(args));
751    _defineProperty(_assertThisInitialized(_this), "uploader", void 0);
752    _defineProperty(_assertThisInitialized(_this), "saveUploader", function(node) {
753      _this.uploader = node;
754    });
755    return _this;
756  }
757  _createClass(Upload2, [{
758    key: "abort",
759    value: function abort(file) {
760      this.uploader.abort(file);
761    }
762  }, {
763    key: "render",
764    value: function render3() {
765      return /* @__PURE__ */ React.createElement(AjaxUploader, _extends({}, this.props, {
766        ref: this.saveUploader
767      }));
768    }
769  }]);
770  return Upload2;
771}(reactExports.Component);
772_defineProperty(Upload$2, "defaultProps", {
773  component: "span",
774  prefixCls: "rc-upload",
775  data: {},
776  headers: {},
777  name: "file",
778  multipart: false,
779  onStart: empty,
780  onError: empty,
781  onSuccess: empty,
782  multiple: false,
783  beforeUpload: null,
784  customRequest: null,
785  withCredentials: false,
786  openFileDialogOnClick: true,
787  hasControlInside: false
788});
789const genDraggerStyle = (token) => {
790  const {
791    componentCls,
792    iconCls
793  } = token;
794  return {
795    [`${componentCls}-wrapper`]: {
796      [`${componentCls}-drag`]: {
797        position: "relative",
798        width: "100%",
799        height: "100%",
800        textAlign: "center",
801        background: token.colorFillAlter,
802        border: `${unit(token.lineWidth)} dashed ${token.colorBorder}`,
803        borderRadius: token.borderRadiusLG,
804        cursor: "pointer",
805        transition: `border-color ${token.motionDurationSlow}`,
806        [componentCls]: {
807          padding: token.padding
808        },
809        [`${componentCls}-btn`]: {
810          display: "table",
811          width: "100%",
812          height: "100%",
813          outline: "none",
814          borderRadius: token.borderRadiusLG,
815          "&:focus-visible": {
816            outline: `${unit(token.lineWidthFocus)} solid ${token.colorPrimaryBorder}`
817          }
818        },
819        [`${componentCls}-drag-container`]: {
820          display: "table-cell",
821          verticalAlign: "middle"
822        },
823        [`
824          &:not(${componentCls}-disabled):hover,
825          &-hover:not(${componentCls}-disabled)
826        `]: {
827          borderColor: token.colorPrimaryHover
828        },
829        [`p${componentCls}-drag-icon`]: {
830          marginBottom: token.margin,
831          [iconCls]: {
832            color: token.colorPrimary,
833            fontSize: token.uploadThumbnailSize
834          }
835        },
836        [`p${componentCls}-text`]: {
837          margin: `0 0 ${unit(token.marginXXS)}`,
838          color: token.colorTextHeading,
839          fontSize: token.fontSizeLG
840        },
841        [`p${componentCls}-hint`]: {
842          color: token.colorTextDescription,
843          fontSize: token.fontSize
844        },
845        // ===================== Disabled =====================
846        [`&${componentCls}-disabled`]: {
847          [`p${componentCls}-drag-icon ${iconCls},
848            p${componentCls}-text,
849            p${componentCls}-hint
850          `]: {
851            color: token.colorTextDisabled
852          }
853        }
854      }
855    }
856  };
857};
858const genListStyle = (token) => {
859  const {
860    componentCls,
861    iconCls,
862    fontSize,
863    lineHeight,
864    calc
865  } = token;
866  const itemCls = `${componentCls}-list-item`;
867  const actionsCls = `${itemCls}-actions`;
868  const actionCls = `${itemCls}-action`;
869  return {
870    [`${componentCls}-wrapper`]: {
871      [`${componentCls}-list`]: Object.assign(Object.assign({}, clearFix()), {
872        lineHeight: token.lineHeight,
873        [itemCls]: {
874          position: "relative",
875          height: calc(token.lineHeight).mul(fontSize).equal(),
876          marginTop: token.marginXS,
877          fontSize,
878          display: "flex",
879          alignItems: "center",
880          transition: `background-color ${token.motionDurationSlow}`,
881          borderRadius: token.borderRadiusSM,
882          "&:hover": {
883            backgroundColor: token.controlItemBgHover
884          },
885          [`${itemCls}-name`]: Object.assign(Object.assign({}, textEllipsis), {
886            padding: `0 ${unit(token.paddingXS)}`,
887            lineHeight,
888            flex: "auto",
889            transition: `all ${token.motionDurationSlow}`
890          }),
891          [actionsCls]: {
892            whiteSpace: "nowrap",
893            [actionCls]: {
894              opacity: 0
895            },
896            [iconCls]: {
897              color: token.actionsColor,
898              transition: `all ${token.motionDurationSlow}`
899            },
900            [`
901              ${actionCls}:focus-visible,
902              &.picture ${actionCls}
903            `]: {
904              opacity: 1
905            }
906          },
907          [`${componentCls}-icon ${iconCls}`]: {
908            color: token.colorIcon,
909            fontSize
910          },
911          [`${itemCls}-progress`]: {
912            position: "absolute",
913            bottom: token.calc(token.uploadProgressOffset).mul(-1).equal(),
914            width: "100%",
915            paddingInlineStart: calc(fontSize).add(token.paddingXS).equal(),
916            fontSize,
917            lineHeight: 0,
918            pointerEvents: "none",
919            "> div": {
920              margin: 0
921            }
922          }
923        },
924        [`${itemCls}:hover ${actionCls}`]: {
925          opacity: 1
926        },
927        [`${itemCls}-error`]: {
928          color: token.colorError,
929          [`${itemCls}-name, ${componentCls}-icon ${iconCls}`]: {
930            color: token.colorError
931          },
932          [actionsCls]: {
933            [`${iconCls}, ${iconCls}:hover`]: {
934              color: token.colorError
935            },
936            [actionCls]: {
937              opacity: 1
938            }
939          }
940        },
941        [`${componentCls}-list-item-container`]: {
942          transition: `opacity ${token.motionDurationSlow}, height ${token.motionDurationSlow}`,
943          // For smooth removing animation
944          "&::before": {
945            display: "table",
946            width: 0,
947            height: 0,
948            content: '""'
949          }
950        }
951      })
952    }
953  };
954};
955const genMotionStyle = (token) => {
956  const {
957    componentCls
958  } = token;
959  const uploadAnimateInlineIn = new Keyframe("uploadAnimateInlineIn", {
960    from: {
961      width: 0,
962      height: 0,
963      padding: 0,
964      opacity: 0,
965      margin: token.calc(token.marginXS).div(-2).equal()
966    }
967  });
968  const uploadAnimateInlineOut = new Keyframe("uploadAnimateInlineOut", {
969    to: {
970      width: 0,
971      height: 0,
972      padding: 0,
973      opacity: 0,
974      margin: token.calc(token.marginXS).div(-2).equal()
975    }
976  });
977  const inlineCls = `${componentCls}-animate-inline`;
978  return [{
979    [`${componentCls}-wrapper`]: {
980      [`${inlineCls}-appear, ${inlineCls}-enter, ${inlineCls}-leave`]: {
981        animationDuration: token.motionDurationSlow,
982        animationTimingFunction: token.motionEaseInOutCirc,
983        animationFillMode: "forwards"
984      },
985      [`${inlineCls}-appear, ${inlineCls}-enter`]: {
986        animationName: uploadAnimateInlineIn
987      },
988      [`${inlineCls}-leave`]: {
989        animationName: uploadAnimateInlineOut
990      }
991    }
992  }, {
993    [`${componentCls}-wrapper`]: initFadeMotion(token)
994  }, uploadAnimateInlineIn, uploadAnimateInlineOut];
995};
996const genPictureStyle = (token) => {
997  const {
998    componentCls,
999    iconCls,
1000    uploadThumbnailSize,
1001    uploadProgressOffset,
1002    calc
1003  } = token;
1004  const listCls = `${componentCls}-list`;
1005  const itemCls = `${listCls}-item`;
1006  return {
1007    [`${componentCls}-wrapper`]: {
1008      // ${listCls} 增加优先级
1009      [`
1010        ${listCls}${listCls}-picture,
1011        ${listCls}${listCls}-picture-card,
1012        ${listCls}${listCls}-picture-circle
1013      `]: {
1014        [itemCls]: {
1015          position: "relative",
1016          height: calc(uploadThumbnailSize).add(calc(token.lineWidth).mul(2)).add(calc(token.paddingXS).mul(2)).equal(),
1017          padding: token.paddingXS,
1018          border: `${unit(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
1019          borderRadius: token.borderRadiusLG,
1020          "&:hover": {
1021            background: "transparent"
1022          },
1023          [`${itemCls}
1023-thumbnail`]: Object.assign(Object.assign({}, textEllipsis), {
1024            width: uploadThumbnailSize,
1025            height: uploadThumbnailSize,
1026            lineHeight: unit(calc(uploadThumbnailSize).add(token.paddingSM).equal()),
1027            textAlign: "center",
1028            flex: "none",
1029            [iconCls]: {
1030              fontSize: token.fontSizeHeading2,
1031              color: token.colorPrimary
1032            },
1033            img: {
1034              display: "block",
1035              width: "100%",
1036              height: "100%",
1037              overflow: "hidden"
1038            }
1039          }),
1040          [`${itemCls}-progress`]: {
1041            bottom: uploadProgressOffset,
1042            width: `calc(100% - ${unit(calc(token.paddingSM).mul(2).equal())})`,
1043            marginTop: 0,
1044            paddingInlineStart: calc(uploadThumbnailSize).add(token.paddingXS).equal()
1045          }
1046        },
1047        [`${itemCls}-error`]: {
1048          borderColor: token.colorError,
1049          // Adjust the color of the error icon : https://github.com/ant-design/ant-design/pull/24160
1050          [`${itemCls}-thumbnail ${iconCls}`]: {
1051            [`svg path[fill='${blue[0]}']`]: {
1052              fill: token.colorErrorBg
1053            },
1054            [`svg path[fill='${blue.primary}']`]: {
1055              fill: token.colorError
1056            }
1057          }
1058        },
1059        [`${itemCls}-uploading`]: {
1060          borderStyle: "dashed",
1061          [`${itemCls}-name`]: {
1062            marginBottom: uploadProgressOffset
1063          }
1064        }
1065      },
1066      [`${listCls}${listCls}-picture-circle ${itemCls}`]: {
1067        [`&, &::before, ${itemCls}-thumbnail`]: {
1068          borderRadius: "50%"
1069        }
1070      }
1071    }
1072  };
1073};
1074const genPictureCardStyle = (token) => {
1075  const {
1076    componentCls,
1077    iconCls,
1078    fontSizeLG,
1079    colorTextLightSolid,
1080    calc
1081  } = token;
1082  const listCls = `${componentCls}-list`;
1083  const itemCls = `${listCls}-item`;
1084  const uploadPictureCardSize = token.uploadPicCardSize;
1085  return {
1086    [`
1087      ${componentCls}-wrapper${componentCls}-picture-card-wrapper,
1088      ${componentCls}-wrapper${componentCls}-picture-circle-wrapper
1089    `]: Object.assign(Object.assign({}, clearFix()), {
1090      display: "block",
1091      [`${componentCls}${componentCls}-select`]: {
1092        width: uploadPictureCardSize,
1093        height: uploadPictureCardSize,
1094        textAlign: "center",
1095        verticalAlign: "top",
1096        backgroundColor: token.colorFillAlter,
1097        border: `${unit(token.lineWidth)} dashed ${token.colorBorder}`,
1098        borderRadius: token.borderRadiusLG,
1099        cursor: "pointer",
1100        transition: `border-color ${token.motionDurationSlow}`,
1101        [`> ${componentCls}`]: {
1102          display: "flex",
1103          alignItems: "center",
1104          justifyContent: "center",
1105          height: "100%",
1106          textAlign: "center"
1107        },
1108        [`&:not(${componentCls}-disabled):hover`]: {
1109          borderColor: token.colorPrimary
1110        }
1111      },
1112      // list
1113      [`${listCls}${listCls}-picture-card, ${listCls}${listCls}-picture-circle`]: {
1114        display: "flex",
1115        flexWrap: "wrap",
1116        "@supports not (gap: 1px)": {
1117          "& > *": {
1118            marginBlockEnd: token.marginXS,
1119            marginInlineEnd: token.marginXS
1120          }
1121        },
1122        "@supports (gap: 1px)": {
1123          gap: token.marginXS
1124        },
1125        [`${listCls}-item-container`]: {
1126          display: "inline-block",
1127          width: uploadPictureCardSize,
1128          height: uploadPictureCardSize,
1129          verticalAlign: "top"
1130        },
1131        "&::after": {
1132          display: "none"
1133        },
1134        "&::before": {
1135          display: "none"
1136        },
1137        [itemCls]: {
1138          height: "100%",
1139          margin: 0,
1140          "&::before": {
1141            position: "absolute",
1142            zIndex: 1,
1143            width: `calc(100% - ${unit(calc(token.paddingXS).mul(2).equal())})`,
1144            height: `calc(100% - ${unit(calc(token.paddingXS).mul(2).equal())})`,
1145            backgroundColor: token.colorBgMask,
1146            opacity: 0,
1147            transition: `all ${token.motionDurationSlow}`,
1148            content: '" "'
1149          }
1150        },
1151        [`${itemCls}:hover`]: {
1152          [`&::before, ${itemCls}-actions`]: {
1153            opacity: 1
1154          }
1155        },
1156        [`${itemCls}-actions`]: {
1157          position: "absolute",
1158          insetInlineStart: 0,
1159          zIndex: 10,
1160          width: "100%",
1161          whiteSpace: "nowrap",
1162          textAlign: "center",
1163          opacity: 0,
1164          transition: `all ${token.motionDurationSlow}`,
1165          [`
1166            ${iconCls}-eye,
1167            ${iconCls}-download,
1168            ${iconCls}-delete
1169          `]: {
1170            zIndex: 10,
1171            width: fontSizeLG,
1172            margin: `0 ${unit(token.marginXXS)}`,
1173            fontSize: fontSizeLG,
1174            cursor: "pointer",
1175            transition: `all ${token.motionDurationSlow}`,
1176            color: colorTextLightSolid,
1177            "&:hover": {
1178              color: colorTextLightSolid
1179            },
1180            svg: {
1181              verticalAlign: "baseline"
1182            }
1183          }
1184        },
1185        [`${itemCls}
1185-thumbnail, ${itemCls}-thumbnail img`]: {
1186          position: "static",
1187          display: "block",
1188          width: "100%",
1189          height: "100%",
1190          objectFit: "contain"
1191        },
1192        [`${itemCls}-name`]: {
1193          display: "none",
1194          textAlign: "center"
1195        },
1196        [`${itemCls}-file + ${itemCls}-name`]: {
1197          position: "absolute",
1198          bottom: token.margin,
1199          display: "block",
1200          width: `calc(100% - ${unit(calc(token.paddingXS).mul(2).equal())})`
1201        },
1202        [`${itemCls}-uploading`]: {
1203          [`&${itemCls}`]: {
1204            backgroundColor: token.colorFillAlter
1205          },
1206          [`&::before, ${iconCls}-eye, ${iconCls}-download, ${iconCls}-delete`]: {
1207            display: "none"
1208          }
1209        },
1210        [`${itemCls}-progress`]: {
1211          bottom: token.marginXL,
1212          width: `calc(100% - ${unit(calc(token.paddingXS).mul(2).equal())})`,
1213          paddingInlineStart: 0
1214        }
1215      }
1216    }),
1217    [`${componentCls}-wrapper${componentCls}-picture-circle-wrapper`]: {
1218      [`${componentCls}${componentCls}-select`]: {
1219        borderRadius: "50%"
1220      }
1221    }
1222  };
1223};
1224const genRtlStyle = (token) => {
1225  const {
1226    componentCls
1227  } = token;
1228  return {
1229    [`${componentCls}-rtl`]: {
1230      direction: "rtl"
1231    }
1232  };
1233};
1234const genBaseStyle = (token) => {
1235  const {
1236    componentCls,
1237    colorTextDisabled
1238  } = token;
1239  return {
1240    [`${componentCls}-wrapper`]: Object.assign(Object.assign({}, resetComponent(token)), {
1241      [componentCls]: {
1242        outline: 0,
1243        "input[type='file']": {
1244          cursor: "pointer"
1245        }
1246      },
1247      [`${componentCls}-select`]: {
1248        display: "inline-block"
1249      },
1250      [`${componentCls}-hidden`]: {
1251        display: "none"
1252      },
1253      [`${componentCls}-disabled`]: {
1254        color: colorTextDisabled,
1255        cursor: "not-allowed"
1256      }
1257    })
1258  };
1259};
1260const prepareComponentToken = (token) => ({
1261  actionsColor: token.colorIcon,
1262  pictureCardSize: token.controlHeightLG * 2.55
1263});
1264const useStyle = genStyleHooks("Upload", (token) => {
1265  const {
1266    fontSizeHeading3,
1267    fontHeight,
1268    lineWidth,
1269    pictureCardSize,
1270    calc
1271  } = token;
1272  const uploadToken = merge(token, {
1273    uploadThumbnailSize: calc(fontSizeHeading3).mul(2).equal(),
1274    uploadProgressOffset: calc(calc(fontHeight).div(2)).add(lineWidth).equal(),
1275    uploadPicCardSize: pictureCardSize
1276  });
1277  return [genBaseStyle(uploadToken), genDraggerStyle(uploadToken), genPictureStyle(uploadToken), genPictureCardStyle(uploadToken), genListStyle(uploadToken), genMotionStyle(uploadToken), genRtlStyle(uploadToken), genCollapseMotion(uploadToken)];
1278}, prepareComponentToken);
1279var FileTwoTone$1 = { "icon": function render(primaryColor, secondaryColor) {
1280  return { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M534 352V136H232v752h560V394H576a42 42 0 01-42-42z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0042 42h216v494z", "fill": primaryColor } }] };
1281}, "name": "file", "theme": "twotone" };
1282var FileTwoTone = function FileTwoTone2(props, ref) {
1283  return /* @__PURE__ */ reactExports.createElement(Icon, _extends({}, props, {
1284    ref,
1285    icon: FileTwoTone$1
1286  }));
1287};
1288var RefIcon$2 = /* @__PURE__ */ reactExports.forwardRef(FileTwoTone);
1289var PaperClipOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z" } }] }, "name": "paper-clip", "theme": "outlined" };
1290var PaperClipOutlined = function PaperClipOutlined2(props, ref) {
1291  return /* @__PURE__ */ reactExports.createElement(Icon, _extends({}, props, {
1292    ref,
1293    icon: PaperClipOutlined$1
1294  }));
1295};
1296var RefIcon$1 = /* @__PURE__ */ reactExports.forwardRef(PaperClipOutlined);
1297var PictureTwoTone$1 = { "icon": function render2(primaryColor, secondaryColor) {
1298  return { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z", "fill": primaryColor } }, { "tag": "path", "attrs": { "d": "M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 110 176 88 88 0 010-176z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M276 368a28 28 0 1056 0 28 28 0 10-56 0z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z", "fill": primaryColor } }] };
1299}, "name": "picture", "theme": "twotone" };
1300var PictureTwoTone = function PictureTwoTone2(props, ref) {
1301  return /* @__PURE__ */ reactExports.createElement(Icon, _extends({}, props, {
1302    ref,
1303    icon: PictureTwoTone$1
1304  }));
1305};
1306var RefIcon = /* @__PURE__ */ reactExports.forwardRef(PictureTwoTone);
1307function file2Obj(file) {
1308  return Object.assign(Object.assign({}, file), {
1309    lastModified: file.lastModified,
1310    lastModifiedDate: file.lastModifiedDate,
1311    name: file.name,
1312    size: file.size,
1313    type: file.type,
1314    uid: file.uid,
1315    percent: 0,
1316    originFileObj: file
1317  });
1318}
1319function updateFileList(file, fileList) {
1320  const nextFileList = _toConsumableArray(fileList);
1321  const fileIndex = nextFileList.findIndex(({
1322    uid: uid2
1323  }) => uid2 === file.uid);
1324  if (fileIndex === -1) {
1325    nextFileList.push(file);
1326  } else {
1327    nextFileList[fileIndex] = file;
1328  }
1329  return nextFileList;
1330}
1331function getFileItem(file, fileList) {
1332  const matchKey = file.uid !== void 0 ? "uid" : "name";
1333  return fileList.filter((item) => item[matchKey] === file[matchKey])[0];
1334}
1335function removeFileItem(file, fileList) {
1336  const matchKey = file.uid !== void 0 ? "uid" : "name";
1337  const removed = fileList.filter((item) => item[matchKey] !== file[matchKey]);
1338  if (removed.length === fileList.length) {
1339    return null;
1340  }
1341  return removed;
1342}
1343const extname = (url = "") => {
1344  const temp = url.split("/");
1345  const filename = temp[temp.length - 1];
1346  const filenameWithoutSuffix = filename.split(/#|\?/)[0];
1347  return (/\.[^./\\]*$/.exec(filenameWithoutSuffix) || [""])[0];
1348};
1349const isImageFileType = (type) => type.indexOf("image/") === 0;
1350const isImageUrl = (file) => {
1351  if (file.type && !file.thumbUrl) {
1352    return isImageFileType(file.type);
1353  }
1354  const url = file.thumbUrl || file.url || "";
1355  const extension = extname(url);
1356  if (/^data:image\//.test(url) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test(extension)) {
1357    return true;
1358  }
1359  if (/^data:/.test(url)) {
1360    return false;
1361  }
1362  if (extension) {
1363    return false;
1364  }
1365  return true;
1366};
1367const MEASURE_SIZE = 200;
1368function previewImage(file) {
1369  return new Promise((resolve) => {
1370    if (!file.type || !isImageFileType(file.type)) {
1371      resolve("");
1372      return;
1373    }
1374    const canvas = document.createElement("canvas");
1375    canvas.width = MEASURE_SIZE;
1376    canvas.height = MEASURE_SIZE;
1377    canvas.style.cssText = `position: fixed; left: 0; top: 0; width: ${MEASURE_SIZE}px; height: ${MEASURE_SIZE}px; z-index: 9999; display: none;`;
1378    document.body.appendChild(canvas);
1379    const ctx = canvas.getContext("2d");
1380    const img = new Image();
1381    img.onload = () => {
1382      const {
1383        width,
1384        height
1385      } = img;
1386      let drawWidth = MEASURE_SIZE;
1387      let drawHeight = MEASURE_SIZE;
1388      let offsetX = 0;
1389      let offsetY = 0;
1390      if (width > height) {
1391        drawHeight = height * (MEASURE_SIZE / width);
1392        offsetY = -(drawHeight - drawWidth) / 2;
1393      } else {
1394        drawWidth = width * (MEASURE_SIZE / height);
1395        offsetX = -(drawWidth - drawHeight) / 2;
1396      }
1397      ctx.drawImage(img, offsetX, offsetY, drawWidth, drawHeight);
1398      const dataURL = canvas.toDataURL();
1399      document.body.removeChild(canvas);
1400      window.URL.revokeObjectURL(img.src);
1401      resolve(dataURL);
1402    };
1403    img.crossOrigin = "anonymous";
1404    if (file.type.startsWith("image/svg+xml")) {
1405      const reader = new FileReader();
1406      reader.onload = () => {
1407        if (reader.result && typeof reader.result === "string") {
1408          img.src = reader.result;
1409        }
1410      };
1411      reader.readAsDataURL(file);
1412    } else if (file.type.startsWith("image/gif")) {
1413      const reader = new FileReader();
1414      reader.onload = () => {
1415        if (reader.result) {
1416          resolve(reader.result);
1417        }
1418      };
1419      reader.readAsDataURL(file);
1420    } else {
1421      img.src = window.URL.createObjectURL(file);
1422    }
1423  });
1424}
1425const ListItem = /* @__PURE__ */ reactExports.forwardRef(({
1426  prefixCls,
1427  className,
1428  style,
1429  locale,
1430  listType,
1431  file,
1432  items,
1433  progress: progressProps,
1434  iconRender,
1435  actionIconRender,
1436  itemRender,
1437  isImgUrl,
1438  showPreviewIcon,
1439  showRemoveIcon,
1440  showDownloadIcon,
1441  previewIcon: customPreviewIcon,
1442  removeIcon: customRemoveIcon,
1443  downloadIcon: customDownloadIcon,
1444  extra: customExtra,
1445  onPreview,
1446  onDownload,
1447  onClose
1448}, ref) => {
1449  var _a, _b;
1450  const {
1451    status
1452  } = file;
1453  const [mergedStatus, setMergedStatus] = reactExports.useState(status);
1454  reactExports.useEffect(() => {
1455    if (status !== "removed") {
1456      setMergedStatus(status);
1457    }
1458  }, [status]);
1459  const [showProgress, setShowProgress] = reactExports.useState(false);
1460  reactExports.useEffect(() => {
1461    const timer = setTimeout(() => {
1462      setShowProgress(true);
1463    }, 300);
1464    return () => {
1465      clearTimeout(timer);
1466    };
1467  }, []);
1468  const iconNode = iconRender(file);
1469  let icon = /* @__PURE__ */ reactExports.createElement("div", {
1470    className: `${prefixCls}-icon`
1471  }, iconNode);
1472  if (listType === "picture" || listType === "picture-card" || listType === "picture-circle") {
1473    if (mergedStatus === "uploading" || !file.thumbUrl && !file.url) {
1474      const uploadingClassName = classNames(`${prefixCls}-list-item-thumbnail`, {
1475        [`${prefixCls}-list-item-file`]: mergedStatus !== "uploading"
1476      });
1477      icon = /* @__PURE__ */ reactExports.createElement("div", {
1478        className: uploadingClassName
1479      }, iconNode);
1480    } else {
1481      const thumbnail = (isImgUrl === null || isImgUrl === void 0 ? void 0 : isImgUrl(file)) ? /* @__PURE__ */ reactExports.createElement("img", {
1482        src: file.thumbUrl || file.url,
1483        alt: file.name,
1484        className: `${prefixCls}-list-item-image`,
1485        crossOrigin: file.crossOrigin
1486      }) : iconNode;
1487      const aClassName = classNames(`${prefixCls}-list-item-thumbnail`, {
1488        [`${prefixCls}-list-item-file`]: isImgUrl && !isImgUrl(file)
1489      });
1490      icon = /* @__PURE__ */ reactExports.createElement("a", {
1491        className: aClassName,
1492        onClick: (e) => onPreview(file, e),
1493        href: file.url || file.thumbUrl,
1494        target: "_blank",
1495        rel: "noopener noreferrer"
1496      }, thumbnail);
1497    }
1498  }
1499  const listItemClassName = classNames(`${prefixCls}-list-item`, `${prefixCls}-list-item-${mergedStatus}`);
1500  const linkProps = typeof file.linkProps === "string" ? JSON.parse(file.linkProps) : file.linkProps;
1501  const removeIcon = (typeof showRemoveIcon === "function" ? showRemoveIcon(file) : showRemoveIcon) ? actionIconRender(
1502    (typeof customRemoveIcon === "function" ? customRemoveIcon(file) : customRemoveIcon) || /* @__P
1502URE__ */ reactExports.createElement(RefIcon$3, null),
1503    () => onClose(file),
1504    prefixCls,
1505    locale.removeFile,
1506    // acceptUploadDisabled is true, only remove icon will follow Upload disabled prop
1507    // https://github.com/ant-design/ant-design/issues/46171
1508    true
1509  ) : null;
1510  const downloadIcon = (typeof showDownloadIcon === "function" ? showDownloadIcon(file) : showDownloadIcon) && mergedStatus === "done" ? actionIconRender((typeof customDownloadIcon === "function" ? customDownloadIcon(file) : customDownloadIcon) || /* @__PURE__ */ reactExports.createElement(RefIcon$4, null), () => onDownload(file), prefixCls, locale.downloadFile) : null;
1511  const downloadOrDelete = listType !== "picture-card" && listType !== "picture-circle" && /* @__PURE__ */ reactExports.createElement("span", {
1512    key: "download-delete",
1513    className: classNames(`${prefixCls}-list-item-actions`, {
1514      picture: listType === "picture"
1515    })
1516  }, downloadIcon, removeIcon);
1517  const extraContent = typeof customExtra === "function" ? customExtra(file) : customExtra;
1518  const extra = extraContent && /* @__PURE__ */ reactExports.createElement("span", {
1519    className: `${prefixCls}-list-item-extra`
1520  }, extraContent);
1521  const listItemNameClass = classNames(`${prefixCls}-list-item-name`);
1522  const fileName = file.url ? /* @__PURE__ */ reactExports.createElement("a", Object.assign({
1523    key: "view",
1524    target: "_blank",
1525    rel: "noopener noreferrer",
1526    className: listItemNameClass,
1527    title: file.name
1528  }, linkProps, {
1529    href: file.url,
1530    onClick: (e) => onPreview(file, e)
1531  }), file.name, extra) : /* @__PURE__ */ reactExports.createElement("span", {
1532    key: "view",
1533    className: listItemNameClass,
1534    onClick: (e) => onPreview(file, e),
1535    title: file.name
1536  }, file.name, extra);
1537  const previewIcon = (typeof showPreviewIcon === "function" ? showPreviewIcon(file) : showPreviewIcon) && (file.url || file.thumbUrl) ? /* @__PURE__ */ reactExports.createElement("a", {
1538    href: file.url || file.thumbUrl,
1539    target: "_blank",
1540    rel: "noopener noreferrer",
1541    onClick: (e) => onPreview(file, e),
1542    title: locale.previewFile
1543  }, typeof customPreviewIcon === "function" ? customPreviewIcon(file) : customPreviewIcon || /* @__P
1543URE__ */ reactExports.createElement(RefIcon$5, null)) : null;
1544  const pictureCardActions = (listType === "picture-card" || listType === "picture-circle") && mergedStatus !== "uploading" && /* @__PURE__ */ reactExports.createElement("span", {
1545    className: `${prefixCls}-list-item-actions`
1546  }, previewIcon, mergedStatus === "done" && downloadIcon, removeIcon);
1547  const {
1548    getPrefixCls
1549  } = reactExports.useContext(ConfigContext);
1550  const rootPrefixCls = getPrefixCls();
1551  const dom = /* @__PURE__ */ reactExports.createElement("div", {
1552    className: listItemClassName
1553  }, icon, fileName, downloadOrDelete, pictureCardActions, showProgress && /* @__PURE__ */ reactExports.createElement(CSSMotion, {
1554    motionName: `${rootPrefixCls}-fade`,
1555    visible: mergedStatus === "uploading",
1556    motionDeadline: 2e3
1557  }, ({
1558    className: motionClassName
1559  }) => {
1560    const loadingProgress = "percent" in file ? /* @__PURE__ */ reactExports.createElement(Progress, Object.assign({
1561      type: "line",
1562      percent: file.percent,
1563      "aria-label": file["aria-label"],
1564      "aria-labelledby": file["aria-labelledby"]
1565    }, progressProps)) : null;
1566    return /* @__PURE__ */ reactExports.createElement("div", {
1567      className: classNames(`${prefixCls}-list-item-progress`, motionClassName)
1568    }, loadingProgress);
1569  }));
1570  const message = file.response && typeof file.response === "string" ? file.response : ((_a = file.error) === null || _a === void 0 ? void 0 : _a.statusText) || ((_b = file.error) === null || _b === void 0 ? void 0 : _b.message) || locale.uploadError;
1571  const item = mergedStatus === "error" ? /* @__PURE__ */ reactExports.createElement(Tooltip, {
1572    title: message,
1573    getPopupContainer: (node) => node.parentNode
1574  }, dom) : dom;
1575  return /* @__PURE__ */ reactExports.createElement("div", {
1576    className: classNames(`${prefixCls}-list-item-container`, className),
1577    style,
1578    ref
1579  }, itemRender ? itemRender(item, file, items, {
1580    download: onDownload.bind(null, file),
1581    preview: onPreview.bind(null, file),
1582    remove: onClose.bind(null, file)
1583  }) : item);
1584});
1585const InternalUploadList = (props, ref) => {
1586  const {
1587    listType = "text",
1588    previewFile = previewImage,
1589    onPreview,
1590    onDownload,
1591    onRemove,
1592    locale,
1593    iconRender,
1594    isImageUrl: isImgUrl = isImageUrl,
1595    prefixCls: customizePrefixCls,
1596    items = [],
1597    showPreviewIcon = true,
1598    showRemoveIcon = true,
1599    showDownloadIcon = false,
1600    removeIcon,
1601    previewIcon,
1602    downloadIcon,
1603    extra,
1604    progress = {
1605      size: [-1, 2],
1606      showInfo: false
1607    },
1608    appendAction,
1609    appendActionVisible = true,
1610    itemRender,
1611    disabled
1612  } = props;
1613  const [, forceUpdate] = useForceUpdate();
1614  const [motionAppear, setMotionAppear] = reactExports.useState(false);
1615  const isPictureCardOrCirle = ["picture-card", "picture-circle"].includes(listType);
1616  reactExports.useEffect(() => {
1617    if (!listType.startsWith("picture")) {
1618      return;
1619    }
1620    (items || []).forEach((file) => {
1621      if (!(file.originFileObj instanceof File || file.originFileObj instanceof Blob) || file.thumbUrl !== void 0) {
1622        return;
1623      }
1624      file.thumbUrl = "";
1625      previewFile === null || previewFile === void 0 ? void 0 : previewFile(file.originFileObj).then((previewDataUrl) => {
1626        file.thumbUrl = previewDataUrl || "";
1627        forceUpdate();
1628      });
1629    });
1630  }, [listType, items, previewFile]);
1631  reactExports.useEffect(() => {
1632    setMotionAppear(true);
1633  }, []);
1634  const onInternalPreview = (file, e) => {
1635    if (!onPreview) {
1636      return;
1637    }
1638    e === null || e === void 0 ? void 0 : e.preventDefault();
1639    return onPreview(file);
1640  };
1641  const onInternalDownload = (file) => {
1642    if (typeof onDownload === "function") {
1643      onDownload(file);
1644    } else if (file.url) {
1645      window.open(file.url);
1646    }
1647  };
1648  const onInternalClose = (file) => {
1649    onRemove === null || onRemove === void 0 ? void 0 : onRemove(file);
1650  };
1651  const internalIconRender = (file) => {
1652    if (iconRender) {
1653      return iconRender(file, listType);
1654    }
1655    const isLoading = file.status === "uploading";
1656    if (listType.startsWith("picture")) {
1657      const loadingIcon = listType === "picture" ? /* @__PURE__ */ reactExports.createElement(RefIcon$6, null) : locale.uploading;
1658      const fileIcon = (isImgUrl === null || isImgUrl === void 0 ? void 0 : isImgUrl(file)) ? /* @__PURE__ */ reactExports.createElement(RefIcon, null) : /* @__PURE__ */ reactExports.createElement(RefIcon$2, null);
1659      return isLoading ? loadingIcon : fileIcon;
1660    }
1661    return isLoading ? /* @__PURE__ */ reactExports.createElement(RefIcon$6, null) : /* @__PURE__ */ reactExports.createElement(RefIcon$1, null);
1662  };
1663  const actionIconRender = (customIcon, callback, prefixCls2, title, acceptUploadDisabled) => {
1664    const btnProps = {
1665      type: "text",
1666      size: "small",
1667      title,
1668      onClick: (e) => {
1669        var _a, _b;
1670        callback();
1671        if (/* @__PURE__ */ reactExports.isValidElement(customIcon)) {
1672          (_b = (_a = customIcon.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
1673        }
1674      },
1675      className: `${prefixCls2}-list-item-action`,
1676      disabled: acceptUploadDisabled ? disabled : false
1677    };
1678    return /* @__PURE__ */ reactExports.isValidElement(customIcon) ? /* @__PURE__ */ reactExports.createElement(Button, Object.assign({}, btnProps, {
1679      icon: cloneElement(customIcon, Object.assign(Object.assign({}, customIcon.props), {
1680        onClick: () => {
1681        }
1682      }))
1683    })) : /* @__PURE__ */ reactExports.createElement(Button, Object.assign({}
1683, btnProps), /* @__PURE__ */ reactExports.createElement("span", null, customIcon));
1684  };
1685  reactExports.useImperativeHandle(ref, () => ({
1686    handlePreview: onInternalPreview,
1687    handleDownload: onInternalDownload
1688  }));
1689  const {
1690    getPrefixCls
1691  } = reactExports.useContext(ConfigContext);
1692  const prefixCls = getPrefixCls("upload", customizePrefixCls);
1693  const rootPrefixCls = getPrefixCls();
1694  const listClassNames = classNames(`${prefixCls}-list`, `${prefixCls}-list-${listType}`);
1695  const listItemMotion = reactExports.useMemo(() => omit(initCollapseMotion(rootPrefixCls), ["onAppearEnd", "onEnterEnd", "onLeaveEnd"]), [rootPrefixCls]);
1696  const motionConfig = Object.assign(Object.assign({}, isPictureCardOrCirle ? {} : listItemMotion), {
1697    motionDeadline: 2e3,
1698    motionName: `${prefixCls}-${isPictureCardOrCirle ? "animate-inline" : "animate"}`,
1699    keys: _toConsumableArray(items.map((file) => ({
1700      key: file.uid,
1701      file
1702    }))),
1703    motionAppear
1704  });
1705  return /* @__PURE__ */ reactExports.createElement("div", {
1706    className: listClassNames
1707  }, /* @__PURE__ */ reactExports.createElement(CSSMotionList, Object.assign({}, motionConfig, {
1708    component: false
1709  }), ({
1710    key,
1711    file,
1712    className: motionClassName,
1713    style: motionStyle
1714  }) => /* @__PURE__ */ reactExports.createElement(ListItem, {
1715    key,
1716    locale,
1717    prefixCls,
1718    className: motionClassName,
1719    style: motionStyle,
1720    file,
1721    items,
1722    progress,
1723    listType,
1724    isImgUrl,
1725    showPreviewIcon,
1726    showRemoveIcon,
1727    showDownloadIcon,
1728    removeIcon,
1729    previewIcon,
1730    downloadIcon,
1731    extra,
1732    iconRender: internalIconRender,
1733    actionIconRender,
1734    itemRender,
1735    onPreview: onInternalPreview,
1736    onDownload: onInternalDownload,
1737    onClose: onInternalClose
1738  }
1738)), appendAction && /* @__PURE__ */ reactExports.createElement(CSSMotion, Object.assign({}, motionConfig, {
1739    visible: appendActionVisible,
1740    forceRender: true
1741  }), ({
1742    className: motionClassName,
1743    style: motionStyle
1744  }) => cloneElement(appendAction, (oriProps) => ({
1745    className: classNames(oriProps.className, motionClassName),
1746    style: Object.assign(Object.assign(Object.assign({}, motionStyle), {
1747      // prevent the element has hover css pseudo-class that may cause animation to end prematurely.
1748      pointerEvents: motionClassName ? "none" : void 0
1749    }), oriProps.style)
1750  }))));
1751};
1752const UploadList = /* @__PURE__ */ reactExports.forwardRef(InternalUploadList);
1753var __awaiter = function(thisArg, _arguments, P, generator) {
1754  function adopt(value) {
1755    return value instanceof P ? value : new P(function(resolve) {
1756      resolve(value);
1757    });
1758  }
1759  return new (P || (P = Promise))(function(resolve, reject) {
1760    function fulfilled(value) {
1761      try {
1762        step(generator.next(value));
1763      } catch (e) {
1764        reject(e);
1765      }
1766    }
1767    function rejected(value) {
1768      try {
1769        step(generator["throw"](value));
1770      } catch (e) {
1771        reject(e);
1772      }
1773    }
1774    function step(result) {
1775      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
1776    }
1777    step((generator = generator.apply(thisArg, [])).next());
1778  });
1779};
1780const LIST_IGNORE = `__LIST_IGNORE_${Date.now()}__`;
1781const InternalUpload = (props, ref) => {
1782  const config = useComponentConfig("upload");
1783  const {
1784    fileList,
1785    defaultFileList,
1786    onRemove,
1787    showUploadList = true,
1788    listType = "text",
1789    onPreview,
1790    onDownload,
1791    onChange,
1792    onDrop,
1793    previewFile,
1794    disabled: customDisabled,
1795    locale: propLocale,
1796    iconRender,
1797    isImageUrl: isImageUrl2,
1798    progress,
1799    prefixCls: customizePrefixCls,
1800    className,
1801    type = "select",
1802    children,
1803    style,
1804    itemRender,
1805    maxCount,
1806    data = {},
1807    multiple = false,
1808    hasControlInside = true,
1809    action = "",
1810    accept = "",
1811    supportServerRender = true,
1812    rootClassName
1813  } = props;
1814  const disabled = reactExports.useContext(DisabledContext);
1815  const mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
1816  const customRequest = props.customRequest || config.customRequest;
1817  const [mergedFileList, setMergedFileList] = useMergedState(defaultFileList || [], {
1818    value: fileList,
1819    postState: (list) => list !== null && list !== void 0 ? list : []
1820  });
1821  const [dragState, setDragState] = reactExports.useState("drop");
1822  const upload2 = reactExports.useRef(null);
1823  const wrapRef = reactExports.useRef(null);
1824  reactExports.useMemo(() => {
1825    const timestamp = Date.now();
1826    (fileList || []).forEach((file, index2) => {
1827      if (!file.uid && !Object.isFrozen(file)) {
1828        file.uid = `__AUTO__${timestamp}_${index2}__`;
1829      }
1830    });
1831  }, [fileList]);
1832  const onInternalChange = (file, changedFileList, event) => {
1833    let cloneList = _toConsumableArray(changedFileList);
1834    let exceedMaxCount = false;
1835    if (maxCount === 1) {
1836      cloneList = cloneList.slice(-1);
1837    } else if (maxCount) {
1838      exceedMaxCount = cloneList.length > maxCount;
1839      cloneList = cloneList.slice(0, maxCount);
1840    }
1841    reactDomExports.flushSync(() => {
1842      setMergedFileList(cloneList);
1843    });
1844    const changeInfo = {
1845      file,
1846      fileList: cloneList
1847    };
1848    if (event) {
1849      changeInfo.event = event;
1850    }
1851    if (!exceedMaxCount || file.status === "removed" || // We should ignore event if current file is exceed `maxCount`
1852    cloneList.some((f) => f.uid === file.uid)) {
1853      reactDomExports.flushSync(() => {
1854        onChange === null || onChange === void 0 ? void 0 : onChange(changeInfo);
1855      });
1856    }
1857  };
1858  const mergedBeforeUpload = (file, fileListArgs) => __awaiter(void 0, void 0, void 0, function* () {
1859    const {
1860      beforeUpload,
1861      transformFile
1862    } = props;
1863    let parsedFile = file;
1864    if (beforeUpload) {
1865      const result = yield beforeUpload(file, fileListArgs);
1866      if (result === false) {
1867        return false;
1868      }
1869      delete file[LIST_IGNORE];
1870      if (result === LIST_IGNORE) {
1871        Object.defineProperty(file, LIST_IGNORE, {
1872          value: true,
1873          configurable: true
1874        });
1875        return false;
1876      }
1877      if (typeof result === "object" && result) {
1878        parsedFile = result;
1879      }
1880    }
1881    if (transformFile) {
1882      parsedFile = yield transformFile(parsedFile);
1883    }
1884    return parsedFile;
1885  });
1886  const onBatchStart = (batchFileInfoList) => {
1887    const filteredFileInfoList = batchFileInfoList.filter((info) => !info.file[LIST_IGNORE]);
1888    if (!filteredFileInfoList.length) {
1889      return;
1890    }
1891    const objectFileList = filteredFileInfoList.map((info) => file2Obj(info.file));
1892    let newFileList = _toConsumableArray(mergedFileList);
1893    objectFileList.forEach((fileObj) => {
1894      newFileList = updateFileList(fileObj, newFileList);
1895    });
1896    objectFileList.forEach((fileObj, index2) => {
1897      let triggerFileObj = fileObj;
1898      if (!filteredFileInfoList[index2].parsedFile) {
1899        const {
1900          originFileObj
1901        } = fileObj;
1902        let clone;
1903        try {
1904          clone = new File([originFileObj], originFileObj.name, {
1905            type: originFileObj.type
1906          });
1907        } catch (_a) {
1908          clone = new Blob([originFileObj], {
1909            type: originFileObj.type
1910          });
1911          clone.name = originFileObj.name;
1912          clone.lastModifiedDate = /* @__PURE__ */ new Date();
1913          clone.lastModified = (/* @__PURE__ */ new Date()).getTime();
1914        }
1915        clone.uid = fileObj.uid;
1916        triggerFileObj = clone;
1917      } else {
1918        fileObj.status = "uploading";
1919      }
1920      onInternalChange(triggerFileObj, newFileList);
1921    });
1922  };
1923  const onSuccess = (response, file, xhr) => {
1924    try {
1925      if (typeof response === "string") {
1926        response = JSON.parse(response);
1927      }
1928    } catch (_a) {
1929    }
1930    if (!getFileItem(file, mergedFileList)) {
1931      return;
1932    }
1933    const targetItem = file2Obj(file);
1934    targetItem.status = "done";
1935    targetItem.percent = 100;
1936    targetItem.response = response;
1937    targetItem.xhr = xhr;
1938    const nextFileList = updateFileList(targetItem, mergedFileList);
1939    onInternalChange(targetItem, nextFileList);
1940  };
1941  const onProgress = (e, file) => {
1942    if (!getFileItem(file, mergedFileList)) {
1943      return;
1944    }
1945    const targetItem = file2Obj(file);
1946    targetItem.status = "uploading";
1947    targetItem.percent = e.percent;
1948    const nextFileList = updateFileList(targetItem, mergedFileList);
1949    onInternalChange(targetItem, nextFileList, e);
1950  };
1951  const onError = (error, response, file) => {
1952    if (!getFileItem(file, mergedFileList)) {
1953      return;
1954    }
1955    const targetItem = file2Obj(file);
1956    targetItem.error = error;
1957    targetItem.response = response;
1958    targetItem.status = "error";
1959    const nextFileList = updateFileList(targetItem, mergedFileList);
1960    onInternalChange(targetItem, nextFileList);
1961  };
1962  const handleRemove = (file) => {
1963    let currentFile;
1964    Promise.resolve(typeof onRemove === "function" ? onRemove(file) : onRemove).then((ret) => {
1965      var _a;
1966      if (ret === false) {
1967        return;
1968      }
1969      const removedFileList = removeFileItem(file, mergedFileList);
1970      if (removedFileList) {
1971        currentFile = Object.assign(Object.assign({}, file), {
1972          status: "removed"
1973        });
1974        mergedFileList === null || mergedFileList === void 0 ? void 0 : mergedFileList.forEach((item) => {
1975          const matchKey = currentFile.uid !== void 0 ? "uid" : "name";
1976          if (item[matchKey] === currentFile[matchKey] && !Object.isFrozen(item)) {
1977            item.status = "removed";
1978          }
1979        });
1980        (_a = upload2.current) === null || _a === void 0 ? void 0 : _a.abort(currentFile);
1981        onInternalChange(currentFile, removedFileList);
1982      }
1983    });
1984  };
1985  const onFileDrop = (e) => {
1986    setDragState(e.type);
1987    if (e.type === "drop") {
1988      onDrop === null || onDrop === void 0 ? void 0 : onDrop(e);
1989    }
1990  };
1991  reactExports.useImperativeHandle(ref, () => ({
1992    onBatchStart,
1993    onSuccess,
1994    onProgress,
1995    onError,
1996    fileList: mergedFileList,
1997    upload: upload2.current,
1998    nativeElement: wrapRef.current
1999  }));
2000  const {
2001    getPrefixCls,
2002    direction,
2003    upload: ctxUpload
2004  } = reactExports.useContext(ConfigContext);
2005  const prefixCls = getPrefixCls("upload", customizePrefixCls);
2006  const rcUploadProps = Object.assign(Object.assign({
2007    onBatchStart,
2008    onError,
2009    onProgress,
2010    onSuccess
2011  }, props), {
2012    customRequest,
2013    data,
2014    multiple,
2015    action,
2016    accept,
2017    supportServerRender,
2018    prefixCls,
2019    disabled: mergedDisabled,
2020    beforeUpload: mergedBeforeUpload,
2021    onChange: void 0,
2022    hasControlInside
2023  });
2024  delete rcUploadProps.className;
2025  delete rcUploadProps.style;
2026  if (!children || mergedDisabled) {
2027    delete rcUploadProps.id;
2028  }
2029  const wrapperCls = `${prefixCls}-wrapper`;
2030  const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, wrapperCls);
2031  const [contextLocale] = useLocale("Upload", localeValues.Upload);
2032  const {
2033    showRemoveIcon,
2034    showPreviewIcon,
2035    showDownloadIcon,
2036    removeIcon,
2037    previewIcon,
2038    downloadIcon,
2039    extra
2040  } = typeof showUploadList === "boolean" ? {} : showUploadList;
2041  const realShowRemoveIcon = typeof showRemoveIcon === "undefined" ? !mergedDisabled : showRemoveIcon;
2042  const renderUploadList = (button, buttonVisible) => {
2043    if (!showUploadList) {
2044      return button;
2045    }
2046    return /* @__PURE__ */ reactExports.createElement(UploadList, {
2047      prefixCls,
2048      listType,
2049      items: mergedFileList,
2050      previewFile,
2051      onPreview,
2052      onDownload,
2053      onRemove: handleRemove,
2054      showRemoveIcon: realShowRemoveIcon,
2055      showPreviewIcon,
2056      showDownloadIcon,
2057      removeIcon,
2058      previewIcon,
2059      downloadIcon,
2060      iconRender,
2061      extra,
2062      locale: Object.assign(Object.assign({}, contextLocale), propLocale),
2063      isImageUrl: isImageUrl2,
2064      progress,
2065      appendAction: button,
2066      appendActionVisible: buttonVisible,
2067      itemRender,
2068      disabled: mergedDisabled
2069    });
2070  };
2071  const mergedCls = classNames(wrapperCls, className, rootClassName, hashId, cssVarCls, ctxUpload === null || ctxUpload === void 0 ? void 0 : ctxUpload.className, {
2072    [`${prefixCls}-rtl`]: direction === "rtl",
2073    [`${prefixCls}-picture-card-wrapper`]: listType === "picture-card",
2074    [`${prefixCls}-picture-circle-wrapper`]: listType === "picture-circle"
2075  });
2076  const mergedStyle = Object.assign(Object.assign({}, ctxUpload === null || ctxUpload === void 0 ? void 0 : ctxUpload.style), style);
2077  if (type === "drag") {
2078    const dragCls = classNames(hashId, prefixCls, `${prefixCls}-drag`, {
2079      [`${prefixCls}-drag-uploading`]: mergedFileList.some((file) => file.status === "uploading"),
2080      [`${prefixCls}-drag-hover`]: dragState === "dragover",
2081      [`${prefixCls}-disabled`]: mergedDisabled,
2082      [`${prefixCls}-rtl`]: direction === "rtl"
2083    });
2084    return wrapCSSVar(/* @__PURE__ */ reactExports.createElement("span", {
2085      className: mergedCls,
2086      ref: wrapRef
2087    }
2087, /* @__PURE__ */ reactExports.createElement("div", {
2088      className: dragCls,
2089      style: mergedStyle,
2090      onDrop: onFileDrop,
2091      onDragOver: onFileDrop,
2092      onDragLeave: onFileDrop
2093    }, /* @__PURE__ */ reactExports.createElement(Upload$2, Object.assign({}, rcUploadProps, {
2094      ref: upload2,
2095      className: `${prefixCls}-btn`
2096    }), /* @__PURE__ */ reactExports.createElement("div", {
2097      className: `${prefixCls}-drag-container`
2098    }, children))), renderUploadList()));
2099  }
2100  const uploadBtnCls = classNames(prefixCls, `${prefixCls}-select`, {
2101    [`${prefixCls}-disabled`]: mergedDisabled,
2102    [`${prefixCls}-hidden`]: !children
2103  });
2104  const uploadButton = /* @__PURE__ */ reactExports.createElement("div", {
2105    className: uploadBtnCls,
2106    style: mergedStyle
2107  }, /* @__PURE__ */ reactExports.createElement(Upload$2, Object.assign({}, rcUploadProps, {
2108    ref: upload2
2109  })));
2110  if (listType === "picture-card" || listType === "picture-circle") {
2111    return wrapCSSVar(/* @__PURE__ */ reactExports.createElement("span", {
2112      className: mergedCls,
2113      ref: wrapRef
2114    }, renderUploadList(uploadButton, !!children)));
2115  }
2116  return wrapCSSVar(/* @__PURE__ */ reactExports.createElement("span", {
2117    className: mergedCls,
2118    ref: wrapRef
2119  }, uploadButton, renderUploadList()));
2120};
2121const Upload$1 = /* @__PURE__ */ reactExports.forwardRef(InternalUpload);
2122var __rest = function(s, e) {
2123  var t = {};
2124  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2125  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2126    if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2127  }
2128  return t;
2129};
2130const Dragger = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
2131  const {
2132    style,
2133    height,
2134    hasControlInside = false,
2135    children
2136  } = props, restProps = __rest(props, ["style", "height", "hasControlInside", "children"]);
2137  const mergedStyle = Object.assign(Object.assign({}, style), {
2138    height
2139  });
2140  return /* @__PURE__ */ reactExports.createElement(Upload$1, Object.assign({
2141    ref,
2142    hasControlInside
2143  }, restProps, {
2144    style: mergedStyle,
2145    type: "drag"
2146  }), children);
2147});
2148const Upload = Upload$1;
2149Upload.Dragger = Dragger;
2150Upload.LIST_IGNORE = LIST_IGNORE;
2151const { Title } = Typography;
2152const StepForm = ({ forms, selected_index, StepTreeForm = [] }) => {
2153  const [currentStep, setCurrentStep] = reactExports.useState(1);
2154  const { data, setData, errors, processing } = G({
2155    form_url: ""
2156  });
2157  const [activeDiv, setActiveDiv] = reactExports.useState(selected_index);
2158  const [collectStepThreeData, setCollectStepThreeData] = reactExports.useState(null);
2159  const { account_id, csrf } = X().props;
2160  const [uploading, setUploading] = reactExports.useState(false);
2161  const [isModalOpen, setIsModalOpen] = reactExports.useState(false);
2162  const [selectedFile, setSelectedFile] = reactExports.useState(null);
2163  const [fileName, setFileName] = reactExports.useState("");
2164  const [emailTestingEnabled, setEmailTestingEnabled] = reactExports.useState(false);
2165  const [isPluginInstalled, setIsPluginInstalled] = reactExports.useState(false);
2166  const [toggleLoading, setToggleLoading] = reactExports.useState(false);
2167  const [showPluginWarning, setShowPluginWarning] = reactExports.useState(false);
2168  const [extractedUrl, setExtractedUrl] = reactExports.useState(null);
2169  const handleEmailToggleChange = async (checked) => {
2170    if (checked) {
2171      setToggleLoading(true);
2172      setShowPluginWarning(false);
2173      try {
2174        const apiUrl = route("api.plugin.check", { account_id });
2175        const response = await fetch(apiUrl, {
2176          method: "POST",
2177          credentials: "same-origin",
2178          headers: {
2179            "Content-Type": "application/json",
2180            "Accept": "application/json",
2181            "X-Requested-With": "XMLHttpRequest",
2182            "X-CSRF-TOKEN": csrf
2183          },
2184          body: JSON.stringify({ url: extractedUrl })
2185        });
2186        const result = await response.json();
2187        if (result.installed) {
2188          setIsPluginInstalled(true);
2189          setEmailTestingEnabled(true);
2190          setShowPluginWarning(false);
2191        } else {
2192          setEmailTestingEnabled(false);
2193          setShowPluginWarning(true);
2194        }
2195      } catch (error) {
2196        console.error("Plugin check failed:", error);
2197        setEmailTestingEnabled(false);
2198        setShowPluginWarning(true);
2199      } finally {
2200        setToggleLoading(false);
2201      }
2202    } else {
2203      setEmailTestingEnabled(false);
2204      setShowPluginWarning(false);
2205    }
2206  };
2207  const extractUrlFromJsonFile = async (file) => {
2208    return new Promise((resolve, reject) => {
2209      const reader = new FileReader();
2210      reader.onload = (e) => {
2211        try {
2212          const json = JSON.parse(e.target.result);
2213          const url = json.startingUrl || json.pages && json.pages[0] && json.pages[0].url || null;
2214          resolve(url);
2215        } catch (error) {
2216          reject(error);
2217        }
2218      };
2219      reader.onerror = reject;
2220      reader.readAsText(file);
2221    });
2222  };
2223  const submitStepTwoForm = (activeDiv2) => {
2224    if (activeDiv2 !== void 0) {
2225      At.post(route("forms.new.step.three", { account_id }), {
2226        select_form: activeDiv2
2227        // Posting selected form index
2228      }, {
2229        onSuccess: () => {
2230          setCurrentStep(3);
2231        },
2232        onError: (e) => {
2233          console.error(e);
2234        }
2235      });
2236    } else {
2237      console.error("No form selected!");
2238    }
2239  };
2240  const submitStepThreeForm = () => {
2241    if (collectStepThreeData) {
2242      const stepThreeFormData = collectStepThreeData();
2243      At.post(route("forms.new.step.three.save", { account_id }), {
2244        ...stepThreeFormData,
2245        onSuccess: () => {
2246          console.log("Step 3 form submitted successfully");
2247        },
2248        onError: (e) => {
2249          console.error("Error submitting step 3 form:", e);
2250        }
2251      });
2252    }
2253  };
2254  const nextStep = () => {
2255    if (currentStep === 1) {
2256      At.post(
2257        route("forms.new.step.two", { account_id }),
2258        { form_url: data.form_url },
2259        {
2260          onSuccess: (page) => {
2261            if (page.props.forms && page.props.forms.length > 0) {
2262              setCurrentStep(2);
2263            }
2264          },
2265          onError: (e) => {
2266            console.log(e.form_url);
2267            errors.form_url = e.form_url;
2268          }
2269        }
2270      );
2271    } else if (currentStep === 2) {
2272      console.log("selected form: ", activeDiv);
2273      submitStepTwoForm(activeDiv);
2274    } else if (currentStep === 3) {
2275      submitStepThreeForm();
2276    }
2277  };
2278  const prevStep = () => {
2279    setCurrentStep((prevStep2) => Math.max(prevStep2 - 1, 1));
2280  };
2281  const cancelStep = () => {
2282    if (currentStep === 3) {
2283      setCurrentStep(1);
2284    }
2285  };
2286  const handleSubmit = (e) => {
2287    e.preventDefault();
2288    if (currentStep === 3) {
2289      submitStepThreeForm();
2290    }
2291  };
2292  const handleManualRecordingUpload = async (file) => {
2293    setUploading(true);
2294    setIsModalOpen(false);
2295    setSelectedFile(null);
2296    setFileName("");
2297    const formData = new FormData();
2298    formData.append("file", file);
2299    formData.append("email_testing", emailTestingEnabled ? "1" : "0");
2300    try {
2301      await At.post(route("replay.upload", { account_id }), formData, {
2302        forceFormData: true,
2303        onSuccess: () => {
2304          staticMethods.success("Manual recording test started!");
2305          setUploading(false);
2306        },
2307        onError: (errors2) => {
2308          staticMethods.error("Upload failed: " + (errors2.file || "Unknown error"));
2309          setUploading(false);
2310        }
2311      });
2312    } catch (error) {
2313      staticMethods.error("Upload failed");
2314      setUploading(false);
2315    }
2316  };
2317  const handleDrop = async (e) => {
2318    e.preventDefault();
2319    setIsDragging(false);
2320    const files = e.dataTransfer.files;
2321    if (files && files.length > 0) {
2322      const file = files[0];
2323      if (file.name.endsWith(".json")) {
2324        setSelectedFile(file);
2325        setFileName(file.name);
2326        setShowPluginWarning(false);
2327        try {
2328          const url = await extractUrlFromJsonFile(file);
2329          if (url) {
2330            setExtractedUrl(url);
2331          }
2332        } catch (error) {
2333          console.error("Failed to parse JSON:", error);
2334        }
2335      } else {
2336        staticMethods.error("Please upload a .json file");
2337      }
2338    }
2339  };
2340  const handleFileSelect = async (file) => {
2341    setSelectedFile(file);
2342    setFileName(file.name);
2343    setShowPluginWarning(false);
2344    try {
2345      const url = await extractUrlFromJsonFile(file);
2346      if (url) {
2347        setExtractedUrl(url);
2348      }
2349    } catch (error) {
2350      console.error("Failed to parse JSON:", error);
2351    }
2352    return false;
2353  };
2354  const handleRunTest = () => {
2355    if (selectedFile) {
2356      handleManualRecordingUpload(selectedFile);
2357    }
2358  };
2359  const handleCancelModal = () => {
2360    setIsModalOpen(false);
2361    setSelectedFile(null);
2362    setFileName("");
2363    setIsPluginInstalled(false);
2364    setEmailTestingEnabled(false);
2365    setExtractedUrl(null);
2366    setShowPluginWarning(false);
2367    setToggleLoading(false);
2368  };
2369  const renderStep = () => {
2370    switch (currentStep) {
2371      case 1:
2372        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4", children: [
2373          /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "block text-sm font-medium text-gray-700", children: "Form URL" }),
2374          /* @__PURE__ */ jsxRuntimeExports.jsx(
2375            "input",
2376            {
2377              type: "url",
2378              name: "form_url",
2379              value: data.form_url,
2380              onChange: (e) => setData("form_url", e.target.value),
2381              className: "p-2 bg-gray-50 border border-gray-300 text-gray-900 rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",
2382              placeholder: "https://example.com/your-contact-form/"
2383            }
2384          ),
2385          errors.form_url && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-2", children: errors.form_url })
2386        ] });
2387      case 2:
2388        return /* @__PURE__ */ jsxRuntimeExports.jsx(
2389          StepTwoForm,
2390          {
2391            forms,
2392            selectedFormIndex: selected_index,
2393            setActiveDiv
2394          }
2395        );
2396      case 3:
2397        return /* @__PURE__ */ jsxRuntimeExports.jsx(
2398          StepThreeForm,
2399          {
2400            StepTreeForm,
2401            onCollectData: (fn) => {
2402              if (typeof fn === "function") {
2403                setCollectStepThreeData(() => fn);
2404              }
2405            }
2406          }
2407        );
2408      default:
2409        return null;
2410    }
2411  };
2412  const steps = ["Form URL", "Select Form", "Submit Form"];
2413  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full mx-auto p-8", children: [
2414    /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-2xl font-semibold mb-6", children: "Add Form" }),
2415    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between mb-8", children: steps.map((step, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
2416      "div",
2417      {
2418        className: `flex-1 text-center py-2 border-b-4 ${currentStep === index2 + 1 ? "border-primary-500 text-primary-500" : "border-gray-300 text-gray-500"}`,
2419        children: step
2420      },
2421      index2
2422    )) }),
2423    /* @__PURE__ */ jsxRuntimeExports.jsxs("form", { onSubmit: handleSubmit, children: [
2424      renderStep(),
2425      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mt-6", children: [
2426        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex space-x-4", children: currentStep === 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(
2427          "button",
2428          {
2429            type: "button",
2430            disabled: uploading,
2431            onClick: () => setIsModalOpen(true),
2432            className: "text-blue-600 hover:text-blue-700 underline",
2433            children: "Upload Manual Recording"
2434          }
2435        ) }),
2436        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex space-x-4", children: [
2437          currentStep > 1 && currentStep <= 2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
2438            "button",
2439            {
2440              type: "button",
2441              onClick: prevStep,
2442              disabled: processing,
2443              className: "bg-gray-500 text-white px-6 py-1 rounded-md",
2444              children: "Previous"
2445            }
2446          ),
2447          currentStep < 3 && /* @__PURE__ */ jsxRuntimeExports.jsx(
2448            "button",
2449            {
2450              type: "button",
2451              onClick: nextStep,
2452              className: "bg-primary-500 text-white px-6 py-1 rounded-md",
2453              children: "Next"
2454            }
2455          ),
2456          currentStep === 3 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
2457            /* @__PURE__ */ jsxRuntimeExports.jsx(
2458              "button",
2459              {
2460                type: "button",
2461                onClick: cancelStep,
2462                disabled: processing,
2463                className: "bg-gray-500 text-white px-6 py-1 rounded-md",
2464                children: "Cancel"
2465              }
2466            ),
2467            /* @__PURE__ */ jsxRuntimeExports.jsx(
2468              "button",
2469              {
2470                type: "submit",
2471                className: "bg-primary-500 text-white px-6 py-1 rounded-md",
2472                children: "Submit"
2473              }
2474            )
2475          ] })
2476        ] })
2477      ] })
2478    ] }),
2479    /* @__PURE__ */ jsxRuntimeExports.jsxs(
2480      Modal,
2481      {
2482        title: "Upload Manual Recording",
2483        open: isModalOpen,
2484        onCancel: handleCancelModal,
2485        footer: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-end gap-2", children: [
2486          /* @__PURE__ */ jsxRuntimeExports.jsx(
2487            "button",
2488            {
2489              onClick: handleCancelModal,
2490              className: "px-4 py-2 text-gray-600 hover:text-gray-800",
2491              children: "Cancel"
2492            }
2493          ),
2494          /* @__PURE__ */ jsxRuntimeExports.jsx(
2495            "button",
2496            {
2497              onClick: handleRunTest,
2498              disabled: !selectedFile || uploading,
2499              className: `px-6 py-1 rounded-md ${selectedFile && !uploading ? "bg-primary-500 text-white hover:bg-primary-600" : "bg-gray-300 text-gray-500 cursor-not-allowed"}`,
2500              children: uploading ? "Running..." : "Run test"
2501            }
2502          )
2503        ] }),
2504        width: 500,
2505        centered: true,
2506        children: [
2507          fileName && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4 p-3 bg-gray-100 rounded-lg", children: [
2508            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-600", children: "Selected file:" }),
2509            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "font-medium text-gray-800", children: fileName })
2510          ] }),
2511          selectedFile && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4", children: [
2512            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between p-3 bg-gray-50 rounded-lg border border-gray-200", children: [
2513              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
2514                /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "font-medium text-gray-800", children: "Enable Email Testing" }),
2515                /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-gray-500", children: "Check if FormStatus plugin is installed on the target site" })
2516              ] }),
2517              /* @__PURE__ */ jsxRuntimeExports.jsx(
2518                Switch,
2519                {
2520                  checked: emailTestingEnabled,
2521                  onChange: handleEmailToggleChange,
2522                  loading: toggleLoading,
2523                  disabled: toggleLoading
2524                }
2525              )
2526            ] }),
2527            showPluginWarning && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 p-3 bg-yellow-50 rounded-lg border border-yellow-200", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2", children: [
2528              /* @__PURE__ */ jsxRuntimeExports.jsx(
2529                "svg",
2530                {
2531                  className: "w-5 h-5 text-yellow-600 mt-0.5 flex-shrink-0",
2532                  fill: "none",
2533                  stroke: "currentColor",
2534                  viewBox: "0 0 24 24",
2535                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2536                    "path",
2537                    {
2538                      strokeLinecap: "round",
2539                      strokeLinejoin: "round",
2540                      strokeWidth: 2,
2541                      d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
2542                    }
2543                  )
2544                }
2545              ),
2546              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
2547                /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-yellow-800 font-medium", children: "FormStatus plugin not detected" }),
2548                /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-yellow-700 mt-1", children: "Please install and activate the FormStatus plugin on your WordPress site to enable email testing." })
2549              ] })
2550            ] }) }),
2551            emailTestingEnabled && isPluginInstalled && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 p-3 bg-green-50 rounded-lg border border-green-200", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
2552              /* @__PURE__ */ jsxRuntimeExports.jsx(
2553                "svg",
2554                {
2555                  className: "w-5 h-5 text-green-600",
2556                  fill: "none",
2557                  stroke: "currentColor",
2558                  viewBox: "0 0 24 24",
2559                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2560                    "path",
2561                    {
2562                      strokeLinecap: "round",
2563                      strokeLinejoin: "round",
2564                      strokeWidth: 2,
2565                      d: "M5 13l4 4L19 7"
2566                    }
2567                  )
2568                }
2569              ),
2570              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-green-700", children: "FormStatus plugin detected - Email testing enabled" })
2571            ] }) })
2572          ] }),
2573          /* @__PURE__ */ jsxRuntimeExports.jsxs(
2574            Upload.Dragger,
2575            {
2576              beforeUpload: handleFileSelect,
2577              showUploadList: false,
2578              accept: ".json",
2579              disabled: uploading,
2580              onDrop: handleDrop,
2581              className: "mt-4",
2582              children: [
2583                /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "ant-upload-drag-icon", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2584                  "svg",
2585                  {
2586                    className: "w-16 h-16 mx-auto text-gray-400",
2587                    fill: "none",
2588                    stroke: "currentColor",
2589                    viewBox: "0 0 24 24",
2590                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2591                      "path",
2592                      {
2593                        strokeLinecap: "round",
2594                        strokeLinejoin: "round",
2595                        strokeWidth: 2,
2596                        d: "M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"
2597                      }
2598                    )
2599                  }
2600                ) }),
2601                /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "ant-upload-text", children: "Click or drag file to this area to upload" }),
2602                /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "ant-upload-hint", children: "Upload your manual recording JSON file" })
2603              ]
2604            }
2605          )
2606        ]
2607      }
2608    )
2609  ] }) });
2610};
2611function NewForm({ forms, selected_index, StepTreeForm = [] }) {
2612  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
2613    AuthenticatedLayout,
2614    {
2615      header: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "font-semibold text-xl text-gray-800 leading-tight", children: "Add New Form" }),
2616      children: [
2617        /* @__PURE__ */ jsxRuntimeExports.jsx(Se, { title: "Add Form" }),
2618        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-10 pb-12", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-7xl mx-auto sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-white overflow-hidden shadow-sm sm:rounded-lg", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-6 text-gray-900", children: /* @__PURE__ */ jsxRuntimeExports.jsx(StepForm, { forms, selected_index, StepTreeForm }) }) }) }) })
2619      ]
2620    }
2621  );
2622}
2623export {
2624  NewForm as default
2625};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.