@availity/mui-file-selector 1.7.0 → 1.7.1
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/CHANGELOG.md +7 -0
- package/dist/index.js +4 -1103
- package/dist/index.mjs +8 -1133
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
3
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -21,12 +17,6 @@ var __spreadValues = (a, b) => {
|
|
|
21
17
|
return a;
|
|
22
18
|
};
|
|
23
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
25
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
26
|
-
}) : x)(function(x) {
|
|
27
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
28
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
29
|
-
});
|
|
30
20
|
var __objRest = (source, exclude) => {
|
|
31
21
|
var target = {};
|
|
32
22
|
for (var prop in source)
|
|
@@ -39,25 +29,6 @@ var __objRest = (source, exclude) => {
|
|
|
39
29
|
}
|
|
40
30
|
return target;
|
|
41
31
|
};
|
|
42
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
43
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
44
|
-
};
|
|
45
|
-
var __copyProps = (to, from, except, desc) => {
|
|
46
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
47
|
-
for (let key of __getOwnPropNames(from))
|
|
48
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
49
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
50
|
-
}
|
|
51
|
-
return to;
|
|
52
|
-
};
|
|
53
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
54
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
55
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
56
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
57
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
58
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
59
|
-
mod
|
|
60
|
-
));
|
|
61
32
|
var __async = (__this, __arguments, generator) => {
|
|
62
33
|
return new Promise((resolve, reject) => {
|
|
63
34
|
var fulfilled = (value) => {
|
|
@@ -79,135 +50,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
79
50
|
});
|
|
80
51
|
};
|
|
81
52
|
|
|
82
|
-
// ../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js
|
|
83
|
-
var require_use_sync_external_store_shim_production = __commonJS({
|
|
84
|
-
"../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js"(exports) {
|
|
85
|
-
"use strict";
|
|
86
|
-
var React6 = __require("react");
|
|
87
|
-
function is(x, y) {
|
|
88
|
-
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
89
|
-
}
|
|
90
|
-
var objectIs = "function" === typeof Object.is ? Object.is : is;
|
|
91
|
-
var useState7 = React6.useState;
|
|
92
|
-
var useEffect4 = React6.useEffect;
|
|
93
|
-
var useLayoutEffect = React6.useLayoutEffect;
|
|
94
|
-
var useDebugValue = React6.useDebugValue;
|
|
95
|
-
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
96
|
-
var value = getSnapshot(), _useState = useState7({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
97
|
-
useLayoutEffect(
|
|
98
|
-
function() {
|
|
99
|
-
inst.value = value;
|
|
100
|
-
inst.getSnapshot = getSnapshot;
|
|
101
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
102
|
-
},
|
|
103
|
-
[subscribe, value, getSnapshot]
|
|
104
|
-
);
|
|
105
|
-
useEffect4(
|
|
106
|
-
function() {
|
|
107
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
108
|
-
return subscribe(function() {
|
|
109
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
110
|
-
});
|
|
111
|
-
},
|
|
112
|
-
[subscribe]
|
|
113
|
-
);
|
|
114
|
-
useDebugValue(value);
|
|
115
|
-
return value;
|
|
116
|
-
}
|
|
117
|
-
function checkIfSnapshotChanged(inst) {
|
|
118
|
-
var latestGetSnapshot = inst.getSnapshot;
|
|
119
|
-
inst = inst.value;
|
|
120
|
-
try {
|
|
121
|
-
var nextValue = latestGetSnapshot();
|
|
122
|
-
return !objectIs(inst, nextValue);
|
|
123
|
-
} catch (error) {
|
|
124
|
-
return true;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
function useSyncExternalStore$12(subscribe, getSnapshot) {
|
|
128
|
-
return getSnapshot();
|
|
129
|
-
}
|
|
130
|
-
var shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$12 : useSyncExternalStore$2;
|
|
131
|
-
exports.useSyncExternalStore = void 0 !== React6.useSyncExternalStore ? React6.useSyncExternalStore : shim;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
// ../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
|
|
136
|
-
var require_use_sync_external_store_shim_development = __commonJS({
|
|
137
|
-
"../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
|
|
138
|
-
"use strict";
|
|
139
|
-
"production" !== process.env.NODE_ENV && function() {
|
|
140
|
-
function is(x, y) {
|
|
141
|
-
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
142
|
-
}
|
|
143
|
-
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
144
|
-
didWarnOld18Alpha || void 0 === React6.startTransition || (didWarnOld18Alpha = true, console.error(
|
|
145
|
-
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
146
|
-
));
|
|
147
|
-
var value = getSnapshot();
|
|
148
|
-
if (!didWarnUncachedGetSnapshot) {
|
|
149
|
-
var cachedValue = getSnapshot();
|
|
150
|
-
objectIs(value, cachedValue) || (console.error(
|
|
151
|
-
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
152
|
-
), didWarnUncachedGetSnapshot = true);
|
|
153
|
-
}
|
|
154
|
-
cachedValue = useState7({
|
|
155
|
-
inst: { value, getSnapshot }
|
|
156
|
-
});
|
|
157
|
-
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
158
|
-
useLayoutEffect(
|
|
159
|
-
function() {
|
|
160
|
-
inst.value = value;
|
|
161
|
-
inst.getSnapshot = getSnapshot;
|
|
162
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
163
|
-
},
|
|
164
|
-
[subscribe, value, getSnapshot]
|
|
165
|
-
);
|
|
166
|
-
useEffect4(
|
|
167
|
-
function() {
|
|
168
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
169
|
-
return subscribe(function() {
|
|
170
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
171
|
-
});
|
|
172
|
-
},
|
|
173
|
-
[subscribe]
|
|
174
|
-
);
|
|
175
|
-
useDebugValue(value);
|
|
176
|
-
return value;
|
|
177
|
-
}
|
|
178
|
-
function checkIfSnapshotChanged(inst) {
|
|
179
|
-
var latestGetSnapshot = inst.getSnapshot;
|
|
180
|
-
inst = inst.value;
|
|
181
|
-
try {
|
|
182
|
-
var nextValue = latestGetSnapshot();
|
|
183
|
-
return !objectIs(inst, nextValue);
|
|
184
|
-
} catch (error) {
|
|
185
|
-
return true;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function useSyncExternalStore$12(subscribe, getSnapshot) {
|
|
189
|
-
return getSnapshot();
|
|
190
|
-
}
|
|
191
|
-
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
192
|
-
var React6 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState7 = React6.useState, useEffect4 = React6.useEffect, useLayoutEffect = React6.useLayoutEffect, useDebugValue = React6.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$12 : useSyncExternalStore$2;
|
|
193
|
-
exports.useSyncExternalStore = void 0 !== React6.useSyncExternalStore ? React6.useSyncExternalStore : shim;
|
|
194
|
-
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
195
|
-
}();
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
// ../../node_modules/use-sync-external-store/shim/index.js
|
|
200
|
-
var require_shim = __commonJS({
|
|
201
|
-
"../../node_modules/use-sync-external-store/shim/index.js"(exports, module) {
|
|
202
|
-
"use strict";
|
|
203
|
-
if (process.env.NODE_ENV === "production") {
|
|
204
|
-
module.exports = require_use_sync_external_store_shim_production();
|
|
205
|
-
} else {
|
|
206
|
-
module.exports = require_use_sync_external_store_shim_development();
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
|
|
211
53
|
// src/lib/Dropzone.tsx
|
|
212
54
|
import { useCallback } from "react";
|
|
213
55
|
import { styled } from "@mui/material/styles";
|
|
@@ -1036,952 +878,8 @@ var UploadProgressBar = ({ upload, onProgress, onError, onSuccess }) => {
|
|
|
1036
878
|
] }) : /* @__PURE__ */ jsx11(LinearProgress, { value: statePercentage, "aria-label": `${upload.file.name}-progress` });
|
|
1037
879
|
};
|
|
1038
880
|
|
|
1039
|
-
// ../../node_modules/@tanstack/query-core/build/lib/subscribable.mjs
|
|
1040
|
-
var Subscribable = class {
|
|
1041
|
-
constructor() {
|
|
1042
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
1043
|
-
this.subscribe = this.subscribe.bind(this);
|
|
1044
|
-
}
|
|
1045
|
-
subscribe(listener) {
|
|
1046
|
-
const identity = {
|
|
1047
|
-
listener
|
|
1048
|
-
};
|
|
1049
|
-
this.listeners.add(identity);
|
|
1050
|
-
this.onSubscribe();
|
|
1051
|
-
return () => {
|
|
1052
|
-
this.listeners.delete(identity);
|
|
1053
|
-
this.onUnsubscribe();
|
|
1054
|
-
};
|
|
1055
|
-
}
|
|
1056
|
-
hasListeners() {
|
|
1057
|
-
return this.listeners.size > 0;
|
|
1058
|
-
}
|
|
1059
|
-
onSubscribe() {
|
|
1060
|
-
}
|
|
1061
|
-
onUnsubscribe() {
|
|
1062
|
-
}
|
|
1063
|
-
};
|
|
1064
|
-
|
|
1065
|
-
// ../../node_modules/@tanstack/query-core/build/lib/utils.mjs
|
|
1066
|
-
var isServer = typeof window === "undefined" || "Deno" in window;
|
|
1067
|
-
function noop() {
|
|
1068
|
-
return void 0;
|
|
1069
|
-
}
|
|
1070
|
-
function isValidTimeout(value) {
|
|
1071
|
-
return typeof value === "number" && value >= 0 && value !== Infinity;
|
|
1072
|
-
}
|
|
1073
|
-
function timeUntilStale(updatedAt, staleTime) {
|
|
1074
|
-
return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
|
|
1075
|
-
}
|
|
1076
|
-
function parseQueryArgs(arg1, arg2, arg3) {
|
|
1077
|
-
if (!isQueryKey(arg1)) {
|
|
1078
|
-
return arg1;
|
|
1079
|
-
}
|
|
1080
|
-
if (typeof arg2 === "function") {
|
|
1081
|
-
return __spreadProps(__spreadValues({}, arg3), {
|
|
1082
|
-
queryKey: arg1,
|
|
1083
|
-
queryFn: arg2
|
|
1084
|
-
});
|
|
1085
|
-
}
|
|
1086
|
-
return __spreadProps(__spreadValues({}, arg2), {
|
|
1087
|
-
queryKey: arg1
|
|
1088
|
-
});
|
|
1089
|
-
}
|
|
1090
|
-
function replaceEqualDeep(a, b) {
|
|
1091
|
-
if (a === b) {
|
|
1092
|
-
return a;
|
|
1093
|
-
}
|
|
1094
|
-
const array = isPlainArray(a) && isPlainArray(b);
|
|
1095
|
-
if (array || isPlainObject(a) && isPlainObject(b)) {
|
|
1096
|
-
const aSize = array ? a.length : Object.keys(a).length;
|
|
1097
|
-
const bItems = array ? b : Object.keys(b);
|
|
1098
|
-
const bSize = bItems.length;
|
|
1099
|
-
const copy = array ? [] : {};
|
|
1100
|
-
let equalItems = 0;
|
|
1101
|
-
for (let i = 0; i < bSize; i++) {
|
|
1102
|
-
const key = array ? i : bItems[i];
|
|
1103
|
-
copy[key] = replaceEqualDeep(a[key], b[key]);
|
|
1104
|
-
if (copy[key] === a[key]) {
|
|
1105
|
-
equalItems++;
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
return aSize === bSize && equalItems === aSize ? a : copy;
|
|
1109
|
-
}
|
|
1110
|
-
return b;
|
|
1111
|
-
}
|
|
1112
|
-
function shallowEqualObjects(a, b) {
|
|
1113
|
-
if (a && !b || b && !a) {
|
|
1114
|
-
return false;
|
|
1115
|
-
}
|
|
1116
|
-
for (const key in a) {
|
|
1117
|
-
if (a[key] !== b[key]) {
|
|
1118
|
-
return false;
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
return true;
|
|
1122
|
-
}
|
|
1123
|
-
function isPlainArray(value) {
|
|
1124
|
-
return Array.isArray(value) && value.length === Object.keys(value).length;
|
|
1125
|
-
}
|
|
1126
|
-
function isPlainObject(o) {
|
|
1127
|
-
if (!hasObjectPrototype(o)) {
|
|
1128
|
-
return false;
|
|
1129
|
-
}
|
|
1130
|
-
const ctor = o.constructor;
|
|
1131
|
-
if (typeof ctor === "undefined") {
|
|
1132
|
-
return true;
|
|
1133
|
-
}
|
|
1134
|
-
const prot = ctor.prototype;
|
|
1135
|
-
if (!hasObjectPrototype(prot)) {
|
|
1136
|
-
return false;
|
|
1137
|
-
}
|
|
1138
|
-
if (!prot.hasOwnProperty("isPrototypeOf")) {
|
|
1139
|
-
return false;
|
|
1140
|
-
}
|
|
1141
|
-
return true;
|
|
1142
|
-
}
|
|
1143
|
-
function hasObjectPrototype(o) {
|
|
1144
|
-
return Object.prototype.toString.call(o) === "[object Object]";
|
|
1145
|
-
}
|
|
1146
|
-
function isQueryKey(value) {
|
|
1147
|
-
return Array.isArray(value);
|
|
1148
|
-
}
|
|
1149
|
-
function sleep(timeout) {
|
|
1150
|
-
return new Promise((resolve) => {
|
|
1151
|
-
setTimeout(resolve, timeout);
|
|
1152
|
-
});
|
|
1153
|
-
}
|
|
1154
|
-
function scheduleMicrotask(callback) {
|
|
1155
|
-
sleep(0).then(callback);
|
|
1156
|
-
}
|
|
1157
|
-
function replaceData(prevData, data, options) {
|
|
1158
|
-
if (options.isDataEqual != null && options.isDataEqual(prevData, data)) {
|
|
1159
|
-
return prevData;
|
|
1160
|
-
} else if (typeof options.structuralSharing === "function") {
|
|
1161
|
-
return options.structuralSharing(prevData, data);
|
|
1162
|
-
} else if (options.structuralSharing !== false) {
|
|
1163
|
-
return replaceEqualDeep(prevData, data);
|
|
1164
|
-
}
|
|
1165
|
-
return data;
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
// ../../node_modules/@tanstack/query-core/build/lib/focusManager.mjs
|
|
1169
|
-
var FocusManager = class extends Subscribable {
|
|
1170
|
-
constructor() {
|
|
1171
|
-
super();
|
|
1172
|
-
this.setup = (onFocus) => {
|
|
1173
|
-
if (!isServer && window.addEventListener) {
|
|
1174
|
-
const listener = () => onFocus();
|
|
1175
|
-
window.addEventListener("visibilitychange", listener, false);
|
|
1176
|
-
window.addEventListener("focus", listener, false);
|
|
1177
|
-
return () => {
|
|
1178
|
-
window.removeEventListener("visibilitychange", listener);
|
|
1179
|
-
window.removeEventListener("focus", listener);
|
|
1180
|
-
};
|
|
1181
|
-
}
|
|
1182
|
-
return;
|
|
1183
|
-
};
|
|
1184
|
-
}
|
|
1185
|
-
onSubscribe() {
|
|
1186
|
-
if (!this.cleanup) {
|
|
1187
|
-
this.setEventListener(this.setup);
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
onUnsubscribe() {
|
|
1191
|
-
if (!this.hasListeners()) {
|
|
1192
|
-
var _this$cleanup;
|
|
1193
|
-
(_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);
|
|
1194
|
-
this.cleanup = void 0;
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
setEventListener(setup) {
|
|
1198
|
-
var _this$cleanup2;
|
|
1199
|
-
this.setup = setup;
|
|
1200
|
-
(_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);
|
|
1201
|
-
this.cleanup = setup((focused) => {
|
|
1202
|
-
if (typeof focused === "boolean") {
|
|
1203
|
-
this.setFocused(focused);
|
|
1204
|
-
} else {
|
|
1205
|
-
this.onFocus();
|
|
1206
|
-
}
|
|
1207
|
-
});
|
|
1208
|
-
}
|
|
1209
|
-
setFocused(focused) {
|
|
1210
|
-
const changed = this.focused !== focused;
|
|
1211
|
-
if (changed) {
|
|
1212
|
-
this.focused = focused;
|
|
1213
|
-
this.onFocus();
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
onFocus() {
|
|
1217
|
-
this.listeners.forEach(({
|
|
1218
|
-
listener
|
|
1219
|
-
}) => {
|
|
1220
|
-
listener();
|
|
1221
|
-
});
|
|
1222
|
-
}
|
|
1223
|
-
isFocused() {
|
|
1224
|
-
if (typeof this.focused === "boolean") {
|
|
1225
|
-
return this.focused;
|
|
1226
|
-
}
|
|
1227
|
-
if (typeof document === "undefined") {
|
|
1228
|
-
return true;
|
|
1229
|
-
}
|
|
1230
|
-
return [void 0, "visible", "prerender"].includes(document.visibilityState);
|
|
1231
|
-
}
|
|
1232
|
-
};
|
|
1233
|
-
var focusManager = new FocusManager();
|
|
1234
|
-
|
|
1235
|
-
// ../../node_modules/@tanstack/query-core/build/lib/onlineManager.mjs
|
|
1236
|
-
var onlineEvents = ["online", "offline"];
|
|
1237
|
-
var OnlineManager = class extends Subscribable {
|
|
1238
|
-
constructor() {
|
|
1239
|
-
super();
|
|
1240
|
-
this.setup = (onOnline) => {
|
|
1241
|
-
if (!isServer && window.addEventListener) {
|
|
1242
|
-
const listener = () => onOnline();
|
|
1243
|
-
onlineEvents.forEach((event) => {
|
|
1244
|
-
window.addEventListener(event, listener, false);
|
|
1245
|
-
});
|
|
1246
|
-
return () => {
|
|
1247
|
-
onlineEvents.forEach((event) => {
|
|
1248
|
-
window.removeEventListener(event, listener);
|
|
1249
|
-
});
|
|
1250
|
-
};
|
|
1251
|
-
}
|
|
1252
|
-
return;
|
|
1253
|
-
};
|
|
1254
|
-
}
|
|
1255
|
-
onSubscribe() {
|
|
1256
|
-
if (!this.cleanup) {
|
|
1257
|
-
this.setEventListener(this.setup);
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
onUnsubscribe() {
|
|
1261
|
-
if (!this.hasListeners()) {
|
|
1262
|
-
var _this$cleanup;
|
|
1263
|
-
(_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);
|
|
1264
|
-
this.cleanup = void 0;
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
setEventListener(setup) {
|
|
1268
|
-
var _this$cleanup2;
|
|
1269
|
-
this.setup = setup;
|
|
1270
|
-
(_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);
|
|
1271
|
-
this.cleanup = setup((online) => {
|
|
1272
|
-
if (typeof online === "boolean") {
|
|
1273
|
-
this.setOnline(online);
|
|
1274
|
-
} else {
|
|
1275
|
-
this.onOnline();
|
|
1276
|
-
}
|
|
1277
|
-
});
|
|
1278
|
-
}
|
|
1279
|
-
setOnline(online) {
|
|
1280
|
-
const changed = this.online !== online;
|
|
1281
|
-
if (changed) {
|
|
1282
|
-
this.online = online;
|
|
1283
|
-
this.onOnline();
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
onOnline() {
|
|
1287
|
-
this.listeners.forEach(({
|
|
1288
|
-
listener
|
|
1289
|
-
}) => {
|
|
1290
|
-
listener();
|
|
1291
|
-
});
|
|
1292
|
-
}
|
|
1293
|
-
isOnline() {
|
|
1294
|
-
if (typeof this.online === "boolean") {
|
|
1295
|
-
return this.online;
|
|
1296
|
-
}
|
|
1297
|
-
if (typeof navigator === "undefined" || typeof navigator.onLine === "undefined") {
|
|
1298
|
-
return true;
|
|
1299
|
-
}
|
|
1300
|
-
return navigator.onLine;
|
|
1301
|
-
}
|
|
1302
|
-
};
|
|
1303
|
-
var onlineManager = new OnlineManager();
|
|
1304
|
-
|
|
1305
|
-
// ../../node_modules/@tanstack/query-core/build/lib/retryer.mjs
|
|
1306
|
-
function canFetch(networkMode) {
|
|
1307
|
-
return (networkMode != null ? networkMode : "online") === "online" ? onlineManager.isOnline() : true;
|
|
1308
|
-
}
|
|
1309
|
-
var CancelledError = class {
|
|
1310
|
-
constructor(options) {
|
|
1311
|
-
this.revert = options == null ? void 0 : options.revert;
|
|
1312
|
-
this.silent = options == null ? void 0 : options.silent;
|
|
1313
|
-
}
|
|
1314
|
-
};
|
|
1315
|
-
function isCancelledError(value) {
|
|
1316
|
-
return value instanceof CancelledError;
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
// ../../node_modules/@tanstack/query-core/build/lib/notifyManager.mjs
|
|
1320
|
-
function createNotifyManager() {
|
|
1321
|
-
let queue = [];
|
|
1322
|
-
let transactions = 0;
|
|
1323
|
-
let notifyFn = (callback) => {
|
|
1324
|
-
callback();
|
|
1325
|
-
};
|
|
1326
|
-
let batchNotifyFn = (callback) => {
|
|
1327
|
-
callback();
|
|
1328
|
-
};
|
|
1329
|
-
const batch = (callback) => {
|
|
1330
|
-
let result;
|
|
1331
|
-
transactions++;
|
|
1332
|
-
try {
|
|
1333
|
-
result = callback();
|
|
1334
|
-
} finally {
|
|
1335
|
-
transactions--;
|
|
1336
|
-
if (!transactions) {
|
|
1337
|
-
flush();
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
return result;
|
|
1341
|
-
};
|
|
1342
|
-
const schedule = (callback) => {
|
|
1343
|
-
if (transactions) {
|
|
1344
|
-
queue.push(callback);
|
|
1345
|
-
} else {
|
|
1346
|
-
scheduleMicrotask(() => {
|
|
1347
|
-
notifyFn(callback);
|
|
1348
|
-
});
|
|
1349
|
-
}
|
|
1350
|
-
};
|
|
1351
|
-
const batchCalls = (callback) => {
|
|
1352
|
-
return (...args) => {
|
|
1353
|
-
schedule(() => {
|
|
1354
|
-
callback(...args);
|
|
1355
|
-
});
|
|
1356
|
-
};
|
|
1357
|
-
};
|
|
1358
|
-
const flush = () => {
|
|
1359
|
-
const originalQueue = queue;
|
|
1360
|
-
queue = [];
|
|
1361
|
-
if (originalQueue.length) {
|
|
1362
|
-
scheduleMicrotask(() => {
|
|
1363
|
-
batchNotifyFn(() => {
|
|
1364
|
-
originalQueue.forEach((callback) => {
|
|
1365
|
-
notifyFn(callback);
|
|
1366
|
-
});
|
|
1367
|
-
});
|
|
1368
|
-
});
|
|
1369
|
-
}
|
|
1370
|
-
};
|
|
1371
|
-
const setNotifyFunction = (fn) => {
|
|
1372
|
-
notifyFn = fn;
|
|
1373
|
-
};
|
|
1374
|
-
const setBatchNotifyFunction = (fn) => {
|
|
1375
|
-
batchNotifyFn = fn;
|
|
1376
|
-
};
|
|
1377
|
-
return {
|
|
1378
|
-
batch,
|
|
1379
|
-
batchCalls,
|
|
1380
|
-
schedule,
|
|
1381
|
-
setNotifyFunction,
|
|
1382
|
-
setBatchNotifyFunction
|
|
1383
|
-
};
|
|
1384
|
-
}
|
|
1385
|
-
var notifyManager = createNotifyManager();
|
|
1386
|
-
|
|
1387
|
-
// ../../node_modules/@tanstack/query-core/build/lib/queryObserver.mjs
|
|
1388
|
-
var QueryObserver = class extends Subscribable {
|
|
1389
|
-
constructor(client, options) {
|
|
1390
|
-
super();
|
|
1391
|
-
this.client = client;
|
|
1392
|
-
this.options = options;
|
|
1393
|
-
this.trackedProps = /* @__PURE__ */ new Set();
|
|
1394
|
-
this.selectError = null;
|
|
1395
|
-
this.bindMethods();
|
|
1396
|
-
this.setOptions(options);
|
|
1397
|
-
}
|
|
1398
|
-
bindMethods() {
|
|
1399
|
-
this.remove = this.remove.bind(this);
|
|
1400
|
-
this.refetch = this.refetch.bind(this);
|
|
1401
|
-
}
|
|
1402
|
-
onSubscribe() {
|
|
1403
|
-
if (this.listeners.size === 1) {
|
|
1404
|
-
this.currentQuery.addObserver(this);
|
|
1405
|
-
if (shouldFetchOnMount(this.currentQuery, this.options)) {
|
|
1406
|
-
this.executeFetch();
|
|
1407
|
-
}
|
|
1408
|
-
this.updateTimers();
|
|
1409
|
-
}
|
|
1410
|
-
}
|
|
1411
|
-
onUnsubscribe() {
|
|
1412
|
-
if (!this.hasListeners()) {
|
|
1413
|
-
this.destroy();
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
shouldFetchOnReconnect() {
|
|
1417
|
-
return shouldFetchOn(this.currentQuery, this.options, this.options.refetchOnReconnect);
|
|
1418
|
-
}
|
|
1419
|
-
shouldFetchOnWindowFocus() {
|
|
1420
|
-
return shouldFetchOn(this.currentQuery, this.options, this.options.refetchOnWindowFocus);
|
|
1421
|
-
}
|
|
1422
|
-
destroy() {
|
|
1423
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
1424
|
-
this.clearStaleTimeout();
|
|
1425
|
-
this.clearRefetchInterval();
|
|
1426
|
-
this.currentQuery.removeObserver(this);
|
|
1427
|
-
}
|
|
1428
|
-
setOptions(options, notifyOptions) {
|
|
1429
|
-
const prevOptions = this.options;
|
|
1430
|
-
const prevQuery = this.currentQuery;
|
|
1431
|
-
this.options = this.client.defaultQueryOptions(options);
|
|
1432
|
-
if (process.env.NODE_ENV !== "production" && typeof (options == null ? void 0 : options.isDataEqual) !== "undefined") {
|
|
1433
|
-
this.client.getLogger().error("The isDataEqual option has been deprecated and will be removed in the next major version. You can achieve the same functionality by passing a function as the structuralSharing option");
|
|
1434
|
-
}
|
|
1435
|
-
if (!shallowEqualObjects(prevOptions, this.options)) {
|
|
1436
|
-
this.client.getQueryCache().notify({
|
|
1437
|
-
type: "observerOptionsUpdated",
|
|
1438
|
-
query: this.currentQuery,
|
|
1439
|
-
observer: this
|
|
1440
|
-
});
|
|
1441
|
-
}
|
|
1442
|
-
if (typeof this.options.enabled !== "undefined" && typeof this.options.enabled !== "boolean") {
|
|
1443
|
-
throw new Error("Expected enabled to be a boolean");
|
|
1444
|
-
}
|
|
1445
|
-
if (!this.options.queryKey) {
|
|
1446
|
-
this.options.queryKey = prevOptions.queryKey;
|
|
1447
|
-
}
|
|
1448
|
-
this.updateQuery();
|
|
1449
|
-
const mounted = this.hasListeners();
|
|
1450
|
-
if (mounted && shouldFetchOptionally(this.currentQuery, prevQuery, this.options, prevOptions)) {
|
|
1451
|
-
this.executeFetch();
|
|
1452
|
-
}
|
|
1453
|
-
this.updateResult(notifyOptions);
|
|
1454
|
-
if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || this.options.staleTime !== prevOptions.staleTime)) {
|
|
1455
|
-
this.updateStaleTimeout();
|
|
1456
|
-
}
|
|
1457
|
-
const nextRefetchInterval = this.computeRefetchInterval();
|
|
1458
|
-
if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== this.currentRefetchInterval)) {
|
|
1459
|
-
this.updateRefetchInterval(nextRefetchInterval);
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
getOptimisticResult(options) {
|
|
1463
|
-
const query = this.client.getQueryCache().build(this.client, options);
|
|
1464
|
-
const result = this.createResult(query, options);
|
|
1465
|
-
if (shouldAssignObserverCurrentProperties(this, result, options)) {
|
|
1466
|
-
this.currentResult = result;
|
|
1467
|
-
this.currentResultOptions = this.options;
|
|
1468
|
-
this.currentResultState = this.currentQuery.state;
|
|
1469
|
-
}
|
|
1470
|
-
return result;
|
|
1471
|
-
}
|
|
1472
|
-
getCurrentResult() {
|
|
1473
|
-
return this.currentResult;
|
|
1474
|
-
}
|
|
1475
|
-
trackResult(result) {
|
|
1476
|
-
const trackedResult = {};
|
|
1477
|
-
Object.keys(result).forEach((key) => {
|
|
1478
|
-
Object.defineProperty(trackedResult, key, {
|
|
1479
|
-
configurable: false,
|
|
1480
|
-
enumerable: true,
|
|
1481
|
-
get: () => {
|
|
1482
|
-
this.trackedProps.add(key);
|
|
1483
|
-
return result[key];
|
|
1484
|
-
}
|
|
1485
|
-
});
|
|
1486
|
-
});
|
|
1487
|
-
return trackedResult;
|
|
1488
|
-
}
|
|
1489
|
-
getCurrentQuery() {
|
|
1490
|
-
return this.currentQuery;
|
|
1491
|
-
}
|
|
1492
|
-
remove() {
|
|
1493
|
-
this.client.getQueryCache().remove(this.currentQuery);
|
|
1494
|
-
}
|
|
1495
|
-
refetch(_a = {}) {
|
|
1496
|
-
var _b = _a, {
|
|
1497
|
-
refetchPage
|
|
1498
|
-
} = _b, options = __objRest(_b, [
|
|
1499
|
-
"refetchPage"
|
|
1500
|
-
]);
|
|
1501
|
-
return this.fetch(__spreadProps(__spreadValues({}, options), {
|
|
1502
|
-
meta: {
|
|
1503
|
-
refetchPage
|
|
1504
|
-
}
|
|
1505
|
-
}));
|
|
1506
|
-
}
|
|
1507
|
-
fetchOptimistic(options) {
|
|
1508
|
-
const defaultedOptions = this.client.defaultQueryOptions(options);
|
|
1509
|
-
const query = this.client.getQueryCache().build(this.client, defaultedOptions);
|
|
1510
|
-
query.isFetchingOptimistic = true;
|
|
1511
|
-
return query.fetch().then(() => this.createResult(query, defaultedOptions));
|
|
1512
|
-
}
|
|
1513
|
-
fetch(fetchOptions) {
|
|
1514
|
-
var _fetchOptions$cancelR;
|
|
1515
|
-
return this.executeFetch(__spreadProps(__spreadValues({}, fetchOptions), {
|
|
1516
|
-
cancelRefetch: (_fetchOptions$cancelR = fetchOptions.cancelRefetch) != null ? _fetchOptions$cancelR : true
|
|
1517
|
-
})).then(() => {
|
|
1518
|
-
this.updateResult();
|
|
1519
|
-
return this.currentResult;
|
|
1520
|
-
});
|
|
1521
|
-
}
|
|
1522
|
-
executeFetch(fetchOptions) {
|
|
1523
|
-
this.updateQuery();
|
|
1524
|
-
let promise = this.currentQuery.fetch(this.options, fetchOptions);
|
|
1525
|
-
if (!(fetchOptions != null && fetchOptions.throwOnError)) {
|
|
1526
|
-
promise = promise.catch(noop);
|
|
1527
|
-
}
|
|
1528
|
-
return promise;
|
|
1529
|
-
}
|
|
1530
|
-
updateStaleTimeout() {
|
|
1531
|
-
this.clearStaleTimeout();
|
|
1532
|
-
if (isServer || this.currentResult.isStale || !isValidTimeout(this.options.staleTime)) {
|
|
1533
|
-
return;
|
|
1534
|
-
}
|
|
1535
|
-
const time = timeUntilStale(this.currentResult.dataUpdatedAt, this.options.staleTime);
|
|
1536
|
-
const timeout = time + 1;
|
|
1537
|
-
this.staleTimeoutId = setTimeout(() => {
|
|
1538
|
-
if (!this.currentResult.isStale) {
|
|
1539
|
-
this.updateResult();
|
|
1540
|
-
}
|
|
1541
|
-
}, timeout);
|
|
1542
|
-
}
|
|
1543
|
-
computeRefetchInterval() {
|
|
1544
|
-
var _this$options$refetch;
|
|
1545
|
-
return typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(this.currentResult.data, this.currentQuery) : (_this$options$refetch = this.options.refetchInterval) != null ? _this$options$refetch : false;
|
|
1546
|
-
}
|
|
1547
|
-
updateRefetchInterval(nextInterval) {
|
|
1548
|
-
this.clearRefetchInterval();
|
|
1549
|
-
this.currentRefetchInterval = nextInterval;
|
|
1550
|
-
if (isServer || this.options.enabled === false || !isValidTimeout(this.currentRefetchInterval) || this.currentRefetchInterval === 0) {
|
|
1551
|
-
return;
|
|
1552
|
-
}
|
|
1553
|
-
this.refetchIntervalId = setInterval(() => {
|
|
1554
|
-
if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
|
|
1555
|
-
this.executeFetch();
|
|
1556
|
-
}
|
|
1557
|
-
}, this.currentRefetchInterval);
|
|
1558
|
-
}
|
|
1559
|
-
updateTimers() {
|
|
1560
|
-
this.updateStaleTimeout();
|
|
1561
|
-
this.updateRefetchInterval(this.computeRefetchInterval());
|
|
1562
|
-
}
|
|
1563
|
-
clearStaleTimeout() {
|
|
1564
|
-
if (this.staleTimeoutId) {
|
|
1565
|
-
clearTimeout(this.staleTimeoutId);
|
|
1566
|
-
this.staleTimeoutId = void 0;
|
|
1567
|
-
}
|
|
1568
|
-
}
|
|
1569
|
-
clearRefetchInterval() {
|
|
1570
|
-
if (this.refetchIntervalId) {
|
|
1571
|
-
clearInterval(this.refetchIntervalId);
|
|
1572
|
-
this.refetchIntervalId = void 0;
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
createResult(query, options) {
|
|
1576
|
-
const prevQuery = this.currentQuery;
|
|
1577
|
-
const prevOptions = this.options;
|
|
1578
|
-
const prevResult = this.currentResult;
|
|
1579
|
-
const prevResultState = this.currentResultState;
|
|
1580
|
-
const prevResultOptions = this.currentResultOptions;
|
|
1581
|
-
const queryChange = query !== prevQuery;
|
|
1582
|
-
const queryInitialState = queryChange ? query.state : this.currentQueryInitialState;
|
|
1583
|
-
const prevQueryResult = queryChange ? this.currentResult : this.previousQueryResult;
|
|
1584
|
-
const {
|
|
1585
|
-
state
|
|
1586
|
-
} = query;
|
|
1587
|
-
let {
|
|
1588
|
-
dataUpdatedAt,
|
|
1589
|
-
error,
|
|
1590
|
-
errorUpdatedAt,
|
|
1591
|
-
fetchStatus,
|
|
1592
|
-
status
|
|
1593
|
-
} = state;
|
|
1594
|
-
let isPreviousData = false;
|
|
1595
|
-
let isPlaceholderData = false;
|
|
1596
|
-
let data;
|
|
1597
|
-
if (options._optimisticResults) {
|
|
1598
|
-
const mounted = this.hasListeners();
|
|
1599
|
-
const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
|
|
1600
|
-
const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
|
|
1601
|
-
if (fetchOnMount || fetchOptionally) {
|
|
1602
|
-
fetchStatus = canFetch(query.options.networkMode) ? "fetching" : "paused";
|
|
1603
|
-
if (!dataUpdatedAt) {
|
|
1604
|
-
status = "loading";
|
|
1605
|
-
}
|
|
1606
|
-
}
|
|
1607
|
-
if (options._optimisticResults === "isRestoring") {
|
|
1608
|
-
fetchStatus = "idle";
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
if (options.keepPreviousData && !state.dataUpdatedAt && prevQueryResult != null && prevQueryResult.isSuccess && status !== "error") {
|
|
1612
|
-
data = prevQueryResult.data;
|
|
1613
|
-
dataUpdatedAt = prevQueryResult.dataUpdatedAt;
|
|
1614
|
-
status = prevQueryResult.status;
|
|
1615
|
-
isPreviousData = true;
|
|
1616
|
-
} else if (options.select && typeof state.data !== "undefined") {
|
|
1617
|
-
if (prevResult && state.data === (prevResultState == null ? void 0 : prevResultState.data) && options.select === this.selectFn) {
|
|
1618
|
-
data = this.selectResult;
|
|
1619
|
-
} else {
|
|
1620
|
-
try {
|
|
1621
|
-
this.selectFn = options.select;
|
|
1622
|
-
data = options.select(state.data);
|
|
1623
|
-
data = replaceData(prevResult == null ? void 0 : prevResult.data, data, options);
|
|
1624
|
-
this.selectResult = data;
|
|
1625
|
-
this.selectError = null;
|
|
1626
|
-
} catch (selectError) {
|
|
1627
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1628
|
-
this.client.getLogger().error(selectError);
|
|
1629
|
-
}
|
|
1630
|
-
this.selectError = selectError;
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
} else {
|
|
1634
|
-
data = state.data;
|
|
1635
|
-
}
|
|
1636
|
-
if (typeof options.placeholderData !== "undefined" && typeof data === "undefined" && status === "loading") {
|
|
1637
|
-
let placeholderData;
|
|
1638
|
-
if (prevResult != null && prevResult.isPlaceholderData && options.placeholderData === (prevResultOptions == null ? void 0 : prevResultOptions.placeholderData)) {
|
|
1639
|
-
placeholderData = prevResult.data;
|
|
1640
|
-
} else {
|
|
1641
|
-
placeholderData = typeof options.placeholderData === "function" ? options.placeholderData() : options.placeholderData;
|
|
1642
|
-
if (options.select && typeof placeholderData !== "undefined") {
|
|
1643
|
-
try {
|
|
1644
|
-
placeholderData = options.select(placeholderData);
|
|
1645
|
-
this.selectError = null;
|
|
1646
|
-
} catch (selectError) {
|
|
1647
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1648
|
-
this.client.getLogger().error(selectError);
|
|
1649
|
-
}
|
|
1650
|
-
this.selectError = selectError;
|
|
1651
|
-
}
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
if (typeof placeholderData !== "undefined") {
|
|
1655
|
-
status = "success";
|
|
1656
|
-
data = replaceData(prevResult == null ? void 0 : prevResult.data, placeholderData, options);
|
|
1657
|
-
isPlaceholderData = true;
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
if (this.selectError) {
|
|
1661
|
-
error = this.selectError;
|
|
1662
|
-
data = this.selectResult;
|
|
1663
|
-
errorUpdatedAt = Date.now();
|
|
1664
|
-
status = "error";
|
|
1665
|
-
}
|
|
1666
|
-
const isFetching = fetchStatus === "fetching";
|
|
1667
|
-
const isLoading = status === "loading";
|
|
1668
|
-
const isError2 = status === "error";
|
|
1669
|
-
const result = {
|
|
1670
|
-
status,
|
|
1671
|
-
fetchStatus,
|
|
1672
|
-
isLoading,
|
|
1673
|
-
isSuccess: status === "success",
|
|
1674
|
-
isError: isError2,
|
|
1675
|
-
isInitialLoading: isLoading && isFetching,
|
|
1676
|
-
data,
|
|
1677
|
-
dataUpdatedAt,
|
|
1678
|
-
error,
|
|
1679
|
-
errorUpdatedAt,
|
|
1680
|
-
failureCount: state.fetchFailureCount,
|
|
1681
|
-
failureReason: state.fetchFailureReason,
|
|
1682
|
-
errorUpdateCount: state.errorUpdateCount,
|
|
1683
|
-
isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,
|
|
1684
|
-
isFetchedAfterMount: state.dataUpdateCount > queryInitialState.dataUpdateCount || state.errorUpdateCount > queryInitialState.errorUpdateCount,
|
|
1685
|
-
isFetching,
|
|
1686
|
-
isRefetching: isFetching && !isLoading,
|
|
1687
|
-
isLoadingError: isError2 && state.dataUpdatedAt === 0,
|
|
1688
|
-
isPaused: fetchStatus === "paused",
|
|
1689
|
-
isPlaceholderData,
|
|
1690
|
-
isPreviousData,
|
|
1691
|
-
isRefetchError: isError2 && state.dataUpdatedAt !== 0,
|
|
1692
|
-
isStale: isStale(query, options),
|
|
1693
|
-
refetch: this.refetch,
|
|
1694
|
-
remove: this.remove
|
|
1695
|
-
};
|
|
1696
|
-
return result;
|
|
1697
|
-
}
|
|
1698
|
-
updateResult(notifyOptions) {
|
|
1699
|
-
const prevResult = this.currentResult;
|
|
1700
|
-
const nextResult = this.createResult(this.currentQuery, this.options);
|
|
1701
|
-
this.currentResultState = this.currentQuery.state;
|
|
1702
|
-
this.currentResultOptions = this.options;
|
|
1703
|
-
if (shallowEqualObjects(nextResult, prevResult)) {
|
|
1704
|
-
return;
|
|
1705
|
-
}
|
|
1706
|
-
this.currentResult = nextResult;
|
|
1707
|
-
const defaultNotifyOptions = {
|
|
1708
|
-
cache: true
|
|
1709
|
-
};
|
|
1710
|
-
const shouldNotifyListeners = () => {
|
|
1711
|
-
if (!prevResult) {
|
|
1712
|
-
return true;
|
|
1713
|
-
}
|
|
1714
|
-
const {
|
|
1715
|
-
notifyOnChangeProps
|
|
1716
|
-
} = this.options;
|
|
1717
|
-
const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
|
|
1718
|
-
if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !this.trackedProps.size) {
|
|
1719
|
-
return true;
|
|
1720
|
-
}
|
|
1721
|
-
const includedProps = new Set(notifyOnChangePropsValue != null ? notifyOnChangePropsValue : this.trackedProps);
|
|
1722
|
-
if (this.options.useErrorBoundary) {
|
|
1723
|
-
includedProps.add("error");
|
|
1724
|
-
}
|
|
1725
|
-
return Object.keys(this.currentResult).some((key) => {
|
|
1726
|
-
const typedKey = key;
|
|
1727
|
-
const changed = this.currentResult[typedKey] !== prevResult[typedKey];
|
|
1728
|
-
return changed && includedProps.has(typedKey);
|
|
1729
|
-
});
|
|
1730
|
-
};
|
|
1731
|
-
if ((notifyOptions == null ? void 0 : notifyOptions.listeners) !== false && shouldNotifyListeners()) {
|
|
1732
|
-
defaultNotifyOptions.listeners = true;
|
|
1733
|
-
}
|
|
1734
|
-
this.notify(__spreadValues(__spreadValues({}, defaultNotifyOptions), notifyOptions));
|
|
1735
|
-
}
|
|
1736
|
-
updateQuery() {
|
|
1737
|
-
const query = this.client.getQueryCache().build(this.client, this.options);
|
|
1738
|
-
if (query === this.currentQuery) {
|
|
1739
|
-
return;
|
|
1740
|
-
}
|
|
1741
|
-
const prevQuery = this.currentQuery;
|
|
1742
|
-
this.currentQuery = query;
|
|
1743
|
-
this.currentQueryInitialState = query.state;
|
|
1744
|
-
this.previousQueryResult = this.currentResult;
|
|
1745
|
-
if (this.hasListeners()) {
|
|
1746
|
-
prevQuery == null ? void 0 : prevQuery.removeObserver(this);
|
|
1747
|
-
query.addObserver(this);
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
onQueryUpdate(action) {
|
|
1751
|
-
const notifyOptions = {};
|
|
1752
|
-
if (action.type === "success") {
|
|
1753
|
-
notifyOptions.onSuccess = !action.manual;
|
|
1754
|
-
} else if (action.type === "error" && !isCancelledError(action.error)) {
|
|
1755
|
-
notifyOptions.onError = true;
|
|
1756
|
-
}
|
|
1757
|
-
this.updateResult(notifyOptions);
|
|
1758
|
-
if (this.hasListeners()) {
|
|
1759
|
-
this.updateTimers();
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
notify(notifyOptions) {
|
|
1763
|
-
notifyManager.batch(() => {
|
|
1764
|
-
if (notifyOptions.onSuccess) {
|
|
1765
|
-
var _this$options$onSucce, _this$options, _this$options$onSettl, _this$options2;
|
|
1766
|
-
(_this$options$onSucce = (_this$options = this.options).onSuccess) == null ? void 0 : _this$options$onSucce.call(_this$options, this.currentResult.data);
|
|
1767
|
-
(_this$options$onSettl = (_this$options2 = this.options).onSettled) == null ? void 0 : _this$options$onSettl.call(_this$options2, this.currentResult.data, null);
|
|
1768
|
-
} else if (notifyOptions.onError) {
|
|
1769
|
-
var _this$options$onError, _this$options3, _this$options$onSettl2, _this$options4;
|
|
1770
|
-
(_this$options$onError = (_this$options3 = this.options).onError) == null ? void 0 : _this$options$onError.call(_this$options3, this.currentResult.error);
|
|
1771
|
-
(_this$options$onSettl2 = (_this$options4 = this.options).onSettled) == null ? void 0 : _this$options$onSettl2.call(_this$options4, void 0, this.currentResult.error);
|
|
1772
|
-
}
|
|
1773
|
-
if (notifyOptions.listeners) {
|
|
1774
|
-
this.listeners.forEach(({
|
|
1775
|
-
listener
|
|
1776
|
-
}) => {
|
|
1777
|
-
listener(this.currentResult);
|
|
1778
|
-
});
|
|
1779
|
-
}
|
|
1780
|
-
if (notifyOptions.cache) {
|
|
1781
|
-
this.client.getQueryCache().notify({
|
|
1782
|
-
query: this.currentQuery,
|
|
1783
|
-
type: "observerResultsUpdated"
|
|
1784
|
-
});
|
|
1785
|
-
}
|
|
1786
|
-
});
|
|
1787
|
-
}
|
|
1788
|
-
};
|
|
1789
|
-
function shouldLoadOnMount(query, options) {
|
|
1790
|
-
return options.enabled !== false && !query.state.dataUpdatedAt && !(query.state.status === "error" && options.retryOnMount === false);
|
|
1791
|
-
}
|
|
1792
|
-
function shouldFetchOnMount(query, options) {
|
|
1793
|
-
return shouldLoadOnMount(query, options) || query.state.dataUpdatedAt > 0 && shouldFetchOn(query, options, options.refetchOnMount);
|
|
1794
|
-
}
|
|
1795
|
-
function shouldFetchOn(query, options, field) {
|
|
1796
|
-
if (options.enabled !== false) {
|
|
1797
|
-
const value = typeof field === "function" ? field(query) : field;
|
|
1798
|
-
return value === "always" || value !== false && isStale(query, options);
|
|
1799
|
-
}
|
|
1800
|
-
return false;
|
|
1801
|
-
}
|
|
1802
|
-
function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
|
|
1803
|
-
return options.enabled !== false && (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
|
|
1804
|
-
}
|
|
1805
|
-
function isStale(query, options) {
|
|
1806
|
-
return query.isStaleByTime(options.staleTime);
|
|
1807
|
-
}
|
|
1808
|
-
function shouldAssignObserverCurrentProperties(observer, optimisticResult, options) {
|
|
1809
|
-
if (options.keepPreviousData) {
|
|
1810
|
-
return false;
|
|
1811
|
-
}
|
|
1812
|
-
if (options.placeholderData !== void 0) {
|
|
1813
|
-
return optimisticResult.isPlaceholderData;
|
|
1814
|
-
}
|
|
1815
|
-
if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
|
|
1816
|
-
return true;
|
|
1817
|
-
}
|
|
1818
|
-
return false;
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
// ../../node_modules/@tanstack/react-query/build/lib/useSyncExternalStore.mjs
|
|
1822
|
-
var import_shim = __toESM(require_shim(), 1);
|
|
1823
|
-
var useSyncExternalStore = import_shim.useSyncExternalStore;
|
|
1824
|
-
|
|
1825
|
-
// ../../node_modules/@tanstack/react-query/build/lib/QueryClientProvider.mjs
|
|
1826
|
-
import * as React from "react";
|
|
1827
|
-
var defaultContext = /* @__PURE__ */ React.createContext(void 0);
|
|
1828
|
-
var QueryClientSharingContext = /* @__PURE__ */ React.createContext(false);
|
|
1829
|
-
function getQueryClientContext(context, contextSharing) {
|
|
1830
|
-
if (context) {
|
|
1831
|
-
return context;
|
|
1832
|
-
}
|
|
1833
|
-
if (contextSharing && typeof window !== "undefined") {
|
|
1834
|
-
if (!window.ReactQueryClientContext) {
|
|
1835
|
-
window.ReactQueryClientContext = defaultContext;
|
|
1836
|
-
}
|
|
1837
|
-
return window.ReactQueryClientContext;
|
|
1838
|
-
}
|
|
1839
|
-
return defaultContext;
|
|
1840
|
-
}
|
|
1841
|
-
var useQueryClient = ({
|
|
1842
|
-
context
|
|
1843
|
-
} = {}) => {
|
|
1844
|
-
const queryClient = React.useContext(getQueryClientContext(context, React.useContext(QueryClientSharingContext)));
|
|
1845
|
-
if (!queryClient) {
|
|
1846
|
-
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
1847
|
-
}
|
|
1848
|
-
return queryClient;
|
|
1849
|
-
};
|
|
1850
|
-
|
|
1851
|
-
// ../../node_modules/@tanstack/react-query/build/lib/isRestoring.mjs
|
|
1852
|
-
import * as React2 from "react";
|
|
1853
|
-
var IsRestoringContext = /* @__PURE__ */ React2.createContext(false);
|
|
1854
|
-
var useIsRestoring = () => React2.useContext(IsRestoringContext);
|
|
1855
|
-
var IsRestoringProvider = IsRestoringContext.Provider;
|
|
1856
|
-
|
|
1857
|
-
// ../../node_modules/@tanstack/react-query/build/lib/QueryErrorResetBoundary.mjs
|
|
1858
|
-
import * as React3 from "react";
|
|
1859
|
-
function createValue() {
|
|
1860
|
-
let isReset = false;
|
|
1861
|
-
return {
|
|
1862
|
-
clearReset: () => {
|
|
1863
|
-
isReset = false;
|
|
1864
|
-
},
|
|
1865
|
-
reset: () => {
|
|
1866
|
-
isReset = true;
|
|
1867
|
-
},
|
|
1868
|
-
isReset: () => {
|
|
1869
|
-
return isReset;
|
|
1870
|
-
}
|
|
1871
|
-
};
|
|
1872
|
-
}
|
|
1873
|
-
var QueryErrorResetBoundaryContext = /* @__PURE__ */ React3.createContext(createValue());
|
|
1874
|
-
var useQueryErrorResetBoundary = () => React3.useContext(QueryErrorResetBoundaryContext);
|
|
1875
|
-
|
|
1876
|
-
// ../../node_modules/@tanstack/react-query/build/lib/errorBoundaryUtils.mjs
|
|
1877
|
-
import * as React4 from "react";
|
|
1878
|
-
|
|
1879
|
-
// ../../node_modules/@tanstack/react-query/build/lib/utils.mjs
|
|
1880
|
-
function shouldThrowError(_useErrorBoundary, params) {
|
|
1881
|
-
if (typeof _useErrorBoundary === "function") {
|
|
1882
|
-
return _useErrorBoundary(...params);
|
|
1883
|
-
}
|
|
1884
|
-
return !!_useErrorBoundary;
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
// ../../node_modules/@tanstack/react-query/build/lib/errorBoundaryUtils.mjs
|
|
1888
|
-
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
|
|
1889
|
-
if (options.suspense || options.useErrorBoundary) {
|
|
1890
|
-
if (!errorResetBoundary.isReset()) {
|
|
1891
|
-
options.retryOnMount = false;
|
|
1892
|
-
}
|
|
1893
|
-
}
|
|
1894
|
-
};
|
|
1895
|
-
var useClearResetErrorBoundary = (errorResetBoundary) => {
|
|
1896
|
-
React4.useEffect(() => {
|
|
1897
|
-
errorResetBoundary.clearReset();
|
|
1898
|
-
}, [errorResetBoundary]);
|
|
1899
|
-
};
|
|
1900
|
-
var getHasError = ({
|
|
1901
|
-
result,
|
|
1902
|
-
errorResetBoundary,
|
|
1903
|
-
useErrorBoundary,
|
|
1904
|
-
query
|
|
1905
|
-
}) => {
|
|
1906
|
-
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && shouldThrowError(useErrorBoundary, [result.error, query]);
|
|
1907
|
-
};
|
|
1908
|
-
|
|
1909
|
-
// ../../node_modules/@tanstack/react-query/build/lib/suspense.mjs
|
|
1910
|
-
var ensureStaleTime = (defaultedOptions) => {
|
|
1911
|
-
if (defaultedOptions.suspense) {
|
|
1912
|
-
if (typeof defaultedOptions.staleTime !== "number") {
|
|
1913
|
-
defaultedOptions.staleTime = 1e3;
|
|
1914
|
-
}
|
|
1915
|
-
}
|
|
1916
|
-
};
|
|
1917
|
-
var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
|
|
1918
|
-
var shouldSuspend = (defaultedOptions, result, isRestoring) => (defaultedOptions == null ? void 0 : defaultedOptions.suspense) && willFetch(result, isRestoring);
|
|
1919
|
-
var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).then(({
|
|
1920
|
-
data
|
|
1921
|
-
}) => {
|
|
1922
|
-
defaultedOptions.onSuccess == null ? void 0 : defaultedOptions.onSuccess(data);
|
|
1923
|
-
defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(data, null);
|
|
1924
|
-
}).catch((error) => {
|
|
1925
|
-
errorResetBoundary.clearReset();
|
|
1926
|
-
defaultedOptions.onError == null ? void 0 : defaultedOptions.onError(error);
|
|
1927
|
-
defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(void 0, error);
|
|
1928
|
-
});
|
|
1929
|
-
|
|
1930
|
-
// ../../node_modules/@tanstack/react-query/build/lib/useBaseQuery.mjs
|
|
1931
|
-
import * as React5 from "react";
|
|
1932
|
-
function useBaseQuery(options, Observer) {
|
|
1933
|
-
const queryClient = useQueryClient({
|
|
1934
|
-
context: options.context
|
|
1935
|
-
});
|
|
1936
|
-
const isRestoring = useIsRestoring();
|
|
1937
|
-
const errorResetBoundary = useQueryErrorResetBoundary();
|
|
1938
|
-
const defaultedOptions = queryClient.defaultQueryOptions(options);
|
|
1939
|
-
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
|
|
1940
|
-
if (defaultedOptions.onError) {
|
|
1941
|
-
defaultedOptions.onError = notifyManager.batchCalls(defaultedOptions.onError);
|
|
1942
|
-
}
|
|
1943
|
-
if (defaultedOptions.onSuccess) {
|
|
1944
|
-
defaultedOptions.onSuccess = notifyManager.batchCalls(defaultedOptions.onSuccess);
|
|
1945
|
-
}
|
|
1946
|
-
if (defaultedOptions.onSettled) {
|
|
1947
|
-
defaultedOptions.onSettled = notifyManager.batchCalls(defaultedOptions.onSettled);
|
|
1948
|
-
}
|
|
1949
|
-
ensureStaleTime(defaultedOptions);
|
|
1950
|
-
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);
|
|
1951
|
-
useClearResetErrorBoundary(errorResetBoundary);
|
|
1952
|
-
const [observer] = React5.useState(() => new Observer(queryClient, defaultedOptions));
|
|
1953
|
-
const result = observer.getOptimisticResult(defaultedOptions);
|
|
1954
|
-
useSyncExternalStore(React5.useCallback((onStoreChange) => {
|
|
1955
|
-
const unsubscribe = isRestoring ? () => void 0 : observer.subscribe(notifyManager.batchCalls(onStoreChange));
|
|
1956
|
-
observer.updateResult();
|
|
1957
|
-
return unsubscribe;
|
|
1958
|
-
}, [observer, isRestoring]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
|
|
1959
|
-
React5.useEffect(() => {
|
|
1960
|
-
observer.setOptions(defaultedOptions, {
|
|
1961
|
-
listeners: false
|
|
1962
|
-
});
|
|
1963
|
-
}, [defaultedOptions, observer]);
|
|
1964
|
-
if (shouldSuspend(defaultedOptions, result, isRestoring)) {
|
|
1965
|
-
throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
|
|
1966
|
-
}
|
|
1967
|
-
if (getHasError({
|
|
1968
|
-
result,
|
|
1969
|
-
errorResetBoundary,
|
|
1970
|
-
useErrorBoundary: defaultedOptions.useErrorBoundary,
|
|
1971
|
-
query: observer.getCurrentQuery()
|
|
1972
|
-
})) {
|
|
1973
|
-
throw result.error;
|
|
1974
|
-
}
|
|
1975
|
-
return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
|
|
1976
|
-
}
|
|
1977
|
-
|
|
1978
|
-
// ../../node_modules/@tanstack/react-query/build/lib/useQuery.mjs
|
|
1979
|
-
function useQuery(arg1, arg2, arg3) {
|
|
1980
|
-
const parsedOptions = parseQueryArgs(arg1, arg2, arg3);
|
|
1981
|
-
return useBaseQuery(parsedOptions, QueryObserver);
|
|
1982
|
-
}
|
|
1983
|
-
|
|
1984
881
|
// src/lib/useUploadCore.tsx
|
|
882
|
+
import { useQuery } from "@tanstack/react-query";
|
|
1985
883
|
import Upload2 from "@availity/upload-core";
|
|
1986
884
|
function startUpload2(file, options) {
|
|
1987
885
|
return __async(this, null, function* () {
|
|
@@ -2141,8 +1039,9 @@ var FileList2 = ({
|
|
|
2141
1039
|
};
|
|
2142
1040
|
|
|
2143
1041
|
// src/lib/FileSelector.tsx
|
|
2144
|
-
import { useState as
|
|
1042
|
+
import { useState as useState3 } from "react";
|
|
2145
1043
|
import { useFormContext as useFormContext3 } from "react-hook-form";
|
|
1044
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
2146
1045
|
import { Grid as Grid4 } from "@availity/mui-layout";
|
|
2147
1046
|
import { Typography as Typography6 } from "@availity/mui-typography";
|
|
2148
1047
|
import { Alert as Alert2, AlertTitle as AlertTitle2 } from "@availity/mui-alert";
|
|
@@ -2207,8 +1106,8 @@ var FileSelector = ({
|
|
|
2207
1106
|
validator,
|
|
2208
1107
|
disableRemove
|
|
2209
1108
|
}) => {
|
|
2210
|
-
const [totalSize, setTotalSize] =
|
|
2211
|
-
const [fileRejections, setFileRejections] =
|
|
1109
|
+
const [totalSize, setTotalSize] = useState3(0);
|
|
1110
|
+
const [fileRejections, setFileRejections] = useState3([]);
|
|
2212
1111
|
const client = useQueryClient();
|
|
2213
1112
|
const formMethods = useFormContext3();
|
|
2214
1113
|
const options = __spreadProps(__spreadValues({}, uploadOptions), {
|
|
@@ -2350,7 +1249,7 @@ var FileSelector = ({
|
|
|
2350
1249
|
};
|
|
2351
1250
|
|
|
2352
1251
|
// src/lib/FileSelector2.tsx
|
|
2353
|
-
import { useState as
|
|
1252
|
+
import { useState as useState4 } from "react";
|
|
2354
1253
|
import { useFormContext as useFormContext4 } from "react-hook-form";
|
|
2355
1254
|
import { Grid as Grid5 } from "@availity/mui-layout";
|
|
2356
1255
|
import { Typography as Typography7 } from "@availity/mui-typography";
|
|
@@ -2382,8 +1281,8 @@ var FileSelector2 = ({
|
|
|
2382
1281
|
validator,
|
|
2383
1282
|
disableRemove
|
|
2384
1283
|
}) => {
|
|
2385
|
-
const [totalSize, setTotalSize] =
|
|
2386
|
-
const [fileRejections, setFileRejections] =
|
|
1284
|
+
const [totalSize, setTotalSize] = useState4(0);
|
|
1285
|
+
const [fileRejections, setFileRejections] = useState4([]);
|
|
2387
1286
|
const formMethods = useFormContext4();
|
|
2388
1287
|
const options = __spreadProps(__spreadValues({}, uploadOptions), {
|
|
2389
1288
|
bucketId,
|
|
@@ -2544,27 +1443,3 @@ export {
|
|
|
2544
1443
|
outerBoxStyles,
|
|
2545
1444
|
useUploadCore
|
|
2546
1445
|
};
|
|
2547
|
-
/*! Bundled license information:
|
|
2548
|
-
|
|
2549
|
-
use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
|
|
2550
|
-
(**
|
|
2551
|
-
* @license React
|
|
2552
|
-
* use-sync-external-store-shim.production.js
|
|
2553
|
-
*
|
|
2554
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2555
|
-
*
|
|
2556
|
-
* This source code is licensed under the MIT license found in the
|
|
2557
|
-
* LICENSE file in the root directory of this source tree.
|
|
2558
|
-
*)
|
|
2559
|
-
|
|
2560
|
-
use-sync-external-store/cjs/use-sync-external-store-shim.development.js:
|
|
2561
|
-
(**
|
|
2562
|
-
* @license React
|
|
2563
|
-
* use-sync-external-store-shim.development.js
|
|
2564
|
-
*
|
|
2565
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2566
|
-
*
|
|
2567
|
-
* This source code is licensed under the MIT license found in the
|
|
2568
|
-
* LICENSE file in the root directory of this source tree.
|
|
2569
|
-
*)
|
|
2570
|
-
*/
|