!function(n) {
    n(["jquery"], function(n) {
        return function() {
            function v(n, t, r) {
                return u({
                    type: f.error,
                    iconClass: i().iconClasses.error,
                    message: n,
                    optionsOverride: r,
                    title: t
                })
            }
            function r(r, u) {
                return r || (r = i()),
                t = n("#" + r.containerId),
                t.length ? t : (u && (t = nt(r)),
                t)
            }
            function y(n, t, r) {
                return u({
                    type: f.info,
                    iconClass: i().iconClasses.info,
                    message: n,
                    optionsOverride: r,
                    title: t
                })
            }
            function p(n) {
                o = n
            }
            function w(n, t, r) {
                return u({
                    type: f.success,
                    iconClass: i().iconClasses.success,
                    message: n,
                    optionsOverride: r,
                    title: t
                })
            }
            function b(n, t, r) {
                return u({
                    type: f.warning,
                    iconClass: i().iconClasses.warning,
                    message: n,
                    optionsOverride: r,
                    title: t
                })
            }
            function k(n) {
                var u = i();
                t || r(u);
                h(n, u) || g(u)
            }
            function d(u) {
                var f = i();
                return t || r(f),
                u && 0 === n(":focus", u).length ? void e(u) : void (t.children().length && t.remove())
            }
            function g(i) {
                for (var u = t.children(), r = u.length - 1; r >= 0; r--)
                    h(n(u[r]), i)
            }
            function h(t, i) {
                return t && 0 === n(":focus", t).length ? (t[i.hideMethod]({
                    duration: i.hideDuration,
                    easing: i.hideEasing,
                    complete: function() {
                        e(t)
                    }
                }),
                !0) : !1
            }
            function nt(i) {
                return t = n("<div/>").attr("id", i.containerId).addClass(i.positionClass).attr("aria-live", "polite").attr("role", "alert"),
                t.appendTo(n(i.target)),
                t
            }
            function tt() {
                return {
                    tapToDismiss: !0,
                    toastClass: "toast",
                    containerId: "toast-container",
                    debug: !1,
                    showMethod: "fadeIn",
                    showDuration: 300,
                    showEasing: "swing",
                    onShown: void 0,
                    hideMethod: "fadeOut",
                    hideDuration: 1e3,
                    hideEasing: "swing",
                    onHidden: void 0,
                    extendedTimeOut: 1e3,
                    iconClasses: {
                        error: "toast-error",
                        info: "toast-info",
                        success: "toast-success",
                        warning: "toast-warning"
                    },
                    iconClass: "toast-info",
                    positionClass: "toast-top-right",
                    timeOut: 5e3,
                    titleClass: "toast-title",
                    messageClass: "toast-message",
                    target: "body",
                    closeHtml: '<button type="button">&times;<\/button>',
                    newestOnTop: !0,
                    preventDuplicates: !1,
                    progressBar: !1
                }
            }
            function c(n) {
                o && o(n)
            }
            function u(u) {
                function v(t) {
                    if (!n(":focus", o).length || t)
                        return (clearTimeout(h.intervalId),
                        o[f.hideMethod]({
                            duration: f.hideDuration,
                            easing: f.hideEasing,
                            complete: function() {
                                e(o);
                                f.onHidden && "hidden" !== a.state && f.onHidden();
                                a.state = "hidden";
                                a.endTime = new Date;
                                c(a)
                            }
                        }))
                }
                function g() {
                    (f.timeOut > 0 || f.extendedTimeOut > 0) && (w = setTimeout(v, f.extendedTimeOut),
                    h.maxHideTime = parseFloat(f.extendedTimeOut),
                    h.hideEta = (new Date).getTime() + h.maxHideTime)
                }
                function nt() {
                    clearTimeout(w);
                    h.hideEta = 0;
                    o.stop(!0, !0)[f.showMethod]({
                        duration: f.showDuration,
                        easing: f.showEasing
                    })
                }
                function tt() {
                    var n = (h.hideEta - (new Date).getTime()) / h.maxHideTime * 100;
                    b.width(n + "%")
                }
                var f = i()
                  , p = u.iconClass || f.iconClass;
                if ("undefined" != typeof u.optionsOverride && (f = n.extend(f, u.optionsOverride),
                p = u.optionsOverride.iconClass || p),
                f.preventDuplicates) {
                    if (u.message === s)
                        return;
                    s = u.message
                }
                l++;
                t = r(f, !0);
                var w = null
                  , o = n("<div/>")
                  , k = n("<div/>")
                  , d = n("<div/>")
                  , b = n("<div/>")
                  , y = n(f.closeHtml)
                  , h = {
                    intervalId: null,
                    hideEta: null,
                    maxHideTime: null
                }
                  , a = {
                    toastId: l,
                    state: "visible",
                    startTime: new Date,
                    options: f,
                    map: u
                };
                return u.iconClass && o.addClass(f.toastClass).addClass(p),
                u.title && (k.append(u.title).addClass(f.titleClass),
                o.append(k)),
                u.message && (d.append(u.message).addClass(f.messageClass),
                o.append(d)),
                f.closeButton && (y.addClass("toast-close-button").attr("role", "button"),
                o.prepend(y)),
                f.progressBar && (b.addClass("toast-progress"),
                o.prepend(b)),
                o.hide(),
                f.newestOnTop ? t.prepend(o) : t.append(o),
                o[f.showMethod]({
                    duration: f.showDuration,
                    easing: f.showEasing,
                    complete: f.onShown
                }),
                f.timeOut > 0 && (w = setTimeout(v, f.timeOut),
                h.maxHideTime = parseFloat(f.timeOut),
                h.hideEta = (new Date).getTime() + h.maxHideTime,
                f.progressBar && (h.intervalId = setInterval(tt, 10))),
                o.hover(nt, g),
                !f.onclick && f.tapToDismiss && o.click(v),
                f.closeButton && y && y.click(function(n) {
                    n.stopPropagation ? n.stopPropagation() : void 0 !== n.cancelBubble && n.cancelBubble !== !0 && (n.cancelBubble = !0);
                    v(!0)
                }),
                f.onclick && o.click(function() {
                    f.onclick();
                    v()
                }),
                c(a),
                f.debug && console && console.log(a),
                o
            }
            function i() {
                return n.extend({}, tt(), a.options)
            }
            function e(n) {
                t || (t = r());
                n.is(":visible") || (n.remove(),
                n = null,
                0 === t.children().length && (t.remove(),
                s = void 0))
            }
            var t, o, s, l = 0, f = {
                error: "error",
                info: "info",
                success: "success",
                warning: "warning"
            }, a = {
                clear: k,
                remove: d,
                error: v,
                getContainer: r,
                info: y,
                options: {},
                subscribe: p,
                success: w,
                version: "2.1.0",
                warning: b
            };
            return a
        }()
    })
}("function" == typeof define && define.amd ? define : function(n, t) {
    "undefined" != typeof module && module.exports ? module.exports = t(require("jquery")) : window.toastr = t(window.jQuery)
}
)
