import f from "./index-classCallCheck.js";
import c from "./index-createClass.js";
import n from "./index-assertThisInitialized.js";
import m from "./index-inherits.js";
import p from "./index-createSuper.js";
import s from "./index-defineProperty.js";
import { Parser as Q } from "./index-Parser4.js";
import { parseNDigits as l } from "./index-utils12.js";
var C = /* @__PURE__ */ (function(u) {
  m(o, u);
  var i = p(o);
  function o() {
    var a;
    f(this, o);
    for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++)
      e[t] = arguments[t];
    return a = i.call.apply(i, [this].concat(e)), s(n(a), "priority", 120), s(n(a), "incompatibleTokens", ["Y", "R", "q", "M", "L", "w", "I", "d", "D", "i", "e", "c", "t", "T"]), a;
  }
  return c(o, [{
    key: "parse",
    value: function(r, e, t) {
      switch (e) {
        // 1, 2, 3, 4
        case "Q":
        case "QQ":
          return l(e.length, r);
        // 1st, 2nd, 3rd, 4th
        case "Qo":
          return t.ordinalNumber(r, {
            unit: "quarter"
          });
        // Q1, Q2, Q3, Q4
        case "QQQ":
          return t.quarter(r, {
            width: "abbreviated",
            context: "formatting"
          }) || t.quarter(r, {
            width: "narrow",
            context: "formatting"
          });
        // 1, 2, 3, 4 (narrow quarter; could be not numerical)
        case "QQQQQ":
          return t.quarter(r, {
            width: "narrow",
            context: "formatting"
          });
        // 1st quarter, 2nd quarter, ...
        case "QQQQ":
        default:
          return t.quarter(r, {
            width: "wide",
            context: "formatting"
          }) || t.quarter(r, {
            width: "abbreviated",
            context: "formatting"
          }) || t.quarter(r, {
            width: "narrow",
            context: "formatting"
          });
      }
    }
  }, {
    key: "validate",
    value: function(r, e) {
      return e >= 1 && e <= 4;
    }
  }, {
    key: "set",
    value: function(r, e, t) {
      return r.setUTCMonth((t - 1) * 3, 1), r.setUTCHours(0, 0, 0, 0), r;
    }
  }]), o;
})(Q);
export {
  C as QuarterParser
};
