mk-sdk-git 1.1.94 → 1.1.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mk-core.js +1 -1
- package/dist/mk-sdk.js +1 -1
- package/package.json +1 -1
- package/src/core/experiments.js +126 -0
- package/src/core/transport.js +3 -0
- package/src/index.js +2 -0
- package/src/platforms/vtex.js +118 -0
- package/src/tryon/automount.js +21 -4
- package/src/tryon/bridge.js +4 -2
package/dist/mk-core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var tn=Object.defineProperty;var v=(t,e)=>{for(var r in e)tn(t,r,{get:e[r],enumerable:!0})};var jt={collectorUrl:"https://api-collector.mk3dlabs.com",appUrl:"https://mkfashion.mk3dlabs.com/visualizer",apiUrl:"https://mkfashion-new-api.mk3dlabs.com"},en={},Q=null;function Bt(){if(Q)return Q;let t=null;try{t=document.currentScript||document.querySelector("script[data-mk-project]")||document.querySelector('script[src*="mk-sdk"]')||document.querySelector('script[src*="mk-pixel"]')}catch(i){}let e=i=>{try{return t&&t.getAttribute(i)}catch(a){return null}},r=e("data-mk-project")||e("data-mk-client")||window.__MK&&(window.__MK.projectId||window.__MK.clientSlug)||null,n=e("data-mk-product")||window.__MK&&window.__MK.product||"mk-fashion",o=e("data-mk-collector")||window.__MK&&window.__MK.collectorUrl||en.collectorUrl||jt.collectorUrl;return Q={projectId:r,product:n,collectorUrl:o,appUrl:window.__MK&&window.__MK.appUrl||jt.appUrl,apiUrl:window.__MK&&window.__MK.apiUrl||jt.apiUrl,debug:!!(e("data-mk-debug")!==null||window.__MK&&window.__MK.debug||/[?&]mkdebug\b/.test(location.search)),observe:!!(window.__MK&&window.__MK.observe),forceButton:!!(window.__MK&&window.__MK.forceButton),anchor:window.__MK&&window.__MK.anchor||null,anchors:window.__MK&&window.__MK.anchors||null,cards:window.__MK&&window.__MK.cards||null,modalWidth:window.__MK&&window.__MK.modalWidth||null,modalHeight:window.__MK&&window.__MK.modalHeight||null,cartRedirect:!(window.__MK&&window.__MK.cartRedirect===!1),cartBehavior:window.__MK&&window.__MK.cartBehavior||null,cartOpenSelector:window.__MK&&window.__MK.cartOpenSelector||null,autoTrack:e("data-mk-no-autotrack")===null,batchIntervalMs:window.__MK&&window.__MK.batchIntervalMs||8e3,batchMaxSize:window.__MK&&window.__MK.batchMaxSize||20,engagementIntervalMs:15e3},Q}function y(){return Q||Bt()}function x(...t){let e=y();e&&e.debug&&typeof console!="undefined"&&console.log("[mk-sdk]",...t)}var Le="_mk_vid",Ie="_mk_sid",tt=null,et=null;function dt(){return typeof crypto!="undefined"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function Re(){if(tt)return tt;try{let t=localStorage.getItem(Le);return t||(t="v_"+dt(),localStorage.setItem(Le,t)),tt=t,t}catch(t){return tt="v_"+dt(),tt}}function Me(){if(et)return et;try{let t=sessionStorage.getItem(Ie);return t||(t="s_"+dt(),sessionStorage.setItem(Ie,t)),et=t,t}catch(t){return et="s_"+dt(),et}}var Pe=[/email/i,/e-?mail/i,/cpf/i,/cnpj/i,/phone/i,/telefone/i,/celular/i,/address/i,/endereco/i,/cep/i,/zip/i,/card/i,/cartao/i,/cvv/i,/password/i,/senha/i,/token/i,/\bnome\b/i,/fullname/i,/firstname/i,/lastname/i,/sobrenome/i,/birth/i,/nascimento/i,/rg\b/i],je={imageUrl:1,image:1,thumbnail:1,photo:1,imageBase64:1,src:1},Ot=2e3;function Be(t){for(let e=0;e<Pe.length;e++)if(Pe[e].test(t))return!0;return!1}function Nt(t){if(!t||typeof t!="object"||Array.isArray(t))return typeof t=="string"&&t.length>Ot?t.slice(0,200)+"...[truncated "+t.length+"B]":t;let e={};for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||Be(r))continue;let n=t[r];if(je[r]){e[r+"Present"]=!!n;continue}if(typeof n=="string"&&n.length>Ot){e[r]=n.slice(0,200)+"...[truncated "+n.length+"B]";continue}if(n&&typeof n=="object"&&!Array.isArray(n)){e[r]=rn(n);continue}e[r]=n}return e}function rn(t){let e={};for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||Be(r))continue;let n=t[r];if(je[r]){e[r+"Present"]=!!n;continue}if(typeof n=="string"&&n.length>Ot){e[r]=n.slice(0,200)+"...[truncated]";continue}e[r]=n}return e}var ft=[],qt=null,$=null,Dt="1.1.94",nn=["off","pdp_tryon","pdp","all","tryon_engaged"],rt,zt=null,H="unknown",K=[],F=null;function Ne(){let t=y();return"mk_engaged_"+(t&&t.projectId||"")}function Ut(){if(F!==null)return F;try{F=localStorage.getItem(Ne())==="1"}catch(t){F=!1}return F}function Ft(){if(!Ut()){F=!0;try{localStorage.setItem(Ne(),"1")}catch(t){}pt(!1)}}var on=/^purchase$/;function qe(t,e){if(rt===void 0)return"hold";if(rt==="off")return"drop";if(rt==="all"||e&&on.test(e))return"collect";switch(rt){case"pdp":return t==="pdp"?"collect":"drop";case"tryon_engaged":if(Ut())return"collect";case"pdp_tryon":return t!=="pdp"?"drop":H==="available"?"collect":H==="unavailable"?"drop":"hold";default:return"collect"}}function pt(t){if(!K.length)return;let e=[];for(let r of K){let n=qe(r._pt,r.name);n==="collect"?Ue(r.name,r.params,r.ts):n==="hold"&&!t&&e.push(r)}K=e}function $t(t){rt=nn.indexOf(t)>=0?t:"all",pt(!1)}function ze(t){H=t==="available"?"available":"unavailable",pt(!1)}function De(t){pt(!0),$=t,zt=t&&t.pageType||null,H="unknown"}function m(t,e,r){if(!y().projectId){(m._pre=m._pre||[]).push({name:t,params:e,ts:r||Date.now()}),m._pre.length>50&&m._pre.shift();return}if(m._pre&&m._pre.length){let o=m._pre;m._pre=[];for(let i of o)Oe(i.name,i.params,i.ts)}Oe(t,e,r)}function Oe(t,e,r){let n=qe(zt,t);if(an(t,e,n),n==="collect"){Ue(t,e,r);return}if(n==="drop"){x("descartado (escopo)",t);return}K.push({name:t,params:e,ts:r||Date.now(),_pt:zt}),K.length>300&&K.shift()}function an(t,e,r){if(y().observe)try{window.postMessage({__mkpixel:!0,event:{name:"page_"+Fe(t),params:Nt(e||{})},site:$?{pageType:$.pageType,platform:$.platform,url:$.url}:null,gate:r},"*")}catch(o){}}function Ue(t,e,r){let n=y(),o=Nt(e||{}),i="page_"+Fe(t);if(ft.push({name:i,ts:r||Date.now(),params:o}),x("queued",t,o),ft.length>=n.batchMaxSize){B();return}qt||(qt=setTimeout(()=>{qt=null,B()},n.batchIntervalMs))}function Fe(t){if(typeof t!="string"||!t)return"unknown";let e=t.replace(/^on/,"");return e=e.replace(/[A-Z]/g,(r,n)=>(n>0?"_":"")+r.toLowerCase()),e.indexOf("page_")===0&&(e=e.slice(5)),e}function B(t){if(ft.length===0)return;let e=y();if(!e.projectId||!e.collectorUrl)return;let r=ft.splice(0,50),n=H==="available"?!0:H==="unavailable"?!1:void 0,o=JSON.stringify({product:e.product||void 0,sdkVersion:Dt,visitorId:Re(),sessionId:Me(),engaged:Ut()||void 0,tryonAvailable:n,events:r,site:$||void 0}),i=e.collectorUrl+"/v1/track";try{fetch(i,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json","X-MK-Project-Id":e.projectId},body:o}).catch(()=>{})}catch(a){try{navigator.sendBeacon&&navigator.sendBeacon(i+"?projectId="+encodeURIComponent(e.projectId),new Blob([o],{type:"text/plain"}))}catch(c){}}}function $e(){try{window.addEventListener("pagehide",()=>B(!0)),window.addEventListener("beforeunload",()=>B(!0)),document.addEventListener("visibilitychange",()=>{document.hidden&&B(!0)})}catch(t){}}function E(t){let e=[];try{let r=document.querySelectorAll('script[type="application/ld+json"]');for(let n of r){let o;try{o=JSON.parse(n.textContent)}catch(a){continue}let i=[];Array.isArray(o)?i.push(...o):o["@graph"]?i.push(...o["@graph"]):i.push(o);for(let a of i){if(!a||!a["@type"])continue;let c=Array.isArray(a["@type"])?a["@type"]:[a["@type"]];(!t||t.some(l=>c.includes(l)))&&e.push(a)}}}catch(r){}return e}var Ke=["off","pdp_tryon","pdp","all","tryon_engaged"],cn="all",ln=30*60*1e3,O=null;function V(){if(O)return O;let t=y();return!t.projectId||!t.apiUrl?(O=Promise.resolve(null),O):(O=fetch(t.apiUrl+"/projects/"+t.projectId).then(e=>{if(!e.ok)throw new Error("http "+e.status);return e.json()}).then(e=>e&&e.project||e||null).catch(()=>(O=null,null)),O)}function He(t){let e=t&&t.analytic&&t.analytic.scope;return Ke.indexOf(e)>=0?e:cn}var Ve=t=>"mk_scope_"+t;function We(t){try{let e=localStorage.getItem(Ve(t));if(!e)return null;let r=JSON.parse(e);return!r||typeof r.exp!="number"||r.exp<Date.now()?null:Ke.indexOf(r.scope)>=0?r.scope:null}catch(e){return null}}function Je(t,e){try{localStorage.setItem(Ve(t),JSON.stringify({scope:e,exp:Date.now()+ln}))}catch(r){}}var Vt={};v(Vt,{addToCart:()=>vn,detect:()=>wn,getCartSummary:()=>bn,id:()=>yn,openCartDrawer:()=>Cn,resolveSku:()=>xn,skipRedirect:()=>gn});var ht={};v(ht,{addToCart:()=>dn,detect:()=>un,getCartSummary:()=>Ht,id:()=>sn,openCartDrawer:()=>hn,resolveSku:()=>Kt});var sn="shopify";function un(){return!!(window.Shopify||window.ShopifyAnalytics)}function Kt(){let t=window;return t.ShopifyAnalytics&&t.ShopifyAnalytics.meta&&t.ShopifyAnalytics.meta.product?{value:String(t.ShopifyAnalytics.meta.product.id),source:"shopify"}:null}var mt=t=>String(t==null?"":t).trim().toLowerCase();async function dn({size:t,color:e,sku:r,quantity:n}){let o=(location.pathname.split("/products/")[1]||"").split(/[?#]/)[0];if(!o)throw new Error("shopify: sem handle de produto na URL (n\xE3o \xE9 PDP?)");let a=(await fetch("/products/"+o+".js").then(p=>p.json())).variants||[],c=p=>[p.option1,p.option2,p.option3].concat(String(p.title||"").split("/")).map(mt).filter(Boolean),l=(p,A)=>c(p).indexOf(mt(A))>=0,s=p=>(!t||l(p,t))&&(!e||l(p,e)),u=null;if((t||e)&&(u=a.find(p=>s(p)&&p.available)||a.find(s)),!u&&r&&(u=a.find(p=>mt(p.sku)===mt(r))),u||(u=a.find(p=>p.available)||a[0]),!u)throw new Error("shopify: variante n\xE3o encontrada");let f=Ge(),d=null;if(f&&typeof f.getSectionsToRender=="function")try{d=f.getSectionsToRender().map(p=>({id:p.id,selector:p.selector||"#"+p.id})).filter(p=>p.id)}catch(p){}let w={items:[{id:u.id,quantity:n||1}]};d&&d.length&&(w.sections=d.map(p=>p.id).join(","),w.sections_url=location.pathname);let h=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)});if(!h.ok)throw new Error("shopify: /cart/add.js HTTP "+h.status);let b=await h.json().catch(()=>({}));return f&&d&&b.sections&&fn(f,d,b.sections),{platform:"shopify",variantId:u.id,size:u.title,sku:u.sku||null}}function Ge(){return document.querySelector("cart-drawer, cart-notification")}function fn(t,e,r){for(let n of e){let o=r[n.id];if(o)try{let i=null;if(typeof t.getSectionInnerHTML=="function")i=t.getSectionInnerHTML(o,n.selector);else{let c=new DOMParser().parseFromString(o,"text/html").querySelector(n.selector);i=c?c.innerHTML:null}let a=document.querySelector(n.selector);a&&i!=null&&(a.innerHTML=i)}catch(i){}}}async function Ht(){try{let t=await fetch("/cart.js",{headers:{Accept:"application/json"}}).then(e=>e.json());return{value:(Number(t.total_price)||0)/100,itemCount:Number(t.item_count)||0,currency:t.currency||null}}catch(t){return null}}var pn=["[data-cart-drawer-toggle]",'[data-action="open-cart-drawer"]','[data-action="open-cart"]',".js-cart-drawer-open",".js-drawer-open-cart",".cart-drawer-toggle",".js-cart-toggle",'[aria-controls="CartDrawer"]','[aria-controls="cart-drawer"]',"#cart-icon-bubble","#lk-cart-icon",".header__cart",".site-header__cart",".cart-link",".header-cart",'a[href="/cart"]','a[href$="/cart"]'];function mn(t){try{let e=t.getBoundingClientRect();return e.width>0&&e.height>0&&getComputedStyle(t).visibility!=="hidden"}catch(e){return!1}}function hn(){let t=Ge();if(t&&typeof t.open=="function")return setTimeout(()=>{try{t.open()}catch(r){}},200),!0;let e=null;for(let r of pn)try{if(e=[...document.querySelectorAll(r)].find(mn),e)break}catch(n){}return e?(setTimeout(()=>{try{e.click()}catch(r){}},300),!0):!1}var yn="zerezes",gn=!0;function wn(){try{if(!(window.Shopify||window.ShopifyAnalytics))return!1;let t=window.Shopify&&window.Shopify.shop||"";return/(^|\.)zerezes\./i.test(location.hostname)||/cs-zerezes/i.test(t)}catch(t){return!1}}var xn=Kt,bn=Ht;function _n(){let t=[...document.querySelectorAll(".lens-selection__button, [data-has-lens-basket]")];return t.find(e=>{let r=e.getBoundingClientRect();return r.width>0&&r.height>0})||t[0]||null}async function vn(){let t=_n();if(!t)throw new Error("zerezes: bot\xE3o de sele\xE7\xE3o de lentes n\xE3o encontrado");try{window.postMessage({source:"mkfashion-app",action:"close_request"},"*")}catch(e){}return setTimeout(()=>{try{t.click()}catch(e){}},250),{platform:"zerezes",nativeFlow:"lens-selection"}}function Cn(){return!0}var Jt={};v(Jt,{addToCart:()=>An,detect:()=>Sn,getCartSummary:()=>En,id:()=>kn,resolveSku:()=>Tn});var kn="hybris";function Sn(){return!!(window.ACC&&window.ACC.config)}function Tn(){let t=(location.pathname||"").match(/\/p\/([^/?#]+)/);return t&&t[1]?{value:decodeURIComponent(t[1]),source:"hybris/url"}:null}var Xe=t=>String(t==null?"":t).trim().toLowerCase();async function An({size:t,quantity:e}){let r=[...document.querySelectorAll('.js-product-select-size, a[data-code], [class*="select-size"]')].filter(w=>w.getAttribute&&w.getAttribute("data-code")),n=t?r.find(w=>Xe(w.textContent)===Xe(t)):null;n||(n=r.find(w=>w.offsetParent!==null)||r[0]);let o=n&&n.getAttribute("data-code");if(!o)throw new Error("hybris: variante (data-code) n\xE3o encontrada");let i=document.getElementById("product--add-to-cart-form")||document.querySelector('form[action*="/cart/add"]'),a=i&&i.querySelector('[name="CSRFToken"]'),c=a&&a.value,l=i&&i.getAttribute("action")||"/cart/add";if(!c)throw new Error("hybris: CSRFToken n\xE3o encontrado");let s=new URLSearchParams;s.set("productCodePost",o),s.set("qty",String(e||1)),s.set("CSRFToken",c);let u=await fetch(l,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},body:s.toString()});if(!u.ok)throw new Error("hybris: "+l+" HTTP "+u.status);let f=null,d=null;try{let w=await u.clone().json(),h=w&&w.cartData;h&&(f=Wt(h.total!=null?h.total:h.totalPrice),d=h.totalUnitCount!=null?Number(h.totalUnitCount):Array.isArray(h.products)?h.products.length:null)}catch(w){}return{platform:"hybris",productCode:o,size:n.textContent.trim(),cartValue:f,itemCount:d,currency:"BRL"}}function Wt(t){if(t==null||t==="")return null;if(typeof t=="number")return Number.isFinite(t)?t:null;let e=String(t).replace(/[^\d.,]/g,"");if(!e)return null;let r=e.indexOf(",")>e.indexOf(".")?parseFloat(e.replace(/\./g,"").replace(",",".")):parseFloat(e.replace(/,/g,""));return Number.isFinite(r)?r:null}async function En(){try{let t=await fetch("/cart/async?nocache="+Date.now(),{headers:{"X-Requested-With":"XMLHttpRequest"}}).then(a=>a.ok?a.text():"");if(!t)return null;let e=new DOMParser().parseFromString(t,"text/html"),r=e.querySelector(".minicart-total .price")||e.querySelector(".floating-cart--cart-total"),n=r?Wt(r.textContent):null,o=e.querySelector(".mini-badge"),i=o?parseInt(o.textContent,10)||0:null;return n==null&&i==null?null:{value:n,itemCount:i,currency:"BRL"}}catch(t){}try{let t=[".minicart-total .price",".js-cart-total",".cart-total",".total-price",".grand-total"];for(let e of t){let r=document.querySelector(e),n=r&&Wt(r.textContent);if(n)return{value:n,itemCount:null,currency:"BRL"}}}catch(t){}return null}var Xt={};v(Xt,{addToCart:()=>Rn,addToCartBatch:()=>Mn,detect:()=>In,getCartSummary:()=>Pn,id:()=>Ln,resolveSku:()=>Gt});var Ln="vtex";function In(){return!!(window.vtex||window.vtexjs||window.vtxctx||window.skuJson_0||window.__RUNTIME__||window.vtexaf||document.querySelector('link[href*="vtexassets"], script[src*="vtexassets"], link[href*="vteximg"], script[src*="vteximg"], img[src*="vteximg"]'))}function Gt(){let t=window;if(t.vtxctx&&t.vtxctx.skus&&t.vtxctx.skus[0])return{value:String(t.vtxctx.skus[0]),source:"vtex/vtxctx"};if(t.skuJson_0&&t.skuJson_0.skus&&t.skuJson_0.skus[0])return{value:String(t.skuJson_0.skus[0].sku),source:"vtex/skuJson"};try{let e=document.querySelector('meta[property="product:sku"]'),r=e&&(e.getAttribute("content")||"").trim();if(r)return{value:String(r),source:"vtex/og-sku"}}catch(e){}return null}var yt=t=>String(t==null?"":t).trim().toLowerCase();async function Ye(t,e){let r=Array.isArray(t)?t:[t],n=r.map(f=>({id:parseInt(f,10),quantity:e||1,seller:"1"})).filter(f=>Number.isFinite(f.id));if(!n.length)throw new Error("vtex: nenhum skuId v\xE1lido");let o=location.origin,i=await fetch(o+"/api/checkout/pub/orderForm",{headers:{accept:"application/json"},credentials:"include"}).then(f=>f.json()),a=i&&i.orderFormId;if(!a)throw new Error("vtex: orderFormId indispon\xEDvel");let c=await fetch(o+"/api/checkout/pub/orderForm/"+encodeURIComponent(a)+"/items",{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},credentials:"include",body:JSON.stringify({orderItems:n})}).then(f=>f.json()),l=c&&typeof c.value=="number"?c.value/100:null,s=Array.isArray(c&&c.items)?c.items.reduce((f,d)=>f+(Number(d.quantity)||1),0):null,u=c&&c.storePreferencesData&&c.storePreferencesData.currencyCode||"BRL";return{platform:"vtex",skuId:r.map(String).join(","),cartValue:l,itemCount:s,currency:u}}async function Rn(t){t=t||{};let{size:e,sku:r,quantity:n}=t,o=window.skuJson_0&&window.skuJson_0.skus||[];if(o.length&&window.vtexjs&&window.vtexjs.checkout&&window.vtexjs.checkout.addToCart){let c=s=>yt(s.skuname)===yt(e)||s.dimensions&&Object.values(s.dimensions).some(u=>yt(u)===yt(e)),l=e?o.find(s=>c(s)&&s.available)||o.find(c):null;if(l||(l=o.find(s=>s.available)||o[0]),!l)throw new Error("vtex: variante n\xE3o encontrada");return await window.vtexjs.checkout.addToCart([{id:parseInt(l.sku,10),quantity:n||1,seller:"1"}]),{platform:"vtex",skuId:l.sku,size:l.skuname||e}}let i=Gt(),a=r||i&&i.value||null;if(!a)throw new Error("vtex: skuId n\xE3o resolvido (IO)");return Ye(a,n)}async function Mn(t){let e=(t||[]).map(r=>r&&(r.sku||(Gt()||{}).value)).filter(Boolean);if(!e.length)throw new Error("vtex: nenhum skuId pro batch");return window.skuJson_0&&window.vtexjs&&window.vtexjs.checkout&&window.vtexjs.checkout.addToCart?(await window.vtexjs.checkout.addToCart(e.map(r=>({id:parseInt(r,10),quantity:1,seller:"1"}))),{platform:"vtex",count:e.length}):Ye(e,1)}async function Pn(){try{let t=window.vtexjs&&window.vtexjs.checkout&&window.vtexjs.checkout.orderForm;if(t&&typeof t.value=="number"){let e=t.storePreferencesData&&t.storePreferencesData.currencyCode||"BRL",r=(t.items||[]).reduce((n,o)=>n+(Number(o.quantity)||1),0);return{value:t.value/100,itemCount:r,currency:e}}}catch(t){}try{let t=await fetch(location.origin+"/api/checkout/pub/orderForm",{headers:{accept:"application/json"},credentials:"include"}).then(e=>e.json());if(t&&typeof t.value=="number"){let e=(t.items||[]).reduce((r,n)=>r+(Number(n.quantity)||1),0);return{value:t.value/100,itemCount:e,currency:t.storePreferencesData&&t.storePreferencesData.currencyCode||"BRL"}}}catch(t){}return null}var Yt={};v(Yt,{addToCart:()=>qn,detect:()=>On,getCartSummary:()=>Dn,id:()=>jn,openCartDrawer:()=>zn,resolveSku:()=>Nn,skipRedirect:()=>Bn});var jn="nuvemshop",Bn=!0;function On(){return!!(window.LS&&(window.LS.cart||window.LS.addToCart))}function Nn(){try{let t=window.LS,e=t&&t.variants||[],r=document.querySelector('[name="variant_id"]'),n=r&&r.value?e.find(o=>String(o.id)===String(r.value)):null;if(n||(n=e.find(o=>o.available!==!1&&o.sku)||e.find(o=>o.sku)||e[0]),n&&n.sku)return{value:String(n.sku),source:"nuvemshop/variant"};if(t&&t.product&&t.product.sku)return{value:String(t.product.sku),source:"nuvemshop/product"}}catch(t){}return null}var gt=t=>String(t==null?"":t).trim().toLowerCase();async function qn({size:t,quantity:e,productId:r}){if(r&&!document.getElementById("product_form")){let c=String(r).replace(/["\\]/g,""),l=document.querySelector('[data-product-id="'+c+'"]'),s=l&&l.querySelector("form[action]"),u=s&&s.getAttribute("action")||"/comprar/",f=window.LS;if(f&&typeof f.addToCartEnhanced=="function")try{let h=document.createElement("form");h.setAttribute("action",u),h.setAttribute("method","post");let b=document.createElement("input");return b.type="hidden",b.name="add_to_cart",b.value=c,h.appendChild(b),document.body.appendChild(h),f.addToCartEnhanced(h),setTimeout(()=>{try{h.remove()}catch(p){}},3e3),{platform:"nuvemshop",productId:c,via:"gallery-enhanced"}}catch(h){}let d=!1,w=null;try{let b=await(await fetch(u,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},body:"add_to_cart="+encodeURIComponent(c)+"&quantity="+(e||1)})).json().catch(()=>({}));d=!!b.success,w=b.error_code||null}catch(h){}return{platform:"nuvemshop",productId:c,via:"gallery",added:d,reason:w}}let n=document.getElementById("product_form")||document.querySelector('.js-product-form, form[action*="/comprar"]');if(!n)throw new Error("nuvemshop: #product_form n\xE3o encontrado");t&&n.querySelectorAll('select[name^="variation"]').forEach(c=>{let l=[...c.options].find(s=>gt(s.textContent).includes(gt(t))||gt(s.value)===gt(t));l&&(c.value=l.value,c.dispatchEvent(new Event("change",{bubbles:!0})))});let o=n.querySelector('[name="quantity"]');o&&e&&(o.value=String(e)),await new Promise(c=>setTimeout(c,400));let i=n.querySelector(".js-addtocart")||document.querySelector(".js-addtocart");return i?i.click():typeof n.requestSubmit=="function"?n.requestSubmit():n.submit(),await new Promise(c=>setTimeout(c,1200)),{platform:"nuvemshop",variantId:(n.querySelector('[name="variant_id"]')||{}).value||null}}function zn(){try{if([...document.querySelectorAll('#ajax-cart-details, .modal-cart, [class*="cart-modal" i], [class*="modal-cart" i]')].find(o=>{try{return o.getBoundingClientRect().width>0&&getComputedStyle(o).display!=="none"}catch(i){return!1}}))return!0;let r=[...document.querySelectorAll('[data-toggle="#modal-cart"], [data-toggle*="cart" i], #ajax-cart a.js-modal-open, .cart-summary a.js-modal-open, .js-toggle-cart')],n=r.find(o=>{let i=o.getBoundingClientRect();return i.width>0&&i.height>0})||r[0];if(n)return setTimeout(()=>{try{n.click()}catch(o){}},300),!0;if(window.LS&&typeof window.LS.toggleCart=="function")return setTimeout(()=>{try{window.LS.toggleCart()}catch(o){}},300),!0}catch(t){}return!1}function Dn(){try{let t=window.LS,e=t&&t.cart;if(!e)return null;let r=t.currency&&t.currency.code||"BRL",n=Array.isArray(e.items)?e.items.reduce((i,a)=>i+(Number(a.quantity)||1),0):Number(e.items)||0,o=e.subtotal!=null?Number(e.subtotal):null;return{value:o!=null?o/100:null,itemCount:n,currency:r}}catch(t){return null}}var Zt={};v(Zt,{addToCart:()=>Hn,detect:()=>$n,getCartSummary:()=>Vn,id:()=>Un,openCartDrawer:()=>Jn,resolveSku:()=>Kn,skipRedirect:()=>Fn});var Un="wake",Fn=!0;function $n(){return!!(window.StorefrontClient||typeof window.addOrCreateCheckout=="function"||typeof window.addToCartClick=="function")}function Kn(){try{let t=document.querySelector('input[name="product-id"], [data-product-id]'),e=t?t.value||t.getAttribute("data-product-id"):null;if(e)return{value:String(e).trim(),source:"wake/product-id"};let r=(location.pathname||"").match(/-(\d+)\/?(?:[?#]|$)/);if(r)return{value:r[1],source:"wake/url"}}catch(t){}return null}var Ze=t=>String(t==null?"":t).trim().toLowerCase();async function Hn({size:t,quantity:e}){if(t){let i=[...document.querySelectorAll("input[attribute-value]")].find(a=>Ze(a.getAttribute("attribute-value"))===Ze(t));if(i){try{i.checked=!0}catch(a){}try{typeof window.selectAttribute=="function"?window.selectAttribute(i):i.click()}catch(a){}await new Promise(a=>setTimeout(a,600))}}let r=document.querySelector('[name="product-variant-id"]'),n=r&&r.value;if(!n)throw new Error("wake: product-variant-id n\xE3o encontrado");if(typeof window.addOrCreateCheckout!="function")throw new Error("wake: addOrCreateCheckout indispon\xEDvel");if(!await window.addOrCreateCheckout([{productVariantId:Number(n),quantity:e||1,customization:[]}]))throw new Error("wake: addOrCreateCheckout retornou false");return{platform:"wake",productVariantId:n,size:t||null}}function Qe(t){if(t==null)return null;let e=String(t).match(/([\d.]+,\d{2}|\d+(?:\.\d{2})?)/),r=(e?e[1]:String(t)).replace(/[^\d.,]/g,"");if(!r)return null;let n=r.indexOf(",")>r.indexOf(".")?parseFloat(r.replace(/\./g,"").replace(",",".")):parseFloat(r.replace(/,/g,""));return Number.isFinite(n)&&n>0?n:null}async function Vn(){try{let t=()=>{let o=document.querySelector(".mc-subtotal__value")||document.querySelector(".mc-subtotal");return o?Qe(o.textContent):null},e=t();if(e==null&&typeof window.loadMiniCart=="function"){try{window.loadMiniCart()}catch(o){}await new Promise(o=>setTimeout(o,700)),e=t()}e==null&&(e=Wn());let r=document.querySelector('.mc-products__count, [class*="mc-"][class*="count" i], [class*="minicart" i] [class*="count" i]'),n=r&&parseInt(String(r.textContent||"").replace(/\D/g,""),10)||null;if(e!=null)return{value:e,itemCount:n,currency:"BRL"}}catch(t){}return null}function Wn(){try{let t=document.querySelector('[class*="mini-cart" i], .mini-cart')||document;for(let e of t.querySelectorAll("div,span,p,li,strong,b")){if(e.children.length>2)continue;let r=(e.textContent||"").replace(/\s+/g," ").trim();if(!(!/R\$/.test(r)||/frete|faltam|gr[aá]tis|desconto|economi/i.test(r))&&/^(sub)?total\b/i.test(r)){let n=Qe(r);if(n)return n}}}catch(t){}return null}function Jn(){if(typeof window.setCartDivVisibility!="function")return!1;try{typeof window.loadMiniCart=="function"&&window.loadMiniCart()}catch(t){}return setTimeout(()=>{try{let t=document.querySelector('[class*="mini-cart" i], .mini-cart');if(t&&t.getBoundingClientRect().width>0)return;window.setCartDivVisibility()}catch(t){}},350),!0}var ee={};v(ee,{addToCart:()=>Qn,cartUrl:()=>Yn,detect:()=>Zn,getCartSummary:()=>to,id:()=>Gn,openCartDrawer:()=>eo,skipRedirect:()=>Xn});var Qt="/api/v2/front",te={"Content-Type":"application/json",Accept:"application/json","App-Token":"wapstore"},tr=t=>String(t==null?"":t).trim().toLowerCase(),Gn="wapstore",Xn=!0,Yn="/checkout/carrinho";function Zn(){try{if(document.querySelector('script[src*="/tema/"][src*="/dist/assets/"]')||/(?:^|;\s*)produto\/visitado=/.test(document.cookie))return!0}catch(t){}return!1}function er(t){if(!t||typeof t!="object")return null;let e=t.subtotal&&t.subtotal.valor;return e==null?null:{value:e,itemCount:t.quantidadeItens!=null?t.quantidadeItens:null,currency:"BRL"}}async function Qn({size:t,quantity:e}){let r=await fetch(Qt+"/url/product/detail?url="+encodeURIComponent(location.pathname),{headers:te}).then(d=>d.json()),n=(r&&(r.produto||r.data||r)||{}).conteudo||{},o=n.atributos&&n.atributos.simples&&n.atributos.simples.valores||[];if(!o.length)throw new Error("wapstore: sem variante de compra (atributos.simples)");let i=t?o.find(d=>tr(d.label)===tr(t)):null;i=i||o.find(d=>d.selecionado)||o.find(d=>(d.estoque||0)>0)||o[0];let a=i&&i.carrinho;if(!a||!a.itens||!a.itens.length)throw new Error("wapstore: variante sem payload de carrinho");let c=a.itens.map(d=>Object.assign({},d,{quantidade:String(e||d.quantidade||1)})),l=await fetch(Qt+"/checkout/cart",{method:"POST",headers:te,body:JSON.stringify({itens:c,tipo:a.tipo||"produto"})});if(!l.ok)throw new Error("wapstore: add HTTP "+l.status);let s=await l.json().catch(()=>({})),u=er(s),f={platform:"wapstore",idProduto:c[0]&&c[0].idProduto,size:i&&i.label||null};return u&&(f.cartValue=u.value,f.itemCount=u.itemCount,f.currency=u.currency),f}async function to(){try{let t=await fetch(Qt+"/checkout/cart",{headers:te}).then(e=>e.json());return er(t)}catch(t){}return null}function eo(){try{let t=document.querySelector(".common-sheet.side-cart, .side-cart");if(t&&t.getBoundingClientRect().width>0)return!0;let e=document.querySelector('.button-cart, [class*="button-cart"]');if(e)return e.click(),!0}catch(t){}return!1}var re={};v(re,{addToCart:()=>so,detect:()=>io,getCartSummary:()=>uo,id:()=>ro,openCartDrawer:()=>fo,resolveSku:()=>ao,skipRedirect:()=>no});var rr=t=>String(t==null?"":t).trim().toLowerCase(),ro="linx",no=!0;function oo(t){if(t==null)return null;let e=String(t).match(/([\d.]+,\d{2}|\d+(?:\.\d{2})?)/),r=(e?e[1]:String(t)).replace(/[^\d.,]/g,"");if(!r)return null;let n=r.indexOf(",")>r.indexOf(".")?parseFloat(r.replace(/\./g,"").replace(",",".")):parseFloat(r.replace(/,/g,""));return Number.isFinite(n)&&n>0?n:null}function io(){return typeof window.carrinhoLateral=="function"&&typeof window.addToCart=="function"}function ao(){try{let t=(location.pathname.match(/-p(\d+)\/?(?:[?#]|$)/)||[])[1];if(t)return{value:t,source:"linx/url-pid"};let e=(String(document.body.className||"").match(/context-product-(\d+)/)||[])[1];if(e)return{value:e,source:"linx/context"}}catch(t){}return null}function co(){let t=[...document.querySelectorAll('.add-to-cart, [data-action="add-to-cart"]')];return t.find(e=>{let r=e.getBoundingClientRect();return r.width>0&&r.height>0})||t[0]||null}function lo(t){if(t==null||t==="")return!1;let e=rr(t),r=e.replace(/\D/g,""),n=[...document.querySelectorAll('input[type="radio"]')].filter(i=>/aro|tamanho|grade|numera|size|variant/i.test(i.name||i.id||"")),o=n.find(i=>rr(i.value)===e)||(r?n.find(i=>String(i.value).replace(/\D/g,"")===r):null);if(!o)return!1;try{o.checked||(o.checked=!0),(o.labels&&o.labels[0]||null||o).click(),o.dispatchEvent(new Event("change",{bubbles:!0}))}catch(i){}return!0}async function so(t){t=t||{};let e=co();if(!e)throw new Error("linx: bot\xE3o .add-to-cart n\xE3o encontrado");return t.size!=null&&t.size!==""&&(lo(t.size),await new Promise(r=>setTimeout(r,1100))),e.click(),await new Promise(r=>setTimeout(r,1400)),{platform:"linx"}}function uo(){try{let t=document.querySelector("#mini-cart");if(!t)return null;let e=null;for(let n of t.querySelectorAll("div,span,p,li,strong,b,td")){if(n.children.length>2)continue;let o=(n.textContent||"").replace(/\s+/g," ").trim();if(/^(sub)?total\b/i.test(o)&&/R\$/.test(o)&&(e=oo(o),e))break}if(e==null)return null;let r=(t.textContent||"").match(/cont[ée]m\s+(\d+)\s+ite/i);return{value:e,itemCount:r?parseInt(r[1],10):null,currency:"BRL"}}catch(t){}return null}function fo(){try{let e=typeof window.carrinhoLateral=="function"?window.carrinhoLateral():null;if(e&&typeof e.openCart=="function"){try{typeof e.fetchHTML=="function"&&e.fetchHTML()}catch(r){}return setTimeout(()=>{try{e.openCart()}catch(r){}},400),!0}}catch(e){}let t=document.querySelector("#mini-cart");if(t){try{t.classList.add("open")}catch(e){}return!0}return!1}var oe={};v(oe,{addToCart:()=>N,detect:()=>mo,id:()=>po,resolveSku:()=>ne});var po="generic";function mo(){return!0}function ne(){let t=E(["Product"]);if(t[0]){let e=t[0],r=e.sku||e.mpn||e.gtin13||e.productID;if(r)return{value:String(r),source:"jsonld"}}try{let e=document.querySelector('[itemprop="sku"]');if(e){let r=e.getAttribute("content")||(e.textContent||"").trim();if(r)return{value:String(r),source:"microdata"}}}catch(e){}try{let e=window.konfidencyData;if(e&&e.product&&e.product.variants&&e.product.variants[0])return{value:String(e.product.variants[0]),source:"konfidency"}}catch(e){}return null}var ho=/(adicionar\s*(à|a|ao)?\s*(sacola|carrinho|cesta|bolsa))|adicionar ao carrinho|add to (cart|bag)|comprar agora/i,yo=/continuar|como comprar|lista|desejos|favorito/i;async function N(){let t=document.querySelectorAll("button,[role=button],input[type=submit]");for(let e of t){let r=(e.textContent||e.value||"").replace(/\s+/g," ").trim();if(r&&r.length<40&&ho.test(r)&&!yo.test(r))try{return e.click(),{platform:"native-click",clicked:r}}catch(n){}}return{platform:"none",error:"bot\xE3o de carrinho nativo n\xE3o encontrado"}}var nr=[Vt,ht,Jt,Xt,Yt,Zt,ee,re],go=[["woocommerce",()=>!!(window.wc_add_to_cart_params||window.woocommerce_params)],["lojaintegrada",()=>!!window.LojaIntegrada]],ie;function q(){if(ie)return ie;let t=nr.find(e=>{try{return e.detect()}catch(r){return!1}});return t&&(ie=t),t||oe}function or(){let t=nr.find(e=>{try{return e.detect()}catch(r){return!1}});if(t)return t.id;for(let[e,r]of go)try{if(r())return e}catch(n){}return null}function W(){let t=q();if(t.id!=="generic"&&t.resolveSku){try{let e=t.resolveSku();if(e)return e}catch(e){}if(t.id==="vtex"&&window.__RUNTIME__)return{value:null,source:"vtex/pending"}}return ne()}function ir(t){return t=t||{},{size:t.size||t.selectedSize||t.tamanho||t.aro||t.ringSize||null,color:t.color||t.selectedColor||t.colour||t.cor||null,sku:t.sku||t.identifier||t.selectedIdentifier||null,quantity:t.quantity||1,productId:t.productId||null}}async function ar(t){if(t=t||{},Array.isArray(t.items)&&t.items.length)return wo(t.items);let e=ir(t),r=q();try{let n=r.addToCart?await r.addToCart(e):await N(e);return x("cart: adicionado",n),wt(),ae(r,n,e.sku),n}catch(n){x('cart: adapter "'+r.id+'" falhou \u2014 fallback clique nativo',n&&n.message);let o=await N(e);return wt(),ae(r,o,e.sku),o}}async function wo(t){let e=t.map(ir),r=q(),n=null;try{if(r.addToCartBatch)n=await r.addToCartBatch(e);else for(let o of e)try{n=r.addToCart?await r.addToCart(o):await N(o)}catch(i){}}catch(o){x('cart: batch do adapter "'+r.id+'" falhou \u2014 fallback',o&&o.message);for(let i of e)try{n=await N(i)}catch(a){}}return x("cart: "+e.length+" itens adicionados",n),wt(),ae(r,n,null),n}async function ae(t,e,r){try{let n=null;e&&e.cartValue!=null?n={value:e.cartValue,itemCount:e.itemCount!=null?e.itemCount:null,currency:e.currency||null}:t&&t.getCartSummary&&(n=await t.getCartSummary()),n&&n.value!=null&&(n.value>0||(n.itemCount||0)>0)&&m("cart_value",{via:"tryon",value:n.value,itemCount:n.itemCount!=null?n.itemCount:null,currency:n.currency||null,sku:r||null})}catch(n){}}async function ce(){let t=q();if(t&&t.getCartSummary)try{return await t.getCartSummary()}catch(e){}return null}async function cr(t){t=t||{};let e=q(),r={platform:e.id};try{let n=W();r.sku=n&&n.value||null;let o={size:t.size||null,color:t.color||null,sku:r.sku,quantity:t.quantity||1};r.added=e.addToCart?await e.addToCart(o):await N(o),wt();try{await le()}catch(i){}r.cart=await ce(),r.ok=!0}catch(n){r.ok=!1,r.error=n&&n.message||String(n)}return r}function wt(){["cart:refresh","cart:updated","cart:build","ajaxProduct:added","product:added-to-cart"].forEach(t=>{try{document.dispatchEvent(new CustomEvent(t))}catch(e){}})}async function le(t){if(t&&t.drawerHandled)return!1;let e=q(),r=y(),n=null;try{n=await V()}catch(a){}let o=n&&n.template&&n.template.cart||n&&n.cart||{},i=o.afterAdd||o.behavior||r.cartBehavior;if(i||(i=r.cartRedirect===!1?"none":"auto"),i==="none")return!1;if(i==="auto"||i==="drawer"){let a=o.openSelector||r.cartOpenSelector;if(a){let c=document.querySelector(a);if(c)return setTimeout(()=>{try{c.click()}catch(l){}},300),!1}else if(e&&e.openCartDrawer){let c=!1;try{c=e.openCartDrawer()}catch(l){}if(c)return!1}}return!0}function lr(){let t=q();if(t&&t.skipRedirect)return;let e=t&&t.cartUrl||"/cart";setTimeout(()=>{try{window.location.href=e}catch(r){}},250)}var xo=/\/(thank[_-]?you|orders?\/|pedido[_-]?(confirmado|realizado|finalizado|sucesso)|sucesso|order[_-]?confirmation|compra[_-]?(finalizada|concluida)|orderplaced|checkout\/[^?#]*success)/i,bo=/\/(my[_-]?account|minha[_-]?conta|account|conta|customer|cliente|profile|perfil|wishlist|favoritos)(\/|$)/i,_o=/\/checkout/i,vo=/\/(cart|carrinho|sacola|bag|comprar)(\/|$|\?|#)/i,sr=/\/(products?|produtos?|p)(\/|$|\?|#)/i,Co=/\/(collections?|categoria|categorias|c|departamento)\//i,ko=/\/(search|busca|s)(\/|\?)/i;function ur(){try{if(window.__mkPageType)return window.__mkPageType}catch(r){}let t=(location.pathname||"").toLowerCase(),e=bo.test(t);try{let r=E(),n=0,o=!1,i=!1;for(let a of r){let c=Array.isArray(a["@type"])?a["@type"]:[a["@type"]];if((c.includes("Order")||c.includes("Invoice"))&&!e)return"purchase";c.includes("SearchResultsPage")&&(o=!0),(c.includes("CollectionPage")||c.includes("ItemList"))&&(i=!0),c.includes("Product")&&n++}if(o)return"search";if(i)return"category";if(n===1)return"pdp";if(n>1)return sr.test(t)?"pdp":"category"}catch(r){}return t==="/"||t===""||t==="/home"||t==="/index.html"?"home":xo.test(t)&&!e?"purchase":_o.test(t)?"checkout":vo.test(t)?"cart":sr.test(t)?"pdp":Co.test(t)?"category":ko.test(t)?"search":"other"}function dr(t){let e=null;try{let r=new URLSearchParams(location.search),n=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],o={};for(let i of n){let a=r.get(i);a&&(o[i.replace("utm_","")]=a)}Object.keys(o).length&&(e=o)}catch(r){}return{url:location.href,pathname:location.pathname,referrer:document.referrer||null,title:document.title||null,pageType:t,utm:e,userAgent:navigator.userAgent,language:navigator.language,viewport:window.innerWidth+"x"+window.innerHeight,platform:So()}}function So(){return or()}var se={},To=null,nt=0,fr=!1;function pr(t){fr||(fr=!0,mr(t),Ao(),Eo(),Lo(),Io(),Ro(t))}function mr(t){se={};let e=ur(),r=dr(e);if(De(r),m("view",{url:location.href,pathname:location.pathname,referrer:document.referrer||null,title:document.title||null,pageType:e}),typeof t=="function")try{t(e,r)}catch(n){}}function Ao(){if(!document.body)return;let t={A:1,BUTTON:1,INPUT:1,SELECT:1,TEXTAREA:1},e=0;document.body.addEventListener("click",r=>{try{let n=Date.now();if(n-e<100)return;e=n;let o=r.target;for(let c=0;c<5&&o&&o!==document.body&&!(t[o.tagName]||o.getAttribute&&o.getAttribute("role")==="button");c++)o=o.parentElement;if(!o||!t[o.tagName]&&!(o.getAttribute&&o.getAttribute("role")==="button"))return;let i={tag:o.tagName},a=o.tagName==="INPUT"||o.tagName==="TEXTAREA"?o.value:o.textContent;i.text=(a||"").replace(/\s+/g," ").trim().substring(0,100),o.href&&(i.href=String(o.href).substring(0,500)),o.id&&(i.id=o.id),o.className&&typeof o.className=="string"&&(i.classes=o.className.trim().substring(0,200)),m("click",i)}catch(n){}},{capture:!0,passive:!0})}function Eo(){let t=[25,50,75,100],e=null,r=()=>{try{let n=window.scrollY||document.documentElement.scrollTop||0,o=Math.max(document.body&&document.body.scrollHeight||0,document.documentElement&&document.documentElement.scrollHeight||0);if(o<=0)return;let i=Math.min(100,Math.floor((n+window.innerHeight)/o*100));for(let a of t)i>=a&&!se[a]&&(se[a]=!0,m("scroll_depth",{depth:a}))}catch(n){}};r(),window.addEventListener("scroll",()=>{e||(e=setTimeout(()=>{e=null,r()},250))},{passive:!0})}function Lo(){document.body&&document.body.addEventListener("submit",t=>{try{let e=t.target;if(!e||e.tagName!=="FORM"||e.querySelector('input[type="password"], input[name*="card"], input[name*="cpf"]'))return;let r="other",n=(e.className||"").toLowerCase(),o=(e.action||"").toLowerCase();e.querySelector('input[type="search"], input[name="q"], input[name="s"]')?r="search":/newsletter|subscribe|mailchimp/.test(n+o)?r="newsletter":/contact|contato/.test(n+o)&&(r="contact"),m("form_submit",{form_id:e.id||"",form_type:r})}catch(e){}},{capture:!0})}function Io(){let t=y();nt=Date.now(),To=setInterval(()=>{if(document.hidden)return;let e=Date.now(),r=Math.round((e-nt)/1e3);nt=e,r>0&&r<60&&m("engagement",{url:location.pathname,dwellSec:r})},t.engagementIntervalMs),document.addEventListener("visibilitychange",()=>{if(document.hidden){let e=Math.round((Date.now()-nt)/1e3);e>0&&e<600&&m("engagement",{url:location.pathname,dwellSec:e})}nt=Date.now()})}function Ro(t){let e=location.href,r=()=>{location.href!==e&&(e=location.href,mr(t))};try{let n=history.pushState,o=history.replaceState;history.pushState=function(){n.apply(this,arguments),setTimeout(r,0)},history.replaceState=function(){o.apply(this,arguments),setTimeout(r,0)},window.addEventListener("popstate",r),window.addEventListener("hashchange",r)}catch(n){}}function de(){let t=W(),e=E(["Product"]);if(e.length>0){let o=e[0],i=Array.isArray(o.offers)?o.offers[0]:o.offers;return{sku:t?t.value:o.sku||o.mpn||o.gtin13||o.productID||null,skuSource:t?t.source:null,name:typeof o.name=="string"?o.name:null,price:i&&parseFloat(i.price||i.lowPrice)||null||hr(),currency:i?i.priceCurrency:null,brand:o.brand?typeof o.brand=="string"?o.brand:o.brand.name:null,category:o.category||null}}let r=o=>{let i=document.querySelector('meta[property="og:'+o+'"], meta[property="product:'+o+'"]');return i?i.getAttribute("content"):null},n=o=>{let i=document.querySelector('[itemprop="'+o+'"]');return i?i.getAttribute("content")||(i.textContent||"").trim():null};if(t||r("type")==="product"||r("price:amount")||n("name")){let o=n("price")||r("price:amount"),i=o&&parseFloat(String(o).replace(",","."))||null;return{sku:t?t.value:null,skuSource:t?t.source:null,name:n("name")||r("title")||document.title||null,price:(i&&i>0?i:null)||hr(),currency:n("priceCurrency")||r("price:currency")||null,brand:n("brand")||null,category:null}}return null}function hr(){try{let t=window.dataLayer;if(!Array.isArray(t))return null;for(let e=t.length-1;e>=0;e--){let r=t[e];if(!r||typeof r!="object")continue;let n=r.ecommerce||r,o=n&&n.items||null,i=n&&n.detail&&n.detail.products||n&&n.products||r.products||null,a=Array.isArray(o)&&o[0]&&o[0].price||Array.isArray(i)&&i[0]&&i[0].price||null,c=ue(a!=null?String(a):"");if(c)return c}}catch(t){}return null}function L(){try{let t=location.pathname+location.search,e=t.match(/order[_-]?confirmation\/([\w-]+)/i)||t.match(/[?&]order[_-]?id=([\w-]+)/i)||t.match(/\/orders?\/([\w-]{4,})/i)||t.match(/pedido[_-]?(?:confirmado|realizado|finalizado)?\/([\w-]+)/i);return e?e[1]:null}catch(t){return null}}function xt(){let t=E(["Order","Invoice"]);if(t.length>0){let o=t[0],i=o.totalPaymentDue?parseFloat(o.totalPaymentDue.price):parseFloat(o.price||o.total);return{orderId:o.orderNumber||o.confirmationNumber||o.identifier||L(),revenue:Number.isFinite(i)?i:null,currency:o.totalPaymentDue&&o.totalPaymentDue.priceCurrency||o.priceCurrency||null,source:"jsonld"}}try{let o=window.Shopify&&window.Shopify.checkout;if(o&&o.total_price!=null){let i=parseFloat(o.total_price);return{orderId:(o.order_id!=null?String(o.order_id):null)||o.token||L(),revenue:Number.isFinite(i)?i:null,currency:o.currency||null,itemCount:Array.isArray(o.line_items)?o.line_items.length:null,source:"shopify"}}}catch(o){}try{let o=window.LS&&window.LS.order;if(o&&o.total!=null){let i=Number(o.total),a=window.LS.currency&&window.LS.currency.code||"BRL";return{orderId:String(o.number||o.id||L()||""),revenue:Number.isFinite(i)?i/100:null,currency:a,source:"nuvemshop"}}}catch(o){}try{if(Array.isArray(window.dataLayer))for(let o=window.dataLayer.length-1;o>=0;o--){let i=window.dataLayer[o],a=i&&i.ecommerce||i&&i.ecommerce_data&&i.ecommerce_data.ecommerce;if(a&&(i.event==="purchase"||a.purchase||a.transaction_id)){let c=a.purchase&&a.purchase.actionField,l=parseFloat(c&&(c.revenue||c.value)||a.value||a.revenue);return{orderId:c&&(c.id||c.transaction_id)||a.transaction_id||a.transactionId||L(),revenue:Number.isFinite(l)?l:null,currency:a.currency||a.currencyCode||c&&c.currency||null,itemCount:(a.purchase&&a.purchase.products||a.items||a.products||[]).length||null,source:"datalayer"}}}}catch(o){}let e=document.querySelector('meta[property="order:total"], meta[name="order-total"]');if(e&&e.content)return{orderId:L(),revenue:parseFloat(e.content)||null,source:"meta"};let r=Mo();if(r)return r;let n=L();return n?{orderId:n,revenue:null,source:"url"}:null}function Mo(){try{let t=document.querySelector(".orderTotalPrice");if(t){let r=String(t.value||t.getAttribute("value")||t.textContent||"").trim(),n=r.split(/\s+/),o=ue(n.length>1?n[n.length-1]:r);if(o)return{orderId:yr(),revenue:o,currency:(n.length>1?n[0]:null)||null,source:"dom"}}let e=[".order-total","#order-total",".total-price",".order__total","[data-order-total]",".summary-total",".grand-total"];for(let r of e){let n=document.querySelector(r);if(n){let o=ue(n.value||n.textContent);if(o)return{orderId:yr(),revenue:o,source:"dom"}}}return null}catch(t){return null}}function yr(){try{let t=document.querySelector(".orderID");if(t&&(t.value||t.getAttribute("value")))return t.value||t.getAttribute("value");let r=(document.body.innerText||"").match(/(?:pedido|order|n[º°o]\.?)\s*#?\s*([A-Z0-9-]{4,})/i);return r?r[1]:null}catch(t){return null}}function ue(t){if(!t)return null;let e=String(t).replace(/[^\d.,]/g,"");if(!e)return null;let r;e.indexOf(",")>e.indexOf(".")?r=e.replace(/\./g,"").replace(",","."):r=e.replace(/,/g,"");let n=parseFloat(r);return Number.isFinite(n)&&n>0?n:null}function gr(){let t=E(["ItemList","CollectionPage"]);if(t.length===0)return null;let e=t[0],r=e.itemListElement||e.mainEntity&&e.mainEntity.itemListElement||[],n=[];for(let o of r.slice(0,50)){let i=o.item||o;i&&(i.sku||i.productID||i.name)&&n.push(i.sku||i.productID||i.name)}return n.length>0?{count:n.length,skus:n.slice(0,20)}:null}var _t=!1,bt=[/\b(adicionar|adic\.?|colocar|incluir|jogar)\b.{0,30}\b(carrinho|sacola|sacolinha|bag)\b/i,/\bcomprar\b(?!\s+(em|por|sem))/i,/\bcomprar\s*$/i,/^add\s+to\s+(cart|bag)\b/i,/^buy\s+(now|it|this)\b/i,/^(sacolinha|carrinho|sacola)$/i],Po=[/^finalizar(\s+(compra|pedido|pagamento))?\b/i,/^(fechar|confirmar)\s+(compra|pedido|pagamento)\b/i,/^pagar(\s+(agora|pedido))?\b/i,/^(complete|place)\s+(purchase|order)\b/i,/^checkout$/i];function ot(t,e){for(let r=0;r<t.length;r++)if(t[r].test(e))return!0;return!1}function _r(t){switch(t){case"pdp":{let e=de();m("view_item",e||{sku:null});break}case"category":case"search":{let e=gr();m("view_item_list",e||{count:0});break}case"cart":ce().then(e=>m("view_cart",e&&e.value!=null?{value:e.value,itemCount:e.itemCount,currency:e.currency}:{})).catch(()=>m("view_cart",{}));break;case"checkout":m("begin_checkout",{});break;case"purchase":jo();break}}var wr=500,xr=30;function jo(){let t=!1,e=0,r=(o,i)=>{t||(t=!0,vr(o,i))};try{window.addEventListener("pagehide",()=>r(xt(),!0),{once:!0})}catch(o){}let n=()=>{if(t)return;let o=xt();if(o&&o.revenue!=null)return r(o);if(e++>=xr)return x("purchase: receita n\xE3o apareceu em "+wr*xr+"ms \u2014 emitindo sem valor"),r(o);setTimeout(n,wr)};n()}function vr(t,e){if(!_t){if(t&&!t.orderId&&(t.orderId=L()),t&&t.orderId){let r="_mk_purch_"+t.orderId;try{if(sessionStorage.getItem(r)){x("purchase j\xE1 contado",t.orderId);return}sessionStorage.setItem(r,"1")}catch(n){}}if(_t=!0,m("purchase",t||{revenue:null,_note:"no_order_data_extracted"}),x("purchase emitido",t),e)try{B(!0)}catch(r){}}}var br=!1;function Cr(){if(br)return;br=!0;let t=r=>{try{if(!r||typeof r!="object")return!1;let n=r.ecommerce||r.ecommerce_data&&r.ecommerce_data.ecommerce;return n?r.event==="purchase"||r.event==="transaction"||!!n.purchase||n.transaction_id!=null:!1}catch(n){return!1}},e=r=>{_t||!t(r)||setTimeout(()=>{if(!_t)try{vr(xt(),!0)}catch(n){}},0)};try{let r=window.dataLayer=window.dataLayer||[];for(let o=0;o<r.length;o++)e(r[o]);let n=r.push;r.push=function(){let o=n.apply(this,arguments);try{for(let i=0;i<arguments.length;i++)e(arguments[i])}catch(i){}return o}}catch(r){}}function kr(){if(!document.body)return;let t=0;document.body.addEventListener("click",e=>{try{let r=Date.now();if(r-t<150)return;let n=e.target;for(let c=0;c<5&&n&&n!==document.body&&!(n.tagName==="BUTTON"||n.tagName==="A"||n.getAttribute&&n.getAttribute("role")==="button");c++)n=n.parentElement;if(!n)return;let o=n.tagName!=="A",i=(n.textContent||"").replace(/\s+/g," ").trim();if(!i||i.length>80)return;let a=!1;if((ot([bt[0]],i)||o&&ot([bt[1]],i)||o&&ot([bt[2]],i)||ot(bt.slice(3),i))&&(a=!0),a){t=r;let c=de();m("add_to_cart",{via:"click",buttonText:i,sku:c?c.sku:null,price:c?c.price:null});return}o&&ot(Po,i)&&(t=r,m("begin_checkout",{via:"click",buttonText:i}))}catch(r){}},{capture:!0,passive:!0})}var vt={};v(vt,{available:()=>qo,id:()=>Bo,iframeSrc:()=>No,modalSize:()=>Oo,onMounted:()=>zo});var Bo="mk-fashion",Oo={width:430,height:800};function No(t,e){let r=encodeURIComponent(e).replace(/\./g,"%2E");return y().appUrl+"/"+t+"/"+r}async function qo(t,e){let r=y().apiUrl+"/availability/"+t+"?sku="+encodeURIComponent(e),n=await fetch(r);if(!n.ok)throw new Error("availability HTTP "+n.status);return n.json()}function zo(){}var fe={};v(fe,{available:()=>Vo,closeButton:()=>$o,id:()=>Do,iframeSrc:()=>Ho,modalSize:()=>Uo,modalSizeMobile:()=>Fo,onMounted:()=>Go});var Do="mk-makeup",Uo={width:"80vw",height:"80vh"},Fo={width:"100vw",height:"100dvh"},$o=!0;function Ko(){return window.__MK&&window.__MK.pulpoarUrl||"https://plugin.pulpoar.com/vto"}function Ho(t,e){let r=window.__MK&&window.__MK.pulpoarIframeUrl;if(r){let o=String(r);return e!=null&&/\{sku\}|\{identifier\}/.test(o)&&(o=o.replace(/\{sku\}|\{identifier\}/g,encodeURIComponent(e))),o}let n=window.__MK&&window.__MK.pulpoarProjectKey||t;return Ko()+"/"+encodeURIComponent(n)}async function Vo(t,e){let r=window.__MK&&window.__MK.pulpoarProjectKey||t;if(!r)return{available:!0};let n=await Tr(e)||e;if(!n)return{available:!0};try{let i=String(y().collectorUrl||"").replace(/\/+$/,"")+"/v1/makeup/availability/"+encodeURIComponent(r)+"?slug="+encodeURIComponent(n);t&&(i+="&projectId="+encodeURIComponent(t));let a=await fetch(i).then(c=>c.json());return x("pulpoar availability",a),{available:!(a&&(a.available===!1||a.projectActive===!1))}}catch(o){return x("pulpoar availability erro",o&&o.message),{available:!0}}}var Wo="https://cdn.jsdelivr.net/npm/@pulpoar/plugin-sdk@latest/dist/index.iife.js",Ct=null;function Jo(){return window.pulpoar?Promise.resolve(window.pulpoar):Ct||(Ct=new Promise(t=>{try{let e=document.createElement("script");e.src=Wo,e.async=!0,e.onload=()=>t(window.pulpoar||null),e.onerror=()=>t(null),(document.head||document.documentElement).appendChild(e)}catch(e){t(null)}}),Ct)}async function Tr(t){try{if(window.Shopify||window.ShopifyAnalytics){let e=(location.pathname.split("/products/")[1]||"").split(/[?#]/)[0];if(e){let r=window.ShopifyAnalytics&&window.ShopifyAnalytics.meta,n=new URLSearchParams(location.search).get("variant")||r&&r.selectedVariantId,i=(await fetch("/products/"+e+".js").then(l=>l.json())).variants||[],a=n?i.find(l=>String(l.id)===String(n)):null;if(a&&a.sku)return a.sku;let c=i.find(l=>l.available)||i[0];if(c&&c.sku)return c.sku}}}catch(e){}return t||null}function Sr(t){return!t||typeof t!="object"?{quantity:1}:{sku:t.sku||t.slug||t.key||t.variant_key||t.barcode||null,color:t.color||t.shade||t.colorName||null,size:t.size||null,quantity:1}}function Go(t,e){Jo().then(async r=>{if(!r){x("pulpoar: SDK n\xE3o carregou");return}let n=await Tr(e.identifier);if(x("pulpoar variante p/ cat\xE1logo",n),n)try{r.applyVariantsWithCatalog([String(n)],o=>{e.track("product_loaded",{via:"makeup",applied:Array.isArray(o)?o.length:0})})}catch(o){x("pulpoar applyVariantsWithCatalog falhou",o&&o.message)}try{r.onReady(()=>e.fire("onReady",{}))}catch(o){}try{r.onAddToCart(o=>{let i=(Array.isArray(o)?o:[o]).filter(a=>a&&typeof a=="object");if(x("pulpoar onAddToCart",i.length+" item(s)",i),i.length<=1){e.handleAddToCart(i.length?Sr(i[0]):{quantity:1},"makeup");return}e.handleAddToCart({items:i.map(Sr)},"makeup")})}catch(o){}try{r.onGoToProduct(o=>e.fire("onGoToProduct",o))}catch(o){}})}var Xo={"mk-fashion":vt,"mk-makeup":fe};function kt(t){return Xo[t]||vt}var T=null,S=null,Tt=!1,At=!1,R=null,Ar={},pe=null,St=0,k={onReady:null,onClose:null,onAddToCart:null,onProductLoaded:null,onError:null,onInteraction:null,onGenerationComplete:null},Yo={gregory:"698c7e791d3129430f15dddd"};function Lr(t){return t?Yo[String(t).toLowerCase()]||t:null}async function z(t,e){let r=Lr(t),n=String(e||"").trim();return kt(y().product).available(r,n)}async function Ir(t,e){e||(e=t,t="698c7e791d3129430f15dddd");try{return(await z(t,e)).available===!0}catch(r){return!1}}async function it(t){if(t=t||{},Tt)return;let e=Lr(t.projectId||t.projectid||t.store),r=String(t.identifier||t.sku||"").trim();if(!e||!r){console.error("[mk-sdk] open: projectId e identifier obrigatorios");return}let n=e+":"+r;if(Ar[n]!==!0){try{if(!(await z(e,r)).available){alert("Produto nao disponivel para prova virtual.");return}}catch(l){alert("Produto nao encontrado ou indisponivel.");return}Ar[n]=!0}let o=kt(y().product),a=(window.innerWidth||0)<=768&&o.modalSizeMobile||o.modalSize||{width:430,height:800},c=y();R={projectId:e,identifier:r,width:t.width||c.modalWidth||a.width,height:t.height||c.modalHeight||a.height},At=!1,Pr(),Zo(R),Tt=!0,St=Date.now(),m("modal_opened",{projectId:e,identifier:r})}function Et(){if(!Tt)return;let t=At;if(At=!1,Qo(),Tt=!1,I("onClose"),m("modal_closed",{projectId:R&&R.projectId,identifier:R&&R.identifier}),t)try{lr()}catch(e){}}function Rr(t){try{Fr().forEach(e=>{t?(e.dataset.mkPrevDisplay===void 0&&(e.dataset.mkPrevDisplay=e.style.display),e.style.display="none"):(e.style.display=e.dataset.mkPrevDisplay||"",delete e.dataset.mkPrevDisplay)})}catch(e){}}function Zo(t){T=document.createElement("div"),T.style.cssText="position:fixed;inset:0;background:rgba(0,0,0,.8);display:flex;align-items:center;justify-content:center;z-index:2147483647;",Rr(!0);let e=document.createElement("div"),r=typeof t.width=="number"?t.width+"px":t.width,n=typeof t.height=="number"?t.height+"px":t.height,o=String(t.width).indexOf("100v")>=0;e.style.cssText="position:relative;width:"+r+";height:"+n+";max-width:100vw;max-height:100dvh;border-radius:"+(o?"0":"12px")+";overflow:hidden;background:#fff;",S=document.createElement("iframe");let i=kt(y().product);if(S.src=i.iframeSrc(t.projectId,t.identifier),S.style.cssText="width:100%;height:100%;border:none;",S.setAttribute("allow","camera *; microphone *"),S.setAttribute("allowfullscreen","true"),e.appendChild(S),i.closeButton){let a=document.createElement("button");a.setAttribute("aria-label","Fechar"),a.setAttribute("type","button"),a.innerHTML='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true"><path d="M1.6 1.6l10.8 10.8M12.4 1.6L1.6 12.4" stroke="#111" stroke-width="2" stroke-linecap="round"/></svg>',a.style.cssText="position:absolute;top:8px;right:8px;z-index:2;width:32px;height:32px;padding:0;border:none;border-radius:50%;background:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 1px 5px rgba(0,0,0,.3);",a.addEventListener("click",()=>{try{Et()}catch(c){}}),e.appendChild(a)}T.appendChild(e),document.body.appendChild(T);try{i.onMounted(S,{projectId:t.projectId,identifier:t.identifier,handleAddToCart:jr,track:m,fire:I})}catch(a){x("launcher.onMounted falhou",a&&a.message)}x("try-on modal aberto",S.src)}function Qo(){T&&T.parentNode&&T.parentNode.removeChild(T),T=null,S=null,Rr(!1)}var Er=!1;function Mr(){Pr()}function Pr(){Er||(Er=!0,window.addEventListener("message",t=>{let e=t.data;if(!e||e.source!=="mkfashion-app")return;let r=e.action,n=e.data||{};switch(r){case"close_request":Et();break;case"ready":I("onReady",n);break;case"product_loaded":I("onProductLoaded",n),m("product_loaded",me(n));break;case"interaction":{I("onInteraction",n),n&&n.method&&(pe=n.method),m(ti(n),me(n));break}case"add_to_cart":jr(n,"tryon");break;case"generation_start":St=Date.now();break;case"generation_complete":I("onGenerationComplete",n),m("generation_complete",{method:n.method||pe||"unknown",durationMs:St?Date.now()-St:null,success:n.success!==!1,imageUrlPresent:!!n.imageUrl});break;case"generation_error":I("onError",n),m("generation_error",{method:pe||"unknown",error:n&&n.error});break}}))}function jr(t,e){if(m("add_to_cart",Object.assign({via:e||"tryon"},me(t))),typeof k.onAddToCart=="function"){I("onAddToCart",t);return}let r=Object.assign({productId:R&&R.identifier},t);ar(r).then(n=>le(n)).then(n=>{At=!!n}).catch(()=>{})}function ti(t){return t&&t.action,"interaction"}function me(t){if(!t||typeof t!="object")return t;let e={};for(let r in t){if(r==="imageUrl"||r==="image"||r==="product"){r==="product"&&t[r]?(e.productSku=t[r].sku||null,e.productName=t[r].name||null):e[r+"Present"]=!!t[r];continue}e[r]=t[r]}return e}function I(t,e){if(typeof k[t]=="function")try{k[t](e)}catch(r){console.error("[mk-sdk]",r)}}function Br(t){k.onReady=t}function Or(t){k.onClose=t}function Nr(t){k.onAddToCart=t}function qr(t){k.onProductLoaded=t}function zr(t){k.onError=t}function Dr(t){k.onInteraction=t}function Ur(t){k.onGenerationComplete=t}var ri=767,ni=1024,oi=/(adicionar\s*(à|a|ao)?\s*(sacola|carrinho|cesta|bolsa))|adicionar ao carrinho|add to (cart|bag)|comprar agora|^comprar$|finalizar compra|eu quero/i,ii=/continuar|como comprar|lista|desejos|favorito|looks|cupom/i;function he(t){try{let e=t.getBoundingClientRect();if(e.width<=0||e.height<=0)return!1;let r=getComputedStyle(t);return r.display!=="none"&&r.visibility!=="hidden"&&r.opacity!=="0"}catch(e){return!1}}function ai(t){if(!t)return!1;try{let e=document.querySelector(t);return!!e&&he(e)}catch(e){return!1}}function ci(t){return(t.tagName==="INPUT"?t.value||"":t.textContent||"").replace(/\s+/g," ").trim()}function li(t){if(!t||typeof t!="object"||t.selector)return t;let e=!1;if(["mobile","tablet","desktop"].forEach(n=>{let o=t[n];o&&o.mkAnchor===1&&o.anchor&&typeof o.anchor=="object"&&(e=!0)}),!e)return t;let r={};return["mobile","tablet","desktop"].forEach(n=>{let o=t[n];if(o){if(o.selector){r[n]=o;return}if(o.mkAnchor===1&&o.anchor&&typeof o.anchor=="object"){let i=o.anchor[n]||o.anchor.desktop||o.anchor.mobile||o.anchor.tablet;i&&i.selector&&(r[n]=i)}}}),["bpMobile","bpTablet","breakpoint"].forEach(n=>{t[n]!=null&&(r[n]=t[n])}),r}function at(t){if(!t||typeof t!="object")return null;if(t=li(t),t.selector)return t;let e=[["mobile",t.mobile],["tablet",t.tablet],["desktop",t.desktop]].filter(l=>l[1]&&l[1].selector);if(e.length===0)return null;if(e.length===1)return e[0][1];let r=e.filter(([,l])=>ai(l.selector));if(r.length===1)return r[0][1];let n=window.innerWidth||1024,o=Number(t.bpMobile)||Number(t.breakpoint)||ri,i=Number(t.bpTablet)||ni,a=l=>(e.find(s=>s[0]===l)||[])[1],c=n<=o?["mobile","tablet","desktop"]:n<=i?["tablet","desktop","mobile"]:["desktop","tablet","mobile"];for(let l of c){let s=a(l);if(s)return s}return e[0][1]}function Lt(t){let e=at(t);if(e&&e.selector)try{let r=document.querySelector(e.selector);if(r&&he(r))return{el:r,position:e.position||"afterend",mode:e.mode||"flow",style:e.style||"",align:e.align||"top-left",selector:e.selector}}catch(r){}return null}function $r(){let t=y(),e=Lt(t&&t.anchor);if(e)return e;let r=document.querySelectorAll('button, [role="button"], a.btn, a.button, input[type="submit"], input[type="button"]');for(let n of r){let o=ci(n);if(!(!o||o.length>40)&&!ii.test(o)&&oi.test(o)&&he(n))return{el:n,position:"afterend",mode:"flow",style:"",selector:null}}return null}var _="'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",ye={none:"0",sm:"4px",md:"8px",pill:"9999px"},ge={none:"0",sm:"4px",md:"8px",lg:"16px"},si='<svg viewBox="0 0 17.5263 20.6862" fill="none" xmlns="http://www.w3.org/2000/svg" style="display:block;width:100%;height:100%"><g><path d="M8.49995 12.1862C10.1568 12.1862 11.5 10.8431 11.5 9.18622C11.5 7.52936 10.1568 6.18622 8.49995 6.18622C6.8431 6.18622 5.49995 7.52936 5.49995 9.18622C5.49995 10.8431 6.8431 12.1862 8.49995 12.1862Z" stroke="currentColor" shape-rendering="crispEdges"/><path d="M0.5 9.11152C0.5 6.56953 0.5 5.29894 1.1099 4.38664C1.375 3.9902 1.71424 3.65088 2.10821 3.38809C2.6945 2.9958 3.42899 2.85564 4.55351 2.80588C5.09013 2.80588 5.55183 2.39949 5.65687 1.87284C5.73715 1.48708 5.94572 1.14138 6.24735 0.894155C6.54898 0.646934 6.92516 0.51336 7.31231 0.516006H9.9734C10.7779 0.516006 11.4709 1.08412 11.6288 1.87284C11.7339 2.39949 12.1956 2.80588 12.7322 2.80588C13.8559 2.85564 12.9129 4.67413 13.5 5.06559C13.8949 5.32932 15.1484 3.80355 15.5 4.02647C16.1099 4.93876 16.7857 6.56953 16.7857 9.11152C16.7857 11.6535 16.7857 12.9233 16.1758 13.8364C15.9107 14.2328 15.5715 14.5722 15.1775 14.835C14.2647 15.4445 12.9936 15.4445 10.4522 15.4445H6.83351C4.29213 15.4445 3.02103 15.4445 2.10821 14.835C1.71446 14.5718 1.3755 14.2322 1.11071 13.8356C0.933802 13.5672 0.803519 13.2698 0.725557 12.9564" stroke="currentColor" stroke-linecap="round"/><path d="M12.676 0.607931C12.9446 -0.178095 14.0307 -0.2019 14.3491 0.536515L14.3761 0.60838L14.7385 1.66839C14.8216 1.91149 14.9559 2.13395 15.1322 2.32076C15.3086 2.50757 15.5229 2.65439 15.7608 2.75131L15.8583 2.78769L16.9183 3.14971C17.7044 3.41831 17.7282 4.50437 16.9902 4.82283L16.9183 4.84978L15.8583 5.21225C15.6151 5.29526 15.3926 5.42947 15.2057 5.60582C15.0188 5.78218 14.8719 5.99657 14.7749 6.23453L14.7385 6.33155L14.3765 7.39201C14.1079 8.17803 13.0219 8.20184 12.7039 7.46387L12.676 7.39201L12.314 6.332C12.231 6.08881 12.0968 5.86627 11.9204 5.67938C11.744 5.49249 11.5297 5.3456 11.2917 5.24863L11.1947 5.21225L10.1347 4.85022C9.34817 4.58163 9.32437 3.49557 10.0628 3.17756L10.1347 3.14971L11.1947 2.78769C11.4378 2.70462 11.6602 2.57039 11.847 2.39404C12.0339 2.21769 12.1807 2.00333 12.2776 1.76541L12.314 1.66839L12.676 0.607931Z" fill="currentColor"/></g></svg>',Hr='<svg viewBox="0 0 11.6122 12.7248" fill="none" xmlns="http://www.w3.org/2000/svg" style="display:block;width:12px;height:12px"><path d="M4.09055 2.01133C4.43939 0.9905 5.84989 0.959583 6.26347 1.91858L6.29847 2.01192L6.76922 3.38858C6.8771 3.7043 7.05144 3.99321 7.28047 4.23583C7.5095 4.47845 7.7879 4.66912 8.09689 4.795L8.22347 4.84225L9.60014 5.31242C10.621 5.66125 10.6519 7.07175 9.69347 7.48533L9.60014 7.52033L8.22347 7.99108C7.90764 8.09889 7.61862 8.2732 7.3759 8.50223C7.13318 8.73127 6.94241 9.0097 6.81647 9.31875L6.76922 9.44475L6.29905 10.822C5.95022 11.8428 4.53972 11.8737 4.12672 10.9153L4.09055 10.822L3.62039 9.44533C3.51258 9.12951 3.33827 8.84048 3.10924 8.59776C2.8802 8.35504 2.60177 8.16427 2.29272 8.03833L2.16672 7.99108L0.790054 7.52092C-0.231363 7.17208 -0.26228 5.76158 0.69672 5.34858L0.790054 5.31242L2.16672 4.84225C2.48244 4.73437 2.77135 4.56003 3.01397 4.331C3.25658 4.10197 3.44726 3.82357 3.57314 3.51458L3.62039 3.38858L4.09055 2.01133ZM9.86147 0C9.9706 0 10.0775 0.0306123 10.1701 0.0883584C10.2627 0.146104 10.3373 0.228668 10.3853 0.326667L10.4133 0.394917L10.6175 0.993417L11.2166 1.19758C11.3259 1.23474 11.4218 1.30353 11.492 1.39523C11.5623 1.48693 11.6037 1.59741 11.611 1.71268C11.6184 1.82795 11.5914 1.94281 11.5334 2.04271C11.4755 2.14261 11.3891 2.22305 11.2854 2.27383L11.2166 2.30183L10.6181 2.506L10.4139 3.10508C10.3767 3.21442 10.3078 3.31024 10.2161 3.38041C10.1244 3.45058 10.0139 3.49194 9.89859 3.49925C9.78333 3.50656 9.66849 3.47949 9.56863 3.42147C9.46876 3.36345 9.38837 3.27709 9.33764 3.17333L9.30964 3.10508L9.10547 2.50658L8.50639 2.30242C8.39702 2.26526 8.30115 2.19647 8.23092 2.10477C8.16069 2.01307 8.11926 1.90259 8.11189 1.78732C8.10452 1.67205 8.13153 1.55719 8.18951 1.45729C8.24749 1.35739 8.33381 1.27695 8.43755 1.22617L8.50639 1.19817L9.10489 0.994L9.30905 0.394917C9.34839 0.279665 9.42281 0.179613 9.52187 0.108791C9.62094 0.0379686 9.73969 -0.0000730808 9.86147 0Z" fill="currentColor"/></svg>';function g(t,e={}){let r=document.createElement(t);if(e.style&&(r.style.cssText=e.style),e.text!=null&&(r.textContent=e.text),e.html!=null&&(r.innerHTML=e.html),e.attrs)for(let n in e.attrs)r.setAttribute(n,e.attrs[n]);if(e.on)for(let n in e.on)r.addEventListener(n,e.on[n]);if(e.children)for(let n of e.children)n&&r.appendChild(n);return r}function Vr(t){return g("span",{style:`width:12px;height:12px;display:inline-flex;align-items:center;justify-content:center;color:${t};flex-shrink:0;`,html:Hr})}var It=t=>'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" style="display:block;width:100%;height:100%">'+t+"</svg>",Kr={camera:si,sparkle:Hr.replace("width:12px;height:12px","width:100%;height:100%"),shirt:It('<path d="M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z"/>'),face:It('<path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><path d="M9 9h.01"/><path d="M15 9h.01"/>'),glasses:It('<circle cx="6" cy="15" r="4"/><circle cx="18" cy="15" r="4"/><path d="M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2"/><path d="M2.5 13 5 7c.7-1.3 1.4-2 3-2"/><path d="M21.5 13 19 7c-.7-1.3-1.5-2-3-2"/>'),wand:It('<path d="m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72"/><path d="m14 7 3 3"/><path d="M5 6v4"/><path d="M19 14v4"/><path d="M10 2v2"/><path d="M7 8H3"/><path d="M21 16h-4"/><path d="M11 3H9"/>')};function M(t,e,r){let n=Number(r)>0?Number(r):24;return g("span",{style:`width:${n}px;height:${n}px;padding:2px;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;color:${e};flex-shrink:0;`,html:Kr[t]||Kr.camera})}function J(t){return t.borderWidth>0&&t.borderColor?`${t.borderWidth}px solid ${t.borderColor}`:"none"}function G(){if(!document.getElementById("mk-jakarta-font"))try{document.head.appendChild(g("link",{attrs:{id:"mk-jakarta-font",rel:"stylesheet",href:"https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;700&display=swap"}}))}catch(t){}}function ui(t){return t.subtext?g("span",{style:`display:flex;align-items:center;justify-content:center;padding:4px;background:${t.badgeBgColor};font-family:${_};font-weight:700;font-size:16px;text-transform:uppercase;color:${t.badgeTextColor};line-height:1;white-space:nowrap;`,text:t.subtext}):null}function Wr(t,e){G();let r=g("span",{style:"display:inline-flex;align-items:center;gap:4px;",children:[M(t.icon,t.textColor,t.iconSize),g("span",{text:t.text,style:`font-family:${_};font-weight:700;font-size:inherit;text-transform:uppercase;letter-spacing:2px;color:${t.textColor};white-space:nowrap;text-align:center;line-height:1;`})]});return g("button",{attrs:{type:"button"},style:`display:flex;align-items:center;justify-content:center;gap:8px;padding:8px;width:100%;max-width:238px;box-sizing:border-box;background:${t.bgColor};border:${J(t)};border-radius:${t.borderRadiusPx};font-family:${_};font-size:${t.fontSize}px;cursor:pointer;transition:opacity 0.2s ease;line-height:1;-webkit-appearance:none;appearance:none;`,children:[r,ui(t)],on:{mouseenter:n=>{n.currentTarget.style.opacity="0.85"},mouseleave:n=>{n.currentTarget.style.opacity="1"},click:n=>{try{n.preventDefault(),n.stopPropagation()}catch(o){}try{e&&e()}catch(o){}}}})}function fi(t){return t.subtext?g("span",{style:`display:flex;align-items:center;gap:4px;padding:4px;background:${t.badgeBgColor};font-family:${_};font-weight:600;font-size:10px;text-transform:uppercase;color:${t.badgeTextColor};line-height:1;white-space:nowrap;`,children:[Vr(t.badgeTextColor),g("span",{text:t.subtext})]}):null}function pi(t,e){return g("button",{attrs:{type:"button"},style:`display:flex;align-items:center;justify-content:center;gap:8px;padding:8px 12px 8px 8px;width:100%;margin-top:auto;box-sizing:border-box;background:${t.bgColor};border:${J(t)};border-radius:${t.borderRadiusPx};filter:drop-shadow(0 0 6px rgba(0,0,0,0.08));font-family:${_};cursor:pointer;transition:opacity 0.2s ease;line-height:1;-webkit-appearance:none;appearance:none;`,children:[M(t.icon,t.textColor,t.iconSize),g("span",{text:t.text,style:`font-family:${_};font-weight:700;font-size:inherit;color:${t.textColor};white-space:nowrap;line-height:1;`})],on:{mouseenter:r=>{r.currentTarget.style.opacity="0.85"},mouseleave:r=>{r.currentTarget.style.opacity="1"},click:r=>{try{r.preventDefault(),r.stopPropagation()}catch(n){}try{e&&e()}catch(n){}}}})}function Jr(t,e){G();let r=g("div",{style:"display:flex;flex-direction:column;gap:4px;",children:[t.cardTitle&&g("p",{text:t.cardTitle,style:`margin:0;font-family:${_};font-weight:700;font-size:16px;letter-spacing:1px;text-transform:uppercase;color:${t.cardTitleColor};line-height:1.2;`}),t.cardDescription&&g("p",{html:t.cardDescription,style:`margin:0;font-family:${_};font-weight:400;font-size:12px;max-width:177px;line-height:1.2;color:${t.cardTextColor};`})]}),n=g("div",{style:"display:flex;flex-direction:column;justify-content:space-between;gap:16px;flex:1 1 0;min-width:0;",children:[r,t.cardFooter&&g("p",{text:t.cardFooter,style:`margin:0;font-family:${_};font-weight:400;font-size:10px;color:${t.cardTextColor};line-height:1.2;`})]}),o=g("div",{style:"display:flex;flex-direction:column;align-items:flex-end;flex:1 1 0;min-width:0;",children:[fi(t),pi(t,e)]}),i=g("div",{style:"display:flex;gap:16px;align-items:stretch;width:100%;flex:1;box-sizing:border-box;",children:[n,o]});return g("div",{style:`display:flex;flex-direction:column;align-items:flex-start;padding:12px;width:100%;max-width:402px;min-height:140px;box-sizing:border-box;background:${t.cardBgColor};border-radius:${t.cardBorderRadiusPx};font-family:${_};font-size:${t.fontSize}px;`,children:[i]})}function Gr(t,e){let r=Number(t.iconSize)>0?Number(t.iconSize):24;return g("button",{attrs:{type:"button","aria-label":t.text||"Provar virtualmente"},style:`display:inline-flex;align-items:center;justify-content:center;padding:8px;box-sizing:border-box;background:${t.bgColor};border:${J(t)};border-radius:${t.borderRadiusPx};cursor:pointer;transition:opacity 0.2s ease;line-height:1;-webkit-appearance:none;appearance:none;`,children:[M(t.icon,t.textColor,r)],on:{mouseenter:n=>{n.currentTarget.style.opacity="0.85"},mouseleave:n=>{n.currentTarget.style.opacity="1"},click:n=>{try{n.preventDefault(),n.stopPropagation()}catch(o){}try{e&&e()}catch(o){}}}})}function Xr(t,e){G();let r=g("div",{style:"display:flex;flex-direction:column;gap:8px;width:fit-content;max-width:100%;",children:[g("div",{style:"display:flex;align-items:center;gap:8px;",children:[M(t.icon,t.cardTitleColor,t.iconSize),t.cardTitle&&g("p",{text:t.cardTitle,style:`margin:0;font-family:${_};font-weight:700;font-size:16px;text-transform:uppercase;letter-spacing:1px;color:${t.cardTitleColor};white-space:nowrap;line-height:1.2;`})]}),g("div",{style:`height:3px;width:100%;border-radius:9999px;background:linear-gradient(90deg, ${t.cardAccentFrom}, ${t.cardAccentTo});`})]}),n=t.cardDescription&&g("p",{html:t.cardDescription,style:`margin:0;font-family:${_};font-weight:400;font-size:13px;line-height:1.4;color:${t.cardTextColor};`}),o=g("button",{attrs:{type:"button"},text:t.text,style:`font-family:${_};font-weight:700;font-size:${t.fontSize}px;text-transform:uppercase;letter-spacing:1px;text-decoration:underline;text-underline-offset:4px;color:${t.cardCtaColor};background:transparent;border:none;padding:0;cursor:pointer;text-align:left;line-height:1.2;transition:opacity 0.2s ease;`,on:{mouseenter:i=>{i.currentTarget.style.opacity="0.7"},mouseleave:i=>{i.currentTarget.style.opacity="1"},click:i=>{try{i.preventDefault(),i.stopPropagation()}catch(a){}try{e&&e()}catch(a){}}}});return g("div",{style:`display:flex;flex-direction:column;align-items:flex-start;gap:24px;padding:20px;width:360px;max-width:100%;box-sizing:border-box;background:${t.cardBgColor};border:1px solid ${t.cardBorderColor};border-radius:${t.cardBorderRadiusPx};font-family:${_};`,children:[r,n,o]})}var gi={style:"gregory-black",icon:"camera",text:"Provar Virtualmente",fontSize:14,iconSize:24,subtext:"",bgColor:"#1E1E1E",textColor:"#FFFFFF",badgeBgColor:"#C51A1B",badgeTextColor:"#FFFFFF",borderRadius:"md",borderColor:"#1E1E1E",borderWidth:0,cardTitle:"",cardDescription:"",cardFooter:"",cardBgColor:"#F6F6F6",cardTitleColor:"#1E1E1E",cardTextColor:"#717171",cardBorderRadius:"md",cardCtaColor:"#1E1E1E",cardBorderColor:"#E5E0DA",cardAccentFrom:"#8A5A3C",cardAccentTo:"#E9DACB"};function we(t){if(!t)return null;let e=Array.isArray(t.anchors)?t.anchors:[];if(t.version===2||t.main)return{version:2,main:t.main||{},anchors:e,cards:t.cards||null};let r=t.desktop||t.tablet||t.mobile||{},n=t.anchor||{};return{version:2,main:Object.assign({},r,{desktop:n.desktop,tablet:n.tablet,mobile:n.mobile,bpMobile:n.bpMobile,bpTablet:n.bpTablet}),anchors:e,cards:t.cards||null}}function ct(t,e){let r={...gi,...t||{}};return r.style==="gregory-card"&&e&&(r.style="gregory-black"),r.borderRadiusPx=ye[r.borderRadius]!=null?ye[r.borderRadius]:"0",r.cardBorderRadiusPx=ge[r.cardBorderRadius]!=null?ge[r.cardBorderRadius]:"0",r.fontSize=Number(r.fontSize)||14,r.iconSize=Number(r.iconSize)||24,r.borderWidth=Number(r.borderWidth)||0,r}var xe={"gregory-black":Wr,"gregory-card":Jr,"gregory-icon":Gr,"card-link":Xr},Ta=Object.keys(xe).concat("none");function Yr(t,e){return t&&t.style==="none"?null:(xe[t.style]||xe["gregory-black"])(t,e)}function wi(){return"abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)]+Math.random().toString(36).slice(2,11)}var D=null,P=[];function Fr(){return[D].concat(P).filter(Boolean)}function xi(t,e){let r;try{r=document.createElement("iframe"),r.setAttribute("aria-hidden","true"),r.style.cssText="display:none!important;width:0;height:0;border:0;position:absolute;left:-9999px;",(document.body||document.documentElement).appendChild(r);let n=r.contentWindow&&r.contentWindow.Element&&r.contentWindow.Element.prototype&&r.contentWindow.Element.prototype.attachShadow;if(typeof n=="function"){let o=n.call(t,e);return r.remove(),o}}catch(n){}try{r&&r.remove()}catch(n){}return t.attachShadow(e)}var bi=/^(transform|transform-origin|margin|margin-(top|right|bottom|left)|align-self|justify-self|place-self|position|inset|top|right|bottom|left|z-index|width|min-width|max-width|height|min-height|max-height|font-size)$/i;function _i(t){return!t||typeof t!="string"?"":t.split(";").map(e=>e.trim()).filter(Boolean).filter(e=>bi.test(e.split(":")[0].trim().toLowerCase())).join(";")}var Mt=null,be=!1,_e=0,ve=0,Ce=0,X={},Zr=!1,lt=null;function j(){return lt||(lt=V().then(t=>t?we(t.template&&t.template.tryOnButton||null)||{__loaded:!0}:(lt=null,null)).catch(()=>(lt=null,null))),lt}function vi(){if(Zr)return;Zr=!0;let t=null;try{window.addEventListener("resize",()=>{clearTimeout(t),t=setTimeout(()=>{Mt&&C("pdp")},200)})}catch(e){}}function Se(t){if(t){if(typeof t.__mkCleanup=="function")try{t.__mkCleanup()}catch(e){}t.parentNode&&t.parentNode.removeChild(t)}}function Rt(){Se(D),P.forEach(Se),D=null,P=[],Mt=null}var Ci={IMG:1,INPUT:1,VIDEO:1,CANVAS:1,EMBED:1,OBJECT:1,IFRAME:1,BR:1,HR:1,SELECT:1,TEXTAREA:1,SVG:1};function ki(t){switch(t){case"top-center":return"top:0;left:50%;transform:translateX(-50%);";case"top-right":return"top:0;right:0;";case"middle-left":return"top:50%;left:0;transform:translateY(-50%);";case"center":return"top:50%;left:50%;transform:translate(-50%,-50%);";case"middle-right":return"top:50%;right:0;transform:translateY(-50%);";case"bottom-left":return"bottom:0;left:0;";case"bottom-center":return"bottom:0;left:50%;transform:translateX(-50%);";case"bottom-right":return"bottom:0;right:0;";case"top-left":default:return"top:0;left:0;"}}function Si(t,e,r){let o=!Ci[t.tagName]?t:t.parentElement||document.body;try{getComputedStyle(o).position==="static"&&(o.style.position="relative")}catch(u){}if(o===t){e.style.cssText="position:absolute;z-index:2147483000;"+ki(r),t.appendChild(e);return}e.style.cssText="position:absolute;z-index:2147483000;",o.appendChild(e);let i=()=>{try{let u=t.getBoundingClientRect(),f=o.getBoundingClientRect(),d=e.offsetWidth,w=e.offsetHeight,h=u.top-f.top+o.scrollTop,b=u.left-f.left+o.scrollLeft,p=r||"top-left",A=h,Z=b;p.indexOf("bottom")===0?A=h+u.height-w:(p.indexOf("middle")===0||p==="center")&&(A=h+(u.height-w)/2),p.indexOf("right")>=0?Z=b+u.width-d:p.indexOf("center")>=0&&(Z=b+(u.width-d)/2),e.style.top=A+"px",e.style.left=Z+"px"}catch(u){}};i();let a=()=>i();window.addEventListener("resize",a);let c=setTimeout(i,600),l=setTimeout(i,1500),s=null;try{if(t.tagName==="IMG"&&!t.complete&&t.addEventListener("load",i,{once:!0}),typeof ResizeObserver=="function"){s=new ResizeObserver(()=>i());try{s.observe(t)}catch(u){}try{s.observe(o)}catch(u){}}}catch(u){}e.__mkCleanup=()=>{window.removeEventListener("resize",a),clearTimeout(c),clearTimeout(l);try{t.removeEventListener("load",i)}catch(u){}try{s&&s.disconnect()}catch(u){}}}function Ti(t,e,r){e.style.cssText="position:absolute;z-index:100;",document.body.appendChild(e);let n=()=>{try{let l=t.getBoundingClientRect(),s=e.offsetWidth,u=e.offsetHeight,f=r||"top-left",d=l.top+window.scrollY,w=l.left+window.scrollX;f.indexOf("bottom")===0?d=l.bottom+window.scrollY-u:(f.indexOf("middle")===0||f==="center")&&(d=l.top+window.scrollY+(l.height-u)/2),f.indexOf("right")>=0?w=l.right+window.scrollX-s:f.indexOf("center")>=0&&(w=l.left+window.scrollX+(l.width-s)/2),e.style.top=Math.round(d)+"px",e.style.left=Math.round(w)+"px"}catch(l){}};n();let o=()=>n();window.addEventListener("resize",o);let i=setTimeout(n,600),a=setTimeout(n,1500),c=null;try{t.tagName==="IMG"&&!t.complete&&t.addEventListener("load",n,{once:!0});let l=t.querySelector&&t.querySelector("img");if(l&&!l.complete&&l.addEventListener("load",n,{once:!0}),typeof ResizeObserver=="function"){c=new ResizeObserver(()=>n());try{c.observe(t)}catch(s){}}}catch(l){}e.__mkCleanup=()=>{window.removeEventListener("resize",o),clearTimeout(i),clearTimeout(a);try{c&&c.disconnect()}catch(l){}}}function Ai(t,e,r){try{return t.insertAdjacentElement(r||"afterend",e),!0}catch(n){try{return t.parentNode.insertBefore(e,t.nextSibling),!0}catch(o){return!1}}}async function C(t){let e=y();if(t!=="pdp"){Rt();return}if(!e.projectId)return;if(!e._anchorFromPicker){let s=await j();s&&s.main&&(e.anchor=s.main),s&&s.anchors&&(e.anchors=s.anchors),s&&s.cards&&(e.cards=s.cards);let u=!!(e.anchor&&(e.anchor.desktop||e.anchor.mobile||e.anchor.tablet||e.anchor.selector));if(!e.forceButton&&!(s&&s.main)&&!u){Rt(),s===null&&_e<3&&(_e++,setTimeout(()=>C(t),1500));return}_e=0}if(be)return;let r=W(),n=r&&r.value,o=!!e.forceButton,i=s=>s?[s.selector,s.position,s.mode,s.align,s.style].join("~"):"heuristic",a=Array.isArray(e.anchors)?e.anchors:[],c=[n||"demo",i(at(e.anchor))].concat(a.map(s=>i(at(s)))).join("|"),l=D;if(!(l&&Mt===c)){if(l&&Rt(),!n&&!o){x("auto-mount: SKU n\xE3o resolvido na PDP"),ve<10&&(ve++,setTimeout(()=>C(t),800));return}if(ve=0,!o&&e.anchor&&at(e.anchor)&&!Lt(e.anchor)&&Ce<12){Ce++,setTimeout(()=>C(t),600);return}Ce=0,be=!0;try{let s=o;o||(X[n]||(X[n]=z(e.projectId,n).then(b=>!!(b&&b.available)).catch(()=>!1)),s=await X[n]);try{ze(s?"available":"unavailable")}catch(b){}if(!s){x("auto-mount: produto sem try-on",n);return}let u=await j(),f=window.matchMedia("(max-width: 767px)").matches,d=ct(u&&u.main||e.anchor||{},f),w=()=>{let b=W(),p=b&&b.value||n||"";Ft(),m("button_clicked",{sku:p,style:d.style}),it({projectId:e.projectId,identifier:p})},h=$r();D=Te(h,d,w),P=[];for(let b=0;b<a.length;b++){let p=a[b],A=Lt(p);if(!A)continue;let Z=u&&u.anchors&&u.anchors[b]||p,Ee=Te(A,ct(Z,f),w);Ee&&P.push(Ee)}Mt=c,vi(),x("auto-mount: bot\xE3o",{style:d.style,sku:n,mounted:!!D,extras:P.length,forced:o}),(D||P.length)&&m("button_rendered",{style:d.style,sku:n||null,skuSource:r&&r.source,anchorFound:!!h,position:h?h.position:null,mode:h?h.mode:null,extras:P.length,forced:o})}finally{be=!1}}}function Te(t,e,r){let n=t&&t.mode||"flow",o=Yr(e,r);if(!o)return null;let i=document.createElement("div");i.id=wi(),xi(i,{mode:"closed"}).appendChild(o),["click","mousedown","mouseup","pointerdown","pointerup","touchstart"].forEach(l=>{try{i.addEventListener(l,s=>{s.stopPropagation()},!1)}catch(s){}});let c=!1;if(t&&t.el&&t.el.parentNode&&(n==="overlay"?(t.detached?Ti(t.el,i,t.align):Si(t.el,i,t.align),c=!0):(i.style.cssText="display:contents;",c=Ai(t.el,i,t.position))),c||(i.style.cssText="position:fixed;left:16px;bottom:16px;z-index:2147483000;",document.body.appendChild(i)),t&&t.style){let l=_i(t.style);if(l){if(n==="overlay"){let s=l.match(/(?:^|;)\s*z-index\s*:\s*([^;]+)/i);if(s)try{i.style.zIndex=s[1].trim()}catch(u){}}try{o.style.cssText+=";"+l}catch(s){}}}return i}function Qr(){try{let t=y(),e={anchor:t.anchor,anchors:t.anchors,cards:t.cards,forceButton:t.forceButton},r={},n=i=>({desktop:i,tablet:i,mobile:i}),o=(i,a,c)=>{i=i||{};let l=d=>a===d?c:r[d];t.anchor=l("primary")?n(l("primary")):i.main||null;let s=Array.isArray(i.anchors)?i.anchors:[],u=s.length;Object.keys(r).concat(a?[a]:[]).forEach(d=>{d&&d.indexOf("extra-")===0&&(u=Math.max(u,(parseInt(d.slice(6),10)||0)+1))});let f=[];for(let d=0;d<u;d++){let w=l("extra-"+d);f[d]=w?n(w):s[d]||null}t.anchors=f,t._anchorFromPicker=!0,t.forceButton=!0};window.addEventListener("message",i=>{if(i.source!==window)return;let a=i.data;if(!(!a||!a.__mkCmd)){if(a.__mkCmd==="getButtons"){j().then(c=>{let l=c&&Array.isArray(c.anchors)?c.anchors.length:0;try{window.postMessage({__mkButtons:{extras:l,hasMain:!!(c&&c.main)}},"*")}catch(s){}});return}if(a.__mkCmd==="previewSlot"){j().then(c=>{o(c,a.slot||"primary",a.live),C("pdp")});return}if(a.__mkCmd==="saveSlot"){a.slot&&a.live&&(r[a.slot]=a.live),j().then(c=>{o(c),C("pdp")});return}if(a.__mkCmd==="galleryPreview"){t.cards=a.cards||null,t._anchorFromPicker=!0,t.forceButton=!0,Y(),Pt("category");return}if(a.__mkCmd==="applyRecipe"){j().then(c=>{o(c),a.cards!==void 0&&(t.cards=a.cards||null),C("pdp"),t.cards&&(Y(),Pt("category"))});return}if(a.__mkCmd==="cancelPreview"){Object.keys(r).length?j().then(c=>{o(c),C("pdp")}):(t.anchor=e.anchor,t.anchors=e.anchors,t.cards=e.cards,t._anchorFromPicker=!1,t.forceButton=e.forceButton,Rt(),Y(),C("pdp"));return}}})}catch(t){}}var U=null,st=null,Ae=null,ut=new Map;function Ei(t,e){try{if(e.skuAttr){let o=e.skuSelector?t.querySelector(e.skuSelector):t,i=o&&o.getAttribute(e.skuAttr);if(i)return String(i).trim()}if(e.skuSelector&&!e.skuAttr){let o=t.querySelector(e.skuSelector),i=o&&(o.getAttribute("content")||o.textContent||"").trim();if(i)return i}let r=t.querySelector(e.linkSelector||"a[href]"),n=r&&r.getAttribute("href");if(n){let o=n.match(/-p(\d+)|[?&]variant=(\d+)|\/produtos?\/([\w-]+)|\/products?\/([\w-]+)|-(\d+)(?:[/?#]|$)/);if(o)return o[1]||o[2]||o[3]||o[4]||o[5]}}catch(r){}return null}async function Li(t,e,r){if(ut.has(t))return;let n=!!y().forceButton,o=Ei(t,e);if(!o&&!n)return;let i=n;if(i||(X[o]||(X[o]=z(y().projectId,o).then(u=>!!(u&&u.available)).catch(()=>!1)),i=await X[o]),!i||ut.has(t)||!t.isConnected)return;let c={el:e.anchorWithin&&t.querySelector(e.anchorWithin)||t,mode:e.mode||"overlay",align:e.align||"top-left",position:e.position||"afterbegin",style:e.injectStyle||e.style||"",detached:!0},s=Te(c,r,()=>{Ft(),m("button_clicked",{sku:o,gallery:!0,style:r.style}),it({projectId:y().projectId,identifier:o})});s&&(ut.set(t,s),m("button_rendered",{gallery:!0,sku:o,style:r.style}))}function ke(t){try{document.querySelectorAll(t.cardSelector).forEach(e=>{e.__mkCard||(e.__mkCard=!0,U.observe(e))})}catch(e){}}function Y(){if(U){try{U.disconnect()}catch(t){}U=null}if(st){try{st.disconnect()}catch(t){}st=null}clearTimeout(Ae),ut.forEach(t=>Se(t)),ut.clear()}async function Pt(t){let e=y();if(t==="pdp"||t==="cart"||t==="checkout"||t==="purchase"){Y();return}if(!e.projectId)return;let r=await j(),n=e.cards||r&&r.cards||null;if(!n||!n.cardSelector){Y();return}if(U){ke(n);return}if(typeof IntersectionObserver!="function")return;let o=ct(n,window.matchMedia("(max-width: 767px)").matches);if(o.style==="none"){Y();return}U=new IntersectionObserver(i=>{for(let a of i)a.isIntersecting&&(U.unobserve(a.target),Li(a.target,n,o))},{rootMargin:"300px"}),ke(n);try{st=new MutationObserver(()=>{clearTimeout(Ae),Ae=setTimeout(()=>ke(n),250)}),st.observe(document.body,{childList:!0,subtree:!0})}catch(i){}x("auto-mount galeria ativa",{cardSelector:n.cardSelector})}(function(){"use strict";try{let r=function(){try{$e(),Qr(),Mr(),e.autoTrack!==!1&&(pr((o,i)=>{_r(o,i),C(o),Pt(o)}),kr(),Cr()),x("mk-sdk iniciado",{projectId:e.projectId,collectorUrl:e.collectorUrl})}catch(o){e.debug&&console.error("[mk-sdk] init erro",o)}},e=Bt();if(e.projectId){let o=We(e.projectId);o&&$t(o),V().then(i=>{let a=He(i);$t(a),Je(e.projectId,a),x("escopo de coleta",a)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r):r();let n={open:it,close:Et,isAvailable:Ir,getAvailability:z,onReady:Br,onClose:Or,onAddToCart:Nr,onProductLoaded:qr,onError:zr,onInteraction:Dr,onGenerationComplete:Ur,testCart:cr,_version:Dt,_isMkSdk:!0};typeof window!="undefined"&&(window.mk=n)}catch(e){typeof console!="undefined"&&console.error("[mk-sdk] boot fatal",e)}})();})();
|
|
1
|
+
(()=>{var fn=Object.defineProperty;var C=(t,e)=>{for(var r in e)fn(t,r,{get:e[r],enumerable:!0})};var Ut={collectorUrl:"https://api-collector.mk3dlabs.com",appUrl:"https://mkfashion.mk3dlabs.com/visualizer",apiUrl:"https://mkfashion-new-api.mk3dlabs.com"},pn={},tt=null;function Ft(){if(tt)return tt;let t=null;try{t=document.currentScript||document.querySelector("script[data-mk-project]")||document.querySelector('script[src*="mk-sdk"]')||document.querySelector('script[src*="mk-pixel"]')}catch(i){}let e=i=>{try{return t&&t.getAttribute(i)}catch(a){return null}},r=e("data-mk-project")||e("data-mk-client")||window.__MK&&(window.__MK.projectId||window.__MK.clientSlug)||null,n=e("data-mk-product")||window.__MK&&window.__MK.product||"mk-fashion",o=e("data-mk-collector")||window.__MK&&window.__MK.collectorUrl||pn.collectorUrl||Ut.collectorUrl;return tt={projectId:r,product:n,collectorUrl:o,appUrl:window.__MK&&window.__MK.appUrl||Ut.appUrl,apiUrl:window.__MK&&window.__MK.apiUrl||Ut.apiUrl,debug:!!(e("data-mk-debug")!==null||window.__MK&&window.__MK.debug||/[?&]mkdebug\b/.test(location.search)),observe:!!(window.__MK&&window.__MK.observe),forceButton:!!(window.__MK&&window.__MK.forceButton),anchor:window.__MK&&window.__MK.anchor||null,anchors:window.__MK&&window.__MK.anchors||null,cards:window.__MK&&window.__MK.cards||null,modalWidth:window.__MK&&window.__MK.modalWidth||null,modalHeight:window.__MK&&window.__MK.modalHeight||null,cartRedirect:!(window.__MK&&window.__MK.cartRedirect===!1),cartBehavior:window.__MK&&window.__MK.cartBehavior||null,cartOpenSelector:window.__MK&&window.__MK.cartOpenSelector||null,autoTrack:e("data-mk-no-autotrack")===null,batchIntervalMs:window.__MK&&window.__MK.batchIntervalMs||8e3,batchMaxSize:window.__MK&&window.__MK.batchMaxSize||20,engagementIntervalMs:15e3},tt}function y(){return tt||Ft()}function w(...t){let e=y();e&&e.debug&&typeof console!="undefined"&&console.log("[mk-sdk]",...t)}var Be="_mk_vid",Ne="_mk_sid",et=null,rt=null;function mt(){return typeof crypto!="undefined"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function ht(){if(et)return et;try{let t=localStorage.getItem(Be);return t||(t="v_"+mt(),localStorage.setItem(Be,t)),et=t,t}catch(t){return et="v_"+mt(),et}}function qe(){if(rt)return rt;try{let t=sessionStorage.getItem(Ne);return t||(t="s_"+mt(),sessionStorage.setItem(Ne,t)),rt=t,t}catch(t){return rt="s_"+mt(),rt}}var yt=[],De=!1;function Kt(t){let e=2166136261;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r),e=Math.imul(e,16777619)>>>0;return(e>>>0)/4294967296}function mn(){let t=typeof navigator!="undefined"&&navigator.userAgent||"";return/iPad|Tablet|PlayBook|Silk/i.test(t)||/Android/i.test(t)&&!/Mobile/i.test(t)?"tablet":/Mobi|Android|iPhone|iPod|Windows Phone|BlackBerry/i.test(t)?"mobile":"desktop"}function hn(){try{return localStorage.getItem("_mk_seen")?!0:(localStorage.setItem("_mk_seen",String(Date.now())),!1)}catch(t){return!1}}function yn(t,e){let r=t.product||"mk-fashion";return r==="ambos"||r===(e||"mk-fashion")}function gn(t,e){let r=t.targeting||{};return!(Array.isArray(r.device)&&r.device.length&&r.device.indexOf(e.device)<0||r.audience==="new"&&e.returning||r.audience==="returning"&&!e.returning)}function wn(t,e){let r=t.traffic==null?100:Number(t.traffic);return r>=100?!0:r<=0?!1:Kt(e+"|"+t.id+"|t")*100<r}function xn(t,e){let r=(t.variants||[]).filter(a=>a&&a.key),n=r.reduce((a,c)=>a+(Number(c.weight)||0),0);if(n<=0)return null;let o=Kt(e+"|"+t.id)*n,i=0;for(let a=0;a<r.length;a++)if(i+=Number(r[a].weight)||0,o<i)return r[a];return r[r.length-1]}function bn(t,e,r){let n="mk_exp_"+e+"_"+t.id,o=c=>(t.variants||[]).filter(l=>l&&l.key===c)[0]||null,i=null;try{i=localStorage.getItem(n)}catch(c){}if(i&&o(i))return o(i);let a=xn(t,r);if(a)try{localStorage.setItem(n,a.key)}catch(c){}return a}function gt(t,e,r){if(De)return;De=!0;let n=t&&Array.isArray(t.experiments)?t.experiments:[];if(!n.length)return;let o=ht(),i={device:mn(),returning:hn()},a=n.filter(u=>u&&u.status==="running"&&yn(u,r)&&gn(u,i)&&wn(u,o));if(!a.length)return;let c=a.filter(u=>u.coexist==="exclusive"),l;if(c.length){let u=Math.min(c.length-1,Math.floor(Kt(o+"|excl")*c.length));l=[c[u]]}else l=a;for(let u=0;u<l.length;u++){let s=l[u],d=bn(s,e||"",o);d&&yt.push({exp:s.id,var:d.key,control:!!d.control,overrides:d.overrides||{}})}}function ze(){return yt.map(t=>({exp:t.exp,var:t.var}))}function nt(){let t={holdout:!1,tryOnButton:null,modalWidth:null,modalHeight:null};for(let e=0;e<yt.length;e++){let r=yt[e];if(r.control)continue;let n=r.overrides||{};n.holdout&&(t.holdout=!0),n.tryOnButton&&(t.tryOnButton=n.tryOnButton),n.modalWidth&&(t.modalWidth=n.modalWidth),n.modalHeight&&(t.modalHeight=n.modalHeight)}return t}var Ue=[/email/i,/e-?mail/i,/cpf/i,/cnpj/i,/phone/i,/telefone/i,/celular/i,/address/i,/endereco/i,/cep/i,/zip/i,/card/i,/cartao/i,/cvv/i,/password/i,/senha/i,/token/i,/\bnome\b/i,/fullname/i,/firstname/i,/lastname/i,/sobrenome/i,/birth/i,/nascimento/i,/rg\b/i],Fe={imageUrl:1,image:1,thumbnail:1,photo:1,imageBase64:1,src:1},$t=2e3;function Ke(t){for(let e=0;e<Ue.length;e++)if(Ue[e].test(t))return!0;return!1}function Ht(t){if(!t||typeof t!="object"||Array.isArray(t))return typeof t=="string"&&t.length>$t?t.slice(0,200)+"...[truncated "+t.length+"B]":t;let e={};for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||Ke(r))continue;let n=t[r];if(Fe[r]){e[r+"Present"]=!!n;continue}if(typeof n=="string"&&n.length>$t){e[r]=n.slice(0,200)+"...[truncated "+n.length+"B]";continue}if(n&&typeof n=="object"&&!Array.isArray(n)){e[r]=_n(n);continue}e[r]=n}return e}function _n(t){let e={};for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r)||Ke(r))continue;let n=t[r];if(Fe[r]){e[r+"Present"]=!!n;continue}if(typeof n=="string"&&n.length>$t){e[r]=n.slice(0,200)+"...[truncated]";continue}e[r]=n}return e}var wt=[],Vt=null,H=null,Jt="1.1.96",vn=["off","pdp_tryon","pdp","all","tryon_engaged"],ot,Wt=null,W="unknown",V=[],$=null;function He(){let t=y();return"mk_engaged_"+(t&&t.projectId||"")}function Gt(){if($!==null)return $;try{$=localStorage.getItem(He())==="1"}catch(t){$=!1}return $}function Xt(){if(!Gt()){$=!0;try{localStorage.setItem(He(),"1")}catch(t){}xt(!1)}}var Cn=/^purchase$/;function Ve(t,e){if(ot===void 0)return"hold";if(ot==="off")return"drop";if(ot==="all"||e&&Cn.test(e))return"collect";switch(ot){case"pdp":return t==="pdp"?"collect":"drop";case"tryon_engaged":if(Gt())return"collect";case"pdp_tryon":return t!=="pdp"?"drop":W==="available"?"collect":W==="unavailable"?"drop":"hold";default:return"collect"}}function xt(t){if(!V.length)return;let e=[];for(let r of V){let n=Ve(r._pt,r.name);n==="collect"?Ge(r.name,r.params,r.ts):n==="hold"&&!t&&e.push(r)}V=e}function Yt(t){ot=vn.indexOf(t)>=0?t:"all",xt(!1)}function We(t){W=t==="available"?"available":"unavailable",xt(!1)}function Je(t){xt(!0),H=t,Wt=t&&t.pageType||null,W="unknown"}function m(t,e,r){if(!y().projectId){(m._pre=m._pre||[]).push({name:t,params:e,ts:r||Date.now()}),m._pre.length>50&&m._pre.shift();return}if(m._pre&&m._pre.length){let o=m._pre;m._pre=[];for(let i of o)$e(i.name,i.params,i.ts)}$e(t,e,r)}function $e(t,e,r){let n=Ve(Wt,t);if(kn(t,e,n),n==="collect"){Ge(t,e,r);return}if(n==="drop"){w("descartado (escopo)",t);return}V.push({name:t,params:e,ts:r||Date.now(),_pt:Wt}),V.length>300&&V.shift()}function kn(t,e,r){if(y().observe)try{window.postMessage({__mkpixel:!0,event:{name:"page_"+Xe(t),params:Ht(e||{})},site:H?{pageType:H.pageType,platform:H.platform,url:H.url}:null,gate:r},"*")}catch(o){}}function Ge(t,e,r){let n=y(),o=Ht(e||{}),i="page_"+Xe(t);if(wt.push({name:i,ts:r||Date.now(),params:o}),w("queued",t,o),wt.length>=n.batchMaxSize){B();return}Vt||(Vt=setTimeout(()=>{Vt=null,B()},n.batchIntervalMs))}function Xe(t){if(typeof t!="string"||!t)return"unknown";let e=t.replace(/^on/,"");return e=e.replace(/[A-Z]/g,(r,n)=>(n>0?"_":"")+r.toLowerCase()),e.indexOf("page_")===0&&(e=e.slice(5)),e}function B(t){if(wt.length===0)return;let e=y();if(!e.projectId||!e.collectorUrl)return;let r=wt.splice(0,50),n=W==="available"?!0:W==="unavailable"?!1:void 0,o=ze(),i=JSON.stringify({product:e.product||void 0,sdkVersion:Jt,experiments:o.length?o:void 0,visitorId:ht(),sessionId:qe(),engaged:Gt()||void 0,tryonAvailable:n,events:r,site:H||void 0}),a=e.collectorUrl+"/v1/track";try{fetch(a,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json","X-MK-Project-Id":e.projectId},body:i}).catch(()=>{})}catch(c){try{navigator.sendBeacon&&navigator.sendBeacon(a+"?projectId="+encodeURIComponent(e.projectId),new Blob([i],{type:"text/plain"}))}catch(l){}}}function Ye(){try{window.addEventListener("pagehide",()=>B(!0)),window.addEventListener("beforeunload",()=>B(!0)),document.addEventListener("visibilitychange",()=>{document.hidden&&B(!0)})}catch(t){}}function I(t){let e=[];try{let r=document.querySelectorAll('script[type="application/ld+json"]');for(let n of r){let o;try{o=JSON.parse(n.textContent)}catch(a){continue}let i=[];Array.isArray(o)?i.push(...o):o["@graph"]?i.push(...o["@graph"]):i.push(o);for(let a of i){if(!a||!a["@type"])continue;let c=Array.isArray(a["@type"])?a["@type"]:[a["@type"]];(!t||t.some(l=>c.includes(l)))&&e.push(a)}}}catch(r){}return e}var Ze=["off","pdp_tryon","pdp","all","tryon_engaged"],Sn="all",Tn=30*60*1e3,N=null;function J(){if(N)return N;let t=y();return!t.projectId||!t.apiUrl?(N=Promise.resolve(null),N):(N=fetch(t.apiUrl+"/projects/"+t.projectId).then(e=>{if(!e.ok)throw new Error("http "+e.status);return e.json()}).then(e=>e&&e.project||e||null).catch(()=>(N=null,null)),N)}function Qe(t){let e=t&&t.analytic&&t.analytic.scope;return Ze.indexOf(e)>=0?e:Sn}var tr=t=>"mk_scope_"+t;function er(t){try{let e=localStorage.getItem(tr(t));if(!e)return null;let r=JSON.parse(e);return!r||typeof r.exp!="number"||r.exp<Date.now()?null:Ze.indexOf(r.scope)>=0?r.scope:null}catch(e){return null}}function rr(t,e){try{localStorage.setItem(tr(t),JSON.stringify({scope:e,exp:Date.now()+Tn}))}catch(r){}}var te={};C(te,{addToCart:()=>zn,detect:()=>Bn,getCartSummary:()=>qn,id:()=>jn,openCartDrawer:()=>Un,resolveSku:()=>Nn,skipRedirect:()=>On});var _t={};C(_t,{addToCart:()=>In,detect:()=>En,getCartSummary:()=>Qt,id:()=>An,openCartDrawer:()=>Pn,resolveSku:()=>Zt});var An="shopify";function En(){return!!(window.Shopify||window.ShopifyAnalytics)}function Zt(){let t=window;return t.ShopifyAnalytics&&t.ShopifyAnalytics.meta&&t.ShopifyAnalytics.meta.product?{value:String(t.ShopifyAnalytics.meta.product.id),source:"shopify"}:null}var bt=t=>String(t==null?"":t).trim().toLowerCase();async function In({size:t,color:e,sku:r,quantity:n}){let o=(location.pathname.split("/products/")[1]||"").split(/[?#]/)[0];if(!o)throw new Error("shopify: sem handle de produto na URL (n\xE3o \xE9 PDP?)");let a=(await fetch("/products/"+o+".js").then(p=>p.json())).variants||[],c=p=>[p.option1,p.option2,p.option3].concat(String(p.title||"").split("/")).map(bt).filter(Boolean),l=(p,v)=>c(p).indexOf(bt(v))>=0,u=p=>(!t||l(p,t))&&(!e||l(p,e)),s=null;if((t||e)&&(s=a.find(p=>u(p)&&p.available)||a.find(u)),!s&&r&&(s=a.find(p=>bt(p.sku)===bt(r))),s||(s=a.find(p=>p.available)||a[0]),!s)throw new Error("shopify: variante n\xE3o encontrada");let d=nr(),f=null;if(d&&typeof d.getSectionsToRender=="function")try{f=d.getSectionsToRender().map(p=>({id:p.id,selector:p.selector||"#"+p.id})).filter(p=>p.id)}catch(p){}let h={items:[{id:s.id,quantity:n||1}]};f&&f.length&&(h.sections=f.map(p=>p.id).join(","),h.sections_url=location.pathname);let g=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)});if(!g.ok)throw new Error("shopify: /cart/add.js HTTP "+g.status);let b=await g.json().catch(()=>({}));return d&&f&&b.sections&&Ln(d,f,b.sections),{platform:"shopify",variantId:s.id,size:s.title,sku:s.sku||null}}function nr(){return document.querySelector("cart-drawer, cart-notification")}function Ln(t,e,r){for(let n of e){let o=r[n.id];if(o)try{let i=null;if(typeof t.getSectionInnerHTML=="function")i=t.getSectionInnerHTML(o,n.selector);else{let c=new DOMParser().parseFromString(o,"text/html").querySelector(n.selector);i=c?c.innerHTML:null}let a=document.querySelector(n.selector);a&&i!=null&&(a.innerHTML=i)}catch(i){}}}async function Qt(){try{let t=await fetch("/cart.js",{headers:{Accept:"application/json"}}).then(e=>e.json());return{value:(Number(t.total_price)||0)/100,itemCount:Number(t.item_count)||0,currency:t.currency||null}}catch(t){return null}}var Rn=["[data-cart-drawer-toggle]",'[data-action="open-cart-drawer"]','[data-action="open-cart"]',".js-cart-drawer-open",".js-drawer-open-cart",".cart-drawer-toggle",".js-cart-toggle",'[aria-controls="CartDrawer"]','[aria-controls="cart-drawer"]',"#cart-icon-bubble","#lk-cart-icon",".header__cart",".site-header__cart",".cart-link",".header-cart",'a[href="/cart"]','a[href$="/cart"]'];function Mn(t){try{let e=t.getBoundingClientRect();return e.width>0&&e.height>0&&getComputedStyle(t).visibility!=="hidden"}catch(e){return!1}}function Pn(){let t=nr();if(t&&typeof t.open=="function")return setTimeout(()=>{try{t.open()}catch(r){}},200),!0;let e=null;for(let r of Rn)try{if(e=[...document.querySelectorAll(r)].find(Mn),e)break}catch(n){}return e?(setTimeout(()=>{try{e.click()}catch(r){}},300),!0):!1}var jn="zerezes",On=!0;function Bn(){try{if(!(window.Shopify||window.ShopifyAnalytics))return!1;let t=window.Shopify&&window.Shopify.shop||"";return/(^|\.)zerezes\./i.test(location.hostname)||/cs-zerezes/i.test(t)}catch(t){return!1}}var Nn=Zt,qn=Qt;function Dn(){let t=[...document.querySelectorAll(".lens-selection__button, [data-has-lens-basket]")];return t.find(e=>{let r=e.getBoundingClientRect();return r.width>0&&r.height>0})||t[0]||null}async function zn(){let t=Dn();if(!t)throw new Error("zerezes: bot\xE3o de sele\xE7\xE3o de lentes n\xE3o encontrado");try{window.postMessage({source:"mkfashion-app",action:"close_request"},"*")}catch(e){}return setTimeout(()=>{try{t.click()}catch(e){}},250),{platform:"zerezes",nativeFlow:"lens-selection"}}function Un(){return!0}var re={};C(re,{addToCart:()=>Hn,detect:()=>Kn,getCartSummary:()=>Vn,id:()=>Fn,resolveSku:()=>$n});var Fn="hybris";function Kn(){return!!(window.ACC&&window.ACC.config)}function $n(){let t=(location.pathname||"").match(/\/p\/([^/?#]+)/);return t&&t[1]?{value:decodeURIComponent(t[1]),source:"hybris/url"}:null}var or=t=>String(t==null?"":t).trim().toLowerCase();async function Hn({size:t,quantity:e}){let r=[...document.querySelectorAll('.js-product-select-size, a[data-code], [class*="select-size"]')].filter(h=>h.getAttribute&&h.getAttribute("data-code")),n=t?r.find(h=>or(h.textContent)===or(t)):null;n||(n=r.find(h=>h.offsetParent!==null)||r[0]);let o=n&&n.getAttribute("data-code");if(!o)throw new Error("hybris: variante (data-code) n\xE3o encontrada");let i=document.getElementById("product--add-to-cart-form")||document.querySelector('form[action*="/cart/add"]'),a=i&&i.querySelector('[name="CSRFToken"]'),c=a&&a.value,l=i&&i.getAttribute("action")||"/cart/add";if(!c)throw new Error("hybris: CSRFToken n\xE3o encontrado");let u=new URLSearchParams;u.set("productCodePost",o),u.set("qty",String(e||1)),u.set("CSRFToken",c);let s=await fetch(l,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},body:u.toString()});if(!s.ok)throw new Error("hybris: "+l+" HTTP "+s.status);let d=null,f=null;try{let h=await s.clone().json(),g=h&&h.cartData;g&&(d=ee(g.total!=null?g.total:g.totalPrice),f=g.totalUnitCount!=null?Number(g.totalUnitCount):Array.isArray(g.products)?g.products.length:null)}catch(h){}return{platform:"hybris",productCode:o,size:n.textContent.trim(),cartValue:d,itemCount:f,currency:"BRL"}}function ee(t){if(t==null||t==="")return null;if(typeof t=="number")return Number.isFinite(t)?t:null;let e=String(t).replace(/[^\d.,]/g,"");if(!e)return null;let r=e.indexOf(",")>e.indexOf(".")?parseFloat(e.replace(/\./g,"").replace(",",".")):parseFloat(e.replace(/,/g,""));return Number.isFinite(r)?r:null}async function Vn(){try{let t=await fetch("/cart/async?nocache="+Date.now(),{headers:{"X-Requested-With":"XMLHttpRequest"}}).then(a=>a.ok?a.text():"");if(!t)return null;let e=new DOMParser().parseFromString(t,"text/html"),r=e.querySelector(".minicart-total .price")||e.querySelector(".floating-cart--cart-total"),n=r?ee(r.textContent):null,o=e.querySelector(".mini-badge"),i=o?parseInt(o.textContent,10)||0:null;return n==null&&i==null?null:{value:n,itemCount:i,currency:"BRL"}}catch(t){}try{let t=[".minicart-total .price",".js-cart-total",".cart-total",".total-price",".grand-total"];for(let e of t){let r=document.querySelector(e),n=r&&ee(r.textContent);if(n)return{value:n,itemCount:null,currency:"BRL"}}}catch(t){}return null}var oe={};C(oe,{addToCart:()=>Xn,addToCartBatch:()=>Yn,detect:()=>Jn,getCartSummary:()=>Zn,getFsCartStore:()=>Ct,id:()=>Wn,openCartDrawer:()=>Gn,resolveSku:()=>ne});var Wn="vtex";function Jn(){return!!(window.vtex||window.vtexjs||window.vtxctx||window.skuJson_0||window.__RUNTIME__||window.vtexaf||document.querySelector('link[href*="vtexassets"], script[src*="vtexassets"], link[href*="vteximg"], script[src*="vteximg"], img[src*="vteximg"]'))}function ne(){let t=window;if(t.vtxctx&&t.vtxctx.skus&&t.vtxctx.skus[0])return{value:String(t.vtxctx.skus[0]),source:"vtex/vtxctx"};if(t.skuJson_0&&t.skuJson_0.skus&&t.skuJson_0.skus[0])return{value:String(t.skuJson_0.skus[0].sku),source:"vtex/skuJson"};try{let e=document.querySelector('meta[property="product:sku"]'),r=e&&(e.getAttribute("content")||"").trim();if(r)return{value:String(r),source:"vtex/og-sku"}}catch(e){}return null}var vt=t=>String(t==null?"":t).trim().toLowerCase(),T;function Ct(){if(T!==void 0)return T;T=null;try{let t=Object.keys(window).find(o=>/^webpackChunk/.test(o));if(!t||!window[t]||typeof window[t].push!="function")return T;let e=null;try{window[t].push([["mk-cart-"+Math.random().toString(36).slice(2)],{},o=>{e=o}])}catch(o){}if(!e||!e.m)return T;let r=null;for(let o in e.m)try{let i=e.m[o].toString();if(i.indexOf("cart-storage")>=0&&i.indexOf("addToCart")>=0&&i.indexOf("toggleCart")>=0){r=o;break}}catch(i){}if(r==null)return T;let n=e(r);for(let o in n)try{let i=n[o];if(typeof i=="function"&&typeof i.getState=="function"){let a=i.getState();if(a&&typeof a.addToCart=="function"&&Array.isArray(a.items)){T=i;break}}}catch(i){}}catch(t){T=null}return T}function ir(t){try{let e=t&&t.totalizers||[];if(!e.length)return null;let r=e.reduce((n,o)=>n+(Number(o&&o.value)||0),0);return r>0?r/100:null}catch(e){return null}}async function ar(t,e){let r=Ct();if(!r)return null;let n=(Array.isArray(t)?t:[t]).map(l=>String(l)).filter(Boolean);if(!n.length||typeof r.getState().addToCart!="function")return null;let i=!1;for(let l=0;l<n.length;l++){let u=l===n.length-1;try{await r.getState().addToCart({id:n[l],seller:"1"},"mk-tryon",e||1,u),i=!0}catch(s){}}if(!i)return null;let a=r.getState(),c=(a.items||[]).reduce((l,u)=>l+(Number(u&&u.quantity)||1),0);return{platform:"vtex",skuId:n.join(","),itemCount:c||null,cartValue:ir(a),currency:a.currencyCode||"BRL",drawerHandled:!0}}function Gn(){try{let e=Ct();if(e){let r=e.getState();if(r&&r.cartOpen)return!0;if(typeof e.setState=="function")return e.setState({cartOpen:!0}),!0;if(r&&typeof r.toggleCart=="function")return r.toggleCart(),!0}}catch(e){}let t=['[data-testid="cart-toggle"]','button[aria-label="Abrir carrinho de compras"]','[class*="minicart" i] button','button[class*="minicart" i]','[class*="miniCart" i] button',".vtexsc-cart",".fn-minicart","#header-cart",'[class*="cartIcon" i]','[aria-label*="carrinho" i]','[aria-label*="sacola" i]','[data-testid*="cart" i] button'];for(let e of t)try{let r=document.querySelector(e);if(r)return r.click(),!0}catch(r){}return!1}async function cr(t,e){let r=Array.isArray(t)?t:[t],n=r.map(d=>({id:parseInt(d,10),quantity:e||1,seller:"1"})).filter(d=>Number.isFinite(d.id));if(!n.length)throw new Error("vtex: nenhum skuId v\xE1lido");let o=location.origin,i=await fetch(o+"/api/checkout/pub/orderForm",{headers:{accept:"application/json"},credentials:"include"}).then(d=>d.json()),a=i&&i.orderFormId;if(!a)throw new Error("vtex: orderFormId indispon\xEDvel");let c=await fetch(o+"/api/checkout/pub/orderForm/"+encodeURIComponent(a)+"/items",{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},credentials:"include",body:JSON.stringify({orderItems:n})}).then(d=>d.json()),l=c&&typeof c.value=="number"?c.value/100:null,u=Array.isArray(c&&c.items)?c.items.reduce((d,f)=>d+(Number(f.quantity)||1),0):null,s=c&&c.storePreferencesData&&c.storePreferencesData.currencyCode||"BRL";return{platform:"vtex",skuId:r.map(String).join(","),cartValue:l,itemCount:u,currency:s}}async function Xn(t){t=t||{};let{size:e,sku:r,quantity:n}=t,o=window.skuJson_0&&window.skuJson_0.skus||[];if(o.length&&window.vtexjs&&window.vtexjs.checkout&&window.vtexjs.checkout.addToCart){let l=s=>vt(s.skuname)===vt(e)||s.dimensions&&Object.values(s.dimensions).some(d=>vt(d)===vt(e)),u=e?o.find(s=>l(s)&&s.available)||o.find(l):null;if(u||(u=o.find(s=>s.available)||o[0]),!u)throw new Error("vtex: variante n\xE3o encontrada");return await window.vtexjs.checkout.addToCart([{id:parseInt(u.sku,10),quantity:n||1,seller:"1"}]),{platform:"vtex",skuId:u.sku,size:u.skuname||e}}let i=ne(),a=r||i&&i.value||null;if(!a)throw new Error("vtex: skuId n\xE3o resolvido (IO)");let c=await ar(a,n);return c||cr(a,n)}async function Yn(t){let e=(t||[]).map(n=>n&&(n.sku||(ne()||{}).value)).filter(Boolean);if(!e.length)throw new Error("vtex: nenhum skuId pro batch");let r=await ar(e,1);return r?Object.assign({count:e.length},r):window.skuJson_0&&window.vtexjs&&window.vtexjs.checkout&&window.vtexjs.checkout.addToCart?(await window.vtexjs.checkout.addToCart(e.map(n=>({id:parseInt(n,10),quantity:1,seller:"1"}))),{platform:"vtex",count:e.length}):cr(e,1)}async function Zn(){try{let t=Ct();if(t){let e=t.getState(),r=ir(e),n=(e.items||[]).reduce((o,i)=>o+(Number(i&&i.quantity)||1),0);if(r!=null||n)return{value:r,itemCount:n,currency:e.currencyCode||"BRL"}}}catch(t){}try{let t=window.vtexjs&&window.vtexjs.checkout&&window.vtexjs.checkout.orderForm;if(t&&typeof t.value=="number"){let e=t.storePreferencesData&&t.storePreferencesData.currencyCode||"BRL",r=(t.items||[]).reduce((n,o)=>n+(Number(o.quantity)||1),0);return{value:t.value/100,itemCount:r,currency:e}}}catch(t){}try{let t=await fetch(location.origin+"/api/checkout/pub/orderForm",{headers:{accept:"application/json"},credentials:"include"}).then(e=>e.json());if(t&&typeof t.value=="number"){let e=(t.items||[]).reduce((r,n)=>r+(Number(n.quantity)||1),0);return{value:t.value/100,itemCount:e,currency:t.storePreferencesData&&t.storePreferencesData.currencyCode||"BRL"}}}catch(t){}return null}var ie={};C(ie,{addToCart:()=>no,detect:()=>eo,getCartSummary:()=>io,id:()=>Qn,openCartDrawer:()=>oo,resolveSku:()=>ro,skipRedirect:()=>to});var Qn="nuvemshop",to=!0;function eo(){return!!(window.LS&&(window.LS.cart||window.LS.addToCart))}function ro(){try{let t=window.LS,e=t&&t.variants||[],r=document.querySelector('[name="variant_id"]'),n=r&&r.value?e.find(o=>String(o.id)===String(r.value)):null;if(n||(n=e.find(o=>o.available!==!1&&o.sku)||e.find(o=>o.sku)||e[0]),n&&n.sku)return{value:String(n.sku),source:"nuvemshop/variant"};if(t&&t.product&&t.product.sku)return{value:String(t.product.sku),source:"nuvemshop/product"}}catch(t){}return null}var kt=t=>String(t==null?"":t).trim().toLowerCase();async function no({size:t,quantity:e,productId:r}){if(r&&!document.getElementById("product_form")){let c=String(r).replace(/["\\]/g,""),l=document.querySelector('[data-product-id="'+c+'"]'),u=l&&l.querySelector("form[action]"),s=u&&u.getAttribute("action")||"/comprar/",d=window.LS;if(d&&typeof d.addToCartEnhanced=="function")try{let g=document.createElement("form");g.setAttribute("action",s),g.setAttribute("method","post");let b=document.createElement("input");return b.type="hidden",b.name="add_to_cart",b.value=c,g.appendChild(b),document.body.appendChild(g),d.addToCartEnhanced(g),setTimeout(()=>{try{g.remove()}catch(p){}},3e3),{platform:"nuvemshop",productId:c,via:"gallery-enhanced"}}catch(g){}let f=!1,h=null;try{let b=await(await fetch(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},body:"add_to_cart="+encodeURIComponent(c)+"&quantity="+(e||1)})).json().catch(()=>({}));f=!!b.success,h=b.error_code||null}catch(g){}return{platform:"nuvemshop",productId:c,via:"gallery",added:f,reason:h}}let n=document.getElementById("product_form")||document.querySelector('.js-product-form, form[action*="/comprar"]');if(!n)throw new Error("nuvemshop: #product_form n\xE3o encontrado");t&&n.querySelectorAll('select[name^="variation"]').forEach(c=>{let l=[...c.options].find(u=>kt(u.textContent).includes(kt(t))||kt(u.value)===kt(t));l&&(c.value=l.value,c.dispatchEvent(new Event("change",{bubbles:!0})))});let o=n.querySelector('[name="quantity"]');o&&e&&(o.value=String(e)),await new Promise(c=>setTimeout(c,400));let i=n.querySelector(".js-addtocart")||document.querySelector(".js-addtocart");return i?i.click():typeof n.requestSubmit=="function"?n.requestSubmit():n.submit(),await new Promise(c=>setTimeout(c,1200)),{platform:"nuvemshop",variantId:(n.querySelector('[name="variant_id"]')||{}).value||null}}function oo(){try{if([...document.querySelectorAll('#ajax-cart-details, .modal-cart, [class*="cart-modal" i], [class*="modal-cart" i]')].find(o=>{try{return o.getBoundingClientRect().width>0&&getComputedStyle(o).display!=="none"}catch(i){return!1}}))return!0;let r=[...document.querySelectorAll('[data-toggle="#modal-cart"], [data-toggle*="cart" i], #ajax-cart a.js-modal-open, .cart-summary a.js-modal-open, .js-toggle-cart')],n=r.find(o=>{let i=o.getBoundingClientRect();return i.width>0&&i.height>0})||r[0];if(n)return setTimeout(()=>{try{n.click()}catch(o){}},300),!0;if(window.LS&&typeof window.LS.toggleCart=="function")return setTimeout(()=>{try{window.LS.toggleCart()}catch(o){}},300),!0}catch(t){}return!1}function io(){try{let t=window.LS,e=t&&t.cart;if(!e)return null;let r=t.currency&&t.currency.code||"BRL",n=Array.isArray(e.items)?e.items.reduce((i,a)=>i+(Number(a.quantity)||1),0):Number(e.items)||0,o=e.subtotal!=null?Number(e.subtotal):null;return{value:o!=null?o/100:null,itemCount:n,currency:r}}catch(t){return null}}var ae={};C(ae,{addToCart:()=>uo,detect:()=>lo,getCartSummary:()=>fo,id:()=>ao,openCartDrawer:()=>mo,resolveSku:()=>so,skipRedirect:()=>co});var ao="wake",co=!0;function lo(){return!!(window.StorefrontClient||typeof window.addOrCreateCheckout=="function"||typeof window.addToCartClick=="function")}function so(){try{let t=document.querySelector('input[name="product-id"], [data-product-id]'),e=t?t.value||t.getAttribute("data-product-id"):null;if(e)return{value:String(e).trim(),source:"wake/product-id"};let r=(location.pathname||"").match(/-(\d+)\/?(?:[?#]|$)/);if(r)return{value:r[1],source:"wake/url"}}catch(t){}return null}var lr=t=>String(t==null?"":t).trim().toLowerCase();async function uo({size:t,quantity:e}){if(t){let i=[...document.querySelectorAll("input[attribute-value]")].find(a=>lr(a.getAttribute("attribute-value"))===lr(t));if(i){try{i.checked=!0}catch(a){}try{typeof window.selectAttribute=="function"?window.selectAttribute(i):i.click()}catch(a){}await new Promise(a=>setTimeout(a,600))}}let r=document.querySelector('[name="product-variant-id"]'),n=r&&r.value;if(!n)throw new Error("wake: product-variant-id n\xE3o encontrado");if(typeof window.addOrCreateCheckout!="function")throw new Error("wake: addOrCreateCheckout indispon\xEDvel");if(!await window.addOrCreateCheckout([{productVariantId:Number(n),quantity:e||1,customization:[]}]))throw new Error("wake: addOrCreateCheckout retornou false");return{platform:"wake",productVariantId:n,size:t||null}}function sr(t){if(t==null)return null;let e=String(t).match(/([\d.]+,\d{2}|\d+(?:\.\d{2})?)/),r=(e?e[1]:String(t)).replace(/[^\d.,]/g,"");if(!r)return null;let n=r.indexOf(",")>r.indexOf(".")?parseFloat(r.replace(/\./g,"").replace(",",".")):parseFloat(r.replace(/,/g,""));return Number.isFinite(n)&&n>0?n:null}async function fo(){try{let t=()=>{let o=document.querySelector(".mc-subtotal__value")||document.querySelector(".mc-subtotal");return o?sr(o.textContent):null},e=t();if(e==null&&typeof window.loadMiniCart=="function"){try{window.loadMiniCart()}catch(o){}await new Promise(o=>setTimeout(o,700)),e=t()}e==null&&(e=po());let r=document.querySelector('.mc-products__count, [class*="mc-"][class*="count" i], [class*="minicart" i] [class*="count" i]'),n=r&&parseInt(String(r.textContent||"").replace(/\D/g,""),10)||null;if(e!=null)return{value:e,itemCount:n,currency:"BRL"}}catch(t){}return null}function po(){try{let t=document.querySelector('[class*="mini-cart" i], .mini-cart')||document;for(let e of t.querySelectorAll("div,span,p,li,strong,b")){if(e.children.length>2)continue;let r=(e.textContent||"").replace(/\s+/g," ").trim();if(!(!/R\$/.test(r)||/frete|faltam|gr[aá]tis|desconto|economi/i.test(r))&&/^(sub)?total\b/i.test(r)){let n=sr(r);if(n)return n}}}catch(t){}return null}function mo(){if(typeof window.setCartDivVisibility!="function")return!1;try{typeof window.loadMiniCart=="function"&&window.loadMiniCart()}catch(t){}return setTimeout(()=>{try{let t=document.querySelector('[class*="mini-cart" i], .mini-cart');if(t&&t.getBoundingClientRect().width>0)return;window.setCartDivVisibility()}catch(t){}},350),!0}var se={};C(se,{addToCart:()=>xo,cartUrl:()=>go,detect:()=>wo,getCartSummary:()=>bo,id:()=>ho,openCartDrawer:()=>_o,skipRedirect:()=>yo});var ce="/api/v2/front",le={"Content-Type":"application/json",Accept:"application/json","App-Token":"wapstore"},ur=t=>String(t==null?"":t).trim().toLowerCase(),ho="wapstore",yo=!0,go="/checkout/carrinho";function wo(){try{if(document.querySelector('script[src*="/tema/"][src*="/dist/assets/"]')||/(?:^|;\s*)produto\/visitado=/.test(document.cookie))return!0}catch(t){}return!1}function dr(t){if(!t||typeof t!="object")return null;let e=t.subtotal&&t.subtotal.valor;return e==null?null:{value:e,itemCount:t.quantidadeItens!=null?t.quantidadeItens:null,currency:"BRL"}}async function xo({size:t,quantity:e}){let r=await fetch(ce+"/url/product/detail?url="+encodeURIComponent(location.pathname),{headers:le}).then(f=>f.json()),n=(r&&(r.produto||r.data||r)||{}).conteudo||{},o=n.atributos&&n.atributos.simples&&n.atributos.simples.valores||[];if(!o.length)throw new Error("wapstore: sem variante de compra (atributos.simples)");let i=t?o.find(f=>ur(f.label)===ur(t)):null;i=i||o.find(f=>f.selecionado)||o.find(f=>(f.estoque||0)>0)||o[0];let a=i&&i.carrinho;if(!a||!a.itens||!a.itens.length)throw new Error("wapstore: variante sem payload de carrinho");let c=a.itens.map(f=>Object.assign({},f,{quantidade:String(e||f.quantidade||1)})),l=await fetch(ce+"/checkout/cart",{method:"POST",headers:le,body:JSON.stringify({itens:c,tipo:a.tipo||"produto"})});if(!l.ok)throw new Error("wapstore: add HTTP "+l.status);let u=await l.json().catch(()=>({})),s=dr(u),d={platform:"wapstore",idProduto:c[0]&&c[0].idProduto,size:i&&i.label||null};return s&&(d.cartValue=s.value,d.itemCount=s.itemCount,d.currency=s.currency),d}async function bo(){try{let t=await fetch(ce+"/checkout/cart",{headers:le}).then(e=>e.json());return dr(t)}catch(t){}return null}function _o(){try{let t=document.querySelector(".common-sheet.side-cart, .side-cart");if(t&&t.getBoundingClientRect().width>0)return!0;let e=document.querySelector('.button-cart, [class*="button-cart"]');if(e)return e.click(),!0}catch(t){}return!1}var ue={};C(ue,{addToCart:()=>Io,detect:()=>So,getCartSummary:()=>Lo,id:()=>vo,openCartDrawer:()=>Ro,resolveSku:()=>To,skipRedirect:()=>Co});var fr=t=>String(t==null?"":t).trim().toLowerCase(),vo="linx",Co=!0;function ko(t){if(t==null)return null;let e=String(t).match(/([\d.]+,\d{2}|\d+(?:\.\d{2})?)/),r=(e?e[1]:String(t)).replace(/[^\d.,]/g,"");if(!r)return null;let n=r.indexOf(",")>r.indexOf(".")?parseFloat(r.replace(/\./g,"").replace(",",".")):parseFloat(r.replace(/,/g,""));return Number.isFinite(n)&&n>0?n:null}function So(){return typeof window.carrinhoLateral=="function"&&typeof window.addToCart=="function"}function To(){try{let t=(location.pathname.match(/-p(\d+)\/?(?:[?#]|$)/)||[])[1];if(t)return{value:t,source:"linx/url-pid"};let e=(String(document.body.className||"").match(/context-product-(\d+)/)||[])[1];if(e)return{value:e,source:"linx/context"}}catch(t){}return null}function Ao(){let t=[...document.querySelectorAll('.add-to-cart, [data-action="add-to-cart"]')];return t.find(e=>{let r=e.getBoundingClientRect();return r.width>0&&r.height>0})||t[0]||null}function Eo(t){if(t==null||t==="")return!1;let e=fr(t),r=e.replace(/\D/g,""),n=[...document.querySelectorAll('input[type="radio"]')].filter(i=>/aro|tamanho|grade|numera|size|variant/i.test(i.name||i.id||"")),o=n.find(i=>fr(i.value)===e)||(r?n.find(i=>String(i.value).replace(/\D/g,"")===r):null);if(!o)return!1;try{o.checked||(o.checked=!0),(o.labels&&o.labels[0]||null||o).click(),o.dispatchEvent(new Event("change",{bubbles:!0}))}catch(i){}return!0}async function Io(t){t=t||{};let e=Ao();if(!e)throw new Error("linx: bot\xE3o .add-to-cart n\xE3o encontrado");return t.size!=null&&t.size!==""&&(Eo(t.size),await new Promise(r=>setTimeout(r,1100))),e.click(),await new Promise(r=>setTimeout(r,1400)),{platform:"linx"}}function Lo(){try{let t=document.querySelector("#mini-cart");if(!t)return null;let e=null;for(let n of t.querySelectorAll("div,span,p,li,strong,b,td")){if(n.children.length>2)continue;let o=(n.textContent||"").replace(/\s+/g," ").trim();if(/^(sub)?total\b/i.test(o)&&/R\$/.test(o)&&(e=ko(o),e))break}if(e==null)return null;let r=(t.textContent||"").match(/cont[ée]m\s+(\d+)\s+ite/i);return{value:e,itemCount:r?parseInt(r[1],10):null,currency:"BRL"}}catch(t){}return null}function Ro(){try{let e=typeof window.carrinhoLateral=="function"?window.carrinhoLateral():null;if(e&&typeof e.openCart=="function"){try{typeof e.fetchHTML=="function"&&e.fetchHTML()}catch(r){}return setTimeout(()=>{try{e.openCart()}catch(r){}},400),!0}}catch(e){}let t=document.querySelector("#mini-cart");if(t){try{t.classList.add("open")}catch(e){}return!0}return!1}var fe={};C(fe,{addToCart:()=>q,detect:()=>Po,id:()=>Mo,resolveSku:()=>de});var Mo="generic";function Po(){return!0}function de(){let t=I(["Product"]);if(t[0]){let e=t[0],r=e.sku||e.mpn||e.gtin13||e.productID;if(r)return{value:String(r),source:"jsonld"}}try{let e=document.querySelector('[itemprop="sku"]');if(e){let r=e.getAttribute("content")||(e.textContent||"").trim();if(r)return{value:String(r),source:"microdata"}}}catch(e){}try{let e=window.konfidencyData;if(e&&e.product&&e.product.variants&&e.product.variants[0])return{value:String(e.product.variants[0]),source:"konfidency"}}catch(e){}return null}var jo=/(adicionar\s*(à|a|ao)?\s*(sacola|carrinho|cesta|bolsa))|adicionar ao carrinho|add to (cart|bag)|comprar agora/i,Oo=/continuar|como comprar|lista|desejos|favorito/i;async function q(){let t=document.querySelectorAll("button,[role=button],input[type=submit]");for(let e of t){let r=(e.textContent||e.value||"").replace(/\s+/g," ").trim();if(r&&r.length<40&&jo.test(r)&&!Oo.test(r))try{return e.click(),{platform:"native-click",clicked:r}}catch(n){}}return{platform:"none",error:"bot\xE3o de carrinho nativo n\xE3o encontrado"}}var pr=[te,_t,re,oe,ie,ae,se,ue],Bo=[["woocommerce",()=>!!(window.wc_add_to_cart_params||window.woocommerce_params)],["lojaintegrada",()=>!!window.LojaIntegrada]],pe;function D(){if(pe)return pe;let t=pr.find(e=>{try{return e.detect()}catch(r){return!1}});return t&&(pe=t),t||fe}function mr(){let t=pr.find(e=>{try{return e.detect()}catch(r){return!1}});if(t)return t.id;for(let[e,r]of Bo)try{if(r())return e}catch(n){}return null}function G(){let t=D();if(t.id!=="generic"&&t.resolveSku){try{let e=t.resolveSku();if(e)return e}catch(e){}if(t.id==="vtex"&&window.__RUNTIME__)return{value:null,source:"vtex/pending"}}return de()}function hr(t){return t=t||{},{size:t.size||t.selectedSize||t.tamanho||t.aro||t.ringSize||null,color:t.color||t.selectedColor||t.colour||t.cor||null,sku:t.sku||t.identifier||t.selectedIdentifier||null,quantity:t.quantity||1,productId:t.productId||null}}async function yr(t){if(t=t||{},Array.isArray(t.items)&&t.items.length)return No(t.items);let e=hr(t),r=D();try{let n=r.addToCart?await r.addToCart(e):await q(e);return w("cart: adicionado",n),St(),me(r,n,e.sku),n}catch(n){w('cart: adapter "'+r.id+'" falhou \u2014 fallback clique nativo',n&&n.message);let o=await q(e);return St(),me(r,o,e.sku),o}}async function No(t){let e=t.map(hr),r=D(),n=null;try{if(r.addToCartBatch)n=await r.addToCartBatch(e);else for(let o of e)try{n=r.addToCart?await r.addToCart(o):await q(o)}catch(i){}}catch(o){w('cart: batch do adapter "'+r.id+'" falhou \u2014 fallback',o&&o.message);for(let i of e)try{n=await q(i)}catch(a){}}return w("cart: "+e.length+" itens adicionados",n),St(),me(r,n,null),n}async function me(t,e,r){try{let n=null;e&&e.cartValue!=null?n={value:e.cartValue,itemCount:e.itemCount!=null?e.itemCount:null,currency:e.currency||null}:t&&t.getCartSummary&&(n=await t.getCartSummary()),n&&n.value!=null&&(n.value>0||(n.itemCount||0)>0)&&m("cart_value",{via:"tryon",value:n.value,itemCount:n.itemCount!=null?n.itemCount:null,currency:n.currency||null,sku:r||null})}catch(n){}}async function he(){let t=D();if(t&&t.getCartSummary)try{return await t.getCartSummary()}catch(e){}return null}async function gr(t){t=t||{};let e=D(),r={platform:e.id};try{let n=G();r.sku=n&&n.value||null;let o={size:t.size||null,color:t.color||null,sku:r.sku,quantity:t.quantity||1};r.added=e.addToCart?await e.addToCart(o):await q(o),St();try{await ye()}catch(i){}r.cart=await he(),r.ok=!0}catch(n){r.ok=!1,r.error=n&&n.message||String(n)}return r}function St(){["cart:refresh","cart:updated","cart:build","ajaxProduct:added","product:added-to-cart"].forEach(t=>{try{document.dispatchEvent(new CustomEvent(t))}catch(e){}})}async function ye(t){if(t&&t.drawerHandled)return!1;let e=D(),r=y(),n=null;try{n=await J()}catch(a){}let o=n&&n.template&&n.template.cart||n&&n.cart||{},i=o.afterAdd||o.behavior||r.cartBehavior;if(i||(i=r.cartRedirect===!1?"none":"auto"),i==="none")return!1;if(i==="auto"||i==="drawer"){let a=o.openSelector||r.cartOpenSelector;if(a){let c=document.querySelector(a);if(c)return setTimeout(()=>{try{c.click()}catch(l){}},300),!1}else if(e&&e.openCartDrawer){let c=!1;try{c=e.openCartDrawer()}catch(l){}if(c)return!1}}return!0}function wr(){let t=D();if(t&&t.skipRedirect)return;let e=t&&t.cartUrl||"/cart";setTimeout(()=>{try{window.location.href=e}catch(r){}},250)}var qo=/\/(thank[_-]?you|orders?\/|pedido[_-]?(confirmado|realizado|finalizado|sucesso)|sucesso|order[_-]?confirmation|compra[_-]?(finalizada|concluida)|orderplaced|checkout\/[^?#]*success)/i,Do=/\/(my[_-]?account|minha[_-]?conta|account|conta|customer|cliente|profile|perfil|wishlist|favoritos)(\/|$)/i,zo=/\/checkout/i,Uo=/\/(cart|carrinho|sacola|bag|comprar)(\/|$|\?|#)/i,xr=/\/(products?|produtos?|p)(\/|$|\?|#)/i,Fo=/\/(collections?|categoria|categorias|c|departamento)\//i,Ko=/\/(search|busca|s)(\/|\?)/i;function br(){try{if(window.__mkPageType)return window.__mkPageType}catch(r){}let t=(location.pathname||"").toLowerCase(),e=Do.test(t);try{let r=I(),n=0,o=!1,i=!1;for(let a of r){let c=Array.isArray(a["@type"])?a["@type"]:[a["@type"]];if((c.includes("Order")||c.includes("Invoice"))&&!e)return"purchase";c.includes("SearchResultsPage")&&(o=!0),(c.includes("CollectionPage")||c.includes("ItemList"))&&(i=!0),c.includes("Product")&&n++}if(o)return"search";if(i)return"category";if(n===1)return"pdp";if(n>1)return xr.test(t)?"pdp":"category"}catch(r){}return t==="/"||t===""||t==="/home"||t==="/index.html"?"home":qo.test(t)&&!e?"purchase":zo.test(t)?"checkout":Uo.test(t)?"cart":xr.test(t)?"pdp":Fo.test(t)?"category":Ko.test(t)?"search":"other"}function _r(t){let e=null;try{let r=new URLSearchParams(location.search),n=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],o={};for(let i of n){let a=r.get(i);a&&(o[i.replace("utm_","")]=a)}Object.keys(o).length&&(e=o)}catch(r){}return{url:location.href,pathname:location.pathname,referrer:document.referrer||null,title:document.title||null,pageType:t,utm:e,userAgent:navigator.userAgent,language:navigator.language,viewport:window.innerWidth+"x"+window.innerHeight,platform:$o()}}function $o(){return mr()}var ge={},Ho=null,it=0,vr=!1;function Cr(t){vr||(vr=!0,kr(t),Vo(),Wo(),Jo(),Go(),Xo(t))}function kr(t){ge={};let e=br(),r=_r(e);if(Je(r),m("view",{url:location.href,pathname:location.pathname,referrer:document.referrer||null,title:document.title||null,pageType:e}),typeof t=="function")try{t(e,r)}catch(n){}}function Vo(){if(!document.body)return;let t={A:1,BUTTON:1,INPUT:1,SELECT:1,TEXTAREA:1},e=0;document.body.addEventListener("click",r=>{try{let n=Date.now();if(n-e<100)return;e=n;let o=r.target;for(let c=0;c<5&&o&&o!==document.body&&!(t[o.tagName]||o.getAttribute&&o.getAttribute("role")==="button");c++)o=o.parentElement;if(!o||!t[o.tagName]&&!(o.getAttribute&&o.getAttribute("role")==="button"))return;let i={tag:o.tagName},a=o.tagName==="INPUT"||o.tagName==="TEXTAREA"?o.value:o.textContent;i.text=(a||"").replace(/\s+/g," ").trim().substring(0,100),o.href&&(i.href=String(o.href).substring(0,500)),o.id&&(i.id=o.id),o.className&&typeof o.className=="string"&&(i.classes=o.className.trim().substring(0,200)),m("click",i)}catch(n){}},{capture:!0,passive:!0})}function Wo(){let t=[25,50,75,100],e=null,r=()=>{try{let n=window.scrollY||document.documentElement.scrollTop||0,o=Math.max(document.body&&document.body.scrollHeight||0,document.documentElement&&document.documentElement.scrollHeight||0);if(o<=0)return;let i=Math.min(100,Math.floor((n+window.innerHeight)/o*100));for(let a of t)i>=a&&!ge[a]&&(ge[a]=!0,m("scroll_depth",{depth:a}))}catch(n){}};r(),window.addEventListener("scroll",()=>{e||(e=setTimeout(()=>{e=null,r()},250))},{passive:!0})}function Jo(){document.body&&document.body.addEventListener("submit",t=>{try{let e=t.target;if(!e||e.tagName!=="FORM"||e.querySelector('input[type="password"], input[name*="card"], input[name*="cpf"]'))return;let r="other",n=(e.className||"").toLowerCase(),o=(e.action||"").toLowerCase();e.querySelector('input[type="search"], input[name="q"], input[name="s"]')?r="search":/newsletter|subscribe|mailchimp/.test(n+o)?r="newsletter":/contact|contato/.test(n+o)&&(r="contact"),m("form_submit",{form_id:e.id||"",form_type:r})}catch(e){}},{capture:!0})}function Go(){let t=y();it=Date.now(),Ho=setInterval(()=>{if(document.hidden)return;let e=Date.now(),r=Math.round((e-it)/1e3);it=e,r>0&&r<60&&m("engagement",{url:location.pathname,dwellSec:r})},t.engagementIntervalMs),document.addEventListener("visibilitychange",()=>{if(document.hidden){let e=Math.round((Date.now()-it)/1e3);e>0&&e<600&&m("engagement",{url:location.pathname,dwellSec:e})}it=Date.now()})}function Xo(t){let e=location.href,r=()=>{location.href!==e&&(e=location.href,kr(t))};try{let n=history.pushState,o=history.replaceState;history.pushState=function(){n.apply(this,arguments),setTimeout(r,0)},history.replaceState=function(){o.apply(this,arguments),setTimeout(r,0)},window.addEventListener("popstate",r),window.addEventListener("hashchange",r)}catch(n){}}function xe(){let t=G(),e=I(["Product"]);if(e.length>0){let o=e[0],i=Array.isArray(o.offers)?o.offers[0]:o.offers;return{sku:t?t.value:o.sku||o.mpn||o.gtin13||o.productID||null,skuSource:t?t.source:null,name:typeof o.name=="string"?o.name:null,price:i&&parseFloat(i.price||i.lowPrice)||null||Sr(),currency:i?i.priceCurrency:null,brand:o.brand?typeof o.brand=="string"?o.brand:o.brand.name:null,category:o.category||null}}let r=o=>{let i=document.querySelector('meta[property="og:'+o+'"], meta[property="product:'+o+'"]');return i?i.getAttribute("content"):null},n=o=>{let i=document.querySelector('[itemprop="'+o+'"]');return i?i.getAttribute("content")||(i.textContent||"").trim():null};if(t||r("type")==="product"||r("price:amount")||n("name")){let o=n("price")||r("price:amount"),i=o&&parseFloat(String(o).replace(",","."))||null;return{sku:t?t.value:null,skuSource:t?t.source:null,name:n("name")||r("title")||document.title||null,price:(i&&i>0?i:null)||Sr(),currency:n("priceCurrency")||r("price:currency")||null,brand:n("brand")||null,category:null}}return null}function Sr(){try{let t=window.dataLayer;if(!Array.isArray(t))return null;for(let e=t.length-1;e>=0;e--){let r=t[e];if(!r||typeof r!="object")continue;let n=r.ecommerce||r,o=n&&n.items||null,i=n&&n.detail&&n.detail.products||n&&n.products||r.products||null,a=Array.isArray(o)&&o[0]&&o[0].price||Array.isArray(i)&&i[0]&&i[0].price||null,c=we(a!=null?String(a):"");if(c)return c}}catch(t){}return null}function L(){try{let t=location.pathname+location.search,e=t.match(/order[_-]?confirmation\/([\w-]+)/i)||t.match(/[?&]order[_-]?id=([\w-]+)/i)||t.match(/\/orders?\/([\w-]{4,})/i)||t.match(/pedido[_-]?(?:confirmado|realizado|finalizado)?\/([\w-]+)/i);return e?e[1]:null}catch(t){return null}}function Tt(){let t=I(["Order","Invoice"]);if(t.length>0){let o=t[0],i=o.totalPaymentDue?parseFloat(o.totalPaymentDue.price):parseFloat(o.price||o.total);return{orderId:o.orderNumber||o.confirmationNumber||o.identifier||L(),revenue:Number.isFinite(i)?i:null,currency:o.totalPaymentDue&&o.totalPaymentDue.priceCurrency||o.priceCurrency||null,source:"jsonld"}}try{let o=window.Shopify&&window.Shopify.checkout;if(o&&o.total_price!=null){let i=parseFloat(o.total_price);return{orderId:(o.order_id!=null?String(o.order_id):null)||o.token||L(),revenue:Number.isFinite(i)?i:null,currency:o.currency||null,itemCount:Array.isArray(o.line_items)?o.line_items.length:null,source:"shopify"}}}catch(o){}try{let o=window.LS&&window.LS.order;if(o&&o.total!=null){let i=Number(o.total),a=window.LS.currency&&window.LS.currency.code||"BRL";return{orderId:String(o.number||o.id||L()||""),revenue:Number.isFinite(i)?i/100:null,currency:a,source:"nuvemshop"}}}catch(o){}try{if(Array.isArray(window.dataLayer))for(let o=window.dataLayer.length-1;o>=0;o--){let i=window.dataLayer[o],a=i&&i.ecommerce||i&&i.ecommerce_data&&i.ecommerce_data.ecommerce;if(a&&(i.event==="purchase"||a.purchase||a.transaction_id)){let c=a.purchase&&a.purchase.actionField,l=parseFloat(c&&(c.revenue||c.value)||a.value||a.revenue);return{orderId:c&&(c.id||c.transaction_id)||a.transaction_id||a.transactionId||L(),revenue:Number.isFinite(l)?l:null,currency:a.currency||a.currencyCode||c&&c.currency||null,itemCount:(a.purchase&&a.purchase.products||a.items||a.products||[]).length||null,source:"datalayer"}}}}catch(o){}let e=document.querySelector('meta[property="order:total"], meta[name="order-total"]');if(e&&e.content)return{orderId:L(),revenue:parseFloat(e.content)||null,source:"meta"};let r=Yo();if(r)return r;let n=L();return n?{orderId:n,revenue:null,source:"url"}:null}function Yo(){try{let t=document.querySelector(".orderTotalPrice");if(t){let r=String(t.value||t.getAttribute("value")||t.textContent||"").trim(),n=r.split(/\s+/),o=we(n.length>1?n[n.length-1]:r);if(o)return{orderId:Tr(),revenue:o,currency:(n.length>1?n[0]:null)||null,source:"dom"}}let e=[".order-total","#order-total",".total-price",".order__total","[data-order-total]",".summary-total",".grand-total"];for(let r of e){let n=document.querySelector(r);if(n){let o=we(n.value||n.textContent);if(o)return{orderId:Tr(),revenue:o,source:"dom"}}}return null}catch(t){return null}}function Tr(){try{let t=document.querySelector(".orderID");if(t&&(t.value||t.getAttribute("value")))return t.value||t.getAttribute("value");let r=(document.body.innerText||"").match(/(?:pedido|order|n[º°o]\.?)\s*#?\s*([A-Z0-9-]{4,})/i);return r?r[1]:null}catch(t){return null}}function we(t){if(!t)return null;let e=String(t).replace(/[^\d.,]/g,"");if(!e)return null;let r;e.indexOf(",")>e.indexOf(".")?r=e.replace(/\./g,"").replace(",","."):r=e.replace(/,/g,"");let n=parseFloat(r);return Number.isFinite(n)&&n>0?n:null}function Ar(){let t=I(["ItemList","CollectionPage"]);if(t.length===0)return null;let e=t[0],r=e.itemListElement||e.mainEntity&&e.mainEntity.itemListElement||[],n=[];for(let o of r.slice(0,50)){let i=o.item||o;i&&(i.sku||i.productID||i.name)&&n.push(i.sku||i.productID||i.name)}return n.length>0?{count:n.length,skus:n.slice(0,20)}:null}var Et=!1,At=[/\b(adicionar|adic\.?|colocar|incluir|jogar)\b.{0,30}\b(carrinho|sacola|sacolinha|bag)\b/i,/\bcomprar\b(?!\s+(em|por|sem))/i,/\bcomprar\s*$/i,/^add\s+to\s+(cart|bag)\b/i,/^buy\s+(now|it|this)\b/i,/^(sacolinha|carrinho|sacola)$/i],Zo=[/^finalizar(\s+(compra|pedido|pagamento))?\b/i,/^(fechar|confirmar)\s+(compra|pedido|pagamento)\b/i,/^pagar(\s+(agora|pedido))?\b/i,/^(complete|place)\s+(purchase|order)\b/i,/^checkout$/i];function at(t,e){for(let r=0;r<t.length;r++)if(t[r].test(e))return!0;return!1}function Rr(t){switch(t){case"pdp":{let e=xe();m("view_item",e||{sku:null});break}case"category":case"search":{let e=Ar();m("view_item_list",e||{count:0});break}case"cart":he().then(e=>m("view_cart",e&&e.value!=null?{value:e.value,itemCount:e.itemCount,currency:e.currency}:{})).catch(()=>m("view_cart",{}));break;case"checkout":m("begin_checkout",{});break;case"purchase":Qo();break}}var Er=500,Ir=30;function Qo(){let t=!1,e=0,r=(o,i)=>{t||(t=!0,Mr(o,i))};try{window.addEventListener("pagehide",()=>r(Tt(),!0),{once:!0})}catch(o){}let n=()=>{if(t)return;let o=Tt();if(o&&o.revenue!=null)return r(o);if(e++>=Ir)return w("purchase: receita n\xE3o apareceu em "+Er*Ir+"ms \u2014 emitindo sem valor"),r(o);setTimeout(n,Er)};n()}function Mr(t,e){if(!Et){if(t&&!t.orderId&&(t.orderId=L()),t&&t.orderId){let r="_mk_purch_"+t.orderId;try{if(sessionStorage.getItem(r)){w("purchase j\xE1 contado",t.orderId);return}sessionStorage.setItem(r,"1")}catch(n){}}if(Et=!0,m("purchase",t||{revenue:null,_note:"no_order_data_extracted"}),w("purchase emitido",t),e)try{B(!0)}catch(r){}}}var Lr=!1;function Pr(){if(Lr)return;Lr=!0;let t=r=>{try{if(!r||typeof r!="object")return!1;let n=r.ecommerce||r.ecommerce_data&&r.ecommerce_data.ecommerce;return n?r.event==="purchase"||r.event==="transaction"||!!n.purchase||n.transaction_id!=null:!1}catch(n){return!1}},e=r=>{Et||!t(r)||setTimeout(()=>{if(!Et)try{Mr(Tt(),!0)}catch(n){}},0)};try{let r=window.dataLayer=window.dataLayer||[];for(let o=0;o<r.length;o++)e(r[o]);let n=r.push;r.push=function(){let o=n.apply(this,arguments);try{for(let i=0;i<arguments.length;i++)e(arguments[i])}catch(i){}return o}}catch(r){}}function jr(){if(!document.body)return;let t=0;document.body.addEventListener("click",e=>{try{let r=Date.now();if(r-t<150)return;let n=e.target;for(let c=0;c<5&&n&&n!==document.body&&!(n.tagName==="BUTTON"||n.tagName==="A"||n.getAttribute&&n.getAttribute("role")==="button");c++)n=n.parentElement;if(!n)return;let o=n.tagName!=="A",i=(n.textContent||"").replace(/\s+/g," ").trim();if(!i||i.length>80)return;let a=!1;if((at([At[0]],i)||o&&at([At[1]],i)||o&&at([At[2]],i)||at(At.slice(3),i))&&(a=!0),a){t=r;let c=xe();m("add_to_cart",{via:"click",buttonText:i,sku:c?c.sku:null,price:c?c.price:null});return}o&&at(Zo,i)&&(t=r,m("begin_checkout",{via:"click",buttonText:i}))}catch(r){}},{capture:!0,passive:!0})}var It={};C(It,{available:()=>ni,id:()=>ti,iframeSrc:()=>ri,modalSize:()=>ei,onMounted:()=>oi});var ti="mk-fashion",ei={width:430,height:800};function ri(t,e){let r=encodeURIComponent(e).replace(/\./g,"%2E");return y().appUrl+"/"+t+"/"+r}async function ni(t,e){let r=y().apiUrl+"/availability/"+t+"?sku="+encodeURIComponent(e),n=await fetch(r);if(!n.ok)throw new Error("availability HTTP "+n.status);return n.json()}function oi(){}var be={};C(be,{available:()=>di,closeButton:()=>li,id:()=>ii,iframeSrc:()=>ui,modalSize:()=>ai,modalSizeMobile:()=>ci,onMounted:()=>mi});var ii="mk-makeup",ai={width:"80vw",height:"80vh"},ci={width:"100vw",height:"100dvh"},li=!0;function si(){return window.__MK&&window.__MK.pulpoarUrl||"https://plugin.pulpoar.com/vto"}function ui(t,e){let r=window.__MK&&window.__MK.pulpoarIframeUrl;if(r){let o=String(r);return e!=null&&/\{sku\}|\{identifier\}/.test(o)&&(o=o.replace(/\{sku\}|\{identifier\}/g,encodeURIComponent(e))),o}let n=window.__MK&&window.__MK.pulpoarProjectKey||t;return si()+"/"+encodeURIComponent(n)}async function di(t,e){let r=window.__MK&&window.__MK.pulpoarProjectKey||t;if(!r)return{available:!0};let n=await Br(e)||e;if(!n)return{available:!0};try{let i=String(y().collectorUrl||"").replace(/\/+$/,"")+"/v1/makeup/availability/"+encodeURIComponent(r)+"?slug="+encodeURIComponent(n);t&&(i+="&projectId="+encodeURIComponent(t));let a=await fetch(i).then(c=>c.json());return w("pulpoar availability",a),{available:!(a&&(a.available===!1||a.projectActive===!1))}}catch(o){return w("pulpoar availability erro",o&&o.message),{available:!0}}}var fi="https://cdn.jsdelivr.net/npm/@pulpoar/plugin-sdk@latest/dist/index.iife.js",Lt=null;function pi(){return window.pulpoar?Promise.resolve(window.pulpoar):Lt||(Lt=new Promise(t=>{try{let e=document.createElement("script");e.src=fi,e.async=!0,e.onload=()=>t(window.pulpoar||null),e.onerror=()=>t(null),(document.head||document.documentElement).appendChild(e)}catch(e){t(null)}}),Lt)}async function Br(t){try{if(window.Shopify||window.ShopifyAnalytics){let e=(location.pathname.split("/products/")[1]||"").split(/[?#]/)[0];if(e){let r=window.ShopifyAnalytics&&window.ShopifyAnalytics.meta,n=new URLSearchParams(location.search).get("variant")||r&&r.selectedVariantId,i=(await fetch("/products/"+e+".js").then(l=>l.json())).variants||[],a=n?i.find(l=>String(l.id)===String(n)):null;if(a&&a.sku)return a.sku;let c=i.find(l=>l.available)||i[0];if(c&&c.sku)return c.sku}}}catch(e){}return t||null}function Or(t){return!t||typeof t!="object"?{quantity:1}:{sku:t.sku||t.slug||t.key||t.variant_key||t.barcode||null,color:t.color||t.shade||t.colorName||null,size:t.size||null,quantity:1}}function mi(t,e){pi().then(async r=>{if(!r){w("pulpoar: SDK n\xE3o carregou");return}let n=await Br(e.identifier);if(w("pulpoar variante p/ cat\xE1logo",n),n)try{r.applyVariantsWithCatalog([String(n)],o=>{e.track("product_loaded",{via:"makeup",applied:Array.isArray(o)?o.length:0})})}catch(o){w("pulpoar applyVariantsWithCatalog falhou",o&&o.message)}try{r.onReady(()=>e.fire("onReady",{}))}catch(o){}try{r.onAddToCart(o=>{let i=(Array.isArray(o)?o:[o]).filter(a=>a&&typeof a=="object");if(w("pulpoar onAddToCart",i.length+" item(s)",i),i.length<=1){e.handleAddToCart(i.length?Or(i[0]):{quantity:1},"makeup");return}e.handleAddToCart({items:i.map(Or)},"makeup")})}catch(o){}try{r.onGoToProduct(o=>e.fire("onGoToProduct",o))}catch(o){}})}var hi={"mk-fashion":It,"mk-makeup":be};function Rt(t){return hi[t]||It}var E=null,A=null,Pt=!1,jt=!1,M=null,Nr={},_e=null,Mt=0,S={onReady:null,onClose:null,onAddToCart:null,onProductLoaded:null,onError:null,onInteraction:null,onGenerationComplete:null},yi={gregory:"698c7e791d3129430f15dddd"};function Dr(t){return t?yi[String(t).toLowerCase()]||t:null}async function z(t,e){let r=Dr(t),n=String(e||"").trim();return Rt(y().product).available(r,n)}async function zr(t,e){e||(e=t,t="698c7e791d3129430f15dddd");try{return(await z(t,e)).available===!0}catch(r){return!1}}async function ct(t){if(t=t||{},Pt)return;let e=Dr(t.projectId||t.projectid||t.store),r=String(t.identifier||t.sku||"").trim();if(!e||!r){console.error("[mk-sdk] open: projectId e identifier obrigatorios");return}let n=e+":"+r;if(Nr[n]!==!0){try{if(!(await z(e,r)).available){alert("Produto nao disponivel para prova virtual.");return}}catch(u){alert("Produto nao encontrado ou indisponivel.");return}Nr[n]=!0}let o=Rt(y().product),a=(window.innerWidth||0)<=768&&o.modalSizeMobile||o.modalSize||{width:430,height:800},c=y(),l=nt();M={projectId:e,identifier:r,width:t.width||l.modalWidth||c.modalWidth||a.width,height:t.height||l.modalHeight||c.modalHeight||a.height},jt=!1,Kr(),gi(M),Pt=!0,Mt=Date.now(),m("modal_opened",{projectId:e,identifier:r})}function Ot(){if(!Pt)return;let t=jt;if(jt=!1,wi(),Pt=!1,R("onClose"),m("modal_closed",{projectId:M&&M.projectId,identifier:M&&M.identifier}),t)try{wr()}catch(e){}}function Ur(t){try{Zr().forEach(e=>{t?(e.dataset.mkPrevDisplay===void 0&&(e.dataset.mkPrevDisplay=e.style.display),e.style.display="none"):(e.style.display=e.dataset.mkPrevDisplay||"",delete e.dataset.mkPrevDisplay)})}catch(e){}}function gi(t){E=document.createElement("div"),E.style.cssText="position:fixed;inset:0;background:rgba(0,0,0,.8);display:flex;align-items:center;justify-content:center;z-index:2147483647;",Ur(!0);let e=document.createElement("div"),r=typeof t.width=="number"?t.width+"px":t.width,n=typeof t.height=="number"?t.height+"px":t.height,o=String(t.width).indexOf("100v")>=0;e.style.cssText="position:relative;width:"+r+";height:"+n+";max-width:100vw;max-height:100dvh;border-radius:"+(o?"0":"12px")+";overflow:hidden;background:#fff;",A=document.createElement("iframe");let i=Rt(y().product);if(A.src=i.iframeSrc(t.projectId,t.identifier),A.style.cssText="width:100%;height:100%;border:none;",A.setAttribute("allow","camera *; microphone *"),A.setAttribute("allowfullscreen","true"),e.appendChild(A),i.closeButton){let a=document.createElement("button");a.setAttribute("aria-label","Fechar"),a.setAttribute("type","button"),a.innerHTML='<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true"><path d="M1.6 1.6l10.8 10.8M12.4 1.6L1.6 12.4" stroke="#111" stroke-width="2" stroke-linecap="round"/></svg>',a.style.cssText="position:absolute;top:8px;right:8px;z-index:2;width:32px;height:32px;padding:0;border:none;border-radius:50%;background:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 1px 5px rgba(0,0,0,.3);",a.addEventListener("click",()=>{try{Ot()}catch(c){}}),e.appendChild(a)}E.appendChild(e),document.body.appendChild(E);try{i.onMounted(A,{projectId:t.projectId,identifier:t.identifier,handleAddToCart:$r,track:m,fire:R})}catch(a){w("launcher.onMounted falhou",a&&a.message)}w("try-on modal aberto",A.src)}function wi(){E&&E.parentNode&&E.parentNode.removeChild(E),E=null,A=null,Ur(!1)}var qr=!1;function Fr(){Kr()}function Kr(){qr||(qr=!0,window.addEventListener("message",t=>{let e=t.data;if(!e||e.source!=="mkfashion-app")return;let r=e.action,n=e.data||{};switch(r){case"close_request":Ot();break;case"ready":R("onReady",n);break;case"product_loaded":R("onProductLoaded",n),m("product_loaded",ve(n));break;case"interaction":{R("onInteraction",n),n&&n.method&&(_e=n.method),m(xi(n),ve(n));break}case"add_to_cart":$r(n,"tryon");break;case"generation_start":Mt=Date.now();break;case"generation_complete":R("onGenerationComplete",n),m("generation_complete",{method:n.method||_e||"unknown",durationMs:Mt?Date.now()-Mt:null,success:n.success!==!1,imageUrlPresent:!!n.imageUrl});break;case"generation_error":R("onError",n),m("generation_error",{method:_e||"unknown",error:n&&n.error});break}}))}function $r(t,e){if(m("add_to_cart",Object.assign({via:e||"tryon"},ve(t))),typeof S.onAddToCart=="function"){R("onAddToCart",t);return}let r=Object.assign({productId:M&&M.identifier},t);yr(r).then(n=>ye(n)).then(n=>{jt=!!n}).catch(()=>{})}function xi(t){return t&&t.action,"interaction"}function ve(t){if(!t||typeof t!="object")return t;let e={};for(let r in t){if(r==="imageUrl"||r==="image"||r==="product"){r==="product"&&t[r]?(e.productSku=t[r].sku||null,e.productName=t[r].name||null):e[r+"Present"]=!!t[r];continue}e[r]=t[r]}return e}function R(t,e){if(typeof S[t]=="function")try{S[t](e)}catch(r){console.error("[mk-sdk]",r)}}function Hr(t){S.onReady=t}function Vr(t){S.onClose=t}function Wr(t){S.onAddToCart=t}function Jr(t){S.onProductLoaded=t}function Gr(t){S.onError=t}function Xr(t){S.onInteraction=t}function Yr(t){S.onGenerationComplete=t}var _i=767,vi=1024,Ci=/(adicionar\s*(à|a|ao)?\s*(sacola|carrinho|cesta|bolsa))|adicionar ao carrinho|add to (cart|bag)|comprar agora|^comprar$|finalizar compra|eu quero/i,ki=/continuar|como comprar|lista|desejos|favorito|looks|cupom/i;function Ce(t){try{let e=t.getBoundingClientRect();if(e.width<=0||e.height<=0)return!1;let r=getComputedStyle(t);return r.display!=="none"&&r.visibility!=="hidden"&&r.opacity!=="0"}catch(e){return!1}}function Si(t){if(!t)return!1;try{let e=document.querySelector(t);return!!e&&Ce(e)}catch(e){return!1}}function Ti(t){return(t.tagName==="INPUT"?t.value||"":t.textContent||"").replace(/\s+/g," ").trim()}function Ai(t){if(!t||typeof t!="object"||t.selector)return t;let e=!1;if(["mobile","tablet","desktop"].forEach(n=>{let o=t[n];o&&o.mkAnchor===1&&o.anchor&&typeof o.anchor=="object"&&(e=!0)}),!e)return t;let r={};return["mobile","tablet","desktop"].forEach(n=>{let o=t[n];if(o){if(o.selector){r[n]=o;return}if(o.mkAnchor===1&&o.anchor&&typeof o.anchor=="object"){let i=o.anchor[n]||o.anchor.desktop||o.anchor.mobile||o.anchor.tablet;i&&i.selector&&(r[n]=i)}}}),["bpMobile","bpTablet","breakpoint"].forEach(n=>{t[n]!=null&&(r[n]=t[n])}),r}function lt(t){if(!t||typeof t!="object")return null;if(t=Ai(t),t.selector)return t;let e=[["mobile",t.mobile],["tablet",t.tablet],["desktop",t.desktop]].filter(l=>l[1]&&l[1].selector);if(e.length===0)return null;if(e.length===1)return e[0][1];let r=e.filter(([,l])=>Si(l.selector));if(r.length===1)return r[0][1];let n=window.innerWidth||1024,o=Number(t.bpMobile)||Number(t.breakpoint)||_i,i=Number(t.bpTablet)||vi,a=l=>(e.find(u=>u[0]===l)||[])[1],c=n<=o?["mobile","tablet","desktop"]:n<=i?["tablet","desktop","mobile"]:["desktop","tablet","mobile"];for(let l of c){let u=a(l);if(u)return u}return e[0][1]}function Bt(t){let e=lt(t);if(e&&e.selector)try{let r=document.querySelector(e.selector);if(r&&Ce(r))return{el:r,position:e.position||"afterend",mode:e.mode||"flow",style:e.style||"",align:e.align||"top-left",selector:e.selector}}catch(r){}return null}function Qr(){let t=y(),e=Bt(t&&t.anchor);if(e)return e;let r=document.querySelectorAll('button, [role="button"], a.btn, a.button, input[type="submit"], input[type="button"]');for(let n of r){let o=Ti(n);if(!(!o||o.length>40)&&!ki.test(o)&&Ci.test(o)&&Ce(n))return{el:n,position:"afterend",mode:"flow",style:"",selector:null}}return null}var _="'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",ke={none:"0",sm:"4px",md:"8px",pill:"9999px"},Se={none:"0",sm:"4px",md:"8px",lg:"16px"},Ei='<svg viewBox="0 0 17.5263 20.6862" fill="none" xmlns="http://www.w3.org/2000/svg" style="display:block;width:100%;height:100%"><g><path d="M8.49995 12.1862C10.1568 12.1862 11.5 10.8431 11.5 9.18622C11.5 7.52936 10.1568 6.18622 8.49995 6.18622C6.8431 6.18622 5.49995 7.52936 5.49995 9.18622C5.49995 10.8431 6.8431 12.1862 8.49995 12.1862Z" stroke="currentColor" shape-rendering="crispEdges"/><path d="M0.5 9.11152C0.5 6.56953 0.5 5.29894 1.1099 4.38664C1.375 3.9902 1.71424 3.65088 2.10821 3.38809C2.6945 2.9958 3.42899 2.85564 4.55351 2.80588C5.09013 2.80588 5.55183 2.39949 5.65687 1.87284C5.73715 1.48708 5.94572 1.14138 6.24735 0.894155C6.54898 0.646934 6.92516 0.51336 7.31231 0.516006H9.9734C10.7779 0.516006 11.4709 1.08412 11.6288 1.87284C11.7339 2.39949 12.1956 2.80588 12.7322 2.80588C13.8559 2.85564 12.9129 4.67413 13.5 5.06559C13.8949 5.32932 15.1484 3.80355 15.5 4.02647C16.1099 4.93876 16.7857 6.56953 16.7857 9.11152C16.7857 11.6535 16.7857 12.9233 16.1758 13.8364C15.9107 14.2328 15.5715 14.5722 15.1775 14.835C14.2647 15.4445 12.9936 15.4445 10.4522 15.4445H6.83351C4.29213 15.4445 3.02103 15.4445 2.10821 14.835C1.71446 14.5718 1.3755 14.2322 1.11071 13.8356C0.933802 13.5672 0.803519 13.2698 0.725557 12.9564" stroke="currentColor" stroke-linecap="round"/><path d="M12.676 0.607931C12.9446 -0.178095 14.0307 -0.2019 14.3491 0.536515L14.3761 0.60838L14.7385 1.66839C14.8216 1.91149 14.9559 2.13395 15.1322 2.32076C15.3086 2.50757 15.5229 2.65439 15.7608 2.75131L15.8583 2.78769L16.9183 3.14971C17.7044 3.41831 17.7282 4.50437 16.9902 4.82283L16.9183 4.84978L15.8583 5.21225C15.6151 5.29526 15.3926 5.42947 15.2057 5.60582C15.0188 5.78218 14.8719 5.99657 14.7749 6.23453L14.7385 6.33155L14.3765 7.39201C14.1079 8.17803 13.0219 8.20184 12.7039 7.46387L12.676 7.39201L12.314 6.332C12.231 6.08881 12.0968 5.86627 11.9204 5.67938C11.744 5.49249 11.5297 5.3456 11.2917 5.24863L11.1947 5.21225L10.1347 4.85022C9.34817 4.58163 9.32437 3.49557 10.0628 3.17756L10.1347 3.14971L11.1947 2.78769C11.4378 2.70462 11.6602 2.57039 11.847 2.39404C12.0339 2.21769 12.1807 2.00333 12.2776 1.76541L12.314 1.66839L12.676 0.607931Z" fill="currentColor"/></g></svg>',en='<svg viewBox="0 0 11.6122 12.7248" fill="none" xmlns="http://www.w3.org/2000/svg" style="display:block;width:12px;height:12px"><path d="M4.09055 2.01133C4.43939 0.9905 5.84989 0.959583 6.26347 1.91858L6.29847 2.01192L6.76922 3.38858C6.8771 3.7043 7.05144 3.99321 7.28047 4.23583C7.5095 4.47845 7.7879 4.66912 8.09689 4.795L8.22347 4.84225L9.60014 5.31242C10.621 5.66125 10.6519 7.07175 9.69347 7.48533L9.60014 7.52033L8.22347 7.99108C7.90764 8.09889 7.61862 8.2732 7.3759 8.50223C7.13318 8.73127 6.94241 9.0097 6.81647 9.31875L6.76922 9.44475L6.29905 10.822C5.95022 11.8428 4.53972 11.8737 4.12672 10.9153L4.09055 10.822L3.62039 9.44533C3.51258 9.12951 3.33827 8.84048 3.10924 8.59776C2.8802 8.35504 2.60177 8.16427 2.29272 8.03833L2.16672 7.99108L0.790054 7.52092C-0.231363 7.17208 -0.26228 5.76158 0.69672 5.34858L0.790054 5.31242L2.16672 4.84225C2.48244 4.73437 2.77135 4.56003 3.01397 4.331C3.25658 4.10197 3.44726 3.82357 3.57314 3.51458L3.62039 3.38858L4.09055 2.01133ZM9.86147 0C9.9706 0 10.0775 0.0306123 10.1701 0.0883584C10.2627 0.146104 10.3373 0.228668 10.3853 0.326667L10.4133 0.394917L10.6175 0.993417L11.2166 1.19758C11.3259 1.23474 11.4218 1.30353 11.492 1.39523C11.5623 1.48693 11.6037 1.59741 11.611 1.71268C11.6184 1.82795 11.5914 1.94281 11.5334 2.04271C11.4755 2.14261 11.3891 2.22305 11.2854 2.27383L11.2166 2.30183L10.6181 2.506L10.4139 3.10508C10.3767 3.21442 10.3078 3.31024 10.2161 3.38041C10.1244 3.45058 10.0139 3.49194 9.89859 3.49925C9.78333 3.50656 9.66849 3.47949 9.56863 3.42147C9.46876 3.36345 9.38837 3.27709 9.33764 3.17333L9.30964 3.10508L9.10547 2.50658L8.50639 2.30242C8.39702 2.26526 8.30115 2.19647 8.23092 2.10477C8.16069 2.01307 8.11926 1.90259 8.11189 1.78732C8.10452 1.67205 8.13153 1.55719 8.18951 1.45729C8.24749 1.35739 8.33381 1.27695 8.43755 1.22617L8.50639 1.19817L9.10489 0.994L9.30905 0.394917C9.34839 0.279665 9.42281 0.179613 9.52187 0.108791C9.62094 0.0379686 9.73969 -0.0000730808 9.86147 0Z" fill="currentColor"/></svg>';function x(t,e={}){let r=document.createElement(t);if(e.style&&(r.style.cssText=e.style),e.text!=null&&(r.textContent=e.text),e.html!=null&&(r.innerHTML=e.html),e.attrs)for(let n in e.attrs)r.setAttribute(n,e.attrs[n]);if(e.on)for(let n in e.on)r.addEventListener(n,e.on[n]);if(e.children)for(let n of e.children)n&&r.appendChild(n);return r}function rn(t){return x("span",{style:`width:12px;height:12px;display:inline-flex;align-items:center;justify-content:center;color:${t};flex-shrink:0;`,html:en})}var Nt=t=>'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" style="display:block;width:100%;height:100%">'+t+"</svg>",tn={camera:Ei,sparkle:en.replace("width:12px;height:12px","width:100%;height:100%"),shirt:Nt('<path d="M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z"/>'),face:Nt('<path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><path d="M9 9h.01"/><path d="M15 9h.01"/>'),glasses:Nt('<circle cx="6" cy="15" r="4"/><circle cx="18" cy="15" r="4"/><path d="M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2"/><path d="M2.5 13 5 7c.7-1.3 1.4-2 3-2"/><path d="M21.5 13 19 7c-.7-1.3-1.5-2-3-2"/>'),wand:Nt('<path d="m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72"/><path d="m14 7 3 3"/><path d="M5 6v4"/><path d="M19 14v4"/><path d="M10 2v2"/><path d="M7 8H3"/><path d="M21 16h-4"/><path d="M11 3H9"/>')};function P(t,e,r){let n=Number(r)>0?Number(r):24;return x("span",{style:`width:${n}px;height:${n}px;padding:2px;box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;color:${e};flex-shrink:0;`,html:tn[t]||tn.camera})}function X(t){return t.borderWidth>0&&t.borderColor?`${t.borderWidth}px solid ${t.borderColor}`:"none"}function Y(){if(!document.getElementById("mk-jakarta-font"))try{document.head.appendChild(x("link",{attrs:{id:"mk-jakarta-font",rel:"stylesheet",href:"https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;700&display=swap"}}))}catch(t){}}function Ii(t){return t.subtext?x("span",{style:`display:flex;align-items:center;justify-content:center;padding:4px;background:${t.badgeBgColor};font-family:${_};font-weight:700;font-size:16px;text-transform:uppercase;color:${t.badgeTextColor};line-height:1;white-space:nowrap;`,text:t.subtext}):null}function nn(t,e){Y();let r=x("span",{style:"display:inline-flex;align-items:center;gap:4px;",children:[P(t.icon,t.textColor,t.iconSize),x("span",{text:t.text,style:`font-family:${_};font-weight:700;font-size:inherit;text-transform:uppercase;letter-spacing:2px;color:${t.textColor};white-space:nowrap;text-align:center;line-height:1;`})]});return x("button",{attrs:{type:"button"},style:`display:flex;align-items:center;justify-content:center;gap:8px;padding:8px;width:100%;max-width:238px;box-sizing:border-box;background:${t.bgColor};border:${X(t)};border-radius:${t.borderRadiusPx};font-family:${_};font-size:${t.fontSize}px;cursor:pointer;transition:opacity 0.2s ease;line-height:1;-webkit-appearance:none;appearance:none;`,children:[r,Ii(t)],on:{mouseenter:n=>{n.currentTarget.style.opacity="0.85"},mouseleave:n=>{n.currentTarget.style.opacity="1"},click:n=>{try{n.preventDefault(),n.stopPropagation()}catch(o){}try{e&&e()}catch(o){}}}})}function Ri(t){return t.subtext?x("span",{style:`display:flex;align-items:center;gap:4px;padding:4px;background:${t.badgeBgColor};font-family:${_};font-weight:600;font-size:10px;text-transform:uppercase;color:${t.badgeTextColor};line-height:1;white-space:nowrap;`,children:[rn(t.badgeTextColor),x("span",{text:t.subtext})]}):null}function Mi(t,e){return x("button",{attrs:{type:"button"},style:`display:flex;align-items:center;justify-content:center;gap:8px;padding:8px 12px 8px 8px;width:100%;margin-top:auto;box-sizing:border-box;background:${t.bgColor};border:${X(t)};border-radius:${t.borderRadiusPx};filter:drop-shadow(0 0 6px rgba(0,0,0,0.08));font-family:${_};cursor:pointer;transition:opacity 0.2s ease;line-height:1;-webkit-appearance:none;appearance:none;`,children:[P(t.icon,t.textColor,t.iconSize),x("span",{text:t.text,style:`font-family:${_};font-weight:700;font-size:inherit;color:${t.textColor};white-space:nowrap;line-height:1;`})],on:{mouseenter:r=>{r.currentTarget.style.opacity="0.85"},mouseleave:r=>{r.currentTarget.style.opacity="1"},click:r=>{try{r.preventDefault(),r.stopPropagation()}catch(n){}try{e&&e()}catch(n){}}}})}function on(t,e){Y();let r=x("div",{style:"display:flex;flex-direction:column;gap:4px;",children:[t.cardTitle&&x("p",{text:t.cardTitle,style:`margin:0;font-family:${_};font-weight:700;font-size:16px;letter-spacing:1px;text-transform:uppercase;color:${t.cardTitleColor};line-height:1.2;`}),t.cardDescription&&x("p",{html:t.cardDescription,style:`margin:0;font-family:${_};font-weight:400;font-size:12px;max-width:177px;line-height:1.2;color:${t.cardTextColor};`})]}),n=x("div",{style:"display:flex;flex-direction:column;justify-content:space-between;gap:16px;flex:1 1 0;min-width:0;",children:[r,t.cardFooter&&x("p",{text:t.cardFooter,style:`margin:0;font-family:${_};font-weight:400;font-size:10px;color:${t.cardTextColor};line-height:1.2;`})]}),o=x("div",{style:"display:flex;flex-direction:column;align-items:flex-end;flex:1 1 0;min-width:0;",children:[Ri(t),Mi(t,e)]}),i=x("div",{style:"display:flex;gap:16px;align-items:stretch;width:100%;flex:1;box-sizing:border-box;",children:[n,o]});return x("div",{style:`display:flex;flex-direction:column;align-items:flex-start;padding:12px;width:100%;max-width:402px;min-height:140px;box-sizing:border-box;background:${t.cardBgColor};border-radius:${t.cardBorderRadiusPx};font-family:${_};font-size:${t.fontSize}px;`,children:[i]})}function an(t,e){let r=Number(t.iconSize)>0?Number(t.iconSize):24;return x("button",{attrs:{type:"button","aria-label":t.text||"Provar virtualmente"},style:`display:inline-flex;align-items:center;justify-content:center;padding:8px;box-sizing:border-box;background:${t.bgColor};border:${X(t)};border-radius:${t.borderRadiusPx};cursor:pointer;transition:opacity 0.2s ease;line-height:1;-webkit-appearance:none;appearance:none;`,children:[P(t.icon,t.textColor,r)],on:{mouseenter:n=>{n.currentTarget.style.opacity="0.85"},mouseleave:n=>{n.currentTarget.style.opacity="1"},click:n=>{try{n.preventDefault(),n.stopPropagation()}catch(o){}try{e&&e()}catch(o){}}}})}function cn(t,e){Y();let r=x("div",{style:"display:flex;flex-direction:column;gap:8px;width:fit-content;max-width:100%;",children:[x("div",{style:"display:flex;align-items:center;gap:8px;",children:[P(t.icon,t.cardTitleColor,t.iconSize),t.cardTitle&&x("p",{text:t.cardTitle,style:`margin:0;font-family:${_};font-weight:700;font-size:16px;text-transform:uppercase;letter-spacing:1px;color:${t.cardTitleColor};white-space:nowrap;line-height:1.2;`})]}),x("div",{style:`height:3px;width:100%;border-radius:9999px;background:linear-gradient(90deg, ${t.cardAccentFrom}, ${t.cardAccentTo});`})]}),n=t.cardDescription&&x("p",{html:t.cardDescription,style:`margin:0;font-family:${_};font-weight:400;font-size:13px;line-height:1.4;color:${t.cardTextColor};`}),o=x("button",{attrs:{type:"button"},text:t.text,style:`font-family:${_};font-weight:700;font-size:${t.fontSize}px;text-transform:uppercase;letter-spacing:1px;text-decoration:underline;text-underline-offset:4px;color:${t.cardCtaColor};background:transparent;border:none;padding:0;cursor:pointer;text-align:left;line-height:1.2;transition:opacity 0.2s ease;`,on:{mouseenter:i=>{i.currentTarget.style.opacity="0.7"},mouseleave:i=>{i.currentTarget.style.opacity="1"},click:i=>{try{i.preventDefault(),i.stopPropagation()}catch(a){}try{e&&e()}catch(a){}}}});return x("div",{style:`display:flex;flex-direction:column;align-items:flex-start;gap:24px;padding:20px;width:360px;max-width:100%;box-sizing:border-box;background:${t.cardBgColor};border:1px solid ${t.cardBorderColor};border-radius:${t.cardBorderRadiusPx};font-family:${_};`,children:[r,n,o]})}var Bi={style:"gregory-black",icon:"camera",text:"Provar Virtualmente",fontSize:14,iconSize:24,subtext:"",bgColor:"#1E1E1E",textColor:"#FFFFFF",badgeBgColor:"#C51A1B",badgeTextColor:"#FFFFFF",borderRadius:"md",borderColor:"#1E1E1E",borderWidth:0,cardTitle:"",cardDescription:"",cardFooter:"",cardBgColor:"#F6F6F6",cardTitleColor:"#1E1E1E",cardTextColor:"#717171",cardBorderRadius:"md",cardCtaColor:"#1E1E1E",cardBorderColor:"#E5E0DA",cardAccentFrom:"#8A5A3C",cardAccentTo:"#E9DACB"};function qt(t){if(!t)return null;let e=Array.isArray(t.anchors)?t.anchors:[];if(t.version===2||t.main)return{version:2,main:t.main||{},anchors:e,cards:t.cards||null};let r=t.desktop||t.tablet||t.mobile||{},n=t.anchor||{};return{version:2,main:Object.assign({},r,{desktop:n.desktop,tablet:n.tablet,mobile:n.mobile,bpMobile:n.bpMobile,bpTablet:n.bpTablet}),anchors:e,cards:t.cards||null}}function st(t,e){let r={...Bi,...t||{}};return r.style==="gregory-card"&&e&&(r.style="gregory-black"),r.borderRadiusPx=ke[r.borderRadius]!=null?ke[r.borderRadius]:"0",r.cardBorderRadiusPx=Se[r.cardBorderRadius]!=null?Se[r.cardBorderRadius]:"0",r.fontSize=Number(r.fontSize)||14,r.iconSize=Number(r.iconSize)||24,r.borderWidth=Number(r.borderWidth)||0,r}var Te={"gregory-black":nn,"gregory-card":on,"gregory-icon":an,"card-link":cn},Ga=Object.keys(Te).concat("none");function ln(t,e){return t&&t.style==="none"?null:(Te[t.style]||Te["gregory-black"])(t,e)}function Ni(){return"abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)]+Math.random().toString(36).slice(2,11)}var U=null,j=[];function Zr(){return[U].concat(j).filter(Boolean)}function qi(t,e){let r;try{r=document.createElement("iframe"),r.setAttribute("aria-hidden","true"),r.style.cssText="display:none!important;width:0;height:0;border:0;position:absolute;left:-9999px;",(document.body||document.documentElement).appendChild(r);let n=r.contentWindow&&r.contentWindow.Element&&r.contentWindow.Element.prototype&&r.contentWindow.Element.prototype.attachShadow;if(typeof n=="function"){let o=n.call(t,e);return r.remove(),o}}catch(n){}try{r&&r.remove()}catch(n){}return t.attachShadow(e)}var Di=/^(transform|transform-origin|margin|margin-(top|right|bottom|left)|align-self|justify-self|place-self|position|inset|top|right|bottom|left|z-index|width|min-width|max-width|height|min-height|max-height|font-size)$/i;function zi(t){return!t||typeof t!="string"?"":t.split(";").map(e=>e.trim()).filter(Boolean).filter(e=>Di.test(e.split(":")[0].trim().toLowerCase())).join(";")}var Dt=null,Ae=!1,Ee=0,Ie=0,Le=0,Z={},sn=!1,ut=null;function O(){return ut||(ut=J().then(t=>{if(!t)return ut=null,null;try{gt(t,y().projectId,y().product)}catch(e){}return qt(t.template&&t.template.tryOnButton||null)||{__loaded:!0}}).catch(()=>(ut=null,null))),ut}function Ui(){if(sn)return;sn=!0;let t=null;try{window.addEventListener("resize",()=>{clearTimeout(t),t=setTimeout(()=>{Dt&&k("pdp")},200)})}catch(e){}}function Me(t){if(t){if(typeof t.__mkCleanup=="function")try{t.__mkCleanup()}catch(e){}t.parentNode&&t.parentNode.removeChild(t)}}function dt(){Me(U),j.forEach(Me),U=null,j=[],Dt=null}var Fi={IMG:1,INPUT:1,VIDEO:1,CANVAS:1,EMBED:1,OBJECT:1,IFRAME:1,BR:1,HR:1,SELECT:1,TEXTAREA:1,SVG:1};function Ki(t){switch(t){case"top-center":return"top:0;left:50%;transform:translateX(-50%);";case"top-right":return"top:0;right:0;";case"middle-left":return"top:50%;left:0;transform:translateY(-50%);";case"center":return"top:50%;left:50%;transform:translate(-50%,-50%);";case"middle-right":return"top:50%;right:0;transform:translateY(-50%);";case"bottom-left":return"bottom:0;left:0;";case"bottom-center":return"bottom:0;left:50%;transform:translateX(-50%);";case"bottom-right":return"bottom:0;right:0;";case"top-left":default:return"top:0;left:0;"}}function $i(t,e,r){let o=!Fi[t.tagName]?t:t.parentElement||document.body;try{getComputedStyle(o).position==="static"&&(o.style.position="relative")}catch(s){}if(o===t){e.style.cssText="position:absolute;z-index:2147483000;"+Ki(r),t.appendChild(e);return}e.style.cssText="position:absolute;z-index:2147483000;",o.appendChild(e);let i=()=>{try{let s=t.getBoundingClientRect(),d=o.getBoundingClientRect(),f=e.offsetWidth,h=e.offsetHeight,g=s.top-d.top+o.scrollTop,b=s.left-d.left+o.scrollLeft,p=r||"top-left",v=g,K=b;p.indexOf("bottom")===0?v=g+s.height-h:(p.indexOf("middle")===0||p==="center")&&(v=g+(s.height-h)/2),p.indexOf("right")>=0?K=b+s.width-f:p.indexOf("center")>=0&&(K=b+(s.width-f)/2),e.style.top=v+"px",e.style.left=K+"px"}catch(s){}};i();let a=()=>i();window.addEventListener("resize",a);let c=setTimeout(i,600),l=setTimeout(i,1500),u=null;try{if(t.tagName==="IMG"&&!t.complete&&t.addEventListener("load",i,{once:!0}),typeof ResizeObserver=="function"){u=new ResizeObserver(()=>i());try{u.observe(t)}catch(s){}try{u.observe(o)}catch(s){}}}catch(s){}e.__mkCleanup=()=>{window.removeEventListener("resize",a),clearTimeout(c),clearTimeout(l);try{t.removeEventListener("load",i)}catch(s){}try{u&&u.disconnect()}catch(s){}}}function Hi(t,e,r){e.style.cssText="position:absolute;z-index:100;",document.body.appendChild(e);let n=()=>{try{let l=t.getBoundingClientRect(),u=e.offsetWidth,s=e.offsetHeight,d=r||"top-left",f=l.top+window.scrollY,h=l.left+window.scrollX;d.indexOf("bottom")===0?f=l.bottom+window.scrollY-s:(d.indexOf("middle")===0||d==="center")&&(f=l.top+window.scrollY+(l.height-s)/2),d.indexOf("right")>=0?h=l.right+window.scrollX-u:d.indexOf("center")>=0&&(h=l.left+window.scrollX+(l.width-u)/2),e.style.top=Math.round(f)+"px",e.style.left=Math.round(h)+"px"}catch(l){}};n();let o=()=>n();window.addEventListener("resize",o);let i=setTimeout(n,600),a=setTimeout(n,1500),c=null;try{t.tagName==="IMG"&&!t.complete&&t.addEventListener("load",n,{once:!0});let l=t.querySelector&&t.querySelector("img");if(l&&!l.complete&&l.addEventListener("load",n,{once:!0}),typeof ResizeObserver=="function"){c=new ResizeObserver(()=>n());try{c.observe(t)}catch(u){}}}catch(l){}e.__mkCleanup=()=>{window.removeEventListener("resize",o),clearTimeout(i),clearTimeout(a);try{c&&c.disconnect()}catch(l){}}}function Vi(t,e,r){try{return t.insertAdjacentElement(r||"afterend",e),!0}catch(n){try{return t.parentNode.insertBefore(e,t.nextSibling),!0}catch(o){return!1}}}async function k(t){let e=y(),r=null;if(t!=="pdp"){dt();return}if(!e.projectId)return;if(!e._anchorFromPicker){let s=await O(),d=nt(),f=s&&s.main,h=s&&s.anchors,g=s&&s.cards;if(d&&d.tryOnButton){let p=qt(d.tryOnButton)||{};p.main&&(f=Object.assign({},f||e.anchor||{},p.main),r=f),p.anchors&&(h=p.anchors),p.cards&&(g=p.cards)}f&&(e.anchor=f),h&&(e.anchors=h),g&&(e.cards=g);let b=!!(e.anchor&&(e.anchor.desktop||e.anchor.mobile||e.anchor.tablet||e.anchor.selector));if(!e.forceButton&&!(s&&s.main)&&!b){dt(),s===null&&Ee<3&&(Ee++,setTimeout(()=>k(t),1500));return}Ee=0}if(Ae)return;let n=G(),o=n&&n.value,i=!!e.forceButton,a=s=>s?[s.selector,s.position,s.mode,s.align,s.style].join("~"):"heuristic",c=Array.isArray(e.anchors)?e.anchors:[],l=[o||"demo",a(lt(e.anchor))].concat(c.map(s=>a(lt(s)))).join("|"),u=U;if(!(u&&Dt===l)){if(u&&dt(),!o&&!i){w("auto-mount: SKU n\xE3o resolvido na PDP"),Ie<10&&(Ie++,setTimeout(()=>k(t),800));return}if(Ie=0,!i&&e.anchor&<(e.anchor)&&!Bt(e.anchor)&&Le<12){Le++,setTimeout(()=>k(t),600);return}Le=0,Ae=!0;try{let s=i;i||(Z[o]||(Z[o]=z(e.projectId,o).then(p=>!!(p&&p.available)).catch(()=>!1)),s=await Z[o]);try{We(s?"available":"unavailable")}catch(p){}if(!s){w("auto-mount: produto sem try-on",o);return}if(nt().holdout){dt(),w("auto-mount: holdout \u2014 bot\xE3o suprimido");return}let d=await O(),f=window.matchMedia("(max-width: 767px)").matches,h=st(r||d&&d.main||e.anchor||{},f),g=()=>{let p=G(),v=p&&p.value||o||"";Xt(),m("button_clicked",{sku:v,style:h.style}),ct({projectId:e.projectId,identifier:v})},b=Qr();U=Pe(b,h,g),j=[];for(let p=0;p<c.length;p++){let v=c[p],K=Bt(v);if(!K)continue;let dn=d&&d.anchors&&d.anchors[p]||v,Oe=Pe(K,st(dn,f),g);Oe&&j.push(Oe)}Dt=l,Ui(),w("auto-mount: bot\xE3o",{style:h.style,sku:o,mounted:!!U,extras:j.length,forced:i}),(U||j.length)&&m("button_rendered",{style:h.style,sku:o||null,skuSource:n&&n.source,anchorFound:!!b,position:b?b.position:null,mode:b?b.mode:null,extras:j.length,forced:i})}finally{Ae=!1}}}function Pe(t,e,r){let n=t&&t.mode||"flow",o=ln(e,r);if(!o)return null;let i=document.createElement("div");i.id=Ni(),qi(i,{mode:"closed"}).appendChild(o),["click","mousedown","mouseup","pointerdown","pointerup","touchstart"].forEach(l=>{try{i.addEventListener(l,u=>{u.stopPropagation()},!1)}catch(u){}});let c=!1;if(t&&t.el&&t.el.parentNode&&(n==="overlay"?(t.detached?Hi(t.el,i,t.align):$i(t.el,i,t.align),c=!0):(i.style.cssText="display:contents;",c=Vi(t.el,i,t.position))),c||(i.style.cssText="position:fixed;left:16px;bottom:16px;z-index:2147483000;",document.body.appendChild(i)),t&&t.style){let l=zi(t.style);if(l){if(n==="overlay"){let u=l.match(/(?:^|;)\s*z-index\s*:\s*([^;]+)/i);if(u)try{i.style.zIndex=u[1].trim()}catch(s){}}try{o.style.cssText+=";"+l}catch(u){}}}return i}function un(){try{let t=y(),e={anchor:t.anchor,anchors:t.anchors,cards:t.cards,forceButton:t.forceButton},r={},n=i=>({desktop:i,tablet:i,mobile:i}),o=(i,a,c)=>{i=i||{};let l=f=>a===f?c:r[f];t.anchor=l("primary")?n(l("primary")):i.main||null;let u=Array.isArray(i.anchors)?i.anchors:[],s=u.length;Object.keys(r).concat(a?[a]:[]).forEach(f=>{f&&f.indexOf("extra-")===0&&(s=Math.max(s,(parseInt(f.slice(6),10)||0)+1))});let d=[];for(let f=0;f<s;f++){let h=l("extra-"+f);d[f]=h?n(h):u[f]||null}t.anchors=d,t._anchorFromPicker=!0,t.forceButton=!0};window.addEventListener("message",i=>{if(i.source!==window)return;let a=i.data;if(!(!a||!a.__mkCmd)){if(a.__mkCmd==="getButtons"){O().then(c=>{let l=c&&Array.isArray(c.anchors)?c.anchors.length:0;try{window.postMessage({__mkButtons:{extras:l,hasMain:!!(c&&c.main)}},"*")}catch(u){}});return}if(a.__mkCmd==="previewSlot"){O().then(c=>{o(c,a.slot||"primary",a.live),k("pdp")});return}if(a.__mkCmd==="saveSlot"){a.slot&&a.live&&(r[a.slot]=a.live),O().then(c=>{o(c),k("pdp")});return}if(a.__mkCmd==="galleryPreview"){t.cards=a.cards||null,t._anchorFromPicker=!0,t.forceButton=!0,Q(),zt("category");return}if(a.__mkCmd==="applyRecipe"){O().then(c=>{o(c),a.cards!==void 0&&(t.cards=a.cards||null),k("pdp"),t.cards&&(Q(),zt("category"))});return}if(a.__mkCmd==="cancelPreview"){Object.keys(r).length?O().then(c=>{o(c),k("pdp")}):(t.anchor=e.anchor,t.anchors=e.anchors,t.cards=e.cards,t._anchorFromPicker=!1,t.forceButton=e.forceButton,dt(),Q(),k("pdp"));return}}})}catch(t){}}var F=null,ft=null,je=null,pt=new Map;function Wi(t,e){try{if(e.skuAttr){let o=e.skuSelector?t.querySelector(e.skuSelector):t,i=o&&o.getAttribute(e.skuAttr);if(i)return String(i).trim()}if(e.skuSelector&&!e.skuAttr){let o=t.querySelector(e.skuSelector),i=o&&(o.getAttribute("content")||o.textContent||"").trim();if(i)return i}let r=t.querySelector(e.linkSelector||"a[href]"),n=r&&r.getAttribute("href");if(n){let o=n.match(/-p(\d+)|[?&]variant=(\d+)|\/produtos?\/([\w-]+)|\/products?\/([\w-]+)|-(\d+)(?:[/?#]|$)/);if(o)return o[1]||o[2]||o[3]||o[4]||o[5]}}catch(r){}return null}async function Ji(t,e,r){if(pt.has(t))return;let n=!!y().forceButton,o=Wi(t,e);if(!o&&!n)return;let i=n;if(i||(Z[o]||(Z[o]=z(y().projectId,o).then(s=>!!(s&&s.available)).catch(()=>!1)),i=await Z[o]),!i||pt.has(t)||!t.isConnected)return;let c={el:e.anchorWithin&&t.querySelector(e.anchorWithin)||t,mode:e.mode||"overlay",align:e.align||"top-left",position:e.position||"afterbegin",style:e.injectStyle||e.style||"",detached:!0},u=Pe(c,r,()=>{Xt(),m("button_clicked",{sku:o,gallery:!0,style:r.style}),ct({projectId:y().projectId,identifier:o})});u&&(pt.set(t,u),m("button_rendered",{gallery:!0,sku:o,style:r.style}))}function Re(t){try{document.querySelectorAll(t.cardSelector).forEach(e=>{e.__mkCard||(e.__mkCard=!0,F.observe(e))})}catch(e){}}function Q(){if(F){try{F.disconnect()}catch(t){}F=null}if(ft){try{ft.disconnect()}catch(t){}ft=null}clearTimeout(je),pt.forEach(t=>Me(t)),pt.clear()}async function zt(t){let e=y();if(t==="pdp"||t==="cart"||t==="checkout"||t==="purchase"){Q();return}if(!e.projectId)return;let r=await O(),n=e.cards||r&&r.cards||null;if(!n||!n.cardSelector){Q();return}if(F){Re(n);return}if(typeof IntersectionObserver!="function")return;let o=st(n,window.matchMedia("(max-width: 767px)").matches);if(o.style==="none"){Q();return}F=new IntersectionObserver(i=>{for(let a of i)a.isIntersecting&&(F.unobserve(a.target),Ji(a.target,n,o))},{rootMargin:"300px"}),Re(n);try{ft=new MutationObserver(()=>{clearTimeout(je),je=setTimeout(()=>Re(n),250)}),ft.observe(document.body,{childList:!0,subtree:!0})}catch(i){}w("auto-mount galeria ativa",{cardSelector:n.cardSelector})}(function(){"use strict";try{let r=function(){try{Ye(),un(),Fr(),e.autoTrack!==!1&&(Cr((o,i)=>{Rr(o,i),k(o),zt(o)}),jr(),Pr()),w("mk-sdk iniciado",{projectId:e.projectId,collectorUrl:e.collectorUrl})}catch(o){e.debug&&console.error("[mk-sdk] init erro",o)}},e=Ft();if(e.projectId){let o=er(e.projectId);o&&Yt(o),J().then(i=>{let a=Qe(i);Yt(a),rr(e.projectId,a),w("escopo de coleta",a);try{gt(i,e.projectId,e.product)}catch(c){}})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r):r();let n={open:ct,close:Ot,isAvailable:zr,getAvailability:z,onReady:Hr,onClose:Vr,onAddToCart:Wr,onProductLoaded:Jr,onError:Gr,onInteraction:Xr,onGenerationComplete:Yr,testCart:gr,_version:Jt,_isMkSdk:!0};typeof window!="undefined"&&(window.mk=n)}catch(e){typeof console!="undefined"&&console.error("[mk-sdk] boot fatal",e)}})();})();
|
package/dist/mk-sdk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{(function(){try{let a=function(){try{var t=JSON.parse(localStorage.getItem(s));return t&&u.test(t.v)&&t.exp>Date.now()?t.v:null}catch(e){return null}},n=function(t){if(!d){d=!0;var e=document.createElement("script");if(e.src="https://cdn.jsdelivr.net/npm/mk-sdk-git@"+t+"/dist/mk-core.js",e.async=!0,r&&r.attributes)for(var c=0;c<r.attributes.length;c++){var i=r.attributes[c];i.name.indexOf("data-")===0&&e.setAttribute(i.name,i.value)}(document.head||document.documentElement).appendChild(e)}};var l=a,f=n;if(window.__mkBooted)return;window.__mkBooted=!0;var s="mk_sdk_v",v=10*60*1e3,_=700,u=/^\d+\.\d+\.\d+$/,r=document.currentScript||document.querySelector("script[data-mk-project]")||document.querySelector('script[src*="mk-sdk"]'),d=!1,o=a()||"1.1.
|
|
1
|
+
(()=>{(function(){try{let a=function(){try{var t=JSON.parse(localStorage.getItem(s));return t&&u.test(t.v)&&t.exp>Date.now()?t.v:null}catch(e){return null}},n=function(t){if(!d){d=!0;var e=document.createElement("script");if(e.src="https://cdn.jsdelivr.net/npm/mk-sdk-git@"+t+"/dist/mk-core.js",e.async=!0,r&&r.attributes)for(var c=0;c<r.attributes.length;c++){var i=r.attributes[c];i.name.indexOf("data-")===0&&e.setAttribute(i.name,i.value)}(document.head||document.documentElement).appendChild(e)}};var l=a,f=n;if(window.__mkBooted)return;window.__mkBooted=!0;var s="mk_sdk_v",v=10*60*1e3,_=700,u=/^\d+\.\d+\.\d+$/,r=document.currentScript||document.querySelector("script[data-mk-project]")||document.querySelector('script[src*="mk-sdk"]'),d=!1,o=a()||"1.1.96",m=setTimeout(function(){n(o)},_);fetch("https://api-collector.mk3dlabs.com/v1/sdk/version").then(function(t){return t.ok?t.json():null}).then(function(t){var e=t&&t.version;if(u.test(e))try{localStorage.setItem(s,JSON.stringify({v:e,exp:Date.now()+v}))}catch(c){}clearTimeout(m),n(u.test(e)?e:o)}).catch(function(){clearTimeout(m),n(o)})}catch(a){}})();})();
|
package/package.json
CHANGED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// experiments.js — motor de Teste A/B do SDK.
|
|
2
|
+
// Lê project.experiments[] (da recipe), bucketiza o visitante de forma
|
|
3
|
+
// determinística e STICKY (mesma variante sempre, chave = visitorId) e expõe:
|
|
4
|
+
// - getActiveExperiments(): [{exp,var}] — carimbo no evento (transport)
|
|
5
|
+
// - getVariantOverride(): overrides a aplicar (botão / modal / holdout)
|
|
6
|
+
// Regras (do docs/plano-teste-ab.md): só experimentos running + elegíveis por
|
|
7
|
+
// produto/targeting/tráfego entram; exclusivo → só um; overlap → todos.
|
|
8
|
+
import { getVisitorId } from './identity.js';
|
|
9
|
+
|
|
10
|
+
let _active = []; // [{ exp, var, control, overrides }]
|
|
11
|
+
let _inited = false;
|
|
12
|
+
|
|
13
|
+
// hash string → [0,1) (FNV-1a 32-bit — determinístico, sem Math.random)
|
|
14
|
+
function hashUnit(str) {
|
|
15
|
+
let h = 2166136261 >>> 0;
|
|
16
|
+
for (let i = 0; i < str.length; i++) { h ^= str.charCodeAt(i); h = Math.imul(h, 16777619) >>> 0; }
|
|
17
|
+
return (h >>> 0) / 4294967296;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function getDevice() {
|
|
21
|
+
const ua = (typeof navigator !== 'undefined' && navigator.userAgent) || '';
|
|
22
|
+
if (/iPad|Tablet|PlayBook|Silk/i.test(ua) || (/Android/i.test(ua) && !/Mobile/i.test(ua))) return 'tablet';
|
|
23
|
+
if (/Mobi|Android|iPhone|iPod|Windows Phone|BlackBerry/i.test(ua)) return 'mobile';
|
|
24
|
+
return 'desktop';
|
|
25
|
+
}
|
|
26
|
+
// novo × recorrente — aproximação client-side (o collector tem a versão exata).
|
|
27
|
+
function isReturning() {
|
|
28
|
+
try {
|
|
29
|
+
if (localStorage.getItem('_mk_seen')) return true;
|
|
30
|
+
localStorage.setItem('_mk_seen', String(Date.now()));
|
|
31
|
+
return false;
|
|
32
|
+
} catch (_) { return false; }
|
|
33
|
+
}
|
|
34
|
+
function matchesProduct(exp, product) {
|
|
35
|
+
const p = exp.product || 'mk-fashion';
|
|
36
|
+
return p === 'ambos' || p === (product || 'mk-fashion');
|
|
37
|
+
}
|
|
38
|
+
function matchesTargeting(exp, ctx) {
|
|
39
|
+
const t = exp.targeting || {};
|
|
40
|
+
if (Array.isArray(t.device) && t.device.length && t.device.indexOf(ctx.device) < 0) return false;
|
|
41
|
+
if (t.audience === 'new' && ctx.returning) return false;
|
|
42
|
+
if (t.audience === 'returning' && !ctx.returning) return false;
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
// % do tráfego elegível que entra no experimento (gate por hash separado)
|
|
46
|
+
function inTraffic(exp, vid) {
|
|
47
|
+
const traffic = exp.traffic == null ? 100 : Number(exp.traffic);
|
|
48
|
+
if (traffic >= 100) return true;
|
|
49
|
+
if (traffic <= 0) return false;
|
|
50
|
+
return hashUnit(vid + '|' + exp.id + '|t') * 100 < traffic;
|
|
51
|
+
}
|
|
52
|
+
// sorteio da variante pelos pesos (determinístico por visitorId)
|
|
53
|
+
function pickVariant(exp, vid) {
|
|
54
|
+
const variants = (exp.variants || []).filter((v) => v && v.key);
|
|
55
|
+
const total = variants.reduce((n, v) => n + (Number(v.weight) || 0), 0);
|
|
56
|
+
if (total <= 0) return null;
|
|
57
|
+
const r = hashUnit(vid + '|' + exp.id) * total;
|
|
58
|
+
let acc = 0;
|
|
59
|
+
for (let i = 0; i < variants.length; i++) { acc += Number(variants[i].weight) || 0; if (r < acc) return variants[i]; }
|
|
60
|
+
return variants[variants.length - 1];
|
|
61
|
+
}
|
|
62
|
+
// STICKY: guarda a variante sorteada; nas próximas visitas reusa (se ainda existe)
|
|
63
|
+
function assignedVariant(exp, projectId, vid) {
|
|
64
|
+
const key = 'mk_exp_' + projectId + '_' + exp.id;
|
|
65
|
+
const byKey = (k) => (exp.variants || []).filter((v) => v && v.key === k)[0] || null;
|
|
66
|
+
let stored = null;
|
|
67
|
+
try { stored = localStorage.getItem(key); } catch (_) {}
|
|
68
|
+
if (stored && byKey(stored)) return byKey(stored);
|
|
69
|
+
const picked = pickVariant(exp, vid);
|
|
70
|
+
if (picked) { try { localStorage.setItem(key, picked.key); } catch (_) {} }
|
|
71
|
+
return picked;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Idempotente (roda 1x por sessão; chamada tanto no boot quanto no getTemplateCached).
|
|
75
|
+
export function initExperiments(project, projectId, product) {
|
|
76
|
+
if (_inited) return;
|
|
77
|
+
_inited = true;
|
|
78
|
+
const list = (project && Array.isArray(project.experiments)) ? project.experiments : [];
|
|
79
|
+
if (!list.length) return;
|
|
80
|
+
const vid = getVisitorId();
|
|
81
|
+
const ctx = { device: getDevice(), returning: isReturning() };
|
|
82
|
+
const eligible = list.filter((e) =>
|
|
83
|
+
e && e.status === 'running' &&
|
|
84
|
+
matchesProduct(e, product) && matchesTargeting(e, ctx) && inTraffic(e, vid)
|
|
85
|
+
);
|
|
86
|
+
if (!eligible.length) return;
|
|
87
|
+
// Convivência: exclusivo → o visitante entra em UM só (nada mais); overlap → todos.
|
|
88
|
+
const exclusives = eligible.filter((e) => e.coexist === 'exclusive');
|
|
89
|
+
let chosen;
|
|
90
|
+
if (exclusives.length) {
|
|
91
|
+
const idx = Math.min(exclusives.length - 1, Math.floor(hashUnit(vid + '|excl') * exclusives.length));
|
|
92
|
+
chosen = [exclusives[idx]];
|
|
93
|
+
} else {
|
|
94
|
+
chosen = eligible;
|
|
95
|
+
}
|
|
96
|
+
for (let i = 0; i < chosen.length; i++) {
|
|
97
|
+
const e = chosen[i];
|
|
98
|
+
const v = assignedVariant(e, projectId || '', vid);
|
|
99
|
+
if (!v) continue;
|
|
100
|
+
_active.push({ exp: e.id, var: v.key, control: !!v.control, overrides: v.overrides || {} });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// [{exp,var}] pra carimbar em todo evento (nível de sessão/batch)
|
|
105
|
+
export function getActiveExperiments() {
|
|
106
|
+
return _active.map((a) => ({ exp: a.exp, var: a.var }));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Override efetivo (merge das variantes NÃO-controle ativas):
|
|
110
|
+
// { holdout, tryOnButton (parcial v2), modalWidth, modalHeight }
|
|
111
|
+
export function getVariantOverride() {
|
|
112
|
+
const out = { holdout: false, tryOnButton: null, modalWidth: null, modalHeight: null };
|
|
113
|
+
for (let i = 0; i < _active.length; i++) {
|
|
114
|
+
const a = _active[i];
|
|
115
|
+
if (a.control) continue;
|
|
116
|
+
const o = a.overrides || {};
|
|
117
|
+
if (o.holdout) out.holdout = true;
|
|
118
|
+
if (o.tryOnButton) out.tryOnButton = o.tryOnButton;
|
|
119
|
+
if (o.modalWidth) out.modalWidth = o.modalWidth;
|
|
120
|
+
if (o.modalHeight) out.modalHeight = o.modalHeight;
|
|
121
|
+
}
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// só p/ testes/QA
|
|
126
|
+
export function _resetExperiments() { _active = []; _inited = false; }
|
package/src/core/transport.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { getConfig, log } from './config.js';
|
|
4
4
|
import { getVisitorId, getSessionId } from './identity.js';
|
|
5
|
+
import { getActiveExperiments } from './experiments.js';
|
|
5
6
|
import { sanitize } from './sanitize.js';
|
|
6
7
|
|
|
7
8
|
let queue = [];
|
|
@@ -202,9 +203,11 @@ export function flush(useBeacon) {
|
|
|
202
203
|
// omite (collector mantém, fail-open).
|
|
203
204
|
const tryonAvailable = tryonState === 'available' ? true
|
|
204
205
|
: (tryonState === 'unavailable' ? false : undefined);
|
|
206
|
+
const experiments = getActiveExperiments();
|
|
205
207
|
const payload = JSON.stringify({
|
|
206
208
|
product: cfg.product || undefined,
|
|
207
209
|
sdkVersion: SDK_VERSION, // versão da SDK em TODO dado coletado (auditoria/dash)
|
|
210
|
+
experiments: experiments.length ? experiments : undefined, // teste A/B: [{exp,var}] por sessão/batch
|
|
208
211
|
visitorId: getVisitorId(),
|
|
209
212
|
sessionId: getSessionId(),
|
|
210
213
|
engaged: isEngaged() || undefined, // tryon_engaged: o collector enforça o escopo com este flag
|
package/src/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { resolveConfig, getConfig, log } from './core/config.js';
|
|
|
5
5
|
import { startAutoTrack } from './core/autoTrack.js';
|
|
6
6
|
import { initUnloadFlush, setCollectionScope, SDK_VERSION } from './core/transport.js';
|
|
7
7
|
import { fetchProjectRecipe, resolveScope, readCachedScope, cacheScope } from './core/projectRecipe.js';
|
|
8
|
+
import { initExperiments } from './core/experiments.js';
|
|
8
9
|
import { onPageView, initFunnelClickTracking, initPurchaseDataLayerWatcher } from './ecommerce/funnel.js';
|
|
9
10
|
import { maybeMountButton, maybeMountGallery, initPickerBridge } from './tryon/automount.js';
|
|
10
11
|
import { cartSelfTest } from './platforms/index.js';
|
|
@@ -27,6 +28,7 @@ import * as tryon from './tryon/bridge.js';
|
|
|
27
28
|
setCollectionScope(scope);
|
|
28
29
|
cacheScope(cfg.projectId, scope);
|
|
29
30
|
log('escopo de coleta', scope);
|
|
31
|
+
try { initExperiments(project, cfg.projectId, cfg.product); } catch (_) {} // teste A/B: bucketing do visitante
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
34
|
|
package/src/platforms/vtex.js
CHANGED
|
@@ -30,6 +30,105 @@ export function resolveSku() {
|
|
|
30
30
|
|
|
31
31
|
const norm = (s) => String(s == null ? '' : s).trim().toLowerCase();
|
|
32
32
|
|
|
33
|
+
// ===== VTEX FastStore (ex.: Época) — minicart via store Zustand "cart-storage" =====
|
|
34
|
+
// A Época roda FastStore (Next.js headless): o minicart NÃO é o orderForm legado nem o
|
|
35
|
+
// fs::cart do @faststore/sdk — é uma store Zustand própria (persist name "cart-storage")
|
|
36
|
+
// que guarda items/cartOpen/totalizers e dirige o contador (data-items no [data-testid=
|
|
37
|
+
// "cart-toggle"]) e a sacola lateral. Um POST cru no orderForm é INVISÍVEL pra ela.
|
|
38
|
+
// A própria store expõe addToCart(item, origin, qty, openDrawer) que faz TUDO de forma
|
|
39
|
+
// nativa: add no servidor + atualiza contador + abre a sacola + toast. Pegamos a store
|
|
40
|
+
// pelo runtime webpack do Next (sem expor nada global): empurramos um "chunk" pra obter
|
|
41
|
+
// __webpack_require__, achamos o módulo da store pelo código-fonte da factory (sem
|
|
42
|
+
// executar nada novo) e lemos a store já instanciada. Tudo defensivo: se não achar
|
|
43
|
+
// (VTEX IO Mascavo, legacy, etc.), retorna null e caímos no caminho antigo.
|
|
44
|
+
let _fsStore; // undefined = ainda não tentou | null = não existe | função = a store
|
|
45
|
+
export function getFsCartStore() {
|
|
46
|
+
if (_fsStore !== undefined) return _fsStore;
|
|
47
|
+
_fsStore = null;
|
|
48
|
+
try {
|
|
49
|
+
const ck = Object.keys(window).find((k) => /^webpackChunk/.test(k));
|
|
50
|
+
if (!ck || !window[ck] || typeof window[ck].push !== 'function') return _fsStore;
|
|
51
|
+
let req = null;
|
|
52
|
+
try { window[ck].push([['mk-cart-' + Math.random().toString(36).slice(2)], {}, (r) => { req = r; }]); } catch (_) {}
|
|
53
|
+
if (!req || !req.m) return _fsStore;
|
|
54
|
+
let targetId = null;
|
|
55
|
+
for (const id in req.m) {
|
|
56
|
+
try {
|
|
57
|
+
const src = req.m[id].toString();
|
|
58
|
+
if (src.indexOf('cart-storage') >= 0 && src.indexOf('addToCart') >= 0 && src.indexOf('toggleCart') >= 0) { targetId = id; break; }
|
|
59
|
+
} catch (_) {}
|
|
60
|
+
}
|
|
61
|
+
if (targetId == null) return _fsStore; // não é FastStore com cart-storage
|
|
62
|
+
const mod = req(targetId); // módulo já carregado → retorna cache (sem reexecutar)
|
|
63
|
+
for (const k in mod) {
|
|
64
|
+
try {
|
|
65
|
+
const v = mod[k];
|
|
66
|
+
if (typeof v === 'function' && typeof v.getState === 'function') {
|
|
67
|
+
const st = v.getState();
|
|
68
|
+
if (st && typeof st.addToCart === 'function' && Array.isArray(st.items)) { _fsStore = v; break; }
|
|
69
|
+
}
|
|
70
|
+
} catch (_) {}
|
|
71
|
+
}
|
|
72
|
+
} catch (_) { _fsStore = null; }
|
|
73
|
+
return _fsStore;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Soma o valor do carrinho (em reais) a partir dos totalizers da store (centavos).
|
|
77
|
+
function fsCartValue(state) {
|
|
78
|
+
try {
|
|
79
|
+
const tz = (state && state.totalizers) || [];
|
|
80
|
+
if (!tz.length) return null;
|
|
81
|
+
const cents = tz.reduce((acc, t) => acc + (Number(t && t.value) || 0), 0);
|
|
82
|
+
return cents > 0 ? cents / 100 : null;
|
|
83
|
+
} catch (_) { return null; }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Adiciona via a store nativa do FastStore (server + contador + sacola). Retorna o
|
|
87
|
+
// result no formato do adapter (com drawerHandled:true) ou null se a store não existir.
|
|
88
|
+
async function fsStoreAdd(ids, quantity) {
|
|
89
|
+
const store = getFsCartStore();
|
|
90
|
+
if (!store) return null;
|
|
91
|
+
const list = (Array.isArray(ids) ? ids : [ids]).map((x) => String(x)).filter(Boolean);
|
|
92
|
+
if (!list.length) return null;
|
|
93
|
+
const add = store.getState().addToCart;
|
|
94
|
+
if (typeof add !== 'function') return null;
|
|
95
|
+
let okAny = false;
|
|
96
|
+
for (let i = 0; i < list.length; i++) {
|
|
97
|
+
const openDrawer = i === list.length - 1; // abre a sacola só no último item
|
|
98
|
+
try { await store.getState().addToCart({ id: list[i], seller: '1' }, 'mk-tryon', quantity || 1, openDrawer); okAny = true; }
|
|
99
|
+
catch (_) { /* tenta os demais */ }
|
|
100
|
+
}
|
|
101
|
+
if (!okAny) return null;
|
|
102
|
+
const s2 = store.getState();
|
|
103
|
+
const itemCount = (s2.items || []).reduce((n, it) => n + (Number(it && it.quantity) || 1), 0);
|
|
104
|
+
return { platform: 'vtex', skuId: list.join(','), itemCount: itemCount || null, cartValue: fsCartValue(s2), currency: s2.currencyCode || 'BRL', drawerHandled: true };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Abre a sacola lateral. 1) store FastStore (cartOpen) — idempotente, nunca fecha.
|
|
108
|
+
// 2) clique no gatilho do minicart (seletores comuns VTEX FastStore/IO/legacy). true se abriu.
|
|
109
|
+
export function openCartDrawer() {
|
|
110
|
+
try {
|
|
111
|
+
const store = getFsCartStore();
|
|
112
|
+
if (store) {
|
|
113
|
+
const st = store.getState();
|
|
114
|
+
if (st && st.cartOpen) return true; // já aberta
|
|
115
|
+
if (typeof store.setState === 'function') { store.setState({ cartOpen: true }); return true; }
|
|
116
|
+
if (st && typeof st.toggleCart === 'function') { st.toggleCart(); return true; }
|
|
117
|
+
}
|
|
118
|
+
} catch (_) {}
|
|
119
|
+
const sels = [
|
|
120
|
+
'[data-testid="cart-toggle"]', // FastStore (Época)
|
|
121
|
+
'button[aria-label="Abrir carrinho de compras"]',
|
|
122
|
+
'[class*="minicart" i] button', 'button[class*="minicart" i]', '[class*="miniCart" i] button',
|
|
123
|
+
'.vtexsc-cart', '.fn-minicart', '#header-cart', '[class*="cartIcon" i]',
|
|
124
|
+
'[aria-label*="carrinho" i]', '[aria-label*="sacola" i]', '[data-testid*="cart" i] button'
|
|
125
|
+
];
|
|
126
|
+
for (const s of sels) {
|
|
127
|
+
try { const el = document.querySelector(s); if (el) { el.click(); return true; } } catch (_) {}
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
|
|
33
132
|
// VTEX IO (React): sem vtexjs/skuJson_0 — adiciona via a API REST de orderForm
|
|
34
133
|
// (pega/cria o orderForm do usuário e dá POST no item). skuId = id NUMÉRICO do SKU.
|
|
35
134
|
async function ioAddToCart(skuIds, quantity) {
|
|
@@ -72,6 +171,12 @@ export async function addToCart(opts) {
|
|
|
72
171
|
const skuRes = resolveSku();
|
|
73
172
|
const skuId = sku || (skuRes && skuRes.value) || null;
|
|
74
173
|
if (!skuId) throw new Error('vtex: skuId não resolvido (IO)');
|
|
174
|
+
|
|
175
|
+
// FastStore (Época): usa a store nativa do minicart (add server + contador + sacola).
|
|
176
|
+
// Se não for FastStore (Mascavo etc.) → fsStoreAdd retorna null e cai no orderForm REST.
|
|
177
|
+
const fs = await fsStoreAdd(skuId, quantity);
|
|
178
|
+
if (fs) return fs;
|
|
179
|
+
|
|
75
180
|
return ioAddToCart(skuId, quantity);
|
|
76
181
|
}
|
|
77
182
|
|
|
@@ -80,6 +185,9 @@ export async function addToCart(opts) {
|
|
|
80
185
|
export async function addToCartBatch(norms) {
|
|
81
186
|
const ids = (norms || []).map((n) => n && (n.sku || (resolveSku() || {}).value)).filter(Boolean);
|
|
82
187
|
if (!ids.length) throw new Error('vtex: nenhum skuId pro batch');
|
|
188
|
+
// FastStore (Época): store nativa primeiro (1 add por variante, abre a sacola no fim).
|
|
189
|
+
const fs = await fsStoreAdd(ids, 1);
|
|
190
|
+
if (fs) return Object.assign({ count: ids.length }, fs);
|
|
83
191
|
if (window.skuJson_0 && window.vtexjs && window.vtexjs.checkout && window.vtexjs.checkout.addToCart) {
|
|
84
192
|
await window.vtexjs.checkout.addToCart(ids.map((id) => ({ id: parseInt(id, 10), quantity: 1, seller: '1' })));
|
|
85
193
|
return { platform: 'vtex', count: ids.length };
|
|
@@ -90,6 +198,16 @@ export async function addToCartBatch(norms) {
|
|
|
90
198
|
// Total do carrinho. Legacy: vtexjs.checkout.orderForm. IO: API REST de orderForm.
|
|
91
199
|
// (CENTAVOS → /100.)
|
|
92
200
|
export async function getCartSummary() {
|
|
201
|
+
// FastStore (Época): lê direto da store Zustand do minicart.
|
|
202
|
+
try {
|
|
203
|
+
const store = getFsCartStore();
|
|
204
|
+
if (store) {
|
|
205
|
+
const st = store.getState();
|
|
206
|
+
const v = fsCartValue(st);
|
|
207
|
+
const items = (st.items || []).reduce((n, i) => n + (Number(i && i.quantity) || 1), 0);
|
|
208
|
+
if (v != null || items) return { value: v, itemCount: items, currency: st.currencyCode || 'BRL' };
|
|
209
|
+
}
|
|
210
|
+
} catch (_) {}
|
|
93
211
|
try {
|
|
94
212
|
const of = window.vtexjs && window.vtexjs.checkout && window.vtexjs.checkout.orderForm;
|
|
95
213
|
if (of && typeof of.value === 'number') {
|
package/src/tryon/automount.js
CHANGED
|
@@ -10,6 +10,7 @@ import { resolveSku } from '../ecommerce/extractors.js';
|
|
|
10
10
|
import { getAvailability, open } from './bridge.js';
|
|
11
11
|
import { resolveAnchor, resolveAnchorObj, pickAnchorVariant } from './anchor.js';
|
|
12
12
|
import { renderButton, normalizeButtonConfig, readTryOnButton } from './buttons/registry.js';
|
|
13
|
+
import { getVariantOverride, initExperiments } from '../core/experiments.js';
|
|
13
14
|
|
|
14
15
|
// Id do host ALEATÓRIO por inicialização — sem prefixo semântico (mk/tryon),
|
|
15
16
|
// pra a loja não conseguir mirar nosso botão nem por id exato nem por prefixo
|
|
@@ -82,6 +83,7 @@ function getTemplateCached() {
|
|
|
82
83
|
_tplPromise = fetchProjectRecipe()
|
|
83
84
|
.then((p) => {
|
|
84
85
|
if (!p) { _tplPromise = null; return null; } // recipe NÃO carregou (falha) → retry no próximo
|
|
86
|
+
try { initExperiments(p, getConfig().projectId, getConfig().product); } catch (_) {} // teste A/B (idempotente — garante bucketing antes do mount)
|
|
85
87
|
return readTryOnButton((p.template && p.template.tryOnButton) || null) || { __loaded: true }; // carregou; sem botão → sentinela
|
|
86
88
|
})
|
|
87
89
|
.catch(() => { _tplPromise = null; return null; });
|
|
@@ -255,6 +257,7 @@ function insertByPosition(ref, node, position) {
|
|
|
255
257
|
*/
|
|
256
258
|
export async function maybeMountButton(pageType) {
|
|
257
259
|
const cfg = getConfig();
|
|
260
|
+
let _abMain = null; // teste A/B: main efetivo (recipe + override da variante), usado no render
|
|
258
261
|
|
|
259
262
|
if (pageType !== 'pdp') { removeButton(); return; }
|
|
260
263
|
if (!cfg.projectId) return;
|
|
@@ -266,9 +269,19 @@ export async function maybeMountButton(pageType) {
|
|
|
266
269
|
// falta dos dois, o resolveAnchor cai na heurística.
|
|
267
270
|
if (!cfg._anchorFromPicker) {
|
|
268
271
|
const tpl0 = await getTemplateCached(); // v2 { main, anchors[], cards } | {__loaded} (sem botão) | null (falhou)
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
+
// Teste A/B: se a variante do visitante tem override de botão, mescla sobre a recipe
|
|
273
|
+
// (merge raso do `main` → variante de "posição" troca os slots; "estilo" troca style/text).
|
|
274
|
+
const _ov = getVariantOverride();
|
|
275
|
+
let _main = tpl0 && tpl0.main, _anchors = tpl0 && tpl0.anchors, _cards = tpl0 && tpl0.cards;
|
|
276
|
+
if (_ov && _ov.tryOnButton) {
|
|
277
|
+
const ob = readTryOnButton(_ov.tryOnButton) || {};
|
|
278
|
+
if (ob.main) { _main = Object.assign({}, _main || cfg.anchor || {}, ob.main); _abMain = _main; }
|
|
279
|
+
if (ob.anchors) _anchors = ob.anchors;
|
|
280
|
+
if (ob.cards) _cards = ob.cards;
|
|
281
|
+
}
|
|
282
|
+
if (_main) cfg.anchor = _main; // PRINCIPAL: estilo (raiz) + posição (slots desktop/mobile)
|
|
283
|
+
if (_anchors) cfg.anchors = _anchors; // EXTRAS: cada um com estilo + posição própria
|
|
284
|
+
if (_cards) cfg.cards = _cards; // GALERIA
|
|
272
285
|
// Monta quando: a API enviou a config do botão (main), OU há âncora inline
|
|
273
286
|
// (__MK.anchor — ex.: extensão/embed da loja; comum no makeup, que não tem
|
|
274
287
|
// recipe de botão no mk-fashion-api), OU forceButton. Sem nenhum dos três NÃO
|
|
@@ -331,10 +344,14 @@ export async function maybeMountButton(pageType) {
|
|
|
331
344
|
// os eventos retidos desta PDP conforme o provador exista ou não.
|
|
332
345
|
try { setTryonState(available ? 'available' : 'unavailable'); } catch (_) {}
|
|
333
346
|
if (!available) { log('auto-mount: produto sem try-on', sku); return; }
|
|
347
|
+
// Teste A/B holdout: o produto TEM provador (available), mas esta variante NÃO
|
|
348
|
+
// mostra o botão. Não monta — mas os eventos seguem coletados e carimbados com a
|
|
349
|
+
// variante (é assim que se mede o ROI do provador).
|
|
350
|
+
if (getVariantOverride().holdout) { removeButton(); log('auto-mount: holdout — botão suprimido'); return; }
|
|
334
351
|
|
|
335
352
|
const tpl = await getTemplateCached(); // v2 { main, anchors[], cards }
|
|
336
353
|
const isMobile = window.matchMedia('(max-width: 767px)').matches;
|
|
337
|
-
const config = normalizeButtonConfig((tpl && tpl.main) || cfg.anchor || {}, isMobile); //
|
|
354
|
+
const config = normalizeButtonConfig(_abMain || (tpl && tpl.main) || cfg.anchor || {}, isMobile); // A/B override > recipe main > âncora inline
|
|
338
355
|
|
|
339
356
|
// clique do botão — na PDP re-resolve o SKU (caso troquem a variante depois).
|
|
340
357
|
// Emite o clique IMEDIATAMENTE (antes de qualquer async que possa abortar o open).
|
package/src/tryon/bridge.js
CHANGED
|
@@ -6,6 +6,7 @@ import { track } from '../core/transport.js';
|
|
|
6
6
|
import { addToCart as cartAdd, openCartAfterAdd, redirectToCart } from '../platforms/index.js';
|
|
7
7
|
import { getButtonHosts } from './automount.js';
|
|
8
8
|
import { resolveLauncher } from './launchers/index.js';
|
|
9
|
+
import { getVariantOverride } from '../core/experiments.js';
|
|
9
10
|
|
|
10
11
|
let modal = null;
|
|
11
12
|
let iframe = null;
|
|
@@ -74,10 +75,11 @@ export async function open(options) {
|
|
|
74
75
|
const isMobile = (window.innerWidth || 0) <= 768;
|
|
75
76
|
const size = (isMobile && launcher0.modalSizeMobile) || launcher0.modalSize || { width: 430, height: 800 };
|
|
76
77
|
const ccfg = getConfig();
|
|
78
|
+
const vov = getVariantOverride(); // teste A/B: override de tamanho do modal (variante "tamanho")
|
|
77
79
|
currentConfig = {
|
|
78
80
|
projectId, identifier,
|
|
79
|
-
width: options.width || ccfg.modalWidth || size.width,
|
|
80
|
-
height: options.height || ccfg.modalHeight || size.height
|
|
81
|
+
width: options.width || vov.modalWidth || ccfg.modalWidth || size.width,
|
|
82
|
+
height: options.height || vov.modalHeight || ccfg.modalHeight || size.height
|
|
81
83
|
};
|
|
82
84
|
pendingRedirect = false;
|
|
83
85
|
setupMessageListener();
|