PageSourceSearch

https://www.catcat.com/vite/assets/push.min-_Qijl4mg.js

js catcat.com collected 2026-09-28 08:39:53 UTC 11,416 bytes, 1 lines download raw bytes

1import{t as e}from"./rolldown-runtime-DAXXjFlN.js";import{n as t,t as n}from"./dist-Bnj2Qb5M.js";var r=e(((e,r)=>{t(),(function(t,n){typeof e==`object`&&r!==void 0?r.exports=n():typeof define==`function`&&define.amd?define(n):(t=t||self).Push=n()})(e,function(){var e={errors:{incompatible:`PushError: Push.js is incompatible with browser.`,invalid_plugin:`PushError: plugin class missing from plugin manifest (invalid plugin). Please check the documentation.`,invalid_title:`PushError: title of notification must be a string`,permission_denied:`PushError: permission request declined`,sw_notification_error:`PushError: could not show a ServiceWorker notification due to the following reason: `,sw_registration_error:`PushError: could not register the ServiceWorker due to the following reason: `,unknown_interface:`PushError: unable to create notification: unknown interface`}};function t(e){return(t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e})(e)}function r(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function o(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t){return!t||typeof t!=`object`&&typeof t!=`function`?function(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}(e):t}var u=function(){function e(t){r(this,e),this._win=t,this.GRANTED=`granted`,this.DEFAULT=`default`,this.DENIED=`denied`,this._permissions=[this.GRANTED,this.DEFAULT,this.DENIED]}return a(e,[{key:`request`,value:function(e,t){return arguments.length>0?this._requestWithCallback.apply(this,arguments):this._requestAsPromise()}},{key:`_requestWithCallback`,value:function(e,t){var n,r=this,i=this.get(),a=!1,o=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:r._win.Notification.permission;a||(a=!0,n===void 0&&r._win.webkitNotifications&&(n=r._win.webkitNotifications.checkPermission()),n===r.GRANTED||n===0?e&&e():t&&t())};i===this.DEFAULT?this._win.webkitNotifications&&this._win.webkitNotifications.checkPermission?this._win.webkitNotifications.requestPermission(o):this._win.Notification&&this._win.Notification.requestPermission?(n=this._win.Notification.requestPermission(o))&&n.then&&n.then(o).catch(function(){t&&t()}):e&&e():o(i)}},{key:`_requestAsPromise`,value:function(){var e=this,t=this.get(),n=t!==this.DEFAULT,r=this._win.Notification&&this._win.Notification.requestPermission,i=this._win.webkitNotifications&&this._win.webkitNotifications.checkPermission;return new Promise(function(a,o){var s,c=!1,l=function(t){c||(c=!0,function(t){return t===e.GRANTED||t===0}(t)?a():o())};n?l(t):i?e._win.webkitNotifications.requestPermission(function(e){l(e)}):r?(s=e._win.Notification.requestPermission(l))&&s.then&&s.then(l).catch(o):a()})}},{key:`has`,value:function(){return this.get()===this.GRANTED}},{key:`get`,value:function(){return this._win.Notification&&this._win.Notification.permission?this._win.Notification.permission:this._win.webkitNotifications&&this._win.webkitNotifications.checkPermission?this._permissions[this._win.webkitNotifications.checkPermission()]:navigator.mozNotification?this.GRANTED:this._win.external&&this._win.external.msIsSiteMode?this._win.external.msIsSiteMode()?this.GRANTED:this.DEFAULT:this.GRANTED}}]),e}(),d=function(){function e(){r(this,e)}return a(e,null,[{key:`isUndefined`,value:function(e){return e===void 0}}
1,{key:`isNull`,value:function(e){return obj===null}},{key:`isString`,value:function(e){return typeof e==`string`}},{key:`isFunction`,value:function(e){return e&&{}.toString.call(e)===`[object Function]`}},{key:`isObject`,value:function(e){return t(e)===`object`}},{key:`objectMerge`,value:function(e,t){for(var n in t)e.hasOwnProperty(n)&&this.isObject(e[n])&&this.isObject(t[n])?this.objectMerge(e[n],t[n]):e[n]=t[n]}}]),e}(),f=function e(t){r(this,e),this._win=t},p=function(e){function t(){return r(this,t),l(this,s(t).apply(this,arguments))}return o(t,f),a(t,[{key:`isSupported`,value:function(){return this._win.Notification!==void 0}},{key:`create`,value:function(e,t){return new this._win.Notification(e,{icon:d.isString(t.icon)||d.isUndefined(t.icon)||d.isNull(t.icon)?t.icon:t.icon.x32,body:t.body,tag:t.tag,requireInteraction:t.requireInteraction})}},{key:`close`,value:function(e){e.close()}}]),t}(),m=function(t){function n(){return r(this,n),l(this,s(n).apply(this,arguments))}return o(n,f),a(n,[{key:`isSupported`,value:function(){return this._win.navigator!==void 0&&this._win.navigator.serviceWorker!==void 0}},{key:`getFunctionBody`,value:function(e){var t=e.toString().match(/function[^{]+{([\s\S]*)}$/);return t!=null&&t.length>1?t[1]:null}},{key:`create`,value:function(t,n,r,i,a){var o=this;this._win.navigator.serviceWorker.register(i),this._win.navigator.serviceWorker.ready.then(function(i){var s={id:t,link:r.link,origin:document.location.href,onClick:d.isFunction(r.onClick)?o.getFunctionBody(r.onClick):``,onClose:d.isFunction(r.onClose)?o.getFunctionBody(r.onClose):``};r.data!==void 0&&r.data!==null&&(s=Object.assign(s,r.data)),i.showNotification(n,{icon:r.icon,body:r.body,vibrate:r.vibrate,tag:r.tag,data:s,requireInteraction:r.requireInteraction,silent:r.silent}).then(function(){i.getNotifications().then(function(e){i.active.postMessage(``),a(e)})}).catch(function(t){throw Error(e.errors.sw_notification_error+t.message)})}).catch(function(t){throw Error(e.errors.sw_registration_error+t.message)})}},{key:`close`,value:function(){}}]),n}(),h=function(e){function t(){return r(this,t),l(this,s(t).apply(this,arguments))}return o(t,f),a(t,[{key:`isSupported`,value:function(){return this._win.navigator.mozNotification!==void 0}},{key:`create`,value:function(e,t){var n=this._win.navigator.mozNotification.createNotification(e,t.body,t.icon);return n.show(),n}}]),t}(),g=function(e){function t(){return r(this,t),l(this,s(t).apply(this,arguments))}return o(t,f),a(t,[{key:`isSupported`,value:function(){return this._win.external!==void 0&&this._win.external.msIsSiteMode!==void 0}},{key:`create`,value:function(e,t){return this._win.external.msSiteModeClearIconOverlay(),this._win.external.msSiteModeSetIconOverlay(d.isString(t.icon)||d.isUndefined(t.icon)?t.icon:t.icon.x16,e),this._win.external.msSiteModeActivate(),null}},{key:`close`,value:function(){this._win.external.msSiteModeClearIconOverlay()}}]),t}(),_=function(e){function t(){return r(this,t),l(this,s(t).apply(this,arguments))}return o(t,f),a(t,[{key:`isSupported`,value:function(){return this._win.webkitNotifications!==void 0}},{key:`create`,value:function(e,t){var n=this._win.webkitNotifications.createNotification(t.icon,e,t.body);return n.show(),n}},{key:`close`,value:function(e){e.cancel()}}]),t}();return new(function(){function t(e){r(this,t),this._currentId=0,this._notifications={},this._win=e,this.Permission=new u(e),this._agents={desktop:new p(e),chrome:new m(e),firefox:new h(e),ms:new g(e),webkit:new _(e)},this._configuration={serviceWorker:`/serviceWorker.min.js`,fallback:function(e){}}}return a(t,[{key:`_closeNotification`,value:function(t){var n=!0,r=this._notifications[t];if(r!==void 0){if(n=this._removeNotification(t),this._agents.desktop.isSupported())this._agents.desktop.close(r);else if(this._agents.webkit.isSupported())this._agents.webkit.close(r);else{if(!this._agents.ms.isSupported())throw n=!1,Error(e.errors.unknown_interface);this._agents.ms.close()}return n}return!1}},{key:`_addNotification`,value:function(e){var t=this._currentId;return this._notifications[t]=e,this._currentId++,t}},{key:`_removeNotification`,value:function(e){var t=!1;return this._notifications.hasOwnProperty(e)&&(delete this._notifications[e],t=!0),t}},{key:`_prepareNotification`,value:function(e,t){var n,r=this;return n={get:function(){return r._notifications[e]},close:function(){r._closeNotification(e)}},t.timeout&&setTimeout(function(){n.close()},t.timeout),n}},{key:`_serviceWorkerCallback`,value:function(e,t,n){var r=this,i=this._addNotification(e[e.length-1]);navigator&&navigator.serviceWorker&&(navigator.serviceWorker.addEventListener(`message`,function(e){var t=JSON.parse(e.data);t.action===`close`&&Number.isInteger(t.id)&&r._removeNotification(t.id)}),n(this._prepareNotification(i,t))),n(null)}},{key:`_createCallback`,value:function(e,t,n){var r,i=this,a=null;if(t=t||{},r=function(e){i._removeNotification(e),d.isFunction(t.onClose)&&t.onClose.call(i,a)},this._agents.desktop.isSupported())try{a=this._agents.desktop.create(e,t)}catch{var o=this._currentId,s=this.config().serviceWorker;this._agents.chrome.isSupported()&&this._agents.chrome.create(o,e,t,s,function(e){return i._serviceWorkerCallback(e,t,n)})}else this._agents.webkit.isSupported()?a=this._agents.webkit.create(e,t):this._agents.firefox.isSupported()?this._agents.firefox.create(e,t):this._agents.ms.isSupported()?a=this._agents.ms.create(e,t):(t.title=e,this.config().fallback(t));if(a!==null){var c=this._addNotification(a),l=this._prepareNotification(c,t);d.isFunction(t.onShow)&&a.addEventListener(`show`,t.onShow),d.isFunction(t.onError)&&a.addEventListener(`error`,t.onError),d.isFunction(t.onClick)&&a.addEventListener(`click`,t.onClick),a.addEventListener(`close`,function(){r(c)}),a.addEventListener(`cancel`,function(){r(c)}),n(l)}n(null)}},{key:`create`,value:function(t,n){var r,i=this;if(!d.isString(t))throw Error(e.errors.invalid_title);return r=this.Permission.has()?function(e,r){try{i._createCallback(t,n,e)}catch(e){r(e)}}
1:function(r,a){i.Permission.request().then(function(){i._createCallback(t,n,r)}).catch(function(){a(e.errors.permission_denied)})},new Promise(r)}},{key:`count`,value:function(){var e,t=0;for(e in this._notifications)this._notifications.hasOwnProperty(e)&&t++;return t}},{key:`close`,value:function(e){for(var t in this._notifications)if(this._notifications.hasOwnProperty(t)&&this._notifications[t].tag===e)return this._closeNotification(t)}},{key:`clear`,value:function(){var e,t=!0;for(e in this._notifications)this._notifications.hasOwnProperty(e)&&(t=t&&this._closeNotification(e));return t}},{key:`supported`,value:function(){var e=!1;for(var t in this._agents)this._agents.hasOwnProperty(t)&&(e=e||this._agents[t].isSupported());return e}},{key:`config`,value:function(e){return(e!==void 0||e!==null&&d.isObject(e))&&d.objectMerge(this._configuration,e),this._configuration}},{key:`extend`,value:function(t){var n,r={}.hasOwnProperty;if(!r.call(t,`plugin`))throw Error(e.errors.invalid_plugin);for(var i in r.call(t,`config`)&&d.isObject(t.config)&&t.config!==null&&this.config(t.config),n=new t.plugin(this.config()))r.call(n,i)&&d.isFunction(n[i])&&(this[i]=n[i])}}]),t}())(typeof window<`u`?window:n)})}));export{r as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.