chenyc
2025-12-09 65e034683b28d799e73c7d7e5e4769fab5b9bc9c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
var __extends = this && this.t || function() {
    var extendStatics = function(r, t) {
        extendStatics = Object.setPrototypeOf || {
            __proto__: []
        } instanceof Array && function(r, t) {
            r.__proto__ = t;
        } || function(r, t) {
            for (var e in t) if (Object.prototype.hasOwnProperty.call(t, e)) r[e] = t[e];
        };
        return extendStatics(r, t);
    };
    return function(r, t) {
        if (typeof t !== "function" && t !== null) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
        extendStatics(r, t);
        function __() {
            this.constructor = r;
        }
        r.prototype = t === null ? Object.create(t) : (__.prototype = t.prototype, new __);
    };
}();
 
import { ContainerIterator } from "../../ContainerBase";
 
import { throwIteratorAccessError } from "../../../utils/throwError";
 
var TreeIterator = function(r) {
    __extends(TreeIterator, r);
    function TreeIterator(t, e, i) {
        var n = r.call(this, i) || this;
        n.o = t;
        n.h = e;
        if (n.iteratorType === 0) {
            n.pre = function() {
                if (this.o === this.h.K) {
                    throwIteratorAccessError();
                }
                this.o = this.o.L();
                return this;
            };
            n.next = function() {
                if (this.o === this.h) {
                    throwIteratorAccessError();
                }
                this.o = this.o.m();
                return this;
            };
        } else {
            n.pre = function() {
                if (this.o === this.h.N) {
                    throwIteratorAccessError();
                }
                this.o = this.o.m();
                return this;
            };
            n.next = function() {
                if (this.o === this.h) {
                    throwIteratorAccessError();
                }
                this.o = this.o.L();
                return this;
            };
        }
        return n;
    }
    Object.defineProperty(TreeIterator.prototype, "index", {
        get: function() {
            var r = this.o;
            var t = this.h.rr;
            if (r === this.h) {
                if (t) {
                    return t.tr - 1;
                }
                return 0;
            }
            var e = 0;
            if (r.K) {
                e += r.K.tr;
            }
            while (r !== t) {
                var i = r.rr;
                if (r === i.N) {
                    e += 1;
                    if (i.K) {
                        e += i.K.tr;
                    }
                }
                r = i;
            }
            return e;
        },
        enumerable: false,
        configurable: true
    });
    return TreeIterator;
}(ContainerIterator);
 
export default TreeIterator;
//# sourceMappingURL=TreeIterator.js.map