triafly-ui-kit 1.0.23 → 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/README.md +93 -93
  2. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  3. package/dist/assets/Accordeon.css +1 -0
  4. package/dist/assets/Alert.css +1 -0
  5. package/dist/assets/Avatar.css +1 -0
  6. package/dist/assets/Badge.css +1 -0
  7. package/dist/assets/Button.css +1 -0
  8. package/dist/assets/ButtonsArray.css +1 -0
  9. package/dist/assets/Checkbox.css +1 -0
  10. package/dist/assets/CliTextareaInput.css +1 -0
  11. package/dist/assets/CustomLink.css +1 -0
  12. package/dist/assets/DatePicker.css +1 -0
  13. package/dist/assets/DropdownInput.css +1 -0
  14. package/dist/assets/DropdownMenu.css +1 -0
  15. package/dist/assets/FileUpload.css +1 -0
  16. package/dist/assets/FormRoot.css +1 -0
  17. package/dist/assets/Loader.css +1 -0
  18. package/dist/assets/ModalWindow.css +1 -0
  19. package/dist/assets/Pagination.css +1 -0
  20. package/dist/assets/Radio.css +1 -0
  21. package/dist/assets/SearchInput.css +1 -0
  22. package/dist/assets/Skeleton.css +1 -0
  23. package/dist/assets/Switch.css +1 -0
  24. package/dist/assets/Table.css +1 -0
  25. package/dist/assets/Tabs.css +1 -0
  26. package/dist/assets/TextInput.css +1 -0
  27. package/dist/assets/TextareaInput.css +1 -0
  28. package/dist/assets/ToastContext.css +1 -0
  29. package/dist/assets/Tooltip.css +1 -0
  30. package/dist/assets/Tooltip2.css +1 -0
  31. package/dist/assets/fonts/FiraCode-Regular.ttf +0 -0
  32. package/dist/assets/fonts/Manrope-Bold.ttf +0 -0
  33. package/dist/assets/fonts/Manrope-Regular.ttf +0 -0
  34. package/dist/assets/fonts/Manrope-SemiBold.ttf +0 -0
  35. package/dist/assets/fonts/RobotoSlab-SemiBold.ttf +0 -0
  36. package/dist/components/Ui/Accordeon/Accordeon.js +33 -0
  37. package/dist/components/Ui/Accordeon/Accordeon.stories.js +72 -0
  38. package/dist/components/Ui/Accordeon/index.js +4 -0
  39. package/dist/components/Ui/Alert/Alert.js +14 -0
  40. package/dist/components/Ui/Alert/index.js +4 -0
  41. package/dist/components/Ui/Avatar/Avatar.js +10 -0
  42. package/dist/components/Ui/Avatar/index.js +4 -0
  43. package/dist/components/Ui/Badge/Badge.js +43 -0
  44. package/dist/components/Ui/Badge/index.js +4 -0
  45. package/dist/components/Ui/Button/Button.js +49 -0
  46. package/dist/components/Ui/Button/index.js +4 -0
  47. package/dist/components/Ui/ButtonsArray/ButtonsArray.js +28 -0
  48. package/dist/components/Ui/ButtonsArray/ButtonsArray.stories.js +78 -0
  49. package/dist/components/Ui/ButtonsArray/index.js +4 -0
  50. package/dist/components/Ui/Checkbox/Checkbox.js +39 -0
  51. package/dist/components/Ui/Checkbox/Checkbox.stories.js +120 -0
  52. package/dist/components/Ui/Checkbox/index.js +4 -0
  53. package/dist/components/Ui/CliTextareaInput/CliTextareaInput.js +121 -0
  54. package/dist/components/Ui/CliTextareaInput/index.js +23 -0
  55. package/dist/components/Ui/CliTextareaInput/utils/escapeHtml/escapeHtml.js +4 -0
  56. package/dist/components/Ui/CliTextareaInput/utils/fixJson/fixJson.js +12 -0
  57. package/dist/components/Ui/CliTextareaInput/utils/highlightSyntax/highlightSyntax.js +20 -0
  58. package/dist/components/Ui/CliTextareaInput/utils/highlightSyntax/index.js +4 -0
  59. package/dist/components/Ui/CliTextareaInput/utils/hooks/index.js +17 -0
  60. package/dist/components/Ui/CliTextareaInput/utils/hooks/useFixFormat/index.js +4 -0
  61. package/dist/components/Ui/CliTextareaInput/utils/hooks/useFixFormat/useFixFormat.js +29 -0
  62. package/dist/components/Ui/CliTextareaInput/utils/hooks/useHistoryNavigation/index.js +4 -0
  63. package/dist/components/Ui/CliTextareaInput/utils/hooks/useHistoryNavigation/useHistoryNavigation.js +34 -0
  64. package/dist/components/Ui/CliTextareaInput/utils/hooks/useKeyHandlers/index.js +4 -0
  65. package/dist/components/Ui/CliTextareaInput/utils/hooks/useKeyHandlers/useKeyHandlers.js +45 -0
  66. package/dist/components/Ui/CliTextareaInput/utils/hooks/useLineNumbers/index.js +5 -0
  67. package/dist/components/Ui/CliTextareaInput/utils/hooks/useLineNumbers/useLineNumbers.js +17 -0
  68. package/dist/components/Ui/CliTextareaInput/utils/hooks/useScrollSync/index.js +4 -0
  69. package/dist/components/Ui/CliTextareaInput/utils/hooks/useScrollSync/useScrollSync.js +13 -0
  70. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextActions/index.js +4 -0
  71. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextActions/useTextActions.js +37 -0
  72. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextCoursore/index.js +4 -0
  73. package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextCoursore/useTextCoursore.js +14 -0
  74. package/dist/components/Ui/CliTextareaInput/utils/index.js +21 -0
  75. package/dist/components/Ui/CliTextareaInput/utils/processJson/index.js +4 -0
  76. package/dist/components/Ui/CliTextareaInput/utils/processJson/processJson.js +11 -0
  77. package/dist/components/Ui/CliTextareaInput/utils/processXml/processXml.js +8 -0
  78. package/dist/components/Ui/CliTextareaInput/utils/processYml/processYml.js +27 -0
  79. package/dist/components/Ui/CliTextareaInput/utils/types.js +1 -0
  80. package/dist/components/Ui/CustomLink/CustomLink.js +49 -0
  81. package/dist/components/Ui/CustomLink/index.js +4 -0
  82. package/dist/components/Ui/DatePicker/DatePicker.js +175 -0
  83. package/dist/components/Ui/DatePicker/DatePicker.stories.js +114 -0
  84. package/dist/components/Ui/DatePicker/index.js +4 -0
  85. package/dist/components/Ui/DropdownInput/DropdownInput.js +91 -0
  86. package/dist/components/Ui/DropdownInput/DropdownInput.stories.js +77 -0
  87. package/dist/components/Ui/DropdownInput/index.js +4 -0
  88. package/dist/components/Ui/DropdownMenu/DropdownMenu.js +83 -0
  89. package/dist/components/Ui/DropdownMenu/DropdownMenu.stories.js +50 -0
  90. package/dist/components/Ui/DropdownMenu/index.js +4 -0
  91. package/dist/components/Ui/FileUpload/FileUpload.js +615 -0
  92. package/dist/components/Ui/FileUpload/fn.js +10 -0
  93. package/dist/components/Ui/FileUpload/index.js +4 -0
  94. package/dist/components/Ui/FileUpload/types.js +1 -0
  95. package/dist/components/Ui/Form/FormContext/FormContext.js +5 -0
  96. package/dist/components/Ui/Form/FormItem/FormItem.js +107 -0
  97. package/dist/components/Ui/Form/FormItem/fn.js +25 -0
  98. package/dist/components/Ui/Form/FormItem/types.js +1 -0
  99. package/dist/components/Ui/Form/FormRoot/FormRoot.js +25 -0
  100. package/dist/components/Ui/Form/FormRoot/index.js +4 -0
  101. package/dist/components/Ui/Form/FormRoot/types.js +1 -0
  102. package/dist/components/Ui/Form/index.js +6 -0
  103. package/dist/components/Ui/Form/useForm/index.js +4 -0
  104. package/dist/components/Ui/Form/useForm/useForm.js +111 -0
  105. package/dist/components/Ui/Form/utils/fn.js +31 -0
  106. package/dist/components/Ui/Form/utils/types.js +1 -0
  107. package/dist/components/Ui/Icons/Icons.js +577 -0
  108. package/dist/components/Ui/Icons/index.js +97 -0
  109. package/dist/components/Ui/Icons/utils/CreateIcon.js +23 -0
  110. package/dist/components/Ui/Loader/Loader.js +6 -0
  111. package/dist/components/Ui/Loader/index.js +4 -0
  112. package/dist/components/Ui/ModalWindow/ModalWindow.js +50 -0
  113. package/dist/components/Ui/ModalWindow/index.js +4 -0
  114. package/dist/components/Ui/Pagination/Pagination.js +294 -0
  115. package/dist/components/Ui/Pagination/index.js +4 -0
  116. package/dist/components/Ui/Radio/Radio.js +30 -0
  117. package/dist/components/Ui/Radio/Radio.stories.js +42 -0
  118. package/dist/components/Ui/Radio/index.js +4 -0
  119. package/dist/components/Ui/SearchInput/SearchData.js +30 -0
  120. package/dist/components/Ui/SearchInput/SearchInput.js +109 -0
  121. package/dist/components/Ui/Skeleton/Skeleton.js +28 -0
  122. package/dist/components/Ui/Skeleton/index.js +4 -0
  123. package/dist/components/Ui/Switch/Switch.js +25 -0
  124. package/dist/components/Ui/Switch/index.js +4 -0
  125. package/dist/components/Ui/Table/MemoizedRow/MemoizedRow.js +79 -0
  126. package/dist/components/Ui/Table/Table.js +160 -0
  127. package/dist/components/Ui/Table/TableTypes.js +1 -0
  128. package/dist/components/Ui/Table/index.js +4 -0
  129. package/dist/components/Ui/Tabs/Tabs.js +24 -0
  130. package/dist/components/Ui/Tabs/Tabs.stories.js +67 -0
  131. package/dist/components/Ui/Tabs/index.js +4 -0
  132. package/dist/components/Ui/TextInput/TextInput.js +85 -0
  133. package/dist/components/Ui/TextInput/TextInput.stories.js +225 -0
  134. package/dist/components/Ui/TextInput/index.js +4 -0
  135. package/dist/components/Ui/TextareaInput/TextareaInput.js +68 -0
  136. package/dist/components/Ui/TextareaInput/TextareaInput.stories.js +19 -0
  137. package/dist/components/Ui/TextareaInput/index.js +4 -0
  138. package/dist/components/Ui/Tooltip/Tooltip.js +92 -0
  139. package/dist/components/Ui/Tooltip/Tooltip.stories.js +92 -0
  140. package/dist/components/Ui/Tooltip/index.js +4 -0
  141. package/dist/context/ToastContext/ToastContext.js +40 -0
  142. package/dist/context/ToastContext/index.js +5 -0
  143. package/dist/context/TriaflyContext/TriaflyContext.types.js +1 -0
  144. package/dist/context/TriaflyContext/TriaflyProvider.js +27 -0
  145. package/dist/context/TriaflyContext/hooks/index.js +8 -0
  146. package/dist/context/TriaflyContext/hooks/useBreakpointValue/index.js +4 -0
  147. package/dist/context/TriaflyContext/hooks/useBreakpointValue/useBreakpointValue.js +11 -0
  148. package/dist/context/TriaflyContext/hooks/useModal/index.js +4 -0
  149. package/dist/context/TriaflyContext/hooks/useModal/useModal.js +16 -0
  150. package/dist/context/TriaflyContext/hooks/useTheme/index.js +4 -0
  151. package/dist/context/TriaflyContext/hooks/useTheme/useTheme.js +17 -0
  152. package/dist/context/TriaflyContext/index.js +12 -0
  153. package/dist/index-2QXL0WYc.js +45 -0
  154. package/dist/main.d.ts +1243 -0
  155. package/dist/main.js +164 -0
  156. package/dist/vite-env.d.js +1 -0
  157. package/package.json +106 -106
