Onionr/onionr/static-data/www/shared/node_modules/pnotify/dist/iife/PNotifyHistory.js

2 lines
3.5 KiB
JavaScript

var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},PNotifyHistory=function(c){"use strict";c=c&&c.__esModule?c.default:c;var e,t={initModule:function(t){if(this.set(t),this.get().history){var e=this.get()._notice;e.get().destroy&&e.set({destroy:!1})}},beforeOpen:function(){var t=this.get(),e=t.maxInStack,n=t._options;if(e!==1/0){var o=n.stack;if(!1!==o&&c.notices&&c.notices.length>e){for(var i="top"===o.push,s=[],r=0,a=i?0:c.notices.length-1;i?a<c.notices.length:0<=a;i?a++:a--)-1!==["opening","open"].indexOf(c.notices[a].get()._state)&&c.notices[a].get().stack===o&&(e<=r?s.push(c.notices[a]):r++);for(var f=0;f<s.length;f++)s[f].close(!1)}}}};function n(t){!function(t,e){t._handlers=i(),t._slots=i(),t._bind=e._bind,t._staged={},t.options=e,t.root=e.root||t,t.store=e.store||t.root.store,e.root||(t._beforecreate=[],t._oncreate=[],t._aftercreate=[])}(this,t),this._state=s(_extends({_notice:null,_options:{}},c.modules.History.defaults),t.data),this._intro=!0,this._fragment=(this._state,{c:o,m:o,p:o,d:o}),t.target&&(this._fragment.c(),this._mount(t.target,t.anchor))}function o(){}function s(t,e){for(var n in e)t[n]=e[n];return t}function i(){return Object.create(null)}function r(t){for(;t&&t.length;)t.shift()()}return s(n.prototype,{destroy:function(t){this.destroy=o,this.fire("destroy"),this.set=o,this._fragment.d(!1!==t),this._fragment=null,this._state={}},get:function(){return this._state},fire:function(t,e){var n=t in this._handlers&&this._handlers[t].slice();if(!n)return;for(var o=0;o<n.length;o+=1){var i=n[o];if(!i.__calling)try{i.__calling=!0,i.call(this,e)}finally{i.__calling=!1}}},on:function(t,e){var n=this._handlers[t]||(this._handlers[t]=[]);return n.push(e),{cancel:function(){var t=n.indexOf(e);~t&&n.splice(t,1)}}},set:function(t){if(this._set(s({},t)),this.root._lock)return;!function(t){t._lock=!0,r(t._beforecreate),r(t._oncreate),r(t._aftercreate),t._lock=!1}(this.root)},_set:function(t){var e=this._state,n={},o=!1;for(var i in t=s(this._staged,t),this._staged={},t)this._differs(t[i],e[i])&&(n[i]=o=!0);if(!o)return;this._state=s(s({},e),t),this._recompute(n,this._state),this._bind&&this._bind(n,this._state);this._fragment&&(this.fire("state",{changed:n,current:this._state,previous:e}),this._fragment.p(n,this._state),this.fire("update",{changed:n,current:this._state,previous:e}))},_stage:function(t){s(this._staged,t)},_mount:function(t,e){this._fragment[this._fragment.i?"i":"m"](t,e||null)},_differs:function(t,e){return t!=t?e==e:t!==e||t&&"object"===(void 0===t?"undefined":_typeof(t))||"function"==typeof t}}),s(n.prototype,t),n.prototype._recompute=o,(e=n).key="History",e.defaults={history:!0,maxInStack:1/0},e.init=function(t){return new e({target:document.body})},e.showLast=function(t){if(void 0===t&&(t=c.defaultStack),!1!==t){var e="top"===t.push,n=e?0:c.notices.length-1,o=void 0;do{if(!(o=c.notices[n]))return;n+=e?1:-1}while(o.get().stack!==t||!o.get()._modules.History.get().history||"opening"===o.get()._state||"open"===o.get()._state);o.open()}},e.showAll=function(t){if(void 0===t&&(t=c.defaultStack),!1!==t)for(var e=0;e<c.notices.length;e++){var n=c.notices[e];!0!==t&&n.get().stack!==t||!n.get()._modules.History.get().history||n.open()}},c.modules.History=e,n}(PNotify);
//# sourceMappingURL=PNotifyHistory.js.map