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B,IAAAA,QAAiB,yBACjB5C,EAAiBrB,gBAAgB,kBAInC,GAAI5C,EAAU8G,qBAKb,YAJAd,EACChG,EAAU8G,qBACV9G,EAAU+G,uBAKZ9C,EAAiBrB,gBAAgB,SACjCoE,uBAAsB,WACrB/C,EAAiBvC,QAAQuF,MAAQ,aAGlC,IAAIC,EAAuB5C,EACxBA,EAAcM,MACd,SAACuC,GAAD,OACCrH,EACCC,EAAW,CACVC,UAAWmH,EACXlH,YACAC,kBAGFiH,EAAgBhC,WAAanF,EAAUmF,UACF,YAArCnF,EAAUiF,wBACiC,YAA3CkC,EAAgBlC,0BAEjB,KAtae,IAAC9E,KAyalBJ,EAAW,CACVC,UAAWkH,GAAwBlH,EACnCC,YACAC,gBA3aHJ,EAAMK,GACH,IAAIiH,SAAQ,SAACC,GACbA,EAAQvH,EAAMK,IACdL,EAAMK,GAAOL,EAAMK,GAAKmH,WAExB,IAAIF,SAAQ,SAACC,GAAD,OACZE,MAAMpH,GAAKqH,MAAK,SAACC,GAChBJ,EAAQI,GACR3H,EAAMK,GAAOsH,EAASH,eAyavBE,MAAK,SAACC,GAAD,OAAcA,EAASC,UAC5BF,MAAK,YAAuB,IAAtB,QAAEG,EAAF,KAAWC,GAAW,EACvBD,GAIL3B,EAAW4B,EAAK3B,KAAM2B,EAAKb","sources":["webpack://ctFrontend/./static/js/frontend/woocommerce/variable-products.js"],"sourcesContent":["import $ from 'jquery'\nimport ctEvents from 'ct-events'\n\nlet originalImageUpdate = null\n\nconst store = {}\n\nfunction isTouchDevice() {\n\ttry {\n\t\tdocument.createEvent('TouchEvent')\n\t\treturn true\n\t} catch (e) {\n\t\treturn false\n\t}\n}\n\nconst cachedFetch = (url) =>\n\tstore[url]\n\t\t? new Promise((resolve) => {\n\t\t\t\tresolve(store[url])\n\t\t\t\tstore[url] = store[url].clone()\n\t\t })\n\t\t: new Promise((resolve) =>\n\t\t\t\tfetch(url).then((response) => {\n\t\t\t\t\tresolve(response)\n\t\t\t\t\tstore[url] = response.clone()\n\t\t\t\t})\n\t\t )\n\nconst makeUrlFor = ({ variation, productId, isQuickView }) => {\n\tlet url = new URL(ct_localizations.ajax_url)\n\tlet params = new URLSearchParams(url.search.slice(1))\n\n\tparams.append('action', 'blocksy_get_product_view_for_variation')\n\tparams.append('variation_id', variation.variation_id)\n\tparams.append('product_id', productId)\n\tparams.append('is_quick_view', isQuickView)\n\n\turl.search = `?${params.toString()}`\n\n\treturn url.toString()\n}\n\nconst replaceFirstImage = ({ container, image }) => {\n\tif (!image) {\n\t\treturn\n\t}\n\n\tconst containersToReplace = []\n\n\tconst selectorsToTry = [\n\t\t'.woocommerce-product-gallery > .ct-image-container',\n\t\t'.woocommerce-product-gallery .flexy-items > *:first-child > *',\n\t\t'.woocommerce-product-gallery .flexy-pills > ol > *:first-child > *',\n\t]\n\n\tselectorsToTry.map((selector) => {\n\t\tif (container.parentNode.querySelector(selector)) {\n\t\t\tcontainersToReplace.push(\n\t\t\t\tcontainer.parentNode.querySelector(selector)\n\t\t\t)\n\t\t}\n\t})\n\n\tcontainersToReplace.map((imgContainer) => {\n\t\tif (imgContainer.href) {\n\t\t\timgContainer.href = image.full_src\n\t\t}\n\n\t\tif (imgContainer.dataset.height) {\n\t\t\timgContainer.dataset.height = image.full_src_h\n\t\t}\n\n\t\tif (imgContainer.dataset.width) {\n\t\t\timgContainer.dataset.width = image.full_src_w\n\t\t}\n\n\t\t;[...imgContainer.querySelectorAll('.zoomImg')].map((img) => {\n\t\t\timg.remove()\n\t\t})\n\t\t;[...imgContainer.querySelectorAll('img, source')].map((img) => {\n\t\t\tif (img.matches('.zoomImg')) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (img.getAttribute('width')) {\n\t\t\t\timg.width =\n\t\t\t\t\timage.width ||\n\t\t\t\t\t(img.closest('.flexy-pills')\n\t\t\t\t\t\t? image.gallery_thumbnail_src_w\n\t\t\t\t\t\t: image.src_w)\n\t\t\t}\n\n\t\t\tif (img.getAttribute('height')) {\n\t\t\t\timg.height =\n\t\t\t\t\timage.height ||\n\t\t\t\t\t(img.closest('.flexy-pills')\n\t\t\t\t\t\t? image.gallery_thumbnail_src_h\n\t\t\t\t\t\t: image.src_h)\n\t\t\t}\n\n\t\t\timg.src = img.closest('.flexy-pills')\n\t\t\t\t? image.gallery_thumbnail_src\n\t\t\t\t: image.src\n\n\t\t\tif (image.srcset && img.srcset && image.srcset !== 'false') {\n\t\t\t\timg.srcset = image.srcset\n\t\t\t} else {\n\t\t\t\timg.removeAttribute('srcset')\n\t\t\t}\n\t\t})\n\n\t\tif ($.fn.zoom) {\n\t\t\tif (\n\t\t\t\t(window.wp &&\n\t\t\t\t\twp.customize &&\n\t\t\t\t\twp.customize('has_product_single_zoom') &&\n\t\t\t\t\twp.customize('has_product_single_zoom')() === 'yes') ||\n\t\t\t\t!window.wp ||\n\t\t\t\t!wp.customize\n\t\t\t) {\n\t\t\t\tconst rect = imgContainer.getBoundingClientRect()\n\n\t\t\t\tif (\n\t\t\t\t\tparseFloat(imgContainer.getAttribute('data-width')) >\n\t\t\t\t\timgContainer\n\t\t\t\t\t\t.closest('.woocommerce-product-gallery')\n\t\t\t\t\t\t.getBoundingClientRect().width\n\t\t\t\t) {\n\t\t\t\t\t$(imgContainer).zoom({\n\t\t\t\t\t\turl: imgContainer.href,\n\t\t\t\t\t\ttouch: false,\n\t\t\t\t\t\tduration: 50,\n\n\t\t\t\t\t\t...(rect.width >\n\t\t\t\t\t\t\tparseFloat(imgContainer.dataset.width) ||\n\t\t\t\t\t\trect.height > parseFloat(imgContainer.dataset.height)\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tmagnify: 2,\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: {}),\n\n\t\t\t\t\t\t...(isTouchDevice()\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\ton: 'toggle',\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n}\n\nconst performInPlaceUpdate = ({\n\tcontainer,\n\tcurrentVariationObj,\n\tnextVariationObj,\n}) => {\n\tconst currentImage = currentVariationObj\n\t\t? { id: currentVariationObj.image_id, ...currentVariationObj.image }\n\t\t: (nextVariationObj || {}).blocksy_original_image\n\n\tconst nextImage = nextVariationObj\n\t\t? { id: nextVariationObj.image_id, ...nextVariationObj.image }\n\t\t: (currentVariationObj || {}).blocksy_original_image\n\n\tif (!nextImage) {\n\t\treturn\n\t}\n\n\tif (\n\t\tcurrentImage &&\n\t\tparseFloat(nextImage.id) === parseFloat(currentImage.id)\n\t) {\n\t\treturn\n\t}\n\n\t// Attempt slide to image\n\n\tif (container.querySelector(`.flexy-pills > *`)) {\n\t\tlet maybePillImage =\n\t\t\tcontainer.querySelector(\n\t\t\t\t`.flexy-items [srcset*=\"${nextImage.src}\"]`\n\t\t\t) ||\n\t\t\tcontainer.querySelector(`.flexy-items [src*=\"${nextImage.src}\"]`)\n\n\t\tif (maybePillImage) {\n\t\t\tlet pillIndex = [\n\t\t\t\t...container.querySelector(`.flexy-items`).children,\n\t\t\t].indexOf(maybePillImage.closest('div'))\n\n\t\t\tconst pill =\n\t\t\t\tcontainer.querySelector(`.flexy-pills > *`).children[pillIndex]\n\n\t\t\tif (pill) {\n\t\t\t\tif (\n\t\t\t\t\tcontainer\n\t\t\t\t\t\t.querySelector('[data-flexy]')\n\t\t\t\t\t\t.dataset.flexy.indexOf('no') > -1\n\t\t\t\t) {\n\t\t\t\t\tif (container.querySelector('[data-flexy]').forcedMount) {\n\t\t\t\t\t\tcontainer.querySelector('[data-flexy]').forcedMount()\n\t\t\t\t\t}\n\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (nextVariationObj) {\n\t\t\t\t\t\t\treplaceFirstImage({\n\t\t\t\t\t\t\t\tcontainer,\n\t\t\t\t\t\t\t\timage: nextVariationObj.blocksy_original_image,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpill.click()\n\t\t\t\t\t}, 500)\n\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\tif (nextVariationObj) {\n\t\t\t\t\t\treplaceFirstImage({\n\t\t\t\t\t\t\tcontainer,\n\t\t\t\t\t\t\timage: nextVariationObj.blocksy_original_image,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\n\t\t\t\t\tpill.click()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Replace 1st image\n\n\treplaceFirstImage({ container, image: nextImage })\n\n\tif (container.querySelector(`.flexy-pills > *`)) {\n\t\tconst pill = container.querySelector(`.flexy-pills > *`).children[0]\n\n\t\tif (pill) {\n\t\t\tpill.click()\n\t\t}\n\t}\n}\n\nexport const mount = (el) => {\n\tif (!$ || !$.fn || !$.fn.wc_variations_image_update) {\n\t\treturn\n\t}\n\n\toriginalImageUpdate = $.fn.wc_variations_image_update\n\n\t$.fn.wc_variations_image_update = function (variation) {\n\t\tconst currentElement = this[0]\n\n\t\tif (\n\t\t\tcurrentElement.closest('.woobt-products') ||\n\t\t\tcurrentElement.closest('.upsells') ||\n\t\t\tcurrentElement.closest('.related')\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tconst currentVariation = el\n\t\t\t.closest('.product')\n\t\t\t.querySelector('.woocommerce-product-gallery')\n\n\t\tlet productContainer = currentVariation.closest('.type-product')\n\n\t\tlet isQuickView = 'no'\n\n\t\tlet productId = productContainer.id.replace('product-', '')\n\n\t\tif (!productId) {\n\t\t\tproductId = currentVariation\n\t\t\t\t.closest('[class*=\"ct-quick-view\"]')\n\t\t\t\t.querySelector('[data-product_id]').dataset.product_id\n\n\t\t\tif (productId) {\n\t\t\t\tisQuickView = 'yes'\n\t\t\t}\n\t\t}\n\n\t\tconst allVariations = JSON.parse(el.dataset.product_variations)\n\n\t\tlet nextVariationObj = false\n\t\tlet currentVariationObj = false\n\n\t\tif (allVariations) {\n\t\t\tnextVariationObj = variation.variation_id\n\t\t\t\t? allVariations.find(\n\t\t\t\t\t\t({ variation_id }) =>\n\t\t\t\t\t\t\tparseInt(variation_id) ===\n\t\t\t\t\t\t\tparseInt(variation.variation_id)\n\t\t\t\t )\n\t\t\t\t: false\n\t\t\tcurrentVariationObj = currentVariation.dataset.currentVariation\n\t\t\t\t? allVariations.find(\n\t\t\t\t\t\t({ variation_id }) =>\n\t\t\t\t\t\t\tparseInt(variation_id) ===\n\t\t\t\t\t\t\tparseInt(currentVariation.dataset.currentVariation)\n\t\t\t\t )\n\t\t\t\t: false\n\t\t}\n\n\t\tlet defaultCanDoInPlaceUpdate = '__DEFAULT__'\n\n\t\tif (\n\t\t\tvariation &&\n\t\t\t!variation.variation_id &&\n\t\t\tcurrentElement.querySelector('.wcpa_form_outer')\n\t\t) {\n\t\t\tdefaultCanDoInPlaceUpdate = true\n\t\t\tnextVariationObj = variation\n\t\t}\n\n\t\tif (\n\t\t\tdefaultCanDoInPlaceUpdate === '__DEFAULT__' &&\n\t\t\t!variation.variation_id &&\n\t\t\t!currentVariation.dataset.currentVariation\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tif (\n\t\t\tdefaultCanDoInPlaceUpdate === '__DEFAULT__' &&\n\t\t\tparseInt(variation.variation_id) ===\n\t\t\t\tparseInt(currentVariation.dataset.currentVariation)\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tif (\n\t\t\tvariation.variation_id ||\n\t\t\tdefaultCanDoInPlaceUpdate === '__DEFAULT__'\n\t\t) {\n\t\t\tcurrentVariation.dataset.currentVariation =\n\t\t\t\tvariation.variation_id || '0'\n\t\t} else {\n\t\t\tcurrentVariation.removeAttribute('data-current-variation')\n\t\t}\n\n\t\tconst canDoInPlaceUpdate =\n\t\t\tdefaultCanDoInPlaceUpdate === '__DEFAULT__'\n\t\t\t\t? allVariations &&\n\t\t\t\t [nextVariationObj, currentVariationObj].every((variation) => {\n\t\t\t\t\t\tif (!variation) {\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn variation.blocksy_gallery_source === 'default'\n\t\t\t\t })\n\t\t\t\t: defaultCanDoInPlaceUpdate\n\n\t\tif (canDoInPlaceUpdate) {\n\t\t\tperformInPlaceUpdate({\n\t\t\t\tcontainer: currentVariation,\n\t\t\t\tnextVariationObj,\n\t\t\t\tcurrentVariationObj,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tconst acceptHtml = (html, style) => {\n\t\t\tconst div = document.createElement('div')\n\t\t\tdiv.innerHTML = html\n\t\t\t;[...div.firstElementChild.children].map((el, index) => {\n\t\t\t\tif (\n\t\t\t\t\t!el.matches(\n\t\t\t\t\t\t'.flexy-container, .ct-image-container, .ct-before-gallery'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tel.remove()\n\t\t\t\t}\n\t\t\t})\n\t\t\tlet didInsert = false\n\t\t\t;[...currentVariation.children].map((el, index) => {\n\t\t\t\tif (el.matches('.flexy-container, .ct-image-container')) {\n\t\t\t\t\tif (!didInsert) {\n\t\t\t\t\t\tdidInsert = true\n\t\t\t\t\t\tel.insertAdjacentHTML(\n\t\t\t\t\t\t\t'beforebegin',\n\t\t\t\t\t\t\tdiv.firstElementChild.innerHTML\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tel.matches(\n\t\t\t\t\t\t'.flexy-container, .ct-image-container, .ct-before-gallery'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tel.remove()\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tcurrentVariation\n\t\t\t\t.closest('.product')\n\t\t\t\t.classList.remove('thumbs-left', 'thumbs-bottom')\n\n\t\t\tif (currentVariation.querySelector('.flexy-container')) {\n\t\t\t\tcurrentVariation.closest('.product').classList.add(style)\n\t\t\t}\n\n\t\t\tcurrentVariation.hasLazyLoadClickHoverListener = false\n\n\t\t\tsetTimeout(() => {\n\t\t\t\tctEvents.trigger('blocksy:frontend:init')\n\t\t\t\tcurrentVariation.removeAttribute('data-state')\n\t\t\t})\n\t\t}\n\n\t\tif (variation.blocksy_gallery_html) {\n\t\t\tacceptHtml(\n\t\t\t\tvariation.blocksy_gallery_html,\n\t\t\t\tvariation.blocksy_gallery_style\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\tcurrentVariation.removeAttribute('style')\n\t\trequestAnimationFrame(() => {\n\t\t\tcurrentVariation.dataset.state = 'loading'\n\t\t})\n\n\t\tlet maybeLoadedVariation = allVariations\n\t\t\t? allVariations.find(\n\t\t\t\t\t(nestedVariation) =>\n\t\t\t\t\t\tstore[\n\t\t\t\t\t\t\tmakeUrlFor({\n\t\t\t\t\t\t\t\tvariation: nestedVariation,\n\t\t\t\t\t\t\t\tproductId,\n\t\t\t\t\t\t\t\tisQuickView,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t] &&\n\t\t\t\t\t\tnestedVariation.image_id === variation.image_id &&\n\t\t\t\t\t\tvariation.blocksy_gallery_source === 'default' &&\n\t\t\t\t\t\tnestedVariation.blocksy_gallery_source === 'default'\n\t\t\t )\n\t\t\t: null\n\n\t\tcachedFetch(\n\t\t\tmakeUrlFor({\n\t\t\t\tvariation: maybeLoadedVariation || variation,\n\t\t\t\tproductId,\n\t\t\t\tisQuickView,\n\t\t\t}),\n\t\t\t{\n\t\t\t\tmethod: 'POST',\n\t\t\t}\n\t\t)\n\t\t\t.then((response) => response.json())\n\t\t\t.then(({ success, data }) => {\n\t\t\t\tif (!success) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tacceptHtml(data.html, data.blocksy_gallery_style)\n\t\t\t})\n\t}\n}\n"],"names":["originalImageUpdate","store","makeUrlFor","variation","productId","isQuickView","url","URL","ct_localizations","ajax_url","params","URLSearchParams","search","slice","append","variation_id","toString","replaceFirstImage","container","image","containersToReplace","map","selector","parentNode","querySelector","push","imgContainer","href","full_src","dataset","height","full_src_h","width","full_src_w","querySelectorAll","img","remove","matches","getAttribute","closest","gallery_thumbnail_src_w","src_w","gallery_thumbnail_src_h","src_h","src","gallery_thumbnail_src","srcset","removeAttribute","$","window","wp","customize","rect","getBoundingClientRect","parseFloat","zoom","touch","duration","magnify","document","createEvent","e","isTouchDevice","on","mount","el","currentElement","this","currentVariation","productContainer","id","replace","product_id","allVariations","JSON","parse","product_variations","nextVariationObj","currentVariationObj","find","parseInt","defaultCanDoInPlaceUpdate","canDoInPlaceUpdate","every","blocksy_gallery_source","currentImage","image_id","blocksy_original_image","nextImage","maybePillImage","pillIndex","children","indexOf","pill","flexy","forcedMount","setTimeout","click","performInPlaceUpdate","acceptHtml","html","style","div","createElement","innerHTML","firstElementChild","index","didInsert","insertAdjacentHTML","classList","add","hasLazyLoadClickHoverListener","ctEvents","blocksy_gallery_html","blocksy_gallery_style","requestAnimationFrame","state","maybeLoadedVariation","nestedVariation","Promise","resolve","clone","fetch","then","response","json","success","data"],"sourceRoot":""}