@tracktor/shared-module 2.12.4 → 2.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
1
  # [Versions](https://github.com/Tracktor/shared-module/releases)
2
2
 
3
- ## v2.12.4
4
- - **[fix]** - export axiosCustomInstance
3
+ ## v2.13.0
4
+ - **[feat]** - Add `useQueryIds` to force useQuery instead useMutation
@@ -24,9 +24,14 @@ interface CustomOrvalConfig {
24
24
  baseUrl?: string;
25
25
  };
26
26
  /**
27
- * List of operations to use infinite query
27
+ * List of operations to use an infinite query
28
28
  */
29
- operationsToGenerateInfiniteQueryHook?: string[];
29
+ useInfiniteIds?: string[];
30
+ /**
31
+ * List of operations to force query
32
+ * Like POST requests that you want to use with useQuery instead of useMutation
33
+ */
34
+ useQueryIds?: string[];
30
35
  }
31
36
  interface OrvalConfig {
32
37
  [key: string]: CustomOrvalConfig;
@@ -48,11 +53,12 @@ export declare const convertRouteToCamelCase: (route: string) => string;
48
53
  export declare const generateApiName: (input: string) => string;
49
54
  /**
50
55
  * Generate the operation name for orval output
51
- * @param _
56
+ * @param operation
52
57
  * @param route
53
- * @param method
58
+ * @param verb
59
+ * @param useQueryIds
54
60
  */
55
- export declare const getOrvalOperationName: (_: any, route: string, method: string) => string;
61
+ export declare const getOrvalOperationName: (operation: unknown, route: string, verb: string, useQueryIds?: string[]) => string;
56
62
  /**
57
63
  * Get the orval config required for the generation
58
64
  */
package/dist/main.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var gt=Object.create;var De=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var yt=Object.getOwnPropertyNames;var mt=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty;var wt=(t,r,o,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of yt(r))!Et.call(t,a)&&a!==o&&De(t,a,{get:()=>r[a],enumerable:!(i=ht(r,a))||i.enumerable});return t};var Fe=(t,r,o)=>(o=t!=null?gt(mt(t)):{},wt(r||!t||!t.__esModule?De(o,"default",{value:t,enumerable:!0}):o,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react");var se={exports:{}},G={};/**
1
+ "use strict";var gt=Object.create;var Ie=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var yt=Object.getOwnPropertyNames;var mt=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty;var wt=(t,r,o,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of yt(r))!Et.call(t,a)&&a!==o&&Ie(t,a,{get:()=>r[a],enumerable:!(i=ht(r,a))||i.enumerable});return t};var Fe=(t,r,o)=>(o=t!=null?gt(mt(t)):{},wt(r||!t||!t.__esModule?Ie(o,"default",{value:t,enumerable:!0}):o,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react");var se={exports:{}},G={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Le;function Rt(){if(Le)return G;Le=1;var t=w,r=Symbol.for("react.element"),o=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function f(d,u,m){var g,P={},b=null,s=null;m!==void 0&&(b=""+m),u.key!==void 0&&(b=""+u.key),u.ref!==void 0&&(s=u.ref);for(g in u)i.call(u,g)&&!l.hasOwnProperty(g)&&(P[g]=u[g]);if(d&&d.defaultProps)for(g in u=d.defaultProps,u)P[g]===void 0&&(P[g]=u[g]);return{$$typeof:r,type:d,key:b,ref:s,props:P,_owner:a.current}}return G.Fragment=o,G.jsx=f,G.jsxs=f,G}var J={};/**
9
+ */var Le;function Rt(){if(Le)return G;Le=1;var t=w,r=Symbol.for("react.element"),o=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function l(d,u,h){var g,C={},_=null,s=null;h!==void 0&&(_=""+h),u.key!==void 0&&(_=""+u.key),u.ref!==void 0&&(s=u.ref);for(g in u)i.call(u,g)&&!f.hasOwnProperty(g)&&(C[g]=u[g]);if(d&&d.defaultProps)for(g in u=d.defaultProps,u)C[g]===void 0&&(C[g]=u[g]);return{$$typeof:r,type:d,key:_,ref:s,props:C,_owner:a.current}}return G.Fragment=o,G.jsx=l,G.jsxs=l,G}var J={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,12 +14,12 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var $e;function Ct(){return $e||($e=1,process.env.NODE_ENV!=="production"&&function(){var t=w,r=Symbol.for("react.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),d=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),s=Symbol.for("react.offscreen"),S=Symbol.iterator,C="@@iterator";function j(e){if(e===null||typeof e!="object")return null;var n=S&&e[S]||e[C];return typeof n=="function"?n:null}var h=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _(e){{for(var n=arguments.length,c=new Array(n>1?n-1:0),v=1;v<n;v++)c[v-1]=arguments[v];I("error",e,c)}}function I(e,n,c){{var v=h.ReactDebugCurrentFrame,R=v.getStackAddendum();R!==""&&(n+="%s",c=c.concat([R]));var p=c.map(function(E){return String(E)});p.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,p)}}var F=!1,L=!1,$=!1,x=!1,ue=!1,ee;ee=Symbol.for("react.module.reference");function q(e){return!!(typeof e=="string"||typeof e=="function"||e===i||e===l||ue||e===a||e===m||e===g||x||e===s||F||L||$||typeof e=="object"&&e!==null&&(e.$$typeof===b||e.$$typeof===P||e.$$typeof===f||e.$$typeof===d||e.$$typeof===u||e.$$typeof===ee||e.getModuleId!==void 0))}function Ve(e,n,c){var v=e.displayName;if(v)return v;var R=n.displayName||n.name||"";return R!==""?c+"("+R+")":c}function le(e){return e.displayName||"Context"}function W(e){if(e==null)return null;if(typeof e.tag=="number"&&_("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case i:return"Fragment";case o:return"Portal";case l:return"Profiler";case a:return"StrictMode";case m:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case d:var n=e;return le(n)+".Consumer";case f:var c=e;return le(c._context)+".Provider";case u:return Ve(e,e.render,"ForwardRef");case P:var v=e.displayName||null;return v!==null?v:W(e.type)||"Memo";case b:{var R=e,p=R._payload,E=R._init;try{return W(E(p))}catch{return null}}}return null}var z=Object.assign,U=0,fe,de,ve,ge,he,ye,me;function Ee(){}Ee.__reactDisabledLog=!0;function Me(){{if(U===0){fe=console.log,de=console.info,ve=console.warn,ge=console.error,he=console.group,ye=console.groupCollapsed,me=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ee,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}U++}}function Ue(){{if(U--,U===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},e,{value:fe}),info:z({},e,{value:de}),warn:z({},e,{value:ve}),error:z({},e,{value:ge}),group:z({},e,{value:he}),groupCollapsed:z({},e,{value:ye}),groupEnd:z({},e,{value:me})})}U<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=h.ReactCurrentDispatcher,re;function K(e,n,c){{if(re===void 0)try{throw Error()}catch(R){var v=R.stack.trim().match(/\n( *(at )?)/);re=v&&v[1]||""}return`
18
- `+re+e}}var ne=!1,Q;{var Ge=typeof WeakMap=="function"?WeakMap:Map;Q=new Ge}function we(e,n){if(!e||ne)return"";{var c=Q.get(e);if(c!==void 0)return c}var v;ne=!0;var R=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var p;p=te.current,te.current=null,Me();try{if(n){var E=function(){throw Error()};if(Object.defineProperty(E.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(E,[])}catch(N){v=N}Reflect.construct(e,[],E)}else{try{E.call()}catch(N){v=N}e.call(E.prototype)}}else{try{throw Error()}catch(N){v=N}e()}}catch(N){if(N&&v&&typeof N.stack=="string"){for(var y=N.stack.split(`
17
+ */var $e;function pt(){return $e||($e=1,process.env.NODE_ENV!=="production"&&function(){var t=w,r=Symbol.for("react.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),d=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),s=Symbol.for("react.offscreen"),b=Symbol.iterator,p="@@iterator";function j(e){if(e===null||typeof e!="object")return null;var n=b&&e[b]||e[p];return typeof n=="function"?n:null}var y=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(e){{for(var n=arguments.length,c=new Array(n>1?n-1:0),v=1;v<n;v++)c[v-1]=arguments[v];k("error",e,c)}}function k(e,n,c){{var v=y.ReactDebugCurrentFrame,R=v.getStackAddendum();R!==""&&(n+="%s",c=c.concat([R]));var P=c.map(function(E){return String(E)});P.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,P)}}var F=!1,L=!1,$=!1,x=!1,ue=!1,ee;ee=Symbol.for("react.module.reference");function q(e){return!!(typeof e=="string"||typeof e=="function"||e===i||e===f||ue||e===a||e===h||e===g||x||e===s||F||L||$||typeof e=="object"&&e!==null&&(e.$$typeof===_||e.$$typeof===C||e.$$typeof===l||e.$$typeof===d||e.$$typeof===u||e.$$typeof===ee||e.getModuleId!==void 0))}function Ue(e,n,c){var v=e.displayName;if(v)return v;var R=n.displayName||n.name||"";return R!==""?c+"("+R+")":c}function le(e){return e.displayName||"Context"}function W(e){if(e==null)return null;if(typeof e.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case i:return"Fragment";case o:return"Portal";case f:return"Profiler";case a:return"StrictMode";case h:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case d:var n=e;return le(n)+".Consumer";case l:var c=e;return le(c._context)+".Provider";case u:return Ue(e,e.render,"ForwardRef");case C:var v=e.displayName||null;return v!==null?v:W(e.type)||"Memo";case _:{var R=e,P=R._payload,E=R._init;try{return W(E(P))}catch{return null}}}return null}var z=Object.assign,M=0,fe,de,ve,ge,he,ye,me;function Ee(){}Ee.__reactDisabledLog=!0;function Ve(){{if(M===0){fe=console.log,de=console.info,ve=console.warn,ge=console.error,he=console.group,ye=console.groupCollapsed,me=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ee,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}M++}}function Me(){{if(M--,M===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},e,{value:fe}),info:z({},e,{value:de}),warn:z({},e,{value:ve}),error:z({},e,{value:ge}),group:z({},e,{value:he}),groupCollapsed:z({},e,{value:ye}),groupEnd:z({},e,{value:me})})}M<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=y.ReactCurrentDispatcher,re;function K(e,n,c){{if(re===void 0)try{throw Error()}catch(R){var v=R.stack.trim().match(/\n( *(at )?)/);re=v&&v[1]||""}return`
18
+ `+re+e}}var ne=!1,B;{var Ge=typeof WeakMap=="function"?WeakMap:Map;B=new Ge}function we(e,n){if(!e||ne)return"";{var c=B.get(e);if(c!==void 0)return c}var v;ne=!0;var R=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var P;P=te.current,te.current=null,Ve();try{if(n){var E=function(){throw Error()};if(Object.defineProperty(E.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(E,[])}catch(N){v=N}Reflect.construct(e,[],E)}else{try{E.call()}catch(N){v=N}e.call(E.prototype)}}else{try{throw Error()}catch(N){v=N}e()}}catch(N){if(N&&v&&typeof N.stack=="string"){for(var m=N.stack.split(`
19
19
  `),A=v.stack.split(`
20
- `),O=y.length-1,T=A.length-1;O>=1&&T>=0&&y[O]!==A[T];)T--;for(;O>=1&&T>=0;O--,T--)if(y[O]!==A[T]){if(O!==1||T!==1)do if(O--,T--,T<0||y[O]!==A[T]){var D=`
21
- `+y[O].replace(" at new "," at ");return e.displayName&&D.includes("<anonymous>")&&(D=D.replace("<anonymous>",e.displayName)),typeof e=="function"&&Q.set(e,D),D}while(O>=1&&T>=0);break}}}finally{ne=!1,te.current=p,Ue(),Error.prepareStackTrace=R}var M=e?e.displayName||e.name:"",ke=M?K(M):"";return typeof e=="function"&&Q.set(e,ke),ke}function Je(e,n,c){return we(e,!1)}function qe(e){var n=e.prototype;return!!(n&&n.isReactComponent)}function B(e,n,c){if(e==null)return"";if(typeof e=="function")return we(e,qe(e));if(typeof e=="string")return K(e);switch(e){case m:return K("Suspense");case g:return K("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return Je(e.render);case P:return B(e.type,n,c);case b:{var v=e,R=v._payload,p=v._init;try{return B(p(R),n,c)}catch{}}}return""}var H=Object.prototype.hasOwnProperty,Re={},Ce=h.ReactDebugCurrentFrame;function X(e){if(e){var n=e._owner,c=B(e.type,e._source,n?n.type:null);Ce.setExtraStackFrame(c)}else Ce.setExtraStackFrame(null)}function Ke(e,n,c,v,R){{var p=Function.call.bind(H);for(var E in e)if(p(e,E)){var y=void 0;try{if(typeof e[E]!="function"){var A=Error((v||"React class")+": "+c+" type `"+E+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[E]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw A.name="Invariant Violation",A}y=e[E](n,E,v,c,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(O){y=O}y&&!(y instanceof Error)&&(X(R),_("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",v||"React class",c,E,typeof y),X(null)),y instanceof Error&&!(y.message in Re)&&(Re[y.message]=!0,X(R),_("Failed %s type: %s",c,y.message),X(null))}}}var Qe=Array.isArray;function oe(e){return Qe(e)}function Be(e){{var n=typeof Symbol=="function"&&Symbol.toStringTag,c=n&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c}}function He(e){try{return _e(e),!1}catch{return!0}}function _e(e){return""+e}function pe(e){if(He(e))return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Be(e)),_e(e)}var Se=h.ReactCurrentOwner,Xe={key:!0,ref:!0,__self:!0,__source:!0},Pe,be;function Ze(e){if(H.call(e,"ref")){var n=Object.getOwnPropertyDescriptor(e,"ref").get;if(n&&n.isReactWarning)return!1}return e.ref!==void 0}function et(e){if(H.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function tt(e,n){typeof e.ref=="string"&&Se.current}function rt(e,n){{var c=function(){Pe||(Pe=!0,_("%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://reactjs.org/link/special-props)",n))};c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}}function nt(e,n){{var c=function(){be||(be=!0,_("%s: `ref` 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://reactjs.org/link/special-props)",n))};c.isReactWarning=!0,Object.defineProperty(e,"ref",{get:c,configurable:!0})}}var ot=function(e,n,c,v,R,p,E){var y={$$typeof:r,type:e,key:n,ref:c,props:E,_owner:p};return y._store={},Object.defineProperty(y._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(y,"_self",{configurable:!1,enumerable:!1,writable:!1,value:v}),Object.defineProperty(y,"_source",{configurable:!1,enumerable:!1,writable:!1,value:R}),Object.freeze&&(Object.freeze(y.props),Object.freeze(y)),y};function at(e,n,c,v,R){{var p,E={},y=null,A=null;c!==void 0&&(pe(c),y=""+c),et(n)&&(pe(n.key),y=""+n.key),Ze(n)&&(A=n.ref,tt(n,R));for(p in n)H.call(n,p)&&!Xe.hasOwnProperty(p)&&(E[p]=n[p]);if(e&&e.defaultProps){var O=e.defaultProps;for(p in O)E[p]===void 0&&(E[p]=O[p])}if(y||A){var T=typeof e=="function"?e.displayName||e.name||"Unknown":e;y&&rt(E,T),A&&nt(E,T)}return ot(e,y,A,R,v,Se.current,E)}}var ae=h.ReactCurrentOwner,je=h.ReactDebugCurrentFrame;function V(e){if(e){var n=e._owner,c=B(e.type,e._source,n?n.type:null);je.setExtraStackFrame(c)}else je.setExtraStackFrame(null)}var ie;ie=!1;function ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function Oe(){{if(ae.current){var e=W(ae.current.type);if(e)return`
20
+ `),T=m.length-1,O=A.length-1;T>=1&&O>=0&&m[T]!==A[O];)O--;for(;T>=1&&O>=0;T--,O--)if(m[T]!==A[O]){if(T!==1||O!==1)do if(T--,O--,O<0||m[T]!==A[O]){var I=`
21
+ `+m[T].replace(" at new "," at ");return e.displayName&&I.includes("<anonymous>")&&(I=I.replace("<anonymous>",e.displayName)),typeof e=="function"&&B.set(e,I),I}while(T>=1&&O>=0);break}}}finally{ne=!1,te.current=P,Me(),Error.prepareStackTrace=R}var V=e?e.displayName||e.name:"",De=V?K(V):"";return typeof e=="function"&&B.set(e,De),De}function Je(e,n,c){return we(e,!1)}function qe(e){var n=e.prototype;return!!(n&&n.isReactComponent)}function Q(e,n,c){if(e==null)return"";if(typeof e=="function")return we(e,qe(e));if(typeof e=="string")return K(e);switch(e){case h:return K("Suspense");case g:return K("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return Je(e.render);case C:return Q(e.type,n,c);case _:{var v=e,R=v._payload,P=v._init;try{return Q(P(R),n,c)}catch{}}}return""}var H=Object.prototype.hasOwnProperty,Re={},pe=y.ReactDebugCurrentFrame;function X(e){if(e){var n=e._owner,c=Q(e.type,e._source,n?n.type:null);pe.setExtraStackFrame(c)}else pe.setExtraStackFrame(null)}function Ke(e,n,c,v,R){{var P=Function.call.bind(H);for(var E in e)if(P(e,E)){var m=void 0;try{if(typeof e[E]!="function"){var A=Error((v||"React class")+": "+c+" type `"+E+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[E]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw A.name="Invariant Violation",A}m=e[E](n,E,v,c,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(T){m=T}m&&!(m instanceof Error)&&(X(R),S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",v||"React class",c,E,typeof m),X(null)),m instanceof Error&&!(m.message in Re)&&(Re[m.message]=!0,X(R),S("Failed %s type: %s",c,m.message),X(null))}}}var Be=Array.isArray;function oe(e){return Be(e)}function Qe(e){{var n=typeof Symbol=="function"&&Symbol.toStringTag,c=n&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c}}function He(e){try{return Ce(e),!1}catch{return!0}}function Ce(e){return""+e}function _e(e){if(He(e))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Qe(e)),Ce(e)}var Se=y.ReactCurrentOwner,Xe={key:!0,ref:!0,__self:!0,__source:!0},Pe,be;function Ze(e){if(H.call(e,"ref")){var n=Object.getOwnPropertyDescriptor(e,"ref").get;if(n&&n.isReactWarning)return!1}return e.ref!==void 0}function et(e){if(H.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function tt(e,n){typeof e.ref=="string"&&Se.current}function rt(e,n){{var c=function(){Pe||(Pe=!0,S("%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://reactjs.org/link/special-props)",n))};c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}}function nt(e,n){{var c=function(){be||(be=!0,S("%s: `ref` 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://reactjs.org/link/special-props)",n))};c.isReactWarning=!0,Object.defineProperty(e,"ref",{get:c,configurable:!0})}}var ot=function(e,n,c,v,R,P,E){var m={$$typeof:r,type:e,key:n,ref:c,props:E,_owner:P};return m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(m,"_self",{configurable:!1,enumerable:!1,writable:!1,value:v}),Object.defineProperty(m,"_source",{configurable:!1,enumerable:!1,writable:!1,value:R}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m};function at(e,n,c,v,R){{var P,E={},m=null,A=null;c!==void 0&&(_e(c),m=""+c),et(n)&&(_e(n.key),m=""+n.key),Ze(n)&&(A=n.ref,tt(n,R));for(P in n)H.call(n,P)&&!Xe.hasOwnProperty(P)&&(E[P]=n[P]);if(e&&e.defaultProps){var T=e.defaultProps;for(P in T)E[P]===void 0&&(E[P]=T[P])}if(m||A){var O=typeof e=="function"?e.displayName||e.name||"Unknown":e;m&&rt(E,O),A&&nt(E,O)}return ot(e,m,A,R,v,Se.current,E)}}var ae=y.ReactCurrentOwner,je=y.ReactDebugCurrentFrame;function U(e){if(e){var n=e._owner,c=Q(e.type,e._source,n?n.type:null);je.setExtraStackFrame(c)}else je.setExtraStackFrame(null)}var ie;ie=!1;function ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===r}function Te(){{if(ae.current){var e=W(ae.current.type);if(e)return`
22
22
 
23
- Check the render method of \``+e+"`."}return""}}function it(e){return""}var Te={};function ct(e){{var n=Oe();if(!n){var c=typeof e=="string"?e:e.displayName||e.name;c&&(n=`
23
+ Check the render method of \``+e+"`."}return""}}function it(e){return""}var Oe={};function ct(e){{var n=Te();if(!n){var c=typeof e=="string"?e:e.displayName||e.name;c&&(n=`
24
24
 
25
- Check the top-level render call using <`+c+">.")}return n}}function xe(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var c=ct(n);if(Te[c])return;Te[c]=!0;var v="";e&&e._owner&&e._owner!==ae.current&&(v=" It was passed a child from "+W(e._owner.type)+"."),V(e),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',c,v),V(null)}}function Ae(e,n){{if(typeof e!="object")return;if(oe(e))for(var c=0;c<e.length;c++){var v=e[c];ce(v)&&xe(v,n)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var R=j(e);if(typeof R=="function"&&R!==e.entries)for(var p=R.call(e),E;!(E=p.next()).done;)ce(E.value)&&xe(E.value,n)}}}function st(e){{var n=e.type;if(n==null||typeof n=="string")return;var c;if(typeof n=="function")c=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===u||n.$$typeof===P))c=n.propTypes;else return;if(c){var v=W(n);Ke(c,e.props,"prop",v,e)}else if(n.PropTypes!==void 0&&!ie){ie=!0;var R=W(n);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ut(e){{for(var n=Object.keys(e.props),c=0;c<n.length;c++){var v=n[c];if(v!=="children"&&v!=="key"){V(e),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),V(null);break}}e.ref!==null&&(V(e),_("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}function Ie(e,n,c,v,R,p){{var E=q(e);if(!E){var y="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(y+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var A=it();A?y+=A:y+=Oe();var O;e===null?O="null":oe(e)?O="array":e!==void 0&&e.$$typeof===r?(O="<"+(W(e.type)||"Unknown")+" />",y=" Did you accidentally export a JSX literal instead of a component?"):O=typeof e,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",O,y)}var T=at(e,n,c,R,p);if(T==null)return T;if(E){var D=n.children;if(D!==void 0)if(v)if(oe(D)){for(var M=0;M<D.length;M++)Ae(D[M],e);Object.freeze&&Object.freeze(D)}else _("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 Ae(D,e)}return e===i?ut(T):st(T),T}}function lt(e,n,c){return Ie(e,n,c,!0)}function ft(e,n,c){return Ie(e,n,c,!1)}var dt=ft,vt=lt;J.Fragment=i,J.jsx=dt,J.jsxs=vt}()),J}process.env.NODE_ENV==="production"?se.exports=Rt():se.exports=Ct();var Y=se.exports;const k=w.createContext({}),_t=({children:t,apiURL:r,libraries:o,localStorageKeys:i})=>{const a=w.useMemo(()=>({apiURL:r,libraries:o,localStorageKeys:i}),[r,o,i]);return Y.jsx(k.Provider,{value:a,children:t})},pt="user",St=({Fallback:t,isLogged:r,loginPath:o="/login",redirect401Path:i="/login",...a})=>{var I,F,L,$;const{libraries:l,localStorageKeys:f}=w.useContext(k),d=(a==null?void 0:a.reactRouter)||(l==null?void 0:l.reactRouter),u=(a==null?void 0:a.axios)||(l==null?void 0:l.axios),m=(a==null?void 0:a.localStorageKey)||(f==null?void 0:f.user)||pt;if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[g,P]=w.useState(null),{useLocation:b,Navigate:s,Outlet:S}=d,C=b(),j=w.useRef(!1),h=typeof r=="function"?r():!!r,_=typeof h=="boolean"?h:h==null?void 0:h.isLogged;return w.useEffect(()=>{j.current||(j.current=!0,u.interceptors.response.use(x=>x,async x=>{var q;return typeof x=="object"&&x&&"response"in x&&x.response&&typeof x.response=="object"&&"status"in x.response&&x.response&&typeof x.response=="object"&&"status"in x.response&&((q=x==null?void 0:x.response)==null?void 0:q.status)===401&&(u.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(m),P(i)),Promise.reject(x)}))},[u.defaults.headers.common,u.interceptors.response,m,i]),_&&!g?Y.jsx(w.Suspense,{fallback:t,children:(F=(I=C.state)==null?void 0:I.from)!=null&&F.state&&(($=(L=C.state)==null?void 0:L.from)==null?void 0:$.pathname)===o?Y.jsx(s,{to:C.state.from.state.from.pathname+C.state.from.state.from.search,replace:!0}):Y.jsx(S,{})}):Y.jsx(s,{to:o+C.search,state:{from:C},replace:!0})},Pt=({data:t,...r})=>{const{libraries:o}=w.useContext(k),i=(r==null?void 0:r.reactRouter)||(o==null?void 0:o.reactRouter),a=(r==null?void 0:r.gtm)||(o==null?void 0:o.gtm);if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!a)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:l}=a,{useLocation:f,Outlet:d}=i,{pathname:u}=f(),{sendEvent:m}=l();return w.useEffect(()=>{m({event:"pageView",pathname:u,...t})},[t,u,m]),Y.jsx(d,{})},bt="user",jt=({tokenTypeKey:t="tokenType",tokenKey:r="accessToken",postContentType:o="application/json",...i})=>{const{apiURL:a=i.apiURL,libraries:l,localStorageKeys:f}=w.useContext(k),d=(i==null?void 0:i.userLocalStorageKey)||(f==null?void 0:f.user)||bt,u=(i==null?void 0:i.axios)||(l==null?void 0:l.axios);if(!u)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!(u!=null&&u.defaults))return null;if(typeof window<"u"&&window.localStorage){const m=localStorage.getItem(d),g=m?JSON.parse(m):null,P=g!=null&&g[t]?g[t]:null,b=g!=null&&g[r]?g[r]:null,s=m?`${P} ${b}`:null;s&&(u.defaults.headers.common.Authorization=s)}return u.defaults.baseURL=a,u.defaults.headers.post["Content-Type"]=o,null},Ot=({debug:t,resources:r,...o})=>{const{libraries:i}=w.useContext(k),a=(o==null?void 0:o.i18)||(i==null?void 0:i.i18),{i18next:l,initReactI18next:f,languageDetector:d}=a||{};if(!a)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return l!=null&&l.isInitialized||(l.use(d).use(f).init({debug:t,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:r,returnNull:!1}).then(()=>{document.documentElement.lang!==l.resolvedLanguage&&l.resolvedLanguage&&document.documentElement.setAttribute("lang",l.resolvedLanguage)}),l.on("languageChanged",u=>{document.documentElement.setAttribute("lang",u)})),null},Tt=({dsn:t,integrations:r,tracesSampleRate:o,replaysSessionSampleRate:i,replaysOnErrorSampleRate:a,tracePropagationTargets:l,ignoreErrors:f,debug:d,environment:u,release:m,...g})=>{const{libraries:P}=w.useContext(k),b=(g==null?void 0:g.sentry)||(P==null?void 0:P.sentry),s=(g==null?void 0:g.reactRouter)||(P==null?void 0:P.reactRouter);if(!b)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(b.isInitialized())return null;const{createRoutesFromChildren:S,matchRoutes:C,useLocation:j,useNavigationType:h}=s;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&b.init({debug:d,dsn:t,environment:u||"production",ignoreErrors:[...f||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[b.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:S,matchRoutes:C,useEffect:w.useEffect,useLocation:j,useNavigationType:h}),...r||[]],release:m,replaysOnErrorSampleRate:a||1,replaysSessionSampleRate:i||.1,tracePropagationTargets:l,tracesSampleRate:o||1}),null},xt=({IMaskMixin:t,...r})=>{const o=w.useMemo(()=>t(({TextField:i,...a})=>Y.jsx(i,{...a})),[t]);return Y.jsx(o,{...r})},At=({language:t,...r})=>{const{libraries:o}=w.useContext(k),i=(r==null?void 0:r.dayjs)||(o==null?void 0:o.dayjs),a=(r==null?void 0:r.plugin)||(o==null?void 0:o.dayjsPlugin);if(!i)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return w.useEffect(()=>{(async()=>{var d;const f=t||((d=navigator.language)==null?void 0:d.slice(0,2))||"en";a&&a.forEach(u=>{u&&i.extend(u)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),i.locale(f)})().then()},[i,a,t]),null},It=()=>(w.useEffect(()=>{const t=r=>{try{r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",t),()=>{window.removeEventListener("vite:preloadError",t)}},[]),null),kt=t=>t&&typeof t=="function",Dt=t=>t&&typeof t=="function",Ft=({children:t,defaultQueriesOptions:r,defaultMutationsOptions:o,...i})=>{var u,m;const{libraries:a}=w.useContext(k),l=(i==null?void 0:i.QueryClient)||((u=a==null?void 0:a.reactQuery)==null?void 0:u.QueryClient),f=(i==null?void 0:i.QueryClientProvider)||((m=a==null?void 0:a.reactQuery)==null?void 0:m.QueryClientProvider);if(!l)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!f)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!kt(f))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Dt(l))throw new Error("Provided QueryClient dependencies are not valid.");const d=new l({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(g,P,b)=>g.length+(b||0),refetchOnWindowFocus:!1,retry:3,...r}}});return Y.jsx(f,{client:d,children:t})},Lt=t=>{var m,g,P;const{libraries:r}=w.useContext(k),o=(t==null?void 0:t.i18)||(r==null?void 0:r.i18),i=((m=t==null?void 0:t.i18)==null?void 0:m.translateFunction)||((g=r==null?void 0:r.i18)==null?void 0:g.translateFunction),a=((P=o==null?void 0:o.i18next)==null?void 0:P.t)||i||(b=>b),{unknownErrorTranslationKey:l="error.unknownError"}=t||{},f=a(l),d=w.useCallback(b=>{var S,C,j,h,_,I,F,L,$;const{response:s}=b||{};return s!=null&&s.reason?String(s.reason):(S=s==null?void 0:s.data)!=null&&S.reason?String(s.data.reason):(C=s==null?void 0:s.data)!=null&&C.message?String(s.data.message):(h=(j=s==null?void 0:s.data)==null?void 0:j.detail)!=null&&h.length&&Array.isArray((_=s==null?void 0:s.data)==null?void 0:_.detail)&&((F=(I=s==null?void 0:s.data)==null?void 0:I.detail[0])!=null&&F.msg)&&typeof(($=(L=s==null?void 0:s.data)==null?void 0:L.detail[0])==null?void 0:$.msg)=="string"?String(s.data.detail[0].msg):f},[f]);return{getErrorCode:w.useCallback(b=>{var S,C,j;const{response:s}=b||{};return s!=null&&s.error_code?String(s==null?void 0:s.error_code):(S=s==null?void 0:s.data)!=null&&S.error_code?String((C=s==null?void 0:s.data)==null?void 0:C.error_code):s!=null&&s.error_code?String(s==null?void 0:s.error_code):(j=s==null?void 0:s.data)!=null&&j.error_code?String(s.data.error_code):"unknown_error_code"},[]),printError:d}},$t=({data:t,fetchNextPage:r,isFetchingNextPage:o,isInitialLoading:i,isLoading:a,enabled:l=!0})=>{const f=w.useCallback(async u=>{o||!l||await r({pageParam:(u==null?void 0:u.pageParam)||u.visibleRowsCount})},[l,r,o]),d=w.useMemo(()=>{if(t)return t.pages.reduce((u,m)=>[...u,...m],[])},[t]);return{fetchNextPageOnRowsScrollEnd:f,isLoading:o||a,loadingVariant:i?"skeleton":"linear",rows:d}},Nt=t=>{const{libraries:r}=w.useContext(k),o=(t==null?void 0:t.axios)||(r==null?void 0:r.axios),i=(t==null?void 0:t.localStorageKey)||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const a=w.useCallback(({tokenType:f,accessToken:d})=>{o.defaults.headers.common.Authorization=`${f} ${d}`},[o.defaults.headers.common]),l=()=>{o.defaults.headers.common.Authorization=null};return w.useEffect(()=>{const f=({newValue:d,key:u})=>{if(u===i&&d)try{const{accessToken:m,tokenType:g}=JSON.parse(d);a({accessToken:m,tokenType:g})}catch(m){console.error("Failed to parse newValue from localStorage:",m)}};return window.addEventListener("storage",f),()=>{window.removeEventListener("storage",f)}},[i,a]),{clearAuthenticationToken:l,setAuthenticationToken:a}},Ye=({library:t,date:r,format:o="ll"})=>t(r).format(o),We=(t,r)=>{const{fractionDigits:o=0,metric:i="km"}=r||{},a=Number(t);return Number.isNaN(a)?`0${i}`:`${a.toFixed(o)}${i}`},ze=t=>!t||typeof t!="string"?"":t.replace(/_/g," ").toLowerCase().split(" ").map(o=>o.length>0?o.charAt(0).toUpperCase()+o.slice(1):o).join(" "),Yt=t=>t!=null&&t.startsWith("/")?t!=null&&t.startsWith("/files")?t:`/files${t}`:t!=null&&t.startsWith("files")?`/${t}`:`/files/${t}`,Wt=({path:t,size:r,apiURL:o})=>{if(!t)return"";const i=Yt(t),a=`${o}${i}`,l=a.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof r=="number"&&l?`${a.replace("/files",`/thumbs/${r}`)}`:a},zt=t=>{const{apiURL:r,libraries:o}=w.useContext(k),i=(t==null?void 0:t.dayjs)||(o==null?void 0:o.dayjs);return{dateAdapter:(f,d)=>{if(!i)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return Ye({date:f,format:d,library:i})},distanceAdapter:We,filePathAdapter:(f,d)=>{if(!r)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return Wt({apiURL:r,path:f,size:d})},worksiteNameAdapter:ze}},Z=(t,r)=>r==="short"?t.split("-")[0]:t,Vt=(t,r="full")=>{const[o,i]=w.useState(()=>{const a=(t==null?void 0:t.language)||navigator.language;return t&&"isInitialized"in t&&t.isInitialized,Z(a,r)});return w.useEffect(()=>{var l;t&&"isInitialized"in t&&t.isInitialized&&t.language&&i(Z(t.language,r));const a=f=>{i(Z(f,r))};return(l=t==null?void 0:t.on)==null||l.call(t,"languageChanged",a),()=>{var f;(f=t==null?void 0:t.off)==null||f.call(t,"languageChanged",a)}},[t,r]),o},Mt="tracktor.filter",Ne=(t,r,o)=>`${o}_${t}=>${r}`,Ut=t=>{const{libraries:r,localStorageKeys:o}=w.useContext(k),i=(t==null?void 0:t.reactRouter)||(r==null?void 0:r.reactRouter),{useLocation:a,useSearchParams:l}=i,{pathname:f}=a(),[d,u]=l(),m=(o==null?void 0:o.filter)||Mt;if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const g=(S,C,j=!0)=>{const h=Ne(S,(t==null?void 0:t.pathname)||f,m);if(!C||Array.isArray(C)&&!C.length){d.delete(S),u(d),localStorage.removeItem(h);return}j&&C&&localStorage.setItem(h,JSON.stringify({...d,[S]:C})),C&&(d.set(S,JSON.stringify(C)),u(d))};return{getFilter:(S,C)=>{const j=d.get(S);if(j)try{return JSON.parse(j)}catch{return j}const h=Ne(S,(t==null?void 0:t.pathname)||f,m),_=localStorage.getItem(h);if(_)try{return JSON.parse(_)[S]}catch{}return C},getFilters:()=>{const S=Object.fromEntries(d.entries()),j=Object.keys(localStorage).filter(h=>h.startsWith(m)&&h.endsWith((t==null?void 0:t.pathname)||f)).reduce((h,_)=>{var F,L;const I=localStorage.getItem(_);if(I){const $=JSON.parse(I),x=(F=Object.keys($))==null?void 0:F[0];h[x]=(L=Object.values($))==null?void 0:L[0]}return h},{});return{...S,...j}},handleFilter:(S,C)=>(j,h)=>{if(h||Array.isArray(h)&&h.length===0){const _=C||"value",I=typeof h=="object"&&_ in h?h[_]:h;g(S,I);return}g(S,void 0)},setFilter:g}},Gt=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Jt=t=>{const i=t.split("/").filter(a=>a.length>0).map(a=>a.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join("")).join("");return i.charAt(0).toLowerCase()+i.slice(1)},qt=t=>(t.split("/").pop()||t).replace(/\.json$/,"").replace(/^openapi\./,""),Kt=(t,r,o)=>{const i=Jt(r),a=Gt(o);return`${i}${a}`},Qt=t=>{if(t)return(t==null?void 0:t.reduce((r,o)=>(r[o]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}},r),{}))||{}},Bt=t=>(Array.isArray(t)?t:[t]).reduce((o,i)=>{const{output:a,operationsToGenerateInfiniteQueryHook:l,input:f="./openapi.json"}=i||{},d=qt(f);return{...o,[d]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:f,output:{baseUrl:a==null?void 0:a.baseUrl,client:"react-query",mode:"tags-split",override:{...(l==null?void 0:l.length)&&{operations:Qt(l)},header:u=>["Generated by orval 🍺",...u.title?[u.title]:[],...u.description?[u.description]:[]],mutator:{name:"axiosCustomInstance",path:"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"},operationName:Kt,query:{useQuery:!0}},schemas:(a==null?void 0:a.schemas)||`src/api/${d}/model`,target:(a==null?void 0:a.target)||`src/api/${d}/services/api.ts`,...a}}}},{});exports.GTMSendPageView=Pt;exports.InitializeAxiosConfig=jt;exports.InitializeDaysJSConfig=At;exports.InitializeI18nConfig=Ot;exports.InitializeSentryConfig=Tt;exports.InjectDependenciesContext=k;exports.InjectDependenciesProvider=_t;exports.MaskTextField=xt;exports.PreloadErrorHandler=It;exports.QueryClientProviderWithConfig=Ft;exports.RequireAuth=St;exports.dateAdapter=Ye;exports.distanceAdapter=We;exports.getOrvalConfig=Bt;exports.useAdapter=zt;exports.useAuth=Nt;exports.useCurrentLanguage=Vt;exports.useFilters=Ut;exports.useInfiniteDataGrid=$t;exports.useResponseError=Lt;exports.worksiteNameAdapter=ze;
25
+ Check the top-level render call using <`+c+">.")}return n}}function xe(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var c=ct(n);if(Oe[c])return;Oe[c]=!0;var v="";e&&e._owner&&e._owner!==ae.current&&(v=" It was passed a child from "+W(e._owner.type)+"."),U(e),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',c,v),U(null)}}function Ae(e,n){{if(typeof e!="object")return;if(oe(e))for(var c=0;c<e.length;c++){var v=e[c];ce(v)&&xe(v,n)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var R=j(e);if(typeof R=="function"&&R!==e.entries)for(var P=R.call(e),E;!(E=P.next()).done;)ce(E.value)&&xe(E.value,n)}}}function st(e){{var n=e.type;if(n==null||typeof n=="string")return;var c;if(typeof n=="function")c=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===u||n.$$typeof===C))c=n.propTypes;else return;if(c){var v=W(n);Ke(c,e.props,"prop",v,e)}else if(n.PropTypes!==void 0&&!ie){ie=!0;var R=W(n);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ut(e){{for(var n=Object.keys(e.props),c=0;c<n.length;c++){var v=n[c];if(v!=="children"&&v!=="key"){U(e),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),U(null);break}}e.ref!==null&&(U(e),S("Invalid attribute `ref` supplied to `React.Fragment`."),U(null))}}function ke(e,n,c,v,R,P){{var E=q(e);if(!E){var m="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(m+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var A=it();A?m+=A:m+=Te();var T;e===null?T="null":oe(e)?T="array":e!==void 0&&e.$$typeof===r?(T="<"+(W(e.type)||"Unknown")+" />",m=" Did you accidentally export a JSX literal instead of a component?"):T=typeof e,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",T,m)}var O=at(e,n,c,R,P);if(O==null)return O;if(E){var I=n.children;if(I!==void 0)if(v)if(oe(I)){for(var V=0;V<I.length;V++)Ae(I[V],e);Object.freeze&&Object.freeze(I)}else S("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 Ae(I,e)}return e===i?ut(O):st(O),O}}function lt(e,n,c){return ke(e,n,c,!0)}function ft(e,n,c){return ke(e,n,c,!1)}var dt=ft,vt=lt;J.Fragment=i,J.jsx=dt,J.jsxs=vt}()),J}process.env.NODE_ENV==="production"?se.exports=Rt():se.exports=pt();var Y=se.exports;const D=w.createContext({}),Ct=({children:t,apiURL:r,libraries:o,localStorageKeys:i})=>{const a=w.useMemo(()=>({apiURL:r,libraries:o,localStorageKeys:i}),[r,o,i]);return Y.jsx(D.Provider,{value:a,children:t})},_t="user",St=({Fallback:t,isLogged:r,loginPath:o="/login",redirect401Path:i="/login",...a})=>{var k,F,L,$;const{libraries:f,localStorageKeys:l}=w.useContext(D),d=(a==null?void 0:a.reactRouter)||(f==null?void 0:f.reactRouter),u=(a==null?void 0:a.axios)||(f==null?void 0:f.axios),h=(a==null?void 0:a.localStorageKey)||(l==null?void 0:l.user)||_t;if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[g,C]=w.useState(null),{useLocation:_,Navigate:s,Outlet:b}=d,p=_(),j=w.useRef(!1),y=typeof r=="function"?r():!!r,S=typeof y=="boolean"?y:y==null?void 0:y.isLogged;return w.useEffect(()=>{j.current||(j.current=!0,u.interceptors.response.use(x=>x,async x=>{var q;return typeof x=="object"&&x&&"response"in x&&x.response&&typeof x.response=="object"&&"status"in x.response&&x.response&&typeof x.response=="object"&&"status"in x.response&&((q=x==null?void 0:x.response)==null?void 0:q.status)===401&&(u.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(h),C(i)),Promise.reject(x)}))},[u.defaults.headers.common,u.interceptors.response,h,i]),S&&!g?Y.jsx(w.Suspense,{fallback:t,children:(F=(k=p.state)==null?void 0:k.from)!=null&&F.state&&(($=(L=p.state)==null?void 0:L.from)==null?void 0:$.pathname)===o?Y.jsx(s,{to:p.state.from.state.from.pathname+p.state.from.state.from.search,replace:!0}):Y.jsx(b,{})}):Y.jsx(s,{to:o+p.search,state:{from:p},replace:!0})},Pt=({data:t,...r})=>{const{libraries:o}=w.useContext(D),i=(r==null?void 0:r.reactRouter)||(o==null?void 0:o.reactRouter),a=(r==null?void 0:r.gtm)||(o==null?void 0:o.gtm);if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!a)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:f}=a,{useLocation:l,Outlet:d}=i,{pathname:u}=l(),{sendEvent:h}=f();return w.useEffect(()=>{h({event:"pageView",pathname:u,...t})},[t,u,h]),Y.jsx(d,{})},bt="user",jt=({tokenTypeKey:t="tokenType",tokenKey:r="accessToken",postContentType:o="application/json",...i})=>{const{apiURL:a=i.apiURL,libraries:f,localStorageKeys:l}=w.useContext(D),d=(i==null?void 0:i.userLocalStorageKey)||(l==null?void 0:l.user)||bt,u=(i==null?void 0:i.axios)||(f==null?void 0:f.axios);if(!u)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!(u!=null&&u.defaults))return null;if(typeof window<"u"&&window.localStorage){const h=localStorage.getItem(d),g=h?JSON.parse(h):null,C=g!=null&&g[t]?g[t]:null,_=g!=null&&g[r]?g[r]:null,s=h?`${C} ${_}`:null;s&&(u.defaults.headers.common.Authorization=s)}return u.defaults.baseURL=a,u.defaults.headers.post["Content-Type"]=o,null},Tt=({debug:t,resources:r,...o})=>{const{libraries:i}=w.useContext(D),a=(o==null?void 0:o.i18)||(i==null?void 0:i.i18),{i18next:f,initReactI18next:l,languageDetector:d}=a||{};if(!a)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return f!=null&&f.isInitialized||(f.use(d).use(l).init({debug:t,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:r,returnNull:!1}).then(()=>{document.documentElement.lang!==f.resolvedLanguage&&f.resolvedLanguage&&document.documentElement.setAttribute("lang",f.resolvedLanguage)}),f.on("languageChanged",u=>{document.documentElement.setAttribute("lang",u)})),null},Ot=({dsn:t,integrations:r,tracesSampleRate:o,replaysSessionSampleRate:i,replaysOnErrorSampleRate:a,tracePropagationTargets:f,ignoreErrors:l,debug:d,environment:u,release:h,...g})=>{const{libraries:C}=w.useContext(D),_=(g==null?void 0:g.sentry)||(C==null?void 0:C.sentry),s=(g==null?void 0:g.reactRouter)||(C==null?void 0:C.reactRouter);if(!_)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(_.isInitialized())return null;const{createRoutesFromChildren:b,matchRoutes:p,useLocation:j,useNavigationType:y}=s;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&_.init({debug:d,dsn:t,environment:u||"production",ignoreErrors:[...l||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[_.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:b,matchRoutes:p,useEffect:w.useEffect,useLocation:j,useNavigationType:y}),...r||[]],release:h,replaysOnErrorSampleRate:a||1,replaysSessionSampleRate:i||.1,tracePropagationTargets:f,tracesSampleRate:o||1}),null},xt=({IMaskMixin:t,...r})=>{const o=w.useMemo(()=>t(({TextField:i,...a})=>Y.jsx(i,{...a})),[t]);return Y.jsx(o,{...r})},At=({language:t,...r})=>{const{libraries:o}=w.useContext(D),i=(r==null?void 0:r.dayjs)||(o==null?void 0:o.dayjs),a=(r==null?void 0:r.plugin)||(o==null?void 0:o.dayjsPlugin);if(!i)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return w.useEffect(()=>{(async()=>{var d;const l=t||((d=navigator.language)==null?void 0:d.slice(0,2))||"en";a&&a.forEach(u=>{u&&i.extend(u)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),i.locale(l)})().then()},[i,a,t]),null},kt=()=>(w.useEffect(()=>{const t=r=>{try{r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",t),()=>{window.removeEventListener("vite:preloadError",t)}},[]),null),Dt=t=>t&&typeof t=="function",It=t=>t&&typeof t=="function",Ft=({children:t,defaultQueriesOptions:r,defaultMutationsOptions:o,...i})=>{var u,h;const{libraries:a}=w.useContext(D),f=(i==null?void 0:i.QueryClient)||((u=a==null?void 0:a.reactQuery)==null?void 0:u.QueryClient),l=(i==null?void 0:i.QueryClientProvider)||((h=a==null?void 0:a.reactQuery)==null?void 0:h.QueryClientProvider);if(!f)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!Dt(l))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!It(f))throw new Error("Provided QueryClient dependencies are not valid.");const d=new f({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(g,C,_)=>g.length+(_||0),refetchOnWindowFocus:!1,retry:3,...r}}});return Y.jsx(l,{client:d,children:t})},Lt=t=>{var h,g,C;const{libraries:r}=w.useContext(D),o=(t==null?void 0:t.i18)||(r==null?void 0:r.i18),i=((h=t==null?void 0:t.i18)==null?void 0:h.translateFunction)||((g=r==null?void 0:r.i18)==null?void 0:g.translateFunction),a=((C=o==null?void 0:o.i18next)==null?void 0:C.t)||i||(_=>_),{unknownErrorTranslationKey:f="error.unknownError"}=t||{},l=a(f),d=w.useCallback(_=>{var b,p,j,y,S,k,F,L,$;if(_ instanceof Error)return _.message;const{response:s}=_||{};return s!=null&&s.reason?String(s.reason):(b=s==null?void 0:s.data)!=null&&b.reason?String(s.data.reason):(p=s==null?void 0:s.data)!=null&&p.message?String(s.data.message):(y=(j=s==null?void 0:s.data)==null?void 0:j.detail)!=null&&y.length&&Array.isArray((S=s==null?void 0:s.data)==null?void 0:S.detail)&&((F=(k=s==null?void 0:s.data)==null?void 0:k.detail[0])!=null&&F.msg)&&typeof(($=(L=s==null?void 0:s.data)==null?void 0:L.detail[0])==null?void 0:$.msg)=="string"?String(s.data.detail[0].msg):l},[l]);return{getErrorCode:w.useCallback(_=>{var b,p,j;const{response:s}=_||{};return s!=null&&s.error_code?String(s==null?void 0:s.error_code):(b=s==null?void 0:s.data)!=null&&b.error_code?String((p=s==null?void 0:s.data)==null?void 0:p.error_code):s!=null&&s.error_code?String(s==null?void 0:s.error_code):(j=s==null?void 0:s.data)!=null&&j.error_code?String(s.data.error_code):"unknown_error_code"},[]),printError:d}},$t=({data:t,fetchNextPage:r,isFetchingNextPage:o,isInitialLoading:i,isLoading:a,enabled:f=!0})=>{const l=w.useCallback(async u=>{o||!f||await r({pageParam:(u==null?void 0:u.pageParam)||u.visibleRowsCount})},[f,r,o]),d=w.useMemo(()=>{if(t)return t.pages.reduce((u,h)=>[...u,...h],[])},[t]);return{fetchNextPageOnRowsScrollEnd:l,isLoading:o||a,loadingVariant:i?"skeleton":"linear",rows:d}},Nt=t=>{const{libraries:r}=w.useContext(D),o=(t==null?void 0:t.axios)||(r==null?void 0:r.axios),i=(t==null?void 0:t.localStorageKey)||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const a=w.useCallback(({tokenType:l,accessToken:d})=>{o.defaults.headers.common.Authorization=`${l} ${d}`},[o.defaults.headers.common]),f=()=>{o.defaults.headers.common.Authorization=null};return w.useEffect(()=>{const l=({newValue:d,key:u})=>{if(u===i&&d)try{const{accessToken:h,tokenType:g}=JSON.parse(d);a({accessToken:h,tokenType:g})}catch(h){console.error("Failed to parse newValue from localStorage:",h)}};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}},[i,a]),{clearAuthenticationToken:f,setAuthenticationToken:a}},Ye=({library:t,date:r,format:o="ll"})=>t(r).format(o),We=(t,r)=>{const{fractionDigits:o=0,metric:i="km"}=r||{},a=Number(t);return Number.isNaN(a)?`0${i}`:`${a.toFixed(o)}${i}`},ze=t=>!t||typeof t!="string"?"":t.replace(/_/g," ").toLowerCase().split(" ").map(o=>o.length>0?o.charAt(0).toUpperCase()+o.slice(1):o).join(" "),Yt=t=>t!=null&&t.startsWith("/")?t!=null&&t.startsWith("/files")?t:`/files${t}`:t!=null&&t.startsWith("files")?`/${t}`:`/files/${t}`,Wt=({path:t,size:r,apiURL:o})=>{if(!t)return"";const i=Yt(t),a=`${o}${i}`,f=a.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof r=="number"&&f?`${a.replace("/files",`/thumbs/${r}`)}`:a},zt=t=>{const{apiURL:r,libraries:o}=w.useContext(D),i=(t==null?void 0:t.dayjs)||(o==null?void 0:o.dayjs);return{dateAdapter:(l,d)=>{if(!i)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return Ye({date:l,format:d,library:i})},distanceAdapter:We,filePathAdapter:(l,d)=>{if(!r)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return Wt({apiURL:r,path:l,size:d})},worksiteNameAdapter:ze}},Z=(t,r)=>r==="short"?t.split("-")[0]:t,Ut=(t,r="full")=>{const[o,i]=w.useState(()=>{const a=(t==null?void 0:t.language)||navigator.language;return t&&"isInitialized"in t&&t.isInitialized,Z(a,r)});return w.useEffect(()=>{var f;t&&"isInitialized"in t&&t.isInitialized&&t.language&&i(Z(t.language,r));const a=l=>{i(Z(l,r))};return(f=t==null?void 0:t.on)==null||f.call(t,"languageChanged",a),()=>{var l;(l=t==null?void 0:t.off)==null||l.call(t,"languageChanged",a)}},[t,r]),o},Vt="tracktor.filter",Ne=(t,r,o)=>`${o}_${t}=>${r}`,Mt=t=>{const{libraries:r,localStorageKeys:o}=w.useContext(D),i=(t==null?void 0:t.reactRouter)||(r==null?void 0:r.reactRouter),{useLocation:a,useSearchParams:f}=i,{pathname:l}=a(),[d,u]=f(),h=(o==null?void 0:o.filter)||Vt;if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const g=(b,p,j=!0)=>{const y=Ne(b,(t==null?void 0:t.pathname)||l,h);if(!p||Array.isArray(p)&&!p.length){d.delete(b),u(d),localStorage.removeItem(y);return}j&&p&&localStorage.setItem(y,JSON.stringify({...d,[b]:p})),p&&(d.set(b,JSON.stringify(p)),u(d))};return{getFilter:(b,p)=>{const j=d.get(b);if(j)try{return JSON.parse(j)}catch{return j}const y=Ne(b,(t==null?void 0:t.pathname)||l,h),S=localStorage.getItem(y);if(S)try{return JSON.parse(S)[b]}catch{}return p},getFilters:()=>{const b=Object.fromEntries(d.entries()),j=Object.keys(localStorage).filter(y=>y.startsWith(h)&&y.endsWith((t==null?void 0:t.pathname)||l)).reduce((y,S)=>{var F,L;const k=localStorage.getItem(S);if(k){const $=JSON.parse(k),x=(F=Object.keys($))==null?void 0:F[0];y[x]=(L=Object.values($))==null?void 0:L[0]}return y},{});return{...b,...j}},handleFilter:(b,p)=>(j,y)=>{if(y||Array.isArray(y)&&y.length===0){const S=p||"value",k=typeof y=="object"&&S in y?y[S]:y;g(b,k);return}g(b,void 0)},setFilter:g}},Gt=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),Jt=t=>{const i=t.split("/").filter(a=>a.length>0).map(a=>a.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(u=>u.charAt(0).toUpperCase()+u.slice(1)).join("")).join("");return i.charAt(0).toLowerCase()+i.slice(1)},qt=t=>(t.split("/").pop()||t).replace(/\.json$/,"").replace(/^openapi\./,""),Kt=(t,r,o,i)=>{const a=Jt(r),f=Gt(o),l=`${a}${f}`;return t&&typeof t=="object"&&"operationId"in t&&(i!=null&&i.includes(String(t.operationId)))?`${l}AsQuery`:l},Bt=(t,r)=>{const o={};return t==null||t.forEach(i=>{o[i]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),r==null||r.filter(i=>!o[i]).forEach(i=>{o[i]={query:{useQuery:!0}}}),Object.keys(o).length?o:void 0},Qt=t=>(Array.isArray(t)?t:[t]).reduce((o,i)=>{const{output:a,useInfiniteIds:f,useQueryIds:l,input:d="./openapi.json"}=i||{},u=qt(d);return{...o,[u]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:d,output:{baseUrl:a==null?void 0:a.baseUrl,client:"react-query",mode:"tags-split",override:{...((f==null?void 0:f.length)||(l==null?void 0:l.length))&&{operations:Bt(f,l)},header:h=>["Generated by orval 🍺",...h.title?[h.title]:[],...h.description?[h.description]:[]],mutator:{name:"axiosCustomInstance",path:"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"},operationName:(h,g,C)=>Kt(h,g,C,l),query:{useQuery:!0}},schemas:(a==null?void 0:a.schemas)||`src/api/${u}/model`,target:(a==null?void 0:a.target)||`src/api/${u}/services/api.ts`,...a}}}},{});exports.GTMSendPageView=Pt;exports.InitializeAxiosConfig=jt;exports.InitializeDaysJSConfig=At;exports.InitializeI18nConfig=Tt;exports.InitializeSentryConfig=Ot;exports.InjectDependenciesContext=D;exports.InjectDependenciesProvider=Ct;exports.MaskTextField=xt;exports.PreloadErrorHandler=kt;exports.QueryClientProviderWithConfig=Ft;exports.RequireAuth=St;exports.dateAdapter=Ye;exports.distanceAdapter=We;exports.getOrvalConfig=Qt;exports.useAdapter=zt;exports.useAuth=Nt;exports.useCurrentLanguage=Ut;exports.useFilters=Mt;exports.useInfiniteDataGrid=$t;exports.useResponseError=Lt;exports.worksiteNameAdapter=ze;