@malga-checkout/core
Version:
Core components for Malga Checkout
1,245 lines (1,040 loc) • 106 kB
JavaScript
import { r as registerInstance, c as createEvent, h as h$1, H as Host, F as Fragment } from './index-2a32ffa8.js';
import { c as createCommonjsModule, a as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-ba3f0406.js';
import { Z } from './i18n.es-92f2761e.js';
import { f as formatCurrency } from './currency-22f5cec5.js';
import { p as parseDate, a as formatDate } from './date-c7dc3e83.js';
import './index-9658ddab.js';
function handleClipboardButtonLabel(isMobile, clipboardIsClicked, locale) {
if (clipboardIsClicked) {
return Z('dialogs.common.clipboardClicked', locale);
}
if (isMobile) {
return Z('dialogs.common.clipboard', locale);
}
return Z('dialogs.common.clipboardDescription', locale);
}
var clipboard = createCommonjsModule(function (module, exports) {
/*!
* clipboard.js v2.0.8
* https://clipboardjs.com/
*
* Licensed MIT © Zeno Rocha
*/
(function webpackUniversalModuleDefinition(root, factory) {
module.exports = factory();
})(commonjsGlobal, function() {
return /******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 134:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ clipboard; }
});
// EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js
var tiny_emitter = __webpack_require__(279);
var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter);
// EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js
var listen = __webpack_require__(370);
var listen_default = /*#__PURE__*/__webpack_require__.n(listen);
// EXTERNAL MODULE: ./node_modules/select/src/select.js
var src_select = __webpack_require__(817);
var select_default = /*#__PURE__*/__webpack_require__.n(src_select);
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* Inner class which performs selection from either `text` or `target`
* properties and then executes copy or cut operations.
*/
var ClipboardAction = /*#__PURE__*/function () {
/**
* @param {Object} options
*/
function ClipboardAction(options) {
_classCallCheck(this, ClipboardAction);
this.resolveOptions(options);
this.initSelection();
}
/**
* Defines base properties passed from constructor.
* @param {Object} options
*/
_createClass(ClipboardAction, [{
key: "resolveOptions",
value: function resolveOptions() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
this.action = options.action;
this.container = options.container;
this.emitter = options.emitter;
this.target = options.target;
this.text = options.text;
this.trigger = options.trigger;
this.selectedText = '';
}
/**
* Decides which selection strategy is going to be applied based
* on the existence of `text` and `target` properties.
*/
}, {
key: "initSelection",
value: function initSelection() {
if (this.text) {
this.selectFake();
} else if (this.target) {
this.selectTarget();
}
}
/**
* Creates a fake textarea element, sets its value from `text` property,
*/
}, {
key: "createFakeElement",
value: function createFakeElement() {
var isRTL = document.documentElement.getAttribute('dir') === 'rtl';
this.fakeElem = document.createElement('textarea'); // Prevent zooming on iOS
this.fakeElem.style.fontSize = '12pt'; // Reset box model
this.fakeElem.style.border = '0';
this.fakeElem.style.padding = '0';
this.fakeElem.style.margin = '0'; // Move element out of screen horizontally
this.fakeElem.style.position = 'absolute';
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically
var yPosition = window.pageYOffset || document.documentElement.scrollTop;
this.fakeElem.style.top = "".concat(yPosition, "px");
this.fakeElem.setAttribute('readonly', '');
this.fakeElem.value = this.text;
return this.fakeElem;
}
/**
* Get's the value of fakeElem,
* and makes a selection on it.
*/
}, {
key: "selectFake",
value: function selectFake() {
var _this = this;
var fakeElem = this.createFakeElement();
this.fakeHandlerCallback = function () {
return _this.removeFake();
};
this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
this.container.appendChild(fakeElem);
this.selectedText = select_default()(fakeElem);
this.copyText();
this.removeFake();
}
/**
* Only removes the fake element after another click event, that way
* a user can hit `Ctrl+C` to copy because selection still exists.
*/
}, {
key: "removeFake",
value: function removeFake() {
if (this.fakeHandler) {
this.container.removeEventListener('click', this.fakeHandlerCallback);
this.fakeHandler = null;
this.fakeHandlerCallback = null;
}
if (this.fakeElem) {
this.container.removeChild(this.fakeElem);
this.fakeElem = null;
}
}
/**
* Selects the content from element passed on `target` property.
*/
}, {
key: "selectTarget",
value: function selectTarget() {
this.selectedText = select_default()(this.target);
this.copyText();
}
/**
* Executes the copy operation based on the current selection.
*/
}, {
key: "copyText",
value: function copyText() {
var succeeded;
try {
succeeded = document.execCommand(this.action);
} catch (err) {
succeeded = false;
}
this.handleResult(succeeded);
}
/**
* Fires an event based on the copy operation result.
* @param {Boolean} succeeded
*/
}, {
key: "handleResult",
value: function handleResult(succeeded) {
this.emitter.emit(succeeded ? 'success' : 'error', {
action: this.action,
text: this.selectedText,
trigger: this.trigger,
clearSelection: this.clearSelection.bind(this)
});
}
/**
* Moves focus away from `target` and back to the trigger, removes current selection.
*/
}, {
key: "clearSelection",
value: function clearSelection() {
if (this.trigger) {
this.trigger.focus();
}
document.activeElement.blur();
window.getSelection().removeAllRanges();
}
/**
* Sets the `action` to be performed which can be either 'copy' or 'cut'.
* @param {String} action
*/
}, {
key: "destroy",
/**
* Destroy lifecycle.
*/
value: function destroy() {
this.removeFake();
}
}, {
key: "action",
set: function set() {
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
this._action = action;
if (this._action !== 'copy' && this._action !== 'cut') {
throw new Error('Invalid "action" value, use either "copy" or "cut"');
}
}
/**
* Gets the `action` property.
* @return {String}
*/
,
get: function get() {
return this._action;
}
/**
* Sets the `target` property using an element
* that will be have its content copied.
* @param {Element} target
*/
}, {
key: "target",
set: function set(target) {
if (target !== undefined) {
if (target && _typeof(target) === 'object' && target.nodeType === 1) {
if (this.action === 'copy' && target.hasAttribute('disabled')) {
throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
}
if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
}
this._target = target;
} else {
throw new Error('Invalid "target" value, use a valid Element');
}
}
}
/**
* Gets the `target` property.
* @return {String|HTMLElement}
*/
,
get: function get() {
return this._target;
}
}]);
return ClipboardAction;
}();
/* harmony default export */ var clipboard_action = (ClipboardAction);
function clipboard_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { clipboard_typeof = function _typeof(obj) { return typeof obj; }; } else { clipboard_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return clipboard_typeof(obj); }
function clipboard_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function clipboard_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function clipboard_createClass(Constructor, protoProps, staticProps) { if (protoProps) clipboard_defineProperties(Constructor.prototype, protoProps); if (staticProps) clipboard_defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (clipboard_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
/**
* Helper function to retrieve attribute value.
* @param {String} suffix
* @param {Element} element
*/
function getAttributeValue(suffix, element) {
var attribute = "data-clipboard-".concat(suffix);
if (!element.hasAttribute(attribute)) {
return;
}
return element.getAttribute(attribute);
}
/**
* Base class which takes one or more elements, adds event listeners to them,
* and instantiates a new `ClipboardAction` on each click.
*/
var Clipboard = /*#__PURE__*/function (_Emitter) {
_inherits(Clipboard, _Emitter);
var _super = _createSuper(Clipboard);
/**
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
* @param {Object} options
*/
function Clipboard(trigger, options) {
var _this;
clipboard_classCallCheck(this, Clipboard);
_this = _super.call(this);
_this.resolveOptions(options);
_this.listenClick(trigger);
return _this;
}
/**
* Defines if attributes would be resolved using internal setter functions
* or custom functions that were passed in the constructor.
* @param {Object} options
*/
clipboard_createClass(Clipboard, [{
key: "resolveOptions",
value: function resolveOptions() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
this.text = typeof options.text === 'function' ? options.text : this.defaultText;
this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body;
}
/**
* Adds a click event listener to the passed trigger.
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
*/
}, {
key: "listenClick",
value: function listenClick(trigger) {
var _this2 = this;
this.listener = listen_default()(trigger, 'click', function (e) {
return _this2.onClick(e);
});
}
/**
* Defines a new `ClipboardAction` on each click event.
* @param {Event} e
*/
}, {
key: "onClick",
value: function onClick(e) {
var trigger = e.delegateTarget || e.currentTarget;
if (this.clipboardAction) {
this.clipboardAction = null;
}
this.clipboardAction = new clipboard_action({
action: this.action(trigger),
target: this.target(trigger),
text: this.text(trigger),
container: this.container,
trigger: trigger,
emitter: this
});
}
/**
* Default `action` lookup function.
* @param {Element} trigger
*/
}, {
key: "defaultAction",
value: function defaultAction(trigger) {
return getAttributeValue('action', trigger);
}
/**
* Default `target` lookup function.
* @param {Element} trigger
*/
}, {
key: "defaultTarget",
value: function defaultTarget(trigger) {
var selector = getAttributeValue('target', trigger);
if (selector) {
return document.querySelector(selector);
}
}
/**
* Returns the support of the given action, or all actions if no action is
* given.
* @param {String} [action]
*/
}, {
key: "defaultText",
/**
* Default `text` lookup function.
* @param {Element} trigger
*/
value: function defaultText(trigger) {
return getAttributeValue('text', trigger);
}
/**
* Destroy lifecycle.
*/
}, {
key: "destroy",
value: function destroy() {
this.listener.destroy();
if (this.clipboardAction) {
this.clipboardAction.destroy();
this.clipboardAction = null;
}
}
}], [{
key: "isSupported",
value: function isSupported() {
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
var actions = typeof action === 'string' ? [action] : action;
var support = !!document.queryCommandSupported;
actions.forEach(function (action) {
support = support && !!document.queryCommandSupported(action);
});
return support;
}
}]);
return Clipboard;
}((tiny_emitter_default()));
/* harmony default export */ var clipboard = (Clipboard);
/***/ }),
/***/ 828:
/***/ (function(module) {
var DOCUMENT_NODE_TYPE = 9;
/**
* A polyfill for Element.matches()
*/
if (typeof Element !== 'undefined' && !Element.prototype.matches) {
var proto = Element.prototype;
proto.matches = proto.matchesSelector ||
proto.mozMatchesSelector ||
proto.msMatchesSelector ||
proto.oMatchesSelector ||
proto.webkitMatchesSelector;
}
/**
* Finds the closest parent that matches a selector.
*
* @param {Element} element
* @param {String} selector
* @return {Function}
*/
function closest (element, selector) {
while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
if (typeof element.matches === 'function' &&
element.matches(selector)) {
return element;
}
element = element.parentNode;
}
}
module.exports = closest;
/***/ }),
/***/ 438:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var closest = __webpack_require__(828);
/**
* Delegates event to a selector.
*
* @param {Element} element
* @param {String} selector
* @param {String} type
* @param {Function} callback
* @param {Boolean} useCapture
* @return {Object}
*/
function _delegate(element, selector, type, callback, useCapture) {
var listenerFn = listener.apply(this, arguments);
element.addEventListener(type, listenerFn, useCapture);
return {
destroy: function() {
element.removeEventListener(type, listenerFn, useCapture);
}
}
}
/**
* Delegates event to a selector.
*
* @param {Element|String|Array} [elements]
* @param {String} selector
* @param {String} type
* @param {Function} callback
* @param {Boolean} useCapture
* @return {Object}
*/
function delegate(elements, selector, type, callback, useCapture) {
// Handle the regular Element usage
if (typeof elements.addEventListener === 'function') {
return _delegate.apply(null, arguments);
}
// Handle Element-less usage, it defaults to global delegation
if (typeof type === 'function') {
// Use `document` as the first parameter, then apply arguments
// This is a short way to .unshift `arguments` without running into deoptimizations
return _delegate.bind(null, document).apply(null, arguments);
}
// Handle Selector-based usage
if (typeof elements === 'string') {
elements = document.querySelectorAll(elements);
}
// Handle Array-like based usage
return Array.prototype.map.call(elements, function (element) {
return _delegate(element, selector, type, callback, useCapture);
});
}
/**
* Finds closest match and invokes callback.
*
* @param {Element} element
* @param {String} selector
* @param {String} type
* @param {Function} callback
* @return {Function}
*/
function listener(element, selector, type, callback) {
return function(e) {
e.delegateTarget = closest(e.target, selector);
if (e.delegateTarget) {
callback.call(element, e);
}
}
}
module.exports = delegate;
/***/ }),
/***/ 879:
/***/ (function(__unused_webpack_module, exports) {
/**
* Check if argument is a HTML element.
*
* @param {Object} value
* @return {Boolean}
*/
exports.node = function(value) {
return value !== undefined
&& value instanceof HTMLElement
&& value.nodeType === 1;
};
/**
* Check if argument is a list of HTML elements.
*
* @param {Object} value
* @return {Boolean}
*/
exports.nodeList = function(value) {
var type = Object.prototype.toString.call(value);
return value !== undefined
&& (type === '[object NodeList]' || type === '[object HTMLCollection]')
&& ('length' in value)
&& (value.length === 0 || exports.node(value[0]));
};
/**
* Check if argument is a string.
*
* @param {Object} value
* @return {Boolean}
*/
exports.string = function(value) {
return typeof value === 'string'
|| value instanceof String;
};
/**
* Check if argument is a function.
*
* @param {Object} value
* @return {Boolean}
*/
exports.fn = function(value) {
var type = Object.prototype.toString.call(value);
return type === '[object Function]';
};
/***/ }),
/***/ 370:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var is = __webpack_require__(879);
var delegate = __webpack_require__(438);
/**
* Validates all params and calls the right
* listener function based on its target type.
*
* @param {String|HTMLElement|HTMLCollection|NodeList} target
* @param {String} type
* @param {Function} callback
* @return {Object}
*/
function listen(target, type, callback) {
if (!target && !type && !callback) {
throw new Error('Missing required arguments');
}
if (!is.string(type)) {
throw new TypeError('Second argument must be a String');
}
if (!is.fn(callback)) {
throw new TypeError('Third argument must be a Function');
}
if (is.node(target)) {
return listenNode(target, type, callback);
}
else if (is.nodeList(target)) {
return listenNodeList(target, type, callback);
}
else if (is.string(target)) {
return listenSelector(target, type, callback);
}
else {
throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
}
}
/**
* Adds an event listener to a HTML element
* and returns a remove listener function.
*
* @param {HTMLElement} node
* @param {String} type
* @param {Function} callback
* @return {Object}
*/
function listenNode(node, type, callback) {
node.addEventListener(type, callback);
return {
destroy: function() {
node.removeEventListener(type, callback);
}
}
}
/**
* Add an event listener to a list of HTML elements
* and returns a remove listener function.
*
* @param {NodeList|HTMLCollection} nodeList
* @param {String} type
* @param {Function} callback
* @return {Object}
*/
function listenNodeList(nodeList, type, callback) {
Array.prototype.forEach.call(nodeList, function(node) {
node.addEventListener(type, callback);
});
return {
destroy: function() {
Array.prototype.forEach.call(nodeList, function(node) {
node.removeEventListener(type, callback);
});
}
}
}
/**
* Add an event listener to a selector
* and returns a remove listener function.
*
* @param {String} selector
* @param {String} type
* @param {Function} callback
* @return {Object}
*/
function listenSelector(selector, type, callback) {
return delegate(document.body, selector, type, callback);
}
module.exports = listen;
/***/ }),
/***/ 817:
/***/ (function(module) {
function select(element) {
var selectedText;
if (element.nodeName === 'SELECT') {
element.focus();
selectedText = element.value;
}
else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
var isReadOnly = element.hasAttribute('readonly');
if (!isReadOnly) {
element.setAttribute('readonly', '');
}
element.select();
element.setSelectionRange(0, element.value.length);
if (!isReadOnly) {
element.removeAttribute('readonly');
}
selectedText = element.value;
}
else {
if (element.hasAttribute('contenteditable')) {
element.focus();
}
var selection = window.getSelection();
var range = document.createRange();
range.selectNodeContents(element);
selection.removeAllRanges();
selection.addRange(range);
selectedText = selection.toString();
}
return selectedText;
}
module.exports = select;
/***/ }),
/***/ 279:
/***/ (function(module) {
function E () {
// Keep this empty so it's easier to inherit from
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
}
E.prototype = {
on: function (name, callback, ctx) {
var e = this.e || (this.e = {});
(e[name] || (e[name] = [])).push({
fn: callback,
ctx: ctx
});
return this;
},
once: function (name, callback, ctx) {
var self = this;
function listener () {
self.off(name, listener);
callback.apply(ctx, arguments);
}
listener._ = callback;
return this.on(name, listener, ctx);
},
emit: function (name) {
var data = [].slice.call(arguments, 1);
var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
var i = 0;
var len = evtArr.length;
for (i; i < len; i++) {
evtArr[i].fn.apply(evtArr[i].ctx, data);
}
return this;
},
off: function (name, callback) {
var e = this.e || (this.e = {});
var evts = e[name];
var liveEvents = [];
if (evts && callback) {
for (var i = 0, len = evts.length; i < len; i++) {
if (evts[i].fn !== callback && evts[i].fn._ !== callback)
liveEvents.push(evts[i]);
}
}
// Remove event from queue to prevent memory leak
// Suggested by https://github.com/lazd
// Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
(liveEvents.length)
? e[name] = liveEvents
: delete e[name];
return this;
}
};
module.exports = E;
module.exports.TinyEmitter = E;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ !function() {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function() { return module['default']; } :
/******/ function() { return module; };
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); };
/******/ }();
/******/
/************************************************************************/
/******/ // module exports must be returned from runtime so entry inlining is disabled
/******/ // startup
/******/ // Load entry module and return exports
/******/ return __webpack_require__(134);
/******/ })()
.default;
});
});
const Clipboard = /*@__PURE__*/getDefaultExportFromCjs(clipboard);
const checkoutButtonCss = "@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap\"); :root{--malga-checkout-color-page-background:#eef2f6;--malga-checkout-color-brand-accent-light:#79DBD4;--malga-checkout-color-brand-accent-normal:#39BFAD;--malga-checkout-color-brand-clean:#C3F4EF;--malga-checkout-color-brand-light:#79DBD4;--malga-checkout-color-brand-normal:#39BFAD;--malga-checkout-color-brand-middle:#2FAC9B;--malga-checkout-color-brand-dark:#147F70;--malga-checkout-color-grey-light:#666666;--malga-checkout-color-grey-normal:#4D4D4D;--malga-checkout-color-grey-middle:#333333;--malga-checkout-color-grey-dark:#1A1A1A;--malga-checkout-color-grey-darkness:#000000;--malga-checkout-color-accent-light:#ffffff;--malga-checkout-color-accent-normal:#F1F1F1;--malga-checkout-color-accent-middle:#CBCBCB;--malga-checkout-color-warning-light:#FFF8E6;--malga-checkout-color-warning-normal:#F9DF8D;--malga-checkout-color-warning-middle:#FFA400;--malga-checkout-color-warning-dark:#ED3A3D;--malga-checkout-color-modal-success:#00AE42;--malga-checkout-color-modal-error:#ED3A3D;--malga-checkout-color-modal-neutral:#4D4D4D;--malga-checkout-color-disabled:#F9F9F9;--malga-checkout-color-modal-action-button-error:#000000;--malga-checkout-color-modal-action-button-error-hover:#333333;--malga-checkout-color-modal-action-button-success:#000000;--malga-checkout-color-modal-action-button-success-hover:#333333;--malga-checkout-color-modal-action-button-success-font-color:#ffffff;--malga-checkout-color-modal-action-button-error-font-color:#ffffff;--malga-checkout-typography-family:\"Inter\", sans-serif;--malga-checkout-spacing-xxs:4px;--malga-checkout-spacing-xs:8px;--malga-checkout-spacing-sm:16px;--malga-checkout-spacing-default:24px;--malga-checkout-spacing-md:32px;--malga-checkout-spacing-lg:48px;--malga-checkout-spacing-xlg:64px;--malga-checkout-spacing-xxlg:96px;--malga-checkout-size-min-width:250px;--malga-checkout-border-radius-default:4px;--malga-checkout-border-radius-md:6px;--malga-checkout-border-radius-lg:20px;--malga-checkout-transition-slow:0.3s;--malga-checkout-transition-default:0.5s}.checkout-button__native{font-family:var(--malga-checkout-typography-family);font-size:14px;font-style:normal;font-weight:bold;text-transform:uppercase}.checkout-button__native{font-family:var(--malga-checkout-typography-family);padding:0;margin:0;box-sizing:border-box}.checkout-button__native{display:flex;align-items:center;justify-content:center}.checkout-button__container--full-width{width:100%}.checkout-button__native{transition:background var(--malga-checkout-transition-default) ease;display:flex;flex-direction:row;align-items:center;justify-content:center;cursor:pointer;outline:none;height:40px;padding:0 var(--malga-checkout-spacing-sm);border:0;border-radius:var(--malga-checkout-border-radius-default);background:var(--malga-checkout-color-brand-middle);letter-spacing:1.25px;text-align:center;color:var(--malga-checkout-color-accent-light)}.checkout-button__native:hover{background:var(--malga-checkout-color-brand-normal)}.checkout-button__native:focus{border:2px solid var(--malga-checkout-color-brand-accent-light)}.checkout-button__native:disabled{background:var(--malga-checkout-color-accent-normal);color:var(--malga-checkout-color-accent-middle);cursor:not-allowed}.checkout-button__native:disabled>.icon{color:var(--malga-checkout-color-accent-middle)}.checkout-button__native>checkout-icon>i>svg{color:css(--malga-checkout-color-accent-light)}.checkout-button__native>.icon{height:var(--malga-checkout-spacing-sm);width:var(--malga-checkout-spacing-sm);display:flex;align-items:center;justify-content:center;margin-right:10px;margin-top:3px}.checkout-button__native>.icon-loading{animation:spin 1.5s linear infinite}@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}.checkout-button__native--full-width{width:100%}";
const CheckoutButton = class {
constructor(hostRef) {
registerInstance(this, hostRef);
this.clicked = createEvent(this, "clicked", 7);
this.focused = createEvent(this, "focused", 7);
this.blured = createEvent(this, "blured", 7);
this.disabled = false;
this.type = 'button';
this.onClick = () => {
if (this.isLoading || this.disabled) {
return;
}
this.clicked.emit();
};
this.onFocus = () => {
this.focused.emit();
};
this.onBlur = () => {
this.blured.emit();
};
this.handleDynamicClipboardAttribute = () => {
if (this.clipboardContent) {
return { 'data-clipboard-text': this.clipboardContent };
}
return {};
};
}
componentDidLoad() {
if (this.clipboardContent) {
new Clipboard('#clipboard');
}
}
render() {
return (h$1(Host, { style: { pointerEvents: this.disabled ? 'none' : undefined }, "aria-disabled": this.disabled ? 'true' : null }, h$1("button", Object.assign({ disabled: this.disabled, type: this.type, id: this.clipboardContent ? 'clipboard' : '', class: {
'checkout-button__native': true,
'checkout-button__native--full-width': this.fullWidth,
[this.customClass]: !!this.customClass,
}, onClick: this.onClick, onFocus: this.onFocus, onBlur: this.onBlur }, this.handleDynamicClipboardAttribute()), (!!this.icon || this.isLoading) && (h$1("checkout-icon", { icon: this.isLoading ? 'spinner' : this.icon, class: this.isLoading ? 'icon icon-loading' : 'icon' })), this.isLoading ? Z('common.processing', this.locale) : this.label)));
}
};
CheckoutButton.style = checkoutButtonCss;
const checkoutClipboardButtonCss = "@import url(\"https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap\"); :root{--malga-checkout-color-page-background:#eef2f6;--malga-checkout-color-brand-accent-light:#79DBD4;--malga-checkout-color-brand-accent-normal:#39BFAD;--malga-checkout-color-brand-clean:#C3F4EF;--malga-checkout-color-brand-light:#79DBD4;--malga-checkout-color-brand-normal:#39BFAD;--malga-checkout-color-brand-middle:#2FAC9B;--malga-checkout-color-brand-dark:#147F70;--malga-checkout-color-grey-light:#666666;--malga-checkout-color-grey-normal:#4D4D4D;--malga-checkout-color-grey-middle:#333333;--malga-checkout-color-grey-dark:#1A1A1A;--malga-checkout-color-grey-darkness:#000000;--malga-checkout-color-accent-light:#ffffff;--malga-checkout-color-accent-normal:#F1F1F1;--malga-checkout-color-accent-middle:#CBCBCB;--malga-checkout-color-warning-light:#FFF8E6;--malga-checkout-color-warning-normal:#F9DF8D;--malga-checkout-color-warning-middle:#FFA400;--malga-checkout-color-warning-dark:#ED3A3D;--malga-checkout-color-modal-success:#00AE42;--malga-checkout-color-modal-error:#ED3A3D;--malga-checkout-color-modal-neutral:#4D4D4D;--malga-checkout-color-disabled:#F9F9F9;--malga-checkout-color-modal-action-button-error:#000000;--malga-checkout-color-modal-action-button-error-hover:#333333;--malga-checkout-color-modal-action-button-success:#000000;--malga-checkout-color-modal-action-button-success-hover:#333333;--malga-checkout-color-modal-action-button-success-font-color:#ffffff;--malga-checkout-color-modal-action-button-error-font-color:#ffffff;--malga-checkout-typography-family:\"Inter\", sans-serif;--malga-checkout-spacing-xxs:4px;--malga-checkout-spacing-xs:8px;--malga-checkout-spacing-sm:16px;--malga-checkout-spacing-default:24px;--malga-checkout-spacing-md:32px;--malga-checkout-spacing-lg:48px;--malga-checkout-spacing-xlg:64px;--malga-checkout-spacing-xxlg:96px;--malga-checkout-size-min-width:250px;--malga-checkout-border-radius-default:4px;--malga-checkout-border-radius-md:6px;--malga-checkout-border-radius-lg:20px;--malga-checkout-transition-slow:0.3s;--malga-checkout-transition-default:0.5s}.checkout-clipboard-button__container{display:block;width:100%}.checkout-clipboard-button__button{display:flex;flex-direction:row;align-items:center;border:none;background:transparent;cursor:pointer;margin:0;padding:0}.checkout-clipboard-button__button>checkout-icon{margin-right:var(--malga-checkout-spacing-xs)}.checkout-clipboard-button__button>checkout-typography{text-align:start}.checkout-clipboard-button__button>checkout-typography>span{color:var(--malga-checkout-color-grey-normal)}";
const CheckoutClipboardButton = class {
constructor(hostRef) {
registerInstance(this, hostRef);
}
componentDidLoad() {
new Clipboard('#clipboard');
}
render() {
return (h$1(Host, { class: { 'checkout-clipboard-button__container': true } }, h$1("button", { id: "clipboard", class: { 'checkout-clipboard-button__button': true }, "data-clipboard-text": this.clipboardContent }, h$1("checkout-icon", { icon: "clipboard" }), h$1("checkout-typography", { tag: "span", variation: "label", content: this.label }))));
}
};
CheckoutClipboardButton.style = checkoutClipboardButtonCss;
/*!
* canvas-circular-countdown
* Draw a configurable circular canvas countdown timer
*
* @version v1.5.0
* @author George Raptis <georapbox@gmail.com>
* @homepage https://github.com/georapbox/canvas-circular-countdown#readme
* @repository git+https://github.com/georapbox/canvas-circular-countdown.git
* @license MIT
*/
function t(e){return (t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o);}}function o(t,e,o){return e&&i(t.prototype,e),o&&i(t,o),t}function r(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function n(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,o);}return i}function a(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(Object(i),!0).forEach((function(e){r(t,e,i[e]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e));}));}return t}function s(){return window.performance?window.performance.now():Date.now?Date.now():(new Date).getTime()}function c(t){!1!==t._started&&(t._time=t._time+s()-t._now,t.stop().start(),"function"==typeof t._callback&&t._callback(t));}var u=function(){function t(i,o){e(this,t),this._started=!1,this._now=0,this._time=0,this._duration=i,this._callback=o,i<0&&(this._duration=0),i&&"function"!=typeof i||(this._duration=0,this._callback=i);}return o(t,[{key:"time",value:function(){return {remaining:Math.max(0,this._duration-this._time),elapsed:this._time}}},{key:"start",value:function(t){return t&&this.reset(!0),this._started||Number(this._duration)&&this._time>this._duration||(this._started=!0,this._now=s(),window.requestAnimationFrame(c.bind(this,this))),this}},{key:"stop",value:function(){return this._started=!1,this}},{key:"reset",value:function(t){return t&&this.stop(),this._time=0,this}},{key:"isRunning",value:function(){return this._started}}]),t}();function h(t,e){var i=e.options,o=1.5*Math.PI,r=o+t/50*Math.PI,n=Math.ceil(t),a=i.radius<0?0:i.radius,s=i.radius-i.progressBarOffset-i.progressBarWidth/2;s=s<0?0:s;var c=a,u=a;if(e._ctx.save(),e._ctx.clearRect(0,0,e._canvas.width,e._canvas.height),e._ctx.beginPath(),e._ctx.arc(c,u,a,0,2*Math.PI,!1),e._ctx.fillStyle=i.circleBackgroundColor,e._ctx.fill(),i.progressBarWidth&&(e._ctx.beginPath(),e._ctx.arc(c,u,s,o,4*Math.PI,!1),e._ctx.lineWidth=i.progressBarWidth,e._ctx.strokeStyle=i.emptyProgressBarBackgroundColor,e._ctx.stroke()),i.progressBarWidth&&(e._ctx.beginPath(),e._ctx.arc(c,u,s,o,r,!1),e._ctx.lineWidth=i.progressBarWidth,e._ctx.strokeStyle="function"==typeof i.filledProgressBarBackgroundColor?i.filledProgressBarBackgroundColor(n,e._timer.time()):i.filledProgressBarBackgroundColor,e._ctx.stroke()),"function"==typeof i.showCaption?i.showCaption(n,e._timer.time()):!!i.showCaption){e._ctx.fillStyle="function"==typeof i.captionColor?i.captionColor(n,e._timer.time()):i.captionColor,e._ctx.font="function"==typeof i.captionFont?i.captionFont(n,e._timer.time()):i.captionFont,e._ctx.textBaseline="middle",e._ctx.textAlign="center";var h="".concat(n,"%");if("string"==typeof i.captionText?h=i.captionText:"function"==typeof i.captionText&&(h=i.captionText(n,e._timer.time())),e._ctx.fillText(h,c,u),e._ctx.restore(),"function"==typeof i.draw){var f=2*i.radius;e._ctx.beginPath(),i.draw(e._ctx,{percentage:n,time:e._timer.time(),width:f,height:f});}}}function f(t){var e=t.getContext("2d"),i=window.devicePixelRatio||1,o=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1,r=i/o;if(i!==o){var n=t.width,a=t.height;t.width=Math.round(n*r),t.height=Math.round(a*r),t.style.width=n+"px",t.style.height=a+"px",e.scale(r,r);}return e}function p(t,e,i){if("number"!=typeof t||"number"!=typeof e||"number"!=typeof i)throw new TypeError('"normalise" expects numbers as arguments');return (t-e)/(i-e)}var l=function(){function i(o,r,n){var s=this;e(this,i);if("function"==typeof r&&(n=r,r={}),this.options=a(a({},{duration:6e4,radius:150,progressBarWidth:15,progressBarOffset:5,circleBackgroundColor:"#ffffff",emptyProgressBarBackgroundColor:"#dddddd",filledProgressBarBackgroundColor:"#00bfeb",showCaption:!0,captionColor:"#343a40",captionFont:"20px sans-serif"}),r),"number"!=typeof this.options.duration)throw new TypeError("Expected a number for duration, instead got ".concat(t(this.options.duration)));if("CANVAS"===o.nodeName)this._canvas=o;else {var c=document.createElement("canvas");o.appendChild(c),this._canvas=c;}var l=function(t){var e=100*p(t.time().remaining,0,s.options.duration);h(e,s),"function"==typeof n&&n(Math.ceil(e),t.time(),s);},d="number"==typeof this.options.throttle&&!Number.isNaN(this.options.throttle)&&this.options.throttle<=this.options.duration;this._timer=new u(this.options.duration,d?function(t,e){var i,o;if("function"!=typeof t)throw new TypeError("Expected a function for first argument");return function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];o?(clearTimeout(i),i=setTimeout((function(){Date.now()-o>=e&&(t.apply(void 0,n),o=Date.now());}),e-(Date.now()-o)||0)):(t.apply(void 0,n),o=Date.now());}}(l,this.options.throttle):l),this._canvas.width=2*this.options.radius,this._canvas.height=2*this.options.radius,this._ctx=f(this._canvas),h(100,this);}return o(i,[{key:"style",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{delete t.duration;}catch(t){}var e=a({},this.options);this.options=a(a({duration:this.options.duration},e),t);var i=100*p(this._timer.time().remaining,0,this.options.duration);return this._canvas.width=2*this.options.radius,this._canvas.height=2*this.options.radius,this._ctx=f(this._canvas),h(i,this),this}},{key:"start",value:function(){return 0===this.options.duration||this._timer.start(!1),this}},{key:"stop",value:function(){return this._timer.stop(),this}},{key:"reset",value:function(){return this._timer.reset(!0),h(100,this),this}}]),i}();
var easytimer = createCommonjsModule(function (module, exports) {
/**
* easytimer.js
* Generated: 2021-09-24
* Version: 4.5.1
*/
(function (global, factory) {
factory(exports) ;
})(commonjsGlobal, (function (exports) {
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function leftPadding(string, padLength, character) {
var i;
var characters = '';
string = typeof string === 'number' ? String(string) : string;
if (string.length > padLength) {
return string;
}
for (i = 0; i < padLength; i = i + 1) {
characters += String(character);
}
return (characters + string).slice(-characters.length);
}
function TimeCounter() {
this.reset();
}
/**
* [toString convert the counted values on a string]
* @param {array} units [array with the units to display]
* @param {string} separator [separator of the units]
* @param {number} leftZeroPadding [number of zero padding]
* @return {string} [result string]
*/
TimeCounter.prototype.toString = function () {
var units = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['hours', 'minutes', 'seconds'];
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ':';
var leftZeroPadding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
units = units || ['hours', 'minutes', 'seconds'];
separator = separator || ':';
leftZeroPadding = leftZeroPadding || 2;
var arrayTime = [];
var i;
for (i = 0; i < units.length; i = i + 1) {
if (this[units[i]] !== undefined) {
if (units[i] === 'secondTenths') {
arrayTime.push(this[units[i]]);
} else {
arrayTime.push(leftPadding(this[units[i]], leftZeroPadding, '0'));
}
}
}
return arrayTime.join(separator);
};
/**
* [reset reset counter]
*/
TimeCounter.prototype.reset = function () {
this.secondTenths = 0;
this.seconds = 0;
this.minutes = 0;
this.hours = 0;
this.days = 0;
};
function EventEmitter() {
this.events = {};
}
EventEmitter.prototype.on = function (event, listener) {
var _this = this;
if (!Array.isArray(this.events[event])) {
this.events[event] = [];
}
this.events[event].push(listener);
return function () {
return _this.removeListener(event, listener);
};
};
EventEmitter.prototype.removeListener = function (event, listener) {
if (Array.isArray(this.events[event])) {
var eventIndex = this.events[event].indexOf(listener);
if (eventIndex > -1) {
this.events[event].splice(eventIndex, 1);
}
}
};
EventEmitter.prototype.removeAllListeners = function (event) {
if (!event) {
this.events = {};
} else if (Array.isArray(this.events[event])) {
this.events[event] = [];
}
};
EventEmitter.prototype.emit = function (event) {
var _this2 = this;
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
if (Array.isArray(this.events[event])) {
this.events[event].forEach(function (listener) {
return listener.apply(_this2, args);
});
}
};
/*
* General functions, variables and constants
*/
var SECOND_TENTHS_PER_SECOND = 10;
var SECONDS_PER_MINUTE = 60;
var MINUTES_PER_HOUR = 60;
var HOURS_PER_DAY = 24;
var SECOND_TENTHS_POSITION = 0;
var SECONDS_POSITION = 1;
var MINUTES_POSITION = 2;
var HOURS_POSITION = 3;
var DAYS_POSITION = 4;
var SECOND_TENTHS = 'secondTenths';
var SECONDS = 'seconds';
var MINUTES = 'minutes';
var HOURS = 'hours';
var DAYS = 'days';
var VALID_INPUT_VALUES = [SECOND_TENT