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EAAE,GAAG,CAAC,CAAC,CAAC;SAC5E;IACL,CAAC;AACL,CAAC;AAtFY,2BAAmB,uBAsF/B;AAED,+BAAmB,GAAE,CAAC;;;;;;;UCnGtB;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;UAEA;UACA;;;;;WC5BA;WACA;WACA;WACA;WACA,+BAA+B,wCAAwC;WACvE;WACA;WACA;WACA;WACA,iBAAiB,qBAAqB;WACtC;WACA;WACA,kBAAkB,qBAAqB;WACvC;WACA;WACA,KAAK;WACL;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;WC3BA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,GAAG;WACH;WACA;WACA,CAAC;;;;;WCPD;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;WCNA;WACA;WACA;WACA;WACA;;;;;WCJA;;WAEA;WACA;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA,MAAM,qBAAqB;WAC3B;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;;;;;UEhDA;UACA;UACA;UACA;UACA","sources":["webpack://Library/webpack/universalModuleDefinition","webpack://Library/./Static/javascript/ace/pages/giftCertificatePage/gift-certificate-page.ts","webpack://Library/webpack/bootstrap","webpack://Library/webpack/runtime/chunk loaded","webpack://Library/webpack/runtime/compat get default export","webpack://Library/webpack/runtime/define property getters","webpack://Library/webpack/runtime/global","webpack://Library/webpack/runtime/hasOwnProperty shorthand","webpack://Library/webpack/runtime/make namespace object","webpack://Library/webpack/runtime/node module decorator","webpack://Library/webpack/runtime/jsonp chunk loading","webpack://Library/webpack/before-startup","webpack://Library/webpack/startup","webpack://Library/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Library\"] = factory();\n\telse\n\t\troot[\"Library\"] = factory();\n})(self, () => {\nreturn ","import { AmountSelection } from '../../../modules/amount-selection';\r\n\r\nconst imageAttribute = \"data-preview-selected-image\";\r\nconst imageRadioAttribute = \"data-preview-image-radio\";\r\nconst imagePathInputAttribute = \"data-preview-selected-value\";\r\nconst imagePathInputName = \"ImageUrl\";\r\nconst formFieldAttribute = \"data-preview-field\";\r\nconst amountRadioGroupName = \"GiftCertificatesRequest.Amount\";\r\nconst amountLabelAttribute = \"data-amount-name\";\r\nconst imageApiRoute = \"/ace-api/gift/preview\";\r\n\r\nexport const giftCertificatePage = () => {\r\n let queryStringElements = [];\r\n let altTextElements = [];\r\n const previewImage = document.querySelector(`[${imageAttribute}]`) as HTMLImageElement;\r\n const designRadios = [].slice.call(document.querySelectorAll(`[${imageRadioAttribute}]`)) as HTMLInputElement[];\r\n const formInputs = document.querySelectorAll(`[${formFieldAttribute}]`);\r\n const hiddenInput = document.querySelector(`[${imagePathInputAttribute}]`) as HTMLInputElement;\r\n const amountGroup = [].slice.call(document.querySelectorAll(`[name=\"${amountRadioGroupName}\"]`)) as HTMLInputElement[];\r\n let selectedDesign = document.querySelector(`[${imageRadioAttribute}]:checked`) as HTMLInputElement || designRadios[0];\r\n\r\n // Amount radio inputs + custom textbox\r\n const customAmountInput = document.querySelector('#Amounts_custom-field') as HTMLInputElement;\r\n const customAmountRadio = document.querySelector('#Amounts_custom') as HTMLInputElement;\r\n const amountName = customAmountInput?.getAttribute(amountLabelAttribute);\r\n\r\n // Bind radio buttons to create a new preview\r\n designRadios.forEach(designRadio => {\r\n designRadio.addEventListener('change', () => {\r\n designRadios.forEach(radioInGroup => {\r\n if (radioInGroup.checked) {\r\n updateSelectedDesign(radioInGroup.value);\r\n }\r\n })\r\n });\r\n });\r\n\r\n // Bind inputs to refresh preview image when they change text\r\n [].forEach.call(formInputs, (input) => {\r\n input.addEventListener(\"change\", () => {\r\n updateImagePreview();\r\n });\r\n });\r\n\r\n // Initialize preview to the first image (or already-selected image if refreshed/user has gone back in browser)\r\n selectedDesign.checked = true;\r\n updateSelectedDesign(selectedDesign.value);\r\n\r\n if (customAmountInput && amountGroup) {\r\n const amountSelection = new AmountSelection(customAmountInput, amountGroup, customAmountRadio);\r\n amountSelection.on('inputBlur', () => {\r\n updateImagePreview();\r\n });\r\n\r\n amountGroup.forEach(radio => {\r\n radio.addEventListener('change', updateImagePreview);\r\n });\r\n }\r\n\r\n function updateSelectedDesign(selectedDesignUrl) {\r\n // set hidden field value to the new item\r\n hiddenInput.value = selectedDesignUrl;\r\n\r\n updateImagePreview();\r\n }\r\n\r\n function updateImagePreview() {\r\n // Find selected amount and add to query string\r\n const checkedAmount = document.querySelector(`[name=\"${amountRadioGroupName}\"]:checked`) as HTMLInputElement;\r\n appendToQueryString(checkedAmount, amountName);\r\n\r\n // Update query string with current values from all other fields\r\n [].forEach.call(formInputs, input => {\r\n appendToQueryString(input);\r\n });\r\n\r\n // Set image src to api route with query params applied\r\n const serializedQueryString = queryStringElements.join(\"&\");\r\n const currentAltText = altTextElements.join(\", \");\r\n previewImage.src = `${imageApiRoute}?${serializedQueryString}`;\r\n previewImage.alt = currentAltText;\r\n queryStringElements = [];\r\n altTextElements = [];\r\n }\r\n\r\n function appendToQueryString(input: HTMLInputElement, paramName?: string) {\r\n // Get the query string param name from the preview field attribute value\r\n paramName = paramName == null ? input.getAttribute(formFieldAttribute) : paramName;\r\n const paramValue = input?.value;\r\n if (paramName && paramValue) {\r\n queryStringElements.push(`${paramName}=${paramValue}`);\r\n }\r\n\r\n if (paramName != imagePathInputName) {\r\n altTextElements.push((`${paramName}: ${paramValue}`).replace(/\"/g, \"'\"));\r\n }\r\n }\r\n}\r\n\r\ngiftCertificatePage();","// 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\tid: moduleId,\n\t\tloaded: false,\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// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\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__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t\"gift-certificates\": 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkLibrary\"] = self[\"webpackChunkLibrary\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [\"common\"], () => (__webpack_require__(\"./Static/javascript/ace/pages/giftCertificatePage/gift-certificate-page.ts\")))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n",""],"names":[],"sourceRoot":""}