text: angular.module("happybazarApp",["ui.router","search.controllers","productdisplay.controllers","userAlerts.controllers","search.services","data.appData"]).config(["$stateProvider","$urlRouterProvider",function(e,r){e.state("welcome",{url:"/welcome",templateUrl:"App/components/main/partials/welcome.html"}).state("searchResults",{url:"/searchResults/:gameTitle",templateUrl:"App/components/search/partials/resultList.html",controller:"searchResultsController"}).state("productInfo",{url:"/productInfo/:productId",templateUrl:"App/components/productdisplay/partials/procuctDisplay.html",controller:"productDisplayController"}),r.otherwise("/welcome")}]),angular.module("data.appData",[]).value("productData",{usedGames:[{name:"Madden NFL 15",productId:"madden_nfl_15",summary:"Madden NFL 15 has an all-new broadcast-style presentation, authentic NFL jumbotrons, Player Spotlight Montages, as well as new pregame and halftime shows.",url:"app/images/madden15.png",price:54.95},{name:"Far Cry 4",productId:"far_cray_4",summary:"Building on its award-winning predecessor, Far Cry 4 delivers its best experience ever! Experience an entirely new integrated co-op play in the incredibly open worled of Kyrat.",url:"app/images/farcry.png",price:59.96},{name:"Assassin's Creed Unity",productId:"acreed_unity",summary:"Experience the cobblestone streets of Paris in 1789 during the French revolution. Rise up with the commoners against an oppressive aristocracy. In this heroic journey, Arno tries to find out who's really behind the Revolution. His pursuit leads him into a struggle for the fate of a nation - one that will transform him into a true Master Assassin.",url:"app/images/creed.png",price:53.83},{name:"Call of Duty Advanced Warfare",productId:"cod_adv_war",summary:"Join the battle of the future in a new era of combat for the Call of Duty franchise. Academy Award winning actor Kevin Spacey stars as Jonathan Irons who's bent on reshaping future of war.",url:"app/images/callOfDuty.png",price:59},{name:"Middle Earth: Shadow of Mordor",productId:"mid_earth_shadow_mordor",summary:"As Talion, a Ranger of the Black Gate, you'll travel through brutal combos while mastering powerful new skills and weaponry in an attempt to become the most feared force in Mordor in this latest Lord of the Rings saga.",url:"app/images/mordor.png",price:49.78}]}),angular.module("messaging.services",[]).factory("messageSvc",["$rootScope",function(e){function r(r){e.$broadcast("userMessage",r)}return{displayMsg:r}}]),angular.module("pricing.services",[]).factory("pricingSvc",function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function r(r){return e(r)?(t*r).toFixed(2):1}var a=40,t=a/100;return{applyDiscount:r}}),angular.module("productdisplay.controllers",["productdisplay.services"]).controller("productDisplayController",["$scope","$stateParams","productDisplaySvc",function(e,r,a){e.results=a.getDetails(r.productId)}]),angular.module("search.controllers",["search.services"]).controller("searchController",["$scope","$state",function(e,r){e.search=function(){r.go("searchResults",{gameTitle:e.game.name})}}]).controller("searchResultsController",["$scope","$stateParams","searchSvc",function(e,r,a){e.results=a.search(r.gameTitle)}]),angular.module("search.services",["data.appData","messaging.services"]).factory("searchSvc",["productData","messageSvc",function(e,r){function a(a){if(!a||"function"!=typeof a.trim)return[];if(!e||!e.usedGames||"function"!=typeof e.usedGames.filter)return[];var o=a.trim().toLowerCase(),s=e.usedGames.filter(function(e){return e.name.toLowerCase().indexOf(o)>-1});return r.displayMsg(t(s.length)),s}function t(e){var r=e>0?e:"No",a=1===e?"game":"games",t=e>0?"!":".";return r+" "+a+" found"+t}return{search:a}}]),angular.module("productdisplay.services",["data.appData","pricing.services"]).factory("productDisplaySvc",["productData","pricingSvc",function(e,r){function a(a){if(!e||!e.usedGames)return null;if("function"!=typeof e.usedGames.filter)return null;var t=e.usedGames.filter(function(e){return e.productId==a});if(!t.length)return null;var o=t[0];return{name:o.name,productId:o.productId,summary:o.summary,url:o.url,price:r.applyDiscount(o.price)}}return{getDetails:a}}]),angular.module("userAlerts.controllers",[]).controller("userAlertsController",["$scope","$rootScope","$timeout",function(e,r,a){r.$on("userMessage",function(r,t){e.msg=t,a(function(){e.msg=null},2e3)})}]);