define(["css!cmpts/notifications/notifications.css"],function(){var i,t=Dom7,n=Template7;app.addNotification=function(o){if(o){"undefined"==typeof o.media&&(o.media=app.params.notificationMedia),"undefined"==typeof o.title&&(o.title=app.params.notificationTitle),"undefined"==typeof o.subtitle&&(o.subtitle=app.params.notificationSubtitle),"undefined"==typeof o.closeIcon&&(o.closeIcon=app.params.notificationCloseIcon),"undefined"==typeof o.hold&&(o.hold=app.params.notificationHold),"undefined"==typeof o.closeOnClick&&(o.closeOnClick=app.params.notificationCloseOnClick),"undefined"==typeof o.button&&(o.button=app.params.notificationCloseButtonText&&{text:app.params.notificationCloseButtonText,close:!0}),i||(i=document.createElement("div")),o.material=0;var a=t(".notifications");0===a.length&&(t("body").append('
'),a=t(".notifications"));var e=a.children("ul"),s=app.params.notificationTemplate||'{{#if custom}}
  • {{custom}}
  • {{else}}
  • {{#if material}}
    {{js "this.message || this.title || this.subtitle"}}
    {{#if ../button}}{{#button}}{{/button}}{{/if}}
    {{else}}{{#if media}}
    {{media}}
    {{/if}}
    {{#if title}}
    {{title}}
    {{/if}}{{#if closeIcon}}
    {{/if}}
    {{#if subtitle}}
    {{subtitle}}
    {{/if}}{{#if message}}
    {{message}}
    {{/if}}{{/if}}
  • {{/if}}';app._compiledTemplates.notification||(app._compiledTemplates.notification=n.compile(s)),i.innerHTML=app._compiledTemplates.notification(o);var l=t(i).children();l.on("click",function(i){var n=!1,a=t(i.target);o.material&&a.hasClass("button")&&o.button&&o.button.onClick&&o.button.onClick.call(a[0],i,l[0]),a.is(".close-notification")||t(i.target).parents(".close-notification").length>0?n=!0:(o.onClick&&o.onClick(i,l[0]),o.closeOnClick&&(n=!0)),n&&app.closeNotification(l[0])}),o.onClose&&l.data("f7NotificationOnClose",function(){o.onClose(l[0])}),o.additionalClass&&l.addClass(o.additionalClass),o.hold&&setTimeout(function(){l.length>0&&app.closeNotification(l[0])},o.hold),e[o.material?"append":"prepend"](l[0]),a.show();var c,f=l.outerHeight();return o.material?(a.transform("translate3d(0, "+f+"px, 0)"),a.transition(0),c=l[0].clientLeft,a.transform("translate3d(0, 0, 0)"),a.transition("")):(l.css("marginTop",-f+"px"),l.transition(0),c=l[0].clientLeft,l.transition(""),l.css("marginTop","0px")),a.transform("translate3d(0, 0,0)"),l.removeClass("notification-hidden"),l[0]}},app.closeNotification=function(i){if(i=t(i),0!==i.length&&!i.hasClass("notification-item-removing")){var n=t(".notifications"),o=i.outerHeight();i.css("height",o+"px").transition(0).addClass("notification-item-removing");i[0].clientLeft;i.css("height","0px").transition(""),i.data("f7NotificationOnClose")&&i.data("f7NotificationOnClose")(),0===n.find(".notification-item:not(.notification-item-removing)").length&&n.transform(""),i.addClass("notification-hidden").transitionEnd(function(){i.remove(),0===n.find(".notification-item").length&&n.hide()})}}});