vendor: 4,199 bytes, lines 1-151
1/*! js-cookie v3.0.0 | MIT */ 2; 3(function (global, factory) { 4 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 5 typeof define === 'function' && define.amd ? define(factory) : 6 (global = global || self, (function () { 7 var current = global.Cookies; 8 var exports = global.Cookies = factory(); 9 exports.noConflict = function () { global.Cookies = current; return exports; }; 10 }())); 11}(this, (function () { 'use strict'; 12 13 /* eslint-disable no-var */ 14 function assign (target) { 15 for (var i = 1; i < arguments.length; i++) { 16 var source = arguments[i]; 17 for (var key in source) { 18 target[key] = source[key]; 19 } 20 } 21 return target 22 } 23 /* eslint-enable no-var */ 24 25 /* eslint-disable no-var */ 26 var defaultConverter = { 27 read: function (value) { 28 return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent) 29 }, 30 write: function (value) { 31 return encodeURIComponent(value).replace( 32 /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, 33 decodeURIComponent 34 ) 35 } 36 }; 37 /* eslint-enable no-var */ 38 39 /* eslint-disable no-var */ 40 41 function init (converter, defaultAttributes) { 42 function set (key, value, attributes) { 43 if (typeof document === 'undefined') { 44 return 45 } 46 47 attributes = assign({}, defaultAttributes, attributes); 48 49 if (typeof attributes.expires === 'number') { 50 attributes.expires = new Date(Date.now() + attributes.expires * 864e5); 51 } 52 if (attributes.expires) { 53 attributes.expires = attributes.expires.toUTCString(); 54 } 55 56 key = encodeURIComponent(key) 57 .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent) 58 .replace(/[()]/g, escape); 59 60 value = converter.write(value, key); 61 62 var stringifiedAttributes = ''; 63 for (var attributeName in attributes) { 64 if (!attributes[attributeName]) { 65 continue 66 } 67 68 stringifiedAttributes += '; ' + attributeName; 69 70 if (attributes[attributeName] === true) { 71 continue 72 } 73 74 // Considers RFC 6265 section 5.2: 75 // ... 76 // 3. If the remaining unparsed-attributes contains a %x3B (";") 77 // character: 78 // Consume the characters of the unparsed-attributes up to, 79 // not including, the first %x3B (";") character. 80 // ... 81 stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; 82 } 83 84 return (document.cookie = key + '=' + value + stringifiedAttributes) 85 } 86 87 function get (key) { 88 if (typeof document === 'undefined' || (arguments.length && !key)) { 89 return 90 } 91 92 // To prevent the for loop in the first place assign an empty array 93 // in case there are no cookies at all. 94 var cookies = document.cookie ? document.cookie.split('; ') : []; 95 var jar = {}; 96 for (var i = 0; i < cookies.length; i++) { 97 var parts = cookies[i].split('='); 98 var value = parts.slice(1).join('='); 99 100 if (value[0] === '"') { 101 value = value.slice(1, -1); 102 } 103 104 try { 105 var foundKey = defaultConverter.read(parts[0]); 106 jar[foundKey] = converter.read(value, foundKey); 107 108 if (key === foundKey) { 109 break 110 } 111 } catch (e) {} 112 } 113 114 return key ? jar[key] : jar 115 } 116 117 return Object.create( 118 { 119 set: set, 120 get: get, 121 remove: function (key, attributes) { 122 set( 123 key, 124 '', 125 assign({}, attributes, { 126 expires: -1 127 }) 128 ); 129 }, 130 withAttributes: function (attributes) { 131 return init(this.converter, assign({}, this.attributes, attributes)) 132 }, 133 withConverter: function (converter) { 134 return init(assign({}, this.converter, converter), this.attributes) 135 } 136 }, 137 { 138 attributes: { value: Object.freeze(defaultAttributes) }, 139 converter: { value: Object.freeze(converter) } 140 } 141 ) 142 } 143 144 var api = init(defaultConverter, { path: '/' }); 145 /* eslint-enable no-var */ 146 147 return api; 148 149}))); 150 151
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.