thecore-auth 0.0.74 → 0.0.75
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 +4 -4
- package/dist/thecore-auth.esm.js +60 -60
- package/package.json +1 -1
package/dist/thecore-auth.cjs.js
CHANGED
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
`+he+e+Te}function p(e,l){if(!e||xe)return"";var c=ve.get(e);if(c!==void 0)return c;xe=!0,c=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var E=null;E=z.H,z.H=null,u();try{var A={DetermineComponentFrameRoot:function(){try{if(l){var Z=function(){throw Error()};if(Object.defineProperty(Z.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Z,[])}catch($){var ue=$}Reflect.construct(e,[],Z)}else{try{Z.call()}catch($){ue=$}e.call(Z.prototype)}}else{try{throw Error()}catch($){ue=$}(Z=e())&&typeof Z.catch=="function"&&Z.catch(function(){})}}catch($){if($&&ue&&typeof $.stack=="string")return[$.stack,ue.stack]}return[null,null]}};A.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var O=Object.getOwnPropertyDescriptor(A.DetermineComponentFrameRoot,"name");O&&O.configurable&&Object.defineProperty(A.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=A.DetermineComponentFrameRoot(),B=x[0],re=x[1];if(B&&re){var N=B.split(`
|
|
20
20
|
`),K=re.split(`
|
|
21
21
|
`);for(x=O=0;O<N.length&&!N[O].includes("DetermineComponentFrameRoot");)O++;for(;x<K.length&&!K[x].includes("DetermineComponentFrameRoot");)x++;if(O===N.length||x===K.length)for(O=N.length-1,x=K.length-1;1<=O&&0<=x&&N[O]!==K[x];)x--;for(;1<=O&&0<=x;O--,x--)if(N[O]!==K[x]){if(O!==1||x!==1)do if(O--,x--,0>x||N[O]!==K[x]){var ae=`
|
|
22
|
-
`+N[O].replace(" at new "," at ");return e.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",e.displayName)),typeof e=="function"&&ve.set(e,ae),ae}while(1<=O&&0<=x);break}}}finally{xe=!1,z.H=E,f(),Error.prepareStackTrace=c}return N=(N=e?e.displayName||e.name:"")?d(N):"",typeof e=="function"&&ve.set(e,N),N}function m(e){if(e==null)return"";if(typeof e=="function"){var l=e.prototype;return p(e,!(!l||!l.isReactComponent))}if(typeof e=="string")return d(e);switch(e){case V:return d("Suspense");case G:return d("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case W:return e=p(e.render,!1),e;case X:return m(e.type);case T:l=e._payload,e=e._init;try{return m(e(l))}catch{}}return""}function w(){var e=z.A;return e===null?null:e.getOwner()}function C(e){if(te.call(e,"key")){var l=Object.getOwnPropertyDescriptor(e,"key").get;if(l&&l.isReactWarning)return!1}return e.key!==void 0}function P(e,l){function c(){_e||(_e=!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)",l))}c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}function k(){var e=t(this.type);return Ae[e]||(Ae[e]=!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.")),e=this.props.ref,e!==void 0?e:null}function
|
|
22
|
+
`+N[O].replace(" at new "," at ");return e.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",e.displayName)),typeof e=="function"&&ve.set(e,ae),ae}while(1<=O&&0<=x);break}}}finally{xe=!1,z.H=E,f(),Error.prepareStackTrace=c}return N=(N=e?e.displayName||e.name:"")?d(N):"",typeof e=="function"&&ve.set(e,N),N}function m(e){if(e==null)return"";if(typeof e=="function"){var l=e.prototype;return p(e,!(!l||!l.isReactComponent))}if(typeof e=="string")return d(e);switch(e){case V:return d("Suspense");case G:return d("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case W:return e=p(e.render,!1),e;case X:return m(e.type);case T:l=e._payload,e=e._init;try{return m(e(l))}catch{}}return""}function w(){var e=z.A;return e===null?null:e.getOwner()}function C(e){if(te.call(e,"key")){var l=Object.getOwnPropertyDescriptor(e,"key").get;if(l&&l.isReactWarning)return!1}return e.key!==void 0}function P(e,l){function c(){_e||(_e=!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)",l))}c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}function k(){var e=t(this.type);return Ae[e]||(Ae[e]=!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.")),e=this.props.ref,e!==void 0?e:null}function g(e,l,c,E,A,O){return c=O.ref,e={$$typeof:j,type:e,key:l,props:O,_owner:A},(c!==void 0?c:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:k}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function b(e,l,c,E,A,O){if(typeof e=="string"||typeof e=="function"||e===D||e===F||e===ee||e===V||e===G||e===M||typeof e=="object"&&e!==null&&(e.$$typeof===T||e.$$typeof===X||e.$$typeof===H||e.$$typeof===q||e.$$typeof===W||e.$$typeof===nt||e.getModuleId!==void 0)){var x=l.children;if(x!==void 0)if(E)if(ge(x)){for(E=0;E<x.length;E++)v(x[E],e);Object.freeze&&Object.freeze(x)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else v(x,e)}else x="",(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(x+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),e===null?E="null":ge(e)?E="array":e!==void 0&&e.$$typeof===j?(E="<"+(t(e.type)||"Unknown")+" />",x=" Did you accidentally export a JSX literal instead of a component?"):E=typeof e,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",E,x);if(te.call(l,"key")){x=t(e);var B=Object.keys(l).filter(function(N){return N!=="key"});E=0<B.length?"{key: someKey, "+B.join(": ..., ")+": ...}":"{key: someKey}",Ne[x+E]||(B=0<B.length?"{"+B.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} />`,E,x,B,x),Ne[x+E]=!0)}if(x=null,c!==void 0&&(n(c),x=""+c),C(l)&&(n(l.key),x=""+l.key),"key"in l){c={};for(var re in l)re!=="key"&&(c[re]=l[re])}else c=l;return x&&P(c,typeof e=="function"?e.displayName||e.name||"Unknown":e),
|
|
27
|
+
<%s key={someKey} {...props} />`,E,x,B,x),Ne[x+E]=!0)}if(x=null,c!==void 0&&(n(c),x=""+c),C(l)&&(n(l.key),x=""+l.key),"key"in l){c={};for(var re in l)re!=="key"&&(c[re]=l[re])}else c=l;return x&&P(c,typeof e=="function"?e.displayName||e.name||"Unknown":e),g(e,x,O,A,w(),c)}function v(e,l){if(typeof e=="object"&&e&&e.$$typeof!==at){if(ge(e))for(var c=0;c<e.length;c++){var E=e[c];S(E)&&y(E,l)}else if(S(e))e._store&&(e._store.validated=1);else if(e===null||typeof e!="object"?c=null:(c=Y&&e[Y]||e["@@iterator"],c=typeof c=="function"?c:null),typeof c=="function"&&c!==e.entries&&(c=c.call(e),c!==e))for(;!(e=c.next()).done;)S(e.value)&&y(e.value,l)}}function S(e){return typeof e=="object"&&e!==null&&e.$$typeof===j}function y(e,l){if(e._store&&!e._store.validated&&e.key==null&&(e._store.validated=1,l=h(l),!Me[l])){Me[l]=!0;var c="";e&&e._owner!=null&&e._owner!==w()&&(c=null,typeof e._owner.tag=="number"?c=t(e._owner.type):typeof e._owner.name=="string"&&(c=e._owner.name),c=" It was passed a child from "+c+".");var E=z.getCurrentStack;z.getCurrentStack=function(){var A=m(e.type);return E&&(A+=E()||""),A},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.',l,c),z.getCurrentStack=E}}function h(e){var l="",c=w();return c&&(c=t(c.type))&&(l=`
|
|
28
28
|
|
|
29
29
|
Check the render method of \``+c+"`."),l||(e=t(e))&&(l=`
|
|
30
30
|
|
|
@@ -50,7 +50,7 @@ Esempio di config.json:
|
|
|
50
50
|
"autoLogin": ,
|
|
51
51
|
"autoLoginEmail": ,
|
|
52
52
|
"autoLoginPassword":
|
|
53
|
-
}`,d=()=>{const h=new Date,b=String(h.getDate()).padStart(2,"0"),v=String(h.getMonth()+1).padStart(2,"0"),S=h.getFullYear(),y=String(h.getHours()).padStart(2,"0"),g=String(h.getMinutes()).padStart(2,"0"),R=String(h.getSeconds()).padStart(2,"0");return`${b}/${v}/${S} ${y}:${g}:${R}`},p=h=>new Promise((b,v)=>{const S=indexedDB.open("configDatabase",1);S.onupgradeneeded=y=>{const g=y.target.result;g.objectStoreNames.contains(h)||g.createObjectStore(h,{keyPath:"id"})},S.onsuccess=y=>b(y.target.result),S.onerror=y=>v(y.target.error)}),m=async(h,b)=>{let v=await p();return new Promise((S,y)=>{if(!v){y("Errore: DB non disponibile");return}const g=v==null?void 0:v.transaction(h,"readonly"),R=g==null?void 0:g.objectStore(h),j=R==null?void 0:R.get(b);j.onsuccess=()=>S(j.result),j.onerror=_=>y(_.target.error)})},w=async(h,b)=>{let v=await p();return new Promise((S,y)=>{if(!v){y("Errore: DB non disponibile");return}const g=v==null?void 0:v.transaction(h,"readwrite"),R=g==null?void 0:g.objectStore(h),j=R==null?void 0:R.put(b);j.onsuccess=()=>S(j.result),j.onerror=_=>y(_.target.error)})},C=async h=>{let b=Date.now(),v;do v=await m(h,b),v&&b++;while(v);return b},P=async(h,b)=>{b.id||(b.id=await C(h)),await w(h,b)},k=async()=>{try{const v={...await(await fetch("/config.json")).json(),openIndexedDB:p,getDataIndexedDB:m,setDataIndexedDB:w,generateUniqueId:C,setDataWithAutoId:P,setCurrentDate:d};n(v)}catch(h){console.error(h),u(!0)}};return i.useEffect(()=>{k()},[]),Object.keys(o).length===0?s.jsx(Fe,{errorShow:a,errorMessage:f}):s.jsx(We.Provider,{value:o,children:t})},U=()=>{const t=i.useContext(We);if(t===void 0)throw new Error("Non puoi leggere i config");return t},pt=t=>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",...t},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 "}))))),gt=t=>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",...t},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 "}))))),ht=t=>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",...t},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 Ye={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Be=i.createContext&&i.createContext(Ye),xt=["attr","size","title"];function vt(t,o){if(t==null)return{};var n=bt(t,o),a,u;if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(t);for(u=0;u<f.length;u++)a=f[u],!(o.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(t,a)&&(n[a]=t[a])}return n}function bt(t,o){if(t==null)return{};var n={};for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){if(o.indexOf(a)>=0)continue;n[a]=t[a]}return n}function de(){return de=Object.assign?Object.assign.bind():function(t){for(var o=1;o<arguments.length;o++){var n=arguments[o];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},de.apply(this,arguments)}function $e(t,o){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);o&&(a=a.filter(function(u){return Object.getOwnPropertyDescriptor(t,u).enumerable})),n.push.apply(n,a)}return n}function me(t){for(var o=1;o<arguments.length;o++){var n=arguments[o]!=null?arguments[o]:{};o%2?$e(Object(n),!0).forEach(function(a){Et(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$e(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function Et(t,o,n){return o=yt(o),o in t?Object.defineProperty(t,o,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[o]=n,t}function yt(t){var o=Ct(t,"string");return typeof o=="symbol"?o:o+""}function Ct(t,o){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var a=n.call(t,o||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(t)}function Ze(t){return t&&t.map((o,n)=>i.createElement(o.tag,me({key:n},o.attr),Ze(o.child)))}function Ce(t){return o=>i.createElement(wt,de({attr:me({},t.attr)},o),Ze(t.child))}function wt(t){var o=n=>{var{attr:a,size:u,title:f}=t,d=vt(t,xt),p=u||n.size||"1em",m;return n.className&&(m=n.className),t.className&&(m=(m?m+" ":"")+t.className),i.createElement("svg",de({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,a,d,{className:m,style:me(me({color:t.color||n.color},n.style),t.style),height:p,width:p,xmlns:"http://www.w3.org/2000/svg"}),f&&i.createElement("title",null,f),t.children)};return Be!==void 0?i.createElement(Be.Consumer,null,n=>o(n)):o(Ye)}function jt(t){return Ce({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:[]}]})(t)}const Ue=i.createContext(),St=({children:t})=>{const[o,n]=i.useState(!1),[a,u]=i.useState(),[f,d]=i.useState(),P={showAlert:o,setShowAlert:n,typeAlert:a,setTypeAlert:u,messageAlert:f,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:k=>{switch(k){case"danger":return s.jsx(pt,{className:"w-[20px] h-[20px]"});case"info":return s.jsx(gt,{className:"w-[20px] h-[20px]"});case"success":return s.jsx(jt,{className:"text-xl"});case"warning":return s.jsx(ht,{className:"w-[20px] h-[20px]"})}},closeAlert:()=>{n(!o)},activeAlert:(k,h)=>{n(!1),setTimeout(()=>{u(k),d(h),n(!0)},50)}};return s.jsx(Ue.Provider,{value:P,children:t})},Q=()=>{const t=i.useContext(Ue);if(t===void 0)throw new Error("Non puoi modificare l'alert");return t};let oe;const le=async(t,o,n)=>{if(oe)return oe;try{const u=await(await fetch("/config.json")).json(),f=u.baseUri,{unauthorized:d,notFound:p,defaultMessage:m}=u.axiosErrors,w=u.axiosTimeout;return oe=it.create({baseURL:f,timeout:w}),oe.interceptors.request.use(C=>C),oe.interceptors.response.use(C=>C,C=>{if(C.response)switch(t(!0),o("danger"),C.response.status){case 401:localStorage.removeItem("accessToken"),n(d);break;case 404:n(p);break;default:n(`${m} ${C.response.status} ${C.response.data.error}`)}return Promise.reject(C)}),oe}catch(a){console.error(a)}},qe=i.createContext(),Lt=({children:t})=>{const{heartbeatEndpoint:o,firstPrivatePath:n,infiniteSession:a,timeDeducted:u,authenticatedEndpoint:f,autoLogin:d,autoLoginEmail:p,autoLoginPassword:m,setCurrentDate:w}=U(),{setIsLoading:C}=ce(),{setShowAlert:P,setMessageAlert:k,setTypeAlert:h,activeAlert:b}=Q(),v=L.useNavigate(),[S,y]=i.useState(null),[g,R]=i.useState(),[j,_]=i.useState(),[D,ee]=i.useState(),[F,q]=i.useState(!1),H=async(T=null,M)=>{T&&T.preventDefault(),q(!0);try{C(!0),P(!1);const I=await(await le(P,h,k)).post(f,{auth:M}),z=I.data.id,te=I.headers.token;te&&(localStorage.setItem("accessToken",te),localStorage.setItem("id",z),y(!0),R(te),v(`${n}${z}`))}catch(Y){console.error(Y)}finally{q(!1),C(!1)}},W=()=>{localStorage.removeItem("accessToken"),localStorage.removeItem("id"),y(!1),R(null)},V=async()=>{try{const T=localStorage.getItem("accessToken"),I=(await(await le(P,h,k)).get(`${o}`,{headers:{Authorization:T}})).headers.token;localStorage.setItem("accessToken",I),R(I),console.log("nuovo token: ",I,"Data:",w())}catch(T){console.error(T),W()}},G=()=>{if(!g)return;const M=st(g).exp,Y=Math.floor(Date.now()/1e3),I=(M-Y)*1e3;ee(I),_(I-u)};i.useEffect(()=>{if(localStorage.getItem("accessToken"))y(!0);else{y(!1);return}},[]),i.useEffect(()=>{const T=localStorage.getItem("accessToken");d&&!T&&!F&&H(null,{email:p,password:m})},[d,F]),i.useEffect(()=>{G();let T;a&&g&&j&&(T=setInterval(()=>{V()},j));let M;return!a&&g&&D&&(M=setTimeout(()=>{W(),b("danger","Sessione scaduta")},D)),()=>{T&&clearInterval(T),M&&clearTimeout(M)}},[g,j]),i.useEffect(()=>{S||d&&!F&&H(null,{email:p,password:m})},[S]);const X={isAuthenticated:S,setIsAuthenticated:y,login:H,logout:W,setCurrentToken:R};return s.jsx(qe.Provider,{value:X,children:t})},pe=()=>{const t=i.useContext(qe);if(t===void 0)throw new Error("Non sei dentro al Auth Provider");return t},He=i.createContext(),Ot=({children:t,publicRoutes:o=[],privateRoutes:n=[]})=>s.jsx(He.Provider,{value:{publicRoutes:o,privateRoutes:n},children:t}),Ve=()=>{const t=i.useContext(He);if(t===void 0)throw new Error(`Errore: Le rotte non sono state inizializzate correttamente.
|
|
53
|
+
}`,d=()=>{const g=new Date,b=String(g.getDate()).padStart(2,"0"),v=String(g.getMonth()+1).padStart(2,"0"),S=g.getFullYear(),y=String(g.getHours()).padStart(2,"0"),h=String(g.getMinutes()).padStart(2,"0"),R=String(g.getSeconds()).padStart(2,"0");return`${b}/${v}/${S} ${y}:${h}:${R}`},p=g=>new Promise((b,v)=>{const S=indexedDB.open("configDatabase",1);S.onupgradeneeded=y=>{const h=y.target.result;h.objectStoreNames.contains(g)||h.createObjectStore(g,{keyPath:"id"})},S.onsuccess=y=>b(y.target.result),S.onerror=y=>v(y.target.error)}),m=async(g,b)=>{let v=await p(g);return new Promise((S,y)=>{if(!v){y("Errore: DB non disponibile");return}const h=v==null?void 0:v.transaction(g,"readonly"),R=h==null?void 0:h.objectStore(g),j=R==null?void 0:R.get(b);j.onsuccess=()=>S(j.result),j.onerror=_=>y(_.target.error)})},w=async(g,b)=>{let v=await p(g);return new Promise((S,y)=>{if(!v){y("Errore: DB non disponibile");return}const h=v==null?void 0:v.transaction(g,"readwrite"),R=h==null?void 0:h.objectStore(g),j=R==null?void 0:R.put(b);j.onsuccess=()=>S(j.result),j.onerror=_=>y(_.target.error)})},C=async g=>{let b=Date.now(),v;do v=await m(g,b),v&&b++;while(v);return b},P=async(g,b)=>{b.id||(b.id=await C(g)),await w(g,b)},k=async()=>{try{const v={...await(await fetch("/config.json")).json(),openIndexedDB:p,getDataIndexedDB:m,setDataIndexedDB:w,generateUniqueId:C,setDataWithAutoId:P,setCurrentDate:d};n(v)}catch(g){console.error(g),u(!0)}};return i.useEffect(()=>{k()},[]),Object.keys(o).length===0?s.jsx(Fe,{errorShow:a,errorMessage:f}):s.jsx(We.Provider,{value:o,children:t})},U=()=>{const t=i.useContext(We);if(t===void 0)throw new Error("Non puoi leggere i config");return t},pt=t=>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",...t},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 "}))))),gt=t=>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",...t},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 "}))))),ht=t=>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",...t},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 Ye={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Be=i.createContext&&i.createContext(Ye),xt=["attr","size","title"];function vt(t,o){if(t==null)return{};var n=bt(t,o),a,u;if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(t);for(u=0;u<f.length;u++)a=f[u],!(o.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(t,a)&&(n[a]=t[a])}return n}function bt(t,o){if(t==null)return{};var n={};for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){if(o.indexOf(a)>=0)continue;n[a]=t[a]}return n}function de(){return de=Object.assign?Object.assign.bind():function(t){for(var o=1;o<arguments.length;o++){var n=arguments[o];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},de.apply(this,arguments)}function $e(t,o){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);o&&(a=a.filter(function(u){return Object.getOwnPropertyDescriptor(t,u).enumerable})),n.push.apply(n,a)}return n}function me(t){for(var o=1;o<arguments.length;o++){var n=arguments[o]!=null?arguments[o]:{};o%2?$e(Object(n),!0).forEach(function(a){Et(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$e(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function Et(t,o,n){return o=yt(o),o in t?Object.defineProperty(t,o,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[o]=n,t}function yt(t){var o=Ct(t,"string");return typeof o=="symbol"?o:o+""}function Ct(t,o){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var a=n.call(t,o||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(t)}function Ze(t){return t&&t.map((o,n)=>i.createElement(o.tag,me({key:n},o.attr),Ze(o.child)))}function Ce(t){return o=>i.createElement(wt,de({attr:me({},t.attr)},o),Ze(t.child))}function wt(t){var o=n=>{var{attr:a,size:u,title:f}=t,d=vt(t,xt),p=u||n.size||"1em",m;return n.className&&(m=n.className),t.className&&(m=(m?m+" ":"")+t.className),i.createElement("svg",de({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,a,d,{className:m,style:me(me({color:t.color||n.color},n.style),t.style),height:p,width:p,xmlns:"http://www.w3.org/2000/svg"}),f&&i.createElement("title",null,f),t.children)};return Be!==void 0?i.createElement(Be.Consumer,null,n=>o(n)):o(Ye)}function jt(t){return Ce({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:[]}]})(t)}const Ue=i.createContext(),St=({children:t})=>{const[o,n]=i.useState(!1),[a,u]=i.useState(),[f,d]=i.useState(),P={showAlert:o,setShowAlert:n,typeAlert:a,setTypeAlert:u,messageAlert:f,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:k=>{switch(k){case"danger":return s.jsx(pt,{className:"w-[20px] h-[20px]"});case"info":return s.jsx(gt,{className:"w-[20px] h-[20px]"});case"success":return s.jsx(jt,{className:"text-xl"});case"warning":return s.jsx(ht,{className:"w-[20px] h-[20px]"})}},closeAlert:()=>{n(!o)},activeAlert:(k,g)=>{n(!1),setTimeout(()=>{u(k),d(g),n(!0)},50)}};return s.jsx(Ue.Provider,{value:P,children:t})},Q=()=>{const t=i.useContext(Ue);if(t===void 0)throw new Error("Non puoi modificare l'alert");return t};let oe;const le=async(t,o,n)=>{if(oe)return oe;try{const u=await(await fetch("/config.json")).json(),f=u.baseUri,{unauthorized:d,notFound:p,defaultMessage:m}=u.axiosErrors,w=u.axiosTimeout;return oe=it.create({baseURL:f,timeout:w}),oe.interceptors.request.use(C=>C),oe.interceptors.response.use(C=>C,C=>{if(C.response)switch(t(!0),o("danger"),C.response.status){case 401:localStorage.removeItem("accessToken"),n(d);break;case 404:n(p);break;default:n(`${m} ${C.response.status} ${C.response.data.error}`)}return Promise.reject(C)}),oe}catch(a){console.error(a)}},qe=i.createContext(),Lt=({children:t})=>{const{heartbeatEndpoint:o,firstPrivatePath:n,infiniteSession:a,timeDeducted:u,authenticatedEndpoint:f,autoLogin:d,autoLoginEmail:p,autoLoginPassword:m,setCurrentDate:w}=U(),{setIsLoading:C}=ce(),{setShowAlert:P,setMessageAlert:k,setTypeAlert:g,activeAlert:b}=Q(),v=L.useNavigate(),[S,y]=i.useState(null),[h,R]=i.useState(),[j,_]=i.useState(),[D,ee]=i.useState(),[F,q]=i.useState(!1),H=async(T=null,M)=>{T&&T.preventDefault(),q(!0);try{C(!0),P(!1);const I=await(await le(P,g,k)).post(f,{auth:M}),z=I.data.id,te=I.headers.token;te&&(localStorage.setItem("accessToken",te),localStorage.setItem("id",z),y(!0),R(te),v(`${n}${z}`))}catch(Y){console.error(Y)}finally{q(!1),C(!1)}},W=()=>{localStorage.removeItem("accessToken"),localStorage.removeItem("id"),y(!1),R(null)},V=async()=>{try{const T=localStorage.getItem("accessToken"),I=(await(await le(P,g,k)).get(`${o}`,{headers:{Authorization:T}})).headers.token;localStorage.setItem("accessToken",I),R(I),console.log("nuovo token: ",I,"Data:",w())}catch(T){console.error(T),W()}},G=()=>{if(!h)return;const M=st(h).exp,Y=Math.floor(Date.now()/1e3),I=(M-Y)*1e3;ee(I),_(I-u)};i.useEffect(()=>{if(localStorage.getItem("accessToken"))y(!0);else{y(!1);return}},[]),i.useEffect(()=>{const T=localStorage.getItem("accessToken");d&&!T&&!F&&H(null,{email:p,password:m})},[d,F]),i.useEffect(()=>{G();let T;a&&h&&j&&(T=setInterval(()=>{V()},j));let M;return!a&&h&&D&&(M=setTimeout(()=>{W(),b("danger","Sessione scaduta")},D)),()=>{T&&clearInterval(T),M&&clearTimeout(M)}},[h,j]),i.useEffect(()=>{S||d&&!F&&H(null,{email:p,password:m})},[S]);const X={isAuthenticated:S,setIsAuthenticated:y,login:H,logout:W,setCurrentToken:R};return s.jsx(qe.Provider,{value:X,children:t})},pe=()=>{const t=i.useContext(qe);if(t===void 0)throw new Error("Non sei dentro al Auth Provider");return t},He=i.createContext(),Ot=({children:t,publicRoutes:o=[],privateRoutes:n=[]})=>s.jsx(He.Provider,{value:{publicRoutes:o,privateRoutes:n},children:t}),Ve=()=>{const t=i.useContext(He);if(t===void 0)throw new Error(`Errore: Le rotte non sono state inizializzate correttamente.
|
|
54
54
|
|
|
55
55
|
Soluzione: Assicurati di avvolgere il tuo componente con <RouteProvider>.
|
|
56
56
|
|
|
@@ -58,4 +58,4 @@ Esempio:
|
|
|
58
58
|
|
|
59
59
|
<RouteProvider publicRoutes={[]} privateRoutes={[]}>
|
|
60
60
|
<MyPackageRoutes />
|
|
61
|
-
</RouteProvider>`);return t},Xe=i.createContext(),Pt=({children:t})=>{const{login:o}=pe(),{clearLoginFormOnError:n}=U(),a={email:"",password:""},[u,f]=i.useState("Accedi"),[d,p]=i.useState("Email"),[m,w]=i.useState("email"),[C,P]=i.useState("example@example.it"),[k,h]=i.useState("Accedi"),[b,v]=i.useState(a),[S,y]=i.useState(),[g,R]=i.useState(),[j,_]=i.useState(),[D,ee]=i.useState(),[F,q]=i.useState({}),V={overrideStyle:F,setOverrideStyle:q,title:u,setTitle:f,label:d,setLabel:p,type:m,setType:w,placeholder:C,setPlaceholder:P,buttonText:k,setButtonText:h,formData:b,setFormData:v,LogoImg:S,setLogoImg:y,styleCardForm:g,setStyleCardForm:R,styleContainerLogo:j,setStyleContainerLogo:_,styleLogo:D,setStyleLogo:ee,changeData:(G,X)=>{v(T=>({...T,[G]:X}))},handleLogin:G=>{o(G,b),n&&v(a)}};return s.jsx(Xe.Provider,{value:V,children:t})},we=()=>{const t=i.useContext(Xe);if(t===void 0)throw new Error("Non puoi modificare La login");return t};function Je(t){return Ce({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:[]}]})(t)}const Ke=()=>{const{loadingProps:t}=ce(),{spinner:o=!0,spinnerStyle:n,text:a,textStyle:u,children:f,containerStyle:d,overrideStyle:p={}}=t;return s.jsxs("div",{className:p.container||`fixed top-0 bottom-0 left-0 right-0 flex items-center justify-center bg-loading-bg z-[999] ${d}`,children:[o&&s.jsx(Je,{className:p.spinner||`text-[20rem] relative animate-spin text-spinner ${n}`}),f||s.jsx("p",{className:p.text||`text-white text-2xl select-none absolute ${u}`,children:a||"Loading..."})]})};function kt(t){return Ce({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:[]}]})(t)}const be=()=>{const{messageAlert:t,typeAlert:o,alertConfig:n,getIcon:a,closeAlert:u}=Q(),{alertTimeout:f}=U(),[d,p]=i.useState(0),{bgColor:m,textColor:w,buttonBg:C,hoverBg:P,focusRing:k,progressColor:h}=n[o];return i.useEffect(()=>{let b;const S=100/(f/100);b=setInterval(()=>{p(g=>g>=100?(clearInterval(b),100):g+S)},100);const y=setTimeout(()=>{u()},f);return()=>{clearTimeout(y),clearInterval(b)}},[]),s.jsxs("div",{className:`flex items-center p-4 pt-6 ${w} 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:[s.jsx("div",{className:"w-full bg-gray-200 rounded-t-lg overflow-hidden h-2.5 absolute top-0 left-0 right-0",children:s.jsx("div",{className:`${h} h-2.5 rounded-t-lg`,style:{width:`${d}%`}})}),a(o),s.jsx("div",{className:"px-4 text-sm font-medium",children:t}),s.jsx("button",{type:"button",className:`ms-auto ${C} rounded-lg focus:ring-2 ${k} p-1.5 ${P} inline-flex items-center justify-center h-8 w-8 cursor-pointer`,title:"Close",onClick:u,children:s.jsx(kt,{className:"text-xl"})})]})},Qe=t=>{const{isLoading:o}=ce(),{showAlert:n}=Q(),a=L.useLocation(),{isMain:u=!0,headerComponent:f=null,showHeaderOnLogin:d=!1,headerExcludedRoutes:p=[],footerComponent:m=null,showFooterOnLogin:w=!1,footerExcludedRoutes:C=[]}=t,P=p.some(v=>L.matchPath(v,a.pathname));let k;a.pathname==="/"?k=f&&d:k=f&&!P;const h=C.some(v=>L.matchPath(v,a.pathname));let b;return a.pathname==="/"?b=m&&w:b=m&&!h,s.jsxs(s.Fragment,{children:[o&&s.jsx(Ke,{}),n&&s.jsx(be,{}),k&&f,u?s.jsxs("main",{className:o?"hidden":"",children:[n&&s.jsx(be,{}),s.jsx(L.Outlet,{})]}):s.jsx(L.Outlet,{}),b&&m]})},Ee=t=>{const{inputType:o,inputId:n,inputPlaceholder:a,inputRequired:u,inputValue:f,inputChange:d,autoFocus:p,inputStyle:m,overrideStyle:w}=t,P=["text","email","password","search","tel","url"].includes(o)?o:"text";return s.jsx("input",{type:P,autoFocus:p,id:n,className:w||`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 ${m}`,placeholder:a,required:u??!0,value:f,onChange:d})},ye=({label:t,labelId:o,labelStyle:n,overrideStyle:a})=>s.jsx("label",{htmlFor:o,className:a||`show-label mb-2 text-input-label font-medium text-color-label ${n}`,children:t}),et=()=>{const{title:t,label:o,type:n,placeholder:a,buttonText:u,formData:f,changeData:d,handleLogin:p,overrideStyle:m}=we();return s.jsxs("form",{onSubmit:p,className:m.form||"form-size",children:[s.jsx("h1",{className:m.title||"text-form-title-size show-title title-position m-form-title",children:t}),s.jsxs("div",{className:m.containerEmail||"flex justify-center flex-col gap-1 m-input-form input-size mx-auto",children:[s.jsx(ye,{labelId:"user-email",label:o}),s.jsx(Ee,{inputType:n,inputId:"user-email",inputPlaceholder:a,inputValue:f.email,inputChange:w=>{d("email",w.target.value)},autoFocus:!0})]}),s.jsxs("div",{className:m.containerPassword||"flex justify-center flex-col gap-1 my-4 input-size mx-auto",children:[s.jsx(ye,{labelId:"password",label:"Password"}),s.jsx(Ee,{inputType:"password",inputId:"password",inputPlaceholder:"Password",inputValue:f.password,inputChange:w=>{d("password",w.target.value)}})]}),s.jsx("div",{className:m.containerButton||"flex button-position items-center m-primary-button",children:s.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:u})})]})},tt=({Logo:t})=>{const{activeAlert:o}=Q(),{styleCardForm:n,styleContainerLogo:a,styleLogo:u,overrideStyle:f}=we(),{firstPrivatePath:d}=U(),p=L.useNavigate();return i.useEffect(()=>{const m=localStorage.getItem("id");localStorage.getItem("accessToken")&&m&&(p(`${d}${m}`),o("info","Sei già loggato"))},[]),s.jsx("section",{id:"login-page",children:s.jsx("div",{className:f.container||"container mx-auto flex items-center justify-center h-screen",children:s.jsxs("div",{className:f.cardForm||`bg-form card-style card-size flex flex-col sm:flex-row sm:items-center justify-center ${n}`,children:[s.jsx("div",{className:f.containerLogo||`basis-1/2 flex items-center justify-center ${a}`,children:t&&s.jsx(t,{className:f.logo||`login-logo h-full sm:h-auto ${u}`})}),s.jsx(et,{})]})})})},rt=()=>{const{isAuthenticated:t}=pe(),{activeAlert:o}=Q(),{autoLogin:n}=U();return i.useEffect(()=>{const a=localStorage.getItem("accessToken");!t&&!a&&!n&&o("danger","Non sei autorizzato")},[]),t===null?null:t?s.jsx(L.Outlet,{}):s.jsx(L.Navigate,{to:"/",replace:!0})},ot=()=>{const{id:t}=L.useParams(),{logout:o,setCurrentToken:n}=pe(),{usersEndpoint:a}=U(),{setIsLoading:u}=ce(),{setShowAlert:f,setTypeAlert:d,setMessageAlert:p,activeAlert:m}=Q(),[w,C]=i.useState({}),[P,k]=i.useState(null),[h,b]=i.useState(!1),v=async()=>{try{u(!0);const g=localStorage.getItem("accessToken");if(!g){o(),m("danger","Sessione Scaduta");return}n(g);const _=(await(await le(f,d,p)).get(`${a}${t}`,{headers:{Authorization:g}})).data;C(_)}catch(g){console.error(g),o()}finally{u(!1)}},S=async()=>{try{b(!0);const g=localStorage.getItem("accessToken");if(!g){o(),m("danger","Sessione Scaduta");return}const _=(await(await le(f,d,p)).get(`${a}`,{headers:{Authorization:g}})).data;k(_)}catch(g){console.error(g),u(!1)}finally{b(!1)}},y=()=>{o(),m("info","Hai effettuato il logout")};return i.useEffect(()=>{v()},[]),s.jsx("section",{children:s.jsxs("div",{className:"container mx-auto py-8",children:[s.jsxs("div",{className:"flex items-center justify-center gap-8 h-20",children:[s.jsxs("h1",{className:"text-4xl text-center text-slate-800",children:["Email: ",w.email]}),s.jsx("button",{onClick:y,className:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-full cursor-pointer shadow-[0_4px_10px_rgba(239,68,68,0.3),0_2px_4px_rgba(239,68,68,0.2)] hover:shadow-[0_6px_14px_rgba(185,28,28,0.4),0_3px_6px_rgba(185,28,28,0.3)] active:shadow-[0_2px_5px_rgba(239,68,68,0.3)] transition-all duration-200 active:translate-y-[2px]",children:"Logout"})]}),s.jsx("div",{className:"flex justify-center items-center my-12",children:s.jsx("button",{onClick:S,className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full disabled:bg-blue-300 disabled:text-gray-500 disabled:cursor-not-allowed cursor-pointer transition-all duration-200 active:translate-y-[2px] shadow-[0_4px_10px_rgba(59,130,246,0.3),0_2px_4px_rgba(59,130,246,0.2)] hover:shadow-[0_6px_14px_rgba(29,78,216,0.4),0_3px_6px_rgba(29,78,216,0.3)] active:shadow-[0_2px_5px_rgba(59,130,246,0.3)]",disabled:h,children:"Lista degli utenti"})}),s.jsx("div",{className:"flex justify-center items-center",children:P&&s.jsx("ul",{children:P.map(g=>s.jsxs("li",{className:"text-xl my-4",children:[g.id," - ",g.email]},`user-${g.id}`))})})]})})},Rt=t=>r.createElement("svg",{width:"108.41262mm",height:"108.41262mm",viewBox:"0 0 108.41262 108.41262",id:"svg1",xmlSpace:"preserve",xmlnsXlink:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/svg","xmlns:svg":"http://www.w3.org/2000/svg",...t},r.createElement("defs",{id:"defs1"},r.createElement("linearGradient",{id:"linearGradient27"},r.createElement("stop",{style:{stopColor:"#ff0000",stopOpacity:1},offset:0,id:"stop27"}),r.createElement("stop",{style:{stopColor:"#ffca00",stopOpacity:.96862745},offset:1,id:"stop28"})),r.createElement("linearGradient",{xlinkHref:"#linearGradient27",id:"linearGradient28",x1:35.001785,y1:192.35495,x2:143.4144,y2:83.942337,gradientUnits:"userSpaceOnUse"}),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter90",x:-.059506074,y:-.12477839,width:1.1465613,height:1.3073246},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:1,floodColor:"rgb(0,0,0)",id:"feFlood89"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:.9,id:"feGaussianBlur89"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:1,id:"feOffset89"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite89"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite90"})),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter147",x:-.31473854,y:-.27257434,width:1.6432813,height:1.5822092},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:.815686,floodColor:"rgb(255,255,255)",id:"feFlood146"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:9.5,id:"feGaussianBlur146"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:3.1,id:"feOffset146"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite146"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite147"})),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter385",x:0,y:0,width:1.0518825,height:1.0518825},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:.815686,floodColor:"rgb(105,0,0)",id:"feFlood384"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:0,id:"feGaussianBlur384"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:1,id:"feOffset384"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite384"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite385"})),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter387",x:0,y:0,width:1.0518825,height:1.0518825},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:.815686,floodColor:"rgb(105,0,0)",id:"feFlood385"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:0,id:"feGaussianBlur385"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:1,id:"feOffset385"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite386"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite387"})),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter389",x:0,y:0,width:1.0518825,height:1.0518825},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:.815686,floodColor:"rgb(105,0,0)",id:"feFlood387"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:0,id:"feGaussianBlur387"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:1,id:"feOffset387"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite388"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite389"})),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter391",x:0,y:0,width:1.0518825,height:1.0518825},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:.815686,floodColor:"rgb(105,0,0)",id:"feFlood389"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:0,id:"feGaussianBlur389"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:1,id:"feOffset389"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite390"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite391"})),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter393",x:0,y:0,width:1.0518825,height:1.0518825},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:.815686,floodColor:"rgb(105,0,0)",id:"feFlood391"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:0,id:"feGaussianBlur391"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:1,id:"feOffset391"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite392"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite393"})),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter395",x:0,y:0,width:1.0112203,height:1.010137},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:.815686,floodColor:"rgb(105,0,0)",id:"feFlood393"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:0,id:"feGaussianBlur393"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:1,id:"feOffset393"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite394"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite395"}))),r.createElement("g",{id:"layer1",transform:"translate(-35.001785,-83.942337)"},r.createElement("rect",{style:{fill:"url(#linearGradient28)",fillOpacity:1,fillRule:"evenodd",stroke:"#ff9b01",strokeWidth:0,strokeOpacity:1,paintOrder:"stroke markers fill"},id:"rect26",width:108.41262,height:108.41262,x:35.001785,y:83.942337,rx:30,ry:30}),r.createElement("g",{id:"g1",transform:"matrix(0.90701349,0,0,0.90701349,9.3696997,14.003172)",style:{strokeWidth:1.10252}},r.createElement("path",{id:"path272",style:{fill:"#000000",strokeWidth:1.10252},d:"m 103.62373,105.0137 c -0.2695,0.002 -0.78905,0.20889 -1.00345,0.40037 -0.0723,0.0646 -0.21317,0.24236 -0.313,0.39478 l -0.18141,0.27703 -0.0181,18.06409 -0.0178,18.06382 h -1.52343 -1.523699 l -2.7e-4,-9.75061 c -5.1e-4,-10.41143 -0.004,-10.51883 -0.34443,-11.94691 -1.39786,-5.8616 -6.2432,-10.12876 -12.21276,-10.75566 -1.515814,-0.1589 -19.83671,-0.16023 -20.462316,-0.003 l -0.0017,-0.004 -19.984159,3.5751 18.852043,2.16035 v 6.07801 l -17.36031,3.10307 17.360304,1.98933 v 6.52314 l -17.360304,3.10307 14.274817,1.63584 -0.01572,4.90514 -0.01864,5.72665 -0.63026,0.1252 c -1.586894,0.3153 -3.197032,1.06826 -4.528475,2.1172 -2.205268,1.73733 -3.741586,4.44584 -4.052716,7.1446 -0.370335,3.21237 0.552005,6.19841 2.657413,8.60144 1.687848,1.92642 4.173186,3.25989 6.695215,3.59241 v -5.2e-4 c 0.823968,0.10864 2.933749,0.0318 3.671522,-0.13399 0.932239,-0.20951 1.790163,-0.51486 2.636639,-0.93819 2.065707,-1.03314 3.823794,-2.77572 4.827084,-4.78447 0.504382,-1.00984 0.910162,-2.2066 1.026636,-3.02875 l 0.04632,-0.32925 h 9.414169 9.413628 v 0.21364 c 0,0.11749 0.0641,0.46829 0.14251,0.77944 0.90405,3.58952 3.50881,6.4605 6.974649,7.68694 1.34306,0.47527 1.94661,0.56832 3.65554,0.56367 1.31935,-0.003 1.6122,-0.0248 2.18192,-0.1577 3.36735,-0.785 6.02631,-2.86016 7.51461,-5.86464 0.44078,-0.88981 0.88236,-2.20383 0.97202,-2.8921 l 0.0429,-0.32925 7.18349,-0.002 c 7.08058,-0.002 7.18734,-0.003 7.49462,-0.14278 0.6474,-0.29351 0.90064,-0.70316 0.90064,-1.45738 0,-0.56862 -0.16856,-0.94445 -0.54982,-1.22508 -0.50606,-0.37245 -0.22593,-0.35988 -7.89979,-0.35988 h -7.11582 l -0.11721,-0.59669 c -0.2611,-1.32878 -0.84786,-2.70966 -1.68167,-3.95762 -0.57002,-0.85316 -2.01938,-2.29531 -2.86466,-2.85108 -1.21392,-0.79816 -2.80463,-1.46394 -3.99997,-1.6734 l -0.5016,-0.0876 -0.0181,-21.17061 -0.0178,-21.17036 -0.15424,-0.31167 c -0.25804,-0.52106 -0.8796,-0.9025 -1.46482,-0.8993 z m 9.34091,0.76079 c -1.96193,0 -3.68713,1.06774 -4.53247,2.80552 -0.53635,1.10262 -0.53017,1.02648 -0.50719,6.44296 l 0.0203,4.7802 0.18834,0.55566 c 0.62086,1.83041 2.22554,3.17608 4.08307,3.42406 0.24153,0.0323 2.71506,0.0532 5.4965,0.0458 5.70515,-0.0145 5.3423,0.0172 6.54658,-0.57378 0.54778,-0.26881 0.75708,-0.42234 1.25039,-0.91741 0.48917,-0.4909 0.64889,-0.70949 0.91635,-1.25279 0.53896,-1.09564 0.53516,-1.04438 0.53516,-6.26129 0,-4.84593 -0.0122,-5.0614 -0.32764,-5.86224 -0.76424,-1.94014 -2.6134,-3.18671 -4.72693,-3.18671 h -0.55701 l -0.003,4.13929 -0.003,4.13902 -1.87799,1.48961 c -1.03267,0.8192 -1.9166,1.51251 -1.96429,1.54074 -0.0554,0.0327 -0.79171,-0.51293 -2.03382,-1.50745 l -1.94697,-1.55885 v -4.12119 -4.12117 z m 2.28928,0.5522 v 3.46322 3.46375 l 1.08417,0.86973 c 0.59637,0.47836 1.10581,0.86085 1.13185,0.85003 0.0261,-0.0108 0.53535,-0.40918 1.13212,-0.88546 l 1.08497,-0.866 -0.0171,-3.42912 -0.0168,-3.42939 -2.19977,-0.0184 z m -47.246903,6.50849 9.196533,0.0248 c 9.138394,0.0246 9.200727,0.0256 9.88912,0.17528 2.276157,0.49507 4.008841,1.42496 5.576421,2.99252 1.56294,1.56292 2.49402,3.26009 3.00157,5.47254 0.15094,0.65777 0.15069,0.6637 0.16943,10.68613 l 0.0189,10.02763 -1.19632,-2.6e-4 -1.19658,-2.6e-4 -2.909674,-2.90889 c -2.148162,-2.14765 -2.999001,-2.95439 -3.251981,-3.08256 l -0.342815,-0.17367 h -9.477299 -9.477299 v -11.60676 z m 44.869453,16.35471 c -0.8458,0 -1.3552,0.0997 -1.97601,0.38599 -1.35181,0.62342 -2.29671,1.66611 -2.77169,3.05885 l -0.18354,0.53889 -0.0203,4.74531 c -0.0228,5.40031 -0.0234,5.39175 0.50346,6.47758 0.5061,1.04314 1.24312,1.77945 2.29621,2.29407 0.34744,0.1698 0.83013,0.35177 1.07325,0.40464 h 5.1e-4 c 0.35322,0.0766 1.47942,0.0968 5.60252,0.10015 5.81748,0.004 5.68307,0.0148 6.74876,-0.50692 1.37728,-0.67421 2.29905,-1.80091 2.67474,-3.26982 0.12915,-0.50539 0.13665,-0.78389 0.13665,-5.22267 0,-4.44771 -0.007,-4.7167 -0.13746,-5.23651 -0.23263,-0.92645 -0.63571,-1.63668 -1.31912,-2.32417 -0.51589,-0.519 -0.69084,-0.64491 -1.31831,-0.94858 -0.81757,-0.39568 -1.26328,-0.49681 -2.19099,-0.49681 h -0.64544 v 4.11159 4.11159 l -1.90888,1.51757 c -1.04987,0.83448 -1.93862,1.52747 -1.97495,1.54022 -0.0363,0.0129 -0.93815,-0.6732 -2.00425,-1.52423 l -1.93845,-1.54714 -2.7e-4,-4.10467 -5.1e-4,-4.10493 z m 2.37718,0.55434 0.004,3.44644 0.004,3.4467 1.05221,0.84416 h 5.1e-4 c 0.57884,0.46404 1.07893,0.84576 1.1116,0.84843 0.0327,0.003 0.55455,-0.39065 1.1601,-0.87373 l 1.10122,-0.87826 v -3.41687 -3.41687 h -2.21709 z m -50.294829,9.49115 h 10.511122 10.511121 l 3.015165,3.00185 c 2.567942,2.55652 3.057622,3.01393 3.300462,3.08282 0.2049,0.0582 1.62307,0.0807 5.03966,0.0807 h 4.754629 v 1.5799 1.57938 l -0.53676,0.0938 c -1.12048,0.19566 -2.647899,0.80928 -3.728799,1.49786 -1.68955,1.07633 -3.11899,2.69978 -3.99411,4.53647 -0.44366,0.93112 -0.88466,2.34132 -0.88466,2.82896 v 0.21524 H 83.533023 74.11886 l -0.04632,-0.32925 c -0.173141,-1.22207 -0.843416,-2.86149 -1.706703,-4.17392 -0.532033,-0.80881 -1.995609,-2.29178 -2.799129,-2.83643 -1.322594,-0.89646 -2.959014,-1.5737 -4.282866,-1.77223 l -0.324987,-0.0488 v -4.66833 z"}),r.createElement("path",{id:"path268",style:{fill:"#ffffff",strokeWidth:1.10252},d:"m 103.6238,103.56164 c -0.26951,0.002 -0.78905,0.20888 -1.00346,0.40036 -0.0723,0.0646 -0.21316,0.24236 -0.313,0.39478 l -0.1814,0.27703 -0.0181,18.06409 -0.0178,18.06382 h -1.52344 -1.523699 l -2.6e-4,-9.7506 c -5.1e-4,-10.41144 -0.004,-10.51884 -0.34443,-11.94692 -1.39786,-5.86159 -6.2432,-10.12876 -12.212765,-10.75566 -1.515813,-0.1589 -19.836715,-0.16022 -20.46231,-0.003 l -0.0017,-0.004 -19.984159,3.5751 18.852043,2.16035 v 6.07801 l -17.36031,3.10307 17.36031,1.98934 v 6.52313 l -17.36031,3.10307 14.274823,1.63584 -0.01572,4.90514 -0.01864,5.72666 -0.630261,0.12519 c -1.586888,0.3153 -3.19702,1.06826 -4.528463,2.1172 -2.205268,1.73733 -3.741592,4.44584 -4.052721,7.1446 -0.370335,3.21237 0.55201,6.19842 2.657412,8.60144 1.687849,1.92642 4.173187,3.25989 6.695216,3.59241 v -5.2e-4 c 0.823962,0.10864 2.933749,0.0318 3.671527,-0.13398 0.932233,-0.20952 1.790157,-0.51486 2.636639,-0.9382 2.065707,-1.03313 3.823794,-2.77572 4.82709,-4.78447 0.504371,-1.00983 0.910151,-2.2066 1.026624,-3.02874 l 0.04632,-0.32925 h 9.414164 9.413621 v 0.21363 c 0,0.11749 0.0641,0.46829 0.14252,0.77944 0.90405,3.58952 3.50882,6.4605 6.974649,7.68695 1.34307,0.47527 1.94662,0.56831 3.65555,0.56366 1.31934,-0.003 1.6122,-0.0248 2.18192,-0.1577 3.36734,-0.785 6.0263,-2.86016 7.51461,-5.86464 0.44078,-0.88981 0.88236,-2.20383 0.97202,-2.89209 l 0.0429,-0.32925 7.18349,-0.002 c 7.08058,-0.002 7.18734,-0.003 7.49463,-0.14278 0.6474,-0.29351 0.90063,-0.70316 0.90063,-1.45737 0,-0.56863 -0.16856,-0.94446 -0.54981,-1.22508 -0.50607,-0.37246 -0.22593,-0.35988 -7.89979,-0.35988 h -7.11583 l -0.11721,-0.5967 c -0.2611,-1.32878 -0.84786,-2.70966 -1.68166,-3.95762 -0.57003,-0.85315 -2.01939,-2.29531 -2.86466,-2.85107 -1.21393,-0.79817 -2.80464,-1.46395 -3.99997,-1.6734 l -0.50159,-0.0876 -0.0181,-21.17061 -0.0179,-21.17036 -0.15424,-0.31166 c -0.25804,-0.52107 -0.8796,-0.90251 -1.46482,-0.8993 z m 9.34091,0.76078 c -1.96194,0 -3.68714,1.06774 -4.53248,2.80552 -0.53635,1.10263 -0.53017,1.02648 -0.50719,6.44296 l 0.0203,4.7802 0.18834,0.55567 c 0.62086,1.8304 2.22555,3.17607 4.08308,3.42406 0.24152,0.0323 2.71505,0.0532 5.4965,0.0458 5.70514,-0.0145 5.34229,0.0172 6.54658,-0.57378 0.54778,-0.2688 0.75707,-0.42233 1.25039,-0.91741 0.48917,-0.4909 0.64889,-0.70948 0.91635,-1.25279 0.53896,-1.09564 0.53516,-1.04438 0.53516,-6.26128 0,-4.84594 -0.0122,-5.06141 -0.32765,-5.86225 -0.76423,-1.94014 -2.6134,-3.18671 -4.72692,-3.18671 h -0.55701 l -0.003,4.13929 -0.003,4.13902 -1.87798,1.48961 c -1.03268,0.8192 -1.9166,1.51252 -1.96429,1.54074 -0.0554,0.0327 -0.79171,-0.51293 -2.03382,-1.50745 l -1.94698,-1.55886 v -4.12117 -4.12118 z m 2.28927,0.55221 v 3.46321 3.46375 l 1.08417,0.86974 c 0.59637,0.47835 1.10582,0.86085 1.13185,0.85002 0.0261,-0.0108 0.53535,-0.40918 1.13213,-0.88545 l 1.08496,-0.86601 -0.0171,-3.42912 -0.0168,-3.42939 -2.19978,-0.0184 z m -47.246901,6.50848 9.196533,0.0248 c 9.138394,0.0247 9.200727,0.0256 9.889125,0.17528 2.276152,0.49507 4.008834,1.42496 5.576414,2.99253 1.56294,1.56292 2.49402,3.26009 3.00158,5.47253 0.15094,0.65777 0.15069,0.6637 0.16942,10.68613 l 0.0189,10.02764 -1.19632,-2.7e-4 -1.19658,-2.6e-4 -2.909672,-2.90888 c -2.148163,-2.14765 -2.999001,-2.9544 -3.251981,-3.08256 l -0.342835,-0.17368 H 77.484375 68.00707 v -11.60675 z m 44.869461,16.35472 c -0.84581,0 -1.35521,0.0997 -1.97602,0.38599 -1.35181,0.62342 -2.29671,1.6661 -2.77169,3.05885 l -0.18354,0.53888 -0.0203,4.74531 c -0.0229,5.40032 -0.0234,5.39175 0.50346,6.47758 0.50611,1.04314 1.24312,1.77945 2.29621,2.29408 0.34744,0.1698 0.83013,0.35177 1.07325,0.40463 h 5.1e-4 c 0.35322,0.0766 1.47942,0.0968 5.60252,0.10015 5.81748,0.005 5.68308,0.0148 6.74876,-0.50692 1.37729,-0.67421 2.29905,-1.8009 2.67474,-3.26982 0.12916,-0.50539 0.13665,-0.78389 0.13665,-5.22266 0,-4.44771 -0.007,-4.7167 -0.13745,-5.23652 -0.23264,-0.92645 -0.63572,-1.63668 -1.31912,-2.32417 -0.5159,-0.519 -0.69084,-0.64491 -1.31832,-0.94858 -0.81757,-0.39568 -1.26328,-0.4968 -2.19098,-0.4968 h -0.64545 v 4.11159 4.11159 l -1.90888,1.51756 c -1.04987,0.83448 -1.93862,1.52747 -1.97495,1.54022 -0.0363,0.0129 -0.93815,-0.6732 -2.00425,-1.52423 l -1.93845,-1.54714 -2.6e-4,-4.10466 -5.2e-4,-4.10493 z m 2.37718,0.55434 0.004,3.44643 0.004,3.4467 1.0522,0.84416 h 5.2e-4 c 0.57883,0.46405 1.07893,0.84577 1.1116,0.84843 0.0327,0.003 0.55454,-0.39065 1.16009,-0.87374 l 1.10122,-0.87825 v -3.41686 -3.41687 h -2.21709 z m -50.294837,9.49114 H 75.47001 85.981126 l 3.015165,3.00185 c 2.56794,2.55652 3.05762,3.01393 3.30046,3.08283 0.20491,0.0582 1.62308,0.0807 5.03966,0.0807 h 4.754639 v 1.5799 1.57938 l -0.53676,0.0938 c -1.12049,0.19566 -2.647909,0.80928 -3.728809,1.49786 -1.68955,1.07634 -3.11898,2.69979 -3.99411,4.53647 -0.44366,0.93112 -0.88465,2.34132 -0.88465,2.82897 v 0.21523 h -9.413636 -9.414164 l -0.04632,-0.32925 c -0.173136,-1.22207 -0.843417,-2.86149 -1.706697,-4.17392 -0.53204,-0.80881 -1.995616,-2.29178 -2.799129,-2.83642 -1.322601,-0.89647 -2.959015,-1.57371 -4.282873,-1.77224 l -0.324986,-0.0487 v -4.66833 z"})),r.createElement("path",{style:{fill:"#ffffff",fillOpacity:1,fillRule:"evenodd",stroke:"#ff9b01",strokeWidth:0,strokeOpacity:1,paintOrder:"stroke markers fill"},d:"",id:"path40",transform:"scale(0.26458333)"}))),Tt=t=>{const{publicRoutes:o,privateRoutes:n}=Ve(),{firstPrivatePath:a}=U(),{logoImg:u=Rt,pathImg:f="./src/assets/MyWarehouse.svg",firstPrivateElement:d=s.jsx(ot,{}),globalLayout:p,isMain:m,headerComponent:w,showHeaderOnLogin:C,headerExcludedRoutes:P,footerComponent:k,showFooterOnLogin:h,footerExcludedRoutes:b,privateProvider:v,customProvider:S}=t,y=p||s.jsx(Qe,{isMain:m,headerComponent:w,showHeaderOnLogin:C,headerExcludedRoutes:P,footerComponent:k,showFooterOnLogin:h,footerExcludedRoutes:b}),g=v?i.cloneElement(v,{},S):s.jsx(rt,{children:S}),R=()=>{const j=document.querySelector("link[rel='icon']");f&&(j.href=f)};return i.useEffect(()=>{R()},[]),s.jsx(L.Routes,{children:s.jsxs(L.Route,{element:p==="none"?null:y,children:[s.jsxs(L.Route,{path:"/",children:[s.jsx(L.Route,{index:!0,element:s.jsx(tt,{Logo:u})}),o.map((j,_)=>s.jsx(L.Route,{path:j.path,element:j.element},`public-${_}`))]}),s.jsxs(L.Route,{element:g,children:[s.jsx(L.Route,{path:`${a??"/dashboard/"}:id`,element:d}),n.map((j,_)=>s.jsx(L.Route,{path:j.path,element:j.element},`private-${_}`))]})]})})},_t=({spinner:t=!0,spinnerStyle:o,text:n,textStyle:a,children:u,containerStyle:f,overrideStyle:d={}})=>s.jsxs("div",{className:d.container||`w-full h-full relative flex items-center justify-center ${f}`,children:[t&&s.jsx(Je,{className:d.spinner||`text-[20rem] animate-spin text-black ${o}`}),u||s.jsx("p",{className:d.text||`text-black text-2xl select-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ${a}`,children:n||"Loading..."})]});Object.defineProperty(exports,"BrowserRouter",{enumerable:!0,get:()=>L.BrowserRouter});Object.defineProperty(exports,"Link",{enumerable:!0,get:()=>L.Link});Object.defineProperty(exports,"NavLink",{enumerable:!0,get:()=>L.NavLink});Object.defineProperty(exports,"Outlet",{enumerable:!0,get:()=>L.Outlet});Object.defineProperty(exports,"Route",{enumerable:!0,get:()=>L.Route});Object.defineProperty(exports,"Routes",{enumerable:!0,get:()=>L.Routes});Object.defineProperty(exports,"useLocation",{enumerable:!0,get:()=>L.useLocation});Object.defineProperty(exports,"useMatch",{enumerable:!0,get:()=>L.useMatch});exports.Alert=be;exports.AlertProvider=St;exports.AuthPage=rt;exports.AuthProvider=Lt;exports.ConfigProvider=mt;exports.Dashboard=ot;exports.DefaultLayout=Qe;exports.ErrorPage=Fe;exports.Input=Ee;exports.InputLabel=ye;exports.Loading=Ke;exports.LoadingComponent=_t;exports.LoadingProvider=dt;exports.Login=tt;exports.LoginForm=et;exports.LoginFormProvider=Pt;exports.PackageRoutes=Tt;exports.RouteProvider=Ot;exports.fetchAxiosConfig=le;exports.useAlert=Q;exports.useAuth=pe;exports.useConfig=U;exports.useLoading=ce;exports.useLoginForm=we;exports.useRoutesInjection=Ve;
|
|
61
|
+
</RouteProvider>`);return t},Xe=i.createContext(),Pt=({children:t})=>{const{login:o}=pe(),{clearLoginFormOnError:n}=U(),a={email:"",password:""},[u,f]=i.useState("Accedi"),[d,p]=i.useState("Email"),[m,w]=i.useState("email"),[C,P]=i.useState("example@example.it"),[k,g]=i.useState("Accedi"),[b,v]=i.useState(a),[S,y]=i.useState(),[h,R]=i.useState(),[j,_]=i.useState(),[D,ee]=i.useState(),[F,q]=i.useState({}),V={overrideStyle:F,setOverrideStyle:q,title:u,setTitle:f,label:d,setLabel:p,type:m,setType:w,placeholder:C,setPlaceholder:P,buttonText:k,setButtonText:g,formData:b,setFormData:v,LogoImg:S,setLogoImg:y,styleCardForm:h,setStyleCardForm:R,styleContainerLogo:j,setStyleContainerLogo:_,styleLogo:D,setStyleLogo:ee,changeData:(G,X)=>{v(T=>({...T,[G]:X}))},handleLogin:G=>{o(G,b),n&&v(a)}};return s.jsx(Xe.Provider,{value:V,children:t})},we=()=>{const t=i.useContext(Xe);if(t===void 0)throw new Error("Non puoi modificare La login");return t};function Je(t){return Ce({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:[]}]})(t)}const Ke=()=>{const{loadingProps:t}=ce(),{spinner:o=!0,spinnerStyle:n,text:a,textStyle:u,children:f,containerStyle:d,overrideStyle:p={}}=t;return s.jsxs("div",{className:p.container||`fixed top-0 bottom-0 left-0 right-0 flex items-center justify-center bg-loading-bg z-[999] ${d}`,children:[o&&s.jsx(Je,{className:p.spinner||`text-[20rem] relative animate-spin text-spinner ${n}`}),f||s.jsx("p",{className:p.text||`text-white text-2xl select-none absolute ${u}`,children:a||"Loading..."})]})};function kt(t){return Ce({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:[]}]})(t)}const be=()=>{const{messageAlert:t,typeAlert:o,alertConfig:n,getIcon:a,closeAlert:u}=Q(),{alertTimeout:f}=U(),[d,p]=i.useState(0),{bgColor:m,textColor:w,buttonBg:C,hoverBg:P,focusRing:k,progressColor:g}=n[o];return i.useEffect(()=>{let b;const S=100/(f/100);b=setInterval(()=>{p(h=>h>=100?(clearInterval(b),100):h+S)},100);const y=setTimeout(()=>{u()},f);return()=>{clearTimeout(y),clearInterval(b)}},[]),s.jsxs("div",{className:`flex items-center p-4 pt-6 ${w} 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:[s.jsx("div",{className:"w-full bg-gray-200 rounded-t-lg overflow-hidden h-2.5 absolute top-0 left-0 right-0",children:s.jsx("div",{className:`${g} h-2.5 rounded-t-lg`,style:{width:`${d}%`}})}),a(o),s.jsx("div",{className:"px-4 text-sm font-medium",children:t}),s.jsx("button",{type:"button",className:`ms-auto ${C} rounded-lg focus:ring-2 ${k} p-1.5 ${P} inline-flex items-center justify-center h-8 w-8 cursor-pointer`,title:"Close",onClick:u,children:s.jsx(kt,{className:"text-xl"})})]})},Qe=t=>{const{isLoading:o}=ce(),{showAlert:n}=Q(),a=L.useLocation(),{isMain:u=!0,headerComponent:f=null,showHeaderOnLogin:d=!1,headerExcludedRoutes:p=[],footerComponent:m=null,showFooterOnLogin:w=!1,footerExcludedRoutes:C=[]}=t,P=p.some(v=>L.matchPath(v,a.pathname));let k;a.pathname==="/"?k=f&&d:k=f&&!P;const g=C.some(v=>L.matchPath(v,a.pathname));let b;return a.pathname==="/"?b=m&&w:b=m&&!g,s.jsxs(s.Fragment,{children:[o&&s.jsx(Ke,{}),n&&s.jsx(be,{}),k&&f,u?s.jsxs("main",{className:o?"hidden":"",children:[n&&s.jsx(be,{}),s.jsx(L.Outlet,{})]}):s.jsx(L.Outlet,{}),b&&m]})},Ee=t=>{const{inputType:o,inputId:n,inputPlaceholder:a,inputRequired:u,inputValue:f,inputChange:d,autoFocus:p,inputStyle:m,overrideStyle:w}=t,P=["text","email","password","search","tel","url"].includes(o)?o:"text";return s.jsx("input",{type:P,autoFocus:p,id:n,className:w||`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 ${m}`,placeholder:a,required:u??!0,value:f,onChange:d})},ye=({label:t,labelId:o,labelStyle:n,overrideStyle:a})=>s.jsx("label",{htmlFor:o,className:a||`show-label mb-2 text-input-label font-medium text-color-label ${n}`,children:t}),et=()=>{const{title:t,label:o,type:n,placeholder:a,buttonText:u,formData:f,changeData:d,handleLogin:p,overrideStyle:m}=we();return s.jsxs("form",{onSubmit:p,className:m.form||"form-size",children:[s.jsx("h1",{className:m.title||"text-form-title-size show-title title-position m-form-title",children:t}),s.jsxs("div",{className:m.containerEmail||"flex justify-center flex-col gap-1 m-input-form input-size mx-auto",children:[s.jsx(ye,{labelId:"user-email",label:o}),s.jsx(Ee,{inputType:n,inputId:"user-email",inputPlaceholder:a,inputValue:f.email,inputChange:w=>{d("email",w.target.value)},autoFocus:!0})]}),s.jsxs("div",{className:m.containerPassword||"flex justify-center flex-col gap-1 my-4 input-size mx-auto",children:[s.jsx(ye,{labelId:"password",label:"Password"}),s.jsx(Ee,{inputType:"password",inputId:"password",inputPlaceholder:"Password",inputValue:f.password,inputChange:w=>{d("password",w.target.value)}})]}),s.jsx("div",{className:m.containerButton||"flex button-position items-center m-primary-button",children:s.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:u})})]})},tt=({Logo:t})=>{const{activeAlert:o}=Q(),{styleCardForm:n,styleContainerLogo:a,styleLogo:u,overrideStyle:f}=we(),{firstPrivatePath:d}=U(),p=L.useNavigate();return i.useEffect(()=>{const m=localStorage.getItem("id");localStorage.getItem("accessToken")&&m&&(p(`${d}${m}`),o("info","Sei già loggato"))},[]),s.jsx("section",{id:"login-page",children:s.jsx("div",{className:f.container||"container mx-auto flex items-center justify-center h-screen",children:s.jsxs("div",{className:f.cardForm||`bg-form card-style card-size flex flex-col sm:flex-row sm:items-center justify-center ${n}`,children:[s.jsx("div",{className:f.containerLogo||`basis-1/2 flex items-center justify-center ${a}`,children:t&&s.jsx(t,{className:f.logo||`login-logo h-full sm:h-auto ${u}`})}),s.jsx(et,{})]})})})},rt=()=>{const{isAuthenticated:t}=pe(),{activeAlert:o}=Q(),{autoLogin:n}=U();return i.useEffect(()=>{const a=localStorage.getItem("accessToken");!t&&!a&&!n&&o("danger","Non sei autorizzato")},[]),t===null?null:t?s.jsx(L.Outlet,{}):s.jsx(L.Navigate,{to:"/",replace:!0})},ot=()=>{const{id:t}=L.useParams(),{logout:o,setCurrentToken:n}=pe(),{usersEndpoint:a}=U(),{setIsLoading:u}=ce(),{setShowAlert:f,setTypeAlert:d,setMessageAlert:p,activeAlert:m}=Q(),[w,C]=i.useState({}),[P,k]=i.useState(null),[g,b]=i.useState(!1),v=async()=>{try{u(!0);const h=localStorage.getItem("accessToken");if(!h){o(),m("danger","Sessione Scaduta");return}n(h);const _=(await(await le(f,d,p)).get(`${a}${t}`,{headers:{Authorization:h}})).data;C(_)}catch(h){console.error(h),o()}finally{u(!1)}},S=async()=>{try{b(!0);const h=localStorage.getItem("accessToken");if(!h){o(),m("danger","Sessione Scaduta");return}const _=(await(await le(f,d,p)).get(`${a}`,{headers:{Authorization:h}})).data;k(_)}catch(h){console.error(h),u(!1)}finally{b(!1)}},y=()=>{o(),m("info","Hai effettuato il logout")};return i.useEffect(()=>{v()},[]),s.jsx("section",{children:s.jsxs("div",{className:"container mx-auto py-8",children:[s.jsxs("div",{className:"flex items-center justify-center gap-8 h-20",children:[s.jsxs("h1",{className:"text-4xl text-center text-slate-800",children:["Email: ",w.email]}),s.jsx("button",{onClick:y,className:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-full cursor-pointer shadow-[0_4px_10px_rgba(239,68,68,0.3),0_2px_4px_rgba(239,68,68,0.2)] hover:shadow-[0_6px_14px_rgba(185,28,28,0.4),0_3px_6px_rgba(185,28,28,0.3)] active:shadow-[0_2px_5px_rgba(239,68,68,0.3)] transition-all duration-200 active:translate-y-[2px]",children:"Logout"})]}),s.jsx("div",{className:"flex justify-center items-center my-12",children:s.jsx("button",{onClick:S,className:"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full disabled:bg-blue-300 disabled:text-gray-500 disabled:cursor-not-allowed cursor-pointer transition-all duration-200 active:translate-y-[2px] shadow-[0_4px_10px_rgba(59,130,246,0.3),0_2px_4px_rgba(59,130,246,0.2)] hover:shadow-[0_6px_14px_rgba(29,78,216,0.4),0_3px_6px_rgba(29,78,216,0.3)] active:shadow-[0_2px_5px_rgba(59,130,246,0.3)]",disabled:g,children:"Lista degli utenti"})}),s.jsx("div",{className:"flex justify-center items-center",children:P&&s.jsx("ul",{children:P.map(h=>s.jsxs("li",{className:"text-xl my-4",children:[h.id," - ",h.email]},`user-${h.id}`))})})]})})},Rt=t=>r.createElement("svg",{width:"108.41262mm",height:"108.41262mm",viewBox:"0 0 108.41262 108.41262",id:"svg1",xmlSpace:"preserve",xmlnsXlink:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/svg","xmlns:svg":"http://www.w3.org/2000/svg",...t},r.createElement("defs",{id:"defs1"},r.createElement("linearGradient",{id:"linearGradient27"},r.createElement("stop",{style:{stopColor:"#ff0000",stopOpacity:1},offset:0,id:"stop27"}),r.createElement("stop",{style:{stopColor:"#ffca00",stopOpacity:.96862745},offset:1,id:"stop28"})),r.createElement("linearGradient",{xlinkHref:"#linearGradient27",id:"linearGradient28",x1:35.001785,y1:192.35495,x2:143.4144,y2:83.942337,gradientUnits:"userSpaceOnUse"}),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter90",x:-.059506074,y:-.12477839,width:1.1465613,height:1.3073246},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:1,floodColor:"rgb(0,0,0)",id:"feFlood89"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:.9,id:"feGaussianBlur89"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:1,id:"feOffset89"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite89"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite90"})),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter147",x:-.31473854,y:-.27257434,width:1.6432813,height:1.5822092},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:.815686,floodColor:"rgb(255,255,255)",id:"feFlood146"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:9.5,id:"feGaussianBlur146"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:3.1,id:"feOffset146"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite146"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite147"})),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter385",x:0,y:0,width:1.0518825,height:1.0518825},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:.815686,floodColor:"rgb(105,0,0)",id:"feFlood384"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:0,id:"feGaussianBlur384"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:1,id:"feOffset384"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite384"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite385"})),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter387",x:0,y:0,width:1.0518825,height:1.0518825},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:.815686,floodColor:"rgb(105,0,0)",id:"feFlood385"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:0,id:"feGaussianBlur385"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:1,id:"feOffset385"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite386"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite387"})),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter389",x:0,y:0,width:1.0518825,height:1.0518825},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:.815686,floodColor:"rgb(105,0,0)",id:"feFlood387"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:0,id:"feGaussianBlur387"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:1,id:"feOffset387"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite388"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite389"})),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter391",x:0,y:0,width:1.0518825,height:1.0518825},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:.815686,floodColor:"rgb(105,0,0)",id:"feFlood389"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:0,id:"feGaussianBlur389"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:1,id:"feOffset389"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite390"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite391"})),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter393",x:0,y:0,width:1.0518825,height:1.0518825},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:.815686,floodColor:"rgb(105,0,0)",id:"feFlood391"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:0,id:"feGaussianBlur391"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:1,id:"feOffset391"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite392"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite393"})),r.createElement("filter",{style:{colorInterpolationFilters:"sRGB"},id:"filter395",x:0,y:0,width:1.0112203,height:1.010137},r.createElement("feFlood",{result:"flood",in:"SourceGraphic",floodOpacity:.815686,floodColor:"rgb(105,0,0)",id:"feFlood393"}),r.createElement("feGaussianBlur",{result:"blur",in:"SourceGraphic",stdDeviation:0,id:"feGaussianBlur393"}),r.createElement("feOffset",{result:"offset",in:"blur",dx:1,dy:1,id:"feOffset393"}),r.createElement("feComposite",{result:"comp1",operator:"in",in:"flood",in2:"offset",id:"feComposite394"}),r.createElement("feComposite",{result:"comp2",operator:"over",in:"SourceGraphic",in2:"comp1",id:"feComposite395"}))),r.createElement("g",{id:"layer1",transform:"translate(-35.001785,-83.942337)"},r.createElement("rect",{style:{fill:"url(#linearGradient28)",fillOpacity:1,fillRule:"evenodd",stroke:"#ff9b01",strokeWidth:0,strokeOpacity:1,paintOrder:"stroke markers fill"},id:"rect26",width:108.41262,height:108.41262,x:35.001785,y:83.942337,rx:30,ry:30}),r.createElement("g",{id:"g1",transform:"matrix(0.90701349,0,0,0.90701349,9.3696997,14.003172)",style:{strokeWidth:1.10252}},r.createElement("path",{id:"path272",style:{fill:"#000000",strokeWidth:1.10252},d:"m 103.62373,105.0137 c -0.2695,0.002 -0.78905,0.20889 -1.00345,0.40037 -0.0723,0.0646 -0.21317,0.24236 -0.313,0.39478 l -0.18141,0.27703 -0.0181,18.06409 -0.0178,18.06382 h -1.52343 -1.523699 l -2.7e-4,-9.75061 c -5.1e-4,-10.41143 -0.004,-10.51883 -0.34443,-11.94691 -1.39786,-5.8616 -6.2432,-10.12876 -12.21276,-10.75566 -1.515814,-0.1589 -19.83671,-0.16023 -20.462316,-0.003 l -0.0017,-0.004 -19.984159,3.5751 18.852043,2.16035 v 6.07801 l -17.36031,3.10307 17.360304,1.98933 v 6.52314 l -17.360304,3.10307 14.274817,1.63584 -0.01572,4.90514 -0.01864,5.72665 -0.63026,0.1252 c -1.586894,0.3153 -3.197032,1.06826 -4.528475,2.1172 -2.205268,1.73733 -3.741586,4.44584 -4.052716,7.1446 -0.370335,3.21237 0.552005,6.19841 2.657413,8.60144 1.687848,1.92642 4.173186,3.25989 6.695215,3.59241 v -5.2e-4 c 0.823968,0.10864 2.933749,0.0318 3.671522,-0.13399 0.932239,-0.20951 1.790163,-0.51486 2.636639,-0.93819 2.065707,-1.03314 3.823794,-2.77572 4.827084,-4.78447 0.504382,-1.00984 0.910162,-2.2066 1.026636,-3.02875 l 0.04632,-0.32925 h 9.414169 9.413628 v 0.21364 c 0,0.11749 0.0641,0.46829 0.14251,0.77944 0.90405,3.58952 3.50881,6.4605 6.974649,7.68694 1.34306,0.47527 1.94661,0.56832 3.65554,0.56367 1.31935,-0.003 1.6122,-0.0248 2.18192,-0.1577 3.36735,-0.785 6.02631,-2.86016 7.51461,-5.86464 0.44078,-0.88981 0.88236,-2.20383 0.97202,-2.8921 l 0.0429,-0.32925 7.18349,-0.002 c 7.08058,-0.002 7.18734,-0.003 7.49462,-0.14278 0.6474,-0.29351 0.90064,-0.70316 0.90064,-1.45738 0,-0.56862 -0.16856,-0.94445 -0.54982,-1.22508 -0.50606,-0.37245 -0.22593,-0.35988 -7.89979,-0.35988 h -7.11582 l -0.11721,-0.59669 c -0.2611,-1.32878 -0.84786,-2.70966 -1.68167,-3.95762 -0.57002,-0.85316 -2.01938,-2.29531 -2.86466,-2.85108 -1.21392,-0.79816 -2.80463,-1.46394 -3.99997,-1.6734 l -0.5016,-0.0876 -0.0181,-21.17061 -0.0178,-21.17036 -0.15424,-0.31167 c -0.25804,-0.52106 -0.8796,-0.9025 -1.46482,-0.8993 z m 9.34091,0.76079 c -1.96193,0 -3.68713,1.06774 -4.53247,2.80552 -0.53635,1.10262 -0.53017,1.02648 -0.50719,6.44296 l 0.0203,4.7802 0.18834,0.55566 c 0.62086,1.83041 2.22554,3.17608 4.08307,3.42406 0.24153,0.0323 2.71506,0.0532 5.4965,0.0458 5.70515,-0.0145 5.3423,0.0172 6.54658,-0.57378 0.54778,-0.26881 0.75708,-0.42234 1.25039,-0.91741 0.48917,-0.4909 0.64889,-0.70949 0.91635,-1.25279 0.53896,-1.09564 0.53516,-1.04438 0.53516,-6.26129 0,-4.84593 -0.0122,-5.0614 -0.32764,-5.86224 -0.76424,-1.94014 -2.6134,-3.18671 -4.72693,-3.18671 h -0.55701 l -0.003,4.13929 -0.003,4.13902 -1.87799,1.48961 c -1.03267,0.8192 -1.9166,1.51251 -1.96429,1.54074 -0.0554,0.0327 -0.79171,-0.51293 -2.03382,-1.50745 l -1.94697,-1.55885 v -4.12119 -4.12117 z m 2.28928,0.5522 v 3.46322 3.46375 l 1.08417,0.86973 c 0.59637,0.47836 1.10581,0.86085 1.13185,0.85003 0.0261,-0.0108 0.53535,-0.40918 1.13212,-0.88546 l 1.08497,-0.866 -0.0171,-3.42912 -0.0168,-3.42939 -2.19977,-0.0184 z m -47.246903,6.50849 9.196533,0.0248 c 9.138394,0.0246 9.200727,0.0256 9.88912,0.17528 2.276157,0.49507 4.008841,1.42496 5.576421,2.99252 1.56294,1.56292 2.49402,3.26009 3.00157,5.47254 0.15094,0.65777 0.15069,0.6637 0.16943,10.68613 l 0.0189,10.02763 -1.19632,-2.6e-4 -1.19658,-2.6e-4 -2.909674,-2.90889 c -2.148162,-2.14765 -2.999001,-2.95439 -3.251981,-3.08256 l -0.342815,-0.17367 h -9.477299 -9.477299 v -11.60676 z m 44.869453,16.35471 c -0.8458,0 -1.3552,0.0997 -1.97601,0.38599 -1.35181,0.62342 -2.29671,1.66611 -2.77169,3.05885 l -0.18354,0.53889 -0.0203,4.74531 c -0.0228,5.40031 -0.0234,5.39175 0.50346,6.47758 0.5061,1.04314 1.24312,1.77945 2.29621,2.29407 0.34744,0.1698 0.83013,0.35177 1.07325,0.40464 h 5.1e-4 c 0.35322,0.0766 1.47942,0.0968 5.60252,0.10015 5.81748,0.004 5.68307,0.0148 6.74876,-0.50692 1.37728,-0.67421 2.29905,-1.80091 2.67474,-3.26982 0.12915,-0.50539 0.13665,-0.78389 0.13665,-5.22267 0,-4.44771 -0.007,-4.7167 -0.13746,-5.23651 -0.23263,-0.92645 -0.63571,-1.63668 -1.31912,-2.32417 -0.51589,-0.519 -0.69084,-0.64491 -1.31831,-0.94858 -0.81757,-0.39568 -1.26328,-0.49681 -2.19099,-0.49681 h -0.64544 v 4.11159 4.11159 l -1.90888,1.51757 c -1.04987,0.83448 -1.93862,1.52747 -1.97495,1.54022 -0.0363,0.0129 -0.93815,-0.6732 -2.00425,-1.52423 l -1.93845,-1.54714 -2.7e-4,-4.10467 -5.1e-4,-4.10493 z m 2.37718,0.55434 0.004,3.44644 0.004,3.4467 1.05221,0.84416 h 5.1e-4 c 0.57884,0.46404 1.07893,0.84576 1.1116,0.84843 0.0327,0.003 0.55455,-0.39065 1.1601,-0.87373 l 1.10122,-0.87826 v -3.41687 -3.41687 h -2.21709 z m -50.294829,9.49115 h 10.511122 10.511121 l 3.015165,3.00185 c 2.567942,2.55652 3.057622,3.01393 3.300462,3.08282 0.2049,0.0582 1.62307,0.0807 5.03966,0.0807 h 4.754629 v 1.5799 1.57938 l -0.53676,0.0938 c -1.12048,0.19566 -2.647899,0.80928 -3.728799,1.49786 -1.68955,1.07633 -3.11899,2.69978 -3.99411,4.53647 -0.44366,0.93112 -0.88466,2.34132 -0.88466,2.82896 v 0.21524 H 83.533023 74.11886 l -0.04632,-0.32925 c -0.173141,-1.22207 -0.843416,-2.86149 -1.706703,-4.17392 -0.532033,-0.80881 -1.995609,-2.29178 -2.799129,-2.83643 -1.322594,-0.89646 -2.959014,-1.5737 -4.282866,-1.77223 l -0.324987,-0.0488 v -4.66833 z"}),r.createElement("path",{id:"path268",style:{fill:"#ffffff",strokeWidth:1.10252},d:"m 103.6238,103.56164 c -0.26951,0.002 -0.78905,0.20888 -1.00346,0.40036 -0.0723,0.0646 -0.21316,0.24236 -0.313,0.39478 l -0.1814,0.27703 -0.0181,18.06409 -0.0178,18.06382 h -1.52344 -1.523699 l -2.6e-4,-9.7506 c -5.1e-4,-10.41144 -0.004,-10.51884 -0.34443,-11.94692 -1.39786,-5.86159 -6.2432,-10.12876 -12.212765,-10.75566 -1.515813,-0.1589 -19.836715,-0.16022 -20.46231,-0.003 l -0.0017,-0.004 -19.984159,3.5751 18.852043,2.16035 v 6.07801 l -17.36031,3.10307 17.36031,1.98934 v 6.52313 l -17.36031,3.10307 14.274823,1.63584 -0.01572,4.90514 -0.01864,5.72666 -0.630261,0.12519 c -1.586888,0.3153 -3.19702,1.06826 -4.528463,2.1172 -2.205268,1.73733 -3.741592,4.44584 -4.052721,7.1446 -0.370335,3.21237 0.55201,6.19842 2.657412,8.60144 1.687849,1.92642 4.173187,3.25989 6.695216,3.59241 v -5.2e-4 c 0.823962,0.10864 2.933749,0.0318 3.671527,-0.13398 0.932233,-0.20952 1.790157,-0.51486 2.636639,-0.9382 2.065707,-1.03313 3.823794,-2.77572 4.82709,-4.78447 0.504371,-1.00983 0.910151,-2.2066 1.026624,-3.02874 l 0.04632,-0.32925 h 9.414164 9.413621 v 0.21363 c 0,0.11749 0.0641,0.46829 0.14252,0.77944 0.90405,3.58952 3.50882,6.4605 6.974649,7.68695 1.34307,0.47527 1.94662,0.56831 3.65555,0.56366 1.31934,-0.003 1.6122,-0.0248 2.18192,-0.1577 3.36734,-0.785 6.0263,-2.86016 7.51461,-5.86464 0.44078,-0.88981 0.88236,-2.20383 0.97202,-2.89209 l 0.0429,-0.32925 7.18349,-0.002 c 7.08058,-0.002 7.18734,-0.003 7.49463,-0.14278 0.6474,-0.29351 0.90063,-0.70316 0.90063,-1.45737 0,-0.56863 -0.16856,-0.94446 -0.54981,-1.22508 -0.50607,-0.37246 -0.22593,-0.35988 -7.89979,-0.35988 h -7.11583 l -0.11721,-0.5967 c -0.2611,-1.32878 -0.84786,-2.70966 -1.68166,-3.95762 -0.57003,-0.85315 -2.01939,-2.29531 -2.86466,-2.85107 -1.21393,-0.79817 -2.80464,-1.46395 -3.99997,-1.6734 l -0.50159,-0.0876 -0.0181,-21.17061 -0.0179,-21.17036 -0.15424,-0.31166 c -0.25804,-0.52107 -0.8796,-0.90251 -1.46482,-0.8993 z m 9.34091,0.76078 c -1.96194,0 -3.68714,1.06774 -4.53248,2.80552 -0.53635,1.10263 -0.53017,1.02648 -0.50719,6.44296 l 0.0203,4.7802 0.18834,0.55567 c 0.62086,1.8304 2.22555,3.17607 4.08308,3.42406 0.24152,0.0323 2.71505,0.0532 5.4965,0.0458 5.70514,-0.0145 5.34229,0.0172 6.54658,-0.57378 0.54778,-0.2688 0.75707,-0.42233 1.25039,-0.91741 0.48917,-0.4909 0.64889,-0.70948 0.91635,-1.25279 0.53896,-1.09564 0.53516,-1.04438 0.53516,-6.26128 0,-4.84594 -0.0122,-5.06141 -0.32765,-5.86225 -0.76423,-1.94014 -2.6134,-3.18671 -4.72692,-3.18671 h -0.55701 l -0.003,4.13929 -0.003,4.13902 -1.87798,1.48961 c -1.03268,0.8192 -1.9166,1.51252 -1.96429,1.54074 -0.0554,0.0327 -0.79171,-0.51293 -2.03382,-1.50745 l -1.94698,-1.55886 v -4.12117 -4.12118 z m 2.28927,0.55221 v 3.46321 3.46375 l 1.08417,0.86974 c 0.59637,0.47835 1.10582,0.86085 1.13185,0.85002 0.0261,-0.0108 0.53535,-0.40918 1.13213,-0.88545 l 1.08496,-0.86601 -0.0171,-3.42912 -0.0168,-3.42939 -2.19978,-0.0184 z m -47.246901,6.50848 9.196533,0.0248 c 9.138394,0.0247 9.200727,0.0256 9.889125,0.17528 2.276152,0.49507 4.008834,1.42496 5.576414,2.99253 1.56294,1.56292 2.49402,3.26009 3.00158,5.47253 0.15094,0.65777 0.15069,0.6637 0.16942,10.68613 l 0.0189,10.02764 -1.19632,-2.7e-4 -1.19658,-2.6e-4 -2.909672,-2.90888 c -2.148163,-2.14765 -2.999001,-2.9544 -3.251981,-3.08256 l -0.342835,-0.17368 H 77.484375 68.00707 v -11.60675 z m 44.869461,16.35472 c -0.84581,0 -1.35521,0.0997 -1.97602,0.38599 -1.35181,0.62342 -2.29671,1.6661 -2.77169,3.05885 l -0.18354,0.53888 -0.0203,4.74531 c -0.0229,5.40032 -0.0234,5.39175 0.50346,6.47758 0.50611,1.04314 1.24312,1.77945 2.29621,2.29408 0.34744,0.1698 0.83013,0.35177 1.07325,0.40463 h 5.1e-4 c 0.35322,0.0766 1.47942,0.0968 5.60252,0.10015 5.81748,0.005 5.68308,0.0148 6.74876,-0.50692 1.37729,-0.67421 2.29905,-1.8009 2.67474,-3.26982 0.12916,-0.50539 0.13665,-0.78389 0.13665,-5.22266 0,-4.44771 -0.007,-4.7167 -0.13745,-5.23652 -0.23264,-0.92645 -0.63572,-1.63668 -1.31912,-2.32417 -0.5159,-0.519 -0.69084,-0.64491 -1.31832,-0.94858 -0.81757,-0.39568 -1.26328,-0.4968 -2.19098,-0.4968 h -0.64545 v 4.11159 4.11159 l -1.90888,1.51756 c -1.04987,0.83448 -1.93862,1.52747 -1.97495,1.54022 -0.0363,0.0129 -0.93815,-0.6732 -2.00425,-1.52423 l -1.93845,-1.54714 -2.6e-4,-4.10466 -5.2e-4,-4.10493 z m 2.37718,0.55434 0.004,3.44643 0.004,3.4467 1.0522,0.84416 h 5.2e-4 c 0.57883,0.46405 1.07893,0.84577 1.1116,0.84843 0.0327,0.003 0.55454,-0.39065 1.16009,-0.87374 l 1.10122,-0.87825 v -3.41686 -3.41687 h -2.21709 z m -50.294837,9.49114 H 75.47001 85.981126 l 3.015165,3.00185 c 2.56794,2.55652 3.05762,3.01393 3.30046,3.08283 0.20491,0.0582 1.62308,0.0807 5.03966,0.0807 h 4.754639 v 1.5799 1.57938 l -0.53676,0.0938 c -1.12049,0.19566 -2.647909,0.80928 -3.728809,1.49786 -1.68955,1.07634 -3.11898,2.69979 -3.99411,4.53647 -0.44366,0.93112 -0.88465,2.34132 -0.88465,2.82897 v 0.21523 h -9.413636 -9.414164 l -0.04632,-0.32925 c -0.173136,-1.22207 -0.843417,-2.86149 -1.706697,-4.17392 -0.53204,-0.80881 -1.995616,-2.29178 -2.799129,-2.83642 -1.322601,-0.89647 -2.959015,-1.57371 -4.282873,-1.77224 l -0.324986,-0.0487 v -4.66833 z"})),r.createElement("path",{style:{fill:"#ffffff",fillOpacity:1,fillRule:"evenodd",stroke:"#ff9b01",strokeWidth:0,strokeOpacity:1,paintOrder:"stroke markers fill"},d:"",id:"path40",transform:"scale(0.26458333)"}))),Tt=t=>{const{publicRoutes:o,privateRoutes:n}=Ve(),{firstPrivatePath:a}=U(),{logoImg:u=Rt,pathImg:f="./src/assets/MyWarehouse.svg",firstPrivateElement:d=s.jsx(ot,{}),globalLayout:p,isMain:m,headerComponent:w,showHeaderOnLogin:C,headerExcludedRoutes:P,footerComponent:k,showFooterOnLogin:g,footerExcludedRoutes:b,privateProvider:v,customProvider:S}=t,y=p||s.jsx(Qe,{isMain:m,headerComponent:w,showHeaderOnLogin:C,headerExcludedRoutes:P,footerComponent:k,showFooterOnLogin:g,footerExcludedRoutes:b}),h=v?i.cloneElement(v,{},S):s.jsx(rt,{children:S}),R=()=>{const j=document.querySelector("link[rel='icon']");f&&(j.href=f)};return i.useEffect(()=>{R()},[]),s.jsx(L.Routes,{children:s.jsxs(L.Route,{element:p==="none"?null:y,children:[s.jsxs(L.Route,{path:"/",children:[s.jsx(L.Route,{index:!0,element:s.jsx(tt,{Logo:u})}),o.map((j,_)=>s.jsx(L.Route,{path:j.path,element:j.element},`public-${_}`))]}),s.jsxs(L.Route,{element:h,children:[s.jsx(L.Route,{path:`${a??"/dashboard/"}:id`,element:d}),n.map((j,_)=>s.jsx(L.Route,{path:j.path,element:j.element},`private-${_}`))]})]})})},_t=({spinner:t=!0,spinnerStyle:o,text:n,textStyle:a,children:u,containerStyle:f,overrideStyle:d={}})=>s.jsxs("div",{className:d.container||`w-full h-full relative flex items-center justify-center ${f}`,children:[t&&s.jsx(Je,{className:d.spinner||`text-[20rem] animate-spin text-black ${o}`}),u||s.jsx("p",{className:d.text||`text-black text-2xl select-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ${a}`,children:n||"Loading..."})]});Object.defineProperty(exports,"BrowserRouter",{enumerable:!0,get:()=>L.BrowserRouter});Object.defineProperty(exports,"Link",{enumerable:!0,get:()=>L.Link});Object.defineProperty(exports,"NavLink",{enumerable:!0,get:()=>L.NavLink});Object.defineProperty(exports,"Outlet",{enumerable:!0,get:()=>L.Outlet});Object.defineProperty(exports,"Route",{enumerable:!0,get:()=>L.Route});Object.defineProperty(exports,"Routes",{enumerable:!0,get:()=>L.Routes});Object.defineProperty(exports,"useLocation",{enumerable:!0,get:()=>L.useLocation});Object.defineProperty(exports,"useMatch",{enumerable:!0,get:()=>L.useMatch});exports.Alert=be;exports.AlertProvider=St;exports.AuthPage=rt;exports.AuthProvider=Lt;exports.ConfigProvider=mt;exports.Dashboard=ot;exports.DefaultLayout=Qe;exports.ErrorPage=Fe;exports.Input=Ee;exports.InputLabel=ye;exports.Loading=Ke;exports.LoadingComponent=_t;exports.LoadingProvider=dt;exports.Login=tt;exports.LoginForm=et;exports.LoginFormProvider=Pt;exports.PackageRoutes=Tt;exports.RouteProvider=Ot;exports.fetchAxiosConfig=le;exports.useAlert=Q;exports.useAuth=pe;exports.useConfig=U;exports.useLoading=ce;exports.useLoginForm=we;exports.useRoutesInjection=Ve;
|
package/dist/thecore-auth.esm.js
CHANGED
|
@@ -319,7 +319,7 @@ function dt() {
|
|
|
319
319
|
"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."
|
|
320
320
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function p(e, i, l, E, _, S) {
|
|
323
323
|
return l = S.ref, e = {
|
|
324
324
|
$$typeof: w,
|
|
325
325
|
type: e,
|
|
@@ -387,7 +387,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
387
387
|
return h && O(
|
|
388
388
|
l,
|
|
389
389
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
390
|
-
),
|
|
390
|
+
), p(e, h, S, _, C(), l);
|
|
391
391
|
}
|
|
392
392
|
function x(e, i) {
|
|
393
393
|
if (typeof e == "object" && e && e.$$typeof !== nt) {
|
|
@@ -407,7 +407,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
407
407
|
return typeof e == "object" && e !== null && e.$$typeof === w;
|
|
408
408
|
}
|
|
409
409
|
function b(e, i) {
|
|
410
|
-
if (e._store && !e._store.validated && e.key == null && (e._store.validated = 1, i =
|
|
410
|
+
if (e._store && !e._store.validated && e.key == null && (e._store.validated = 1, i = g(i), !Ie[i])) {
|
|
411
411
|
Ie[i] = !0;
|
|
412
412
|
var l = "";
|
|
413
413
|
e && e._owner != null && e._owner !== C() && (l = null, typeof e._owner.tag == "number" ? l = t(e._owner.type) : typeof e._owner.name == "string" && (l = e._owner.name), l = " It was passed a child from " + l + ".");
|
|
@@ -422,7 +422,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
422
422
|
), I.getCurrentStack = E;
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
|
-
function
|
|
425
|
+
function g(e) {
|
|
426
426
|
var i = "", l = C();
|
|
427
427
|
return l && (l = t(l.type)) && (i = `
|
|
428
428
|
|
|
@@ -479,42 +479,42 @@ Esempio di config.json:
|
|
|
479
479
|
"autoLoginEmail": ,
|
|
480
480
|
"autoLoginPassword":
|
|
481
481
|
}`, f = () => {
|
|
482
|
-
const
|
|
483
|
-
return `${v}/${x}/${L} ${b}:${
|
|
484
|
-
}, m = (
|
|
482
|
+
const p = /* @__PURE__ */ new Date(), v = String(p.getDate()).padStart(2, "0"), x = String(p.getMonth() + 1).padStart(2, "0"), L = p.getFullYear(), b = String(p.getHours()).padStart(2, "0"), g = String(p.getMinutes()).padStart(2, "0"), k = String(p.getSeconds()).padStart(2, "0");
|
|
483
|
+
return `${v}/${x}/${L} ${b}:${g}:${k}`;
|
|
484
|
+
}, m = (p) => new Promise((v, x) => {
|
|
485
485
|
const L = indexedDB.open("configDatabase", 1);
|
|
486
486
|
L.onupgradeneeded = (b) => {
|
|
487
|
-
const
|
|
488
|
-
|
|
487
|
+
const g = b.target.result;
|
|
488
|
+
g.objectStoreNames.contains(p) || g.createObjectStore(p, { keyPath: "id" });
|
|
489
489
|
}, L.onsuccess = (b) => v(b.target.result), L.onerror = (b) => x(b.target.error);
|
|
490
|
-
}), d = async (
|
|
491
|
-
let x = await m();
|
|
490
|
+
}), d = async (p, v) => {
|
|
491
|
+
let x = await m(p);
|
|
492
492
|
return new Promise((L, b) => {
|
|
493
493
|
if (!x) {
|
|
494
494
|
b("Errore: DB non disponibile");
|
|
495
495
|
return;
|
|
496
496
|
}
|
|
497
|
-
const
|
|
497
|
+
const g = x == null ? void 0 : x.transaction(p, "readonly"), k = g == null ? void 0 : g.objectStore(p), w = k == null ? void 0 : k.get(v);
|
|
498
498
|
w.onsuccess = () => L(w.result), w.onerror = (T) => b(T.target.error);
|
|
499
499
|
});
|
|
500
|
-
}, C = async (
|
|
501
|
-
let x = await m();
|
|
500
|
+
}, C = async (p, v) => {
|
|
501
|
+
let x = await m(p);
|
|
502
502
|
return new Promise((L, b) => {
|
|
503
503
|
if (!x) {
|
|
504
504
|
b("Errore: DB non disponibile");
|
|
505
505
|
return;
|
|
506
506
|
}
|
|
507
|
-
const
|
|
507
|
+
const g = x == null ? void 0 : x.transaction(p, "readwrite"), k = g == null ? void 0 : g.objectStore(p), w = k == null ? void 0 : k.put(v);
|
|
508
508
|
w.onsuccess = () => L(w.result), w.onerror = (T) => b(T.target.error);
|
|
509
509
|
});
|
|
510
|
-
}, y = async (
|
|
510
|
+
}, y = async (p) => {
|
|
511
511
|
let v = Date.now(), x;
|
|
512
512
|
do
|
|
513
|
-
x = await d(
|
|
513
|
+
x = await d(p, v), x && v++;
|
|
514
514
|
while (x);
|
|
515
515
|
return v;
|
|
516
|
-
}, O = async (
|
|
517
|
-
v.id || (v.id = await y(
|
|
516
|
+
}, O = async (p, v) => {
|
|
517
|
+
v.id || (v.id = await y(p)), await C(p, v);
|
|
518
518
|
}, P = async () => {
|
|
519
519
|
try {
|
|
520
520
|
const x = {
|
|
@@ -527,8 +527,8 @@ Esempio di config.json:
|
|
|
527
527
|
setCurrentDate: f
|
|
528
528
|
};
|
|
529
529
|
n(x);
|
|
530
|
-
} catch (
|
|
531
|
-
console.error(
|
|
530
|
+
} catch (p) {
|
|
531
|
+
console.error(p), c(!0);
|
|
532
532
|
}
|
|
533
533
|
};
|
|
534
534
|
return z(() => {
|
|
@@ -707,9 +707,9 @@ const Je = ae(), Ft = ({ children: t }) => {
|
|
|
707
707
|
closeAlert: () => {
|
|
708
708
|
n(!o);
|
|
709
709
|
},
|
|
710
|
-
activeAlert: (P,
|
|
710
|
+
activeAlert: (P, p) => {
|
|
711
711
|
n(!1), setTimeout(() => {
|
|
712
|
-
c(P), f(
|
|
712
|
+
c(P), f(p), n(!0);
|
|
713
713
|
}, 50);
|
|
714
714
|
}
|
|
715
715
|
};
|
|
@@ -750,11 +750,11 @@ const he = async (t, o, n) => {
|
|
|
750
750
|
console.error(s);
|
|
751
751
|
}
|
|
752
752
|
}, Ke = ae(), Dt = ({ children: t }) => {
|
|
753
|
-
const { heartbeatEndpoint: o, firstPrivatePath: n, infiniteSession: s, timeDeducted: c, authenticatedEndpoint: u, autoLogin: f, autoLoginEmail: m, autoLoginPassword: d, setCurrentDate: C } = ee(), { setIsLoading: y } = xe(), { setShowAlert: O, setMessageAlert: P, setTypeAlert:
|
|
753
|
+
const { heartbeatEndpoint: o, firstPrivatePath: n, infiniteSession: s, timeDeducted: c, authenticatedEndpoint: u, autoLogin: f, autoLoginEmail: m, autoLoginPassword: d, setCurrentDate: C } = ee(), { setIsLoading: y } = xe(), { setShowAlert: O, setMessageAlert: P, setTypeAlert: p, activeAlert: v } = ie(), x = Ue(), [L, b] = j(null), [g, k] = j(), [w, T] = j(), [D, te] = j(), [W, q] = j(!1), H = async (R = null, A) => {
|
|
754
754
|
R && R.preventDefault(), q(!0);
|
|
755
755
|
try {
|
|
756
756
|
y(!0), O(!1);
|
|
757
|
-
const M = await (await he(O,
|
|
757
|
+
const M = await (await he(O, p, P)).post(u, {
|
|
758
758
|
auth: A
|
|
759
759
|
}), I = M.data.id, re = M.headers.token;
|
|
760
760
|
re && (localStorage.setItem("accessToken", re), localStorage.setItem("id", I), b(!0), k(re), x(`${n}${I}`));
|
|
@@ -767,7 +767,7 @@ const he = async (t, o, n) => {
|
|
|
767
767
|
localStorage.removeItem("accessToken"), localStorage.removeItem("id"), b(!1), k(null);
|
|
768
768
|
}, V = async () => {
|
|
769
769
|
try {
|
|
770
|
-
const R = localStorage.getItem("accessToken"), M = (await (await he(O,
|
|
770
|
+
const R = localStorage.getItem("accessToken"), M = (await (await he(O, p, P)).get(
|
|
771
771
|
`${o}`,
|
|
772
772
|
{ headers: {
|
|
773
773
|
Authorization: R
|
|
@@ -778,9 +778,9 @@ const he = async (t, o, n) => {
|
|
|
778
778
|
console.error(R), Y();
|
|
779
779
|
}
|
|
780
780
|
}, G = () => {
|
|
781
|
-
if (!
|
|
781
|
+
if (!g)
|
|
782
782
|
return;
|
|
783
|
-
const A = at(
|
|
783
|
+
const A = at(g).exp, Z = Math.floor(Date.now() / 1e3), M = (A - Z) * 1e3;
|
|
784
784
|
te(M), T(M - c);
|
|
785
785
|
};
|
|
786
786
|
z(() => {
|
|
@@ -799,16 +799,16 @@ const he = async (t, o, n) => {
|
|
|
799
799
|
}, [f, W]), z(() => {
|
|
800
800
|
G();
|
|
801
801
|
let R;
|
|
802
|
-
s &&
|
|
802
|
+
s && g && w && (R = setInterval(() => {
|
|
803
803
|
V();
|
|
804
804
|
}, w));
|
|
805
805
|
let A;
|
|
806
|
-
return !s &&
|
|
806
|
+
return !s && g && D && (A = setTimeout(() => {
|
|
807
807
|
Y(), v("danger", "Sessione scaduta");
|
|
808
808
|
}, D)), () => {
|
|
809
809
|
R && clearInterval(R), A && clearTimeout(A);
|
|
810
810
|
};
|
|
811
|
-
}, [
|
|
811
|
+
}, [g, w]), z(() => {
|
|
812
812
|
L || f && !W && H(null, {
|
|
813
813
|
email: m,
|
|
814
814
|
password: d
|
|
@@ -845,7 +845,7 @@ Esempio:
|
|
|
845
845
|
const { login: o } = je(), { clearLoginFormOnError: n } = ee(), s = {
|
|
846
846
|
email: "",
|
|
847
847
|
password: ""
|
|
848
|
-
}, [c, u] = j("Accedi"), [f, m] = j("Email"), [d, C] = j("email"), [y, O] = j("example@example.it"), [P,
|
|
848
|
+
}, [c, u] = j("Accedi"), [f, m] = j("Email"), [d, C] = j("email"), [y, O] = j("example@example.it"), [P, p] = j("Accedi"), [v, x] = j(s), [L, b] = j(), [g, k] = j(), [w, T] = j(), [D, te] = j(), [W, q] = j({}), V = {
|
|
849
849
|
overrideStyle: W,
|
|
850
850
|
setOverrideStyle: q,
|
|
851
851
|
title: c,
|
|
@@ -857,12 +857,12 @@ Esempio:
|
|
|
857
857
|
placeholder: y,
|
|
858
858
|
setPlaceholder: O,
|
|
859
859
|
buttonText: P,
|
|
860
|
-
setButtonText:
|
|
860
|
+
setButtonText: p,
|
|
861
861
|
formData: v,
|
|
862
862
|
setFormData: x,
|
|
863
863
|
LogoImg: L,
|
|
864
864
|
setLogoImg: b,
|
|
865
|
-
styleCardForm:
|
|
865
|
+
styleCardForm: g,
|
|
866
866
|
setStyleCardForm: k,
|
|
867
867
|
styleContainerLogo: w,
|
|
868
868
|
setStyleContainerLogo: T,
|
|
@@ -895,12 +895,12 @@ function Pt(t) {
|
|
|
895
895
|
return we({ 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: [] }] })(t);
|
|
896
896
|
}
|
|
897
897
|
const We = () => {
|
|
898
|
-
const { messageAlert: t, typeAlert: o, alertConfig: n, getIcon: s, closeAlert: c } = ie(), { alertTimeout: u } = ee(), [f, m] = j(0), { bgColor: d, textColor: C, buttonBg: y, hoverBg: O, focusRing: P, progressColor:
|
|
898
|
+
const { messageAlert: t, typeAlert: o, alertConfig: n, getIcon: s, closeAlert: c } = ie(), { alertTimeout: u } = ee(), [f, m] = j(0), { bgColor: d, textColor: C, buttonBg: y, hoverBg: O, focusRing: P, progressColor: p } = n[o];
|
|
899
899
|
return z(() => {
|
|
900
900
|
let v;
|
|
901
901
|
const L = 100 / (u / 100);
|
|
902
902
|
v = setInterval(() => {
|
|
903
|
-
m((
|
|
903
|
+
m((g) => g >= 100 ? (clearInterval(v), 100) : g + L);
|
|
904
904
|
}, 100);
|
|
905
905
|
const b = setTimeout(() => {
|
|
906
906
|
c();
|
|
@@ -909,7 +909,7 @@ const We = () => {
|
|
|
909
909
|
clearTimeout(b), clearInterval(v);
|
|
910
910
|
};
|
|
911
911
|
}, []), /* @__PURE__ */ a.jsxs("div", { className: `flex items-center p-4 pt-6 ${C} rounded-lg ${d} 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: [
|
|
912
|
-
/* @__PURE__ */ a.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__ */ a.jsx("div", { className: `${
|
|
912
|
+
/* @__PURE__ */ a.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__ */ a.jsx("div", { className: `${p} h-2.5 rounded-t-lg`, style: { width: `${f}%` } }) }),
|
|
913
913
|
s(o),
|
|
914
914
|
/* @__PURE__ */ a.jsx("div", { className: "px-4 text-sm font-medium", children: t }),
|
|
915
915
|
/* @__PURE__ */ a.jsx(
|
|
@@ -935,9 +935,9 @@ const We = () => {
|
|
|
935
935
|
} = t, O = m.some((x) => ze(x, s.pathname));
|
|
936
936
|
let P;
|
|
937
937
|
s.pathname === "/" ? P = u && f : P = u && !O;
|
|
938
|
-
const
|
|
938
|
+
const p = y.some((x) => ze(x, s.pathname));
|
|
939
939
|
let v;
|
|
940
|
-
return s.pathname === "/" ? v = d && C : v = d && !
|
|
940
|
+
return s.pathname === "/" ? v = d && C : v = d && !p, /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
941
941
|
o && /* @__PURE__ */ a.jsx(Ot, {}),
|
|
942
942
|
n && /* @__PURE__ */ a.jsx(We, {}),
|
|
943
943
|
P && u,
|
|
@@ -1025,44 +1025,44 @@ const We = () => {
|
|
|
1025
1025
|
!t && !s && !n && o("danger", "Non sei autorizzato");
|
|
1026
1026
|
}, []), t === null ? null : t ? /* @__PURE__ */ a.jsx(Ce, {}) : /* @__PURE__ */ a.jsx(it, { to: "/", replace: !0 });
|
|
1027
1027
|
}, Nt = () => {
|
|
1028
|
-
const { id: t } = lt(), { logout: o, setCurrentToken: n } = je(), { usersEndpoint: s } = ee(), { setIsLoading: c } = xe(), { setShowAlert: u, setTypeAlert: f, setMessageAlert: m, activeAlert: d } = ie(), [C, y] = j({}), [O, P] = j(null), [
|
|
1028
|
+
const { id: t } = lt(), { logout: o, setCurrentToken: n } = je(), { usersEndpoint: s } = ee(), { setIsLoading: c } = xe(), { setShowAlert: u, setTypeAlert: f, setMessageAlert: m, activeAlert: d } = ie(), [C, y] = j({}), [O, P] = j(null), [p, v] = j(!1), x = async () => {
|
|
1029
1029
|
try {
|
|
1030
1030
|
c(!0);
|
|
1031
|
-
const
|
|
1032
|
-
if (!
|
|
1031
|
+
const g = localStorage.getItem("accessToken");
|
|
1032
|
+
if (!g) {
|
|
1033
1033
|
o(), d("danger", "Sessione Scaduta");
|
|
1034
1034
|
return;
|
|
1035
1035
|
}
|
|
1036
|
-
n(
|
|
1036
|
+
n(g);
|
|
1037
1037
|
const T = (await (await he(u, f, m)).get(
|
|
1038
1038
|
`${s}${t}`,
|
|
1039
1039
|
{ headers: {
|
|
1040
|
-
Authorization:
|
|
1040
|
+
Authorization: g
|
|
1041
1041
|
} }
|
|
1042
1042
|
)).data;
|
|
1043
1043
|
y(T);
|
|
1044
|
-
} catch (
|
|
1045
|
-
console.error(
|
|
1044
|
+
} catch (g) {
|
|
1045
|
+
console.error(g), o();
|
|
1046
1046
|
} finally {
|
|
1047
1047
|
c(!1);
|
|
1048
1048
|
}
|
|
1049
1049
|
}, L = async () => {
|
|
1050
1050
|
try {
|
|
1051
1051
|
v(!0);
|
|
1052
|
-
const
|
|
1053
|
-
if (!
|
|
1052
|
+
const g = localStorage.getItem("accessToken");
|
|
1053
|
+
if (!g) {
|
|
1054
1054
|
o(), d("danger", "Sessione Scaduta");
|
|
1055
1055
|
return;
|
|
1056
1056
|
}
|
|
1057
1057
|
const T = (await (await he(u, f, m)).get(
|
|
1058
1058
|
`${s}`,
|
|
1059
1059
|
{ headers: {
|
|
1060
|
-
Authorization:
|
|
1060
|
+
Authorization: g
|
|
1061
1061
|
} }
|
|
1062
1062
|
)).data;
|
|
1063
1063
|
P(T);
|
|
1064
|
-
} catch (
|
|
1065
|
-
console.error(
|
|
1064
|
+
} catch (g) {
|
|
1065
|
+
console.error(g), c(!1);
|
|
1066
1066
|
} finally {
|
|
1067
1067
|
v(!1);
|
|
1068
1068
|
}
|
|
@@ -1091,15 +1091,15 @@ const We = () => {
|
|
|
1091
1091
|
{
|
|
1092
1092
|
onClick: L,
|
|
1093
1093
|
className: "bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full disabled:bg-blue-300 disabled:text-gray-500 disabled:cursor-not-allowed cursor-pointer transition-all duration-200 active:translate-y-[2px] shadow-[0_4px_10px_rgba(59,130,246,0.3),0_2px_4px_rgba(59,130,246,0.2)] hover:shadow-[0_6px_14px_rgba(29,78,216,0.4),0_3px_6px_rgba(29,78,216,0.3)] active:shadow-[0_2px_5px_rgba(59,130,246,0.3)]",
|
|
1094
|
-
disabled:
|
|
1094
|
+
disabled: p,
|
|
1095
1095
|
children: "Lista degli utenti"
|
|
1096
1096
|
}
|
|
1097
1097
|
) }),
|
|
1098
|
-
/* @__PURE__ */ a.jsx("div", { className: "flex justify-center items-center", children: O && /* @__PURE__ */ a.jsx("ul", { children: O.map((
|
|
1099
|
-
|
|
1098
|
+
/* @__PURE__ */ a.jsx("div", { className: "flex justify-center items-center", children: O && /* @__PURE__ */ a.jsx("ul", { children: O.map((g) => /* @__PURE__ */ a.jsxs("li", { className: "text-xl my-4", children: [
|
|
1099
|
+
g.id,
|
|
1100
1100
|
" - ",
|
|
1101
|
-
|
|
1102
|
-
] }, `user-${
|
|
1101
|
+
g.email
|
|
1102
|
+
] }, `user-${g.id}`)) }) })
|
|
1103
1103
|
] }) });
|
|
1104
1104
|
}, At = (t) => /* @__PURE__ */ r.createElement("svg", { width: "108.41262mm", height: "108.41262mm", viewBox: "0 0 108.41262 108.41262", id: "svg1", xmlSpace: "preserve", xmlnsXlink: "http://www.w3.org/1999/xlink", xmlns: "http://www.w3.org/2000/svg", "xmlns:svg": "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ r.createElement("defs", { id: "defs1" }, /* @__PURE__ */ r.createElement("linearGradient", { id: "linearGradient27" }, /* @__PURE__ */ r.createElement("stop", { style: {
|
|
1105
1105
|
stopColor: "#ff0000",
|
|
@@ -1158,7 +1158,7 @@ const We = () => {
|
|
|
1158
1158
|
showHeaderOnLogin: y,
|
|
1159
1159
|
headerExcludedRoutes: O,
|
|
1160
1160
|
footerComponent: P,
|
|
1161
|
-
showFooterOnLogin:
|
|
1161
|
+
showFooterOnLogin: p,
|
|
1162
1162
|
footerExcludedRoutes: v,
|
|
1163
1163
|
privateProvider: x,
|
|
1164
1164
|
customProvider: L
|
|
@@ -1170,10 +1170,10 @@ const We = () => {
|
|
|
1170
1170
|
showHeaderOnLogin: y,
|
|
1171
1171
|
headerExcludedRoutes: O,
|
|
1172
1172
|
footerComponent: P,
|
|
1173
|
-
showFooterOnLogin:
|
|
1173
|
+
showFooterOnLogin: p,
|
|
1174
1174
|
footerExcludedRoutes: v
|
|
1175
1175
|
}
|
|
1176
|
-
),
|
|
1176
|
+
), g = x ? F.cloneElement(x, {}, L) : /* @__PURE__ */ a.jsx(_t, { children: L }), k = () => {
|
|
1177
1177
|
const w = document.querySelector("link[rel='icon']");
|
|
1178
1178
|
u && (w.href = u);
|
|
1179
1179
|
};
|
|
@@ -1184,7 +1184,7 @@ const We = () => {
|
|
|
1184
1184
|
/* @__PURE__ */ a.jsx(Q, { index: !0, element: /* @__PURE__ */ a.jsx(Tt, { Logo: c }) }),
|
|
1185
1185
|
o.map((w, T) => /* @__PURE__ */ a.jsx(Q, { path: w.path, element: w.element }, `public-${T}`))
|
|
1186
1186
|
] }),
|
|
1187
|
-
/* @__PURE__ */ a.jsxs(Q, { element:
|
|
1187
|
+
/* @__PURE__ */ a.jsxs(Q, { element: g, children: [
|
|
1188
1188
|
/* @__PURE__ */ a.jsx(Q, { path: `${s ?? "/dashboard/"}:id`, element: f }),
|
|
1189
1189
|
n.map((w, T) => /* @__PURE__ */ a.jsx(Q, { path: w.path, element: w.element }, `private-${T}`))
|
|
1190
1190
|
] })
|