{"version":3,"sources":["webpack:///./node_modules/basil.js/src/basil.js"],"names":["Basil","options","utils","extend","plugins","Storage","init","version","destination","arguments","i","length","property","each","obj","fnIterator","context","this","isArray","call","key","tryEach","fnError","value","error","isFunction","registerPlugin","methods","types","type","Object","prototype","toString","namespace","storages","expireDays","window","_salt","Math","random","substring","_storages","_toStoragesArray","isString","_toStoredKey","path","join","_toKeyName","replace","RegExp","webStorageInterface","engine","check","setItem","removeItem","e","set","Error","get","getItem","remove","reset","indexOf","keys","push","local","session","memory","_hash","cookie","navigator","cookieEnabled","date","Date","setTime","getTime","toGMTString","domain","document","_domain","split","secure","cookies","domainParts","slice","substr","setOptions","support","storage","hasOwnProperty","raw","JSON","stringify","_toStoredValue","where","index","parse","_fromStoredValue","keysMap","map","localStorage","sessionStorage"],"mappings":"+EAAA,kBAEC,IAAIA,MAAQ,SAAUC,GACrB,OAAOD,MAAME,MAAMC,OAAO,GAAIH,MAAMI,SAAS,IAAIJ,MAAMK,SAAUC,KAAKL,KAIvED,MAAMO,QAAU,QAGhBP,MAAME,MAAQ,CACbC,OAAQ,WAEP,IADA,IAAIK,EAAsC,iBAAjBC,UAAU,GAAkBA,UAAU,GAAK,GAC3DC,EAAI,EAAGA,EAAID,UAAUE,OAAQD,IACrC,GAAID,UAAUC,IAA8B,iBAAjBD,UAAUC,GACpC,IAAK,IAAIE,KAAYH,UAAUC,GAC9BF,EAAYI,GAAYH,UAAUC,GAAGE,GAExC,OAAOJ,GAERK,KAAM,SAAUC,EAAKC,EAAYC,GAChC,GAAIC,KAAKC,QAAQJ,IAChB,IAAK,IAAIJ,EAAI,EAAGA,EAAII,EAAIH,OAAQD,IAC/B,IAA4C,IAAxCK,EAAWI,KAAKH,EAASF,EAAIJ,GAAIA,GAAc,YAC9C,GAAII,EACV,IAAK,IAAIM,KAAON,EACf,IAAgD,IAA5CC,EAAWI,KAAKH,EAASF,EAAIM,GAAMA,GAAgB,QAG1DC,QAAS,SAAUP,EAAKC,EAAYO,EAASN,G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yD,KAAK,IACpF1F,MAAMqE,QAAS,IAAIrE,MAAMK,SAAUC,KAAK,CAAE4B,SAAU,SAAUD,UAAW,KAAMyD,KAAK,IACpF1F,MAAMoG,cAAe,IAAIpG,MAAMK,SAAUC,KAAK,CAAE4B,SAAU,QAASD,UAAW,KAAMyD,KAAK,IACzF1F,MAAMqG,gBAAiB,IAAIrG,MAAMK,SAAUC,KAAK,CAAE4B,SAAU,UAAWD,UAAW,KAAMyD,KAAK,IAG7FtD,OAAOpC,MAAQA,WAMb,KAFD,aACC,OAAOA,OACP,8BAvWH","file":"npm.basil.js-2e47f5649b66bdeccbe1.js","sourcesContent":["(function () {\n\t// Basil\n\tvar Basil = function (options) {\n\t\treturn Basil.utils.extend({}, Basil.plugins, new Basil.Storage().init(options));\n\t};\n\n\t// Version\n\tBasil.version = '0.4.1';\n\n\t// Utils\n\tBasil.utils = {\n\t\textend: function () {\n\t\t\tvar destination = typeof arguments[0] === 'object' ? arguments[0] : {};\n\t\t\tfor (var i = 1; i < arguments.length; i++) {\n\t\t\t\tif (arguments[i] && typeof arguments[i] === 'object')\n\t\t\t\t\tfor (var property in arguments[i])\n\t\t\t\t\t\tdestination[property] = arguments[i][property];\n\t\t\t}\n\t\t\treturn destination;\n\t\t},\n\t\teach: function (obj, fnIterator, context) {\n\t\t\tif (this.isArray(obj)) {\n\t\t\t\tfor (var i = 0; i < obj.length; i++)\n\t\t\t\t\tif (fnIterator.call(context, obj[i], i) === false) return;\n\t\t\t} else if (obj) {\n\t\t\t\tfor (var key in obj)\n\t\t\t\t\tif (fnIterator.call(context, obj[key], key) === false) return;\n\t\t\t}\n\t\t},\n\t\ttryEach: function (obj, fnIterator, fnError, context) {\n\t\t\tthis.each(obj, function (value, key) {\n\t\t\t\ttry {\n\t\t\t\t\treturn fnIterator.call(context, value, key);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (this.isFunction(fnError)) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tfnError.call(context, value, key, error);\n\t\t\t\t\t\t} catch (error) {}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, this);\n\t\t},\n\t\tregisterPlugin: function (methods) {\n\t\t\tBasil.plugins = this.extend(methods, Basil.plugins);\n\t\t}\n\t};\n \t// Add some isType methods: isArguments, isBoolean, isFunction, isString, isArray, isNumber, isDate, isRegExp.\n\tvar types = ['Arguments', 'Boolean', 'Function', 'String', 'Array', 'Number', 'Date', 'RegExp']\n\tfor (var i = 0; i < types.length; i++) {\n\t\tBasil.utils['is' + types[i]] = (function (type) {\n\t\t\treturn function (obj) {\n\t\t\t\treturn Object.prototype.toString.call(obj) === '[object ' + type + ']';\n\t\t\t};\n\t\t})(types[i]);\n\t}\n\n\t// Plugins\n\tBasil.plugins = {};\n\n\t// Options\n\tBasil.options = Basil.utils.extend({\n\t\tnamespace: 'b45i1',\n\t\tstorages: ['local', 'cookie', 'session', 'memory'],\n\t\texpireDays: 365\n\t}, window.Basil ? window.Basil.options : {});\n\n\t// Storage\n\tBasil.Storage = function () {\n\t\tvar _salt = 'b45i1' + (Math.random() + 1)\n\t\t\t\t.toString(36)\n\t\t\t\t.substring(7),\n\t\t\t_storages = {},\n\t\t\t_toStoragesArray = function (storages) {\n\t\t\t\tif (Basil.utils.isArray(storages))\n\t\t\t\t\treturn storages;\n\t\t\t\treturn Basil.utils.isString(storages) ? [storages] : [];\n\t\t\t},\n\t\t\t_toStoredKey = function (namespace, path) {\n\t\t\t\tvar key = '';\n\t\t\t\tif (Basil.utils.isString(path) && path.length)\n\t\t\t\t\tpath = [path];\n\t\t\t\tif (Basil.utils.isArray(path) && path.length)\n\t\t\t\t\tkey = path.join(':');\n\t\t\t\treturn key && namespace ? namespace + ':' + key : key;\n\t\t\t},\n\t\t\t_toKeyName = function (namespace, key) {\n\t\t\t\tif (!namespace)\n\t\t\t\t\treturn key;\n\t\t\t\treturn key.replace(new RegExp('^' + namespace + ':'), '');\n\t\t\t},\n\t\t\t_toStoredValue = function (value) {\n\t\t\t\treturn JSON.stringify(value);\n\t\t\t},\n\t\t\t_fromStoredValue = function (value) {\n\t\t\t\treturn value ? JSON.parse(value) : null;\n\t\t\t};\n\n\t\t// HTML5 web storage interface\n\t\tvar webStorageInterface = {\n\t\t\tengine: null,\n\t\t\tcheck: function () {\n\t\t\t\ttry {\n\t\t\t\t\twindow[this.engine].setItem(_salt, true);\n\t\t\t\t\twindow[this.engine].removeItem(_salt);\n\t\t\t\t} catch (e) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tset: function (key, value, options) {\n\t\t\t\tif (!key)\n\t\t\t\t\tthrow Error('invalid key');\n\t\t\t\twindow[this.engine].setItem(key, value);\n\t\t\t},\n\t\t\tget: function (key) {\n\t\t\t\treturn window[this.engine].getItem(key);\n\t\t\t},\n\t\t\tremove: function (key) {\n\t\t\t\twindow[this.engine].removeItem(key);\n\t\t\t},\n\t\t\treset: function (namespace) {\n\t\t\t\tfor (var i = 0, key; i < window[this.engine].length; i++) {\n\t\t\t\t\tkey = window[this.engine].key(i);\n\t\t\t\t\tif (!namespace || key.indexOf(namespace) === 0) {\n\t\t\t\t\t\tthis.remove(key);\n\t\t\t\t\t\ti--;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tkeys: function (namespace) {\n\t\t\t\tvar keys = [];\n\t\t\t\tfor (var i = 0, key; i < window[this.engine].length; i++) {\n\t\t\t\t\tkey = window[this.engine].key(i);\n\t\t\t\t\tif (!namespace || key.indexOf(namespace) === 0)\n\t\t\t\t\t\tkeys.push(_toKeyName(namespace, key));\n\t\t\t\t}\n\t\t\t\treturn keys;\n\t\t\t}\n\t\t};\n\n\t\t// local storage\n\t\t_storages.local = Basil.utils.extend({}, webStorageInterface, {\n\t\t\tengine: 'localStorage'\n\t\t});\n\t\t// session storage\n\t\t_storages.session = Basil.utils.extend({}, webStorageInterface, {\n\t\t\tengine: 'sessionStorage'\n\t\t});\n\n\t\t// memory storage\n\t\t_storages.memory = {\n\t\t\t_hash: {},\n\t\t\tcheck: function () {\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tset: function (key, value, options) {\n\t\t\t\tif (!key)\n\t\t\t\t\tthrow Error('invalid key');\n\t\t\t\tthis._hash[key] = value;\n\t\t\t},\n\t\t\tget: function (key) {\n\t\t\t\treturn this._hash[key] || null;\n\t\t\t},\n\t\t\tremove: function (key) {\n\t\t\t\tdelete this._hash[key];\n\t\t\t},\n\t\t\treset: function (namespace) {\n\t\t\t\tfor (var key in this._hash) {\n\t\t\t\t\tif (!namespace || key.indexOf(namespace) === 0)\n\t\t\t\t\t\tthis.remove(key);\n\t\t\t\t}\n\t\t\t},\n\t\t\tkeys: function (namespace) {\n\t\t\t\tvar keys = [];\n\t\t\t\tfor (var key in this._hash)\n\t\t\t\t\tif (!namespace || key.indexOf(namespace) === 0)\n\t\t\t\t\t\tkeys.push(_toKeyName(namespace, key));\n\t\t\t\treturn keys;\n\t\t\t}\n\t\t};\n\n\t\t// cookie storage\n\t\t_storages.cookie = {\n\t\t\tcheck: function () {\n\t\t\t\treturn navigator.cookieEnabled;\n\t\t\t},\n\t\t\tset: function (key, value, options) {\n\t\t\t\tif (!this.check())\n\t\t\t\t\tthrow Error('cookies are disabled');\n\t\t\t\toptions = options || {};\n\t\t\t\tif (!key)\n\t\t\t\t\tthrow Error('invalid key');\n\t\t\t\tvar cookie = key + '=' + value;\n\t\t\t\t// handle expiration days\n\t\t\t\tif (options.expireDays) {\n\t\t\t\t\tvar date = new Date();\n\t\t\t\t\tdate.setTime(date.getTime() + (options.expireDays * 24 * 60 * 60 * 1000));\n\t\t\t\t\tcookie += '; expires=' + date.toGMTString();\n\t\t\t\t}\n\t\t\t\t// handle domain\n\t\t\t\tif (options.domain && options.domain !== document.domain) {\n\t\t\t\t\tvar _domain = options.domain.replace(/^\\./, '');\n\t\t\t\t\tif (document.domain.indexOf(_domain) === -1 || _domain.split('.').length <= 1)\n\t\t\t\t\t\tthrow Error('invalid domain');\n\t\t\t\t\tcookie += '; domain=' + options.domain;\n\t\t\t\t}\n\t\t\t\t// handle secure\n\t\t\t\tif (options.secure === true) {\n\t\t\t\t\tcookie =+ '; secure';\n\t\t\t\t}\n\t\t\t\tdocument.cookie = cookie + '; path=/';\n\t\t\t},\n\t\t\tget: function (key) {\n\t\t\t\tif (!this.check())\n\t\t\t\t\tthrow Error('cookies are disabled');\n\t\t\t\tvar cookies = document.cookie ? document.cookie.split(';') : [];\n\t\t\t\t// retrieve last updated cookie first\n\t\t\t\tfor (var i = cookies.length - 1, cookie; i >= 0; i--) {\n\t\t\t\t\tcookie = cookies[i].replace(/^\\s*/, '');\n\t\t\t\t\tif (cookie.indexOf(key + '=') === 0)\n\t\t\t\t\t\treturn cookie.substring(key.length + 1, cookie.length);\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t},\n\t\t\tremove: function (key) {\n\t\t\t\t// remove cookie from main domain\n\t\t\t\tthis.set(key, '', { expireDays: -1 });\n\t\t\t\t// remove cookie from upper domains\n\t\t\t\tvar domainParts = document.domain.split('.');\n\t\t\t\tfor (var i = domainParts.length; i >= 0; i--) {\n\t\t\t\t\tthis.set(key, '', { expireDays: -1, domain: '.' + domainParts.slice(- i).join('.') });\n\t\t\t\t}\n\t\t\t},\n\t\t\treset: function (namespace) {\n\t\t\t\tvar cookies = document.cookie ? document.cookie.split(';') : [];\n\t\t\t\tfor (var i = 0, cookie, key; i < cookies.length; i++) {\n\t\t\t\t\tcookie = cookies[i].replace(/^\\s*/, '');\n\t\t\t\t\tkey = cookie.substr(0, cookie.indexOf('='));\n\t\t\t\t\tif (!namespace || key.indexOf(namespace) === 0)\n\t\t\t\t\t\tthis.remove(key);\n\t\t\t\t}\n\t\t\t},\n\t\t\tkeys: function (namespace) {\n\t\t\t\tif (!this.check())\n\t\t\t\t\tthrow Error('cookies are disabled');\n\t\t\t\tvar keys = [],\n\t\t\t\t\tcookies = document.cookie ? document.cookie.split(';') : [];\n\t\t\t\tfor (var i = 0, cookie, key; i < cookies.length; i++) {\n\t\t\t\t\tcookie = cookies[i].replace(/^\\s*/, '');\n\t\t\t\t\tkey = cookie.substr(0, cookie.indexOf('='));\n\t\t\t\t\tif (!namespace || key.indexOf(namespace) === 0)\n\t\t\t\t\t\tkeys.push(_toKeyName(namespace, key));\n\t\t\t\t}\n\t\t\t\treturn keys;\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\tinit: function (options) {\n\t\t\t\tthis.setOptions(options);\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tsetOptions: function (options) {\n\t\t\t\tthis.options = Basil.utils.extend({}, this.options || Basil.options, options);\n\t\t\t},\n\t\t\tsupport: function (storage) {\n\t\t\t\treturn _storages.hasOwnProperty(storage);\n\t\t\t},\n\t\t\tcheck: function (storage) {\n\t\t\t\tif (this.support(storage))\n\t\t\t\t\treturn _storages[storage].check();\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\tset: function (key, value, options) {\n\t\t\t\toptions = Basil.utils.extend({}, this.options, options);\n\t\t\t\tif (!(key = _toStoredKey(options.namespace, key)))\n\t\t\t\t\treturn false;\n\t\t\t\tvalue = options.raw === true ? value : _toStoredValue(value);\n\t\t\t\tvar where = null;\n\t\t\t\t// try to set key/value in first available storage\n\t\t\t\tBasil.utils.tryEach(_toStoragesArray(options.storages), function (storage, index) {\n\t\t\t\t\t_storages[storage].set(key, value, options);\n\t\t\t\t\twhere = storage;\n\t\t\t\t\treturn false; // break;\n\t\t\t\t}, null, this);\n\t\t\t\tif (!where) {\n\t\t\t\t\t// key has not been set anywhere\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t// remove key from all other storages\n\t\t\t\tBasil.utils.tryEach(_toStoragesArray(options.storages), function (storage, index) {\n\t\t\t\t\tif (storage !== where)\n\t\t\t\t\t\t_storages[storage].remove(key);\n\t\t\t\t}, null, this);\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tget: function (key, options) {\n\t\t\t\toptions = Basil.utils.extend({}, this.options, options);\n\t\t\t\tif (!(key = _toStoredKey(options.namespace, key)))\n\t\t\t\t\treturn null;\n\t\t\t\tvar value = null;\n\t\t\t\tBasil.utils.tryEach(_toStoragesArray(options.storages), function (storage, index) {\n\t\t\t\t\tif (value !== null)\n\t\t\t\t\t\treturn false; // break if a value has already been found.\n\t\t\t\t\tvalue = _storages[storage].get(key, options) || null;\n\t\t\t\t\tvalue = options.raw === true ? value : _fromStoredValue(value);\n\t\t\t\t}, function (storage, index, error) {\n\t\t\t\t\tvalue = null;\n\t\t\t\t}, this);\n\t\t\t\treturn value;\n\t\t\t},\n\t\t\tremove: function (key, options) {\n\t\t\t\toptions = Basil.utils.extend({}, this.options, options);\n\t\t\t\tif (!(key = _toStoredKey(options.namespace, key)))\n\t\t\t\t\treturn;\n\t\t\t\tBasil.utils.tryEach(_toStoragesArray(options.storages), function (storage) {\n\t\t\t\t\t_storages[storage].remove(key);\n\t\t\t\t}, null, this);\n\t\t\t},\n\t\t\treset: function (options) {\n\t\t\t\toptions = Basil.utils.extend({}, this.options, options);\n\t\t\t\tBasil.utils.tryEach(_toStoragesArray(options.storages), function (storage) {\n\t\t\t\t\t_storages[storage].reset(options.namespace);\n\t\t\t\t}, null, this);\n\t\t\t},\n\t\t\tkeys: function (options) {\n\t\t\t\toptions = options || {};\n\t\t\t\tvar keys = [];\n\t\t\t\tfor (var key in this.keysMap(options))\n\t\t\t\t\tkeys.push(key);\n\t\t\t\treturn keys;\n\t\t\t},\n\t\t\tkeysMap: function (options) {\n\t\t\t\toptions = Basil.utils.extend({}, this.options, options);\n\t\t\t\tvar map = {};\n\t\t\t\tBasil.utils.tryEach(_toStoragesArray(options.storages), function (storage) {\n\t\t\t\t\tBasil.utils.each(_storages[storage].keys(options.namespace), function (key) {\n\t\t\t\t\t\tmap[key] = Basil.utils.isArray(map[key]) ? map[key] : [];\n\t\t\t\t\t\tmap[key].push(storage);\n\t\t\t\t\t}, this);\n\t\t\t\t}, null, this);\n\t\t\t\treturn map;\n\t\t\t}\n\t\t};\n\t};\n\n\t// Access to native storages, without namespace or basil value decoration\n\tBasil.memory = new Basil.Storage().init({ storages: 'memory', namespace: null, raw: true });\n\tBasil.cookie = new Basil.Storage().init({ storages: 'cookie', namespace: null, raw: true });\n\tBasil.localStorage = new Basil.Storage().init({ storages: 'local', namespace: null, raw: true });\n\tBasil.sessionStorage = new Basil.Storage().init({ storages: 'session', namespace: null, raw: true });\n\n\t// browser export\n\twindow.Basil = Basil;\n\n\t// AMD export\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine(function() {\n\t\t\treturn Basil;\n\t\t});\n\t// commonjs export\n\t} else if (typeof module !== 'undefined' && module.exports) {\n\t\tmodule.exports = Basil;\n\t}\n\n})();\n"],"sourceRoot":""}