const utils={loader:{create:function(){let e=document.querySelector(".loader-wrapper");var t,o;return e||((e=document.createElement("div")).className="loader-wrapper",e.style.display="none",e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.backgroundColor="rgba(0, 0, 0, 0.5)",e.style.justifyContent="center",e.style.alignItems="center",e.style.zIndex="9999",(t=document.createElement("div")).className="loader-spinner",t.style.border="4px solid #f3f3f3",t.style.borderTop="4px solid #3498db",t.style.borderRadius="50%",t.style.width="50px",t.style.height="50px",t.style.animation="spin 1s linear infinite",(o=document.createElement("style")).textContent="@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }",document.head.appendChild(o),e.appendChild(t),document.body.appendChild(e)),e},show:function(){this.create().style.display="flex"},hide:function(){var e=document.querySelector(".loader-wrapper");e&&(e.style.display="none")}},snackbar:{show:function(e,t="default"){var o=document.querySelector(".snackbar");o&&o.remove();const s=document.createElement("div");s.className="snackbar "+t,s.textContent=e;Object.assign(s.style,{visibility:"hidden",minWidth:"250px",marginLeft:"-125px",backgroundColor:"error"===t?"#f44336":"success"===t?"#4CAF50":"#333",color:"#fff",textAlign:"center",borderRadius:"2px",padding:"16px",position:"fixed",zIndex:"10000",left:"50%",bottom:"30px",fontSize:"17px"}),document.body.appendChild(s);o=document.createElement("style");o.textContent=` .snackbar.show { visibility: visible !important; -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s; animation: fadein 0.5s, fadeout 0.5s 2.5s; } @-webkit-keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 30px; opacity: 1;} } @keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 30px; opacity: 1;} } @-webkit-keyframes fadeout { from {bottom: 30px; opacity: 1;} to {bottom: 0; opacity: 0;} } @keyframes fadeout { from {bottom: 30px; opacity: 1;} to {bottom: 0; opacity: 0;} } `,document.head.appendChild(o),setTimeout(()=>{s.className+=" show"},100),setTimeout(()=>{s.remove()},3e3)},success:function(e){this.show(e,"success")},error:function(e){this.show(e,"error")}},handleApiResponse:function(e,t,o){e&&"ok"===e.Status?(t&&t(e),this.snackbar.success("Operation completed successfully")):(o&&o(e),this.snackbar.error(e?.Message||"Something went wrong"))}};window.utils=utils,window.closeLoader=utils.loader.hide;