1/*
2 * Copyright (c) 2023-2024 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
16if (!('finalizeConstruction' in ViewPU.prototype)) {
17  Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { });
18}
19if (PUV2ViewBase.contextStack === undefined) {
20  Reflect.set(PUV2ViewBase, 'contextStack', []);
21}
22const KeyCode = requireNapi('multimodalInput.keyCode').KeyCode;
23const hilog = requireNapi('hilog');
24const PUBLIC_MORE = { 'id': -1, 'type': 20000, params: ['sys.media.ohos_ic_public_more'],
25  'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' };
26const PUBLIC_BACK = { 'id': -1, 'type': 20000, params: ['sys.media.ohos_ic_back'],
27  'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' };
28const TEXT_EDITABLE_DIALOG = '18.3fp';
29const IMAGE_SIZE = '64vp';
30const MAX_DIALOG = '256vp';
31const MIN_DIALOG = '216vp';
32
33export class SelectTitleBar extends ViewPU {
34  constructor(x9, y9, z9, a10 = -1, b10 = undefined, c10) {
35    super(x9, z9, a10, c10);
36    if (typeof b10 === 'function') {
37      this.paramsGenerator_ = b10;
38    }
39    this.__selected = new ObservedPropertySimplePU(0, this, 'selected');
40    this.options = [];
41    this.menuItems = [];
42    this.subtitle = '';
43    this.badgeValue = 0;
44    this.hidesBackButton = false;
45    this.onSelected = () => { };
46    this.__selectMaxWidth = new ObservedPropertySimplePU(0, this, 'selectMaxWidth');
47    this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize');
48    this.setInitiallyProvidedValue(y9);
49    this.finalizeConstruction();
50  }
51
52  setInitiallyProvidedValue(w9) {
53    if (w9.selected !== undefined) {
54      this.selected = w9.selected;
55    }
56    if (w9.options !== undefined) {
57      this.options = w9.options;
58    }
59    if (w9.menuItems !== undefined) {
60      this.menuItems = w9.menuItems;
61    }
62    if (w9.subtitle !== undefined) {
63      this.subtitle = w9.subtitle;
64    }
65    if (w9.badgeValue !== undefined) {
66      this.badgeValue = w9.badgeValue;
67    }
68    if (w9.hidesBackButton !== undefined) {
69      this.hidesBackButton = w9.hidesBackButton;
70    }
71    if (w9.onSelected !== undefined) {
72      this.onSelected = w9.onSelected;
73    }
74    if (w9.selectMaxWidth !== undefined) {
75      this.selectMaxWidth = w9.selectMaxWidth;
76    }
77    if (w9.fontSize !== undefined) {
78      this.fontSize = w9.fontSize;
79    }
80  }
81
82  updateStateVars(v9) {
83  }
84
85  purgeVariableDependenciesOnElmtId(u9) {
86    this.__selected.purgeDependencyOnElmtId(u9);
87    this.__selectMaxWidth.purgeDependencyOnElmtId(u9);
88    this.__fontSize.purgeDependencyOnElmtId(u9);
89  }
90
91  aboutToBeDeleted() {
92    this.__selected.aboutToBeDeleted();
93    this.__selectMaxWidth.aboutToBeDeleted();
94    this.__fontSize.aboutToBeDeleted();
95    SubscriberManager.Get().delete(this.id__());
96    this.aboutToBeDeletedInternal();
97  }
98
99  get selected() {
100    return this.__selected.get();
101  }
102
103  set selected(t9) {
104    this.__selected.set(t9);
105  }
106
107  get selectMaxWidth() {
108    return this.__selectMaxWidth.get();
109  }
110
111  set selectMaxWidth(s9) {
112    this.__selectMaxWidth.set(s9);
113  }
114
115  get fontSize() {
116    return this.__fontSize.get();
117  }
118
119  set fontSize(q9) {
120    this.__fontSize.set(q9);
121  }
122
123  initialRender() {
124    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
125    this.observeComponentCreation2((j9, k9) => {
126      Flex.create({
127        justifyContent: FlexAlign.SpaceBetween,
128        alignItems: ItemAlign.Stretch
129      });
130      Flex.width('100%');
131      Flex.height(SelectTitleBar.totalHeight);
132      Flex.backgroundColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_background'],
133        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' });
134      Flex.onAreaChange((m9, n9) => {
135        let o9 = Number(n9.width);
136        if (!this.hidesBackButton) {
137          o9 -= ImageMenuItem.imageHotZoneWidth;
138          o9 += SelectTitleBar.leftPadding;
139          o9 -= SelectTitleBar.leftPaddingWithBack;
140        }
141        if (this.menuItems !== undefined) {
142          let p9 = this.menuItems.length;
143          if (p9 >= CollapsibleMenuSection.maxCountOfVisibleItems) {
144            o9 -= ImageMenuItem.imageHotZoneWidth * CollapsibleMenuSection.maxCountOfVisibleItems;
145          } else if (p9 > 0) {
146            o9 -= ImageMenuItem.imageHotZoneWidth * p9;
147          }
148        }
149        if (this.badgeValue) {
150          this.selectMaxWidth = o9 - SelectTitleBar.badgeSize - SelectTitleBar.leftPadding -
151          SelectTitleBar.rightPadding - SelectTitleBar.badgePadding;
152        } else {
153          this.selectMaxWidth = o9 - SelectTitleBar.leftPadding - SelectTitleBar.rightPadding;
154        }
155      });
156    }, Flex);
157    this.observeComponentCreation2((h9, i9) => {
158      Row.create();
159      Row.margin({ left: this.hidesBackButton ? {
160        'id': -1, 'type': 10002, params: ['sys.float.ohos_id_max_padding_start'],
161        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } :
162        { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_default_padding_start'],
163          'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }
164      });
165    }, Row);
166    this.observeComponentCreation2((t8, u8) => {
167      If.create();
168      if (!this.hidesBackButton) {
169        this.ifElseBranchUpdateFunction(0, () => {
170          {
171            this.observeComponentCreation2((z8, a9) => {
172              if (a9) {
173                let b9 = new ImageMenuItem(this, { item: {
174                  value: PUBLIC_BACK,
175                  isEnabled: true,
176                  action: () => this.getUIContext()?.getRouter()?.back()
177                }, index: -1 }, undefined, z8, () => { },
178                  { page: 'library/src/main/ets/components/MainPage.ets', line: 73, col: 11 });
179                ViewPU.create(b9);
180                let c9 = () => {
181                  return {
182                    item: {
183                      value: PUBLIC_BACK,
184                      isEnabled: true,
185                      action: () => this.getUIContext()?.getRouter()?.back()
186                    },
187                    index: -1,
188                  };
189                };
190                b9.paramsGenerator_ = c9;
191              }
192              else {
193                this.updateStateVarsOfChildByElmtId(z8, {});
194              }
195            }, { name: 'ImageMenuItem' });
196          }
197        });
198      } else {
199        this.ifElseBranchUpdateFunction(1, () => {
200        });
201      }
202    }, If);
203    If.pop();
204    this.observeComponentCreation2((r8, s8) => {
205      Column.create();
206      Column.justifyContent(FlexAlign.Start);
207      Column.alignItems(HorizontalAlign.Start);
208      Column.constraintSize({ maxWidth: this.selectMaxWidth });
209    }, Column);
210    this.observeComponentCreation2((y7, z7) => {
211      If.create();
212      if (this.badgeValue) {
213        this.ifElseBranchUpdateFunction(0, () => {
214          this.observeComponentCreation2((p8, q8) => {
215            Badge.create({
216              count: this.badgeValue,
217              position: BadgePosition.Right,
218              style: {
219                badgeColor: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_emphasize'],
220                  'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' },
221                borderColor: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_emphasize'],
222                  'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' },
223                borderWidth: 0
224              }
225            });
226          }, Badge);
227          this.observeComponentCreation2((n8, o8) => {
228            Row.create();
229            Row.justifyContent(FlexAlign.Start);
230            Row.margin({ right: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_elements_margin_horizontal_l'],
231              'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } });
232          }, Row);
233          this.observeComponentCreation2((l8, m8) => {
234            Select.create(this.options);
235            Select.selected(this.selected);
236            Select.value(this.selected < this.options.length ? this.options[this.selected].value.toString() : '');
237            Select.font({ size: this.hidesBackButton && !this.subtitle ?
238              { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_headline7'],
239                'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } :
240              { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_headline8'],
241                'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } });
242            Select.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_text'],
243              'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' });
244            Select.backgroundColor(Color.Transparent);
245            Select.onSelect(this.onSelected);
246            Select.constraintSize({ maxWidth: this.selectMaxWidth });
247            Select.offset({ x: -4 });
248          }, Select);
249          Select.pop();
250          Row.pop();
251          Badge.pop();
252        });
253      }
254      else {
255        this.ifElseBranchUpdateFunction(1, () => {
256          this.observeComponentCreation2((f8, g8) => {
257            Row.create();
258            Row.justifyContent(FlexAlign.Start);
259          }, Row);
260          this.observeComponentCreation2((d8, e8) => {
261            Select.create(this.options);
262            Select.selected(this.selected);
263            Select.value(this.selected < this.options.length ? this.options[this.selected].value.toString() : '');
264            Select.font({ size: this.hidesBackButton && !this.subtitle ?
265              { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_headline7'],
266                'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } :
267              { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_headline8'],
268                'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } });
269            Select.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_text'],
270              'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' });
271            Select.backgroundColor(Color.Transparent);
272            Select.onSelect(this.onSelected);
273            Select.constraintSize({ maxWidth: this.selectMaxWidth });
274            Select.offset({ x: -4 });
275          }, Select);
276          Select.pop();
277          Row.pop();
278        });
279      }
280    }, If);
281    If.pop();
282    this.observeComponentCreation2((o7, p7) => {
283      If.create();
284      if (this.subtitle !== undefined) {
285        this.ifElseBranchUpdateFunction(0, () => {
286          this.observeComponentCreation2((w7, x7) => {
287            Row.create();
288            Row.justifyContent(FlexAlign.Start);
289            Row.margin({ left: SelectTitleBar.subtitleLeftPadding });
290          }, Row);
291          this.observeComponentCreation2((u7, v7) => {
292            Text.create(this.subtitle);
293            Text.fontSize({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_over_line'],
294              'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' });
295            Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_subtitle_text'],
296              'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' });
297            Text.maxLines(1);
298            Text.textOverflow({ overflow: TextOverflow.Ellipsis });
299            Text.constraintSize({ maxWidth: this.selectMaxWidth });
300            Text.offset({ y: -4 });
301          }, Text);
302          Text.pop();
303          Row.pop();
304        });
305      } else {
306        this.ifElseBranchUpdateFunction(1, () => {
307        });
308      }
309    }, If);
310    If.pop();
311    Column.pop();
312    Row.pop();
313    this.observeComponentCreation2((d7, e7) => {
314      If.create();
315      if (this.menuItems !== undefined && this.menuItems.length > 0) {
316        this.ifElseBranchUpdateFunction(0, () => {
317          {
318            this.observeComponentCreation2((i7, j7) => {
319              if (j7) {
320                let k7 = new CollapsibleMenuSection(this, { menuItems: this.menuItems,
321                  index: 1 + SelectTitleBar.instanceCount++ }, undefined, i7, () => { },
322                  { page: 'library/src/main/ets/components/MainPage.ets', line: 146, col: 9 });
323                ViewPU.create(k7);
324                let l7 = () => {
325                  return {
326                    menuItems: this.menuItems,
327                    index: 1 + SelectTitleBar.instanceCount++
328                  };
329                };
330                k7.paramsGenerator_ = l7;
331              }
332              else {
333                this.updateStateVarsOfChildByElmtId(i7, {});
334              }
335            }, { name: 'CollapsibleMenuSection' });
336          }
337        });
338      } else {
339        this.ifElseBranchUpdateFunction(1, () => {
340        });
341      }
342    }, If);
343    If.pop();
344    Flex.pop();
345    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
346  }
347
348  rerender() {
349    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
350    this.updateDirtyElements();
351    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
352  }
353}
354SelectTitleBar.badgeSize = 16;
355SelectTitleBar.totalHeight = 56;
356SelectTitleBar.leftPadding = 24;
357SelectTitleBar.leftPaddingWithBack = 12;
358SelectTitleBar.rightPadding = 24;
359SelectTitleBar.badgePadding = 16;
360SelectTitleBar.subtitleLeftPadding = 4;
361SelectTitleBar.instanceCount = 0;
362class CollapsibleMenuSection extends ViewPU {
363  constructor(m6, n6, o6, p6 = -1, q6 = undefined, r6) {
364    super(m6, o6, p6, r6);
365    if (typeof q6 === 'function') {
366      this.paramsGenerator_ = q6;
367    }
368    this.menuItems = [];
369    this.item = {
370      value: PUBLIC_MORE,
371      label: { 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'],
372        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' },
373    };
374    this.index = 0;
375    this.longPressTime = 500;
376    this.minFontSize = 1.75;
377    this.isFollowingSystemFontScale = false;
378    this.maxFontScale = 1;
379    this.systemFontScale = 1;
380    this.firstFocusableIndex = -1;
381    this.__isPopupShown = new ObservedPropertySimplePU(false, this, 'isPopupShown');
382    this.__isMoreIconOnFocus = new ObservedPropertySimplePU(false, this, 'isMoreIconOnFocus');
383    this.__isMoreIconOnHover = new ObservedPropertySimplePU(false, this, 'isMoreIconOnHover');
384    this.__isMoreIconOnClick = new ObservedPropertySimplePU(false, this, 'isMoreIconOnClick');
385    this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize');
386    this.dialogController = new CustomDialogController({
387      builder: () => {
388        let s6 = new SelectTitleBarDialog(this, {
389          cancel: () => {
390          },
391          confirm: () => {
392          },
393          SelectTitleDialog: this.item,
394          SelectTitleBarDialog: this.item.label ? this.item.label : '',
395          fontSize: this.fontSize,
396        }, undefined, -1, () => { }, { page: 'library/src/main/ets/components/MainPage.ets', line: 201, col: 14 });
397        s6.setController(this.dialogController);
398        ViewPU.create(s6);
399        let t6 = () => {
400          return {
401            cancel: () => {
402            },
403            confirm: () => {
404            },
405            SelectTitleDialog: this.item,
406            SelectTitleBarDialog: this.item.label ? this.item.label : '',
407            fontSize: this.fontSize
408          };
409        };
410        s6.paramsGenerator_ = t6;
411      },
412      maskColor: Color.Transparent,
413      isModal: true,
414      customStyle: true
415    }, this);
416    this.setInitiallyProvidedValue(n6);
417    this.finalizeConstruction();
418  }
419
420  setInitiallyProvidedValue(l6) {
421    if (l6.menuItems !== undefined) {
422      this.menuItems = l6.menuItems;
423    }
424    if (l6.item !== undefined) {
425      this.item = l6.item;
426    }
427    if (l6.index !== undefined) {
428      this.index = l6.index;
429    }
430    if (l6.longPressTime !== undefined) {
431      this.longPressTime = l6.longPressTime;
432    }
433    if (l6.minFontSize !== undefined) {
434      this.minFontSize = l6.minFontSize;
435    }
436    if (l6.isFollowingSystemFontScale !== undefined) {
437      this.isFollowingSystemFontScale = l6.isFollowingSystemFontScale;
438    }
439    if (l6.maxFontScale !== undefined) {
440      this.maxFontScale = l6.maxFontScale;
441    }
442    if (l6.systemFontScale !== undefined) {
443      this.systemFontScale = l6.systemFontScale;
444    }
445    if (l6.firstFocusableIndex !== undefined) {
446      this.firstFocusableIndex = l6.firstFocusableIndex;
447    }
448    if (l6.isPopupShown !== undefined) {
449      this.isPopupShown = l6.isPopupShown;
450    }
451    if (l6.isMoreIconOnFocus !== undefined) {
452      this.isMoreIconOnFocus = l6.isMoreIconOnFocus;
453    }
454    if (l6.isMoreIconOnHover !== undefined) {
455      this.isMoreIconOnHover = l6.isMoreIconOnHover;
456    }
457    if (l6.isMoreIconOnClick !== undefined) {
458      this.isMoreIconOnClick = l6.isMoreIconOnClick;
459    }
460    if (l6.fontSize !== undefined) {
461      this.fontSize = l6.fontSize;
462    }
463    if (l6.dialogController !== undefined) {
464      this.dialogController = l6.dialogController;
465    }
466  }
467
468  updateStateVars(k6) {
469  }
470
471  purgeVariableDependenciesOnElmtId(j6) {
472    this.__isPopupShown.purgeDependencyOnElmtId(j6);
473    this.__isMoreIconOnFocus.purgeDependencyOnElmtId(j6);
474    this.__isMoreIconOnHover.purgeDependencyOnElmtId(j6);
475    this.__isMoreIconOnClick.purgeDependencyOnElmtId(j6);
476    this.__fontSize.purgeDependencyOnElmtId(j6);
477  }
478
479  aboutToBeDeleted() {
480    this.__isPopupShown.aboutToBeDeleted();
481    this.__isMoreIconOnFocus.aboutToBeDeleted();
482    this.__isMoreIconOnHover.aboutToBeDeleted();
483    this.__isMoreIconOnClick.aboutToBeDeleted();
484    this.__fontSize.aboutToBeDeleted();
485    SubscriberManager.Get().delete(this.id__());
486    this.aboutToBeDeletedInternal();
487  }
488
489  get isPopupShown() {
490    return this.__isPopupShown.get();
491  }
492
493  set isPopupShown(i6) {
494    this.__isPopupShown.set(i6);
495  }
496
497  get isMoreIconOnFocus() {
498    return this.__isMoreIconOnFocus.get();
499  }
500
501  set isMoreIconOnFocus(h6) {
502    this.__isMoreIconOnFocus.set(h6);
503  }
504
505  get isMoreIconOnHover() {
506    return this.__isMoreIconOnHover.get();
507  }
508
509  set isMoreIconOnHover(g6) {
510    this.__isMoreIconOnHover.set(g6);
511  }
512
513  get isMoreIconOnClick() {
514    return this.__isMoreIconOnClick.get();
515  }
516
517  set isMoreIconOnClick(f6) {
518    this.__isMoreIconOnClick.set(f6);
519  }
520
521  get fontSize() {
522    return this.__fontSize.get();
523  }
524
525  set fontSize(e6) {
526    this.__fontSize.set(e6);
527  }
528
529  getMoreIconFgColor() {
530    return this.isMoreIconOnClick ?
531      { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon_pressed'],
532        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } :
533      { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon'],
534        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' };
535  }
536
537  getMoreIconBgColor() {
538    if (this.isMoreIconOnClick) {
539      return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'],
540        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' };
541    } else if (this.isMoreIconOnHover) {
542      return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'],
543        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' };
544    } else {
545      return Color.Transparent;
546    }
547  }
548
549  aboutToAppear() {
550    try {
551      let h = this.getUIContext();
552      this.isFollowingSystemFontScale = h.isFollowingSystemFontScale();
553      this.maxFontScale = h.getMaxFontScale();
554    }
555    catch (j9) {
556      let k9 = j9.code;
557      let l9 = j9.message;
558      hilog.error(0x3900, 'Ace', `Faild to decideFontScale,cause, code: ${k9}, message: ${l9}`);
559    }
560    this.menuItems.forEach((c6, d6) => {
561      if (c6.isEnabled && this.firstFocusableIndex == -1 &&
562        d6 > CollapsibleMenuSection.maxCountOfVisibleItems - 2) {
563        this.firstFocusableIndex = this.index * 1000 + d6 + 1;
564      }
565    });
566  }
567  decideFontScale() {
568    let m9 = this.getUIContext();
569    this.systemFontScale = m9.getHostContext()?.config?.fontSizeScale ?? 1;
570    if (!this.isFollowingSystemFontScale) {
571      return 1;
572    }
573    return Math.min(this.systemFontScale, this.maxFontScale);
574  }
575
576  initialRender() {
577    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
578    this.observeComponentCreation2((z5, a6) => {
579      Column.create();
580      Column.height('100%');
581      Column.margin({ right: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_default_padding_end'],
582        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } });
583      Column.justifyContent(FlexAlign.Center);
584    }, Column);
585    this.observeComponentCreation2((x5, y5) => {
586      Row.create();
587    }, Row);
588    this.observeComponentCreation2((w3, x3) => {
589      If.create();
590      if (this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems) {
591        this.ifElseBranchUpdateFunction(0, () => {
592          this.observeComponentCreation2((j5, k5) => {
593            ForEach.create();
594            const l5 = (n5, o5) => {
595              const p5 = n5;
596              {
597                this.observeComponentCreation2((r5, s5) => {
598                  if (s5) {
599                    let t5 = new ImageMenuItem(this, { item: p5, index: this.index * 1000 + o5 + 1 }, undefined, r5,
600                      () => { }, { page: 'library/src/main/ets/components/MainPage.ets', line: 245, col: 13 });
601                    ViewPU.create(t5);
602                    let u5 = () => {
603                      return {
604                        item: p5,
605                        index: this.index * 1000 + o5 + 1
606                      };
607                    };
608                    t5.paramsGenerator_ = u5;
609                  }
610                  else {
611                    this.updateStateVarsOfChildByElmtId(r5, {});
612                  }
613                }, { name: 'ImageMenuItem' });
614              }
615            };
616            this.forEachUpdateFunction(j5, this.menuItems, l5, undefined, true, false);
617          }, ForEach);
618          ForEach.pop();
619        });
620      }
621      else {
622        this.ifElseBranchUpdateFunction(1, () => {
623          this.observeComponentCreation2((t4, u4) => {
624            ForEach.create();
625            const v4 = (x4, y4) => {
626              const z4 = x4;
627              {
628                this.observeComponentCreation2((b5, c5) => {
629                  if (c5) {
630                    let d5 = new ImageMenuItem(this, { item: z4, index: this.index * 1000 + y4 + 1 }, undefined, b5,
631                      () => { }, { page: 'library/src/main/ets/components/MainPage.ets', line: 250, col: 15 });
632                    ViewPU.create(d5);
633                    let e5 = () => {
634                      return {
635                        item: z4,
636                        index: this.index * 1000 + y4 + 1
637                      };
638                    };
639                    d5.paramsGenerator_ = e5;
640                  }
641                  else {
642                    this.updateStateVarsOfChildByElmtId(b5, {});
643                  }
644                }, { name: 'ImageMenuItem' });
645              }
646            };
647            this.forEachUpdateFunction(t4, this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1),
648              v4, undefined, true, false);
649          }, ForEach);
650          ForEach.pop();
651          this.observeComponentCreation2((e4, f4) => {
652            Row.create();
653            Row.width(ImageMenuItem.imageHotZoneWidth);
654            Row.height(ImageMenuItem.imageHotZoneWidth);
655            Row.borderRadius(ImageMenuItem.buttonBorderRadius);
656            Row.foregroundColor(this.getMoreIconFgColor());
657            Row.backgroundColor(this.getMoreIconBgColor());
658            Row.justifyContent(FlexAlign.Center);
659            ViewStackProcessor.visualState('focused');
660            Row.border({
661              radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'],
662                'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' },
663              width: ImageMenuItem.focusBorderWidth,
664              color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'],
665                'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' },
666              style: BorderStyle.Solid
667            });
668            ViewStackProcessor.visualState('normal');
669            Row.border({
670              radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'],
671                'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' },
672              width: 0
673            });
674            ViewStackProcessor.visualState();
675            Row.onFocus(() => this.isMoreIconOnFocus = true);
676            Row.onBlur(() => this.isMoreIconOnFocus = false);
677            Row.onHover((s4) => this.isMoreIconOnHover = s4);
678            Row.onKeyEvent((r4) => {
679              if (r4.keyCode !== KeyCode.KEYCODE_ENTER && r4.keyCode !== KeyCode.KEYCODE_SPACE) {
680                return;
681              }
682              if (r4.type === KeyType.Down) {
683                this.isMoreIconOnClick = true;
684              }
685              if (r4.type === KeyType.Up) {
686                this.isMoreIconOnClick = false;
687              }
688            });
689            Row.onTouch((q4) => {
690              if (q4.type === TouchType.Down) {
691                this.isMoreIconOnClick = true;
692              }
693              if (q4.type === TouchType.Up || q4.type === TouchType.Cancel) {
694                this.isMoreIconOnClick = false;
695                if (this.fontSize >= this.minFontSize) {
696                  this.dialogController?.close();
697                }
698              }
699            });
700            Row.onClick(() => this.isPopupShown = true);
701            Gesture.create(GesturePriority.Low);
702            LongPressGesture.create({ repeat: false, duration: this.longPressTime });
703            LongPressGesture.onAction((o4) => {
704              this.fontSize = this.decideFontScale();
705              if (o4) {
706                if (this.fontSize >= this.minFontSize) {
707                  this.dialogController?.open();
708                }
709              }
710            });
711            LongPressGesture.pop();
712            Gesture.pop();
713            Row.bindPopup(this.isPopupShown, {
714              builder: { builder: this.popupBuilder.bind(this) },
715              placement: Placement.Bottom,
716              popupColor: Color.White,
717              enableArrow: false,
718              onStateChange: (n4) => {
719                this.isPopupShown = n4.isVisible;
720                if (!n4.isVisible) {
721                  this.isMoreIconOnClick = false;
722                }
723              }
724            });
725          }, Row);
726          this.observeComponentCreation2((c4, d4) => {
727            Image.create(PUBLIC_MORE);
728            Image.width(ImageMenuItem.imageSize);
729            Image.height(ImageMenuItem.imageSize);
730            Image.focusable(true);
731            Image.draggable(false);
732            Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'],
733              'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' });
734          }, Image);
735          Row.pop();
736        });
737      }
738    }, If);
739    If.pop();
740    Row.pop();
741    Column.pop();
742    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
743  }
744
745  popupBuilder(z2 = null) {
746    this.observeComponentCreation2((q3, r3) => {
747      Column.create();
748      Column.width(
749        ImageMenuItem.imageHotZoneWidth + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum
750      );
751      Column.margin({ top: CollapsibleMenuSection.focusPadding, bottom: CollapsibleMenuSection.focusPadding });
752      Column.onAppear(() => {
753        focusControl.requestFocus(ImageMenuItem.focusablePrefix + this.firstFocusableIndex);
754      });
755    }, Column);
756    this.observeComponentCreation2((c3, d3) => {
757      ForEach.create();
758      const e3 = (g3, h3) => {
759        const i3 = g3;
760        {
761          this.observeComponentCreation2((k3, l3) => {
762            if (l3) {
763              let m3 = new ImageMenuItem(this, { item: i3,
764                index: this.index * 1000 + CollapsibleMenuSection.maxCountOfVisibleItems + h3, isPopup: true },
765                undefined, k3, () => { }, { page: 'library/src/main/ets/components/MainPage.ets', line: 345, col: 11 });
766              ViewPU.create(m3);
767              let n3 = () => {
768                return {
769                  item: i3,
770                  index: this.index * 1000 + CollapsibleMenuSection.maxCountOfVisibleItems + h3,
771                  isPopup: true
772                };
773              };
774              m3.paramsGenerator_ = n3;
775            }
776            else {
777              this.updateStateVarsOfChildByElmtId(k3, {});
778            }
779          }, { name: 'ImageMenuItem' });
780        }
781      };
782      this.forEachUpdateFunction(c3, this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1,
783        this.menuItems.length), e3, undefined, true, false);
784    }, ForEach);
785    ForEach.pop();
786    Column.pop();
787  }
788
789  rerender() {
790    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
791    this.updateDirtyElements();
792    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
793  }
794}
795CollapsibleMenuSection.maxCountOfVisibleItems = 3;
796CollapsibleMenuSection.focusPadding = 4;
797CollapsibleMenuSection.marginsNum = 2;
798class ImageMenuItem extends ViewPU {
799  constructor(p2, q2, r2, s2 = -1, t2 = undefined, u2) {
800    super(p2, r2, s2, u2);
801    if (typeof t2 === 'function') {
802      this.paramsGenerator_ = t2;
803    }
804    this.item = {};
805    this.index = 0;
806    this.longPressTime = 500;
807    this.minFontSize = 1.75;
808    this.isFollowingSystemFontScale = false;
809    this.maxFontScale = 1;
810    this.systemFontScale = 1;
811    this.isPopup = false;
812    this.__isOnFocus = new ObservedPropertySimplePU(false, this, 'isOnFocus');
813    this.__isOnHover = new ObservedPropertySimplePU(false, this, 'isOnHover');
814    this.__isOnClick = new ObservedPropertySimplePU(false, this, 'isOnClick');
815    this.__fontSize = new SynchedPropertySimpleOneWayPU(q2.fontSize, this, 'fontSize');
816    this.dialogController = new CustomDialogController({
817      builder: () => {
818        let v2 = new SelectTitleBarDialog(this, {
819          cancel: () => {
820          },
821          confirm: () => {
822          },
823          SelectTitleDialog: this.item,
824          SelectTitleBarDialog: this.item.label ? this.item.label : this.textDialog(),
825          fontSize: this.fontSize,
826        }, undefined, -1, () => { }, { page: 'library/src/main/ets/components/MainPage.ets', line: 376, col: 14 });
827        v2.setController(this.dialogController);
828        ViewPU.create(v2);
829        let w2 = () => {
830          return {
831            cancel: () => {
832            },
833            confirm: () => {
834            },
835            SelectTitleDialog: this.item,
836            SelectTitleBarDialog: this.item.label ? this.item.label : this.textDialog(),
837            fontSize: this.fontSize
838          };
839        };
840        v2.paramsGenerator_ = w2;
841      },
842      maskColor: Color.Transparent,
843      isModal: true,
844      customStyle: true
845    }, this);
846    this.setInitiallyProvidedValue(q2);
847    this.finalizeConstruction();
848  }
849
850  setInitiallyProvidedValue(o2) {
851    if (o2.item !== undefined) {
852      this.item = o2.item;
853    }
854    if (o2.index !== undefined) {
855      this.index = o2.index;
856    }
857    if (o2.longPressTime !== undefined) {
858      this.longPressTime = o2.longPressTime;
859    }
860    if (o2.minFontSize !== undefined) {
861      this.minFontSize = o2.minFontSize;
862    }
863    if (o2.isFollowingSystemFontScale !== undefined) {
864      this.isFollowingSystemFontScale = o2.isFollowingSystemFontScale;
865    }
866    if (o2.maxFontScale !== undefined) {
867      this.maxFontScale = o2.maxFontScale;
868    }
869    if (o2.systemFontScale !== undefined) {
870      this.systemFontScale = o2.systemFontScale;
871    }
872    if (o2.isPopup !== undefined) {
873      this.isPopup = o2.isPopup;
874    }
875    if (o2.isOnFocus !== undefined) {
876      this.isOnFocus = o2.isOnFocus;
877    }
878    if (o2.isOnHover !== undefined) {
879      this.isOnHover = o2.isOnHover;
880    }
881    if (o2.isOnClick !== undefined) {
882      this.isOnClick = o2.isOnClick;
883    }
884    if (o2.fontSize === undefined) {
885      this.__fontSize.set(1);
886    }
887    if (o2.dialogController !== undefined) {
888      this.dialogController = o2.dialogController;
889    }
890  }
891
892  updateStateVars(n2) {
893    this.__fontSize.reset(n2.fontSize);
894  }
895
896  purgeVariableDependenciesOnElmtId(m2) {
897    this.__isOnFocus.purgeDependencyOnElmtId(m2);
898    this.__isOnHover.purgeDependencyOnElmtId(m2);
899    this.__isOnClick.purgeDependencyOnElmtId(m2);
900    this.__fontSize.purgeDependencyOnElmtId(m2);
901  }
902
903  aboutToBeDeleted() {
904    this.__isOnFocus.aboutToBeDeleted();
905    this.__isOnHover.aboutToBeDeleted();
906    this.__isOnClick.aboutToBeDeleted();
907    this.__fontSize.aboutToBeDeleted();
908    SubscriberManager.Get().delete(this.id__());
909    this.aboutToBeDeletedInternal();
910  }
911
912  get isOnFocus() {
913    return this.__isOnFocus.get();
914  }
915
916  set isOnFocus(l2) {
917    this.__isOnFocus.set(l2);
918  }
919
920  get isOnHover() {
921    return this.__isOnHover.get();
922  }
923
924  set isOnHover(k2) {
925    this.__isOnHover.set(k2);
926  }
927
928  get isOnClick() {
929    return this.__isOnClick.get();
930  }
931
932  set isOnClick(j2) {
933    this.__isOnClick.set(j2);
934  }
935
936  get fontSize() {
937    return this.__fontSize.get();
938  }
939
940  set fontSize(i2) {
941    this.__fontSize.set(i2);
942  }
943
944  textDialog() {
945    if (this.item.value === PUBLIC_MORE) {
946      return { 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'],
947        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' };
948    } else if (this.item.value === PUBLIC_BACK) {
949      return { 'id': -1, 'type': 10003, params: ['sys.string.icon_back'],
950        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' };
951    } else {
952      return this.item.label ? this.item.label : '';
953    }
954  }
955
956  getFgColor() {
957    return this.isOnClick ?
958      { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon_pressed'],
959        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } :
960      { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon'],
961        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' };
962  }
963
964  getBgColor() {
965    if (this.isOnClick) {
966      return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'],
967        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' };
968    } else if (this.isOnHover) {
969      return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'],
970        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' };
971    } else {
972      return Color.Transparent;
973    }
974  }
975  aboutToAppear() {
976    try {
977      let h = this.getUIContext();
978      this.isFollowingSystemFontScale = h.isFollowingSystemFontScale();
979      this.maxFontScale = h.getMaxFontScale();
980    }
981    catch (h2) {
982      let i2 = h2.code;
983      let j2 = h2.message;
984      hilog.error(0x3900, 'Ace', `Faild to decideFontScale,cause, code: ${i2}, message: ${j2}`);
985    }
986  }
987  decideFontScale() {
988    let k2 = this.getUIContext();
989    this.systemFontScale = k2.getHostContext()?.config?.fontSizeScale ?? 1;
990    if (!this.isFollowingSystemFontScale) {
991      return 1;
992    }
993    return Math.min(this.systemFontScale, this.maxFontScale);
994  }
995
996  initialRender() {
997    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
998    this.observeComponentCreation2((u1, v1) => {
999      Row.create();
1000      Row.width(ImageMenuItem.imageHotZoneWidth);
1001      Row.height(ImageMenuItem.imageHotZoneWidth);
1002      Row.borderRadius(ImageMenuItem.buttonBorderRadius);
1003      Row.foregroundColor(this.getFgColor());
1004      Row.backgroundColor(this.getBgColor());
1005      Row.justifyContent(FlexAlign.Center);
1006      Row.opacity(this.item.isEnabled ? 1 : ImageMenuItem.disabledImageOpacity);
1007      ViewStackProcessor.visualState('focused');
1008      Row.border({
1009        radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'],
1010          'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' },
1011        width: ImageMenuItem.focusBorderWidth,
1012        color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'],
1013          'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' },
1014        style: BorderStyle.Solid,
1015      });
1016      ViewStackProcessor.visualState('normal');
1017      Row.border({
1018        radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'],
1019          'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' },
1020        width: 0,
1021      });
1022      ViewStackProcessor.visualState();
1023      Row.onFocus(() => {
1024        if (!this.item.isEnabled) {
1025          return;
1026        }
1027        this.isOnFocus = true;
1028      });
1029      Row.onBlur(() => this.isOnFocus = false);
1030      Row.onHover((h2) => {
1031        if (!this.item.isEnabled) {
1032          return;
1033        }
1034        this.isOnHover = h2;
1035      });
1036      Row.onKeyEvent((g2) => {
1037        if (!this.item.isEnabled) {
1038          return;
1039        }
1040        if (g2.keyCode !== KeyCode.KEYCODE_ENTER && g2.keyCode !== KeyCode.KEYCODE_SPACE) {
1041          return;
1042        }
1043        if (g2.type === KeyType.Down) {
1044          this.isOnClick = true;
1045        }
1046        if (g2.type === KeyType.Up) {
1047          this.isOnClick = false;
1048        }
1049      });
1050      Row.onTouch((f2) => {
1051        if (!this.item.isEnabled) {
1052          return;
1053        }
1054        if (f2.type === TouchType.Down) {
1055          this.isOnClick = true;
1056        }
1057        if (f2.type === TouchType.Up || f2.type === TouchType.Cancel) {
1058          this.isOnClick = false;
1059          if (this.fontSize >= this.minFontSize && this.isPopup === false) {
1060            this.dialogController?.close();
1061          }
1062        }
1063      });
1064      Row.onClick(() => this.item.isEnabled && this.item.action && this.item.action());
1065      Gesture.create(GesturePriority.Low);
1066      LongPressGesture.create({ repeat: false, duration: this.longPressTime });
1067      LongPressGesture.onAction((d2) => {
1068        this.fontSize = this.decideFontScale();
1069        if (d2) {
1070          if (this.fontSize >= this.minFontSize && this.isPopup === false) {
1071            this.dialogController?.open();
1072          }
1073        }
1074      });
1075      LongPressGesture.pop();
1076      Gesture.pop();
1077    }, Row);
1078    this.observeComponentCreation2((s1, t1) => {
1079      Image.create(this.item.value);
1080      Image.draggable(false);
1081      Image.width(ImageMenuItem.imageSize);
1082      Image.height(ImageMenuItem.imageSize);
1083      Image.focusable(this.item.isEnabled);
1084      Image.key(ImageMenuItem.focusablePrefix + this.index);
1085      Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'],
1086        'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' });
1087    }, Image);
1088    Row.pop();
1089    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
1090  }
1091
1092  rerender() {
1093    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
1094    this.updateDirtyElements();
1095    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
1096  }
1097}
1098ImageMenuItem.imageSize = 24;
1099ImageMenuItem.imageHotZoneWidth = 48;
1100ImageMenuItem.buttonBorderRadius = 8;
1101ImageMenuItem.focusBorderWidth = 2;
1102ImageMenuItem.disabledImageOpacity = 0.4;
1103ImageMenuItem.focusablePrefix = 'Id-SelectTitleBar-ImageMenuItem-';
1104class SelectTitleBarDialog extends ViewPU {
1105  constructor(i1, j1, k1, l1 = -1, m1 = undefined, n1) {
1106    super(i1, k1, l1, n1);
1107    if (typeof m1 === 'function') {
1108      this.paramsGenerator_ = m1;
1109    }
1110    this.SelectTitleDialog = {};
1111    this.callbackId = undefined;
1112    this.SelectTitleBarDialog = '';
1113    this.mainWindowStage = undefined;
1114    this.controller = undefined;
1115    this.minFontSize = 1.75;
1116    this.maxFontSize = 3.2;
1117    this.screenWidth = 640;
1118    this.verticalScreenLines = 6;
1119    this.horizontalsScreenLines = 1;
1120    this.__mainWindow = this.createStorageLink('mainWindow', undefined, 'mainWindow');
1121    this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize');
1122    this.__maxLines = new ObservedPropertySimplePU(1, this, 'maxLines');
1123    this.__windowStandardHeight = this.createStorageProp('windowStandardHeight', 0, 'windowStandardHeight');
1124    this.cancel = () => {
1125    };
1126    this.confirm = () => {
1127    };
1128    this.setInitiallyProvidedValue(j1);
1129    this.finalizeConstruction();
1130  }
1131
1132  setInitiallyProvidedValue(h1) {
1133    if (h1.SelectTitleDialog !== undefined) {
1134      this.SelectTitleDialog = h1.SelectTitleDialog;
1135    }
1136    if (h1.callbackId !== undefined) {
1137      this.callbackId = h1.callbackId;
1138    }
1139    if (h1.SelectTitleBarDialog !== undefined) {
1140      this.SelectTitleBarDialog = h1.SelectTitleBarDialog;
1141    }
1142    if (h1.mainWindowStage !== undefined) {
1143      this.mainWindowStage = h1.mainWindowStage;
1144    }
1145    if (h1.controller !== undefined) {
1146      this.controller = h1.controller;
1147    }
1148    if (h1.minFontSize !== undefined) {
1149      this.minFontSize = h1.minFontSize;
1150    }
1151    if (h1.maxFontSize !== undefined) {
1152      this.maxFontSize = h1.maxFontSize;
1153    }
1154    if (h1.screenWidth !== undefined) {
1155      this.screenWidth = h1.screenWidth;
1156    }
1157    if (h1.verticalScreenLines !== undefined) {
1158      this.verticalScreenLines = h1.verticalScreenLines;
1159    }
1160    if (h1.horizontalsScreenLines !== undefined) {
1161      this.horizontalsScreenLines = h1.horizontalsScreenLines;
1162    }
1163    if (h1.fontSize !== undefined) {
1164      this.fontSize = h1.fontSize;
1165    }
1166    if (h1.maxLines !== undefined) {
1167      this.maxLines = h1.maxLines;
1168    }
1169    if (h1.cancel !== undefined) {
1170      this.cancel = h1.cancel;
1171    }
1172    if (h1.confirm !== undefined) {
1173      this.confirm = h1.confirm;
1174    }
1175  }
1176
1177  updateStateVars(g1) {
1178  }
1179
1180  purgeVariableDependenciesOnElmtId(f1) {
1181    this.__mainWindow.purgeDependencyOnElmtId(f1);
1182    this.__fontSize.purgeDependencyOnElmtId(f1);
1183    this.__maxLines.purgeDependencyOnElmtId(f1);
1184    this.__windowStandardHeight.purgeDependencyOnElmtId(f1);
1185  }
1186
1187  aboutToBeDeleted() {
1188    this.__mainWindow.aboutToBeDeleted();
1189    this.__fontSize.aboutToBeDeleted();
1190    this.__maxLines.aboutToBeDeleted();
1191    this.__windowStandardHeight.aboutToBeDeleted();
1192    SubscriberManager.Get().delete(this.id__());
1193    this.aboutToBeDeletedInternal();
1194  }
1195
1196  setController(e1) {
1197    this.controller = e1;
1198  }
1199
1200  get mainWindow() {
1201    return this.__mainWindow.get();
1202  }
1203
1204  set mainWindow(d1) {
1205    this.__mainWindow.set(d1);
1206  }
1207
1208  get fontSize() {
1209    return this.__fontSize.get();
1210  }
1211
1212  set fontSize(c1) {
1213    this.__fontSize.set(c1);
1214  }
1215
1216  get maxLines() {
1217    return this.__maxLines.get();
1218  }
1219
1220  set maxLines(b1) {
1221    this.__maxLines.set(b1);
1222  }
1223
1224  get windowStandardHeight() {
1225    return this.__windowStandardHeight.get();
1226  }
1227
1228  set windowStandardHeight(a1) {
1229    this.__windowStandardHeight.set(a1);
1230  }
1231
1232  initialRender() {
1233    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
1234    this.observeComponentCreation2((e, f) => {
1235      If.create();
1236      if (this.SelectTitleBarDialog) {
1237        this.ifElseBranchUpdateFunction(0, () => {
1238          this.observeComponentCreation2((y, z) => {
1239            Column.create();
1240            Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG);
1241            Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG });
1242            Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK);
1243            Column.shadow(ShadowStyle.OUTER_DEFAULT_LG);
1244            Column.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'],
1245              'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' });
1246          }, Column);
1247          this.observeComponentCreation2((w, x) => {
1248            Image.create(this.SelectTitleDialog.value);
1249            Image.width(IMAGE_SIZE);
1250            Image.height(IMAGE_SIZE);
1251            Image.margin({
1252              top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'],
1253                'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' },
1254              bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'],
1255                'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' },
1256            });
1257            Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'],
1258              'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' });
1259          }, Image);
1260          this.observeComponentCreation2((u, v) => {
1261            Column.create();
1262            Column.width('100%');
1263            Column.padding({
1264              left: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'],
1265                'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' },
1266              right: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'],
1267                'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' },
1268              bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level12'],
1269                'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' },
1270            });
1271          }, Column);
1272          this.observeComponentCreation2((s, t) => {
1273            Text.create(this.SelectTitleBarDialog);
1274            Text.fontSize(TEXT_EDITABLE_DIALOG);
1275            Text.textOverflow({ overflow: TextOverflow.Ellipsis });
1276            Text.maxLines(this.maxLines);
1277            Text.width('100%');
1278            Text.textAlign(TextAlign.Center);
1279            Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'],
1280              'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' });
1281          }, Text);
1282          Text.pop();
1283          Column.pop();
1284          Column.pop();
1285        });
1286      }
1287      else {
1288        this.ifElseBranchUpdateFunction(1, () => {
1289          this.observeComponentCreation2((l, m) => {
1290            Column.create();
1291            Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG);
1292            Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG });
1293            Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK);
1294            Column.shadow(ShadowStyle.OUTER_DEFAULT_LG);
1295            Column.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'],
1296              'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' });
1297            Column.justifyContent(FlexAlign.Center);
1298          }, Column);
1299          this.observeComponentCreation2((j, k) => {
1300            Image.create(this.SelectTitleDialog.value);
1301            Image.width(IMAGE_SIZE);
1302            Image.height(IMAGE_SIZE);
1303            Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'],
1304              'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' });
1305          }, Image);
1306          Column.pop();
1307        });
1308      }
1309    }, If);
1310    If.pop();
1311    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
1312  }
1313
1314  async aboutToAppear() {
1315    let a = this.getUIContext().getHostContext();
1316    this.mainWindowStage = a.windowStage.getMainWindowSync();
1317    let b = this.mainWindowStage.getWindowProperties();
1318    let c = b.windowRect;
1319    if (px2vp(c.height) > this.screenWidth) {
1320      this.maxLines = this.verticalScreenLines;
1321    }
1322    else {
1323      this.maxLines = this.horizontalsScreenLines;
1324    }
1325  }
1326
1327  rerender() {
1328    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
1329    this.updateDirtyElements();
1330    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
1331  }
1332}
1333export default {
1334  SelectTitleBar: SelectTitleBar,
1335};
1336