text: /**
  * @author Jason Dobry <jason.dobry@gmail.com>
  * @file js-data-localstorage.min.js
  * @version 0.1.1 - Homepage <http://wwwjs-data.io/js-data-localstorage>
  * @copyright (c) 2014 Jason Dobry
  * @license MIT <https://github.com/js-data/js-data-localstorage/blob/master/LICENSE>
  *
  * @overview My Adapter.
  */
  !function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.DSLocalStorageAdapter=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){var c=a("./isKind"),d=Array.isArray||function(a){return c(a,"Array")};b.exports=d},{"./isKind":2}],2:[function(a,b){function c(a,b){return d(a)===b}var d=a("./kindOf");b.exports=c},{"./kindOf":3}],3:[function(a,b){function c(a){return null===a?"Null":a===d?"Undefined":e.exec(f.call(a))[1]}var d,e=/^\[object (.*)\]$/,f=Object.prototype.toString;b.exports=c},{}],4:[function(a,b){b.exports=2147483647},{}],5:[function(a,b){b.exports=-2147483648},{}],6:[function(a,b){function c(){g=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],f=!0;for(var a in{toString:null})f=!1}function d(a,b,d){var i,j=0;null==f&&c();for(i in a)if(e(b,a,i,d)===!1)break;if(f)for(var k=a.constructor,l=!!k&&a===k.prototype;(i=g[j++])&&("constructor"===i&&(l||!h(a,i))||a[i]===Object.prototype[i]||e(b,a,i,d)!==!1););}function e(a,b,c,d){return a.call(d,b[c],c,b)}var f,g,h=a("./hasOwn");b.exports=d},{"./hasOwn":8}],7:[function(a,b){function c(a,b,c){e(a,function(e,f){return d(a,f)?b.call(c,a[f],f,a):void 0})}var d=a("./hasOwn"),e=a("./forIn");b.exports=c},{"./forIn":6,"./hasOwn":8}],8:[function(a,b){function c(a,b){return Object.prototype.hasOwnProperty.call(a,b)}b.exports=c},{}],9:[function(a,b){var c=a("./forOwn"),d=Object.keys||function(a){var b=[];return c(a,function(a,c){b.push(c)}),b};b.exports=d},{"./forOwn":7}],10:[function(a,b){function c(a){var b=1===arguments.length&&e(a)?a:arguments;return b[d(0,b.length-1)]}var d=a("./randInt"),e=a("../lang/isArray");b.exports=c},{"../lang/isArray":1,"./randInt":14}],11:[function(a,b){function c(){return d(8)+"-"+d(4)+"-4"+d(3)+"-"+e(8,9,"a","b")+d(3)+"-"+d(12)}var d=a("./randHex"),e=a("./choice");b.exports=c},{"./choice":10,"./randHex":13}],12:[function(a,b){function c(a,b){return a=null==a?e:a,b=null==b?f:b,a+(b-a)*d()}var d=a("./random"),e=a("../number/MIN_INT"),f=a("../number/MAX_INT");b.exports=c},{"../number/MAX_INT":4,"../number/MIN_INT":5,"./random":15}],13:[function(a,b){function c(a){a=a&&a>0?a:6;for(var b="";a--;)b+=d(e);return b}var d=a("./choice"),e="0123456789abcdef".split("");b.exports=c},{"./choice":10}],14:[function(a,b){function c(a,b){return a=null==a?d:~~a,b=null==b?e:~~b,Math.round(f(a-.5,b+.499999999999))}var d=a("../number/MIN_INT"),e=a("../number/MAX_INT"),f=a("./rand");b.exports=c},{"../number/MAX_INT":4,"../number/MIN_INT":5,"./rand":12}],15:[function(a,b){function c(){return c.get()}c.get=Math.random,b.exports=c},{}],16:[function(a,b){function c(){}function d(a){a=a||{},g.isString(a.namespace)||(a.namespace="DS"),this.defaults=new c,i(this.defaults,a)}var e;e=!window&&"undefined"!=typeof b&&b.exports?a("js-data"):window.JSData;var f=new e.DS,g=e.DSUtils,h=g.makePath,i=g.deepMixIn,j=g.toJson,k=g.fromJson,l=g.forEach,m=f.defaults.defaultFilter,n=a("mout/random/guid"),o=a("mout/object/keys"),p=g.Promise;d.prototype.getIds=function(a,b){var c,d=h(b.namespace||this.defaults.namespace,"DSKeys",a),e=localStorage.getItem(d);return e?c=k(e):(localStorage.setItem(d,j({})),c={}),c},d.prototype.saveKeys=function(a,b,c){var d=h(c.namespace||this.defaults.namespace,"DSKeys",b);localStorage.setItem(d,j(a))},d.prototype.ensureId=function(a,b,c){var d=this.getIds(b,c);d[a]=1,this.saveKeys(d,b,c)},d.prototype.removeId=function(a,b,c){var d=this.getIds(b,c);delete d[a],this.saveKeys(d,b,c)},d.prototype.GET=function(a){return new p(function(b){var c=localStorage.getItem(a);b(c?k(c):void 0)})},d.prototype.PUT=function(a,b){var c=this;return c.GET(a).then(function(d){return d&&i(d,b),localStorage.setItem(a,j(d||b)),c.GET(a)})},d.prototype.DEL=function(a){return new p(function(b){localStorage.removeItem(a),b()})},d.prototype.find=function(a,b,c){return c=c||{},this.GET(h(c.namespace||this.defaults.namespace,a.getEndpoint(b,c),b))},d.prototype.findAll=function(a,b,c){var d=this;return new p(function(e){c=c||{},"allowSimpleWhere"in c||(c.allowSimpleWhere=!0);var g=[],i=o(d.getIds(a.name,c));l(i,function(b){var e=localStorage.getItem(h(c.namespace||d.defaults.namespace,a.getEndpoint(b,c),b));e&&g.push(k(e))}),e(m.call(f,g,a.name,b,c))})},d.prototype.create=function(a,b,c){var d=this;return b[a.idAttribute]=b[a.idAttribute]||n(),c=c||{},this.PUT(h(c.namespace||this.defaults.namespace,a.getEndpoint(b,c),b[a.idAttribute]),b).then(function(b){return d.ensureId(b[a.idAttribute],a.name,c),b})},d.prototype.update=function(a,b,c,d){var e=this;return d=d||{},this.PUT(h(d.namespace||this.defaults.namespace,a.getEndpoint(b,d),b),c).then(function(b){return e.ensureId(b[a.idAttribute],a.name,d),b})},d.prototype.updateAll=function(a,b,c,d){var e=this;return this.findAll(a,c,d).then(function(c){var f=[];return l(c,function(c){f.push(e.update(a,c[a.idAttribute],b,d))}),p.all(f)})},d.prototype.destroy=function(a,b,c){var d=this;return c=c||{},this.DEL(h(c.namespace||this.defaults.namespace,a.getEndpoint(b,c),b)).then(function(){d.removeId(b,a.name,c)})},d.prototype.destroyAll=function(a,b,c){var d=this;return this.findAll(a,b,c).then(function(b){var e=[];return l(b,function(b){e.push(d.destroy(a,b[a.idAttribute],c))}),p.all(e)})},b.exports=d},{"js-data":"js-data","mout/object/keys":9,"mout/random/guid":11}]},{},[16])(16)});