@@ -0,0 +1,615 @@
1
+ import { jsxs as J, jsx as j } from "react/jsx-runtime";
2
+ import { forwardRef as Ee, useState as _e, useRef as Re, useCallback as we, useImperativeHandle as Se } from "react";
3
+ import { g as xe } from "../../../_commonjsHelpers-C6fGbg64.js";
4
+ import { Button as Oe } from "../Button/Button.js";
5
+ import { IconFile as Ie } from "../Icons/Icons.js";
6
+ import { Loader as De } from "../Loader/Loader.js";
7
+ import { formatFileSize as Le, SIZE_UNITS as Te } from "./fn.js";
8
+ import '../../../assets/FileUpload.css';var ge = { exports: {} };
9
+ /* @license
10
+ Papa Parse
11
+ v5.5.3
12
+ https://github.com/mholt/PapaParse
13
+ License: MIT
14
+ */
15
+ var Ae = ge.exports, be;
16
+ function Ce() {
17
+ return be || (be = 1, function(ne, le) {
18
+ ((ee, b) => {
19
+ ne.exports = b();
20
+ })(Ae, function ee() {
21
+ var b = typeof self < "u" ? self : typeof window < "u" ? window : b !== void 0 ? b : {}, U, T = !b.document && !!b.postMessage, Y = b.IS_PAPA_WORKER || !1, Z = {}, me = 0, u = {};
22
+ function C(e) {
23
+ this._handle = null, this._finished = !1, this._completed = !1, this._halted = !1, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = !0, this._completeResults = { data: [], errors: [], meta: {} }, (function(t) {
24
+ var r = ie(t);
25
+ r.chunkSize = parseInt(r.chunkSize), t.step || t.chunk || (r.chunkSize = null), this._handle = new de(r), (this._handle.streamer = this)._config = r;
26
+ }).call(this, e), this.parseChunk = function(t, r) {
27
+ var s = parseInt(this._config.skipFirstNLines) || 0;
28
+ if (this.isFirstChunk && 0 < s) {
29
+ let d = this._config.newline;
30
+ d || (n = this._config.quoteChar || '"', d = this._handle.guessLineEndings(t, n)), t = [...t.split(d).slice(s)].join(d);
31
+ }
32
+ this.isFirstChunk && y(this._config.beforeFirstChunk) && (n = this._config.beforeFirstChunk(t)) !== void 0 && (t = n), this.isFirstChunk = !1, this._halted = !1;
33
+ var s = this._partialLine + t, n = (this._partialLine = "", this._handle.parse(s, this._baseIndex, !this._finished));
34
+ if (!this._handle.paused() && !this._handle.aborted()) {
35
+ if (t = n.meta.cursor, s = (this._finished || (this._partialLine = s.substring(t - this._baseIndex), this._baseIndex = t), n && n.data && (this._rowCount += n.data.length), this._finished || this._config.preview && this._rowCount >= this._config.preview), Y) b.postMessage({ results: n, workerId: u.WORKER_ID, finished: s });
36
+ else if (y(this._config.chunk) && !r) {
37
+ if (this._config.chunk(n, this._handle), this._handle.paused() || this._handle.aborted()) return void (this._halted = !0);
38
+ this._completeResults = n = void 0;
39
+ }
40
+ return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(n.data), this._completeResults.errors = this._completeResults.errors.concat(n.errors), this._completeResults.meta = n.meta), this._completed || !s || !y(this._config.complete) || n && n.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = !0), s || n && n.meta.paused || this._nextChunk(), n;
41
+ }
42
+ this._halted = !0;
43
+ }, this._sendError = function(t) {
44
+ y(this._config.error) ? this._config.error(t) : Y && this._config.error && b.postMessage({ workerId: u.WORKER_ID, error: t, finished: !1 });
45
+ };
46
+ }
47
+ function B(e) {
48
+ var t;
49
+ (e = e || {}).chunkSize || (e.chunkSize = u.RemoteChunkSize), C.call(this, e), this._nextChunk = T ? function() {
50
+ this._readChunk(), this._chunkLoaded();
51
+ } : function() {
52
+ this._readChunk();
53
+ }, this.stream = function(r) {
54
+ this._input = r, this._nextChunk();
55
+ }, this._readChunk = function() {
56
+ if (this._finished) this._chunkLoaded();
57
+ else {
58
+ if (t = new XMLHttpRequest(), this._config.withCredentials && (t.withCredentials = this._config.withCredentials), T || (t.onload = F(this._chunkLoaded, this), t.onerror = F(this._chunkError, this)), t.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !T), this._config.downloadRequestHeaders) {
59
+ var r, s = this._config.downloadRequestHeaders;
60
+ for (r in s) t.setRequestHeader(r, s[r]);
61
+ }
62
+ var n;
63
+ this._config.chunkSize && (n = this._start + this._config.chunkSize - 1, t.setRequestHeader("Range", "bytes=" + this._start + "-" + n));
64
+ try {
65
+ t.send(this._config.downloadRequestBody);
66
+ } catch (d) {
67
+ this._chunkError(d.message);
68
+ }
69
+ T && t.status === 0 && this._chunkError();
70
+ }
71
+ }, this._chunkLoaded = function() {
72
+ t.readyState === 4 && (t.status < 200 || 400 <= t.status ? this._chunkError() : (this._start += this._config.chunkSize || t.responseText.length, this._finished = !this._config.chunkSize || this._start >= ((r) => (r = r.getResponseHeader("Content-Range")) !== null ? parseInt(r.substring(r.lastIndexOf("/") + 1)) : -1)(t), this.parseChunk(t.responseText)));
73
+ }, this._chunkError = function(r) {
74
+ r = t.statusText || r, this._sendError(new Error(r));
75
+ };
76
+ }
77
+ function se(e) {
78
+ (e = e || {}).chunkSize || (e.chunkSize = u.LocalChunkSize), C.call(this, e);
79
+ var t, r, s = typeof FileReader < "u";
80
+ this.stream = function(n) {
81
+ this._input = n, r = n.slice || n.webkitSlice || n.mozSlice, s ? ((t = new FileReader()).onload = F(this._chunkLoaded, this), t.onerror = F(this._chunkError, this)) : t = new FileReaderSync(), this._nextChunk();
82
+ }, this._nextChunk = function() {
83
+ this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk();
84
+ }, this._readChunk = function() {
85
+ var n = this._input, d = (this._config.chunkSize && (d = Math.min(this._start + this._config.chunkSize, this._input.size), n = r.call(n, this._start, d)), t.readAsText(n, this._config.encoding));
86
+ s || this._chunkLoaded({ target: { result: d } });
87
+ }, this._chunkLoaded = function(n) {
88
+ this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(n.target.result);
89
+ }, this._chunkError = function() {
90
+ this._sendError(t.error);
91
+ };
92
+ }
93
+ function X(e) {
94
+ var t;
95
+ C.call(this, e = e || {}), this.stream = function(r) {
96
+ return t = r, this._nextChunk();
97
+ }, this._nextChunk = function() {
98
+ var r, s;
99
+ if (!this._finished) return r = this._config.chunkSize, t = r ? (s = t.substring(0, r), t.substring(r)) : (s = t, ""), this._finished = !t, this.parseChunk(s);
100
+ };
101
+ }
102
+ function te(e) {
103
+ C.call(this, e = e || {});
104
+ var t = [], r = !0, s = !1;
105
+ this.pause = function() {
106
+ C.prototype.pause.apply(this, arguments), this._input.pause();
107
+ }, this.resume = function() {
108
+ C.prototype.resume.apply(this, arguments), this._input.resume();
109
+ }, this.stream = function(n) {
110
+ this._input = n, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError);
111
+ }, this._checkIsFinished = function() {
112
+ s && t.length === 1 && (this._finished = !0);
113
+ }, this._nextChunk = function() {
114
+ this._checkIsFinished(), t.length ? this.parseChunk(t.shift()) : r = !0;
115
+ }, this._streamData = F(function(n) {
116
+ try {
117
+ t.push(typeof n == "string" ? n : n.toString(this._config.encoding)), r && (r = !1, this._checkIsFinished(), this.parseChunk(t.shift()));
118
+ } catch (d) {
119
+ this._streamError(d);
120
+ }
121
+ }, this), this._streamError = F(function(n) {
122
+ this._streamCleanUp(), this._sendError(n);
123
+ }, this), this._streamEnd = F(function() {
124
+ this._streamCleanUp(), s = !0, this._streamData("");
125
+ }, this), this._streamCleanUp = F(function() {
126
+ this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError);
127
+ }, this);
128
+ }
129
+ function de(e) {
130
+ var t, r, s, n, d = Math.pow(2, 53), R = -d, M = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, z = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/, i = this, v = 0, l = 0, S = !1, f = !1, a = [], o = { data: [], errors: [], meta: {} };
131
+ function I(_) {
132
+ return e.skipEmptyLines === "greedy" ? _.join("").trim() === "" : _.length === 1 && _[0].length === 0;
133
+ }
134
+ function p() {
135
+ if (o && s && (q("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + u.DefaultDelimiter + "'"), s = !1), e.skipEmptyLines && (o.data = o.data.filter(function(h) {
136
+ return !I(h);
137
+ })), D()) {
138
+ let h = function(O, L) {
139
+ y(e.transformHeader) && (O = e.transformHeader(O, L)), a.push(O);
140
+ };
141
+ if (o) if (Array.isArray(o.data[0])) {
142
+ for (var _ = 0; D() && _ < o.data.length; _++) o.data[_].forEach(h);
143
+ o.data.splice(0, 1);
144
+ } else o.data.forEach(h);
145
+ }
146
+ function m(h, O) {
147
+ for (var L = e.header ? {} : [], k = 0; k < h.length; k++) {
148
+ var w = k, g = h[k], g = ((W, c) => ((E) => (e.dynamicTypingFunction && e.dynamicTyping[E] === void 0 && (e.dynamicTyping[E] = e.dynamicTypingFunction(E)), (e.dynamicTyping[E] || e.dynamicTyping) === !0))(W) ? c === "true" || c === "TRUE" || c !== "false" && c !== "FALSE" && (((E) => {
149
+ if (M.test(E) && (E = parseFloat(E), R < E && E < d))
150
+ return 1;
151
+ })(c) ? parseFloat(c) : z.test(c) ? new Date(c) : c === "" ? null : c) : c)(w = e.header ? k >= a.length ? "__parsed_extra" : a[k] : w, g = e.transform ? e.transform(g, w) : g);
152
+ w === "__parsed_extra" ? (L[w] = L[w] || [], L[w].push(g)) : L[w] = g;
153
+ }
154
+ return e.header && (k > a.length ? q("FieldMismatch", "TooManyFields", "Too many fields: expected " + a.length + " fields but parsed " + k, l + O) : k < a.length && q("FieldMismatch", "TooFewFields", "Too few fields: expected " + a.length + " fields but parsed " + k, l + O)), L;
155
+ }
156
+ var x;
157
+ o && (e.header || e.dynamicTyping || e.transform) && (x = 1, !o.data.length || Array.isArray(o.data[0]) ? (o.data = o.data.map(m), x = o.data.length) : o.data = m(o.data, 0), e.header && o.meta && (o.meta.fields = a), l += x);
158
+ }
159
+ function D() {
160
+ return e.header && a.length === 0;
161
+ }
162
+ function q(_, m, x, h) {
163
+ _ = { type: _, code: m, message: x }, h !== void 0 && (_.row = h), o.errors.push(_);
164
+ }
165
+ y(e.step) && (n = e.step, e.step = function(_) {
166
+ o = _, D() ? p() : (p(), o.data.length !== 0 && (v += _.data.length, e.preview && v > e.preview ? r.abort() : (o.data = o.data[0], n(o, i))));
167
+ }), this.parse = function(_, m, x) {
168
+ var h = e.quoteChar || '"', h = (e.newline || (e.newline = this.guessLineEndings(_, h)), s = !1, e.delimiter ? y(e.delimiter) && (e.delimiter = e.delimiter(_), o.meta.delimiter = e.delimiter) : ((h = ((O, L, k, w, g) => {
169
+ var W, c, E, V;
170
+ g = g || [",", " ", "|", ";", u.RECORD_SEP, u.UNIT_SEP];
171
+ for (var ae = 0; ae < g.length; ae++) {
172
+ for (var H, fe = g[ae], N = 0, K = 0, A = 0, P = (E = void 0, new $({ comments: w, delimiter: fe, newline: L, preview: 10 }).parse(O)), G = 0; G < P.data.length; G++) k && I(P.data[G]) ? A++ : (H = P.data[G].length, K += H, E === void 0 ? E = H : 0 < H && (N += Math.abs(H - E), E = H));
173
+ 0 < P.data.length && (K /= P.data.length - A), (c === void 0 || N <= c) && (V === void 0 || V < K) && 1.99 < K && (c = N, W = fe, V = K);
174
+ }
175
+ return { successful: !!(e.delimiter = W), bestDelimiter: W };
176
+ })(_, e.newline, e.skipEmptyLines, e.comments, e.delimitersToGuess)).successful ? e.delimiter = h.bestDelimiter : (s = !0, e.delimiter = u.DefaultDelimiter), o.meta.delimiter = e.delimiter), ie(e));
177
+ return e.preview && e.header && h.preview++, t = _, r = new $(h), o = r.parse(t, m, x), p(), S ? { meta: { paused: !0 } } : o || { meta: { paused: !1 } };
178
+ }, this.paused = function() {
179
+ return S;
180
+ }, this.pause = function() {
181
+ S = !0, r.abort(), t = y(e.chunk) ? "" : t.substring(r.getCharIndex());
182
+ }, this.resume = function() {
183
+ i.streamer._halted ? (S = !1, i.streamer.parseChunk(t, !0)) : setTimeout(i.resume, 3);
184
+ }, this.aborted = function() {
185
+ return f;
186
+ }, this.abort = function() {
187
+ f = !0, r.abort(), o.meta.aborted = !0, y(e.complete) && e.complete(o), t = "";
188
+ }, this.guessLineEndings = function(O, h) {
189
+ O = O.substring(0, 1048576);
190
+ var h = new RegExp(re(h) + "([^]*?)" + re(h), "gm"), x = (O = O.replace(h, "")).split("\r"), h = O.split(`
191
+ `), O = 1 < h.length && h[0].length < x[0].length;
192
+ if (x.length === 1 || O) return `
193
+ `;
194
+ for (var L = 0, k = 0; k < x.length; k++) x[k][0] === `
195
+ ` && L++;
196
+ return L >= x.length / 2 ? `\r
197
+ ` : "\r";
198
+ };
199
+ }
200
+ function re(e) {
201
+ return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
202
+ }
203
+ function $(e) {
204
+ var t = (e = e || {}).delimiter, r = e.newline, s = e.comments, n = e.step, d = e.preview, R = e.fastMode, M = null, z = !1, i = e.quoteChar == null ? '"' : e.quoteChar, v = i;
205
+ if (e.escapeChar !== void 0 && (v = e.escapeChar), (typeof t != "string" || -1 < u.BAD_DELIMITERS.indexOf(t)) && (t = ","), s === t) throw new Error("Comment character same as delimiter");
206
+ s === !0 ? s = "#" : (typeof s != "string" || -1 < u.BAD_DELIMITERS.indexOf(s)) && (s = !1), r !== `
207
+ ` && r !== "\r" && r !== `\r
208
+ ` && (r = `
209
+ `);
210
+ var l = 0, S = !1;
211
+ this.parse = function(f, a, o) {
212
+ if (typeof f != "string") throw new Error("Input must be a string");
213
+ var I = f.length, p = t.length, D = r.length, q = s.length, _ = y(n), m = [], x = [], h = [], O = l = 0;
214
+ if (!f) return N();
215
+ if (R || R !== !1 && f.indexOf(i) === -1) {
216
+ for (var L = f.split(r), k = 0; k < L.length; k++) {
217
+ if (h = L[k], l += h.length, k !== L.length - 1) l += r.length;
218
+ else if (o) return N();
219
+ if (!s || h.substring(0, q) !== s) {
220
+ if (_) {
221
+ if (m = [], V(h.split(t)), K(), S) return N();
222
+ } else V(h.split(t));
223
+ if (d && d <= k) return m = m.slice(0, d), N(!0);
224
+ }
225
+ }
226
+ return N();
227
+ }
228
+ for (var w = f.indexOf(t, l), g = f.indexOf(r, l), W = new RegExp(re(v) + re(i), "g"), c = f.indexOf(i, l); ; ) if (f[l] === i) for (c = l, l++; ; ) {
229
+ if ((c = f.indexOf(i, c + 1)) === -1) return o || x.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: m.length, index: l }), H();
230
+ if (c === I - 1) return H(f.substring(l, c).replace(W, i));
231
+ if (i === v && f[c + 1] === v) c++;
232
+ else if (i === v || c === 0 || f[c - 1] !== v) {
233
+ w !== -1 && w < c + 1 && (w = f.indexOf(t, c + 1));
234
+ var E = ae((g = g !== -1 && g < c + 1 ? f.indexOf(r, c + 1) : g) === -1 ? w : Math.min(w, g));
235
+ if (f.substr(c + 1 + E, p) === t) {
236
+ h.push(f.substring(l, c).replace(W, i)), f[l = c + 1 + E + p] !== i && (c = f.indexOf(i, l)), w = f.indexOf(t, l), g = f.indexOf(r, l);
237
+ break;
238
+ }
239
+ if (E = ae(g), f.substring(c + 1 + E, c + 1 + E + D) === r) {
240
+ if (h.push(f.substring(l, c).replace(W, i)), fe(c + 1 + E + D), w = f.indexOf(t, l), c = f.indexOf(i, l), _ && (K(), S)) return N();
241
+ if (d && m.length >= d) return N(!0);
242
+ break;
243
+ }
244
+ x.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: m.length, index: l }), c++;
245
+ }
246
+ }
247
+ else if (s && h.length === 0 && f.substring(l, l + q) === s) {
248
+ if (g === -1) return N();
249
+ l = g + D, g = f.indexOf(r, l), w = f.indexOf(t, l);
250
+ } else if (w !== -1 && (w < g || g === -1)) h.push(f.substring(l, w)), l = w + p, w = f.indexOf(t, l);
251
+ else {
252
+ if (g === -1) break;
253
+ if (h.push(f.substring(l, g)), fe(g + D), _ && (K(), S)) return N();
254
+ if (d && m.length >= d) return N(!0);
255
+ }
256
+ return H();
257
+ function V(A) {
258
+ m.push(A), O = l;
259
+ }
260
+ function ae(A) {
261
+ var P = 0;
262
+ return P = A !== -1 && (A = f.substring(c + 1, A)) && A.trim() === "" ? A.length : P;
263
+ }
264
+ function H(A) {
265
+ return o || (A === void 0 && (A = f.substring(l)), h.push(A), l = I, V(h), _ && K()), N();
266
+ }
267
+ function fe(A) {
268
+ l = A, V(h), h = [], g = f.indexOf(r, l);
269
+ }
270
+ function N(A) {
271
+ if (e.header && !a && m.length && !z) {
272
+ var P = m[0], G = /* @__PURE__ */ Object.create(null), ye = new Set(P);
273
+ let ve = !1;
274
+ for (let oe = 0; oe < P.length; oe++) {
275
+ let Q = P[oe];
276
+ if (G[Q = y(e.transformHeader) ? e.transformHeader(Q, oe) : Q]) {
277
+ let he, ke = G[Q];
278
+ for (; he = Q + "_" + ke, ke++, ye.has(he); ) ;
279
+ ye.add(he), P[oe] = he, G[Q]++, ve = !0, (M = M === null ? {} : M)[he] = Q;
280
+ } else G[Q] = 1, P[oe] = Q;
281
+ ye.add(Q);
282
+ }
283
+ ve && console.warn("Duplicate headers found and renamed."), z = !0;
284
+ }
285
+ return { data: m, errors: x, meta: { delimiter: t, linebreak: r, aborted: S, truncated: !!A, cursor: O + (a || 0), renamedHeaders: M } };
286
+ }
287
+ function K() {
288
+ n(N()), m = [], x = [];
289
+ }
290
+ }, this.abort = function() {
291
+ S = !0;
292
+ }, this.getCharIndex = function() {
293
+ return l;
294
+ };
295
+ }
296
+ function ce(e) {
297
+ var t = e.data, r = Z[t.workerId], s = !1;
298
+ if (t.error) r.userError(t.error, t.file);
299
+ else if (t.results && t.results.data) {
300
+ var n = { abort: function() {
301
+ s = !0, pe(t.workerId, { data: [], errors: [], meta: { aborted: !0 } });
302
+ }, pause: ue, resume: ue };
303
+ if (y(r.userStep)) {
304
+ for (var d = 0; d < t.results.data.length && (r.userStep({ data: t.results.data[d], errors: t.results.errors, meta: t.results.meta }, n), !s); d++) ;
305
+ delete t.results;
306
+ } else y(r.userChunk) && (r.userChunk(t.results, n, t.file), delete t.results);
307
+ }
308
+ t.finished && !s && pe(t.workerId, t.results);
309
+ }
310
+ function pe(e, t) {
311
+ var r = Z[e];
312
+ y(r.userComplete) && r.userComplete(t), r.terminate(), delete Z[e];
313
+ }
314
+ function ue() {
315
+ throw new Error("Not implemented.");
316
+ }
317
+ function ie(e) {
318
+ if (typeof e != "object" || e === null) return e;
319
+ var t, r = Array.isArray(e) ? [] : {};
320
+ for (t in e) r[t] = ie(e[t]);
321
+ return r;
322
+ }
323
+ function F(e, t) {
324
+ return function() {
325
+ e.apply(t, arguments);
326
+ };
327
+ }
328
+ function y(e) {
329
+ return typeof e == "function";
330
+ }
331
+ return u.parse = function(e, t) {
332
+ var r = (t = t || {}).dynamicTyping || !1;
333
+ if (y(r) && (t.dynamicTypingFunction = r, r = {}), t.dynamicTyping = r, t.transform = !!y(t.transform) && t.transform, !t.worker || !u.WORKERS_SUPPORTED) return r = null, u.NODE_STREAM_INPUT, typeof e == "string" ? (e = ((s) => s.charCodeAt(0) !== 65279 ? s : s.slice(1))(e), r = new (t.download ? B : X)(t)) : e.readable === !0 && y(e.read) && y(e.on) ? r = new te(t) : (b.File && e instanceof File || e instanceof Object) && (r = new se(t)), r.stream(e);
334
+ (r = (() => {
335
+ var s;
336
+ return !!u.WORKERS_SUPPORTED && (s = (() => {
337
+ var n = b.URL || b.webkitURL || null, d = ee.toString();
338
+ return u.BLOB_URL || (u.BLOB_URL = n.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ", "(", d, ")();"], { type: "text/javascript" })));
339
+ })(), (s = new b.Worker(s)).onmessage = ce, s.id = me++, Z[s.id] = s);
340
+ })()).userStep = t.step, r.userChunk = t.chunk, r.userComplete = t.complete, r.userError = t.error, t.step = y(t.step), t.chunk = y(t.chunk), t.complete = y(t.complete), t.error = y(t.error), delete t.worker, r.postMessage({ input: e, config: t, workerId: r.id });
341
+ }, u.unparse = function(e, t) {
342
+ var r = !1, s = !0, n = ",", d = `\r
343
+ `, R = '"', M = R + R, z = !1, i = null, v = !1, l = ((() => {
344
+ if (typeof t == "object") {
345
+ if (typeof t.delimiter != "string" || u.BAD_DELIMITERS.filter(function(a) {
346
+ return t.delimiter.indexOf(a) !== -1;
347
+ }).length || (n = t.delimiter), typeof t.quotes != "boolean" && typeof t.quotes != "function" && !Array.isArray(t.quotes) || (r = t.quotes), typeof t.skipEmptyLines != "boolean" && typeof t.skipEmptyLines != "string" || (z = t.skipEmptyLines), typeof t.newline == "string" && (d = t.newline), typeof t.quoteChar == "string" && (R = t.quoteChar), typeof t.header == "boolean" && (s = t.header), Array.isArray(t.columns)) {
348
+ if (t.columns.length === 0) throw new Error("Option columns is empty");
349
+ i = t.columns;
350
+ }
351
+ t.escapeChar !== void 0 && (M = t.escapeChar + R), t.escapeFormulae instanceof RegExp ? v = t.escapeFormulae : typeof t.escapeFormulae == "boolean" && t.escapeFormulae && (v = /^[=+\-@\t\r].*$/);
352
+ }
353
+ })(), new RegExp(re(R), "g"));
354
+ if (typeof e == "string" && (e = JSON.parse(e)), Array.isArray(e)) {
355
+ if (!e.length || Array.isArray(e[0])) return S(null, e, z);
356
+ if (typeof e[0] == "object") return S(i || Object.keys(e[0]), e, z);
357
+ } else if (typeof e == "object") return typeof e.data == "string" && (e.data = JSON.parse(e.data)), Array.isArray(e.data) && (e.fields || (e.fields = e.meta && e.meta.fields || i), e.fields || (e.fields = Array.isArray(e.data[0]) ? e.fields : typeof e.data[0] == "object" ? Object.keys(e.data[0]) : []), Array.isArray(e.data[0]) || typeof e.data[0] == "object" || (e.data = [e.data])), S(e.fields || [], e.data || [], z);
358
+ throw new Error("Unable to serialize unrecognized input");
359
+ function S(a, o, I) {
360
+ var p = "", D = (typeof a == "string" && (a = JSON.parse(a)), typeof o == "string" && (o = JSON.parse(o)), Array.isArray(a) && 0 < a.length), q = !Array.isArray(o[0]);
361
+ if (D && s) {
362
+ for (var _ = 0; _ < a.length; _++) 0 < _ && (p += n), p += f(a[_], _);
363
+ 0 < o.length && (p += d);
364
+ }
365
+ for (var m = 0; m < o.length; m++) {
366
+ var x = (D ? a : o[m]).length, h = !1, O = D ? Object.keys(o[m]).length === 0 : o[m].length === 0;
367
+ if (I && !D && (h = I === "greedy" ? o[m].join("").trim() === "" : o[m].length === 1 && o[m][0].length === 0), I === "greedy" && D) {
368
+ for (var L = [], k = 0; k < x; k++) {
369
+ var w = q ? a[k] : k;
370
+ L.push(o[m][w]);
371
+ }
372
+ h = L.join("").trim() === "";
373
+ }
374
+ if (!h) {
375
+ for (var g = 0; g < x; g++) {
376
+ 0 < g && !O && (p += n);
377
+ var W = D && q ? a[g] : g;
378
+ p += f(o[m][W], g);
379
+ }
380
+ m < o.length - 1 && (!I || 0 < x && !O) && (p += d);
381
+ }
382
+ }
383
+ return p;
384
+ }
385
+ function f(a, o) {
386
+ var I, p;
387
+ return a == null ? "" : a.constructor === Date ? JSON.stringify(a).slice(1, 25) : (p = !1, v && typeof a == "string" && v.test(a) && (a = "'" + a, p = !0), I = a.toString().replace(l, M), (p = p || r === !0 || typeof r == "function" && r(a, o) || Array.isArray(r) && r[o] || ((D, q) => {
388
+ for (var _ = 0; _ < q.length; _++) if (-1 < D.indexOf(q[_])) return !0;
389
+ return !1;
390
+ })(I, u.BAD_DELIMITERS) || -1 < I.indexOf(n) || I.charAt(0) === " " || I.charAt(I.length - 1) === " ") ? R + I + R : I);
391
+ }
392
+ }, u.RECORD_SEP = "", u.UNIT_SEP = "", u.BYTE_ORDER_MARK = "\uFEFF", u.BAD_DELIMITERS = ["\r", `
393
+ `, '"', u.BYTE_ORDER_MARK], u.WORKERS_SUPPORTED = !T && !!b.Worker, u.NODE_STREAM_INPUT = 1, u.LocalChunkSize = 10485760, u.RemoteChunkSize = 5242880, u.DefaultDelimiter = ",", u.Parser = $, u.ParserHandle = de, u.NetworkStreamer = B, u.FileStreamer = se, u.StringStreamer = X, u.ReadableStreamStreamer = te, b.jQuery && ((U = b.jQuery).fn.parse = function(e) {
394
+ var t = e.config || {}, r = [];
395
+ return this.each(function(d) {
396
+ if (!(U(this).prop("tagName").toUpperCase() === "INPUT" && U(this).attr("type").toLowerCase() === "file" && b.FileReader) || !this.files || this.files.length === 0) return !0;
397
+ for (var R = 0; R < this.files.length; R++) r.push({ file: this.files[R], inputElem: this, instanceConfig: U.extend({}, t) });
398
+ }), s(), this;
399
+ function s() {
400
+ if (r.length === 0) y(e.complete) && e.complete();
401
+ else {
402
+ var d, R, M, z, i = r[0];
403
+ if (y(e.before)) {
404
+ var v = e.before(i.file, i.inputElem);
405
+ if (typeof v == "object") {
406
+ if (v.action === "abort") return d = "AbortError", R = i.file, M = i.inputElem, z = v.reason, void (y(e.error) && e.error({ name: d }, R, M, z));
407
+ if (v.action === "skip") return void n();
408
+ typeof v.config == "object" && (i.instanceConfig = U.extend(i.instanceConfig, v.config));
409
+ } else if (v === "skip") return void n();
410
+ }
411
+ var l = i.instanceConfig.complete;
412
+ i.instanceConfig.complete = function(S) {
413
+ y(l) && l(S, i.file, i.inputElem), n();
414
+ }, u.parse(i.file, i.instanceConfig);
415
+ }
416
+ }
417
+ function n() {
418
+ r.splice(0, 1), s();
419
+ }
420
+ }), Y && (b.onmessage = function(e) {
421
+ e = e.data, u.WORKER_ID === void 0 && e && (u.WORKER_ID = e.workerId), typeof e.input == "string" ? b.postMessage({ workerId: u.WORKER_ID, results: u.parse(e.input, e.config), finished: !0 }) : (b.File && e.input instanceof File || e.input instanceof Object) && (e = u.parse(e.input, e.config)) && b.postMessage({ workerId: u.WORKER_ID, results: e, finished: !0 });
422
+ }), (B.prototype = Object.create(C.prototype)).constructor = B, (se.prototype = Object.create(C.prototype)).constructor = se, (X.prototype = Object.create(X.prototype)).constructor = X, (te.prototype = Object.create(C.prototype)).constructor = te, u;
423
+ });
424
+ }(ge)), ge.exports;
425
+ }
426
+ var Fe = Ce();
427
+ const Ne = /* @__PURE__ */ xe(Fe), je = Ee(
428
+ ({
429
+ acceptedFormats: ne = [".csv", ".pdf", ".jpg", ".png", ".xlsx"],
430
+ maxSize: le = 7,
431
+ sizeUnit: ee = "MB",
432
+ multiple: b = !1,
433
+ onFilesChange: U,
434
+ onError: T,
435
+ parserCsv: Y = !1,
436
+ onReset: Z,
437
+ visibilityFileUpload: me = !0,
438
+ onVisibilityChange: u,
439
+ onChange: C,
440
+ isDisabled: B = !1,
441
+ hasError: se = !1,
442
+ errorMessage: X,
443
+ label: te,
444
+ isNotDeleteElement: de
445
+ }, re) => {
446
+ const [$, ce] = _e([]), [pe, ue] = _e(!1), [ie, F] = _e(""), y = Re(null), [e, t] = _e(!1), r = we(() => {
447
+ ce([]), F(""), y.current && (y.current.value = ""), Z == null || Z(), C == null || C([]), U == null || U([], []), u == null || u(!0);
448
+ }, [Z, U, u]);
449
+ Se(re, () => ({
450
+ reset: r,
451
+ getFiles: () => $.map((i) => i.file),
452
+ getParsedData: () => $.map((i) => i.parsedData)
453
+ }));
454
+ const s = le * Te[ee], n = we(
455
+ async (i) => Y && i.name.endsWith(".csv") ? new Promise((v, l) => {
456
+ Ne.parse(i, {
457
+ complete: (S) => {
458
+ S.errors.length && l(new Error("Ошибка при парсинге CSV файла")), v(S.data);
459
+ },
460
+ error: () => {
461
+ l(new Error("Не удалось прочитать CSV файл"));
462
+ },
463
+ skipEmptyLines: !0
464
+ });
465
+ }) : [],
466
+ [Y]
467
+ ), d = async (i) => {
468
+ if (!i.target.files || B) return;
469
+ F("");
470
+ const v = Array.from(i.target.files), l = [];
471
+ ue(!0);
472
+ try {
473
+ for (const a of v) {
474
+ const o = ne.some(
475
+ (p) => a.name.toLowerCase().endsWith(p.replace(".", ""))
476
+ ), I = a.size <= s;
477
+ if ($.some(
478
+ (p) => p.file.name === a.name && p.file.size === a.size && p.file.lastModified === a.lastModified
479
+ )) {
480
+ T == null || T(`Файл "${a.name}" уже загружен`), F(`Файл "${a.name}" уже загружен`);
481
+ continue;
482
+ }
483
+ if (!o) {
484
+ const p = `Неподдерживаемый формат: ${a.name}`;
485
+ T == null || T(p), F(`Неподдерживаемый формат: ${a.name}`);
486
+ continue;
487
+ }
488
+ if (!I) {
489
+ const p = `Файл слишком большой (максимум ${le} ${ee}): ${a.name}`;
490
+ T == null || T(p), F(`Файл слишком большой (максимум ${le} ${ee}): ${a.name}`);
491
+ continue;
492
+ }
493
+ try {
494
+ const p = Y ? await n(a) : void 0;
495
+ l.push({ file: a, parsedData: p });
496
+ } catch (p) {
497
+ const D = p instanceof Error ? p.message : "Неизвестная ошибка";
498
+ T == null || T(D), l.push({
499
+ file: a,
500
+ error: D,
501
+ isLoading: !1
502
+ });
503
+ }
504
+ }
505
+ ce((a) => b ? [...a, ...l] : l);
506
+ const f = (b ? [...$, ...l] : l).filter((a) => !a.error);
507
+ C == null || C(f.map((a) => a.file)), U == null || U(
508
+ f.map((a) => a.file),
509
+ Y ? f.map((a) => a.parsedData).filter(Boolean) : void 0
510
+ ), f.length > 0 && (u == null || u(!1));
511
+ } finally {
512
+ ue(!1);
513
+ }
514
+ }, R = (i) => {
515
+ i.preventDefault(), t(!0);
516
+ }, M = (i) => {
517
+ i.preventDefault(), t(!1);
518
+ }, z = (i) => {
519
+ if (i.preventDefault(), F(""), t(!1), i.dataTransfer.files && i.dataTransfer.files.length > 0) {
520
+ if (!ne.some(
521
+ (S) => i.dataTransfer.files[0].name.toLowerCase().endsWith(S.replace(".", ""))
522
+ )) {
523
+ F(`Неподдерживаемый формат: ${i.dataTransfer.files[0].name}`);
524
+ return;
525
+ }
526
+ const l = {
527
+ target: { files: i.dataTransfer.files }
528
+ };
529
+ d(l);
530
+ }
531
+ };
532
+ return /* @__PURE__ */ J("div", { className: "file-upload", children: [
533
+ te && /* @__PURE__ */ j("label", { className: "form-item-label", children: te }),
534
+ me && /* @__PURE__ */ j("div", { children: pe ? /* @__PURE__ */ J("div", { className: "file-upload__loading", children: [
535
+ /* @__PURE__ */ j("div", { style: { position: "relative", height: "40px", width: "40px" }, children: /* @__PURE__ */ j(De, { size: 40 }) }),
536
+ /* @__PURE__ */ j("span", { children: "Файл загружается..." })
537
+ ] }) : /* @__PURE__ */ J(
538
+ "label",
539
+ {
540
+ htmlFor: "fileInput",
541
+ className: `file-upload__label ${B ? "disabled" : ""}`,
542
+ children: [
543
+ /* @__PURE__ */ j(
544
+ "input",
545
+ {
546
+ ref: y,
547
+ type: "file",
548
+ id: "fileInput",
549
+ multiple: !1,
550
+ accept: ne.join(","),
551
+ onChange: d,
552
+ className: "file-upload__input",
553
+ disabled: B
554
+ }
555
+ ),
556
+ /* @__PURE__ */ J(
557
+ "div",
558
+ {
559
+ onDragEnter: R,
560
+ onDragOver: R,
561
+ onDragLeave: M,
562
+ onDrop: z,
563
+ className: `file-upload__drop-area ${e ? "dragging" : ""} ${ie ? "error" : ""} ${B ? "disabled" : ""}`,
564
+ children: [
565
+ /* @__PURE__ */ j("p", { children: "Перетащите или выберите файлы чтобы загрузить" }),
566
+ /* @__PURE__ */ j(
567
+ Oe,
568
+ {
569
+ onClick: () => {
570
+ var i;
571
+ return !B && ((i = document.getElementById("fileInput")) == null ? void 0 : i.click());
572
+ },
573
+ label: "Выбрать файлы",
574
+ type: "button",
575
+ className: "file-upload__select-btn",
576
+ isDisabled: B
577
+ }
578
+ ),
579
+ /* @__PURE__ */ J("div", { className: "file-upload__formats", children: [
580
+ /* @__PURE__ */ J("span", { children: [
581
+ "Поддерживаемые форматы: ",
582
+ ne.join(", ")
583
+ ] }),
584
+ /* @__PURE__ */ J("span", { children: [
585
+ "Максимальный размер: ",
586
+ le,
587
+ " ",
588
+ ee
589
+ ] })
590
+ ] }),
591
+ (ie || se && X) && /* @__PURE__ */ j("span", { style: { color: "red" }, children: ie || X })
592
+ ]
593
+ }
594
+ )
595
+ ]
596
+ }
597
+ ) }),
598
+ $.length > 0 && /* @__PURE__ */ j("div", { className: "file-upload__files-list", children: /* @__PURE__ */ j("ul", { children: $ == null ? void 0 : $.map((i, v) => /* @__PURE__ */ J("li", { className: "file-upload__file-item", children: [
599
+ /* @__PURE__ */ J("div", { className: "file-upload__file-info", children: [
600
+ /* @__PURE__ */ j("div", { className: "file-upload__box-icon", children: /* @__PURE__ */ j(Ie, { className: "icon" }) }),
601
+ /* @__PURE__ */ J("div", { className: "file-upload__block-text", children: [
602
+ /* @__PURE__ */ j("span", { className: "file-upload__file-name", children: i.file.name }),
603
+ /* @__PURE__ */ j("span", { className: "file-upload__file-size", children: Le(i.file.size) })
604
+ ] }),
605
+ i.error && /* @__PURE__ */ j("span", { className: "file-upload__file-error", children: i.error })
606
+ ] }),
607
+ null
608
+ ] }, `${i.file.name}-${v}`)) }) })
609
+ ] });
610
+ }
611
+ );
612
+ je.displayName = "FileUpload";
613
+ export {
614
+ je as FileUpload
615
+ };
@@ -0,0 +1,10 @@
1
+ const r = {
2
+ B: 1,
3
+ KB: 1024,
4
+ MB: 1048576,
5
+ GB: 1073741824
6
+ }, i = (B) => B < r.KB ? `${B} B` : B < r.MB ? `${(B / r.KB).toFixed(2)} KB` : B < r.GB ? `${(B / r.MB).toFixed(2)} MB` : `${(B / r.GB).toFixed(2)} GB`;
7
+ export {
8
+ r as SIZE_UNITS,
9
+ i as formatFileSize
10
+ };
@@ -0,0 +1,4 @@
1
+ import { FileUpload as l } from "./FileUpload.js";
2
+ export {
3
+ l as FileUpload
4
+ };
@@ -0,0 +1,5 @@
1
+ import { createContext as t } from "react";
2
+ const e = t(null);
3
+ export {
4
+ e as FormContext
5
+ };