• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16var __decorate =
17  (this && this.__decorate) ||
18  function (b7, c7, d7, e7) {
19    var f7 = arguments.length,
20      g7 =
21        f7 < 3
22          ? c7
23          : e7 === null
24          ? (e7 = Object.getOwnPropertyDescriptor(c7, d7))
25          : e7,
26      h7;
27    if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function') {
28      g7 = Reflect.decorate(b7, c7, d7, e7);
29    } else {
30      for (var i7 = b7.length - 1; i7 >= 0; i7--) {
31        if ((h7 = b7[i7])) {
32          g7 = (f7 < 3 ? h7(g7) : f7 > 3 ? h7(c7, d7, g7) : h7(c7, d7)) || g7;
33        }
34      }
35    }
36    return f7 > 3 && g7 && Object.defineProperty(c7, d7, g7), g7;
37  };
38if (!('finalizeConstruction' in ViewPU.prototype)) {
39  Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => {});
40}
41if (PUV2ViewBase.contextStack === undefined) {
42  Reflect.set(PUV2ViewBase, 'contextStack', []);
43}
44const curves = requireNativeModule('ohos.curves');
45const LengthMetrics = requireNapi('arkui.node').LengthMetrics;
46const LengthUnit = requireNapi('arkui.node').LengthUnit;
47const i18n = requireNapi('i18n');
48const util = requireNapi('util');
49
50const SMALLEST_MAX_FONT_SCALE = 1;
51const LARGEST_MAX_FONT_SCALE = 2;
52const SMALLEST_MIN_FONT_SCALE = 0;
53const LARGEST_MIN_FONT_SCALE = 1;
54const tabSimpleTheme = {
55  buttonBackgroundColor: {
56    id: -1,
57    type: 10001,
58    params: ['sys.color.segment_button_v2_tab_button_background'],
59    bundleName: '__harDefaultBundleName__',
60    moduleName: '__harDefaultModuleName__',
61  },
62  buttonBorderRadius: {
63    id: -1,
64    type: 10002,
65    params: ['sys.float.segment_button_v2_background_corner_radius'],
66    bundleName: '__harDefaultBundleName__',
67    moduleName: '__harDefaultModuleName__',
68  },
69  buttonMinHeight: {
70    id: -1,
71    type: 10002,
72    params: ['sys.float.segment_button_v2_singleline_background_height'],
73    bundleName: '__harDefaultBundleName__',
74    moduleName: '__harDefaultModuleName__',
75  },
76  hybridButtonMinHeight: {
77    id: -1,
78    type: 10002,
79    params: ['sys.float.segment_button_v2_doubleline_background_height'],
80    bundleName: '__harDefaultBundleName__',
81    moduleName: '__harDefaultModuleName__',
82  },
83  buttonPadding: {
84    id: -1,
85    type: 10002,
86    params: ['sys.float.padding_level1'],
87    bundleName: '__harDefaultBundleName__',
88    moduleName: '__harDefaultModuleName__',
89  },
90  itemSelectedBackgroundColor: {
91    id: -1,
92    type: 10001,
93    params: ['sys.color.segment_button_v2_tab_selected_item_background'],
94    bundleName: '__harDefaultBundleName__',
95    moduleName: '__harDefaultModuleName__',
96  },
97  itemBorderRadius: {
98    id: -1,
99    type: 10002,
100    params: ['sys.float.segment_button_v2_selected_corner_radius'],
101    bundleName: '__harDefaultBundleName__',
102    moduleName: '__harDefaultModuleName__',
103  },
104  itemSpace: LengthMetrics.vp(0),
105  itemFontSize: {
106    id: -1,
107    type: 10002,
108    params: ['sys.float.ohos_id_text_size_button2'],
109    bundleName: '__harDefaultBundleName__',
110    moduleName: '__harDefaultModuleName__',
111  },
112  itemFontColor: {
113    id: -1,
114    type: 10001,
115    params: ['sys.color.font_secondary'],
116    bundleName: '__harDefaultBundleName__',
117    moduleName: '__harDefaultModuleName__',
118  },
119  itemSelectedFontColor: {
120    id: -1,
121    type: 10001,
122    params: ['sys.color.font_primary'],
123    bundleName: '__harDefaultBundleName__',
124    moduleName: '__harDefaultModuleName__',
125  },
126  itemFontWeight: FontWeight.Medium,
127  itemSelectedFontWeight: FontWeight.Medium,
128  itemIconSize: 24,
129  itemIconFillColor: {
130    id: -1,
131    type: 10001,
132    params: ['sys.color.font_secondary'],
133    bundleName: '__harDefaultBundleName__',
134    moduleName: '__harDefaultModuleName__',
135  },
136  itemSelectedIconFillColor: {
137    id: -1,
138    type: 10001,
139    params: ['sys.color.font_primary'],
140    bundleName: '__harDefaultBundleName__',
141    moduleName: '__harDefaultModuleName__',
142  },
143  itemSymbolFontSize: 20,
144  itemSymbolFontColor: {
145    id: -1,
146    type: 10001,
147    params: ['sys.color.font_secondary'],
148    bundleName: '__harDefaultBundleName__',
149    moduleName: '__harDefaultModuleName__',
150  },
151  itemSelectedSymbolFontColor: {
152    id: -1,
153    type: 10001,
154    params: ['sys.color.font_primary'],
155    bundleName: '__harDefaultBundleName__',
156    moduleName: '__harDefaultModuleName__',
157  },
158  itemMinHeight: {
159    id: -1,
160    type: 10002,
161    params: ['sys.float.segment_button_v2_singleline_selected_height'],
162    bundleName: '__harDefaultBundleName__',
163    moduleName: '__harDefaultModuleName__',
164  },
165  hybridItemMinHeight: {
166    id: -1,
167    type: 10002,
168    params: ['sys.float.segment_button_v2_doubleline_selected_height'],
169    bundleName: '__harDefaultBundleName__',
170    moduleName: '__harDefaultModuleName__',
171  },
172  itemPadding: {
173    top: LengthMetrics.resource({
174      id: -1,
175      type: 10002,
176      params: ['sys.float.padding_level2'],
177      bundleName: '__harDefaultBundleName__',
178      moduleName: '__harDefaultModuleName__',
179    }),
180    bottom: LengthMetrics.resource({
181      id: -1,
182      type: 10002,
183      params: ['sys.float.padding_level2'],
184      bundleName: '__harDefaultBundleName__',
185      moduleName: '__harDefaultModuleName__',
186    }),
187    start: LengthMetrics.resource({
188      id: -1,
189      type: 10002,
190      params: ['sys.float.padding_level4'],
191      bundleName: '__harDefaultBundleName__',
192      moduleName: '__harDefaultModuleName__',
193    }),
194    end: LengthMetrics.resource({
195      id: -1,
196      type: 10002,
197      params: ['sys.float.padding_level4'],
198      bundleName: '__harDefaultBundleName__',
199      moduleName: '__harDefaultModuleName__',
200    }),
201  },
202  itemShadow: ShadowStyle.OUTER_DEFAULT_XS,
203  itemMaxFontScale: SMALLEST_MAX_FONT_SCALE,
204  itemMaxFontScaleSmallest: SMALLEST_MAX_FONT_SCALE,
205  itemMaxFontScaleLargest: LARGEST_MAX_FONT_SCALE,
206  itemMinFontScale: SMALLEST_MIN_FONT_SCALE,
207  itemMinFontScaleSmallest: SMALLEST_MIN_FONT_SCALE,
208  itemMinFontScaleLargest: LARGEST_MIN_FONT_SCALE,
209};
210const capsuleSimpleTheme = {
211  buttonBackgroundColor: {
212    id: -1,
213    type: 10001,
214    params: ['sys.color.segment_button_v2_tab_button_background'],
215    bundleName: '__harDefaultBundleName__',
216    moduleName: '__harDefaultModuleName__',
217  },
218  buttonBorderRadius: {
219    id: -1,
220    type: 10002,
221    params: ['sys.float.segment_button_v2_background_corner_radius'],
222    bundleName: '__harDefaultBundleName__',
223    moduleName: '__harDefaultModuleName__',
224  },
225  buttonMinHeight: {
226    id: -1,
227    type: 10002,
228    params: ['sys.float.segment_button_v2_singleline_background_height'],
229    bundleName: '__harDefaultBundleName__',
230    moduleName: '__harDefaultModuleName__',
231  },
232  hybridButtonMinHeight: {
233    id: -1,
234    type: 10002,
235    params: ['sys.float.segment_button_v2_doubleline_background_height'],
236    bundleName: '__harDefaultBundleName__',
237    moduleName: '__harDefaultModuleName__',
238  },
239  buttonPadding: {
240    id: -1,
241    type: 10002,
242    params: ['sys.float.padding_level1'],
243    bundleName: '__harDefaultBundleName__',
244    moduleName: '__harDefaultModuleName__',
245  },
246  itemSelectedBackgroundColor: {
247    id: -1,
248    type: 10001,
249    params: ['sys.color.comp_background_emphasize'],
250    bundleName: '__harDefaultBundleName__',
251    moduleName: '__harDefaultModuleName__',
252  },
253  itemBorderRadius: {
254    id: -1,
255    type: 10002,
256    params: ['sys.float.segment_button_v2_selected_corner_radius'],
257    bundleName: '__harDefaultBundleName__',
258    moduleName: '__harDefaultModuleName__',
259  },
260  itemSpace: LengthMetrics.vp(0),
261  itemFontSize: {
262    id: -1,
263    type: 10002,
264    params: ['sys.float.ohos_id_text_size_button2'],
265    bundleName: '__harDefaultBundleName__',
266    moduleName: '__harDefaultModuleName__',
267  },
268  itemFontColor: {
269    id: -1,
270    type: 10001,
271    params: ['sys.color.font_secondary'],
272    bundleName: '__harDefaultBundleName__',
273    moduleName: '__harDefaultModuleName__',
274  },
275  itemSelectedFontColor: {
276    id: -1,
277    type: 10001,
278    params: ['sys.color.font_on_primary'],
279    bundleName: '__harDefaultBundleName__',
280    moduleName: '__harDefaultModuleName__',
281  },
282  itemFontWeight: FontWeight.Medium,
283  itemSelectedFontWeight: FontWeight.Medium,
284  itemIconSize: 24,
285  itemIconFillColor: {
286    id: -1,
287    type: 10001,
288    params: ['sys.color.icon_secondary'],
289    bundleName: '__harDefaultBundleName__',
290    moduleName: '__harDefaultModuleName__',
291  },
292  itemSelectedIconFillColor: {
293    id: -1,
294    type: 10001,
295    params: ['sys.color.font_on_primary'],
296    bundleName: '__harDefaultBundleName__',
297    moduleName: '__harDefaultModuleName__',
298  },
299  itemSymbolFontSize: 20,
300  itemSymbolFontColor: {
301    id: -1,
302    type: 10001,
303    params: ['sys.color.font_secondary'],
304    bundleName: '__harDefaultBundleName__',
305    moduleName: '__harDefaultModuleName__',
306  },
307  itemSelectedSymbolFontColor: {
308    id: -1,
309    type: 10001,
310    params: ['sys.color.font_on_primary'],
311    bundleName: '__harDefaultBundleName__',
312    moduleName: '__harDefaultModuleName__',
313  },
314  itemMinHeight: {
315    id: -1,
316    type: 10002,
317    params: ['sys.float.segment_button_v2_singleline_selected_height'],
318    bundleName: '__harDefaultBundleName__',
319    moduleName: '__harDefaultModuleName__',
320  },
321  hybridItemMinHeight: {
322    id: -1,
323    type: 10002,
324    params: ['sys.float.segment_button_v2_doubleline_selected_height'],
325    bundleName: '__harDefaultBundleName__',
326    moduleName: '__harDefaultModuleName__',
327  },
328  itemPadding: {
329    top: LengthMetrics.resource({
330      id: -1,
331      type: 10002,
332      params: ['sys.float.padding_level2'],
333      bundleName: '__harDefaultBundleName__',
334      moduleName: '__harDefaultModuleName__',
335    }),
336    bottom: LengthMetrics.resource({
337      id: -1,
338      type: 10002,
339      params: ['sys.float.padding_level2'],
340      bundleName: '__harDefaultBundleName__',
341      moduleName: '__harDefaultModuleName__',
342    }),
343    start: LengthMetrics.resource({
344      id: -1,
345      type: 10002,
346      params: ['sys.float.padding_level4'],
347      bundleName: '__harDefaultBundleName__',
348      moduleName: '__harDefaultModuleName__',
349    }),
350    end: LengthMetrics.resource({
351      id: -1,
352      type: 10002,
353      params: ['sys.float.padding_level4'],
354      bundleName: '__harDefaultBundleName__',
355      moduleName: '__harDefaultModuleName__',
356    }),
357  },
358  itemShadow: ShadowStyle.OUTER_DEFAULT_XS,
359  itemMaxFontScale: SMALLEST_MAX_FONT_SCALE,
360  itemMaxFontScaleSmallest: SMALLEST_MAX_FONT_SCALE,
361  itemMaxFontScaleLargest: LARGEST_MAX_FONT_SCALE,
362  itemMinFontScale: SMALLEST_MIN_FONT_SCALE,
363  itemMinFontScaleSmallest: SMALLEST_MIN_FONT_SCALE,
364  itemMinFontScaleLargest: LARGEST_MIN_FONT_SCALE,
365};
366let SegmentButtonV2Item = class SegmentButtonV2Item {
367  constructor(a7) {
368    this.text = a7.text;
369    this.icon = a7.icon;
370    this.symbol = a7.symbol;
371    this.enabled = a7.enabled ?? true;
372    this.textModifier = a7.textModifier;
373    this.iconModifier = a7.iconModifier;
374    this.symbolModifier = a7.symbolModifier;
375    this.accessibilityText = a7.accessibilityText;
376    this.accessibilityDescription = a7.accessibilityDescription;
377    this.accessibilityLevel = a7.accessibilityLevel;
378  }
379
380  get isHybrid() {
381    return !!this.text && (!!this.icon || !!this.symbol);
382  }
383};
384__decorate([Trace], SegmentButtonV2Item.prototype, 'text', void 0);
385__decorate([Trace], SegmentButtonV2Item.prototype, 'icon', void 0);
386__decorate([Trace], SegmentButtonV2Item.prototype, 'symbol', void 0);
387__decorate([Trace], SegmentButtonV2Item.prototype, 'enabled', void 0);
388__decorate([Trace], SegmentButtonV2Item.prototype, 'textModifier', void 0);
389__decorate([Trace], SegmentButtonV2Item.prototype, 'iconModifier', void 0);
390__decorate([Trace], SegmentButtonV2Item.prototype, 'symbolModifier', void 0);
391__decorate([Trace], SegmentButtonV2Item.prototype, 'accessibilityText', void 0);
392__decorate(
393  [Trace],
394  SegmentButtonV2Item.prototype,
395  'accessibilityDescription',
396  void 0
397);
398__decorate(
399  [Trace],
400  SegmentButtonV2Item.prototype,
401  'accessibilityLevel',
402  void 0
403);
404__decorate([Computed], SegmentButtonV2Item.prototype, 'isHybrid', null);
405SegmentButtonV2Item = __decorate([ObservedV2], SegmentButtonV2Item);
406
407export { SegmentButtonV2Item };
408let SegmentButtonV2Items = class SegmentButtonV2Items extends Array {
409  constructor(y6) {
410    super(typeof y6 === 'number' ? y6 : 0);
411    if (typeof y6 !== 'number' && y6 && y6.length) {
412      for (let z6 of y6) {
413        if (z6) {
414          this.push(new SegmentButtonV2Item(z6));
415        }
416      }
417    }
418  }
419
420  get hasHybrid() {
421    return this.some((x6) => x6.isHybrid);
422  }
423};
424__decorate([Computed], SegmentButtonV2Items.prototype, 'hasHybrid', null);
425SegmentButtonV2Items = __decorate([ObservedV2], SegmentButtonV2Items);
426
427export { SegmentButtonV2Items };
428const EMPTY_ITEMS = new SegmentButtonV2Items([]);
429
430export class TabSegmentButtonV2 extends ViewV2 {
431  constructor(r6, s6, t6, u6 = -1, v6, w6) {
432    super(r6, u6, w6);
433    this.initParam('items', s6 && 'items' in s6 ? s6.items : undefined);
434    this.initParam(
435      'selectedIndex',
436      s6 && 'selectedIndex' in s6 ? s6.selectedIndex : undefined
437    );
438    this.$selectedIndex = '$selectedIndex' in s6 ? s6.$selectedIndex : () => {};
439    this.onItemClicked = 'onItemClicked' in s6 ? s6.onItemClicked : () => {};
440    this.initParam(
441      'itemMinFontScale',
442      s6 && 'itemMinFontScale' in s6 ? s6.itemMinFontScale : undefined
443    );
444    this.initParam(
445      'itemMaxFontScale',
446      s6 && 'itemMaxFontScale' in s6 ? s6.itemMaxFontScale : undefined
447    );
448    this.initParam(
449      'itemSpace',
450      s6 && 'itemSpace' in s6 ? s6.itemSpace : undefined
451    );
452    this.initParam(
453      'itemFontSize',
454      s6 && 'itemFontSize' in s6 ? s6.itemFontSize : undefined
455    );
456    this.initParam(
457      'itemSelectedFontSize',
458      s6 && 'itemSelectedFontSize' in s6 ? s6.itemSelectedFontSize : undefined
459    );
460    this.initParam(
461      'itemFontColor',
462      s6 && 'itemFontColor' in s6 ? s6.itemFontColor : undefined
463    );
464    this.initParam(
465      'itemSelectedFontColor',
466      s6 && 'itemSelectedFontColor' in s6 ? s6.itemSelectedFontColor : undefined
467    );
468    this.initParam(
469      'itemFontWeight',
470      s6 && 'itemFontWeight' in s6 ? s6.itemFontWeight : undefined
471    );
472    this.initParam(
473      'itemSelectedFontWeight',
474      s6 && 'itemSelectedFontWeight' in s6
475        ? s6.itemSelectedFontWeight
476        : undefined
477    );
478    this.initParam(
479      'itemBorderRadius',
480      s6 && 'itemBorderRadius' in s6 ? s6.itemBorderRadius : undefined
481    );
482    this.initParam(
483      'itemSelectedBackgroundColor',
484      s6 && 'itemSelectedBackgroundColor' in s6
485        ? s6.itemSelectedBackgroundColor
486        : undefined
487    );
488    this.initParam(
489      'itemIconSize',
490      s6 && 'itemIconSize' in s6 ? s6.itemIconSize : undefined
491    );
492    this.initParam(
493      'itemIconFillColor',
494      s6 && 'itemIconFillColor' in s6 ? s6.itemIconFillColor : undefined
495    );
496    this.initParam(
497      'itemSelectedIconFillColor',
498      s6 && 'itemSelectedIconFillColor' in s6
499        ? s6.itemSelectedIconFillColor
500        : undefined
501    );
502    this.initParam(
503      'itemSymbolFontSize',
504      s6 && 'itemSymbolFontSize' in s6 ? s6.itemSymbolFontSize : undefined
505    );
506    this.initParam(
507      'itemSymbolFontColor',
508      s6 && 'itemSymbolFontColor' in s6 ? s6.itemSymbolFontColor : undefined
509    );
510    this.initParam(
511      'itemSelectedSymbolFontColor',
512      s6 && 'itemSelectedSymbolFontColor' in s6
513        ? s6.itemSelectedSymbolFontColor
514        : undefined
515    );
516    this.initParam(
517      'itemMinHeight',
518      s6 && 'itemMinHeight' in s6 ? s6.itemMinHeight : undefined
519    );
520    this.initParam(
521      'itemPadding',
522      s6 && 'itemPadding' in s6 ? s6.itemPadding : undefined
523    );
524    this.initParam(
525      'itemShadow',
526      s6 && 'itemShadow' in s6 ? s6.itemShadow : undefined
527    );
528    this.initParam(
529      'buttonBackgroundColor',
530      s6 && 'buttonBackgroundColor' in s6 ? s6.buttonBackgroundColor : undefined
531    );
532    this.initParam(
533      'buttonBackgroundBlurStyle',
534      s6 && 'buttonBackgroundBlurStyle' in s6
535        ? s6.buttonBackgroundBlurStyle
536        : undefined
537    );
538    this.initParam(
539      'buttonBackgroundBlurStyleOptions',
540      s6 && 'buttonBackgroundBlurStyleOptions' in s6
541        ? s6.buttonBackgroundBlurStyleOptions
542        : undefined
543    );
544    this.initParam(
545      'buttonBackgroundEffect',
546      s6 && 'buttonBackgroundEffect' in s6
547        ? s6.buttonBackgroundEffect
548        : undefined
549    );
550    this.initParam(
551      'buttonBorderRadius',
552      s6 && 'buttonBorderRadius' in s6 ? s6.buttonBorderRadius : undefined
553    );
554    this.initParam(
555      'buttonMinHeight',
556      s6 && 'buttonMinHeight' in s6 ? s6.buttonMinHeight : undefined
557    );
558    this.initParam(
559      'buttonPadding',
560      s6 && 'buttonPadding' in s6 ? s6.buttonPadding : undefined
561    );
562    this.initParam(
563      'languageDirection',
564      s6 && 'languageDirection' in s6 ? s6.languageDirection : undefined
565    );
566    this.finalizeConstruction();
567  }
568
569  resetStateVarsOnReuse(q6) {
570    this.resetParam('items', q6 && 'items' in q6 ? q6.items : undefined);
571    this.resetParam(
572      'selectedIndex',
573      q6 && 'selectedIndex' in q6 ? q6.selectedIndex : undefined
574    );
575    this.$selectedIndex = '$selectedIndex' in q6 ? q6.$selectedIndex : () => {};
576    this.onItemClicked = 'onItemClicked' in q6 ? q6.onItemClicked : () => {};
577    this.resetParam(
578      'itemMinFontScale',
579      q6 && 'itemMinFontScale' in q6 ? q6.itemMinFontScale : undefined
580    );
581    this.resetParam(
582      'itemMaxFontScale',
583      q6 && 'itemMaxFontScale' in q6 ? q6.itemMaxFontScale : undefined
584    );
585    this.resetParam(
586      'itemSpace',
587      q6 && 'itemSpace' in q6 ? q6.itemSpace : undefined
588    );
589    this.resetParam(
590      'itemFontSize',
591      q6 && 'itemFontSize' in q6 ? q6.itemFontSize : undefined
592    );
593    this.resetParam(
594      'itemSelectedFontSize',
595      q6 && 'itemSelectedFontSize' in q6 ? q6.itemSelectedFontSize : undefined
596    );
597    this.resetParam(
598      'itemFontColor',
599      q6 && 'itemFontColor' in q6 ? q6.itemFontColor : undefined
600    );
601    this.resetParam(
602      'itemSelectedFontColor',
603      q6 && 'itemSelectedFontColor' in q6 ? q6.itemSelectedFontColor : undefined
604    );
605    this.resetParam(
606      'itemFontWeight',
607      q6 && 'itemFontWeight' in q6 ? q6.itemFontWeight : undefined
608    );
609    this.resetParam(
610      'itemSelectedFontWeight',
611      q6 && 'itemSelectedFontWeight' in q6
612        ? q6.itemSelectedFontWeight
613        : undefined
614    );
615    this.resetParam(
616      'itemBorderRadius',
617      q6 && 'itemBorderRadius' in q6 ? q6.itemBorderRadius : undefined
618    );
619    this.resetParam(
620      'itemSelectedBackgroundColor',
621      q6 && 'itemSelectedBackgroundColor' in q6
622        ? q6.itemSelectedBackgroundColor
623        : undefined
624    );
625    this.resetParam(
626      'itemIconSize',
627      q6 && 'itemIconSize' in q6 ? q6.itemIconSize : undefined
628    );
629    this.resetParam(
630      'itemIconFillColor',
631      q6 && 'itemIconFillColor' in q6 ? q6.itemIconFillColor : undefined
632    );
633    this.resetParam(
634      'itemSelectedIconFillColor',
635      q6 && 'itemSelectedIconFillColor' in q6
636        ? q6.itemSelectedIconFillColor
637        : undefined
638    );
639    this.resetParam(
640      'itemSymbolFontSize',
641      q6 && 'itemSymbolFontSize' in q6 ? q6.itemSymbolFontSize : undefined
642    );
643    this.resetParam(
644      'itemSymbolFontColor',
645      q6 && 'itemSymbolFontColor' in q6 ? q6.itemSymbolFontColor : undefined
646    );
647    this.resetParam(
648      'itemSelectedSymbolFontColor',
649      q6 && 'itemSelectedSymbolFontColor' in q6
650        ? q6.itemSelectedSymbolFontColor
651        : undefined
652    );
653    this.resetParam(
654      'itemMinHeight',
655      q6 && 'itemMinHeight' in q6 ? q6.itemMinHeight : undefined
656    );
657    this.resetParam(
658      'itemPadding',
659      q6 && 'itemPadding' in q6 ? q6.itemPadding : undefined
660    );
661    this.resetParam(
662      'itemShadow',
663      q6 && 'itemShadow' in q6 ? q6.itemShadow : undefined
664    );
665    this.resetParam(
666      'buttonBackgroundColor',
667      q6 && 'buttonBackgroundColor' in q6 ? q6.buttonBackgroundColor : undefined
668    );
669    this.resetParam(
670      'buttonBackgroundBlurStyle',
671      q6 && 'buttonBackgroundBlurStyle' in q6
672        ? q6.buttonBackgroundBlurStyle
673        : undefined
674    );
675    this.resetParam(
676      'buttonBackgroundBlurStyleOptions',
677      q6 && 'buttonBackgroundBlurStyleOptions' in q6
678        ? q6.buttonBackgroundBlurStyleOptions
679        : undefined
680    );
681    this.resetParam(
682      'buttonBackgroundEffect',
683      q6 && 'buttonBackgroundEffect' in q6
684        ? q6.buttonBackgroundEffect
685        : undefined
686    );
687    this.resetParam(
688      'buttonBorderRadius',
689      q6 && 'buttonBorderRadius' in q6 ? q6.buttonBorderRadius : undefined
690    );
691    this.resetParam(
692      'buttonMinHeight',
693      q6 && 'buttonMinHeight' in q6 ? q6.buttonMinHeight : undefined
694    );
695    this.resetParam(
696      'buttonPadding',
697      q6 && 'buttonPadding' in q6 ? q6.buttonPadding : undefined
698    );
699    this.resetParam(
700      'languageDirection',
701      q6 && 'languageDirection' in q6 ? q6.languageDirection : undefined
702    );
703  }
704
705  initialRender() {
706    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
707    {
708      this.observeComponentCreation2(
709        (k6, l6) => {
710          if (l6) {
711            let m6 = new SimpleSegmentButtonV2(
712              this,
713              {
714                theme: tabSimpleTheme,
715                items: this.items,
716                selectedIndex: this.selectedIndex,
717                $selectedIndex: (p6) => {
718                  this.$selectedIndex?.(p6);
719                },
720                onItemClicked: this.onItemClicked,
721                itemMinFontScale: this.itemMinFontScale,
722                itemMaxFontScale: this.itemMaxFontScale,
723                itemSpace: this.itemSpace,
724                itemFontColor: this.itemFontColor,
725                itemSelectedFontColor: this.itemSelectedFontColor,
726                itemFontSize: this.itemFontSize,
727                itemSelectedFontSize: this.itemSelectedFontSize,
728                itemFontWeight: this.itemFontWeight,
729                itemSelectedFontWeight: this.itemSelectedFontWeight,
730                itemSelectedBackgroundColor: this.itemSelectedBackgroundColor,
731                itemIconSize: this.itemIconSize,
732                itemIconFillColor: this.itemIconFillColor,
733                itemSelectedIconFillColor: this.itemSelectedIconFillColor,
734                itemSymbolFontSize: this.itemSymbolFontSize,
735                itemSymbolFontColor: this.itemSymbolFontColor,
736                itemSelectedSymbolFontColor: this.itemSelectedSymbolFontColor,
737                itemBorderRadius: this.itemBorderRadius,
738                itemMinHeight: this.itemMinHeight,
739                itemPadding: this.itemPadding,
740                itemShadow: this.itemShadow,
741                buttonBackgroundColor: this.buttonBackgroundColor,
742                buttonBackgroundBlurStyle: this.buttonBackgroundBlurStyle,
743                buttonBackgroundBlurStyleOptions:
744                  this.buttonBackgroundBlurStyleOptions,
745                buttonBackgroundEffect: this.buttonBackgroundEffect,
746                buttonBorderRadius: this.buttonBorderRadius,
747                buttonMinHeight: this.buttonMinHeight,
748                buttonPadding: this.buttonPadding,
749                languageDirection: this.languageDirection,
750              },
751              undefined,
752              k6,
753              () => {},
754              {
755                page: 'library/src/main/ets/components/MainPage.ets',
756                line: 295,
757                col: 5,
758              }
759            );
760            ViewV2.create(m6);
761            let n6 = () => {
762              return {
763                theme: tabSimpleTheme,
764                items: this.items,
765                selectedIndex: this.selectedIndex,
766                $selectedIndex: (o6) => {
767                  this.$selectedIndex?.(o6);
768                },
769                onItemClicked: this.onItemClicked,
770                itemMinFontScale: this.itemMinFontScale,
771                itemMaxFontScale: this.itemMaxFontScale,
772                itemSpace: this.itemSpace,
773                itemFontColor: this.itemFontColor,
774                itemSelectedFontColor: this.itemSelectedFontColor,
775                itemFontSize: this.itemFontSize,
776                itemSelectedFontSize: this.itemSelectedFontSize,
777                itemFontWeight: this.itemFontWeight,
778                itemSelectedFontWeight: this.itemSelectedFontWeight,
779                itemSelectedBackgroundColor: this.itemSelectedBackgroundColor,
780                itemIconSize: this.itemIconSize,
781                itemIconFillColor: this.itemIconFillColor,
782                itemSelectedIconFillColor: this.itemSelectedIconFillColor,
783                itemSymbolFontSize: this.itemSymbolFontSize,
784                itemSymbolFontColor: this.itemSymbolFontColor,
785                itemSelectedSymbolFontColor: this.itemSelectedSymbolFontColor,
786                itemBorderRadius: this.itemBorderRadius,
787                itemMinHeight: this.itemMinHeight,
788                itemPadding: this.itemPadding,
789                itemShadow: this.itemShadow,
790                buttonBackgroundColor: this.buttonBackgroundColor,
791                buttonBackgroundBlurStyle: this.buttonBackgroundBlurStyle,
792                buttonBackgroundBlurStyleOptions:
793                  this.buttonBackgroundBlurStyleOptions,
794                buttonBackgroundEffect: this.buttonBackgroundEffect,
795                buttonBorderRadius: this.buttonBorderRadius,
796                buttonMinHeight: this.buttonMinHeight,
797                buttonPadding: this.buttonPadding,
798                languageDirection: this.languageDirection,
799              };
800            };
801            m6.paramsGenerator_ = n6;
802          } else {
803            this.updateStateVarsOfChildByElmtId(k6, {
804              theme: tabSimpleTheme,
805              items: this.items,
806              selectedIndex: this.selectedIndex,
807              itemMinFontScale: this.itemMinFontScale,
808              itemMaxFontScale: this.itemMaxFontScale,
809              itemSpace: this.itemSpace,
810              itemFontColor: this.itemFontColor,
811              itemSelectedFontColor: this.itemSelectedFontColor,
812              itemFontSize: this.itemFontSize,
813              itemSelectedFontSize: this.itemSelectedFontSize,
814              itemFontWeight: this.itemFontWeight,
815              itemSelectedFontWeight: this.itemSelectedFontWeight,
816              itemSelectedBackgroundColor: this.itemSelectedBackgroundColor,
817              itemIconSize: this.itemIconSize,
818              itemIconFillColor: this.itemIconFillColor,
819              itemSelectedIconFillColor: this.itemSelectedIconFillColor,
820              itemSymbolFontSize: this.itemSymbolFontSize,
821              itemSymbolFontColor: this.itemSymbolFontColor,
822              itemSelectedSymbolFontColor: this.itemSelectedSymbolFontColor,
823              itemBorderRadius: this.itemBorderRadius,
824              itemMinHeight: this.itemMinHeight,
825              itemPadding: this.itemPadding,
826              itemShadow: this.itemShadow,
827              buttonBackgroundColor: this.buttonBackgroundColor,
828              buttonBackgroundBlurStyle: this.buttonBackgroundBlurStyle,
829              buttonBackgroundBlurStyleOptions:
830                this.buttonBackgroundBlurStyleOptions,
831              buttonBackgroundEffect: this.buttonBackgroundEffect,
832              buttonBorderRadius: this.buttonBorderRadius,
833              buttonMinHeight: this.buttonMinHeight,
834              buttonPadding: this.buttonPadding,
835              languageDirection: this.languageDirection,
836            });
837          }
838        },
839        { name: 'SimpleSegmentButtonV2' }
840      );
841    }
842    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
843  }
844
845  updateStateVars(j6) {
846    if (j6 === undefined) {
847      return;
848    }
849    if ('items' in j6) {
850      this.updateParam('items', j6.items);
851    }
852    if ('selectedIndex' in j6) {
853      this.updateParam('selectedIndex', j6.selectedIndex);
854    }
855    if ('itemMinFontScale' in j6) {
856      this.updateParam('itemMinFontScale', j6.itemMinFontScale);
857    }
858    if ('itemMaxFontScale' in j6) {
859      this.updateParam('itemMaxFontScale', j6.itemMaxFontScale);
860    }
861    if ('itemSpace' in j6) {
862      this.updateParam('itemSpace', j6.itemSpace);
863    }
864    if ('itemFontSize' in j6) {
865      this.updateParam('itemFontSize', j6.itemFontSize);
866    }
867    if ('itemSelectedFontSize' in j6) {
868      this.updateParam('itemSelectedFontSize', j6.itemSelectedFontSize);
869    }
870    if ('itemFontColor' in j6) {
871      this.updateParam('itemFontColor', j6.itemFontColor);
872    }
873    if ('itemSelectedFontColor' in j6) {
874      this.updateParam('itemSelectedFontColor', j6.itemSelectedFontColor);
875    }
876    if ('itemFontWeight' in j6) {
877      this.updateParam('itemFontWeight', j6.itemFontWeight);
878    }
879    if ('itemSelectedFontWeight' in j6) {
880      this.updateParam('itemSelectedFontWeight', j6.itemSelectedFontWeight);
881    }
882    if ('itemBorderRadius' in j6) {
883      this.updateParam('itemBorderRadius', j6.itemBorderRadius);
884    }
885    if ('itemSelectedBackgroundColor' in j6) {
886      this.updateParam(
887        'itemSelectedBackgroundColor',
888        j6.itemSelectedBackgroundColor
889      );
890    }
891    if ('itemIconSize' in j6) {
892      this.updateParam('itemIconSize', j6.itemIconSize);
893    }
894    if ('itemIconFillColor' in j6) {
895      this.updateParam('itemIconFillColor', j6.itemIconFillColor);
896    }
897    if ('itemSelectedIconFillColor' in j6) {
898      this.updateParam(
899        'itemSelectedIconFillColor',
900        j6.itemSelectedIconFillColor
901      );
902    }
903    if ('itemSymbolFontSize' in j6) {
904      this.updateParam('itemSymbolFontSize', j6.itemSymbolFontSize);
905    }
906    if ('itemSymbolFontColor' in j6) {
907      this.updateParam('itemSymbolFontColor', j6.itemSymbolFontColor);
908    }
909    if ('itemSelectedSymbolFontColor' in j6) {
910      this.updateParam(
911        'itemSelectedSymbolFontColor',
912        j6.itemSelectedSymbolFontColor
913      );
914    }
915    if ('itemMinHeight' in j6) {
916      this.updateParam('itemMinHeight', j6.itemMinHeight);
917    }
918    if ('itemPadding' in j6) {
919      this.updateParam('itemPadding', j6.itemPadding);
920    }
921    if ('itemShadow' in j6) {
922      this.updateParam('itemShadow', j6.itemShadow);
923    }
924    if ('buttonBackgroundColor' in j6) {
925      this.updateParam('buttonBackgroundColor', j6.buttonBackgroundColor);
926    }
927    if ('buttonBackgroundBlurStyle' in j6) {
928      this.updateParam(
929        'buttonBackgroundBlurStyle',
930        j6.buttonBackgroundBlurStyle
931      );
932    }
933    if ('buttonBackgroundBlurStyleOptions' in j6) {
934      this.updateParam(
935        'buttonBackgroundBlurStyleOptions',
936        j6.buttonBackgroundBlurStyleOptions
937      );
938    }
939    if ('buttonBackgroundEffect' in j6) {
940      this.updateParam('buttonBackgroundEffect', j6.buttonBackgroundEffect);
941    }
942    if ('buttonBorderRadius' in j6) {
943      this.updateParam('buttonBorderRadius', j6.buttonBorderRadius);
944    }
945    if ('buttonMinHeight' in j6) {
946      this.updateParam('buttonMinHeight', j6.buttonMinHeight);
947    }
948    if ('buttonPadding' in j6) {
949      this.updateParam('buttonPadding', j6.buttonPadding);
950    }
951    if ('languageDirection' in j6) {
952      this.updateParam('languageDirection', j6.languageDirection);
953    }
954  }
955
956  rerender() {
957    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
958    this.updateDirtyElements();
959    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
960  }
961}
962__decorate([Param], TabSegmentButtonV2.prototype, 'items', void 0);
963__decorate([Param], TabSegmentButtonV2.prototype, 'selectedIndex', void 0);
964__decorate([Event], TabSegmentButtonV2.prototype, '$selectedIndex', void 0);
965__decorate([Event], TabSegmentButtonV2.prototype, 'onItemClicked', void 0);
966__decorate([Param], TabSegmentButtonV2.prototype, 'itemMinFontScale', void 0);
967__decorate([Param], TabSegmentButtonV2.prototype, 'itemMaxFontScale', void 0);
968__decorate([Param], TabSegmentButtonV2.prototype, 'itemSpace', void 0);
969__decorate([Param], TabSegmentButtonV2.prototype, 'itemFontSize', void 0);
970__decorate(
971  [Param],
972  TabSegmentButtonV2.prototype,
973  'itemSelectedFontSize',
974  void 0
975);
976__decorate([Param], TabSegmentButtonV2.prototype, 'itemFontColor', void 0);
977__decorate(
978  [Param],
979  TabSegmentButtonV2.prototype,
980  'itemSelectedFontColor',
981  void 0
982);
983__decorate([Param], TabSegmentButtonV2.prototype, 'itemFontWeight', void 0);
984__decorate(
985  [Param],
986  TabSegmentButtonV2.prototype,
987  'itemSelectedFontWeight',
988  void 0
989);
990__decorate([Param], TabSegmentButtonV2.prototype, 'itemBorderRadius', void 0);
991__decorate(
992  [Param],
993  TabSegmentButtonV2.prototype,
994  'itemSelectedBackgroundColor',
995  void 0
996);
997__decorate([Param], TabSegmentButtonV2.prototype, 'itemIconSize', void 0);
998__decorate([Param], TabSegmentButtonV2.prototype, 'itemIconFillColor', void 0);
999__decorate(
1000  [Param],
1001  TabSegmentButtonV2.prototype,
1002  'itemSelectedIconFillColor',
1003  void 0
1004);
1005__decorate([Param], TabSegmentButtonV2.prototype, 'itemSymbolFontSize', void 0);
1006__decorate(
1007  [Param],
1008  TabSegmentButtonV2.prototype,
1009  'itemSymbolFontColor',
1010  void 0
1011);
1012__decorate(
1013  [Param],
1014  TabSegmentButtonV2.prototype,
1015  'itemSelectedSymbolFontColor',
1016  void 0
1017);
1018__decorate([Param], TabSegmentButtonV2.prototype, 'itemMinHeight', void 0);
1019__decorate([Param], TabSegmentButtonV2.prototype, 'itemPadding', void 0);
1020__decorate([Param], TabSegmentButtonV2.prototype, 'itemShadow', void 0);
1021__decorate(
1022  [Param],
1023  TabSegmentButtonV2.prototype,
1024  'buttonBackgroundColor',
1025  void 0
1026);
1027__decorate(
1028  [Param],
1029  TabSegmentButtonV2.prototype,
1030  'buttonBackgroundBlurStyle',
1031  void 0
1032);
1033__decorate(
1034  [Param],
1035  TabSegmentButtonV2.prototype,
1036  'buttonBackgroundBlurStyleOptions',
1037  void 0
1038);
1039__decorate(
1040  [Param],
1041  TabSegmentButtonV2.prototype,
1042  'buttonBackgroundEffect',
1043  void 0
1044);
1045__decorate([Param], TabSegmentButtonV2.prototype, 'buttonBorderRadius', void 0);
1046__decorate([Param], TabSegmentButtonV2.prototype, 'buttonMinHeight', void 0);
1047__decorate([Param], TabSegmentButtonV2.prototype, 'buttonPadding', void 0);
1048__decorate([Param], TabSegmentButtonV2.prototype, 'languageDirection', void 0);
1049
1050export class CapsuleSegmentButtonV2 extends ViewV2 {
1051  constructor(d6, e6, f6, g6 = -1, h6, i6) {
1052    super(d6, g6, i6);
1053    this.initParam('items', e6 && 'items' in e6 ? e6.items : undefined);
1054    this.initParam(
1055      'selectedIndex',
1056      e6 && 'selectedIndex' in e6 ? e6.selectedIndex : undefined
1057    );
1058    this.$selectedIndex = '$selectedIndex' in e6 ? e6.$selectedIndex : () => {};
1059    this.onItemClicked = 'onItemClicked' in e6 ? e6.onItemClicked : () => {};
1060    this.initParam(
1061      'itemMinFontScale',
1062      e6 && 'itemMinFontScale' in e6 ? e6.itemMinFontScale : undefined
1063    );
1064    this.initParam(
1065      'itemMaxFontScale',
1066      e6 && 'itemMaxFontScale' in e6 ? e6.itemMaxFontScale : undefined
1067    );
1068    this.initParam(
1069      'itemSpace',
1070      e6 && 'itemSpace' in e6 ? e6.itemSpace : undefined
1071    );
1072    this.initParam(
1073      'itemFontColor',
1074      e6 && 'itemFontColor' in e6 ? e6.itemFontColor : undefined
1075    );
1076    this.initParam(
1077      'itemSelectedFontColor',
1078      e6 && 'itemSelectedFontColor' in e6 ? e6.itemSelectedFontColor : undefined
1079    );
1080    this.initParam(
1081      'itemFontSize',
1082      e6 && 'itemFontSize' in e6 ? e6.itemFontSize : undefined
1083    );
1084    this.initParam(
1085      'itemSelectedFontSize',
1086      e6 && 'itemSelectedFontSize' in e6 ? e6.itemSelectedFontSize : undefined
1087    );
1088    this.initParam(
1089      'itemFontWeight',
1090      e6 && 'itemFontWeight' in e6 ? e6.itemFontWeight : undefined
1091    );
1092    this.initParam(
1093      'itemSelectedFontWeight',
1094      e6 && 'itemSelectedFontWeight' in e6
1095        ? e6.itemSelectedFontWeight
1096        : undefined
1097    );
1098    this.initParam(
1099      'itemBorderRadius',
1100      e6 && 'itemBorderRadius' in e6 ? e6.itemBorderRadius : undefined
1101    );
1102    this.initParam(
1103      'itemSelectedBackgroundColor',
1104      e6 && 'itemSelectedBackgroundColor' in e6
1105        ? e6.itemSelectedBackgroundColor
1106        : undefined
1107    );
1108    this.initParam(
1109      'itemIconSize',
1110      e6 && 'itemIconSize' in e6 ? e6.itemIconSize : undefined
1111    );
1112    this.initParam(
1113      'itemIconFillColor',
1114      e6 && 'itemIconFillColor' in e6 ? e6.itemIconFillColor : undefined
1115    );
1116    this.initParam(
1117      'itemSelectedIconFillColor',
1118      e6 && 'itemSelectedIconFillColor' in e6
1119        ? e6.itemSelectedIconFillColor
1120        : undefined
1121    );
1122    this.initParam(
1123      'itemSymbolFontSize',
1124      e6 && 'itemSymbolFontSize' in e6 ? e6.itemSymbolFontSize : undefined
1125    );
1126    this.initParam(
1127      'itemSymbolFontColor',
1128      e6 && 'itemSymbolFontColor' in e6 ? e6.itemSymbolFontColor : undefined
1129    );
1130    this.initParam(
1131      'itemSelectedSymbolFontColor',
1132      e6 && 'itemSelectedSymbolFontColor' in e6
1133        ? e6.itemSelectedSymbolFontColor
1134        : undefined
1135    );
1136    this.initParam(
1137      'itemMinHeight',
1138      e6 && 'itemMinHeight' in e6 ? e6.itemMinHeight : undefined
1139    );
1140    this.initParam(
1141      'itemPadding',
1142      e6 && 'itemPadding' in e6 ? e6.itemPadding : undefined
1143    );
1144    this.initParam(
1145      'itemShadow',
1146      e6 && 'itemShadow' in e6 ? e6.itemShadow : undefined
1147    );
1148    this.initParam(
1149      'buttonBackgroundColor',
1150      e6 && 'buttonBackgroundColor' in e6 ? e6.buttonBackgroundColor : undefined
1151    );
1152    this.initParam(
1153      'buttonBackgroundBlurStyle',
1154      e6 && 'buttonBackgroundBlurStyle' in e6
1155        ? e6.buttonBackgroundBlurStyle
1156        : undefined
1157    );
1158    this.initParam(
1159      'buttonBackgroundBlurStyleOptions',
1160      e6 && 'buttonBackgroundBlurStyleOptions' in e6
1161        ? e6.buttonBackgroundBlurStyleOptions
1162        : undefined
1163    );
1164    this.initParam(
1165      'buttonBackgroundEffect',
1166      e6 && 'buttonBackgroundEffect' in e6
1167        ? e6.buttonBackgroundEffect
1168        : undefined
1169    );
1170    this.initParam(
1171      'buttonBorderRadius',
1172      e6 && 'buttonBorderRadius' in e6 ? e6.buttonBorderRadius : undefined
1173    );
1174    this.initParam(
1175      'buttonMinHeight',
1176      e6 && 'buttonMinHeight' in e6 ? e6.buttonMinHeight : undefined
1177    );
1178    this.initParam(
1179      'buttonPadding',
1180      e6 && 'buttonPadding' in e6 ? e6.buttonPadding : undefined
1181    );
1182    this.initParam(
1183      'languageDirection',
1184      e6 && 'languageDirection' in e6 ? e6.languageDirection : undefined
1185    );
1186    this.finalizeConstruction();
1187  }
1188
1189  resetStateVarsOnReuse(c6) {
1190    this.resetParam('items', c6 && 'items' in c6 ? c6.items : undefined);
1191    this.resetParam(
1192      'selectedIndex',
1193      c6 && 'selectedIndex' in c6 ? c6.selectedIndex : undefined
1194    );
1195    this.$selectedIndex = '$selectedIndex' in c6 ? c6.$selectedIndex : () => {};
1196    this.onItemClicked = 'onItemClicked' in c6 ? c6.onItemClicked : () => {};
1197    this.resetParam(
1198      'itemMinFontScale',
1199      c6 && 'itemMinFontScale' in c6 ? c6.itemMinFontScale : undefined
1200    );
1201    this.resetParam(
1202      'itemMaxFontScale',
1203      c6 && 'itemMaxFontScale' in c6 ? c6.itemMaxFontScale : undefined
1204    );
1205    this.resetParam(
1206      'itemSpace',
1207      c6 && 'itemSpace' in c6 ? c6.itemSpace : undefined
1208    );
1209    this.resetParam(
1210      'itemFontColor',
1211      c6 && 'itemFontColor' in c6 ? c6.itemFontColor : undefined
1212    );
1213    this.resetParam(
1214      'itemSelectedFontColor',
1215      c6 && 'itemSelectedFontColor' in c6 ? c6.itemSelectedFontColor : undefined
1216    );
1217    this.resetParam(
1218      'itemFontSize',
1219      c6 && 'itemFontSize' in c6 ? c6.itemFontSize : undefined
1220    );
1221    this.resetParam(
1222      'itemSelectedFontSize',
1223      c6 && 'itemSelectedFontSize' in c6 ? c6.itemSelectedFontSize : undefined
1224    );
1225    this.resetParam(
1226      'itemFontWeight',
1227      c6 && 'itemFontWeight' in c6 ? c6.itemFontWeight : undefined
1228    );
1229    this.resetParam(
1230      'itemSelectedFontWeight',
1231      c6 && 'itemSelectedFontWeight' in c6
1232        ? c6.itemSelectedFontWeight
1233        : undefined
1234    );
1235    this.resetParam(
1236      'itemBorderRadius',
1237      c6 && 'itemBorderRadius' in c6 ? c6.itemBorderRadius : undefined
1238    );
1239    this.resetParam(
1240      'itemSelectedBackgroundColor',
1241      c6 && 'itemSelectedBackgroundColor' in c6
1242        ? c6.itemSelectedBackgroundColor
1243        : undefined
1244    );
1245    this.resetParam(
1246      'itemIconSize',
1247      c6 && 'itemIconSize' in c6 ? c6.itemIconSize : undefined
1248    );
1249    this.resetParam(
1250      'itemIconFillColor',
1251      c6 && 'itemIconFillColor' in c6 ? c6.itemIconFillColor : undefined
1252    );
1253    this.resetParam(
1254      'itemSelectedIconFillColor',
1255      c6 && 'itemSelectedIconFillColor' in c6
1256        ? c6.itemSelectedIconFillColor
1257        : undefined
1258    );
1259    this.resetParam(
1260      'itemSymbolFontSize',
1261      c6 && 'itemSymbolFontSize' in c6 ? c6.itemSymbolFontSize : undefined
1262    );
1263    this.resetParam(
1264      'itemSymbolFontColor',
1265      c6 && 'itemSymbolFontColor' in c6 ? c6.itemSymbolFontColor : undefined
1266    );
1267    this.resetParam(
1268      'itemSelectedSymbolFontColor',
1269      c6 && 'itemSelectedSymbolFontColor' in c6
1270        ? c6.itemSelectedSymbolFontColor
1271        : undefined
1272    );
1273    this.resetParam(
1274      'itemMinHeight',
1275      c6 && 'itemMinHeight' in c6 ? c6.itemMinHeight : undefined
1276    );
1277    this.resetParam(
1278      'itemPadding',
1279      c6 && 'itemPadding' in c6 ? c6.itemPadding : undefined
1280    );
1281    this.resetParam(
1282      'itemShadow',
1283      c6 && 'itemShadow' in c6 ? c6.itemShadow : undefined
1284    );
1285    this.resetParam(
1286      'buttonBackgroundColor',
1287      c6 && 'buttonBackgroundColor' in c6 ? c6.buttonBackgroundColor : undefined
1288    );
1289    this.resetParam(
1290      'buttonBackgroundBlurStyle',
1291      c6 && 'buttonBackgroundBlurStyle' in c6
1292        ? c6.buttonBackgroundBlurStyle
1293        : undefined
1294    );
1295    this.resetParam(
1296      'buttonBackgroundBlurStyleOptions',
1297      c6 && 'buttonBackgroundBlurStyleOptions' in c6
1298        ? c6.buttonBackgroundBlurStyleOptions
1299        : undefined
1300    );
1301    this.resetParam(
1302      'buttonBackgroundEffect',
1303      c6 && 'buttonBackgroundEffect' in c6
1304        ? c6.buttonBackgroundEffect
1305        : undefined
1306    );
1307    this.resetParam(
1308      'buttonBorderRadius',
1309      c6 && 'buttonBorderRadius' in c6 ? c6.buttonBorderRadius : undefined
1310    );
1311    this.resetParam(
1312      'buttonMinHeight',
1313      c6 && 'buttonMinHeight' in c6 ? c6.buttonMinHeight : undefined
1314    );
1315    this.resetParam(
1316      'buttonPadding',
1317      c6 && 'buttonPadding' in c6 ? c6.buttonPadding : undefined
1318    );
1319    this.resetParam(
1320      'languageDirection',
1321      c6 && 'languageDirection' in c6 ? c6.languageDirection : undefined
1322    );
1323  }
1324
1325  initialRender() {
1326    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
1327    {
1328      this.observeComponentCreation2(
1329        (w5, x5) => {
1330          if (x5) {
1331            let y5 = new SimpleSegmentButtonV2(
1332              this,
1333              {
1334                theme: capsuleSimpleTheme,
1335                items: this.items,
1336                selectedIndex: this.selectedIndex,
1337                $selectedIndex: (b6) => {
1338                  this.$selectedIndex?.(b6);
1339                },
1340                onItemClicked: this.onItemClicked,
1341                itemMinFontScale: this.itemMinFontScale,
1342                itemMaxFontScale: this.itemMaxFontScale,
1343                itemSpace: this.itemSpace,
1344                itemFontColor: this.itemFontColor,
1345                itemSelectedFontColor: this.itemSelectedFontColor,
1346                itemFontSize: this.itemFontSize,
1347                itemSelectedFontSize: this.itemSelectedFontSize,
1348                itemFontWeight: this.itemFontWeight,
1349                itemSelectedFontWeight: this.itemSelectedFontWeight,
1350                itemSelectedBackgroundColor: this.itemSelectedBackgroundColor,
1351                itemIconSize: this.itemIconSize,
1352                itemIconFillColor: this.itemIconFillColor,
1353                itemSelectedIconFillColor: this.itemSelectedIconFillColor,
1354                itemSymbolFontSize: this.itemSymbolFontSize,
1355                itemSymbolFontColor: this.itemSymbolFontColor,
1356                itemSelectedSymbolFontColor: this.itemSelectedSymbolFontColor,
1357                itemBorderRadius: this.itemBorderRadius,
1358                itemMinHeight: this.itemMinHeight,
1359                itemPadding: this.itemPadding,
1360                itemShadow: this.itemShadow,
1361                buttonBackgroundColor: this.buttonBackgroundColor,
1362                buttonBackgroundBlurStyle: this.buttonBackgroundBlurStyle,
1363                buttonBackgroundBlurStyleOptions:
1364                  this.buttonBackgroundBlurStyleOptions,
1365                buttonBackgroundEffect: this.buttonBackgroundEffect,
1366                buttonBorderRadius: this.buttonBorderRadius,
1367                buttonMinHeight: this.buttonMinHeight,
1368                buttonPadding: this.buttonPadding,
1369                languageDirection: this.languageDirection,
1370              },
1371              undefined,
1372              w5,
1373              () => {},
1374              {
1375                page: 'library/src/main/ets/components/MainPage.ets',
1376                line: 405,
1377                col: 5,
1378              }
1379            );
1380            ViewV2.create(y5);
1381            let z5 = () => {
1382              return {
1383                theme: capsuleSimpleTheme,
1384                items: this.items,
1385                selectedIndex: this.selectedIndex,
1386                $selectedIndex: (a6) => {
1387                  this.$selectedIndex?.(a6);
1388                },
1389                onItemClicked: this.onItemClicked,
1390                itemMinFontScale: this.itemMinFontScale,
1391                itemMaxFontScale: this.itemMaxFontScale,
1392                itemSpace: this.itemSpace,
1393                itemFontColor: this.itemFontColor,
1394                itemSelectedFontColor: this.itemSelectedFontColor,
1395                itemFontSize: this.itemFontSize,
1396                itemSelectedFontSize: this.itemSelectedFontSize,
1397                itemFontWeight: this.itemFontWeight,
1398                itemSelectedFontWeight: this.itemSelectedFontWeight,
1399                itemSelectedBackgroundColor: this.itemSelectedBackgroundColor,
1400                itemIconSize: this.itemIconSize,
1401                itemIconFillColor: this.itemIconFillColor,
1402                itemSelectedIconFillColor: this.itemSelectedIconFillColor,
1403                itemSymbolFontSize: this.itemSymbolFontSize,
1404                itemSymbolFontColor: this.itemSymbolFontColor,
1405                itemSelectedSymbolFontColor: this.itemSelectedSymbolFontColor,
1406                itemBorderRadius: this.itemBorderRadius,
1407                itemMinHeight: this.itemMinHeight,
1408                itemPadding: this.itemPadding,
1409                itemShadow: this.itemShadow,
1410                buttonBackgroundColor: this.buttonBackgroundColor,
1411                buttonBackgroundBlurStyle: this.buttonBackgroundBlurStyle,
1412                buttonBackgroundBlurStyleOptions:
1413                  this.buttonBackgroundBlurStyleOptions,
1414                buttonBackgroundEffect: this.buttonBackgroundEffect,
1415                buttonBorderRadius: this.buttonBorderRadius,
1416                buttonMinHeight: this.buttonMinHeight,
1417                buttonPadding: this.buttonPadding,
1418                languageDirection: this.languageDirection,
1419              };
1420            };
1421            y5.paramsGenerator_ = z5;
1422          } else {
1423            this.updateStateVarsOfChildByElmtId(w5, {
1424              theme: capsuleSimpleTheme,
1425              items: this.items,
1426              selectedIndex: this.selectedIndex,
1427              itemMinFontScale: this.itemMinFontScale,
1428              itemMaxFontScale: this.itemMaxFontScale,
1429              itemSpace: this.itemSpace,
1430              itemFontColor: this.itemFontColor,
1431              itemSelectedFontColor: this.itemSelectedFontColor,
1432              itemFontSize: this.itemFontSize,
1433              itemSelectedFontSize: this.itemSelectedFontSize,
1434              itemFontWeight: this.itemFontWeight,
1435              itemSelectedFontWeight: this.itemSelectedFontWeight,
1436              itemSelectedBackgroundColor: this.itemSelectedBackgroundColor,
1437              itemIconSize: this.itemIconSize,
1438              itemIconFillColor: this.itemIconFillColor,
1439              itemSelectedIconFillColor: this.itemSelectedIconFillColor,
1440              itemSymbolFontSize: this.itemSymbolFontSize,
1441              itemSymbolFontColor: this.itemSymbolFontColor,
1442              itemSelectedSymbolFontColor: this.itemSelectedSymbolFontColor,
1443              itemBorderRadius: this.itemBorderRadius,
1444              itemMinHeight: this.itemMinHeight,
1445              itemPadding: this.itemPadding,
1446              itemShadow: this.itemShadow,
1447              buttonBackgroundColor: this.buttonBackgroundColor,
1448              buttonBackgroundBlurStyle: this.buttonBackgroundBlurStyle,
1449              buttonBackgroundBlurStyleOptions:
1450                this.buttonBackgroundBlurStyleOptions,
1451              buttonBackgroundEffect: this.buttonBackgroundEffect,
1452              buttonBorderRadius: this.buttonBorderRadius,
1453              buttonMinHeight: this.buttonMinHeight,
1454              buttonPadding: this.buttonPadding,
1455              languageDirection: this.languageDirection,
1456            });
1457          }
1458        },
1459        { name: 'SimpleSegmentButtonV2' }
1460      );
1461    }
1462    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
1463  }
1464
1465  updateStateVars(v5) {
1466    if (v5 === undefined) {
1467      return;
1468    }
1469    if ('items' in v5) {
1470      this.updateParam('items', v5.items);
1471    }
1472    if ('selectedIndex' in v5) {
1473      this.updateParam('selectedIndex', v5.selectedIndex);
1474    }
1475    if ('itemMinFontScale' in v5) {
1476      this.updateParam('itemMinFontScale', v5.itemMinFontScale);
1477    }
1478    if ('itemMaxFontScale' in v5) {
1479      this.updateParam('itemMaxFontScale', v5.itemMaxFontScale);
1480    }
1481    if ('itemSpace' in v5) {
1482      this.updateParam('itemSpace', v5.itemSpace);
1483    }
1484    if ('itemFontColor' in v5) {
1485      this.updateParam('itemFontColor', v5.itemFontColor);
1486    }
1487    if ('itemSelectedFontColor' in v5) {
1488      this.updateParam('itemSelectedFontColor', v5.itemSelectedFontColor);
1489    }
1490    if ('itemFontSize' in v5) {
1491      this.updateParam('itemFontSize', v5.itemFontSize);
1492    }
1493    if ('itemSelectedFontSize' in v5) {
1494      this.updateParam('itemSelectedFontSize', v5.itemSelectedFontSize);
1495    }
1496    if ('itemFontWeight' in v5) {
1497      this.updateParam('itemFontWeight', v5.itemFontWeight);
1498    }
1499    if ('itemSelectedFontWeight' in v5) {
1500      this.updateParam('itemSelectedFontWeight', v5.itemSelectedFontWeight);
1501    }
1502    if ('itemBorderRadius' in v5) {
1503      this.updateParam('itemBorderRadius', v5.itemBorderRadius);
1504    }
1505    if ('itemSelectedBackgroundColor' in v5) {
1506      this.updateParam(
1507        'itemSelectedBackgroundColor',
1508        v5.itemSelectedBackgroundColor
1509      );
1510    }
1511    if ('itemIconSize' in v5) {
1512      this.updateParam('itemIconSize', v5.itemIconSize);
1513    }
1514    if ('itemIconFillColor' in v5) {
1515      this.updateParam('itemIconFillColor', v5.itemIconFillColor);
1516    }
1517    if ('itemSelectedIconFillColor' in v5) {
1518      this.updateParam(
1519        'itemSelectedIconFillColor',
1520        v5.itemSelectedIconFillColor
1521      );
1522    }
1523    if ('itemSymbolFontSize' in v5) {
1524      this.updateParam('itemSymbolFontSize', v5.itemSymbolFontSize);
1525    }
1526    if ('itemSymbolFontColor' in v5) {
1527      this.updateParam('itemSymbolFontColor', v5.itemSymbolFontColor);
1528    }
1529    if ('itemSelectedSymbolFontColor' in v5) {
1530      this.updateParam(
1531        'itemSelectedSymbolFontColor',
1532        v5.itemSelectedSymbolFontColor
1533      );
1534    }
1535    if ('itemMinHeight' in v5) {
1536      this.updateParam('itemMinHeight', v5.itemMinHeight);
1537    }
1538    if ('itemPadding' in v5) {
1539      this.updateParam('itemPadding', v5.itemPadding);
1540    }
1541    if ('itemShadow' in v5) {
1542      this.updateParam('itemShadow', v5.itemShadow);
1543    }
1544    if ('buttonBackgroundColor' in v5) {
1545      this.updateParam('buttonBackgroundColor', v5.buttonBackgroundColor);
1546    }
1547    if ('buttonBackgroundBlurStyle' in v5) {
1548      this.updateParam(
1549        'buttonBackgroundBlurStyle',
1550        v5.buttonBackgroundBlurStyle
1551      );
1552    }
1553    if ('buttonBackgroundBlurStyleOptions' in v5) {
1554      this.updateParam(
1555        'buttonBackgroundBlurStyleOptions',
1556        v5.buttonBackgroundBlurStyleOptions
1557      );
1558    }
1559    if ('buttonBackgroundEffect' in v5) {
1560      this.updateParam('buttonBackgroundEffect', v5.buttonBackgroundEffect);
1561    }
1562    if ('buttonBorderRadius' in v5) {
1563      this.updateParam('buttonBorderRadius', v5.buttonBorderRadius);
1564    }
1565    if ('buttonMinHeight' in v5) {
1566      this.updateParam('buttonMinHeight', v5.buttonMinHeight);
1567    }
1568    if ('buttonPadding' in v5) {
1569      this.updateParam('buttonPadding', v5.buttonPadding);
1570    }
1571    if ('languageDirection' in v5) {
1572      this.updateParam('languageDirection', v5.languageDirection);
1573    }
1574  }
1575
1576  rerender() {
1577    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
1578    this.updateDirtyElements();
1579    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
1580  }
1581}
1582__decorate([Param], CapsuleSegmentButtonV2.prototype, 'items', void 0);
1583__decorate([Param], CapsuleSegmentButtonV2.prototype, 'selectedIndex', void 0);
1584__decorate([Event], CapsuleSegmentButtonV2.prototype, '$selectedIndex', void 0);
1585__decorate([Event], CapsuleSegmentButtonV2.prototype, 'onItemClicked', void 0);
1586__decorate(
1587  [Param],
1588  CapsuleSegmentButtonV2.prototype,
1589  'itemMinFontScale',
1590  void 0
1591);
1592__decorate(
1593  [Param],
1594  CapsuleSegmentButtonV2.prototype,
1595  'itemMaxFontScale',
1596  void 0
1597);
1598__decorate([Param], CapsuleSegmentButtonV2.prototype, 'itemSpace', void 0);
1599__decorate([Param], CapsuleSegmentButtonV2.prototype, 'itemFontColor', void 0);
1600__decorate(
1601  [Param],
1602  CapsuleSegmentButtonV2.prototype,
1603  'itemSelectedFontColor',
1604  void 0
1605);
1606__decorate([Param], CapsuleSegmentButtonV2.prototype, 'itemFontSize', void 0);
1607__decorate(
1608  [Param],
1609  CapsuleSegmentButtonV2.prototype,
1610  'itemSelectedFontSize',
1611  void 0
1612);
1613__decorate([Param], CapsuleSegmentButtonV2.prototype, 'itemFontWeight', void 0);
1614__decorate(
1615  [Param],
1616  CapsuleSegmentButtonV2.prototype,
1617  'itemSelectedFontWeight',
1618  void 0
1619);
1620__decorate(
1621  [Param],
1622  CapsuleSegmentButtonV2.prototype,
1623  'itemBorderRadius',
1624  void 0
1625);
1626__decorate(
1627  [Param],
1628  CapsuleSegmentButtonV2.prototype,
1629  'itemSelectedBackgroundColor',
1630  void 0
1631);
1632__decorate([Param], CapsuleSegmentButtonV2.prototype, 'itemIconSize', void 0);
1633__decorate(
1634  [Param],
1635  CapsuleSegmentButtonV2.prototype,
1636  'itemIconFillColor',
1637  void 0
1638);
1639__decorate(
1640  [Param],
1641  CapsuleSegmentButtonV2.prototype,
1642  'itemSelectedIconFillColor',
1643  void 0
1644);
1645__decorate(
1646  [Param],
1647  CapsuleSegmentButtonV2.prototype,
1648  'itemSymbolFontSize',
1649  void 0
1650);
1651__decorate(
1652  [Param],
1653  CapsuleSegmentButtonV2.prototype,
1654  'itemSymbolFontColor',
1655  void 0
1656);
1657__decorate(
1658  [Param],
1659  CapsuleSegmentButtonV2.prototype,
1660  'itemSelectedSymbolFontColor',
1661  void 0
1662);
1663__decorate([Param], CapsuleSegmentButtonV2.prototype, 'itemMinHeight', void 0);
1664__decorate([Param], CapsuleSegmentButtonV2.prototype, 'itemPadding', void 0);
1665__decorate([Param], CapsuleSegmentButtonV2.prototype, 'itemShadow', void 0);
1666__decorate(
1667  [Param],
1668  CapsuleSegmentButtonV2.prototype,
1669  'buttonBackgroundColor',
1670  void 0
1671);
1672__decorate(
1673  [Param],
1674  CapsuleSegmentButtonV2.prototype,
1675  'buttonBackgroundBlurStyle',
1676  void 0
1677);
1678__decorate(
1679  [Param],
1680  CapsuleSegmentButtonV2.prototype,
1681  'buttonBackgroundBlurStyleOptions',
1682  void 0
1683);
1684__decorate(
1685  [Param],
1686  CapsuleSegmentButtonV2.prototype,
1687  'buttonBackgroundEffect',
1688  void 0
1689);
1690__decorate(
1691  [Param],
1692  CapsuleSegmentButtonV2.prototype,
1693  'buttonBorderRadius',
1694  void 0
1695);
1696__decorate(
1697  [Param],
1698  CapsuleSegmentButtonV2.prototype,
1699  'buttonMinHeight',
1700  void 0
1701);
1702__decorate([Param], CapsuleSegmentButtonV2.prototype, 'buttonPadding', void 0);
1703__decorate(
1704  [Param],
1705  CapsuleSegmentButtonV2.prototype,
1706  'languageDirection',
1707  void 0
1708);
1709
1710class SimpleSegmentButtonV2 extends ViewV2 {
1711  constructor(c4, d4, e4, f4 = -1, g4, h4) {
1712    super(c4, f4, h4);
1713    this.ContentLayer = () => {
1714      const t4 =
1715        PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.length
1716          ? PUV2ViewBase.contextStack[PUV2ViewBase.contextStack.length - 1]
1717          : null;
1718      this.observeComponentCreation2((i5, j5) => {
1719        Flex.create({
1720          alignItems: ItemAlign.Stretch,
1721          space: { main: this.getItemSpace() },
1722        });
1723        Flex.constraintSize({
1724          minWidth: '100%',
1725          minHeight: this.getButtonMinHeight(),
1726        });
1727        Flex.clip(false);
1728        Flex.direction(this.languageDirection);
1729        Flex.focusScopeId(this.focusGroupId, true);
1730        Flex.padding(this.getButtonPadding());
1731        Gesture.create(GesturePriority.High);
1732        PanGesture.create();
1733        PanGesture.onActionStart((s5) => {
1734          const t5 = s5.fingerList.find(Boolean);
1735          if (!t5) {
1736            return;
1737          }
1738          const u5 = this.getIndexByPosition(t5.globalX, t5.globalY);
1739          if (!this.isItemEnabled(u5)) {
1740            return;
1741          }
1742          if (s5.axisHorizontal !== 0 || s5.axisVertical !== 0) {
1743            this.isMouseWheelScroll = true;
1744            return;
1745          }
1746          if (u5 === this.normalizedSelectedIndex) {
1747            this.isDragging = true;
1748          }
1749          this.panStartGlobalX = t5.globalX;
1750          this.panStartIndex = u5;
1751        });
1752        PanGesture.onActionUpdate((p5) => {
1753          if (!this.isDragging) {
1754            return;
1755          }
1756          const q5 = p5.fingerList.find(Boolean);
1757          if (!q5) {
1758            return;
1759          }
1760          const r5 = this.getIndexByPosition(q5.globalX, q5.globalY);
1761          this.updateSelectedIndex(r5);
1762        });
1763        PanGesture.onActionEnd((k5) => {
1764          if (!this.isItemEnabled(this.panStartIndex)) {
1765            return;
1766          }
1767          if (this.isMouseWheelScroll) {
1768            const n5 = k5.offsetX !== 0 ? k5.offsetX : k5.offsetY;
1769            const o5 = n5 < 0 ? 1 : -1;
1770            this.updateSelectedIndex(this.normalizedSelectedIndex + o5);
1771            this.isMouseWheelScroll = false;
1772            return;
1773          }
1774          if (this.isDragging) {
1775            this.isDragging = false;
1776            return;
1777          }
1778          if (!this.isItemEnabled(this.normalizedSelectedIndex)) {
1779            return;
1780          }
1781          const l5 = k5.fingerList.find(Boolean);
1782          if (!l5) {
1783            return;
1784          }
1785          let m5 = l5.globalX - this.panStartGlobalX < 0 ? -1 : 1;
1786          if (this.isRTL()) {
1787            m5 = -m5;
1788          }
1789          this.updateSelectedIndex(this.normalizedSelectedIndex + m5);
1790        });
1791        PanGesture.onActionCancel(() => {
1792          this.isDragging = false;
1793          this.isMouseWheelScroll = false;
1794          this.panStartIndex = -1;
1795        });
1796        PanGesture.pop();
1797        Gesture.pop();
1798      }, Flex);
1799      this.observeComponentCreation2((u4, v4) => {
1800        Repeat(this.getItems(), this)
1801          .each((w4) => {
1802            this.observeComponentCreation2((b5, c5) => {
1803              Button.createWithChild({ type: ButtonType.Normal });
1804              Button.accessibilityGroup(true);
1805              Button.accessibilitySelected(this.isSelected(w4));
1806              Button.accessibilityText(this.getItemAccessibilityText(w4));
1807              Button.accessibilityDescription(
1808                this.getItemAccessibilityDescription(w4)
1809              );
1810              Button.accessibilityLevel(w4.item.accessibilityLevel);
1811              Button.backgroundColor(Color.Transparent);
1812              Button.borderRadius(this.getItemBorderRadius());
1813              Button.direction(this.languageDirection);
1814              Button.enabled(w4.item.enabled);
1815              Button.focusScopePriority(
1816                this.focusGroupId,
1817                this.getFocusPriority(w4)
1818              );
1819              Button.hoverEffect(HoverEffect.None);
1820              Button.layoutWeight(1);
1821              Button.padding(0);
1822              Button.scale(this.getItemScale(w4.index));
1823              Button.stateEffect(false);
1824              Button.onAreaChange((g5, h5) => {
1825                this.itemRects[w4.index] = {
1826                  size: {
1827                    width: h5.width,
1828                    height: h5.height,
1829                  },
1830                  position: {
1831                    x: h5.position.x,
1832                    y: h5.position.y,
1833                  },
1834                  globalPosition: {
1835                    x: h5.globalPosition.x,
1836                    y: h5.globalPosition.y,
1837                  },
1838                };
1839              });
1840              Gesture.create(GesturePriority.Low);
1841              TapGesture.create();
1842              TapGesture.onAction(() => {
1843                this.onItemClicked?.(w4.index);
1844                this.updateSelectedIndex(w4.index);
1845              });
1846              TapGesture.pop();
1847              Gesture.pop();
1848              Button.onTouch((f5) => {
1849                if (f5.type === TouchType.Down) {
1850                  if (this.isSelected(w4)) {
1851                    this.updateItemScale(0.95);
1852                  }
1853                  this.updateTouchPressedItemIndex(w4.index);
1854                } else if ([TouchType.Up, TouchType.Cancel].includes(f5.type)) {
1855                  this.updateItemScale(1);
1856                  this.updateTouchPressedItemIndex(-1);
1857                }
1858              });
1859              Button.onHover((e5) => {
1860                if (e5) {
1861                  this.updateHoveredItemIndex(w4.index);
1862                } else {
1863                  this.updateHoveredItemIndex(-1);
1864                }
1865              });
1866              Button.onMouse((d5) => {
1867                if (d5.action === MouseAction.Press) {
1868                  this.updateMousePressedItemIndex(w4.index);
1869                } else if (
1870                  [MouseAction.Release, MouseAction.CANCEL].includes(d5.action)
1871                ) {
1872                  this.updateMousePressedItemIndex(-1);
1873                }
1874              });
1875            }, Button);
1876            {
1877              this.observeComponentCreation2(
1878                (x4, y4) => {
1879                  if (y4) {
1880                    let z4 = new SegmentButtonV2ItemContent(
1881                      t4 ? t4 : this,
1882                      {
1883                        theme: this.theme,
1884                        item: w4.item,
1885                        selected: this.isSelected(w4),
1886                        itemMinFontScale: this.itemMinFontScale,
1887                        itemMaxFontScale: this.itemMaxFontScale,
1888                        itemFontColor: this.itemFontColor,
1889                        itemSelectedFontColor: this.itemSelectedFontColor,
1890                        itemFontSize: this.itemFontSize,
1891                        itemSelectedFontSize: this.itemSelectedFontSize,
1892                        itemFontWeight: this.itemFontWeight,
1893                        itemSelectedFontWeight: this.itemSelectedFontWeight,
1894                        itemIconSize: this.itemIconSize,
1895                        itemIconFillColor: this.itemIconFillColor,
1896                        itemSelectedIconFillColor:
1897                          this.itemSelectedIconFillColor,
1898                        itemSymbolFontSize: this.itemSymbolFontSize,
1899                        itemSymbolFontColor: this.itemSymbolFontColor,
1900                        itemSelectedSymbolFontColor:
1901                          this.itemSelectedSymbolFontColor,
1902                        itemMinHeight: this.itemMinHeight,
1903                        itemPadding: this.itemPadding,
1904                        languageDirection: this.languageDirection,
1905                        hasHybrid: this.getItems().hasHybrid,
1906                      },
1907                      undefined,
1908                      x4,
1909                      () => {},
1910                      {
1911                        page: 'library/src/main/ets/components/MainPage.ets',
1912                        line: 577,
1913                        col: 13,
1914                      }
1915                    );
1916                    ViewV2.create(z4);
1917                    let a5 = () => {
1918                      return {
1919                        theme: this.theme,
1920                        item: w4.item,
1921                        selected: this.isSelected(w4),
1922                        itemMinFontScale: this.itemMinFontScale,
1923                        itemMaxFontScale: this.itemMaxFontScale,
1924                        itemFontColor: this.itemFontColor,
1925                        itemSelectedFontColor: this.itemSelectedFontColor,
1926                        itemFontSize: this.itemFontSize,
1927                        itemSelectedFontSize: this.itemSelectedFontSize,
1928                        itemFontWeight: this.itemFontWeight,
1929                        itemSelectedFontWeight: this.itemSelectedFontWeight,
1930                        itemIconSize: this.itemIconSize,
1931                        itemIconFillColor: this.itemIconFillColor,
1932                        itemSelectedIconFillColor:
1933                          this.itemSelectedIconFillColor,
1934                        itemSymbolFontSize: this.itemSymbolFontSize,
1935                        itemSymbolFontColor: this.itemSymbolFontColor,
1936                        itemSelectedSymbolFontColor:
1937                          this.itemSelectedSymbolFontColor,
1938                        itemMinHeight: this.itemMinHeight,
1939                        itemPadding: this.itemPadding,
1940                        languageDirection: this.languageDirection,
1941                        hasHybrid: this.getItems().hasHybrid,
1942                      };
1943                    };
1944                    z4.paramsGenerator_ = a5;
1945                  } else {
1946                    this.updateStateVarsOfChildByElmtId(x4, {
1947                      theme: this.theme,
1948                      item: w4.item,
1949                      selected: this.isSelected(w4),
1950                      itemMinFontScale: this.itemMinFontScale,
1951                      itemMaxFontScale: this.itemMaxFontScale,
1952                      itemFontColor: this.itemFontColor,
1953                      itemSelectedFontColor: this.itemSelectedFontColor,
1954                      itemFontSize: this.itemFontSize,
1955                      itemSelectedFontSize: this.itemSelectedFontSize,
1956                      itemFontWeight: this.itemFontWeight,
1957                      itemSelectedFontWeight: this.itemSelectedFontWeight,
1958                      itemIconSize: this.itemIconSize,
1959                      itemIconFillColor: this.itemIconFillColor,
1960                      itemSelectedIconFillColor: this.itemSelectedIconFillColor,
1961                      itemSymbolFontSize: this.itemSymbolFontSize,
1962                      itemSymbolFontColor: this.itemSymbolFontColor,
1963                      itemSelectedSymbolFontColor:
1964                        this.itemSelectedSymbolFontColor,
1965                      itemMinHeight: this.itemMinHeight,
1966                      itemPadding: this.itemPadding,
1967                      languageDirection: this.languageDirection,
1968                      hasHybrid: this.getItems().hasHybrid,
1969                    });
1970                  }
1971                },
1972                { name: 'SegmentButtonV2ItemContent' }
1973              );
1974            }
1975            Button.pop();
1976          })
1977          .key(generateUniqueKye(this.focusGroupId))
1978          .render(v4);
1979      }, Repeat);
1980      Flex.pop();
1981    };
1982    this.BackplateLayer = () => {
1983      const o4 =
1984        PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.length
1985          ? PUV2ViewBase.contextStack[PUV2ViewBase.contextStack.length - 1]
1986          : null;
1987      this.observeComponentCreation2((p4, q4) => {
1988        If.create();
1989        if (this.selectedItemRect) {
1990          this.ifElseBranchUpdateFunction(0, () => {
1991            this.observeComponentCreation2((r4, s4) => {
1992              Stack.create();
1993              Stack.position({
1994                x: this.selectedItemRect.position.x,
1995                y: this.selectedItemRect.position.y,
1996              });
1997              Stack.backgroundColor(this.getItemSelectedBackgroundColor());
1998              Stack.borderRadius(this.getItemBorderRadius());
1999              Stack.scale({ x: this.itemScale, y: this.itemScale });
2000              Stack.shadow(this.getItemBackplateShadow());
2001              Stack.height(this.selectedItemRect.size.height);
2002              Stack.width(this.selectedItemRect.size.width);
2003            }, Stack);
2004            Stack.pop();
2005          });
2006        } else {
2007          this.ifElseBranchUpdateFunction(1, () => {});
2008        }
2009      }, If);
2010      If.pop();
2011    };
2012    this.EffectLayer = () => {
2013      const i4 =
2014        PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.length
2015          ? PUV2ViewBase.contextStack[PUV2ViewBase.contextStack.length - 1]
2016          : null;
2017      this.observeComponentCreation2((j4, k4) => {
2018        Repeat(this.getItemRects(), this)
2019          .each((l4) => {
2020            this.observeComponentCreation2((m4, n4) => {
2021              Stack.create();
2022              Stack.backgroundColor(this.getEffectBackgroundColor(l4));
2023              Stack.borderRadius(this.getItemBorderRadius());
2024              Stack.height(l4.item.size.height);
2025              Stack.position({
2026                x: l4.item.position.x,
2027                y: l4.item.position.y,
2028              });
2029              Stack.scale(this.getItemScale(l4.index));
2030              Stack.width(l4.item.size.width);
2031            }, Stack);
2032            Stack.pop();
2033          })
2034          .render(k4);
2035      }, Repeat);
2036    };
2037    this.initParam('items', d4 && 'items' in d4 ? d4.items : undefined);
2038    this.initParam(
2039      'selectedIndex',
2040      d4 && 'selectedIndex' in d4 ? d4.selectedIndex : undefined
2041    );
2042    this.$selectedIndex = '$selectedIndex' in d4 ? d4.$selectedIndex : () => {};
2043    this.initParam('theme', d4 && 'theme' in d4 ? d4.theme : undefined);
2044    this.onItemClicked = 'onItemClicked' in d4 ? d4.onItemClicked : () => {};
2045    this.initParam(
2046      'itemMinFontScale',
2047      d4 && 'itemMinFontScale' in d4 ? d4.itemMinFontScale : undefined
2048    );
2049    this.initParam(
2050      'itemMaxFontScale',
2051      d4 && 'itemMaxFontScale' in d4 ? d4.itemMaxFontScale : undefined
2052    );
2053    this.initParam(
2054      'itemSpace',
2055      d4 && 'itemSpace' in d4 ? d4.itemSpace : undefined
2056    );
2057    this.initParam(
2058      'itemFontColor',
2059      d4 && 'itemFontColor' in d4 ? d4.itemFontColor : undefined
2060    );
2061    this.initParam(
2062      'itemSelectedFontColor',
2063      d4 && 'itemSelectedFontColor' in d4 ? d4.itemSelectedFontColor : undefined
2064    );
2065    this.initParam(
2066      'itemFontSize',
2067      d4 && 'itemFontSize' in d4 ? d4.itemFontSize : undefined
2068    );
2069    this.initParam(
2070      'itemSelectedFontSize',
2071      d4 && 'itemSelectedFontSize' in d4 ? d4.itemSelectedFontSize : undefined
2072    );
2073    this.initParam(
2074      'itemFontWeight',
2075      d4 && 'itemFontWeight' in d4 ? d4.itemFontWeight : undefined
2076    );
2077    this.initParam(
2078      'itemSelectedFontWeight',
2079      d4 && 'itemSelectedFontWeight' in d4
2080        ? d4.itemSelectedFontWeight
2081        : undefined
2082    );
2083    this.initParam(
2084      'itemBorderRadius',
2085      d4 && 'itemBorderRadius' in d4 ? d4.itemBorderRadius : undefined
2086    );
2087    this.initParam(
2088      'itemSelectedBackgroundColor',
2089      d4 && 'itemSelectedBackgroundColor' in d4
2090        ? d4.itemSelectedBackgroundColor
2091        : undefined
2092    );
2093    this.initParam(
2094      'itemIconSize',
2095      d4 && 'itemIconSize' in d4 ? d4.itemIconSize : undefined
2096    );
2097    this.initParam(
2098      'itemIconFillColor',
2099      d4 && 'itemIconFillColor' in d4 ? d4.itemIconFillColor : undefined
2100    );
2101    this.initParam(
2102      'itemSelectedIconFillColor',
2103      d4 && 'itemSelectedIconFillColor' in d4
2104        ? d4.itemSelectedIconFillColor
2105        : undefined
2106    );
2107    this.initParam(
2108      'itemSymbolFontSize',
2109      d4 && 'itemSymbolFontSize' in d4 ? d4.itemSymbolFontSize : undefined
2110    );
2111    this.initParam(
2112      'itemSymbolFontColor',
2113      d4 && 'itemSymbolFontColor' in d4 ? d4.itemSymbolFontColor : undefined
2114    );
2115    this.initParam(
2116      'itemSelectedSymbolFontColor',
2117      d4 && 'itemSelectedSymbolFontColor' in d4
2118        ? d4.itemSelectedSymbolFontColor
2119        : undefined
2120    );
2121    this.initParam(
2122      'itemMinHeight',
2123      d4 && 'itemMinHeight' in d4 ? d4.itemMinHeight : undefined
2124    );
2125    this.initParam(
2126      'itemPadding',
2127      d4 && 'itemPadding' in d4 ? d4.itemPadding : undefined
2128    );
2129    this.initParam(
2130      'itemShadow',
2131      d4 && 'itemShadow' in d4 ? d4.itemShadow : undefined
2132    );
2133    this.initParam(
2134      'buttonBackgroundColor',
2135      d4 && 'buttonBackgroundColor' in d4 ? d4.buttonBackgroundColor : undefined
2136    );
2137    this.initParam(
2138      'buttonBackgroundBlurStyle',
2139      d4 && 'buttonBackgroundBlurStyle' in d4
2140        ? d4.buttonBackgroundBlurStyle
2141        : undefined
2142    );
2143    this.initParam(
2144      'buttonBackgroundBlurStyleOptions',
2145      d4 && 'buttonBackgroundBlurStyleOptions' in d4
2146        ? d4.buttonBackgroundBlurStyleOptions
2147        : undefined
2148    );
2149    this.initParam(
2150      'buttonBackgroundEffect',
2151      d4 && 'buttonBackgroundEffect' in d4
2152        ? d4.buttonBackgroundEffect
2153        : undefined
2154    );
2155    this.initParam(
2156      'buttonBorderRadius',
2157      d4 && 'buttonBorderRadius' in d4 ? d4.buttonBorderRadius : undefined
2158    );
2159    this.initParam(
2160      'buttonMinHeight',
2161      d4 && 'buttonMinHeight' in d4 ? d4.buttonMinHeight : undefined
2162    );
2163    this.initParam(
2164      'buttonPadding',
2165      d4 && 'buttonPadding' in d4 ? d4.buttonPadding : undefined
2166    );
2167    this.initParam(
2168      'languageDirection',
2169      d4 && 'languageDirection' in d4 ? d4.languageDirection : undefined
2170    );
2171    this.itemRects = [];
2172    this.itemScale = 1;
2173    this.hoveredItemIndex = -1;
2174    this.mousePressedItemIndex = -1;
2175    this.touchPressedItemIndex = -1;
2176    this.isMouseWheelScroll = false;
2177    this.isDragging = false;
2178    this.panStartGlobalX = 0;
2179    this.panStartIndex = -1;
2180    this.focusGroupId = util.generateRandomUUID();
2181    this.finalizeConstruction();
2182  }
2183
2184  resetStateVarsOnReuse(b4) {
2185    this.resetParam('items', b4 && 'items' in b4 ? b4.items : undefined);
2186    this.resetParam(
2187      'selectedIndex',
2188      b4 && 'selectedIndex' in b4 ? b4.selectedIndex : undefined
2189    );
2190    this.$selectedIndex = '$selectedIndex' in b4 ? b4.$selectedIndex : () => {};
2191    this.resetParam('theme', b4 && 'theme' in b4 ? b4.theme : undefined);
2192    this.onItemClicked = 'onItemClicked' in b4 ? b4.onItemClicked : () => {};
2193    this.resetParam(
2194      'itemMinFontScale',
2195      b4 && 'itemMinFontScale' in b4 ? b4.itemMinFontScale : undefined
2196    );
2197    this.resetParam(
2198      'itemMaxFontScale',
2199      b4 && 'itemMaxFontScale' in b4 ? b4.itemMaxFontScale : undefined
2200    );
2201    this.resetParam(
2202      'itemSpace',
2203      b4 && 'itemSpace' in b4 ? b4.itemSpace : undefined
2204    );
2205    this.resetParam(
2206      'itemFontColor',
2207      b4 && 'itemFontColor' in b4 ? b4.itemFontColor : undefined
2208    );
2209    this.resetParam(
2210      'itemSelectedFontColor',
2211      b4 && 'itemSelectedFontColor' in b4 ? b4.itemSelectedFontColor : undefined
2212    );
2213    this.resetParam(
2214      'itemFontSize',
2215      b4 && 'itemFontSize' in b4 ? b4.itemFontSize : undefined
2216    );
2217    this.resetParam(
2218      'itemSelectedFontSize',
2219      b4 && 'itemSelectedFontSize' in b4 ? b4.itemSelectedFontSize : undefined
2220    );
2221    this.resetParam(
2222      'itemFontWeight',
2223      b4 && 'itemFontWeight' in b4 ? b4.itemFontWeight : undefined
2224    );
2225    this.resetParam(
2226      'itemSelectedFontWeight',
2227      b4 && 'itemSelectedFontWeight' in b4
2228        ? b4.itemSelectedFontWeight
2229        : undefined
2230    );
2231    this.resetParam(
2232      'itemBorderRadius',
2233      b4 && 'itemBorderRadius' in b4 ? b4.itemBorderRadius : undefined
2234    );
2235    this.resetParam(
2236      'itemSelectedBackgroundColor',
2237      b4 && 'itemSelectedBackgroundColor' in b4
2238        ? b4.itemSelectedBackgroundColor
2239        : undefined
2240    );
2241    this.resetParam(
2242      'itemIconSize',
2243      b4 && 'itemIconSize' in b4 ? b4.itemIconSize : undefined
2244    );
2245    this.resetParam(
2246      'itemIconFillColor',
2247      b4 && 'itemIconFillColor' in b4 ? b4.itemIconFillColor : undefined
2248    );
2249    this.resetParam(
2250      'itemSelectedIconFillColor',
2251      b4 && 'itemSelectedIconFillColor' in b4
2252        ? b4.itemSelectedIconFillColor
2253        : undefined
2254    );
2255    this.resetParam(
2256      'itemSymbolFontSize',
2257      b4 && 'itemSymbolFontSize' in b4 ? b4.itemSymbolFontSize : undefined
2258    );
2259    this.resetParam(
2260      'itemSymbolFontColor',
2261      b4 && 'itemSymbolFontColor' in b4 ? b4.itemSymbolFontColor : undefined
2262    );
2263    this.resetParam(
2264      'itemSelectedSymbolFontColor',
2265      b4 && 'itemSelectedSymbolFontColor' in b4
2266        ? b4.itemSelectedSymbolFontColor
2267        : undefined
2268    );
2269    this.resetParam(
2270      'itemMinHeight',
2271      b4 && 'itemMinHeight' in b4 ? b4.itemMinHeight : undefined
2272    );
2273    this.resetParam(
2274      'itemPadding',
2275      b4 && 'itemPadding' in b4 ? b4.itemPadding : undefined
2276    );
2277    this.resetParam(
2278      'itemShadow',
2279      b4 && 'itemShadow' in b4 ? b4.itemShadow : undefined
2280    );
2281    this.resetParam(
2282      'buttonBackgroundColor',
2283      b4 && 'buttonBackgroundColor' in b4 ? b4.buttonBackgroundColor : undefined
2284    );
2285    this.resetParam(
2286      'buttonBackgroundBlurStyle',
2287      b4 && 'buttonBackgroundBlurStyle' in b4
2288        ? b4.buttonBackgroundBlurStyle
2289        : undefined
2290    );
2291    this.resetParam(
2292      'buttonBackgroundBlurStyleOptions',
2293      b4 && 'buttonBackgroundBlurStyleOptions' in b4
2294        ? b4.buttonBackgroundBlurStyleOptions
2295        : undefined
2296    );
2297    this.resetParam(
2298      'buttonBackgroundEffect',
2299      b4 && 'buttonBackgroundEffect' in b4
2300        ? b4.buttonBackgroundEffect
2301        : undefined
2302    );
2303    this.resetParam(
2304      'buttonBorderRadius',
2305      b4 && 'buttonBorderRadius' in b4 ? b4.buttonBorderRadius : undefined
2306    );
2307    this.resetParam(
2308      'buttonMinHeight',
2309      b4 && 'buttonMinHeight' in b4 ? b4.buttonMinHeight : undefined
2310    );
2311    this.resetParam(
2312      'buttonPadding',
2313      b4 && 'buttonPadding' in b4 ? b4.buttonPadding : undefined
2314    );
2315    this.resetParam(
2316      'languageDirection',
2317      b4 && 'languageDirection' in b4 ? b4.languageDirection : undefined
2318    );
2319    this.itemRects = [];
2320    this.itemScale = 1;
2321    this.hoveredItemIndex = -1;
2322    this.mousePressedItemIndex = -1;
2323    this.touchPressedItemIndex = -1;
2324    this.resetComputed('normalizedSelectedIndex');
2325    this.resetComputed('selectedItemRect');
2326  }
2327
2328  get normalizedSelectedIndex() {
2329    const a4 = this.getItems();
2330    return normalize(this.selectedIndex, 0, a4.length - 1);
2331  }
2332
2333  get selectedItemRect() {
2334    return this.itemRects[this.normalizedSelectedIndex];
2335  }
2336
2337  getFocusPriority(z3) {
2338    return this.normalizedSelectedIndex === z3.index
2339      ? FocusPriority.PREVIOUS
2340      : FocusPriority.AUTO;
2341  }
2342
2343  isItemEnabled(x3) {
2344    const y3 = this.getItems();
2345    if (x3 < 0 || x3 >= y3.length) {
2346      return false;
2347    }
2348    return y3[x3].enabled;
2349  }
2350
2351  getItemRects() {
2352    if (!this.items) {
2353      return [];
2354    }
2355    if (this.items.length === this.itemRects.length) {
2356      return this.itemRects;
2357    }
2358    return this.itemRects.slice(0, this.items.length);
2359  }
2360
2361  initialRender() {
2362    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
2363    this.observeComponentCreation2((v3, w3) => {
2364      Stack.create();
2365      Stack.backgroundColor(this.getButtonBackgroundColor());
2366      Stack.backgroundEffect(this.buttonBackgroundEffect);
2367      Stack.borderRadius(this.getButtonBorderRadius());
2368      Stack.clip(false);
2369      Stack.constraintSize({
2370        minWidth: '100%',
2371        minHeight: this.getButtonMinHeight(),
2372      });
2373      Stack.direction(this.languageDirection);
2374    }, Stack);
2375    this.observeComponentCreation2((t3, u3) => {
2376      Stack.create();
2377      Stack.borderRadius(this.getButtonBorderRadius());
2378      Stack.backgroundBlurStyle(
2379        this.getButtonBackgroundBlurStyle(),
2380        this.getButtonBackgroundBlurStyleOptions()
2381      );
2382      Stack.clip(false);
2383      Stack.direction(this.languageDirection);
2384    }, Stack);
2385    this.EffectLayer.bind(this)();
2386    this.BackplateLayer.bind(this)();
2387    this.ContentLayer.bind(this)();
2388    Stack.pop();
2389    Stack.pop();
2390    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
2391  }
2392
2393  getItems() {
2394    return this.items ?? EMPTY_ITEMS;
2395  }
2396
2397  getItemBackplateShadow() {
2398    return this.itemShadow ?? this.theme.itemShadow;
2399  }
2400
2401  getButtonBackgroundBlurStyle() {
2402    if (this.buttonBackgroundEffect) {
2403      return undefined;
2404    }
2405    return this.buttonBackgroundBlurStyle;
2406  }
2407
2408  getButtonBackgroundBlurStyleOptions() {
2409    if (this.buttonBackgroundEffect) {
2410      return undefined;
2411    }
2412    return this.buttonBackgroundBlurStyleOptions;
2413  }
2414
2415  getItemScale(q3) {
2416    const r3 = this.isPressed(q3);
2417    const s3 = r3 ? 0.95 : 1;
2418    return { x: s3, y: s3 };
2419  }
2420
2421  isPressed(p3) {
2422    return this.mousePressedItemIndex === p3;
2423  }
2424
2425  updateHoveredItemIndex(o3) {
2426    if (o3 === this.hoveredItemIndex) {
2427      return;
2428    }
2429    Context.animateTo({ duration: 250, curve: Curve.Friction }, () => {
2430      this.hoveredItemIndex = o3;
2431    });
2432  }
2433
2434  updateMousePressedItemIndex(n3) {
2435    if (n3 === this.mousePressedItemIndex) {
2436      return;
2437    }
2438    Context.animateTo({ duration: 250, curve: Curve.Friction }, () => {
2439      this.mousePressedItemIndex = n3;
2440    });
2441  }
2442
2443  updateTouchPressedItemIndex(m3) {
2444    if (m3 === this.touchPressedItemIndex) {
2445      return;
2446    }
2447    Context.animateTo({ duration: 250, curve: Curve.Friction }, () => {
2448      this.touchPressedItemIndex = m3;
2449    });
2450  }
2451
2452  isRTL() {
2453    if (this.languageDirection || this.languageDirection === Direction.Auto) {
2454      return i18n.isRTL(i18n.System.getSystemLanguage());
2455    }
2456    return this.languageDirection === Direction.Rtl;
2457  }
2458
2459  getEffectBackgroundColor(l3) {
2460    if (l3.index === this.mousePressedItemIndex) {
2461      return {
2462        id: -1,
2463        type: 10001,
2464        params: ['sys.color.interactive_click'],
2465        bundleName: '__harDefaultBundleName__',
2466        moduleName: '__harDefaultModuleName__',
2467      };
2468    }
2469    if (l3.index === this.hoveredItemIndex) {
2470      return {
2471        id: -1,
2472        type: 10001,
2473        params: ['sys.color.interactive_hover'],
2474        bundleName: '__harDefaultBundleName__',
2475        moduleName: '__harDefaultModuleName__',
2476      };
2477    }
2478    return Color.Transparent;
2479  }
2480
2481  getItemBorderRadius() {
2482    if (
2483      this.itemBorderRadius &&
2484      LengthMetricsUtils.getInstance().isNaturalNumber(this.itemBorderRadius)
2485    ) {
2486      return LengthMetricsUtils.getInstance().stringify(this.itemBorderRadius);
2487    }
2488    return this.theme.itemBorderRadius;
2489  }
2490
2491  getItemSelectedBackgroundColor() {
2492    if (this.itemSelectedBackgroundColor) {
2493      return this.itemSelectedBackgroundColor.color;
2494    }
2495    return this.theme.itemSelectedBackgroundColor;
2496  }
2497
2498  getItemSpace() {
2499    if (
2500      this.itemSpace &&
2501      this.itemSpace.unit !== LengthUnit.PERCENT &&
2502      LengthMetricsUtils.getInstance().isNaturalNumber(this.itemSpace)
2503    ) {
2504      return this.itemSpace;
2505    }
2506    return this.theme.itemSpace;
2507  }
2508
2509  getIndexByPosition(h3, i3) {
2510    let j3 = 0;
2511    while (j3 < this.itemRects.length) {
2512      const k3 = this.itemRects[j3];
2513      if (this.isPointOnRect(h3, i3, k3)) {
2514        return j3;
2515      }
2516      ++j3;
2517    }
2518    return -1;
2519  }
2520
2521  isPointOnRect(e3, f3, g3) {
2522    return (
2523      e3 >= g3.globalPosition.x &&
2524      e3 <= g3.globalPosition.x + g3.size.width &&
2525      f3 >= g3.globalPosition.y &&
2526      f3 <= g3.globalPosition.y + g3.size.height
2527    );
2528  }
2529
2530  updateSelectedIndex(d3) {
2531    if (!this.isItemEnabled(d3) || d3 === this.selectedIndex) {
2532      return;
2533    }
2534    this.getUIContext().animateTo(
2535      { curve: curves.springMotion(0.347, 0.99) },
2536      () => {
2537        this.$selectedIndex?.(d3);
2538      }
2539    );
2540  }
2541
2542  updateItemScale(c3) {
2543    if (this.itemScale === c3) {
2544      return;
2545    }
2546    this.getUIContext().animateTo(
2547      { curve: curves.interpolatingSpring(10, 1, 410, 38) },
2548      () => {
2549        this.itemScale = c3;
2550      }
2551    );
2552  }
2553
2554  getItemAccessibilityDescription(b3) {
2555    return b3.item.accessibilityDescription;
2556  }
2557
2558  getItemAccessibilityText(a3) {
2559    return a3.item.accessibilityText;
2560  }
2561
2562  isSelected(z2) {
2563    return z2.index === this.normalizedSelectedIndex;
2564  }
2565
2566  getButtonPadding() {
2567    if (
2568      this.buttonPadding &&
2569      LengthMetricsUtils.getInstance().isNaturalNumber(this.buttonPadding)
2570    ) {
2571      return LengthMetricsUtils.getInstance().stringify(this.buttonPadding);
2572    }
2573    return this.theme.buttonPadding;
2574  }
2575
2576  getButtonBorderRadius() {
2577    if (
2578      this.buttonBorderRadius &&
2579      LengthMetricsUtils.getInstance().isNaturalNumber(this.buttonBorderRadius)
2580    ) {
2581      return LengthMetricsUtils.getInstance().stringify(
2582        this.buttonBorderRadius
2583      );
2584    }
2585    return this.theme.buttonBorderRadius;
2586  }
2587
2588  getButtonBackgroundColor() {
2589    if (this.buttonBackgroundColor) {
2590      return this.buttonBackgroundColor.color;
2591    }
2592    return this.theme.buttonBackgroundColor;
2593  }
2594
2595  getButtonMinHeight() {
2596    if (
2597      this.buttonMinHeight &&
2598      LengthMetricsUtils.getInstance().isNaturalNumber(this.buttonMinHeight)
2599    ) {
2600      return LengthMetricsUtils.getInstance().stringify(this.buttonMinHeight);
2601    }
2602    const y2 = this.getItems();
2603    return y2.hasHybrid
2604      ? this.theme.hybridButtonMinHeight
2605      : this.theme.buttonMinHeight;
2606  }
2607
2608  updateStateVars(x2) {
2609    if (x2 === undefined) {
2610      return;
2611    }
2612    if ('items' in x2) {
2613      this.updateParam('items', x2.items);
2614    }
2615    if ('selectedIndex' in x2) {
2616      this.updateParam('selectedIndex', x2.selectedIndex);
2617    }
2618    if ('theme' in x2) {
2619      this.updateParam('theme', x2.theme);
2620    }
2621    if ('itemMinFontScale' in x2) {
2622      this.updateParam('itemMinFontScale', x2.itemMinFontScale);
2623    }
2624    if ('itemMaxFontScale' in x2) {
2625      this.updateParam('itemMaxFontScale', x2.itemMaxFontScale);
2626    }
2627    if ('itemSpace' in x2) {
2628      this.updateParam('itemSpace', x2.itemSpace);
2629    }
2630    if ('itemFontColor' in x2) {
2631      this.updateParam('itemFontColor', x2.itemFontColor);
2632    }
2633    if ('itemSelectedFontColor' in x2) {
2634      this.updateParam('itemSelectedFontColor', x2.itemSelectedFontColor);
2635    }
2636    if ('itemFontSize' in x2) {
2637      this.updateParam('itemFontSize', x2.itemFontSize);
2638    }
2639    if ('itemSelectedFontSize' in x2) {
2640      this.updateParam('itemSelectedFontSize', x2.itemSelectedFontSize);
2641    }
2642    if ('itemFontWeight' in x2) {
2643      this.updateParam('itemFontWeight', x2.itemFontWeight);
2644    }
2645    if ('itemSelectedFontWeight' in x2) {
2646      this.updateParam('itemSelectedFontWeight', x2.itemSelectedFontWeight);
2647    }
2648    if ('itemBorderRadius' in x2) {
2649      this.updateParam('itemBorderRadius', x2.itemBorderRadius);
2650    }
2651    if ('itemSelectedBackgroundColor' in x2) {
2652      this.updateParam(
2653        'itemSelectedBackgroundColor',
2654        x2.itemSelectedBackgroundColor
2655      );
2656    }
2657    if ('itemIconSize' in x2) {
2658      this.updateParam('itemIconSize', x2.itemIconSize);
2659    }
2660    if ('itemIconFillColor' in x2) {
2661      this.updateParam('itemIconFillColor', x2.itemIconFillColor);
2662    }
2663    if ('itemSelectedIconFillColor' in x2) {
2664      this.updateParam(
2665        'itemSelectedIconFillColor',
2666        x2.itemSelectedIconFillColor
2667      );
2668    }
2669    if ('itemSymbolFontSize' in x2) {
2670      this.updateParam('itemSymbolFontSize', x2.itemSymbolFontSize);
2671    }
2672    if ('itemSymbolFontColor' in x2) {
2673      this.updateParam('itemSymbolFontColor', x2.itemSymbolFontColor);
2674    }
2675    if ('itemSelectedSymbolFontColor' in x2) {
2676      this.updateParam(
2677        'itemSelectedSymbolFontColor',
2678        x2.itemSelectedSymbolFontColor
2679      );
2680    }
2681    if ('itemMinHeight' in x2) {
2682      this.updateParam('itemMinHeight', x2.itemMinHeight);
2683    }
2684    if ('itemPadding' in x2) {
2685      this.updateParam('itemPadding', x2.itemPadding);
2686    }
2687    if ('itemShadow' in x2) {
2688      this.updateParam('itemShadow', x2.itemShadow);
2689    }
2690    if ('buttonBackgroundColor' in x2) {
2691      this.updateParam('buttonBackgroundColor', x2.buttonBackgroundColor);
2692    }
2693    if ('buttonBackgroundBlurStyle' in x2) {
2694      this.updateParam(
2695        'buttonBackgroundBlurStyle',
2696        x2.buttonBackgroundBlurStyle
2697      );
2698    }
2699    if ('buttonBackgroundBlurStyleOptions' in x2) {
2700      this.updateParam(
2701        'buttonBackgroundBlurStyleOptions',
2702        x2.buttonBackgroundBlurStyleOptions
2703      );
2704    }
2705    if ('buttonBackgroundEffect' in x2) {
2706      this.updateParam('buttonBackgroundEffect', x2.buttonBackgroundEffect);
2707    }
2708    if ('buttonBorderRadius' in x2) {
2709      this.updateParam('buttonBorderRadius', x2.buttonBorderRadius);
2710    }
2711    if ('buttonMinHeight' in x2) {
2712      this.updateParam('buttonMinHeight', x2.buttonMinHeight);
2713    }
2714    if ('buttonPadding' in x2) {
2715      this.updateParam('buttonPadding', x2.buttonPadding);
2716    }
2717    if ('languageDirection' in x2) {
2718      this.updateParam('languageDirection', x2.languageDirection);
2719    }
2720  }
2721
2722  rerender() {
2723    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
2724    this.updateDirtyElements();
2725    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
2726  }
2727}
2728
2729__decorate([Param], SimpleSegmentButtonV2.prototype, 'items', void 0);
2730__decorate([Param], SimpleSegmentButtonV2.prototype, 'selectedIndex', void 0);
2731__decorate([Event], SimpleSegmentButtonV2.prototype, '$selectedIndex', void 0);
2732__decorate([Param], SimpleSegmentButtonV2.prototype, 'theme', void 0);
2733__decorate([Event], SimpleSegmentButtonV2.prototype, 'onItemClicked', void 0);
2734__decorate(
2735  [Param],
2736  SimpleSegmentButtonV2.prototype,
2737  'itemMinFontScale',
2738  void 0
2739);
2740__decorate(
2741  [Param],
2742  SimpleSegmentButtonV2.prototype,
2743  'itemMaxFontScale',
2744  void 0
2745);
2746__decorate([Param], SimpleSegmentButtonV2.prototype, 'itemSpace', void 0);
2747__decorate([Param], SimpleSegmentButtonV2.prototype, 'itemFontColor', void 0);
2748__decorate(
2749  [Param],
2750  SimpleSegmentButtonV2.prototype,
2751  'itemSelectedFontColor',
2752  void 0
2753);
2754__decorate([Param], SimpleSegmentButtonV2.prototype, 'itemFontSize', void 0);
2755__decorate(
2756  [Param],
2757  SimpleSegmentButtonV2.prototype,
2758  'itemSelectedFontSize',
2759  void 0
2760);
2761__decorate([Param], SimpleSegmentButtonV2.prototype, 'itemFontWeight', void 0);
2762__decorate(
2763  [Param],
2764  SimpleSegmentButtonV2.prototype,
2765  'itemSelectedFontWeight',
2766  void 0
2767);
2768__decorate(
2769  [Param],
2770  SimpleSegmentButtonV2.prototype,
2771  'itemBorderRadius',
2772  void 0
2773);
2774__decorate(
2775  [Param],
2776  SimpleSegmentButtonV2.prototype,
2777  'itemSelectedBackgroundColor',
2778  void 0
2779);
2780__decorate([Param], SimpleSegmentButtonV2.prototype, 'itemIconSize', void 0);
2781__decorate(
2782  [Param],
2783  SimpleSegmentButtonV2.prototype,
2784  'itemIconFillColor',
2785  void 0
2786);
2787__decorate(
2788  [Param],
2789  SimpleSegmentButtonV2.prototype,
2790  'itemSelectedIconFillColor',
2791  void 0
2792);
2793__decorate(
2794  [Param],
2795  SimpleSegmentButtonV2.prototype,
2796  'itemSymbolFontSize',
2797  void 0
2798);
2799__decorate(
2800  [Param],
2801  SimpleSegmentButtonV2.prototype,
2802  'itemSymbolFontColor',
2803  void 0
2804);
2805__decorate(
2806  [Param],
2807  SimpleSegmentButtonV2.prototype,
2808  'itemSelectedSymbolFontColor',
2809  void 0
2810);
2811__decorate([Param], SimpleSegmentButtonV2.prototype, 'itemMinHeight', void 0);
2812__decorate([Param], SimpleSegmentButtonV2.prototype, 'itemPadding', void 0);
2813__decorate([Param], SimpleSegmentButtonV2.prototype, 'itemShadow', void 0);
2814__decorate(
2815  [Param],
2816  SimpleSegmentButtonV2.prototype,
2817  'buttonBackgroundColor',
2818  void 0
2819);
2820__decorate(
2821  [Param],
2822  SimpleSegmentButtonV2.prototype,
2823  'buttonBackgroundBlurStyle',
2824  void 0
2825);
2826__decorate(
2827  [Param],
2828  SimpleSegmentButtonV2.prototype,
2829  'buttonBackgroundBlurStyleOptions',
2830  void 0
2831);
2832__decorate(
2833  [Param],
2834  SimpleSegmentButtonV2.prototype,
2835  'buttonBackgroundEffect',
2836  void 0
2837);
2838__decorate(
2839  [Param],
2840  SimpleSegmentButtonV2.prototype,
2841  'buttonBorderRadius',
2842  void 0
2843);
2844__decorate([Param], SimpleSegmentButtonV2.prototype, 'buttonMinHeight', void 0);
2845__decorate([Param], SimpleSegmentButtonV2.prototype, 'buttonPadding', void 0);
2846__decorate(
2847  [Param],
2848  SimpleSegmentButtonV2.prototype,
2849  'languageDirection',
2850  void 0
2851);
2852__decorate([Local], SimpleSegmentButtonV2.prototype, 'itemRects', void 0);
2853__decorate([Local], SimpleSegmentButtonV2.prototype, 'itemScale', void 0);
2854__decorate(
2855  [Local],
2856  SimpleSegmentButtonV2.prototype,
2857  'hoveredItemIndex',
2858  void 0
2859);
2860__decorate(
2861  [Local],
2862  SimpleSegmentButtonV2.prototype,
2863  'mousePressedItemIndex',
2864  void 0
2865);
2866__decorate(
2867  [Local],
2868  SimpleSegmentButtonV2.prototype,
2869  'touchPressedItemIndex',
2870  void 0
2871);
2872__decorate(
2873  [Computed],
2874  SimpleSegmentButtonV2.prototype,
2875  'normalizedSelectedIndex',
2876  null
2877);
2878__decorate(
2879  [Computed],
2880  SimpleSegmentButtonV2.prototype,
2881  'selectedItemRect',
2882  null
2883);
2884const multiplyCapsuleTheme = {
2885  itemBorderRadius: {
2886    id: -1,
2887    type: 10002,
2888    params: ['sys.float.segment_button_v2_multi_corner_radius'],
2889    bundleName: '__harDefaultBundleName__',
2890    moduleName: '__harDefaultModuleName__',
2891  },
2892  itemBackgroundColor: {
2893    id: -1,
2894    type: 10001,
2895    params: ['sys.color.segment_button_v2_multi_capsule_button_background'],
2896    bundleName: '__harDefaultBundleName__',
2897    moduleName: '__harDefaultModuleName__',
2898  },
2899  itemSelectedBackgroundColor: {
2900    id: -1,
2901    type: 10001,
2902    params: ['sys.color.comp_background_emphasize'],
2903    bundleName: '__harDefaultBundleName__',
2904    moduleName: '__harDefaultModuleName__',
2905  },
2906  itemSpace: LengthMetrics.vp(1),
2907  itemFontColor: {
2908    id: -1,
2909    type: 10001,
2910    params: ['sys.color.font_secondary'],
2911    bundleName: '__harDefaultBundleName__',
2912    moduleName: '__harDefaultModuleName__',
2913  },
2914  itemSelectedFontColor: {
2915    id: -1,
2916    type: 10001,
2917    params: ['sys.color.font_on_primary'],
2918    bundleName: '__harDefaultBundleName__',
2919    moduleName: '__harDefaultModuleName__',
2920  },
2921  itemFontWeight: FontWeight.Medium,
2922  itemSelectedFontWeight: FontWeight.Medium,
2923  itemIconFillColor: {
2924    id: -1,
2925    type: 10001,
2926    params: ['sys.color.icon_secondary'],
2927    bundleName: '__harDefaultBundleName__',
2928    moduleName: '__harDefaultModuleName__',
2929  },
2930  itemSelectedIconFillColor: {
2931    id: -1,
2932    type: 10001,
2933    params: ['sys.color.font_on_primary'],
2934    bundleName: '__harDefaultBundleName__',
2935    moduleName: '__harDefaultModuleName__',
2936  },
2937  itemSymbolFontColor: {
2938    id: -1,
2939    type: 10001,
2940    params: ['sys.color.font_secondary'],
2941    bundleName: '__harDefaultBundleName__',
2942    moduleName: '__harDefaultModuleName__',
2943  },
2944  itemSelectedSymbolFontColor: {
2945    id: -1,
2946    type: 10001,
2947    params: ['sys.color.font_on_primary'],
2948    bundleName: '__harDefaultBundleName__',
2949    moduleName: '__harDefaultModuleName__',
2950  },
2951  itemFontSize: {
2952    id: -1,
2953    type: 10002,
2954    params: ['sys.float.ohos_id_text_size_button2'],
2955    bundleName: '__harDefaultBundleName__',
2956    moduleName: '__harDefaultModuleName__',
2957  },
2958  itemIconSize: 24,
2959  itemSymbolFontSize: 20,
2960  itemPadding: {
2961    top: LengthMetrics.resource({
2962      id: -1,
2963      type: 10002,
2964      params: ['sys.float.padding_level2'],
2965      bundleName: '__harDefaultBundleName__',
2966      moduleName: '__harDefaultModuleName__',
2967    }),
2968    bottom: LengthMetrics.resource({
2969      id: -1,
2970      type: 10002,
2971      params: ['sys.float.padding_level2'],
2972      bundleName: '__harDefaultBundleName__',
2973      moduleName: '__harDefaultModuleName__',
2974    }),
2975    start: LengthMetrics.resource({
2976      id: -1,
2977      type: 10002,
2978      params: ['sys.float.padding_level4'],
2979      bundleName: '__harDefaultBundleName__',
2980      moduleName: '__harDefaultModuleName__',
2981    }),
2982    end: LengthMetrics.resource({
2983      id: -1,
2984      type: 10002,
2985      params: ['sys.float.padding_level4'],
2986      bundleName: '__harDefaultBundleName__',
2987      moduleName: '__harDefaultModuleName__',
2988    }),
2989  },
2990  itemMinHeight: {
2991    id: -1,
2992    type: 10002,
2993    params: ['sys.float.segment_button_v2_multi_singleline_height'],
2994    bundleName: '__harDefaultBundleName__',
2995    moduleName: '__harDefaultModuleName__',
2996  },
2997  hybridItemMinHeight: {
2998    id: -1,
2999    type: 10002,
3000    params: ['sys.float.segment_button_v2_multi_doubleline_height'],
3001    bundleName: '__harDefaultBundleName__',
3002    moduleName: '__harDefaultModuleName__',
3003  },
3004  itemMaxFontScale: SMALLEST_MAX_FONT_SCALE,
3005  itemMaxFontScaleSmallest: SMALLEST_MAX_FONT_SCALE,
3006  itemMaxFontScaleLargest: LARGEST_MAX_FONT_SCALE,
3007  itemMinFontScale: SMALLEST_MIN_FONT_SCALE,
3008  itemMinFontScaleSmallest: SMALLEST_MIN_FONT_SCALE,
3009  itemMinFontScaleLargest: LARGEST_MIN_FONT_SCALE,
3010};
3011
3012export class MultiCapsuleSegmentButtonV2 extends ViewV2 {
3013  constructor(r2, s2, t2, u2 = -1, v2, w2) {
3014    super(r2, u2, w2);
3015    this.initParam('items', s2 && 'items' in s2 ? s2.items : undefined);
3016    this.initParam(
3017      'selectedIndexes',
3018      s2 && 'selectedIndexes' in s2 ? s2.selectedIndexes : undefined
3019    );
3020    this.$selectedIndexes =
3021      '$selectedIndexes' in s2 ? s2.$selectedIndexes : () => {};
3022    this.onItemClicked = 'onItemClicked' in s2 ? s2.onItemClicked : () => {};
3023    this.initParam(
3024      'itemMinFontScale',
3025      s2 && 'itemMinFontScale' in s2 ? s2.itemMinFontScale : undefined
3026    );
3027    this.initParam(
3028      'itemMaxFontScale',
3029      s2 && 'itemMaxFontScale' in s2 ? s2.itemMaxFontScale : undefined
3030    );
3031    this.initParam(
3032      'itemSpace',
3033      s2 && 'itemSpace' in s2 ? s2.itemSpace : undefined
3034    );
3035    this.initParam(
3036      'itemFontColor',
3037      s2 && 'itemFontColor' in s2 ? s2.itemFontColor : undefined
3038    );
3039    this.initParam(
3040      'itemSelectedFontColor',
3041      s2 && 'itemSelectedFontColor' in s2 ? s2.itemSelectedFontColor : undefined
3042    );
3043    this.initParam(
3044      'itemFontSize',
3045      s2 && 'itemFontSize' in s2 ? s2.itemFontSize : undefined
3046    );
3047    this.initParam(
3048      'itemSelectedFontSize',
3049      s2 && 'itemSelectedFontSize' in s2 ? s2.itemSelectedFontSize : undefined
3050    );
3051    this.initParam(
3052      'itemFontWeight',
3053      s2 && 'itemFontWeight' in s2 ? s2.itemFontWeight : undefined
3054    );
3055    this.initParam(
3056      'itemSelectedFontWeight',
3057      s2 && 'itemSelectedFontWeight' in s2
3058        ? s2.itemSelectedFontWeight
3059        : undefined
3060    );
3061    this.initParam(
3062      'itemBorderRadius',
3063      s2 && 'itemBorderRadius' in s2 ? s2.itemBorderRadius : undefined
3064    );
3065    this.initParam(
3066      'itemBackgroundColor',
3067      s2 && 'itemBackgroundColor' in s2 ? s2.itemBackgroundColor : undefined
3068    );
3069    this.initParam(
3070      'itemBackgroundEffect',
3071      s2 && 'itemBackgroundEffect' in s2 ? s2.itemBackgroundEffect : undefined
3072    );
3073    this.initParam(
3074      'itemBackgroundBlurStyle',
3075      s2 && 'itemBackgroundBlurStyle' in s2
3076        ? s2.itemBackgroundBlurStyle
3077        : undefined
3078    );
3079    this.initParam(
3080      'itemBackgroundBlurStyleOptions',
3081      s2 && 'itemBackgroundBlurStyleOptions' in s2
3082        ? s2.itemBackgroundBlurStyleOptions
3083        : undefined
3084    );
3085    this.initParam(
3086      'itemSelectedBackgroundColor',
3087      s2 && 'itemSelectedBackgroundColor' in s2
3088        ? s2.itemSelectedBackgroundColor
3089        : undefined
3090    );
3091    this.initParam(
3092      'itemIconSize',
3093      s2 && 'itemIconSize' in s2 ? s2.itemIconSize : undefined
3094    );
3095    this.initParam(
3096      'itemIconFillColor',
3097      s2 && 'itemIconFillColor' in s2 ? s2.itemIconFillColor : undefined
3098    );
3099    this.initParam(
3100      'itemSelectedIconFillColor',
3101      s2 && 'itemSelectedIconFillColor' in s2
3102        ? s2.itemSelectedIconFillColor
3103        : undefined
3104    );
3105    this.initParam(
3106      'itemSymbolFontSize',
3107      s2 && 'itemSymbolFontSize' in s2 ? s2.itemSymbolFontSize : undefined
3108    );
3109    this.initParam(
3110      'itemSymbolFontColor',
3111      s2 && 'itemSymbolFontColor' in s2 ? s2.itemSymbolFontColor : undefined
3112    );
3113    this.initParam(
3114      'itemSelectedSymbolFontColor',
3115      s2 && 'itemSelectedSymbolFontColor' in s2
3116        ? s2.itemSelectedSymbolFontColor
3117        : undefined
3118    );
3119    this.initParam(
3120      'itemMinHeight',
3121      s2 && 'itemMinHeight' in s2 ? s2.itemMinHeight : undefined
3122    );
3123    this.initParam(
3124      'itemPadding',
3125      s2 && 'itemPadding' in s2 ? s2.itemPadding : undefined
3126    );
3127    this.initParam(
3128      'languageDirection',
3129      s2 && 'languageDirection' in s2 ? s2.languageDirection : undefined
3130    );
3131    this.theme = multiplyCapsuleTheme;
3132    this.focusGroupId = util.generateRandomUUID();
3133    this.finalizeConstruction();
3134  }
3135
3136  resetStateVarsOnReuse(q2) {
3137    this.resetParam('items', q2 && 'items' in q2 ? q2.items : undefined);
3138    this.resetParam(
3139      'selectedIndexes',
3140      q2 && 'selectedIndexes' in q2 ? q2.selectedIndexes : undefined
3141    );
3142    this.$selectedIndexes =
3143      '$selectedIndexes' in q2 ? q2.$selectedIndexes : () => {};
3144    this.onItemClicked = 'onItemClicked' in q2 ? q2.onItemClicked : () => {};
3145    this.resetParam(
3146      'itemMinFontScale',
3147      q2 && 'itemMinFontScale' in q2 ? q2.itemMinFontScale : undefined
3148    );
3149    this.resetParam(
3150      'itemMaxFontScale',
3151      q2 && 'itemMaxFontScale' in q2 ? q2.itemMaxFontScale : undefined
3152    );
3153    this.resetParam(
3154      'itemSpace',
3155      q2 && 'itemSpace' in q2 ? q2.itemSpace : undefined
3156    );
3157    this.resetParam(
3158      'itemFontColor',
3159      q2 && 'itemFontColor' in q2 ? q2.itemFontColor : undefined
3160    );
3161    this.resetParam(
3162      'itemSelectedFontColor',
3163      q2 && 'itemSelectedFontColor' in q2 ? q2.itemSelectedFontColor : undefined
3164    );
3165    this.resetParam(
3166      'itemFontSize',
3167      q2 && 'itemFontSize' in q2 ? q2.itemFontSize : undefined
3168    );
3169    this.resetParam(
3170      'itemSelectedFontSize',
3171      q2 && 'itemSelectedFontSize' in q2 ? q2.itemSelectedFontSize : undefined
3172    );
3173    this.resetParam(
3174      'itemFontWeight',
3175      q2 && 'itemFontWeight' in q2 ? q2.itemFontWeight : undefined
3176    );
3177    this.resetParam(
3178      'itemSelectedFontWeight',
3179      q2 && 'itemSelectedFontWeight' in q2
3180        ? q2.itemSelectedFontWeight
3181        : undefined
3182    );
3183    this.resetParam(
3184      'itemBorderRadius',
3185      q2 && 'itemBorderRadius' in q2 ? q2.itemBorderRadius : undefined
3186    );
3187    this.resetParam(
3188      'itemBackgroundColor',
3189      q2 && 'itemBackgroundColor' in q2 ? q2.itemBackgroundColor : undefined
3190    );
3191    this.resetParam(
3192      'itemBackgroundEffect',
3193      q2 && 'itemBackgroundEffect' in q2 ? q2.itemBackgroundEffect : undefined
3194    );
3195    this.resetParam(
3196      'itemBackgroundBlurStyle',
3197      q2 && 'itemBackgroundBlurStyle' in q2
3198        ? q2.itemBackgroundBlurStyle
3199        : undefined
3200    );
3201    this.resetParam(
3202      'itemBackgroundBlurStyleOptions',
3203      q2 && 'itemBackgroundBlurStyleOptions' in q2
3204        ? q2.itemBackgroundBlurStyleOptions
3205        : undefined
3206    );
3207    this.resetParam(
3208      'itemSelectedBackgroundColor',
3209      q2 && 'itemSelectedBackgroundColor' in q2
3210        ? q2.itemSelectedBackgroundColor
3211        : undefined
3212    );
3213    this.resetParam(
3214      'itemIconSize',
3215      q2 && 'itemIconSize' in q2 ? q2.itemIconSize : undefined
3216    );
3217    this.resetParam(
3218      'itemIconFillColor',
3219      q2 && 'itemIconFillColor' in q2 ? q2.itemIconFillColor : undefined
3220    );
3221    this.resetParam(
3222      'itemSelectedIconFillColor',
3223      q2 && 'itemSelectedIconFillColor' in q2
3224        ? q2.itemSelectedIconFillColor
3225        : undefined
3226    );
3227    this.resetParam(
3228      'itemSymbolFontSize',
3229      q2 && 'itemSymbolFontSize' in q2 ? q2.itemSymbolFontSize : undefined
3230    );
3231    this.resetParam(
3232      'itemSymbolFontColor',
3233      q2 && 'itemSymbolFontColor' in q2 ? q2.itemSymbolFontColor : undefined
3234    );
3235    this.resetParam(
3236      'itemSelectedSymbolFontColor',
3237      q2 && 'itemSelectedSymbolFontColor' in q2
3238        ? q2.itemSelectedSymbolFontColor
3239        : undefined
3240    );
3241    this.resetParam(
3242      'itemMinHeight',
3243      q2 && 'itemMinHeight' in q2 ? q2.itemMinHeight : undefined
3244    );
3245    this.resetParam(
3246      'itemPadding',
3247      q2 && 'itemPadding' in q2 ? q2.itemPadding : undefined
3248    );
3249    this.resetParam(
3250      'languageDirection',
3251      q2 && 'languageDirection' in q2 ? q2.languageDirection : undefined
3252    );
3253  }
3254
3255  initialRender() {
3256    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
3257    this.observeComponentCreation2((o2, p2) => {
3258      Flex.create({
3259        alignItems: ItemAlign.Stretch,
3260        space: { main: this.getItemSpace() },
3261      });
3262      Flex.clip(false);
3263      Flex.direction(this.languageDirection);
3264      Flex.focusScopeId(this.focusGroupId, true);
3265    }, Flex);
3266    this.observeComponentCreation2((y1, z1) => {
3267      Repeat(this.getItems(), this)
3268        .each((a2) => {
3269          this.observeComponentCreation2((h2, i2) => {
3270            Button.createWithChild({ type: ButtonType.Normal });
3271            Button.accessibilityGroup(true);
3272            Button.accessibilityChecked(this.isSelected(a2));
3273            Button.accessibilityText(this.getItemAccessibilityText(a2));
3274            Button.accessibilityDescription(
3275              this.getItemAccessibilityDescription(a2)
3276            );
3277            Button.accessibilityLevel(a2.item.accessibilityLevel);
3278            Button.backgroundColor(this.getItemBackgroundColor(a2));
3279            Button.backgroundEffect(this.itemBackgroundEffect);
3280            Button.borderRadius(this.getItemButtonBorderRadius(a2));
3281            Button.constraintSize({ minHeight: this.getItemMinHeight() });
3282            Button.direction(this.languageDirection);
3283            Button.enabled(a2.item.enabled);
3284            Button.focusScopePriority(
3285              this.focusGroupId,
3286              this.getFocusPriority(a2)
3287            );
3288            Button.layoutWeight(1);
3289            Button.padding(0);
3290            Button.onClick(() => {
3291              this.onItemClicked?.(a2.index);
3292              let j2;
3293              const k2 = this.getItems();
3294              const l2 = this.selectedIndexes ?? [];
3295              if (this.isSelected(a2)) {
3296                j2 = l2.filter((n2) => {
3297                  if (n2 < 0 || n2 > k2.length - 1) {
3298                    return false;
3299                  }
3300                  return n2 !== a2.index;
3301                });
3302              } else {
3303                j2 = l2
3304                  .filter((m2) => m2 >= 0 && m2 <= k2.length - 1)
3305                  .concat(a2.index);
3306              }
3307              this.$selectedIndexes(j2);
3308            });
3309          }, Button);
3310          this.observeComponentCreation2((f2, g2) => {
3311            __Common__.create();
3312            __Common__.borderRadius(this.getItemButtonBorderRadius(a2));
3313            __Common__.backgroundBlurStyle(
3314              this.getItemBackgroundBlurStyle(),
3315              this.getItemBackgroundBlurStyleOptions()
3316            );
3317            __Common__.direction(this.languageDirection);
3318          }, __Common__);
3319          {
3320            this.observeComponentCreation2(
3321              (b2, c2) => {
3322                if (c2) {
3323                  let d2 = new SegmentButtonV2ItemContent(
3324                    this,
3325                    {
3326                      theme: this.theme,
3327                      item: a2.item,
3328                      selected: this.isSelected(a2),
3329                      hasHybrid: this.getItems().hasHybrid,
3330                      itemMinFontScale: this.itemMinFontScale,
3331                      itemMaxFontScale: this.itemMaxFontScale,
3332                      itemFontColor: this.itemFontColor,
3333                      itemSelectedFontColor: this.itemSelectedFontColor,
3334                      itemFontSize: this.itemFontSize,
3335                      itemSelectedFontSize: this.itemSelectedFontSize,
3336                      itemFontWeight: this.itemFontWeight,
3337                      itemSelectedFontWeight: this.itemSelectedFontWeight,
3338                      itemIconSize: this.itemIconSize,
3339                      itemIconFillColor: this.itemIconFillColor,
3340                      itemSelectedIconFillColor: this.itemSelectedIconFillColor,
3341                      itemSymbolFontSize: this.itemSymbolFontSize,
3342                      itemSymbolFontColor: this.itemSymbolFontColor,
3343                      itemSelectedSymbolFontColor:
3344                        this.itemSelectedSymbolFontColor,
3345                      itemMinHeight: this.itemMinHeight,
3346                      itemPadding: this.itemPadding,
3347                      languageDirection: this.languageDirection,
3348                    },
3349                    undefined,
3350                    b2,
3351                    () => {},
3352                    {
3353                      page: 'library/src/main/ets/components/MainPage.ets',
3354                      line: 1108,
3355                      col: 13,
3356                    }
3357                  );
3358                  ViewV2.create(d2);
3359                  let e2 = () => {
3360                    return {
3361                      theme: this.theme,
3362                      item: a2.item,
3363                      selected: this.isSelected(a2),
3364                      hasHybrid: this.getItems().hasHybrid,
3365                      itemMinFontScale: this.itemMinFontScale,
3366                      itemMaxFontScale: this.itemMaxFontScale,
3367                      itemFontColor: this.itemFontColor,
3368                      itemSelectedFontColor: this.itemSelectedFontColor,
3369                      itemFontSize: this.itemFontSize,
3370                      itemSelectedFontSize: this.itemSelectedFontSize,
3371                      itemFontWeight: this.itemFontWeight,
3372                      itemSelectedFontWeight: this.itemSelectedFontWeight,
3373                      itemIconSize: this.itemIconSize,
3374                      itemIconFillColor: this.itemIconFillColor,
3375                      itemSelectedIconFillColor: this.itemSelectedIconFillColor,
3376                      itemSymbolFontSize: this.itemSymbolFontSize,
3377                      itemSymbolFontColor: this.itemSymbolFontColor,
3378                      itemSelectedSymbolFontColor:
3379                        this.itemSelectedSymbolFontColor,
3380                      itemMinHeight: this.itemMinHeight,
3381                      itemPadding: this.itemPadding,
3382                      languageDirection: this.languageDirection,
3383                    };
3384                  };
3385                  d2.paramsGenerator_ = e2;
3386                } else {
3387                  this.updateStateVarsOfChildByElmtId(b2, {
3388                    theme: this.theme,
3389                    item: a2.item,
3390                    selected: this.isSelected(a2),
3391                    hasHybrid: this.getItems().hasHybrid,
3392                    itemMinFontScale: this.itemMinFontScale,
3393                    itemMaxFontScale: this.itemMaxFontScale,
3394                    itemFontColor: this.itemFontColor,
3395                    itemSelectedFontColor: this.itemSelectedFontColor,
3396                    itemFontSize: this.itemFontSize,
3397                    itemSelectedFontSize: this.itemSelectedFontSize,
3398                    itemFontWeight: this.itemFontWeight,
3399                    itemSelectedFontWeight: this.itemSelectedFontWeight,
3400                    itemIconSize: this.itemIconSize,
3401                    itemIconFillColor: this.itemIconFillColor,
3402                    itemSelectedIconFillColor: this.itemSelectedIconFillColor,
3403                    itemSymbolFontSize: this.itemSymbolFontSize,
3404                    itemSymbolFontColor: this.itemSymbolFontColor,
3405                    itemSelectedSymbolFontColor:
3406                      this.itemSelectedSymbolFontColor,
3407                    itemMinHeight: this.itemMinHeight,
3408                    itemPadding: this.itemPadding,
3409                    languageDirection: this.languageDirection,
3410                  });
3411                }
3412              },
3413              { name: 'SegmentButtonV2ItemContent' }
3414            );
3415          }
3416          __Common__.pop();
3417          Button.pop();
3418        })
3419        .key(generateUniqueKye(this.focusGroupId))
3420        .render(z1);
3421    }, Repeat);
3422    Flex.pop();
3423    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
3424  }
3425
3426  getFocusPriority(x1) {
3427    return Math.min(...this.selectedIndexes) === x1.index
3428      ? FocusPriority.PREVIOUS
3429      : FocusPriority.AUTO;
3430  }
3431
3432  getItems() {
3433    return this.items ?? EMPTY_ITEMS;
3434  }
3435
3436  getItemBackgroundBlurStyleOptions() {
3437    if (this.itemBackgroundEffect) {
3438      return undefined;
3439    }
3440    return this.itemBackgroundBlurStyleOptions;
3441  }
3442
3443  getItemBackgroundBlurStyle() {
3444    if (this.itemBackgroundEffect) {
3445      return undefined;
3446    }
3447    return this.itemBackgroundBlurStyle;
3448  }
3449
3450  getItemAccessibilityDescription(w1) {
3451    return w1.item.accessibilityDescription;
3452  }
3453
3454  getItemAccessibilityText(v1) {
3455    return v1.item.accessibilityText;
3456  }
3457
3458  getItemSpace() {
3459    if (
3460      this.itemSpace &&
3461      this.itemSpace.unit !== LengthUnit.PERCENT &&
3462      LengthMetricsUtils.getInstance().isNaturalNumber(this.itemSpace)
3463    ) {
3464      return this.itemSpace;
3465    }
3466    return this.theme.itemSpace;
3467  }
3468
3469  getItemMinHeight() {
3470    if (
3471      this.itemMinHeight &&
3472      LengthMetricsUtils.getInstance().isNaturalNumber(this.itemMinHeight)
3473    ) {
3474      return LengthMetricsUtils.getInstance().stringify(this.itemMinHeight);
3475    }
3476    return this.theme.itemMinHeight;
3477  }
3478
3479  getItemBackgroundColor(u1) {
3480    if (this.isSelected(u1)) {
3481      return (
3482        this.itemSelectedBackgroundColor?.color ??
3483        this.theme.itemSelectedBackgroundColor
3484      );
3485    }
3486    return this.itemBackgroundColor?.color ?? this.theme.itemBackgroundColor;
3487  }
3488
3489  isSelected(s1) {
3490    const t1 = this.selectedIndexes ?? [];
3491    return t1.includes(s1.index);
3492  }
3493
3494  getItemButtonBorderRadius(m1) {
3495    const n1 = this.getItems();
3496    const o1 = LengthMetrics.vp(0);
3497    const p1 = {
3498      topStart: o1,
3499      bottomStart: o1,
3500      topEnd: o1,
3501      bottomEnd: o1,
3502    };
3503    if (m1.index === 0) {
3504      const r1 =
3505        this.itemBorderRadius ??
3506        LengthMetrics.resource(this.theme.itemBorderRadius);
3507      p1.topStart = r1;
3508      p1.bottomStart = r1;
3509    }
3510    if (m1.index === n1.length - 1) {
3511      const q1 =
3512        this.itemBorderRadius ??
3513        LengthMetrics.resource(this.theme.itemBorderRadius);
3514      p1.topEnd = q1;
3515      p1.bottomEnd = q1;
3516    }
3517    return p1;
3518  }
3519
3520  updateStateVars(l1) {
3521    if (l1 === undefined) {
3522      return;
3523    }
3524    if ('items' in l1) {
3525      this.updateParam('items', l1.items);
3526    }
3527    if ('selectedIndexes' in l1) {
3528      this.updateParam('selectedIndexes', l1.selectedIndexes);
3529    }
3530    if ('itemMinFontScale' in l1) {
3531      this.updateParam('itemMinFontScale', l1.itemMinFontScale);
3532    }
3533    if ('itemMaxFontScale' in l1) {
3534      this.updateParam('itemMaxFontScale', l1.itemMaxFontScale);
3535    }
3536    if ('itemSpace' in l1) {
3537      this.updateParam('itemSpace', l1.itemSpace);
3538    }
3539    if ('itemFontColor' in l1) {
3540      this.updateParam('itemFontColor', l1.itemFontColor);
3541    }
3542    if ('itemSelectedFontColor' in l1) {
3543      this.updateParam('itemSelectedFontColor', l1.itemSelectedFontColor);
3544    }
3545    if ('itemFontSize' in l1) {
3546      this.updateParam('itemFontSize', l1.itemFontSize);
3547    }
3548    if ('itemSelectedFontSize' in l1) {
3549      this.updateParam('itemSelectedFontSize', l1.itemSelectedFontSize);
3550    }
3551    if ('itemFontWeight' in l1) {
3552      this.updateParam('itemFontWeight', l1.itemFontWeight);
3553    }
3554    if ('itemSelectedFontWeight' in l1) {
3555      this.updateParam('itemSelectedFontWeight', l1.itemSelectedFontWeight);
3556    }
3557    if ('itemBorderRadius' in l1) {
3558      this.updateParam('itemBorderRadius', l1.itemBorderRadius);
3559    }
3560    if ('itemBackgroundColor' in l1) {
3561      this.updateParam('itemBackgroundColor', l1.itemBackgroundColor);
3562    }
3563    if ('itemBackgroundEffect' in l1) {
3564      this.updateParam('itemBackgroundEffect', l1.itemBackgroundEffect);
3565    }
3566    if ('itemBackgroundBlurStyle' in l1) {
3567      this.updateParam('itemBackgroundBlurStyle', l1.itemBackgroundBlurStyle);
3568    }
3569    if ('itemBackgroundBlurStyleOptions' in l1) {
3570      this.updateParam(
3571        'itemBackgroundBlurStyleOptions',
3572        l1.itemBackgroundBlurStyleOptions
3573      );
3574    }
3575    if ('itemSelectedBackgroundColor' in l1) {
3576      this.updateParam(
3577        'itemSelectedBackgroundColor',
3578        l1.itemSelectedBackgroundColor
3579      );
3580    }
3581    if ('itemIconSize' in l1) {
3582      this.updateParam('itemIconSize', l1.itemIconSize);
3583    }
3584    if ('itemIconFillColor' in l1) {
3585      this.updateParam('itemIconFillColor', l1.itemIconFillColor);
3586    }
3587    if ('itemSelectedIconFillColor' in l1) {
3588      this.updateParam(
3589        'itemSelectedIconFillColor',
3590        l1.itemSelectedIconFillColor
3591      );
3592    }
3593    if ('itemSymbolFontSize' in l1) {
3594      this.updateParam('itemSymbolFontSize', l1.itemSymbolFontSize);
3595    }
3596    if ('itemSymbolFontColor' in l1) {
3597      this.updateParam('itemSymbolFontColor', l1.itemSymbolFontColor);
3598    }
3599    if ('itemSelectedSymbolFontColor' in l1) {
3600      this.updateParam(
3601        'itemSelectedSymbolFontColor',
3602        l1.itemSelectedSymbolFontColor
3603      );
3604    }
3605    if ('itemMinHeight' in l1) {
3606      this.updateParam('itemMinHeight', l1.itemMinHeight);
3607    }
3608    if ('itemPadding' in l1) {
3609      this.updateParam('itemPadding', l1.itemPadding);
3610    }
3611    if ('languageDirection' in l1) {
3612      this.updateParam('languageDirection', l1.languageDirection);
3613    }
3614  }
3615
3616  rerender() {
3617    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
3618    this.updateDirtyElements();
3619    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
3620  }
3621}
3622__decorate([Param], MultiCapsuleSegmentButtonV2.prototype, 'items', void 0);
3623__decorate(
3624  [Param],
3625  MultiCapsuleSegmentButtonV2.prototype,
3626  'selectedIndexes',
3627  void 0
3628);
3629__decorate(
3630  [Event],
3631  MultiCapsuleSegmentButtonV2.prototype,
3632  '$selectedIndexes',
3633  void 0
3634);
3635__decorate(
3636  [Event],
3637  MultiCapsuleSegmentButtonV2.prototype,
3638  'onItemClicked',
3639  void 0
3640);
3641__decorate(
3642  [Param],
3643  MultiCapsuleSegmentButtonV2.prototype,
3644  'itemMinFontScale',
3645  void 0
3646);
3647__decorate(
3648  [Param],
3649  MultiCapsuleSegmentButtonV2.prototype,
3650  'itemMaxFontScale',
3651  void 0
3652);
3653__decorate([Param], MultiCapsuleSegmentButtonV2.prototype, 'itemSpace', void 0);
3654__decorate(
3655  [Param],
3656  MultiCapsuleSegmentButtonV2.prototype,
3657  'itemFontColor',
3658  void 0
3659);
3660__decorate(
3661  [Param],
3662  MultiCapsuleSegmentButtonV2.prototype,
3663  'itemSelectedFontColor',
3664  void 0
3665);
3666__decorate(
3667  [Param],
3668  MultiCapsuleSegmentButtonV2.prototype,
3669  'itemFontSize',
3670  void 0
3671);
3672__decorate(
3673  [Param],
3674  MultiCapsuleSegmentButtonV2.prototype,
3675  'itemSelectedFontSize',
3676  void 0
3677);
3678__decorate(
3679  [Param],
3680  MultiCapsuleSegmentButtonV2.prototype,
3681  'itemFontWeight',
3682  void 0
3683);
3684__decorate(
3685  [Param],
3686  MultiCapsuleSegmentButtonV2.prototype,
3687  'itemSelectedFontWeight',
3688  void 0
3689);
3690__decorate(
3691  [Param],
3692  MultiCapsuleSegmentButtonV2.prototype,
3693  'itemBorderRadius',
3694  void 0
3695);
3696__decorate(
3697  [Param],
3698  MultiCapsuleSegmentButtonV2.prototype,
3699  'itemBackgroundColor',
3700  void 0
3701);
3702__decorate(
3703  [Param],
3704  MultiCapsuleSegmentButtonV2.prototype,
3705  'itemBackgroundEffect',
3706  void 0
3707);
3708__decorate(
3709  [Param],
3710  MultiCapsuleSegmentButtonV2.prototype,
3711  'itemBackgroundBlurStyle',
3712  void 0
3713);
3714__decorate(
3715  [Param],
3716  MultiCapsuleSegmentButtonV2.prototype,
3717  'itemBackgroundBlurStyleOptions',
3718  void 0
3719);
3720__decorate(
3721  [Param],
3722  MultiCapsuleSegmentButtonV2.prototype,
3723  'itemSelectedBackgroundColor',
3724  void 0
3725);
3726__decorate(
3727  [Param],
3728  MultiCapsuleSegmentButtonV2.prototype,
3729  'itemIconSize',
3730  void 0
3731);
3732__decorate(
3733  [Param],
3734  MultiCapsuleSegmentButtonV2.prototype,
3735  'itemIconFillColor',
3736  void 0
3737);
3738__decorate(
3739  [Param],
3740  MultiCapsuleSegmentButtonV2.prototype,
3741  'itemSelectedIconFillColor',
3742  void 0
3743);
3744__decorate(
3745  [Param],
3746  MultiCapsuleSegmentButtonV2.prototype,
3747  'itemSymbolFontSize',
3748  void 0
3749);
3750__decorate(
3751  [Param],
3752  MultiCapsuleSegmentButtonV2.prototype,
3753  'itemSymbolFontColor',
3754  void 0
3755);
3756__decorate(
3757  [Param],
3758  MultiCapsuleSegmentButtonV2.prototype,
3759  'itemSelectedSymbolFontColor',
3760  void 0
3761);
3762__decorate(
3763  [Param],
3764  MultiCapsuleSegmentButtonV2.prototype,
3765  'itemMinHeight',
3766  void 0
3767);
3768__decorate(
3769  [Param],
3770  MultiCapsuleSegmentButtonV2.prototype,
3771  'itemPadding',
3772  void 0
3773);
3774__decorate(
3775  [Param],
3776  MultiCapsuleSegmentButtonV2.prototype,
3777  'languageDirection',
3778  void 0
3779);
3780
3781class SegmentButtonV2ItemContent extends ViewV2 {
3782  constructor(f1, g1, h1, i1 = -1, j1, k1) {
3783    super(f1, i1, k1);
3784    this.initParam(
3785      'hasHybrid',
3786      g1 && 'hasHybrid' in g1 ? g1.hasHybrid : undefined
3787    );
3788    this.initParam('item', g1 && 'item' in g1 ? g1.item : undefined);
3789    this.initParam(
3790      'selected',
3791      g1 && 'selected' in g1 ? g1.selected : undefined
3792    );
3793    this.initParam('theme', g1 && 'theme' in g1 ? g1.theme : undefined);
3794    this.initParam(
3795      'itemMinFontScale',
3796      g1 && 'itemMinFontScale' in g1 ? g1.itemMinFontScale : undefined
3797    );
3798    this.initParam(
3799      'itemMaxFontScale',
3800      g1 && 'itemMaxFontScale' in g1 ? g1.itemMaxFontScale : undefined
3801    );
3802    this.initParam(
3803      'itemFontColor',
3804      g1 && 'itemFontColor' in g1 ? g1.itemFontColor : undefined
3805    );
3806    this.initParam(
3807      'itemSelectedFontColor',
3808      g1 && 'itemSelectedFontColor' in g1 ? g1.itemSelectedFontColor : undefined
3809    );
3810    this.initParam(
3811      'itemFontSize',
3812      g1 && 'itemFontSize' in g1 ? g1.itemFontSize : undefined
3813    );
3814    this.initParam(
3815      'itemSelectedFontSize',
3816      g1 && 'itemSelectedFontSize' in g1 ? g1.itemSelectedFontSize : undefined
3817    );
3818    this.initParam(
3819      'itemFontWeight',
3820      g1 && 'itemFontWeight' in g1 ? g1.itemFontWeight : undefined
3821    );
3822    this.initParam(
3823      'itemSelectedFontWeight',
3824      g1 && 'itemSelectedFontWeight' in g1
3825        ? g1.itemSelectedFontWeight
3826        : undefined
3827    );
3828    this.initParam(
3829      'itemIconSize',
3830      g1 && 'itemIconSize' in g1 ? g1.itemIconSize : undefined
3831    );
3832    this.initParam(
3833      'itemIconFillColor',
3834      g1 && 'itemIconFillColor' in g1 ? g1.itemIconFillColor : undefined
3835    );
3836    this.initParam(
3837      'itemSelectedIconFillColor',
3838      g1 && 'itemSelectedIconFillColor' in g1
3839        ? g1.itemSelectedIconFillColor
3840        : undefined
3841    );
3842    this.initParam(
3843      'itemSymbolFontSize',
3844      g1 && 'itemSymbolFontSize' in g1 ? g1.itemSymbolFontSize : undefined
3845    );
3846    this.initParam(
3847      'itemSymbolFontColor',
3848      g1 && 'itemSymbolFontColor' in g1 ? g1.itemSymbolFontColor : undefined
3849    );
3850    this.initParam(
3851      'itemSelectedSymbolFontColor',
3852      g1 && 'itemSelectedSymbolFontColor' in g1
3853        ? g1.itemSelectedSymbolFontColor
3854        : undefined
3855    );
3856    this.initParam(
3857      'itemMinHeight',
3858      g1 && 'itemMinHeight' in g1 ? g1.itemMinHeight : undefined
3859    );
3860    this.initParam(
3861      'itemPadding',
3862      g1 && 'itemPadding' in g1 ? g1.itemPadding : undefined
3863    );
3864    this.initParam(
3865      'languageDirection',
3866      g1 && 'languageDirection' in g1 ? g1.languageDirection : undefined
3867    );
3868    this.finalizeConstruction();
3869  }
3870
3871  resetStateVarsOnReuse(e1) {
3872    this.resetParam(
3873      'hasHybrid',
3874      e1 && 'hasHybrid' in e1 ? e1.hasHybrid : undefined
3875    );
3876    this.resetParam('item', e1 && 'item' in e1 ? e1.item : undefined);
3877    this.resetParam(
3878      'selected',
3879      e1 && 'selected' in e1 ? e1.selected : undefined
3880    );
3881    this.resetParam('theme', e1 && 'theme' in e1 ? e1.theme : undefined);
3882    this.resetParam(
3883      'itemMinFontScale',
3884      e1 && 'itemMinFontScale' in e1 ? e1.itemMinFontScale : undefined
3885    );
3886    this.resetParam(
3887      'itemMaxFontScale',
3888      e1 && 'itemMaxFontScale' in e1 ? e1.itemMaxFontScale : undefined
3889    );
3890    this.resetParam(
3891      'itemFontColor',
3892      e1 && 'itemFontColor' in e1 ? e1.itemFontColor : undefined
3893    );
3894    this.resetParam(
3895      'itemSelectedFontColor',
3896      e1 && 'itemSelectedFontColor' in e1 ? e1.itemSelectedFontColor : undefined
3897    );
3898    this.resetParam(
3899      'itemFontSize',
3900      e1 && 'itemFontSize' in e1 ? e1.itemFontSize : undefined
3901    );
3902    this.resetParam(
3903      'itemSelectedFontSize',
3904      e1 && 'itemSelectedFontSize' in e1 ? e1.itemSelectedFontSize : undefined
3905    );
3906    this.resetParam(
3907      'itemFontWeight',
3908      e1 && 'itemFontWeight' in e1 ? e1.itemFontWeight : undefined
3909    );
3910    this.resetParam(
3911      'itemSelectedFontWeight',
3912      e1 && 'itemSelectedFontWeight' in e1
3913        ? e1.itemSelectedFontWeight
3914        : undefined
3915    );
3916    this.resetParam(
3917      'itemIconSize',
3918      e1 && 'itemIconSize' in e1 ? e1.itemIconSize : undefined
3919    );
3920    this.resetParam(
3921      'itemIconFillColor',
3922      e1 && 'itemIconFillColor' in e1 ? e1.itemIconFillColor : undefined
3923    );
3924    this.resetParam(
3925      'itemSelectedIconFillColor',
3926      e1 && 'itemSelectedIconFillColor' in e1
3927        ? e1.itemSelectedIconFillColor
3928        : undefined
3929    );
3930    this.resetParam(
3931      'itemSymbolFontSize',
3932      e1 && 'itemSymbolFontSize' in e1 ? e1.itemSymbolFontSize : undefined
3933    );
3934    this.resetParam(
3935      'itemSymbolFontColor',
3936      e1 && 'itemSymbolFontColor' in e1 ? e1.itemSymbolFontColor : undefined
3937    );
3938    this.resetParam(
3939      'itemSelectedSymbolFontColor',
3940      e1 && 'itemSelectedSymbolFontColor' in e1
3941        ? e1.itemSelectedSymbolFontColor
3942        : undefined
3943    );
3944    this.resetParam(
3945      'itemMinHeight',
3946      e1 && 'itemMinHeight' in e1 ? e1.itemMinHeight : undefined
3947    );
3948    this.resetParam(
3949      'itemPadding',
3950      e1 && 'itemPadding' in e1 ? e1.itemPadding : undefined
3951    );
3952    this.resetParam(
3953      'languageDirection',
3954      e1 && 'languageDirection' in e1 ? e1.languageDirection : undefined
3955    );
3956  }
3957
3958  initialRender() {
3959    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
3960    this.observeComponentCreation2((c1, d1) => {
3961      Column.create({ space: 2 });
3962      Column.constraintSize({
3963        minHeight: this.getItemMinHeight(),
3964        minWidth: '100%',
3965      });
3966      Column.direction(this.languageDirection);
3967      Column.justifyContent(FlexAlign.Center);
3968      Column.padding(this.getItemPadding());
3969    }, Column);
3970    this.observeComponentCreation2((w, x) => {
3971      If.create();
3972      if (this.item.symbol || this.item.symbolModifier) {
3973        this.ifElseBranchUpdateFunction(0, () => {
3974          this.observeComponentCreation2((a1, b1) => {
3975            SymbolGlyph.create(this.item.symbol);
3976            SymbolGlyph.fontSize(this.getSymbolFontSize());
3977            SymbolGlyph.fontColor([this.getItemSymbolFillColor()]);
3978            SymbolGlyph.direction(this.languageDirection);
3979            SymbolGlyph.attributeModifier.bind(this)(this.item.symbolModifier);
3980          }, SymbolGlyph);
3981        });
3982      } else if (this.item.icon) {
3983        this.ifElseBranchUpdateFunction(1, () => {
3984          this.observeComponentCreation2((y, z) => {
3985            Image.create(this.item.icon);
3986            Image.fillColor(this.getItemIconFillColor());
3987            Image.width(this.getItemIconWidth());
3988            Image.height(this.getItemIconHeight());
3989            Image.direction(this.languageDirection);
3990            Image.draggable(false);
3991            Image.attributeModifier.bind(this)(this.item.iconModifier);
3992          }, Image);
3993        });
3994      } else {
3995        this.ifElseBranchUpdateFunction(2, () => {});
3996      }
3997    }, If);
3998    If.pop();
3999    this.observeComponentCreation2((s, t) => {
4000      If.create();
4001      if (this.item.text) {
4002        this.ifElseBranchUpdateFunction(0, () => {
4003          this.observeComponentCreation2((u, v) => {
4004            Text.create(this.item.text);
4005            Text.direction(this.languageDirection);
4006            Text.fontSize(this.getItemFontSize());
4007            Text.fontColor(this.getItemFontColor());
4008            Text.fontWeight(this.getItemFontWeight());
4009            Text.textOverflow({ overflow: TextOverflow.Ellipsis });
4010            Text.maxLines(1);
4011            Text.maxFontScale(this.getItemMaxFontScale());
4012            Text.minFontScale(this.getItemMinFontScale());
4013            Text.attributeModifier.bind(this)(this.item.textModifier);
4014          }, Text);
4015          Text.pop();
4016        });
4017      } else {
4018        this.ifElseBranchUpdateFunction(1, () => {});
4019      }
4020    }, If);
4021    If.pop();
4022    Column.pop();
4023    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
4024  }
4025
4026  getItemFontWeight() {
4027    if (this.selected) {
4028      return this.itemSelectedFontWeight ?? this.theme.itemSelectedFontWeight;
4029    }
4030    return this.itemFontWeight ?? this.theme.itemFontWeight;
4031  }
4032
4033  getItemSymbolFillColor() {
4034    if (this.selected) {
4035      return (
4036        this.itemSelectedSymbolFontColor?.color ??
4037        this.theme.itemSelectedSymbolFontColor
4038      );
4039    }
4040    return this.itemSymbolFontColor?.color ?? this.theme.itemSymbolFontColor;
4041  }
4042
4043  getSymbolFontSize() {
4044    if (
4045      this.itemSymbolFontSize &&
4046      LengthMetricsUtils.getInstance().isNaturalNumber(
4047        this.itemSymbolFontSize
4048      ) &&
4049      this.itemSymbolFontSize.unit !== LengthUnit.PERCENT
4050    ) {
4051      return LengthMetricsUtils.getInstance().stringify(
4052        this.itemSymbolFontSize
4053      );
4054    }
4055    return this.theme.itemSymbolFontSize;
4056  }
4057
4058  getItemMaxFontScale() {
4059    if (typeof this.itemMaxFontScale === 'number') {
4060      return normalize(
4061        this.itemMaxFontScale,
4062        this.theme.itemMaxFontScaleSmallest,
4063        this.theme.itemMaxFontScaleLargest
4064      );
4065    }
4066    if (typeof this.itemMaxFontScale === 'object') {
4067      const r =
4068        parseNumericResource(this.getUIContext(), this.itemMaxFontScale) ??
4069        SMALLEST_MAX_FONT_SCALE;
4070      return normalize(
4071        r,
4072        this.theme.itemMaxFontScaleSmallest,
4073        this.theme.itemMaxFontScaleLargest
4074      );
4075    }
4076    return SMALLEST_MAX_FONT_SCALE;
4077  }
4078
4079  getItemMinFontScale() {
4080    if (typeof this.itemMinFontScale === 'number') {
4081      return normalize(
4082        this.itemMinFontScale,
4083        this.theme.itemMinFontScaleSmallest,
4084        this.theme.itemMinFontScaleLargest
4085      );
4086    }
4087    if (typeof this.itemMinFontScale === 'object') {
4088      const q =
4089        parseNumericResource(this.getUIContext(), this.itemMinFontScale) ??
4090        SMALLEST_MIN_FONT_SCALE;
4091      return normalize(
4092        q,
4093        this.theme.itemMinFontScaleSmallest,
4094        this.theme.itemMinFontScaleLargest
4095      );
4096    }
4097    return SMALLEST_MIN_FONT_SCALE;
4098  }
4099
4100  getItemPadding() {
4101    const p = {
4102      top: this.theme.itemPadding.top,
4103      bottom: this.theme.itemPadding.bottom,
4104      start: this.theme.itemPadding.start,
4105      end: this.theme.itemPadding.end,
4106    };
4107    if (
4108      this.itemPadding?.top &&
4109      LengthMetricsUtils.getInstance().isNaturalNumber(this.itemPadding.top)
4110    ) {
4111      p.top = this.itemPadding.top;
4112    }
4113    if (
4114      this.itemPadding?.bottom &&
4115      LengthMetricsUtils.getInstance().isNaturalNumber(this.itemPadding.bottom)
4116    ) {
4117      p.bottom = this.itemPadding.bottom;
4118    }
4119    if (
4120      this.itemPadding?.start &&
4121      LengthMetricsUtils.getInstance().isNaturalNumber(this.itemPadding.start)
4122    ) {
4123      p.start = this.itemPadding.start;
4124    }
4125    if (
4126      this.itemPadding?.end &&
4127      LengthMetricsUtils.getInstance().isNaturalNumber(this.itemPadding.end)
4128    ) {
4129      p.end = this.itemPadding.end;
4130    }
4131    return p;
4132  }
4133
4134  getItemMinHeight() {
4135    if (
4136      this.itemMinHeight &&
4137      LengthMetricsUtils.getInstance().isNaturalNumber(this.itemMinHeight)
4138    ) {
4139      return LengthMetricsUtils.getInstance().stringify(this.itemMinHeight);
4140    }
4141    return this.hasHybrid
4142      ? this.theme.hybridItemMinHeight
4143      : this.theme.itemMinHeight;
4144  }
4145
4146  getItemFontColor() {
4147    if (this.selected) {
4148      if (this.itemSelectedFontColor) {
4149        return this.itemSelectedFontColor.color;
4150      }
4151      return this.theme.itemSelectedFontColor;
4152    }
4153    if (this.itemFontColor) {
4154      return this.itemFontColor.color;
4155    }
4156    return this.theme.itemFontColor;
4157  }
4158
4159  getItemFontSize() {
4160    if (this.selected) {
4161      if (
4162        this.itemSelectedFontSize &&
4163        LengthMetricsUtils.getInstance().isNaturalNumber(
4164          this.itemSelectedFontSize
4165        ) &&
4166        this.itemSelectedFontSize.unit !== LengthUnit.PERCENT
4167      ) {
4168        return LengthMetricsUtils.getInstance().stringify(
4169          this.itemSelectedFontSize
4170        );
4171      }
4172      return this.theme.itemFontSize;
4173    }
4174    if (
4175      this.itemFontSize &&
4176      LengthMetricsUtils.getInstance().isNaturalNumber(this.itemFontSize) &&
4177      this.itemFontSize.unit !== LengthUnit.PERCENT
4178    ) {
4179      return LengthMetricsUtils.getInstance().stringify(this.itemFontSize);
4180    }
4181    return this.theme.itemFontSize;
4182  }
4183
4184  getItemIconHeight() {
4185    if (
4186      this.itemIconSize?.height &&
4187      LengthMetricsUtils.getInstance().isNaturalNumber(this.itemIconSize.height)
4188    ) {
4189      return LengthMetricsUtils.getInstance().stringify(
4190        this.itemIconSize.height
4191      );
4192    }
4193    return this.theme.itemIconSize;
4194  }
4195
4196  getItemIconWidth() {
4197    if (
4198      this.itemIconSize?.width &&
4199      LengthMetricsUtils.getInstance().isNaturalNumber(this.itemIconSize.width)
4200    ) {
4201      return LengthMetricsUtils.getInstance().stringify(
4202        this.itemIconSize.width
4203      );
4204    }
4205    return this.theme.itemIconSize;
4206  }
4207
4208  getItemIconFillColor() {
4209    if (this.selected) {
4210      if (this.itemSelectedIconFillColor) {
4211        return this.itemSelectedIconFillColor.color;
4212      }
4213      return this.theme.itemSelectedIconFillColor;
4214    }
4215    if (this.itemIconFillColor) {
4216      return this.itemIconFillColor.color;
4217    }
4218    return this.theme.itemIconFillColor;
4219  }
4220
4221  updateStateVars(o) {
4222    if (o === undefined) {
4223      return;
4224    }
4225    if ('hasHybrid' in o) {
4226      this.updateParam('hasHybrid', o.hasHybrid);
4227    }
4228    if ('item' in o) {
4229      this.updateParam('item', o.item);
4230    }
4231    if ('selected' in o) {
4232      this.updateParam('selected', o.selected);
4233    }
4234    if ('theme' in o) {
4235      this.updateParam('theme', o.theme);
4236    }
4237    if ('itemMinFontScale' in o) {
4238      this.updateParam('itemMinFontScale', o.itemMinFontScale);
4239    }
4240    if ('itemMaxFontScale' in o) {
4241      this.updateParam('itemMaxFontScale', o.itemMaxFontScale);
4242    }
4243    if ('itemFontColor' in o) {
4244      this.updateParam('itemFontColor', o.itemFontColor);
4245    }
4246    if ('itemSelectedFontColor' in o) {
4247      this.updateParam('itemSelectedFontColor', o.itemSelectedFontColor);
4248    }
4249    if ('itemFontSize' in o) {
4250      this.updateParam('itemFontSize', o.itemFontSize);
4251    }
4252    if ('itemSelectedFontSize' in o) {
4253      this.updateParam('itemSelectedFontSize', o.itemSelectedFontSize);
4254    }
4255    if ('itemFontWeight' in o) {
4256      this.updateParam('itemFontWeight', o.itemFontWeight);
4257    }
4258    if ('itemSelectedFontWeight' in o) {
4259      this.updateParam('itemSelectedFontWeight', o.itemSelectedFontWeight);
4260    }
4261    if ('itemIconSize' in o) {
4262      this.updateParam('itemIconSize', o.itemIconSize);
4263    }
4264    if ('itemIconFillColor' in o) {
4265      this.updateParam('itemIconFillColor', o.itemIconFillColor);
4266    }
4267    if ('itemSelectedIconFillColor' in o) {
4268      this.updateParam(
4269        'itemSelectedIconFillColor',
4270        o.itemSelectedIconFillColor
4271      );
4272    }
4273    if ('itemSymbolFontSize' in o) {
4274      this.updateParam('itemSymbolFontSize', o.itemSymbolFontSize);
4275    }
4276    if ('itemSymbolFontColor' in o) {
4277      this.updateParam('itemSymbolFontColor', o.itemSymbolFontColor);
4278    }
4279    if ('itemSelectedSymbolFontColor' in o) {
4280      this.updateParam(
4281        'itemSelectedSymbolFontColor',
4282        o.itemSelectedSymbolFontColor
4283      );
4284    }
4285    if ('itemMinHeight' in o) {
4286      this.updateParam('itemMinHeight', o.itemMinHeight);
4287    }
4288    if ('itemPadding' in o) {
4289      this.updateParam('itemPadding', o.itemPadding);
4290    }
4291    if ('languageDirection' in o) {
4292      this.updateParam('languageDirection', o.languageDirection);
4293    }
4294  }
4295
4296  rerender() {
4297    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
4298    this.updateDirtyElements();
4299    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
4300  }
4301}
4302
4303__decorate([Param], SegmentButtonV2ItemContent.prototype, 'hasHybrid', void 0);
4304__decorate([Param], SegmentButtonV2ItemContent.prototype, 'item', void 0);
4305__decorate([Param], SegmentButtonV2ItemContent.prototype, 'selected', void 0);
4306__decorate([Param], SegmentButtonV2ItemContent.prototype, 'theme', void 0);
4307__decorate(
4308  [Param],
4309  SegmentButtonV2ItemContent.prototype,
4310  'itemMinFontScale',
4311  void 0
4312);
4313__decorate(
4314  [Param],
4315  SegmentButtonV2ItemContent.prototype,
4316  'itemMaxFontScale',
4317  void 0
4318);
4319__decorate(
4320  [Param],
4321  SegmentButtonV2ItemContent.prototype,
4322  'itemFontColor',
4323  void 0
4324);
4325__decorate(
4326  [Param],
4327  SegmentButtonV2ItemContent.prototype,
4328  'itemSelectedFontColor',
4329  void 0
4330);
4331__decorate(
4332  [Param],
4333  SegmentButtonV2ItemContent.prototype,
4334  'itemFontSize',
4335  void 0
4336);
4337__decorate(
4338  [Param],
4339  SegmentButtonV2ItemContent.prototype,
4340  'itemSelectedFontSize',
4341  void 0
4342);
4343__decorate(
4344  [Param],
4345  SegmentButtonV2ItemContent.prototype,
4346  'itemFontWeight',
4347  void 0
4348);
4349__decorate(
4350  [Param],
4351  SegmentButtonV2ItemContent.prototype,
4352  'itemSelectedFontWeight',
4353  void 0
4354);
4355__decorate(
4356  [Param],
4357  SegmentButtonV2ItemContent.prototype,
4358  'itemIconSize',
4359  void 0
4360);
4361__decorate(
4362  [Param],
4363  SegmentButtonV2ItemContent.prototype,
4364  'itemIconFillColor',
4365  void 0
4366);
4367__decorate(
4368  [Param],
4369  SegmentButtonV2ItemContent.prototype,
4370  'itemSelectedIconFillColor',
4371  void 0
4372);
4373__decorate(
4374  [Param],
4375  SegmentButtonV2ItemContent.prototype,
4376  'itemSymbolFontSize',
4377  void 0
4378);
4379__decorate(
4380  [Param],
4381  SegmentButtonV2ItemContent.prototype,
4382  'itemSymbolFontColor',
4383  void 0
4384);
4385__decorate(
4386  [Param],
4387  SegmentButtonV2ItemContent.prototype,
4388  'itemSelectedSymbolFontColor',
4389  void 0
4390);
4391__decorate(
4392  [Param],
4393  SegmentButtonV2ItemContent.prototype,
4394  'itemMinHeight',
4395  void 0
4396);
4397__decorate(
4398  [Param],
4399  SegmentButtonV2ItemContent.prototype,
4400  'itemPadding',
4401  void 0
4402);
4403__decorate(
4404  [Param],
4405  SegmentButtonV2ItemContent.prototype,
4406  'languageDirection',
4407  void 0
4408);
4409
4410class LengthMetricsUtils {
4411  constructor() {}
4412
4413  static getInstance() {
4414    if (!LengthMetricsUtils.instance) {
4415      LengthMetricsUtils.instance = new LengthMetricsUtils();
4416    }
4417    return LengthMetricsUtils.instance;
4418  }
4419
4420  stringify(n) {
4421    switch (n.unit) {
4422      case LengthUnit.PX:
4423        return `${n.value}px`;
4424      case LengthUnit.VP:
4425        return `${n.value}vp`;
4426      case LengthUnit.FP:
4427        return `${n.value}fp`;
4428      case LengthUnit.PERCENT:
4429        return `${n.value}%`;
4430      case LengthUnit.LPX:
4431        return `${n.value}lpx`;
4432    }
4433  }
4434
4435  isNaturalNumber(m) {
4436    return m.value >= 0;
4437  }
4438}
4439
4440function parseNumericResource(i, j) {
4441  const k = i.getHostContext()?.resourceManager;
4442  if (!k) {
4443    return undefined;
4444  }
4445  try {
4446    return k.getNumber(j);
4447  } catch (l) {
4448    return undefined;
4449  }
4450}
4451
4452function normalize(f, g, h) {
4453  return Math.min(Math.max(f, g), h);
4454}
4455
4456function generateUniqueKye(b) {
4457  return (c, d) => {
4458    let e = b;
4459    if (c.text) {
4460      if (typeof c.text === 'string') {
4461        e += c.text;
4462      } else {
4463        e += getResourceUniqueId(c.text);
4464      }
4465    }
4466    if (c.icon) {
4467      if (typeof c.icon === 'string') {
4468        e += c.icon;
4469      } else {
4470        e += getResourceUniqueId(c.icon);
4471      }
4472    }
4473    if (c.symbol) {
4474      e += getResourceUniqueId(c.symbol);
4475    }
4476    return e;
4477  };
4478}
4479
4480function getResourceUniqueId(a) {
4481  if (a.id !== -1) {
4482    return `${a.id}`;
4483  } else {
4484    return JSON.stringify(a);
4485  }
4486}
4487
4488export default {
4489  SegmentButtonV2Item,
4490  SegmentButtonV2Items,
4491  TabSegmentButtonV2,
4492  CapsuleSegmentButtonV2,
4493  MultiCapsuleSegmentButtonV2,
4494};
4495