@tracktor/shared-module 2.19.5 → 2.19.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/hooks/useFilters.d.ts +1 -1
- package/dist/main.js +140 -141
- package/dist/main.umd.cjs +2 -2
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ declare const useFilters: (options?: useFiltersOptions) => {
|
|
|
31
31
|
} | {
|
|
32
32
|
getFilter: <T = string, DefaultValue = undefined>(name: string, defaultValue?: T) => DefaultValue extends undefined ? T | undefined : T;
|
|
33
33
|
getFilters: () => {
|
|
34
|
-
[x: string]:
|
|
34
|
+
[x: string]: unknown;
|
|
35
35
|
};
|
|
36
36
|
handleFilter: <T>(name: string, key?: string) => (_: SyntheticEvent, value?: T) => void;
|
|
37
37
|
setFilter: (name: string, value: unknown, persist?: boolean) => void;
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import X from "axios";
|
|
2
|
-
import
|
|
2
|
+
import fe, { useMemo as M, createContext as pe, useContext as P, useEffect as j, useState as Y, useRef as oe, Suspense as ge, useCallback as x } from "react";
|
|
3
3
|
const Ye = (e, r) => {
|
|
4
4
|
const o = X.CancelToken.source(), a = X({
|
|
5
5
|
...e,
|
|
@@ -12,7 +12,7 @@ const Ye = (e, r) => {
|
|
|
12
12
|
};
|
|
13
13
|
var $ = { exports: {} }, O = {};
|
|
14
14
|
var Z;
|
|
15
|
-
function
|
|
15
|
+
function me() {
|
|
16
16
|
if (Z) return O;
|
|
17
17
|
Z = 1;
|
|
18
18
|
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), r = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
@@ -35,25 +35,25 @@ function ge() {
|
|
|
35
35
|
}
|
|
36
36
|
var N = {};
|
|
37
37
|
var ee;
|
|
38
|
-
function
|
|
38
|
+
function ye() {
|
|
39
39
|
return ee || (ee = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
40
40
|
function e(t) {
|
|
41
41
|
if (t == null) return null;
|
|
42
42
|
if (typeof t == "function")
|
|
43
|
-
return t.$$typeof ===
|
|
43
|
+
return t.$$typeof === le ? null : t.displayName || t.name || null;
|
|
44
44
|
if (typeof t == "string") return t;
|
|
45
45
|
switch (t) {
|
|
46
|
-
case
|
|
46
|
+
case m:
|
|
47
47
|
return "Fragment";
|
|
48
|
-
case
|
|
48
|
+
case T:
|
|
49
49
|
return "Profiler";
|
|
50
50
|
case h:
|
|
51
51
|
return "StrictMode";
|
|
52
|
-
case oe:
|
|
53
|
-
return "Suspense";
|
|
54
52
|
case ae:
|
|
53
|
+
return "Suspense";
|
|
54
|
+
case se:
|
|
55
55
|
return "SuspenseList";
|
|
56
|
-
case
|
|
56
|
+
case ce:
|
|
57
57
|
return "Activity";
|
|
58
58
|
}
|
|
59
59
|
if (typeof t == "object")
|
|
@@ -62,14 +62,14 @@ function me() {
|
|
|
62
62
|
), t.$$typeof) {
|
|
63
63
|
case S:
|
|
64
64
|
return "Portal";
|
|
65
|
-
case
|
|
65
|
+
case v:
|
|
66
66
|
return t.displayName || "Context";
|
|
67
|
-
case
|
|
67
|
+
case g:
|
|
68
68
|
return (t._context.displayName || "Context") + ".Consumer";
|
|
69
|
-
case
|
|
69
|
+
case A:
|
|
70
70
|
var f = t.render;
|
|
71
71
|
return t = t.displayName, t || (t = f.displayName || f.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
72
|
-
case
|
|
72
|
+
case ie:
|
|
73
73
|
return f = t.displayName || null, f !== null ? f : e(t.type) || "Memo";
|
|
74
74
|
case W:
|
|
75
75
|
f = t._payload, t = t._init;
|
|
@@ -92,8 +92,8 @@ function me() {
|
|
|
92
92
|
}
|
|
93
93
|
if (f) {
|
|
94
94
|
f = console;
|
|
95
|
-
var
|
|
96
|
-
return
|
|
95
|
+
var E = f.error, w = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
96
|
+
return E.call(
|
|
97
97
|
f,
|
|
98
98
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
99
99
|
w
|
|
@@ -101,7 +101,7 @@ function me() {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
function a(t) {
|
|
104
|
-
if (t ===
|
|
104
|
+
if (t === m) return "<>";
|
|
105
105
|
if (typeof t == "object" && t !== null && t.$$typeof === W)
|
|
106
106
|
return "<...>";
|
|
107
107
|
try {
|
|
@@ -126,14 +126,14 @@ function me() {
|
|
|
126
126
|
return t.key !== void 0;
|
|
127
127
|
}
|
|
128
128
|
function u(t, f) {
|
|
129
|
-
function
|
|
129
|
+
function E() {
|
|
130
130
|
J || (J = !0, console.error(
|
|
131
131
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
132
132
|
f
|
|
133
133
|
));
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
get:
|
|
135
|
+
E.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
136
|
+
get: E,
|
|
137
137
|
configurable: !0
|
|
138
138
|
});
|
|
139
139
|
}
|
|
@@ -143,13 +143,13 @@ function me() {
|
|
|
143
143
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
144
144
|
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
145
145
|
}
|
|
146
|
-
function d(t, f,
|
|
147
|
-
var R =
|
|
146
|
+
function d(t, f, E, w, F, Q) {
|
|
147
|
+
var R = E.ref;
|
|
148
148
|
return t = {
|
|
149
|
-
$$typeof:
|
|
149
|
+
$$typeof: k,
|
|
150
150
|
type: t,
|
|
151
151
|
key: f,
|
|
152
|
-
props:
|
|
152
|
+
props: E,
|
|
153
153
|
_owner: w
|
|
154
154
|
}, (R !== void 0 ? R : null) !== null ? Object.defineProperty(t, "ref", {
|
|
155
155
|
enumerable: !1,
|
|
@@ -176,11 +176,11 @@ function me() {
|
|
|
176
176
|
value: Q
|
|
177
177
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
178
178
|
}
|
|
179
|
-
function s(t, f,
|
|
179
|
+
function s(t, f, E, w, F, Q) {
|
|
180
180
|
var R = f.children;
|
|
181
181
|
if (R !== void 0)
|
|
182
182
|
if (w)
|
|
183
|
-
if (
|
|
183
|
+
if (ue(R)) {
|
|
184
184
|
for (w = 0; w < R.length; w++)
|
|
185
185
|
y(R[w]);
|
|
186
186
|
Object.freeze && Object.freeze(R);
|
|
@@ -191,8 +191,8 @@ function me() {
|
|
|
191
191
|
else y(R);
|
|
192
192
|
if (G.call(f, "key")) {
|
|
193
193
|
R = e(t);
|
|
194
|
-
var I = Object.keys(f).filter(function(
|
|
195
|
-
return
|
|
194
|
+
var I = Object.keys(f).filter(function(de) {
|
|
195
|
+
return de !== "key";
|
|
196
196
|
});
|
|
197
197
|
w = 0 < I.length ? "{key: someKey, " + I.join(": ..., ") + ": ...}" : "{key: someKey}", H[R + w] || (I = 0 < I.length ? "{" + I.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
198
198
|
`A props object containing a "key" prop is being spread into JSX:
|
|
@@ -207,18 +207,18 @@ React keys must be passed directly to JSX without using spread:
|
|
|
207
207
|
R
|
|
208
208
|
), H[R + w] = !0);
|
|
209
209
|
}
|
|
210
|
-
if (R = null,
|
|
211
|
-
|
|
210
|
+
if (R = null, E !== void 0 && (o(E), R = "" + E), c(f) && (o(f.key), R = "" + f.key), "key" in f) {
|
|
211
|
+
E = {};
|
|
212
212
|
for (var V in f)
|
|
213
|
-
V !== "key" && (
|
|
214
|
-
} else
|
|
213
|
+
V !== "key" && (E[V] = f[V]);
|
|
214
|
+
} else E = f;
|
|
215
215
|
return R && u(
|
|
216
|
-
|
|
216
|
+
E,
|
|
217
217
|
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
218
218
|
), d(
|
|
219
219
|
t,
|
|
220
220
|
R,
|
|
221
|
-
|
|
221
|
+
E,
|
|
222
222
|
n(),
|
|
223
223
|
F,
|
|
224
224
|
Q
|
|
@@ -228,36 +228,36 @@ React keys must be passed directly to JSX without using spread:
|
|
|
228
228
|
p(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === W && (t._payload.status === "fulfilled" ? p(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
|
|
229
229
|
}
|
|
230
230
|
function p(t) {
|
|
231
|
-
return typeof t == "object" && t !== null && t.$$typeof ===
|
|
231
|
+
return typeof t == "object" && t !== null && t.$$typeof === k;
|
|
232
232
|
}
|
|
233
|
-
var
|
|
233
|
+
var _ = fe, k = /* @__PURE__ */ Symbol.for("react.transitional.element"), S = /* @__PURE__ */ Symbol.for("react.portal"), m = /* @__PURE__ */ Symbol.for("react.fragment"), h = /* @__PURE__ */ Symbol.for("react.strict_mode"), T = /* @__PURE__ */ Symbol.for("react.profiler"), g = /* @__PURE__ */ Symbol.for("react.consumer"), v = /* @__PURE__ */ Symbol.for("react.context"), A = /* @__PURE__ */ Symbol.for("react.forward_ref"), ae = /* @__PURE__ */ Symbol.for("react.suspense"), se = /* @__PURE__ */ Symbol.for("react.suspense_list"), ie = /* @__PURE__ */ Symbol.for("react.memo"), W = /* @__PURE__ */ Symbol.for("react.lazy"), ce = /* @__PURE__ */ Symbol.for("react.activity"), le = /* @__PURE__ */ Symbol.for("react.client.reference"), z = _.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, G = Object.prototype.hasOwnProperty, ue = Array.isArray, U = console.createTask ? console.createTask : function() {
|
|
234
234
|
return null;
|
|
235
235
|
};
|
|
236
|
-
|
|
236
|
+
_ = {
|
|
237
237
|
react_stack_bottom_frame: function(t) {
|
|
238
238
|
return t();
|
|
239
239
|
}
|
|
240
240
|
};
|
|
241
|
-
var J, K = {}, q =
|
|
242
|
-
|
|
241
|
+
var J, K = {}, q = _.react_stack_bottom_frame.bind(
|
|
242
|
+
_,
|
|
243
243
|
i
|
|
244
244
|
)(), B = U(a(i)), H = {};
|
|
245
|
-
N.Fragment =
|
|
245
|
+
N.Fragment = m, N.jsx = function(t, f, E) {
|
|
246
246
|
var w = 1e4 > z.recentlyCreatedOwnerStacks++;
|
|
247
247
|
return s(
|
|
248
248
|
t,
|
|
249
249
|
f,
|
|
250
|
-
|
|
250
|
+
E,
|
|
251
251
|
!1,
|
|
252
252
|
w ? Error("react-stack-top-frame") : q,
|
|
253
253
|
w ? U(a(t)) : B
|
|
254
254
|
);
|
|
255
|
-
}, N.jsxs = function(t, f,
|
|
255
|
+
}, N.jsxs = function(t, f, E) {
|
|
256
256
|
var w = 1e4 > z.recentlyCreatedOwnerStacks++;
|
|
257
257
|
return s(
|
|
258
258
|
t,
|
|
259
259
|
f,
|
|
260
|
-
|
|
260
|
+
E,
|
|
261
261
|
!0,
|
|
262
262
|
w ? Error("react-stack-top-frame") : q,
|
|
263
263
|
w ? U(a(t)) : B
|
|
@@ -266,10 +266,10 @@ React keys must be passed directly to JSX without using spread:
|
|
|
266
266
|
})()), N;
|
|
267
267
|
}
|
|
268
268
|
var te;
|
|
269
|
-
function
|
|
270
|
-
return te || (te = 1, process.env.NODE_ENV === "production" ? $.exports =
|
|
269
|
+
function he() {
|
|
270
|
+
return te || (te = 1, process.env.NODE_ENV === "production" ? $.exports = me() : $.exports = ye()), $.exports;
|
|
271
271
|
}
|
|
272
|
-
var C =
|
|
272
|
+
var C = he();
|
|
273
273
|
const We = ({ IMaskMixin: e, ...r }) => {
|
|
274
274
|
const o = M(
|
|
275
275
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -277,7 +277,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
277
277
|
[e]
|
|
278
278
|
);
|
|
279
279
|
return /* @__PURE__ */ C.jsx(o, { ...r });
|
|
280
|
-
},
|
|
280
|
+
}, b = pe({}), ze = ({ children: e, apiURL: r, libraries: o, localStorageKeys: a }) => {
|
|
281
281
|
const n = M(
|
|
282
282
|
() => ({
|
|
283
283
|
apiURL: r,
|
|
@@ -286,9 +286,9 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
286
286
|
}),
|
|
287
287
|
[r, o, a]
|
|
288
288
|
);
|
|
289
|
-
return /* @__PURE__ */ C.jsx(
|
|
289
|
+
return /* @__PURE__ */ C.jsx(b.Provider, { value: n, children: e });
|
|
290
290
|
}, Ue = ({ data: e, ...r }) => {
|
|
291
|
-
const { libraries: o } =
|
|
291
|
+
const { libraries: o } = P(b), a = r?.reactRouter || o?.reactRouter, n = r?.gtm || o?.gtm;
|
|
292
292
|
if (!a)
|
|
293
293
|
throw new Error(
|
|
294
294
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
|
|
@@ -296,7 +296,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
296
296
|
if (!n)
|
|
297
297
|
throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
|
|
298
298
|
const { useGoogleTagManager: i } = n, { useLocation: c, Outlet: u } = a, { pathname: l } = c(), { sendEvent: d } = i();
|
|
299
|
-
return
|
|
299
|
+
return j(() => {
|
|
300
300
|
d({
|
|
301
301
|
event: "pageView",
|
|
302
302
|
pathname: l,
|
|
@@ -311,29 +311,29 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
311
311
|
} catch {
|
|
312
312
|
return !1;
|
|
313
313
|
}
|
|
314
|
-
})(),
|
|
314
|
+
})(), ve = "user", Qe = ({
|
|
315
315
|
tokenTypeKey: e = "tokenType",
|
|
316
316
|
tokenKey: r = "accessToken",
|
|
317
317
|
postContentType: o = "application/json",
|
|
318
318
|
...a
|
|
319
319
|
}) => {
|
|
320
|
-
const { apiURL: n = a.apiURL, libraries: i, localStorageKeys: c } =
|
|
320
|
+
const { apiURL: n = a.apiURL, libraries: i, localStorageKeys: c } = P(b), u = a?.userLocalStorageKey || c?.user || ve, l = a?.axios || i?.axios;
|
|
321
321
|
if (!l)
|
|
322
322
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
323
323
|
if (!l?.defaults || L)
|
|
324
324
|
return null;
|
|
325
325
|
if (typeof window < "u" && window.localStorage) {
|
|
326
|
-
const d = localStorage.getItem(u), s = d ? JSON.parse(d) : null, y = s?.[e] ? s[e] : null, p = s?.[r] ? s[r] : null,
|
|
327
|
-
|
|
326
|
+
const d = localStorage.getItem(u), s = d ? JSON.parse(d) : null, y = s?.[e] ? s[e] : null, p = s?.[r] ? s[r] : null, _ = d ? `${y} ${p}` : null;
|
|
327
|
+
_ && (l.defaults.headers.common.Authorization = _);
|
|
328
328
|
}
|
|
329
329
|
return l.defaults.baseURL = n, l.defaults.headers.post["Content-Type"] = o, null;
|
|
330
330
|
}, Ve = ({ language: e, ...r }) => {
|
|
331
|
-
const { libraries: o } =
|
|
331
|
+
const { libraries: o } = P(b), a = r?.dayjs || o?.dayjs, n = r?.plugin || o?.dayjsPlugin;
|
|
332
332
|
if (!a)
|
|
333
333
|
throw new Error(
|
|
334
334
|
"Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig."
|
|
335
335
|
);
|
|
336
|
-
return
|
|
336
|
+
return j(() => {
|
|
337
337
|
(async () => {
|
|
338
338
|
const c = e || navigator.language?.slice(0, 2) || "en";
|
|
339
339
|
n && n.forEach((u) => {
|
|
@@ -342,7 +342,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
342
342
|
})().then();
|
|
343
343
|
}, [a, n, e]), null;
|
|
344
344
|
}, Me = ({ debug: e, resources: r, ...o }) => {
|
|
345
|
-
const { libraries: a } =
|
|
345
|
+
const { libraries: a } = P(b), n = o?.i18 || a?.i18, { i18next: i, initReactI18next: c, languageDetector: u } = n || {};
|
|
346
346
|
if (L)
|
|
347
347
|
return null;
|
|
348
348
|
if (!n)
|
|
@@ -378,14 +378,14 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
378
378
|
release: d,
|
|
379
379
|
...s
|
|
380
380
|
}) => {
|
|
381
|
-
const { libraries: y } =
|
|
381
|
+
const { libraries: y } = P(b), p = s?.sentry || y?.sentry, _ = s?.reactRouter || y?.reactRouter;
|
|
382
382
|
if (!p)
|
|
383
383
|
throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
384
|
-
if (!
|
|
384
|
+
if (!_)
|
|
385
385
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
386
386
|
if (p.isInitialized())
|
|
387
387
|
return null;
|
|
388
|
-
const { createRoutesFromChildren:
|
|
388
|
+
const { createRoutesFromChildren: k, matchRoutes: S, useLocation: m, useNavigationType: h } = _;
|
|
389
389
|
return (u || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && p.init({
|
|
390
390
|
debug: u,
|
|
391
391
|
dsn: e,
|
|
@@ -401,10 +401,10 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
401
401
|
],
|
|
402
402
|
integrations: [
|
|
403
403
|
p.reactRouterV6BrowserTracingIntegration({
|
|
404
|
-
createRoutesFromChildren:
|
|
404
|
+
createRoutesFromChildren: k,
|
|
405
405
|
matchRoutes: S,
|
|
406
|
-
useEffect:
|
|
407
|
-
useLocation:
|
|
406
|
+
useEffect: j,
|
|
407
|
+
useLocation: m,
|
|
408
408
|
useNavigationType: h
|
|
409
409
|
}),
|
|
410
410
|
...r || []
|
|
@@ -415,7 +415,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
415
415
|
tracePropagationTargets: i,
|
|
416
416
|
tracesSampleRate: o || 1
|
|
417
417
|
}), null;
|
|
418
|
-
}, Je = () => (
|
|
418
|
+
}, Je = () => (j(() => {
|
|
419
419
|
if (L)
|
|
420
420
|
return;
|
|
421
421
|
const e = (r) => {
|
|
@@ -427,18 +427,18 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
427
427
|
return window.addEventListener("vite:preloadError", e), () => {
|
|
428
428
|
window.removeEventListener("vite:preloadError", e);
|
|
429
429
|
};
|
|
430
|
-
}, []), null),
|
|
431
|
-
const { libraries: i, localStorageKeys: c } =
|
|
430
|
+
}, []), null), Ee = "user", Ke = ({ Fallback: e, isLogged: r, loginPath: o = "/login", redirect401Path: a = "/login", ...n }) => {
|
|
431
|
+
const { libraries: i, localStorageKeys: c } = P(b), u = n?.reactRouter || i?.reactRouter, l = n?.axios || i?.axios, d = n?.localStorageKey || c?.user || Ee;
|
|
432
432
|
if (!u)
|
|
433
433
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
434
|
-
const [s, y] = Y(null), { useLocation: p, Navigate:
|
|
435
|
-
return
|
|
436
|
-
|
|
437
|
-
(
|
|
438
|
-
async (
|
|
434
|
+
const [s, y] = Y(null), { useLocation: p, Navigate: _, Outlet: k } = u, S = p(), m = oe(!1), h = typeof r == "function" ? r() : !!r, T = typeof h == "boolean" ? h : h?.isLogged;
|
|
435
|
+
return j(() => {
|
|
436
|
+
m.current || (m.current = !0, l.interceptors.response.use(
|
|
437
|
+
(g) => g,
|
|
438
|
+
async (g) => (typeof g == "object" && g && "response" in g && g.response && typeof g.response == "object" && "status" in g.response && g.response && typeof g.response == "object" && "status" in g.response && g?.response?.status === 401 && (l.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(d), y(a)), Promise.reject(g))
|
|
439
439
|
));
|
|
440
|
-
}, [l.defaults.headers.common, l.interceptors.response, d, a]),
|
|
441
|
-
},
|
|
440
|
+
}, [l.defaults.headers.common, l.interceptors.response, d, a]), T && !s ? /* @__PURE__ */ C.jsx(ge, { fallback: e, children: S.state?.from?.state && S.state?.from?.pathname === o ? /* @__PURE__ */ C.jsx(_, { to: S.state.from.state.from.pathname + S.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ C.jsx(k, {}) }) : /* @__PURE__ */ C.jsx(_, { to: o + S.search, state: { from: S }, replace: !0 });
|
|
441
|
+
}, we = async () => {
|
|
442
442
|
if ("caches" in window)
|
|
443
443
|
try {
|
|
444
444
|
const e = await caches.keys();
|
|
@@ -447,16 +447,16 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
447
447
|
console.error("Failed to clear caches:", e);
|
|
448
448
|
}
|
|
449
449
|
}, qe = ({ autoUpdate: e, renderDialog: r, clearCachesOnReload: o }) => {
|
|
450
|
-
const a =
|
|
450
|
+
const a = oe(null), [n, i] = Y(!1), c = x(() => {
|
|
451
451
|
a.current && a.current.postMessage({ type: "SKIP_WAITING" }), o && localStorage.setItem("tracktor_clear_caches", "1"), window.location.reload();
|
|
452
452
|
}, [o]);
|
|
453
|
-
|
|
454
|
-
localStorage.getItem("tracktor_clear_caches") === "1" && (localStorage.removeItem("tracktor_clear_caches"),
|
|
453
|
+
j(() => {
|
|
454
|
+
localStorage.getItem("tracktor_clear_caches") === "1" && (localStorage.removeItem("tracktor_clear_caches"), we().catch(console.error));
|
|
455
455
|
}, []);
|
|
456
456
|
const u = x(() => {
|
|
457
457
|
window.confirm("A new version is available. The app will reload now.") && c();
|
|
458
458
|
}, [c]);
|
|
459
|
-
return
|
|
459
|
+
return j(() => {
|
|
460
460
|
if (!("serviceWorker" in navigator))
|
|
461
461
|
return;
|
|
462
462
|
let l, d;
|
|
@@ -473,21 +473,21 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
473
473
|
})().catch(console.error), () => {
|
|
474
474
|
l?.removeEventListener("updatefound", y), d && l?.installing && l.installing.removeEventListener("statechange", d);
|
|
475
475
|
};
|
|
476
|
-
}, []),
|
|
476
|
+
}, []), j(() => {
|
|
477
477
|
n && e && c();
|
|
478
|
-
}, [e, n, c]),
|
|
478
|
+
}, [e, n, c]), j(() => {
|
|
479
479
|
n && !e && !r && u();
|
|
480
480
|
}, [r, u, n, e]), n && !e && r ? r(c) : null;
|
|
481
|
-
},
|
|
481
|
+
}, Re = (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase(), _e = (e) => {
|
|
482
482
|
const r = e.split(/[/\\]/).pop() || "";
|
|
483
483
|
return r.substring(0, r.lastIndexOf("."));
|
|
484
484
|
}, be = (e) => {
|
|
485
485
|
const a = e.split("/").filter((n) => n.length > 0).map((n) => n.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join("")).join("");
|
|
486
486
|
return a.charAt(0).toLowerCase() + a.slice(1);
|
|
487
|
-
},
|
|
488
|
-
const n = be(r), i =
|
|
487
|
+
}, Se = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), Ae = (e, r, o, a) => {
|
|
488
|
+
const n = be(r), i = Re(o), c = `${n}${i}`;
|
|
489
489
|
return e && typeof e == "object" && "operationId" in e && a?.includes(String(e.operationId)) ? `${c}AsQuery` : c;
|
|
490
|
-
},
|
|
490
|
+
}, je = (e, r) => {
|
|
491
491
|
const o = {};
|
|
492
492
|
return e?.forEach((a) => {
|
|
493
493
|
o[a] = {
|
|
@@ -505,7 +505,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
505
505
|
};
|
|
506
506
|
}), Object.keys(o).length ? o : void 0;
|
|
507
507
|
}, Be = (e) => (Array.isArray(e) ? e : [e]).reduce((o, a) => {
|
|
508
|
-
const { output: n, useInfiniteIds: i, useQueryIds: c, input: u = "./openapi.json", customAxiosInstancePath: l, overrideApiName: d } = a || {}, s = d ||
|
|
508
|
+
const { output: n, useInfiniteIds: i, useQueryIds: c, input: u = "./openapi.json", customAxiosInstancePath: l, overrideApiName: d } = a || {}, s = d || Se(u), y = l || "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";
|
|
509
509
|
return {
|
|
510
510
|
...o,
|
|
511
511
|
[s]: {
|
|
@@ -516,7 +516,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
516
516
|
mode: "tags-split",
|
|
517
517
|
override: {
|
|
518
518
|
...(i?.length || c?.length) && {
|
|
519
|
-
operations:
|
|
519
|
+
operations: je(i, c)
|
|
520
520
|
},
|
|
521
521
|
header: (p) => [
|
|
522
522
|
"Generated by orval 🍺",
|
|
@@ -524,10 +524,10 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
524
524
|
...p.description ? [p.description] : []
|
|
525
525
|
],
|
|
526
526
|
mutator: {
|
|
527
|
-
name:
|
|
527
|
+
name: _e(y),
|
|
528
528
|
path: y
|
|
529
529
|
},
|
|
530
|
-
operationName: (p,
|
|
530
|
+
operationName: (p, _, k) => Ae(p, _, k, c),
|
|
531
531
|
query: {
|
|
532
532
|
useQuery: !0
|
|
533
533
|
}
|
|
@@ -538,20 +538,20 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
540
|
};
|
|
541
|
-
}, {}),
|
|
541
|
+
}, {}), Pe = (e) => e && typeof e == "function", Te = (e) => e && typeof e == "function", He = ({
|
|
542
542
|
children: e,
|
|
543
543
|
defaultQueriesOptions: r,
|
|
544
544
|
defaultMutationsOptions: o,
|
|
545
545
|
...a
|
|
546
546
|
}) => {
|
|
547
|
-
const { libraries: n } =
|
|
547
|
+
const { libraries: n } = P(b), i = a?.QueryClient || n?.reactQuery?.QueryClient, c = a?.QueryClientProvider || n?.reactQuery?.QueryClientProvider;
|
|
548
548
|
if (!i)
|
|
549
549
|
throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
550
550
|
if (!c)
|
|
551
551
|
throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
552
|
-
if (!
|
|
552
|
+
if (!Pe(c))
|
|
553
553
|
throw new Error("Provided QueryClientProvider dependencies are not valid.");
|
|
554
|
-
if (!
|
|
554
|
+
if (!Te(i))
|
|
555
555
|
throw new Error("Provided QueryClient dependencies are not valid.");
|
|
556
556
|
const u = new i({
|
|
557
557
|
defaultOptions: {
|
|
@@ -567,42 +567,42 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
567
567
|
}
|
|
568
568
|
});
|
|
569
569
|
return /* @__PURE__ */ C.jsx(c, { client: u, children: e });
|
|
570
|
-
},
|
|
570
|
+
}, ke = ({ library: e, date: r, format: o = "ll" }) => e(r).format(o), Ce = (e, r) => {
|
|
571
571
|
const { fractionDigits: o = 0, metric: a = "km", spacingBetween: n = !0 } = r || {}, i = Number(e), c = n ? " " : "";
|
|
572
572
|
return Number.isNaN(i) ? `0${c}${a}` : `${i.toFixed(o)}${c}${a}`;
|
|
573
|
-
},
|
|
573
|
+
}, Ie = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((o) => o.length > 0 ? o.charAt(0).toUpperCase() + o.slice(1) : o).join(" "), xe = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, Oe = ({ path: e, size: r, apiURL: o }) => {
|
|
574
574
|
if (!e)
|
|
575
575
|
return "";
|
|
576
|
-
const a =
|
|
576
|
+
const a = xe(e), n = `${o}${a}`, i = n.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
577
577
|
return typeof r == "number" && i ? `${n.replace("/files", `/thumbs/${r}`)}` : n;
|
|
578
578
|
}, Xe = (e) => {
|
|
579
|
-
const { apiURL: r, libraries: o } =
|
|
579
|
+
const { apiURL: r, libraries: o } = P(b), a = e?.dayjs || o?.dayjs;
|
|
580
580
|
return {
|
|
581
581
|
dateAdapter: (c, u) => {
|
|
582
582
|
if (!a)
|
|
583
583
|
throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
584
|
-
return
|
|
584
|
+
return ke({
|
|
585
585
|
date: c,
|
|
586
586
|
format: u,
|
|
587
587
|
library: a
|
|
588
588
|
});
|
|
589
589
|
},
|
|
590
|
-
distanceAdapter:
|
|
590
|
+
distanceAdapter: Ce,
|
|
591
591
|
filePathAdapter: (c, u) => {
|
|
592
592
|
if (!r)
|
|
593
593
|
throw new Error(
|
|
594
594
|
"API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter."
|
|
595
595
|
);
|
|
596
|
-
return typeof c == "string" && /^https?:\/\//.test(c) ? c :
|
|
596
|
+
return typeof c == "string" && /^https?:\/\//.test(c) ? c : Oe({
|
|
597
597
|
apiURL: r,
|
|
598
598
|
path: c,
|
|
599
599
|
size: u
|
|
600
600
|
});
|
|
601
601
|
},
|
|
602
|
-
worksiteNameAdapter:
|
|
602
|
+
worksiteNameAdapter: Ie
|
|
603
603
|
};
|
|
604
604
|
}, Ze = (e) => {
|
|
605
|
-
const { libraries: r } =
|
|
605
|
+
const { libraries: r } = P(b), o = e?.axios || r?.axios, a = e?.localStorageKey || "user";
|
|
606
606
|
if (!o)
|
|
607
607
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
608
608
|
const n = x(
|
|
@@ -613,7 +613,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
613
613
|
), i = () => {
|
|
614
614
|
o.defaults.headers.common.Authorization = null;
|
|
615
615
|
};
|
|
616
|
-
return
|
|
616
|
+
return j(() => {
|
|
617
617
|
if (L)
|
|
618
618
|
return;
|
|
619
619
|
const c = ({ newValue: u, key: l }) => {
|
|
@@ -637,7 +637,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
637
637
|
const n = e?.language || navigator.language;
|
|
638
638
|
return e && "isInitialized" in e && e.isInitialized, D(n, r);
|
|
639
639
|
});
|
|
640
|
-
return
|
|
640
|
+
return j(() => {
|
|
641
641
|
e && "isInitialized" in e && e.isInitialized && e.language && a(D(e.language, r));
|
|
642
642
|
const n = (i) => {
|
|
643
643
|
a(D(i, r));
|
|
@@ -646,7 +646,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
646
646
|
e?.off?.("languageChanged", n);
|
|
647
647
|
};
|
|
648
648
|
}, [e, r]), o;
|
|
649
|
-
},
|
|
649
|
+
}, Ne = "tracktor.filter", Le = {
|
|
650
650
|
getFilter: () => {
|
|
651
651
|
},
|
|
652
652
|
getFilters: () => ({}),
|
|
@@ -654,14 +654,13 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
654
654
|
},
|
|
655
655
|
setFilter: () => {
|
|
656
656
|
}
|
|
657
|
-
},
|
|
657
|
+
}, re = (e) => {
|
|
658
658
|
try {
|
|
659
|
-
|
|
660
|
-
return r !== null && typeof r == "object" ? r : e;
|
|
659
|
+
return JSON.parse(e);
|
|
661
660
|
} catch {
|
|
662
661
|
return e;
|
|
663
662
|
}
|
|
664
|
-
},
|
|
663
|
+
}, ne = (e, r, o) => `${o}_${e}=>${r}`, Fe = (e) => e.reduce((r, o) => {
|
|
665
664
|
const a = localStorage.getItem(o);
|
|
666
665
|
if (a)
|
|
667
666
|
try {
|
|
@@ -671,55 +670,55 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
671
670
|
}
|
|
672
671
|
return r;
|
|
673
672
|
}, {}), tt = (e) => {
|
|
674
|
-
const { libraries: r, localStorageKeys: o } =
|
|
675
|
-
}], [u, l] = Y({}), d = o?.filter ||
|
|
673
|
+
const { libraries: r, localStorageKeys: o } = P(b), a = e?.reactRouter || r?.reactRouter, { pathname: n } = a?.useLocation?.() ?? { pathname: "/" }, [i, c] = a?.useSearchParams?.() ?? [new URLSearchParams(), () => {
|
|
674
|
+
}], [u, l] = Y({}), d = o?.filter || Ne, s = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl;
|
|
676
675
|
if (L)
|
|
677
|
-
return
|
|
676
|
+
return Le;
|
|
678
677
|
if (!a)
|
|
679
678
|
throw new Error(
|
|
680
679
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter."
|
|
681
680
|
);
|
|
682
681
|
const y = () => Object.keys(localStorage).filter(
|
|
683
|
-
(
|
|
684
|
-
), p = (
|
|
685
|
-
const
|
|
682
|
+
(m) => m.startsWith(d) && m.endsWith(e?.pathname || n)
|
|
683
|
+
), p = (m, h, T = !0) => {
|
|
684
|
+
const g = ne(m, e?.pathname || n, d);
|
|
686
685
|
if (!h || Array.isArray(h) && !h.length) {
|
|
687
|
-
s ? (i.delete(
|
|
688
|
-
const
|
|
689
|
-
return delete
|
|
690
|
-
}), localStorage.removeItem(
|
|
686
|
+
s ? (i.delete(m), c(i)) : l((v) => {
|
|
687
|
+
const A = { ...v };
|
|
688
|
+
return delete A[m], A;
|
|
689
|
+
}), localStorage.removeItem(g);
|
|
691
690
|
return;
|
|
692
691
|
}
|
|
693
|
-
|
|
692
|
+
T && h && localStorage.setItem(g, JSON.stringify({ ...i, [m]: h })), s && h ? (i.set(m, JSON.stringify(h)), c(i)) : !s && h && l((v) => ({ ...v, [m]: h }));
|
|
694
693
|
};
|
|
695
694
|
return {
|
|
696
|
-
getFilter: (
|
|
695
|
+
getFilter: (m, h) => {
|
|
697
696
|
if (!s) {
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
700
|
-
return
|
|
697
|
+
const v = u[m];
|
|
698
|
+
if (v !== void 0)
|
|
699
|
+
return v;
|
|
701
700
|
}
|
|
702
701
|
if (s) {
|
|
703
|
-
const
|
|
704
|
-
if (
|
|
705
|
-
return
|
|
702
|
+
const v = i.get(m);
|
|
703
|
+
if (v)
|
|
704
|
+
return re(v);
|
|
706
705
|
}
|
|
707
|
-
const
|
|
708
|
-
if (
|
|
706
|
+
const T = ne(m, e?.pathname || n, d), g = localStorage.getItem(T);
|
|
707
|
+
if (g)
|
|
709
708
|
try {
|
|
710
|
-
const
|
|
711
|
-
return !s &&
|
|
709
|
+
const v = JSON.parse(g)[m];
|
|
710
|
+
return !s && v !== void 0 && l((A) => ({ ...A, [m]: v })), v;
|
|
712
711
|
} catch {
|
|
713
712
|
}
|
|
714
713
|
return h;
|
|
715
714
|
},
|
|
716
715
|
getFilters: () => {
|
|
717
|
-
const
|
|
716
|
+
const m = y(), h = Fe(m);
|
|
718
717
|
if (s) {
|
|
719
|
-
const
|
|
718
|
+
const T = Array.from(i.entries()).reduce((g, [v, A]) => (g[v] = re(A), g), {});
|
|
720
719
|
return {
|
|
721
720
|
...h,
|
|
722
|
-
...
|
|
721
|
+
...T
|
|
723
722
|
};
|
|
724
723
|
}
|
|
725
724
|
return {
|
|
@@ -727,13 +726,13 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
727
726
|
...u
|
|
728
727
|
};
|
|
729
728
|
},
|
|
730
|
-
handleFilter: (
|
|
731
|
-
if (
|
|
732
|
-
const
|
|
733
|
-
p(
|
|
729
|
+
handleFilter: (m, h) => (T, g) => {
|
|
730
|
+
if (g || Array.isArray(g) && g.length === 0) {
|
|
731
|
+
const v = h || "value", A = typeof g == "object" && v in g ? g[v] : g;
|
|
732
|
+
p(m, A);
|
|
734
733
|
return;
|
|
735
734
|
}
|
|
736
|
-
p(
|
|
735
|
+
p(m, void 0);
|
|
737
736
|
},
|
|
738
737
|
setFilter: p
|
|
739
738
|
};
|
|
@@ -761,7 +760,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
761
760
|
rows: u
|
|
762
761
|
};
|
|
763
762
|
}, nt = (e) => {
|
|
764
|
-
const { libraries: r } =
|
|
763
|
+
const { libraries: r } = P(b), o = e?.i18 || r?.i18, a = e?.i18?.translateFunction || r?.i18?.translateFunction, n = o?.i18next?.t || a || ((d) => d), { unknownErrorTranslationKey: i = "error.unknownError" } = e || {}, c = n(i), u = x(
|
|
765
764
|
(d) => {
|
|
766
765
|
if (d && typeof d == "object" && "response" in d) {
|
|
767
766
|
const { response: s } = d || {};
|
|
@@ -795,7 +794,7 @@ export {
|
|
|
795
794
|
Ve as InitializeDaysJSConfig,
|
|
796
795
|
Me as InitializeI18nConfig,
|
|
797
796
|
Ge as InitializeSentryConfig,
|
|
798
|
-
|
|
797
|
+
b as InjectDependenciesContext,
|
|
799
798
|
ze as InjectDependenciesProvider,
|
|
800
799
|
We as MaskTextField,
|
|
801
800
|
Je as PreloadErrorHandler,
|
|
@@ -803,8 +802,8 @@ export {
|
|
|
803
802
|
Ke as RequireAuth,
|
|
804
803
|
qe as UpdateNotifier,
|
|
805
804
|
Ye as axiosCustomInstance,
|
|
806
|
-
|
|
807
|
-
|
|
805
|
+
ke as dateAdapter,
|
|
806
|
+
Ce as distanceAdapter,
|
|
808
807
|
Be as getOrvalConfig,
|
|
809
808
|
Xe as useAdapter,
|
|
810
809
|
Ze as useAuth,
|
|
@@ -812,5 +811,5 @@ export {
|
|
|
812
811
|
tt as useFilters,
|
|
813
812
|
rt as useInfiniteDataGrid,
|
|
814
813
|
nt as useResponseError,
|
|
815
|
-
|
|
814
|
+
Ie as worksiteNameAdapter
|
|
816
815
|
};
|
package/dist/main.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(y,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("axios"),require("react")):typeof define=="function"&&define.amd?define(["exports","axios","react"],I):(y=typeof globalThis<"u"?globalThis:y||self,I(y["@tracktor/shared-module"]={},y.axios,y.React))})(this,(function(y,I,f){"use strict";const oe=(e,r)=>{const o=I.CancelToken.source(),a=I({...e,...r,cancelToken:o.token}).then(({data:n})=>n);return a.cancel=()=>{o.cancel("Query was cancelled")},a};var F={exports:{}},x={};var V;function ae(){if(V)return x;V=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function o(a,n,i){var c=null;if(i!==void 0&&(c=""+i),n.key!==void 0&&(c=""+n.key),"key"in n){i={};for(var u in n)u!=="key"&&(i[u]=n[u])}else i=n;return n=i.ref,{$$typeof:e,type:a,key:c,ref:n!==void 0?n:null,props:i}}return x.Fragment=r,x.jsx=o,x.jsxs=o,x}var N={};var G;function se(){return G||(G=1,process.env.NODE_ENV!=="production"&&(function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Je?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case h:return"Fragment";case P:return"Profiler";case E:return"StrictMode";case Me:return"Suspense";case Qe:return"SuspenseList";case Ge:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case C:return"Portal";case w:return t.displayName||"Context";case m:return(t._context.displayName||"Context")+".Consumer";case j:var p=t.render;return t=t.displayName,t||(t=p.displayName||p.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Ve:return p=t.displayName||null,p!==null?p:e(t.type)||"Memo";case W:p=t._payload,t=t._init;try{return e(t(p))}catch{}}return null}function r(t){return""+t}function o(t){try{r(t);var p=!1}catch{p=!0}if(p){p=console;var R=p.error,b=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return R.call(p,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",b),r(t)}}function a(t){if(t===h)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===W)return"<...>";try{var p=e(t);return p?"<"+p+">":"<...>"}catch{return"<...>"}}function n(){var t=z.A;return t===null?null:t.getOwner()}function i(){return Error("react-stack-top-frame")}function c(t){if(q.call(t,"key")){var p=Object.getOwnPropertyDescriptor(t,"key").get;if(p&&p.isReactWarning)return!1}return t.key!==void 0}function u(t,p){function R(){$||($=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",p))}R.isReactWarning=!0,Object.defineProperty(t,"key",{get:R,configurable:!0})}function l(){var t=e(this.type);return ee[t]||(ee[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function d(t,p,R,b,Y,M){var _=R.ref;return t={$$typeof:k,type:t,key:p,props:R,_owner:b},(_!==void 0?_:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:l}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function s(t,p,R,b,Y,M){var _=p.children;if(_!==void 0)if(b)if(Ke(_)){for(b=0;b<_.length;b++)v(_[b]);Object.freeze&&Object.freeze(_)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else v(_);if(q.call(p,"key")){_=e(t);var O=Object.keys(p).filter(function(Be){return Be!=="key"});b=0<O.length?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}",ne[_+b]||(O=0<O.length?"{"+O.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,R,_,O,_),re[_+R]=!0)}if(_=null,w!==void 0&&(o(w),_=""+w),c(p)&&(o(p.key),_=""+p.key),"key"in p){w={};for(var Q in p)Q!=="key"&&(w[Q]=p[Q])}else w=p;return _&&u(w,typeof t=="function"?t.displayName||t.name||"Unknown":t),d(t,_,w,n(),Y,M)}function v(t){g(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===W&&(t._payload.status==="fulfilled"?g(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function g(t){return typeof t=="object"&&t!==null&&t.$$typeof===T}var S=f,T=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),b=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),Me=Symbol.for("react.suspense"),Qe=Symbol.for("react.suspense_list"),Ve=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),Ge=Symbol.for("react.activity"),Je=Symbol.for("react.client.reference"),z=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,Ke=Array.isArray,U=console.createTask?console.createTask:function(){return null};S={react_stack_bottom_frame:function(t){return t()}};var q,$={},ee=S.react_stack_bottom_frame.bind(S,i)(),te=U(a(i)),re={};N.Fragment=y,N.jsx=function(t,p,w){var R=1e4>z.recentlyCreatedOwnerStacks++;return s(t,p,w,!1,R?Error("react-stack-top-frame"):ee,R?U(a(t)):te)},N.jsxs=function(t,p,w){var R=1e4>z.recentlyCreatedOwnerStacks++;return s(t,p,w,!0,R?Error("react-stack-top-frame"):ee,R?U(a(t)):te)}})()),N}var J;function se(){return J||(J=1,process.env.NODE_ENV==="production"?F.exports=oe():F.exports=ae()),F.exports}var P=se();const ie=({IMaskMixin:e,...r})=>{const o=f.useMemo(()=>e(({TextField:a,...n})=>P.jsx(a,{...n})),[e]);return P.jsx(o,{...r})},A=f.createContext({}),ce=({children:e,apiURL:r,libraries:o,localStorageKeys:a})=>{const n=f.useMemo(()=>({apiURL:r,libraries:o,localStorageKeys:a}),[r,o,a]);return P.jsx(A.Provider,{value:n,children:e})},le=({data:e,...r})=>{const{libraries:o}=f.useContext(A),a=r?.reactRouter||o?.reactRouter,n=r?.gtm||o?.gtm;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!n)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:i}=n,{useLocation:c,Outlet:u}=a,{pathname:l}=c(),{sendEvent:d}=i();return f.useEffect(()=>{d({event:"pageView",pathname:l,...e})},[e,l,d]),P.jsx(u,{})},L=(()=>{try{return typeof global=="object"&&global!==null&&("HermesInternal"in global||"__fbBatchedBridge"in global||"__metro"in global)||typeof window>"u"&&typeof global<"u"?!0:typeof navigator<"u"&&navigator.userAgent?/react.native|ReactNative/i.test(navigator.userAgent):!1}catch{return!1}})(),ue="user",de=({tokenTypeKey:e="tokenType",tokenKey:r="accessToken",postContentType:o="application/json",...a})=>{const{apiURL:n=a.apiURL,libraries:i,localStorageKeys:c}=f.useContext(A),u=a?.userLocalStorageKey||c?.user||ue,l=a?.axios||i?.axios;if(!l)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l?.defaults||L)return null;if(typeof window<"u"&&window.localStorage){const d=localStorage.getItem(u),s=d?JSON.parse(d):null,v=s?.[e]?s[e]:null,g=s?.[r]?s[r]:null,S=d?`${v} ${g}`:null;S&&(l.defaults.headers.common.Authorization=S)}return l.defaults.baseURL=n,l.defaults.headers.post["Content-Type"]=o,null},fe=({language:e,...r})=>{const{libraries:o}=f.useContext(A),a=r?.dayjs||o?.dayjs,n=r?.plugin||o?.dayjsPlugin;if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return f.useEffect(()=>{(async()=>{const c=e||navigator.language?.slice(0,2)||"en";n&&n.forEach(u=>{u&&a.extend(u)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),a.locale(c)})().then()},[a,n,e]),null},pe=({debug:e,resources:r,...o})=>{const{libraries:a}=f.useContext(A),n=o?.i18||a?.i18,{i18next:i,initReactI18next:c,languageDetector:u}=n||{};if(L)return null;if(!n)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return i?.isInitialized||(i.use(u).use(c).init({debug:e,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:r,returnNull:!1}).then(()=>{document.documentElement.lang!==i.resolvedLanguage&&i.resolvedLanguage&&document.documentElement.setAttribute("lang",i.resolvedLanguage)}),i.on("languageChanged",l=>{document.documentElement.setAttribute("lang",l)})),null},ge=({dsn:e,integrations:r,tracesSampleRate:o,replaysSessionSampleRate:a,replaysOnErrorSampleRate:n,tracePropagationTargets:i,ignoreErrors:c,debug:u,environment:l,release:d,...s})=>{const{libraries:v}=f.useContext(A),g=s?.sentry||v?.sentry,S=s?.reactRouter||v?.reactRouter;if(!g)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!S)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(g.isInitialized())return null;const{createRoutesFromChildren:T,matchRoutes:C,useLocation:y,useNavigationType:E}=S;return(u||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&g.init({debug:u,dsn:e,environment:l||"production",ignoreErrors:[...c||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[g.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:T,matchRoutes:C,useEffect:f.useEffect,useLocation:y,useNavigationType:E}),...r||[]],release:d,replaysOnErrorSampleRate:n||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:i,tracesSampleRate:o||1}),null},me=()=>(f.useEffect(()=>{if(L)return;const e=r=>{try{r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",e),()=>{window.removeEventListener("vite:preloadError",e)}},[]),null),ye="user",he=({Fallback:e,isLogged:r,loginPath:o="/login",redirect401Path:a="/login",...n})=>{const{libraries:i,localStorageKeys:c}=f.useContext(A),u=n?.reactRouter||i?.reactRouter,l=n?.axios||i?.axios,d=n?.localStorageKey||c?.user||ye;if(!u)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[s,v]=f.useState(null),{useLocation:g,Navigate:S,Outlet:T}=u,C=g(),y=f.useRef(!1),E=typeof r=="function"?r():!!r,j=typeof E=="boolean"?E:E?.isLogged;return f.useEffect(()=>{y.current||(y.current=!0,l.interceptors.response.use(h=>h,async h=>(typeof h=="object"&&h&&"response"in h&&h.response&&typeof h.response=="object"&&"status"in h.response&&h.response&&typeof h.response=="object"&&"status"in h.response&&h?.response?.status===401&&(l.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(d),v(a)),Promise.reject(h))))},[l.defaults.headers.common,l.interceptors.response,d,a]),j&&!s?P.jsx(f.Suspense,{fallback:e,children:C.state?.from?.state&&C.state?.from?.pathname===o?P.jsx(S,{to:C.state.from.state.from.pathname+C.state.from.state.from.search,replace:!0}):P.jsx(T,{})}):P.jsx(S,{to:o+C.search,state:{from:C},replace:!0})},ve=async()=>{if("caches"in window)try{const e=await caches.keys();await Promise.all(e.map(r=>caches.delete(r)))}catch(e){console.error("Failed to clear caches:",e)}},Ee=({autoUpdate:e,renderDialog:r,clearCachesOnReload:o})=>{const a=f.useRef(null),[n,i]=f.useState(!1),c=f.useCallback(()=>{a.current&&a.current.postMessage({type:"SKIP_WAITING"}),o&&localStorage.setItem("tracktor_clear_caches","1"),window.location.reload()},[o]);f.useEffect(()=>{localStorage.getItem("tracktor_clear_caches")==="1"&&(localStorage.removeItem("tracktor_clear_caches"),ve().catch(console.error))},[]);const u=f.useCallback(()=>{window.confirm("A new version is available. The app will reload now.")&&c()},[c]);return f.useEffect(()=>{if(!("serviceWorker"in navigator))return;let l,d;const s=g=>{g&&navigator.serviceWorker.controller&&(a.current=g,i(!0))},v=()=>{const g=l?.installing;g&&(d=()=>{g.state==="installed"&&s(g)},g.addEventListener("statechange",d))};return(async()=>{l=await navigator.serviceWorker.getRegistration(),l&&(s(l.waiting),l.addEventListener("updatefound",v))})().catch(console.error),()=>{l?.removeEventListener("updatefound",v),d&&l?.installing&&l.installing.removeEventListener("statechange",d)}},[]),f.useEffect(()=>{n&&e&&c()},[e,n,c]),f.useEffect(()=>{n&&!e&&!r&&u()},[r,u,n,e]),n&&!e&&r?r(c):null},we=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),be=e=>{const r=e.split(/[/\\]/).pop()||"";return r.substring(0,r.lastIndexOf("."))},Re=e=>{const a=e.split("/").filter(n=>n.length>0).map(n=>n.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join("")).join("");return a.charAt(0).toLowerCase()+a.slice(1)},_e=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),Se=(e,r,o,a)=>{const n=Re(r),i=we(o),c=`${n}${i}`;return e&&typeof e=="object"&&"operationId"in e&&a?.includes(String(e.operationId))?`${c}AsQuery`:c},Ae=(e,r)=>{const o={};return e?.forEach(a=>{o[a]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),r?.filter(a=>!o[a]).forEach(a=>{o[a]={query:{useQuery:!0}}}),Object.keys(o).length?o:void 0},Ce=e=>(Array.isArray(e)?e:[e]).reduce((o,a)=>{const{output:n,useInfiniteIds:i,useQueryIds:c,input:u="./openapi.json",customAxiosInstancePath:l,overrideApiName:d}=a||{},s=d||_e(u),v=l||"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";return{...o,[s]:{input:u,output:{baseUrl:n?.baseUrl,client:"react-query",mode:"tags-split",override:{...(i?.length||c?.length)&&{operations:Ae(i,c)},header:g=>["Generated by orval 🍺",...g.title?[g.title]:[],...g.description?[g.description]:[]],mutator:{name:be(v),path:v},operationName:(g,S,T)=>Se(g,S,T,c),query:{useQuery:!0}},schemas:n?.schemas||`src/api/${s}/model`,target:n?.target||`src/api/${s}/services/api.ts`,...n}}}},{}),je=e=>e&&typeof e=="function",Pe=e=>e&&typeof e=="function",Te=({children:e,defaultQueriesOptions:r,defaultMutationsOptions:o,...a})=>{const{libraries:n}=f.useContext(A),i=a?.QueryClient||n?.reactQuery?.QueryClient,c=a?.QueryClientProvider||n?.reactQuery?.QueryClientProvider;if(!i)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!c)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!je(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Pe(i))throw new Error("Provided QueryClient dependencies are not valid.");const u=new i({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(l,d,s)=>l.length+(s||0),refetchOnWindowFocus:!1,retry:3,...r}}});return P.jsx(c,{client:u,children:e})},K=({library:e,date:r,format:o="ll"})=>e(r).format(o),B=(e,r)=>{const{fractionDigits:o=0,metric:a="km",spacingBetween:n=!0}=r||{},i=Number(e),c=n?" ":"";return Number.isNaN(i)?`0${c}${a}`:`${i.toFixed(o)}${c}${a}`},H=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(o=>o.length>0?o.charAt(0).toUpperCase()+o.slice(1):o).join(" "),ke=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,Ie=({path:e,size:r,apiURL:o})=>{if(!e)return"";const a=ke(e),n=`${o}${a}`,i=n.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof r=="number"&&i?`${n.replace("/files",`/thumbs/${r}`)}`:n},Oe=e=>{const{apiURL:r,libraries:o}=f.useContext(A),a=e?.dayjs||o?.dayjs;return{dateAdapter:(c,u)=>{if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return K({date:c,format:u,library:a})},distanceAdapter:B,filePathAdapter:(c,u)=>{if(!r)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return typeof c=="string"&&/^https?:\/\//.test(c)?c:Ie({apiURL:r,path:c,size:u})},worksiteNameAdapter:H}},xe=e=>{const{libraries:r}=f.useContext(A),o=e?.axios||r?.axios,a=e?.localStorageKey||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const n=f.useCallback(({tokenType:c,accessToken:u})=>{o.defaults.headers.common.Authorization=`${c} ${u}`},[o.defaults.headers.common]),i=()=>{o.defaults.headers.common.Authorization=null};return f.useEffect(()=>{if(L)return;const c=({newValue:u,key:l})=>{if(l===a&&u)try{const{accessToken:d,tokenType:s}=JSON.parse(u);n({accessToken:d,tokenType:s})}catch(d){console.error("Failed to parse newValue from localStorage:",d)}};return window.addEventListener("storage",c),()=>{window.removeEventListener("storage",c)}},[a,n]),{clearAuthenticationToken:i,setAuthenticationToken:n}},D=(e,r)=>r==="short"?e.split("-")[0]:e,Ne=(e,r="full")=>{const[o,a]=f.useState(()=>{const n=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,D(n,r)});return f.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&a(D(e.language,r));const n=i=>{a(D(i,r))};return e?.on?.("languageChanged",n),()=>{e?.off?.("languageChanged",n)}},[e,r]),o},Le="tracktor.filter",Fe={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},De=e=>{try{const r=JSON.parse(e);return r!==null&&typeof r=="object"?r:e}catch{return e}},X=(e,r,o)=>`${o}_${e}=>${r}`,Ye=e=>e.reduce((r,o)=>{const a=localStorage.getItem(o);if(a)try{const n=JSON.parse(a),i=Object.keys(n)?.[0];i&&(r[i]=Object.values(n)?.[0])}catch{}return r},{}),We=e=>{const{libraries:r,localStorageKeys:o}=f.useContext(A),a=e?.reactRouter||r?.reactRouter,{pathname:n}=a?.useLocation?.()??{pathname:"/"},[i,c]=a?.useSearchParams?.()??[new URLSearchParams,()=>{}],[u,l]=f.useState({}),d=o?.filter||Le,s=e?.syncWithUrl===void 0?!0:e?.syncWithUrl;if(L)return Fe;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");const v=()=>Object.keys(localStorage).filter(y=>y.startsWith(d)&&y.endsWith(e?.pathname||n)),g=(y,E,j=!0)=>{const h=X(y,e?.pathname||n,d);if(!E||Array.isArray(E)&&!E.length){s?(i.delete(y),c(i)):l(b=>{const k={...b};return delete k[y],k}),localStorage.removeItem(h);return}j&&E&&localStorage.setItem(h,JSON.stringify({...i,[y]:E})),s&&E?(i.set(y,JSON.stringify(E)),c(i)):!s&&E&&l(b=>({...b,[y]:E}))};return{getFilter:(y,E)=>{if(!s){const b=u[y];if(b!==void 0)return b}if(s){const b=i.get(y);if(b)return De(b)}const j=X(y,e?.pathname||n,d),h=localStorage.getItem(j);if(h)try{const b=JSON.parse(h)[y];return!s&&b!==void 0&&l(k=>({...k,[y]:b})),b}catch{}return E},getFilters:()=>{const y=v(),E=Ye(y);if(s){const j=Object.fromEntries(i.entries());return{...E,...j}}return{...E,...u}},handleFilter:(y,E)=>(j,h)=>{if(h||Array.isArray(h)&&h.length===0){const b=E||"value",k=typeof h=="object"&&b in h?h[b]:h;g(y,k);return}g(y,void 0)},setFilter:g}},ze=({data:e,fetchNextPage:r,isFetchingNextPage:o,isInitialLoading:a,isLoading:n,enabled:i=!0})=>{const c=f.useCallback(async l=>{o||!i||await r({pageParam:l?.pageParam||l.visibleRowsCount})},[i,r,o]),u=f.useMemo(()=>{if(e)return e.pages.reduce((l,d)=>[...l,...d],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:o||n,loadingVariant:a?"skeleton":"linear-progress",rows:u}},Ue=e=>{const{libraries:r}=f.useContext(A),o=e?.i18||r?.i18,a=e?.i18?.translateFunction||r?.i18?.translateFunction,n=o?.i18next?.t||a||(d=>d),{unknownErrorTranslationKey:i="error.unknownError"}=e||{},c=n(i),u=f.useCallback(d=>{if(d&&typeof d=="object"&&"response"in d){const{response:s}=d||{};if(s&&typeof s=="object"&&"reason"in s&&s.reason)return String(s.reason);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"reason"in s.data&&s.data.reason)return String(s.data.reason);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"message"in s.data&&s.data.message)return String(s.data.message);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"detail"in s.data){const{detail:v}=s.data;if(Array.isArray(v)&&v.length>0&&typeof v[0]=="object"&&v[0]!==null&&"msg"in v[0]){const{msg:g}=v[0];if(typeof g=="string")return String(g)}}}return d instanceof Error?d.message:c},[c]);return{getErrorCode:f.useCallback(d=>{const{response:s}=d||{};return s?.error_code?String(s?.error_code):s?.data?.error_code?String(s?.data?.error_code):s?.error_code?String(s?.error_code):s?.data?.error_code?String(s.data.error_code):"unknown_error_code"},[]),printError:u}};m.GTMSendPageView=le,m.InitializeAxiosConfig=de,m.InitializeDaysJSConfig=fe,m.InitializeI18nConfig=pe,m.InitializeSentryConfig=ge,m.InjectDependenciesContext=A,m.InjectDependenciesProvider=ce,m.MaskTextField=ie,m.PreloadErrorHandler=me,m.QueryClientProviderWithConfig=Te,m.RequireAuth=he,m.UpdateNotifier=Ee,m.axiosCustomInstance=ne,m.dateAdapter=K,m.distanceAdapter=B,m.getOrvalConfig=Ce,m.useAdapter=Oe,m.useAuth=xe,m.useCurrentLanguage=Ne,m.useFilters=We,m.useInfiniteDataGrid=ze,m.useResponseError=Ue,m.worksiteNameAdapter=H,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
|
|
6
|
+
<%s key={someKey} {...props} />`,b,_,O,_),ne[_+b]=!0)}if(_=null,R!==void 0&&(o(R),_=""+R),c(p)&&(o(p.key),_=""+p.key),"key"in p){R={};for(var Q in p)Q!=="key"&&(R[Q]=p[Q])}else R=p;return _&&u(R,typeof t=="function"?t.displayName||t.name||"Unknown":t),d(t,_,R,n(),Y,M)}function v(t){g(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===W&&(t._payload.status==="fulfilled"?g(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function g(t){return typeof t=="object"&&t!==null&&t.$$typeof===k}var S=f,k=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),w=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),Me=Symbol.for("react.suspense"),Qe=Symbol.for("react.suspense_list"),Ve=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),Ge=Symbol.for("react.activity"),Je=Symbol.for("react.client.reference"),z=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,Ke=Array.isArray,U=console.createTask?console.createTask:function(){return null};S={react_stack_bottom_frame:function(t){return t()}};var $,ee={},te=S.react_stack_bottom_frame.bind(S,i)(),re=U(a(i)),ne={};N.Fragment=h,N.jsx=function(t,p,R){var b=1e4>z.recentlyCreatedOwnerStacks++;return s(t,p,R,!1,b?Error("react-stack-top-frame"):te,b?U(a(t)):re)},N.jsxs=function(t,p,R){var b=1e4>z.recentlyCreatedOwnerStacks++;return s(t,p,R,!0,b?Error("react-stack-top-frame"):te,b?U(a(t)):re)}})()),N}var J;function ie(){return J||(J=1,process.env.NODE_ENV==="production"?F.exports=ae():F.exports=se()),F.exports}var T=ie();const ce=({IMaskMixin:e,...r})=>{const o=f.useMemo(()=>e(({TextField:a,...n})=>T.jsx(a,{...n})),[e]);return T.jsx(o,{...r})},A=f.createContext({}),le=({children:e,apiURL:r,libraries:o,localStorageKeys:a})=>{const n=f.useMemo(()=>({apiURL:r,libraries:o,localStorageKeys:a}),[r,o,a]);return T.jsx(A.Provider,{value:n,children:e})},ue=({data:e,...r})=>{const{libraries:o}=f.useContext(A),a=r?.reactRouter||o?.reactRouter,n=r?.gtm||o?.gtm;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!n)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:i}=n,{useLocation:c,Outlet:u}=a,{pathname:l}=c(),{sendEvent:d}=i();return f.useEffect(()=>{d({event:"pageView",pathname:l,...e})},[e,l,d]),T.jsx(u,{})},L=(()=>{try{return typeof global=="object"&&global!==null&&("HermesInternal"in global||"__fbBatchedBridge"in global||"__metro"in global)||typeof window>"u"&&typeof global<"u"?!0:typeof navigator<"u"&&navigator.userAgent?/react.native|ReactNative/i.test(navigator.userAgent):!1}catch{return!1}})(),de="user",fe=({tokenTypeKey:e="tokenType",tokenKey:r="accessToken",postContentType:o="application/json",...a})=>{const{apiURL:n=a.apiURL,libraries:i,localStorageKeys:c}=f.useContext(A),u=a?.userLocalStorageKey||c?.user||de,l=a?.axios||i?.axios;if(!l)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l?.defaults||L)return null;if(typeof window<"u"&&window.localStorage){const d=localStorage.getItem(u),s=d?JSON.parse(d):null,v=s?.[e]?s[e]:null,g=s?.[r]?s[r]:null,S=d?`${v} ${g}`:null;S&&(l.defaults.headers.common.Authorization=S)}return l.defaults.baseURL=n,l.defaults.headers.post["Content-Type"]=o,null},pe=({language:e,...r})=>{const{libraries:o}=f.useContext(A),a=r?.dayjs||o?.dayjs,n=r?.plugin||o?.dayjsPlugin;if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return f.useEffect(()=>{(async()=>{const c=e||navigator.language?.slice(0,2)||"en";n&&n.forEach(u=>{u&&a.extend(u)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),a.locale(c)})().then()},[a,n,e]),null},ge=({debug:e,resources:r,...o})=>{const{libraries:a}=f.useContext(A),n=o?.i18||a?.i18,{i18next:i,initReactI18next:c,languageDetector:u}=n||{};if(L)return null;if(!n)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return i?.isInitialized||(i.use(u).use(c).init({debug:e,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:r,returnNull:!1}).then(()=>{document.documentElement.lang!==i.resolvedLanguage&&i.resolvedLanguage&&document.documentElement.setAttribute("lang",i.resolvedLanguage)}),i.on("languageChanged",l=>{document.documentElement.setAttribute("lang",l)})),null},me=({dsn:e,integrations:r,tracesSampleRate:o,replaysSessionSampleRate:a,replaysOnErrorSampleRate:n,tracePropagationTargets:i,ignoreErrors:c,debug:u,environment:l,release:d,...s})=>{const{libraries:v}=f.useContext(A),g=s?.sentry||v?.sentry,S=s?.reactRouter||v?.reactRouter;if(!g)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!S)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(g.isInitialized())return null;const{createRoutesFromChildren:k,matchRoutes:C,useLocation:h,useNavigationType:E}=S;return(u||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&g.init({debug:u,dsn:e,environment:l||"production",ignoreErrors:[...c||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[g.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:k,matchRoutes:C,useEffect:f.useEffect,useLocation:h,useNavigationType:E}),...r||[]],release:d,replaysOnErrorSampleRate:n||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:i,tracesSampleRate:o||1}),null},ye=()=>(f.useEffect(()=>{if(L)return;const e=r=>{try{r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",e),()=>{window.removeEventListener("vite:preloadError",e)}},[]),null),he="user",ve=({Fallback:e,isLogged:r,loginPath:o="/login",redirect401Path:a="/login",...n})=>{const{libraries:i,localStorageKeys:c}=f.useContext(A),u=n?.reactRouter||i?.reactRouter,l=n?.axios||i?.axios,d=n?.localStorageKey||c?.user||he;if(!u)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[s,v]=f.useState(null),{useLocation:g,Navigate:S,Outlet:k}=u,C=g(),h=f.useRef(!1),E=typeof r=="function"?r():!!r,P=typeof E=="boolean"?E:E?.isLogged;return f.useEffect(()=>{h.current||(h.current=!0,l.interceptors.response.use(m=>m,async m=>(typeof m=="object"&&m&&"response"in m&&m.response&&typeof m.response=="object"&&"status"in m.response&&m.response&&typeof m.response=="object"&&"status"in m.response&&m?.response?.status===401&&(l.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(d),v(a)),Promise.reject(m))))},[l.defaults.headers.common,l.interceptors.response,d,a]),P&&!s?T.jsx(f.Suspense,{fallback:e,children:C.state?.from?.state&&C.state?.from?.pathname===o?T.jsx(S,{to:C.state.from.state.from.pathname+C.state.from.state.from.search,replace:!0}):T.jsx(k,{})}):T.jsx(S,{to:o+C.search,state:{from:C},replace:!0})},Ee=async()=>{if("caches"in window)try{const e=await caches.keys();await Promise.all(e.map(r=>caches.delete(r)))}catch(e){console.error("Failed to clear caches:",e)}},we=({autoUpdate:e,renderDialog:r,clearCachesOnReload:o})=>{const a=f.useRef(null),[n,i]=f.useState(!1),c=f.useCallback(()=>{a.current&&a.current.postMessage({type:"SKIP_WAITING"}),o&&localStorage.setItem("tracktor_clear_caches","1"),window.location.reload()},[o]);f.useEffect(()=>{localStorage.getItem("tracktor_clear_caches")==="1"&&(localStorage.removeItem("tracktor_clear_caches"),Ee().catch(console.error))},[]);const u=f.useCallback(()=>{window.confirm("A new version is available. The app will reload now.")&&c()},[c]);return f.useEffect(()=>{if(!("serviceWorker"in navigator))return;let l,d;const s=g=>{g&&navigator.serviceWorker.controller&&(a.current=g,i(!0))},v=()=>{const g=l?.installing;g&&(d=()=>{g.state==="installed"&&s(g)},g.addEventListener("statechange",d))};return(async()=>{l=await navigator.serviceWorker.getRegistration(),l&&(s(l.waiting),l.addEventListener("updatefound",v))})().catch(console.error),()=>{l?.removeEventListener("updatefound",v),d&&l?.installing&&l.installing.removeEventListener("statechange",d)}},[]),f.useEffect(()=>{n&&e&&c()},[e,n,c]),f.useEffect(()=>{n&&!e&&!r&&u()},[r,u,n,e]),n&&!e&&r?r(c):null},Re=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),be=e=>{const r=e.split(/[/\\]/).pop()||"";return r.substring(0,r.lastIndexOf("."))},_e=e=>{const a=e.split("/").filter(n=>n.length>0).map(n=>n.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join("")).join("");return a.charAt(0).toLowerCase()+a.slice(1)},Se=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),Ae=(e,r,o,a)=>{const n=_e(r),i=Re(o),c=`${n}${i}`;return e&&typeof e=="object"&&"operationId"in e&&a?.includes(String(e.operationId))?`${c}AsQuery`:c},Ce=(e,r)=>{const o={};return e?.forEach(a=>{o[a]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),r?.filter(a=>!o[a]).forEach(a=>{o[a]={query:{useQuery:!0}}}),Object.keys(o).length?o:void 0},je=e=>(Array.isArray(e)?e:[e]).reduce((o,a)=>{const{output:n,useInfiniteIds:i,useQueryIds:c,input:u="./openapi.json",customAxiosInstancePath:l,overrideApiName:d}=a||{},s=d||Se(u),v=l||"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";return{...o,[s]:{input:u,output:{baseUrl:n?.baseUrl,client:"react-query",mode:"tags-split",override:{...(i?.length||c?.length)&&{operations:Ce(i,c)},header:g=>["Generated by orval 🍺",...g.title?[g.title]:[],...g.description?[g.description]:[]],mutator:{name:be(v),path:v},operationName:(g,S,k)=>Ae(g,S,k,c),query:{useQuery:!0}},schemas:n?.schemas||`src/api/${s}/model`,target:n?.target||`src/api/${s}/services/api.ts`,...n}}}},{}),Pe=e=>e&&typeof e=="function",Te=e=>e&&typeof e=="function",ke=({children:e,defaultQueriesOptions:r,defaultMutationsOptions:o,...a})=>{const{libraries:n}=f.useContext(A),i=a?.QueryClient||n?.reactQuery?.QueryClient,c=a?.QueryClientProvider||n?.reactQuery?.QueryClientProvider;if(!i)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!c)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!Pe(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Te(i))throw new Error("Provided QueryClient dependencies are not valid.");const u=new i({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(l,d,s)=>l.length+(s||0),refetchOnWindowFocus:!1,retry:3,...r}}});return T.jsx(c,{client:u,children:e})},K=({library:e,date:r,format:o="ll"})=>e(r).format(o),B=(e,r)=>{const{fractionDigits:o=0,metric:a="km",spacingBetween:n=!0}=r||{},i=Number(e),c=n?" ":"";return Number.isNaN(i)?`0${c}${a}`:`${i.toFixed(o)}${c}${a}`},H=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(o=>o.length>0?o.charAt(0).toUpperCase()+o.slice(1):o).join(" "),Ie=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,Oe=({path:e,size:r,apiURL:o})=>{if(!e)return"";const a=Ie(e),n=`${o}${a}`,i=n.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof r=="number"&&i?`${n.replace("/files",`/thumbs/${r}`)}`:n},xe=e=>{const{apiURL:r,libraries:o}=f.useContext(A),a=e?.dayjs||o?.dayjs;return{dateAdapter:(c,u)=>{if(!a)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return K({date:c,format:u,library:a})},distanceAdapter:B,filePathAdapter:(c,u)=>{if(!r)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return typeof c=="string"&&/^https?:\/\//.test(c)?c:Oe({apiURL:r,path:c,size:u})},worksiteNameAdapter:H}},Ne=e=>{const{libraries:r}=f.useContext(A),o=e?.axios||r?.axios,a=e?.localStorageKey||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const n=f.useCallback(({tokenType:c,accessToken:u})=>{o.defaults.headers.common.Authorization=`${c} ${u}`},[o.defaults.headers.common]),i=()=>{o.defaults.headers.common.Authorization=null};return f.useEffect(()=>{if(L)return;const c=({newValue:u,key:l})=>{if(l===a&&u)try{const{accessToken:d,tokenType:s}=JSON.parse(u);n({accessToken:d,tokenType:s})}catch(d){console.error("Failed to parse newValue from localStorage:",d)}};return window.addEventListener("storage",c),()=>{window.removeEventListener("storage",c)}},[a,n]),{clearAuthenticationToken:i,setAuthenticationToken:n}},D=(e,r)=>r==="short"?e.split("-")[0]:e,Le=(e,r="full")=>{const[o,a]=f.useState(()=>{const n=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,D(n,r)});return f.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&a(D(e.language,r));const n=i=>{a(D(i,r))};return e?.on?.("languageChanged",n),()=>{e?.off?.("languageChanged",n)}},[e,r]),o},Fe="tracktor.filter",De={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},X=e=>{try{return JSON.parse(e)}catch{return e}},Z=(e,r,o)=>`${o}_${e}=>${r}`,Ye=e=>e.reduce((r,o)=>{const a=localStorage.getItem(o);if(a)try{const n=JSON.parse(a),i=Object.keys(n)?.[0];i&&(r[i]=Object.values(n)?.[0])}catch{}return r},{}),We=e=>{const{libraries:r,localStorageKeys:o}=f.useContext(A),a=e?.reactRouter||r?.reactRouter,{pathname:n}=a?.useLocation?.()??{pathname:"/"},[i,c]=a?.useSearchParams?.()??[new URLSearchParams,()=>{}],[u,l]=f.useState({}),d=o?.filter||Fe,s=e?.syncWithUrl===void 0?!0:e?.syncWithUrl;if(L)return De;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter.");const v=()=>Object.keys(localStorage).filter(h=>h.startsWith(d)&&h.endsWith(e?.pathname||n)),g=(h,E,P=!0)=>{const m=Z(h,e?.pathname||n,d);if(!E||Array.isArray(E)&&!E.length){s?(i.delete(h),c(i)):l(w=>{const j={...w};return delete j[h],j}),localStorage.removeItem(m);return}P&&E&&localStorage.setItem(m,JSON.stringify({...i,[h]:E})),s&&E?(i.set(h,JSON.stringify(E)),c(i)):!s&&E&&l(w=>({...w,[h]:E}))};return{getFilter:(h,E)=>{if(!s){const w=u[h];if(w!==void 0)return w}if(s){const w=i.get(h);if(w)return X(w)}const P=Z(h,e?.pathname||n,d),m=localStorage.getItem(P);if(m)try{const w=JSON.parse(m)[h];return!s&&w!==void 0&&l(j=>({...j,[h]:w})),w}catch{}return E},getFilters:()=>{const h=v(),E=Ye(h);if(s){const P=Array.from(i.entries()).reduce((m,[w,j])=>(m[w]=X(j),m),{});return{...E,...P}}return{...E,...u}},handleFilter:(h,E)=>(P,m)=>{if(m||Array.isArray(m)&&m.length===0){const w=E||"value",j=typeof m=="object"&&w in m?m[w]:m;g(h,j);return}g(h,void 0)},setFilter:g}},ze=({data:e,fetchNextPage:r,isFetchingNextPage:o,isInitialLoading:a,isLoading:n,enabled:i=!0})=>{const c=f.useCallback(async l=>{o||!i||await r({pageParam:l?.pageParam||l.visibleRowsCount})},[i,r,o]),u=f.useMemo(()=>{if(e)return e.pages.reduce((l,d)=>[...l,...d],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:o||n,loadingVariant:a?"skeleton":"linear-progress",rows:u}},Ue=e=>{const{libraries:r}=f.useContext(A),o=e?.i18||r?.i18,a=e?.i18?.translateFunction||r?.i18?.translateFunction,n=o?.i18next?.t||a||(d=>d),{unknownErrorTranslationKey:i="error.unknownError"}=e||{},c=n(i),u=f.useCallback(d=>{if(d&&typeof d=="object"&&"response"in d){const{response:s}=d||{};if(s&&typeof s=="object"&&"reason"in s&&s.reason)return String(s.reason);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"reason"in s.data&&s.data.reason)return String(s.data.reason);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"message"in s.data&&s.data.message)return String(s.data.message);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"detail"in s.data){const{detail:v}=s.data;if(Array.isArray(v)&&v.length>0&&typeof v[0]=="object"&&v[0]!==null&&"msg"in v[0]){const{msg:g}=v[0];if(typeof g=="string")return String(g)}}}return d instanceof Error?d.message:c},[c]);return{getErrorCode:f.useCallback(d=>{const{response:s}=d||{};return s?.error_code?String(s?.error_code):s?.data?.error_code?String(s?.data?.error_code):s?.error_code?String(s?.error_code):s?.data?.error_code?String(s.data.error_code):"unknown_error_code"},[]),printError:u}};y.GTMSendPageView=ue,y.InitializeAxiosConfig=fe,y.InitializeDaysJSConfig=pe,y.InitializeI18nConfig=ge,y.InitializeSentryConfig=me,y.InjectDependenciesContext=A,y.InjectDependenciesProvider=le,y.MaskTextField=ce,y.PreloadErrorHandler=ye,y.QueryClientProviderWithConfig=ke,y.RequireAuth=ve,y.UpdateNotifier=we,y.axiosCustomInstance=oe,y.dateAdapter=K,y.distanceAdapter=B,y.getOrvalConfig=je,y.useAdapter=xe,y.useAuth=Ne,y.useCurrentLanguage=Le,y.useFilters=We,y.useInfiniteDataGrid=ze,y.useResponseError=Ue,y.worksiteNameAdapter=H,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
|