thecore-auth 0.0.149 → 0.0.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/thecore-auth.cjs.js +7 -7
- package/dist/thecore-auth.esm.js +194 -194
- package/package.json +1 -1
package/dist/thecore-auth.cjs.js
CHANGED
|
@@ -14,21 +14,21 @@
|
|
|
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 pt(){return $e||($e=1,process.env.NODE_ENV!=="production"&&function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===le?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case I:return"Fragment";case R:return"Portal";case F:return"Profiler";case U:return"StrictMode";case ae:return"Suspense";case X:return"SuspenseList"}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 Y:return(t.displayName||"Context")+".Provider";case J:return(t._context.displayName||"Context")+".Consumer";case Z:var f=t.render;return t=t.displayName,t||(t=f.displayName||f.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case W:return f=t.displayName||null,f!==null?f:e(t.type)||"Memo";case _:f=t._payload,t=t._init;try{return e(t(f))}catch{}}return null}function a(t){return""+t}function n(t){try{a(t);var f=!1}catch{f=!0}if(f){f=console;var m=f.error,L=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return m.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",L),a(t)}}function s(){}function l(){if(T===0){
|
|
17
|
+
*/var $e;function pt(){return $e||($e=1,process.env.NODE_ENV!=="production"&&function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===le?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case I:return"Fragment";case R:return"Portal";case F:return"Profiler";case U:return"StrictMode";case ae:return"Suspense";case X:return"SuspenseList"}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 Y:return(t.displayName||"Context")+".Provider";case J:return(t._context.displayName||"Context")+".Consumer";case Z:var f=t.render;return t=t.displayName,t||(t=f.displayName||f.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case W:return f=t.displayName||null,f!==null?f:e(t.type)||"Memo";case _:f=t._payload,t=t._init;try{return e(t(f))}catch{}}return null}function a(t){return""+t}function n(t){try{a(t);var f=!1}catch{f=!0}if(f){f=console;var m=f.error,L=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return m.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",L),a(t)}}function s(){}function l(){if(T===0){N=console.log,M=console.info,G=console.warn,z=console.error,V=console.group,Ee=console.groupCollapsed,pe=console.groupEnd;var t={configurable:!0,enumerable:!0,value:s,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}T++}function c(){if(T--,T===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:q({},t,{value:N}),info:q({},t,{value:M}),warn:q({},t,{value:G}),error:q({},t,{value:z}),group:q({},t,{value:V}),groupCollapsed:q({},t,{value:Ee}),groupEnd:q({},t,{value:pe})})}0>T&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function d(t){if(he===void 0)try{throw Error()}catch(m){var f=m.stack.trim().match(/\n( *(at )?)/);he=f&&f[1]||"",we=-1<m.stack.indexOf(`
|
|
18
18
|
at`)?" (<anonymous>)":-1<m.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
19
|
-
`+he+t+we}function h(t,f){if(!t||Pe)return"";var m=Re.get(t);if(m!==void 0)return m;Pe=!0,m=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var L=null;L=H.H,H.H=null,l();try{var $={DetermineComponentFrameRoot:function(){try{if(f){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(ee){var Ce=ee}Reflect.construct(t,[],oe)}else{try{oe.call()}catch(ee){Ce=ee}t.call(oe.prototype)}}else{try{throw Error()}catch(ee){Ce=ee}(oe=t())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(ee){if(ee&&Ce&&typeof ee.stack=="string")return[ee.stack,Ce.stack]}return[null,null]}};$.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var
|
|
19
|
+
`+he+t+we}function h(t,f){if(!t||Pe)return"";var m=Re.get(t);if(m!==void 0)return m;Pe=!0,m=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var L=null;L=H.H,H.H=null,l();try{var $={DetermineComponentFrameRoot:function(){try{if(f){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(ee){var Ce=ee}Reflect.construct(t,[],oe)}else{try{oe.call()}catch(ee){Ce=ee}t.call(oe.prototype)}}else{try{throw Error()}catch(ee){Ce=ee}(oe=t())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(ee){if(ee&&Ce&&typeof ee.stack=="string")return[ee.stack,Ce.stack]}return[null,null]}};$.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var A=Object.getOwnPropertyDescriptor($.DetermineComponentFrameRoot,"name");A&&A.configurable&&Object.defineProperty($.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=$.DetermineComponentFrameRoot(),Q=w[0],ue=w[1];if(Q&&ue){var D=Q.split(`
|
|
20
20
|
`),se=ue.split(`
|
|
21
|
-
`);for(w=
|
|
22
|
-
`+D[
|
|
21
|
+
`);for(w=A=0;A<D.length&&!D[A].includes("DetermineComponentFrameRoot");)A++;for(;w<se.length&&!se[w].includes("DetermineComponentFrameRoot");)w++;if(A===D.length||w===se.length)for(A=D.length-1,w=se.length-1;1<=A&&0<=w&&D[A]!==se[w];)w--;for(;1<=A&&0<=w;A--,w--)if(D[A]!==se[w]){if(A!==1||w!==1)do if(A--,w--,0>w||D[A]!==se[w]){var ge=`
|
|
22
|
+
`+D[A].replace(" at new "," at ");return t.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",t.displayName)),typeof t=="function"&&Re.set(t,ge),ge}while(1<=A&&0<=w);break}}}finally{Pe=!1,H.H=L,c(),Error.prepareStackTrace=m}return D=(D=t?t.displayName||t.name:"")?d(D):"",typeof t=="function"&&Re.set(t,D),D}function p(t){if(t==null)return"";if(typeof t=="function"){var f=t.prototype;return h(t,!(!f||!f.isReactComponent))}if(typeof t=="string")return d(t);switch(t){case ae:return d("Suspense");case X:return d("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case Z:return t=h(t.render,!1),t;case W:return p(t.type);case _:f=t._payload,t=t._init;try{return p(t(f))}catch{}}return""}function x(){var t=H.A;return t===null?null:t.getOwner()}function j(t){if(re.call(t,"key")){var f=Object.getOwnPropertyDescriptor(t,"key").get;if(f&&f.isReactWarning)return!1}return t.key!==void 0}function S(t,f){function m(){Me||(Me=!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)",f))}m.isReactWarning=!0,Object.defineProperty(t,"key",{get:m,configurable:!0})}function b(){var t=e(this.type);return Ge[t]||(Ge[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 u(t,f,m,L,$,A){return m=A.ref,t={$$typeof:E,type:t,key:f,props:A,_owner:$},(m!==void 0?m:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:b}):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.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function g(t,f,m,L,$,A){if(typeof t=="string"||typeof t=="function"||t===I||t===F||t===U||t===ae||t===X||t===K||typeof t=="object"&&t!==null&&(t.$$typeof===_||t.$$typeof===W||t.$$typeof===Y||t.$$typeof===J||t.$$typeof===Z||t.$$typeof===ce||t.getModuleId!==void 0)){var w=f.children;if(w!==void 0)if(L)if(me(w)){for(L=0;L<w.length;L++)y(w[L],t);Object.freeze&&Object.freeze(w)}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 y(w,t)}else w="",(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(w+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),t===null?L="null":me(t)?L="array":t!==void 0&&t.$$typeof===E?(L="<"+(e(t.type)||"Unknown")+" />",w=" Did you accidentally export a JSX literal instead of a component?"):L=typeof t,console.error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",L,w);if(re.call(f,"key")){w=e(t);var Q=Object.keys(f).filter(function(D){return D!=="key"});L=0<Q.length?"{key: someKey, "+Q.join(": ..., ")+": ...}":"{key: someKey}",Ie[w+L]||(Q=0<Q.length?"{"+Q.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
23
23
|
let props = %s;
|
|
24
24
|
<%s {...props} />
|
|
25
25
|
React keys must be passed directly to JSX without using spread:
|
|
26
26
|
let props = %s;
|
|
27
|
-
<%s key={someKey} {...props} />`,L,w,Q,w),Ie[w+L]=!0)}if(w=null,m!==void 0&&(n(m),w=""+m),j(f)&&(n(f.key),w=""+f.key),"key"in f){m={};for(var ue in f)ue!=="key"&&(m[ue]=f[ue])}else m=f;return w&&S(m,typeof t=="function"?t.displayName||t.name||"Unknown":t),u(t,w,
|
|
27
|
+
<%s key={someKey} {...props} />`,L,w,Q,w),Ie[w+L]=!0)}if(w=null,m!==void 0&&(n(m),w=""+m),j(f)&&(n(f.key),w=""+f.key),"key"in f){m={};for(var ue in f)ue!=="key"&&(m[ue]=f[ue])}else m=f;return w&&S(m,typeof t=="function"?t.displayName||t.name||"Unknown":t),u(t,w,A,$,x(),m)}function y(t,f){if(typeof t=="object"&&t&&t.$$typeof!==dt){if(me(t))for(var m=0;m<t.length;m++){var L=t[m];v(L)&&k(L,f)}else if(v(t))t._store&&(t._store.validated=1);else if(t===null||typeof t!="object"?m=null:(m=B&&t[B]||t["@@iterator"],m=typeof m=="function"?m:null),typeof m=="function"&&m!==t.entries&&(m=m.call(t),m!==t))for(;!(t=m.next()).done;)v(t.value)&&k(t.value,f)}}function v(t){return typeof t=="object"&&t!==null&&t.$$typeof===E}function k(t,f){if(t._store&&!t._store.validated&&t.key==null&&(t._store.validated=1,f=O(f),!Be[f])){Be[f]=!0;var m="";t&&t._owner!=null&&t._owner!==x()&&(m=null,typeof t._owner.tag=="number"?m=e(t._owner.type):typeof t._owner.name=="string"&&(m=t._owner.name),m=" It was passed a child from "+m+".");var L=H.getCurrentStack;H.getCurrentStack=function(){var $=p(t.type);return L&&($+=L()||""),$},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',f,m),H.getCurrentStack=L}}function O(t){var f="",m=x();return m&&(m=e(m.type))&&(f=`
|
|
28
28
|
|
|
29
29
|
Check the render method of \``+m+"`."),f||(t=e(t))&&(f=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+t+">."),f}var P=i,E=Symbol.for("react.transitional.element"),R=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),J=Symbol.for("react.consumer"),Y=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),ae=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),K=Symbol.for("react.offscreen"),B=Symbol.iterator,le=Symbol.for("react.client.reference"),H=P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re=Object.prototype.hasOwnProperty,q=Object.assign,ce=Symbol.for("react.client.reference"),me=Array.isArray,T=0,
|
|
31
|
+
Check the top-level render call using <`+t+">."),f}var P=i,E=Symbol.for("react.transitional.element"),R=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),J=Symbol.for("react.consumer"),Y=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),ae=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),K=Symbol.for("react.offscreen"),B=Symbol.iterator,le=Symbol.for("react.client.reference"),H=P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re=Object.prototype.hasOwnProperty,q=Object.assign,ce=Symbol.for("react.client.reference"),me=Array.isArray,T=0,N,M,G,z,V,Ee,pe;s.__reactDisabledLog=!0;var he,we,Pe=!1,Re=new(typeof WeakMap=="function"?WeakMap:Map),dt=Symbol.for("react.client.reference"),Me,Ge={},Ie={},Be={};ve.Fragment=I,ve.jsx=function(t,f,m,L,$){return g(t,f,m,!1,L,$)},ve.jsxs=function(t,f,m,L,$){return g(t,f,m,!0,L,$)}}()),ve}var Fe;function ht(){return Fe||(Fe=1,process.env.NODE_ENV==="production"?je.exports=mt():je.exports=pt()),je.exports}var o=ht();const Ze=i.createContext(),gt=({children:e,defaultComponent:a})=>{const[n,s]=i.useState(!1),[l,c]=i.useState({}),[d,h]=i.useState(a),x={isLoading:n,setIsLoading:s,loadingProps:l,setLoadingProps:c,loadingComponent:d,setLoadingComponent:h,showLoadingFor:(j=2e3,S={})=>{c(S),s(!0),setTimeout(()=>{s(!1)},j)}};return o.jsx(Ze.Provider,{value:x,children:e})},fe=()=>{const e=i.useContext(Ze);if(e===void 0)throw new Error("Non puoi settare il loading");return e},xt="0.0.151",qe=({errorMessage:e,errorShow:a})=>o.jsx("section",{className:a?"":"hidden",children:o.jsxs("div",{className:"container mx-auto",children:[o.jsx("h1",{className:"text-center text-8xl my-12",children:"Errore"}),o.jsx("pre",{className:"text-xl",children:e})]})}),Ue=i.createContext(),vt=({children:e})=>{const[a,n]=i.useState({}),[s,l]=i.useState(!1),c=`Creare un file config.json in public per il corretto funzionamento
|
|
32
32
|
Esempio di config.json:
|
|
33
33
|
|
|
34
34
|
{
|
|
@@ -55,7 +55,7 @@ Esempio di config.json:
|
|
|
55
55
|
"backendToken": "",
|
|
56
56
|
"isDebug": "",
|
|
57
57
|
"showHeaderButton": ""
|
|
58
|
-
}`,d=()=>{const u=new Date,g=String(u.getDate()).padStart(2,"0"),y=String(u.getMonth()+1).padStart(2,"0"),v=u.getFullYear(),k=String(u.getHours()).padStart(2,"0"),O=String(u.getMinutes()).padStart(2,"0"),P=String(u.getSeconds()).padStart(2,"0");return`${g}/${y}/${v} ${k}:${O}:${P}`},h=(u,g)=>new Promise((y,v)=>{const k=indexedDB.open(u,1);k.onupgradeneeded=O=>{const P=O.target.result;P.objectStoreNames.contains(g)||P.createObjectStore(g,{keyPath:"id"})},k.onsuccess=O=>y(O.target.result),k.onerror=O=>v(O.target.error)}),p=async(u,g,y)=>{const v=await h(u,g);return new Promise((k,O)=>{if(!v){O("Errore: DB non disponibile");return}const P=v==null?void 0:v.transaction(g,"readonly"),E=P==null?void 0:P.objectStore(g),R=E==null?void 0:E.get(y);R.onsuccess=()=>k(R.result),R.onerror=I=>O(I.target.error)})},x=async(u,g,y)=>{const v=await h(u,g);return new Promise((k,O)=>{if(!v){O("Errore: DB non disponibile");return}const P=v==null?void 0:v.transaction(g,"readwrite"),E=P==null?void 0:P.objectStore(g),R=E==null?void 0:E.put(y);R.onsuccess=()=>k(R.result),R.onerror=I=>O(I.target.error)})},j=async(u,g)=>{let y=Date.now(),v;do v=await p(u,g,y),v&&y++;while(v);return y},S=async(u,g,y)=>{y.id||(y.id=await j(u,g)),await x(u,g,y)},b=async()=>{try{const g=await(await fetch("/config.json")).json();let y;g.isDevelopment?y=xt:y=(await(await fetch("/package.json")).json()).version;const v={...g,version:y,openIndexedDB:h,getDataIndexedDB:p,setDataIndexedDB:x,generateUniqueId:j,setDataWithAutoId:S,setCurrentDate:d};n(v)}catch(u){console.error(u),l(!0)}};return i.useEffect(()=>{b()},[]),Object.keys(a).length===0?o.jsx(qe,{errorShow:s,errorMessage:c}):o.jsx(Ue.Provider,{value:a,children:e})},te=()=>{const e=i.useContext(Ue);if(e===void 0)throw new Error("Non puoi leggere i config");return e},bt=e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:500,zoomAndPan:"magnify",viewBox:"0 0 375 374.999991",height:500,preserveAspectRatio:"xMidYMid meet",...e},r.createElement("defs",null,r.createElement("g",null),r.createElement("clipPath",{id:"6ca7e2bf04"},r.createElement("path",{d:"M 265.136719 0 L 375 109.863281 L 375 265.136719 L 265.136719 375 L 109.863281 375 L 0 265.136719 L 0 109.863281 L 109.863281 0 Z M 265.136719 0 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"2c77c820c6"},r.createElement("path",{d:"M 12.878906 12.878906 L 362.121094 12.878906 L 362.121094 362.121094 L 12.878906 362.121094 Z M 12.878906 12.878906 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"3d94df7d66"},r.createElement("path",{d:"M 259.804688 12.878906 L 362.121094 115.195312 L 362.121094 259.804688 L 259.804688 362.121094 L 115.195312 362.121094 L 12.878906 259.804688 L 12.878906 115.195312 L 115.195312 12.878906 Z M 259.804688 12.878906 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"8793709a64"},r.createElement("path",{d:"M 12.878906 12.878906 L 362.109375 12.878906 L 362.109375 362.109375 L 12.878906 362.109375 Z M 12.878906 12.878906 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"fdb3fe29d8"},r.createElement("path",{d:"M 259.796875 12.878906 L 362.109375 115.191406 L 362.109375 259.796875 L 259.796875 362.109375 L 115.191406 362.109375 L 12.878906 259.796875 L 12.878906 115.191406 L 115.191406 12.878906 Z M 259.796875 12.878906 ",clipRule:"nonzero"}))),r.createElement("g",{clipPath:"url(#6ca7e2bf04)"},r.createElement("rect",{x:-37.5,width:450,fill:"#b91c1c",y:-37.499999,height:449.999989,fillOpacity:1})),r.createElement("g",{clipPath:"url(#2c77c820c6)"},r.createElement("g",{clipPath:"url(#3d94df7d66)"},r.createElement("path",{fill:"#b91c1c",d:"M 12.878906 12.878906 L 362.121094 12.878906 L 362.121094 362.121094 L 12.878906 362.121094 Z M 12.878906 12.878906 ",fillOpacity:1,fillRule:"nonzero"}))),r.createElement("g",{clipPath:"url(#8793709a64)"},r.createElement("g",{clipPath:"url(#fdb3fe29d8)"},r.createElement("path",{strokeLinecap:"butt",transform:"matrix(0.75, 0, 0, 0.75, 12.879396, 12.879392)",fill:"none",strokeLinejoin:"miter",d:"M 329.223327 -0.000647072 L 465.640003 136.416029 L 465.640003 329.223333 L 329.223327 465.640009 L 136.416023 465.640009 L -0.000653072 329.223333 L -0.000653072 136.416029 L 136.416023 -0.000647072 Z M 329.223327 -0.000647072 ",stroke:"#ffffff",strokeWidth:34,strokeOpacity:1,strokeMiterlimit:4}))),r.createElement("g",{fill:"#ffffff",fillOpacity:1},r.createElement("g",{transform:"translate(111.648432, 267.442446)"},r.createElement("g",null,r.createElement("path",{d:"M 2.828125 0 L 56.25 -79.859375 L 3.046875 -159.609375 L 37.28125 -159.609375 L 75.90625 -98.046875 L 114.53125 -159.609375 L 148.765625 -159.609375 L 95.5625 -79.859375 L 148.984375 0 L 114.765625 0 L 75.671875 -60.65625 L 37.046875 0 Z M 2.828125 0 "}))))),yt=e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:500,zoomAndPan:"magnify",viewBox:"0 0 375 374.999991",height:500,preserveAspectRatio:"xMidYMid meet",...e},r.createElement("defs",null,r.createElement("g",null),r.createElement("clipPath",{id:"30562604dd"},r.createElement("path",{d:"M 187.5 0 C 83.945312 0 0 83.945312 0 187.5 C 0 291.054688 83.945312 375 187.5 375 C 291.054688 375 375 291.054688 375 187.5 C 375 83.945312 291.054688 0 187.5 0 Z M 187.5 0 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"971fcd5f72"},r.createElement("path",{d:"M 18.570312 18.570312 L 356.429688 18.570312 L 356.429688 356.429688 L 18.570312 356.429688 Z M 18.570312 18.570312 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"e891a7f57e"},r.createElement("path",{d:"M 187.5 18.570312 C 94.203125 18.570312 18.570312 94.203125 18.570312 187.5 C 18.570312 280.796875 94.203125 356.429688 187.5 356.429688 C 280.796875 356.429688 356.429688 280.796875 356.429688 187.5 C 356.429688 94.203125 280.796875 18.570312 187.5 18.570312 Z M 187.5 18.570312 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"19a9ddc130"},r.createElement("path",{d:"M 18.570312 18.570312 L 356.070312 18.570312 L 356.070312 356.070312 L 18.570312 356.070312 Z M 18.570312 18.570312 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"5e650d5bd0"},r.createElement("path",{d:"M 187.496094 18.570312 C 94.199219 18.570312 18.570312 94.199219 18.570312 187.496094 C 18.570312 280.792969 94.199219 356.421875 187.496094 356.421875 C 280.792969 356.421875 356.421875 280.792969 356.421875 187.496094 C 356.421875 94.199219 280.792969 18.570312 187.496094 18.570312 Z M 187.496094 18.570312 ",clipRule:"nonzero"}))),r.createElement("g",{clipPath:"url(#30562604dd)"},r.createElement("rect",{x:-37.5,width:450,fill:"#1d4ed8",y:-37.499999,height:449.999989,fillOpacity:1})),r.createElement("g",{clipPath:"url(#971fcd5f72)"},r.createElement("g",{clipPath:"url(#e891a7f57e)"},r.createElement("path",{fill:"#1d4ed8",d:"M 18.570312 18.570312 L 356.429688 18.570312 L 356.429688 356.429688 L 18.570312 356.429688 Z M 18.570312 18.570312 ",fillOpacity:1,fillRule:"nonzero"}))),r.createElement("g",{clipPath:"url(#19a9ddc130)"},r.createElement("g",{clipPath:"url(#5e650d5bd0)"},r.createElement("path",{strokeLinecap:"butt",transform:"matrix(0.75, 0, 0, 0.75, 18.570291, 18.570286)",fill:"none",strokeLinejoin:"miter",d:"M 225.234419 0.0000349326 C 100.838577 0.0000349326 0.0000289326 100.838583 0.0000289326 225.234425 C 0.0000289326 349.630266 100.838577 450.468815 225.234419 450.468815 C 349.63026 450.468815 450.468809 349.630266 450.468809 225.234425 C 450.468809 100.838583 349.63026 0.0000349326 225.234419 0.0000349326 Z M 225.234419 0.0000349326 ",stroke:"#ffffff",strokeWidth:34,strokeOpacity:1,strokeMiterlimit:4}))),r.createElement("g",{fill:"#ffffff",fillOpacity:1},r.createElement("g",{transform:"translate(136.121787, 300.837436)"},r.createElement("g",null,r.createElement("path",{d:"M 60 -193.78125 C 54.707031 -193.78125 50.109375 -195.734375 46.203125 -199.640625 C 42.296875 -203.554688 40.34375 -208.15625 40.34375 -213.4375 C 40.34375 -218.726562 42.296875 -223.328125 46.203125 -227.234375 C 50.109375 -231.140625 54.707031 -233.09375 60 -233.09375 C 65.28125 -233.09375 69.875 -231.140625 73.78125 -227.234375 C 77.695312 -223.328125 79.65625 -218.726562 79.65625 -213.4375 C 79.65625 -208.15625 77.695312 -203.554688 73.78125 -199.640625 C 69.875 -195.734375 65.28125 -193.78125 60 -193.78125 Z M 45.171875 4.828125 C 39.191406 4.828125 35.28125 2.414062 33.4375 -2.40625 C 31.601562 -7.238281 30.6875 -13.675781 30.6875 -21.71875 C 30.6875 -34.59375 31.773438 -47.234375 33.953125 -59.640625 C 36.140625 -72.054688 38.328125 -83.894531 40.515625 -95.15625 C 42.703125 -106.425781 43.796875 -116.890625 43.796875 -126.546875 C 43.796875 -129.078125 43.675781 -131.832031 43.4375 -134.8125 C 43.207031 -137.800781 42.632812 -140.101562 41.71875 -141.71875 C 38.039062 -139.414062 33.269531 -135.617188 27.40625 -130.328125 C 21.550781 -125.046875 16.898438 -119.1875 13.453125 -112.75 C 11.835938 -114.363281 11.03125 -116.550781 11.03125 -119.3125 C 11.03125 -123.21875 12.582031 -127.46875 15.6875 -132.0625 C 18.789062 -136.65625 22.925781 -141.078125 28.09375 -145.328125 C 33.269531 -149.585938 38.847656 -153.097656 44.828125 -155.859375 C 50.804688 -158.617188 56.664062 -160 62.40625 -160 C 67.695312 -160 71.085938 -158.734375 72.578125 -156.203125 C 74.078125 -153.671875 74.828125 -150.453125 74.828125 -146.546875 C 74.828125 -140.796875 74.078125 -133.378906 72.578125 -124.296875 C 71.085938 -115.222656 69.363281 -105.515625 67.40625 -95.171875 C 65.457031 -84.828125 63.734375 -74.484375 62.234375 -64.140625 C 60.742188 -53.796875 60 -44.367188 60 -35.859375 C 60 -31.492188 60.226562 -27.414062 60.6875 -23.625 C 61.144531 -19.832031 61.71875 -16.671875 62.40625 -14.140625 C 68.15625 -16.671875 73.613281 -20.40625 78.78125 -25.34375 C 83.957031 -30.28125 87.8125 -34.9375 90.34375 -39.3125 C 91.71875 -37.238281 92.40625 -35.050781 92.40625 -32.75 C 92.40625 -29.070312 90.796875 -25.050781 87.578125 -20.6875 C 84.359375 -16.320312 80.332031 -12.179688 75.5 -8.265625 C 70.675781 -4.359375 65.5625 -1.203125 60.15625 1.203125 C 54.757812 3.617188 49.765625 4.828125 45.171875 4.828125 Z M 45.171875 4.828125 "}))))),Et=e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:500,zoomAndPan:"magnify",viewBox:"0 0 375 374.999991",height:500,preserveAspectRatio:"xMidYMid meet",...e},r.createElement("defs",null,r.createElement("g",null),r.createElement("clipPath",{id:"59a10ac27a"},r.createElement("path",{d:"M 17.179688 32.695312 L 360 32.695312 L 360 337.5 L 17.179688 337.5 Z M 17.179688 32.695312 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"664b27481e"},r.createElement("path",{d:"M 207.042969 43.574219 L 356.394531 304.941406 C 360.242188 311.675781 360.214844 319.953125 356.324219 326.660156 C 352.429688 333.371094 345.257812 337.5 337.5 337.5 L 39.375 337.5 C 31.617188 337.5 24.445312 333.371094 20.554688 326.660156 C 16.660156 319.953125 16.632812 311.675781 20.480469 304.941406 L 169.832031 43.574219 C 173.648438 36.898438 180.746094 32.777344 188.4375 32.777344 C 196.128906 32.777344 203.226562 36.898438 207.042969 43.574219 Z M 207.042969 43.574219 ",clipRule:"nonzero"}))),r.createElement("g",{clipPath:"url(#59a10ac27a)"},r.createElement("g",{clipPath:"url(#664b27481e)"},r.createElement("path",{fill:"#d97706",d:"M 1.875 11.015625 L 375.546875 11.015625 L 375.546875 337.5 L 1.875 337.5 Z M 1.875 11.015625 ",fillOpacity:1,fillRule:"nonzero"}))),r.createElement("g",{fill:"#ffffff",fillOpacity:1},r.createElement("g",{transform:"translate(158.410439, 295.655517)"},r.createElement("g",null,r.createElement("path",{d:"M 46.890625 -63.21875 C 46.890625 -63.21875 46.890625 -64.445312 46.890625 -66.90625 L 46.890625 -176.46875 C 46.890625 -178.925781 46.1875 -180.859375 44.78125 -182.265625 C 43.375 -183.671875 41.441406 -184.375 38.984375 -184.375 L 21.078125 -184.375 C 18.617188 -184.375 16.6875 -183.671875 15.28125 -182.265625 C 13.875 -180.859375 13.171875 -178.925781 13.171875 -176.46875 L 13.171875 -66.90625 C 13.171875 -64.445312 13.875 -62.515625 15.28125 -61.109375 C 16.6875 -59.703125 18.617188 -59 21.078125 -59 L 38.984375 -59 C 41.441406 -59 43.375 -59.703125 44.78125 -61.109375 C 46.1875 -62.515625 46.890625 -63.21875 46.890625 -63.21875 Z M 46.890625 -4.21875 C 46.890625 -4.21875 46.890625 -5.445312 46.890625 -7.90625 L 46.890625 -25.546875 C 46.890625 -28.003906 46.1875 -29.9375 44.78125 -31.34375 C 43.375 -32.75 41.441406 -33.453125 38.984375 -33.453125 L 21.078125 -33.453125 C 18.617188 -33.453125 16.6875 -32.75 15.28125 -31.34375 C 13.875 -29.9375 13.171875 -28.003906 13.171875 -25.546875 L 13.171875 -7.90625 C 13.171875 -5.445312 13.875 -3.515625 15.28125 -2.109375 C 16.6875 -0.703125 18.617188 0 21.078125 0 L 38.984375 0 C 41.441406 0 43.375 -0.703125 44.78125 -2.109375 C 46.1875 -3.515625 46.890625 -4.21875 46.890625 -4.21875 Z M 46.890625 -4.21875 "})))));var Ve={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},De=i.createContext&&i.createContext(Ve),wt=["attr","size","title"];function Ct(e,a){if(e==null)return{};var n=jt(e,a),s,l;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(l=0;l<c.length;l++)s=c[l],!(a.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function jt(e,a){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(a.indexOf(s)>=0)continue;n[s]=e[s]}return n}function Se(){return Se=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Se.apply(this,arguments)}function We(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);a&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,s)}return n}function ke(e){for(var a=1;a<arguments.length;a++){var n=arguments[a]!=null?arguments[a]:{};a%2?We(Object(n),!0).forEach(function(s){St(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):We(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function St(e,a,n){return a=kt(a),a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function kt(e){var a=Ot(e,"string");return typeof a=="symbol"?a:a+""}function Ot(e,a){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,a||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(e)}function Je(e){return e&&e.map((a,n)=>i.createElement(a.tag,ke({key:n},a.attr),Je(a.child)))}function ie(e){return a=>i.createElement(Lt,Se({attr:ke({},e.attr)},a),Je(e.child))}function Lt(e){var a=n=>{var{attr:s,size:l,title:c}=e,d=Ct(e,wt),h=l||n.size||"1em",p;return n.className&&(p=n.className),e.className&&(p=(p?p+" ":"")+e.className),i.createElement("svg",Se({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,s,d,{className:p,style:ke(ke({color:e.color||n.color},n.style),e.style),height:h,width:h,xmlns:"http://www.w3.org/2000/svg"}),c&&i.createElement("title",null,c),e.children)};return De!==void 0?i.createElement(De.Consumer,null,n=>a(n)):a(Ve)}function Pt(e){return ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M17.47 250.9C88.82 328.1 158 397.6 224.5 485.5c72.3-143.8 146.3-288.1 268.4-444.37L460 26.06C356.9 135.4 276.8 238.9 207.2 361.9c-48.4-43.6-126.62-105.3-174.38-137z"},child:[]}]})(e)}const Xe=i.createContext(),Rt=({children:e})=>{const[a,n]=i.useState(!1),[s,l]=i.useState(),[c,d]=i.useState(),S={showAlert:a,setShowAlert:n,typeAlert:s,setTypeAlert:l,messageAlert:c,setMessageAlert:d,alertConfig:{danger:{bgColor:"bg-danger",textColor:"text-danger-text",buttonBg:"bg-danger",hoverBg:"hover:bg-danger-hover",focusRing:"focus:ring-danger-progress",progressColor:"bg-danger-progress"},info:{bgColor:"bg-info",textColor:"text-info-text",buttonBg:"bg-info",hoverBg:"hover:bg-info-hover",focusRing:"focus:ring-info-progress",progressColor:"bg-info-progress"},success:{bgColor:"bg-success",textColor:"text-success-text",buttonBg:"bg-success",hoverBg:"hover:bg-success-hover",focusRing:"focus:ring-success-progress",progressColor:"bg-success-progress"},warning:{bgColor:"bg-warning",textColor:"text-warning-text",buttonBg:"bg-warning",hoverBg:"hover:bg-warning-hover",focusRing:"focus:ring-warning-progress",progressColor:"bg-warning-progress"}},getIcon:b=>{switch(b){case"danger":return o.jsx(bt,{className:"w-[20px] h-[20px]"});case"info":return o.jsx(yt,{className:"w-[20px] h-[20px]"});case"success":return o.jsx(Pt,{className:"text-xl"});case"warning":return o.jsx(Et,{className:"w-[20px] h-[20px]"})}},closeAlert:()=>{n(!a)},activeAlert:(b,u)=>{n(!1),setTimeout(()=>{l(b),d(u),n(!0)},50)}};return o.jsx(Xe.Provider,{value:S,children:e})},ne=()=>{const e=i.useContext(Xe);if(e===void 0)throw new Error("Non puoi modificare l'alert");return e};let de;const Ke=async(e,a,n,s,l,c)=>{if(de)return de;try{const h=await(await fetch("/config.json")).json(),p=h.baseUri,{unauthorized:x,notFound:j,defaultMessage:S}=h.axiosErrors,b=h.axiosTimeout;return de=He.create({baseURL:p,timeout:b}),de.interceptors.request.use(u=>u),de.interceptors.response.use(u=>u,u=>{if(u.response)switch(e==null||e(!0),a==null||a("danger"),u.response.status){case 401:localStorage.removeItem("accessToken"),n==null||n(x),s==null||s();break;case 404:n==null||n(j),l==null||l(u);break;default:n==null||n(`${S} ${u.response.status||""} ${u.response.data.error||""}`),c==null||c(u)}return Promise.reject(u)}),de}catch(d){console.error(d)}},Qe=i.createContext(),Tt=({children:e})=>{const{heartbeatEndpoint:a,firstPrivatePath:n,infiniteSession:s,timeDeducted:l,authenticatedEndpoint:c,autoLogin:d,setCurrentDate:h,isDebug:p,backendToken:x,useCustomLoginTimeout:j,customLoginTimeout:S,tokenLog:b,timerInfiniteSession:u}=te(),{setIsLoading:g,showLoadingFor:y}=fe(),{setShowAlert:v,setMessageAlert:k,setTypeAlert:O,activeAlert:P}=ne(),E=C.useNavigate(),[R,I]=i.useState(null),[U,F]=i.useState(),[J,Y]=i.useState(),[Z,ae]=i.useState(),[X,W]=i.useState(!1),_=async(T=B,A,M)=>await Ke(v,O,k,T,A,M),K=async(T=null,A)=>{T&&T.preventDefault(),W(!0);try{j||g(!0),y(S),v(!1);const G=await(await _()).post(c,{auth:A}),z=G.headers.token,V=G.data;z&&(localStorage.setItem("accessToken",z),localStorage.setItem("user",JSON.stringify(V)),I(!0),F(z),E(`${n}${V.id}`))}catch(M){console.error(M)}finally{W(!1),j||g(!1)}},B=()=>{localStorage.removeItem("accessToken"),localStorage.removeItem("id"),localStorage.removeItem("user"),I(!1),F(null)},le=async()=>{const T=localStorage.getItem("accessToken");if(H()){b&&console.log("Token valido, inutile fare la chiamata heartbeat");return}try{const z=(await(await _()).get(`${a}`,{headers:{Authorization:T}})).headers.token;localStorage.setItem("accessToken",z),F(z),p&&console.log("[Auth]: Nuovo token: ",z,"Data:",h())}catch(M){console.error(M),B()}},H=T=>{const A=T||U;if(!A)return;const M="Token non valido";try{const G=_e(A);if(!G.exp){b&&console.warn("[Auth]: Token senza data di scadenza, eseguo logout."),B(),P("danger",M);return}const z=Math.floor(Date.now()/1e3),V=(G.exp-z)*1e3;if(V<=0){b&&console.warn("[Auth]: Token scaduto, eseguo logout."),B(),P("danger",M);return}ae(V),Y(V-l);const Ee=V-l;if(b){const pe=Math.floor(V/1e3),he=Math.floor(pe/60),we=pe%60;console.log(`[Auth]: Token valido per ancora: ${he} minuti e ${we} secondi`),console.log("[Auth]: Token:",A)}return Ee}catch(G){b&&console.error("[Auth]: Errore nella decodifica del token:",G),B(),P("danger",M)}},re=T=>{if(!T)return!1;try{const A=_e(T),M=Math.floor(Date.now()/1e3);return!A.exp||A.exp<M?(console.warn("[Auth]: Token scaduto o non valido"),!1):!0}catch(A){return console.error("[Auth]: Token non valido o corrotto",A),!1}},q=async T=>{try{const G=(await(await _()).get(a,{headers:{Authorization:T}})).data;G&&(localStorage.setItem("user",JSON.stringify(G)),localStorage.setItem("accessToken",T),I(!0),E(`${n}${G.id}`))}catch(A){console.error(A)}},ce=()=>{const T=localStorage.getItem("accessToken");re(T)?(b&&console.log("[Auth]: Ricarico pagina → controllo scadenza token"),H(T)):(b&&console.warn("[Auth]: Token non valido al reload, eseguo logout"),B())};i.useEffect(()=>{const T=localStorage.getItem("accessToken");if(!re(T)){B();return}I(!0)},[]),i.useEffect(()=>{d&&!R&&!X&&(b&&console.log("[Auth]: Tentativo di autologin con backendToken"),q(x))},[d,R,X]),i.useEffect(()=>{if(document.readyState==="complete")ce();else return window.addEventListener("load",ce),()=>window.removeEventListener("load",ce)},[]),i.useEffect(()=>{if(d)return;const T=localStorage.getItem("accessToken"),A=H(),M=u||A;b&&console.log("intervalTime:",M),b&&console.log("[Auth]: intervallo per il prossimo token:",M);let G;s&&T&&(b&&console.log("[Auth]: Entrato dentro il timer della sessione infinita"),G=setInterval(()=>{le()},M));let z;return!s&&T&&(b&&console.log("[Auth]: Entrato dentro il timer della sessione con scadenza del token"),z=setTimeout(()=>{B(),P("danger","Sessione scaduta")},Z)),()=>{G&&clearInterval(G),z&&clearTimeout(z)}},[U,J]);const me={isAuthenticated:R,setIsAuthenticated:I,login:K,logout:B,setCurrentToken:F,createAxiosInstances:_,fetchHeartbeat:le,getTokenExpiry:H,checkTokenValidity:re,fetchUser:q,handleLoad:ce};return o.jsx(Qe.Provider,{value:me,children:e})},ye=()=>{const e=i.useContext(Qe);if(e===void 0)throw new Error("Non sei dentro al Auth Provider");return e},et=i.createContext(),Nt=({children:e,publicRoutes:a=[],privateRoutes:n=[]})=>o.jsx(et.Provider,{value:{publicRoutes:a,privateRoutes:n},children:e}),tt=()=>{const e=i.useContext(et);if(e===void 0)throw new Error(`Errore: Le rotte non sono state inizializzate correttamente.
|
|
58
|
+
}`,d=()=>{const u=new Date,g=String(u.getDate()).padStart(2,"0"),y=String(u.getMonth()+1).padStart(2,"0"),v=u.getFullYear(),k=String(u.getHours()).padStart(2,"0"),O=String(u.getMinutes()).padStart(2,"0"),P=String(u.getSeconds()).padStart(2,"0");return`${g}/${y}/${v} ${k}:${O}:${P}`},h=(u,g)=>new Promise((y,v)=>{const k=indexedDB.open(u,1);k.onupgradeneeded=O=>{const P=O.target.result;P.objectStoreNames.contains(g)||P.createObjectStore(g,{keyPath:"id"})},k.onsuccess=O=>y(O.target.result),k.onerror=O=>v(O.target.error)}),p=async(u,g,y)=>{const v=await h(u,g);return new Promise((k,O)=>{if(!v){O("Errore: DB non disponibile");return}const P=v==null?void 0:v.transaction(g,"readonly"),E=P==null?void 0:P.objectStore(g),R=E==null?void 0:E.get(y);R.onsuccess=()=>k(R.result),R.onerror=I=>O(I.target.error)})},x=async(u,g,y)=>{const v=await h(u,g);return new Promise((k,O)=>{if(!v){O("Errore: DB non disponibile");return}const P=v==null?void 0:v.transaction(g,"readwrite"),E=P==null?void 0:P.objectStore(g),R=E==null?void 0:E.put(y);R.onsuccess=()=>k(R.result),R.onerror=I=>O(I.target.error)})},j=async(u,g)=>{let y=Date.now(),v;do v=await p(u,g,y),v&&y++;while(v);return y},S=async(u,g,y)=>{y.id||(y.id=await j(u,g)),await x(u,g,y)},b=async()=>{try{const g=await(await fetch("/config.json")).json();let y;g.isDevelopment?y=xt:y=(await(await fetch("/package.json")).json()).version;const v={...g,version:y,openIndexedDB:h,getDataIndexedDB:p,setDataIndexedDB:x,generateUniqueId:j,setDataWithAutoId:S,setCurrentDate:d};n(v)}catch(u){console.error(u),l(!0)}};return i.useEffect(()=>{b()},[]),Object.keys(a).length===0?o.jsx(qe,{errorShow:s,errorMessage:c}):o.jsx(Ue.Provider,{value:a,children:e})},te=()=>{const e=i.useContext(Ue);if(e===void 0)throw new Error("Non puoi leggere i config");return e},bt=e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:500,zoomAndPan:"magnify",viewBox:"0 0 375 374.999991",height:500,preserveAspectRatio:"xMidYMid meet",...e},r.createElement("defs",null,r.createElement("g",null),r.createElement("clipPath",{id:"6ca7e2bf04"},r.createElement("path",{d:"M 265.136719 0 L 375 109.863281 L 375 265.136719 L 265.136719 375 L 109.863281 375 L 0 265.136719 L 0 109.863281 L 109.863281 0 Z M 265.136719 0 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"2c77c820c6"},r.createElement("path",{d:"M 12.878906 12.878906 L 362.121094 12.878906 L 362.121094 362.121094 L 12.878906 362.121094 Z M 12.878906 12.878906 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"3d94df7d66"},r.createElement("path",{d:"M 259.804688 12.878906 L 362.121094 115.195312 L 362.121094 259.804688 L 259.804688 362.121094 L 115.195312 362.121094 L 12.878906 259.804688 L 12.878906 115.195312 L 115.195312 12.878906 Z M 259.804688 12.878906 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"8793709a64"},r.createElement("path",{d:"M 12.878906 12.878906 L 362.109375 12.878906 L 362.109375 362.109375 L 12.878906 362.109375 Z M 12.878906 12.878906 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"fdb3fe29d8"},r.createElement("path",{d:"M 259.796875 12.878906 L 362.109375 115.191406 L 362.109375 259.796875 L 259.796875 362.109375 L 115.191406 362.109375 L 12.878906 259.796875 L 12.878906 115.191406 L 115.191406 12.878906 Z M 259.796875 12.878906 ",clipRule:"nonzero"}))),r.createElement("g",{clipPath:"url(#6ca7e2bf04)"},r.createElement("rect",{x:-37.5,width:450,fill:"#b91c1c",y:-37.499999,height:449.999989,fillOpacity:1})),r.createElement("g",{clipPath:"url(#2c77c820c6)"},r.createElement("g",{clipPath:"url(#3d94df7d66)"},r.createElement("path",{fill:"#b91c1c",d:"M 12.878906 12.878906 L 362.121094 12.878906 L 362.121094 362.121094 L 12.878906 362.121094 Z M 12.878906 12.878906 ",fillOpacity:1,fillRule:"nonzero"}))),r.createElement("g",{clipPath:"url(#8793709a64)"},r.createElement("g",{clipPath:"url(#fdb3fe29d8)"},r.createElement("path",{strokeLinecap:"butt",transform:"matrix(0.75, 0, 0, 0.75, 12.879396, 12.879392)",fill:"none",strokeLinejoin:"miter",d:"M 329.223327 -0.000647072 L 465.640003 136.416029 L 465.640003 329.223333 L 329.223327 465.640009 L 136.416023 465.640009 L -0.000653072 329.223333 L -0.000653072 136.416029 L 136.416023 -0.000647072 Z M 329.223327 -0.000647072 ",stroke:"#ffffff",strokeWidth:34,strokeOpacity:1,strokeMiterlimit:4}))),r.createElement("g",{fill:"#ffffff",fillOpacity:1},r.createElement("g",{transform:"translate(111.648432, 267.442446)"},r.createElement("g",null,r.createElement("path",{d:"M 2.828125 0 L 56.25 -79.859375 L 3.046875 -159.609375 L 37.28125 -159.609375 L 75.90625 -98.046875 L 114.53125 -159.609375 L 148.765625 -159.609375 L 95.5625 -79.859375 L 148.984375 0 L 114.765625 0 L 75.671875 -60.65625 L 37.046875 0 Z M 2.828125 0 "}))))),yt=e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:500,zoomAndPan:"magnify",viewBox:"0 0 375 374.999991",height:500,preserveAspectRatio:"xMidYMid meet",...e},r.createElement("defs",null,r.createElement("g",null),r.createElement("clipPath",{id:"30562604dd"},r.createElement("path",{d:"M 187.5 0 C 83.945312 0 0 83.945312 0 187.5 C 0 291.054688 83.945312 375 187.5 375 C 291.054688 375 375 291.054688 375 187.5 C 375 83.945312 291.054688 0 187.5 0 Z M 187.5 0 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"971fcd5f72"},r.createElement("path",{d:"M 18.570312 18.570312 L 356.429688 18.570312 L 356.429688 356.429688 L 18.570312 356.429688 Z M 18.570312 18.570312 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"e891a7f57e"},r.createElement("path",{d:"M 187.5 18.570312 C 94.203125 18.570312 18.570312 94.203125 18.570312 187.5 C 18.570312 280.796875 94.203125 356.429688 187.5 356.429688 C 280.796875 356.429688 356.429688 280.796875 356.429688 187.5 C 356.429688 94.203125 280.796875 18.570312 187.5 18.570312 Z M 187.5 18.570312 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"19a9ddc130"},r.createElement("path",{d:"M 18.570312 18.570312 L 356.070312 18.570312 L 356.070312 356.070312 L 18.570312 356.070312 Z M 18.570312 18.570312 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"5e650d5bd0"},r.createElement("path",{d:"M 187.496094 18.570312 C 94.199219 18.570312 18.570312 94.199219 18.570312 187.496094 C 18.570312 280.792969 94.199219 356.421875 187.496094 356.421875 C 280.792969 356.421875 356.421875 280.792969 356.421875 187.496094 C 356.421875 94.199219 280.792969 18.570312 187.496094 18.570312 Z M 187.496094 18.570312 ",clipRule:"nonzero"}))),r.createElement("g",{clipPath:"url(#30562604dd)"},r.createElement("rect",{x:-37.5,width:450,fill:"#1d4ed8",y:-37.499999,height:449.999989,fillOpacity:1})),r.createElement("g",{clipPath:"url(#971fcd5f72)"},r.createElement("g",{clipPath:"url(#e891a7f57e)"},r.createElement("path",{fill:"#1d4ed8",d:"M 18.570312 18.570312 L 356.429688 18.570312 L 356.429688 356.429688 L 18.570312 356.429688 Z M 18.570312 18.570312 ",fillOpacity:1,fillRule:"nonzero"}))),r.createElement("g",{clipPath:"url(#19a9ddc130)"},r.createElement("g",{clipPath:"url(#5e650d5bd0)"},r.createElement("path",{strokeLinecap:"butt",transform:"matrix(0.75, 0, 0, 0.75, 18.570291, 18.570286)",fill:"none",strokeLinejoin:"miter",d:"M 225.234419 0.0000349326 C 100.838577 0.0000349326 0.0000289326 100.838583 0.0000289326 225.234425 C 0.0000289326 349.630266 100.838577 450.468815 225.234419 450.468815 C 349.63026 450.468815 450.468809 349.630266 450.468809 225.234425 C 450.468809 100.838583 349.63026 0.0000349326 225.234419 0.0000349326 Z M 225.234419 0.0000349326 ",stroke:"#ffffff",strokeWidth:34,strokeOpacity:1,strokeMiterlimit:4}))),r.createElement("g",{fill:"#ffffff",fillOpacity:1},r.createElement("g",{transform:"translate(136.121787, 300.837436)"},r.createElement("g",null,r.createElement("path",{d:"M 60 -193.78125 C 54.707031 -193.78125 50.109375 -195.734375 46.203125 -199.640625 C 42.296875 -203.554688 40.34375 -208.15625 40.34375 -213.4375 C 40.34375 -218.726562 42.296875 -223.328125 46.203125 -227.234375 C 50.109375 -231.140625 54.707031 -233.09375 60 -233.09375 C 65.28125 -233.09375 69.875 -231.140625 73.78125 -227.234375 C 77.695312 -223.328125 79.65625 -218.726562 79.65625 -213.4375 C 79.65625 -208.15625 77.695312 -203.554688 73.78125 -199.640625 C 69.875 -195.734375 65.28125 -193.78125 60 -193.78125 Z M 45.171875 4.828125 C 39.191406 4.828125 35.28125 2.414062 33.4375 -2.40625 C 31.601562 -7.238281 30.6875 -13.675781 30.6875 -21.71875 C 30.6875 -34.59375 31.773438 -47.234375 33.953125 -59.640625 C 36.140625 -72.054688 38.328125 -83.894531 40.515625 -95.15625 C 42.703125 -106.425781 43.796875 -116.890625 43.796875 -126.546875 C 43.796875 -129.078125 43.675781 -131.832031 43.4375 -134.8125 C 43.207031 -137.800781 42.632812 -140.101562 41.71875 -141.71875 C 38.039062 -139.414062 33.269531 -135.617188 27.40625 -130.328125 C 21.550781 -125.046875 16.898438 -119.1875 13.453125 -112.75 C 11.835938 -114.363281 11.03125 -116.550781 11.03125 -119.3125 C 11.03125 -123.21875 12.582031 -127.46875 15.6875 -132.0625 C 18.789062 -136.65625 22.925781 -141.078125 28.09375 -145.328125 C 33.269531 -149.585938 38.847656 -153.097656 44.828125 -155.859375 C 50.804688 -158.617188 56.664062 -160 62.40625 -160 C 67.695312 -160 71.085938 -158.734375 72.578125 -156.203125 C 74.078125 -153.671875 74.828125 -150.453125 74.828125 -146.546875 C 74.828125 -140.796875 74.078125 -133.378906 72.578125 -124.296875 C 71.085938 -115.222656 69.363281 -105.515625 67.40625 -95.171875 C 65.457031 -84.828125 63.734375 -74.484375 62.234375 -64.140625 C 60.742188 -53.796875 60 -44.367188 60 -35.859375 C 60 -31.492188 60.226562 -27.414062 60.6875 -23.625 C 61.144531 -19.832031 61.71875 -16.671875 62.40625 -14.140625 C 68.15625 -16.671875 73.613281 -20.40625 78.78125 -25.34375 C 83.957031 -30.28125 87.8125 -34.9375 90.34375 -39.3125 C 91.71875 -37.238281 92.40625 -35.050781 92.40625 -32.75 C 92.40625 -29.070312 90.796875 -25.050781 87.578125 -20.6875 C 84.359375 -16.320312 80.332031 -12.179688 75.5 -8.265625 C 70.675781 -4.359375 65.5625 -1.203125 60.15625 1.203125 C 54.757812 3.617188 49.765625 4.828125 45.171875 4.828125 Z M 45.171875 4.828125 "}))))),Et=e=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:500,zoomAndPan:"magnify",viewBox:"0 0 375 374.999991",height:500,preserveAspectRatio:"xMidYMid meet",...e},r.createElement("defs",null,r.createElement("g",null),r.createElement("clipPath",{id:"59a10ac27a"},r.createElement("path",{d:"M 17.179688 32.695312 L 360 32.695312 L 360 337.5 L 17.179688 337.5 Z M 17.179688 32.695312 ",clipRule:"nonzero"})),r.createElement("clipPath",{id:"664b27481e"},r.createElement("path",{d:"M 207.042969 43.574219 L 356.394531 304.941406 C 360.242188 311.675781 360.214844 319.953125 356.324219 326.660156 C 352.429688 333.371094 345.257812 337.5 337.5 337.5 L 39.375 337.5 C 31.617188 337.5 24.445312 333.371094 20.554688 326.660156 C 16.660156 319.953125 16.632812 311.675781 20.480469 304.941406 L 169.832031 43.574219 C 173.648438 36.898438 180.746094 32.777344 188.4375 32.777344 C 196.128906 32.777344 203.226562 36.898438 207.042969 43.574219 Z M 207.042969 43.574219 ",clipRule:"nonzero"}))),r.createElement("g",{clipPath:"url(#59a10ac27a)"},r.createElement("g",{clipPath:"url(#664b27481e)"},r.createElement("path",{fill:"#d97706",d:"M 1.875 11.015625 L 375.546875 11.015625 L 375.546875 337.5 L 1.875 337.5 Z M 1.875 11.015625 ",fillOpacity:1,fillRule:"nonzero"}))),r.createElement("g",{fill:"#ffffff",fillOpacity:1},r.createElement("g",{transform:"translate(158.410439, 295.655517)"},r.createElement("g",null,r.createElement("path",{d:"M 46.890625 -63.21875 C 46.890625 -63.21875 46.890625 -64.445312 46.890625 -66.90625 L 46.890625 -176.46875 C 46.890625 -178.925781 46.1875 -180.859375 44.78125 -182.265625 C 43.375 -183.671875 41.441406 -184.375 38.984375 -184.375 L 21.078125 -184.375 C 18.617188 -184.375 16.6875 -183.671875 15.28125 -182.265625 C 13.875 -180.859375 13.171875 -178.925781 13.171875 -176.46875 L 13.171875 -66.90625 C 13.171875 -64.445312 13.875 -62.515625 15.28125 -61.109375 C 16.6875 -59.703125 18.617188 -59 21.078125 -59 L 38.984375 -59 C 41.441406 -59 43.375 -59.703125 44.78125 -61.109375 C 46.1875 -62.515625 46.890625 -63.21875 46.890625 -63.21875 Z M 46.890625 -4.21875 C 46.890625 -4.21875 46.890625 -5.445312 46.890625 -7.90625 L 46.890625 -25.546875 C 46.890625 -28.003906 46.1875 -29.9375 44.78125 -31.34375 C 43.375 -32.75 41.441406 -33.453125 38.984375 -33.453125 L 21.078125 -33.453125 C 18.617188 -33.453125 16.6875 -32.75 15.28125 -31.34375 C 13.875 -29.9375 13.171875 -28.003906 13.171875 -25.546875 L 13.171875 -7.90625 C 13.171875 -5.445312 13.875 -3.515625 15.28125 -2.109375 C 16.6875 -0.703125 18.617188 0 21.078125 0 L 38.984375 0 C 41.441406 0 43.375 -0.703125 44.78125 -2.109375 C 46.1875 -3.515625 46.890625 -4.21875 46.890625 -4.21875 Z M 46.890625 -4.21875 "})))));var Ve={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},De=i.createContext&&i.createContext(Ve),wt=["attr","size","title"];function Ct(e,a){if(e==null)return{};var n=jt(e,a),s,l;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(l=0;l<c.length;l++)s=c[l],!(a.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function jt(e,a){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(a.indexOf(s)>=0)continue;n[s]=e[s]}return n}function Se(){return Se=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Se.apply(this,arguments)}function We(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);a&&(s=s.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,s)}return n}function ke(e){for(var a=1;a<arguments.length;a++){var n=arguments[a]!=null?arguments[a]:{};a%2?We(Object(n),!0).forEach(function(s){St(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):We(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function St(e,a,n){return a=kt(a),a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function kt(e){var a=Ot(e,"string");return typeof a=="symbol"?a:a+""}function Ot(e,a){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,a||"default");if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(e)}function Je(e){return e&&e.map((a,n)=>i.createElement(a.tag,ke({key:n},a.attr),Je(a.child)))}function ie(e){return a=>i.createElement(Lt,Se({attr:ke({},e.attr)},a),Je(e.child))}function Lt(e){var a=n=>{var{attr:s,size:l,title:c}=e,d=Ct(e,wt),h=l||n.size||"1em",p;return n.className&&(p=n.className),e.className&&(p=(p?p+" ":"")+e.className),i.createElement("svg",Se({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,s,d,{className:p,style:ke(ke({color:e.color||n.color},n.style),e.style),height:h,width:h,xmlns:"http://www.w3.org/2000/svg"}),c&&i.createElement("title",null,c),e.children)};return De!==void 0?i.createElement(De.Consumer,null,n=>a(n)):a(Ve)}function Pt(e){return ie({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M17.47 250.9C88.82 328.1 158 397.6 224.5 485.5c72.3-143.8 146.3-288.1 268.4-444.37L460 26.06C356.9 135.4 276.8 238.9 207.2 361.9c-48.4-43.6-126.62-105.3-174.38-137z"},child:[]}]})(e)}const Xe=i.createContext(),Rt=({children:e})=>{const[a,n]=i.useState(!1),[s,l]=i.useState(),[c,d]=i.useState(),S={showAlert:a,setShowAlert:n,typeAlert:s,setTypeAlert:l,messageAlert:c,setMessageAlert:d,alertConfig:{danger:{bgColor:"bg-danger",textColor:"text-danger-text",buttonBg:"bg-danger",hoverBg:"hover:bg-danger-hover",focusRing:"focus:ring-danger-progress",progressColor:"bg-danger-progress"},info:{bgColor:"bg-info",textColor:"text-info-text",buttonBg:"bg-info",hoverBg:"hover:bg-info-hover",focusRing:"focus:ring-info-progress",progressColor:"bg-info-progress"},success:{bgColor:"bg-success",textColor:"text-success-text",buttonBg:"bg-success",hoverBg:"hover:bg-success-hover",focusRing:"focus:ring-success-progress",progressColor:"bg-success-progress"},warning:{bgColor:"bg-warning",textColor:"text-warning-text",buttonBg:"bg-warning",hoverBg:"hover:bg-warning-hover",focusRing:"focus:ring-warning-progress",progressColor:"bg-warning-progress"}},getIcon:b=>{switch(b){case"danger":return o.jsx(bt,{className:"w-[20px] h-[20px]"});case"info":return o.jsx(yt,{className:"w-[20px] h-[20px]"});case"success":return o.jsx(Pt,{className:"text-xl"});case"warning":return o.jsx(Et,{className:"w-[20px] h-[20px]"})}},closeAlert:()=>{n(!a)},activeAlert:(b,u)=>{n(!1),setTimeout(()=>{l(b),d(u),n(!0)},50)}};return o.jsx(Xe.Provider,{value:S,children:e})},ne=()=>{const e=i.useContext(Xe);if(e===void 0)throw new Error("Non puoi modificare l'alert");return e};let de;const Ke=async(e,a,n,s,l,c)=>{if(de)return de;try{const h=await(await fetch("/config.json")).json(),p=h.baseUri,{unauthorized:x,notFound:j,defaultMessage:S}=h.axiosErrors,b=h.axiosTimeout;return de=He.create({baseURL:p,timeout:b}),de.interceptors.request.use(u=>u),de.interceptors.response.use(u=>u,u=>{if(u.response)switch(e==null||e(!0),a==null||a("danger"),u.response.status){case 401:localStorage.removeItem("accessToken"),n==null||n(x),s==null||s();break;case 404:n==null||n(j),l==null||l(u);break;default:n==null||n(`${S} ${u.response.status||""} ${u.response.data.error||""}`),c==null||c(u)}return Promise.reject(u)}),de}catch(d){console.error(d)}},Qe=i.createContext(),Tt=({children:e})=>{const{heartbeatEndpoint:a,firstPrivatePath:n,infiniteSession:s,timeDeducted:l,authenticatedEndpoint:c,autoLogin:d,setCurrentDate:h,isDebug:p,backendToken:x,useCustomLoginTimeout:j,customLoginTimeout:S,tokenLog:b,timerInfiniteSession:u}=te(),{setIsLoading:g,showLoadingFor:y}=fe(),{setShowAlert:v,setMessageAlert:k,setTypeAlert:O,activeAlert:P}=ne(),E=C.useNavigate(),[R,I]=i.useState(null),[U,F]=i.useState(),[J,Y]=i.useState(),[Z,ae]=i.useState(),[X,W]=i.useState(!1),_=async(T=B,N,M)=>await Ke(v,O,k,T,N,M),K=async(T=null,N)=>{T&&T.preventDefault(),W(!0);try{j||g(!0),y(S),v(!1);const G=await(await _()).post(c,{auth:N}),z=G.headers.token,V=G.data;z&&(localStorage.setItem("accessToken",z),localStorage.setItem("user",JSON.stringify(V)),I(!0),F(z),E(`${n}${V.id}`))}catch(M){console.error(M)}finally{W(!1),j||g(!1)}},B=()=>{localStorage.removeItem("accessToken"),localStorage.removeItem("id"),localStorage.removeItem("user"),I(!1),F(null)},le=async()=>{const T=localStorage.getItem("accessToken"),N=H();if(console.log("validToken:",N),N){b&&console.log("Token valido, inutile fare la chiamata heartbeat");return}try{const z=(await(await _()).get(`${a}`,{headers:{Authorization:T}})).headers.token;localStorage.setItem("accessToken",z),F(z),p&&console.log("[Auth]: Nuovo token: ",z,"Data:",h())}catch(M){console.error(M),B()}},H=T=>{const N=T||U;if(!N)return;const M="Token non valido";try{const G=_e(N);if(!G.exp){b&&console.warn("[Auth]: Token senza data di scadenza, eseguo logout."),B(),P("danger",M);return}const z=Math.floor(Date.now()/1e3),V=(G.exp-z)*1e3;if(V<=0){b&&console.warn("[Auth]: Token scaduto, eseguo logout."),B(),P("danger",M);return}ae(V),Y(V-l);const Ee=V-l;if(b){const pe=Math.floor(V/1e3),he=Math.floor(pe/60),we=pe%60;console.log(`[Auth]: Token valido per ancora: ${he} minuti e ${we} secondi`),console.log("[Auth]: Token:",N)}return Ee}catch(G){b&&console.error("[Auth]: Errore nella decodifica del token:",G),B(),P("danger",M)}},re=T=>{if(!T)return!1;try{const N=_e(T),M=Math.floor(Date.now()/1e3);return!N.exp||N.exp<M?(console.warn("[Auth]: Token scaduto o non valido"),!1):!0}catch(N){return console.error("[Auth]: Token non valido o corrotto",N),!1}},q=async T=>{try{const G=(await(await _()).get(a,{headers:{Authorization:T}})).data;G&&(localStorage.setItem("user",JSON.stringify(G)),localStorage.setItem("accessToken",T),I(!0),E(`${n}${G.id}`))}catch(N){console.error(N)}},ce=()=>{const T=localStorage.getItem("accessToken");re(T)?(b&&console.log("[Auth]: Ricarico pagina → controllo scadenza token"),H(T)):(b&&console.warn("[Auth]: Token non valido al reload, eseguo logout"),B())};i.useEffect(()=>{const T=localStorage.getItem("accessToken");if(!re(T)){B();return}I(!0)},[]),i.useEffect(()=>{d&&!R&&!X&&(b&&console.log("[Auth]: Tentativo di autologin con backendToken"),q(x))},[d,R,X]),i.useEffect(()=>{if(document.readyState==="complete")ce();else return window.addEventListener("load",ce),()=>window.removeEventListener("load",ce)},[]),i.useEffect(()=>{if(d)return;const T=localStorage.getItem("accessToken"),N=H(),M=u||N;b&&console.log("intervalTime:",M),b&&console.log("[Auth]: intervallo per il prossimo token:",M);let G;s&&T&&N&&(b&&console.log("[Auth]: Entrato dentro il timer della sessione infinita"),G=setInterval(()=>{le()},M));let z;return!s&&T&&(b&&console.log("[Auth]: Entrato dentro il timer della sessione con scadenza del token"),z=setTimeout(()=>{B(),P("danger","Sessione scaduta")},Z)),()=>{G&&clearInterval(G),z&&clearTimeout(z)}},[U,J]);const me={isAuthenticated:R,setIsAuthenticated:I,login:K,logout:B,setCurrentToken:F,createAxiosInstances:_,fetchHeartbeat:le,getTokenExpiry:H,checkTokenValidity:re,fetchUser:q,handleLoad:ce};return o.jsx(Qe.Provider,{value:me,children:e})},ye=()=>{const e=i.useContext(Qe);if(e===void 0)throw new Error("Non sei dentro al Auth Provider");return e},et=i.createContext(),Nt=({children:e,publicRoutes:a=[],privateRoutes:n=[]})=>o.jsx(et.Provider,{value:{publicRoutes:a,privateRoutes:n},children:e}),tt=()=>{const e=i.useContext(et);if(e===void 0)throw new Error(`Errore: Le rotte non sono state inizializzate correttamente.
|
|
59
59
|
|
|
60
60
|
Soluzione: Assicurati di avvolgere il tuo componente con <RouteProvider>.
|
|
61
61
|
|
package/dist/thecore-auth.esm.js
CHANGED
|
@@ -21,8 +21,8 @@ var He;
|
|
|
21
21
|
function ht() {
|
|
22
22
|
if (He) return Ee;
|
|
23
23
|
He = 1;
|
|
24
|
-
var e = Symbol.for("react.transitional.element"),
|
|
25
|
-
function n(
|
|
24
|
+
var e = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
|
|
25
|
+
function n(i, a, l) {
|
|
26
26
|
var u = null;
|
|
27
27
|
if (l !== void 0 && (u = "" + l), a.key !== void 0 && (u = "" + a.key), "key" in a) {
|
|
28
28
|
l = {};
|
|
@@ -31,13 +31,13 @@ function ht() {
|
|
|
31
31
|
} else l = a;
|
|
32
32
|
return a = l.ref, {
|
|
33
33
|
$$typeof: e,
|
|
34
|
-
type:
|
|
34
|
+
type: i,
|
|
35
35
|
key: u,
|
|
36
36
|
ref: a !== void 0 ? a : null,
|
|
37
37
|
props: l
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
return Ee.Fragment =
|
|
40
|
+
return Ee.Fragment = s, Ee.jsx = n, Ee.jsxs = n, Ee;
|
|
41
41
|
}
|
|
42
42
|
var we = {};
|
|
43
43
|
/**
|
|
@@ -66,7 +66,7 @@ function gt() {
|
|
|
66
66
|
return "Profiler";
|
|
67
67
|
case V:
|
|
68
68
|
return "StrictMode";
|
|
69
|
-
case
|
|
69
|
+
case se:
|
|
70
70
|
return "Suspense";
|
|
71
71
|
case K:
|
|
72
72
|
return "SuspenseList";
|
|
@@ -93,12 +93,12 @@ function gt() {
|
|
|
93
93
|
}
|
|
94
94
|
return null;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function s(t) {
|
|
97
97
|
return "" + t;
|
|
98
98
|
}
|
|
99
99
|
function n(t) {
|
|
100
100
|
try {
|
|
101
|
-
|
|
101
|
+
s(t);
|
|
102
102
|
var d = !1;
|
|
103
103
|
} catch {
|
|
104
104
|
d = !0;
|
|
@@ -110,18 +110,18 @@ function gt() {
|
|
|
110
110
|
d,
|
|
111
111
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
112
112
|
O
|
|
113
|
-
),
|
|
113
|
+
), s(t);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function i() {
|
|
117
117
|
}
|
|
118
118
|
function a() {
|
|
119
119
|
if (N === 0) {
|
|
120
|
-
|
|
120
|
+
R = console.log, G = console.info, M = console.warn, _ = console.error, J = console.group, je = console.groupCollapsed, ve = console.groupEnd;
|
|
121
121
|
var t = {
|
|
122
122
|
configurable: !0,
|
|
123
123
|
enumerable: !0,
|
|
124
|
-
value:
|
|
124
|
+
value: i,
|
|
125
125
|
writable: !0
|
|
126
126
|
};
|
|
127
127
|
Object.defineProperties(console, {
|
|
@@ -140,7 +140,7 @@ function gt() {
|
|
|
140
140
|
if (N--, N === 0) {
|
|
141
141
|
var t = { configurable: !0, enumerable: !0, writable: !0 };
|
|
142
142
|
Object.defineProperties(console, {
|
|
143
|
-
log: U({}, t, { value:
|
|
143
|
+
log: U({}, t, { value: R }),
|
|
144
144
|
info: U({}, t, { value: G }),
|
|
145
145
|
warn: U({}, t, { value: M }),
|
|
146
146
|
error: U({}, t, { value: _ }),
|
|
@@ -216,11 +216,11 @@ function gt() {
|
|
|
216
216
|
}
|
|
217
217
|
};
|
|
218
218
|
z.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
|
|
219
|
-
var
|
|
219
|
+
var P = Object.getOwnPropertyDescriptor(
|
|
220
220
|
z.DetermineComponentFrameRoot,
|
|
221
221
|
"name"
|
|
222
222
|
);
|
|
223
|
-
|
|
223
|
+
P && P.configurable && Object.defineProperty(
|
|
224
224
|
z.DetermineComponentFrameRoot,
|
|
225
225
|
"name",
|
|
226
226
|
{ value: "DetermineComponentFrameRoot" }
|
|
@@ -228,32 +228,32 @@ function gt() {
|
|
|
228
228
|
var w = z.DetermineComponentFrameRoot(), ee = w[0], he = w[1];
|
|
229
229
|
if (ee && he) {
|
|
230
230
|
var F = ee.split(`
|
|
231
|
-
`),
|
|
231
|
+
`), ie = he.split(`
|
|
232
232
|
`);
|
|
233
|
-
for (w =
|
|
233
|
+
for (w = P = 0; P < F.length && !F[P].includes(
|
|
234
234
|
"DetermineComponentFrameRoot"
|
|
235
235
|
); )
|
|
236
|
-
|
|
237
|
-
for (; w <
|
|
236
|
+
P++;
|
|
237
|
+
for (; w < ie.length && !ie[w].includes(
|
|
238
238
|
"DetermineComponentFrameRoot"
|
|
239
239
|
); )
|
|
240
240
|
w++;
|
|
241
|
-
if (
|
|
242
|
-
for (
|
|
241
|
+
if (P === F.length || w === ie.length)
|
|
242
|
+
for (P = F.length - 1, w = ie.length - 1; 1 <= P && 0 <= w && F[P] !== ie[w]; )
|
|
243
243
|
w--;
|
|
244
|
-
for (; 1 <=
|
|
245
|
-
if (F[
|
|
246
|
-
if (
|
|
244
|
+
for (; 1 <= P && 0 <= w; P--, w--)
|
|
245
|
+
if (F[P] !== ie[w]) {
|
|
246
|
+
if (P !== 1 || w !== 1)
|
|
247
247
|
do
|
|
248
|
-
if (
|
|
248
|
+
if (P--, w--, 0 > w || F[P] !== ie[w]) {
|
|
249
249
|
var ye = `
|
|
250
|
-
` + F[
|
|
250
|
+
` + F[P].replace(
|
|
251
251
|
" at new ",
|
|
252
252
|
" at "
|
|
253
253
|
);
|
|
254
254
|
return t.displayName && ye.includes("<anonymous>") && (ye = ye.replace("<anonymous>", t.displayName)), typeof t == "function" && Ge.set(t, ye), ye;
|
|
255
255
|
}
|
|
256
|
-
while (1 <=
|
|
256
|
+
while (1 <= P && 0 <= w);
|
|
257
257
|
break;
|
|
258
258
|
}
|
|
259
259
|
}
|
|
@@ -273,7 +273,7 @@ function gt() {
|
|
|
273
273
|
}
|
|
274
274
|
if (typeof t == "string") return u(t);
|
|
275
275
|
switch (t) {
|
|
276
|
-
case
|
|
276
|
+
case se:
|
|
277
277
|
return u("Suspense");
|
|
278
278
|
case K:
|
|
279
279
|
return u("SuspenseList");
|
|
@@ -322,12 +322,12 @@ function gt() {
|
|
|
322
322
|
"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."
|
|
323
323
|
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
324
324
|
}
|
|
325
|
-
function c(t, d, f, O, z,
|
|
326
|
-
return f =
|
|
325
|
+
function c(t, d, f, O, z, P) {
|
|
326
|
+
return f = P.ref, t = {
|
|
327
327
|
$$typeof: y,
|
|
328
328
|
type: t,
|
|
329
329
|
key: d,
|
|
330
|
-
props:
|
|
330
|
+
props: P,
|
|
331
331
|
_owner: z
|
|
332
332
|
}, (f !== void 0 ? f : null) !== null ? Object.defineProperty(t, "ref", {
|
|
333
333
|
enumerable: !1,
|
|
@@ -344,8 +344,8 @@ function gt() {
|
|
|
344
344
|
value: null
|
|
345
345
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
346
346
|
}
|
|
347
|
-
function h(t, d, f, O, z,
|
|
348
|
-
if (typeof t == "string" || typeof t == "function" || t === A || t === $ || t === V || t ===
|
|
347
|
+
function h(t, d, f, O, z, P) {
|
|
348
|
+
if (typeof t == "string" || typeof t == "function" || t === A || t === $ || t === V || t === se || t === K || t === Q || typeof t == "object" && t !== null && (t.$$typeof === I || t.$$typeof === D || t.$$typeof === Y || t.$$typeof === X || t.$$typeof === Z || t.$$typeof === pe || t.getModuleId !== void 0)) {
|
|
349
349
|
var w = d.children;
|
|
350
350
|
if (w !== void 0)
|
|
351
351
|
if (O)
|
|
@@ -390,7 +390,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
390
390
|
return w && j(
|
|
391
391
|
f,
|
|
392
392
|
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
393
|
-
), c(t, w,
|
|
393
|
+
), c(t, w, P, z, g(), f);
|
|
394
394
|
}
|
|
395
395
|
function b(t, d) {
|
|
396
396
|
if (typeof t == "object" && t && t.$$typeof !== ct) {
|
|
@@ -433,8 +433,8 @@ Check the render method of \`` + f + "`."), d || (t = e(t)) && (d = `
|
|
|
433
433
|
|
|
434
434
|
Check the top-level render call using <` + t + ">."), d;
|
|
435
435
|
}
|
|
436
|
-
var L = q, y = Symbol.for("react.transitional.element"), T = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), V = Symbol.for("react.strict_mode"), $ = Symbol.for("react.profiler"), X = Symbol.for("react.consumer"), Y = Symbol.for("react.context"), Z = Symbol.for("react.forward_ref"),
|
|
437
|
-
|
|
436
|
+
var L = q, y = Symbol.for("react.transitional.element"), T = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), V = Symbol.for("react.strict_mode"), $ = Symbol.for("react.profiler"), X = Symbol.for("react.consumer"), Y = Symbol.for("react.context"), Z = Symbol.for("react.forward_ref"), se = Symbol.for("react.suspense"), K = Symbol.for("react.suspense_list"), D = Symbol.for("react.memo"), I = Symbol.for("react.lazy"), Q = Symbol.for("react.offscreen"), B = Symbol.iterator, me = Symbol.for("react.client.reference"), W = L.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, re = Object.prototype.hasOwnProperty, U = Object.assign, pe = Symbol.for("react.client.reference"), xe = Array.isArray, N = 0, R, G, M, _, J, je, ve;
|
|
437
|
+
i.__reactDisabledLog = !0;
|
|
438
438
|
var be, ke, Pe = !1, Ge = new (typeof WeakMap == "function" ? WeakMap : Map)(), ct = Symbol.for("react.client.reference"), _e, ze = {}, $e = {}, Fe = {};
|
|
439
439
|
we.Fragment = A, we.jsx = function(t, d, f, O, z) {
|
|
440
440
|
return h(t, d, f, !1, O, z);
|
|
@@ -448,10 +448,10 @@ function xt() {
|
|
|
448
448
|
return Ze || (Ze = 1, process.env.NODE_ENV === "production" ? Oe.exports = ht() : Oe.exports = gt()), Oe.exports;
|
|
449
449
|
}
|
|
450
450
|
var o = xt();
|
|
451
|
-
const Ke = ce(), t0 = ({ children: e, defaultComponent:
|
|
452
|
-
const [n,
|
|
453
|
-
l(j),
|
|
454
|
-
|
|
451
|
+
const Ke = ce(), t0 = ({ children: e, defaultComponent: s }) => {
|
|
452
|
+
const [n, i] = E(!1), [a, l] = E({}), [u, p] = E(s), g = { isLoading: n, setIsLoading: i, loadingProps: a, setLoadingProps: l, loadingComponent: u, setLoadingComponent: p, showLoadingFor: (C = 2e3, j = {}) => {
|
|
453
|
+
l(j), i(!0), setTimeout(() => {
|
|
454
|
+
i(!1);
|
|
455
455
|
}, C);
|
|
456
456
|
} };
|
|
457
457
|
return /* @__PURE__ */ o.jsx(Ke.Provider, { value: g, children: e });
|
|
@@ -459,11 +459,11 @@ const Ke = ce(), t0 = ({ children: e, defaultComponent: i }) => {
|
|
|
459
459
|
const e = ue(Ke);
|
|
460
460
|
if (e === void 0) throw new Error("Non puoi settare il loading");
|
|
461
461
|
return e;
|
|
462
|
-
}, vt = "0.0.
|
|
462
|
+
}, vt = "0.0.151", bt = ({ errorMessage: e, errorShow: s }) => /* @__PURE__ */ o.jsx("section", { className: s ? "" : "hidden", children: /* @__PURE__ */ o.jsxs("div", { className: "container mx-auto", children: [
|
|
463
463
|
/* @__PURE__ */ o.jsx("h1", { className: "text-center text-8xl my-12", children: "Errore" }),
|
|
464
464
|
/* @__PURE__ */ o.jsx("pre", { className: "text-xl", children: e })
|
|
465
465
|
] }) }), Qe = ce(), r0 = ({ children: e }) => {
|
|
466
|
-
const [
|
|
466
|
+
const [s, n] = E({}), [i, a] = E(!1), l = `Creare un file config.json in public per il corretto funzionamento
|
|
467
467
|
Esempio di config.json:
|
|
468
468
|
|
|
469
469
|
{
|
|
@@ -549,7 +549,7 @@ Esempio di config.json:
|
|
|
549
549
|
};
|
|
550
550
|
return H(() => {
|
|
551
551
|
v();
|
|
552
|
-
}, []), Object.keys(
|
|
552
|
+
}, []), Object.keys(s).length === 0 ? /* @__PURE__ */ o.jsx(bt, { errorShow: i, errorMessage: l }) : /* @__PURE__ */ o.jsx(Qe.Provider, { value: s, children: e });
|
|
553
553
|
}, ne = () => {
|
|
554
554
|
const e = ue(Qe);
|
|
555
555
|
if (e === void 0) throw new Error("Non puoi leggere i config");
|
|
@@ -562,88 +562,88 @@ var et = {
|
|
|
562
562
|
style: void 0,
|
|
563
563
|
attr: void 0
|
|
564
564
|
}, Ue = q.createContext && /* @__PURE__ */ q.createContext(et), Ct = ["attr", "size", "title"];
|
|
565
|
-
function jt(e,
|
|
565
|
+
function jt(e, s) {
|
|
566
566
|
if (e == null) return {};
|
|
567
|
-
var n = kt(e,
|
|
567
|
+
var n = kt(e, s), i, a;
|
|
568
568
|
if (Object.getOwnPropertySymbols) {
|
|
569
569
|
var l = Object.getOwnPropertySymbols(e);
|
|
570
570
|
for (a = 0; a < l.length; a++)
|
|
571
|
-
|
|
571
|
+
i = l[a], !(s.indexOf(i) >= 0) && Object.prototype.propertyIsEnumerable.call(e, i) && (n[i] = e[i]);
|
|
572
572
|
}
|
|
573
573
|
return n;
|
|
574
574
|
}
|
|
575
|
-
function kt(e,
|
|
575
|
+
function kt(e, s) {
|
|
576
576
|
if (e == null) return {};
|
|
577
577
|
var n = {};
|
|
578
|
-
for (var
|
|
579
|
-
if (Object.prototype.hasOwnProperty.call(e,
|
|
580
|
-
if (
|
|
581
|
-
n[
|
|
578
|
+
for (var i in e)
|
|
579
|
+
if (Object.prototype.hasOwnProperty.call(e, i)) {
|
|
580
|
+
if (s.indexOf(i) >= 0) continue;
|
|
581
|
+
n[i] = e[i];
|
|
582
582
|
}
|
|
583
583
|
return n;
|
|
584
584
|
}
|
|
585
585
|
function Te() {
|
|
586
586
|
return Te = Object.assign ? Object.assign.bind() : function(e) {
|
|
587
|
-
for (var
|
|
588
|
-
var n = arguments[
|
|
589
|
-
for (var
|
|
590
|
-
Object.prototype.hasOwnProperty.call(n,
|
|
587
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
588
|
+
var n = arguments[s];
|
|
589
|
+
for (var i in n)
|
|
590
|
+
Object.prototype.hasOwnProperty.call(n, i) && (e[i] = n[i]);
|
|
591
591
|
}
|
|
592
592
|
return e;
|
|
593
593
|
}, Te.apply(this, arguments);
|
|
594
594
|
}
|
|
595
|
-
function qe(e,
|
|
595
|
+
function qe(e, s) {
|
|
596
596
|
var n = Object.keys(e);
|
|
597
597
|
if (Object.getOwnPropertySymbols) {
|
|
598
|
-
var
|
|
599
|
-
|
|
598
|
+
var i = Object.getOwnPropertySymbols(e);
|
|
599
|
+
s && (i = i.filter(function(a) {
|
|
600
600
|
return Object.getOwnPropertyDescriptor(e, a).enumerable;
|
|
601
|
-
})), n.push.apply(n,
|
|
601
|
+
})), n.push.apply(n, i);
|
|
602
602
|
}
|
|
603
603
|
return n;
|
|
604
604
|
}
|
|
605
605
|
function Ne(e) {
|
|
606
|
-
for (var
|
|
607
|
-
var n = arguments[
|
|
608
|
-
|
|
609
|
-
St(e,
|
|
610
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : qe(Object(n)).forEach(function(
|
|
611
|
-
Object.defineProperty(e,
|
|
606
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
607
|
+
var n = arguments[s] != null ? arguments[s] : {};
|
|
608
|
+
s % 2 ? qe(Object(n), !0).forEach(function(i) {
|
|
609
|
+
St(e, i, n[i]);
|
|
610
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : qe(Object(n)).forEach(function(i) {
|
|
611
|
+
Object.defineProperty(e, i, Object.getOwnPropertyDescriptor(n, i));
|
|
612
612
|
});
|
|
613
613
|
}
|
|
614
614
|
return e;
|
|
615
615
|
}
|
|
616
|
-
function St(e,
|
|
617
|
-
return
|
|
616
|
+
function St(e, s, n) {
|
|
617
|
+
return s = Ot(s), s in e ? Object.defineProperty(e, s, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[s] = n, e;
|
|
618
618
|
}
|
|
619
619
|
function Ot(e) {
|
|
620
|
-
var
|
|
621
|
-
return typeof
|
|
620
|
+
var s = Lt(e, "string");
|
|
621
|
+
return typeof s == "symbol" ? s : s + "";
|
|
622
622
|
}
|
|
623
|
-
function Lt(e,
|
|
623
|
+
function Lt(e, s) {
|
|
624
624
|
if (typeof e != "object" || !e) return e;
|
|
625
625
|
var n = e[Symbol.toPrimitive];
|
|
626
626
|
if (n !== void 0) {
|
|
627
|
-
var
|
|
628
|
-
if (typeof
|
|
627
|
+
var i = n.call(e, s || "default");
|
|
628
|
+
if (typeof i != "object") return i;
|
|
629
629
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
630
630
|
}
|
|
631
|
-
return (
|
|
631
|
+
return (s === "string" ? String : Number)(e);
|
|
632
632
|
}
|
|
633
633
|
function tt(e) {
|
|
634
|
-
return e && e.map((
|
|
634
|
+
return e && e.map((s, n) => /* @__PURE__ */ q.createElement(s.tag, Ne({
|
|
635
635
|
key: n
|
|
636
|
-
},
|
|
636
|
+
}, s.attr), tt(s.child)));
|
|
637
637
|
}
|
|
638
638
|
function de(e) {
|
|
639
|
-
return (
|
|
639
|
+
return (s) => /* @__PURE__ */ q.createElement(Tt, Te({
|
|
640
640
|
attr: Ne({}, e.attr)
|
|
641
|
-
},
|
|
641
|
+
}, s), tt(e.child));
|
|
642
642
|
}
|
|
643
643
|
function Tt(e) {
|
|
644
|
-
var
|
|
644
|
+
var s = (n) => {
|
|
645
645
|
var {
|
|
646
|
-
attr:
|
|
646
|
+
attr: i,
|
|
647
647
|
size: a,
|
|
648
648
|
title: l
|
|
649
649
|
} = e, u = jt(e, Ct), p = a || n.size || "1em", m;
|
|
@@ -651,7 +651,7 @@ function Tt(e) {
|
|
|
651
651
|
stroke: "currentColor",
|
|
652
652
|
fill: "currentColor",
|
|
653
653
|
strokeWidth: "0"
|
|
654
|
-
}, n.attr,
|
|
654
|
+
}, n.attr, i, u, {
|
|
655
655
|
className: m,
|
|
656
656
|
style: Ne(Ne({
|
|
657
657
|
color: e.color || n.color
|
|
@@ -661,16 +661,16 @@ function Tt(e) {
|
|
|
661
661
|
xmlns: "http://www.w3.org/2000/svg"
|
|
662
662
|
}), l && /* @__PURE__ */ q.createElement("title", null, l), e.children);
|
|
663
663
|
};
|
|
664
|
-
return Ue !== void 0 ? /* @__PURE__ */ q.createElement(Ue.Consumer, null, (n) =>
|
|
664
|
+
return Ue !== void 0 ? /* @__PURE__ */ q.createElement(Ue.Consumer, null, (n) => s(n)) : s(et);
|
|
665
665
|
}
|
|
666
666
|
function Nt(e) {
|
|
667
667
|
return de({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M17.47 250.9C88.82 328.1 158 397.6 224.5 485.5c72.3-143.8 146.3-288.1 268.4-444.37L460 26.06C356.9 135.4 276.8 238.9 207.2 361.9c-48.4-43.6-126.62-105.3-174.38-137z" }, child: [] }] })(e);
|
|
668
668
|
}
|
|
669
669
|
const rt = ce(), o0 = ({ children: e }) => {
|
|
670
|
-
const [
|
|
671
|
-
showAlert:
|
|
670
|
+
const [s, n] = E(!1), [i, a] = E(), [l, u] = E(), j = {
|
|
671
|
+
showAlert: s,
|
|
672
672
|
setShowAlert: n,
|
|
673
|
-
typeAlert:
|
|
673
|
+
typeAlert: i,
|
|
674
674
|
setTypeAlert: a,
|
|
675
675
|
messageAlert: l,
|
|
676
676
|
setMessageAlert: u,
|
|
@@ -721,7 +721,7 @@ const rt = ce(), o0 = ({ children: e }) => {
|
|
|
721
721
|
}
|
|
722
722
|
},
|
|
723
723
|
closeAlert: () => {
|
|
724
|
-
n(!
|
|
724
|
+
n(!s);
|
|
725
725
|
},
|
|
726
726
|
activeAlert: (v, c) => {
|
|
727
727
|
n(!1), setTimeout(() => {
|
|
@@ -736,7 +736,7 @@ const rt = ce(), o0 = ({ children: e }) => {
|
|
|
736
736
|
return e;
|
|
737
737
|
};
|
|
738
738
|
let ge;
|
|
739
|
-
const Rt = async (e,
|
|
739
|
+
const Rt = async (e, s, n, i, a, l) => {
|
|
740
740
|
if (ge) return ge;
|
|
741
741
|
try {
|
|
742
742
|
const p = await (await fetch("/config.json")).json(), m = p.baseUri, { unauthorized: g, notFound: C, defaultMessage: j } = p.axiosErrors, v = p.axiosTimeout;
|
|
@@ -749,9 +749,9 @@ const Rt = async (e, i, n, s, a, l) => {
|
|
|
749
749
|
(c) => c,
|
|
750
750
|
(c) => {
|
|
751
751
|
if (c.response)
|
|
752
|
-
switch (e == null || e(!0),
|
|
752
|
+
switch (e == null || e(!0), s == null || s("danger"), c.response.status) {
|
|
753
753
|
case 401:
|
|
754
|
-
localStorage.removeItem("accessToken"), n == null || n(g),
|
|
754
|
+
localStorage.removeItem("accessToken"), n == null || n(g), i == null || i();
|
|
755
755
|
break;
|
|
756
756
|
case 404:
|
|
757
757
|
n == null || n(C), a == null || a(c);
|
|
@@ -766,12 +766,12 @@ const Rt = async (e, i, n, s, a, l) => {
|
|
|
766
766
|
console.error(u);
|
|
767
767
|
}
|
|
768
768
|
}, ot = ce(), n0 = ({ children: e }) => {
|
|
769
|
-
const { heartbeatEndpoint:
|
|
769
|
+
const { heartbeatEndpoint: s, firstPrivatePath: n, infiniteSession: i, timeDeducted: a, authenticatedEndpoint: l, autoLogin: u, setCurrentDate: p, isDebug: m, backendToken: g, useCustomLoginTimeout: C, customLoginTimeout: j, tokenLog: v, timerInfiniteSession: c } = ne(), { setIsLoading: h, showLoadingFor: b } = Ce(), { setShowAlert: x, setMessageAlert: k, setTypeAlert: S, activeAlert: L } = fe(), y = Be(), [T, A] = E(null), [V, $] = E(), [X, Y] = E(), [Z, se] = E(), [K, D] = E(!1), I = async (N = B, R, G) => await Rt(x, S, k, N, R, G), Q = async (N = null, R) => {
|
|
770
770
|
N && N.preventDefault(), D(!0);
|
|
771
771
|
try {
|
|
772
772
|
C || h(!0), b(j), x(!1);
|
|
773
773
|
const M = await (await I()).post(l, {
|
|
774
|
-
auth:
|
|
774
|
+
auth: R
|
|
775
775
|
}), _ = M.headers.token, J = M.data;
|
|
776
776
|
_ && (localStorage.setItem("accessToken", _), localStorage.setItem("user", JSON.stringify(J)), A(!0), $(_), y(`${n}${J.id}`));
|
|
777
777
|
} catch (G) {
|
|
@@ -782,14 +782,14 @@ const Rt = async (e, i, n, s, a, l) => {
|
|
|
782
782
|
}, B = () => {
|
|
783
783
|
localStorage.removeItem("accessToken"), localStorage.removeItem("id"), localStorage.removeItem("user"), A(!1), $(null);
|
|
784
784
|
}, me = async () => {
|
|
785
|
-
const N = localStorage.getItem("accessToken");
|
|
786
|
-
if (
|
|
785
|
+
const N = localStorage.getItem("accessToken"), R = W();
|
|
786
|
+
if (console.log("validToken:", R), R) {
|
|
787
787
|
v && console.log("Token valido, inutile fare la chiamata heartbeat");
|
|
788
788
|
return;
|
|
789
789
|
}
|
|
790
790
|
try {
|
|
791
791
|
const _ = (await (await I()).get(
|
|
792
|
-
`${
|
|
792
|
+
`${s}`,
|
|
793
793
|
{
|
|
794
794
|
headers: {
|
|
795
795
|
Authorization: N
|
|
@@ -801,11 +801,11 @@ const Rt = async (e, i, n, s, a, l) => {
|
|
|
801
801
|
console.error(G), B();
|
|
802
802
|
}
|
|
803
803
|
}, W = (N) => {
|
|
804
|
-
const
|
|
805
|
-
if (!
|
|
804
|
+
const R = N || V;
|
|
805
|
+
if (!R) return;
|
|
806
806
|
const G = "Token non valido";
|
|
807
807
|
try {
|
|
808
|
-
const M = De(
|
|
808
|
+
const M = De(R);
|
|
809
809
|
if (!M.exp) {
|
|
810
810
|
v && console.warn("[Auth]: Token senza data di scadenza, eseguo logout."), B(), L("danger", G);
|
|
811
811
|
return;
|
|
@@ -815,11 +815,11 @@ const Rt = async (e, i, n, s, a, l) => {
|
|
|
815
815
|
v && console.warn("[Auth]: Token scaduto, eseguo logout."), B(), L("danger", G);
|
|
816
816
|
return;
|
|
817
817
|
}
|
|
818
|
-
|
|
818
|
+
se(J), Y(J - a);
|
|
819
819
|
const je = J - a;
|
|
820
820
|
if (v) {
|
|
821
821
|
const ve = Math.floor(J / 1e3), be = Math.floor(ve / 60), ke = ve % 60;
|
|
822
|
-
console.log(`[Auth]: Token valido per ancora: ${be} minuti e ${ke} secondi`), console.log("[Auth]: Token:",
|
|
822
|
+
console.log(`[Auth]: Token valido per ancora: ${be} minuti e ${ke} secondi`), console.log("[Auth]: Token:", R);
|
|
823
823
|
}
|
|
824
824
|
return je;
|
|
825
825
|
} catch (M) {
|
|
@@ -828,15 +828,15 @@ const Rt = async (e, i, n, s, a, l) => {
|
|
|
828
828
|
}, re = (N) => {
|
|
829
829
|
if (!N) return !1;
|
|
830
830
|
try {
|
|
831
|
-
const
|
|
832
|
-
return !
|
|
833
|
-
} catch (
|
|
834
|
-
return console.error("[Auth]: Token non valido o corrotto",
|
|
831
|
+
const R = De(N), G = Math.floor(Date.now() / 1e3);
|
|
832
|
+
return !R.exp || R.exp < G ? (console.warn("[Auth]: Token scaduto o non valido"), !1) : !0;
|
|
833
|
+
} catch (R) {
|
|
834
|
+
return console.error("[Auth]: Token non valido o corrotto", R), !1;
|
|
835
835
|
}
|
|
836
836
|
}, U = async (N) => {
|
|
837
837
|
try {
|
|
838
838
|
const M = (await (await I()).get(
|
|
839
|
-
|
|
839
|
+
s,
|
|
840
840
|
{
|
|
841
841
|
headers: {
|
|
842
842
|
Authorization: N
|
|
@@ -844,8 +844,8 @@ const Rt = async (e, i, n, s, a, l) => {
|
|
|
844
844
|
}
|
|
845
845
|
)).data;
|
|
846
846
|
M && (localStorage.setItem("user", JSON.stringify(M)), localStorage.setItem("accessToken", N), A(!0), y(`${n}${M.id}`));
|
|
847
|
-
} catch (
|
|
848
|
-
console.error(
|
|
847
|
+
} catch (R) {
|
|
848
|
+
console.error(R);
|
|
849
849
|
}
|
|
850
850
|
}, pe = () => {
|
|
851
851
|
const N = localStorage.getItem("accessToken");
|
|
@@ -867,14 +867,14 @@ const Rt = async (e, i, n, s, a, l) => {
|
|
|
867
867
|
return window.addEventListener("load", pe), () => window.removeEventListener("load", pe);
|
|
868
868
|
}, []), H(() => {
|
|
869
869
|
if (u) return;
|
|
870
|
-
const N = localStorage.getItem("accessToken"),
|
|
870
|
+
const N = localStorage.getItem("accessToken"), R = W(), G = c || R;
|
|
871
871
|
v && console.log("intervalTime:", G), v && console.log("[Auth]: intervallo per il prossimo token:", G);
|
|
872
872
|
let M;
|
|
873
|
-
|
|
873
|
+
i && N && R && (v && console.log("[Auth]: Entrato dentro il timer della sessione infinita"), M = setInterval(() => {
|
|
874
874
|
me();
|
|
875
875
|
}, G));
|
|
876
876
|
let _;
|
|
877
|
-
return !
|
|
877
|
+
return !i && N && (v && console.log("[Auth]: Entrato dentro il timer della sessione con scadenza del token"), _ = setTimeout(() => {
|
|
878
878
|
B(), L("danger", "Sessione scaduta");
|
|
879
879
|
}, Z)), () => {
|
|
880
880
|
M && clearInterval(M), _ && clearTimeout(_);
|
|
@@ -898,7 +898,7 @@ const Rt = async (e, i, n, s, a, l) => {
|
|
|
898
898
|
const e = ue(ot);
|
|
899
899
|
if (e === void 0) throw new Error("Non sei dentro al Auth Provider");
|
|
900
900
|
return e;
|
|
901
|
-
}, nt = ce(),
|
|
901
|
+
}, nt = ce(), s0 = ({ children: e, publicRoutes: s = [], privateRoutes: n = [] }) => /* @__PURE__ */ o.jsx(nt.Provider, { value: { publicRoutes: s, privateRoutes: n }, children: e }), Pt = () => {
|
|
902
902
|
const e = ue(nt);
|
|
903
903
|
if (e === void 0)
|
|
904
904
|
throw new Error(
|
|
@@ -913,11 +913,11 @@ Esempio:
|
|
|
913
913
|
</RouteProvider>`
|
|
914
914
|
);
|
|
915
915
|
return e;
|
|
916
|
-
},
|
|
917
|
-
const { login:
|
|
916
|
+
}, st = ce(), i0 = ({ children: e }) => {
|
|
917
|
+
const { login: s } = Re(), { clearLoginFormOnError: n } = ne(), i = {
|
|
918
918
|
email: "",
|
|
919
919
|
password: ""
|
|
920
|
-
}, [a, l] = E("Accedi"), [u, p] = E("Email"), [m, g] = E("email"), [C, j] = E("example@example.it"), [v, c] = E("Accedi"), [h, b] = E(
|
|
920
|
+
}, [a, l] = E("Accedi"), [u, p] = E("Email"), [m, g] = E("email"), [C, j] = E("example@example.it"), [v, c] = E("Accedi"), [h, b] = E(i), [x, k] = E(), [S, L] = E(), [y, T] = E(), [A, V] = E(), [$, X] = E({}), [Y, Z] = E(null), D = {
|
|
921
921
|
overrideStyle: $,
|
|
922
922
|
setOverrideStyle: X,
|
|
923
923
|
title: a,
|
|
@@ -944,26 +944,26 @@ Esempio:
|
|
|
944
944
|
b((B) => ({ ...B, [I]: Q }));
|
|
945
945
|
},
|
|
946
946
|
handleLogin: (I) => {
|
|
947
|
-
|
|
947
|
+
s(I, h), n && b(i);
|
|
948
948
|
},
|
|
949
949
|
customVersion: Y,
|
|
950
950
|
setCustomVersion: Z
|
|
951
951
|
};
|
|
952
|
-
return /* @__PURE__ */ o.jsx(
|
|
953
|
-
},
|
|
954
|
-
const e = ue(
|
|
952
|
+
return /* @__PURE__ */ o.jsx(st.Provider, { value: D, children: e });
|
|
953
|
+
}, it = () => {
|
|
954
|
+
const e = ue(st);
|
|
955
955
|
if (e === void 0) throw new Error("Non puoi modificare La login");
|
|
956
956
|
return e;
|
|
957
957
|
}, at = ce(), a0 = ({ children: e }) => {
|
|
958
|
-
const [
|
|
958
|
+
const [s, n] = E(!1), [i, a] = E(null), [l, u] = E(""), [p, m] = E(null), [g, C] = E(null), [j, v] = E(null), [c, h] = E("modal-form"), [b, x] = E("submit"), [k, S] = E({}), [L, y] = E(null), [T, A] = E(null), [V, $] = E(null), X = ({ modalData: D, component: I, title: Q = "", onConfirm: B = null, type: me = "submit", formId: W = "modal-form", item: re = null, style: U }) => {
|
|
959
959
|
y(D), a(() => I), u(Q), m(() => B), x(me), h(W), v(re), S(U), n(!0);
|
|
960
960
|
}, Y = () => {
|
|
961
961
|
a(null), u(""), m(null), x("submit"), h("modal-form"), v(null), S({}), n(!1), y(null);
|
|
962
962
|
}, K = {
|
|
963
|
-
isOpen:
|
|
963
|
+
isOpen: s,
|
|
964
964
|
openModal: X,
|
|
965
965
|
closeModal: Y,
|
|
966
|
-
content:
|
|
966
|
+
content: i,
|
|
967
967
|
title: l,
|
|
968
968
|
onConfirm: p,
|
|
969
969
|
type: b,
|
|
@@ -999,9 +999,9 @@ function lt(e) {
|
|
|
999
999
|
return de({ tag: "svg", attr: { version: "1.1", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M8 0c-4.355 0-7.898 3.481-7.998 7.812 0.092-3.779 2.966-6.812 6.498-6.812 3.59 0 6.5 3.134 6.5 7 0 0.828 0.672 1.5 1.5 1.5s1.5-0.672 1.5-1.5c0-4.418-3.582-8-8-8zM8 16c4.355 0 7.898-3.481 7.998-7.812-0.092 3.779-2.966 6.812-6.498 6.812-3.59 0-6.5-3.134-6.5-7 0-0.828-0.672-1.5-1.5-1.5s-1.5 0.672-1.5 1.5c0 4.418 3.582 8 8 8z" }, child: [] }] })(e);
|
|
1000
1000
|
}
|
|
1001
1001
|
const Mt = () => {
|
|
1002
|
-
const { loadingProps: e, loadingComponent:
|
|
1003
|
-
return
|
|
1004
|
-
n && /* @__PURE__ */ o.jsx(lt, { className: m.spinner || `text-[20rem] relative animate-spin text-spinner ${
|
|
1002
|
+
const { loadingProps: e, loadingComponent: s } = Ce(), { spinner: n = !0, spinnerStyle: i, text: a, textStyle: l, children: u, containerStyle: p, overrideStyle: m = {} } = e;
|
|
1003
|
+
return s || /* @__PURE__ */ o.jsxs("div", { className: m.container || `fixed top-0 bottom-0 left-0 right-0 flex items-center justify-center bg-loading-bg z-[999] ${p}`, children: [
|
|
1004
|
+
n && /* @__PURE__ */ o.jsx(lt, { className: m.spinner || `text-[20rem] relative animate-spin text-spinner ${i}` }),
|
|
1005
1005
|
u || /* @__PURE__ */ o.jsx("p", { className: m.text || `text-white text-2xl select-none absolute ${l}`, children: a || "Loading..." })
|
|
1006
1006
|
] });
|
|
1007
1007
|
};
|
|
@@ -1009,7 +1009,7 @@ function At(e) {
|
|
|
1009
1009
|
return de({ tag: "svg", attr: { viewBox: "0 0 15 15", fill: "none" }, child: [{ tag: "path", attr: { fillRule: "evenodd", clipRule: "evenodd", d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor" }, child: [] }] })(e);
|
|
1010
1010
|
}
|
|
1011
1011
|
const Ve = () => {
|
|
1012
|
-
const { messageAlert: e, typeAlert:
|
|
1012
|
+
const { messageAlert: e, typeAlert: s, alertConfig: n, getIcon: i, closeAlert: a } = fe(), { alertTimeout: l } = ne(), [u, p] = E(0), { bgColor: m, textColor: g, buttonBg: C, hoverBg: j, focusRing: v, progressColor: c } = n[s];
|
|
1013
1013
|
return H(() => {
|
|
1014
1014
|
let h;
|
|
1015
1015
|
const x = 100 / (l / 100);
|
|
@@ -1024,7 +1024,7 @@ const Ve = () => {
|
|
|
1024
1024
|
};
|
|
1025
1025
|
}, []), /* @__PURE__ */ o.jsxs("div", { className: `flex items-center p-4 pt-6 ${g} rounded-lg ${m} mx-auto max-sm:min-w-[280px] sm:max-w-1/3 fixed top-[calc(100vh-100px)] sm:right-10 right-1/2 translate-x-1/2 sm:translate-0 z-100`, role: "alert", children: [
|
|
1026
1026
|
/* @__PURE__ */ o.jsx("div", { className: "w-full bg-gray-200 rounded-t-lg overflow-hidden h-2.5 absolute top-0 left-0 right-0", children: /* @__PURE__ */ o.jsx("div", { className: `${c} h-2.5 rounded-t-lg`, style: { width: `${u}%` } }) }),
|
|
1027
|
-
s
|
|
1027
|
+
i(s),
|
|
1028
1028
|
/* @__PURE__ */ o.jsx("div", { className: "px-4 text-sm font-medium", children: e }),
|
|
1029
1029
|
/* @__PURE__ */ o.jsx(
|
|
1030
1030
|
"button",
|
|
@@ -1037,13 +1037,13 @@ const Ve = () => {
|
|
|
1037
1037
|
}
|
|
1038
1038
|
)
|
|
1039
1039
|
] });
|
|
1040
|
-
}, Bt = ({ onClose: e, onConfirm:
|
|
1041
|
-
const u = l.resetButton ?? !0, p = l.confirmButtonText ?? (
|
|
1040
|
+
}, Bt = ({ onClose: e, onConfirm: s, onCancel: n, type: i, formId: a, style: l }) => {
|
|
1041
|
+
const u = l.resetButton ?? !0, p = l.confirmButtonText ?? (i === "delete" ? "Elimina" : "Salva"), m = l.cancelButtonText ?? "Annulla", g = l.bgSaveButton ?? "bg-indigo-600 rounded-lg shadow-md hover:bg-indigo-700 hover:shadow-lg active:bg-indigo-800 text-white", C = l.bgDeleteButton ?? "bg-rose-500 rounded-lg shadow-md hover:bg-rose-600 hover:shadow-lg active:bg-rose-700 text-white", j = l.bgResetButton ?? "bg-rose-500 rounded-lg shadow-md hover:bg-rose-600 hover:shadow-lg active:bg-rose-700 text-white", v = l.bgCancelButton ?? "text-gray-800 bg-gray-300 rounded-lg shadow-md hover:bg-gray-400 hover:shadow-lg active:bg-gray-500", c = i === "custom" ? l.customButtonStyle : null, h = {
|
|
1042
1042
|
delete: () => {
|
|
1043
|
-
|
|
1043
|
+
s == null || s(), e == null || e();
|
|
1044
1044
|
},
|
|
1045
1045
|
custom: () => {
|
|
1046
|
-
|
|
1046
|
+
s == null || s();
|
|
1047
1047
|
}
|
|
1048
1048
|
};
|
|
1049
1049
|
return /* @__PURE__ */ o.jsxs("footer", { className: "flex items-center justify-between mt-4", children: [
|
|
@@ -1056,7 +1056,7 @@ const Ve = () => {
|
|
|
1056
1056
|
}
|
|
1057
1057
|
),
|
|
1058
1058
|
/* @__PURE__ */ o.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
1059
|
-
|
|
1059
|
+
i !== "delete" && u && /* @__PURE__ */ o.jsx(
|
|
1060
1060
|
"button",
|
|
1061
1061
|
{
|
|
1062
1062
|
type: "reset",
|
|
@@ -1068,13 +1068,13 @@ const Ve = () => {
|
|
|
1068
1068
|
/* @__PURE__ */ o.jsx(
|
|
1069
1069
|
"button",
|
|
1070
1070
|
{
|
|
1071
|
-
type:
|
|
1072
|
-
form:
|
|
1071
|
+
type: i === "submit" ? "submit" : "button",
|
|
1072
|
+
form: i === "submit" ? a : void 0,
|
|
1073
1073
|
onClick: () => {
|
|
1074
1074
|
var b;
|
|
1075
|
-
return (b = h[
|
|
1075
|
+
return (b = h[i]) == null ? void 0 : b.call(h);
|
|
1076
1076
|
},
|
|
1077
|
-
className: c || `${
|
|
1077
|
+
className: c || `${i === "delete" ? C : g} px-4 py-2 cursor-pointer text-sm font-medium active:shadow-sm transition-all duration-150 ease-in-out hover:opacity-90 active:scale-95 active:opacity-70`,
|
|
1078
1078
|
children: p
|
|
1079
1079
|
}
|
|
1080
1080
|
)
|
|
@@ -1084,10 +1084,10 @@ const Ve = () => {
|
|
|
1084
1084
|
function It(e) {
|
|
1085
1085
|
return de({ tag: "svg", attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "line", attr: { x1: "18", y1: "6", x2: "6", y2: "18" }, child: [] }, { tag: "line", attr: { x1: "6", y1: "6", x2: "18", y2: "18" }, child: [] }] })(e);
|
|
1086
1086
|
}
|
|
1087
|
-
const _t = ({ onClose: e, type:
|
|
1088
|
-
|
|
1087
|
+
const _t = ({ onClose: e, type: s, title: n, name: i, onCancel: a }) => /* @__PURE__ */ o.jsxs("header", { className: `flex items-center justify-between mb-4 ${s === "delete" ? "gap-8" : ""}`, children: [
|
|
1088
|
+
s === "delete" && i ? /* @__PURE__ */ o.jsxs("h2", { className: "text-2xl", children: [
|
|
1089
1089
|
"Sei sicuro di volere eliminare: ",
|
|
1090
|
-
/* @__PURE__ */ o.jsx("strong", { children:
|
|
1090
|
+
/* @__PURE__ */ o.jsx("strong", { children: i }),
|
|
1091
1091
|
"?"
|
|
1092
1092
|
] }) : /* @__PURE__ */ o.jsx("h2", { className: "text-2xl", children: n || "Conferma operazione" }),
|
|
1093
1093
|
/* @__PURE__ */ o.jsx(
|
|
@@ -1099,7 +1099,7 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1099
1099
|
children: /* @__PURE__ */ o.jsx(It, { className: "text-2xl" })
|
|
1100
1100
|
}
|
|
1101
1101
|
)
|
|
1102
|
-
] }), zt = ({ type: e, children:
|
|
1102
|
+
] }), zt = ({ type: e, children: s, item: n, overrideStyle: i }) => /* @__PURE__ */ o.jsx(o.Fragment, { children: e !== "delete" && /* @__PURE__ */ o.jsx("main", { className: i || "my-8 max-h-[600px] overflow-y-auto overflow-x-hidden", children: e === "delete" && !n ? /* @__PURE__ */ o.jsx("div", { className: "text-red-600 font-semibold", children: "Errore: nessun item selezionato per l'operazione." }) : s }) }), $t = ({ isOpen: e, onClose: s, onCancel: n, title: i, formId: a, children: l, item: u, onConfirm: p, type: m = "submit", style: g = {}, headerContent: C, footerContent: j }) => {
|
|
1103
1103
|
const v = ut(null), [c, h] = E(e), b = () => {
|
|
1104
1104
|
e || h(!1);
|
|
1105
1105
|
}, x = g.width ?? (m === "delete" ? "max-w-md w-auto" : "w-full max-w-4xl"), k = g.bgModal ?? "bg-white", S = g.bgOverlay ?? "bg-black/50", L = g.zIndex ?? "z-50";
|
|
@@ -1107,10 +1107,10 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1107
1107
|
e && h(!0);
|
|
1108
1108
|
}, [e]), H(() => {
|
|
1109
1109
|
const y = (T) => {
|
|
1110
|
-
T.key === "Escape" && (n ? n() :
|
|
1110
|
+
T.key === "Escape" && (n ? n() : s());
|
|
1111
1111
|
};
|
|
1112
1112
|
return document.addEventListener("keydown", y), () => document.removeEventListener("keydown", y);
|
|
1113
|
-
}, [
|
|
1113
|
+
}, [s, n]), H(() => {
|
|
1114
1114
|
var y;
|
|
1115
1115
|
if (e) {
|
|
1116
1116
|
const T = document.activeElement;
|
|
@@ -1121,7 +1121,7 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1121
1121
|
"div",
|
|
1122
1122
|
{
|
|
1123
1123
|
className: `fixed inset-0 ${L} flex items-center justify-center transition-opacity duration-200 ${e ? `${S} opacity-100` : "opacity-0"}`,
|
|
1124
|
-
onClick: n ||
|
|
1124
|
+
onClick: n || s,
|
|
1125
1125
|
onTransitionEnd: b,
|
|
1126
1126
|
children: /* @__PURE__ */ o.jsxs(
|
|
1127
1127
|
"div",
|
|
@@ -1136,10 +1136,10 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1136
1136
|
C || /* @__PURE__ */ o.jsx(
|
|
1137
1137
|
_t,
|
|
1138
1138
|
{
|
|
1139
|
-
onClose:
|
|
1139
|
+
onClose: s,
|
|
1140
1140
|
onCancel: n,
|
|
1141
1141
|
type: m,
|
|
1142
|
-
title:
|
|
1142
|
+
title: i,
|
|
1143
1143
|
name: u == null ? void 0 : u.name
|
|
1144
1144
|
}
|
|
1145
1145
|
),
|
|
@@ -1155,7 +1155,7 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1155
1155
|
j || /* @__PURE__ */ o.jsx(
|
|
1156
1156
|
Bt,
|
|
1157
1157
|
{
|
|
1158
|
-
onClose:
|
|
1158
|
+
onClose: s,
|
|
1159
1159
|
onCancel: n,
|
|
1160
1160
|
onConfirm: p,
|
|
1161
1161
|
type: m,
|
|
@@ -1171,7 +1171,7 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1171
1171
|
document.body
|
|
1172
1172
|
) : null;
|
|
1173
1173
|
}, Ft = (e) => {
|
|
1174
|
-
const { isLoading:
|
|
1174
|
+
const { isLoading: s } = Ce(), { showAlert: n } = fe(), { isOpen: i, closeModal: a, onCancel: l, content: u, title: p, onConfirm: m, item: g, type: C, formId: j, style: v, headerContent: c, footerContent: h } = Gt(), b = Ie(), {
|
|
1175
1175
|
isMain: x = !0,
|
|
1176
1176
|
headerComponent: k = null,
|
|
1177
1177
|
showHeaderOnLogin: S = !1,
|
|
@@ -1185,12 +1185,12 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1185
1185
|
const X = A.some((Z) => We(Z, b.pathname));
|
|
1186
1186
|
let Y;
|
|
1187
1187
|
return b.pathname === "/" ? Y = y && T : Y = y && !X, /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
1188
|
-
|
|
1188
|
+
s && /* @__PURE__ */ o.jsx(Mt, {}),
|
|
1189
1189
|
n && /* @__PURE__ */ o.jsx(Ve, {}),
|
|
1190
1190
|
/* @__PURE__ */ o.jsx(
|
|
1191
1191
|
$t,
|
|
1192
1192
|
{
|
|
1193
|
-
isOpen:
|
|
1193
|
+
isOpen: i,
|
|
1194
1194
|
onClose: a,
|
|
1195
1195
|
onCancel: l,
|
|
1196
1196
|
title: p,
|
|
@@ -1205,7 +1205,7 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1205
1205
|
}
|
|
1206
1206
|
),
|
|
1207
1207
|
$ && k,
|
|
1208
|
-
x ? /* @__PURE__ */ o.jsxs("main", { className:
|
|
1208
|
+
x ? /* @__PURE__ */ o.jsxs("main", { className: s ? "hidden" : "", children: [
|
|
1209
1209
|
n && /* @__PURE__ */ o.jsx(Ve, {}),
|
|
1210
1210
|
/* @__PURE__ */ o.jsx(le, {})
|
|
1211
1211
|
] }) : /* @__PURE__ */ o.jsx(le, {}),
|
|
@@ -1213,9 +1213,9 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1213
1213
|
] });
|
|
1214
1214
|
}, Me = (e) => {
|
|
1215
1215
|
const {
|
|
1216
|
-
inputType:
|
|
1216
|
+
inputType: s,
|
|
1217
1217
|
inputId: n,
|
|
1218
|
-
inputPlaceholder:
|
|
1218
|
+
inputPlaceholder: i,
|
|
1219
1219
|
inputRequired: a,
|
|
1220
1220
|
inputValue: l,
|
|
1221
1221
|
inputChange: u,
|
|
@@ -1224,7 +1224,7 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1224
1224
|
inputStyle: g,
|
|
1225
1225
|
overrideStyle: C,
|
|
1226
1226
|
disabled: j
|
|
1227
|
-
} = e, c = ["text", "email", "password", "search", "tel", "url"].includes(
|
|
1227
|
+
} = e, c = ["text", "email", "password", "search", "tel", "url"].includes(s) ? s : "text";
|
|
1228
1228
|
return /* @__PURE__ */ o.jsx(
|
|
1229
1229
|
"input",
|
|
1230
1230
|
{
|
|
@@ -1232,7 +1232,7 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1232
1232
|
autoFocus: m,
|
|
1233
1233
|
id: n,
|
|
1234
1234
|
className: C || `bg-input-bg border border-input-border text-input-text text-input-placeholder input-rounded focus:ring focus:ring-primary focus:border-primary focus:outline-none focus:shadow-(--shadow-primary-input) block w-full p-input ${g}`,
|
|
1235
|
-
placeholder:
|
|
1235
|
+
placeholder: i,
|
|
1236
1236
|
required: a ?? !0,
|
|
1237
1237
|
value: l,
|
|
1238
1238
|
onChange: u,
|
|
@@ -1240,25 +1240,25 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1240
1240
|
name: p
|
|
1241
1241
|
}
|
|
1242
1242
|
);
|
|
1243
|
-
}, Ae = ({ label: e, labelId:
|
|
1243
|
+
}, Ae = ({ label: e, labelId: s, labelStyle: n, overrideStyle: i }) => /* @__PURE__ */ o.jsx(
|
|
1244
1244
|
"label",
|
|
1245
1245
|
{
|
|
1246
|
-
htmlFor:
|
|
1247
|
-
className:
|
|
1246
|
+
htmlFor: s,
|
|
1247
|
+
className: i || `show-label mb-1 sm:mb-2 text-input-label font-medium text-color-label ${n}`,
|
|
1248
1248
|
children: e
|
|
1249
1249
|
}
|
|
1250
1250
|
), Dt = () => {
|
|
1251
|
-
const { title: e, label:
|
|
1251
|
+
const { title: e, label: s, type: n, placeholder: i, buttonText: a, formData: l, changeData: u, handleLogin: p, overrideStyle: m } = it();
|
|
1252
1252
|
return /* @__PURE__ */ o.jsxs("form", { onSubmit: p, className: m.form || "form-size", children: [
|
|
1253
1253
|
/* @__PURE__ */ o.jsx("h1", { className: m.title || "text-form-title-size show-title title-position m-form-title", children: e }),
|
|
1254
1254
|
/* @__PURE__ */ o.jsxs("div", { className: m.containerEmail || "flex justify-center flex-col gap-1 m-input-form input-size mx-auto", children: [
|
|
1255
|
-
/* @__PURE__ */ o.jsx(Ae, { labelId: "user-email", label:
|
|
1255
|
+
/* @__PURE__ */ o.jsx(Ae, { labelId: "user-email", label: s }),
|
|
1256
1256
|
/* @__PURE__ */ o.jsx(
|
|
1257
1257
|
Me,
|
|
1258
1258
|
{
|
|
1259
1259
|
inputType: n,
|
|
1260
1260
|
inputId: "user-email",
|
|
1261
|
-
inputPlaceholder:
|
|
1261
|
+
inputPlaceholder: i,
|
|
1262
1262
|
inputValue: l.email,
|
|
1263
1263
|
inputChange: (g) => {
|
|
1264
1264
|
u("email", g.target.value);
|
|
@@ -1285,25 +1285,25 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1285
1285
|
/* @__PURE__ */ o.jsx("div", { className: m.containerButton || "flex button-position items-center m-primary-button", children: /* @__PURE__ */ o.jsx("button", { className: m.button || "font-bold cursor-pointer shadow-(--shadow-primary) transition-all duration-200 hover:shadow-(--shadow-primary-hover) active:shadow-(--shadow-primary-active) active:translate-y-[2px] p-primary-button rounded-primary-button bg-primary hover:bg-primary-hover text-primary-text", children: a }) })
|
|
1286
1286
|
] });
|
|
1287
1287
|
}, Wt = ({ Logo: e }) => {
|
|
1288
|
-
const { styleCardForm:
|
|
1288
|
+
const { styleCardForm: s, styleContainerLogo: n, styleLogo: i, overrideStyle: a, customVersion: l } = it(), { firstPrivatePath: u, version: p } = ne(), m = Be();
|
|
1289
1289
|
return H(() => {
|
|
1290
1290
|
const g = JSON.parse(localStorage.getItem("user"));
|
|
1291
1291
|
localStorage.getItem("accessToken") && (g != null && g.id) && m(`${u}${g.id}`);
|
|
1292
1292
|
}, []), /* @__PURE__ */ o.jsxs("section", { id: "login-page", children: [
|
|
1293
1293
|
(p || l) && /* @__PURE__ */ o.jsx("div", { className: "text-md text-primary absolute top-4 left-4", children: l || p }),
|
|
1294
|
-
/* @__PURE__ */ o.jsx("div", { className: a.container || "container mx-auto flex items-center justify-center h-screen", children: /* @__PURE__ */ o.jsxs("div", { className: a.cardForm || `bg-form card-style card-size flex flex-col sm:flex-row sm:items-center justify-center ${
|
|
1295
|
-
/* @__PURE__ */ o.jsx("div", { className: a.containerLogo || `basis-1/2 flex items-center justify-center ${n}`, children: e && /* @__PURE__ */ o.jsx(e, { className: a.logo || `login-logo h-full sm:h-auto ${
|
|
1294
|
+
/* @__PURE__ */ o.jsx("div", { className: a.container || "container mx-auto flex items-center justify-center h-screen", children: /* @__PURE__ */ o.jsxs("div", { className: a.cardForm || `bg-form card-style card-size flex flex-col sm:flex-row sm:items-center justify-center ${s}`, children: [
|
|
1295
|
+
/* @__PURE__ */ o.jsx("div", { className: a.containerLogo || `basis-1/2 flex items-center justify-center ${n}`, children: e && /* @__PURE__ */ o.jsx(e, { className: a.logo || `login-logo h-full sm:h-auto ${i}` }) }),
|
|
1296
1296
|
/* @__PURE__ */ o.jsx(Dt, {})
|
|
1297
1297
|
] }) })
|
|
1298
1298
|
] });
|
|
1299
1299
|
}, Le = () => {
|
|
1300
|
-
const { isAuthenticated: e } = Re(), { activeAlert:
|
|
1300
|
+
const { isAuthenticated: e } = Re(), { activeAlert: s } = fe(), { autoLogin: n } = ne();
|
|
1301
1301
|
return H(() => {
|
|
1302
|
-
const
|
|
1303
|
-
!e && !
|
|
1302
|
+
const i = localStorage.getItem("accessToken");
|
|
1303
|
+
!e && !i && !n && s("danger", "Non sei autorizzato");
|
|
1304
1304
|
}, []), e === null ? null : e ? /* @__PURE__ */ o.jsx(le, {}) : /* @__PURE__ */ o.jsx(Xe, { to: "/", replace: !0 });
|
|
1305
1305
|
}, Ht = () => {
|
|
1306
|
-
const { logout: e, setCurrentToken:
|
|
1306
|
+
const { logout: e, setCurrentToken: s, createAxiosInstances: n } = Re(), { usersEndpoint: i } = ne(), { setIsLoading: a } = Ce(), { activeAlert: l } = fe(), [u, p] = E(null), [m, g] = E(!1), C = JSON.parse(localStorage.getItem("user")), j = async () => {
|
|
1307
1307
|
try {
|
|
1308
1308
|
g(!0);
|
|
1309
1309
|
const c = localStorage.getItem("accessToken");
|
|
@@ -1312,7 +1312,7 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1312
1312
|
return;
|
|
1313
1313
|
}
|
|
1314
1314
|
const x = (await (await n()).get(
|
|
1315
|
-
`${
|
|
1315
|
+
`${i}`,
|
|
1316
1316
|
{
|
|
1317
1317
|
headers: {
|
|
1318
1318
|
Authorization: `Bearer ${c}`
|
|
@@ -1330,7 +1330,7 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1330
1330
|
};
|
|
1331
1331
|
return H(() => {
|
|
1332
1332
|
const c = localStorage.getItem("accessToken");
|
|
1333
|
-
c &&
|
|
1333
|
+
c && s(c);
|
|
1334
1334
|
}, []), /* @__PURE__ */ o.jsx("section", { children: /* @__PURE__ */ o.jsxs("div", { className: "container mx-auto py-8", children: [
|
|
1335
1335
|
/* @__PURE__ */ o.jsxs("div", { className: "flex items-center justify-center gap-8 h-20", children: [
|
|
1336
1336
|
/* @__PURE__ */ o.jsxs("h1", { className: "text-4xl text-center text-slate-800", children: [
|
|
@@ -1408,7 +1408,7 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1408
1408
|
strokeOpacity: 1,
|
|
1409
1409
|
paintOrder: "stroke markers fill"
|
|
1410
1410
|
}, d: "", id: "path40", transform: "scale(0.26458333)" }))), l0 = (e) => {
|
|
1411
|
-
const { publicRoutes:
|
|
1411
|
+
const { publicRoutes: s, privateRoutes: n } = Pt(), { firstPrivatePath: i } = ne(), {
|
|
1412
1412
|
logoImg: a = Yt,
|
|
1413
1413
|
pathImg: l = "./src/assets/MyWarehouse.svg",
|
|
1414
1414
|
firstPrivateElement: u = /* @__PURE__ */ o.jsx(Ht, {}),
|
|
@@ -1457,45 +1457,45 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1457
1457
|
}, []), /* @__PURE__ */ o.jsx(dt, { children: /* @__PURE__ */ o.jsxs(ae, { element: k, children: [
|
|
1458
1458
|
/* @__PURE__ */ o.jsxs(ae, { path: "/", children: [
|
|
1459
1459
|
/* @__PURE__ */ o.jsx(ae, { index: !0, element: /* @__PURE__ */ o.jsx(Wt, { Logo: a }) }),
|
|
1460
|
-
|
|
1460
|
+
s.map((y, T) => /* @__PURE__ */ o.jsx(ae, { path: y.path, element: y.element }, `public-${T}`))
|
|
1461
1461
|
] }),
|
|
1462
1462
|
/* @__PURE__ */ o.jsxs(ae, { element: S, children: [
|
|
1463
|
-
/* @__PURE__ */ o.jsx(ae, { path: `${
|
|
1463
|
+
/* @__PURE__ */ o.jsx(ae, { path: `${i ?? "/dashboard/"}:id`, element: u }),
|
|
1464
1464
|
n.map((y, T) => /* @__PURE__ */ o.jsx(ae, { path: y.path, element: y.element }, `private-${T}`))
|
|
1465
1465
|
] })
|
|
1466
1466
|
] }) });
|
|
1467
1467
|
}, c0 = ({ children: e }) => {
|
|
1468
1468
|
var a;
|
|
1469
|
-
const
|
|
1469
|
+
const s = Ie(), { activeAlert: n } = fe(), i = JSON.parse(localStorage.getItem("user"));
|
|
1470
1470
|
return H(() => {
|
|
1471
|
-
(!
|
|
1472
|
-
}, [
|
|
1473
|
-
}, u0 = ({ spinner: e = !0, spinnerStyle:
|
|
1474
|
-
e && /* @__PURE__ */ o.jsx(lt, { className: u.spinner || `text-[20rem] animate-spin text-black ${
|
|
1475
|
-
a || /* @__PURE__ */ o.jsx("p", { className: u.text || `text-black text-2xl select-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ${
|
|
1476
|
-
] }), Je = ({ isTag: e = !1, value:
|
|
1471
|
+
(!i || !i.admin) && n("warning", "Non puoi accedere a questa pagina");
|
|
1472
|
+
}, [i]), !i || !i.admin ? /* @__PURE__ */ o.jsx(Xe, { to: ((a = s.state) == null ? void 0 : a.from) || "/", replace: !0 }) : e;
|
|
1473
|
+
}, u0 = ({ spinner: e = !0, spinnerStyle: s, text: n, textStyle: i, children: a, containerStyle: l, overrideStyle: u = {} }) => /* @__PURE__ */ o.jsxs("div", { className: u.container || `w-full h-full relative flex items-center justify-center ${l}`, children: [
|
|
1474
|
+
e && /* @__PURE__ */ o.jsx(lt, { className: u.spinner || `text-[20rem] animate-spin text-black ${s}` }),
|
|
1475
|
+
a || /* @__PURE__ */ o.jsx("p", { className: u.text || `text-black text-2xl select-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ${i}`, children: n || "Loading..." })
|
|
1476
|
+
] }), Je = ({ isTag: e = !1, value: s, label: n, placeholder: i, id: a, onChange: l, error: u = null }) => /* @__PURE__ */ o.jsxs("div", { className: `flex items-center justify-center relative ${e ? "gap-4 mb-2" : "gap-1 m-4"}`, children: [
|
|
1477
1477
|
/* @__PURE__ */ o.jsx(Ae, { labelId: a, label: n, overrideStyle: `text-xl font-bold text-color-label ${e ? "" : "basis-1/3"}` }),
|
|
1478
1478
|
/* @__PURE__ */ o.jsx(
|
|
1479
1479
|
Me,
|
|
1480
1480
|
{
|
|
1481
1481
|
type: "text",
|
|
1482
1482
|
inputId: a,
|
|
1483
|
-
inputPlaceholder:
|
|
1484
|
-
inputValue:
|
|
1483
|
+
inputPlaceholder: i,
|
|
1484
|
+
inputValue: s || "",
|
|
1485
1485
|
disabled: e,
|
|
1486
1486
|
inputChange: l,
|
|
1487
1487
|
overrideStyle: `${e ? "w-full" : "basis-2/3"} ${u ? "border-red-600 focus:ring focus:ring-red-600 focus:border-red-600 focus:shadow-[0_0_0_4px_rgba(255,0,0,0.5)]" : ""} bg-input-bg border border-input-border text-input-text text-input-placeholder input-rounded focus:ring focus:ring-focus-ring focus:border-spot-rfid-input-border focus:outline-none focus:shadow-spot-rfid-input block w-full p-input`
|
|
1488
1488
|
}
|
|
1489
1489
|
),
|
|
1490
1490
|
u && /* @__PURE__ */ o.jsx("p", { className: "text-red-600 text-[13px] absolute bottom-0 left-26 translate-y-[20px]", children: u })
|
|
1491
|
-
] }), d0 = ({ title: e, showTag:
|
|
1491
|
+
] }), d0 = ({ title: e, showTag: s, value: n, tag: i, showButton: a, handleClick: l }) => /* @__PURE__ */ o.jsxs("div", { className: `border border-slate-300 rounded-xl p-2 m-2 shadow-xl transition-all duration-700 transform ${e === "TAG B" ? "delay-200" : "mb-4"} ${s ? "opacity-100 translate-y-0" : "opacity-0 translate-y-10"}`, children: [
|
|
1492
1492
|
/* @__PURE__ */ o.jsx("h2", { className: "text-center mb-2 text-2xl", children: e }),
|
|
1493
1493
|
/* @__PURE__ */ o.jsx(
|
|
1494
1494
|
Je,
|
|
1495
1495
|
{
|
|
1496
1496
|
label: "TID",
|
|
1497
1497
|
placeholder: `Leggi ${e}`,
|
|
1498
|
-
id:
|
|
1498
|
+
id: i ? `tid-${i}` : "tid",
|
|
1499
1499
|
isTag: !0,
|
|
1500
1500
|
value: (n == null ? void 0 : n.valueTID) || ""
|
|
1501
1501
|
}
|
|
@@ -1505,7 +1505,7 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1505
1505
|
{
|
|
1506
1506
|
label: "EPC",
|
|
1507
1507
|
placeholder: `Leggi ${e}`,
|
|
1508
|
-
id:
|
|
1508
|
+
id: i ? `epc-${i}` : "epc",
|
|
1509
1509
|
isTag: !0,
|
|
1510
1510
|
value: (n == null ? void 0 : n.valueEPC) || ""
|
|
1511
1511
|
}
|
|
@@ -1523,8 +1523,8 @@ const _t = ({ onClose: e, type: i, title: n, name: s, onCancel: a }) => /* @__PU
|
|
|
1523
1523
|
function Zt(e) {
|
|
1524
1524
|
return de({ tag: "svg", attr: { viewBox: "0 0 16 16", fill: "currentColor" }, child: [{ tag: "path", attr: { fillRule: "evenodd", clipRule: "evenodd", d: "M11.04 1.33L12.71 3l.29.71v.33h-.5l-.5.5v-.83l-1.67-1.67H10v4H4v-4H2v10h3l-.5 1H2l-1-1v-10l1-1h8.33l.71.29zM7 5h2V2H7v3zm6.5 0L15 6.5l-.02.69-5.5 5.5-.13.12-.37.37-.1.09-3 1.5-.67-.67 1.5-3 .09-.1.37-.37.12-.13 5.5-5.5h.71zm-6.22 7.24l-.52 1 1.04-.48-.52-.52zm.69-1.03l.79.79 5.15-5.15-.79-.79-5.15 5.15z" }, child: [] }] })(e);
|
|
1525
1525
|
}
|
|
1526
|
-
const f0 = ({ minReadingPower: e, maxReadingPower:
|
|
1527
|
-
const p = (
|
|
1526
|
+
const f0 = ({ minReadingPower: e, maxReadingPower: s, stepRangePower: n, rangeValue: i, setRangeValue: a, show: l, handleClick: u }) => {
|
|
1527
|
+
const p = (i - e) / (s - e) * 100;
|
|
1528
1528
|
return /* @__PURE__ */ o.jsxs("div", { className: `border border-slate-300 rounded-xl p-2 m-2 shadow-xl transition-all duration-700 transform ${l ? "opacity-100 translate-y-0" : "opacity-0 translate-y-10"}`, children: [
|
|
1529
1529
|
/* @__PURE__ */ o.jsx("h2", { className: "text-center my-4 text-2xl", children: "Configurazione Potenza" }),
|
|
1530
1530
|
/* @__PURE__ */ o.jsxs("div", { className: "relative my-12 w-[90%] mx-auto", children: [
|
|
@@ -1534,9 +1534,9 @@ const f0 = ({ minReadingPower: e, maxReadingPower: i, stepRangePower: n, rangeVa
|
|
|
1534
1534
|
id: "power",
|
|
1535
1535
|
type: "range",
|
|
1536
1536
|
min: e,
|
|
1537
|
-
max:
|
|
1537
|
+
max: s,
|
|
1538
1538
|
step: n,
|
|
1539
|
-
value:
|
|
1539
|
+
value: i,
|
|
1540
1540
|
onChange: (m) => a(Number(m.target.value)),
|
|
1541
1541
|
className: "w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-primary-accent"
|
|
1542
1542
|
}
|
|
@@ -1546,14 +1546,14 @@ const f0 = ({ minReadingPower: e, maxReadingPower: i, stepRangePower: n, rangeVa
|
|
|
1546
1546
|
{
|
|
1547
1547
|
className: "absolute bottom-8 transform -translate-x-1/2 bg-white border border-gray-200 text-sm text-gray-800 py-1 px-2 rounded-lg shadow-md transition-opacity",
|
|
1548
1548
|
style: { left: `${p}%` },
|
|
1549
|
-
children:
|
|
1549
|
+
children: i
|
|
1550
1550
|
}
|
|
1551
1551
|
)
|
|
1552
1552
|
] }),
|
|
1553
1553
|
/* @__PURE__ */ o.jsx("div", { className: "flex items-center justify-center my-4", children: /* @__PURE__ */ o.jsxs(
|
|
1554
1554
|
"button",
|
|
1555
1555
|
{
|
|
1556
|
-
onClick: () => u(
|
|
1556
|
+
onClick: () => u(i),
|
|
1557
1557
|
className: "py-2 px-4 flex items-center justify-center gap-1 bg-save-button text-white rounded-lg shadow-md transition duration-200 ease-in-out transform active:translate-y-[2px] cursor-pointer",
|
|
1558
1558
|
children: [
|
|
1559
1559
|
"Salva",
|
|
@@ -1562,7 +1562,7 @@ const f0 = ({ minReadingPower: e, maxReadingPower: i, stepRangePower: n, rangeVa
|
|
|
1562
1562
|
}
|
|
1563
1563
|
) })
|
|
1564
1564
|
] });
|
|
1565
|
-
}, m0 = ({ show: e, isConfigPage:
|
|
1565
|
+
}, m0 = ({ show: e, isConfigPage: s, handleSelectFile: n }) => /* @__PURE__ */ o.jsxs("div", { className: `${s ? `${e ? "opacity-100 translate-y-0 delay-200" : "opacity-0 translate-y-10"}` : ""} p-4 text-center transition-all duration-700 transform`, children: [
|
|
1566
1566
|
/* @__PURE__ */ o.jsxs("h2", { className: "text-xl my-4", children: [
|
|
1567
1567
|
"Seleziona il file ",
|
|
1568
1568
|
/* @__PURE__ */ o.jsx("strong", { children: "config.json" }),
|
|
@@ -1641,12 +1641,12 @@ const Vt = (e) => /* @__PURE__ */ r.createElement("svg", { width: "108.41262mm",
|
|
|
1641
1641
|
strokeWidth: 0,
|
|
1642
1642
|
strokeOpacity: 1,
|
|
1643
1643
|
paintOrder: "stroke markers fill"
|
|
1644
|
-
}, d: "", id: "path40", transform: "scale(0.26458333)" }))), p0 = ({ Logo: e, logo:
|
|
1645
|
-
const { logout: n } = Re(), { activeAlert:
|
|
1646
|
-
n(),
|
|
1644
|
+
}, d: "", id: "path40", transform: "scale(0.26458333)" }))), p0 = ({ Logo: e, logo: s }) => {
|
|
1645
|
+
const { logout: n } = Re(), { activeAlert: i } = fe(), { autoLogin: a, configRoutes: l, firstPrivateTitle: u, showHeaderButton: p } = ne(), { isLoading: m } = Ce(), g = Ie(), C = Be(), j = () => {
|
|
1646
|
+
n(), i("info", "Hai effettuato il logout");
|
|
1647
1647
|
}, v = l.find((h) => h.path === g.pathname), c = ft("home/:id");
|
|
1648
1648
|
return /* @__PURE__ */ o.jsx("header", { className: m ? "hidden" : "", children: /* @__PURE__ */ o.jsxs("nav", { className: "header-size flex items-center justify-between px-2 shadow-lg border-b gap-2 border-b-gray-300", children: [
|
|
1649
|
-
/* @__PURE__ */ o.jsx("figure", { children: e && typeof e == "function" ? /* @__PURE__ */ o.jsx(e, { className: "header-logo-size" }) :
|
|
1649
|
+
/* @__PURE__ */ o.jsx("figure", { children: e && typeof e == "function" ? /* @__PURE__ */ o.jsx(e, { className: "header-logo-size" }) : s ? /* @__PURE__ */ o.jsx("img", { src: s, alt: "Logo", className: "header-logo-size" }) : /* @__PURE__ */ o.jsx(Vt, { className: "header-logo-size" }) }),
|
|
1650
1650
|
/* @__PURE__ */ o.jsx("div", { children: /* @__PURE__ */ o.jsx("p", { children: (v == null ? void 0 : v.title) || u }) }),
|
|
1651
1651
|
/* @__PURE__ */ o.jsxs("div", { children: [
|
|
1652
1652
|
!a && c && /* @__PURE__ */ o.jsx(
|
|
@@ -1694,14 +1694,14 @@ export {
|
|
|
1694
1694
|
t0 as LoadingProvider,
|
|
1695
1695
|
Wt as Login,
|
|
1696
1696
|
Dt as LoginForm,
|
|
1697
|
-
|
|
1697
|
+
i0 as LoginFormProvider,
|
|
1698
1698
|
a0 as ModalProvider,
|
|
1699
1699
|
b0 as NavLink,
|
|
1700
1700
|
y0 as Outlet,
|
|
1701
1701
|
l0 as PackageRoutes,
|
|
1702
1702
|
N0 as ReactDOM,
|
|
1703
1703
|
E0 as Route,
|
|
1704
|
-
|
|
1704
|
+
s0 as RouteProvider,
|
|
1705
1705
|
w0 as Routes,
|
|
1706
1706
|
L0 as axios,
|
|
1707
1707
|
Rt as fetchAxiosConfig,
|
|
@@ -1710,7 +1710,7 @@ export {
|
|
|
1710
1710
|
ne as useConfig,
|
|
1711
1711
|
Ce as useLoading,
|
|
1712
1712
|
C0 as useLocation,
|
|
1713
|
-
|
|
1713
|
+
it as useLoginForm,
|
|
1714
1714
|
j0 as useMatch,
|
|
1715
1715
|
Gt as useModal,
|
|
1716
1716
|
k0 as useNavigate,
|