;'use strict';(function(exports){var appMgr=navigator.mozApps.mgmt;var apps=null;window.performance.mark('homescreenStart@system.gaiamobile.org');appMgr.getAll().onsuccess=function onsuccess(event){apps=event.target.result;window.dispatchEvent(new CustomEvent('navigator-mozapps-ready'));};function ApplicationSource(store){this.store=store;this.entries=[];this.entriesByManifestUrl={};this.svPreviouslyInstalledApps=[];var pendingInstallRequests=[];function addSVEventListener(){window.addEventListener('singlevariant-ready',function svFileReady(ev){window.removeEventListener('singlevariant-ready',svFileReady);for(var i=0;isvApp.location){app.grid.moveTo(i,i-1);}}}} appMgr.oninstall=function oninstall(event){if(configurator.isSingleVariantReady){install.bind(this)(event.application);}else{pendingInstallRequests.push(install.bind(this,event.application));}}.bind(this);appMgr.onuninstall=function onuninstall(event){var application=event.application;var manifest=application.updateManifest||application.manifest;this.removeIconFromGrid(application.manifestURL);app.itemStore.deferredSave(app.grid.getItems());if(app.HIDDEN_ROLES.indexOf(manifest.role)!==-1){return;}}.bind(this);} ApplicationSource.prototype={synchronize:function(){var storeItems=this.store._allItems;var toAdd=[];var appIconsByManifestUrl={};for(var i=0,iLen=storeItems.length;i