/*!
 * SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
 * (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
 * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
 */
sap.ui.define(['jquery.sap.global'],function(q){"use strict";var S={};S.CSS_CLASS="sapMSwt";S.render=function(r,s){var b=s.getState(),a=b?s._sOn:s._sOff,t=s.getTooltip_AsString(),e=s.getEnabled(),n=s.getName(),C=S.CSS_CLASS;r.write("<div");r.addClass(C+"Cont");if(!e){r.addClass(C+"ContDisabled");}r.writeClasses();r.writeStyles();r.writeControlData(s);if(e){r.writeAttribute("tabindex","0");}if(t){r.writeAttributeEscaped("title",t);}this.writeAccessibilityState(r,s);r.write("><div");r.writeAttribute("id",s.getId()+"-switch");r.addClass(C);r.addClass(b?C+"On":C+"Off");r.addClass(C+s.getType());if(sap.ui.Device.system.desktop&&e){r.addClass(C+"Hoverable");}if(!e){r.addClass(C+"Disabled");}r.writeClasses();r.write("><div");r.addClass(C+"Inner");r.writeAttribute("id",s.getId()+"-inner");r.writeClasses();r.write(">");this.renderText(r,s);this.renderHandle(r,s,a);r.write("</div>");r.write("</div>");if(n){this.renderCheckbox(r,s,a);}r.write("</div>");};S.renderText=function(r,s){var C=S.CSS_CLASS,t=s.getType(),d=t===sap.m.SwitchType.Default,a=t===sap.m.SwitchType.AcceptReject,b=s.getState(),A=sap.ui.getCore().getConfiguration().getAccessibility(),R=s.constructor._oRb;r.write("<div");r.addClass(C+"Text");r.addClass(C+"TextOn");r.writeAttribute("id",s.getId()+"-texton");if(!b){r.writeAttribute("aria-hidden","true");}r.writeClasses();r.write(">");r.write("<span");r.addClass(C+"Label");r.addClass(C+"LabelOn");r.writeClasses();r.write(">");if(d){r.writeEscaped(s._sOn);}r.write("</span>");if(a&&A){this.renderInvisibleElement(r,s,R.getText("SWITCH_ARIA_ACCEPT"));}r.write("</div>");r.write("<div");r.addClass(C+"Text");r.addClass(C+"TextOff");r.writeAttribute("id",s.getId()+"-textoff");if(b){r.writeAttribute("aria-hidden","true");}r.writeClasses();r.write(">");r.write("<span");r.addClass(C+"Label");r.addClass(C+"LabelOff");r.writeClasses();r.write(">");if(d){r.writeEscaped(s._sOff);}r.write("</span>");if(a&&A){this.renderInvisibleElement(r,s,R.getText("SWITCH_ARIA_REJECT"));}r.write("</div>");};S.renderHandle=function(r,s,a){var C=S.CSS_CLASS;r.write("<div");r.writeAttribute("id",s.getId()+"-handle");r.writeAttributeEscaped("data-sap-ui-swt",a);r.addClass(C+"Handle");if(sap.ui.Device.browser.webkit&&Number(sap.ui.Device.browser.webkitVersion).toFixed(2)==="537.35"){r.addClass(C+"WebKit537-35");}r.writeClasses();r.write("></div>");};S.renderCheckbox=function(r,s,a){r.write('<input type="checkbox"');r.writeAttribute("id",s.getId()+"-input");r.writeAttributeEscaped("name",s.getName());r.writeAttributeEscaped("value",a);if(s.getState()){r.writeAttribute("checked","checked");}if(!s.getEnabled()){r.writeAttribute("disabled","disabled");}r.write(">");};S.writeAccessibilityState=function(r,s){var l=s.getId()+(s.getState()?"-texton":"-textoff");r.writeAccessibilityState(s,{role:"checkbox",checked:s.getState(),live:"assertive",labelledby:{value:l,append:true}});};S.renderInvisibleElement=function(r,s,t){r.write('<span aria-hidden="true" style="display: none">');r.writeEscaped(t);r.write("</span>");};return S;},true);
