//>>built
define("dojox/storage/WhatWGStorageProvider",["dijit","dojo","dojox","dojo/require!dojox/storage/Provider,dojox/storage/manager"],function(k,e,h){e.provide("dojox.storage.WhatWGStorageProvider");e.require("dojox.storage.Provider");e.require("dojox.storage.manager");e.declare("dojox.storage.WhatWGStorageProvider",[h.storage.Provider],{initialized:!1,_domain:null,_available:null,_statusHandler:null,_allNamespaces:null,_storageEventListener:null,initialize:function(){1!=e.config.disableWhatWGStorage&&
(this._domain=location.hostname,this.initialized=!0,h.storage.manager.loaded())},isAvailable:function(){return this._available=!0},put:function(a,b,c,d){if(0==this.isValidKey(a))throw Error("Invalid key given: "+a);d=d||this.DEFAULT_NAMESPACE;a=this.getFullKey(a,d);this._statusHandler=c;b=e.isString(b)?"string:"+b:e.toJson(b);var f=e.hitch(this,function(g){window.removeEventListener("storage",f,!1);c&&c.call(null,this.SUCCESS,a,null,d)});window.addEventListener("storage",f,!1);try{globalStorage[this._domain].setItem(a,
b)}catch(g){this._statusHandler.call(null,this.FAILED,a,g.toString(),d)}},get:function(a,b){if(0==this.isValidKey(a))throw Error("Invalid key given: "+a);b=b||this.DEFAULT_NAMESPACE;a=this.getFullKey(a,b);var c=globalStorage[this._domain].getItem(a);if(null==c||""==c)return null;c=c.value;return c=e.isString(c)&&/^string:/.test(c)?c.substring(7):e.fromJson(c)},getNamespaces:function(){for(var a=[this.DEFAULT_NAMESPACE],b={},c=globalStorage[this._domain],d=/^__([^_]*)_/,f=0;f<c.length;f++){var g=c.key(f);
1==d.test(g)&&(g=g.match(d)[1],"undefined"==typeof b[g]&&(b[g]=!0,a.push(g)))}return a},getKeys:function(a){a=a||this.DEFAULT_NAMESPACE;if(0==this.isValidKey(a))throw Error("Invalid namespace given: "+a);a=a==this.DEFAULT_NAMESPACE?RegExp("^([^_]{2}.*)$"):new RegExp("^__"+a+"_(.*)$");for(var b=globalStorage[this._domain],c=[],d=0;d<b.length;d++){var f=b.key(d);1==a.test(f)&&(f=f.match(a)[1],c.push(f))}return c},clear:function(a){a=a||this.DEFAULT_NAMESPACE;if(0==this.isValidKey(a))throw Error("Invalid namespace given: "+
a);a=a==this.DEFAULT_NAMESPACE?RegExp("^[^_]{2}"):new RegExp("^__"+a+"_");for(var b=globalStorage[this._domain],c=[],d=0;d<b.length;d++)1==a.test(b.key(d))&&(c[c.length]=b.key(d));e.forEach(c,e.hitch(b,"removeItem"))},remove:function(a,b){a=this.getFullKey(a,b);globalStorage[this._domain].removeItem(a)},isPermanent:function(){return!0},getMaximumSize:function(){return this.SIZE_NO_LIMIT},hasSettingsUI:function(){return!1},showSettingsUI:function(){throw Error(this.declaredClass+" does not support a storage settings user-interface");
},hideSettingsUI:function(){throw Error(this.declaredClass+" does not support a storage settings user-interface");},getFullKey:function(a,b){b=b||this.DEFAULT_NAMESPACE;if(0==this.isValidKey(b))throw Error("Invalid namespace given: "+b);return b==this.DEFAULT_NAMESPACE?a:"__"+b+"_"+a}});h.storage.manager.register("dojox.storage.WhatWGStorageProvider",new h.storage.WhatWGStorageProvider)});