@tracktor/shared-module 2.19.4 → 2.19.5

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.
@@ -0,0 +1 @@
1
+ export {};
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import X from "axios";
2
2
  import de, { useMemo as M, createContext as fe, useContext as j, useEffect as A, useState as Y, useRef as ne, Suspense as pe, useCallback as x } from "react";
3
- const De = (e, r) => {
3
+ const Ye = (e, r) => {
4
4
  const o = X.CancelToken.source(), a = X({
5
5
  ...e,
6
6
  ...r,
@@ -15,7 +15,7 @@ var Z;
15
15
  function ge() {
16
16
  if (Z) return O;
17
17
  Z = 1;
18
- var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
18
+ var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), r = /* @__PURE__ */ Symbol.for("react.fragment");
19
19
  function o(a, n, i) {
20
20
  var c = null;
21
21
  if (i !== void 0 && (c = "" + i), n.key !== void 0 && (c = "" + n.key), "key" in n) {
@@ -66,7 +66,7 @@ function me() {
66
66
  return t.displayName || "Context";
67
67
  case m:
68
68
  return (t._context.displayName || "Context") + ".Consumer";
69
- case T:
69
+ case k:
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
72
  case se:
@@ -146,7 +146,7 @@ function me() {
146
146
  function d(t, f, v, w, F, Q) {
147
147
  var R = v.ref;
148
148
  return t = {
149
- $$typeof: k,
149
+ $$typeof: T,
150
150
  type: t,
151
151
  key: f,
152
152
  props: v,
@@ -228,9 +228,9 @@ 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 === k;
231
+ return typeof t == "object" && t !== null && t.$$typeof === T;
232
232
  }
233
- var b = de, k = Symbol.for("react.transitional.element"), S = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), h = Symbol.for("react.strict_mode"), P = Symbol.for("react.profiler"), m = Symbol.for("react.consumer"), E = Symbol.for("react.context"), T = Symbol.for("react.forward_ref"), oe = Symbol.for("react.suspense"), ae = Symbol.for("react.suspense_list"), se = Symbol.for("react.memo"), W = Symbol.for("react.lazy"), ie = Symbol.for("react.activity"), ce = Symbol.for("react.client.reference"), z = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, G = Object.prototype.hasOwnProperty, le = Array.isArray, U = console.createTask ? console.createTask : function() {
233
+ var b = de, T = /* @__PURE__ */ Symbol.for("react.transitional.element"), S = /* @__PURE__ */ Symbol.for("react.portal"), g = /* @__PURE__ */ Symbol.for("react.fragment"), h = /* @__PURE__ */ Symbol.for("react.strict_mode"), P = /* @__PURE__ */ Symbol.for("react.profiler"), m = /* @__PURE__ */ Symbol.for("react.consumer"), E = /* @__PURE__ */ Symbol.for("react.context"), k = /* @__PURE__ */ Symbol.for("react.forward_ref"), oe = /* @__PURE__ */ Symbol.for("react.suspense"), ae = /* @__PURE__ */ Symbol.for("react.suspense_list"), se = /* @__PURE__ */ Symbol.for("react.memo"), W = /* @__PURE__ */ Symbol.for("react.lazy"), ie = /* @__PURE__ */ Symbol.for("react.activity"), ce = /* @__PURE__ */ Symbol.for("react.client.reference"), z = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, G = Object.prototype.hasOwnProperty, le = Array.isArray, U = console.createTask ? console.createTask : function() {
234
234
  return null;
235
235
  };
236
236
  b = {
@@ -270,14 +270,14 @@ function ye() {
270
270
  return te || (te = 1, process.env.NODE_ENV === "production" ? $.exports = ge() : $.exports = me()), $.exports;
271
271
  }
272
272
  var C = ye();
273
- const Ye = ({ IMaskMixin: e, ...r }) => {
273
+ const We = ({ IMaskMixin: e, ...r }) => {
274
274
  const o = M(
275
275
  // eslint-disable-next-line react/jsx-props-no-spreading
276
276
  () => e(({ TextField: a, ...n }) => /* @__PURE__ */ C.jsx(a, { ...n })),
277
277
  [e]
278
278
  );
279
279
  return /* @__PURE__ */ C.jsx(o, { ...r });
280
- }, _ = fe({}), We = ({ children: e, apiURL: r, libraries: o, localStorageKeys: a }) => {
280
+ }, _ = fe({}), ze = ({ children: e, apiURL: r, libraries: o, localStorageKeys: a }) => {
281
281
  const n = M(
282
282
  () => ({
283
283
  apiURL: r,
@@ -287,7 +287,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
287
287
  [r, o, a]
288
288
  );
289
289
  return /* @__PURE__ */ C.jsx(_.Provider, { value: n, children: e });
290
- }, ze = ({ data: e, ...r }) => {
290
+ }, Ue = ({ data: e, ...r }) => {
291
291
  const { libraries: o } = j(_), a = r?.reactRouter || o?.reactRouter, n = r?.gtm || o?.gtm;
292
292
  if (!a)
293
293
  throw new Error(
@@ -311,7 +311,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
311
311
  } catch {
312
312
  return !1;
313
313
  }
314
- })(), he = "user", Ue = ({
314
+ })(), he = "user", Qe = ({
315
315
  tokenTypeKey: e = "tokenType",
316
316
  tokenKey: r = "accessToken",
317
317
  postContentType: o = "application/json",
@@ -327,7 +327,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
327
327
  b && (l.defaults.headers.common.Authorization = b);
328
328
  }
329
329
  return l.defaults.baseURL = n, l.defaults.headers.post["Content-Type"] = o, null;
330
- }, Qe = ({ language: e, ...r }) => {
330
+ }, Ve = ({ language: e, ...r }) => {
331
331
  const { libraries: o } = j(_), a = r?.dayjs || o?.dayjs, n = r?.plugin || o?.dayjsPlugin;
332
332
  if (!a)
333
333
  throw new Error(
@@ -341,7 +341,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
341
341
  }), await import("dayjs/locale/en"), await import("dayjs/locale/fr"), a.locale(c);
342
342
  })().then();
343
343
  }, [a, n, e]), null;
344
- }, Ve = ({ debug: e, resources: r, ...o }) => {
344
+ }, Me = ({ debug: e, resources: r, ...o }) => {
345
345
  const { libraries: a } = j(_), n = o?.i18 || a?.i18, { i18next: i, initReactI18next: c, languageDetector: u } = n || {};
346
346
  if (L)
347
347
  return null;
@@ -365,7 +365,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
365
365
  }), i.on("languageChanged", (l) => {
366
366
  document.documentElement.setAttribute("lang", l);
367
367
  })), null;
368
- }, Me = ({
368
+ }, Ge = ({
369
369
  dsn: e,
370
370
  integrations: r,
371
371
  tracesSampleRate: o,
@@ -385,7 +385,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
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: k, matchRoutes: S, useLocation: g, useNavigationType: h } = b;
388
+ const { createRoutesFromChildren: T, matchRoutes: S, useLocation: g, useNavigationType: h } = b;
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,7 +401,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
401
401
  ],
402
402
  integrations: [
403
403
  p.reactRouterV6BrowserTracingIntegration({
404
- createRoutesFromChildren: k,
404
+ createRoutesFromChildren: T,
405
405
  matchRoutes: S,
406
406
  useEffect: A,
407
407
  useLocation: g,
@@ -415,7 +415,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
415
415
  tracePropagationTargets: i,
416
416
  tracesSampleRate: o || 1
417
417
  }), null;
418
- }, Ge = () => (A(() => {
418
+ }, Je = () => (A(() => {
419
419
  if (L)
420
420
  return;
421
421
  const e = (r) => {
@@ -427,17 +427,17 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
427
427
  return window.addEventListener("vite:preloadError", e), () => {
428
428
  window.removeEventListener("vite:preloadError", e);
429
429
  };
430
- }, []), null), ve = "user", Je = ({ Fallback: e, isLogged: r, loginPath: o = "/login", redirect401Path: a = "/login", ...n }) => {
430
+ }, []), null), ve = "user", Ke = ({ Fallback: e, isLogged: r, loginPath: o = "/login", redirect401Path: a = "/login", ...n }) => {
431
431
  const { libraries: i, localStorageKeys: c } = j(_), u = n?.reactRouter || i?.reactRouter, l = n?.axios || i?.axios, d = n?.localStorageKey || c?.user || ve;
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: b, Outlet: k } = u, S = p(), g = ne(!1), h = typeof r == "function" ? r() : !!r, P = typeof h == "boolean" ? h : h?.isLogged;
434
+ const [s, y] = Y(null), { useLocation: p, Navigate: b, Outlet: T } = u, S = p(), g = ne(!1), h = typeof r == "function" ? r() : !!r, P = typeof h == "boolean" ? h : h?.isLogged;
435
435
  return A(() => {
436
436
  g.current || (g.current = !0, l.interceptors.response.use(
437
437
  (m) => m,
438
438
  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), y(a)), Promise.reject(m))
439
439
  ));
440
- }, [l.defaults.headers.common, l.interceptors.response, d, a]), P && !s ? /* @__PURE__ */ C.jsx(pe, { fallback: e, children: S.state?.from?.state && S.state?.from?.pathname === o ? /* @__PURE__ */ C.jsx(b, { to: S.state.from.state.from.pathname + S.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ C.jsx(k, {}) }) : /* @__PURE__ */ C.jsx(b, { to: o + S.search, state: { from: S }, replace: !0 });
440
+ }, [l.defaults.headers.common, l.interceptors.response, d, a]), P && !s ? /* @__PURE__ */ C.jsx(pe, { fallback: e, children: S.state?.from?.state && S.state?.from?.pathname === o ? /* @__PURE__ */ C.jsx(b, { to: S.state.from.state.from.pathname + S.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ C.jsx(T, {}) }) : /* @__PURE__ */ C.jsx(b, { to: o + S.search, state: { from: S }, replace: !0 });
441
441
  }, Ee = async () => {
442
442
  if ("caches" in window)
443
443
  try {
@@ -446,7 +446,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
446
446
  } catch (e) {
447
447
  console.error("Failed to clear caches:", e);
448
448
  }
449
- }, Ke = ({ autoUpdate: e, renderDialog: r, clearCachesOnReload: o }) => {
449
+ }, qe = ({ autoUpdate: e, renderDialog: r, clearCachesOnReload: o }) => {
450
450
  const a = ne(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]);
@@ -504,7 +504,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
504
504
  }
505
505
  };
506
506
  }), Object.keys(o).length ? o : void 0;
