mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
2 lines
6.2 KiB
JavaScript
2 lines
6.2 KiB
JavaScript
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).UniversalCookie=t()}(this,function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t(e,t){return e(t={exports:{}},t.exports),t.exports}function o(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var o={},r=t||{},n=e.split(l),i=r.decode||p,a=0;a<n.length;a++){var s=n[a],u=s.indexOf("=");if(!(u<0)){var c=s.substr(0,u).trim(),f=s.substr(++u,s.length).trim();'"'==f[0]&&(f=f.slice(1,-1)),null==o[c]&&(o[c]=d(f,i))}}return o}function r(e,t,o){var r=o||{},n=r.encode||u;if("function"!=typeof n)throw new TypeError("option encode is invalid");if(!c.test(e))throw new TypeError("argument name is invalid");var i=n(t);if(i&&!c.test(i))throw new TypeError("argument val is invalid");var a=e+"="+i;if(null!=r.maxAge){var s=r.maxAge-0;if(isNaN(s))throw new Error("maxAge should be a Number");a+="; Max-Age="+Math.floor(s)}if(r.domain){if(!c.test(r.domain))throw new TypeError("option domain is invalid");a+="; Domain="+r.domain}if(r.path){if(!c.test(r.path))throw new TypeError("option path is invalid");a+="; Path="+r.path}if(r.expires){if("function"!=typeof r.expires.toUTCString)throw new TypeError("option expires is invalid");a+="; Expires="+r.expires.toUTCString()}if(r.httpOnly&&(a+="; HttpOnly"),r.secure&&(a+="; Secure"),r.sameSite){switch("string"==typeof r.sameSite?r.sameSite.toLowerCase():r.sameSite){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a}var p=decodeURIComponent,u=encodeURIComponent,l=/; */,c=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function d(t,e){try{return e(t)}catch(e){return t}}var f={parse:o,serialize:r},y=t(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.hasDocumentCookie=function(){return"object"===("undefined"==typeof document?"undefined":s(document))&&"string"==typeof document.cookie},t.cleanCookies=function(){document.cookie.split(";").forEach(function(e){document.cookie=e.replace(/^ +/,"").replace(/=.*/,"=;expires="+(new Date).toUTCString()+";path=/")})},t.parseCookies=function(e,t){return"string"==typeof e?o.parse(e,t):"object"===s(e)&&null!==e?e:{}},t.isParsingCookie=r,t.readCookie=function(e,t){void 0===t&&(t={});var o=function(e){if(e&&"j"===e[0]&&":"===e[1])return e.substr(2);return e}(e);if(r(o,t.doNotParse))try{return JSON.parse(o)}catch(e){}return e};var o=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==s(e)&&"function"!=typeof e)return{default:e};var t=a();if(t&&t.has(e))return t.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=r?Object.getOwnPropertyDescriptor(e,n):null;i&&(i.get||i.set)?Object.defineProperty(o,n,i):o[n]=e[n]}o.default=e,t&&t.set(e,o);return o}(f);function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){return void 0===t&&(t=!e||"{"!==e[0]&&"["!==e[0]&&'"'!==e[0]),!t}});e(y);y.hasDocumentCookie,y.cleanCookies,y.parseCookies,y.isParsingCookie,y.readCookie;var n=t(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==s(e)&&"function"!=typeof e)return{default:e};var t=a();if(t&&t.has(e))return t.get(e);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=r?Object.getOwnPropertyDescriptor(e,n):null;i&&(i.get||i.set)?Object.defineProperty(o,n,i):o[n]=e[n]}o.default=e,t&&t.set(e,o);return o}(f
|