wcz-test 6.24.5 → 6.24.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{DialogsHooks-DVnj8xmz.js → DialogsHooks-DOT0O_b4.js} +3 -178
- package/dist/chunks/DialogsHooks-DOT0O_b4.js.map +1 -0
- package/dist/chunks/{FileHooks-GprjzNKW.js → FileHooks-DdKh9cZa.js} +30 -106
- package/dist/chunks/FileHooks-DdKh9cZa.js.map +1 -0
- package/dist/chunks/RouterListItemButton-DTYXk1kh.js +35 -0
- package/dist/chunks/RouterListItemButton-DTYXk1kh.js.map +1 -0
- package/dist/chunks/env-gsqZ6zZD.js +30 -0
- package/dist/chunks/env-gsqZ6zZD.js.map +1 -0
- package/dist/chunks/session-vW7WZadj.js +91 -0
- package/dist/chunks/session-vW7WZadj.js.map +1 -0
- package/dist/chunks/utils-MD9YwOtu.js +91 -0
- package/dist/chunks/utils-MD9YwOtu.js.map +1 -0
- package/dist/client.js +4 -4
- package/dist/components.js +7 -2418
- package/dist/components.js.map +1 -1
- package/dist/hooks.js +5 -1011
- package/dist/hooks.js.map +1 -1
- package/dist/index.js +951 -448
- package/dist/index.js.map +1 -1
- package/dist/queries.js +3 -3
- package/dist/server.js +4 -5213
- package/dist/server.js.map +1 -1
- package/dist/utils.js +5 -5
- package/package.json +1 -1
- package/dist/chunks/DialogsHooks-DVnj8xmz.js.map +0 -1
- package/dist/chunks/FileHooks-GprjzNKW.js.map +0 -1
- package/dist/chunks/RouterListItemButton-BvsZysDL.js +0 -959
- package/dist/chunks/RouterListItemButton-BvsZysDL.js.map +0 -1
- package/dist/chunks/_commonjsHelpers-BGn2FbsY.js +0 -35
- package/dist/chunks/_commonjsHelpers-BGn2FbsY.js.map +0 -1
- package/dist/chunks/env-Di2sjb5X.js +0 -104
- package/dist/chunks/env-Di2sjb5X.js.map +0 -1
- package/dist/chunks/i18next-Dx0Bahhj.js +0 -2203
- package/dist/chunks/i18next-Dx0Bahhj.js.map +0 -1
- package/dist/chunks/index-BrFiyyyk.js +0 -327
- package/dist/chunks/index-BrFiyyyk.js.map +0 -1
- package/dist/chunks/session-CPSUX_HJ.js +0 -12970
- package/dist/chunks/session-CPSUX_HJ.js.map +0 -1
- package/dist/chunks/useTranslation-D7I_DXWv.js +0 -406
- package/dist/chunks/useTranslation-D7I_DXWv.js.map +0 -1
- package/dist/chunks/utils-DtlCJSvY.js +0 -2582
- package/dist/chunks/utils-DtlCJSvY.js.map +0 -1
|
@@ -1,183 +1,9 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { useContext } from "react";
|
|
3
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
2
|
import { c } from "react/compiler-runtime";
|
|
5
3
|
import { useEventCallback, DialogContent, DialogTitle, DialogActions, Button, Dialog } from "@mui/material";
|
|
4
|
+
import { useContext } from "react";
|
|
5
|
+
import { useTranslation } from "react-i18next";
|
|
6
6
|
import { D as DialogsContext } from "./DialogsContext-DoU_8Eeu.js";
|
|
7
|
-
import { u as useTranslation } from "./useTranslation-D7I_DXWv.js";
|
|
8
|
-
var observerMap = /* @__PURE__ */ new Map();
|
|
9
|
-
var RootIds = /* @__PURE__ */ new WeakMap();
|
|
10
|
-
var rootId = 0;
|
|
11
|
-
var unsupportedValue;
|
|
12
|
-
function getRootId(root) {
|
|
13
|
-
if (!root) return "0";
|
|
14
|
-
if (RootIds.has(root)) return RootIds.get(root);
|
|
15
|
-
rootId += 1;
|
|
16
|
-
RootIds.set(root, rootId.toString());
|
|
17
|
-
return RootIds.get(root);
|
|
18
|
-
}
|
|
19
|
-
function optionsToId(options) {
|
|
20
|
-
return Object.keys(options).sort().filter(
|
|
21
|
-
(key) => options[key] !== void 0
|
|
22
|
-
).map((key) => {
|
|
23
|
-
return `${key}_${key === "root" ? getRootId(options.root) : options[key]}`;
|
|
24
|
-
}).toString();
|
|
25
|
-
}
|
|
26
|
-
function createObserver(options) {
|
|
27
|
-
const id = optionsToId(options);
|
|
28
|
-
let instance = observerMap.get(id);
|
|
29
|
-
if (!instance) {
|
|
30
|
-
const elements = /* @__PURE__ */ new Map();
|
|
31
|
-
let thresholds;
|
|
32
|
-
const observer = new IntersectionObserver((entries) => {
|
|
33
|
-
entries.forEach((entry) => {
|
|
34
|
-
var _a2;
|
|
35
|
-
const inView = entry.isIntersecting && thresholds.some((threshold) => entry.intersectionRatio >= threshold);
|
|
36
|
-
if (options.trackVisibility && typeof entry.isVisible === "undefined") {
|
|
37
|
-
entry.isVisible = inView;
|
|
38
|
-
}
|
|
39
|
-
(_a2 = elements.get(entry.target)) == null ? void 0 : _a2.forEach((callback) => {
|
|
40
|
-
callback(inView, entry);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}, options);
|
|
44
|
-
thresholds = observer.thresholds || (Array.isArray(options.threshold) ? options.threshold : [options.threshold || 0]);
|
|
45
|
-
instance = {
|
|
46
|
-
id,
|
|
47
|
-
observer,
|
|
48
|
-
elements
|
|
49
|
-
};
|
|
50
|
-
observerMap.set(id, instance);
|
|
51
|
-
}
|
|
52
|
-
return instance;
|
|
53
|
-
}
|
|
54
|
-
function observe(element, callback, options = {}, fallbackInView = unsupportedValue) {
|
|
55
|
-
if (typeof window.IntersectionObserver === "undefined" && fallbackInView !== void 0) {
|
|
56
|
-
const bounds = element.getBoundingClientRect();
|
|
57
|
-
callback(fallbackInView, {
|
|
58
|
-
isIntersecting: fallbackInView,
|
|
59
|
-
target: element,
|
|
60
|
-
intersectionRatio: typeof options.threshold === "number" ? options.threshold : 0,
|
|
61
|
-
time: 0,
|
|
62
|
-
boundingClientRect: bounds,
|
|
63
|
-
intersectionRect: bounds,
|
|
64
|
-
rootBounds: bounds
|
|
65
|
-
});
|
|
66
|
-
return () => {
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
const { id, observer, elements } = createObserver(options);
|
|
70
|
-
const callbacks = elements.get(element) || [];
|
|
71
|
-
if (!elements.has(element)) {
|
|
72
|
-
elements.set(element, callbacks);
|
|
73
|
-
}
|
|
74
|
-
callbacks.push(callback);
|
|
75
|
-
observer.observe(element);
|
|
76
|
-
return function unobserve() {
|
|
77
|
-
callbacks.splice(callbacks.indexOf(callback), 1);
|
|
78
|
-
if (callbacks.length === 0) {
|
|
79
|
-
elements.delete(element);
|
|
80
|
-
observer.unobserve(element);
|
|
81
|
-
}
|
|
82
|
-
if (elements.size === 0) {
|
|
83
|
-
observer.disconnect();
|
|
84
|
-
observerMap.delete(id);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
function useInView({
|
|
89
|
-
threshold,
|
|
90
|
-
delay,
|
|
91
|
-
trackVisibility,
|
|
92
|
-
rootMargin,
|
|
93
|
-
root,
|
|
94
|
-
triggerOnce,
|
|
95
|
-
skip,
|
|
96
|
-
initialInView,
|
|
97
|
-
fallbackInView,
|
|
98
|
-
onChange
|
|
99
|
-
} = {}) {
|
|
100
|
-
var _a2;
|
|
101
|
-
const [ref, setRef] = React.useState(null);
|
|
102
|
-
const callback = React.useRef(onChange);
|
|
103
|
-
const lastInViewRef = React.useRef(initialInView);
|
|
104
|
-
const [state, setState] = React.useState({
|
|
105
|
-
inView: !!initialInView,
|
|
106
|
-
entry: void 0
|
|
107
|
-
});
|
|
108
|
-
callback.current = onChange;
|
|
109
|
-
React.useEffect(
|
|
110
|
-
() => {
|
|
111
|
-
if (lastInViewRef.current === void 0) {
|
|
112
|
-
lastInViewRef.current = initialInView;
|
|
113
|
-
}
|
|
114
|
-
if (skip || !ref) return;
|
|
115
|
-
let unobserve;
|
|
116
|
-
unobserve = observe(
|
|
117
|
-
ref,
|
|
118
|
-
(inView, entry) => {
|
|
119
|
-
const previousInView = lastInViewRef.current;
|
|
120
|
-
lastInViewRef.current = inView;
|
|
121
|
-
if (previousInView === void 0 && !inView) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
setState({
|
|
125
|
-
inView,
|
|
126
|
-
entry
|
|
127
|
-
});
|
|
128
|
-
if (callback.current) callback.current(inView, entry);
|
|
129
|
-
if (entry.isIntersecting && triggerOnce && unobserve) {
|
|
130
|
-
unobserve();
|
|
131
|
-
unobserve = void 0;
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
root,
|
|
136
|
-
rootMargin,
|
|
137
|
-
threshold,
|
|
138
|
-
// @ts-expect-error
|
|
139
|
-
trackVisibility,
|
|
140
|
-
delay
|
|
141
|
-
},
|
|
142
|
-
fallbackInView
|
|
143
|
-
);
|
|
144
|
-
return () => {
|
|
145
|
-
if (unobserve) {
|
|
146
|
-
unobserve();
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
},
|
|
150
|
-
// We break the rule here, because we aren't including the actual `threshold` variable
|
|
151
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
152
|
-
[
|
|
153
|
-
// If the threshold is an array, convert it to a string, so it won't change between renders.
|
|
154
|
-
Array.isArray(threshold) ? threshold.toString() : threshold,
|
|
155
|
-
ref,
|
|
156
|
-
root,
|
|
157
|
-
rootMargin,
|
|
158
|
-
triggerOnce,
|
|
159
|
-
skip,
|
|
160
|
-
trackVisibility,
|
|
161
|
-
fallbackInView,
|
|
162
|
-
delay
|
|
163
|
-
]
|
|
164
|
-
);
|
|
165
|
-
const entryTarget = (_a2 = state.entry) == null ? void 0 : _a2.target;
|
|
166
|
-
const previousEntryTarget = React.useRef(void 0);
|
|
167
|
-
if (!ref && entryTarget && !triggerOnce && !skip && previousEntryTarget.current !== entryTarget) {
|
|
168
|
-
previousEntryTarget.current = entryTarget;
|
|
169
|
-
setState({
|
|
170
|
-
inView: !!initialInView,
|
|
171
|
-
entry: void 0
|
|
172
|
-
});
|
|
173
|
-
lastInViewRef.current = initialInView;
|
|
174
|
-
}
|
|
175
|
-
const result = [setRef, state.inView, state.entry];
|
|
176
|
-
result.ref = result[0];
|
|
177
|
-
result.inView = result[1];
|
|
178
|
-
result.entry = result[2];
|
|
179
|
-
return result;
|
|
180
|
-
}
|
|
181
7
|
function AlertDialog(t0) {
|
|
182
8
|
const $ = c(22);
|
|
183
9
|
const {
|
|
@@ -447,7 +273,6 @@ function useDialogs() {
|
|
|
447
273
|
return t2;
|
|
448
274
|
}
|
|
449
275
|
export {
|
|
450
|
-
useInView as a,
|
|
451
276
|
useDialogs as u
|
|
452
277
|
};
|
|
453
|
-
//# sourceMappingURL=DialogsHooks-
|
|
278
|
+
//# sourceMappingURL=DialogsHooks-DOT0O_b4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogsHooks-DOT0O_b4.js","sources":["../../src/hooks/DialogsHooks.tsx"],"sourcesContent":["import { Button, Dialog, DialogActions, DialogContent, DialogTitle, useEventCallback } from \"@mui/material\";\nimport { useContext } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { DialogsContext } from \"../contexts/DialogsContext\";\nimport type { ReactNode } from \"react\";\n\nexport interface OpenDialogOptions<TResult> {\n onClose?: (result: TResult) => Promise<void>;\n}\n\nexport interface AlertOptions {\n title?: ReactNode;\n}\n\nexport interface ConfirmOptions {\n title?: ReactNode;\n cancelText?: ReactNode;\n}\n\nexport interface DialogProps<TPayload = undefined, TResult = void> {\n payload: TPayload;\n open: boolean;\n onClose: (result: TResult) => Promise<void>;\n}\n\nexport type OpenAlertDialog = (message: ReactNode, options?: AlertOptions) => Promise<void>;\n\nexport type OpenConfirmDialog = (message: ReactNode, options?: ConfirmOptions) => Promise<boolean>;\n\nexport type DialogComponent<TPayload, TResult> = React.ComponentType<DialogProps<TPayload, TResult>>;\n\nexport interface OpenDialog {\n <TPayload extends undefined, TResult>(Component: DialogComponent<TPayload, TResult>, payload?: TPayload, options?: OpenDialogOptions<TResult>): Promise<TResult>;\n <TPayload, TResult>(Component: DialogComponent<TPayload, TResult>, payload: TPayload, options?: OpenDialogOptions<TResult>): Promise<TResult>;\n}\n\nexport type CloseDialog = <TResult>(dialog: Promise<TResult>, result: TResult) => Promise<TResult>;\n\nexport interface AlertDialogPayload extends AlertOptions {\n message: ReactNode;\n}\n\nexport type AlertDialogProps = DialogProps<AlertDialogPayload, void>\n\nexport function AlertDialog({ open, payload, onClose }: Readonly<AlertDialogProps>) {\n const { t } = useTranslation();\n\n return (\n <Dialog maxWidth=\"xs\" fullWidth open={open} onClose={() => onClose()} disableRestoreFocus>\n <DialogTitle>{payload.title ?? t(\"Layout.Dialog.Alert\")}</DialogTitle>\n <DialogContent>{payload.message}</DialogContent>\n <DialogActions>\n <Button onClick={() => onClose()} autoFocus>\n {t(\"Layout.Dialog.Confirm\")}\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n\nexport interface ConfirmDialogPayload extends ConfirmOptions {\n message: ReactNode;\n}\n\nexport type ConfirmDialogProps = DialogProps<ConfirmDialogPayload, boolean>\n\nexport function ConfirmDialog({ open, payload, onClose }: Readonly<ConfirmDialogProps>) {\n const { t } = useTranslation();\n\n return (\n <Dialog maxWidth=\"xs\" fullWidth open={open} onClose={() => onClose(false)} disableRestoreFocus>\n <DialogTitle>{payload.title ?? t(\"Layout.Dialog.Confirm\")}</DialogTitle>\n <DialogContent>{payload.message}</DialogContent>\n <DialogActions>\n <Button onClick={() => onClose(false)}>\n {payload.cancelText ?? t(\"Layout.Dialog.Cancel\")}\n </Button>\n <Button onClick={() => onClose(true)} autoFocus>\n {t(\"Layout.Dialog.Confirm\")}\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n\ninterface DialogHook {\n alert: OpenAlertDialog;\n confirm: OpenConfirmDialog;\n open: OpenDialog;\n close: CloseDialog;\n}\n\nexport function useDialogs(): DialogHook {\n const { open, close } = useContext(DialogsContext);\n\n const alert = useEventCallback<OpenAlertDialog>((message, { ...options } = {}) =>\n open(AlertDialog, { ...options, message }),\n );\n\n const confirm = useEventCallback<OpenConfirmDialog>((message, { ...options } = {}) =>\n open(ConfirmDialog, { ...options, message }),\n );\n\n return { alert, confirm, open, close };\n}\n"],"names":["AlertDialog","t0","$","_c","open","payload","onClose","t","useTranslation","t1","t2","title","t3","t4","message","t5","t6","t7","t8","ConfirmDialog","cancelText","t9","t10","t11","t12","useDialogs","close","useContext","DialogsContext","options","undefined","alert","useEventCallback","message_0","options_0","confirm"],"mappings":";;;;;;AA4CO,SAAAA,YAAAC,IAAA;AAAA,QAAAC,IAAAC,EAAA,EAAA;AAAqB,QAAA;AAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,EAAAA,IAAAL;AACxB,QAAA;AAAA,IAAAM;AAAAA,EAAAA,IAAcC,eAAAA;AAAiB,MAAAC;AAAA,MAAAP,SAAAI,SAAA;AAG0BG,SAAAA,MAAMH,QAAAA;AAASJ,WAAAI;AAAAJ,WAAAO;AAAAA,EAAA,OAAA;AAAAA,SAAAP,EAAA,CAAA;AAAA,EAAA;AAAA,MAAAQ;AAAA,MAAAR,SAAAG,QAAAM,SAAAT,SAAAK,GAAA;AAClDG,SAAAL,QAAOM,SAAUJ,EAAE,qBAAqB;AAACL,MAAA,CAAA,IAAAG,QAAAM;AAAAT,WAAAK;AAAAL,WAAAQ;AAAAA,EAAA,OAAA;AAAAA,SAAAR,EAAA,CAAA;AAAA,EAAA;AAAA,MAAAU;AAAA,MAAAV,SAAAQ,IAAA;AAAvDE,SAAA,oBAAC,eAAaF,UAAAA,GAAAA,CAA0C;AAAcR,WAAAQ;AAAAR,WAAAU;AAAAA,EAAA,OAAA;AAAAA,SAAAV,EAAA,CAAA;AAAA,EAAA;AAAA,MAAAW;AAAA,MAAAX,EAAA,CAAA,MAAAG,QAAAS,SAAA;AACtED,SAAA,oBAAC,eAAA,EAAeR,UAAAA,QAAOS,SAAS;AAAgBZ,MAAA,CAAA,IAAAG,QAAAS;AAAAZ,WAAAW;AAAAA,EAAA,OAAA;AAAAA,SAAAX,EAAA,CAAA;AAAA,EAAA;AAAA,MAAAa;AAAA,MAAAb,SAAAI,SAAA;AAE3BS,SAAAA,MAAMT,QAAAA;AAASJ,WAAAI;AAAAJ,YAAA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AAAA,MAAAqB;AAAAA,MAAAI;AAAAA,MAAA/B;AAAAA,MAAAsB;AAAAA,IAAAA;AAA+BxB,WAAA6B;AAAA7B,WAAAwB;AAAAxB,WAAAiC;AAAAjC,WAAAE;AAAAF,WAAAQ;AAAAA,EAAA,OAAA;AAAAA,SAAAR,EAAA,CAAA;AAAA,EAAA;AAAA,SAA/BQ;AAA+B;"}
|
|
@@ -1,89 +1,13 @@
|
|
|
1
1
|
import { c } from "react/compiler-runtime";
|
|
2
2
|
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
3
|
-
import
|
|
3
|
+
import saveAs from "file-saver";
|
|
4
4
|
import { useState } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { uuidv7 } from "uuidv7";
|
|
6
6
|
import z__default from "zod";
|
|
7
7
|
import { F as FileMetaSchema } from "./FileMeta-G1oT3mYK.js";
|
|
8
|
-
import { t as toKebabCase, h as httpClient } from "./utils-
|
|
9
|
-
import {
|
|
10
|
-
var
|
|
11
|
-
var FileSaver_min = FileSaver_min$1.exports;
|
|
12
|
-
var hasRequiredFileSaver_min;
|
|
13
|
-
function requireFileSaver_min() {
|
|
14
|
-
if (hasRequiredFileSaver_min) return FileSaver_min$1.exports;
|
|
15
|
-
hasRequiredFileSaver_min = 1;
|
|
16
|
-
(function(module, exports$1) {
|
|
17
|
-
(function(a, b) {
|
|
18
|
-
b();
|
|
19
|
-
})(FileSaver_min, function() {
|
|
20
|
-
function b(a2, b2) {
|
|
21
|
-
return "undefined" == typeof b2 ? b2 = { autoBom: false } : "object" != typeof b2 && (console.warn("Deprecated: Expected third argument to be a object"), b2 = { autoBom: !b2 }), b2.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a2.type) ? new Blob(["\uFEFF", a2], { type: a2.type }) : a2;
|
|
22
|
-
}
|
|
23
|
-
function c2(a2, b2, c3) {
|
|
24
|
-
var d2 = new XMLHttpRequest();
|
|
25
|
-
d2.open("GET", a2), d2.responseType = "blob", d2.onload = function() {
|
|
26
|
-
g(d2.response, b2, c3);
|
|
27
|
-
}, d2.onerror = function() {
|
|
28
|
-
console.error("could not download file");
|
|
29
|
-
}, d2.send();
|
|
30
|
-
}
|
|
31
|
-
function d(a2) {
|
|
32
|
-
var b2 = new XMLHttpRequest();
|
|
33
|
-
b2.open("HEAD", a2, false);
|
|
34
|
-
try {
|
|
35
|
-
b2.send();
|
|
36
|
-
} catch (a3) {
|
|
37
|
-
}
|
|
38
|
-
return 200 <= b2.status && 299 >= b2.status;
|
|
39
|
-
}
|
|
40
|
-
function e(a2) {
|
|
41
|
-
try {
|
|
42
|
-
a2.dispatchEvent(new MouseEvent("click"));
|
|
43
|
-
} catch (c3) {
|
|
44
|
-
var b2 = document.createEvent("MouseEvents");
|
|
45
|
-
b2.initMouseEvent("click", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null), a2.dispatchEvent(b2);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
var f = "object" == typeof window && window.window === window ? window : "object" == typeof self && self.self === self ? self : "object" == typeof commonjsGlobal && commonjsGlobal.global === commonjsGlobal ? commonjsGlobal : void 0, a = f.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent), g = f.saveAs || ("object" != typeof window || window !== f ? function() {
|
|
49
|
-
} : "download" in HTMLAnchorElement.prototype && !a ? function(b2, g2, h) {
|
|
50
|
-
var i = f.URL || f.webkitURL, j = document.createElement("a");
|
|
51
|
-
g2 = g2 || b2.name || "download", j.download = g2, j.rel = "noopener", "string" == typeof b2 ? (j.href = b2, j.origin === location.origin ? e(j) : d(j.href) ? c2(b2, g2, h) : e(j, j.target = "_blank")) : (j.href = i.createObjectURL(b2), setTimeout(function() {
|
|
52
|
-
i.revokeObjectURL(j.href);
|
|
53
|
-
}, 4e4), setTimeout(function() {
|
|
54
|
-
e(j);
|
|
55
|
-
}, 0));
|
|
56
|
-
} : "msSaveOrOpenBlob" in navigator ? function(f2, g2, h) {
|
|
57
|
-
if (g2 = g2 || f2.name || "download", "string" != typeof f2) navigator.msSaveOrOpenBlob(b(f2, h), g2);
|
|
58
|
-
else if (d(f2)) c2(f2, g2, h);
|
|
59
|
-
else {
|
|
60
|
-
var i = document.createElement("a");
|
|
61
|
-
i.href = f2, i.target = "_blank", setTimeout(function() {
|
|
62
|
-
e(i);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
} : function(b2, d2, e2, g2) {
|
|
66
|
-
if (g2 = g2 || open("", "_blank"), g2 && (g2.document.title = g2.document.body.innerText = "downloading..."), "string" == typeof b2) return c2(b2, d2, e2);
|
|
67
|
-
var h = "application/octet-stream" === b2.type, i = /constructor/i.test(f.HTMLElement) || f.safari, j = /CriOS\/[\d]+/.test(navigator.userAgent);
|
|
68
|
-
if ((j || h && i || a) && "undefined" != typeof FileReader) {
|
|
69
|
-
var k = new FileReader();
|
|
70
|
-
k.onloadend = function() {
|
|
71
|
-
var a2 = k.result;
|
|
72
|
-
a2 = j ? a2 : a2.replace(/^data:[^;]*;/, "data:attachment/file;"), g2 ? g2.location.href = a2 : location = a2, g2 = null;
|
|
73
|
-
}, k.readAsDataURL(b2);
|
|
74
|
-
} else {
|
|
75
|
-
var l = f.URL || f.webkitURL, m = l.createObjectURL(b2);
|
|
76
|
-
g2 ? g2.location = m : location.href = m, g2 = null, setTimeout(function() {
|
|
77
|
-
l.revokeObjectURL(m);
|
|
78
|
-
}, 4e4);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
f.saveAs = g.saveAs = g, module.exports = g;
|
|
82
|
-
});
|
|
83
|
-
})(FileSaver_min$1);
|
|
84
|
-
return FileSaver_min$1.exports;
|
|
85
|
-
}
|
|
86
|
-
var FileSaver_minExports = requireFileSaver_min();
|
|
8
|
+
import { t as toKebabCase, h as httpClient } from "./utils-MD9YwOtu.js";
|
|
9
|
+
import { c as clientEnv } from "./env-gsqZ6zZD.js";
|
|
10
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
87
11
|
function _typeof$8(o) {
|
|
88
12
|
"@babel/helpers - typeof";
|
|
89
13
|
return _typeof$8 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
@@ -553,8 +477,8 @@ function requireUrlParse() {
|
|
|
553
477
|
else if (typeof commonjsGlobal !== "undefined") globalVar = commonjsGlobal;
|
|
554
478
|
else if (typeof self !== "undefined") globalVar = self;
|
|
555
479
|
else globalVar = {};
|
|
556
|
-
var
|
|
557
|
-
loc = loc ||
|
|
480
|
+
var location = globalVar.location || {};
|
|
481
|
+
loc = loc || location;
|
|
558
482
|
var finaldestination = {}, type = typeof loc, key;
|
|
559
483
|
if ("blob:" === loc.protocol) {
|
|
560
484
|
finaldestination = new Url(unescape(loc.pathname), {});
|
|
@@ -575,10 +499,10 @@ function requireUrlParse() {
|
|
|
575
499
|
function isSpecial(scheme) {
|
|
576
500
|
return scheme === "file:" || scheme === "ftp:" || scheme === "http:" || scheme === "https:" || scheme === "ws:" || scheme === "wss:";
|
|
577
501
|
}
|
|
578
|
-
function extractProtocol(address,
|
|
502
|
+
function extractProtocol(address, location) {
|
|
579
503
|
address = trimLeft(address);
|
|
580
504
|
address = address.replace(CRHTLF, "");
|
|
581
|
-
|
|
505
|
+
location = location || {};
|
|
582
506
|
var match = protocolre.exec(address);
|
|
583
507
|
var protocol = match[1] ? match[1].toLowerCase() : "";
|
|
584
508
|
var forwardSlashes = !!match[2];
|
|
@@ -611,7 +535,7 @@ function requireUrlParse() {
|
|
|
611
535
|
if (forwardSlashes) {
|
|
612
536
|
rest = rest.slice(2);
|
|
613
537
|
}
|
|
614
|
-
} else if (slashesCount >= 2 && isSpecial(
|
|
538
|
+
} else if (slashesCount >= 2 && isSpecial(location.protocol)) {
|
|
615
539
|
rest = match[4];
|
|
616
540
|
}
|
|
617
541
|
return {
|
|
@@ -640,23 +564,23 @@ function requireUrlParse() {
|
|
|
640
564
|
if (last === "." || last === "..") path.push("");
|
|
641
565
|
return path.join("/");
|
|
642
566
|
}
|
|
643
|
-
function Url(address,
|
|
567
|
+
function Url(address, location, parser) {
|
|
644
568
|
address = trimLeft(address);
|
|
645
569
|
address = address.replace(CRHTLF, "");
|
|
646
570
|
if (!(this instanceof Url)) {
|
|
647
|
-
return new Url(address,
|
|
571
|
+
return new Url(address, location, parser);
|
|
648
572
|
}
|
|
649
|
-
var relative, extracted, parse, instruction, index, key, instructions = rules.slice(), type = typeof
|
|
573
|
+
var relative, extracted, parse, instruction, index, key, instructions = rules.slice(), type = typeof location, url = this, i = 0;
|
|
650
574
|
if ("object" !== type && "string" !== type) {
|
|
651
|
-
parser =
|
|
652
|
-
|
|
575
|
+
parser = location;
|
|
576
|
+
location = null;
|
|
653
577
|
}
|
|
654
578
|
if (parser && "function" !== typeof parser) parser = qs.parse;
|
|
655
|
-
|
|
656
|
-
extracted = extractProtocol(address || "",
|
|
579
|
+
location = lolcation(location);
|
|
580
|
+
extracted = extractProtocol(address || "", location);
|
|
657
581
|
relative = !extracted.protocol && !extracted.slashes;
|
|
658
|
-
url.slashes = extracted.slashes || relative &&
|
|
659
|
-
url.protocol = extracted.protocol ||
|
|
582
|
+
url.slashes = extracted.slashes || relative && location.slashes;
|
|
583
|
+
url.protocol = extracted.protocol || location.protocol || "";
|
|
660
584
|
address = extracted.rest;
|
|
661
585
|
if (extracted.protocol === "file:" && (extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) || !extracted.slashes && (extracted.protocol || extracted.slashesCount < 2 || !isSpecial(url.protocol))) {
|
|
662
586
|
instructions[3] = [/(.*)/, "pathname"];
|
|
@@ -686,12 +610,12 @@ function requireUrlParse() {
|
|
|
686
610
|
url[key] = index[1];
|
|
687
611
|
address = address.slice(0, index.index);
|
|
688
612
|
}
|
|
689
|
-
url[key] = url[key] || (relative && instruction[3] ?
|
|
613
|
+
url[key] = url[key] || (relative && instruction[3] ? location[key] || "" : "");
|
|
690
614
|
if (instruction[4]) url[key] = url[key].toLowerCase();
|
|
691
615
|
}
|
|
692
616
|
if (parser) url.query = parser(url.query);
|
|
693
|
-
if (relative &&
|
|
694
|
-
url.pathname = resolve(url.pathname,
|
|
617
|
+
if (relative && location.slashes && url.pathname.charAt(0) !== "/" && (url.pathname !== "" || location.pathname !== "")) {
|
|
618
|
+
url.pathname = resolve(url.pathname, location.pathname);
|
|
695
619
|
}
|
|
696
620
|
if (url.pathname.charAt(0) !== "/" && isSpecial(url.protocol)) {
|
|
697
621
|
url.pathname = "/" + url.pathname;
|
|
@@ -1470,12 +1394,12 @@ var BaseUpload = /* @__PURE__ */ (function() {
|
|
|
1470
1394
|
_this3._emitHttpError(req, res, "tus: unexpected response while creating upload");
|
|
1471
1395
|
return;
|
|
1472
1396
|
}
|
|
1473
|
-
var
|
|
1474
|
-
if (
|
|
1397
|
+
var location = res.getHeader("Location");
|
|
1398
|
+
if (location == null) {
|
|
1475
1399
|
_this3._emitHttpError(req, res, "tus: invalid or missing Location header");
|
|
1476
1400
|
return;
|
|
1477
1401
|
}
|
|
1478
|
-
_this3.url = resolveUrl(_this3.options.endpoint,
|
|
1402
|
+
_this3.url = resolveUrl(_this3.options.endpoint, location);
|
|
1479
1403
|
log("Created upload at ".concat(_this3.url));
|
|
1480
1404
|
_this3._emitSuccess(res);
|
|
1481
1405
|
})["catch"](function(err) {
|
|
@@ -1666,12 +1590,12 @@ var BaseUpload = /* @__PURE__ */ (function() {
|
|
|
1666
1590
|
_this6._emitHttpError(req, res, "tus: unexpected response while creating upload");
|
|
1667
1591
|
return;
|
|
1668
1592
|
}
|
|
1669
|
-
var
|
|
1670
|
-
if (
|
|
1593
|
+
var location = res.getHeader("Location");
|
|
1594
|
+
if (location == null) {
|
|
1671
1595
|
_this6._emitHttpError(req, res, "tus: invalid or missing Location header");
|
|
1672
1596
|
return;
|
|
1673
1597
|
}
|
|
1674
|
-
_this6.url = resolveUrl(_this6.options.endpoint,
|
|
1598
|
+
_this6.url = resolveUrl(_this6.options.endpoint, location);
|
|
1675
1599
|
log("Created upload at ".concat(_this6.url));
|
|
1676
1600
|
if (typeof _this6.options.onUploadUrlAvailable === "function") {
|
|
1677
1601
|
_this6.options.onUploadUrlAvailable();
|
|
@@ -3497,7 +3421,7 @@ function _temp7(meta) {
|
|
|
3497
3421
|
}).then(_temp6);
|
|
3498
3422
|
}
|
|
3499
3423
|
function _temp8(data, variables) {
|
|
3500
|
-
return
|
|
3424
|
+
return saveAs(data, `${variables.fileName}.${variables.fileExtension}`);
|
|
3501
3425
|
}
|
|
3502
3426
|
function _temp9(request) {
|
|
3503
3427
|
return request.data;
|
|
@@ -3551,4 +3475,4 @@ export {
|
|
|
3551
3475
|
useUploadFile as h,
|
|
3552
3476
|
useGetFileMetas as u
|
|
3553
3477
|
};
|
|
3554
|
-
//# sourceMappingURL=FileHooks-
|
|
3478
|
+
//# sourceMappingURL=FileHooks-DdKh9cZa.js.map
|