UNPKG

jb-payment-input-react

Version:
1,228 lines (1,186 loc) 60.7 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('jb-payment-input')) : typeof define === 'function' && define.amd ? define(['exports', 'react', 'jb-payment-input'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JBPaymentInput = {}, global.React)); })(this, (function (exports, React) { 'use strict'; function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray$1(r, e) || _nonIterableRest(); } function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } function _typeof$1(o) { "@babel/helpers - typeof"; return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$1(o); } function toPrimitive(t, r) { if ("object" != _typeof$1(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof$1(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return (String )(t); } function toPropertyKey(t) { var i = toPrimitive(t, "string"); return "symbol" == _typeof$1(i) ? i : i + ""; } function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o); } } function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof$1(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } } function _isNativeReflectConstruct$1() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct() { return !!t; })(); } function _construct(t, e, r) { if (_isNativeReflectConstruct$1()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; } function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); } function _defineProperty(e, r, t) { return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray$1(r); } function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread(); } function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } function getDefaultExportFromCjs (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } var regeneratorRuntime$1 = {exports: {}}; var _typeof = {exports: {}}; var hasRequired_typeof; function require_typeof () { if (hasRequired_typeof) return _typeof.exports; hasRequired_typeof = 1; (function (module) { function _typeof(o) { "@babel/helpers - typeof"; return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o); } module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; } (_typeof)); return _typeof.exports; } var hasRequiredRegeneratorRuntime; function requireRegeneratorRuntime () { if (hasRequiredRegeneratorRuntime) return regeneratorRuntime$1.exports; hasRequiredRegeneratorRuntime = 1; (function (module) { var _typeof = require_typeof()["default"]; function _regeneratorRuntime() { module.exports = _regeneratorRuntime = function _regeneratorRuntime() { return e; }, module.exports.__esModule = true, module.exports["default"] = module.exports; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; } (regeneratorRuntime$1)); return regeneratorRuntime$1.exports; } var regenerator; var hasRequiredRegenerator; function requireRegenerator () { if (hasRequiredRegenerator) return regenerator; hasRequiredRegenerator = 1; // TODO(Babel 8): Remove this file. var runtime = requireRegeneratorRuntime()(); regenerator = runtime; // Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736= try { regeneratorRuntime = runtime; } catch (accidentalStrictMode) { if (typeof globalThis === "object") { globalThis.regeneratorRuntime = runtime; } else { Function("r", "regeneratorRuntime = r")(runtime); } } return regenerator; } var regeneratorExports = requireRegenerator(); var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regeneratorExports); function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } function t(t, i, s, e) { if ("a" === s && !e) throw new TypeError("Private accessor was defined without a getter"); if ("function" == typeof i ? t !== i || !e : !i.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return "m" === s ? e : "a" === s ? e.call(t) : e ? e.value : i.get(t); } function i$1(t, i, s, e, a) { if ("function" == typeof i ? t !== i || !a : !i.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return i.set(t, s), s; } function s$1(t, i, s) { var _a = a$1(t, i, s), e = _a.syncValidationResult; return e; } function e$1(_x, _x2, _x3) { return _e.apply(this, arguments); } function _e() { _e = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(t, i, s) { var _a3, e, n, _iterator3, _step3, _t3, _i2; return _regeneratorRuntime.wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: _a3 = a$1(t, i, s), e = _a3.syncValidationResult, n = _a3.asyncList; _iterator3 = _createForOfIteratorHelper(n); _context3.prev = 2; _iterator3.s(); case 4: if ((_step3 = _iterator3.n()).done) { _context3.next = 12; break; } _t3 = _step3.value; _context3.next = 8; return _t3; case 8: _i2 = _context3.sent; e.isAllValid = e.isAllValid && _i2.isValid, e.validationList.push(_i2); case 10: _context3.next = 4; break; case 12: _context3.next = 17; break; case 14: _context3.prev = 14; _context3.t0 = _context3["catch"](2); _iterator3.e(_context3.t0); case 17: _context3.prev = 17; _iterator3.f(); return _context3.finish(17); case 20: return _context3.abrupt("return", e); case 21: case "end": return _context3.stop(); } }, _callee3, null, [[2, 14, 17, 20]]); })); return _e.apply(this, arguments); } function a$1(t, i, s) { var e = { validationList: [], isAllValid: !0 }, a = function a(t) { e.validationList.push(t), t.isValid || (e.isAllValid = !1); }, r = t.filter(function (t) { return !0 === t.defer; }), o = t.filter(function (t) { return !0 !== t.defer; }), l = []; var _iterator = _createForOfIteratorHelper(o), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var _t2 = _step.value; var _e3 = n$1(i, _t2, s); _e3 instanceof Promise ? l.push(_e3) : a(_e3); } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } if (e.isAllValid) { var _iterator2 = _createForOfIteratorHelper(r), _step2; try { for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { var _t = _step2.value; var _e2 = n$1(i, _t, s); _e2 instanceof Promise ? l.push(_e2) : a(_e2); } } catch (err) { _iterator2.e(err); } finally { _iterator2.f(); } } return { syncValidationResult: e, asyncList: l }; } function n$1(t, i, s) { var e, a = i.message; if (i.validator instanceof RegExp) { var _a2 = "string" == typeof t ? t : s(t); e = i.validator.test(_a2), i.validator.lastIndex = 0; } if ("function" == typeof i.validator) { var _s$message; var _s = r$1(i.validator, t); if (_s instanceof Promise) return new Promise(function (t) { _s.then(function (s) { t({ isValid: s.isValid, message: s.message, validation: i }); }); }); e = _s.isValid, a = (_s$message = _s.message) !== null && _s$message !== void 0 ? _s$message : a; } return e ? { isValid: !0, message: "", validation: i } : { isValid: !1, message: a, validation: i }; } function r$1(t, i) { function s(t) { var i = null; "string" == typeof t && t.length > 0 && (i = t); return { isValid: "string" == typeof t ? 0 == t.length : t, message: i }; } var e = t(i); return e instanceof Promise ? new Promise(function (t) { e.then(function (i) { t(s(i)); }); }) : s(e); } var o$1, l$1, c$1, f$1, u$1, h$1, d$1, V$1, m$1; "function" == typeof SuppressedError && SuppressedError; var g$1 = /*#__PURE__*/function () { function g(t) { _classCallCheck(this, g); o$1.add(this), l$1.set(this, []), c$1.set(this, { isValid: null, message: null }), this.result = null, f$1.set(this, { clearValidationError: [], getValue: function getValue() { return null; }, getValidations: [], getValueString: function getValueString() { return ""; }, setValidationResult: [], showValidationError: [] }), this.setCallbacks(t); } return _createClass(g, [{ key: "resultSummary", get: function get() { return t(this, c$1, "f"); } }, { key: "setCallbacks", value: function setCallbacks(i) { var _this = this; Object.keys(i).forEach(function (s) { "function" == typeof i[s] && void 0 !== t(_this, f$1, "f")[s] && (Array.isArray(t(_this, f$1, "f")[s]) ? t(_this, f$1, "f")[s].push(i[s]) : t(_this, f$1, "f")[s] = i[s]); }); } }, { key: "list", get: function get() { return t(this, l$1, "f"); }, set: function set(t) { i$1(this, l$1, t), this.checkValidity({ showError: !1 }); } }, { key: "checkValidity", value: function () { var _checkValidity = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(i) { var s, e; return _regeneratorRuntime.wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.t0 = i === null || i === void 0 ? void 0 : i.value; if (_context.t0) { _context.next = 5; break; } _context.next = 4; return Promise.resolve(t(this, f$1, "f").getValue()); case 4: _context.t0 = _context.sent; case 5: s = _context.t0; _context.next = 8; return t(this, o$1, "m", V$1).call(this, s); case 8: e = _context.sent; return _context.abrupt("return", (t(this, o$1, "m", h$1).call(this, e, i), e)); case 10: case "end": return _context.stop(); } }, _callee, this); })); function checkValidity(_x4) { return _checkValidity.apply(this, arguments); } return checkValidity; }() }, { key: "checkValiditySync", value: function checkValiditySync(i) { var s = (i === null || i === void 0 ? void 0 : i.value) || t(this, f$1, "f").getValue(), e = t(this, o$1, "m", m$1).call(this, s); return t(this, o$1, "m", h$1).call(this, e, i), e; } }, { key: "addValidationListGetter", value: function addValidationListGetter(i) { t(this, f$1, "f").getValidations.push(i); } }]); }(); l$1 = new WeakMap(), c$1 = new WeakMap(), f$1 = new WeakMap(), o$1 = new WeakSet(), u$1 = function u() { return [].concat(_toConsumableArray(t(this, o$1, "m", d$1).call(this)), _toConsumableArray(t(this, l$1, "f"))); }, h$1 = function h(s, e) { if (i$1(this, c$1, { isValid: s.isAllValid, message: null }), s.isAllValid) t(this, f$1, "f").clearValidationError.forEach(function (t) { return t(); });else { var _i = s.validationList.find(function (t) { return !t.isValid; }); this.resultSummary.message = _i.message, !1 !== (e === null || e === void 0 ? void 0 : e.showError) && t(this, f$1, "f").showValidationError.forEach(function (t) { return t({ message: _i.message }); }); } this.result = s, t(this, f$1, "f").setValidationResult.forEach(function (t) { return t(s); }); }, d$1 = function d() { var i = []; return t(this, f$1, "f").getValidations.forEach(function (t) { "function" == typeof t && i.push.apply(i, _toConsumableArray(t())); }), i.flat(); }, V$1 = /*#__PURE__*/function () { var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(i) { return _regeneratorRuntime.wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return e$1(t(this, o$1, "a", u$1), i, t(this, f$1, "f").getValueString); case 2: return _context2.abrupt("return", _context2.sent); case 3: case "end": return _context2.stop(); } }, _callee2, this); })); return function V(_x5) { return _ref.apply(this, arguments); }; }(), m$1 = function m(i) { return s$1(t(this, o$1, "a", u$1), i, t(this, f$1, "f").getValueString); }; function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function e(t, e, n, i) { if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter"); if ("function" == typeof e ? t !== e || !i : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return "m" === n ? i : "a" === n ? i.call(t) : i ? i.value : e.get(t); } function n(t, e, n, i, s) { if ("function" == typeof e ? t !== e || !s : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return e.set(t, n), n; } "function" == typeof SuppressedError && SuppressedError; var i, s, a, o, r, l, u, c, d, p, b, h, m, f, g, v, w, y, j, x, E, k, V, S, A, C, T, L, M; function P(t, e, n) { var i = _objectSpread({ altKey: e.altKey, bubbles: e.bubbles, cancelable: e.cancelable, code: e.code, composed: e.composed, ctrlKey: e.ctrlKey, detail: e.detail, isComposing: e.isComposing, key: e.key, location: e.location, metaKey: e.metaKey, repeat: e.repeat, shiftKey: e.shiftKey, view: e.view, charCode: e.charCode, keyCode: e.keyCode, which: e.which }, n); return new KeyboardEvent(t, i); } function q(t, e, n) { var i = _objectSpread({ bubbles: e.bubbles, cancelable: e.cancelable, composed: e.composed, detail: e.detail, isComposing: e.isComposing, view: e.view, which: e.which, data: e.data, dataTransfer: e.dataTransfer, inputType: e.inputType, targetRanges: "function" == typeof e.getTargetRanges() ? e.getTargetRanges() : [] }, n); return new InputEvent(t, i); } var z = /*#__PURE__*/function (_HTMLElement) { function z() { var _this; _classCallCheck(this, z); _this = _callSuper(this, z), i.add(_assertThisInitialized(_this)), s.set(_assertThisInitialized(_this), { displayValue: "", value: "" }), a.set(_assertThisInitialized(_this), !1), o.set(_assertThisInitialized(_this), !1), r.set(_assertThisInitialized(_this), void 0), u.set(_assertThisInitialized(_this), new g$1({ clearValidationError: _this.clearValidationError.bind(_assertThisInitialized(_this)), showValidationError: _this.showValidationError.bind(_assertThisInitialized(_this)), getValue: function getValue() { return e(_assertThisInitialized(_this), s, "f"); }, getValidations: e(_assertThisInitialized(_this), i, "m", L).bind(_assertThisInitialized(_this)), getValueString: function getValueString() { return e(_assertThisInitialized(_this), s, "f").displayValue; }, setValidationResult: e(_assertThisInitialized(_this), i, "m", M).bind(_assertThisInitialized(_this)) })), _this.initialValue = "", f.set(_assertThisInitialized(_this), []), "function" == typeof _this.attachInternals && n(_assertThisInitialized(_this), r, _this.attachInternals()), e(_assertThisInitialized(_this), i, "m", h).call(_assertThisInitialized(_this)); return _this; } _inherits(z, _HTMLElement); return _createClass(z, [{ key: "disabled", get: function get() { return e(this, a, "f"); }, set: function set(t) { var _e$states, _e$states2; n(this, a, t), this.elements.input.disabled = t, t ? (_e$states = e(this, r, "f").states) === null || _e$states === void 0 ? void 0 : _e$states.add("disabled") : (_e$states2 = e(this, r, "f").states) === null || _e$states2 === void 0 ? void 0 : _e$states2["delete"]("disabled"); } }, { key: "required", get: function get() { return e(this, o, "f"); }, set: function set(t) { n(this, o, t), e(this, i, "m", l).call(this, !1); } }, { key: "isAutoValidationDisabled", get: function get() { return "" === this.getAttribute("disable-auto-validation") || "true" === this.getAttribute("disable-auto-validation"); } }, { key: "validation", get: function get() { return e(this, u, "f"); } }, { key: "displayValue", get: function get() { return e(this, s, "f").displayValue; } }, { key: "value", get: function get() { return e(this, s, "f").value; }, set: function set(t) { e(this, i, "m", c).call(this, t, "SET_VALUE"); } }, { key: "isDirty", get: function get() { return e(this, s, "f").value !== this.initialValue; } }, { key: "selectionStart", get: function get() { return this.elements.input.selectionStart; }, set: function set(t) { this.elements.input.selectionStart = t; } }, { key: "selectionEnd", get: function get() { return this.elements.input.selectionEnd; }, set: function set(t) { this.elements.input.selectionEnd = t; } }, { key: "selectionDirection", get: function get() { return this.elements.input.selectionDirection; }, set: function set(t) { this.elements.input.selectionDirection = t; } }, { key: "name", get: function get() { return this.getAttribute("name") || ""; } }, { key: "connectedCallback", value: function connectedCallback() { e(this, i, "m", p).call(this), this.initProp(), e(this, i, "m", b).call(this); } }, { key: "addStandardValueCallback", value: function addStandardValueCallback(t) { e(this, f, "f").push(t); } }, { key: "standardValue", value: function standardValue(t, n) { var _this2 = this; var i = { displayValue: t.toString(), value: t.toString() }; return i = e(this, f, "f").reduce(function (i, a) { return a(t.toString(), e(_this2, s, "f"), i, n); }, i), i; } }, { key: "initProp", value: function initProp() { e(this, i, "m", c).call(this, this.getAttribute("value") || "", "SET_VALUE"); } }, { key: "attributeChangedCallback", value: function attributeChangedCallback(t, e, n) { this.onAttributeChange(t, n); } }, { key: "onAttributeChange", value: function onAttributeChange(t, n) { switch (t) { case "name": case "autocomplete": case "inputmode": case "readonly": this.elements.input.setAttribute(t, n); break; case "label": this.elements.labelValue.innerHTML = n, null == n || null == n || "" == n ? this.elements.label.classList.add("--hide") : this.elements.label.classList.remove("--hide"); break; case "type": this.elements.input.setAttribute("type", n), "number" == n && null == this.getAttribute("inputmode") && this.setAttribute("inputmode", "numeric"); break; case "message": this.elements.messageBox.innerHTML = n; break; case "virtualkeyboardpolicy": this.elements.input.setAttribute("virtualkeyboardpolicy", n); break; case "value": e(this, i, "m", c).call(this, n, "SET_VALUE"); break; case "placeholder": this.elements.input.placeholder = n; break; case "disabled": "" == n || "true" === n ? this.disabled = !0 : "false" != n && null != n && null != n || (this.disabled = !1, this.elements.input.removeAttribute("disabled")); break; case "required": this.required = !!n && "false" !== n; } } }, { key: "showValidationError", value: function showValidationError(t) { var e = "string" == typeof t ? t : t.message; this.elements.messageBox.innerHTML = e, this.elements.messageBox.classList.add("error"); } }, { key: "clearValidationError", value: function clearValidationError() { var t = this.getAttribute("message") || ""; this.elements.messageBox.innerHTML = t, this.elements.messageBox.classList.remove("error"); } }, { key: "focus", value: function focus() { this.elements.input.focus(); } }, { key: "setSelectionRange", value: function setSelectionRange(t, e, n) { this.elements.input.setSelectionRange(t, e, n); } }, { key: "checkValidity", value: function checkValidity() { var t = e(this, u, "f").checkValiditySync({ showError: !1 }); if (!t.isAllValid) { var _t = new CustomEvent("invalid"); this.dispatchEvent(_t); } return t.isAllValid; } }, { key: "reportValidity", value: function reportValidity() { var t = e(this, u, "f").checkValiditySync({ showError: !0 }); if (!t.isAllValid) { var _t2 = new CustomEvent("invalid"); this.dispatchEvent(_t2); } return t.isAllValid; } }, { key: "validationMessage", get: function get() { return e(this, r, "f").validationMessage; } }], [{ key: "formAssociated", get: function get() { return !0; } }, { key: "observedAttributes", get: function get() { return ["label", "type", "message", "value", "name", "autocomplete", "placeholder", "disabled", "inputmode", "readonly", "disable-auto-validation", "virtualkeyboardpolicy", "required"]; } }]); }(/*#__PURE__*/_wrapNativeSuper(HTMLElement)); s = new WeakMap(), a = new WeakMap(), o = new WeakMap(), r = new WeakMap(), u = new WeakMap(), f = new WeakMap(), i = new WeakSet(), l = function l(t) { if (!this.isAutoValidationDisabled) return e(this, u, "f").checkValidity({ showError: t }); }, c = function c(t, n) { null !== t && null != t || (t = ""); var s = this.standardValue(t, n); e(this, i, "m", d).call(this, s); }, d = function d(t) { n(this, s, t), e(this, r, "f") && "function" == typeof e(this, r, "f").setFormValue && e(this, r, "f").setFormValue(t.value), this.elements.input.value = t.displayValue; }, p = function p() { var t = new CustomEvent("load", { bubbles: !0, composed: !0 }); this.dispatchEvent(t); }, b = function b() { var t = new CustomEvent("init", { bubbles: !0, composed: !0 }); this.dispatchEvent(t); }, h = function h() { var t = this.attachShadow({ mode: "open", delegatesFocus: !0 }); e(this, i, "m", m).call(this), this.elements = { input: t.querySelector(".input-box input"), inputBox: t.querySelector(".input-box"), label: t.querySelector("label"), labelValue: t.querySelector("label .label-value"), messageBox: t.querySelector(".message-box"), slots: { startSection: t.querySelector(".jb-input-start-section-wrapper slot"), endSection: t.querySelector(".jb-input-end-section-wrapper slot") } }, e(this, i, "m", g).call(this); }, m = function m() { var t = document.createElement("template"); t.innerHTML = '<style>:host(:focus),\n:host(:focus-visible) {\n outline: none;\n}\n\n.jb-input-web-component {\n width: 100%;\n margin: var(--jb-input-margin, 0 0);\n}\n.jb-input-web-component:focus-visible {\n outline: none;\n}\n.jb-input-web-component label {\n width: 100%;\n margin: var(--jb-input-label-margin, 4px 0px);\n display: block;\n font-size: var(--jb-input-label-font-size, 0.8em);\n color: var(--jb-input-label-color, #1f1735);\n margin: var(--jb-input-label-margin, 0);\n font-weight: var(--jb-input-label-font-weight, 300);\n}\n.jb-input-web-component label.--hide {\n display: none;\n}\n.jb-input-web-component .input-box {\n width: 100%;\n box-sizing: border-box;\n height: var(--jb-input-height, 40px);\n border: solid var(--jb-input-border-width, 1px) var(--jb-input-border-color, #f7f6f6);\n background-color: var(--jb-input-bgcolor, #f7f6f6);\n border-bottom: solid var(--jb-input-border-bottom-width, 3px) var(--jb-input-border-color, #f7f6f6);\n border-radius: var(--jb-input-border-radius, 16px);\n margin: 4px 0px;\n transition: ease 0.3s all;\n overflow: var(--jb-input-box-overflow, hidden);\n display: grid;\n grid-template-columns: auto 1fr auto;\n box-shadow: var(--jb-input-box-shadow, none);\n}\n.jb-input-web-component .input-box:focus-within {\n border-color: var(--jb-input-border-color-focus, #1e2832);\n border-width: var(--jb-input-border-width-focus, var(--jb-input-border-width, 1px));\n border-bottom-width: var(--jb-input-border-bottom-width-focus, var(--jb-input-border-bottom-width, 3px));\n box-shadow: var(--jb-input-box-shadow-focus, none);\n}\n.jb-input-web-component .input-box input {\n border: none;\n width: 100%;\n box-sizing: border-box;\n height: 100%;\n background-color: transparent;\n padding: var(--jb-input-input-padding, 2px 12px 0 12px);\n display: block;\n font-family: inherit;\n font-size: var(--jb-input-value-font-size, 1.1rem);\n color: var(--jb-input-value-color, #1f1735);\n margin: 0;\n border-radius: 0;\n text-align: var(--jb-input-input-text-align, initial);\n direction: var(--jb-input-input-direction, inherit);\n font-weight: var(--jb-input-input-font-weight, initial);\n /* Chrome, Safari, Edge, Opera */\n /* Firefox */\n}\n.jb-input-web-component .input-box input:focus {\n outline: none;\n}\n.jb-input-web-component .input-box input::placeholder {\n color: var(--jb-input-placeholder-color, initial);\n font-size: var(--jb-input-placeholder-font-size, 1.1rem);\n}\n.jb-input-web-component .input-box input::-webkit-outer-spin-button, .jb-input-web-component .input-box input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n.jb-input-web-component .input-box input[type=number] {\n -moz-appearance: textfield;\n}\n.jb-input-web-component .input-box .jb-input-start-section-wrapper {\n display: flex;\n height: 100%;\n width: auto;\n align-items: center;\n justify-content: center;\n}\n.jb-input-web-component .input-box ::slotted([slot=start-section]), .jb-input-web-component .input-box ::slotted([slot=end-section]) {\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n max-height: 100%;\n overflow-y: hidden;\n background-color: transparent;\n padding: 8px 16px;\n width: auto;\n box-sizing: border-box;\n}\n.jb-input-web-component .message-box {\n font-size: var(--jb-input-message-font-size, 0.7rem);\n padding: 2px 8px;\n color: var(--jb-input-message-color, #929292);\n display: var(--jb-input-message-box-display, block);\n}\n.jb-input-web-component .message-box:empty {\n padding: 0;\n}\n.jb-input-web-component .message-box.error {\n color: var(--jb-input-message-error-color, red);\n}</style>\n\n <div class="jb-input-web-component">\n <label class="--hide"><span class="label-value" part="label"></span></label>\n <div class="input-box">\n <div class="jb-input-start-section-wrapper">\n <slot name="start-section"></slot>\n </div>\n <input part="input"/>\n <div class="jb-input-end-section-wrapper">\n <slot name="end-section"></slot>\n </div>\n </div>\n <div class="message-box" part="message"></div>\n</div>\n ', this.shadowRoot.appendChild(t.content.cloneNode(!0)); }, g = function g() { var _this3 = this; this.elements.input.addEventListener("change", function (t) { return e(_this3, i, "m", C).call(_this3, t); }), this.elements.input.addEventListener("beforeinput", e(this, i, "m", S).bind(this)), this.elements.i