function Controller(){function e(){i.is("live action",d);var e=o.data.events;if(_.isEmpty(o.data.commentary))e=e.reverse(),_.each(e,function(e){if("assist"!==e.type){if(e.teamId===n){var a=_.find(o.data.teams.home.crew,function(t){return e.playerId===t.playerId});("goal"===e.type||"penaltyGoal"===e.type)&&r.home.push({player:a.name,minute:e.minute})}else{var a=_.find(o.data.teams.away.crew,function(t){return e.playerId===t.playerId});("goal"===e.type||"penaltyGoal"===e.type)&&r.away.push({player:a.name,minute:e.minute})}e.playerName=a.name,t.matchDetailLiveAction.add(Alloy.createController("matchDetailLiveActionItem",{item:e}).getView())}});else{var a={},l={},c=o.data.commentary,d=_.sortBy(_.union(e,c),function(e){return-e.minute});_.each(d,function(e){if(void 0===e.text)_.isEmpty(a)?a=e:l=e,d=_.reject(d,function(t){return t===e});else{if(!_.isEmpty(a)){if(i.i("temp event is not empty"),i.i("tempEvent.type: "+a.type),a.teamId===n){var c=_.find(o.data.teams.home.crew,function(e){return a.playerId===e.playerId});("goal"===a.type||"penaltyGoal"===a.type)&&r.home.push({player:c.name,minute:e.minute})}else{var c=_.find(o.data.teams.away.crew,function(e){return a.playerId===e.playerId});("goal"===a.type||"penaltyGoal"===a.type)&&r.away.push({player:c.name,minute:e.minute})}a.playerName=c.name,_.extend(e,a)}_.isEmpty(l)||(e.assist=l),t.matchDetailLiveAction.add(Alloy.createController("matchDetailLiveActionItem",{item:e}).getView()),a={},l={}}})}_.defer(function(){i.is("goal breakdown",r);var e,a,o=_.groupBy(r.home,function(e){return e.player}),n=_.groupBy(r.away,function(e){return e.player});e="\n",_.each(o,function(t,a){e=e+"    "+a+" (",_.each(t,function(t){e=e+t.minute+"', "}),e=e.substring(0,e.length-2)+")\n"}),t.goalsScoredHome.text=e+"\n",_.defer(function(){a="\n",_.each(n,function(e,t){a=a+t+" (",_.each(e,function(e){a=a+e.minute+"', "}),a=a.substring(0,a.length-2)+")\n"}),t.goalsScoredAway.text=a+"\n"})})}require("alloy/controllers/BaseController").apply(this,Array.prototype.slice.call(arguments)),this.__controllerPath="matchDetailLiveAction",arguments[0]?arguments[0].__parentSymbol:null,arguments[0]?arguments[0].$model:null,arguments[0]?arguments[0].__itemTemplate:null;var t=this,a={};t.__views.matchDetailLiveAction=Ti.UI.createScrollView({layout:"vertical",backgroundColor:Alloy.CFG.colors.medGrey,id:"matchDetailLiveAction"}),t.__views.matchDetailLiveAction&&t.addTopLevelView(t.__views.matchDetailLiveAction),t.__views.headerGoalScorers=Ti.UI.createLabel({font:{fontSize:16,fontFamily:Alloy.CFG.fonts.bold},backgroundGradient:Alloy.CFG.gradients.lightGrey,width:Ti.UI.FILL,height:28,top:1,id:"headerGoalScorers"}),t.__views.matchDetailLiveAction.add(t.__views.headerGoalScorers),t.__views.goalsScoredHome=Ti.UI.createLabel({font:{fontSize:14,fontFamily:Alloy.CFG.fonts.default},width:Ti.UI.FILL,height:Ti.UI.SIZE,top:1,textAlign:"left",verticalAlign:Ti.UI.TEXT_VERTICAL_ALIGNMENT_TOP,text:"",backgroundColor:Alloy.CFG.colors.white,id:"goalsScoredHome"}),t.__views.matchDetailLiveAction.add(t.__views.goalsScoredHome),t.__views.goalsScoredAway=Ti.UI.createLabel({font:{fontSize:14,fontFamily:Alloy.CFG.fonts.default},width:Ti.UI.SIZE,height:Ti.UI.SIZE,right:10,top:0,textAlign:"right",verticalAlign:Ti.UI.TEXT_VERTICAL_ALIGNMENT_TOP,text:" ",id:"goalsScoredAway"}),t.__views.goalsScoredHome.add(t.__views.goalsScoredAway),t.__views.headerLiveText=Ti.UI.createLabel({font:{fontSize:16,fontFamily:Alloy.CFG.fonts.bold},backgroundGradient:Alloy.CFG.gradients.lightGrey,width:Ti.UI.FILL,height:28,top:1,id:"headerLiveText"}),t.__views.matchDetailLiveAction.add(t.__views.headerLiveText),a.destroy=function(){},_.extend(t,t.__views);var i=require("helpers");require("feedSigner"),require("netConnect");var o=arguments[0]||{},n=o.data.teams.home.teamId,r=(o.data.teams.away.teamId,{home:[],away:[]});t.headerGoalScorers.text="   "+L("Matchdetail_GoalScorers"),t.headerLiveText.text="   "+L("Matchdetail_LiveText"),_.defer(e),_.extend(t,a)}var Alloy=require("alloy"),Backbone=Alloy.Backbone,_=Alloy._;module.exports=Controller;