var gdjs;(function(S){const f=new S.Logger("Storage");let d;(function(p){let h;(function(a){let c=null;try{typeof cc!="undefined"?c=cc.sys.localStorage:typeof window!="undefined"&&(c=window.localStorage)}catch(t){f.error("Unable to get access to the localStorage: "+t)}c||f.error("Storage actions won't work as no localStorage was found.");const u=new Hashtable;a.loadJSONFileFromStorage=t=>{if(u.containsKey(t))return;let i=null;try{c&&(i=c.getItem("GDJS_"+t))}catch(l){f.error('Unable to load data from localStorage for "'+t+'": '+l)}let o={};try{i&&(o=JSON.parse(i))}catch(l){f.error('Unable to load data from "'+t+'" - data is not valid JSON: '+l)}u.put(t,o)},a.unloadJSONFile=t=>{if(!u.containsKey(t))return;const i=u.get(t),o=JSON.stringify(i);try{c&&c.setItem("GDJS_"+t,o)}catch(l){f.error('Unable to save data to localStorage for "'+t+'": '+l)}u.remove(t)};const g=(t,i)=>{let o=!1;u.containsKey(t)||(o=!0,a.loadJSONFileFromStorage(t));const l=i(u.get(t));return o&&a.unloadJSONFile(t),l};a.clearJSONFile=t=>g(t,i=>{for(const o in i)i.hasOwnProperty(o)&&delete i[o];return!0}),a.elementExistsInJSONFile=(t,i)=>g(t,o=>{const l=i.split("/");let n=o;for(let e=0;eg(t,o=>{const l=i.split("/");let n=o;for(let e=0;eg(t,l=>{const n=i.split("/");let e=l;for(let r=0;rg(t,l=>{const n=i.split("/");let e=l;for(let r=0;rg(t,n=>{const e=i.split("/");let r=n;for(let s=0;sg(t,n=>{const e=i.split("/");let r=n;for(let s=0;s