export class ThrottlingSettingsTab extends UI.VBox{constructor(){super(true);this.registerRequiredCSS('mobile_throttling/throttlingSettingsTab.css');const header=this.contentElement.createChild('div','header');header.textContent=ls`Network Throttling Profiles`;UI.ARIAUtils.markAsHeading(header,1);const addButton=UI.createTextButton(Common.UIString('Add custom profile...'),this._addButtonClicked.bind(this),'add-conditions-button');this.contentElement.appendChild(addButton);this._list=new UI.ListWidget(this);this._list.element.classList.add('conditions-list');this._list.registerRequiredCSS('mobile_throttling/throttlingSettingsTab.css');this._list.show(this.contentElement);this._customSetting=Common.moduleSetting('customNetworkConditions');this._customSetting.addChangeListener(this._conditionsUpdated,this);this.setDefaultFocusedElement(addButton);} wasShown(){super.wasShown();this._conditionsUpdated();} _conditionsUpdated(){this._list.clear();const conditions=this._customSetting.get();for(let i=0;i0&&value.length<50;return{valid};} function throughputValidator(item,index,input){const value=input.value.trim();const valid=!value||(/^[\d]+(\.\d+)?|\.\d+$/.test(value)&&value>=0&&value<=10000000);return{valid};} function latencyValidator(item,index,input){const value=input.value.trim();const valid=!value||(/^[\d]+$/.test(value)&&value>=0&&value<=1000000);return{valid};}}} export function throughputText(throughput,plainText){if(throughput<0){return'';} const throughputInKbps=throughput/(1024/8);const delimiter=plainText?'':' ';if(throughputInKbps<1024){return Common.UIString('%d%skb/s',throughputInKbps,delimiter);} if(throughputInKbps<1024*10){return Common.UIString('%.1f%sMb/s',throughputInKbps/1024,delimiter);} return Common.UIString('%d%sMb/s',(throughputInKbps/1024)|0,delimiter);} self.MobileThrottling=self.MobileThrottling||{};MobileThrottling=MobileThrottling||{};MobileThrottling.ThrottlingSettingsTab=ThrottlingSettingsTab;MobileThrottling.throughputText=throughputText;