function u(t,e){let n={color:null,icon:null,duration:5e3,"container-id":"ohsnap",context:document,"fade-duration":"fast"};e=typeof e=="object"?$.extend(n,e):n;let r=$("#"+e["container-id"],e.context),o="",c="";e.icon&&(o="<span class='"+e.icon+"'></span> "),e.color&&(c="ohsnap-alert-"+e.color);let i=$('<div class="ohsnap-alert '+c+'">'+o+t+"</div>").fadeIn(e["fade-duration"]);r.append(i),i.on("click",function(){s($(this))}),setTimeout(function(){s(i)},e.duration)}function s(t,e){let n={duration:"fast"};e=typeof e=="object"?$.extend(n,e):n,typeof t<"u"?t.fadeOut(e.duration,function(){$(this).remove()}):$(".ohsnap-alert").fadeOut(e.duration,function(){$(this).remove()})}function l(t,e={}){let n=window.FleetCart.langs[t];for(let r in e)n=n.replace(`:${r}`,e[r]);return n}function f(t){return Object.keys(FleetCart.permissions).includes(t)}function d(){const t=Math.floor(Math.random()*Date.now()).toString(36),e=Math.random().toString(36).substring(2,8);return(t+e).substring(0,12)}function g(t){$(document).keypressAction({actions:t})}function a(t,e,{duration:n=5e3,context:r=document}){u(e,{"container-id":"notification-toast",context:r,color:{info:"blue",success:"green",warning:"yellow",error:"red"}[t],duration:n})}function p(t,e){a("info",t,{duration:e})}function h(t,e){a("success",t,{duration:e})}function m(t,e){a("warning",t,{duration:e})}function y(t,e){a("error",t,{duration:e})}function w(t){let e="";return e=t.toLowerCase().replace(/e|é|è|ẽ|ẻ|ẹ|ê|ế|ề|ễ|ể|ệ/gi,"e"),e=e.replace(/a|á|à|ã|ả|ạ|ă|ắ|ằ|ẵ|ẳ|ặ|â|ấ|ầ|ẫ|ẩ|ậ/gi,"a"),e=e.replace(/o|ó|ò|õ|ỏ|ọ|ô|ố|ồ|ỗ|ổ|ộ|ơ|ớ|ờ|ỡ|ở|ợ/gi,"o"),e=e.replace(/u|ú|ù|ũ|ủ|ụ|ư|ứ|ừ|ữ|ử|ự/gi,"u"),e=e.replace(/ć|ĉ|č|ċ|ç/gi,"c"),e=e.replace(/î|ï|í|ī|į|ì/gi,"i"),e=e.replace(/\/|'|"|′|’|,|\?|\.|;|]|\[|\+|=|\$|%|&|<|>|:/g," "),e=e.replace(/đ/gi,"d"),e=e.replace(/\s*$/g,""),e=e.replace(/\s+/g,"-"),e}Array.prototype.remove||(Array.prototype.remove=function(){let t,e=arguments,n=e.length,r;for(;n&&this.length;)for(t=e[--n];(r=this.indexOf(t))!==-1;)this.splice(r,1);return this});String.prototype.format||(String.prototype.format=function(){return this.replace(/%(\d+)%/g,(t,e)=>typeof arguments[e]<"u"?arguments[e]:t)});export{w as a,y as e,d as g,f as h,p as i,g as k,a as n,h as s,l as t,m as w};
