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4H,qBAEP,EAMO,YAAAA,qBAAP,SAA4BtF,G,QAI3B,OAFwB,QAAxB,EAAY,QAAZ,EAAApE,OAAOC,aAAK,eAAE0J,kBAAU,SAAEC,kBAAkB9H,OAErC,CACR,EAuED,EApzBA,GAszBA9B,OAAO6J,sBAAwBA,C","sources":["webpack:///webpack/bootstrap","webpack:///webpack/runtime/compat get default export","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///external window \"jQuery\"","webpack:///./js/src/frontend.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\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))","const __WEBPACK_NAMESPACE_OBJECT__ = window[\"jQuery\"];","import $ from 'jquery';\n\n// eslint-disable-next-line import/no-unresolved\nimport './frontend.css';\n\n// Store GFPCL instance in window, so it can be accessed immediately even if Page Conditional Logic inits early.\nwindow.gform.addAction(\n\t'gform_frontend_pages_evaluated',\n\t(pages: any, formId: number, self: any) => {\n\t\t(window as any)[`gspc_gfpcl_${formId}`] = self;\n\t}\n);\n\ninterface GSProductConfiguratorArgs {\n\tformId: number;\n\tisAjax: boolean;\n\tproductBasePriceFieldId: number;\n\tproductType: string;\n\tcanEditForms: boolean;\n}\n\ninterface GSProductConfigurator extends GSProductConfiguratorArgs {}\n\nclass GSProductConfigurator implements GSProductConfigurator {\n\tpublic formId!: number;\n\tpublic currentPage?: number;\n\tpublic gfPageConditionalLogic?: any;\n\tpublic pageClIsOnLastVisiblePage?: boolean;\n\n\t/**\n\t * Store quantity div in case it's detached with AJAX forms.\n\t */\n\tpublic _$quantityDiv?: JQuery;\n\n\tpublic quantityDivSelector = 'div.quantity';\n\n\t/**\n\t * Store Add to Cart button in case it's detached with AJAX forms.\n\t */\n\tpublic _$addToCart?: JQuery;\n\n\tpublic addToCartSelector =\n\t\t'button[name=\"add-to-cart\"], button[class*=\"add_to_cart_button\"]';\n\n\t/**\n\t * Use a getter as the form element can become detached with AJAX forms.\n\t */\n\tget $formEl(): JQuery {\n\t\treturn $(`#gform_${this.formId}`);\n\t}\n\n\t/**\n\t * Use a getter as the form element can become detached with AJAX forms.\n\t */\n\tget $currentPage(): JQuery {\n\t\treturn $(`#gform_page_${this.formId}_${this.currentPage}`);\n\t}\n\n\t/**\n\t * Use a getter as the form element can become detached with AJAX forms.\n\t */\n\tget $formFooter(): JQuery {\n\t\tif (this.$currentPage.length) {\n\t\t\treturn this.$currentPage.find('.gform_page_footer');\n\t\t}\n\n\t\treturn this.$formEl.find('.gform_footer');\n\t}\n\n\tconstructor(args: GSProductConfiguratorArgs) {\n\t\t// Do not re-create the entire object if it already exists.\n\t\tconst existingInstance = (window as any)?.[\n\t\t\t`gs_product_configurator_${args.formId}`\n\t\t];\n\n\t\tif (existingInstance) {\n\t\t\tthis.gfPageConditionalLogic = undefined;\n\t\t\texistingInstance.bindFormEventsGFPL();\n\t\t\texistingInstance.bindFormEventsGPPT();\n\n\t\t\treturn;\n\t\t}\n\n\t\tObject.assign(this, args);\n\n\t\tif (this.canEditForms) {\n\t\t\tthis.showAdminAlerts();\n\t\t}\n\n\t\t// Bind events for both non-AJAX and AJAX forms.\n\t\tthis.bindGlobalEvents();\n\t\tthis.bindProductImageEvents();\n\t\tthis.bindWCBookingsEvents();\n\t\tthis.bindAddToCartClick();\n\n\t\t// Cache quantity div and Add to Cart button.\n\t\tif (this.isAjax) {\n\t\t\tthis.cacheQuantityDiv();\n\t\t\tthis.cacheAddToCart();\n\t\t}\n\n\t\t// Set gfPageConditionalLogic from window if it exists. In some cases Page CL is inited before this init script.\n\t\tthis.gfPageConditionalLogic = (window as any)?.[\n\t\t\t`gspc_gfpcl_${this.formId}`\n\t\t];\n\n\t\t// Do not do anything more if the form doesn't have pages.\n\t\tif (this.$formEl.find('.gform_page').length <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.isAjax) {\n\t\t\tthis.bindEventsAJAX();\n\t\t\tthis.bindFormEventsGPPT();\n\t\t} else {\n\t\t\t// Set current page for non-AJAX forms.\n\t\t\t// @ts-ignore\n\t\t\tthis.setCurrentPage(\n\t\t\t\tparseInt(\n\t\t\t\t\t$(\n\t\t\t\t\t\t`#gform_source_page_number_${this.formId}`\n\t\t\t\t\t).val() as string,\n\t\t\t\t\t10\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\tthis.bindFormEventsGFPL();\n\t\tthis.updateUI();\n\t}\n\n\t/**\n\t * Displays various errors useful to admins.\n\t */\n\tpublic showAdminAlerts() {\n\t\t/*\n\t\t * If the form is detected as a multi-page form and the product type is \"booking\", show an alert. This is because\n\t\t * when navigating a multi-page form, the selected booking time is lost.\n\t\t */\n\t\tif (\n\t\t\tthis.productType === 'booking' &&\n\t\t\tthis.$formEl.find('.gform_page').length > 1\n\t\t) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t`GS Product Configurator: The form with ID ${this.formId} is a multi-page form and the product type is \"booking\". When navigating a multi-page form, the selected booking time is lost.`\n\t\t\t);\n\n\t\t\t// eslint-disable-next-line no-alert\n\t\t\twindow.alert(\n\t\t\t\t`(Only visible to admins)\\n\\nGS Product Configurator: The form with ID ${this.formId} is a multi-page form and the product type is \"booking\". When navigating a multi-page form, the selected booking time is lost.`\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Bind events for all form types (AJAX and non-AJAX)\n\t */\n\tpublic bindGlobalEvents() {\n\t\twindow.gform.addFilter(\n\t\t\t'gform_spinner_target_elem',\n\t\t\t($target: JQuery, formId: number) => {\n\t\t\t\tif (formId !== this.formId) {\n\t\t\t\t\treturn $target;\n\t\t\t\t}\n\n\t\t\t\tconst $addToCart = this.$formEl.find(\n\t\t\t\t\t'[name=\"add-to-cart\"]:visible'\n\t\t\t\t);\n\n\t\t\t\tif ($addToCart.length) {\n\t\t\t\t\treturn $addToCart;\n\t\t\t\t}\n\n\t\t\t\treturn $target;\n\t\t\t},\n\t\t\t50,\n\t\t\t'gspc_set_spinner_target'\n\t\t);\n\n\t\twindow.gform.addFilter(\n\t\t\t'gform_abort_conditional_logic_do_action',\n\t\t\t(\n\t\t\t\tshouldAbort,\n\t\t\t\taction,\n\t\t\t\ttargetId,\n\t\t\t\tanimation,\n\t\t\t\tdefaultValues,\n\t\t\t\tisInit,\n\t\t\t\tformId\n\t\t\t) => {\n\t\t\t\tif (\n\t\t\t\t\tparseInt(formId) === this.formId &&\n\t\t\t\t\ttargetId === `#gform_submit_button_${this.formId}`\n\t\t\t\t) {\n\t\t\t\t\t// We prevent the conditional logic callback from executing as it will trigger the `gform_post_conditional_logic`\n\t\t\t\t\t// which is causing some weird race condition when the dependent field is a calculated field. See Ticket #70013\n\t\t\t\t\twindow.do_callback = null;\n\t\t\t\t}\n\n\t\t\t\treturn shouldAbort;\n\t\t\t}\n\t\t);\n\n\t\twindow.gform.addAction(\n\t\t\t'gform_post_conditional_logic_field_action',\n\t\t\t(formId, action, targetId, defaultValues, isInit) => {\n\t\t\t\tif (parseInt(formId) !== this.formId) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (targetId !== `#gform_submit_button_${this.formId}`) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (action === 'show') {\n\t\t\t\t\tthis.$formEl.removeClass(\n\t\t\t\t\t\t'gspc__form--submit-conditionally-hidden'\n\t\t\t\t\t);\n\t\t\t\t} else if (action === 'hide') {\n\t\t\t\t\tthis.$formEl.addClass(\n\t\t\t\t\t\t'gspc__form--submit-conditionally-hidden'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis.bindEventsAJAX();\n\n\t\twindow.gform.addFilter(\n\t\t\t'gform_is_value_match',\n\t\t\tthis.isValidMatchVariation\n\t\t);\n\t\twindow.gform.addFilter(\n\t\t\t'gform_is_value_match',\n\t\t\tthis.isValidMatchQuantity\n\t\t);\n\n\t\t// Trigger conditional logic when a variation changes.\n\t\tthis.$formEl.on('change', 'select[data-attribute_name]', (event) => {\n\t\t\tconst attributeName = $(event?.currentTarget)\n\t\t\t\t.data('attribute_name')\n\t\t\t\t.replace('attribute_', '');\n\t\t\tconst dependents = this.getConditionalLogicDependents(\n\t\t\t\t`gspc_product_variation_${attributeName}`\n\t\t\t);\n\n\t\t\twindow?.gf_apply_rules?.(this.formId, dependents);\n\t\t});\n\n\t\t// Trigger conditional logic when the WooCommerce quantity changes.\n\t\tthis.getQuantityInput().on('change keyup', (event) => {\n\t\t\tconst dependents =\n\t\t\t\tthis.getConditionalLogicDependents('gspc_quantity');\n\n\t\t\twindow?.gf_apply_rules?.(this.formId, dependents);\n\t\t});\n\n\t\t// Update the base product price when a variation changes.\n\t\tthis.$formEl.on('found_variation', (event, variation) => {\n\t\t\tthis.updateProductPrice(variation.display_price);\n\n\t\t\t// Update input_gspc_variation_id hidden input to be used primarily with GPPA.\n\t\t\tthis.$formEl\n\t\t\t\t.find(`[name=\"input_gspc_variation_id\"]`)\n\t\t\t\t.val(variation.variation_id);\n\t\t});\n\n\t\t// Handle resetting variations (conditional logic, etc)\n\t\tthis.$formEl.on('reset_data', (event) => {\n\t\t\tlet dependents: string[] = [];\n\n\t\t\tthis.$formEl.find('select[data-attribute_name]').each((i, el) => {\n\t\t\t\tconst attributeName = $(el)\n\t\t\t\t\t.data('attribute_name')\n\t\t\t\t\t.replace('attribute_', '');\n\n\t\t\t\tdependents = [\n\t\t\t\t\t...dependents,\n\t\t\t\t\t...this.getConditionalLogicDependents(\n\t\t\t\t\t\t`gspc_product_variation_${attributeName}`\n\t\t\t\t\t),\n\t\t\t\t];\n\t\t\t});\n\n\t\t\twindow?.gf_apply_rules?.(this.formId, dependents);\n\n\t\t\t// Update input_gspc_variation_id hidden input to be used primarily with GPPA.\n\t\t\tthis.$formEl.find(`[name=\"input_gspc_variation_id\"]`).val('');\n\n\t\t\t// Update the price\n\t\t\tthis.updateProductPrice(\n\t\t\t\tthis.$formEl.find('[name=\"gspc_product_price\"]').val() as number\n\t\t\t);\n\t\t});\n\n\t\t// Add the Add to Cart button inside the form to GPPA's submit button list, so it can be enabled/disabled.\n\t\twindow.gform.addFilter(\n\t\t\t'gppa_submit_button',\n\t\t\tfunction ($submitButton: JQuery, $form: JQuery) {\n\t\t\t\treturn $submitButton.add(\n\t\t\t\t\t$form.find('button[name=\"add-to-cart\"]')\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Update WooCommerce product price. Used for changing the WooCommerce product price that's injected into the form.\n\t */\n\tpublic updateProductPrice(price: number) {\n\t\tconst $basePriceInput = this.$formEl.find(\n\t\t\t`#ginput_base_price_${this.formId}_${this.productBasePriceFieldId}`\n\t\t);\n\n\t\tif (!$basePriceInput.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currency = new window.Currency(\n\t\t\twindow.gf_global.gf_currency_config\n\t\t);\n\n\t\tconst value = currency.toMoney(price, true);\n\t\tif (value !== $basePriceInput.val()) {\n\t\t\t$basePriceInput.val(value).trigger('change');\n\t\t}\n\n\t\twindow.gformCalculateTotalPrice(this.formId);\n\t}\n\n\t/**\n\t * Find conditional logic dependents that either match a fieldId literally or using a callback.\n\t */\n\tpublic getConditionalLogicDependents(\n\t\tfieldId: string | ((fieldId: number | string) => boolean)\n\t): string[] {\n\t\tconst cl = window?.gf_form_conditional_logic?.[this.formId];\n\n\t\tif (!cl) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst dependents = [];\n\n\t\tfor (const [logicFieldId, logic] of Object.entries(cl.logic)) {\n\t\t\t// @ts-ignore\n\t\t\tif (!logic.field) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// @ts-ignore\n\t\t\tfor (const rule of logic.field.rules) {\n\t\t\t\tif (typeof fieldId === 'function') {\n\t\t\t\t\tif (!fieldId(rule.fieldId)) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t} else if (rule.fieldId !== fieldId) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tdependents.push(logicFieldId);\n\t\t\t}\n\t\t}\n\n\t\treturn dependents;\n\t}\n\n\t/**\n\t * Bind callbacks on a variety of events such as the page changing.\n\t */\n\tpublic bindEventsAJAX() {\n\t\t$(document).on(\n\t\t\t'gform_page_loaded',\n\t\t\t(event, formId: number, currentPage: string) => {\n\t\t\t\t// eslint-disable-next-line eqeqeq\n\t\t\t\tif (formId != this.formId) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.setCurrentPage(parseInt(currentPage));\n\t\t\t\tthis.updateUI();\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Bind callbacks on the form el for Page Conditional Logic\n\t */\n\tpublic bindFormEventsGFPL() {\n\t\twindow.gform.addAction(\n\t\t\t'gform_frontend_pages_evaluated',\n\t\t\t(pages: any, formId: number, self: any) => {\n\t\t\t\tif (formId !== this.formId) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (typeof this.gfPageConditionalLogic === 'undefined') {\n\t\t\t\t\tthis.gfPageConditionalLogic = self;\n\t\t\t\t}\n\n\t\t\t\tthis.updateUI();\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Helper method to swap out the product image.\n\t */\n\tpublic swapProductImageUsingChoice(choice: any) {\n\t\t// If this field is hidden, don't do anything.\n\t\tif ($(choice).closest('.gfield').is(':hidden')) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst image = $(choice).attr('data-gspc-product-image') as string;\n\n\t\tthis.swapProductImage(image, $(choice).closest('.product'));\n\t}\n\n\t/**\n\t * Helper method to swap out the product image.\n\t */\n\tpublic swapProductImage(image: string, $product: JQuery) {\n\t\tif (!image) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst $productGallery = $product.find('.images');\n\t\tconst $galleryNav = $product.find('.flex-control-nav');\n\t\tconst $galleryImg = $galleryNav.find('li:eq(0) img');\n\n\t\tconst $productImgWrap = $productGallery\n\t\t\t.find(\n\t\t\t\t'.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder'\n\t\t\t)\n\t\t\t.eq(0);\n\n\t\tconst $productImg = $productImgWrap.find('.wp-post-image');\n\t\tconst $productLink = $productImgWrap.find('a').eq(0);\n\n\t\t// Store the original image in a data attribute so we can swap it back later.\n\t\tif (!$productImg.data('original-image')) {\n\t\t\t$productImg.data(\n\t\t\t\t'original-image',\n\t\t\t\t$productImg.attr('src') as string\n\t\t\t);\n\t\t}\n\n\t\tconst tempImg = new Image();\n\t\ttempImg.src = image;\n\n\t\ttempImg.onload = function () {\n\t\t\tconst width = tempImg.width;\n\t\t\tconst height = tempImg.height;\n\n\t\t\t$productImg.removeAttr('height');\n\t\t\t$productImg.removeAttr('width');\n\t\t\t$productImg.attr('srcset', image);\n\t\t\t$productImg.removeAttr('sizes');\n\t\t\t$productImg.removeAttr('title');\n\t\t\t$productImg.removeAttr('data-caption');\n\t\t\t$productImg.removeAttr('alt');\n\t\t\t$productImg.attr('data-src', image);\n\t\t\t$productImg.attr('data-large_image', image);\n\t\t\t$productImg.attr('data-large_image_width', width);\n\t\t\t$productImg.attr('data-large_image_height', height);\n\t\t\t$productImgWrap.attr('data-thumb', image);\n\t\t\t$galleryImg.attr('src', image);\n\t\t\t$productLink.attr('href', image);\n\n\t\t\twindow.setTimeout(function () {\n\t\t\t\t$(window).trigger('resize');\n\t\t\t\t$productGallery.trigger('woocommerce_gallery_init_zoom');\n\t\t\t}, 20);\n\t\t};\n\t}\n\n\t/**\n\t * Bind events to handle product images being swapped out with form fields.\n\t */\n\tpublic bindProductImageEvents() {\n\t\tconst self = this;\n\n\t\t// Find any choices with [data-gspc-product-image] and immediately update the product image to selected choices.\n\t\t$('[data-gspc-product-image]').each(function () {\n\t\t\t// Ensure that the option or radio is selected\n\t\t\tif ($(this).is(':selected') || $(this).is(':checked')) {\n\t\t\t\tself.swapProductImageUsingChoice(this);\n\t\t\t}\n\t\t});\n\n\t\t// Add event listener to forms to listen for changes to choices with the data attribute.\n\t\t$('.gspc__form-wrapper').on(\n\t\t\t'change',\n\t\t\t'input[type=\"radio\"]',\n\t\t\tfunction () {\n\t\t\t\tif ($(this).is('[data-gspc-product-image]')) {\n\t\t\t\t\tself.swapProductImageUsingChoice(this);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\t$('.gspc__form-wrapper').on('change', 'select', function () {\n\t\t\tconst $selectedChoice = $(this).find(':selected');\n\n\t\t\tif ($selectedChoice.is('[data-gspc-product-image]')) {\n\t\t\t\tself.swapProductImageUsingChoice($selectedChoice);\n\t\t\t}\n\t\t});\n\n\t\t// Bind a listener to conditional logic to update the product image when a field is shown.\n\t\twindow.gform.addAction(\n\t\t\t'gform_post_conditional_logic_field_action',\n\t\t\t(formId, action, targetId, defaultValues, isInit) => {\n\t\t\t\tif (parseInt(formId) !== this.formId) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst $target = $(targetId);\n\n\t\t\t\tif (action === 'hide') {\n\t\t\t\t\t// Swap the image back to the original image.\n\t\t\t\t\tconst $product = $target.closest('.product');\n\n\t\t\t\t\tthis.swapProductImage(\n\t\t\t\t\t\t$product\n\t\t\t\t\t\t\t.find('.wp-post-image')\n\t\t\t\t\t\t\t.data('original-image') as string,\n\t\t\t\t\t\t$product\n\t\t\t\t\t);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst $productImageChoices = $target.find(\n\t\t\t\t\t'[data-gspc-product-image]'\n\t\t\t\t);\n\n\t\t\t\tif (!$productImageChoices.length) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t$productImageChoices.each(function (): void | false {\n\t\t\t\t\t// Ensure that the option or radio is selected\n\t\t\t\t\tif ($(this).is(':selected') || $(this).is(':checked')) {\n\t\t\t\t\t\tself.swapProductImageUsingChoice(this);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Listen for WC Bookings updates so we can update the base WC product price in the form.\n\t */\n\tpublic bindWCBookingsEvents() {\n\t\t// Update on initial load\n\t\tthis.syncWCBookingsPrice();\n\n\t\t$(document).on(\n\t\t\t'wc_booking_form_changed',\n\t\t\t(event, form: JQuery) => {\n\t\t\t\tthis.syncWCBookingsPrice();\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Callback to update the base product price depending on the booking cost. This way, we can call it on initial load\n\t * and inside the `wc_booking_form_changed` jQuery event.\n\t */\n\tpublic syncWCBookingsPrice() {\n\t\tconst $product = this.$formEl.closest('.product');\n\n\t\tconst $price = $product.find(\n\t\t\t'.wc-bookings-booking-cost .woocommerce-Price-amount'\n\t\t);\n\n\t\tif (!$price.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currency = new window.Currency(\n\t\t\twindow.gf_global.gf_currency_config\n\t\t);\n\n\t\tthis.updateProductPrice(currency.toNumber($price.text()));\n\t}\n\n\t/**\n\t * Bind callbacks on the form el for a variety of events such as the page changing.\n\t */\n\tpublic bindFormEventsGPPT() {\n\t\tthis.$formEl.on(\n\t\t\t'softValidationPageLoad.gppt',\n\t\t\t(event, newPage: number, oldPage: number, formId: number) => {\n\t\t\t\tconst gppt = (window as any)?.[\n\t\t\t\t\t`GPPageTransitions_${this.formId}`\n\t\t\t\t];\n\n\t\t\t\t// Get the real index of the page as Page Transitions gives the visible page index.\n\t\t\t\tconst realPageIndex = gppt?.getCurrentPageRealIndex() + 1;\n\n\t\t\t\tthis.setCurrentPage(realPageIndex);\n\t\t\t\tthis.updateUI();\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Sets the current page properties.\n\t *\n\t * @param currentPage\n\t */\n\tpublic setCurrentPage(currentPage: number) {\n\t\tthis.currentPage = currentPage;\n\t}\n\n\t/**\n\t * Get the count of the pages in the form.\n\t */\n\tpublic getPageCount() {\n\t\treturn this.$formEl.find('.gform_page').length ?? 1;\n\t}\n\n\t/**\n\t * Determine if we're on the last visible page.\n\t */\n\tpublic isOnLastVisiblePage() {\n\t\tconst { gfPageConditionalLogic: pageCl } = this;\n\n\t\t// If Page Conditional Logic is used, it needs to be handled differently.\n\t\tif (pageCl) {\n\t\t\t// Loop through pages to figure out which is the last visible page.\n\t\t\tlet lastVisiblePageIndex = 0;\n\t\t\tlet pageI = 0;\n\n\t\t\tfor (const page of pageCl.options.pages) {\n\t\t\t\tif (pageCl.isPageVisible(page)) {\n\t\t\t\t\tlastVisiblePageIndex = pageI;\n\t\t\t\t}\n\n\t\t\t\tpageI++;\n\t\t\t}\n\n\t\t\treturn (this.currentPage ?? 1) - 1 === lastVisiblePageIndex + 1;\n\t\t}\n\n\t\treturn (\n\t\t\tthis.currentPage === this.$formEl.find('.gform_page').length ||\n\t\t\t(this.currentPage === 1 && this.getPageCount() === 0)\n\t\t);\n\t}\n\n\t/**\n\t * Get the quantity div.\n\t *\n\t * For regular AJAX forms, we need to store a copy of the element during runtime as the AJAX refresh of the form\n\t * can remove the element.\n\t */\n\tget $quantityDiv() {\n\t\tconst { quantityDivSelector: selector } = this;\n\n\t\tthis.cacheQuantityDiv();\n\n\t\tif (this.$formEl?.find(selector).length) {\n\t\t\treturn this.$formEl?.find(selector);\n\t\t}\n\n\t\treturn this._$quantityDiv!;\n\t}\n\n\t/**\n\t * Cache the Quantity div.\n\t */\n\tpublic cacheQuantityDiv() {\n\t\tconst { quantityDivSelector: selector } = this;\n\n\t\tif (!this._$quantityDiv) {\n\t\t\tthis._$quantityDiv = this.$formEl?.find(selector).clone();\n\t\t}\n\t}\n\n\t/**\n\t * Get the quantity div.\n\t *\n\t * For regular AJAX forms, we need to store a copy of the element during runtime as the AJAX refresh of the form\n\t * can remove the element.\n\t */\n\tget $addToCart() {\n\t\tconst { addToCartSelector: selector } = this;\n\n\t\tthis.cacheAddToCart();\n\n\t\tif (this.$formEl?.find(selector).length) {\n\t\t\treturn this.$formEl?.find(selector);\n\t\t}\n\n\t\treturn this._$addToCart!;\n\t}\n\n\t/**\n\t * Cache the Add to Cart button.\n\t */\n\tpublic cacheAddToCart() {\n\t\tif (!this._$addToCart) {\n\t\t\tthis._$addToCart = this.$formEl\n\t\t\t\t?.find(this.addToCartSelector)\n\t\t\t\t.clone();\n\t\t}\n\t}\n\n\t/**\n\t * Update UI based on the current page.\n\t *\n\t * Position (or hide) the Quantity and Add to Cart depending on the current page.\n\t */\n\tpublic updateUI() {\n\t\tif (this.getPageCount() === 1 && !this.isAjax) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { $currentPage, $formFooter, $quantityDiv, $addToCart } = this;\n\n\t\tconst $submitButton = this.$formEl.find(\n\t\t\t`#gform_submit_button_${this.formId}`\n\t\t);\n\n\t\t// Ensure \"cart\" class exists on the form element\n\t\tthis.$formEl.addClass('cart');\n\n\t\t// Hide submit button again if it gets added\n\t\t$submitButton.addClass('gspc__submit--hidden');\n\n\t\tthis.$formEl\n\t\t\t.find('.gspc--is-last-page')\n\t\t\t.removeClass('gspc--is-last-page');\n\n\t\t// Just in case the add to cart button is not the same as what was on the initial page, re-bind it.\n\t\tthis.bindAddToCartClick();\n\n\t\t// If we're on the last visible page, move the buttons to the last visible page's footer.\n\t\tif (this.isOnLastVisiblePage()) {\n\t\t\t$quantityDiv.appendTo($formFooter).show();\n\t\t\t$addToCart.appendTo($formFooter).show();\n\n\t\t\t$currentPage.addClass('gspc--is-last-page');\n\t\t}\n\t}\n\n\t/**\n\t * Binds the add to cart button click event.\n\t */\n\tpublic bindAddToCartClick() {\n\t\t// Bind click on Add to Cart button to handle anti-spam techniques.\n\t\tthis.$addToCart.off('click.gspcHandleButtonClick');\n\t\tthis.$addToCart.on(\n\t\t\t'click.gspcHandleButtonClick',\n\t\t\tthis.handleAddToCartClick\n\t\t);\n\t}\n\n\t/**\n\t * Gravity Forms has this as an onclick handler on the submit button for anti-spam techniques. We need to also\n\t * run this when the add to cart button is clicked.\n\t */\n\tpublic handleAddToCartClick(event: JQuery.Event) {\n\t\t// @ts-ignore\n\t\twindow.gform?.submission?.handleButtonClick(this);\n\n\t\treturn false;\n\t}\n\n\tisValidMatchVariation = (\n\t\tisMatch: boolean,\n\t\tformId: number,\n\t\trule: GFConditionalLogicRule\n\t) => {\n\t\t// Convert to string if rule's fieldId is stored as a number (possibly, Gravity Forms - Advanced Conditional Logic)\n\t\tif (typeof rule.fieldId === 'number') {\n\t\t\trule.fieldId = '' + rule.fieldId;\n\t\t}\n\t\tif (rule.fieldId.indexOf('gspc_product_variation_') !== 0) {\n\t\t\treturn isMatch;\n\t\t}\n\n\t\tconst attributeName = rule.fieldId.replace(\n\t\t\t'gspc_product_variation_',\n\t\t\t''\n\t\t);\n\t\tconst $variationField = this.$formEl.find(\n\t\t\t`select[data-attribute_name=\"attribute_${attributeName}\"]`\n\t\t);\n\n\t\treturn window.gf_matches_operation(\n\t\t\t$variationField.val(),\n\t\t\trule.value,\n\t\t\trule.operator\n\t\t);\n\t};\n\n\tgetQuantityInput = () => {\n\t\tconst $quantityInput = this.$formEl.find('input.qty');\n\n\t\t/**\n\t\t * If the quantity field isn't found using the default selector,\n\t\t * try looking for a field with .gspc__mapped-quantity.\n\t\t */\n\t\tif (!$quantityInput.length) {\n\t\t\t// If the field is a single product, look for the quantity input inside of it.\n\t\t\tif (\n\t\t\t\tthis.$formEl\n\t\t\t\t\t.find('.gspc__mapped-quantity')\n\t\t\t\t\t.hasClass('gfield--type-product')\n\t\t\t) {\n\t\t\t\treturn this.$formEl.find(\n\t\t\t\t\t'.gspc__mapped-quantity input[id^=\"ginput_quantity_\"]'\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// For any other field type, just look for the first input.\n\t\t\treturn this.$formEl.find('.gspc__mapped-quantity input').first();\n\t\t}\n\n\t\treturn $quantityInput;\n\t};\n\n\tisValidMatchQuantity = (\n\t\tisMatch: boolean,\n\t\tformId: number,\n\t\trule: GFConditionalLogicRule\n\t) => {\n\t\tif (rule.fieldId !== 'gspc_quantity') {\n\t\t\treturn isMatch;\n\t\t}\n\n\t\treturn window.gf_matches_operation(\n\t\t\tthis.getQuantityInput().val(),\n\t\t\trule.value,\n\t\t\trule.operator\n\t\t);\n\t};\n}\n\nwindow.GSProductConfigurator = GSProductConfigurator;\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","window","gform","addAction","pages","formId","self","args","quantityDivSelector","addToCartSelector","isValidMatchVariation","isMatch","rule","fieldId","indexOf","attributeName","replace","$variationField","$formEl","find","gf_matches_operation","val","value","operator","getQuantityInput","$quantityInput","length","hasClass","first","isValidMatchQuantity","existingInstance","this","gfPageConditionalLogic","undefined","bindFormEventsGFPL","bindFormEventsGPPT","assign","canEditForms","showAdminAlerts","bindGlobalEvents","bindProductImageEvents","bindWCBookingsEvents","bindAddToCartClick","isAjax","cacheQuantityDiv","cacheAddToCart","bindEventsAJAX","setCurrentPage","parseInt","updateUI","currentPage","$currentPage","productType","console","error","alert","addFilter","$target","$addToCart","shouldAbort","action","targetId","animation","defaultValues","isInit","do_callback","removeClass","addClass","on","event","currentTarget","data","dependents","getConditionalLogicDependents","gf_apply_rules","variation","updateProductPrice","display_price","variation_id","each","i","el","$submitButton","$form","add","price","$basePriceInput","productBasePriceFieldId","Currency","gf_global","gf_currency_config","toMoney","trigger","gformCalculateTotalPrice","cl","gf_form_conditional_logic","entries","logic","logicFieldId","field","rules","push","document","swapProductImageUsingChoice","choice","closest","is","image","attr","swapProductImage","$product","$productGallery","$galleryImg","$productImgWrap","eq","$productImg","$productLink","tempImg","Image","src","onload","width","height","removeAttr","setTimeout","$selectedChoice","$productImageChoices","syncWCBookingsPrice","form","$price","currency","toNumber","text","newPage","oldPage","gppt","realPageIndex","getCurrentPageRealIndex","getPageCount","isOnLastVisiblePage","pageCl","lastVisiblePageIndex","pageI","options","page","isPageVisible","selector","_$quantityDiv","clone","_$addToCart","$formFooter","$quantityDiv","appendTo","show","off","handleAddToCartClick","submission","handleButtonClick","GSProductConfigurator"],"sourceRoot":""}