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
16var t = (this && this.t) || function (f19, target, key, desc) {
17    var c = arguments.length,
18        r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19    if (typeof Reflect === 'object' && typeof Reflect.u3 === 'function') {
20        r = Reflect.u3(f19, target, key, desc);
21    } else {
22        for (var g19 = f19.length - 1; g19 >= 0; g19--) {
23            if (d = f19[g19]) {
24                r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
25            }
26        }
27    }
28    return c > 3 && r && Object.defineProperty(target, key, r), r;
29};
30if (!('finalizeConstruction' in ViewPU.prototype)) {
31    Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => {
32    });
33}
34
35const hilog = requireNapi('hilog');
36const LengthMetrics = requireNapi('arkui.node').LengthMetrics;
37const resourceManager = requireNapi('resourceManager');
38
39const u = 24;
40const a1 = 24;
41const b1 = 0;
42const c1 = 48;
43const d1 = 32;
44const e1 = 2;
45const f1 = 0;
46const g1 = 48;
47const h1 = 0;
48const i1 = 48;
49const j1 = 10;
50const l1 = 2;
51const m1 = 0.4;
52const n1 = 1;
53const o1 = 1;
54const q1 = 2;
55const s1 = '1.0vp';
56const t1 = '0vp';
57const u1 = '2.75vp';
58const v1 = '-1.25vp';
59const w1 = '1.5vp';
60const z1 = '#FFFFFF';
61const a2 = '#00000000';
62const b2 = '#1A0A59F7';
63const c2 = '#00001E';
64const d2 = '48';
65const e2 = '128vp';
66const f2 = '208vp';
67const g2 = '80vp';
68const h2 = '160vp';
69const i2 = '112vp';
70const j2 = '192vp';
71const l2 = '#00FFFFFF';
72const m2 = 100;
73const n2 = 12;
74const o2 = 8;
75const i16 = 'TreeView';
76const j16 = 0x3900;
77const ARROW_DOWN = {
78    'id': -1,
79    'type': 20000,
80    params: ['sys.media.ohos_ic_public_arrow_down'],
81    'bundleName': '__harDefaultBundleName__',
82    'moduleName': '__harDefaultModuleName__',
83};
84const q2 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAIGNIUk0AAHomAAC' +
85    'AhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAl' +
86    'wSFlzAAAOxAAADsQBlSsOGwAAAKVJREFUeNpjYBgFo2AU0Bww4pL4////diC1hZGRcSo+A4DqWIDUZCB+AVTbiC7PhEfvByCeAjQgn4Dhy4E' +
87    '4BYgvYFODz4JYIF4DxBOwWYJkeAAQRwBdvxGbIcy4TG9sbPzX0NCwHsjUAuIiIPsDUOwkDsPXkhwHWFwaAsQlQAwyrJsYw4myAIslIPCHGMP' +
88    'xBhGO4PoGxF+AOA9o+NbRTDgKRgFxAAAzj0Grm3RjyAAAAABJRU5ErkJggg==';
89const ARROW_RIGHT = {
90    'id': -1,
91    'type': 20000,
92    params: ['sys.media.ohos_ic_public_arrow_right'],
93    'bundleName': '__harDefaultBundleName__',
94    'moduleName': '__harDefaultModuleName__',
95};
96const s2 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAIGNIUk0AAHomAA' +
97    'CAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAEZ0FNQQAAsY58+1GTAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAA' +
98    'lwSFlzAAAOxAAADsQBlSsOGwAAAKFJREFUeNpjYBgFowAE/v//bwHEPOToZSJS3XIg3k6OJcRaUALEFuRYwkyMosbGxusNDQ3XgMwCIHYAsl' +
99    'cDxX5RzQJKLGEmxbvkWMJEaqQxMjKuBVI5QGwDxOnUimR08AFK81DdAmAqArl8DhDfAOKpVLUAavh2IH4CxI7A4HpDMEgpMPwFUXFGS8NJCa' +
100    'L55BgOAixEqqsB4oOkGj4KRggAAN4STB9zyhGzAAAAAElFTkSuQmCC';
101var Event;
102(function (Event) {
103    Event[Event['TOUCH_DOWN'] = 0] = 'TOUCH_DOWN';
104    Event[Event['TOUCH_UP'] = 1] = 'TOUCH_UP';
105    Event[Event['HOVER'] = 3] = 'HOVER';
106    Event[Event['HOVER_OVER'] = 4] = 'HOVER_OVER';
107    Event[Event['FOCUS'] = 5] = 'FOCUS';
108    Event[Event['BLUR'] = 6] = 'BLUR';
109    Event[Event['MOUSE_BUTTON_RIGHT'] = 7] = 'MOUSE_BUTTON_RIGHT';
110    Event[Event['DRAG'] = 8] = 'DRAG';
111})(Event || (Event = {}));
112var t2;
113(function (d19) {
114    d19[d19['ADD_NODE'] = 0] = 'ADD_NODE';
115    d19[d19['REMOVE_NODE'] = 1] = 'REMOVE_NODE';
116    d19[d19['MODIFY_NODE'] = 2] = 'MODIFY_NODE';
117    d19[d19['COMMIT_NODE'] = 3] = 'COMMIT_NODE';
118})(t2 || (t2 = {}));
119var u2;
120(function (c19) {
121    c19[c19['HINTS'] = 0] = 'HINTS';
122    c19[c19['WARNINGS'] = 1] = 'WARNINGS';
123})(u2 || (u2 = {}));
124var v2;
125(function (b19) {
126    b19[b19['INVALID_ERROR'] = 0] = 'INVALID_ERROR';
127    b19[b19['LENGTH_ERROR'] = 1] = 'LENGTH_ERROR';
128    b19[b19['NONE'] = 2] = 'NONE';
129})(v2 || (v2 = {}));
130var w2;
131(function (a19) {
132    a19[a19['DOWN_FLAG'] = 0] = 'DOWN_FLAG';
133    a19[a19['UP_FLAG'] = 1] = 'UP_FLAG';
134    a19[a19['NONE'] = 2] = 'NONE';
135})(w2 || (w2 = {}));
136
137export var z2;
138(function (z18) {
139    z18[z18['EXPAND'] = 0] = 'EXPAND';
140    z18[z18['COLLAPSE'] = 1] = 'COLLAPSE';
141})(z2 || (z2 = {}));
142
143export var a3;
144(function (y18) {
145    y18[y18['NORMAL'] = 0] = 'NORMAL';
146    y18[y18['SELECTED'] = 1] = 'SELECTED';
147    y18[y18['EDIT'] = 2] = 'EDIT';
148    y18[y18['FINISH_EDIT'] = 3] = 'FINISH_EDIT';
149    y18[y18['DRAG_INSERT'] = 4] = 'DRAG_INSERT';
150    y18[y18['FINISH_DRAG_INSERT'] = 5] = 'FINISH_DRAG_INSERT';
151})(a3 || (a3 = {}));
152var b3;
153(function (x18) {
154    x18[x18['ARROW_DOWN'] = 0] = 'ARROW_DOWN';
155    x18[x18['ARROW_RIGHT'] = 1] = 'ARROW_RIGHT';
156    x18[x18['ARROW_DOWN_WHITE'] = 2] = 'ARROW_DOWN_WHITE';
157    x18[x18['ARROW_RIGHT_WHITE'] = 3] = 'ARROW_RIGHT_WHITE';
158})(b3 || (b3 = {}));
159
160class c3 {
161    constructor() {
162    }
163
164    static getInstance() {
165        if (!c3.instance) {
166            c3.instance = new c3();
167        }
168        return c3.instance;
169    }
170
171    createNode() {
172        return {
173            v3: undefined,
174            inputText: new t3(),
175            w3: new s3(''),
176            x3: undefined,
177            fontColor: undefined,
178        };
179    }
180
181    y3(nodeParam) {
182        let w18 = this.createNode();
183        if (nodeParam.icon) {
184            w18.v3 = new r3(nodeParam.icon, {
185                'id': -1,
186                'type': 10002,
187                params: ['sys.float.ohos_id_alpha_content_fourth'],
188                'bundleName': '__harDefaultBundleName__',
189                'moduleName': '__harDefaultModuleName__',
190            }, u, a1, nodeParam.selectedIcon, nodeParam.editIcon);
191        }
192        if (nodeParam.primaryTitle) {
193            w18.w3 = new s3(nodeParam.primaryTitle);
194        }
195        return w18;
196    }
197}
198
199let d3 = {
200    isFolder: true,
201    icon: '',
202    selectedIcon: '',
203    editIcon: '',
204    container: () => {
205    },
206    secondaryTitle: '',
207    primaryTitle: '',
208    parentNodeId: -1,
209    currentNodeId: -1,
210};
211
212class e3 {
213    constructor() {
214        this.z3 = '#1A0A59F7';
215        this.a4 = {
216            'id': -1,
217            'type': 10001,
218            params: ['sys.color.ohos_id_color_primary'],
219            'bundleName': '__harDefaultBundleName__',
220            'moduleName': '__harDefaultModuleName__',
221        };
222        this.b4 = {
223            'id': -1,
224            'type': 10001,
225            params: ['sys.color.ohos_id_color_secondary'],
226            'bundleName': '__harDefaultBundleName__',
227            'moduleName': '__harDefaultModuleName__',
228        };
229        this.c4 = {
230            'id': -1,
231            'type': 10001,
232            params: ['sys.color.ohos_id_color_text_primary_activated'],
233            'bundleName': '__harDefaultBundleName__',
234            'moduleName': '__harDefaultModuleName__',
235        };
236        this.d4 = {
237            'id': -1,
238            'type': 10001,
239            params: ['sys.color.ohos_id_color_click_effect'],
240            'bundleName': '__harDefaultBundleName__',
241            'moduleName': '__harDefaultModuleName__',
242        };
243        this.e4 = {
244            'id': -1,
245            'type': 10001,
246            params: ['sys.color.ohos_id_color_hover'],
247            'bundleName': '__harDefaultBundleName__',
248            'moduleName': '__harDefaultModuleName__',
249        };
250        this.f4 = {
251            'id': -1,
252            'type': 10001,
253            params: ['sys.color.ohos_id_color_focused_outline'],
254            'bundleName': '__harDefaultBundleName__',
255            'moduleName': '__harDefaultModuleName__',
256        };
257        this.g4 = {
258            'id': -1,
259            'type': 10001,
260            params: ['sys.color.icon_secondary'],
261            'bundleName': '__harDefaultBundleName__',
262            'moduleName': '__harDefaultModuleName__',
263        };
264        this.h4 = {
265            'id': -1,
266            'type': 10001,
267            params: ['sys.color.icon_secondary'],
268            'bundleName': '__harDefaultBundleName__',
269            'moduleName': '__harDefaultModuleName__',
270        };
271        this.i4 = {
272            'id': -1,
273            'type': 10001,
274            params: ['sys.color.icon_tertiary'],
275            'bundleName': '__harDefaultBundleName__',
276            'moduleName': '__harDefaultModuleName__',
277        };
278    }
279
280    static getInstance() {
281        if (!e3.instance) {
282            e3.instance = new e3();
283        }
284        return e3.instance;
285    }
286}
287
288let f3 = class NodeInfo {
289    constructor(node, nodeParam) {
290        this.j4 = '';
291        this.borderWidth = { has: e1, l4: f1 };
292        this.m4 = false;
293        this.n4 = false;
294        this.o4 = false;
295        this.q4 = false;
296        this.r4 = false;
297        this.treeViewTheme = e3.getInstance();
298        this.fontColor = '';
299        this.node = node;
300        this.nodeParam = nodeParam;
301        this.s4 = c3.getInstance().y3(nodeParam);
302        this.t4 = {
303            u4: false,
304            v4: false,
305            w4: undefined,
306            x4: '',
307            y4: undefined,
308        };
309        this.z4 = g1;
310        this.a5 = node.b5 * n2 + o2;
311        this.c5 = {
312            'id': -1,
313            'type': 10001,
314            params: ['sys.color.ohos_id_color_background'],
315            'bundleName': '__harDefaultBundleName__',
316            'moduleName': '__harDefaultModuleName__',
317        };
318        this.d5 = (this.node.b5 > 0) ? false : true;
319        this.e5 = (this.node.b5 > 0) ? h1 : i1;
320        this.f5 = true;
321        this.g5 = false;
322        this.isSelected = false;
323        this.status = {
324            normal: {
325                'id': -1,
326                'type': 10001,
327                params: ['sys.color.ohos_id_color_background_transparent'],
328                'bundleName': '__harDefaultBundleName__',
329                'moduleName': '__harDefaultModuleName__',
330            },
331            h5: this.treeViewTheme.e4,
332            i5: this.treeViewTheme.d4,
333            selected: this.treeViewTheme.z3,
334            j5: {
335                'id': -1,
336                'type': 10001,
337                params: ['sys.color.ohos_id_color_activated'],
338                'bundleName': '__harDefaultBundleName__',
339                'moduleName': '__harDefaultModuleName__',
340            }
341        };
342        this.k5 = {
343            borderWidth: f1,
344            borderColor: this.treeViewTheme.f4,
345            borderRadius: {
346                'id': -1,
347                'type': 10002,
348                params: ['sys.float.ohos_id_corner_radius_clicked'],
349                'bundleName': '__harDefaultBundleName__',
350                'moduleName': '__harDefaultModuleName__',
351            }
352        };
353        this.l5 = node.b5 * n2 + o2;
354    }
355
356    m5(v18) {
357        if (v18) {
358            this.s4.x3 =
359                q3.n5(b3.ARROW_RIGHT);
360        } else {
361            this.s4.x3 = undefined;
362        }
363    }
364
365    o5(color) {
366        this.fontColor = color;
367    }
368
369    p5() {
370        return this.fontColor;
371    }
372
373    q5() {
374        return this.t4;
375    }
376
377    r5(isShow) {
378        this.t4.u4 = isShow;
379    }
380
381    s5(u18) {
382        this.t4.v4 = u18;
383    }
384
385    t5(color) {
386        this.t4.w4 = color;
387    }
388
389    u5(text) {
390        this.t4.x4 = text;
391    }
392
393    v5(t18) {
394        this.t4.y4 = t18;
395    }
396
397    w5() {
398        return this.f5;
399    }
400
401    x5() {
402        return this.g5;
403    }
404
405    y5(s18) {
406        if (s18) {
407            this.f5 = false;
408            this.g5 = true;
409        } else {
410            this.f5 = true;
411            this.g5 = false;
412        }
413    }
414
415    z5(r18) {
416        if (r18) {
417            this.s4.x3 =
418                q3.n5(b3.ARROW_DOWN);
419        } else {
420            this.s4.x3 = undefined;
421        }
422    }
423
424    a6(q18) {
425        if (q18 === undefined) {
426            return;
427        }
428        this.c5 = q18;
429    }
430
431    b6() {
432        return this.c5;
433    }
434
435    c6(p18) {
436        this.e5 = p18;
437    }
438
439    d6() {
440        return this.e5;
441    }
442
443    e6() {
444        return this.node.currentNodeId;
445    }
446
447    f6() {
448        return this.node.parentNodeId;
449    }
450
451    g6() {
452        return this.a5;
453    }
454
455    h6() {
456        return this.z4;
457    }
458
459    i6(o18) {
460        this.d5 = o18;
461    }
462
463    j6() {
464        return this.d5;
465    }
466
467    k6() {
468        return this.s4;
469    }
470
471    l6() {
472        return this.status;
473    }
474
475    m6() {
476        return this.k5;
477    }
478
479    n6(n18) {
480        this.k5.borderWidth = n18 ? this.borderWidth.has : this.borderWidth.l4;
481    }
482
483    o6() {
484        return this.node.p6;
485    }
486
487    q6() {
488        return this.nodeParam.container;
489    }
490
491    r6(isSelected) {
492        this.isSelected = isSelected;
493    }
494
495    s6() {
496        return this.isSelected;
497    }
498
499    t6() {
500        return this.nodeParam;
501    }
502
503    u6() {
504        return this.node;
505    }
506
507    v6() {
508        return this.nodeParam.isFolder;
509    }
510
511    w6(m18) {
512        this.m4 = m18;
513    }
514
515    x6() {
516        return this.m4;
517    }
518
519    y6(l18) {
520        if (l18 === undefined) {
521            return;
522        }
523        this.l5 = l18 * n2 + o2;
524    }
525
526    z6() {
527        return this.l5;
528    }
529
530    a7() {
531        return this.node.b5;
532    }
533
534    b7(k18) {
535        this.n4 = k18;
536    }
537
538    c7() {
539        return this.n4;
540    }
541
542    d7(j18) {
543        this.o4 = j18;
544    }
545
546    e7() {
547        return this.o4;
548    }
549
550    f7(i18) {
551        this.q4 = i18;
552    }
553
554    g7() {
555        return this.q4;
556    }
557
558    h7(h18) {
559        this.r4 = h18;
560    }
561
562    i7() {
563        return this.r4;
564    }
565};
566f3 = t([
567    Observed
568], f3);
569
570export { f3 };
571
572export var TreeListenType;
573(function (TreeListenType) {
574    TreeListenType['NODE_CLICK'] = 'NodeClick';
575    TreeListenType['NODE_ADD'] = 'NodeAdd';
576    TreeListenType['NODE_DELETE'] = 'NodeDelete';
577    TreeListenType['NODE_MODIFY'] = 'NodeModify';
578    TreeListenType['NODE_MOVE'] = 'NodeMove';
579})(TreeListenType || (TreeListenType = {}));
580
581export class TreeListener {
582    constructor() {
583        this.j7 = [];
584        this.k7 = [];
585    }
586
587    on(type, callback) {
588        if (Array.isArray(type)) {
589            for (let g18 = 0, l = type.length; g18 < l; g18++) {
590                this.on(type[g18], callback);
591            }
592        } else {
593            (this.j7[type] || (this.j7[type] = [])).push(callback);
594        }
595    }
596
597    once(type, callback) {
598        if (Array.isArray(type)) {
599            this.off(type, callback);
600        } else {
601            (this.k7[type] || (this.k7[type] = [])).push(callback);
602        }
603    }
604
605    off(type, callback) {
606        if (type === null) {
607            this.j7 = [];
608        }
609        if (Array.isArray(type)) {
610            for (let f18 = 0, l = type.length; f18 < l; f18++) {
611                this.off(type[f18], callback);
612            }
613        }
614        let c18 = this.j7[type];
615        if (!c18) {
616            return;
617        }
618        if (callback === null) {
619            this.j7[type] = null;
620        }
621        let d18 = c18.length;
622        while (d18--) {
623            let e18 = c18[d18];
624            if (e18 === callback) {
625                c18.splice(d18, 1);
626                break;
627            }
628        }
629    }
630
631    emit(event, x17) {
632        if (this.k7[event]) {
633            let a18 = Array.from(this.k7[event]);
634            if (a18) {
635                for (let b18 = 0, l = a18.length; b18 < l; b18++) {
636                    try {
637                        a18[b18](x17);
638                    } catch (e) {
639                        throw new Error('once function callbacks error.');
640                    }
641                }
642                this.k7[event] = null;
643            }
644        } else if (this.j7[event]) {
645            let y17 = Array.from(this.j7[event]);
646            if (y17) {
647                for (let z17 = 0, l = y17.length; z17 < l; z17++) {
648                    try {
649                        y17[z17](x17);
650                    } catch (e) {
651                        throw new Error('on function callbacks error.');
652                    }
653                }
654            }
655        }
656    }
657}
658
659export class TreeListenerManager {
660    constructor() {
661        this.appEventBus = new TreeListener();
662    }
663
664    static getInstance() {
665        if (AppStorage.Get('app_key_event_bus') === undefined) {
666            AppStorage.SetOrCreate('app_key_event_bus', new TreeListenerManager());
667        }
668        return AppStorage.Get('app_key_event_bus');
669    }
670
671    getTreeListener() {
672        return this.appEventBus;
673    }
674}
675TreeListenerManager.l7 = 'app_key_event_bus';
676
677export class TreeView extends ViewPU {
678    constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
679        super(parent, __localStorage, elmtId, extraInfo);
680        if (typeof paramsLambda === 'function') {
681            this.paramsGenerator_ = paramsLambda;
682        }
683        this.treeController = new TreeController();
684        this.m7 = new ObservedPropertyObjectPU([], this, 'nodeList');
685        this.listNodeDataSource = new h3();
686        this.n7 = new ObservedPropertyObjectPU(null, this, 'item');
687        this.o7 = new ObservedPropertySimplePU(0, this, 'touchCount');
688        this.p7 = new ObservedPropertySimplePU(0, this, 'dropSelectedIndex');
689        this.q7 = new ObservedPropertySimplePU(-1, this, 'viewLastIndex');
690        this.r7 = new ObservedPropertySimplePU(false, this, 'followingSystemFontScale');
691        this.s7 = new ObservedPropertySimplePU(1, this, 'maxAppFontScale');
692        this.t7 = new ObservedPropertyObjectPU({
693            'id': -1,
694            'type': 10001,
695            params: ['sys.color.ohos_id_color_background_transparent'],
696            'bundleName': '__harDefaultBundleName__',
697            'moduleName': '__harDefaultModuleName__',
698        }, this, 'listItemBgColor');
699        this.u7 = new ObservedPropertyObjectPU(e3.getInstance(), this, 'treeViewTheme');
700        this.addProvidedVar('treeViewTheme', this.u7, false);
701        this.listTreeViewMenu = this.NullBuilder;
702        this.MAX_CN_LENGTH = 254;
703        this.MAX_EN_LENGTH = 255;
704        this.INITIAL_INVALID_VALUE = -1;
705        this.MAX_TOUCH_DOWN_COUNT = 0;
706        this.isMultiPress = false;
707        this.touchDownCount = this.INITIAL_INVALID_VALUE;
708        this.appEventBus = TreeListenerManager.getInstance().getTreeListener();
709        this.itemPadding = {
710            left: {
711                'id': -1,
712                'type': 10002,
713                params: ['sys.float.ohos_id_card_margin_start'],
714                'bundleName': '__harDefaultBundleName__',
715                'moduleName': '__harDefaultModuleName__',
716            },
717            right: {
718                'id': -1,
719                'type': 10002,
720                params: ['sys.float.ohos_id_card_margin_end'],
721                'bundleName': '__harDefaultBundleName__',
722                'moduleName': '__harDefaultModuleName__',
723            },
724            top: {
725                'id': -1,
726                'type': 10002,
727                params: ['sys.float.ohos_id_text_margin_vertical'],
728                'bundleName': '__harDefaultBundleName__',
729                'moduleName': '__harDefaultModuleName__',
730            },
731            bottom: {
732                'id': -1,
733                'type': 10002,
734                params: ['sys.float.ohos_id_text_margin_vertical'],
735                'bundleName': '__harDefaultBundleName__',
736                'moduleName': '__harDefaultModuleName__',
737            },
738        };
739        this.textInputPadding = {
740            left: {
741                'id': -1,
742                'type': 10002,
743                params: ['sys.float.padding_level0'],
744                'bundleName': '__harDefaultBundleName__',
745                'moduleName': '__harDefaultModuleName__',
746            },
747            right: {
748                'id': -1,
749                'type': 10002,
750                params: ['sys.float.padding_level0'],
751                'bundleName': '__harDefaultBundleName__',
752                'moduleName': '__harDefaultModuleName__',
753            },
754            top: {
755                'id': -1,
756                'type': 10002,
757                params: ['sys.float.padding_level0'],
758                'bundleName': '__harDefaultBundleName__',
759                'moduleName': '__harDefaultModuleName__',
760            },
761            bottom: {
762                'id': -1,
763                'type': 10002,
764                params: ['sys.float.padding_level0'],
765                'bundleName': '__harDefaultBundleName__',
766                'moduleName': '__harDefaultModuleName__',
767            }
768        };
769        this.setInitiallyProvidedValue(params);
770        this.finalizeConstruction();
771    }
772
773    setInitiallyProvidedValue(params) {
774        if (params.treeController !== undefined) {
775            this.treeController = params.treeController;
776        }
777        if (params.nodeList !== undefined) {
778            this.nodeList = params.nodeList;
779        }
780        if (params.listNodeDataSource !== undefined) {
781            this.listNodeDataSource = params.listNodeDataSource;
782        }
783        if (params.item !== undefined) {
784            this.item = params.item;
785        }
786        if (params.touchCount !== undefined) {
787            this.touchCount = params.touchCount;
788        }
789        if (params.dropSelectedIndex !== undefined) {
790            this.dropSelectedIndex = params.dropSelectedIndex;
791        }
792        if (params.viewLastIndex !== undefined) {
793            this.viewLastIndex = params.viewLastIndex;
794        }
795        if (params.followingSystemFontScale !== undefined) {
796            this.followingSystemFontScale = params.followingSystemFontScale;
797        }
798        if (params.maxAppFontScale !== undefined) {
799            this.maxAppFontScale = params.maxAppFontScale;
800        }
801        if (params.listItemBgColor !== undefined) {
802            this.listItemBgColor = params.listItemBgColor;
803        }
804        if (params.treeViewTheme !== undefined) {
805            this.treeViewTheme = params.treeViewTheme;
806        }
807        if (params.listTreeViewMenu !== undefined) {
808            this.listTreeViewMenu = params.listTreeViewMenu;
809        }
810        if (params.MAX_CN_LENGTH !== undefined) {
811            this.MAX_CN_LENGTH = params.MAX_CN_LENGTH;
812        }
813        if (params.MAX_EN_LENGTH !== undefined) {
814            this.MAX_EN_LENGTH = params.MAX_EN_LENGTH;
815        }
816        if (params.INITIAL_INVALID_VALUE !== undefined) {
817            this.INITIAL_INVALID_VALUE = params.INITIAL_INVALID_VALUE;
818        }
819        if (params.MAX_TOUCH_DOWN_COUNT !== undefined) {
820            this.MAX_TOUCH_DOWN_COUNT = params.MAX_TOUCH_DOWN_COUNT;
821        }
822        if (params.isMultiPress !== undefined) {
823            this.isMultiPress = params.isMultiPress;
824        }
825        if (params.touchDownCount !== undefined) {
826            this.touchDownCount = params.touchDownCount;
827        }
828        if (params.appEventBus !== undefined) {
829            this.appEventBus = params.appEventBus;
830        }
831        if (params.itemPadding !== undefined) {
832            this.itemPadding = params.itemPadding;
833        }
834        if (params.textInputPadding !== undefined) {
835            this.textInputPadding = params.textInputPadding;
836        }
837    }
838
839    updateStateVars(params) {
840    }
841
842    purgeVariableDependenciesOnElmtId(rmElmtId) {
843        this.m7.purgeDependencyOnElmtId(rmElmtId);
844        this.n7.purgeDependencyOnElmtId(rmElmtId);
845        this.o7.purgeDependencyOnElmtId(rmElmtId);
846        this.p7.purgeDependencyOnElmtId(rmElmtId);
847        this.q7.purgeDependencyOnElmtId(rmElmtId);
848        this.r7.purgeDependencyOnElmtId(rmElmtId);
849        this.s7.purgeDependencyOnElmtId(rmElmtId);
850        this.t7.purgeDependencyOnElmtId(rmElmtId);
851        this.u7.purgeDependencyOnElmtId(rmElmtId);
852    }
853
854    aboutToBeDeleted() {
855        this.m7.aboutToBeDeleted();
856        this.n7.aboutToBeDeleted();
857        this.o7.aboutToBeDeleted();
858        this.p7.aboutToBeDeleted();
859        this.q7.aboutToBeDeleted();
860        this.r7.aboutToBeDeleted();
861        this.s7.aboutToBeDeleted();
862        this.t7.aboutToBeDeleted();
863        this.u7.aboutToBeDeleted();
864        SubscriberManager.Get().delete(this.id__());
865        this.aboutToBeDeletedInternal();
866    }
867
868    get nodeList() {
869        return this.m7.get();
870    }
871
872    set nodeList(newValue) {
873        this.m7.set(newValue);
874    }
875
876    get item() {
877        return this.n7.get();
878    }
879
880    set item(newValue) {
881        this.n7.set(newValue);
882    }
883
884    get touchCount() {
885        return this.o7.get();
886    }
887
888    set touchCount(newValue) {
889        this.o7.set(newValue);
890    }
891
892    get dropSelectedIndex() {
893        return this.p7.get();
894    }
895
896    set dropSelectedIndex(newValue) {
897        this.p7.set(newValue);
898    }
899
900    get viewLastIndex() {
901        return this.q7.get();
902    }
903
904    set viewLastIndex(newValue) {
905        this.q7.set(newValue);
906    }
907
908    get followingSystemFontScale() {
909        return this.r7.get();
910    }
911
912    set followingSystemFontScale(newValue) {
913        this.r7.set(newValue);
914    }
915
916    get maxAppFontScale() {
917        return this.s7.get();
918    }
919
920    set maxAppFontScale(newValue) {
921        this.s7.set(newValue);
922    }
923
924    get listItemBgColor() {
925        return this.t7.get();
926    }
927
928    set listItemBgColor(newValue) {
929        this.t7.set(newValue);
930    }
931
932    get treeViewTheme() {
933        return this.u7.get();
934    }
935
936    set treeViewTheme(newValue) {
937        this.u7.set(newValue);
938    }
939
940    NullBuilder(parent = null) {
941    }
942
943    onWillApplyTheme(theme) {
944        this.treeViewTheme.z3 = theme.colors.interactiveSelect;
945        this.treeViewTheme.d4 = theme.colors.interactivePressed;
946        this.treeViewTheme.e4 = theme.colors.interactiveHover;
947        this.treeViewTheme.a4 = theme.colors.fontPrimary;
948        this.treeViewTheme.b4 = theme.colors.fontSecondary;
949        this.treeViewTheme.c4 = theme.colors.interactiveActive;
950        this.treeViewTheme.f4 = theme.colors.interactiveFocus;
951        this.treeViewTheme.g4 = theme.colors.iconSecondary;
952        this.treeViewTheme.h4 = theme.colors.interactiveActive;
953        this.treeViewTheme.i4 = theme.colors.iconPrimary;
954        this.treeController.treeViewTheme = this.treeViewTheme;
955    }
956
957    aboutToAppear() {
958        if (this.treeController !== null) {
959            this.listNodeDataSource = this.treeController.v7();
960            this.nodeList = this.treeController.v7().w7;
961            this.item = this.treeController.v7().w7;
962        }
963        let w17 = this.getUIContext();
964        this.followingSystemFontScale = w17.isFollowingSystemFontScale();
965        this.maxAppFontScale = w17.getMaxFontScale();
966    }
967
968    decideFontScale() {
969        let u17 = this.getUIContext();
970        let v17 = u17.getHostContext()?.config?.fontSizeScale ?? 1;
971        if (!this.followingSystemFontScale) {
972            return 1;
973        }
974        return Math.min(v17, this.maxAppFontScale, q1);
975    }
976
977    popupForShowTitle(text, backgroundColor, fontColor, parent = null) {
978        this.observeComponentCreation2((elmtId, isInitialRender) => {
979            Row.create();
980            Row.backgroundColor(backgroundColor);
981            Row.border({
982                radius: {
983                    'id': -1,
984                    'type': 10002,
985                    params: ['sys.float.ohos_id_elements_margin_horizontal_l'],
986                    'bundleName': '__harDefaultBundleName__',
987                    'moduleName': '__harDefaultModuleName__',
988                }
989            });
990            Row.padding({
991                left: {
992                    'id': -1,
993                    'type': 10002,
994                    params: ['sys.float.ohos_id_elements_margin_horizontal_l'],
995                    'bundleName': '__harDefaultBundleName__',
996                    'moduleName': '__harDefaultModuleName__',
997                },
998                right: {
999                    'id': -1,
1000                    'type': 10002,
1001                    params: ['sys.float.ohos_id_elements_margin_horizontal_l'],
1002                    'bundleName': '__harDefaultBundleName__',
1003                    'moduleName': '__harDefaultModuleName__',
1004                },
1005                top: {
1006                    'id': -1,
1007                    'type': 10002,
1008                    params: ['sys.float.ohos_id_card_margin_middle'],
1009                    'bundleName': '__harDefaultBundleName__',
1010                    'moduleName': '__harDefaultModuleName__',
1011                },
1012                bottom: {
1013                    'id': -1,
1014                    'type': 10002,
1015                    params: ['sys.float.ohos_id_card_margin_middle'],
1016                    'bundleName': '__harDefaultBundleName__',
1017                    'moduleName': '__harDefaultModuleName__',
1018                },
1019            });
1020        }, Row);
1021        this.observeComponentCreation2((elmtId, isInitialRender) => {
1022            Text.create(text);
1023            Text.fontSize({
1024                'id': -1,
1025                'type': 10002,
1026                params: ['sys.float.ohos_id_text_size_body2'],
1027                'bundleName': '__harDefaultBundleName__',
1028                'moduleName': '__harDefaultModuleName__',
1029            });
1030            Text.fontWeight('regular');
1031            Text.fontColor(fontColor);
1032            Text.minFontScale(o1);
1033            Text.maxFontScale(this.decideFontScale());
1034        }, Text);
1035        Text.pop();
1036        Row.pop();
1037    }
1038
1039    builder(parent = null) {
1040        this.listTreeViewMenu.bind(this)();
1041    }
1042
1043    draggingPopup(item, parent = null) {
1044        this.observeComponentCreation2((elmtId, isInitialRender) => {
1045            Row.create();
1046            Row.constraintSize({
1047                minWidth: this.listNodeDataSource.x7().y7.minWidth,
1048                maxWidth: this.listNodeDataSource.x7().y7.maxWidth,
1049            });
1050            Row.height(this.listNodeDataSource.x7().height);
1051            Row.backgroundColor(this.listNodeDataSource.x7().backgroundColor);
1052            Row.padding({
1053                start: LengthMetrics.resource(this.listNodeDataSource.x7().padding.left),
1054                end: LengthMetrics.resource(this.listNodeDataSource.x7().padding.right),
1055            });
1056            Row.shadow({
1057                radius: {
1058                    'id': -1,
1059                    'type': 10002,
1060                    params: ['sys.float.ohos_id_corner_radius_default_m'],
1061                    'bundleName': '__harDefaultBundleName__',
1062                    'moduleName': '__harDefaultModuleName__',
1063                },
1064                color: c2,
1065                offsetY: 0,
1066            });
1067            Row.borderRadius(this.listNodeDataSource.x7().borderRadius);
1068        }, Row);
1069        this.observeComponentCreation2((elmtId, isInitialRender) => {
1070            If.create();
1071            if (item.k6().v3) {
1072                this.ifElseBranchUpdateFunction(0, () => {
1073                    this.observeComponentCreation2((elmtId, isInitialRender) => {
1074                        Row.create();
1075                        Row.backgroundColor(a2);
1076                        Row.margin({ end: o(item.k6().v3?.z7) });
1077                        Row.height(item.k6().v3?.itemHeight);
1078                        Row.width(item.k6().v3?.itemWidth);
1079                    }, Row);
1080                    this.observeComponentCreation2((elmtId, isInitialRender) => {
1081                        Image.create(item.k6().v3?.a8);
1082                        Image.objectFit(ImageFit.Contain);
1083                        Image.height(item.k6().v3?.itemHeight);
1084                        Image.width(item.k6().v3?.itemWidth);
1085                        Image.opacity(this.listNodeDataSource.x7().b8);
1086                        Image.matchTextDirection((item.k6().x3?.c8 === ARROW_RIGHT || item.k6().x3?.c8 === s2) ? true :
1087                            false);
1088                    }, Image);
1089                    Row.pop();
1090                });
1091            } else {
1092                this.ifElseBranchUpdateFunction(1, () => {
1093                });
1094            }
1095        }, If);
1096        If.pop();
1097        this.observeComponentCreation2((elmtId, isInitialRender) => {
1098            Row.create();
1099            Row.constraintSize({
1100                minWidth: item.k6().v3 ?
1101                this.listNodeDataSource.x7().d8.e8 :
1102                this.listNodeDataSource.x7().d8.f8,
1103                maxWidth: item.k6().v3 ?
1104                this.listNodeDataSource.x7().d8.g8 :
1105                this.listNodeDataSource.x7().d8.h8,
1106            });
1107        }, Row);
1108        this.observeComponentCreation2((elmtId, isInitialRender) => {
1109            If.create();
1110            if (item.k6().w3 && item.w5()) {
1111                this.ifElseBranchUpdateFunction(0, () => {
1112                    this.observeComponentCreation2((elmtId, isInitialRender) => {
1113                        Text.create(item.k6().w3?.title);
1114                        Text.maxLines(1);
1115                        Text.minFontScale(o1);
1116                        Text.maxFontScale(this.decideFontScale());
1117                        Text.fontSize(item.k6().w3?.size);
1118                        Text.fontColor(this.listNodeDataSource.x7().fontColor);
1119                        Text.fontWeight(this.listNodeDataSource.x7().fontWeight);
1120                        Text.textOverflow({ overflow: TextOverflow.Ellipsis });
1121                    }, Text);
1122                    Text.pop();
1123                });
1124            } else {
1125                this.ifElseBranchUpdateFunction(1, () => {
1126                });
1127            }
1128        }, If);
1129        If.pop();
1130        Row.pop();
1131        Row.pop();
1132    }
1133
1134    clearLastIndexColor() {
1135        if (this.viewLastIndex === -1 || this.viewLastIndex >= this.nodeList.length) {
1136            return;
1137        }
1138        this.setImageSources(this.viewLastIndex, a3.NORMAL);
1139        this.listNodeDataSource.i8(this.viewLastIndex, a3.NORMAL);
1140        this.nodeList[this.viewLastIndex].a6({
1141            'id': -1,
1142            'type': 10001,
1143            params: ['sys.color.ohos_id_color_background_transparent'],
1144            'bundleName': '__harDefaultBundleName__',
1145            'moduleName': '__harDefaultModuleName__',
1146        });
1147        this.nodeList[this.viewLastIndex].fontColor = this.treeViewTheme.a4;
1148        this.listNodeDataSource.w7[this.viewLastIndex].a6({
1149            'id': -1,
1150            'type': 10001,
1151            params: ['sys.color.ohos_id_color_background_transparent'],
1152            'bundleName': '__harDefaultBundleName__',
1153            'moduleName': '__harDefaultModuleName__',
1154        });
1155        this.listNodeDataSource.w7[this.viewLastIndex].fontColor = this.treeViewTheme.a4;
1156        this.listNodeDataSource.w7[this.viewLastIndex].r6(false);
1157        this.listNodeDataSource.w7[this.viewLastIndex].j4 = this.listNodeDataSource.w7[this.viewLastIndex].k6()
1158            .v3?.source;
1159    }
1160
1161    setImageSources(index, f17) {
1162        let g17 = this.nodeList[index];
1163        g17.r6(f17 === a3.SELECTED ||
1164            f17 === a3.EDIT || f17 === a3.FINISH_EDIT);
1165        if (g17.k6().w3 !== null && f17 !== a3.DRAG_INSERT &&
1166            f17 !== a3.FINISH_DRAG_INSERT) {
1167            g17.k6().w3?.j8(f17 === a3.SELECTED ||
1168                f17 === a3.FINISH_EDIT);
1169        }
1170        if (g17.k6().v3 !== null) {
1171            g17.k6().v3?.i8(f17);
1172        }
1173    }
1174
1175    initialRender() {
1176        this.observeComponentCreation2((elmtId, isInitialRender) => {
1177            List.create({});
1178            List.onDragMove((event, extraParams) => {
1179                if (this.isMultiPress) {
1180                    hilog.error(j16, i16, 'drag error, a item has been dragged');
1181                    return;
1182                }
1183                let b17 = i1;
1184                let flag = Math.floor(event.getY() /
1185                    (b17 / l1)) % l1 ? w2.DOWN_FLAG : w2.UP_FLAG;
1186                let index = JSON.parse(extraParams).insertIndex;
1187                let c17 = false;
1188                if (index >= this.listNodeDataSource.totalCount()) {
1189                    flag = w2.DOWN_FLAG;
1190                    index = this.listNodeDataSource.totalCount() - 1;
1191                    this.listNodeDataSource.getData(index)?.b7(true);
1192                    c17 = true;
1193                } else {
1194                    this.listNodeDataSource.getData(index)?.b7(false);
1195                }
1196                let d17 = this.listNodeDataSource.getData(index);
1197                let currentNodeId = d17?.e6();
1198                if (index !== this.listNodeDataSource.k8() && this.listNodeDataSource.l8()) {
1199                    let e17 = this.listNodeDataSource.m8(currentNodeId);
1200                    if (e17) {
1201                        this.listNodeDataSource.n8(index);
1202                        if (currentNodeId !== undefined) {
1203                            this.listNodeDataSource.o8(this.listNodeDataSource.findIndex(currentNodeId));
1204                        }
1205                        this.listNodeDataSource.p8(w2.NONE);
1206                        return;
1207                    }
1208                }
1209                this.listNodeDataSource.q8(index);
1210                this.listNodeDataSource.r8(flag, index - 1, c17);
1211                if (currentNodeId !== undefined && currentNodeId !== this.listNodeDataSource.s8()) {
1212                    this.listNodeDataSource.t8(this.listNodeDataSource.findIndex(currentNodeId), currentNodeId, index);
1213                }
1214            });
1215            List.onDragEnter((event, extraParams) => {
1216                if (this.listNodeDataSource.l8()) {
1217                    this.listNodeDataSource.u8(true);
1218                    let a17 = m1;
1219                    this.listNodeDataSource.v8(a17);
1220                }
1221            });
1222            List.onDragLeave((event, extraParams) => {
1223                this.listNodeDataSource.w8();
1224                this.listNodeDataSource.x8();
1225                this.listNodeDataSource.y8();
1226                let z16 = n1;
1227                this.listNodeDataSource.v8(z16);
1228                this.listNodeDataSource.u8(false);
1229                this.listNodeDataSource.z8();
1230            });
1231            List.onDrop((event, extraParams) => {
1232                this.listNodeDataSource.y8();
1233                let m16 = n1;
1234                this.listNodeDataSource.v8(m16);
1235                let n16 = JSON.parse(extraParams).insertIndex;
1236                let o16 = this.dropSelectedIndex;
1237                if (o16 - 1 > this.listNodeDataSource.totalCount() || o16 === undefined) {
1238                    hilog.error(j16, i16, 'drag error, currentNodeIndex is not found');
1239                    this.listNodeDataSource.u8(false);
1240                    return;
1241                }
1242                if (n16 === this.listNodeDataSource.totalCount()) {
1243                    hilog.info(j16, i16, 'need to insert into the position of the last line');
1244                    n16 -= 1;
1245                }
1246                let p16 = this.listNodeDataSource.getData(n16);
1247                if (p16 === undefined) {
1248                    return;
1249                }
1250                let q16 = p16.e6();
1251                if (!this.listNodeDataSource.a9() || !this.listNodeDataSource.l8()) {
1252                    this.listNodeDataSource.x8();
1253                    this.listNodeDataSource.b9(false);
1254                    this.listNodeDataSource.w8();
1255                    this.listNodeDataSource.c9();
1256                    this.listNodeDataSource.d9(q16);
1257                    this.listNodeDataSource.z8();
1258                    return;
1259                }
1260                let r16 = this.listNodeDataSource.e9();
1261                let s16 = p16.f6();
1262                let t16 = this.listNodeDataSource.s8();
1263                let u16 = this.listNodeDataSource.f9();
1264                let v16 = this.listNodeDataSource.m8(q16);
1265                if (v16) {
1266                    this.listNodeDataSource.x8();
1267                    this.listNodeDataSource.b9(false);
1268                    this.listNodeDataSource.w8();
1269                    this.listNodeDataSource.g9(n16);
1270                    this.listNodeDataSource.c9();
1271                    this.listNodeDataSource.u8(false);
1272                    let y16 = this.listNodeDataSource.findIndex(t16);
1273                    this.listNodeDataSource.h9(y16);
1274                    this.listNodeDataSource.i9(Event.DRAG, y16);
1275                    return;
1276                }
1277                if (this.listNodeDataSource.j9(t16) === z2.EXPAND) {
1278                    this.listNodeDataSource.k9(this.listNodeDataSource.findIndex(t16));
1279                }
1280                let flag = false;
1281                if (this.listNodeDataSource.j9(q16) === z2.COLLAPSE) {
1282                    let currentIndex = this.listNodeDataSource.findIndex(q16);
1283                    if (this.listNodeDataSource.w7[currentIndex].g7()) {
1284                        this.listNodeDataSource.k9(currentIndex);
1285                    }
1286                    flag = true;
1287                }
1288                this.listNodeDataSource.l9();
1289                if (r16 !== null && t16 !== q16) {
1290                    this.listNodeDataSource.m9(s16, q16, u16, t16, r16);
1291                    this.listNodeDataSource.w8();
1292                } else {
1293                    this.listNodeDataSource.w8();
1294                    this.listNodeDataSource.n9(t16);
1295                    this.listNodeDataSource.w8();
1296                }
1297                let w16 = this.listNodeDataSource.findIndex(this.listNodeDataSource.o9());
1298                this.listNodeDataSource.p9(w16);
1299                this.listNodeDataSource.x8();
1300                this.listNodeDataSource.c9();
1301                this.listNodeDataSource.u8(false);
1302                let x16 = this.listNodeDataSource.findIndex(t16);
1303                this.listNodeDataSource.h9(x16);
1304                this.listNodeDataSource.i9(Event.DRAG, x16);
1305                this.listNodeDataSource.b9(false);
1306                this.listNodeDataSource.z8();
1307                this.listNodeDataSource.w7[x16].fontColor = this.treeViewTheme.c4;
1308                if (this.viewLastIndex !== -1 && o16 !== this.viewLastIndex) {
1309                    this.listNodeDataSource.w7[this.viewLastIndex].k6()
1310                        .w3?.j8(false);
1311                    this.listNodeDataSource.w7[this.viewLastIndex].k6()
1312                        .w3?.q9(false);
1313                }
1314                if (this.listNodeDataSource.w7[this.viewLastIndex] !== null) {
1315                    this.listNodeDataSource.w7[this.viewLastIndex].fontColor = this.treeViewTheme.a4;
1316                }
1317                this.listNodeDataSource.lastIndex = this.viewLastIndex;
1318                if (this.listNodeDataSource.w7[this.viewLastIndex]) {
1319                    if (this.listNodeDataSource.w7[this.viewLastIndex].k6()
1320                        .v3 !== null) {
1321                        this.listNodeDataSource.w7[this.viewLastIndex].k6()
1322                            .v3?.i8(a3.NORMAL);
1323                        this.listNodeDataSource.w7[this.viewLastIndex].j4 =
1324                            this.listNodeDataSource.w7[this.viewLastIndex].k6()
1325                                .v3?.source;
1326                    }
1327                }
1328                if (this.listNodeDataSource.w7[this.viewLastIndex]) {
1329                    this.listNodeDataSource.w7[this.viewLastIndex].a6({
1330                        'id': -1,
1331                        'type': 10001,
1332                        params: ['sys.color.ohos_id_color_background_transparent'],
1333                        'bundleName': '__harDefaultBundleName__',
1334                        'moduleName': '__harDefaultModuleName__',
1335                    });
1336                }
1337                this.listNodeDataSource.lastIndex = x16;
1338            });
1339        }, List);
1340        {
1341            const __lazyForEachItemGenFunction = _item => {
1342                const u15 = _item;
1343                {
1344                    const itemCreation2 = (elmtId, isInitialRender) => {
1345                        ListItem.create(() => {
1346                        }, false);
1347                        ListItem.width('100%');
1348                        ListItem.height(u15.d6());
1349                        ListItem.padding({
1350                            start: LengthMetrics.resource(this.itemPadding.left),
1351                            end: LengthMetrics.resource(this.itemPadding.right)
1352                        });
1353                        ListItem.align(Alignment.Start);
1354                        ListItem.onDragStart((event, extraParams) => {
1355                            if (this.listNodeDataSource.a9() || this.listNodeDataSource.l8() || this.isMultiPress) {
1356                                hilog.error(j16, i16, 'drag error, a item has been dragged');
1357                                return;
1358                            }
1359                            this.dropSelectedIndex = JSON.parse(extraParams).selectedIndex;
1360                            let e16 = JSON.parse(extraParams).selectedIndex;
1361                            let f16 = this.listNodeDataSource.getData(e16);
1362                            let g16 = u15.e6();
1363                            if (e16 >= this.listNodeDataSource.totalCount() || e16 === undefined) {
1364                                hilog.error(j16, i16, 'drag error, currentNodeIndex is not found in onDragStart');
1365                                return;
1366                            }
1367                            this.listNodeDataSource.b9(true);
1368                            this.listNodeDataSource.u8(true);
1369                            this.listNodeDataSource.r9(f16);
1370                            this.listNodeDataSource.s9(f16?.e6());
1371                            this.listNodeDataSource.t9(f16?.f6());
1372                            let h16 = m1;
1373                            this.listNodeDataSource.v8(h16);
1374                            this.listNodeDataSource.g9(e16);
1375                            if (g16 !== f16?.e6()) {
1376                                hilog.error(j16, i16, 'drag is too fast, it attribute a fault to OH');
1377                                this.listNodeDataSource.u8(false);
1378                                return;
1379                            }
1380                            return {
1381                                builder: () => {
1382                                    this.draggingPopup.call(this, f16);
1383                                }
1384                            };
1385                        });
1386                    };
1387                    const observedDeepRender = () => {
1388                        this.observeComponentCreation2(itemCreation2, ListItem);
1389                        this.observeComponentCreation2((elmtId, isInitialRender) => {
1390                            Row.create();
1391                            Row.onTouch((event) => {
1392                                this.viewLastIndex = this.listNodeDataSource.u9();
1393                                let index = this.listNodeDataSource.findIndex(u15.e6());
1394                                if (event.type === TouchType.Down) {
1395                                    if (index !== this.viewLastIndex) {
1396                                        this.clearLastIndexColor();
1397                                        this.listNodeDataSource.lastIndex = index;
1398                                        this.listNodeDataSource.h9(index);
1399                                    }
1400                                }
1401                                if (event.type === TouchType.Up) {
1402                                    this.listNodeDataSource.w7[index].r6(true);
1403                                    this.listNodeDataSource.i8(index, a3.SELECTED);
1404                                    if (this.listNodeDataSource.w7[index].k6().v3 !== null) {
1405                                        this.listNodeDataSource.w7[index].j4 =
1406                                            this.listNodeDataSource.w7[index].k6().v3?.source;
1407                                    }
1408                                    if (index !== this.viewLastIndex) {
1409                                        this.clearLastIndexColor();
1410                                        this.listNodeDataSource.lastIndex = index;
1411                                        this.listNodeDataSource.h9(index);
1412                                    }
1413                                    this.viewLastIndex = index;
1414                                }
1415                                if (this.listNodeDataSource.u9() !== -1 && index !== this.listNodeDataSource.u9()) {
1416                                    this.listNodeDataSource.v9(u2.WARNINGS, v2.NONE, false,
1417                                        this.listNodeDataSource.u9());
1418                                    this.listNodeDataSource.w9(this.listNodeDataSource.u9(), t2.COMMIT_NODE);
1419                                }
1420                            });
1421                        }, Row);
1422                        {
1423                            this.observeComponentCreation2((elmtId, isInitialRender) => {
1424                                if (isInitialRender) {
1425                                    let componentCall = new i3(this, {
1426                                        item: u15,
1427                                        listNodeDataSource: this.listNodeDataSource,
1428                                        index: this.listNodeDataSource.findIndex(u15.e6()),
1429                                        listTreeViewMenu: this.listTreeViewMenu,
1430                                    }, undefined, elmtId, () => {
1431                                    }, { page: 'library/src/main/ets/components/MainPage.ets', line: 1133, x9: 13 });
1432                                    ViewPU.create(componentCall);
1433                                    let paramsLambda = () => {
1434                                        return {
1435                                            item: u15,
1436                                            listNodeDataSource: this.listNodeDataSource,
1437                                            index: this.listNodeDataSource.findIndex(u15.e6()),
1438                                            listTreeViewMenu: this.listTreeViewMenu
1439                                        };
1440                                    };
1441                                    componentCall.paramsGenerator_ = paramsLambda;
1442                                } else {
1443                                    this.updateStateVarsOfChildByElmtId(elmtId, {
1444                                        item: u15
1445                                    });
1446                                }
1447                            }, { name: 'TreeViewInner' });
1448                        }
1449                        Row.pop();
1450                        ListItem.pop();
1451                    };
1452                    observedDeepRender();
1453                }
1454            };
1455            const __lazyForEachItemIdFunc = (item) => JSON.stringify(item);
1456            LazyForEach.create('1', this, this.listNodeDataSource, __lazyForEachItemGenFunction,
1457                __lazyForEachItemIdFunc);
1458            LazyForEach.pop();
1459        }
1460        List.pop();
1461    }
1462
1463    rerender() {
1464        this.updateDirtyElements();
1465    }
1466}
1467
1468export class TreeController {
1469    constructor() {
1470        this.y9 = -1;
1471        this.z9 = [];
1472        this.listNodeDataSource = new h3();
1473        this.a10 = true;
1474        this.treeViewTheme = e3.getInstance();
1475    }
1476
1477    v7() {
1478        return this.listNodeDataSource;
1479    }
1480
1481    b10() {
1482        let q15 = this.listNodeDataSource.c10();
1483        return this.listNodeDataSource.b10(q15);
1484    }
1485
1486    d10() {
1487        let p15 = this.listNodeDataSource.c10();
1488        return this.listNodeDataSource.e10(p15);
1489    }
1490
1491    removeNode() {
1492        let n15 = this.listNodeDataSource.c10();
1493        if (n15 < 0) {
1494            return;
1495        }
1496        let parentNodeId = this.listNodeDataSource.f10(n15);
1497        let o15 = this.listNodeDataSource.removeNode(n15, parentNodeId);
1498        this.listNodeDataSource.g10(t2.REMOVE_NODE, parentNodeId, o15);
1499        this.z9.splice(this.z9.indexOf(n15), 1);
1500        this.listNodeDataSource.lastIndex = -1;
1501    }
1502
1503    modifyNode() {
1504        let m15 = this.listNodeDataSource.c10();
1505        this.listNodeDataSource.w9(m15, t2.MODIFY_NODE);
1506    }
1507
1508    add(g15) {
1509        let h15 = this.listNodeDataSource.c10();
1510        if (h15 === this.listNodeDataSource.y9 || !this.listNodeDataSource.v6(h15)) {
1511            return;
1512        }
1513        let i15 = this.listNodeDataSource.h10(h15);
1514        this.z9.push(this.z9[this.z9.length - 1] + 1);
1515        let j15 = this.z9[this.z9.length - 1];
1516        let k15 = this.listNodeDataSource.addNode(h15, j15, {
1517            isFolder: i15.isFolder,
1518            icon: i15.icon,
1519            selectedIcon: i15.selectedIcon,
1520            editIcon: i15.editIcon,
1521            primaryTitle: '新建文件夹',
1522            container: i15.container,
1523            secondaryTitle: i15.secondaryTitle,
1524        }, g15);
1525        if (!k15) {
1526            return;
1527        }
1528        this.listNodeDataSource.g10(t2.ADD_NODE, h15, [j15]);
1529        this.listNodeDataSource.v9(u2.WARNINGS, v2.NONE, false, this.listNodeDataSource.u9());
1530        this.listNodeDataSource.w9(this.listNodeDataSource.u9(), t2.COMMIT_NODE);
1531        this.listNodeDataSource.w7[this.listNodeDataSource.u9()].o5(this.treeViewTheme.a4);
1532        let l15 = this.listNodeDataSource.findIndex(j15);
1533        this.listNodeDataSource.h9(l15);
1534        this.listNodeDataSource.i9(Event.TOUCH_UP, l15);
1535    }
1536
1537    addNode(nodeParam) {
1538        if (nodeParam === undefined) {
1539            this.add(this.a10);
1540            return this;
1541        } else {
1542            let e15 = false;
1543            if (nodeParam.primaryTitle !== undefined &&
1544                !this.listNodeDataSource.i10(nodeParam.primaryTitle.toString())) {
1545                throw new Error('ListTreeNode[addNode]: ' +
1546                    'The directory name cannot contain the following characters\ /: *? "< > | or exceeds the maximum length.');
1547                return this;
1548            }
1549            if (nodeParam.primaryTitle === null && nodeParam.icon === null) {
1550                throw new Error('ListTreeNode[addNode]: ' +
1551                    'The icon and directory name cannot be empty at the same time.');
1552                return this;
1553            }
1554            if (nodeParam.currentNodeId === this.y9 || nodeParam.currentNodeId === null) {
1555                throw new Error('ListTreeNode[addNode]: currentNodeId can not be -1 or null.');
1556                return this;
1557            }
1558            if (nodeParam.currentNodeId !== undefined) {
1559                this.z9.push(nodeParam.currentNodeId);
1560            }
1561            if (nodeParam.parentNodeId !== undefined) {
1562                if (nodeParam.currentNodeId !== undefined) {
1563                    e15 =
1564                        this.listNodeDataSource.addNode(nodeParam.parentNodeId, nodeParam.currentNodeId, nodeParam,
1565                            this.a10);
1566                }
1567            }
1568            if (!e15) {
1569                return this;
1570            }
1571            if (!this.a10 && nodeParam.parentNodeId !== undefined) {
1572                let f15 = this.z9[this.z9.length - 1];
1573                this.listNodeDataSource.g10(t2.ADD_NODE, nodeParam.parentNodeId, [f15]);
1574            }
1575            return this;
1576        }
1577    }
1578
1579    refreshNode(parentId, parentSubTitle, d15) {
1580        this.listNodeDataSource.j10(parentId, parentSubTitle, d15);
1581    }
1582
1583    buildDone() {
1584        this.listNodeDataSource.k10();
1585        this.listNodeDataSource.l10();
1586        this.listNodeDataSource.m10();
1587        m(this.z9);
1588        this.a10 = false;
1589    }
1590}
1591
1592class g3 {
1593    constructor() {
1594        this.n10 = [];
1595    }
1596
1597    totalCount() {
1598        return 0;
1599    }
1600
1601    getData(index) {
1602        return undefined;
1603    }
1604
1605    registerDataChangeListener(listener) {
1606        if (this.n10.indexOf(listener) < 0) {
1607            this.n10.push(listener);
1608        }
1609    }
1610
1611    unregisterDataChangeListener(listener) {
1612        const pos = this.n10.indexOf(listener);
1613        if (pos >= 0) {
1614            this.n10.splice(pos, 1);
1615        }
1616    }
1617
1618    z8() {
1619        this.n10.forEach(listener => {
1620            listener.onDataReloaded();
1621        });
1622    }
1623
1624    o10(index) {
1625        this.n10.forEach(listener => {
1626            listener.onDataAdd(index);
1627        });
1628    }
1629
1630    g9(index) {
1631        if (index === undefined) {
1632            return;
1633        }
1634        this.n10.forEach(listener => {
1635            listener.onDataChange(index);
1636        });
1637    }
1638
1639    p10(index) {
1640        this.n10.forEach(listener => {
1641            listener.onDataDelete(index);
1642        });
1643    }
1644
1645    q10(from, to) {
1646        this.n10.forEach(listener => {
1647            listener.onDataMove(from, to);
1648        });
1649    }
1650}
1651
1652function i(t14, count, u14, v14) {
1653    let taskId = setTimeout(() => {
1654        v14.forEach((parentNodeId) => {
1655            j(parentNodeId, u14, t14, count);
1656        });
1657        clearTimeout(taskId);
1658    }, m2);
1659}
1660
1661function j(parentNodeId, q14, r14, count) {
1662    let s14 = parentNodeId;
1663    while (s14 >= 0) {
1664        if (q14.has(s14)) {
1665            let parent = q14.get(s14);
1666            parent.o6().r10 =
1667                r14 ? parent.o6().r10 + count : parent.o6().r10 - count;
1668            s14 = parent.parentNodeId;
1669        } else {
1670            hilog.error(j16, i16, 'updateParentChildNumHandler: parent node not found');
1671            break;
1672        }
1673    }
1674}
1675
1676function m(n14) {
1677    let taskId = setTimeout(() => {
1678        n14.sort((a, b) => a - b);
1679        clearTimeout(taskId);
1680    }, m2);
1681}
1682
1683class h3 extends g3 {
1684    constructor() {
1685        super();
1686        this.y9 = -1;
1687        this.s10 = new j3(d3);
1688        this.t10 = 50;
1689        this.MAX_CN_LENGTH = 254;
1690        this.MAX_EN_LENGTH = 255;
1691        this.INITIAL_INVALID_VALUE = -1;
1692        this.w7 = [];
1693        this.u10 = [];
1694        this.v10 = new Map();
1695        this.w10 = new Map();
1696        this.lastIndex = -1;
1697        this.x10 = -1;
1698        this.y10 = -1;
1699        this.z10 = -1;
1700        this.a11 = new Map();
1701        this.b11 = new Map();
1702        this.c11 = new Map();
1703        this.d11 = false;
1704        this.appEventBus = TreeListenerManager.getInstance().getTreeListener();
1705        this.e11 = false;
1706        this.f11 = false;
1707        this.g11 = this.INITIAL_INVALID_VALUE;
1708        this.h11 = this.INITIAL_INVALID_VALUE;
1709        this.i11 = null;
1710        this.j11 = 1;
1711        this.k11 = this.INITIAL_INVALID_VALUE;
1712        this.l11 = this.INITIAL_INVALID_VALUE;
1713        this.n11 = this.INITIAL_INVALID_VALUE;
1714        this.o11 = this.INITIAL_INVALID_VALUE;
1715        this.p11 = this.INITIAL_INVALID_VALUE;
1716        this.q11 = this.INITIAL_INVALID_VALUE;
1717        this.r11 = this.INITIAL_INVALID_VALUE;
1718        this.s11 = this.INITIAL_INVALID_VALUE;
1719        this.t11 = this.INITIAL_INVALID_VALUE;
1720        this.u11 = this.INITIAL_INVALID_VALUE;
1721        this.v11 = this.INITIAL_INVALID_VALUE;
1722        this.w11 = this.INITIAL_INVALID_VALUE;
1723        this.x11 = new Map();
1724        this.flag = w2.NONE;
1725        this.y11 = this.INITIAL_INVALID_VALUE;
1726        this.z11 = '';
1727        this.a12 = '';
1728        this.b12 = this.INITIAL_INVALID_VALUE;
1729        this.c12 = this.INITIAL_INVALID_VALUE;
1730        this.d12 = this.INITIAL_INVALID_VALUE;
1731        this.treeViewTheme = e3.getInstance();
1732        this.e12 = [];
1733        this.f12 = {
1734            g12: s1,
1735            h12: {
1736                'id': -1,
1737                'type': 10001,
1738                params: ['sys.color.ohos_id_color_emphasize'],
1739                'bundleName': '__harDefaultBundleName__',
1740                'moduleName': '__harDefaultModuleName__',
1741            },
1742            xOffset: t1,
1743            i12: u1,
1744            j12: v1,
1745            k12: w1,
1746        };
1747        this.l12 = {
1748            y7: { minWidth: e2, maxWidth: f2 },
1749            d8: {
1750                e8: g2,
1751                g8: h2,
1752                f8: i2,
1753                h8: j2,
1754            },
1755            padding: {
1756                left: {
1757                    'id': -1,
1758                    'type': 10002,
1759                    params: ['sys.float.padding_level4'],
1760                    'bundleName': '__harDefaultBundleName__',
1761                    'moduleName': '__harDefaultModuleName__',
1762                },
1763                right: {
1764                    'id': -1,
1765                    'type': 10002,
1766                    params: ['sys.float.padding_level4'],
1767                    'bundleName': '__harDefaultBundleName__',
1768                    'moduleName': '__harDefaultModuleName__',
1769                }
1770            },
1771            backgroundColor: z1,
1772            height: d2,
1773            shadow: {
1774                radius: {
1775                    'id': -1,
1776                    'type': 10002,
1777                    params: ['sys.float.ohos_id_corner_radius_default_m'],
1778                    'bundleName': '__harDefaultBundleName__',
1779                    'moduleName': '__harDefaultModuleName__',
1780                },
1781                color: c2,
1782                offsetX: 0,
1783                offsetY: j1,
1784            },
1785            borderRadius: {
1786                'id': -1,
1787                'type': 10002,
1788                params: ['sys.float.ohos_id_corner_radius_clicked'],
1789                'bundleName': '__harDefaultBundleName__',
1790                'moduleName': '__harDefaultModuleName__',
1791            },
1792            fontColor: this.treeViewTheme.a4,
1793            fontSize: {
1794                'id': -1,
1795                'type': 10002,
1796                params: ['sys.float.ohos_id_text_size_body1'],
1797                'bundleName': '__harDefaultBundleName__',
1798                'moduleName': '__harDefaultModuleName__',
1799            },
1800            fontWeight: FontWeight.Regular,
1801            b8: {
1802                'id': -1,
1803                'type': 10002,
1804                params: ['sys.float.ohos_id_alpha_content_fourth'],
1805                'bundleName': '__harDefaultBundleName__',
1806                'moduleName': '__harDefaultModuleName__',
1807            }
1808        };
1809        this.subTitle = {
1810            n12: this.treeViewTheme.b4,
1811            o12: {
1812                'id': -1,
1813                'type': 10001,
1814                params: ['sys.color.ohos_id_color_primary_contrary'],
1815                'bundleName': '__harDefaultBundleName__',
1816                'moduleName': '__harDefaultModuleName__',
1817            },
1818            fontSize: {
1819                'id': -1,
1820                'type': 10002,
1821                params: ['sys.float.ohos_id_text_size_body2'],
1822                'bundleName': '__harDefaultBundleName__',
1823                'moduleName': '__harDefaultModuleName__',
1824            },
1825            fontWeight: FontWeight.Regular,
1826            margin: {
1827                left: {
1828                    'id': -1,
1829                    'type': 10002,
1830                    params: ['sys.float.padding_level2'],
1831                    'bundleName': '__harDefaultBundleName__',
1832                    'moduleName': '__harDefaultModuleName__',
1833                },
1834                right: {
1835                    'id': -1,
1836                    'type': 10002,
1837                    params: ['sys.float.padding_level12'],
1838                    'bundleName': '__harDefaultBundleName__',
1839                    'moduleName': '__harDefaultModuleName__',
1840                }
1841            }
1842        };
1843        this.s10.b5 = -1;
1844        this.v10.set(-1, this.s10);
1845        this.w10.set(-1, d3);
1846    }
1847
1848    p12(index) {
1849        if (index < 0 || index >= this.w7.length) {
1850            hilog.error(j16, i16, 'check index fail');
1851            return false;
1852        }
1853        return true;
1854    }
1855
1856    q12(index, color) {
1857        if (!this.p12(index)) {
1858            return;
1859        }
1860        this.w7[index].a6(color);
1861        this.w7[index].n6(false);
1862    }
1863
1864    b6(index) {
1865        return this.w7[index].b6();
1866    }
1867
1868    r12(index, m14) {
1869        if (this.w7[index].j6()) {
1870            this.w7[index].n6(m14);
1871        }
1872    }
1873
1874    i8(index, k14) {
1875        if (!this.p12(index)) {
1876            return;
1877        }
1878        let l14 = this.w7[index];
1879        l14.r6(k14 === a3.SELECTED ||
1880            k14 === a3.EDIT || k14 === a3.FINISH_EDIT);
1881        if (l14.k6().w3 !== null && k14 !== a3.DRAG_INSERT &&
1882            k14 !== a3.FINISH_DRAG_INSERT) {
1883            l14.k6().w3?.j8(k14 === a3.SELECTED ||
1884                k14 === a3.FINISH_EDIT);
1885        }
1886        if (l14.k6().v3 !== null) {
1887            l14.k6().v3?.i8(k14);
1888        }
1889    }
1890
1891    s12(index, i14) {
1892        let j14 = this.w7[index];
1893        if (j14.k6().x3 !== undefined) {
1894            j14.k6().x3 = q3.t12(i14, this.a11.get(j14.e6()), j14.k6().x3?.type);
1895        }
1896    }
1897
1898    u12() {
1899        if (!this.p12(this.lastIndex)) {
1900            return;
1901        }
1902        this.i8(this.lastIndex, a3.NORMAL);
1903        this.q12(this.lastIndex, this.w7[this.lastIndex].l6().normal);
1904        this.r12(this.lastIndex, false);
1905        this.g9(this.b11.get(this.w7[this.lastIndex].e6()));
1906    }
1907
1908    v12() {
1909        let index = 0;
1910        this.b11.clear();
1911        this.c11.clear();
1912        this.u10.splice(0, this.u10.length);
1913        for (let h14 = 0; h14 < this.w7.length; h14++) {
1914            this.c11.set(this.w7[h14].e6(), h14);
1915            if (this.w7[h14].j6()) {
1916                this.b11.set(this.w7[h14].e6(), index++);
1917                this.u10.push(this.w7[h14]);
1918            }
1919        }
1920    }
1921
1922    w12(e14) {
1923        if (e14 >= this.w7.length) {
1924            hilog.error(j16, i16, 'changeNodeStatus clickIndex error.');
1925            return;
1926        }
1927        let f14 = e14;
1928        let g14 = this.w7[e14].e6();
1929        if (this.a11.get(g14) === z2.EXPAND) {
1930            this.a11.set(g14, z2.COLLAPSE);
1931            this.w7[f14].k6().x3 = q3.x12(z2.COLLAPSE, this.w7[f14].k6().x3?.y12);
1932        } else if (this.a11.get(g14) === z2.COLLAPSE) {
1933            this.a11.set(g14, z2.EXPAND);
1934            this.w7[f14].k6().x3 = q3.x12(z2.EXPAND, this.w7[f14].k6().x3?.y12);
1935        }
1936    }
1937
1938    z12(v13, w13) {
1939        if (v13 >= this.w7.length) {
1940            hilog.error(j16, i16, 'handleExpandAndCollapse clickIndex error.');
1941            return;
1942        }
1943        let x13 = v13;
1944        let y13 = this.w7[x13].e6();
1945        if (!this.a11.has(y13)) {
1946            return;
1947        }
1948        let z13 = this.a11.get(y13);
1949        if (this.w7[x13].o6().a13 && z13 === z2.COLLAPSE) {
1950            for (let d14 = 0; d14 < this.w7[x13].o6().r10; d14++) {
1951                if (this.w7[x13 + 1 + d14] === undefined) {
1952                    return;
1953                }
1954                this.w7[x13 + 1 + d14].i6(false);
1955                this.w7[x13 + 1 + d14].c6(h1);
1956            }
1957            this.v12();
1958            this.z8();
1959            return;
1960        }
1961        let a14 = new Array(this.w7[x13].o6().b13);
1962        a14[0] = x13 + 1;
1963        let index = 1;
1964        while (index < this.w7[x13].o6().b13) {
1965            a14[index] = a14[index - 1] + this.w7[a14[index - 1]].o6().r10 + 1;
1966            index++;
1967        }
1968        if (z13 === z2.EXPAND) {
1969            for (let b14 = 0; b14 < a14.length; b14++) {
1970                if (this.w7[a14[b14]] === undefined) {
1971                    return;
1972                }
1973                this.w7[a14[b14]].i6(true);
1974                this.w7[a14[b14]].c6(i1);
1975                let c14 = this.w7[a14[b14]].e6();
1976                if (this.a11.get(c14) === z2.EXPAND) {
1977                    this.z12(a14[b14], false);
1978                }
1979            }
1980        }
1981        a14 = null;
1982        if (w13) {
1983            this.v12();
1984            this.z8();
1985        }
1986    }
1987
1988    m10() {
1989        i(true, 1, this.v10, this.e12);
1990    }
1991
1992    c13(u13) {
1993        u13.splice(0, u13.length);
1994        this.b11.clear();
1995        this.u10.splice(0, this.u10.length);
1996        this.c11.clear();
1997        this.x11.clear();
1998    }
1999
2000    d13(o13, p13, q13) {
2001        let index = 0;
2002        let r13 = 0;
2003        this.c13(o13);
2004        try {
2005            this.e13((node) => {
2006                if (node.f13() >= 0 && this.w10.has(node.f13())) {
2007                    let t13 = new f3(node, this.w10.get(node.f13()));
2008                    t13.m5(node.o6().a13);
2009                    o13.push(t13);
2010                    this.c11.set(t13.e6(), r13++);
2011                    index = this.g13(t13, index);
2012                }
2013                return false;
2014            }, this.s10, p13, q13);
2015        } catch (err) {
2016            hilog.error(j16, i16, 'traverseSectionNodeDF function callbacks error.');
2017            this.c13(o13);
2018        }
2019    }
2020
2021    g13(n13, index) {
2022        if (n13.o6().a13) {
2023            this.a11.set(n13.e6(), z2.COLLAPSE);
2024        }
2025        if (n13.j6()) {
2026            this.b11.set(n13.e6(), index++);
2027            this.u10.push(n13);
2028        }
2029        if (n13.v6()) {
2030            if (n13.t6().secondaryTitle !== undefined) {
2031                this.x11.set(n13.e6(), n13.t6().secondaryTitle);
2032            } else {
2033                this.x11.set(n13.e6(), '');
2034            }
2035        }
2036        return index;
2037    }
2038
2039    l10() {
2040        let j13 = setTimeout(() => {
2041            let l13 = [];
2042            this.d13(l13, 0);
2043            this.w7.splice(0, this.w7.length);
2044            this.w7.push(...l13);
2045            this.w7.forEach((value, index) => {
2046                this.p10(index);
2047                this.o10(index);
2048            });
2049            clearTimeout(j13);
2050        }, m2);
2051    }
2052
2053    k10() {
2054        this.d13(this.w7, 0, 1);
2055    }
2056
2057    h13(b13, c13) {
2058        let d13 = [];
2059        if (b13.length === 0) {
2060            return;
2061        }
2062        let startIndex = undefined;
2063        for (let g13 = 0; g13 < b13.length; g13++) {
2064            if (this.b11.has(b13[g13])) {
2065                let i13 = this.b11.get(b13[g13]);
2066                d13.push(i13);
2067            }
2068            if (startIndex === undefined && this.c11.has(b13[g13])) {
2069                startIndex = this.c11.get(b13[g13]);
2070            }
2071            if (startIndex !== undefined) {
2072                let h13 = this.w7.splice(startIndex, 1);
2073                h13 = null;
2074            }
2075            if (this.a11.has(b13[g13])) {
2076                this.a11.delete(b13[g13]);
2077            }
2078        }
2079        d13.forEach((value) => {
2080            this.p10(value);
2081            this.g9(value);
2082        });
2083        if (c13.k6().x3 === null) {
2084            if (this.c11.has(c13.e6())) {
2085                let f13 = this.c11.get(c13.e6());
2086                this.w7[f13]?.z5(false);
2087            }
2088            this.a11.delete(c13.e6());
2089            this.g9(this.b11.get(c13.e6()));
2090        }
2091        let callbackParam = {
2092            currentNodeId: c13.e6(),
2093            parentNodeId: c13.f6(),
2094        };
2095        this.v12();
2096        this.appEventBus.emit(TreeListenType.NODE_DELETE, callbackParam);
2097    }
2098
2099    i13(y12) {
2100        let z12 = new f3(new j3(d3), d3);
2101        if (this.v10.has(y12[0])) {
2102            let node = this.v10.get(y12[0]);
2103            z12 = new f3(node, this.w10.get(y12[0]));
2104            z12.m5(node.o6().a13);
2105        }
2106        z12.h7(true);
2107        let index = 0;
2108        for (let a13 = 0; a13 < this.w7.length; a13++) {
2109            if (this.w7[a13].e6() === z12.f6()) {
2110                index = a13;
2111                if (this.w7[a13].k6().x3 === null) {
2112                    this.w7[a13].z5(true);
2113                    this.g9(index);
2114                } else if (this.a11.get(this.w7[a13].e6()) === z2.COLLAPSE) {
2115                    this.w12(index);
2116                }
2117                this.w7.splice(a13 + 1, 0, z12);
2118                this.w7[a13 + 1].y5(true);
2119                this.w7[a13 + 1].i6(true);
2120                this.w7[a13 + 1].c6(i1);
2121                this.c11.set(y12[0], a13 + 1);
2122                this.i8(a13 + 1, a3.EDIT);
2123                this.j13 = t2.ADD_NODE;
2124                this.o10(a13 + 1);
2125                this.k13(a13 + 1, this.j13);
2126                break;
2127            }
2128        }
2129        this.y10 = index + 1;
2130        this.h9(index);
2131        this.lastIndex = index;
2132        this.a11.set(z12.f6(), z2.EXPAND);
2133        this.z12(index, true);
2134    }
2135
2136    g10(operation, parentNodeId, v12) {
2137        let w12 = new f3(new j3(d3), d3);
2138        if (this.v10.has(parentNodeId)) {
2139            let x12 = this.v10.get(parentNodeId);
2140            w12 = new f3(x12, this.w10.get(parentNodeId));
2141            w12.m5(x12.o6().a13);
2142        }
2143        if (operation === t2.REMOVE_NODE) {
2144            this.x11.set(parentNodeId, this.z11);
2145            this.g9(this.b11.get(parentNodeId));
2146            this.h13(v12, w12);
2147        }
2148        if (operation === t2.ADD_NODE) {
2149            this.d12 = v12[0];
2150            this.x11.set(this.c10(), this.z11);
2151            this.x11.set(v12[0], this.a12);
2152            this.i13(v12);
2153        }
2154    }
2155
2156    h9(index) {
2157        this.x10 = index;
2158    }
2159
2160    c10() {
2161        if (!this.p12(this.x10)) {
2162            return -1;
2163        }
2164        return this.w7[this.x10].e6();
2165    }
2166
2167    k9(u12) {
2168        this.w12(u12);
2169        this.z12(u12, true);
2170    }
2171
2172    l13() {
2173        return this.d11;
2174    }
2175
2176    u9() {
2177        return this.lastIndex;
2178    }
2179
2180    findIndex(currentNodeId) {
2181        let t12 = -1;
2182        if (this.c11.has(currentNodeId)) {
2183            t12 = this.c11.get(currentNodeId);
2184        }
2185        return t12;
2186    }
2187
2188    n13(index) {
2189        if (!this.p12(index)) {
2190            return;
2191        }
2192        this.i8(index, a3.NORMAL);
2193        this.q12(index, this.w7[index].l6().normal);
2194        this.r12(index, false);
2195        this.g9(this.b11.get(this.w7[index].e6()));
2196    }
2197
2198    i9(event, index) {
2199        if (this.f11) {
2200            return;
2201        }
2202        if (!this.p12(index)) {
2203            return;
2204        }
2205        if (event === Event.TOUCH_DOWN || event === Event.TOUCH_UP || event === Event.MOUSE_BUTTON_RIGHT) {
2206            if (index !== this.lastIndex) {
2207                this.u12();
2208            }
2209        }
2210        this.o13(index, event);
2211    }
2212
2213    o13(index, event) {
2214        let r12 = this.b11.get(this.w7[index].e6());
2215        switch (event) {
2216            case Event.TOUCH_DOWN:
2217                this.d11 = true;
2218                this.q12(index, this.w7[index].l6().i5);
2219                this.g9(r12);
2220                break;
2221            case Event.TOUCH_UP: {
2222                this.p13(index, r12);
2223                break;
2224            }
2225            case Event.HOVER:
2226                if (this.b6(index) !== this.w7[index].l6().selected) {
2227                    this.q12(index, this.w7[index].l6().h5);
2228                    this.g9(r12);
2229                }
2230                break;
2231            case Event.HOVER_OVER:
2232                if (this.b6(index) !== this.w7[index].l6().selected) {
2233                    this.q12(index, this.w7[index].l6().normal);
2234                    this.g9(r12);
2235                }
2236                break;
2237            case Event.FOCUS:
2238                this.r12(index, true);
2239                this.g9(r12);
2240                break;
2241            case Event.BLUR:
2242                this.r12(index, false);
2243                this.g9(r12);
2244                break;
2245            case Event.MOUSE_BUTTON_RIGHT:
2246                this.lastIndex = index;
2247                this.q13();
2248                break;
2249            case Event.DRAG:
2250                this.d11 = false;
2251                let s12 = this.w7[index];
2252                this.i8(index, a3.SELECTED);
2253                this.lastIndex = index;
2254                this.q12(index, s12.l6().selected);
2255                this.g9(r12);
2256                break;
2257            default:
2258                break;
2259        }
2260    }
2261
2262    p13(index, p12) {
2263        if (this.e11) {
2264            this.e11 = false;
2265        }
2266        this.d11 = false;
2267        let q12 = this.w7[index];
2268        this.i8(index, a3.SELECTED);
2269        q12.o5(this.treeViewTheme.a4);
2270        this.lastIndex = index;
2271        this.q12(index, q12.l6().selected);
2272        this.g9(p12);
2273    }
2274
2275    k13(l12, operation) {
2276        if (operation === t2.MODIFY_NODE) {
2277            let n12 = this.w7[this.y10];
2278            let o12 = {
2279                currentNodeId: n12?.e6(),
2280                parentNodeId: n12?.f6(),
2281            };
2282            this.appEventBus.emit(TreeListenType.NODE_MODIFY, o12);
2283        } else if (operation === t2.ADD_NODE) {
2284            let m12 = this.w7[l12];
2285            if (m12 === undefined) {
2286                return;
2287            }
2288            let icon = (m12.k6().v3 !== undefined) ?
2289                m12.k6().v3?.source : undefined;
2290            let selectedIcon = (m12.k6().v3 !== undefined) ?
2291                m12.k6().v3?.r13 : undefined;
2292            let editIcon = (m12.k6().v3 !== undefined) ?
2293                m12.k6().v3?.s13 : undefined;
2294            let callbackParam = {
2295                currentNodeId: m12?.e6(),
2296                parentNodeId: m12?.f6(),
2297            };
2298            this.appEventBus.emit(TreeListenType.NODE_ADD, callbackParam);
2299        }
2300    }
2301
2302    q13() {
2303        if (this.y10 !== -1) {
2304            this.i8(this.y10, a3.FINISH_EDIT);
2305            this.s12(this.y10, a3.FINISH_EDIT);
2306            this.w7[this.y10].h7(false);
2307            this.w7[this.y10].y5(false);
2308            this.k13(this.y10, this.j13);
2309            this.g9(this.y10);
2310        }
2311    }
2312
2313    w9(h12, operation) {
2314        let index = -1;
2315        if (h12 === -1) {
2316            return;
2317        }
2318        if (operation === t2.MODIFY_NODE) {
2319            for (let k12 = 0; k12 < this.w7.length; k12++) {
2320                if (this.w7[k12]?.e6() === h12) {
2321                    index = k12;
2322                    break;
2323                }
2324            }
2325            let j12 = this.w7[index];
2326            if (j12 === undefined) {
2327                return;
2328            }
2329            j12.h7(true);
2330            if (j12.k6().w3 === null) {
2331                return;
2332            }
2333            this.j13 = t2.MODIFY_NODE;
2334            j12.y5(true);
2335            this.i8(index, a3.EDIT);
2336            this.s12(index, a3.EDIT);
2337            this.y10 = index;
2338            if (j12.k6().inputText) {
2339                if (j12.k6().x3 !== null) {
2340                    j12.k6().inputText.rightMargin = {
2341                        'id': -1,
2342                        'type': 10002,
2343                        params: ['sys.float.ohos_id_text_paragraph_margin_xs'],
2344                        'bundleName': '__harDefaultBundleName__',
2345                        'moduleName': '__harDefaultModuleName__',
2346                    };
2347                } else {
2348                    j12.k6().inputText.rightMargin = {
2349                        'id': -1,
2350                        'type': 10002,
2351                        params: ['sys.float.ohos_id_elements_margin_horizontal_m'],
2352                        'bundleName': '__harDefaultBundleName__',
2353                        'moduleName': '__harDefaultModuleName__',
2354                    };
2355                }
2356            }
2357            this.g9(this.b11.get(h12));
2358        }
2359        index = h12;
2360        if (operation === t2.COMMIT_NODE) {
2361            let i12 = this.w7[index];
2362            if (i12 === undefined) {
2363                return;
2364            }
2365            i12.y5(false);
2366            i12.h7(false);
2367            this.i8(index, a3.FINISH_EDIT);
2368            this.s12(index, a3.FINISH_EDIT);
2369            this.k13(this.y10, this.j13);
2370            this.g9(this.b11.get(i12?.e6()));
2371        }
2372    }
2373
2374    v9(d12, e12, isShow, index) {
2375        if (!this.p12(index)) {
2376            return;
2377        }
2378        let f12 = this.w7[index];
2379        if (f12 === undefined) {
2380            return;
2381        }
2382        f12.r5(isShow);
2383        let g12 = this.b11.get(f12.e6());
2384        if (!isShow) {
2385            this.g9(g12);
2386            return;
2387        }
2388        if (d12 === u2.HINTS) {
2389            if (f12.k6().w3 !== null) {
2390                f12.u5(f12.k6().w3?.title);
2391            } else {
2392                f12.u5('');
2393                f12.r5(false);
2394            }
2395            f12.s5(false);
2396            f12.t5({
2397                'id': -1,
2398                'type': 10001,
2399                params: ['sys.color.ohos_id_color_background'],
2400                'bundleName': '__harDefaultBundleName__',
2401                'moduleName': '__harDefaultModuleName__',
2402            });
2403            f12.v5(this.treeViewTheme.b4);
2404        } else if (d12 === u2.WARNINGS) {
2405            if (f12.k6().inputText !== null) {
2406                if (e12 === v2.INVALID_ERROR) {
2407                    f12.u5('invalid error');
2408                } else if (e12 === v2.LENGTH_ERROR) {
2409                    f12.u5('length error');
2410                }
2411                f12.s5(true);
2412                f12.t5({
2413                    'id': -1,
2414                    'type': 10001,
2415                    params: ['sys.color.ohos_id_color_help_tip_bg'],
2416                    'bundleName': '__harDefaultBundleName__',
2417                    'moduleName': '__harDefaultModuleName__',
2418                });
2419                f12.v5({
2420                    'id': -1,
2421                    'type': 10001,
2422                    params: ['sys.color.ohos_id_color_text_hint_contrary'],
2423                    'bundleName': '__harDefaultBundleName__',
2424                    'moduleName': '__harDefaultModuleName__',
2425                });
2426            }
2427        }
2428        this.g9(g12);
2429    }
2430
2431    t13(timeout, index) {
2432        if (!this.p12(index)) {
2433            return;
2434        }
2435        if (this.w7[index].k6().w3 !== null) {
2436            this.w7[index].k6().w3.u13 = timeout;
2437        }
2438        let c12 = this.b11.get(this.w7[index].e6());
2439        this.g9(c12);
2440    }
2441
2442    v13(index, text) {
2443        this.y10 = index;
2444        if (this.w7[index].k6().w3 !== null) {
2445            this.w7[index].k6().w3.title = text;
2446        }
2447    }
2448
2449    totalCount() {
2450        return this.b11.size;
2451    }
2452
2453    getData(index) {
2454        if (index < 0 || index >= this.u10.length) {
2455            return undefined;
2456        }
2457        return this.u10[index];
2458    }
2459
2460    w13(index, data) {
2461        if (!this.p12(index)) {
2462            return;
2463        }
2464        this.w7.splice(index, 0, data);
2465        this.c11.set(data.e6(), index);
2466        this.v12();
2467        this.o10(index);
2468    }
2469
2470    x13(data) {
2471        this.w7.push(data);
2472        this.c11.set(data.e6(), this.w7.length);
2473        this.v12();
2474        this.o10(this.w7.length - 1);
2475    }
2476
2477    b9(b12) {
2478        this.e11 = b12;
2479    }
2480
2481    l8() {
2482        return this.e11;
2483    }
2484
2485    u8(a12) {
2486        this.f11 = a12;
2487    }
2488
2489    a9() {
2490        return this.f11;
2491    }
2492
2493    r9(z11) {
2494        if (z11 === undefined) {
2495            return;
2496        }
2497        this.i11 = z11;
2498    }
2499
2500    e9() {
2501        return this.i11;
2502    }
2503
2504    t9(y11) {
2505        if (y11 === undefined) {
2506            return;
2507        }
2508        this.h11 = y11;
2509    }
2510
2511    f9() {
2512        return this.h11;
2513    }
2514
2515    s8() {
2516        return this.g11;
2517    }
2518
2519    s9(x11) {
2520        if (x11 === undefined) {
2521            return;
2522        }
2523        this.g11 = x11;
2524    }
2525
2526    v8(w11) {
2527        this.j11 = w11;
2528    }
2529
2530    y13(item) {
2531        return item.e6() === this.s8() ? this.j11 : 1;
2532    }
2533
2534    x7() {
2535        return this.l12;
2536    }
2537
2538    q8(v11) {
2539        this.k11 = v11;
2540    }
2541
2542    k8() {
2543        return this.k11;
2544    }
2545
2546    m8(s11) {
2547        if (this.i11 === null || s11 === undefined) {
2548            return false;
2549        }
2550        let t11 = this.i11.u6();
2551        let parentId = t11.currentNodeId;
2552        let u11 = this.v10.get(s11)?.parentNodeId;
2553        while (u11 !== undefined && u11 !== -1) {
2554            if (parentId === u11) {
2555                return true;
2556            } else {
2557                u11 = this.v10.get(u11)?.parentNodeId;
2558            }
2559        }
2560        return false;
2561    }
2562
2563    n8(r11) {
2564        this.n11 = r11;
2565    }
2566
2567    z13() {
2568        return this.n11;
2569    }
2570
2571    o8(currentIndex) {
2572        if (this.l11 !== this.INITIAL_INVALID_VALUE && this.b11.has(this.l11)) {
2573            let index = this.b11.get(this.l11);
2574            this.w7.forEach((value) => {
2575                if (value.e6() === this.l11) {
2576                    value.w6(false);
2577                    return;
2578                }
2579            });
2580            this.g9(index);
2581        }
2582        if ((this.t11 !== this.INITIAL_INVALID_VALUE &&
2583            this.u11 !== this.t11)) {
2584            clearTimeout(this.t11);
2585            if (this.v11 !== this.INITIAL_INVALID_VALUE) {
2586                this.a14(this.v11);
2587                let index = this.b11
2588                    .get(this.w7[this.v11].e6());
2589                this.g9(index);
2590            }
2591            this.u11 = this.t11;
2592        }
2593        this.t11 = this.s11;
2594        this.v11 = currentIndex;
2595        if ((this.q11 !== this.INITIAL_INVALID_VALUE &&
2596            this.r11 !== this.q11)) {
2597            clearTimeout(this.q11);
2598            this.r11 = this.q11;
2599        }
2600        this.q11 = this.p11;
2601        this.o11 = this.INITIAL_INVALID_VALUE;
2602    }
2603
2604    a14(currentIndex) {
2605        if (!this.p12(currentIndex)) {
2606            return;
2607        }
2608        this.q12(currentIndex, this.w7[currentIndex].l6().normal);
2609        this.b14(currentIndex, false);
2610        this.i8(currentIndex, a3.FINISH_DRAG_INSERT);
2611        this.s12(currentIndex, a3.FINISH_DRAG_INSERT);
2612        this.w7[currentIndex].f7(false);
2613    }
2614
2615    b14(index, p11) {
2616        if (this.w7[index].k6().w3 && this.w7[index].w5()) {
2617            this.w7[index].k6().w3?.q9(p11);
2618        }
2619    }
2620
2621    r8(flag, index, k11) {
2622        let l11 = (this.n11 !== index || this.flag !== flag) ? true : false;
2623        this.n11 = index;
2624        if ((l11 || k11) && this.e11) {
2625            this.flag = flag;
2626            let currentNodeId = this.getData(index)?.e6();
2627            let m11 = this.getData(index)?.a7();
2628            if (currentNodeId !== undefined) {
2629                m11 = (this.a11.get(currentNodeId) === z2.EXPAND &&
2630                    this.flag === w2.DOWN_FLAG) ? (m11 ? m11 + 1 : undefined) : m11;
2631                if (this.l11 !== this.INITIAL_INVALID_VALUE && this.b11.has(this.l11)) {
2632                    let n11 = this.b11.get(this.l11);
2633                    this.w7.forEach((value) => {
2634                        if (value.e6() === this.l11) {
2635                            value.w6(false);
2636                        }
2637                    });
2638                    this.g9(n11);
2639                }
2640                if (this.flag === w2.DOWN_FLAG && index < this.totalCount() - 1) {
2641                    this.getData(index)?.w6(false);
2642                    this.getData(index + 1)?.w6(true);
2643                    this.getData(index)?.d7(false);
2644                    this.getData(index + 1)?.y6(m11);
2645                    this.g9(index);
2646                    this.g9(index + 1);
2647                    this.l11 = this.getData(index + 1)?.e6();
2648                } else if (this.flag === w2.UP_FLAG && index < this.totalCount() - 1) {
2649                    this.getData(index)?.w6(true);
2650                    this.getData(index + 1)?.w6(false);
2651                    this.getData(index)?.d7(false);
2652                    this.getData(index)?.y6(m11);
2653                    this.g9(index);
2654                    this.g9(index + 1);
2655                    this.l11 = this.getData(index)?.e6();
2656                } else if (index >= this.totalCount() - 1) {
2657                    if (this.flag === w2.DOWN_FLAG) {
2658                        this.getData(index)?.w6(false);
2659                        this.getData(index)?.d7(true);
2660                    } else {
2661                        this.getData(index)?.w6(true);
2662                        this.getData(index)?.d7(false);
2663                    }
2664                    this.getData(index)?.y6(m11);
2665                    this.g9(index);
2666                    this.l11 = this.getData(index)?.e6();
2667                }
2668            }
2669        }
2670    }
2671
2672    t8(currentIndex, currentNodeId, b11) {
2673        let c11 = currentIndex !== this.o11 ? true : false;
2674        let d11 = this.getData(b11)?.c7();
2675        if (d11) {
2676            this.o11 = this.INITIAL_INVALID_VALUE;
2677        } else {
2678            this.o11 = currentIndex;
2679        }
2680        if (d11 || c11) {
2681            let e11 = !d11 && (!this.e11 ||
2682                (this.a11.get(currentNodeId) === z2.COLLAPSE && this.e11) ||
2683                (!this.a11.has(currentNodeId) && this.w7[currentIndex].v6()));
2684            if (e11) {
2685                this.q12(currentIndex, this.w7[currentIndex].l6().h5);
2686                this.g9(b11);
2687                let i11 = this.e11 ? 1000 : 0;
2688                this.s11 = setTimeout(() => {
2689                    this.c14(currentIndex);
2690                }, i11);
2691            }
2692            if (d11 || (this.t11 !== this.INITIAL_INVALID_VALUE &&
2693                this.u11 !== this.t11)) {
2694                clearTimeout(this.t11);
2695                if (this.v11 !== this.INITIAL_INVALID_VALUE) {
2696                    this.a14(this.v11);
2697                    this.z8();
2698                }
2699                this.u11 = this.t11;
2700            }
2701            this.t11 = this.s11;
2702            this.v11 = currentIndex;
2703            if (!d11 && this.a11.get(currentNodeId) === z2.COLLAPSE) {
2704                let f11 = this.getData(b11)?.u6().children[0]?.currentNodeId;
2705                let g11 = 2000;
2706                this.p11 = setTimeout(() => {
2707                    this.a14(this.v11);
2708                    if (f11 !== undefined) {
2709                        this.d14(currentIndex, f11);
2710                    }
2711                }, g11);
2712            }
2713            if (d11 || (this.q11 !== this.INITIAL_INVALID_VALUE &&
2714                this.r11 !== this.q11)) {
2715                clearTimeout(this.q11);
2716                this.r11 = this.q11;
2717            }
2718            this.q11 = this.p11;
2719        }
2720    }
2721
2722    c14(currentIndex) {
2723        this.w7.forEach((value) => {
2724            if (value.e6() === this.l11) {
2725                value.w6(false);
2726                value.d7(false);
2727                return;
2728            }
2729        });
2730        this.q12(currentIndex, this.w7[currentIndex].l6().j5);
2731        this.w7[currentIndex].f7(true);
2732        this.b14(currentIndex, true);
2733        this.i8(currentIndex, a3.DRAG_INSERT);
2734        this.s12(currentIndex, a3.DRAG_INSERT);
2735        this.z8();
2736    }
2737
2738    d14(currentIndex, x10) {
2739        this.w7.forEach((value) => {
2740            if (value.e6() === this.l11) {
2741                value.w6(false);
2742                value.d7(false);
2743            }
2744        });
2745        this.w7.forEach((value) => {
2746            if (this.e11 && value.e6() === x10) {
2747                value.w6(true);
2748            }
2749        });
2750        this.w12(currentIndex);
2751        this.z12(currentIndex, true);
2752        this.l11 = x10;
2753    }
2754
2755    w8() {
2756        if (this.l11 !== this.INITIAL_INVALID_VALUE && this.b11.has(this.l11)) {
2757            this.w7.forEach((value) => {
2758                if (value.e6() === this.l11) {
2759                    value.w6(false);
2760                    value.d7(false);
2761                    return;
2762                }
2763            });
2764            let index = this.b11.get(this.l11);
2765            this.g9(index);
2766        }
2767    }
2768
2769    x8() {
2770        if (this.t11 !== this.INITIAL_INVALID_VALUE &&
2771            this.u11 !== this.t11) {
2772            clearTimeout(this.t11);
2773            if (this.v11 !== this.INITIAL_INVALID_VALUE) {
2774                this.a14(this.v11);
2775            }
2776        }
2777    }
2778
2779    y8() {
2780        if (this.q11 !== this.INITIAL_INVALID_VALUE &&
2781            this.r11 !== this.q11) {
2782            clearTimeout(this.q11);
2783        }
2784    }
2785
2786    e14(currentNodeId) {
2787        if (this.x11.has(currentNodeId)) {
2788            if (typeof this.x11.get(currentNodeId) === 'number') {
2789                return this.x11.get(currentNodeId)?.toString();
2790            } else {
2791                return this.x11.get(currentNodeId);
2792            }
2793        } else {
2794            return '';
2795        }
2796    }
2797
2798    f14(currentNodeId) {
2799        return this.x11.has(currentNodeId);
2800    }
2801
2802    c9() {
2803        this.v11 = this.INITIAL_INVALID_VALUE;
2804        this.o11 = this.INITIAL_INVALID_VALUE;
2805        this.k11 = this.INITIAL_INVALID_VALUE;
2806        this.g11 = this.INITIAL_INVALID_VALUE;
2807        this.flag = w2.NONE;
2808    }
2809
2810    d9(v10) {
2811        this.x11.set(this.y11, this.z11);
2812        this.x11.set(v10, this.a12);
2813        this.g9(this.b11.get(this.y11));
2814        this.g9(this.b11.get(v10));
2815    }
2816
2817    j10(s10, t10, u10) {
2818        this.y11 = s10;
2819        this.z11 = t10;
2820        this.a12 = u10;
2821    }
2822
2823    g14() {
2824        return this.a12;
2825    }
2826
2827    j9(currentNodeId) {
2828        return this.a11.get(currentNodeId);
2829    }
2830
2831    o9() {
2832        return this.w11;
2833    }
2834
2835    l9() {
2836        this.w7.forEach((value, index) => {
2837            if (index === this.v11) {
2838                this.w11 = value.e6();
2839            }
2840        });
2841    }
2842
2843    n9(q10) {
2844        this.l11 = q10;
2845    }
2846
2847    p9(p10) {
2848        this.v11 = p10;
2849    }
2850
2851    m9(r9, s9, t9, u9, v9) {
2852        let w9 = [];
2853        let parentNodeId = r9;
2854        let currentNodeId = u9;
2855        let nodeParam = v9.t6();
2856        let x9 = null;
2857        let y9 = v9.u6();
2858        let z9 = false;
2859        let a10 = this.INITIAL_INVALID_VALUE;
2860        let b10 = this.INITIAL_INVALID_VALUE;
2861        let c10 = this.flag === w2.DOWN_FLAG ? true : false;
2862        b10 = this.h14(t9, u9);
2863        a10 = this.h14(r9, s9) + 1;
2864        if (r9 !== t9) {
2865            a10 = c10 ? a10 + 1 : a10;
2866        } else {
2867            if (a10 > b10) {
2868                a10 = c10 ? a10 : a10 - 1;
2869            } else {
2870                a10 = c10 ? a10 + 1 : a10;
2871            }
2872        }
2873        for (let o10 = 0; o10 < this.w7.length; o10++) {
2874            if (this.w7[o10].e6() === s9) {
2875                z9 = this.w7[o10].g7();
2876                if (this.flag === w2.DOWN_FLAG && this.a11.get(s9) === z2.EXPAND) {
2877                    parentNodeId = s9;
2878                    a10 = 0;
2879                } else if (this.flag === w2.UP_FLAG && this.a11.get(s9) ===
2880                z2.EXPAND &&
2881                    this.w7[o10].x6() === false) {
2882                    parentNodeId = s9;
2883                    a10 = 0;
2884                } else if (z9) {
2885                    parentNodeId = s9;
2886                    a10 = 0;
2887                }
2888                break;
2889            }
2890        }
2891        let callbackParam = {
2892            currentNodeId: currentNodeId,
2893            parentNodeId: parentNodeId,
2894            childIndex: a10,
2895        };
2896        this.appEventBus.emit(TreeListenType.NODE_MOVE, callbackParam);
2897        w9.push({ parentId: parentNodeId, i14: currentNodeId, data: nodeParam });
2898        let callback = (node, m10) => {
2899            if (node) {
2900                parentNodeId = node.parentNodeId;
2901                currentNodeId = node.currentNodeId;
2902                for (let n10 = 0; n10 < m10.length; n10++) {
2903                    if (m10[n10].e6() === currentNodeId) {
2904                        x9 = m10[n10];
2905                        break;
2906                    }
2907                }
2908                if (x9 === null) {
2909                    return false;
2910                }
2911                let nodeParam = x9.t6();
2912                if (parentNodeId !== t9) {
2913                    w9.push({ parentId: parentNodeId, i14: currentNodeId, data: nodeParam });
2914                }
2915                return false;
2916            }
2917            return false;
2918        };
2919        this.j14(callback, y9, this.w7);
2920        let d10 = this.removeNode(u9, t9);
2921        if (d10.length === 0) {
2922            return;
2923        }
2924        let e10 = s9;
2925        let isAfter = c10;
2926        if (this.a11.get(s9) === z2.EXPAND) {
2927            isAfter = false;
2928            this.w7.forEach((value) => {
2929                if (value.e6() === s9 && value.x6() === false) {
2930                    if (value.u6().children.length) {
2931                        e10 = value.u6().children[0].currentNodeId;
2932                    } else {
2933                        e10 = this.INITIAL_INVALID_VALUE;
2934                    }
2935                }
2936            });
2937        } else if (!this.a11.get(s9) && z9) {
2938            this.a11.set(s9, z2.EXPAND);
2939        }
2940        let f10 = this.k14(w9[0].parentId, w9[0].i14, e10, isAfter, w9[0].data);
2941        if (!f10) {
2942            return;
2943        }
2944        for (let j10 = 1; j10 < w9.length; j10++) {
2945            let k10 = this.addNode(w9[j10].parentId, w9[j10].i14, w9[j10].data, false);
2946            if (!k10) {
2947                return;
2948            }
2949        }
2950        for (let i10 = 0; i10 < this.w7.length; i10++) {
2951            if (this.w7[i10].e6() === t9) {
2952                if (this.w7[i10].k6().x3 === null) {
2953                    this.w7[i10].z5(false);
2954                    this.a11.delete(t9);
2955                    break;
2956                }
2957            }
2958        }
2959        let g10 = [...this.w7];
2960        this.l14(g10);
2961    }
2962
2963    l14(m9) {
2964        let index = 0;
2965        let n9 = 0;
2966        this.w7.splice(0, this.w7.length);
2967        this.b11.clear();
2968        this.u10.splice(0, this.u10.length);
2969        this.n14((node) => {
2970            let currentNodeId = node.currentNodeId;
2971            if (currentNodeId >= 0) {
2972                if (this.w10.has(currentNodeId)) {
2973                    let p9 = new f3(node, this.w10.get(currentNodeId));
2974                    p9.m5(node.o6().a13);
2975                    this.w7.push(p9);
2976                    this.c11.set(p9.e6(), n9++);
2977                    if (this.a11.get(currentNodeId) === z2.EXPAND) {
2978                        p9.k6().x3 = q3.x12(z2.EXPAND, p9.k6().x3?.y12);
2979                    } else if (this.a11.get(currentNodeId) === z2.COLLAPSE) {
2980                        p9.k6().x3 = q3.x12(z2.COLLAPSE, p9.k6().x3?.y12);
2981                    }
2982                    for (let q9 = 0; q9 < m9.length; q9++) {
2983                        if (m9[q9].e6() === p9.e6()) {
2984                            p9.i6(m9[q9].j6());
2985                            p9.c6(m9[q9].d6());
2986                            if (p9.k6().w3 && p9.w5()) {
2987                                p9.k6().w3.title = m9[q9].k6().w3?.title;
2988                            }
2989                            break;
2990                        }
2991                    }
2992                    if (p9.j6()) {
2993                        this.b11.set(p9.e6(), index++);
2994                        this.u10.push(p9);
2995                    }
2996                }
2997            }
2998            return false;
2999        });
3000    }
3001
3002    o14() {
3003        return this.f12;
3004    }
3005
3006    p14(j9) {
3007        let k9 = this.b11.get(j9.e6()) - 1;
3008        if (k9 > this.INITIAL_INVALID_VALUE) {
3009            let l9 = this.getData(k9);
3010            return (j9.x6() === true && !j9.g7() && !l9?.g7()) ?
3011            Visibility.Visible : Visibility.Hidden;
3012        } else {
3013            return (j9.x6() === true && !j9.g7()) ?
3014            Visibility.Visible : Visibility.Hidden;
3015        }
3016    }
3017
3018    q14() {
3019        return this.subTitle;
3020    }
3021
3022    v6(i9) {
3023        if (this.b11.has(i9)) {
3024            return this.getData(this.b11.get(i9))?.v6();
3025        }
3026        return false;
3027    }
3028
3029    r14(h9) {
3030        return h9 ? this.subTitle.o12 : this.treeViewTheme.b4;
3031    }
3032
3033    h14(d9, e9) {
3034        let f9 = this.INITIAL_INVALID_VALUE;
3035        if (this.v10.has(d9)) {
3036            let node = this.v10.get(d9);
3037            if (node.f13() === d9) {
3038                node.children.forEach((value, index) => {
3039                    if (value.f13() === e9) {
3040                        f9 = index;
3041                        return;
3042                    }
3043                });
3044            }
3045        }
3046        return f9;
3047    }
3048
3049    s14(c9) {
3050        this.b12 = c9;
3051    }
3052
3053    t14() {
3054        return this.b12;
3055    }
3056
3057    u14(b9) {
3058        this.c12 = b9;
3059    }
3060
3061    v14() {
3062        return this.c12;
3063    }
3064
3065    w14() {
3066        return this.d12;
3067    }
3068
3069    p8(flag) {
3070        this.flag = flag;
3071    }
3072
3073    n14(callback, root = this.s10) {
3074        let stack = [];
3075        let z8 = false;
3076        stack.unshift(root);
3077        let a9 = stack.shift();
3078        while (!z8 && a9) {
3079            z8 = callback(a9) === true;
3080            if (!z8) {
3081                stack.unshift(...a9.children);
3082                a9 = stack.shift();
3083            }
3084        }
3085    }
3086
3087    e13(callback, root = this.s10, u8, v8) {
3088        let stack = [];
3089        let w8 = false;
3090        let x8 = false;
3091        stack.unshift(root);
3092        let y8 = stack.shift();
3093        while (!w8 && y8) {
3094            try {
3095                if (u8 !== undefined && y8.b5 < u8) {
3096                    x8 = true;
3097                }
3098                if (v8 !== undefined && y8.b5 > v8) {
3099                    x8 = true;
3100                }
3101                if (!x8) {
3102                    w8 = callback(y8);
3103                }
3104            } catch (err) {
3105                throw new Error('traverseSectionNodeDF function callbacks error');
3106            }
3107            if (!w8) {
3108                stack.unshift(...y8.children);
3109                y8 = stack.shift();
3110                x8 = false;
3111            }
3112        }
3113    }
3114
3115    x14(s8, t8, count) {
3116        let parentNodeId = s8.parentNodeId;
3117        while (parentNodeId >= 0) {
3118            if (this.v10.has(parentNodeId)) {
3119                let parent = this.v10.get(parentNodeId);
3120                parent.o6().r10 =
3121                    t8 ? parent.o6().r10 + count : parent.o6().r10 - count;
3122                parentNodeId = parent.parentNodeId;
3123            } else {
3124                hilog.error(j16, i16, 'updateParentChildNum: parent node not found.');
3125                break;
3126            }
3127        }
3128    }
3129
3130    f10(currentNodeId) {
3131        let current = new j3(d3);
3132        if (this.v10.has(currentNodeId)) {
3133            current = this.v10.get(currentNodeId);
3134        }
3135        return current.parentNodeId;
3136    }
3137
3138    addNode(parentNodeId, currentNodeId, data, p8) {
3139        if (this.s10 === null) {
3140            this.s10 = new j3(d3);
3141            this.s10.b5 = -1;
3142            this.v10.set(-1, this.s10);
3143            this.w10.set(-1, d3);
3144        }
3145        if (this.v10.has(parentNodeId)) {
3146            let parent = this.v10.get(parentNodeId);
3147            let q8 = new j3(data);
3148            if (parent.b5 > this.t10) {
3149                hilog.error(j16, i16, 'ListDataSource[addNode]: The level of the tree view cannot exceed 50.');
3150                return false;
3151            }
3152            q8.b5 = parent.b5 + 1;
3153            q8.parentNodeId = parentNodeId;
3154            q8.currentNodeId = currentNodeId;
3155            q8.y14 = parent.children.length;
3156            data.parentNodeId = parentNodeId;
3157            data.currentNodeId = currentNodeId;
3158            parent.children.push(q8);
3159            parent.o6().a13 = true;
3160            parent.o6().b13 = parent.children.length;
3161            parent.o6().r10 += 1;
3162            if (p8) {
3163                this.e12.push(parent.parentNodeId);
3164            } else {
3165                let r8 = [];
3166                r8.push(parent.parentNodeId);
3167                i(true, 1, this.v10, r8);
3168            }
3169            this.w10.set(currentNodeId, data);
3170            this.v10.set(currentNodeId, q8);
3171            return true;
3172        } else {
3173            hilog.error(j16, i16, 'ListDataSource[addNode]: Parent node not found.');
3174            return false;
3175        }
3176    }
3177
3178    z14(k8, l8) {
3179        let m8 = [];
3180        let callback = (node) => {
3181            m8.push(node);
3182            return false;
3183        };
3184        this.n14(callback, k8);
3185        m8.forEach((value) => {
3186            l8.push(value.f13());
3187            this.v10.delete(value.f13());
3188            this.w10.delete(value.f13());
3189            value = new j3(d3);
3190        });
3191    }
3192
3193    removeNode(currentNodeId, parentNodeId) {
3194        if (this.v10.has(parentNodeId) && this.v10.has(currentNodeId)) {
3195            let parent = this.v10.get(parentNodeId);
3196            let current = this.v10.get(currentNodeId);
3197            let f8 = [];
3198            let index = current.y14;
3199            let g8 = 0;
3200            if (index < 0) {
3201                hilog.error(j16, i16, 'node does not exist.');
3202                return [];
3203            } else {
3204                g8 = parent.children[index].o6().r10 + 1;
3205                this.z14(parent.children[index], f8);
3206                for (let j8 = index; j8 < parent.children.length; j8++) {
3207                    parent.children[j8].y14 -= 1;
3208                }
3209                let node = parent.children.splice(index, 1);
3210                node = null;
3211                if (parent.children.length === 0) {
3212                    if (this.c11.has(parentNodeId)) {
3213                        let i8 = this.c11.get(parentNodeId);
3214                        this.w7[i8]?.m5(false);
3215                    }
3216                }
3217            }
3218            parent.o6().b13 = parent.children.length;
3219            parent.o6().r10 -= (g8);
3220            let h8 = [];
3221            h8.push(parent.parentNodeId);
3222            i(false, g8, this.v10, h8);
3223            return f8;
3224        } else {
3225            hilog.error(j16, i16, 'parent does not exist.');
3226            return [];
3227        }
3228    }
3229
3230    a15(e8) {
3231        if (e8?.currentNodeId === undefined) {
3232            hilog.error(j16, i16, 'getNodeInfoByNodeItem: currentId is undefined');
3233            return new f3(new j3(d3), d3);
3234        }
3235        if (!this.c11.has(e8.currentNodeId)) {
3236            hilog.error(j16, i16, 'getNodeInfoByNodeItem: not has nodeItem.');
3237            return new f3(new j3(d3), d3);
3238        }
3239        let index = this.c11.get(e8.currentNodeId);
3240        return this.w7[index];
3241    }
3242
3243    h10(a8) {
3244        let parent = new j3(d3);
3245        if (this.v10.has(a8)) {
3246            parent = this.v10.get(a8);
3247        }
3248        let b8 = d3;
3249        if (parent) {
3250            let c8 = this.a15(parent);
3251            if (parent.children.length === 0) {
3252                if (c8.k6().v3 !== undefined) {
3253                    b8.icon = c8.k6().v3?.a8;
3254                    b8.selectedIcon = c8.k6().v3?.r13;
3255                    b8.editIcon = c8.k6().v3?.s13;
3256                    b8.container = c8.q6();
3257                } else {
3258                    b8.icon = undefined;
3259                    b8.selectedIcon = undefined;
3260                    b8.editIcon = undefined;
3261                    b8.container = c8.q6();
3262                }
3263            } else if (parent.children.length > 0) {
3264                let d8 = this.a15(parent.children[0]);
3265                if (c8.k6().v3 !== null) {
3266                    b8.icon = (d8.k6().v3 !== undefined) ?
3267                        d8.k6().v3?.a8 : undefined;
3268                    b8.selectedIcon = (d8.k6().v3 !== undefined) ?
3269                        d8.k6().v3?.r13 : undefined;
3270                    b8.editIcon = (d8.k6().v3 !== undefined) ?
3271                        d8.k6().v3?.s13 : undefined;
3272                    b8.container = d8.q6();
3273                } else {
3274                    b8.icon = undefined;
3275                    b8.selectedIcon = undefined;
3276                    b8.editIcon = undefined;
3277                    b8.container = d8.q6();
3278                }
3279            }
3280        }
3281        return b8;
3282    }
3283
3284    e10(w7) {
3285        let parent = new j3(d3);
3286        if (this.v10.has(w7)) {
3287            parent = this.v10.get(w7);
3288        }
3289        if (parent) {
3290            if (parent.children.length === 0) {
3291                return [];
3292            } else if (parent.children.length > 0) {
3293                let x7 = new Array(parent.children.length);
3294                for (let z7 = 0; z7 < x7.length; z7++) {
3295                    x7[z7] = 0;
3296                }
3297                for (let y7 = 0; y7 < parent.children.length && y7 < x7.length; y7++) {
3298                    x7[y7] = parent.children[y7].currentNodeId;
3299                }
3300                return x7;
3301            }
3302        }
3303        return [];
3304    }
3305
3306    b10(r7) {
3307        let parent = new j3(d3);
3308        if (this.v10.has(r7)) {
3309            parent = this.v10.get(r7);
3310        }
3311        if (parent) {
3312            if (parent.children.length === 0) {
3313                return [];
3314            } else if (parent.children.length > 0) {
3315                let s7 = new Array(parent.children.length);
3316                for (let v7 = 0; v7 < s7.length; v7++) {
3317                    s7[v7] = {};
3318                }
3319                for (let t7 = 0; t7 < parent.children.length && t7 < s7.length; t7++) {
3320                    s7[t7].itemId = parent.children[t7].currentNodeId;
3321                    let u7 = this.a15(parent.children[t7]);
3322                    if (u7.k6().v3) {
3323                        s7[t7].b15 = u7.k6().v3?.source;
3324                    }
3325                    if (u7.k6().w3) {
3326                        s7[t7].c15 = u7.k6().w3?.title;
3327                    }
3328                    s7[t7].isFolder = u7.v6();
3329                }
3330                return s7;
3331            }
3332        }
3333        return [];
3334    }
3335
3336    i10(title) {
3337        if (new RegExp('/[\\\/:*?"<>|]/').test(title)) {
3338            return false;
3339        }
3340        if ((new RegExp('/^[\u4e00-\u9fa5]+$/').test(title) && title.length > this.MAX_CN_LENGTH) ||
3341            (!new RegExp('/^[\u4e00-\u9fa5]+$/').test(title) && title.length > this.MAX_EN_LENGTH)) {
3342            return false;
3343        }
3344        return true;
3345    }
3346
3347    j14(callback, root = this.s10, o7) {
3348        let stack = [];
3349        let p7 = false;
3350        stack.unshift(root);
3351        let q7 = stack.shift();
3352        while (!p7 && q7) {
3353            p7 = callback(q7, o7) === true;
3354            if (!p7) {
3355                stack.unshift(...q7.children);
3356                q7 = stack.shift();
3357            }
3358        }
3359    }
3360
3361    d15(insertIndex, parent) {
3362        for (let n7 = insertIndex; n7 < parent.children.length; n7++) {
3363            parent.children[n7].y14 += 1;
3364        }
3365    }
3366
3367    k14(parentNodeId, currentNodeId, k7, isAfter, data) {
3368        if (this.s10 === null) {
3369            this.s10 = new j3(d3);
3370            this.s10.b5 = this.INITIAL_INVALID_VALUE;
3371        }
3372        if (this.v10.has(parentNodeId)) {
3373            let parent = this.v10.get(parentNodeId);
3374            let l7 = new j3(data);
3375            if (parent.b5 > this.t10) {
3376                hilog.error(j16, i16, 'addDragNode: The level of the tree view cannot exceed 50.');
3377                return false;
3378            }
3379            l7.b5 = parent.b5 + 1;
3380            l7.parentNodeId = parentNodeId;
3381            l7.currentNodeId = currentNodeId;
3382            data.parentNodeId = parentNodeId;
3383            data.currentNodeId = currentNodeId;
3384            let insertIndex = this.INITIAL_INVALID_VALUE;
3385            if (parent.children.length) {
3386                for (let m7 = 0; m7 < parent.children.length; m7++) {
3387                    if (parent.children[m7].f13() === k7) {
3388                        insertIndex = m7;
3389                        break;
3390                    }
3391                }
3392                if (isAfter) {
3393                    l7.y14 = insertIndex + 1;
3394                    this.d15(l7.y14, parent);
3395                    parent.children.splice(insertIndex + 1, 0, l7);
3396                } else {
3397                    l7.y14 = insertIndex < 0 ? parent.children.length + insertIndex : insertIndex;
3398                    this.d15(l7.y14, parent);
3399                    parent.children.splice(insertIndex, 0, l7);
3400                }
3401            } else {
3402                l7.y14 = parent.children.length;
3403                parent.children.push(l7);
3404            }
3405            parent.o6().a13 = true;
3406            parent.o6().b13 = parent.children.length;
3407            parent.o6().r10 += 1;
3408            this.x14(parent, true, 1);
3409            this.v10.set(currentNodeId, l7);
3410            this.w10.set(currentNodeId, data);
3411            return true;
3412        } else {
3413            hilog.error(j16, i16, 'addDragNode: Parent node not found.');
3414            return false;
3415        }
3416    }
3417}
3418
3419export class i3 extends ViewPU {
3420    constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
3421        super(parent, __localStorage, elmtId, extraInfo);
3422        if (typeof paramsLambda === 'function') {
3423            this.paramsGenerator_ = paramsLambda;
3424        }
3425        this.n7 = new SynchedPropertyNesedObjectPU(params.item, this, 'item');
3426        this.listNodeDataSource = new h3();
3427        this.e15 = new ObservedPropertySimplePU(0, this, 'columnWidth');
3428        this.f15 = new ObservedPropertySimplePU(false, this, 'isFocused');
3429        this.g15 = new ObservedPropertySimplePU(-1, this, 'index');
3430        this.h15 = new ObservedPropertySimplePU(-1, this, 'lastIndex');
3431        this.i15 = new ObservedPropertySimplePU(0, this, 'count');
3432        this.r7 = new ObservedPropertySimplePU(false, this, 'followingSystemFontScale');
3433        this.s7 = new ObservedPropertySimplePU(1, this, 'maxAppFontScale');
3434        this.u7 = this.initializeConsume('treeViewTheme', 'treeViewTheme');
3435        this.listTreeViewMenu = undefined;
3436        this.MAX_CN_LENGTH = 254;
3437        this.MAX_EN_LENGTH = 255;
3438        this.INITIAL_INVALID_VALUE = -1;
3439        this.MAX_TOUCH_DOWN_COUNT = 0;
3440        this.isMultiPress = false;
3441        this.touchDownCount = this.INITIAL_INVALID_VALUE;
3442        this.appEventBus = TreeListenerManager.getInstance().getTreeListener();
3443        this.itemPadding = {
3444            left: {
3445                'id': -1,
3446                'type': 10002,
3447                params: ['sys.float.ohos_id_card_margin_start'],
3448                'bundleName': '__harDefaultBundleName__',
3449                'moduleName': '__harDefaultModuleName__',
3450            },
3451            right: {
3452                'id': -1,
3453                'type': 10002,
3454                params: ['sys.float.ohos_id_card_margin_end'],
3455                'bundleName': '__harDefaultBundleName__',
3456                'moduleName': '__harDefaultModuleName__',
3457            },
3458            top: {
3459                'id': -1,
3460                'type': 10002,
3461                params: ['sys.float.ohos_id_text_margin_vertical'],
3462                'bundleName': '__harDefaultBundleName__',
3463                'moduleName': '__harDefaultModuleName__',
3464            },
3465            bottom: {
3466                'id': -1,
3467                'type': 10002,
3468                params: ['sys.float.padding_level0'],
3469                'bundleName': '__harDefaultBundleName__',
3470                'moduleName': '__harDefaultModuleName__',
3471            },
3472        };
3473        this.textInputPadding = {
3474            left: {
3475                'id': -1,
3476                'type': 10002,
3477                params: ['sys.float.padding_level0'],
3478                'bundleName': '__harDefaultBundleName__',
3479                'moduleName': '__harDefaultModuleName__',
3480            },
3481            right: {
3482                'id': -1,
3483                'type': 10002,
3484                params: ['sys.float.padding_level0'],
3485                'bundleName': '__harDefaultBundleName__',
3486                'moduleName': '__harDefaultModuleName__',
3487            },
3488            top: {
3489                'id': -1,
3490                'type': 10002,
3491                params: ['sys.float.padding_level0'],
3492                'bundleName': '__harDefaultBundleName__',
3493                'moduleName': '__harDefaultModuleName__',
3494            },
3495            bottom: {
3496                'id': -1,
3497                'type': 10002,
3498                params: ['sys.float.padding_level0'],
3499                'bundleName': '__harDefaultBundleName__',
3500                'moduleName': '__harDefaultModuleName__',
3501            }
3502        };
3503        this.inputFontSize = resourceManager.getSystemResourceManager().getNumberByName('ohos_id_text_size_body1');
3504        this.setInitiallyProvidedValue(params);
3505        this.finalizeConstruction();
3506    }
3507
3508    setInitiallyProvidedValue(params) {
3509        this.n7.set(params.item);
3510        if (params.listNodeDataSource !== undefined) {
3511            this.listNodeDataSource = params.listNodeDataSource;
3512        }
3513        if (params.columnWidth !== undefined) {
3514            this.columnWidth = params.columnWidth;
3515        }
3516        if (params.isFocused !== undefined) {
3517            this.isFocused = params.isFocused;
3518        }
3519        if (params.index !== undefined) {
3520            this.index = params.index;
3521        }
3522        if (params.lastIndex !== undefined) {
3523            this.lastIndex = params.lastIndex;
3524        }
3525        if (params.count !== undefined) {
3526            this.count = params.count;
3527        }
3528        if (params.followingSystemFontScale !== undefined) {
3529            this.followingSystemFontScale = params.followingSystemFontScale;
3530        }
3531        if (params.maxAppFontScale !== undefined) {
3532            this.maxAppFontScale = params.maxAppFontScale;
3533        }
3534        if (params.listTreeViewMenu !== undefined) {
3535            this.listTreeViewMenu = params.listTreeViewMenu;
3536        }
3537        if (params.MAX_CN_LENGTH !== undefined) {
3538            this.MAX_CN_LENGTH = params.MAX_CN_LENGTH;
3539        }
3540        if (params.MAX_EN_LENGTH !== undefined) {
3541            this.MAX_EN_LENGTH = params.MAX_EN_LENGTH;
3542        }
3543        if (params.INITIAL_INVALID_VALUE !== undefined) {
3544            this.INITIAL_INVALID_VALUE = params.INITIAL_INVALID_VALUE;
3545        }
3546        if (params.MAX_TOUCH_DOWN_COUNT !== undefined) {
3547            this.MAX_TOUCH_DOWN_COUNT = params.MAX_TOUCH_DOWN_COUNT;
3548        }
3549        if (params.isMultiPress !== undefined) {
3550            this.isMultiPress = params.isMultiPress;
3551        }
3552        if (params.touchDownCount !== undefined) {
3553            this.touchDownCount = params.touchDownCount;
3554        }
3555        if (params.appEventBus !== undefined) {
3556            this.appEventBus = params.appEventBus;
3557        }
3558        if (params.itemPadding !== undefined) {
3559            this.itemPadding = params.itemPadding;
3560        }
3561        if (params.textInputPadding !== undefined) {
3562            this.textInputPadding = params.textInputPadding;
3563        }
3564        if (params.inputFontSize !== undefined) {
3565            this.inputFontSize = params.inputFontSize;
3566        }
3567    }
3568
3569    updateStateVars(params) {
3570        this.n7.set(params.item);
3571    }
3572
3573    purgeVariableDependenciesOnElmtId(rmElmtId) {
3574        this.n7.purgeDependencyOnElmtId(rmElmtId);
3575        this.e15.purgeDependencyOnElmtId(rmElmtId);
3576        this.f15.purgeDependencyOnElmtId(rmElmtId);
3577        this.g15.purgeDependencyOnElmtId(rmElmtId);
3578        this.h15.purgeDependencyOnElmtId(rmElmtId);
3579        this.i15.purgeDependencyOnElmtId(rmElmtId);
3580        this.r7.purgeDependencyOnElmtId(rmElmtId);
3581        this.s7.purgeDependencyOnElmtId(rmElmtId);
3582        this.u7.purgeDependencyOnElmtId(rmElmtId);
3583    }
3584
3585    aboutToBeDeleted() {
3586        this.n7.aboutToBeDeleted();
3587        this.e15.aboutToBeDeleted();
3588        this.f15.aboutToBeDeleted();
3589        this.g15.aboutToBeDeleted();
3590        this.h15.aboutToBeDeleted();
3591        this.i15.aboutToBeDeleted();
3592        this.r7.aboutToBeDeleted();
3593        this.s7.aboutToBeDeleted();
3594        this.u7.aboutToBeDeleted();
3595        SubscriberManager.Get().delete(this.id__());
3596        this.aboutToBeDeletedInternal();
3597    }
3598
3599    get item() {
3600        return this.n7.get();
3601    }
3602
3603    get columnWidth() {
3604        return this.e15.get();
3605    }
3606
3607    set columnWidth(newValue) {
3608        this.e15.set(newValue);
3609    }
3610
3611    get isFocused() {
3612        return this.f15.get();
3613    }
3614
3615    set isFocused(newValue) {
3616        this.f15.set(newValue);
3617    }
3618
3619    get index() {
3620        return this.g15.get();
3621    }
3622
3623    set index(newValue) {
3624        this.g15.set(newValue);
3625    }
3626
3627    get lastIndex() {
3628        return this.h15.get();
3629    }
3630
3631    set lastIndex(newValue) {
3632        this.h15.set(newValue);
3633    }
3634
3635    get count() {
3636        return this.i15.get();
3637    }
3638
3639    set count(newValue) {
3640        this.i15.set(newValue);
3641    }
3642
3643    get followingSystemFontScale() {
3644        return this.r7.get();
3645    }
3646
3647    set followingSystemFontScale(newValue) {
3648        this.r7.set(newValue);
3649    }
3650
3651    get maxAppFontScale() {
3652        return this.s7.get();
3653    }
3654
3655    set maxAppFontScale(newValue) {
3656        this.s7.set(newValue);
3657    }
3658
3659    get treeViewTheme() {
3660        return this.u7.get();
3661    }
3662
3663    set treeViewTheme(newValue) {
3664        this.u7.set(newValue);
3665    }
3666
3667    aboutToAppear() {
3668        if (this.item.k6().v3) {
3669            this.item.j4 = this.item.k6().v3?.source;
3670        }
3671        let j7 = this.getUIContext();
3672        this.followingSystemFontScale = j7.isFollowingSystemFontScale();
3673        this.maxAppFontScale = j7.getMaxFontScale();
3674    }
3675
3676    decideFontScale() {
3677        let h7 = this.getUIContext();
3678        let i7 = h7.getHostContext()?.config?.fontSizeScale ?? 1;
3679        if (!this.followingSystemFontScale) {
3680            return 1;
3681        }
3682        return Math.min(i7, this.maxAppFontScale, q1);
3683    }
3684
3685    getInputTextMaxFontSize() {
3686        let g7 = this.decideFontScale() * this.inputFontSize + 'vp';
3687        return g7;
3688    }
3689
3690    getLeftIconColor() {
3691        if (this.item.i7()) {
3692            return {
3693                'id': -1,
3694                'type': 10001,
3695                params: ['sys.color.icon_on_primary'],
3696                'bundleName': '__harDefaultBundleName__',
3697                'moduleName': '__harDefaultModuleName__',
3698            };
3699        } else if (this.item.s6()) {
3700            return this.treeViewTheme.h4;
3701        } else {
3702            return this.treeViewTheme.g4;
3703        }
3704    }
3705
3706    checkInvalidPattern(title) {
3707        return new RegExp('/[\\\/:*?"<>|]/').test(title);
3708    }
3709
3710    checkIsAllCN(title) {
3711        return new RegExp('/^[\u4e00-\u9fa5]+$/').test(title);
3712    }
3713
3714    popupForShowTitle(text, backgroundColor, fontColor, parent = null) {
3715        this.observeComponentCreation2((elmtId, isInitialRender) => {
3716            Row.create();
3717            Row.backgroundColor(backgroundColor);
3718            Row.border({
3719                radius: {
3720                    'id': -1,
3721                    'type': 10002,
3722                    params: ['sys.float.ohos_id_elements_margin_horizontal_l'],
3723                    'bundleName': '__harDefaultBundleName__',
3724                    'moduleName': '__harDefaultModuleName__',
3725                }
3726            });
3727            Row.padding({
3728                left: {
3729                    'id': -1,
3730                    'type': 10002,
3731                    params: ['sys.float.ohos_id_elements_margin_horizontal_l'],
3732                    'bundleName': '__harDefaultBundleName__',
3733                    'moduleName': '__harDefaultModuleName__',
3734                },
3735                right: {
3736                    'id': -1,
3737                    'type': 10002,
3738                    params: ['sys.float.ohos_id_elements_margin_horizontal_l'],
3739                    'bundleName': '__harDefaultBundleName__',
3740                    'moduleName': '__harDefaultModuleName__',
3741                },
3742                top: {
3743                    'id': -1,
3744                    'type': 10002,
3745                    params: ['sys.float.ohos_id_card_margin_middle'],
3746                    'bundleName': '__harDefaultBundleName__',
3747                    'moduleName': '__harDefaultModuleName__',
3748                },
3749                bottom: {
3750                    'id': -1,
3751                    'type': 10002,
3752                    params: ['sys.float.ohos_id_card_margin_middle'],
3753                    'bundleName': '__harDefaultBundleName__',
3754                    'moduleName': '__harDefaultModuleName__',
3755                },
3756            });
3757        }, Row);
3758        this.observeComponentCreation2((elmtId, isInitialRender) => {
3759            Text.create(text);
3760            Text.fontSize({
3761                'id': -1,
3762                'type': 10002,
3763                params: ['sys.float.ohos_id_text_size_body2'],
3764                'bundleName': '__harDefaultBundleName__',
3765                'moduleName': '__harDefaultModuleName__',
3766            });
3767            Text.fontWeight('regular');
3768            Text.fontColor(fontColor);
3769            Text.minFontScale(o1);
3770            Text.maxFontScale(this.decideFontScale());
3771        }, Text);
3772        Text.pop();
3773        Row.pop();
3774    }
3775
3776    builder(parent = null) {
3777        this.observeComponentCreation2((elmtId, isInitialRender) => {
3778            If.create();
3779            if (this.listTreeViewMenu) {
3780                this.ifElseBranchUpdateFunction(0, () => {
3781                    this.listTreeViewMenu.bind(this)();
3782                });
3783            } else {
3784                this.ifElseBranchUpdateFunction(1, () => {
3785                });
3786            }
3787        }, If);
3788        If.pop();
3789    }
3790
3791    initialRender() {
3792        this.observeComponentCreation2((elmtId, isInitialRender) => {
3793            If.create();
3794            if (this.item.j6()) {
3795                this.ifElseBranchUpdateFunction(0, () => {
3796                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3797                        Stack.create();
3798                        ViewStackProcessor.visualState('focused');
3799                        Stack.border({
3800                            radius: {
3801                                'id': -1,
3802                                'type': 10002,
3803                                params: ['sys.float.ohos_id_corner_radius_clicked'],
3804                                'bundleName': '__harDefaultBundleName__',
3805                                'moduleName': '__harDefaultModuleName__',
3806                            },
3807                            width: l1,
3808                            color: this.treeViewTheme.f4,
3809                            style: BorderStyle.Solid,
3810                        });
3811                        ViewStackProcessor.visualState('normal');
3812                        Stack.border({
3813                            radius: {
3814                                'id': -1,
3815                                'type': 10002,
3816                                params: ['sys.float.ohos_id_corner_radius_clicked'],
3817                                'bundleName': '__harDefaultBundleName__',
3818                                'moduleName': '__harDefaultModuleName__',
3819                            },
3820                            width: 0,
3821                        });
3822                        ViewStackProcessor.visualState();
3823                    }, Stack);
3824                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3825                        Column.create();
3826                        Column.opacity(this.listNodeDataSource.y13(ObservedObject.GetRawObject(this.item)));
3827                        Column.onHover((isHover) => {
3828                            if (isHover) {
3829                                this.item.a6(this.treeViewTheme.e4);
3830                            } else {
3831                                this.item.a6({
3832                                    'id': -1,
3833                                    'type': 10001,
3834                                    params: ['sys.color.ohos_id_color_background_transparent'],
3835                                    'bundleName': '__harDefaultBundleName__',
3836                                    'moduleName': '__harDefaultModuleName__',
3837                                });
3838                            }
3839                        });
3840                        Column.onTouch((event) => {
3841                            this.count++;
3842                            if (this.count > 1) {
3843                                this.count--;
3844                                return;
3845                            }
3846                            this.index = this.listNodeDataSource.findIndex(this.item.e6());
3847                            this.listNodeDataSource.h9(this.index);
3848                            let z6 = this.item.e6();
3849                            if (event.type === TouchType.Down) {
3850                                this.item.a6(this.treeViewTheme.d4);
3851                            } else if (event.type === TouchType.Up) {
3852                                if (!(typeof this.treeViewTheme.z3 === 'string')) {
3853                                    this.item.a6(b2);
3854                                } else {
3855                                    this.item.a6(this.treeViewTheme.z3);
3856                                }
3857                                if (this.item.k6().v3 !== null) {
3858                                    this.item.k6().v3?.i8(a3.SELECTED);
3859                                    this.listNodeDataSource.i8(this.index, a3.SELECTED);
3860                                    this.item.j4 = this.item.k6().v3?.source;
3861                                }
3862                                this.item.k6().w3?.j8(true);
3863                                let a7 = { currentNodeId: z6 };
3864                                this.appEventBus.emit(TreeListenType.NODE_CLICK, a7);
3865                            }
3866                            if (this.listNodeDataSource.u9() !== -1 && this.index !== this.listNodeDataSource.u9()) {
3867                                this.listNodeDataSource.v9(u2.WARNINGS, v2.NONE, false, this.listNodeDataSource.u9());
3868                                this.listNodeDataSource.w9(this.listNodeDataSource.u9(), t2.COMMIT_NODE);
3869                            }
3870                            this.lastIndex = this.index;
3871                            this.count--;
3872                        });
3873                        Column.backgroundColor((this.item.k6().w3 && this.item.k6().inputText &&
3874                        this.item.x5()) ? this.item.k6().inputText?.j15 : this.item.b6());
3875                        Column.border({
3876                            width: this.item.m6().borderWidth,
3877                            color: this.item.m6().borderColor,
3878                            radius: this.item.m6().borderRadius,
3879                        });
3880                        Column.height(i1);
3881                        Column.focusable(true);
3882                        Column.onMouse((event) => {
3883                            let y6 = this.listNodeDataSource.findIndex(this.item.e6());
3884                            if (event.button === MouseButton.Right) {
3885                                this.listNodeDataSource.i9(Event.MOUSE_BUTTON_RIGHT,
3886                                    this.listNodeDataSource.findIndex(this.item.e6()));
3887                                this.listTreeViewMenu = this.item.q6();
3888                                this.listNodeDataSource.h9(y6);
3889                                clearTimeout(this.item.k6().w3?.u13);
3890                            }
3891                            event.stopPropagation();
3892                        });
3893                        Column.padding({ top: 0, bottom: 0 });
3894                        Column.bindPopup(this.item.q5().u4, {
3895                            builder: {
3896                                builder: () => {
3897                                    this.popupForShowTitle.call(this, this.item.q5().x4, this.item.q5().w4,
3898                                        this.item.q5().y4);
3899                                }
3900                            },
3901                            placement: Placement.BottomLeft,
3902                            placementOnTop: false,
3903                            popupColor: this.item.q5().w4,
3904                            autoCancel: true,
3905                            enableArrow: this.item.q5().v4
3906                        });
3907                        Column.onAreaChange((oldValue, newValue) => {
3908                            let x6 = Number.parseInt(newValue.width.toString());
3909                            this.columnWidth = x6;
3910                        });
3911                    }, Column);
3912                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3913                        Stack.create({ alignContent: Alignment.Bottom });
3914                        Stack.focusable(true);
3915                    }, Stack);
3916                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3917                        Divider.create();
3918                        Divider.height(this.listNodeDataSource.o14().g12);
3919                        Divider.color(this.listNodeDataSource.o14().h12);
3920                        Divider.visibility(this.listNodeDataSource.p14(ObservedObject.GetRawObject(this.item)));
3921                        Divider.lineCap(LineCapStyle.Round);
3922                        Divider.margin({ start: LengthMetrics.vp(this.item.z6()) });
3923                        Divider.focusable(true);
3924                    }, Divider);
3925                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3926                        Row.create({});
3927                        Row.focusable(true);
3928                        Row.width('100%');
3929                        Gesture.create(GesturePriority.Low);
3930                        TapGesture.create({ count: 2 });
3931                        TapGesture.onAction((event) => {
3932                            this.listNodeDataSource.k9(this.listNodeDataSource.findIndex(this.item.e6()));
3933                        });
3934                        TapGesture.pop();
3935                        Gesture.pop();
3936                        Row.height(this.item.h6());
3937                        Row.padding({ start: LengthMetrics.vp(this.item.g6()) });
3938                        Row.bindContextMenu({ builder: this.builder.bind(this) }, ResponseType.RightClick);
3939                    }, Row);
3940                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3941                        If.create();
3942                        if (this.item.k6().v3) {
3943                            this.ifElseBranchUpdateFunction(0, () => {
3944                                this.observeComponentCreation2((elmtId, isInitialRender) => {
3945                                    Row.create();
3946                                    Row.focusable(true);
3947                                    Row.backgroundColor(a2);
3948                                    Row.margin({
3949                                        end: o(this.item.k6().v3?.z7)
3950                                    });
3951                                    Row.height(this.item.k6().v3?.itemHeight);
3952                                    Row.width(this.item.k6().v3?.itemWidth);
3953                                }, Row);
3954                                this.observeComponentCreation2((elmtId, isInitialRender) => {
3955                                    Image.create(this.item.j4);
3956                                    Image.objectFit(ImageFit.Contain);
3957                                    Image.height(this.item.k6().v3?.itemHeight);
3958                                    Image.width(this.item.k6().v3?.itemWidth);
3959                                    Image.opacity(!this.item.s6() && !this.item.g7() ?
3960                                        this.item.k6().v3?.opacity : this.item.k6().v3?.k15);
3961                                    Image.focusable(this.item.k6().w3 !== null ? false : true);
3962                                    Image.fillColor(this.getLeftIconColor());
3963                                    Image.matchTextDirection((this.item.k6().x3?.c8 === ARROW_RIGHT ||
3964                                        this.item.k6().x3?.c8 === s2) ? true : false);
3965                                }, Image);
3966                                Row.pop();
3967                            });
3968                        } else {
3969                            this.ifElseBranchUpdateFunction(1, () => {
3970                            });
3971                        }
3972                    }, If);
3973                    If.pop();
3974                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3975                        Row.create();
3976                        Row.layoutWeight(1);
3977                        Row.focusable(true);
3978                    }, Row);
3979                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3980                        If.create();
3981                        if (this.item.k6().w3 && this.item.w5()) {
3982                            this.ifElseBranchUpdateFunction(0, () => {
3983                                this.observeComponentCreation2((elmtId, isInitialRender) => {
3984                                    Text.create(this.item.k6().w3?.title);
3985                                    Text.minFontScale(o1);
3986                                    Text.maxFontScale(this.decideFontScale());
3987                                    Text.maxLines(1);
3988                                    Text.fontSize(this.item.k6().w3?.size);
3989                                    Text.fontColor(this.item.s6() ?
3990                                    this.treeViewTheme.c4 : this.treeViewTheme.a4);
3991                                    Text.margin({
3992                                        end: o(this.item.k6().w3?.z7)
3993                                    });
3994                                    Text.textOverflow({ overflow: TextOverflow.Ellipsis });
3995                                    Text.fontWeight(this.item.k6().w3?.weight);
3996                                    Text.focusable(true);
3997                                }, Text);
3998                                Text.pop();
3999                            });
4000                        } else {
4001                            this.ifElseBranchUpdateFunction(1, () => {
4002                            });
4003                        }
4004                    }, If);
4005                    If.pop();
4006                    this.observeComponentCreation2((elmtId, isInitialRender) => {
4007                        If.create();
4008                        if (this.item.k6().w3 && this.item.k6().inputText &&
4009                        this.item.x5()) {
4010                            this.ifElseBranchUpdateFunction(0, () => {
4011                                this.observeComponentCreation2((elmtId, isInitialRender) => {
4012                                    Row.create();
4013                                    Row.backgroundColor(this.item.k6().inputText?.backgroundColor);
4014                                    Row.borderRadius(this.item.k6().inputText?.borderRadius);
4015                                    Row.margin({
4016                                        end: o(this.item.k6()
4017                                            .inputText?.z7)
4018                                    });
4019                                }, Row);
4020                                this.observeComponentCreation2((elmtId, isInitialRender) => {
4021                                    TextInput.create({ text: this.item.k6().w3?.title });
4022                                    TextInput.height(this.item.k6().inputText?.itemHeight);
4023                                    TextInput.fontSize(this.getInputTextMaxFontSize());
4024                                    TextInput.fontColor(this.item.k6().inputText?.color);
4025                                    TextInput.borderRadius(this.item.k6().inputText?.borderRadius);
4026                                    TextInput.backgroundColor(this.item.k6().inputText?.backgroundColor);
4027                                    TextInput.enterKeyType(EnterKeyType.Done);
4028                                    TextInput.focusable(true);
4029                                    TextInput.padding({
4030                                        start: LengthMetrics.resource(this.textInputPadding.left),
4031                                        end: LengthMetrics.resource(this.textInputPadding.right),
4032                                        top: LengthMetrics.resource(this.textInputPadding.top),
4033                                        bottom: LengthMetrics.resource(this.textInputPadding.bottom),
4034                                    });
4035                                    TextInput.onChange((value) => {
4036                                        let g6 = this.listNodeDataSource.findIndex(this.item.e6());
4037                                        let h6 = '';
4038                                        let i6 = false;
4039                                        let j6 = false;
4040                                        if (this.checkInvalidPattern(value)) {
4041                                            for (let k6 = 0; k6 < value.length; k6++) {
4042                                                if (!this.checkInvalidPattern(value[k6])) {
4043                                                    h6 += value[k6];
4044                                                }
4045                                            }
4046                                            i6 = true;
4047                                            this.listNodeDataSource.v9(u2.WARNINGS, v2.INVALID_ERROR, true, g6);
4048                                        } else {
4049                                            h6 = value;
4050                                            i6 = false;
4051                                        }
4052                                        if ((this.checkIsAllCN(h6) && h6.length > this.MAX_CN_LENGTH) ||
4053                                            (!this.checkIsAllCN(h6) && h6.length > this.MAX_EN_LENGTH)) {
4054                                            h6 = this.checkIsAllCN(h6) ?
4055                                            h6.substr(0, this.MAX_CN_LENGTH) : h6.substr(0, this.MAX_EN_LENGTH);
4056                                            j6 = true;
4057                                            this.listNodeDataSource.v9(u2.WARNINGS, v2.LENGTH_ERROR, true, g6);
4058                                        } else {
4059                                            j6 = false;
4060                                        }
4061                                        if (!j6 && !i6) {
4062                                            this.listNodeDataSource.v13(g6, h6);
4063                                        }
4064                                    });
4065                                    TextInput.onSubmit((enterKey) => {
4066                                        let f6 = this.listNodeDataSource.findIndex(this.item.e6());
4067                                        this.listNodeDataSource.v9(u2.WARNINGS, v2.NONE, false, f6);
4068                                        this.listNodeDataSource.w9(f6, t2.COMMIT_NODE);
4069                                    });
4070                                }, TextInput);
4071                                Row.pop();
4072                            });
4073                        } else {
4074                            this.ifElseBranchUpdateFunction(1, () => {
4075                            });
4076                        }
4077                    }, If);
4078                    If.pop();
4079                    this.observeComponentCreation2((elmtId, isInitialRender) => {
4080                        Blank.create();
4081                    }, Blank);
4082                    Blank.pop();
4083                    Row.pop();
4084                    this.observeComponentCreation2((elmtId, isInitialRender) => {
4085                        If.create();
4086                        if (this.listNodeDataSource.f14(this.item.e6())) {
4087                            this.ifElseBranchUpdateFunction(0, () => {
4088                                this.observeComponentCreation2((elmtId, isInitialRender) => {
4089                                    Row.create();
4090                                    Row.focusable(true);
4091                                    Row.margin({
4092                                        start: LengthMetrics.resource(this.listNodeDataSource.q14().margin.left),
4093                                        end: this.item.k6().x3 ?
4094                                        LengthMetrics.resource({
4095                                            'id': -1,
4096                                            'type': 10002,
4097                                            params: ['sys.float.padding_level0'],
4098                                            'bundleName': '__harDefaultBundleName__',
4099                                            'moduleName': '__harDefaultModuleName__',
4100                                        }) : LengthMetrics.resource(this.listNodeDataSource.q14().margin.right)
4101                                    });
4102                                }, Row);
4103                                this.observeComponentCreation2((elmtId, isInitialRender) => {
4104                                    Text.create(this.listNodeDataSource.e14(this.item.e6()));
4105                                    Text.minFontScale(o1);
4106                                    Text.maxFontScale(this.decideFontScale());
4107                                    Text.fontSize(this.listNodeDataSource.q14().fontSize);
4108                                    Text.fontColor(this.item.g7() || this.item.i7() ? {
4109                                        'id': -1,
4110                                        'type': 10001,
4111                                        params: ['sys.color.ohos_id_color_primary_contrary'],
4112                                        'bundleName': '__harDefaultBundleName__',
4113                                        'moduleName': '__harDefaultModuleName__',
4114                                    } : this.treeViewTheme.b4);
4115                                    Text.fontWeight(this.listNodeDataSource.q14().fontWeight);
4116                                }, Text);
4117                                Text.pop();
4118                                Row.pop();
4119                            });
4120                        } else {
4121                            this.ifElseBranchUpdateFunction(1, () => {
4122                            });
4123                        }
4124                    }, If);
4125                    If.pop();
4126                    this.observeComponentCreation2((elmtId, isInitialRender) => {
4127                        If.create();
4128                        if (this.item.k6().x3) {
4129                            this.ifElseBranchUpdateFunction(0, () => {
4130                                this.observeComponentCreation2((elmtId, isInitialRender) => {
4131                                    Row.create();
4132                                    Row.focusable(true);
4133                                    Row.height(this.item.k6().x3?.itemHeight);
4134                                    Row.width(this.item.k6().x3?.itemWidth);
4135                                }, Row);
4136                                this.observeComponentCreation2((elmtId, isInitialRender) => {
4137                                    Image.create(this.item.k6().x3?.c8);
4138                                    Image.fillColor(this.item.k6().x3?.y12 ?
4139                                    this.treeViewTheme.i4 : z1);
4140                                    Image.align(Alignment.End);
4141                                    Image.objectFit(ImageFit.Contain);
4142                                    Image.height(this.item.k6().x3?.itemHeight);
4143                                    Image.width(this.item.k6().x3?.itemWidth);
4144                                    Image.opacity(!this.item.g7() ?
4145                                        this.item.k6().x3?.opacity : this.item.k6().x3?.k15);
4146                                    Image.onTouch((event) => {
4147                                        if (event.type === TouchType.Down) {
4148                                            this.listNodeDataSource.k9(this.listNodeDataSource.findIndex(this.item.e6()));
4149                                            this.listNodeDataSource.s14(this.item.e6());
4150                                        }
4151                                        event.stopPropagation();
4152                                    });
4153                                    Image.focusable(true);
4154                                    Image.matchTextDirection((this.item.k6().x3?.c8 === ARROW_RIGHT ||
4155                                        this.item.k6().x3?.c8 === s2) ? true : false);
4156                                }, Image);
4157                                Row.pop();
4158                            });
4159                        } else {
4160                            this.ifElseBranchUpdateFunction(1, () => {
4161                            });
4162                        }
4163                    }, If);
4164                    If.pop();
4165                    Row.pop();
4166                    Stack.pop();
4167                    Column.pop();
4168                    Stack.pop();
4169                });
4170            } else {
4171                this.ifElseBranchUpdateFunction(1, () => {
4172                });
4173            }
4174        }, If);
4175        If.pop();
4176    }
4177
4178    rerender() {
4179        this.updateDirtyElements();
4180    }
4181}
4182
4183export class j3 {
4184    constructor(nodeParam) {
4185        this.currentNodeId = nodeParam.currentNodeId ?? -1;
4186        this.parentNodeId = nodeParam.parentNodeId ?? -1;
4187        this.isFolder = nodeParam.isFolder;
4188        this.b5 = -1;
4189        this.y14 = -1;
4190        this.p6 = { a13: false, b13: 0, r10: 0 };
4191        this.children = [];
4192    }
4193
4194    o6() {
4195        return this.p6;
4196    }
4197
4198    f13() {
4199        return this.currentNodeId;
4200    }
4201
4202    v6() {
4203        return this.isFolder;
4204    }
4205}
4206
4207class l3 {
4208    constructor() {
4209        this.rightMargin = -1;
4210        this.width = -1;
4211        this.height = -1;
4212    }
4213
4214    set itemWidth(width) {
4215        this.width = width;
4216    }
4217
4218    get itemWidth() {
4219        return this.width;
4220    }
4221
4222    set itemHeight(height) {
4223        this.height = height;
4224    }
4225
4226    get itemHeight() {
4227        return this.height;
4228    }
4229
4230    set z7(rightMargin) {
4231        this.rightMargin = rightMargin;
4232    }
4233
4234    get z7() {
4235        return this.rightMargin;
4236    }
4237}
4238
4239export class m3 extends l3 {
4240    constructor(w4, x4, itemWidth, itemHeight, y4, z4, a5) {
4241        super();
4242        this.rightMargin = {
4243            'id': -1,
4244            'type': 10002,
4245            params: ['sys.float.ohos_id_elements_margin_horizontal_m'],
4246            'bundleName': '__harDefaultBundleName__',
4247            'moduleName': '__harDefaultModuleName__',
4248        };
4249        this.j4 = w4;
4250        this.rightMargin = y4;
4251        this.b8 = x4;
4252        this.itemWidth = itemWidth;
4253        this.itemHeight = itemHeight;
4254        this.l15 = w4;
4255        this.m15 = z4;
4256        this.n15 = a5;
4257    }
4258
4259    get source() {
4260        return this.j4;
4261    }
4262
4263    get opacity() {
4264        return this.b8;
4265    }
4266
4267    get k15() {
4268        return 1;
4269    }
4270
4271    get c8() {
4272        return this.l15;
4273    }
4274
4275    get y12() {
4276        return this.m15;
4277    }
4278
4279    get type() {
4280        return this.n15;
4281    }
4282}
4283
4284class n3 {
4285    constructor() {
4286    }
4287
4288    static getInstance() {
4289        if (!n3.instance) {
4290            n3.instance = new n3();
4291        }
4292        return n3.instance;
4293    }
4294
4295    o15(type) {
4296        let v4;
4297        switch (type) {
4298            case b3.ARROW_RIGHT_WHITE:
4299                v4 = s2;
4300                break;
4301            case b3.ARROW_RIGHT:
4302                v4 = ARROW_RIGHT;
4303                break;
4304            case b3.ARROW_DOWN_WHITE:
4305                v4 = q2;
4306                break;
4307            default:
4308                v4 = ARROW_DOWN;
4309        }
4310        return new m3(v4, {
4311            'id': -1,
4312            'type': 10002,
4313            params: ['sys.float.ohos_id_alpha_content_tertiary'],
4314            'bundleName': '__harDefaultBundleName__',
4315            'moduleName': '__harDefaultModuleName__',
4316        }, u, a1, {
4317            'id': -1,
4318            'type': 10002,
4319            params: ['sys.float.ohos_id_text_paragraph_margin_xs'],
4320            'bundleName': '__harDefaultBundleName__',
4321            'moduleName': '__harDefaultModuleName__',
4322        }, (type === b3.ARROW_RIGHT_WHITE || type === b3.ARROW_DOWN_WHITE) ? false : true, type);
4323    }
4324}
4325
4326class q3 {
4327    static n5(type) {
4328        let node = q3.p15.get(type);
4329        if (node === undefined) {
4330            node = n3.getInstance().o15(type);
4331            q3.p15.set(type, node);
4332        }
4333        return node;
4334    }
4335
4336    static t12(s4, t4, u4) {
4337        if (u4 === undefined) {
4338            return undefined;
4339        }
4340        let type = u4;
4341        if (s4 == a3.EDIT ||
4342            s4 === a3.DRAG_INSERT) {
4343            if (t4 === z2.COLLAPSE) {
4344                type = b3.ARROW_RIGHT_WHITE;
4345            } else {
4346                type = b3.ARROW_DOWN_WHITE;
4347            }
4348        } else if (s4 === a3.FINISH_EDIT ||
4349            s4 === a3.FINISH_DRAG_INSERT) {
4350            if (t4 === z2.COLLAPSE) {
4351                type = b3.ARROW_RIGHT;
4352            } else {
4353                type = b3.ARROW_DOWN;
4354            }
4355        }
4356        return q3.n5(type);
4357    }
4358
4359    static x12(q4, r4) {
4360        if (r4 === undefined) {
4361            return undefined;
4362        }
4363        let type;
4364        if (!r4) {
4365            if (q4 === z2.COLLAPSE) {
4366                type = b3.ARROW_RIGHT_WHITE;
4367            } else {
4368                type = b3.ARROW_DOWN_WHITE;
4369            }
4370        } else {
4371            if (q4 === z2.COLLAPSE) {
4372                type = b3.ARROW_RIGHT;
4373            } else {
4374                type = b3.ARROW_DOWN;
4375            }
4376        }
4377        return q3.n5(type);
4378    }
4379}
4380
4381q3.p15 = new Map();
4382
4383export class r3 extends l3 {
4384    constructor(m4, n4, itemWidth, itemHeight, o4, p4) {
4385        super();
4386        this.rightMargin = {
4387            'id': -1,
4388            'type': 10002,
4389            params: ['sys.float.ohos_id_elements_margin_horizontal_m'],
4390            'bundleName': '__harDefaultBundleName__',
4391            'moduleName': '__harDefaultModuleName__',
4392        };
4393        this.j4 = m4;
4394        this.q15 = m4;
4395        if (o4 !== undefined) {
4396            this.r15 = o4;
4397        } else {
4398            this.r15 = this.q15;
4399        }
4400        if (p4 !== undefined) {
4401            this.s15 = p4;
4402        } else {
4403            this.s15 = this.q15;
4404        }
4405        this.b8 = n4;
4406        this.itemWidth = itemWidth;
4407        this.itemHeight = itemHeight;
4408        this.l15 = m4;
4409        this.t15 = ARROW_DOWN;
4410        this.u15 = ARROW_RIGHT;
4411        this.m15 = true;
4412        this.v15 = a3.NORMAL;
4413    }
4414
4415    get source() {
4416        return this.j4;
4417    }
4418
4419    get a8() {
4420        return this.q15;
4421    }
4422
4423    get r13() {
4424        return this.r15;
4425    }
4426
4427    get s13() {
4428        return this.s15;
4429    }
4430
4431    get opacity() {
4432        return this.b8;
4433    }
4434
4435    get k15() {
4436        return 1;
4437    }
4438
4439    get c8() {
4440        return this.l15;
4441    }
4442
4443    get y12() {
4444        return this.m15;
4445    }
4446
4447    x12(l4) {
4448        if (l4 === z2.EXPAND) {
4449            this.l15 = this.t15;
4450        } else if (l4 === z2.COLLAPSE) {
4451            this.l15 = this.u15;
4452        }
4453    }
4454
4455    s12(j4, k4) {
4456        if (j4 === a3.EDIT || j4 === a3.DRAG_INSERT) {
4457            this.t15 = q2;
4458            this.u15 = s2;
4459            this.m15 = false;
4460        } else if (j4 === a3.FINISH_EDIT ||
4461            j4 === a3.FINISH_DRAG_INSERT) {
4462            this.t15 = ARROW_DOWN;
4463            this.u15 = ARROW_RIGHT;
4464            this.m15 = true;
4465        }
4466        this.l15 = (k4 === z2.COLLAPSE) ?
4467        this.u15 : this.t15;
4468    }
4469
4470    i8(i4) {
4471        switch (i4) {
4472            case a3.NORMAL:
4473                this.j4 = this.q15;
4474                this.v15 = i4;
4475                break;
4476            case a3.SELECTED:
4477                if (this.v15 !== a3.EDIT) {
4478                    this.j4 = this.r15;
4479                    this.v15 = i4;
4480                }
4481                break;
4482            case a3.EDIT:
4483                this.j4 = this.s15;
4484                this.v15 = i4;
4485                break;
4486            case a3.FINISH_EDIT:
4487                this.j4 = this.r15;
4488                this.v15 = i4;
4489                break;
4490            case a3.DRAG_INSERT:
4491                this.j4 = this.s15;
4492                this.v15 = i4;
4493                break;
4494            case a3.FINISH_DRAG_INSERT:
4495                this.j4 = this.q15;
4496                this.v15 = i4;
4497                break;
4498            default:
4499                break;
4500        }
4501    }
4502}
4503
4504class s3 extends l3 {
4505    constructor(h4) {
4506        super();
4507        this.treeViewTheme = e3.getInstance();
4508        this.w15 = h4;
4509        this.itemWidth = b1;
4510        this.itemHeight = c1;
4511        this.rightMargin = {
4512            'id': -1,
4513            'type': 10002,
4514            params: ['sys.float.ohos_id_text_paragraph_margin_xs'],
4515            'bundleName': '__harDefaultBundleName__',
4516            'moduleName': '__harDefaultModuleName__',
4517        };
4518        this.x15 = {
4519            fontColor: this.treeViewTheme.a4,
4520            fontSize: {
4521                'id': -1,
4522                'type': 10002,
4523                params: ['sys.float.ohos_id_text_size_body1'],
4524                'bundleName': '__harDefaultBundleName__',
4525                'moduleName': '__harDefaultModuleName__',
4526            },
4527            fontWeight: FontWeight.Normal,
4528        };
4529        this.y15 = 0;
4530    }
4531
4532    j8(isSelected) {
4533        if (isSelected) {
4534            this.x15 = {
4535                fontColor: this.treeViewTheme.c4,
4536                fontSize: {
4537                    'id': -1,
4538                    'type': 10002,
4539                    params: ['sys.float.ohos_id_text_size_body1'],
4540                    'bundleName': '__harDefaultBundleName__',
4541                    'moduleName': '__harDefaultModuleName__',
4542                },
4543                fontWeight: FontWeight.Regular,
4544            };
4545        } else {
4546            this.x15 = {
4547                fontColor: this.treeViewTheme.a4,
4548                fontSize: {
4549                    'id': -1,
4550                    'type': 10002,
4551                    params: ['sys.float.ohos_id_text_size_body1'],
4552                    'bundleName': '__harDefaultBundleName__',
4553                    'moduleName': '__harDefaultModuleName__',
4554                },
4555                fontWeight: FontWeight.Normal,
4556            };
4557        }
4558    }
4559
4560    set title(text) {
4561        this.w15 = text;
4562    }
4563
4564    get title() {
4565        return this.w15;
4566    }
4567
4568    set u13(g4) {
4569        this.y15 = g4;
4570    }
4571
4572    get u13() {
4573        return this.y15;
4574    }
4575
4576    get color() {
4577        return this.x15.fontColor;
4578    }
4579
4580    get size() {
4581        return this.x15.fontSize;
4582    }
4583
4584    get weight() {
4585        return this.x15.fontWeight;
4586    }
4587
4588    q9(f4) {
4589        if (f4) {
4590            this.x15 = {
4591                fontColor: this.treeViewTheme.c4,
4592                fontSize: {
4593                    'id': -1,
4594                    'type': 10002,
4595                    params: ['sys.float.ohos_id_text_size_body1'],
4596                    'bundleName': '__harDefaultBundleName__',
4597                    'moduleName': '__harDefaultModuleName__',
4598                },
4599                fontWeight: FontWeight.Regular,
4600            };
4601        } else {
4602            this.x15 = {
4603                fontColor: this.treeViewTheme.a4,
4604                fontSize: {
4605                    'id': -1,
4606                    'type': 10002,
4607                    params: ['sys.float.ohos_id_text_size_body1'],
4608                    'bundleName': '__harDefaultBundleName__',
4609                    'moduleName': '__harDefaultModuleName__',
4610                },
4611                fontWeight: FontWeight.Normal,
4612            };
4613        }
4614    }
4615}
4616
4617export class t3 extends l3 {
4618    constructor() {
4619        super();
4620        this.status = undefined;
4621        this.z15 = {
4622            'id': -1,
4623            'type': 10001,
4624            params: ['sys.color.ohos_id_color_background'],
4625            'bundleName': '__harDefaultBundleName__',
4626            'moduleName': '__harDefaultModuleName__',
4627        };
4628        this.a16 = {
4629            'id': -1,
4630            'type': 10001,
4631            params: ['sys.color.ohos_id_color_emphasize'],
4632            'bundleName': '__harDefaultBundleName__',
4633            'moduleName': '__harDefaultModuleName__',
4634        };
4635        this.radius = {
4636            'id': -1,
4637            'type': 10002,
4638            params: ['sys.float.ohos_id_corner_radius_default_xs'],
4639            'bundleName': '__harDefaultBundleName__',
4640            'moduleName': '__harDefaultModuleName__',
4641        };
4642        this.treeViewTheme = e3.getInstance();
4643        this.itemWidth = b1;
4644        this.itemHeight = d1;
4645        this.rightMargin = {
4646            'id': -1,
4647            'type': 10002,
4648            params: ['sys.float.ohos_id_text_paragraph_margin_xs'],
4649            'bundleName': '__harDefaultBundleName__',
4650            'moduleName': '__harDefaultModuleName__',
4651        };
4652        this.b16 = {
4653            fontColor: this.treeViewTheme.a4,
4654            fontSize: {
4655                'id': -1,
4656                'type': 10002,
4657                params: ['sys.float.ohos_id_text_size_body1'],
4658                'bundleName': '__harDefaultBundleName__',
4659                'moduleName': '__harDefaultModuleName__',
4660            },
4661            fontWeight: FontWeight.Normal,
4662        };
4663    }
4664
4665    get color() {
4666        return this.b16.fontColor;
4667    }
4668
4669    get size() {
4670        return this.b16.fontSize;
4671    }
4672
4673    get weight() {
4674        return this.b16.fontWeight;
4675    }
4676
4677    get borderRadius() {
4678        return this.radius;
4679    }
4680
4681    get backgroundColor() {
4682        return this.z15;
4683    }
4684
4685    get j15() {
4686        return this.a16;
4687    }
4688
4689    get c16() {
4690        return this.status;
4691    }
4692}
4693
4694function o(e4) {
4695    if (!e4) {
4696        return LengthMetrics.vp(0);
4697    } else if (typeof e4 === 'number') {
4698        return LengthMetrics.vp(e4);
4699    } else {
4700        return LengthMetrics.resource(e4);
4701    }
4702}
4703
4704export default {
4705    TreeController,
4706    TreeListener,
4707    TreeListenerManager,
4708    TreeListenType,
4709    TreeView,
4710}