var tpWidgetsPixelBlocked=!0;!async function(){if(!0===window.tpHeaderLoaded)return;let t=!1;window.tpHeaderLoaded=!0;const e="//ecommplugins-reviewsapp.trustpilot.com",o="//ecommplugins-trustboxpreview.trustpilot.com/v2.0/trustboxpreview.min.js",n="//ecommplugins-scripts.trustpilot.com/v2.1/css/preview.min.css",r="TRUSTPILOT_SKU_VALUE_";function i(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(t,e){return String.fromCharCode(parseInt(e,16))}))}const s=new URL(document.currentScript.src),c=s.searchParams?s.searchParams.get("settings"):void 0,p=s.searchParams?s.searchParams.get("shop"):"https://admin.shopify.com",d=c?JSON.parse((u=c,decodeURIComponent(Array.prototype.map.call(atob(u),function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)}).join("")))):{};var u;"undefined"==typeof TrustpilotObject&&function(t,e,o,n,r){t.TrustpilotObject=r,t.tp=t.tp||function(){(t.tp.q=t.tp.q||[]).push(arguments)},a=e.createElement(o),a.async=1,a.src="https://invitejs.trustpilot.com/tp.min.js",a.type="text/java"+o,f=e.getElementsByTagName(o)[0],f.parentNode.insertBefore(a,f)}(window,document,"script",0,"tp"),tp("register",d.key);const l=new CustomEvent("trustpilotScriptLoaded");if(dispatchEvent(l),function(t){return!(!t||!t.searchParams||"true"!==t.searchParams.get("tpTrustBoxPreview"))}(new URL(window.location.href))){document.body.style.paddingTop="75px";var m=document.createElement("script");if(m.type="text/javascript",m.src="//widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js",m.async=!0,document.head.appendChild(m),"undefined"==typeof TrustpilotPreview)try{var g=document.createElement("script");g.type="text/javascript",g.src="//ecommplugins-scripts.trustpilot.com/v2.1/js/preview_shopify.js",g.onload=function(t){const a=document.createElement("iframe");a.id="pixel_iframe",a.src=`${e}/pixel/index.html?shop=${p}`,a.setAttribute("style","display: none; width: 1px; height: 1px;"),a.onload=function(t){document.getElementById("pixel_iframe").contentWindow.postMessage(JSON.stringify({basis:"iframe",action:"initialLoad"}),"https:"+e)},document.body.appendChild(a)},document.head.appendChild(g)}catch(l){console.log("TrustpilotPreview couldn't load")}window.addEventListener("message",function(a){var r=new URL(window.location).hostname,s=new URL(a.origin).hostname,c=-1===a.origin.indexOf(r),p=r!==s;if(c!==p&&console.log(`Origin missmatch: old condition result: ${c}, new condition result: ${p}`),a.data&&(!p||a.origin==="https:"+e)&&"undefined"!=typeof TrustpilotPreview)if("string"==typeof a.data&&"submit"===a.data)TrustpilotPreview.sendTrustboxes();else if("string"==typeof a.data){try{jsonData=JSON.parse(a.data)}catch(t){return}jsonData.trustbox?TrustpilotPreview.setSettings(jsonData.trustbox):"updatePageUrls"===jsonData.type||"newTrustBox"===jsonData.type||"deletePageTrustBoxes"===jsonData.type?TrustpilotPreview.sendDataTransfer(a.data):"loadCategoryProductInfo"===jsonData.type?function(){const t=$("a.product").toArray().map(t=>t.href.split("/").pop());return Promise.all(t.map(t=>new Promise((e,a)=>{Shopify.getProduct(t,e)}))).then(t=>{const e=v(),a=t.map(t=>({productUrl:t.url,id:t.id.toString(),variationIds:t.variants.map(t=>t.id.toString()),variationSkus:t.variants.map(t=>t[e]),name:t.title}));return a})}().then(t=>{window.postMessage(JSON.stringify(t),window.origin)}):jsonData.customised?TrustpilotPreview.updateActive(jsonData.customised):jsonData.loadData&&(t||(!async function(t){var e=document.createElement("div");e.id="trustpilot_initial_data",e.setAttribute("data-page-urls",i(JSON.stringify(t.loadData.trustbox.pageUrls))),e.setAttribute("data-custom-trustboxes",t.loadData.customTrustBoxes),e.setAttribute("data-settings",i(JSON.stringify(t.loadData))),e.setAttribute("id","trustpilot-trustbox-preview"),e.setAttribute("data-source","Shopify"),e.setAttribute("data-sku","product"===x()?await w(d.s):""),document.body.appendChild(e);var a=document.createElement("script");a.type="text/javascript",a.src=o,a.async=!0,a.onload=function(){const e=JSON.stringify({basis:"iframe",TrustBoxPreviewMode:{integrationKey:d.key},enable:!0,widgets:t.widgets});window.postMessage(e,window.origin),tpWidgetsPixelBlocked=!1,TrustpilotPreview.init([n],t.loadData.trustbox,window,document.getElementById("pixel_iframe").contentWindow)},document.head.appendChild(a)}(jsonData),t=!0))}})}else"undefined"!=typeof trustpilot_trustbox_settings?await b():addEventListener("trustpilotTrustboxSettingsLoaded",async function(){await b()});async function y(t){var e=(await w(t)).join(","),a=function(){var t=ShopifyAnalytics&&ShopifyAnalytics.meta||t;if(t&&t.product&&t.product.variants&&t.product.variants.length>0){var e=t.product.variants;if(t.product.selectedVariantId)for(var a=0;a{const a=new XMLHttpRequest;a.onreadystatechange=function(){if(4===a.readyState&&200==a.status)try{t(JSON.parse(a.response))}catch(t){e()}},a.open("GET",window.location.href,!0),a.setRequestHeader("Accept","application/json"),a.send(null)})).product)}catch(t){}return e}function h(t,e,a){t.push(`${r}${a.id}`);var o=a.variants;for(var n in o)t.push(`${r}${o[n].id}`),o[n][e]&&t.push(o[n][e])}function v(t){return t||(t="sku"),t.toLowerCase()}function x(){const t=document.head.querySelector("[property~='og:type'][content]"),e=t?t.content:"",a=location.pathname;if(meta&&meta.page&&"home"===meta.page.pageType||"/"===location.pathname)return"landing";if(meta&&meta.page&&"collection"===meta.page.pageType||"product.group"===e||/^\/collections(\/[a-z0-9-_]+\/?$)?\/?$/.test(a))return"category";return meta&&meta.page&&"product"===meta.page.pageType||meta&&void 0!==meta.product||"product"===e||/^\/(collections\/[a-z0-9-_]+\/)?products\/[a-z0-9-_]+\/?$/.test(a)?"product":void 0}async function b(){const t=x();if("product"===t){const t=d.s;await y(t)}trustpilot_trustbox_settings.trustboxes=trustpilot_trustbox_settings.trustboxes.filter(function(e){return t===e.page||P(e.page)===P(location.origin+location.pathname)||e.page.toLowerCase()===btoa(location.origin+location.pathname).toLowerCase()}),tp("trustBox",trustpilot_trustbox_settings)}function P(t){return"string"==typeof t?t.replace(/\/+$/,""):t}}(); //# sourceMappingURL=header.min.js.map