Files
Obsidian/Edge Shopping/2.1.114.0/shopping_iframe_driver.js
T

1 line
22 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,i,n){return(i=function(t){var i=function(t){if("object"!==e(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,"string");if("object"!==e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===e(i)?i:String(i)}(i))in t?Object.defineProperty(t,i,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[i]=n,t}let i=function(e){return e.Opal="Opal",e.Extension="Extension",e.SafariExtension="SafariExtension",e.ChromeExtension="ChromeExtension",e.SafariIOSExtension="SafariIOSExtension",e.Edge="Edge",e.EdgeMobile="EdgeMobile",e.Sapphire="Sapphire",e.RBC="RBC",e.EdgeAndroid="EdgeAndroid",e.EdgeiOS="EdgeiOS",e.EdgeDiscover="EdgeDiscover",e}({});i.EdgeMobile,i.EdgeAndroid,i.EdgeiOS;i.Edge,new Set(["amazon.com","amazon.ca","amazon.co.uk","amazon.co.jp","alibaba.com"]),new Map(Object.entries({"etsy.com":"receipt_id","target.com":"referenceId","tmall.com":"bizOrderId"}));const n="COMPONENT_TO_FOCUS_IN_SHORELINE";Object.keys({"bestbuy.com":{policyDays:15,supportPageUrl:"https://www.bestbuy.com/site/help-topics/price-match-guarantee/pcmcat290300050002.c?id=pcmcat290300050002"},"costco.com":{policyDays:30,supportPageUrl:"https://customerservice.costco.com/app/answers/detail/a_id/628/~/price-adjustment---costco.com-orders",useCartAtPathname:"/checkoutcartdisplayview"},"kohls.com":{policyDays:14,supportPageUrl:"https://cs.kohls.com/app/answers/detail/a_id/90/~/price-match-policy"},"target.com":{policyDays:14,supportPageUrl:"https://help.target.com/help/subcategoryarticle?childcat=Price+Match+Guarantee&parentcat=Policies+%26+Guidelines&searchQuery=search+help",useCartAtPathname:"/cart"},"dickssportinggoods.com":{policyDays:14,supportPageUrl:"https://www.dickssportinggoods.com/s/price-match-policy",useCartAtPathname:"/orderitemdisplay"},"jcpenney.com":{policyDays:14,supportPageUrl:"https://www.jcpenney.com/m/customer-service/our-lowest-price-guarantee"},"macys.com":{policyDays:10,supportPageUrl:"https://customerservice-macys.com/articles/how-can-i-get-a-price-adjustment",useCartAtPathname:"/my-bag",hasCsrError:!0},"ashleyfurniture.com":{policyDays:30,supportPageUrl:"https://www.ashleyfurniture.com/price-match/"},"gap.com":{policyDays:14,supportPageUrl:"https://www.gap.com/customerService/info.do?cid=1192378"},"staples.com":{policyDays:14,supportPageUrl:"https://www.staples.com/sbd/cre/marketing/pmg/index.html"}});let r=null;const o="test-shopping-localstorage";function s(e){let t=null;return function(){try{if(null!==r)return r;"undefined"!=typeof window&&window?.localStorage&&(window.localStorage.setItem(o,o),window.localStorage.getItem(o),window.localStorage.removeItem(o),r=!0)}catch(e){r=!1}return r}()&&(t=window.localStorage.getItem(e)),t}function a(e,t){try{if(null!=(i=e)&&i.length>0&&"null"!==i){const i=e.split(/,(?![^\[\]{}()]*[\]})])/),n=[".*","(.*)",".+","(.+)","^.*$","^(.*)$","^.+$","^(.+)$"];for(const e of i){const i=e.trim();if(!n.includes(i)&&i&&new RegExp(i).test(t.toLowerCase()))return!0}return!1}return!1}catch{return!1}var i}class l{static Sleep(e){return new Promise((t=>setTimeout(t,e)))}static StringifyMap(e,t){return t instanceof Map?{dataType:"Map",value:Array.from(t.entries())}:t}static parseBool(e){return"true"===e||!0===e}static ParseMap(e,t){return"object"==typeof t&&null!==t&&"Map"===t.dataType?new Map(t.value):t}static async WaitForCondition(e,t,i){const n=(new Date).getTime();for(;!await e()&&n+t>(new Date).getTime();)await l.Sleep(i??100);return await e()}static async WaitUntilCondition(e,t){const i=(new Date).getTime();for(;i+t>(new Date).getTime();){if(await e())return!0;await l.Sleep(100)}return!1}static async WaitForSyncCondition(e,t){const i=(new Date).getTime();for(;i+t>(new Date).getTime();){if(e())return!0;await l.Sleep(100)}return!1}static IsValidDataField(e){return null!=e&&e.length>0&&"null"!==e}static IsPageMatch(e,t,i,n){let r=!1;if(l.IsValidDataField(e)&&(r=l.IsOnPage(e,i),r||(r=a(e,i))),l.IsValidDataField(t))try{!n&&location.href?.toLocaleLowerCase()?.includes(i.toLocaleLowerCase())&&"chrome-untrusted://shopping/"!==location.href&&(n=location.href?.toLocaleLowerCase()),r=a(t,n??i)}catch{}return r}static IsOnPage(e,t){if(l.IsValidDataField(e)&&t){const i=e.toLowerCase().replace(/\s+/g,"").split(","),n=t.toLowerCase();let r=!1;for(const e of i)if(n.indexOf(e)>=0){r=!0;break}return r}return!1}static ObserveUntil(e,t){const i=new MutationObserver((async()=>{e()&&(i.disconnect(),t())}));i.observe(document.body,{attributeFilter:["offsetWidth","offsetHeight"],childList:!0,subtree:!0})}static async MeasureExecutionTime(e,t){const i=performance.now();return await e(),performance.now()-i}static DeepAssign(e,t){return Object.keys(t).forEach((i=>{if("object"==typeof t[i])e[i]||Object.assign(e,{[i]:{}}),l.DeepAssign(e[i],t[i]);else{let n=t[i];"urlRegex"===i&&"string"==typeof n&&n.endsWith("/")&&(n=n.substring(0,n.length-1)),Object.assign(e,{[i]:n})}})),e}static scrollToModuleIfTargeted(e,t){s(n)===t&&setTimeout((()=>{e?.scrollIntoView({behavior:"smooth",block:"start"}),localStorage.removeItem(n)}),500)}}var c=l,u=class{constructor(e,i,n,r,o,s,a,l,c,u,p,m,d){t(this,"Name",void 0),t(this,"Type",void 0),t(this,"Value",void 0),t(this,"IsMandatory",void 0),t(this,"Format",void 0),t(this,"WaitForVisible",void 0),t(this,"WaitForNotDisabled",void 0),t(this,"WaitBefore",void 0),t(this,"WaitAfter",void 0),t(this,"WaitForNotVisible",void 0),t(this,"NotAlwaysShown",void 0),t(this,"DynamicFetch",void 0),t(this,"ShouldValue",void 0),this.Name=e,this.Type=i,this.Value=n,this.IsMandatory=r,this.Format=o,this.WaitForVisible=s,this.WaitForNotDisabled=a,this.WaitBefore=l,this.WaitAfter=c,this.WaitForNotVisible=u,this.NotAlwaysShown=p,this.DynamicFetch=m,this.ShouldValue=d}},p=class{constructor(e,i,n){if(t(this,"PageUrl",void 0),t(this,"Type",void 0),t(this,"CheckoutElements",void 0),this.PageUrl=e,this.Type=i,this.CheckoutElements=new Map,n)for(const e of n)if(e){const t=e.Name;let i=e.Value;t&&this.CheckoutElements.set(t,new u(t,e.Type,i,e.IsMandatory,e.Format,e.WaitForVisible,e.WaitForNotDisabled,e.WaitBefore,e.WaitAfter,e.WaitForNotVisble,e.NotAlwaysShown,e.DynamicFetch,e.ShouldValue))}}};class m{static Create(e){let t=JSON.parse(atob(e));const i=[],n=new Map,r=t?.[0]?.Group;if(r){let e=r;for(const i of t)if(i){const t=i.Group;if(t&&c.IsOnPage(i.PageUrl,location.pathname)){e=t;break}}t=t.map((t=>{if(t.Group===e)return t}))}for(const e of t)if(e){const t=e.Type;t&&!n.has(t)&&(i.push(t),n.set(t,new p(e.PageUrl,t,e.checkoutElements)))}return{map:n,array:i}}constructor(e){if(t(this,"DomainName",void 0),t(this,"AllcheckoutCompletionPages",void 0),t(this,"AllPageTypeArr",void 0),t(this,"AllCheckoutCompletionPagesStr",void 0),t(this,"IsExpressCheckoutEnabled",void 0),t(this,"CheckoutPageUrl",void 0),e){this.DomainName=e.domainName,this.CheckoutPageUrl=e.checkoutPageUrl,this.IsExpressCheckoutEnabled=e.isExpressCheckoutEnabled;const t=e.allCheckoutCompletionPagesStr;if(this.AllCheckoutCompletionPagesStr=t,t){const{map:e,array:i}=m.Create(t);this.AllcheckoutCompletionPages=e,this.AllPageTypeArr=i}}}}t(m,"PageTypeArr",[]);var d=m;let f=function(e){return e.CCNUpdate="CCNUpdate",e.CCName="CCName",e.CCFirstName="CCFirstName",e.CCMiddleName="CCMiddleName",e.CCLastName="CCLastName",e.CCExpiry="CCExpiry",e.CCExpiryMonth="CCExpiryMonth",e.CCExpiryYear="CCExpiryYear",e.CCSecurityCode="CCSecurityCode",e}({});function h(e){return!e||!e.trim()}function g(e,t,i=!1){if(!e)return 0;const n=i?["-","–","—","/","\\"]:["-"];for(const r of n)if(e.includes(r)){const n=S(e,r,t,i);if(isNaN(n))return 0;e=n.toString();break}e=(e=(e=(e=e.replace(/\([^)]*\)/g,"")).replace(/[^0-9\.,]+/g,"")).replace(/[\.]+$/g,"")).replace(/^[\.]+/,"");try{!1===function(e,t){if("$"===t)return!0;const i=e.lastIndexOf(","),n=e.lastIndexOf(".");return!(n>-1&&i>-1&&i>n||n>-1&&e.length-n-1>2||i>-1&&e.length-i-1<=2||-1===i&&-1===n&&(e=e.trim(),/\s/.test(e)))}(e,t)&&(e=function(e){return e.replace(/[,.]/g,(e=>","===e?".":","))}(e))}catch{}return e=e.replace(/[,]+/g,""),parseFloat(e)}function C(e){return!(!e||!y)&&y.has(e)}const b=["₹","£","€","¥","¥","₽","元","₩","₱","đ","₫","฿","₦","US$","CA$","CL$","AU$","MX$","MXN$","C$","A$","R$","NZ$","COL$","NT$","£E","SG$","zł","S$","AR$","$","£","USD","INR","GBP","CAD","EUR","AUD","JPY","BRL","MXN","NZD","CNY","KRW","RUB","IDR","PHP","VND","THB","TWD","EGP","DKK","SEK","RM","MYR","AMD","CHF","PLN","NOK","SGD","CZK","TL","TRY","COP","ZAR","CLP","SAR","AED","Rp","dr.","Fr.","Kč","Rs","kr.","kr","R","円","Rs","HUF","HK$","руб","₪","JMD","lei","UAH","DOP","XAF","XOF","KD","KWD","AWG","CFP","BGN","BAM","KZT","MAD","BOB","GEL","JOD","QAR","XCD","MNT","TND","NGN","BDT","S/","MDL","MZN","PKR","LAK","BWP","OMR","CRC","DZD","KES","LKR"],y=new Set(b),E=(new Map([["en-us","$"],["en-gb","£"],["en-ca","CA$"],["en-au","AU$"],["en-in","₹"],["fr-fr","€"],["de-de","€"],["ja-jp","¥"],["it-it","€"],["nl-nl","€"],["es-es","€"],["en-nz","NZ$"],["pt-br","R$"],["zh-cn","元"],["es-mx","MX$"],["ko-kr"," ₩"],["ru-ru","₽"],["id-id","Rp"],["fil-ph","₱"],["vi-vn","đ"],["th-th","฿"],["zh-tw","NT$"],["ar-eg","EGP"],["de-at","€"],["da-dk","kr."],["de-ch","Fr."],["pl-pl","zł"],["sv-se","kr"],["en-my","RM"],["no-no","NOK"],["en-sg","S$"],["fi-fi","€"],["fr-be","€"],["cs-cz","Kč"],["tr-tr","TL"],["es-co","COL$"],["en-za","R"],["en-sa","SAR"],["en-eg","EGP"],["ar-ae","AED"],["es-ar","AR$"],["en-ng","₦"],["ar-kw","KD"],["ar-kw","KWD"]]),new Set(["USD","INR","GBP","EUR","NZD","BRL","CAD","AUD","JPY","CNY","MXN","KRW","RUB","IDR","PHP","VND","THB","TWD","EGP","DKK","CHF","PLN","SEK","MYR","NOK","SGD","CZK","TRY","COP","ZAR","CLP","SAR","AED","ARS","NGN","KWD"]),new Map([["$","USD"],["₹","INR"],["Rs","INR"],["£","GBP"],["€","EUR"],["NZ$","NZD"],["R$","BRL"],["CA$","CAD"],["C$","CAD"],["A$","AUD"],["AU$","AUD"],["¥","JPY"],["¥","JPY"],["円","JPY"],["元","CNY"],["MX$","MXN"],["MXN$","MXN"],["£","GBP"],["₩","KRW"],["₽","RUB"],["Rp","IDR"],["₱","PHP"],["đ","VND"],["₫","VND"],["฿","THB"],["NT$","TWD"],["EGP","EGP"],["kr.","DKK"],["Fr.","CHF"],["zł","PLN"],["dr.","SEK"],["RM","MYR"],["NOK","NOK"],["S$","SGD"],["Kč","CZK"],["TL","TRY"],["COL$","COP"],["R","ZAR"],["kr","DKK"],["SG$","SGD"],["SAR","SAR"],["AED","AED"],["AMD","AMD"],["AR$","ARS"],["₦","NGN"],["KD","KWD"]]));function S(e,t,i,n=!1){const[r,o]=e.split(t),s=g(r.trim(),i,n),a=g(o.trim(),i,n),l=e=>!isNaN(e)&&e>0;let c=1/0;return l(s)&&(c=Math.min(c,s)),l(a)&&(c=Math.min(c,a)),c===1/0?0:c}function w(e){try{if(!e)return null;let i=e.innerText;if(e.querySelector&&e.querySelector("sup")&&(i=function(e){try{let t=e.innerText;const i=t.split("\n"),n=e.querySelectorAll("sup");for(const e of n){const t=e.innerText;if(t)for(let e=0;e<i.length;e++){const n=i[e].lastIndexOf(t);if(n>0){let r=".";return("."===i[e][n-1]||t.startsWith("."))&&(r=""),i[e]=i[e].substring(0,n)+r+i[e].substring(n),i.join("\n")}}}return t}catch(t){return e.innerText}}(e)),i&&i.length){const e=function(e,t){const i=e.replace(/[0-9,. ]/g,"").trim();for(const e of b)if(e===i)return e;for(const e of b)if(i.includes(e))return e;return t?function(e){return e&&!h(e)&&C(e)?e:""}(i):function(e){return e&&!h(e)&&C(e)?e:"$"}(i)}(i),n=i.split(/[\n()]/).filter((e=>e.trim().length>0));for(const i of n){const n=g(i.trim());if(n&&n>0){const i=(t=e,E.get(t));return{price:n.toString(),currency:e,currencyCode:i||""}}}}return null}catch(e){return null}var t}new Set(E.keys()),new Map([["USD","$"],["INR","₹"],["GBP","£"],["EUR","€"],["NZD","NZ$"],["BRL","R$"],["CAD","CA$"],["AUD","AU$"],["JPY","¥"],["CNY","元"],["MXN","MX$"],["GBP","£"],["KRW","₩"],["RUB","₽"],["IDR","Rp"],["PHP","₱"],["VND","đ"],["THB","฿"],["TWD","NT$"],["EGP","EGP"],["DKK","kr."],["CHF","Fr."],["PLN","zł"],["SEK","dr."],["MYR","RM"],["NOK","NOK"],["SGD","S$"],["CZK","Kč"],["TRY","TL"],["COP","COL$"],["ZAR","R"],["SAR","SAR"],["AED","AED"],["ARS","AR$"],["NGN","₦"],["KWD","KD"],["ج.م.","EGP"]]);let D=function(e){return e.InStock="In Stock",e.OutOfStock="Out of Stock",e.Empty="",e}({});const N=new Map([["en",["out of stock","sold out","unavailable","temporarily unavailable","currently unavailable","not available","not in stock","item unavailable","backorder","pre-order only","discontinued","coming soon","notify me","break","email when available","currently out of stock","temporarily out of stock","stock status: unavailable","this item is currently unavailable"]],["es",["agotado","sin stock","no disponible","fuera de stock","temporalmente no disponible","no disponible actualmente","sin existencias","producto agotado","fuera de inventario","no hay stock","stock agotado","artículo no disponible","temporalmente agotado","avísame cuando esté disponible","notificarme"]],["fr",["en rupture","rupture de stock","non disponible","épuisé","temporairement indisponible","actuellement indisponible","hors stock","produit épuisé","indisponible temporairement","stock épuisé","article non disponible","me prévenir quand disponible","prévenez-moi","avertissez-moi"]],["de",["nicht verfügbar","ausverkauft","nicht auf lager","vergriffen","vorübergehend nicht verfügbar","derzeit nicht verfügbar","nicht lieferbar","artikel nicht verfügbar","lager leer","benachrichtigen wenn verfügbar","zur zeit nicht verfügbar","benachrichtigen"]],["it",["esaurito","non disponibile","fuori stock","temporaneamente non disponibile","attualmente non disponibile","prodotto esaurito","non in magazzino","articolo non disponibile","scorte esaurite","avvisami quando disponibile","al momento non disponibile","notificami"]],["pt",["esgotado","fora de estoque","indisponível","temporariamente indisponível","atualmente indisponível","produto esgotado","sem estoque","artigo indisponível","estoque esgotado","me avise quando disponível","no momento indisponível","notifique-me"]],["ja",["在庫切れ","品切れ","売り切れ","在庫なし","一時的に利用できません","現在利用できません","完売","取り扱い終了","在庫不足","入荷待ち","販売終了","在庫切れ中","品切れ中","現在品切れ中"]],["zh",["缺货","售罄","暂时缺货","无库存","暂时无货","库存不足","商品缺货","暂时售罄","现货不足","无现货","预售","到货通知","暂无库存","库存售完","商品售罄","暂时没货"]],["ar",["نفدت الكمية","غير متوفر","نفد المخزون","غير متاح حالياً","مؤقتاً غير متوفر","انتهت الكمية","غير متاح للشراء","نفد من المخزون","غير موجود","انتهى المخزون","مؤقتاً غير متاح","أخطرني عند التوفر","غير متوفر حالياً","السلعة غير متوفرة"]]]);let A=function(e){return e.Text="Text",e.Price="Price",e.Image="Image",e.HTMLElement="HTMLElement",e.Number="Number",e}({});class v{static HasVisibleElement(e){return v.CountVisibleElements(e)>0}static HasVisibleElementInViewport(e){return v.CountVisibleElementsInViewport(e)>0}static CountVisibleElements(e){if(!c.IsValidDataField(e))return 0;const t=e.split(";");for(const e of t){const t=v.CountVisibleElementsSingleSel(e);if(t>0)return t}return 0}static CountVisibleElementsInViewport(e){if(!c.IsValidDataField(e))return 0;const t=e.split(";");for(const e of t){const t=v.CountVisibleElementsSingleSelInViewport(e);if(t>0)return t}return 0}static RunQuerySelectorAll(e,t){if(!c.IsValidDataField(e))return[];const i=(e=e.replace(/;/g,",")).split("<");let n;n=t?t.querySelectorAll(i[0]):document.querySelectorAll(i[0]);for(const e of i.slice(1)){const t=n[0]?.shadowRoot;if(!t)return[];n=t.querySelectorAll(e)}return n}static IsElementVisible(e){return e&&e.offsetWidth>0&&e.offsetHeight>0}static IsElementVisibleInViewport(e){if(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}return!1}static GetFirstVisibleElement(e,t){if(!c.IsValidDataField(e))return;const i=e.split(";");for(const e of i)try{const i=v.RunQuerySelectorAll(e,t);for(const e of i)if(v.IsElementVisible(e))return e}catch(e){}}static GetAllVisibleElements(e){if(!c.IsValidDataField(e))return[];const t=e.split(";"),i=[];for(const e of t){const t=v.RunQuerySelectorAll(e);for(const e of t)v.IsElementVisible(e)&&i.push(e)}return i}static GetAllElementsWithText(e){if(!c.IsValidDataField(e))return[];const t=e.split(";"),i=[];for(const e of t){const t=v.RunQuerySelectorAll(e);for(const e of t)e.innerText&&e.innerText.trim().length>0&&i.push(e)}return i}static GetTextValue(e,t){if(!e||!c.IsValidDataField(e))return"";const i=e.split(";"),n=i[0],r=v.GetFirstVisibleElement(n,t);if(!r)return"";let o=r,s=o.innerText;if(1===i.length)o=v.NormalizeIfSuperscripted(r),s=o.innerText;else{const e=o.cloneNode(!0);let r=i[1];const a=v.GetFirstVisibleElement(r,o)??v.GetFirstVisibleElement(r,t);let l="";if(a&&a.innerText){if(l="."+a.innerText,o.contains(a)){const t=v.GetFirstMatchingElement(r,e);if(t?.innerText)e.removeChild(t);else{r.startsWith(n)&&(r=r.slice(n.length));const t=this.GetFirstMatchingElement(r,e);t?.innerText&&e.removeChild(t)}s=e?.innerText?e.innerText:s}s+=l}if(i.length>2){for(const t of i.slice(2)){const i=this.GetFirstMatchingElement(t,e);i?.innerText&&e.removeChild(i)}s=e?.innerText?e.innerText:s}s+=l}return v.StripInvalidJSONCharacters(s)}static GetItemizedData(e,t,i){let n="";if(e&&""!==e){const r=v.RunQuerySelectorAll(e,i);for(const e of r)e&&e.textContent&&(n+=e.textContent?.trim()+t)}return n}static StripInvalidJSONCharacters(e){return e.replace(/\n/gi,"")}static NormalizeIfSuperscripted(e){if(e&&e.innerHTML&&e.innerHTML.toLowerCase().indexOf("</sup>")>-1)try{const t=e.cloneNode(!0),i=t.childNodes.length;for(let e=0;e<i;e++){const i=t.childNodes[e];if("SUP"===i.tagName){let e=i.innerText;const n=/[0-9\.]+/g.exec(e);if(null!==n)return e="."+n[0],i.innerText=e,t}}}catch(t){return e}return e}static GetFirstMatchingElement(e,t){if(!c.IsValidDataField(e))return;const i=e.split(";");for(const e of i){const i=v.RunQuerySelectorAll(e,t);for(const e of i)if(e)return e}}static GetAllMatchingElements(e){if(!c.IsValidDataField(e))return[];const t=e.split(";"),i=[];for(const e of t)try{const t=v.RunQuerySelectorAll(e);for(const e of t)e&&i.push(e)}catch(e){}return i}static CountVisibleElementsSingleSel(e){if(!c.IsValidDataField(e))return 0;const t=v.RunQuerySelectorAll(e);let i=0;for(const e of t)v.IsElementVisible(e)&&i++;return i}static CountVisibleElementsSingleSelInViewport(e){if(!c.IsValidDataField(e))return 0;const t=v.RunQuerySelectorAll(e);let i=0;for(const e of t)v.IsElementVisibleInViewport(e)&&i++;return i}static NormalizeProductAvailability(e,t){if(!t)return D.Empty;const i=v.ExtractAllElementText(t)?.map((e=>e.toLowerCase().replace(/[-_]/g," "))),n=N.get(e)||N.get("en"),r=new RegExp(n.map((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))).join("|"),"i");for(const e of i)if(r.test(e))return D.OutOfStock;return v.IsElementDisabledOrHidden(t)?D.OutOfStock:D.InStock}static DetectPageLanguage(){try{const e=document.documentElement.lang;if(e){const t=e.toLowerCase().split("-")[0];if(N.has(t))return t}return"en"}catch(e){return"en"}}static ExtractAllElementText(e){if(!e)return[];const t=[];try{e.innerText&&t.push(String(e.innerText).toLowerCase().trim());const i=e.getAttribute&&e.getAttribute("title");i&&t.push(String(i).toLowerCase().trim());const n=e.getAttribute&&e.getAttribute("aria-label");n&&t.push(String(n).toLowerCase().trim());const r=e.getAttribute&&e.getAttribute("id");r&&t.push(String(r).toLowerCase().trim());const o=e.getAttribute&&e.getAttribute("value");o&&t.push(String(o).toLowerCase().trim())}catch(e){}return t.filter(((e,t,i)=>e&&e.trim().length>0&&i.indexOf(e)===t))}static IsElementDisabledOrHidden(e){if(!e)return!0;try{if(!v.IsElementVisible(e))return!0;if(e.hasAttribute&&e.hasAttribute("disabled"))return!0;if((e instanceof HTMLButtonElement||e instanceof HTMLInputElement)&&e.disabled)return!0}catch(e){}return!1}static ApplySelectorsInOrder(e,t){if(!e||!c.IsValidDataField(e))return"";try{const i=e.split(",").map((e=>e.trim())).reverse();for(const e of i)if(e)try{const i=e.indexOf("ATTEX"),n=-1!==i?e.substring(0,i):e,r=-1!==i?e.substring(i+5):void 0,o=document.querySelector(n);if(!o)continue;const s=r?o.getAttribute(r)?.trim():void 0;if(t===A.Text){const e=s||o.innerText?.trim();if(e&&e.length>0)return v.StripInvalidJSONCharacters(e)}else if(t===A.Price){const e=w(o);if(e)return e}else if(t===A.Image){if(s)return v.StripInvalidJSONCharacters(s);if(o instanceof HTMLImageElement&&(o.src||o.currentSrc))return v.StripInvalidJSONCharacters(o.src.trim()||o.currentSrc.trim())}else if(t===A.Number){const e=s||o.innerText;if(e){const t=e.match(/\d[\d,.]*/);if(t)return t[0]}}else if(t===A.HTMLElement)return o}catch(e){continue}}catch(e){}return""}}var R=v;function P(e,t){const i=document.createEvent("Events");i.initEvent("change",!0,!1);const n=document.createEvent("Events");n.initEvent("input",!0,!1);const r=new KeyboardEvent("keyup",{bubbles:!0,cancelable:!0,view:window}),o=R.GetFirstVisibleElement(e);if(!o)throw new Error("input box undefined");o.blur(),o.dispatchEvent(i),o.focus(),o.setAttribute("value",t),o.value=t,o.dispatchEvent(r),o.dispatchEvent(n),o.dispatchEvent(i)}window.RunIframeAction=function(e){let t="",i="";try{const n=JSON.parse(e[0]);t=n.Guid,i=n.ParentOrigin;const r=n.CommandName,o=n.Value,s=d.Create(n.AllCheckoutCompletionPagesStr)?.map,a=s.get("PaymentIframe");try{if(r===f.CCNUpdate){const e=a?.CheckoutElements.get("cardNumber");e&&P(e.Value,o)}else if(r===f.CCName){const e=a?.CheckoutElements.get("nameOnCard");e&&P(e.Value,o)}else if(r===f.CCFirstName){const e=a?.CheckoutElements.get("firstName");e&&P(e.Value,o)}else if(r===f.CCMiddleName){const e=a?.CheckoutElements.get("middleName");e&&P(e.Value,o)}else if(r===f.CCLastName){const e=a?.CheckoutElements.get("lastName");e&&P(e.Value,o)}else if(r===f.CCExpiry){const e=a?.CheckoutElements.get("expiry");e&&P(e.Value,o)}else if(r===f.CCExpiryMonth){const e=a?.CheckoutElements.get("expiryMonth");e&&P(e.Value,o)}else if(r===f.CCExpiryYear){const e=a?.CheckoutElements.get("expiryYear");e&&P(e.Value,o)}else if(r===f.CCSecurityCode){const e=a?.CheckoutElements.get("securityCode");e&&P(e.Value,o)}parent.postMessage({guid:t,status:"SUCCESS"},i)}catch(e){parent.postMessage({guid:t,status:"ERROR"},i)}}catch(e){parent.postMessage({guid:t,status:"ERROR"},i)}};const T=new class{initialize(e){e.splice(0,2),window.RunIframeAction(e)}};window.shoppingIframeRuntime=T}();