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