require("../../@babel/runtime/helpers/Arrayincludes");
var e = require("../../common/vendor.js"),
  n = require("../../enums/index.js"),
  a = require("../../utils/util.js");
require("../../constant/index.js"),
  Array || e.resolveComponent("uni-popup")(),
  Math;
var r = {
    __name: "index",
    props: {
      visible: { type: Boolean, default: !1 },
      keyboardType: { type: String, default: n.KeyboardEnum.ABC },
      vin: { type: String, default: "" },
      vehicleNoList: { type: Array, default: ["", "", "", "", "", "", "", ""] },
      vehicleNoIndex: { type: Number, default: 0 },
      canSwitch: { type: Boolean, default: !0 },
      initCopy: { type: Boolean, default: !0 },
    },
    emits: ["close", "change", "type-change"],
    setup: function (r, o) {
      var u = o.emit,
        t = r,
        i = [
          [1, 2, 3, 4, 5, 6, 7, 8, 9, 0],
          ["Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P"],
          ["A", "S", "D", "F", "G", "H", "J", "K", "L", "Z"],
          [
            n.KeyboardEnum.AREA,
            "X",
            "C",
            "V",
            "B",
            "N",
            "M",
            n.KeyboardEnum.DELETE,
          ],
        ],
        d = [
          ["京", "津", "渝", "沪", "冀", "晋", "辽", "吉", "黑", "苏"],
          ["浙", "皖", "闽", "赣", "鲁", "豫", "鄂", "湘", "粤", "琼"],
          ["川", "贵", "云", "陕", "甘", "青", "蒙", "桂", "宁", "新"],
          [
            n.KeyboardEnum.ABC,
            "藏",
            "使",
            "警",
            "学",
            "港",
            "澳",
            n.KeyboardEnum.DELETE,
          ],
        ],
        c = ["I", "O"],
        l = e.ref(null),
        y = e.ref("");
      e.watch(
        function () {
          return t.visible;
        },
        function () {
          t.visible
            ? (t.initCopy || m(), l.value.open(), l.value.closeMask())
            : l.value.close();
        }
      );
      var b = function () {
          u("close");
        },
        E = function (e) {
          e.show || u("close");
        },
        f = function (r) {
          if (
            ((r !== n.KeyboardEnum.AREA && r !== n.KeyboardEnum.ABC) ||
              t.canSwitch) &&
            !c.includes(r)
          )
            if ((a.vibrate(), t.canSwitch)) {
              var o = e._.cloneDeep(t.vehicleNoList),
                i = e._.cloneDeep(t.vehicleNoIndex);
              r === n.KeyboardEnum.AREA || r === n.KeyboardEnum.ABC
                ? u("type-change")
                : r === n.KeyboardEnum.DELETE
                ? (o[i] ? (o[i] = "") : (o[i - 1] = ""),
                  i > 0 && i--,
                  u("change", { value: o, index: i }))
                : ((o[i] = r),
                  i < 7 &&
                    (0 === i &&
                      u("change", { keyboardType: n.KeyboardEnum.ABC }),
                    i++),
                  u("change", { value: o, index: i }));
            } else {
              var d = e._.cloneDeep(t.vin);
              if (r === n.KeyboardEnum.DELETE)
                (d = d.substring(0, d.length - 1)), u("change", { value: d });
              else {
                if (r === n.KeyboardEnum.AREA) return;
                if (d.length >= 17) return;
                u("change", { value: (d += r) });
              }
            }
        },
        s = function () {
          u("change", { value: y.value });
        },
        m = function () {
          e.index.getClipboardData().then(function (a) {
            var r = a.data;
            e.index.hideToast(),
              17 === r.trim().length && t.keyboardType === n.KeyboardEnum.ABC
                ? (y.value = r.trim())
                : (y.value = "");
          });
        };
      return (
        e.onMounted(function () {
          t.initCopy && m();
        }),
        function (a, o) {
          return e.e(
            { a: r.keyboardType === e.unref(n.KeyboardEnum).ABC && y.value },
            r.keyboardType === e.unref(n.KeyboardEnum).ABC && y.value
              ? { b: e.t(y.value) }
              : {},
            {
              c: e.o(s),
              d: e.o(b),
              e: e.f(
                r.keyboardType === e.unref(n.KeyboardEnum).ABC ? i : d,
                function (a, o, u) {
                  return {
                    a: e.f(a, function (a, o, u) {
                      return e.e(
                        { a: a === e.unref(n.KeyboardEnum).DELETE },
                        a === e.unref(n.KeyboardEnum).DELETE
                          ? {
                              b: e.o(function (e) {
                                return f(a);
                              }, o),
                            }
                          : a === e.unref(n.KeyboardEnum).AREA ||
                            a === e.unref(n.KeyboardEnum).ABC
                          ? {
                              d: e.t(a),
                              e: e.n(r.canSwitch ? "" : "disabled"),
                              f: r.canSwitch ? "keyboard-hover" : "",
                              g: e.o(function (e) {
                                return f(a);
                              }, o),
                            }
                          : {
                              h: e.t(a),
                              i: e.n(c.includes(a) ? "disabled" : ""),
                              j: c.includes(a) ? "" : "keyboard-hover",
                              k: e.o(function (e) {
                                return f(a);
                              }, o),
                            },
                        {
                          c:
                            a === e.unref(n.KeyboardEnum).AREA ||
                            a === e.unref(n.KeyboardEnum).ABC,
                          l: o,
                        }
                      );
                    }),
                    b: o,
                  };
                }
              ),
              f: e.sr(l, "8922672d-0", { k: "popup" }),
              g: e.o(E),
              h: e.p({
                type: "bottom",
                "background-color": "#F2F2F2",
                "mask-background-color": "rgba(0, 0, 0, 0)",
                "safe-area": !1,
                animation: !0,
                "is-mask-click": !1,
              }),
            }
          );
        }
      );
    },
  },
  o = e._export_sfc(r, [["__scopeId", "data-v-8922672d"]]);
wx.createComponent(o);
