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7B7H,aAAc,gBACdI,aAAc,eACdO,KAAM,EACNmB,IAAK,IAETgG,EAAQ3I,SAASC,IAAIO,aAAa,aAAc,sBAChDmI,EAAQ3I,SAASE,IAAIM,aAAa,aAAc,qBACpD,CAEAgI,YAAAA,GACI,IAAoDI,EAAhDC,EAAMlJ,SAASmJ,iBAAiB/J,KAAKwG,UACzC,IAAKqD,EAAI,EAAGA,EAAIC,EAAIjF,SAAUgF,EAC5B7J,KAAK0J,QAAQI,EAAID,GAEvB,ECtBJjJ,SAASc,iBAAiB,oBAAoB,KAC1C,MAAM8F,EAAQ,IAAIlB,EAAM,iBAClBkD,EAAS9C,EAAE,iBAAiBqC,KAAK,OACtB,IAAIQ,EAAS,gBAAiBC,GAE/C9C,EAAE,qBAAqB2B,GAAG,SAAUhG,IAChCA,EAAEE,iBACFF,EAAE2H,kBAEFxC,EACKP,OACAgD,MAAMC,IACCA,GACAA,EAAEzD,OAAO0D,KAAK,sBAAsBtH,OACxC,GACF,IAGV6D,EAAE,sBAAsB2B,GAAG,SAAUhG,IACjCA,EAAEE,iBACFF,EAAE2H,kBAEFxC,EAAMgB,OAAO,GACf,G","sources":["webpack://sfcc-hastens/../src/ispin.js","webpack://sfcc-hastens/webpack/bootstrap","webpack://sfcc-hastens/webpack/runtime/compat get default export","webpack://sfcc-hastens/webpack/runtime/define property getters","webpack://sfcc-hastens/webpack/runtime/hasOwnProperty shorthand","webpack://sfcc-hastens/./cartridges/app_hastens/cartridge/client/default/js/components/panel.js","webpack://sfcc-hastens/./cartridges/app_hastens/cartridge/client/default/js/components/qtyInput.js","webpack://sfcc-hastens/./cartridges/app_hastens/cartridge/client/default/js/uikit.js"],"sourcesContent":["// @flow\r\n\r\ntype SpinDirection = (1 | -1);\r\ntype SpinOptions = {\r\n wrapperClass: string,\r\n buttonsClass: string,\r\n step: number,\r\n pageStep: number,\r\n repeatInterval: number,\r\n wrapOverflow: boolean,\r\n parse: string => number,\r\n format: number => string,\r\n disabled: boolean,\r\n max?: number,\r\n min?: number,\r\n onChange?: string => void,\r\n};\r\n\r\n\r\nexport default\r\nclass ISpin {\r\n static DEFAULTS: $Shape;\r\n el: HTMLInputElement;\r\n options: SpinOptions;\r\n _onKeyDown: (e: KeyboardEvent) => void;\r\n _onMouseDown: (e: MouseEvent) => void;\r\n _onMouseUp: (e: MouseEvent) => void;\r\n _onMouseLeave: (e: MouseEvent) => void;\r\n _onWheel: (e: WheelEvent) => void;\r\n _wrapper: HTMLElement;\r\n _buttons: {\r\n inc: HTMLButtonElement,\r\n dec: HTMLButtonElement\r\n };\r\n _spinTimer: IntervalID;\r\n\r\n constructor (el: HTMLInputElement, opts: $Shape) {\r\n this.el = el;\r\n // $FlowFixMe temporary assignment\r\n this.options = {};\r\n\r\n this._onKeyDown = this._onKeyDown.bind(this);\r\n this._onMouseDown = this._onMouseDown.bind(this);\r\n this._onMouseUp = this._onMouseUp.bind(this);\r\n this._onMouseLeave = this._onMouseLeave.bind(this);\r\n this._onWheel = this._onWheel.bind(this);\r\n\r\n this.build();\r\n this.update(opts);\r\n }\r\n\r\n build () {\r\n // wrap element\r\n this._wrapper = document.createElement('div');\r\n if (this.el.parentNode) this.el.parentNode.replaceChild(this._wrapper, this.el);\r\n this._wrapper.appendChild(this.el);\r\n\r\n // add buttons\r\n this._buttons = {\r\n inc: document.createElement('button'),\r\n dec: document.createElement('button')\r\n };\r\n\r\n // listen to events\r\n Object.keys(this._buttons).forEach(k => {\r\n const b = this._buttons[k];\r\n this._wrapper.appendChild(b);\r\n b.setAttribute('type', 'button');\r\n b.addEventListener('mousedown', this._onMouseDown);\r\n b.addEventListener('mouseup', this._onMouseUp);\r\n b.addEventListener('mouseleave', this._onMouseLeave);\r\n });\r\n this.el.addEventListener('keydown', this._onKeyDown);\r\n this.el.addEventListener('wheel', this._onWheel);\r\n }\r\n\r\n update (opts: $Shape) {\r\n opts = {\r\n ...ISpin.DEFAULTS,\r\n ...this.options,\r\n ...opts\r\n };\r\n\r\n // update wrapper class\r\n if (opts.wrapperClass !== this.options.wrapperClass) {\r\n if (this.options.wrapperClass) this._wrapper.classList.remove(this.options.wrapperClass);\r\n if (opts.wrapperClass) this._wrapper.classList.add(opts.wrapperClass);\r\n }\r\n\r\n if (opts.buttonsClass !== this.options.buttonsClass) {\r\n if (this.options.buttonsClass) {\r\n Object.keys(this._buttons).forEach(k => {\r\n this._buttons[k].classList.remove(this.options.buttonsClass);\r\n this._buttons[k].classList.remove(this.options.buttonsClass + '-' + k);\r\n });\r\n }\r\n if (opts.buttonsClass) {\r\n Object.keys(this._buttons).forEach(k => {\r\n this._buttons[k].classList.add(opts.buttonsClass);\r\n this._buttons[k].classList.add(opts.buttonsClass + '-' + k);\r\n });\r\n }\r\n }\r\n\r\n this.disabled = opts.disabled;\r\n\r\n Object.assign(this.options, opts);\r\n }\r\n\r\n destroy () {\r\n if (this._wrapper.parentNode) this._wrapper.parentNode.replaceChild(this.el, this._wrapper);\r\n delete this.el;\r\n delete this._wrapper;\r\n delete this._buttons;\r\n }\r\n\r\n _onKeyDown (e: KeyboardEvent) {\r\n switch (e.keyCode) {\r\n case 38: // arrow up\r\n e.preventDefault();\r\n return this.spin(this.options.step);\r\n case 40: // arrow down\r\n e.preventDefault();\r\n return this.spin(-this.options.step);\r\n case 33: // page up\r\n e.preventDefault();\r\n return this.spin(this.options.pageStep);\r\n case 34: // page down\r\n e.preventDefault();\r\n return this.spin(-this.options.pageStep);\r\n }\r\n }\r\n\r\n _onMouseDown (e: MouseEvent) {\r\n e.preventDefault();\r\n\r\n const direction: SpinDirection = e.currentTarget === this._buttons.inc ? 1 : -1;\r\n this.spin(direction * this.options.step);\r\n this.el.focus();\r\n\r\n this._startSpinning(direction);\r\n }\r\n\r\n _onMouseUp (e: MouseEvent) {\r\n this._stopSpinning();\r\n }\r\n\r\n _onMouseLeave (e: MouseEvent) {\r\n this._stopSpinning();\r\n }\r\n\r\n _startSpinning (direction: SpinDirection) {\r\n this._stopSpinning();\r\n this._spinTimer = setInterval(() => this.spin(direction * this.options.step), this.options.repeatInterval);\r\n }\r\n\r\n _stopSpinning () {\r\n clearInterval(this._spinTimer);\r\n }\r\n\r\n _onWheel (e: WheelEvent) {\r\n if (document.activeElement !== this.el) return;\r\n e.preventDefault();\r\n\r\n const direction: SpinDirection = (e.deltaY > 0 ? -1 : 1);\r\n this.spin(direction * this.options.step);\r\n }\r\n\r\n get value (): number {\r\n return this.options.parse(this.el.value) || 0;\r\n }\r\n\r\n set value (value: number) {\r\n const strValue = this.options.format(this.options.parse(String(value)));\r\n this.el.value = strValue;\r\n if (this.options.onChange) this.options.onChange(strValue);\r\n }\r\n\r\n get disabled (): boolean {\r\n return this._buttons.inc.disabled;\r\n }\r\n\r\n set disabled (disabled: boolean) {\r\n if (this.disabled === disabled) return;\r\n\r\n this._buttons.inc.disabled =\r\n this._buttons.dec.disabled = disabled;\r\n }\r\n\r\n get precision (): number {\r\n return Math.max(...[this.options.step, this.options.min]\r\n .filter(v => v != null)\r\n // $FlowFixMe already checked above\r\n .map(precision));\r\n }\r\n\r\n adjustValue (value: number): number {\r\n value = Number(value.toFixed(this.precision));\r\n\r\n if (this.options.max != null && value > this.options.max) value = this.options.max;\r\n if (this.options.min != null && value < this.options.min) value = this.options.min;\r\n\r\n return value;\r\n }\r\n\r\n wrapValue (value: number): number {\r\n if (this.options.wrapOverflow &&\r\n this.options.max != null &&\r\n this.options.min != null\r\n ) {\r\n if (value < this.options.min) value = this.options.max;\r\n else if (value > this.options.max) value = this.options.min;\r\n }\r\n return value;\r\n }\r\n\r\n spin (step: number) {\r\n this.value = this.adjustValue(this.wrapValue(this.value + step));\r\n }\r\n}\r\nISpin.DEFAULTS = {\r\n wrapperClass: 'ispin-wrapper',\r\n buttonsClass: 'ispin-button',\r\n step: 1,\r\n pageStep: 10,\r\n disabled: false,\r\n repeatInterval: 200,\r\n wrapOverflow: false,\r\n parse: Number,\r\n format: String\r\n};\r\n\r\nfunction precision (num: number) {\r\n return (String(num).split('.')[1] || '').length;\r\n}\r\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import loader from './loader';\n\nexport default class Panel {\n constructor(selector, options) {\n this.selector = selector;\n this.$panel = $(selector);\n this.$container = $('body > .page');\n\n this.settings = {\n duration: 350,\n loader: false,\n };\n\n this.settings = Object.assign(this.settings, options);\n\n this.state = {\n open: false,\n };\n\n if (this.settings.loader) {\n this.setLoading();\n }\n\n if ('panels' in window === false) {\n window.panels = [];\n }\n window.panels.push(this);\n\n this.events();\n }\n\n areThereAnyOpenPanels() {\n const openPanels = window.panels.filter((panel) => panel.state.open);\n\n return openPanels.length > 0;\n }\n\n observeLoad() {\n if (!this.$panel.length) {\n return;\n }\n\n // If observer already exists, disconnect and undefine\n if (this.observer) {\n this.observer.disconnect();\n this.observer = undefined;\n }\n\n const config = { attributes: false, childList: true, subtree: false };\n\n const callback = (mutationsList, obsv) => {\n this.$panel.removeClass('loading');\n\n obsv.disconnect();\n };\n\n this.observer = new MutationObserver(callback);\n this.observer.observe(this.$panel.get(0), config);\n }\n\n events() {\n $(document)\n .on('click touchstart', (e) => {\n if ($(e.target).hasClass('page panel-open')) {\n this.close();\n }\n })\n .on('keydown', (e) => {\n if (e.key === 'Escape') {\n this.close();\n }\n });\n\n $('body')\n .on('menu:open', () => {\n this.close();\n });\n }\n\n setLoading() {\n this.$panel.html($(`
${loader()}
`));\n this.$panel.addClass('loading');\n this.observeLoad();\n }\n\n open() {\n return new Promise((resolve, reject) => {\n if (this.isOpen()) {\n reject();\n } else {\n this.$container.addClass(`panel-open ${this.$panel.attr('data-id')}`);\n\n this.$panel\n .show(0)\n .addClass('show');\n\n setTimeout(() => {\n this.$panel.aria('hidden', false);\n this.state.open = true;\n resolve(this);\n }, this.settings.duration);\n\n $('body').trigger('panel:open', this);\n }\n })\n .catch(() => {\n // Panel already open!\n });\n }\n\n close() {\n return new Promise((resolve, reject) => {\n if (!this.isOpen()) {\n reject();\n } else {\n this.$panel.addClass('hiding');\n\n if (!this.areThereAnyOpenPanels()) {\n this.$container.addClass('hiding');\n }\n\n setTimeout(() => {\n this.$panel.hide().removeClass('show hiding');\n this.$container.removeClass(this.$panel.attr('data-id'));\n this.$panel.aria('hidden', false);\n this.state.open = false;\n if (!this.areThereAnyOpenPanels()) {\n this.$container.removeClass('panel-open hiding');\n }\n resolve(this);\n }, this.settings.duration);\n\n $('body').trigger('panel:close', this);\n }\n })\n .catch(() => {\n // Panel not currently open!\n });\n }\n\n setContent(html) {\n this.$panel.html($(html));\n }\n\n isOpen() {\n return !!this.state.open;\n }\n}\n","import ISpin from 'ispin';\n\nexport default class QtyInput {\n constructor(selector, qtyMax) {\n this.selector = selector;\n this.qtyMax = qtyMax;\n this.loopElements();\n }\n\n setInit(element) {\n let spinner = new ISpin(element, {\n wrapperClass: 'ispin-wrapper',\n buttonsClass: 'ispin-button',\n step: 1,\n min: 1\n });\n spinner._buttons.inc.setAttribute('aria-label', 'Increment quantity');\n spinner._buttons.dec.setAttribute('aria-label', 'Decrement quantity');\n }\n\n loopElements() {\n let qty = document.querySelectorAll(this.selector), i;\n for (i = 0; i < qty.length; ++i) {\n this.setInit(qty[i]);\n };\n }\n}\n","import Panel from './components/panel';\nimport QtyInput from './components/qtyInput';\n\ndocument.addEventListener('DOMContentLoaded', () => {\n const panel = new Panel('.uikit__panel');\n const qtyMax = $('.number-input').attr('max');\n const qtyInput = new QtyInput('.number-input', qtyMax);\n\n $('.open-uikit-panel').on('click', (e) => {\n e.preventDefault();\n e.stopPropagation();\n\n panel\n .open()\n .then((p) => {\n if (p) {\n p.$panel.find('.close-uikit-panel').focus();\n }\n });\n });\n\n $('.close-uikit-panel').on('click', (e) => {\n e.preventDefault();\n e.stopPropagation();\n\n panel.close();\n });\n});\n"],"names":["ISpin","el","opts","_classCallCheck","this","options","_onKeyDown","bind","_onMouseDown","_onMouseUp","_onMouseLeave","_onWheel","build","update","_this","_wrapper","document","createElement","parentNode","replaceChild","appendChild","_buttons","inc","dec","Object","keys","forEach","k","b","setAttribute","addEventListener","_this2","_objectSpread","DEFAULTS","wrapperClass","classList","remove","add","buttonsClass","disabled","_extends","e","keyCode","preventDefault","spin","step","pageStep","direction","currentTarget","focus","_startSpinning","_stopSpinning","_this3","_spinTimer","setInterval","repeatInterval","clearInterval","activeElement","deltaY","value","Number","toFixed","precision","max","min","wrapOverflow","adjustValue","wrapValue","parse","strValue","format","String","onChange","Math","apply","_toConsumableArray","filter","v","map","num","split","length","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","call","n","getter","__esModule","d","a","definition","key","o","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","Panel","constructor","selector","$panel","$","$container","settings","duration","loader","assign","state","open","setLoading","window","panels","push","events","areThereAnyOpenPanels","panel","observeLoad","observer","disconnect","MutationObserver","callback","mutationsList","obsv","removeClass","observe","attributes","childList","subtree","on","target","hasClass","close","html","addClass","Promise","resolve","reject","isOpen","attr","show","setTimeout","aria","trigger","catch","hide","setContent","QtyInput","qtyMax","loopElements","setInit","element","spinner","i","qty","querySelectorAll","stopPropagation","then","p","find"],"sourceRoot":""}