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,qBAGDX,KAAKiH,wBACRoB,EAAaK,SAASN,GAAaO,OACnCnH,EAAWkH,SAASN,GAAaO,OAEjCrH,EAAaoB,SAAS,uBAKvB1C,KAAKvB,QAAQC,KAAK,4CAA4CkK,SAC9D5I,KAAKoI,YAAYS,OAChB,yDAAkD7I,KAAK8I,UAAS,OAI7D9I,KAAKiI,aACuD,IAA3DjI,KAAKvB,QAAQC,KAAK,8BAA8BiB,QACnDK,KAAKvB,QAAQoK,OACZ,0DAAmD7I,KAAKiI,YAAW,M,CAIvE,EAKO,YAAAtH,mBAAP,WAECX,KAAKwB,WAAW2G,IAAI,+BACpBnI,KAAKwB,WAAWmB,GAAG,+BAA+B,W,QAEzB,QAAxB,EAAY,QAAZ,EAAAjF,OAAOC,aAAK,eAAEoL,kBAAU,SAAEC,kBAAkBhJ,KAC7C,GACD,EAuED,EArhCA,GAuhCAtC,OAAOuL,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 PageState {\n\tactivePageCount: number;\n\tcurrentPage: number;\n\tcurrentStep: number;\n\tfirstPage: number;\n\tinactivePages: number[];\n\tlastPage: number;\n\tnextPage: number;\n\tpreviousPage: number;\n\ttotalPageCount: number;\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/** Available in GF 2.9 and newer. */\n\tpublic pageState?: PageState;\n\n\t/**\n\t * Form element attributes. Store these as during AJAX form submissions, the form will be replaced and attributes\n\t * will be lost.\n\t */\n\tpublic formAttributes?: NamedNodeMap;\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 * Store variations selector in case it's detached with AJAX forms.\n\t */\n\tpublic _$variations?: JQuery;\n\n\tpublic variationsSelector = 'table.variations';\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\t/**\n\t * Property and getter to store the product ID.\n\t */\n\tprivate _productId?: number;\n\n\tget productId(): number | null {\n\t\t// Use cached value if it exists.\n\t\tif (this._productId) {\n\t\t\treturn this._productId;\n\t\t}\n\n\t\t// Try to get it from add to cart button first.\n\t\tconst $addToCart = this.$formEl.find(this.addToCartSelector);\n\n\t\tif ($addToCart.val()) {\n\t\t\tthis._productId = parseInt($addToCart.val() as string, 10);\n\n\t\t\treturn this._productId;\n\t\t}\n\n\t\t// Fall back to the hidden input for the add-to-cart.\n\t\tconst $input = this.$formEl.find('input[name=\"add-to-cart\"]');\n\n\t\tif ($input.length) {\n\t\t\tthis._productId = parseInt($input.val() as string, 10);\n\n\t\t\treturn this._productId;\n\t\t}\n\n\t\t// Fall back to the product ID in the GSPC product ID input.\n\t\tconst $productInput = this.$formEl.find(\n\t\t\t'input[name=\"input_gspc_product_id\"]'\n\t\t);\n\n\t\tif ($productInput.length) {\n\t\t\tthis._productId = parseInt($productInput.val() as string, 10);\n\n\t\t\treturn this._productId;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * Property and getter to store the variation ID. Mostly needed for AJAX forms.\n\t */\n\tprivate _variationId?: number;\n\n\tget variationId(): number | null {\n\t\t// Use cached value if it exists.\n\t\tif (this._variationId) {\n\t\t\treturn this._variationId;\n\t\t}\n\n\t\t// Fall back to the hidden input for the variation_id.\n\t\tconst $input = this.$formEl.find('input[name=\"variation_id\"]');\n\n\t\tif ($input.length) {\n\t\t\tthis._variationId = parseInt($input.val() as string, 10);\n\n\t\t\treturn this._variationId;\n\t\t}\n\n\t\t// Fall back to the variation ID in the GSPC variation ID input.\n\t\tconst $gcgsInput = this.$formEl.find(\n\t\t\t'input[name=\"input_gspc_variation_id\"]'\n\t\t);\n\n\t\tif ($gcgsInput.length) {\n\t\t\tthis._variationId = parseInt($gcgsInput.val() as string, 10);\n\n\t\t\treturn this._variationId;\n\t\t}\n\n\t\treturn null;\n\t}\n\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.cacheFormAttributes();\n\t\t\tthis.cacheQuantityDiv();\n\t\t\tthis.cacheAddToCart();\n\t\t\tthis.cacheVariations();\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', this.onVariationChange);\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 * Handler when variation changes.\n\t */\n\tpublic onVariationChange = (event: JQuery.Event, variation: any) => {\n\t\tthis.updateProductPrice(variation.display_price);\n\n\t\t// Update input_gspc_variation_id hidden input to be used primarily with GPPA.\n\t\tthis.$formEl\n\t\t\t.find(`[name=\"input_gspc_variation_id\"]`)\n\t\t\t.val(variation.variation_id);\n\n\t\tthis._variationId = variation.variation_id;\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 gform_post_render',\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\n\t\t/*\n\t\t * GF 2.9 compatibility.\n\t\t *\n\t\t * This logic watches the state and updates the page count and form UI.\n\t\t */\n\t\t(window?.gform as any)?.state?.watch(\n\t\t\tthis.formId,\n\t\t\t['pagination/pages'],\n\t\t\t(formId: number, key: string, data: any) => {\n\t\t\t\tthis.setPageState(data[key].value);\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 * Sets the page state from GF 2.9's state API.\n\t */\n\tpublic setPageState(pageState: PageState) {\n\t\tthis.pageState = pageState;\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 we have access to GP Page Transitions, utilize it.\n\t\tconst gppt = (window as any)?.[`GPPageTransitions_${this.formId}`];\n\n\t\tif (gppt) {\n\t\t\treturn gppt.isOnLastPage();\n\t\t}\n\n\t\t// If we have access to the page state in GF 2.9 and newer, utilize it.\n\t\tif (this.pageState) {\n\t\t\treturn this.pageState.currentPage === this.pageState.lastPage;\n\t\t}\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 || !this._$quantityDiv.length) {\n\t\t\tthis._$quantityDiv = this.$formEl?.find(selector).clone();\n\t\t}\n\t}\n\n\t/**\n\t * Cache the form attributes. Needed mostly for handling variations on AJAX forms.\n\t */\n\tpublic cacheFormAttributes() {\n\t\tif (!this.formAttributes) {\n\t\t\tthis.formAttributes = this.$formEl?.[0]?.attributes;\n\t\t}\n\t}\n\n\t/**\n\t * Get the add to cart button\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 || !this._$addToCart.length) {\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 * Get the variations selector.\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 $variations() {\n\t\tconst { variationsSelector: selector } = this;\n\n\t\tthis.cacheVariations();\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._$variations!;\n\t}\n\n\t/**\n\t * Cache variations selector so it can be re-shown when switching pages.\n\t */\n\tpublic cacheVariations() {\n\t\t// Cache variation ID\n\t\tif (!this.variationId) {\n\t\t\tconst variationIdValue = this.$formEl\n\t\t\t\t.find('input[name=\"variation_id\"]').val();\n\n\t\t\tif (variationIdValue) {\n\t\t\t\tthis._variationId = parseInt(variationIdValue as string, 10);\n\t\t\t}\n\t\t}\n\n\t\tif (!this._$variations || !this._$variations.length) {\n\t\t\tthis._$variations = this.$formEl.find(this.variationsSelector);\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\t// Ensure that the form attributes are cached. Sometimes pre_render is called too early if the form is in a modal.\n\t\tthis.cacheFormAttributes();\n\n\t\t// Ensure that variation change event is bound. Again, may be an issue with modals.\n\t\tthis.$formEl.off('found_variation', this.onVariationChange);\n\t\tthis.$formEl.on('found_variation', this.onVariationChange);\n\n\t\tconst {\n\t\t\t$currentPage,\n\t\t\t$formFooter,\n\t\t\t$quantityDiv,\n\t\t\t$addToCart,\n\t\t\t$variations,\n\t\t} = 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// Add missing attributes to form element.\n\t\tif (this.formAttributes) {\n\t\t\t// @ts-ignore - NamedNodeMap is iterable. https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes\n\t\t\tfor (const attr of this.formAttributes) {\n\t\t\t\tif (attr.name === 'action') {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tthis.$formEl.attr(attr.name, attr.value);\n\t\t\t}\n\t\t}\n\n\t\t// If we have variations and the variations are missing, prepend to form.\n\t\tif (\n\t\t\t$variations.length &&\n\t\t\tthis.$formEl.find(this.variationsSelector).length === 0\n\t\t) {\n\t\t\t$variations.prependTo(this.$formEl);\n\n\t\t\t$('.variations_form').each(function () {\n\t\t\t\t// @ts-ignore\n\t\t\t\t$(this).wc_variation_form();\n\t\t\t});\n\t\t}\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\n\t\t// Add hidden input named \"add-to-cart\" with value from the Add to Cart button. Reason being, handleButtonClick\n\t\t// take over the form submission and the Add to Cart button's value won't go through.\n\t\tthis.$formEl.find('input[type=\"hidden\"][name=\"add-to-cart\"]').remove();\n\t\tthis.$formFooter.append(\n\t\t\t``\n\t\t);\n\n\t\t// Ensure that the variation_id hidden input exists if we have one stored. Could be lost from AJAX.\n\t\tif (this.variationId) {\n\t\t\tif (this.$formEl.find('input[name=\"variation_id\"]').length === 0) {\n\t\t\t\tthis.$formEl.append(\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 * 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('click.gspcHandleButtonClick', function () {\n\t\t\t// @ts-ignore\n\t\t\twindow.gform?.submission?.handleButtonClick(this);\n\t\t});\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","variationsSelector","onVariationChange","event","variation","updateProductPrice","display_price","$formEl","find","val","variation_id","_variationId","isValidMatchVariation","isMatch","rule","fieldId","indexOf","attributeName","replace","$variationField","gf_matches_operation","value","operator","getQuantityInput","$quantityInput","length","hasClass","first","isValidMatchQuantity","existingInstance","this","gfPageConditionalLogic","undefined","bindFormEventsGFPL","bindFormEventsGPPT","assign","canEditForms","showAdminAlerts","bindGlobalEvents","bindProductImageEvents","bindWCBookingsEvents","bindAddToCartClick","isAjax","cacheFormAttributes","cacheQuantityDiv","cacheAddToCart","cacheVariations","bindEventsAJAX","setCurrentPage","parseInt","updateUI","currentPage","$currentPage","_productId","$addToCart","$input","$productInput","$gcgsInput","productType","console","error","alert","addFilter","$target","shouldAbort","action","targetId","animation","defaultValues","isInit","do_callback","removeClass","addClass","on","currentTarget","data","dependents","getConditionalLogicDependents","gf_apply_rules","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","state","watch","setPageState","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","pageState","isOnLastVisiblePage","pageCl","isOnLastPage","lastPage","lastVisiblePageIndex","pageI","options","page","isPageVisible","selector","_$quantityDiv","clone","formAttributes","attributes","_$addToCart","_$variations","variationId","variationIdValue","off","$formFooter","$quantityDiv","$variations","name","prependTo","wc_variation_form","appendTo","show","remove","append","productId","submission","handleButtonClick","GSProductConfigurator"],"sourceRoot":""}