New-OMIS/public/vendor/flasher/flasher-toastr.min.js

2 lines
13 KiB
JavaScript
Raw Permalink Normal View History

2024-04-04 07:46:19 +00:00
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@flasher/flasher"),require("jquery")):"function"==typeof define&&define.amd?define(["@flasher/flasher","jquery"],e):((t="undefined"!=typeof globalThis?globalThis:t||self).flasher=t.flasher||{},t.flasher.toastr=e(t.flasher,t.jQuery))}(this,(function(t,e){"use strict";var o=function(){return o=Object.assign||function(t){for(var e,o=1,i=arguments.length;o<i;o++)for(var n in e=arguments[o])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},o.apply(this,arguments)},i={};!function(t){var o;o=function(t){return function(){var e,o,i,n=0,a="error",s="info",r="success",c="warning",d={clear:function(o,i){var n=u();e||p(n),l(o,n,i)||function(o){for(var i=e.children(),n=i.length-1;n>=0;n--)l(t(i[n]),o)}(n)},remove:function(o){var i=u();e||p(i),o&&0===t(":focus",o).length?f(o):e.children().length&&e.remove()},error:function(t,e,o){return g({type:a,iconClass:u().iconClasses.error,message:t,optionsOverride:o,title:e})},getContainer:p,info:function(t,e,o){return g({type:s,iconClass:u().iconClasses.info,message:t,optionsOverride:o,title:e})},options:{},subscribe:function(t){o=t},success:function(t,e,o){return g({type:r,iconClass:u().iconClasses.success,message:t,optionsOverride:o,title:e})},version:"2.1.4",warning:function(t,e,o){return g({type:c,iconClass:u().iconClasses.warning,message:t,optionsOverride:o,title:e})}};return d;function p(o,i){return o||(o=u()),(e=t("#"+o.containerId)).length||i&&(e=function(o){return(e=t("<div/>").attr("id",o.containerId).addClass(o.positionClass)).appendTo(t(o.target)),e}(o)),e}function l(e,o,i){var n=!(!i||!i.force)&&i.force;return!(!e||!n&&0!==t(":focus",e).length||(e[o.hideMethod]({duration:o.hideDuration,easing:o.hideEasing,complete:function(){f(e)}}),0))}function A(t){o&&o(t)}function g(o){var a=u(),s=o.iconClass||a.iconClass;if(void 0!==o.optionsOverride&&(a=t.extend(a,o.optionsOverride),s=o.optionsOverride.iconClass||s),!function(t,e){if(t.preventDuplicates){if(e.message===i)return!0;i=e.message}return!1}(a,o)){n++,e=p(a,!0);var r=null,c=t("<div/>"),d=t("<div/>"),l=t("<div/>"),g=t("<div/>"),h=t(a.closeHtml),m={intervalId:null,hideEta:null,maxHideTime:null},b={toastId:n,state:"visible",startTime:new Date,options:a,map:o};return o.iconClass&&c.addClass(a.toastClass).addClass(s),function(){if(o.title){var t=o.title;a.escapeHtml&&(t=x(o.title)),d.append(t).addClass(a.titleClass),c.append(d)}}(),function(){if(o.message){var t=o.message;a.escapeHtml&&(t=x(o.message)),l.append(t).addClass(a.messageClass),c.append(l)}}(),a.closeButton&&(h.addClass(a.closeClass).attr("role","button"),c.prepend(h)),a.progressBar&&(g.addClass(a.progressClass),c.prepend(g)),a.rtl&&c.addClass("rtl"),a.newestOnTop?e.prepend(c):e.append(c),function(){var t="";switch(o.iconClass){case"toast-success":case"toast-info":t="polite";break;default:t="assertive"}c.attr("aria-live",t)}(),c.hide(),c[a.showMethod]({duration:a.showDuration,easing:a.showEasing,complete:a.onShown}),a.timeOut>0&&(r=setTimeout(w,a.timeOut),m.maxHideTime=parseFloat(a.timeOut),m.hideEta=(new Date).getTime()+m.maxHideTime,a.progressBar&&(m.intervalId=setInterval(y,10))),a.closeOnHover&&c.hover(C,v),!a.onclick&&a.tapToDismiss&&c.click(w),a.closeButton&&h&&h.click((function(t){t.stopPropagation?t.stopPropagation():void 0!==t.cancelBubble&&!0!==t.cancelBubble&&(t.cancelBubble=!0),a.onCloseClick&&a.onCloseClick(t),w(!0)})),a.onclick&&c.click((function(t){a.onclick(t),w()})),A(b),a.debug&&console&&console.log(b),c}function x(t){return null==t&&(t=""),t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function w(e){var o=e&&!1!==a.closeMethod?a.closeMethod:a.hideMethod,i=e&&!1!==a.closeDuration?a.closeDuration:a.hideDuration,n=e&&!1!==a.closeEasing?a.closeEasing:a.hideEasing;if(!t(":focus",c).length||e)return clearTimeout(m.intervalId),c[o]({duration:i,easing:n,complete:function(){f(c),clearTimeout(r),a.onHidden&&"hidden"!==b.state&&a.onHidden(),b.state="hidden",b.endTime=new Date,A(b)}})}function v(){(a