//>>built
define("dojox/storage/AirFileStorageProvider",["dijit","dojo","dojox","dojo/require!dojox/storage/manager,dojox/storage/Provider"],function(n,g,h){g.provide("dojox.storage.AirFileStorageProvider");g.require("dojox.storage.manager");g.require("dojox.storage.Provider");g.isAIR&&function(){if(!e)var e={};e.File=window.runtime.flash.filesystem.File;e.FileStream=window.runtime.flash.filesystem.FileStream;e.FileMode=window.runtime.flash.filesystem.FileMode;g.declare("dojox.storage.AirFileStorageProvider",
[h.storage.Provider],{initialized:!1,_storagePath:"__DOJO_STORAGE/",initialize:function(){this.initialized=!1;try{var a=e.File.applicationStorageDirectory.resolvePath(this._storagePath);a.exists||a.createDirectory();this.initialized=!0}catch(c){}h.storage.manager.loaded()},isAvailable:function(){return!0},put:function(a,c,b,d){if(0==this.isValidKey(a))throw Error("Invalid key given: "+a);d=d||this.DEFAULT_NAMESPACE;if(0==this.isValidKey(d))throw Error("Invalid namespace given: "+d);try{this.remove(a,
d);var f=e.File.applicationStorageDirectory.resolvePath(this._storagePath+d);f.exists||f.createDirectory();var k=f.resolvePath(a),l=new e.FileStream;l.open(k,e.FileMode.WRITE);l.writeObject(c);l.close()}catch(m){b(this.FAILED,a,m.toString(),d);return}b&&b(this.SUCCESS,a,null,d)},get:function(a,c){if(0==this.isValidKey(a))throw Error("Invalid key given: "+a);c=c||this.DEFAULT_NAMESPACE;var b=null,d=e.File.applicationStorageDirectory.resolvePath(this._storagePath+c+"/"+a);if(d.exists&&!d.isDirectory){var f=
new e.FileStream;f.open(d,e.FileMode.READ);b=f.readObject();f.close()}return b},getNamespaces:function(){var a=[this.DEFAULT_NAMESPACE],c=e.File.applicationStorageDirectory.resolvePath(this._storagePath).getDirectoryListing(),b;for(b=0;b<c.length;b++)c[b].isDirectory&&c[b].name!=this.DEFAULT_NAMESPACE&&a.push(c[b].name);return a},getKeys:function(a){a=a||this.DEFAULT_NAMESPACE;if(0==this.isValidKey(a))throw Error("Invalid namespace given: "+a);var c=[];a=e.File.applicationStorageDirectory.resolvePath(this._storagePath+
a);if(a.exists&&a.isDirectory){a=a.getDirectoryListing();var b;for(b=0;b<a.length;b++)c.push(a[b].name)}return c},clear:function(a){if(0==this.isValidKey(a))throw Error("Invalid namespace given: "+a);a=e.File.applicationStorageDirectory.resolvePath(this._storagePath+a);a.exists&&a.isDirectory&&a.deleteDirectory(!0)},remove:function(a,c){c=c||this.DEFAULT_NAMESPACE;var b=e.File.applicationStorageDirectory.resolvePath(this._storagePath+c+"/"+a);b.exists&&!b.isDirectory&&b.deleteFile()},putMultiple:function(a,
c,b,d){if(!1===this.isValidKeyArray(a)||!c instanceof Array||a.length!=c.length)throw Error("Invalid arguments: keys \x3d ["+a+"], values \x3d ["+c+"]");if(null==d||"undefined"==typeof d)d=this.DEFAULT_NAMESPACE;if(0==this.isValidKey(d))throw Error("Invalid namespace given: "+d);this._statusHandler=b;try{for(var f=0;f<a.length;f++)this.put(a[f],c[f],null,d)}catch(k){b&&b(this.FAILED,a,k.toString(),d);return}b&&b(this.SUCCESS,a,null,d)},getMultiple:function(a,c){if(!1===this.isValidKeyArray(a))throw Error("Invalid key array given: "+
a);if(null==c||"undefined"==typeof c)c=this.DEFAULT_NAMESPACE;if(0==this.isValidKey(c))throw Error("Invalid namespace given: "+c);for(var b=[],d=0;d<a.length;d++)b[d]=this.get(a[d],c);return b},removeMultiple:function(a,c){c=c||this.DEFAULT_NAMESPACE;for(var b=0;b<a.length;b++)this.remove(a[b],c)},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");}});h.storage.manager.register("dojox.storage.AirFileStorageProvider",new h.storage.AirFileStorageProvider);h.storage.manager.initialize()}()});