Repository URL to install this package:
|
Version:
1.2.0-1346 ▾
|
!function(n){"use strict";n="default"in n?n.default:n;var e=require("fs"),t=require("path"),o=require("child_process");n.module("npm-api.service",[]).service("npm",["$rootScope","$log","errorsService",function(n,r,i){var a=this,c=function(e,i){return new Promise(function(a){var c=function(a,c,l){return new Promise(function(s,p){var u=[e,i].concat([a,c,l]).map(function(n){return"[object Object]"===Object.prototype.toString.call(n)?JSON.stringify(n):n}),d=o.fork(t.resolve(__dirname,"npm-runner.js"),u,{cwd:__dirname,silent:!0});d.stdout.on("data",function(n){r.info("stdout: "+n)}),d.stderr.on("data",function(n){p(n),r.error("stderr: "+n)}),d.on("close",function(e){n.$emit("npm:log:end",{type:a,message:e}),r.info("End of command "+a),r.info("child process exited with code "+e)}),d.on("message",function(e){a===e.type?s(e.payload):"log"===e.type?n.$emit("npm:log:log",{type:a,data:e.payload}):r.debug(e)})})};a({ping:function(){return c("ping")},launchInstall:function(){return c("launchInstall")},search:function(n){return c("search",n)},run:function(n){return c("run",n)},view:function(n){return c("view",n)},build:function(n){return c("build",n)},rebuild:function(){return c("rebuild")},install:function(n,e){return c("install",n,e)},installLatest:function(n){return c("installLatest",n)},update:function(n){return c("update",n)},rm:function(n){return c("rm",n)},listOutdated:function(){return c("listOutdated")},outdated:function(){return c("outdated")},prune:function(){return c("prune")},dedupe:function(){return c("dedupe")},list:function(){return c("list")},shrinkwrap:function(){return c("shrinkwrap")},doctor:function(){return c("doctor")},root:function(){return c("root")}})})},l=function(){return new Promise(function(n){o.exec("npm -v",function(e,t,o){var i=void 0;r.warn(e,o),t&&t.length>0&&(i=t.toString()),n(i)})})},s=function(){return new Promise(function(n,e){o.exec("npm -v",function(t){t?e(t):n()})})},p=function(){return new Promise(function(n,e){return navigator.onLine?c("").then(function(t){return t.ping().then(n).catch(e)}).catch(function(n){r.warn("Ping registry",n),e(n)}):(r.warn("You are offline: unable to ping registry."),e())})},u=function(){return new Promise(function(n){a.npmGlobal().catch(function(n){return i.showErrorBox("Npm error","Error during configuring npm for asking the globally installed version: "+n)}).then(function(e){return e.outdated().then(n).catch(function(n){return i.showErrorBox("Npm error","Error asking the globally installed version: "+n)})})})};this.updateNpmGlobally=function(){var e={name:"npm"};return new Promise(function(t,o){a.npmGlobal().catch(function(n){return i.showErrorBox("Npm error","Error configuring npm for installing latest "+e.name+": "+n+" ")}).then(function(r){n.$emit("npm:log:start"),r.installLatest(e).then(function(){n.$emit("npm:log:stop"),t()}).catch(function(e){n.$emit("npm:log:stop"),o(e)})})})},n.$on("dom:ready",function(){r.info("DOM is ready for npm"),process.env.PATH=require("shell-path").sync(),o.exec("npm root -g",function(t,o,i){if(t||i)throw new Error(t||i);var l=o.replace("/lib/node_modules","").replace("\\lib\\node_modules","").trim(),s="";a.npmGlobal=function(){return c(l,!0)},process.platform&&"win32"!==process.platform&&(s="/lib/node_modules"),e.stat(""+l+s,function(e,t){return e&&r.error(e),"win32"===process.platform?(e&&n.$apply(function(n){n.$emit("npm:global-privilege-check",{user:-1,processUser:1,group:-1,processGroup:1})}),n.$apply(function(n){n.$emit("npm:global-privilege-check",{user:1,processUser:1,group:1,processGroup:1})})):n.$apply(function(n){n.$emit("npm:global-privilege-check",{user:t.uid,processUser:process.getuid(),group:t.gid,processGroup:process.getgid()})})}),n.$emit("npm:ready")})}),this.npmInFolder=c,this.outdatedGlobalVersion=u,this.getNpmVersion=l,this.isNpmGloballyInstalled=s,this.pingRegistry=p}]);var r=require("electron"),i=r.ipcRenderer,a=r.shell,c=r.remote,l=c.dialog,s=require("fs");n.module("npm-ui.shell",["npm-api.service"]).controller("ShellController",["$rootScope","$scope","$log","$document","npm","npmGlobal","errorsService","loadingFactory","notificationFactory","assets",function(n,e,t,o,r,p,u,d,f,h){var m=this,g=function(t){var o=void 0;o=process&&"win32"===process.platform?"\\":"/",t&&t.length>0&&e.$apply(function(){t.forEach(function(e){if(e){var r=e,i=m.projects.some(function(n){return n.path&&n.path===r}),a=r.substring(r.lastIndexOf(o)+1);if(!i){var c={dirName:a,path:r};m.projects.unshift(c),h.projects.save(m.projects)}e&&t[0]&&!t[1]&&n.$emit("left-bar:select-project",{path:r})}})})},y=n.$on("npm:ready",function(){r.isNpmGloballyInstalled().then(function(){m.checkRegistryStatus(),m.updateNpmBadgeVersion()}).catch(function(n){l.showMessageBox({title:"npm not installed",defaultId:2,message:"You have not installed npm on your machine.",detail:""+n,buttons:["Quit","Relaunch","Cancel"]},function(n){0===n&&c.app.quit(),1===n&&(c.app.relaunch(),c.app.quit())})})}),v=n.$on("left-bar:edit-project",function(){e.$evalAsync(function(){m.activeLink=void 0})}),b=n.$on("left-bar:open-project-history",function(){e.$evalAsync(function(){m.activeLink=void 0})}),w=i.on("menu:add-project-folder",function(){m.openChooser()}),$=n.$on("shell:file-drop",function(n,e){if(e&&e.dataTransfer&&e.dataTransfer.files){var t=[],o=e.dataTransfer.files;Object.keys(o).forEach(function(n){s.lstatSync(o[n].path).isDirectory()&&t.push(o[n].path)}),t&&t.length&&g(t)}}),k=n.$on("npm:global-privilege-check",function(n,e){try{e.user===e.processUser||e.group===e.processGroup?(t.info("Global is enabled"),m.globalDisabled=!1):(t.info("Global is disabled"),m.globalDisabled=!0)}catch(n){t.info("Global is disabled but there is a problem...",n),m.globalDisabled=!0}}),j=n.$on("left-bar:shrinkwrap-project",function(n,e){var o=m.projects;e&&e.project&&e.project.path&&m.projects.length>0?(o.forEach(function(n,t){n.path===e.project.path&&(m.projects[t].shrinkwrap=!0)}),h.projects.save(m.projects),t.info("Shrinkwrapped project saved",e)):t.warn("Shrinkwrap saving project event fired BUT projects array is empty!")}),E=n.$on("left-bar:unshrinkwrap-project",function(n,o){var r=m.projects;o&&o.project&&o.project.path&&m.projects.length>0?(r.forEach(function(n,t){n.path===o.project.path&&e.$apply(function(){m.projects[t].shrinkwrap=!1})}),h.projects.save(m.projects),t.info("Unshrinkwrapped project saved",o)):t.warn("UnShrinkwrap saving project event fired BUT projects array is empty!")}),P=n.$on("left-bar:delete-project",function(n,e){var o=m.projects;e&&e.project&&e.project.path&&m.projects.length>0?(o.forEach(function(n,t){n.path===e.project.path&&m.projects.splice(t,1)}),h.projects.save(m.projects),t.info("Deleted project folder",e)):t.warn("Delete project event fired BUT projects array is empty!")});this.projects=h.projects,this.enableGlobal=function(){var n=["Cancel","Read Tutorial","Quit"];l.showMessageBox({title:"Global Access",defaultId:0,message:"ndm wants to access your global folder",detail:'FIX NPM PERMISSIONS\n\n1) Follow the tutorial at:\nhttps://docs.npmjs.com/getting-started/fixing-npm-permissions\n\n2) Restart your terminal and run "npm outdated -g"\nwithout "sudo".\n\n3) If no errors in your terminal then quit and reopen ndm.\n',buttons:n},function(n){1===n&&m.openBrowserLink("https://docs.npmjs.com/getting-started/fixing-npm-permissions#option-1-change-the-permission-to-npms-default-directory"),2===n&&c.app.quit()})},this.updateNpm=function(){m.updatingNpm?m.activeClickedLink("update"):l.showMessageBox({title:"Update npm",type:"question",message:"Update npm",defaultId:0,detail:"Are you sure you want to update npm globally?",buttons:["Cancel","Yes"]},function(e){1===e&&(m.activeClickedLink("update"),m.updatingNpm=!0,r.updateNpmGlobally().then(function(){n.$emit("shell:updated-npm"),f.notify("Finished updating npm."),m.updateNpmBadgeVersion(),m.updatingNpm=void 0}).catch(function(n){m.updatingNpm=void 0,u.handleError("Error updating npm...",n)}))})},this.runDoctor=function(){m.runningDoctor||(m.finishedRunningDoctor=!1,m.runningDoctor=!0,r.npmInFolder("").then(function(n){return n.doctor().then(function(n){e.$apply(function(){m.doctorLog=n.map(function(n){return n.map(function(n){return n.replace(/\[\d\dm/g,"")})}),m.runningDoctor=void 0,m.finishedRunningDoctor=!0}),t.info("npm doctor:",n),f.notify("Finished running doctor.")})}).catch(function(n){t.error("npm doctor error:",n),e.$apply(function(){m.runningDoctor=void 0,m.finishedRunningDoctor=!0})}))},this.activeClickedLink=function(e){"1"!==e&&"4"!==e||m.activeLink!==e?(m.activeLink=e,n.$emit("top-bar:active-link",{link:e})):m.activeLink=!1},this.openChooser=function(){l.showOpenDialog({properties:["openDirectory","createDirectory","multiSelections"]},function(n){g(n)})},this.openBrowserLink=function(n){a.openExternal(n)},this.checkRegistryStatus=function(){m.loadingRegistryStatus||(m.loadingRegistryStatus=!0,r.pingRegistry().then(function(){e.$apply(function(){m.registryStatus=!0,m.loadingRegistryStatus=!1})}).catch(function(n){e.$apply(function(){m.registryStatus=!1,m.loadingRegistryStatus=!1}),t.error("Unable to ping registry for checking status",n)}))},this.updateNpmBadgeVersion=function(){m.updatingVersionBadge||(m.updatingVersionBadge=!0,r.outdatedGlobalVersion().then(function(n){if(n&&n.length>0){var t=n.filter(function(n){return"npm"===n.name}).reduce(function(n,e){if("name"===e.name)return e});e.$apply(function(){m.npmLatestVersionBadge=t.latest||void 0,m.npmCurrentVersionBadge=t.current||void 0,m.updatingVersionBadge=!1})}else r.getNpmVersion().then(function(n){e.$apply(function(){m.npmLatestVersionBadge=n||void 0,m.npmCurrentVersionBadge=n||void 0,m.updatingVersionBadge=!1})})}))},n.$on("$destroy",function(){y(),v(),b(),w(),k(),P(),E(),j(),$()})}]);var p=require("fs"),u=require("path");n.module("npm-ui.content",["npm-api.service"]).controller("ContentController",["$rootScope","$scope","$log",function(n,e,t){var o=this,r=n.$on("left-bar:delete-project",function(n,e){e&&e.project&&e.project.path&&o.closeProjectTab(e.project.path)}),i=n.$on("left-bar:select-project",function(n,e){t.info("Selected project payload",e),e&&!o.tabs.includes(e.path)?(o.tabs.unshift(e.path),o.activeTab=o.tabs[0]?o.tabs[0]:void 0):o.activeTab=o.tabs[o.tabs.indexOf(e.path)]});this.closeProjectTab=function(n){n&&o.tabs.includes(n)&&(o.tabs.splice(o.tabs.indexOf(n),1),o.activeTab=o.tabs[0]?o.tabs[0]:void 0)},this.tabs=[],e.$on("$destroy",function(){i(),r()})}]).directive("npmTabs",["$rootScope","$log","npmGlobal","npm","errorsService","loadingFactory","notificationFactory",function(n,e,t,o,r,i,a){return function(i,c,l){var s=l.npmTabId,d=n.$on("left-bar:select-project",function(n,e){e&&e.path&&e.path===s&&i.listPackages()}),f=n.$on("content:selected-package-info",function(n,e){e&&e.info?i.$apply(function(){i.selectedPackageViewInfos=e.info}):i.$apply(function(){i.selectedPackageViewInfos=!1})}),h=n.$on("content:installing-version-package",function(){i.$apply(function(){i.showLoadingSelectedRow=!1})}),m=n.$on("content:installing-version-package-error",function(){i.$apply(function(){i.showLoadingSelectedRow=!1})}),g=n.$on("left-bar:delete-selected-project",function(){i.packageInformations=[],i.goBackHome=!0});i.installPackage=function(n,c){if(n&&n.length>0&&!i.performingAction){i.performingAction=!0,i.installingPackage=!0;var l=Promise.resolve(),d=void 0,f=void 0,h=function(){n.forEach(function(n){l=l.then(function(){return f.catch(function(e){r.showErrorBox("Error","Configuring npm for installing "+n.name+"...",e)}).then(function(t){return e.info("Now installing "+n.name+"..."),t.install({name:n.name,kind:d},n.version).then(function(){e.info("Installed "+n.name+"...")}).catch(function(e){r.showErrorBox("Error","Installing "+n.name+": "+e)})})})}),l.then(function(){i.$apply(function(){i.performingAction=!1,i.installingPackage=!1}),e.info("Finished installing packages."),a.notify("Finished installing packages."),i.listPackages()}).catch(function(n){i.$apply(function(){i.performingAction=!1,i.installingPackage=!1}),r.handleError("Error installing packages.",n),i.listPackages()})};c&&(d="dev"),f=s===t?o.npmGlobal():o.npmInFolder(s),s===t?h():p.readFile(u.join(s,"package.json"),"utf8",function(n,t){n||!t||t&&JSON.parse(t).length<=0&&"{}"!==t?(e.info("Writing a package.json file in folder "+s),p.writeFile(u.join(s,"package.json"),'{"name": "ndm-created-project", "description": "add-a-description", "license": "add-a-license", "respository": "add-a-repository"}',function(n){n?(h(),e.warn("Unable to create package.json in: "+s)):(h(),e.info("Initialized a package.json file in "+s))})):h()})}},i.updatePackage=function(n){if(!i.performingAction){i.performingAction=!0;var c=Promise.resolve(),l=void 0;l=s===t?o.npmGlobal():o.npmInFolder(s),n.forEach(function(n){c=c.then(function(){return l.then(function(t){return e.info("Preparing to update "+n.name+"..."),t.update(n).then(function(){e.info("Updated "+n.name+"...")}).catch(function(e){r.handleError("Error updating "+n.name+"...",e)})}).catch(function(e){r.handleError("Error preparing to update "+n.name+"...",e)})})}),i.showLoadingSelectedRow=!0,c.then(function(){a.notify("Finished updating selected packages."),e.info("Updated all the selected packages."),i.$apply(function(){i.performingAction=!1,i.showLoadingSelectedRow=!1}),i.listPackages()}).catch(function(n){i.$apply(function(){i.performingAction=!1,i.showLoadingSelectedRow=!1}),i.listPackages(),r.handleError("Error updating package.",n)})}},i.installLatest=function(n){if(!i.performingAction){i.performingAction=!0;var c=void 0,l=Promise.resolve();c=s===t?o.npmGlobal():o.npmInFolder(s),n.forEach(function(n){l=l.then(function(){return c.then(function(t){return e.info("Preparing to update latest "+n.name+"..."),t.installLatest(n).then(function(){e.info("Updated to latest "+n.name+"...")}).catch(function(e){r.handleError("Error updating to latest "+n.name+"...",e)})}).catch(function(e){r.handleError("Error preparing to update to latest "+n.name+"...",e)})})}),i.showLoadingSelectedRow=!0,l.then(function(){i.$apply(function(){i.showLoadingSelectedRow=!1,i.performingAction=!1}),e.info("Updated all the selected packages to latest versions."),a.notify("Updated all the selected packages to latest versions."),i.listPackages()}).catch(function(n){i.$apply(function(){i.showLoadingSelectedRow=!1,i.performingAction=!1}),i.listPackages(),r.handleError("Error updating to latest package version.",n)})}},i.uninstallPackage=function(n){if(!i.performingAction){i.performingAction=!0,i.showLoadingSelectedRow=!0;var c=Promise.resolve(),l=void 0;l=s===t?o.npmGlobal():o.npmInFolder(s),n.forEach(function(n){c=c.then(function(){return l.then(function(o){return e.info("Preparing to uninstall "+n.name+"..."),o.rm(n).then(function(){if(s!==t)return e.info("Uninstalled "+n.name+" now pruning..."),o.prune().then(function(){e.info("Uninstalled and Pruned "+n.name+"...")});e.info("Uninstalled "+n.name+" from globals...")}).catch(function(e){r.handleError("Error uninstalling "+n.name+"...",e)})}).catch(function(e){r.handleError("Error preparing to uninstall "+n.name+"...",e)})})}),c.then(function(){i.$apply(function(){i.showLoadingSelectedRow=!1,i.performingAction=!1}),i.listPackages(),e.info("Uninstalled all the selected packages."),a.notify("Uninstalled all the selected packages.")}).catch(function(n){i.$apply(function(){i.showLoadingSelectedRow=!1,i.performingAction=!1}),i.listPackages(),r.handleError("Error uninstalling package.",n)})}},i.installVersionPackage=function(e,c){if(c&&!i.performingAction){i.performingAction=!0,i.installingPackageVersion=!0;var l=void 0;l=s===t?o.npmGlobal():o.npmInFolder(s),n.$emit("content:installing-version-package"),l.catch(function(t){i.installingPackageVersion=!1,i.performingAction=!1,n.$emit("content:installing-version-package-error"),i.listPackages(),r.showErrorBox("Error","Error configuring npm for installing "+e.name+": "+t)}).then(function(t){t.install(e,c).then(function(){i.installingPackageVersion=!1,i.performingAction=!1,a.notify("Finished installing "+e.name+"@"+c),i.listPackages()}).catch(function(t){i.$apply(function(){i.installingPackageVersion=!1,i.performingAction=!1}),n.$emit("content:installing-version-package-error"),i.listPackages(),r.showErrorBox("Error","Error installing "+e.name+"@"+c+": "+t)})})}},i.loadPackagesInfos=function(t){i.packageViewInfos=!1,i.selectedPackageViewInfos=!1,o.npmInFolder("/").then(function(o){o.view(t).then(function(o){try{i.$apply(function(){i.packageViewInfos=o[Object.keys(o)[0]]})}catch(n){i.$apply(function(){i.packageViewInfos=!1}),e.warn(n)}n.$emit("content:selected-package-info",{package:t,info:i.packageViewInfos})}).catch(function(n){i.$apply(function(){i.packageViewInfos=!1}),e.warn("Problem with npm view "+t+" in folder /",n)})}).catch(function(n){i.$apply(function(){i.packageViewInfos=!1}),e.warn("Problem configuring npm for $ npm view "+t+" in folder /",n)})},i.selectPackages=function(n){i.currentSelectedPackages=n,i.showMenuButtons=!0,i.showSpecificVersionPrompt=!1,i.showInstallPrompt=!1,i.loadPackagesInfos(n[0].name)},i.sortTableBy=function(n){i.tableOrderBy.includes(n)||i.tableOrderBy.includes("-"+n)?i.tableOrderBy.includes(n)&&!i.tableOrderBy.includes("-"+n)?(i.tableOrderBy.splice(i.tableOrderBy.indexOf(n),1),i.tableOrderBy.unshift("-"+n)):i.tableOrderBy.includes("-"+n)&&i.tableOrderBy.splice(i.tableOrderBy.indexOf(n),1):i.tableOrderBy.unshift(n)},i.listPackages=function(){if("function"==typeof o.npmGlobal&&"function"==typeof o.npmInFolder){i.$evalAsync(function(){i.loading=!0,i.loaded=!1,i.goBackHome=!1,i.showLoadingSelectedRow=!1,i.packageViewInfos=!1,i.packageInformations=[],i.currentSelectedPackages=[],i.showMenuButtons=!1});var n=void 0;s===t?(i.isGlobalProject=!0,n=o.npmGlobal()):(i.isGlobalProject=!1,n=o.npmInFolder(s)),n.then(function(n){return n.listOutdated().then(function(n){i.$apply(function(){i.packageInformations=n,i.tableOrderBy=["name"],i.loaded=!0,i.loading=!1})}).catch(function(n){i.$apply(function(){i.packageInformations=!1,i.loaded=!0,i.loading=!1}),e.error(n)})}).catch(function(n){i.$apply(function(){i.packageInformations=!1,i.loaded=!0,i.loading=!1}),e.error("Error on npmPomise, content.js: "+n)})}else e.error("npm.npmGlobal or npm.infolder are not functions ready probably :/ :/ !? :/ content.js")},i.selectedPackages=[],s?i.listPackages():e.error("Path for tab identifier is missing"),i.$on("$destroy",function(){h(),m(),d(),g(),f()})}}]);var d=require("electron"),f=d.remote,h=d.shell,m=d.clipboard,g=f.Menu,y=f.MenuItem,v=require("electron-storage"),b=require("fs"),w=require("path"),$=require("rimraf");n.module("npm-ui.left-bar",[]).controller("LeftBarController",["$rootScope","$scope","$window","$filter","$log","npm","npmGlobal","errorsService","loadingFactory","notificationFactory","appHistoryFile",function(n,e,t,o,r,i,a,c,l,s,p){var u=this,d=n.$on("top-bar:active-link",function(n,t){t&&t.link&&e.$evalAsync(function(){u.editorFilePath=!1,u.editorFileName=!1,u.showHistoryPrompt=!1})}),k=n.$on("left-bar:edit-project",function(n,t){e.$apply(function(){u.editorFilePath=t.dirName,u.editorFileName=t.fileName,u.showHistoryPrompt=!1})}),j=n.$on("left-bar:selected-project-npm-unshrinkwrap",function(e,t){var o=t.path.path,i=t.path.dirName;$(w.join(o,"npm-shrinkwrap.json"),function(e){if(e)return c.showErrorBox("Warning","Error deleting npm-shrinkwrap.json in folder "+o+": \n"+e);n.$emit("left-bar:unshrinkwrap-project",{project:t.path}),r.info("Removed npm-shrinkwrap.json in project "+o),s.notify("Removed npm-shrinkwrap.json in project "+i)})}),E=n.$on("left-bar:selected-project-npm-shrinkwrap",function(t,o){var a=o.path.path,l=o.path.dirName,p=function(n){e.$apply(function(){u.deleteShrinkwrappingProjects(n)})};e.$apply(function(){u.npmShrinkwrappingProjects[l]=!0}),i.npmInFolder(a).catch(function(n){p(l),r.error("Configuring npm for $ npm shrinkwrap, in "+a+"...",n),c.handleError("Error","Error configuring npm for shrinkwrap in folder "+a+": "+n)}).then(function(e){e.shrinkwrap().then(function(){n.$emit("left-bar:shrinkwrap-project",{project:o.path}),r.info("Finished npm shrinkwrap in project "+a),s.notify("Finished $ npm shrinkwrap in project "+l),p(l)}).catch(function(n){p(l),r.error(n),c.showErrorBox("Error","Error running $ npm shrinkwrap in folder "+a+": "+n)})})}),P=n.$on("left-bar:selected-project-npm-reinstall",function(n,t){var o=t.path.path,a=t.path.dirName,l=function(n){e.$apply(function(){u.deleteReinstallingProjects(n)})};e.$apply(function(){u.npmReinstallingProjects[a]=!0}),$(w.join(o,"node_modules"),function(n){if(n)return l(a),c.showErrorBox("Warning",'Error deleting "node_modules" in project '+o+" for re-installation: \n"+n);i.npmInFolder(o).catch(function(n){l(a),r.error("Configuring npm for re-installation, in "+o+"...",n),c.handleError("Error","Error configuring npm for clean installation in folder "+o+": "+n)}).then(function(n){n.launchInstall().then(function(){r.info("Finished re-installation in project "+o),s.notify("Finished re-installation in project "+a),l(a)}).catch(function(n){l(a),r.error(n),c.showErrorBox("Error","Error running $ npm install for clean installation in folder "+o+": "+n)})})})}),S=n.$on("left-bar:selected-project-npm-install",function(n,t){var o=t.path.path,a=t.path.dirName,l=function(n){e.$apply(function(){u.deleteInstallingProjects(n)})};e.$apply(function(){u.npmInstallingProjects[a]=!0}),i.npmInFolder(o).catch(function(n){l(a),r.error("Configuring npm for $ npm install, in "+o+"...",n),c.handleError("Error","Error configuring npm for install in folder "+o+": "+n)}).then(function(n){n.launchInstall().then(function(){r.info("Finished npm install in project "+o),s.notify("Finished $ npm install in project "+a),l(a)}).catch(function(n){l(a),r.error(n),c.showErrorBox("Error","Error running $ npm install in folder "+o+": "+n)})})}),F=n.$on("left-bar:selected-project-npm-prune",function(n,t){var o=t.path.path,a=t.path.dirName,l=function(n){e.$apply(function(){u.deletePruningProjects(n)})};e.$apply(function(){u.npmPruningProjects[a]=!0}),i.npmInFolder(o).catch(function(n){l(a),r.error("Configuring npm for $ npm prune, in "+o+"...",n),c.handleError("Error","Error configuring npm for prune in folder "+o+": "+n)}).then(function(n){n.prune().then(function(){r.info("Finished npm prune in project "+o),s.notify("Finished $ npm prune in project "+a),l(a)}).catch(function(n){l(a),r.error(n),c.showErrorBox("Error","Error running $ npm prune in folder "+o+": "+n)})})}),N=n.$on("left-bar:selected-project-npm-dedupe",function(n,t){var o=t.path.path,a=t.path.dirName,l=function(n){e.$apply(function(){u.deleteDedupingProjects(n)})};e.$apply(function(){u.npmDedupingProjects[a]=!0}),i.npmInFolder(o).catch(function(n){l(a),r.error("Configuring npm for $ npm dedupe, in "+o+"...",n),c.handleError("Error","Error configuring npm for dedupe in folder "+o+": "+n)}).then(function(n){n.dedupe().then(function(){r.info("Finished npm dedupe in project folder "+o),s.notify("Finished $ npm dedupe in project "+a),l(a)}).catch(function(n){r.error(n),c.showErrorBox("Error","Error running $ npm dedupe in folder "+o+": "+n),l(a)})})}),I=n.$on("left-bar:selected-project-npm-build",function(n,t){var o=t.path.path,a=t.path.dirName,l=function(n){e.$apply(function(){u.deleteBuildingProjects(n)})};e.$apply(function(){u.npmBuildingProjects[a]=!0}),i.npmInFolder(o).catch(function(n){l(a),r.error("Configuring npm for $ npm build, in "+o+"...",n),c.handleError("Error","Error configuring npm for build in folder "+o+": "+n)}).then(function(n){n.build(o).then(function(){r.info("Finished npm build in project folder "+o),s.notify("Finished $ npm build in project "+a),l(a)}).catch(function(n){r.error(n),c.showErrorBox("Error","Error running $ npm build in folder "+o+": "+n),l(a)})})}),B=n.$on("left-bar:selected-project-npm-run-script",function(n,t){var o=function(n,t){try{e.$apply(function(){u.deleteRunningScript(n,t)})}catch(n){r.warn(n)}};t&&t.dirName&&t.script&&t.scriptName&&e.$apply(function(){u.npmRunningScriptsProject[t.dirName]||(u.npmRunningScriptsProject[t.dirName]=[]),u.npmRunningScriptsProject[t.dirName]&&-1===u.npmRunningScriptsProject[t.dirName].indexOf(t.scriptName)&&(u.npmRunningScriptsProject[t.dirName].push(t.scriptName),i.npmInFolder(t.dirName,t.scriptName).catch(function(n){o(t.dirName,t.scriptName),r.error("Error configuring npm for $ npm run "+t.scriptName+", in folder "+t.dirName+"...",n),c.handleError("Error","Error configuring npm for run "+t.scriptName+" in folder "+t.dirName+":\n"+n)}).then(function(n){r.info("Going to launch: npm run "+t.scriptName,"in folder "+t.dirName),n.run(t.scriptName).then(function(){r.info("Finished running: npm run "+t.scriptName,"in folder: "+t.dirName),s.notify("Finished $ npm run "+t.scriptName+" in project "+t.dirName),o(t.dirName,t.scriptName)}).catch(function(n){o(t.dirName,t.scriptName),c.showErrorBox("Error",'Error running script "'+t.scriptName+'" in folder '+t.dirName+":\n"+n),r.error('Error running script "'+t.scriptName+'" in folder '+t.dirName+":\n"+n)})}).catch(function(n){o(t.dirName,t.scriptName),r.error(n),c.showErrorBox("Error","Error running $ npm run "+t.scriptName+" in folder "+t.dirName+": "+n)}))})});this.deleteRunningScript=function(n,e){u.npmRunningScriptsProject[n].splice(u.npmRunningScriptsProject[n].indexOf(e),1)},this.deleteBuildingProjects=function(n){delete u.npmBuildingProjects[n]},this.deleteShrinkwrappingProjects=function(n){delete u.npmShrinkwrappingProjects[n]},this.deleteInstallingProjects=function(n){delete u.npmInstallingProjects[n]},this.deleteReinstallingProjects=function(n){delete u.npmReinstallingProjects[n]},this.deleteDedupingProjects=function(n){delete u.npmDedupingProjects[n]},this.deletePruningProjects=function(n){delete u.npmPruningProjects[n]},this.deleteSnapshot=function(){var n=u.rightClickedProject.path,t=u.selectedSnapshot;v.get(p,function(o,r){if(o)c.showErrorBox("Error","Error retrieving snapshots: "+o);else{var i=void 0;r[n].forEach(function(n,e){n.datetime===t.datetime&&(i=e)}),r[n].splice(i,1),r[n].length<=0&&delete r[n],e.$apply(function(){u.projectHistory=r[n]||[]}),v.set(p,r,function(n){o&&c.showErrorBox("Error","Error deleting snapshot: "+n)})}})},this.restoreSnapshot=function(){var n=u.rightClickedProject.path,t=u.selectedSnapshot,o=u.rightClickedProject.path,a=function(){e.$apply(function(){u.restoredSnapshot[o]=!0,u.restoringSnapshot[o]=!1})};u.restoringSnapshot=u.restoringSnapshot||[],u.restoredSnapshot=u.restoredSnapshot||[],u.restoredSnapshot[o]=!1,u.restoringSnapshot[o]=!0,v.get(p,function(e,o){if(e)c.showErrorBox("Error","Error retrieving snapshots: "+e),a();else{var l=void 0;o[n].forEach(function(n,e){n.datetime===t.datetime&&(l=e)}),b.writeFileSync(w.join(t.path,"package.json"),o[n][l].status,{flag:"w"},"utf8"),$(w.join(t.path,"node_modules"),function(e){e&&c.showErrorBox("Warning","Error deleting node_modules/ in folder "+t.path+", going to run a simple $ npm install but that's not a clean reinstallation: \n"+e),i.npmInFolder(t.path).catch(function(e){r.error("Error configuring npm for $ npm install to restore snapshot, in folder "+t.path+"...",e),c.handleError("Error","Error configuring npm for install in folder "+t.path+" for restoring snapshot: "+e),u.restoringSnapshot[n]=!1}).then(function(n){n.launchInstall().then(function(){a(),r.info("Restored snapshot in project "+t.path),s.notify("Restored snapshot in folder: "+t.path)}).catch(function(n){a(),r.error("Error npm install (restoring snapshot) in folder "+t.path+": "+n),c.showErrorBox("Error","Something went wrong in folder "+t.path+" while restoring the snapshot. \n"+n)})}).catch(function(n){a(),r.error(n),c.showErrorBox("Error","Error running $ npm install in folder "+t.path+" for restoring snapshot: "+n)})})}})},this.createSnapshot=function(n){var t=o("date")(new Date,"medium"),r=function(){try{return b.readFileSync(w.join(n.path,"package.json")).toString()}catch(e){return c.showErrorBox("Error","No package.json found in folder "+n.path)}}(),i=r;n&&n.path&&v.get(p,function(o,r){if(o)c.showErrorBox("Error","Error creating snapshot: "+o);else{var a=r||{},l=n.path,s=n.path;a&&a[l]?a[l].push({datetime:t,status:i,path:s}):a[l]=[{datetime:t,status:i,path:s}],v.set(p,a,function(t){t?c.showErrorBox("Error","Error creating "+n.dirName+" project snapshot: "+t):e.$apply(function(){u.projectHistory=a[l]})})}})},this.openHistoryPrompt=function(t){n.$emit("left-bar:open-project-history",{project:t}),v.get(p,function(n,o){n&&c.showErrorBox("Error","Error retrieving snapshots: "+n),u.projectHistory=o[t.path],e.$apply(function(){u.showHistoryPrompt=!0,u.editorFilePath=!1})})},this.rightClickMenu=function(t){try{var o=JSON.parse(b.readFileSync(w.join(t.path,"package.json")));t.scripts=o.scripts}catch(n){r.warn("No scripts found in package.json for "+t.path,n)}var i=new g,a=u.createSnapshot,c=u.openHistoryPrompt,l=t,s=[];u.rightClickedProject=t,i.append(new y({label:""+t.dirName,enabled:!1})),i.append(new y({label:"Install",click:function(){n.$emit("left-bar:selected-project-npm-install",{path:t})}})),i.append(new y({label:"Reinstall",click:function(){n.$emit("left-bar:selected-project-npm-reinstall",{path:t})}})),i.append(new y({type:"separator"})),i.append(new y({label:"Build",click:function(){n.$emit("left-bar:selected-project-npm-build",{path:t})}})),i.append(new y({type:"separator"})),i.append(new y({label:"Prune",click:function(){n.$emit("left-bar:selected-project-npm-prune",{path:t})}})),i.append(new y({label:"Dedupe",click:function(){n.$emit("left-bar:selected-project-npm-dedupe",{path:t})}})),i.append(new y({label:"Shrinkwrap",click:function(){n.$emit("left-bar:selected-project-npm-shrinkwrap",{path:t})}})),i.append(new y({label:"Unshrinkwrap",click:function(){n.$emit("left-bar:selected-project-npm-unshrinkwrap",{path:t})}})),t.scripts&&(Object.keys(t.scripts).forEach(function(e){s.push({label:e,click:function(){n.$emit("left-bar:selected-project-npm-run-script",{dirName:""+t.path,script:t.scripts[e].toString(),scriptName:e})}})}),i.append(new y({type:"separator"})),i.append(new y({label:"Run script",submenu:s,click:function(){}}))),i.append(new y({type:"separator"})),i.append(new y({label:"Snapshot",click:function(){a(t)}})),i.append(new y({label:"History",click:function(){c(t)}})),i.append(new y({label:"Edit",submenu:[{label:"package.json",click:function(){n.$emit("left-bar:edit-project",{dirName:w.join(t.path,"package.json"),fileName:"package.json"})}},{label:".npmrc",click:function(){n.$emit("left-bar:edit-project",{dirName:w.join(t.path,".npmrc"),fileName:".npmrc"})}}]})),i.append(new y({label:"Remove",click:function(){var o=this;e.$evalAsync(function(){o.removedProject=t,t===l&&n.$emit("left-bar:delete-selected-project")}),n.$emit("left-bar:delete-project",{project:t})}})),i.append(new y({type:"separator"})),i.append(new y({label:"Copy Full Path",click:function(){m.write({text:t.path})}})),i.append(new y({label:"Open Folder",click:function(){h.showItemInFolder(t.path)}})),i.popup(f.getCurrentWindow())},this.selectProject=function(e,t){e&&(u.global=!1,u.selectedProject=e,n.$emit("left-bar:select-project",{path:u.selectedProject.path})),t.stopPropagation()},this.selectGlobal=function(){u.selectedProject=a,u.global=!0,n.$emit("left-bar:select-project",{path:a,isGlobal:!0})},this.deleteProject=function(e,t){l.finished(),e&&(e===u.selectedProject&&(delete u.selectedProject,n.$emit("left-bar:delete-selected-project")),n.$emit("left-bar:delete-project",{project:e})),t.stopPropagation()},this.npmInstallingProjects=[],this.npmReinstallingProjects=[],this.npmBuildingProjects=[],this.npmPruningProjects=[],this.npmDedupingProjects=[],this.npmRunningScriptsProject=[],this.npmShrinkwrappingProjects=[],e.$on("$destroy",function(){E(),j(),S(),P(),F(),N(),I(),B(),k(),d()})}]);n.module("npm-ui.top-menu",[]).directive("topMenu",["$document","$rootScope","$log","$timeout","npm",function(n,e,t,o,r){return function(n,i,a){var c=void 0,l=void 0,s=a.topMenuProjectPathId
;n.destroyActiveClickedLink=function(){n.activeLink=void 0},n.activeClickedLink=function(t){"1"!==t&&"4"!==t||n.activeLink!==t?(n.activeLink=t,e.$emit("top-bar:active-link",{link:t})):n.activeLink=!1},n.search=function(e){t.info("search",e),e&&e.trim()!==l?(c&&o.cancel(c),l=e,c=o(function(){n.searchingNpm=!0,n.searchResults=[],r.npmInFolder(s).then(function(o){o.search(e).then(function(e){n.$apply(function(){n.searchingNpm=!1,n.searchResults=e})}).catch(function(e){n.$apply(function(){n.searchingNpm=!1,n.searchResults=[]}),t.error("SEARCH ERROR",e)})})},500)):(n.searchingNpm=!1,n.searchResults=[])},n.searchChoosePackage=function(o){n.$evalAsync(function(){n.packageName[n.packageName.length-1].name=o,n.searchResults=[],t.warn(o,n.packageName),e.$emit("top-menu:search-choosen-package",{data:n.packageName,tabPath:s})})},n.hideInstallPrompt=function(){n.showInstallPrompt=!1},n.hideInstallVersionPrompt=function(){n.showSpecificVersionPrompt=!1}}}]);n.module("npm-ui.ng-right-click",[]).directive("ngRightClick",["$parse",function(n){return function(e,t,o){t.on("contextmenu",function(t){e.$apply(function(){t.preventDefault(),n(o.ngRightClick)(e,{$event:t})})})}}]);n.module("npm-ui.ng-drag-drop",[]).directive("ngDragDrop",["$rootScope",function(n){return function(e,t){t.on("drop",function(e){e.preventDefault(),t.removeClass("dragging"),n.$emit("shell:file-drop",e)}),t.on("dragover",function(n){n.preventDefault(),t.addClass("dragging")}),t.on("dragleave",function(n){n.preventDefault(),t.removeClass("dragging")})}}]);var k=require("fs"),j=window.ace;n.module("npm-ui.ng-ace-editor",[]).directive("ngAceEditor",["$rootScope","$document",function(n,e){return{require:"?ngModel",link:function(t,o,r,i){var a=o[0].querySelector(".ng-ace-editor"),c=j.edit(a),l=c.getSession(),s=r.ngAceEditorTheme,p=t.$eval(r.ngAceEditorReadonly),u=function(){r.ngAceFileName.endsWith(".json")?l.setMode("ace/mode/json"):r.ngAceFileName.startsWith(".")&&l.setMode("ace/mode/text")},d=n.$on("ace-editor:saved-file",function(){t.$evalAsync(function(){t.savingFile=!1,t.savedFile=!0})}),f=n.$on("ace-editor:saving-file",function(){t.$evalAsync(function(){t.savingFile=!0,t.savedFile=!1})}),h=n.$on("ace-editor:loaded-file",function(){t.$evalAsync(function(){t.loadingFile=!1,c.focus()})}),m=n.$on("ace-editor:loading-file",function(){t.$evalAsync(function(){t.loadingFile=!0,t.savedFile=!1,t.savingFile=!1,u()})});r.$observe("ngAceFile",function(e){if(e){n.$emit("ace-editor:loading-file",{path:e});try{k.existsSync(e)?t.aceFileModel=k.readFileSync(e).toString():(t.aceFileModel="",c.setValue(""))}catch(n){t.aceFileModel="",c.setValue("")}n.$emit("ace-editor:loaded-file",{path:e,content:t.aceFileModel})}}),r.$observe("ngAceSource",function(n){t.aceFileModel=n||""}),t.saveFile=function(){n.$emit("ace-editor:saving-file",{path:r.ngAceFile,content:t.aceFileModel}),k.writeFileSync(r.ngAceFile,t.aceFileModel,{flag:"w"},"utf8"),n.$emit("ace-editor:saved-file",{path:r.ngAceFile,content:t.aceFileModel})},t.$watch(function(){return[a.offsetWidth,a.offsetHeight]},function(){c.resize(),c.setOptions({showInvisibles:!0,cursorStyle:"smooth",highlightSelectedWord:!0,theme:"ace/theme/"+s,readOnly:p}),c.renderer.updateFull()},!0),l.on("change",function(){l.getValue()&&i.$setViewValue(l.getValue())}),i.$render=function(){i.$viewValue&&l.setValue(i.$viewValue)},e.on("mousedown mouseup mouseover",function(){c.resize()}),o.on("$destroy",function(){l.$stopWorker(),c.destroy(),f(),d(),m(),h()})}}}]);n.module("npm-ui.ng-resizable",[]).directive("ngResizable",["$window","$document",function(e,t){return function(o,r){var i=function(){return Number(e.innerHeight-120)},a=i(),c=function(n){r.css({height:n.pageY-Number(r[0].offsetTop)+"px"}),r[0].offsetHeight<=250&&r.css("height","250px"),r[0].offsetHeight>=a&&r.css("height",a+"px")},l=function n(){t.unbind("mousemove",c),t.unbind("mouseup",n)};r.on("mousedown",function(n){n.preventDefault(),t.on("mousemove",c),t.on("mouseup",l)}),n.element(e).on("resize",function(){a=i()})}}]);n.module("npm-ui.ng-autoscroll",[]).directive("ngAutoscroll",function(){return function(n,e){n.$watch(function(){e[0].scrollTop=e[0].scrollHeight})}});n.module("npm-ui.autofocus",[]).directive("ngAutofocus",function(){return function(n,e){n.$evalAsync(function(){e[0].focus()})}});n.module("npm-ui.ng-tag-input",[]).directive("ngTagInput",["$rootScope","$log",function(e,t){return{require:"?ngModel",link:function(o,r,i,a){var c=i.tabPathId,l=void 0,s=void 0,p=function(){try{r[0].focus(),l=document.createRange(),l.selectNodeContents(r[0].lastChild),l.collapse(!1),s=window.getSelection(),s.removeAllRanges(),s.addRange(l)}catch(n){t.warn("ng-tag-input warning when setting focus",n)}},u=function(){try{var n=r[0].innerText.split(" "),e=[];n&&n.length>0&&(n.forEach(function(n){n.trim().length>0?e.push("<span>"+n.trim()+"</span>"):e.push(n)}),e&&e.length>0&&(r.html(e.join(" ")+" <b> </b>"),p()))}catch(n){t.warn("ng-tag-input warning",n)}},d=function(){var n=r[0].innerText.trim().split(" "),e=[],t=void 0,o=void 0;n.forEach(function(n){n.trim()&&n.trim().length>0&&(n.includes("@")?(t=n.split("@")[0].replace("@","").trim(),o=n.split("@")[1].replace("@","").trim()):(t=n.trim(),o=!1),e.push({name:t,version:o}))}),a.$setViewValue(e)},f=function(){d()},h=function(n){d(),r[0].innerText.trim().length>0&&(n.keyCode&&32===n.keyCode||n.which&&32===n.which)&&(u(),d())},m=function(e){if(d(),e&&e.keyCode&&"13"===e.keyCode.toString()&&r[0].innerText.trim().length>0)try{u(),d(),n.element(document.querySelector("#install-new-packages-button"))[0].click()}catch(n){t.warn("Cannot find form to submit",n)}},g=function(){d()},y=function(){o.$evalAsync(function(){u(),d()})},v=function(){p()},b=function(n){return n.preventDefault()},w=e.$on("top-menu:search-choosen-package",function(n,e){if(e&&e.data&&e.tabPath&&e.tabPath===c){var t="";e.data.forEach(function(n){t+=n.name,n.version&&n.version.length>0&&(t+="@"+n.version),t+=" "}),r[0].innerText=t,u(),d()}});r.on("mousedown",v),r.on("click",v),r.on("paste",y),r.on("blur",f),r.on("keyup",h),r.on("keydown",m),r.on("keypress",g),i.$observe("disabled",function(n){"disabled"===n?r.on("keypress",b):r.unbind("keypress",b)}),o.$on("$destroy",function(){w(),r.unbind("keyup",h),r.unbind("keydown",m),r.unbind("paste",y),r.unbind("mousedown",v),r.unbind("click",v),r.unbind("keypress",g),r.unbind("blur",f),r.unbind("keypress",b)})}}}]);n.module("npm-ui.ng-table-keyboard",[]).directive("ngTableKeyboard",["$window","$document",function(e,t){return function(o,r){var i=function(){var e=r[0].querySelectorAll(".tab:not(.ng-hide) .table-row:not(.disabled)"),t=void 0;e&&e.length>0&&(e.forEach(function(o,r){n.element(o).hasClass("selected")&&(t||e[r+1]&&(t=!0,n.element(e[r+1]).triggerHandler("click")))}),t||n.element(e[0]).triggerHandler("click"))},a=function(){var e=r[0].querySelectorAll(".table-row:not(.disabled)"),t=void 0;e&&e.length>0&&(e.forEach(function(o,r){if(n.element(o).hasClass("selected")&&!t&&e[r-1])return t=!0,n.element(e[r-1]).triggerHandler("click"),!1}),t||n.element(e[0]).triggerHandler("click"))},c=function(e){n.element(t[0].body).hasClass("loading")||e&&e.keyCode&&(40===e.keyCode&&i(),38===e.keyCode&&a())};n.element(e).bind("keydown",c),o.$on("destroy",function(){n.element(e).unbind("keydown",c)})}}]);var E=require("fs"),P=require("path"),S=require("electron-storage");n.module("npm-ui.assets",[]).provider("assets",function(){var n=[];S.get("projects.json").then(function(e){e&&e.length&&e.forEach(function(e){var t=void 0,o=void 0;if(e&&e.path){try{t=!!E.lstatSync(e.path).isDirectory()}catch(n){t=!1,console.warn("Unable to read project path: "+n)}try{o=!!E.existsSync(P.join(e.path,"npm-shrinkwrap.json"))}catch(n){o=!1,console.warn("No npm-shrinkwrap.json found in project path: "+n)}e.shrinkwrap=!!o,t&&n.push(e)}})}).catch(function(n){return function(){console.err("Unable to retrieve saved projects: "+n)}}),n.save=function(n){return S.set("projects.json",n)},this.$get=function(){return{projects:n}}});n.module("npm-ui.loading",[]).service("loadingFactory",["$document",function(n){var e=n.find("body"),t=function(){e.addClass("ready")};return{loading:function(){},finished:function(){e.removeClass("loading")},freeze:function(){e.addClass("freezed")},unfreeze:function(){e.removeClass("freezed")},appReady:t}}]).directive("npmLoading",["$rootScope",function(n){return{scope:!0,restrict:"A",templateUrl:"npm-update-log.html",controller:["$scope",function(e){var t=n.$on("npm:log:log",function(t,o){n.$apply(function(){"installLatest"===o.type&&o.data&&e.log.logs.push(o.data)})});this.logs=[],e.$on("$destroy",function(){t()})}],controllerAs:"log"}}]);var F=require("electron"),N=F.remote,I=N.dialog;n.module("npm-ui.errors-handler",[]).service("errorsService",["$log",function(n){this.handleError=function(e,t){n.error(e,t)},this.showErrorBox=function(n,e){I.showErrorBox(n,e)}}]);n.module("npm-ui.filters",[]).filter("removeHTML",function(){return function(n){return n.replace(/<\/?[^>]+(>|$)/g,"")}}).filter("lastNameInPath",function(){return function(n){var e=void 0,t=void 0;return n.includes("\\")&&(t=n.split("\\"),e=t[t.length-1]),n.includes("/")&&(t=n.split("/"),e=t[t.length-1]),e||n}});var B=require("electron"),R=B.remote.BrowserWindow;n.module("npm-ui.notification",[]).service("notificationFactory",function(){return{notify:function(n,e,t){if(!R.getFocusedWindow()||e){var o=void 0,r=new Notification("ndm",{body:n,sticky:!0});r.onclick=function(){if(e||(o=R.getAllWindows(),o[0]&&o[1]&&(o[0].hide(),o[1].show(),o[1].focus(),o[0].hide())),r=void 0,t)return t()}}}}});var x=require("electron-storage"),A=require("electron"),C=A.ipcRenderer,V=require("universal-analytics"),L=require("uuid/v4"),O=L(),D=V("UA-90211405-1",O);n.module("ndm",["selectionModel","npm-ui.shell","npm-ui.content","npm-ui.left-bar","npm-ui.top-menu","npm-ui.loading","npm-ui.notification","npm-ui.errors-handler","npm-ui.ng-right-click","npm-ui.ng-drag-drop","npm-ui.ng-ace-editor","npm-ui.ng-resizable","npm-ui.ng-autoscroll","npm-ui.autofocus","npm-ui.ng-tag-input","npm-ui.ng-table-keyboard","npm-ui.assets","npm-ui.filters"]).constant("timeoutForWhenUserIsPresent",2500).constant("appHistoryFile","snapshots.json").constant("npmGlobal","<global>").run(["appHistoryFile","$log",function(n,e){x.isPathExists(n,function(t){t?e.info("Storage: OK"):x.set(n,"{}",function(n){n?e.error("Not able to initialize storage for the app"):e.info("Storage initialized for the app")})})}]).run(["loadingFactory",function(n){C.on("loading:freeze-app",function(){n.freeze()}),C.on("loading:unfreeze-app",function(){n.unfreeze()})}]).run(["$window","notificationFactory",function(e,t){var o=function(){t.notify("You are offline. ndm may not work as expected.",!0)},r=function(){o()};n.element(e).on("offline",r),function(){navigator&&!navigator.onLine&&o()}()}]).run(["$document","$rootScope","$timeout","$log","loadingFactory","timeoutForWhenUserIsPresent",function(n,e,t,o,r,i){n.ready(function(){o.info("DOM is ready"),e.$emit("dom:ready"),t(function(){try{D.pageview("/platform/"+process.platform).send(),o.info("Platform "+process.platform)}catch(n){o.warn("Unable to send ga pageview",n)}},i)})}]).run(["$rootScope","$log","loadingFactory",function(n,e,t){n.$on("npm:ready",function(){e.info("npm is ready"),t.appReady()})}])}(angular);