507
- }, qe = (e) => (Array.isArray(e) ? e : [e]).reduce((o, a) => {
507
+ }, Be = (e) => (Array.isArray(e) ? e : [e]).reduce((o, a) => {
508
508
  const { output: n, useInfiniteIds: i, useQueryIds: c, input: u = "./openapi.json", customAxiosInstancePath: l, overrideApiName: d } = a || {}, s = d || _e(u), y = l || "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";
509
509
  return {
510
510
  ...o,
@@ -527,7 +527,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
527
527
  name: Re(y),
528
528
  path: y
529
529
  },
530
- operationName: (p, b, k) => Se(p, b, k, c),
530
+ operationName: (p, b, T) => Se(p, b, T, c),
531
531
  query: {
532
532
  useQuery: !0
533
533
  }
@@ -538,7 +538,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
538
538
  }
539
539
  }
540
540
  };
541
- }, {}), je = (e) => e && typeof e == "function", Pe = (e) => e && typeof e == "function", Be = ({
541
+ }, {}), je = (e) => e && typeof e == "function", Pe = (e) => e && typeof e == "function", He = ({
542
542
  children: e,
543
543
  defaultQueriesOptions: r,
544
544
  defaultMutationsOptions: o,
@@ -575,7 +575,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
575
575
  return "";
576
576
  const a = Ie(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
- }, He = (e) => {
578
+ }, Xe = (e) => {
579
579
  const { apiURL: r, libraries: o } = j(_), a = e?.dayjs || o?.dayjs;
580
580
  return {
581
581
  dateAdapter: (c, u) => {
@@ -601,7 +601,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
601
601
  },
602
602
  worksiteNameAdapter: Ce
603
603
  };
604
- }, Xe = (e) => {
604
+ }, Ze = (e) => {
605
605
  const { libraries: r } = j(_), 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.");
@@ -632,7 +632,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
632
632
  clearAuthenticationToken: i,
633
633
  setAuthenticationToken: n
634
634
  };
635
- }, D = (e, r) => r === "short" ? e.split("-")[0] : e, Ze = (e, r = "full") => {
635
+ }, D = (e, r) => r === "short" ? e.split("-")[0] : e, et = (e, r = "full") => {
636
636
  const [o, a] = Y(() => {
637
637
  const n = e?.language || navigator.language;
638
638
  return e && "isInitialized" in e && e.isInitialized, D(n, r);
@@ -654,7 +654,14 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
654
654
  },
655
655
  setFilter: () => {
656
656
  }
657
- }, re = (e, r, o) => `${o}_${e}=>${r}`, Le = (e) => e.reduce((r, o) => {
657
+ }, Le = (e) => {
658
+ try {
659
+ const r = JSON.parse(e);
660
+ return r !== null && typeof r == "object" ? r : e;
661
+ } catch {
662
+ return e;
663
+ }
664
+ }, re = (e, r, o) => `${o}_${e}=>${r}`, Fe = (e) => e.reduce((r, o) => {
658
665
  const a = localStorage.getItem(o);
659
666
  if (a)
660
667
  try {
@@ -663,7 +670,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
663
670
  } catch {
664
671
  }
665
672
  return r;
666
- }, {}), et = (e) => {
673
+ }, {}), tt = (e) => {
667
674
  const { libraries: r, localStorageKeys: o } = j(_), a = e?.reactRouter || r?.reactRouter, { pathname: n } = a?.useLocation?.() ?? { pathname: "/" }, [i, c] = a?.useSearchParams?.() ?? [new URLSearchParams(), () => {
668
675
  }], [u, l] = Y({}), d = o?.filter || Oe, s = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl;
669
676
  if (L)
@@ -678,8 +685,8 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
678
685
  const m = re(g, e?.pathname || n, d);
679
686
  if (!h || Array.isArray(h) && !h.length) {
680
687
  s ? (i.delete(g), c(i)) : l((E) => {
681
- const T = { ...E };
682
- return delete T[g], T;
688
+ const k = { ...E };
689
+ return delete k[g], k;
683
690
  }), localStorage.removeItem(m);
684
691
  return;
685
692
  }
@@ -695,23 +702,19 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
695
702
  if (s) {
696
703
  const E = i.get(g);
697
704
  if (E)
698
- try {
699
- return JSON.parse(E);
700
- } catch {
701
- return E;
702
- }
705
+ return Le(E);
703
706
  }
704
707
  const P = re(g, e?.pathname || n, d), m = localStorage.getItem(P);
705
708
  if (m)
706
709
  try {
707
710
  const E = JSON.parse(m)[g];
708
- return !s && E !== void 0 && l((T) => ({ ...T, [g]: E })), E;
711
+ return !s && E !== void 0 && l((k) => ({ ...k, [g]: E })), E;
709
712
  } catch {
710
713
  }
711
714
  return h;
712
715
  },
713
716
  getFilters: () => {
714
- const g = y(), h = Le(g);
717
+ const g = y(), h = Fe(g);
715
718
  if (s) {
716
719
  const P = Object.fromEntries(i.entries());
717
720
  return {
@@ -726,15 +729,15 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
726
729
  },
727
730
  handleFilter: (g, h) => (P, m) => {
728
731
  if (m || Array.isArray(m) && m.length === 0) {
729
- const E = h || "value", T = typeof m == "object" && E in m ? m[E] : m;
730
- p(g, T);
732
+ const E = h || "value", k = typeof m == "object" && E in m ? m[E] : m;
733
+ p(g, k);
731
734
  return;
732
735
  }
733
736
  p(g, void 0);
734
737
  },
735
738
  setFilter: p
736
739
  };
737
- }, tt = ({
740
+ }, rt = ({
738
741
  data: e,
739
742
  fetchNextPage: r,
740
743
  isFetchingNextPage: o,
@@ -757,7 +760,7 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
757
760
  loadingVariant: a ? "skeleton" : "linear-progress",
758
761
  rows: u
759
762
  };
760
- }, rt = (e) => {
763
+ }, nt = (e) => {
761
764
  const { libraries: r } = j(_), 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(
762
765
  (d) => {
763
766
  if (d && typeof d == "object" && "response" in d) {
@@ -787,27 +790,27 @@ const Ye = ({ IMaskMixin: e, ...r }) => {
787
790
  }, []), printError: u };
788
791
  };
789
792
  export {
790
- ze as GTMSendPageView,
791
- Ue as InitializeAxiosConfig,
792
- Qe as InitializeDaysJSConfig,
793
- Ve as InitializeI18nConfig,
794
- Me as InitializeSentryConfig,
793
+ Ue as GTMSendPageView,
794
+ Qe as InitializeAxiosConfig,
795
+ Ve as InitializeDaysJSConfig,
796
+ Me as InitializeI18nConfig,
797
+ Ge as InitializeSentryConfig,
795
798
  _ as InjectDependenciesContext,
796
- We as InjectDependenciesProvider,
797
- Ye as MaskTextField,
798
- Ge as PreloadErrorHandler,
799
- Be as QueryClientProviderWithConfig,
800
- Je as RequireAuth,
801
- Ke as UpdateNotifier,
802
- De as axiosCustomInstance,
799
+ ze as InjectDependenciesProvider,
800
+ We as MaskTextField,
801
+ Je as PreloadErrorHandler,
802
+ He as QueryClientProviderWithConfig,
803
+ Ke as RequireAuth,
804
+ qe as UpdateNotifier,
805
+ Ye as axiosCustomInstance,
803
806
  Te as dateAdapter,
804
807
  ke as distanceAdapter,
805
- qe as getOrvalConfig,
806
- He as useAdapter,
807
- Xe as useAuth,
808
- Ze as useCurrentLanguage,
809
- et as useFilters,
810
- tt as useInfiniteDataGrid,
811
- rt as useResponseError,
808
+ Be as getOrvalConfig,
809
+ Xe as useAdapter,
810
+ Ze as useAuth,
811
+ et as useCurrentLanguage,
812
+ tt as useFilters,
813
+ rt as useInfiniteDataGrid,
814
+ nt as useResponseError,
812
815
  Ce as worksiteNameAdapter
813
816
  };
package/dist/main.umd.cjs CHANGED
@@ -1,6 +1,6 @@
1
- (function(m,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("axios"),require("react")):typeof define=="function"&&define.amd?define(["exports","axios","react"],I):(m=typeof globalThis<"u"?globalThis:m||self,I(m["@tracktor/shared-module"]={},m.axios,m.React))})(this,(function(m,I,f){"use strict";const ne=(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 oe(){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 ae(){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===Ge?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case y:return"Fragment";case j:return"Profiler";case E:return"StrictMode";case Ue:return"Suspense";case Me:return"SuspenseList";case Ve: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 b:return t.displayName||"Context";case h:return(t._context.displayName||"Context")+".Consumer";case P:var p=t.render;return t=t.displayName,t||(t=p.displayName||p.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Qe: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 w=p.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return w.call(p,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),r(t)}}function a(t){if(t===y)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(Z.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 w(){q||(q=!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))}w.isReactWarning=!0,Object.defineProperty(t,"key",{get:w,configurable:!0})}function l(){var t=e(this.type);return $[t]||($[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,w,R,Y,M){var _=w.ref;return t={$$typeof:k,type:t,key:p,props:w,_owner:R},(_!==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,w,R,Y,M){var _=p.children;if(_!==void 0)if(R)if(Je(_)){for(R=0;R<_.length;R++)v(_[R]);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(Z.call(p,"key")){_=e(t);var O=Object.keys(p).filter(function(Ke){return Ke!=="key"});R=0<O.length?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}",re[_+R]||(O=0<O.length?"{"+O.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(m,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("axios"),require("react")):typeof define=="function"&&define.amd?define(["exports","axios","react"],I):(m=typeof globalThis<"u"?globalThis:m||self,I(m["@tracktor/shared-module"]={},m.axios,m.React))})(this,(function(m,I,f){"use strict";const ne=(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 oe(){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 ae(){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 y:return"Fragment";case j: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 b:return t.displayName||"Context";case h:return(t._context.displayName||"Context")+".Consumer";case k: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 w=p.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return w.call(p,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),r(t)}}function a(t){if(t===y)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(Z.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 w(){q||(q=!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))}w.isReactWarning=!0,Object.defineProperty(t,"key",{get:w,configurable:!0})}function l(){var t=e(this.type);return $[t]||($[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,w,R,Y,M){var _=w.ref;return t={$$typeof:T,type:t,key:p,props:w,_owner:R},(_!==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,w,R,Y,M){var _=p.children;if(_!==void 0)if(R)if(Ke(_)){for(R=0;R<_.length;R++)v(_[R]);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(Z.call(p,"key")){_=e(t);var O=Object.keys(p).filter(function(Be){return Be!=="key"});R=0<O.length?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}",re[_+R]||(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===k}var S=f,k=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"),P=Symbol.for("react.forward_ref"),Ue=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),Qe=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),Ve=Symbol.for("react.activity"),Ge=Symbol.for("react.client.reference"),z=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,Je=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 T=se();const ie=({IMaskMixin:e,...r})=>{const o=f.useMemo(()=>e(({TextField:a,...n})=>T.jsx(a,{...n})),[e]);return T.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 T.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]),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}})(),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:k,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:k,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:k}=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?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})},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,k)=>Se(g,S,k,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 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(" "),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:()=>{}},X=(e,r,o)=>`${o}_${e}=>${r}`,De=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},{}),Ye=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 P={...b};return delete P[y],P}),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)try{return JSON.parse(b)}catch{return 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(P=>({...P,[y]:b})),b}catch{}return E},getFilters:()=>{const y=v(),E=De(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",P=typeof h=="object"&&b in h?h[b]:h;g(y,P);return}g(y,void 0)},setFilter:g}},We=({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}},ze=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=Ye,m.useInfiniteDataGrid=We,m.useResponseError=ze,m.worksiteNameAdapter=H,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
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"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tracktor/shared-module",
3
- "version": "2.19.4",
3
+ "version": "2.19.5",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "types": "./dist/main.d.ts",
@@ -42,7 +42,7 @@
42
42
  "@types/react": "^19.0.0",
43
43
  "@types/react-dom": "^19.0.0",
44
44
  "@vitejs/plugin-react": "^4.6.0",
45
- "@tracktor/biome-config-react": "^1.0.5",
45
+ "@tracktor/biome-config-react": "^1.4.0",
46
46
  "husky": "^8.0.3",
47
47
  "jsdom": "^22.1.0",
48
48
  "react": "^19.0.0",