define('panels/help/support',['require','modules/settings_cache','shared/lazy_loader'],function(require){'use strict';var SettingsCache=require('modules/settings_cache');var LazyLoader=require('shared/lazy_loader');var Support=function(){};Support.prototype={init:function support_init(elements){this._elements=elements;this._callSupportInfo=null;var url='http://support.mozilla.org/products/firefox-os';this._elements.userGuide.addEventListener('click',()=>{this._elements.userGuide.blur();var activity=new window.MozActivity({name:'view',data:{type:'url',url:url}});activity.onsuccess=function(){};});this._getSupportInfo(this._displaySupportInfo.bind(this));},uninit:function(){this._elements=null;this._supportInfo=null;this._callSupportInfo=null;},_getSupportInfo:function support_getSupportInfo(callback){if(this._supportInfo){callback(this._supportInfo);return;} LazyLoader.getJSON('/resources/support.json').then(function loadSupportInfo(data){this._supportInfo=data;callback(this._supportInfo);}.bind(this));},_createLinkNode:function support_createLinkNode(data,type){var link=document.createElement('a');link.setAttribute('href',data.href);link.classList.add('link-text');if(type=='tel'){link.textContent=data.title+' ('+data.href+')';}else{link.textContent=data.title;} return link;},_enableSupportInfo:function support_enableSupportInfo(){this._elements.help.dataset.hasSupportInfo=true;},_setOnlineSupportInfo:function support_setOnlineSupportInfo(onlineSupportInfo){this._enableSupportInfo();var nodes=this._createLinkNode(onlineSupportInfo);this._elements.supportText.appendChild(nodes);},_setCallSupportInfo:function support_setCallSupportInfo(supportInfo){this._enableSupportInfo();for(var id in supportInfo){this._elements.supportNumber.appendChild(this._createLinkNode(supportInfo[id],'tel'));}},_renderSupportInfo:function support_renderSupportInfo(result){var onlineSupportInfo=null;var onlineSupportTitle=result['support.onlinesupport.title'];if(onlineSupportTitle!==''){onlineSupportInfo={title:onlineSupportTitle};onlineSupportInfo.href=result['support.onlinesupport.href'];this._setOnlineSupportInfo(onlineSupportInfo);}else if(this._supportInfo){this._setOnlineSupportInfo(this._supportInfo.onlinesupport);} var callSupport1Title=result['support.callsupport1.title'];if(callSupport1Title!==''){this._callSupportInfo=[{'title':callSupport1Title,'href':result['support.callsupport1.href']}];var callSupport2Title=result['support.callsupport2.title'];if(callSupport2Title!==''){this._callSupportInfo.push({'title':callSupport2Title,'href':result['support.callsupport2.href']});this._setCallSupportInfo(this._callSupportInfo);}}else if(this._supportInfo){this._setCallSupportInfo(this._supportInfo.callsupport);}},_displaySupportInfo:function support_displaySupportInfo(supportInfo){SettingsCache.getSettings(this._renderSupportInfo.bind(this));}};return function ctor_support(){return new Support();};});define('panels/help/panel',['require','modules/settings_panel','panels/help/support'],function(require){'use strict';var SettingsPanel=require('modules/settings_panel');var Support=require('panels/help/support');return function ctor_support_panel(){var help=Support();return SettingsPanel({onInit:function(panel){var elements={userGuide:panel.querySelector('#user-guide'),help:panel,supportText:panel.querySelector('#help-online-support-text'),supportNumber:panel.querySelector('#help-call-support-numbers')};help.init(elements);}});};});