Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.transition = void 0;

var e = require("A1171D36658710DFC771753133BFEAA0.js"), t = function(e) {
    return {
        enter: "van-".concat(e, "-enter van-").concat(e, "-enter-active enter-class enter-active-class"),
        "enter-to": "van-".concat(e, "-enter-to van-").concat(e, "-enter-active enter-to-class enter-active-class"),
        leave: "van-".concat(e, "-leave van-").concat(e, "-leave-active leave-class leave-active-class"),
        "leave-to": "van-".concat(e, "-leave-to van-").concat(e, "-leave-active leave-to-class leave-active-class")
    };
}, n = function() {
    return new Promise(function(e) {
        return setTimeout(e, 1e3 / 30);
    });
};

exports.transition = function(a) {
    return Behavior({
        properties: {
            customStyle: String,
            show: {
                type: Boolean,
                value: a,
                observer: "observeShow"
            },
            duration: {
                type: [ Number, Object ],
                value: 300,
                observer: "observeDuration"
            },
            name: {
                type: String,
                value: "fade",
                observer: "updateClasses"
            }
        },
        data: {
            type: "",
            inited: !1,
            display: !1,
            classNames: t("fade")
        },
        attached: function() {
            this.data.show && this.enter();
        },
        methods: {
            observeShow: function(e) {
                e ? this.enter() : this.leave();
            },
            updateClasses: function(e) {
                this.set({
                    classNames: t(e)
                });
            },
            enter: function() {
                var t = this, a = this.data, s = a.classNames, c = a.duration, i = (0, e.isObj)(c) ? c.leave : c;
                this.status = "enter", Promise.resolve().then(n).then(function() {
                    t.checkStatus("enter"), t.set({
                        inited: !0,
                        display: !0,
                        classes: s.enter,
                        currentDuration: i
                    });
                }).then(n).then(function() {
                    t.checkStatus("enter"), t.set({
                        classes: s["enter-to"]
                    });
                }).catch(function() {});
            },
            leave: function() {
                var t = this, a = this.data, s = a.classNames, c = a.duration, i = (0, e.isObj)(c) ? c.leave : c;
                this.status = "leave", Promise.resolve().then(n).then(function() {
                    t.checkStatus("leave"), t.set({
                        classes: s.leave,
                        currentDuration: i
                    });
                }).then(function() {
                    return setTimeout(function() {
                        return t.onTransitionEnd();
                    }, i);
                }).then(n).then(function() {
                    t.checkStatus("leave"), t.set({
                        classes: s["leave-to"]
                    });
                }).catch(function() {});
            },
            checkStatus: function(e) {
                if (e !== this.status) throw new Error("incongruent status: ".concat(e));
            },
            onTransitionEnd: function() {
                this.data.show || (this.set({
                    display: !1
                }), this.$emit("transitionEnd"));
            }
        }
    });
};