1fb726d48Sopenharmony_ci/*
2fb726d48Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd.
3fb726d48Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4fb726d48Sopenharmony_ci * you may not use this file except in compliance with the License.
5fb726d48Sopenharmony_ci * You may obtain a copy of the License at
6fb726d48Sopenharmony_ci *
7fb726d48Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8fb726d48Sopenharmony_ci *
9fb726d48Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10fb726d48Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11fb726d48Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12fb726d48Sopenharmony_ci * See the License for the specific language governing permissions and
13fb726d48Sopenharmony_ci * limitations under the License.
14fb726d48Sopenharmony_ci */
15fb726d48Sopenharmony_ci
16fb726d48Sopenharmony_ciimport { BaseElement, element } from '../../../base-ui/BaseElement';
17fb726d48Sopenharmony_ciimport { log } from '../../../log/Log';
18fb726d48Sopenharmony_ciimport { SpRecordTrace } from '../SpRecordTrace';
19fb726d48Sopenharmony_ciimport { Cmd } from '../../../command/Cmd';
20fb726d48Sopenharmony_ciimport LitSwitch from '../../../base-ui/switch/lit-switch';
21fb726d48Sopenharmony_ciimport { LitSlider } from '../../../base-ui/slider/LitSlider';
22fb726d48Sopenharmony_ciimport { LitSelectV } from '../../../base-ui/select/LitSelectV';
23fb726d48Sopenharmony_ciimport { SpAllocationHtml } from './SpAllocation.html';
24fb726d48Sopenharmony_ciimport { NUM_16384, NUM_1800, NUM_30, NUM_300, NUM_3600, NUM_450, NUM_60, NUM_600 } from '../../bean/NumBean';
25fb726d48Sopenharmony_ciimport { LitSelect } from '../../../base-ui/select/LitSelect';
26fb726d48Sopenharmony_ci
27fb726d48Sopenharmony_ci@element('sp-allocations')
28fb726d48Sopenharmony_ciexport class SpAllocations extends BaseElement {
29fb726d48Sopenharmony_ci  // normal option
30fb726d48Sopenharmony_ci  private processId: LitSelectV | null | undefined;
31fb726d48Sopenharmony_ci  private packageName: LitSelect | null | undefined;
32fb726d48Sopenharmony_ci  private unwindEL: HTMLInputElement | null | undefined;
33fb726d48Sopenharmony_ci  private intervalResultInput: HTMLInputElement | null | undefined;
34fb726d48Sopenharmony_ci  private fpUnWind: LitSwitch | null | undefined;
35fb726d48Sopenharmony_ci  private statisticsSlider: LitSlider | null | undefined;
36fb726d48Sopenharmony_ci  private useStatisticsEl: LitSwitch | null | undefined;
37fb726d48Sopenharmony_ci  private recordStatisticsResult: HTMLDivElement | null | undefined;
38fb726d48Sopenharmony_ci  private addOptionButton: HTMLButtonElement | undefined | null;
39fb726d48Sopenharmony_ci  // advance option
40fb726d48Sopenharmony_ci  private recordAccuratelyDivEl: HTMLDivElement | undefined | null;
41fb726d48Sopenharmony_ci  private offlineSymbolizationDivEl: HTMLDivElement | undefined | null;
42fb726d48Sopenharmony_ci  private maxUnwindLevelEl: HTMLDivElement | undefined | null;
43fb726d48Sopenharmony_ci  private sharedMemorySizeEl: HTMLDivElement | undefined | null;
44fb726d48Sopenharmony_ci  private filterMemorySizeEl: HTMLDivElement | undefined | null;
45fb726d48Sopenharmony_ci  private sampleIntervalEl: HTMLDivElement | undefined | null;
46fb726d48Sopenharmony_ci  private useStartupEl: HTMLDivElement | undefined | null;
47fb726d48Sopenharmony_ci  private useResponseLibEl: HTMLDivElement | undefined | null;
48fb726d48Sopenharmony_ci  private jsStackRecordDepthEl: HTMLDivElement | undefined | null;
49fb726d48Sopenharmony_ci  private napiRecordEl: HTMLDivElement | undefined | null;
50fb726d48Sopenharmony_ci  private advanceItems: Array<HTMLDivElement | undefined | null> = [];
51fb726d48Sopenharmony_ci  private shareMemory: HTMLInputElement | null | undefined;
52fb726d48Sopenharmony_ci  private shareMemoryUnit: HTMLSelectElement | null | undefined;
53fb726d48Sopenharmony_ci  private filterMemory: HTMLInputElement | null | undefined;
54fb726d48Sopenharmony_ci  private recordAccurately: LitSwitch | null | undefined;
55fb726d48Sopenharmony_ci  private offlineSymbol: LitSwitch | null | undefined;
56fb726d48Sopenharmony_ci  private startupMode: LitSwitch | null | undefined;
57fb726d48Sopenharmony_ci  private jsStackModel: LitSwitch | null | undefined;
58fb726d48Sopenharmony_ci  private responseLibMode: LitSwitch | null | undefined;
59fb726d48Sopenharmony_ci  private napiName: HTMLInputElement | null | undefined;
60fb726d48Sopenharmony_ci  private jsStackDepth: HTMLInputElement | null | undefined;
61fb726d48Sopenharmony_ci  private statisticsIntervalInput: HTMLInputElement | null | undefined;
62fb726d48Sopenharmony_ci  private statisticsIntervalName: HTMLSpanElement | null | undefined;
63fb726d48Sopenharmony_ci  private statisticsIntervalRange: HTMLSpanElement | null | undefined;
64fb726d48Sopenharmony_ci
65fb726d48Sopenharmony_ci  set startSamp(allocationStart: boolean) {
66fb726d48Sopenharmony_ci    if (allocationStart) {
67fb726d48Sopenharmony_ci      this.setAttribute('startSamp', '');
68fb726d48Sopenharmony_ci    } else {
69fb726d48Sopenharmony_ci      this.removeAttribute('startSamp');
70fb726d48Sopenharmony_ci    }
71fb726d48Sopenharmony_ci  }
72fb726d48Sopenharmony_ci
73fb726d48Sopenharmony_ci  get startSamp(): boolean {
74fb726d48Sopenharmony_ci    return this.hasAttribute('startSamp');
75fb726d48Sopenharmony_ci  }
76fb726d48Sopenharmony_ci
77fb726d48Sopenharmony_ci  get appProcess(): string {
78fb726d48Sopenharmony_ci    return this.processId!.value || this.packageName!.value || '';
79fb726d48Sopenharmony_ci  }
80fb726d48Sopenharmony_ci
81fb726d48Sopenharmony_ci  get unwind(): number {
82fb726d48Sopenharmony_ci    log(`unwind value is :${this.unwindEL!.value}`);
83fb726d48Sopenharmony_ci    return Number(this.unwindEL!.value);
84fb726d48Sopenharmony_ci  }
85fb726d48Sopenharmony_ci
86fb726d48Sopenharmony_ci  get shared(): number {
87fb726d48Sopenharmony_ci    let value = this.shareMemory?.value || '';
88fb726d48Sopenharmony_ci    log(`shareMemory value is :${value}`);
89fb726d48Sopenharmony_ci    if (value !== '') {
90fb726d48Sopenharmony_ci      return Number(this.shareMemory?.value) || NUM_16384;
91fb726d48Sopenharmony_ci    }
92fb726d48Sopenharmony_ci    return NUM_16384;
93fb726d48Sopenharmony_ci  }
94fb726d48Sopenharmony_ci
95fb726d48Sopenharmony_ci  get filter(): number {
96fb726d48Sopenharmony_ci    let value = this.filterMemory?.value || '';
97fb726d48Sopenharmony_ci    log(`filter value is :${value}`);
98fb726d48Sopenharmony_ci    if (value !== '') {
99fb726d48Sopenharmony_ci      return Number(value);
100fb726d48Sopenharmony_ci    }
101fb726d48Sopenharmony_ci    return 0;
102fb726d48Sopenharmony_ci  }
103fb726d48Sopenharmony_ci
104fb726d48Sopenharmony_ci  get fp_unwind(): boolean {
105fb726d48Sopenharmony_ci    let value = this.fpUnWind?.checked;
106fb726d48Sopenharmony_ci    if (value !== undefined) {
107fb726d48Sopenharmony_ci      return value;
108fb726d48Sopenharmony_ci    }
109fb726d48Sopenharmony_ci    return true;
110fb726d48Sopenharmony_ci  }
111fb726d48Sopenharmony_ci
112fb726d48Sopenharmony_ci  get record_accurately(): boolean {
113fb726d48Sopenharmony_ci    let value = this.recordAccurately?.checked;
114fb726d48Sopenharmony_ci    if (value !== undefined) {
115fb726d48Sopenharmony_ci      return value;
116fb726d48Sopenharmony_ci    }
117fb726d48Sopenharmony_ci    return true;
118fb726d48Sopenharmony_ci  }
119fb726d48Sopenharmony_ci
120fb726d48Sopenharmony_ci  get offline_symbolization(): boolean {
121fb726d48Sopenharmony_ci    let value = this.offlineSymbol?.checked;
122fb726d48Sopenharmony_ci    if (value !== undefined) {
123fb726d48Sopenharmony_ci      return value;
124fb726d48Sopenharmony_ci    }
125fb726d48Sopenharmony_ci    return true;
126fb726d48Sopenharmony_ci  }
127fb726d48Sopenharmony_ci
128fb726d48Sopenharmony_ci  get record_statistics(): boolean {
129fb726d48Sopenharmony_ci    let value = this.useStatisticsEl!.checked;
130fb726d48Sopenharmony_ci    if (value !== undefined) {
131fb726d48Sopenharmony_ci      return value;
132fb726d48Sopenharmony_ci    }
133fb726d48Sopenharmony_ci    return true;
134fb726d48Sopenharmony_ci  }
135fb726d48Sopenharmony_ci
136fb726d48Sopenharmony_ci  get statistics_interval(): number {
137fb726d48Sopenharmony_ci    if (this.recordStatisticsResult?.hasAttribute('percentValue')) {
138fb726d48Sopenharmony_ci      return Number(this.recordStatisticsResult?.getAttribute('percentValue'));
139fb726d48Sopenharmony_ci    }
140fb726d48Sopenharmony_ci    return 10;
141fb726d48Sopenharmony_ci  }
142fb726d48Sopenharmony_ci
143fb726d48Sopenharmony_ci  get response_lib_mode(): boolean {
144fb726d48Sopenharmony_ci    let value = this.responseLibMode?.checked;
145fb726d48Sopenharmony_ci    if (value !== undefined) {
146fb726d48Sopenharmony_ci      return value;
147fb726d48Sopenharmony_ci    }
148fb726d48Sopenharmony_ci    return false;
149fb726d48Sopenharmony_ci  }
150fb726d48Sopenharmony_ci
151fb726d48Sopenharmony_ci  get startup_mode(): boolean {
152fb726d48Sopenharmony_ci    let value = this.startupMode?.checked;
153fb726d48Sopenharmony_ci    if (value !== undefined) {
154fb726d48Sopenharmony_ci      return value;
155fb726d48Sopenharmony_ci    }
156fb726d48Sopenharmony_ci    return false;
157fb726d48Sopenharmony_ci  }
158fb726d48Sopenharmony_ci
159fb726d48Sopenharmony_ci  set startup_mode(value: boolean) {
160fb726d48Sopenharmony_ci    if (this.startupMode) {
161fb726d48Sopenharmony_ci      this.startupMode.checked = value;
162fb726d48Sopenharmony_ci    }
163fb726d48Sopenharmony_ci  }
164fb726d48Sopenharmony_ci
165fb726d48Sopenharmony_ci  get recordJsStack(): boolean {
166fb726d48Sopenharmony_ci    let value = this.jsStackModel?.checked;
167fb726d48Sopenharmony_ci    if (value !== undefined) {
168fb726d48Sopenharmony_ci      return value;
169fb726d48Sopenharmony_ci    }
170fb726d48Sopenharmony_ci    return false;
171fb726d48Sopenharmony_ci  }
172fb726d48Sopenharmony_ci
173fb726d48Sopenharmony_ci  set recordJsStack(value: boolean) {
174fb726d48Sopenharmony_ci    if (this.jsStackModel) {
175fb726d48Sopenharmony_ci      this.jsStackModel.checked = value;
176fb726d48Sopenharmony_ci    }
177fb726d48Sopenharmony_ci  }
178fb726d48Sopenharmony_ci
179fb726d48Sopenharmony_ci  get expandPids(): number[] {
180fb726d48Sopenharmony_ci    let allPidList: number[] = [];
181fb726d48Sopenharmony_ci    if (this.processId!.value.length > 0) {
182fb726d48Sopenharmony_ci      let result = this.processId?.value.match(/\((.+?)\)/g);
183fb726d48Sopenharmony_ci      if (result) {
184fb726d48Sopenharmony_ci        for (let index = 0; index < result.length; index++) {
185fb726d48Sopenharmony_ci          let item = result[index];
186fb726d48Sopenharmony_ci          let currentPid = item!.replace('(', '').replace(')', '');
187fb726d48Sopenharmony_ci          allPidList.push(Number(currentPid));
188fb726d48Sopenharmony_ci        }
189fb726d48Sopenharmony_ci      }
190fb726d48Sopenharmony_ci    }
191fb726d48Sopenharmony_ci    return allPidList;
192fb726d48Sopenharmony_ci  }
193fb726d48Sopenharmony_ci
194fb726d48Sopenharmony_ci  get sample_interval(): number {
195fb726d48Sopenharmony_ci    return Number(this.statisticsIntervalInput!.value);
196fb726d48Sopenharmony_ci  }
197fb726d48Sopenharmony_ci
198fb726d48Sopenharmony_ci  get filter_napi_name(): string {
199fb726d48Sopenharmony_ci    if (this.jsStackModel?.checked && !this.fp_unwind) {
200fb726d48Sopenharmony_ci      return this.napiName!.value || '';
201fb726d48Sopenharmony_ci    }
202fb726d48Sopenharmony_ci    return '';
203fb726d48Sopenharmony_ci  }
204fb726d48Sopenharmony_ci
205fb726d48Sopenharmony_ci  get max_js_stack_depth(): number {
206fb726d48Sopenharmony_ci    if (this.jsStackModel?.checked) {
207fb726d48Sopenharmony_ci      return Number(this.jsStackDepth!.value) || 10;
208fb726d48Sopenharmony_ci    }
209fb726d48Sopenharmony_ci    return 0;
210fb726d48Sopenharmony_ci  }
211fb726d48Sopenharmony_ci
212fb726d48Sopenharmony_ci  initElements(): void {
213fb726d48Sopenharmony_ci    // normal option
214fb726d48Sopenharmony_ci    this.processId = this.shadowRoot?.getElementById('pid') as LitSelectV;
215fb726d48Sopenharmony_ci    this.packageName = this.shadowRoot?.getElementById('packageName') as LitSelect;
216fb726d48Sopenharmony_ci    this.unwindEL = this.shadowRoot?.getElementById('unwind') as HTMLInputElement;
217fb726d48Sopenharmony_ci    this.fpUnWind = this.shadowRoot?.getElementById('use_fp_unwind') as LitSwitch;
218fb726d48Sopenharmony_ci    this.statisticsSlider = this.shadowRoot?.querySelector<LitSlider>('#interval-slider') as LitSlider;
219fb726d48Sopenharmony_ci    this.recordStatisticsResult = this.shadowRoot?.querySelector<HTMLDivElement>('.record-statistics-result');
220fb726d48Sopenharmony_ci    this.addOptionButton = this.shadowRoot?.querySelector<HTMLButtonElement>('#addOptions');
221fb726d48Sopenharmony_ci    this.intervalResultInput = this.shadowRoot?.querySelector('.interval-result') as HTMLInputElement;
222fb726d48Sopenharmony_ci    // advance option
223fb726d48Sopenharmony_ci    this.recordAccuratelyDivEl = this.shadowRoot?.getElementById('record_accurately_div') as HTMLDivElement;
224fb726d48Sopenharmony_ci    this.offlineSymbolizationDivEl = this.shadowRoot?.getElementById('offline_symbolization_div') as HTMLDivElement;
225fb726d48Sopenharmony_ci    this.jsStackRecordDepthEl = this.shadowRoot?.getElementById('js-stack-depth-div') as HTMLDivElement;
226fb726d48Sopenharmony_ci    this.napiRecordEl = this.shadowRoot?.getElementById('napi-div') as HTMLDivElement;
227fb726d48Sopenharmony_ci    this.maxUnwindLevelEl = this.shadowRoot?.getElementById('max-unwind-level-el') as HTMLDivElement;
228fb726d48Sopenharmony_ci    this.sharedMemorySizeEl = this.shadowRoot?.getElementById('shared-memory-size-el') as HTMLDivElement;
229fb726d48Sopenharmony_ci    this.filterMemorySizeEl = this.shadowRoot?.getElementById('filter-memory-size-el') as HTMLDivElement;
230fb726d48Sopenharmony_ci    this.sampleIntervalEl = this.shadowRoot?.getElementById('sample-interval-el') as HTMLDivElement;
231fb726d48Sopenharmony_ci    this.useStartupEl = this.shadowRoot?.getElementById('use-startup-el') as HTMLDivElement;
232fb726d48Sopenharmony_ci    this.useResponseLibEl = this.shadowRoot?.getElementById('use-response-lib-el') as HTMLDivElement;
233fb726d48Sopenharmony_ci
234fb726d48Sopenharmony_ci    this.recordAccurately = this.shadowRoot?.getElementById('use_record_accurately') as LitSwitch;
235fb726d48Sopenharmony_ci    this.shareMemory = this.shadowRoot?.getElementById('shareMemory') as HTMLInputElement;
236fb726d48Sopenharmony_ci    this.shareMemoryUnit = this.shadowRoot?.getElementById('shareMemoryUnit') as HTMLSelectElement;
237fb726d48Sopenharmony_ci    this.filterMemory = this.shadowRoot?.getElementById('filterSized') as HTMLInputElement;
238fb726d48Sopenharmony_ci    this.offlineSymbol = this.shadowRoot?.getElementById('use_offline_symbolization') as LitSwitch;
239fb726d48Sopenharmony_ci    this.startupMode = this.shadowRoot?.getElementById('use_startup_mode') as LitSwitch;
240fb726d48Sopenharmony_ci    this.jsStackModel = this.shadowRoot?.getElementById('use_js-stack') as LitSwitch;
241fb726d48Sopenharmony_ci    this.responseLibMode = this.shadowRoot?.getElementById('response_lib_mode') as LitSwitch;
242fb726d48Sopenharmony_ci    this.useStatisticsEl = this.shadowRoot?.getElementById('use_statistics') as LitSwitch;
243fb726d48Sopenharmony_ci    this.statisticsIntervalInput = this.shadowRoot?.getElementById('statistics-interval-input') as HTMLInputElement;
244fb726d48Sopenharmony_ci    this.napiName = this.shadowRoot?.getElementById('napiName') as HTMLInputElement;
245fb726d48Sopenharmony_ci    this.jsStackDepth = this.shadowRoot?.getElementById('jsStackDepth') as HTMLInputElement;
246fb726d48Sopenharmony_ci    this.statisticsIntervalName = this.shadowRoot?.getElementById('statistics-interval-name') as HTMLSpanElement;
247fb726d48Sopenharmony_ci    this.statisticsIntervalRange = this.shadowRoot?.getElementById('statistics-interval-range') as HTMLSpanElement;
248fb726d48Sopenharmony_ci    this.initNativeSwitchOption();
249fb726d48Sopenharmony_ci  }
250fb726d48Sopenharmony_ci
251fb726d48Sopenharmony_ci  initHtml(): string {
252fb726d48Sopenharmony_ci    return SpAllocationHtml;
253fb726d48Sopenharmony_ci  }
254fb726d48Sopenharmony_ci
255fb726d48Sopenharmony_ci  connectedCallback(): void {
256fb726d48Sopenharmony_ci    this.unwindEL?.addEventListener('keydown', this.handleInputChangeEvent);
257fb726d48Sopenharmony_ci    this.shareMemory?.addEventListener('keydown', this.handleInputChangeEvent);
258fb726d48Sopenharmony_ci    this.shareMemoryUnit?.addEventListener('keydown', this.handleInputChangeEvent);
259fb726d48Sopenharmony_ci    this.filterMemory?.addEventListener('keydown', this.handleInputChangeEvent);
260fb726d48Sopenharmony_ci    this.intervalResultInput?.addEventListener('keydown', this.handleInputChangeEvent);
261fb726d48Sopenharmony_ci    this.statisticsSlider?.addEventListener('input', this.statisticsSliderInputEvent);
262fb726d48Sopenharmony_ci    this.intervalResultInput?.addEventListener('input', this.statisticsValueInputEvent);
263fb726d48Sopenharmony_ci    this.intervalResultInput?.addEventListener('focusout', this.statisticsFocusOutEvent);
264fb726d48Sopenharmony_ci    this.statisticsSlider?.shadowRoot
265fb726d48Sopenharmony_ci      ?.querySelector('#slider')!
266fb726d48Sopenharmony_ci      .addEventListener('mouseup', this.statisticsSliderMouseupEvent);
267fb726d48Sopenharmony_ci    this.startupMode?.addEventListener('change', this.startupModeChangeEvent);
268fb726d48Sopenharmony_ci    this.jsStackModel?.addEventListener('change', this.jsStackModelChangeEvent);
269fb726d48Sopenharmony_ci    this.addOptionButton?.addEventListener('click', this.advanceOptionClickEvent);
270fb726d48Sopenharmony_ci    this.fpUnWind?.addEventListener('change', this.fpUnWindChangeEvent);
271fb726d48Sopenharmony_ci    this.useStatisticsEl?.addEventListener('change', this.useStatisticsChangeEvent);
272fb726d48Sopenharmony_ci    this.statisticsIntervalInput?.addEventListener('input', this.statisticsIntervalInputEvent);
273fb726d48Sopenharmony_ci    this.statisticsIntervalInput?.addEventListener('keyup', this.statisticsIntervalKeyUpEvent);
274fb726d48Sopenharmony_ci  }
275fb726d48Sopenharmony_ci
276fb726d48Sopenharmony_ci  disconnectedCallback(): void {
277fb726d48Sopenharmony_ci    this.unwindEL?.removeEventListener('keydown', this.handleInputChangeEvent);
278fb726d48Sopenharmony_ci    this.shareMemory?.removeEventListener('keydown', this.handleInputChangeEvent);
279fb726d48Sopenharmony_ci    this.shareMemoryUnit?.removeEventListener('keydown', this.handleInputChangeEvent);
280fb726d48Sopenharmony_ci    this.filterMemory?.removeEventListener('keydown', this.handleInputChangeEvent);
281fb726d48Sopenharmony_ci    this.intervalResultInput?.removeEventListener('keydown', this.handleInputChangeEvent);
282fb726d48Sopenharmony_ci    this.statisticsSlider?.removeEventListener('input', this.statisticsSliderInputEvent);
283fb726d48Sopenharmony_ci    this.intervalResultInput?.removeEventListener('input', this.statisticsValueInputEvent);
284fb726d48Sopenharmony_ci    this.intervalResultInput?.removeEventListener('focusout', this.statisticsFocusOutEvent);
285fb726d48Sopenharmony_ci    this.statisticsSlider?.shadowRoot
286fb726d48Sopenharmony_ci      ?.querySelector('#slider')!
287fb726d48Sopenharmony_ci      .removeEventListener('mouseup', this.statisticsSliderMouseupEvent);
288fb726d48Sopenharmony_ci    this.startupMode?.removeEventListener('change', this.startupModeChangeEvent);
289fb726d48Sopenharmony_ci    this.jsStackModel?.removeEventListener('change', this.jsStackModelChangeEvent);
290fb726d48Sopenharmony_ci    this.addOptionButton?.removeEventListener('click', this.advanceOptionClickEvent);
291fb726d48Sopenharmony_ci    this.fpUnWind?.removeEventListener('change', this.fpUnWindChangeEvent);
292fb726d48Sopenharmony_ci    this.useStatisticsEl?.removeEventListener('change', this.useStatisticsChangeEvent);
293fb726d48Sopenharmony_ci    this.statisticsIntervalInput?.removeEventListener('input', this.statisticsIntervalInputEvent);
294fb726d48Sopenharmony_ci    this.statisticsIntervalInput?.removeEventListener('keyup', this.statisticsIntervalKeyUpEvent);
295fb726d48Sopenharmony_ci  }
296fb726d48Sopenharmony_ci
297fb726d48Sopenharmony_ci  handleInputChangeEvent = (ev: KeyboardEvent): void => {
298fb726d48Sopenharmony_ci    // @ts-ignore
299fb726d48Sopenharmony_ci    if (ev.key === '0' && ev.target.value.length === 1 && ev.target.value === '0') {
300fb726d48Sopenharmony_ci      ev.preventDefault();
301fb726d48Sopenharmony_ci    }
302fb726d48Sopenharmony_ci  };
303fb726d48Sopenharmony_ci
304fb726d48Sopenharmony_ci  statisticsSliderInputEvent = (): void => {
305fb726d48Sopenharmony_ci    this.statisticsSlider!.sliderStyle = {
306fb726d48Sopenharmony_ci      minRange: 0,
307fb726d48Sopenharmony_ci      maxRange: 3600,
308fb726d48Sopenharmony_ci      defaultValue: `${this.recordStatisticsResult!.getAttribute('percent')}`,
309fb726d48Sopenharmony_ci      resultUnit: 'S',
310fb726d48Sopenharmony_ci      stepSize: 450,
311fb726d48Sopenharmony_ci      lineColor: 'var(--dark-color3,#46B1E3)',
312fb726d48Sopenharmony_ci      buttonColor: '#999999',
313fb726d48Sopenharmony_ci    };
314fb726d48Sopenharmony_ci    this.intervalResultInput!.style.color = 'var(--dark-color1,#000000)';
315fb726d48Sopenharmony_ci    if (this.recordStatisticsResult!.hasAttribute('percent')) {
316fb726d48Sopenharmony_ci      let step = Math.round(Number(this.recordStatisticsResult!.getAttribute('percent')) / NUM_450);
317fb726d48Sopenharmony_ci      this.recordStatisticsResult!.setAttribute('percentValue', `${stepValue[step]}`);
318fb726d48Sopenharmony_ci      this.intervalResultInput!.value = `${stepValue[step]}`;
319fb726d48Sopenharmony_ci    }
320fb726d48Sopenharmony_ci  };
321fb726d48Sopenharmony_ci
322fb726d48Sopenharmony_ci  statisticsValueInputEvent = (): void => {
323fb726d48Sopenharmony_ci    if (this.intervalResultInput!.value === '0') {
324fb726d48Sopenharmony_ci      this.useStatisticsEl!.checked = false;
325fb726d48Sopenharmony_ci      this.useStatisticsChangeHandle(false);
326fb726d48Sopenharmony_ci    } else {
327fb726d48Sopenharmony_ci      this.statisticsIntervalHandle();
328fb726d48Sopenharmony_ci    }
329fb726d48Sopenharmony_ci  };
330fb726d48Sopenharmony_ci
331fb726d48Sopenharmony_ci  statisticsFocusOutEvent = (): void => {
332fb726d48Sopenharmony_ci    let parentElement = this.statisticsSlider!.parentNode as Element;
333fb726d48Sopenharmony_ci    if (this.intervalResultInput!.value.trim() === '') {
334fb726d48Sopenharmony_ci      parentElement.setAttribute('percent', '3600');
335fb726d48Sopenharmony_ci      this.intervalResultInput!.value = '3600';
336fb726d48Sopenharmony_ci      this.intervalResultInput!.style.color = 'var(--dark-color,#6a6f77)';
337fb726d48Sopenharmony_ci      parentElement.setAttribute('percent', this.intervalResultInput!.value);
338fb726d48Sopenharmony_ci      parentElement.setAttribute('percentValue', this.intervalResultInput!.value);
339fb726d48Sopenharmony_ci      this.statisticsSlider!.percent = this.intervalResultInput!.value;
340fb726d48Sopenharmony_ci      let htmlInputElement = this.statisticsSlider!.shadowRoot?.querySelector('#slider') as HTMLInputElement;
341fb726d48Sopenharmony_ci      htmlInputElement.value = this.intervalResultInput!.value;
342fb726d48Sopenharmony_ci    }
343fb726d48Sopenharmony_ci  };
344fb726d48Sopenharmony_ci
345fb726d48Sopenharmony_ci  useStatisticsChangeEvent = (): void => {
346fb726d48Sopenharmony_ci    let useStatistics = this.useStatisticsEl!.checked;
347fb726d48Sopenharmony_ci    this.useStatisticsChangeHandle(useStatistics);
348fb726d48Sopenharmony_ci  };
349fb726d48Sopenharmony_ci
350fb726d48Sopenharmony_ci  fpUnWindChangeEvent = (): void => {
351fb726d48Sopenharmony_ci    this.napiName!.disabled = !(!this.fp_unwind && this.recordJsStack);
352fb726d48Sopenharmony_ci  };
353fb726d48Sopenharmony_ci
354fb726d48Sopenharmony_ci  advanceOptionClickEvent = (): void => {
355fb726d48Sopenharmony_ci    if (!this.startSamp) {
356fb726d48Sopenharmony_ci      return;
357fb726d48Sopenharmony_ci    }
358fb726d48Sopenharmony_ci    this.advanceOptionHandle(this.addOptionButton!.textContent!);
359fb726d48Sopenharmony_ci  };
360fb726d48Sopenharmony_ci
361fb726d48Sopenharmony_ci  startupModeChangeEvent = (): void => {
362fb726d48Sopenharmony_ci    let process = this.processId?.shadowRoot?.querySelector('input') as HTMLInputElement;
363fb726d48Sopenharmony_ci    let processDiv = this.processId?.shadowRoot?.querySelector('.root') as HTMLDivElement;
364fb726d48Sopenharmony_ci    process.value = '';
365fb726d48Sopenharmony_ci    let packageInput = this.packageName?.shadowRoot?.querySelector('input') as HTMLInputElement;
366fb726d48Sopenharmony_ci    let packageDiv = this.packageName?.shadowRoot?.querySelector('.root') as HTMLDivElement;
367fb726d48Sopenharmony_ci    packageInput.value = '';
368fb726d48Sopenharmony_ci    if (this.startup_mode) {
369fb726d48Sopenharmony_ci      this.packageName!.showItem = '';
370fb726d48Sopenharmony_ci      this.packageName!.style.display = 'block';
371fb726d48Sopenharmony_ci      this.processId!.style.display = 'none';
372fb726d48Sopenharmony_ci      packageDiv.style.width = 'auto';
373fb726d48Sopenharmony_ci      packageInput!.placeholder = 'please select package';
374fb726d48Sopenharmony_ci      this.processId!.dataSource([], '');
375fb726d48Sopenharmony_ci    } else {
376fb726d48Sopenharmony_ci      this.processId!.showItems = [];
377fb726d48Sopenharmony_ci      this.packageName!.style.display = 'none';
378fb726d48Sopenharmony_ci      this.processId!.style.display = 'block';
379fb726d48Sopenharmony_ci      processDiv.style.width = 'auto';
380fb726d48Sopenharmony_ci      process!.placeholder = 'please select process';
381fb726d48Sopenharmony_ci      this.packageName!.dataSource = [];
382fb726d48Sopenharmony_ci    }
383fb726d48Sopenharmony_ci  };
384fb726d48Sopenharmony_ci
385fb726d48Sopenharmony_ci  jsStackModelChangeEvent = (): void => {
386fb726d48Sopenharmony_ci    this.jsStackDepth!.disabled = !this.recordJsStack;
387fb726d48Sopenharmony_ci    this.napiName!.disabled = !(!this.fp_unwind && this.recordJsStack);
388fb726d48Sopenharmony_ci  };
389fb726d48Sopenharmony_ci
390fb726d48Sopenharmony_ci  statisticsSliderMouseupEvent = (): void => {
391fb726d48Sopenharmony_ci    setTimeout((): void => {
392fb726d48Sopenharmony_ci      let percentValue = this.recordStatisticsResult!.getAttribute('percent');
393fb726d48Sopenharmony_ci      let index = Math.round(Number(percentValue) / NUM_450);
394fb726d48Sopenharmony_ci      index = index < 1 ? 0 : index;
395fb726d48Sopenharmony_ci      this.intervalResultInput!.value = `${stepValue[index]}`;
396fb726d48Sopenharmony_ci      this.recordStatisticsResult!.setAttribute('percentValue', `${stepValue[index]}`);
397fb726d48Sopenharmony_ci      if (this.intervalResultInput!.value === '0') {
398fb726d48Sopenharmony_ci        this.useStatisticsEl!.checked = false;
399fb726d48Sopenharmony_ci        this.useStatisticsChangeHandle(false);
400fb726d48Sopenharmony_ci      }
401fb726d48Sopenharmony_ci    });
402fb726d48Sopenharmony_ci  };
403fb726d48Sopenharmony_ci
404fb726d48Sopenharmony_ci  statisticsIntervalInputEvent = (): void => {
405fb726d48Sopenharmony_ci    let intervalValue = Number(this.statisticsIntervalInput!.value);
406fb726d48Sopenharmony_ci    if (intervalValue > 65535) {
407fb726d48Sopenharmony_ci      this.statisticsIntervalInput!.value = '65535';
408fb726d48Sopenharmony_ci    }
409fb726d48Sopenharmony_ci    if (intervalValue === 0 || this.statisticsIntervalInput!.value.startsWith('0')) {
410fb726d48Sopenharmony_ci      let resultValue = parseInt(this.statisticsIntervalInput!.value, 10);
411fb726d48Sopenharmony_ci      this.statisticsIntervalInput!.value = `${resultValue}`;
412fb726d48Sopenharmony_ci    }
413fb726d48Sopenharmony_ci  };
414fb726d48Sopenharmony_ci
415fb726d48Sopenharmony_ci  statisticsIntervalKeyUpEvent = (): void => {
416fb726d48Sopenharmony_ci    this.statisticsIntervalInput!.value = this.statisticsIntervalInput!.value.replace(/\D/g, '');
417fb726d48Sopenharmony_ci  };
418fb726d48Sopenharmony_ci
419fb726d48Sopenharmony_ci  private useStatisticsChangeHandle(useStatistics: boolean): void {
420fb726d48Sopenharmony_ci    if (useStatistics) {
421fb726d48Sopenharmony_ci      this.intervalResultInput!.value = '10';
422fb726d48Sopenharmony_ci      this.statisticsIntervalHandle();
423fb726d48Sopenharmony_ci      this.statisticsIntervalName!.textContent = 'Sample Interval';
424fb726d48Sopenharmony_ci      this.statisticsIntervalRange!.textContent = 'Rang is 0 - 65535, default 0 byte';
425fb726d48Sopenharmony_ci      this.statisticsIntervalInput!.value = '0';
426fb726d48Sopenharmony_ci      this.statisticsSlider!.disabled = false;
427fb726d48Sopenharmony_ci      this.intervalResultInput!.disabled = false;
428fb726d48Sopenharmony_ci    } else {
429fb726d48Sopenharmony_ci      this.intervalResultInput!.value = '0';
430fb726d48Sopenharmony_ci      this.statisticsIntervalHandle();
431fb726d48Sopenharmony_ci      this.statisticsIntervalName!.textContent = 'Malloc Free Matching Interval';
432fb726d48Sopenharmony_ci      this.statisticsIntervalRange!.textContent = 'Rang is 0 - 65535, default 10 s';
433fb726d48Sopenharmony_ci      this.statisticsIntervalInput!.value = '10';
434fb726d48Sopenharmony_ci      this.statisticsSlider!.disabled = true;
435fb726d48Sopenharmony_ci      this.intervalResultInput!.disabled = true;
436fb726d48Sopenharmony_ci    }
437fb726d48Sopenharmony_ci  }
438fb726d48Sopenharmony_ci
439fb726d48Sopenharmony_ci  private advanceOptionHandle(textValue: string): void {
440fb726d48Sopenharmony_ci    this.resetAdvanceItems();
441fb726d48Sopenharmony_ci    let displayStyle = 'none';
442fb726d48Sopenharmony_ci    if (textValue === 'Advance Options') {
443fb726d48Sopenharmony_ci      this.addOptionButton!.textContent = 'Normal Options';
444fb726d48Sopenharmony_ci      displayStyle = 'flex';
445fb726d48Sopenharmony_ci    } else {
446fb726d48Sopenharmony_ci      this.addOptionButton!.textContent = 'Advance Options';
447fb726d48Sopenharmony_ci    }
448fb726d48Sopenharmony_ci    this.advanceItems.forEach((itemEl) => {
449fb726d48Sopenharmony_ci      if (itemEl) {
450fb726d48Sopenharmony_ci        itemEl.style.display = displayStyle;
451fb726d48Sopenharmony_ci      }
452fb726d48Sopenharmony_ci    });
453fb726d48Sopenharmony_ci    this.jsStackDepth!.disabled = !this.recordJsStack;
454fb726d48Sopenharmony_ci    this.napiName!.disabled = !(!this.fp_unwind && this.recordJsStack);
455fb726d48Sopenharmony_ci  }
456fb726d48Sopenharmony_ci
457fb726d48Sopenharmony_ci  private resetAdvanceItems(): void {
458fb726d48Sopenharmony_ci    this.advanceItems = [
459fb726d48Sopenharmony_ci      this.recordAccuratelyDivEl,
460fb726d48Sopenharmony_ci      this.recordAccuratelyDivEl,
461fb726d48Sopenharmony_ci      this.offlineSymbolizationDivEl,
462fb726d48Sopenharmony_ci      this.jsStackRecordDepthEl,
463fb726d48Sopenharmony_ci      this.napiRecordEl,
464fb726d48Sopenharmony_ci      this.maxUnwindLevelEl,
465fb726d48Sopenharmony_ci      this.sharedMemorySizeEl,
466fb726d48Sopenharmony_ci      this.filterMemorySizeEl,
467fb726d48Sopenharmony_ci      this.sampleIntervalEl,
468fb726d48Sopenharmony_ci      this.useStartupEl,
469fb726d48Sopenharmony_ci      this.useResponseLibEl,
470fb726d48Sopenharmony_ci    ];
471fb726d48Sopenharmony_ci  }
472fb726d48Sopenharmony_ci
473fb726d48Sopenharmony_ci  private initNativeSwitchOption(): void {
474fb726d48Sopenharmony_ci    this.packageName!.style.display = 'none';
475fb726d48Sopenharmony_ci    let processInputEl = this.processId!.shadowRoot?.querySelector('input') as HTMLInputElement;
476fb726d48Sopenharmony_ci    processInputEl.addEventListener('mousedown', (): void => {
477fb726d48Sopenharmony_ci      this.processMouseDownHandler(processInputEl);
478fb726d48Sopenharmony_ci    });
479fb726d48Sopenharmony_ci    let packageInput = this.packageName!.shadowRoot?.querySelector('input') as HTMLInputElement;
480fb726d48Sopenharmony_ci    packageInput.addEventListener('mousedown', (): void => {
481fb726d48Sopenharmony_ci      this.packageMouseDownHandler(packageInput);
482fb726d48Sopenharmony_ci    });
483fb726d48Sopenharmony_ci    this.statisticsSlider!.sliderStyle = {
484fb726d48Sopenharmony_ci      minRange: 0,
485fb726d48Sopenharmony_ci      maxRange: 3600,
486fb726d48Sopenharmony_ci      defaultValue: '900',
487fb726d48Sopenharmony_ci      resultUnit: 'S',
488fb726d48Sopenharmony_ci      stepSize: 450,
489fb726d48Sopenharmony_ci      lineColor: 'var(--dark-color3,#46B1E3)',
490fb726d48Sopenharmony_ci      buttonColor: '#999999',
491fb726d48Sopenharmony_ci    };
492fb726d48Sopenharmony_ci    let parentElement = this.statisticsSlider!.parentNode as Element;
493fb726d48Sopenharmony_ci    this.intervalResultInput!.value = '10';
494fb726d48Sopenharmony_ci    parentElement.setAttribute('percent', '3600');
495fb726d48Sopenharmony_ci    this.intervalResultInput!.style.color = 'var(--dark-color1,#000000)';
496fb726d48Sopenharmony_ci    let litSwitch = this.shadowRoot?.querySelector('#switch-disabled') as LitSwitch;
497fb726d48Sopenharmony_ci    litSwitch.addEventListener('change', (event: Event): void => {
498fb726d48Sopenharmony_ci      // @ts-ignore
499fb726d48Sopenharmony_ci      let detail = event.detail;
500fb726d48Sopenharmony_ci      if (detail.checked) {
501fb726d48Sopenharmony_ci        this.unDisable();
502fb726d48Sopenharmony_ci      } else {
503fb726d48Sopenharmony_ci        this.disable();
504fb726d48Sopenharmony_ci      }
505fb726d48Sopenharmony_ci      this.addOptionButton!.textContent = 'Advance Options';
506fb726d48Sopenharmony_ci    });
507fb726d48Sopenharmony_ci    this.packageName!.style.display = 'none';
508fb726d48Sopenharmony_ci    this.processId!.style.display = 'block';
509fb726d48Sopenharmony_ci    let processDivEl = this.processId?.shadowRoot?.querySelector('.root') as HTMLDivElement;
510fb726d48Sopenharmony_ci    if (processDivEl) {
511fb726d48Sopenharmony_ci      processDivEl.style.width = 'auto';
512fb726d48Sopenharmony_ci    }
513fb726d48Sopenharmony_ci    this.disable();
514fb726d48Sopenharmony_ci  }
515fb726d48Sopenharmony_ci
516fb726d48Sopenharmony_ci  private processMouseDownHandler(process: HTMLInputElement): void {
517fb726d48Sopenharmony_ci    if (this.startSamp && !this.startup_mode) {
518fb726d48Sopenharmony_ci      Cmd.getProcess().then((processList: string[]): void => {
519fb726d48Sopenharmony_ci        this.processId?.dataSource(processList, '');
520fb726d48Sopenharmony_ci        if (processList.length > 0) {
521fb726d48Sopenharmony_ci          this.processId?.dataSource(processList, '');
522fb726d48Sopenharmony_ci        } else {
523fb726d48Sopenharmony_ci          this.processId?.dataSource([], '');
524fb726d48Sopenharmony_ci        }
525fb726d48Sopenharmony_ci      });
526fb726d48Sopenharmony_ci      process.readOnly = false;
527fb726d48Sopenharmony_ci    } else {
528fb726d48Sopenharmony_ci      process.readOnly = true;
529fb726d48Sopenharmony_ci      return;
530fb726d48Sopenharmony_ci    }
531fb726d48Sopenharmony_ci    if (this.startSamp && (SpRecordTrace.serialNumber === '' || this.startup_mode)) {
532fb726d48Sopenharmony_ci      this.processId?.dataSource([], '');
533fb726d48Sopenharmony_ci    } else {
534fb726d48Sopenharmony_ci    }
535fb726d48Sopenharmony_ci  }
536fb726d48Sopenharmony_ci
537fb726d48Sopenharmony_ci  private packageMouseDownHandler(packageInput: HTMLInputElement): void {
538fb726d48Sopenharmony_ci    if (this.startSamp && this.startup_mode) {
539fb726d48Sopenharmony_ci      Cmd.getPackage().then((packageList: string[]): void => {
540fb726d48Sopenharmony_ci        let finalDataList = packageList.map(str => str.replace(/\t/g, ''));
541fb726d48Sopenharmony_ci        if (finalDataList.length > 0) {
542fb726d48Sopenharmony_ci          this.packageName!.dataSource = finalDataList;
543fb726d48Sopenharmony_ci        } else {
544fb726d48Sopenharmony_ci          this.packageName!.dataSource = [];
545fb726d48Sopenharmony_ci        }
546fb726d48Sopenharmony_ci      });
547fb726d48Sopenharmony_ci      packageInput.readOnly = false;
548fb726d48Sopenharmony_ci    } else {
549fb726d48Sopenharmony_ci      packageInput.readOnly = true;
550fb726d48Sopenharmony_ci      return;
551fb726d48Sopenharmony_ci    }
552fb726d48Sopenharmony_ci  }
553fb726d48Sopenharmony_ci
554fb726d48Sopenharmony_ci  private statisticsIntervalHandle(): void {
555fb726d48Sopenharmony_ci    let parentElement = this.statisticsSlider!.parentNode as Element;
556fb726d48Sopenharmony_ci    if (this.recordStatisticsResult!.hasAttribute('percent')) {
557fb726d48Sopenharmony_ci      this.recordStatisticsResult!.removeAttribute('percent');
558fb726d48Sopenharmony_ci    }
559fb726d48Sopenharmony_ci    this.intervalResultInput!.style.color = 'var(--dark-color1,#000000)';
560fb726d48Sopenharmony_ci    this.intervalResultInput!.parentElement!.style.backgroundColor = 'var(--dark-background5,#F2F2F2)';
561fb726d48Sopenharmony_ci    this.intervalResultInput!.style.backgroundColor = 'var(--dark-background5,#F2F2F2)';
562fb726d48Sopenharmony_ci    if (this.intervalResultInput!.value.trim() === '') {
563fb726d48Sopenharmony_ci      this.intervalResultInput!.style.color = 'red';
564fb726d48Sopenharmony_ci      parentElement.setAttribute('percent', '3600');
565fb726d48Sopenharmony_ci      return;
566fb726d48Sopenharmony_ci    }
567fb726d48Sopenharmony_ci    if (
568fb726d48Sopenharmony_ci      Number(this.intervalResultInput!.value) < this.statisticsSlider!.sliderStyle.minRange ||
569fb726d48Sopenharmony_ci      Number(this.intervalResultInput!.value) > this.statisticsSlider!.sliderStyle.maxRange
570fb726d48Sopenharmony_ci    ) {
571fb726d48Sopenharmony_ci      this.intervalResultInput!.style.color = 'red';
572fb726d48Sopenharmony_ci      parentElement.setAttribute('percent', '3600');
573fb726d48Sopenharmony_ci    } else {
574fb726d48Sopenharmony_ci      let defaultSize = 0;
575fb726d48Sopenharmony_ci      let stepSize = 450;
576fb726d48Sopenharmony_ci      let inputValue = Number(this.intervalResultInput!.value);
577fb726d48Sopenharmony_ci      for (let stepIndex = 0; stepIndex < stepValue.length; stepIndex++) {
578fb726d48Sopenharmony_ci        let currentValue = stepValue[stepIndex];
579fb726d48Sopenharmony_ci        if (inputValue === currentValue) {
580fb726d48Sopenharmony_ci          defaultSize = stepIndex * stepSize;
581fb726d48Sopenharmony_ci          break;
582fb726d48Sopenharmony_ci        } else if (inputValue < currentValue && stepIndex !== 0) {
583fb726d48Sopenharmony_ci          defaultSize =
584fb726d48Sopenharmony_ci            ((inputValue - stepValue[stepIndex - 1]) / (currentValue - stepValue[stepIndex - 1])) * stepSize +
585fb726d48Sopenharmony_ci            stepSize * (stepIndex - 1);
586fb726d48Sopenharmony_ci          break;
587fb726d48Sopenharmony_ci        }
588fb726d48Sopenharmony_ci      }
589fb726d48Sopenharmony_ci      this.statisticsSlider!.percent = `${defaultSize}`;
590fb726d48Sopenharmony_ci      let htmlInputElement = this.statisticsSlider!.shadowRoot?.querySelector('#slider') as HTMLInputElement;
591fb726d48Sopenharmony_ci      this.statisticsSlider!.sliderStyle = {
592fb726d48Sopenharmony_ci        minRange: 0,
593fb726d48Sopenharmony_ci        maxRange: 3600,
594fb726d48Sopenharmony_ci        defaultValue: `${defaultSize}`,
595fb726d48Sopenharmony_ci        resultUnit: 'S',
596fb726d48Sopenharmony_ci        stepSize: 1,
597fb726d48Sopenharmony_ci        lineColor: 'var(--dark-color3,#46B1E3)',
598fb726d48Sopenharmony_ci        buttonColor: '#999999',
599fb726d48Sopenharmony_ci      };
600fb726d48Sopenharmony_ci      htmlInputElement.value = `${defaultSize}`;
601fb726d48Sopenharmony_ci      parentElement.setAttribute('percent', this.intervalResultInput!.value);
602fb726d48Sopenharmony_ci      parentElement.setAttribute('percentValue', this.intervalResultInput!.value);
603fb726d48Sopenharmony_ci    }
604fb726d48Sopenharmony_ci  }
605fb726d48Sopenharmony_ci
606fb726d48Sopenharmony_ci  private unDisable(): void {
607fb726d48Sopenharmony_ci    this.startSamp = true;
608fb726d48Sopenharmony_ci    if (this.fpUnWind) {
609fb726d48Sopenharmony_ci      this.fpUnWind.disabled = false;
610fb726d48Sopenharmony_ci    }
611fb726d48Sopenharmony_ci    if (this.recordAccurately) {
612fb726d48Sopenharmony_ci      this.recordAccurately.disabled = false;
613fb726d48Sopenharmony_ci    }
614fb726d48Sopenharmony_ci    if (this.offlineSymbol) {
615fb726d48Sopenharmony_ci      this.offlineSymbol.disabled = false;
616fb726d48Sopenharmony_ci    }
617fb726d48Sopenharmony_ci    if (this.startupMode) {
618fb726d48Sopenharmony_ci      this.startupMode.disabled = false;
619fb726d48Sopenharmony_ci    }
620fb726d48Sopenharmony_ci    if (this.jsStackModel) {
621fb726d48Sopenharmony_ci      this.jsStackModel.disabled = false;
622fb726d48Sopenharmony_ci    }
623fb726d48Sopenharmony_ci    if (this.responseLibMode) {
624fb726d48Sopenharmony_ci      this.responseLibMode.disabled = false;
625fb726d48Sopenharmony_ci    }
626fb726d48Sopenharmony_ci    if (this.statisticsIntervalInput) {
627fb726d48Sopenharmony_ci      this.statisticsIntervalInput.disabled = false;
628fb726d48Sopenharmony_ci    }
629fb726d48Sopenharmony_ci    if (this.useStatisticsEl) {
630fb726d48Sopenharmony_ci      this.useStatisticsEl.disabled = false;
631fb726d48Sopenharmony_ci    }
632fb726d48Sopenharmony_ci    this.processId!.removeAttribute('disabled');
633fb726d48Sopenharmony_ci    let inputBoxes = this.shadowRoot?.querySelectorAll<HTMLInputElement>('.inputBoxes');
634fb726d48Sopenharmony_ci    inputBoxes!.forEach((item: HTMLInputElement): void => {
635fb726d48Sopenharmony_ci      item.disabled = false;
636fb726d48Sopenharmony_ci    });
637fb726d48Sopenharmony_ci    if (this.startup_mode) {
638fb726d48Sopenharmony_ci      this.packageName!.removeAttribute('disabled');
639fb726d48Sopenharmony_ci    } else {
640fb726d48Sopenharmony_ci      this.processId!.removeAttribute('disabled');
641fb726d48Sopenharmony_ci    }
642fb726d48Sopenharmony_ci    this.statisticsSlider!.disabled = false;
643fb726d48Sopenharmony_ci  }
644fb726d48Sopenharmony_ci
645fb726d48Sopenharmony_ci  private disable(): void {
646fb726d48Sopenharmony_ci    this.startSamp = false;
647fb726d48Sopenharmony_ci    this.advanceOptionHandle('Normal Options');
648fb726d48Sopenharmony_ci    if (this.fpUnWind) {
649fb726d48Sopenharmony_ci      this.fpUnWind.disabled = true;
650fb726d48Sopenharmony_ci    }
651fb726d48Sopenharmony_ci    if (this.recordAccurately) {
652fb726d48Sopenharmony_ci      this.recordAccurately.disabled = true;
653fb726d48Sopenharmony_ci    }
654fb726d48Sopenharmony_ci    if (this.startupMode) {
655fb726d48Sopenharmony_ci      this.startupMode.disabled = true;
656fb726d48Sopenharmony_ci    }
657fb726d48Sopenharmony_ci    if (this.jsStackModel) {
658fb726d48Sopenharmony_ci      this.jsStackModel.disabled = true;
659fb726d48Sopenharmony_ci    }
660fb726d48Sopenharmony_ci    if (this.offlineSymbol) {
661fb726d48Sopenharmony_ci      this.offlineSymbol.disabled = true;
662fb726d48Sopenharmony_ci    }
663fb726d48Sopenharmony_ci    if (this.responseLibMode) {
664fb726d48Sopenharmony_ci      this.responseLibMode.disabled = true;
665fb726d48Sopenharmony_ci    }
666fb726d48Sopenharmony_ci    if (this.statisticsIntervalInput) {
667fb726d48Sopenharmony_ci      this.statisticsIntervalInput.disabled = true;
668fb726d48Sopenharmony_ci    }
669fb726d48Sopenharmony_ci    if (this.useStatisticsEl) {
670fb726d48Sopenharmony_ci      this.useStatisticsEl.disabled = true;
671fb726d48Sopenharmony_ci    }
672fb726d48Sopenharmony_ci    this.processId!.setAttribute('disabled', '');
673fb726d48Sopenharmony_ci    let inputBoxes = this.shadowRoot?.querySelectorAll<HTMLInputElement>('.inputBoxes');
674fb726d48Sopenharmony_ci    inputBoxes!.forEach((item: HTMLInputElement): void => {
675fb726d48Sopenharmony_ci      item.disabled = true;
676fb726d48Sopenharmony_ci    });
677fb726d48Sopenharmony_ci    if (this.startup_mode) {
678fb726d48Sopenharmony_ci      this.packageName!.setAttribute('disabled', '');
679fb726d48Sopenharmony_ci    } else {
680fb726d48Sopenharmony_ci      this.processId!.setAttribute('disabled', '');
681fb726d48Sopenharmony_ci    }
682fb726d48Sopenharmony_ci    this.statisticsSlider!.disabled = true;
683fb726d48Sopenharmony_ci  }
684fb726d48Sopenharmony_ci}
685fb726d48Sopenharmony_ci
686fb726d48Sopenharmony_ciconst stepValue: number[] = [0, 1, 10, NUM_30, NUM_60, NUM_300, NUM_600, NUM_1800, NUM_3600];
687