PageSourceSearch

https://www.morvo.co.uk/widget/morvo.min.js?site_id=$%7Ba%7C%7C

js morvo.co.uk collected 2026-09-24 09:53:22 UTC 103,855 bytes, 192 lines download raw bytes

1(()=>{(function(){if(console.log("start150"),document.contentType&&document.contentType!=="text/html")console.info("Morvo: non-HTML document ("+document.contentType+"), widget not started.");else{const lt=window.__MORVO_CONFIG__&&window.__MORVO_CONFIG__.preview_building;if(lt&&lt.token){document.getElementById("llm-power-building")||function(){const Ee=String(lt.api_base||"https://app.morvo.co.uk").replace(/\/+$/,""),ae=document.createElement("div");ae.id="llm-power-building";const he=ae.attachShadow({mode:"open"});he.innerHTML=`<link rel="stylesheet" href="https://morvo.co.uk/widget/morvo.css?v=207"><div id="llmPower" class="open"><div class="outer-wrapper"><div class="header" style="display:flex;align-items:center;justify-content:flex-start;padding-bottom:14px"><img src="https://morvo.co.uk/widget/morvo-main.webp" alt="Morvo" style="height:22px;width:auto;display:block"/></div><div style="flex:1 1 auto;display:flex;align-items:center;justify-content:center"><div style="text-align:center;width:82%;max-width:320px;font:13px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;color:#1a1d21;padding-bottom:40px"><b style="font-size:15px;display:block;margin-bottom:14px">Building your demo</b><div class="bar" style="height:6px;border-radius:3px;background:#ececec;overflow:hidden;margin:0 0 10px"><div class="fill" style="height:100%;width:5%;background:#1a1d21;border-radius:3px;transition:width .6s ease"></div></div><div class="step" style="color:#5b6270">Queued\u2026</div></div></div></div></div>`,(document.body||document.documentElement).appendChild(ae);const ge=he.querySelector(".fill"),le=he.querySelector(".step"),we={queued:["Queued\u2026",8],fetching:["Reading your store\u2026",25],building:["Building your catalogue\u2026",55],warming:["Teaching Morvo your range\u2026",85]};let Ce=!1;function Ae(P,U){ge&&(ge.style.width=P+"%"),le&&(le.textContent=U)}function Le(){Ce||fetch(Ee+"/api/preview/status?token="+encodeURIComponent(lt.token),{cache:"no-store"}).then(function(P){return P.json()}).then(function(P){if(P.status==="live"&&P.subscription_key){Ce=!0,Ae(100,"Ready \u2014 loading Morvo\u2026"),setTimeout(function(){ae.remove();try{chrome.runtime.sendMessage({type:"morvo_preview_live",subscription_key:P.subscription_key,company_name:P.company_name||"",api_base:Ee})}catch{}},900);return}if(P.status==="failed"){Ce=!0,ge&&(ge.style.background="#b45309"),Ae(100,P.failure&&P.failure.message||"Couldn't build a preview here.");return}const U=we[P.status]||we.queued;P.status==="building"&&P.product_count?Ae(Math.min(70,U[1]+10),"Building your catalogue \u2014 "+P.product_count+" products\u2026"):Ae(U[1],U[0]),setTimeout(Le,2500)}).catch(function(){setTimeout(Le,4e3)})}Le()}();return}if(window.llmPowerLoaded||document.getElementById("llm-power-host"))return;(async()=>{try{let Me=function(){let e=String(location.pathname||"/");return e=e.replace(/^\/[a-z]{2}(?:-[a-z]{2})?(?=\/(?:products|collections|pages|blogs)\/)/i,""),e=e.replace(/^\/collections\/[^\/]+(?=\/products\/)/i,""),e||"/"},wo=function(e){return String(e||"").replace(/^\/+|\/+$/g,"")},bo=function(e){const t=wo(window.location.pathname);return e.some(n=>wo(n)===t)},Bn=function(){We||(Je=0,He.innerText=dt[Je],We=setInterval(()=>{Je=(Je+1)%dt.length,He.innerText=dt[Je]},Rn))},Rt=function(){We&&(clearInterval(We),We=null)},Hn=function(e){e=="***"?Bn():(Rt(),He.innerText=e)},_o=function(e){const t=document.createElement("div");t.className="chatGroup group"+e,V.insertBefore(t,fn)},Bt=function(e){return String(e==null?"":e).replace(/['"\\<>`]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})},k=function(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")},So=function(e){return k(e).replace(/\*\*([^*\n]{1,200}?)\*\*/g,"<strong>$1</strong>")},ko=function(e){if(!e)return"";let t=k(e);return t=t.replace(/!\[([^\]]*)\]\((https:\/\/morvo\.co\.uk\/widget\/swatches\/[A-Za-z0-9\/._-]+)\)/g,'<img class="swatchChip" src="$2" alt="$1"/>'),t=t.replace(/\*\*(.+?)\*\*/gs,"<strong>$1</strong>"),t=t.replace(/(^|\n)((?:- [^\n]+\n?){2,})/g,function(o,r,i){const s=i.trim().split(/\n/).map(function(c){return c.replace(/^- /,"").trim()}).filter(function(c){return c.length>0}).map(function(c){return"<li>"+c+"</li>"}).join("");return r+"<ul>"+s+"</ul>"}),t=t.replace(/\[([^\]\n]{1,120})\]\((https?:\/\/[^\s)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>'),t=t.replace(/(^|[\s(])(https?:\/\/[^\s<>"')]+)/g,'$1<a href="$2" target="_blank" rel="noopener noreferrer">$2</a>'),t=t.replace(/(^|\s)([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/g,'$1<a href="mailto:$2">$2</a>'),t=t.split(/\n{2,}/).map(function(o){return o.trim()}).filter(function(o){return o.length>0}).join("</p><p>"),t=t.replace(/\n/g,"<br>"),t},xo=function(e){return("<p>"+e+"</p>").replace(/<p><ul>/g,"<ul>").replace(/<\/ul><\/p>/g,"</ul>").replace(/<\/ul><br>/g,"</ul><p>").replace(/<p><\/p>/g,"")},be=function(e,t,n){if(e!==""){const o=document.createElement("div"),r=h.querySelector(".group"+n);
1o.className="chatBubble "+t,t==="user"?o.innerHTML="<p>"+k(e)+"</p>":o.innerHTML=xo(ko(e)),r.appendChild(o),V.scrollTo({top:r.offsetTop-80,behavior:"smooth"})}},jn=function(e,t){return t?2400:Math.max(90,Math.min(700,e/.35))},$n=function(){return!Dn&&!document.hidden},Vn=function(e){if(e=Wn(e),(e.match(/\*\*/g)||[]).length%2===1){const n=e.lastIndexOf("**");e=e.slice(0,n)+e.slice(n+2)}return ko(e)},Ht=function(){j.innerHTML=xo(Vn(te))},Eo=function(e){if(_e=null,!j)return;Ne||(Ne=e);const t=Math.min(100,e-Ne);Ne=e;const n=ve.length-te.length;if(n>0){const o=Math.max(1,Math.round(jn(n,Se)*t/1e3));te=ve.slice(0,te.length+o),Ht()}te.length<ve.length?_e=requestAnimationFrame(Eo):Se&&ke(!1)},Co=function(){if(!$n()){te=ve,Ht(),Se&&ke(!1);return}_e||(Ne=0,_e=requestAnimationFrame(Eo))},ke=function(e){_e&&(cancelAnimationFrame(_e),_e=null),j&&(e?j.remove():(j.classList.remove("streaming"),Gn(j.innerText||ve))),j=null,te="",ve="",Ne=0,Se=!1},Gn=function(e){try{const t=h.querySelector(".mv-sr-status");if(!t||!e)return;t.textContent="",setTimeout(function(){t.textContent=String(e).slice(0,2e3)},50)}catch{}},Un=function(e,t){if(e){if(Se&&ke(!1),ve+=e,!j){const n=h.querySelector(".group"+t);if(!n)return;j=document.createElement("div"),j.className="chatBubble system streaming",n.appendChild(j),V.scrollTo({top:n.offsetTop-80,behavior:"smooth"}),Rt(),He.innerText=""}Co()}},Fn=function(e){return j?e?(ve=e,Se=!0,e.startsWith(te)||(te=""),Co(),!0):(ke(!0),!1):!1},zn=function(){!j||Se||(te.trim()?ke(!1):ke(!0))},Ao=function(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},ce=function(e,t){var n=Number(e),o=isFinite(n)&&n%1!==0?2:0,r=t||"GBP";try{return new Intl.NumberFormat(void 0,{style:"currency",currency:r,currencyDisplay:"narrowSymbol",minimumFractionDigits:o,maximumFractionDigits:2}).format(n)}catch{}try{return new Intl.NumberFormat(void 0,{style:"currency",currency:r,minimumFractionDigits:o,maximumFractionDigits:2}).format(n)}catch{return({GBP:"\xA3",USD:"$",EUR:"\u20AC"}[r]||r+" ")+e}},Oe=function(){if(Ee!==void 0)return Ee;var e=null;try{var t=window.Shopify;t&&t.currency&&t.currency.active&&(e={active:String(t.currency.active).toUpperCase(),rate:Number(t.currency.rate)})}catch{}if(!e)try{for(var n=document.querySelectorAll("script:not([src])"),o=0;o<n.length&&!e;o++){var r=/Shopify\.currency\s*=\s*(\{[^}]*\})/.exec(n[o].textContent||"");if(r)try{var i=JSON.parse(r[1]);i&&i.active&&(e={active:String(i.active).toUpperCase(),rate:Number(i.rate)})}catch{}}}catch{}if(!e)try{var s=/(?:^|;\s*)cart_currency=([A-Z]{3})/.exec(document.cookie||"");s&&(e={active:s[1],rate:NaN})}catch{}return e&&!(isFinite(e.rate)&&e.rate>0)&&(e.rate=null),Ee=e,e},mt=function(e){var t=/\/products\/([a-z0-9][a-z0-9\-_%.]*)/i.exec(String(e||""));if(!t)return"";try{return decodeURIComponent(t[1])}catch{return t[1]}},Lo=function(e){var t=Oe();return!!(t&&e&&t.active!==String(e).toUpperCase())},ht=function(e){try{return ce(0,e).replace(/[\d.,\s]/g,"")}catch{return String(e||"")+" "}},To=function(e){if(!e)return Promise.resolve(null);if(ae[e])return Promise.resolve(ae[e]);if(he[e])return he[e];var t=fetch(location.origin+"/products/"+encodeURIComponent(e)+".js",{credentials:"same-origin"}).then(function(n){return n.ok?n.json():null}).then(function(n){if(!n||typeof n.price!="number")return null;var o={};(n.variants||[]).forEach(function(i){i&&i.id!=null&&typeof i.price=="number"&&(o[String(i.id)]=i.price/100)});var r={price:n.price/100,variants:o};return ae[e]=r,r}).catch(function(){return null}).then(function(n){return delete he[e],n});return he[e]=t,t},Dt=function(e,t){var n=Oe();if(n){var o=h.querySelector(".group"+e);if(o){var r=(t||[]).filter(function(c){return c&&Number(c.price)>0&&Lo(c.currency)&&mt(c.link)});if(r.length!==0){var i=r[0].currency,s=o.__mvMarketMap||(o.__mvMarketMap={});Promise.all(r.map(function(c){var a=mt(c.link);return To(a).then(function(l){var d=Number(c.price),p=l&&l.price>0?l.price:n.rate?d*n.rate:null;p>0&&(s[String(d)]=p,!n.rate&&d>0&&(n.rate=p/d),o.querySelectorAll(".product").forEach(function(f){var m=f.querySelector("a[href]");if(!(!m||mt(m.getAttribute("href"))!==a)){var y=f.querySelector(".productPrice strong");y&&!/Enquiry/.test(y.textContent)&&(y.textContent=ce(p,n.active)),f.setAttribute("data-market-handle",a)}}))})})).then(function(){Yn(o,i,n,s)})}}}},Jn=function(e){var t=Oe();if(ge=null,!(!t||!e||!e.currency||!Lo(e.currency))){var n=Array.isArray(e.products)?e.products:[],o={base:String(e.currency).toUpperCase(),map:{},pending:0};
1ge=o,n.forEach(function(r){var i=r&&r.handle?String(r.handle):mt(r&&r.link),s=Number(r&&r.price);!i||!(s>0)||(o.pending++,To(i).then(function(c){var a=c&&c.price>0?c.price:t.rate?s*t.rate:null;a>0&&(o.map[String(s)]=a,t.rate||(t.rate=a/s))}).then(function(){o.pending--,j&&Ht()}))})}},Wn=function(e){var t=ge,n=Oe();if(!t||!n||!e)return e;var o=ht(t.base),r=ht(n.active);if(!o||o===r)return e;var i=new RegExp(o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\s?(\\d[\\d,]*(?:\\.\\d{1,2})?)","g");return e.replace(i,function(s,c){var a=Number(String(c).replace(/,/g,""));if(!(a>0))return s;var l=t.map[String(a)];return l>0?ce(l,n.active):t.pending>0?r+"\u2026":n.rate?ce(a*n.rate,n.active):s})},Yn=function(e,t,n,o){var r=ht(t),i=ht(n.active);if(!(!r||r===i)){var s=new RegExp(r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\s?(\\d[\\d,]*(?:\\.\\d{1,2})?)","g");e.querySelectorAll(".chatBubble:not(.user), .outfit-why, .outfit-title").forEach(function(c){for(var a=document.createTreeWalker(c,NodeFilter.SHOW_TEXT,null),l=[];a.nextNode();)l.push(a.currentNode);l.forEach(function(d){s.lastIndex=0,s.test(d.nodeValue)&&(s.lastIndex=0,d.nodeValue=d.nodeValue.replace(s,function(p,f){var m=Number(String(f).replace(/,/g,""));if(!(m>0))return p;var y=o[String(m)]!=null?o[String(m)]:n.rate?m*n.rate:null;return y>0?ce(y,n.active):p}))})})}},gt=function(e,t,n,o,r){try{setTimeout(function(){Dt(t,e)},0)}catch{}const i=document.createElement("div"),s=h.querySelector(".group"+t),c={};(Array.isArray(o)?o:[]).forEach(function(d){d&&d.name&&Array.isArray(d.shades)&&d.shades.length>0&&(c[d.name]=d.shades)});const a=Object.keys(c).length>0;i.className=a?"grid-products shade-layout":"grid-products",e.forEach(d=>{const p=document.createElement("div");p.className="product",p.innerHTML=$t(d,"grid");const f=c[d.name||""];if(f){const m={};(d.variants||[]).forEach(function(_){_&&_.title&&(m[String(_.title)]=!Pe(_))});const y=document.createElement("div");y.className="shadeBlock";let C='<p class="shadeRowLabel">Your shades</p><div class="shadeRow" role="listbox" aria-label="Choose your shade">';f.forEach(function(_){if(!_||!_.label)return;const u=m[_.label]!==!1,O=/^#[0-9a-fA-F]{6}$/.test(_.hex||"")?_.hex:"#e8e0d8";C+='<button type="button" class="shadeSwatch'+(u?"":" oos")+'"'+(u?"":" disabled")+' data-shade="'+k(_.label)+'" style="background:'+O+'" aria-label="Shade '+k(_.label)+(u?"":" \u2014 out of stock")+'"><span>'+k(_.label)+"</span></button>"}),C+="</div>",y.innerHTML=C,y.appendChild(p),i.appendChild(y)}else i.appendChild(p)}),a&&setTimeout(function(){i.querySelectorAll(".shadeBlock").forEach(function(d){const p=d.querySelector(".shadeSwatch:not(.oos)");p&&p.click()})},0),e.length>0&&s.appendChild(i);const l=r&&typeof r.from=="number"&&r.heading&&!a&&r.from>0&&r.from<i.children.length?r.from:-1;if(l>0){const d=document.createElement("div");d.className=i.className,Array.prototype.slice.call(i.children,l).forEach(function(f){d.appendChild(f)});const p=document.createElement("p");p.className="more-heading",p.textContent=String(r.heading),s.appendChild(p),s.appendChild(d)}V.scrollTo({top:s.offsetTop-80,behavior:"smooth"}),n!=="rebuild"&&(L++,localStorage.setItem(I("chatGroup"),L))},Pe=function(e){return e.inventoryQuantity!==null&&e.inventoryQuantity!==void 0&&Number(e.inventoryQuantity)<=0},Mo=function(e,t,n){return Array.isArray(e.options)&&e.options.some(function(o){return o&&o.name===t&&o.value===n})},Xn=function(e){if(!e.every(function(n){return Array.isArray(n.options)&&n.options.length>0}))return[];const t=[];return e[0].options.forEach(function(n){n&&n.name&&t.push({name:n.name,values:[]})}),e.forEach(function(n){n.options.forEach(function(o){if(!o||!o.name)return;let r=null;for(let i=0;i<t.length;i++)if(t[i].name===o.name){r=t[i];break}r||(r={name:o.name,values:[]},t.push(r)),o.value&&r.values.indexOf(o.value)===-1&&r.values.push(o.value)})}),t.filter(function(n){return n.values.length>1})},$t=function(e,t){t=t||"bundle";const n=Bt(e.link||""),o="'"+Ao(e.name||"")+"','"+n+"','"+(Number(e.price)>0?Number(e.price):"")+"','"+t+"','"+String(e.id==null?"":e.id).replace(/['\\]/g,"")+"'",r=e.img&&e.img!=="null"?'<img src="'+k(Bt(e.img))+'" alt="'+k(e.name||"")+'" />':'<span class="imgPlaceholder" aria-hidden="true"></span>',i=Array.isArray(e.variants)?e.variants.filter(function(p){return p&&(T==="shopify"?p.id:p.id||p.title)}):[],s=i.length>1;let c="",a="";if(s){const p=Xn(i);if(a="v"+ ++Qn,jt[a]=i,p.length>
10)p.forEach(function(f){let m='<option value="" selected disabled>'+k(f.name)+"</option>";f.values.forEach(function(y){const C=i.some(function(_){return Mo(_,f.name,y)&&!Pe(_)});m+='<option value="'+k(y)+'"'+(C?"":" disabled")+">"+k(y)+(C?"":" \u2014 out of stock")+"</option>"}),c+='<select class="variantSelect" data-reg="'+a+'" data-axis="'+k(f.name)+'" aria-label="Choose '+k(f.name)+'">'+m+"</select>"});else{let f='<option value="" selected disabled>Choose an option</option>';i.forEach(function(m,y){const C=Pe(m);f+='<option value="'+y+'"'+(C?" disabled":"")+">"+k(String(m.title||""))+(C?" \u2014 out of stock":"")+"</option>"}),c='<select class="variantSelect" data-reg="'+a+'" aria-label="Choose an option">'+f+"</select>"}}let l="";if(go){const p=T==="woocommerce"?e.id!=null&&(String(e.id).match(/(\d+)$/)||[])[1]||"":s?"":i.length===1?String(i[0].id):"",f=e.basket_meta&&typeof e.basket_meta=="object"?e.basket_meta:{},m=f.sku?String(f.sku):"",y=!s&&i.length===1&&i[0].sku?String(i[0].sku):s?"":m,C=f.uuid?String(f.uuid):"",_=T!=="static"?!0:!!H&&!!C&&(s?i.some(function(u){return u.id!=null&&u.sku}):!!y&&(!!p||!!m));(s||p||!s&&m)&&_&&(l='<button type="button" class="basketButton"'+(s?" disabled":"")+' data-reg="'+a+'" data-sku="'+k(y)+'" data-puuid="'+k(C)+'" data-vid="'+k(p)+'" data-name="'+k(Ao(e.name||""))+'" data-url="'+k(e.link||"")+'" data-price="'+(Number(e.price)>0?Number(e.price):"")+'" data-currency="'+k(e.currency||"")+'"><span>'+(s?"Choose an option":"Add to basket")+"</span>"+Io+"</button>")}const d=/^(?:Value|Mid-range|Premium)$/.test(String(e.tier_label||""))?'<span class="tier-tag">'+k(String(e.tier_label))+"</span>":"";return'<a target="_blank" onclick="morvoRecordPdpClick('+o+')" href="'+k(n)+'">'+r+'</a><div class="productInner">'+d+'<p class="productName">'+k(e.name||"")+'</p><p class="productPrice"><strong>'+(Number(e.price)>0?ce(Number(e.price),e.currency):"Instore Enquiry")+"</strong></p>"+c+'<a target="_blank" onclick="morvoRecordPdpClick('+o+')" href="'+k(n)+'" class="productButton"><span>Visit product page</span><svg viewBox="0 0 20 16" fill="none" stroke="#222222" xmlns="http://www.w3.org/2000/svg"><path d="M3.26953 8L11.3437 8" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/><path d="M8 3.33333L12.6667 8L8 12.6667" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/></svg></a>'+l+"</div>"},No=function(e,t,n){try{setTimeout(function(){Dt(t,[].concat.apply([],(e||[]).map(function(r){return r&&r.products||[]})))},0)}catch{}const o=h.querySelector(".group"+t);!o||!Array.isArray(e)||e.length===0||(e.forEach((r,i)=>{const s=Array.isArray(r.products)?r.products:[];if(s.length===0)return;const c=document.createElement("div");c.className="outfit-bundle";const a=r.badge_label&&String(r.badge_label).trim()||"Outfit idea",l=r.title&&String(r.title).trim()||a+" "+(i+1);let d='<div class="outfit-head"><span class="outfit-badge">'+k(a+" "+(i+1))+'</span><span class="outfit-title">'+k(l)+"</span></div>";r.why&&String(r.why).trim()&&(d+='<p class="outfit-why">'+So(String(r.why).trim())+"</p>"),d+='<div class="grid-products outfit-grid">',s.forEach(p=>{d+='<div class="product">'+$t(p)+"</div>"}),d+="</div>",c.innerHTML=d,o.appendChild(c)}),V.scrollTo({top:o.offsetTop-80,behavior:"smooth"}),n!=="rebuild"&&(L++,localStorage.setItem(I("chatGroup"),L)))},Oo=function(e,t,n){try{setTimeout(function(){Dt(t,[].concat.apply([],(e||[]).map(function(r){return r&&r.products||[]})))},0)}catch{}const o=h.querySelector(".group"+t);!o||!Array.isArray(e)||e.length===0||e.forEach(r=>{if(!r)return;const i=Array.isArray(r.products)?r.products:[];if(i.length===0)return;const s=r.kind==="alternatives"?"alternatives":"add_ons",c=document.createElement("div");c.className="outfit-bundle upsell-card upsell-"+(s==="alternatives"?"alts":"addons");const a=r.badge_label&&String(r.badge_label).trim()||(s==="alternatives"?"Worth a look":"Goes with it"),l=r.title&&String(r.title).trim()||a;let d='<div class="outfit-head"><span class="outfit-badge">'+k(a)+'</span><span class="outfit-title">'+k(l)+"</span></div>";const p=r.why&&String(r.why).trim()||"";p&&(d+='<p class="outfit-why">'+So(p)+"</p>"),d+='<div class="grid-products outfit-grid">
1',i.forEach(f=>{d+='<div class="product">'+$t(f,"upsell")+"</div>"}),d+="</div>",c.innerHTML=d,o.appendChild(c)})},Po=function(e,t){const n=h.querySelector(".group"+e);if(!n)return;const o=document.createElement("div");o.className="order-form",o.innerHTML='<label class="of-label">Order number<input class="of-ref" type="text" inputmode="text" autocomplete="off" maxlength="32" /></label><label class="of-label">Email used at checkout<input class="of-email" type="email" autocomplete="email" /></label><button type="button" class="of-submit">Check my order</button><p class="of-error" hidden></p>';const r=o.querySelector(".of-ref"),i=o.querySelector(".of-email"),s=o.querySelector(".of-submit"),c=o.querySelector(".of-error"),a=l=>{c.textContent=l,c.hidden=!1};s.addEventListener("click",async()=>{const l=(r.value||"").trim(),d=(i.value||"").trim();if(c.hidden=!0,!l||!d){a("Enter your order number and email.");return}s.disabled=!0,s.textContent="Checking\u2026";try{const p=await fetch(ze+"/api/order-status",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscription_key:ye,session_id:se,order_ref:l,email:d})}),f=await p.json().catch(()=>({}));if(p.ok&&f.card){const m=f.card,y=['<p class="of-status-head">Order #'+k(m.order_ref||l)+" \u2014 <strong>"+k(m.status||"In progress")+"</strong></p>"];if(m.financial_status&&y.push('<p class="of-status-row">Payment: '+k(m.financial_status)+"</p>"),m.courier||m.tracking_url){const C=k(m.courier||"Track your parcel");y.push('<p class="of-status-row">'+(m.tracking_url?'<a href="'+k(m.tracking_url)+'" target="_blank" rel="noopener noreferrer">'+C+" tracking</a>":C)+"</p>")}m.destination&&y.push('<p class="of-status-row">Heading to '+k(m.destination)+"</p>"),y.push('<p class="of-status-note">For your privacy this isn\u2019t kept in the chat history.</p>'),o.innerHTML='<div class="of-status">'+y.join("")+"</div>",oe("assistant","[Order status shown \u2014 not kept in history]"),Qe()}else a(f&&f.error||"Order lookup failed \u2014 please try again."),s.disabled=!1,s.textContent="Check my order"}catch{a("Order lookup failed \u2014 please try again."),s.disabled=!1,s.textContent="Check my order"}}),n.appendChild(o),t==="new"&&o.scrollIntoView({behavior:"smooth",block:"nearest"})},qo=function(e,t,n){const o=h.querySelector(".group"+t);if(!o||!Array.isArray(e)||e.length===0)return;const r=4,i=new Map,s=document.createElement("div");s.className="compare-select";const c=document.createElement("p");c.className="cs-hint",c.textContent="Select 2\u2013"+r+" to compare",s.appendChild(c);const a=document.createElement("div");a.className="grid-products compare-select-grid",e.forEach(m=>{const y=document.createElement("div");y.className="product cs-product";const C=Number(m.price)>0?ce(Number(m.price),m.currency):"Instore Enquiry",_=m.label?'<p class="cs-label">'+k(m.label)+"</p>":"",u=m.img&&m.img!=="null"?'<img src="'+k(Bt(m.img))+'" alt="'+k(m.name||"")+'" />':'<span class="imgPlaceholder" aria-hidden="true"></span>';y.innerHTML='<div class="cs-imgwrap">'+u+'<span class="cs-tick"><svg viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="3.2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12l5 5L20 7"/></svg></span></div><div class="productInner"><p class="productName">'+k(m.name||"")+"</p>"+_+'<p class="productPrice"><strong>'+C+"</strong></p></div>",y.addEventListener("click",()=>{const O=String(m.id);if(i.has(O))i.delete(O),y.classList.remove("selected");else{if(i.size>=r)return;i.set(O,m),y.classList.add("selected")}f()}),a.appendChild(y)}),s.appendChild(a);const l=document.createElement("div");l.className="cs-actionbar";const d=document.createElement("span");d.className="cs-count",d.textContent="0 selected";const p=document.createElement("button");p.type="button",p.className="cs-compare",p.disabled=!0,p.textContent="Compare",l.appendChild(d),l.appendChild(p),s.appendChild(l);function f(){const m=i.size;d.textContent=m+" selected",p.disabled=m<2,p.textContent=m>=2?"Compare "+m:"Compare"}p.addEventListener("click",()=>{if(i.size<2)return;const m=[...i.keys()],y=[...i.values()].map(C=>
1C.name).filter(Boolean);s.classList.add("cs-done"),a.querySelectorAll(".cs-product").forEach(C=>{C.style.pointerEvents="none"}),p.disabled=!0,Ye=m,yt="compare_select",R.value="Compare: "+y.join("  \xB7  "),pe.click()}),o.appendChild(s),V.scrollTo({top:o.offsetTop-80,behavior:"smooth"}),n!=="rebuild"&&(L++,localStorage.setItem(I("chatGroup"),L))},I=function(e){return qe==="launcher"?e:e+"__"+(Ke||qe)},Zn=function(e){const t=Me().toLowerCase().replace(/\/+$/,"")||"/";let n=/^\/products\/([^\/]+)/.exec(t);return e==="pdp"&&n?"pdp:"+n[1]:(n=/^\/collections\/([^\/]+)/.exec(t),e==="plp"&&n?"plp:"+n[1]:e+":"+t)},er=function(){if(!(qe==="launcher"||!Ke))try{let e=JSON.parse(localStorage.getItem(Ro)||"[]");Array.isArray(e)||(e=[]),e=e.filter(t=>t&&t.k!==Ke),e.unshift({k:Ke,t:Date.now()});for(const t of e.slice(Bo))Ho.forEach(n=>localStorage.removeItem(n+"__"+t.k));localStorage.setItem(Ro,JSON.stringify(e.slice(0,Bo)))}catch{}},tr=function(){try{if(localStorage.getItem("morvo_page_convos_v1"))return;for(const e of["pdp","plp","embed","page"]){const t=localStorage.getItem("session_id__"+e);let n=[];try{n=JSON.parse(localStorage.getItem("chatHistory__"+e)||"[]")||[]}catch{n=[]}if(t&&Array.isArray(n)&&n.length>0&&!Re().some(o=>o&&o.id===t)){const o=Re();o.unshift({id:t,title:zo(n),updated_at:Date.now(),messages:n}),o.sort((r,i)=>(i.updated_at||0)-(r.updated_at||0)),Ft(o)}Ho.forEach(o=>localStorage.removeItem(o+"__"+e))}localStorage.setItem("morvo_page_convos_v1","1")}catch{}},xe=function(){try{return JSON.parse(localStorage.getItem(I("chatHistory")))||[]}catch{try{localStorage.removeItem(I("chatHistory"))}catch{}return console.warn("Morvo: unreadable chat history discarded"),[]}},Do=function(){localStorage.removeItem(I("chatHistory")),localStorage.removeItem(I("session_id")),localStorage.removeItem(I("morvo_page_ctx"))},vt=function(){let e=localStorage.getItem(I("session_id"));return e||(e=crypto.randomUUID(),localStorage.setItem(I("session_id"),e)),e},Vt=function(){try{const e=location.pathname,t=e.match(/\/products\/([^\/?#]+)/)||e.match(/\/product\/([^\/?#]+)/),n=t&&t[1]?decodeURIComponent(t[1]).slice(0,128):null,o=e.match(/\/collections\/([^\/?#]+)/)||e.match(/\/product-category\/([^\/?#]+)/),r=o&&o[1]&&o[1]!=="all"?decodeURIComponent(o[1]).slice(0,128):null,i=window.ShopifyAnalytics&&window.ShopifyAnalytics.meta,s=i&&i.page;if(s&&s.pageType==="product"&&s.resourceId)return{type:"product",id:String(s.resourceId).slice(0,128),...n?{handle:n}:{}};if(s&&s.pageType==="collection"&&s.resourceId)return{type:"collection",id:String(s.resourceId).slice(0,128),...r?{handle:r}:{}};if(i&&i.product&&i.product.id)return{type:"product",id:String(i.product.id).slice(0,128),...n?{handle:n}:{}};if(n)return{type:"product",id:n};if(r)return{type:"collection",id:r};if(z&&T!=="shopify"&&T!=="woocommerce")return{type:z.type,id:z.id}}catch{}return null},jo=function(e){try{if(e&&z&&e.id===z.id&&z.title)return z.title}catch{}try{const n=document.querySelector("h1"),o=n&&n.textContent?n.textContent.trim():"";if(o&&o.length<=60)return o}catch{}try{let n=(document.title||"").split(/\s+[–—|·]\s+/)[0].trim();if(n=n.replace(/\s+Archives$/i,""),n&&n.length<=60)return n}catch{}const t=e&&e.id?String(e.id):"";return t&&!/^\d+$/.test(t)?t.replace(/[-_]+/g," ").replace(/\b[a-z]/g,function(n){return n.toUpperCase()}):e&&e.type==="product"?"this product":"this collection"},nr=function(){try{const e=Vt();if(e&&e.type==="product")return e;const t=localStorage.getItem(I("session_id")),n=JSON.parse(localStorage.getItem($o)||"null");if(n&&n.sid===t&&xe().length>0)return n.ctx||null;const o=xe().length===0?Vt():null;localStorage.setItem($o,JSON.stringify({sid:t,ctx:o}));let r=null;try{const i=JSON.parse(localStorage.getItem(wt)||"null");o&&i&&i.id===o.id&&(i.choice==="scoped"||i.choice==="storewide")&&(r=i.choice)}catch{}return localStorage.removeItem(wt),o&&r?{type:o.type,id:o.id,...o.handle?{handle:o.handle}:{},choice:r}:o}catch{return null}},Vo=function(){try{const e=JSON.parse(localStorage.getItem(Gt)||"null");if(!e||e.v!==1||!e.items||typeof e.items!="object")return{};const t=Date.now(),n={};return Ut.forEach(function(o){const r=e.items[o];r&&typeof r=="object"&&typeof r.at=="number"&&t-r.at<rr&&(n[o]=r)}),n}catch{return{}}},Go=function(){return!(!yo||typeof we!="undefined"&&we==="opt_in"&&(typeof le=="undefined"||le!=="granted"))},ir=function(e){if(!Go()||!e||typeof e!="object")return;const t=Vo(),n=Date.now();let o=!1;if(Ut.forEach(function(r){!(r in e)||e[r]===null||e[r]===void 0||(t[r]={value:e[r],sid:se,at:n},o=!0)}),"budget_max"in e&&!("budget_about"in e)&&t.budget_about&&delete t.budget_about,!!o)try{localStorage.setItem(Gt,JSON.stringify({v:1,items:t}))}catch{}},sr=function(){if(!Go())return null;const e=Vo(),t={};let n=!1;return Ut.forEach(function(o){const r=e[o];r&&r.sid!==se&&(t[o]=r.value,n=!0)}),t.budget_about&&!t.budget_max&&delete t.budget_about,n?t:null},Uo=function(){try{localStorage.removeItem(Gt)}catch{}},Re=function(){try{const e=JSON.parse(localStorage.getItem(Fo)||"[]");return Array.isArray(e)?e:[]}catch{return[]}},Ft=function(e){let t=e.slice(0,ar);for(let n=0;n<5;n++)try{return localStorage.setItem(Fo,JSON.stringify(t)),!0}catch{if(t.length<=1)return!1;t=t.slice(0,Math.max(1,t.length-Math.ceil(t.length/4)))}return!1},zo=function(e){const t=(e||[]).find(o=>o&&o.role==="user"&&typeof o.content=="string"),n=t?t.content.trim():"";return n?n.length>60?n.slice(0,57)+"...":n:"New conversation"},Qe=function(){const e=xe();if(!e.length)return;const t=localStorage.getItem(I("session_id"));if(!t)return;const n=Re().filter(o=>o&&o.id!==t);n.unshift({id:t,title:zo(e),updated_at:Date.now(),messages:e}),n.sort((o,r)=>(r.updated_at||0)-(o.updated_at||0)),Ft(n)},lr=function(e){Ft(Re().filter(t=>t&&t.id!==e))},oe=function(e,t){if(!e||!t)return;const n=JSON.parse(localStorage.getItem(I("chatHistory"))||"[]");n.push({role:e,content:t}),localStorage.setItem(I("chatHistory"),JSON.stringify(n)),er()},ue=function(){return le==="granted"},q=function(e,t,n){var o=new Date;o.setTime(o.getTime()+n*24*60*60*1e3),document.cookie=e+"="+encodeURIComponent(t)+"; expires="+o.toUTCString()+"; path=/; SameSite=Lax"+(location.protocol==="https:"?"; Secure":"")},Be=function(e){var t=parseInt($(e)||"",10);return!isNaN(t)&&t>0&&Date.now()-t<=ee*864e5},$=function(e){var t=document.cookie.match(new RegExp("(^| )"+e+"=([^;]+)"));return t?decodeURIComponent(t[2]):null},cr=function(){return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))},bt=function(e){try{if(navigator.sendBeacon){navigator.sendBeacon(pt,new Blob([JSON.stringify(e)],{type:"application/json"}));return}}catch{}fetch(pt,{method:"POST",headers:{"Content-Type":"application/json"},keepalive:!0,body:JSON.stringify(e)}).catch(function(){})},Y=function(e,t){if(ue())try{typeof window.gtag=="function"&&window.gtag("event",e,t||{})}catch{}},Jt=function(e,t){const n={item_name:e&&(e.title||e.product_name)||"",index:t},o=e&&parseFloat(e.price);return isNaN(o)||(n.price=o),n},ur=function(e){var t=JSON.stringify(e);if(navigator.sendBeacon){navigator.sendBeacon(pt,new Blob([t],{type:"application/json"}));return}fetch(pt,{method:"POST",headers:{"Content-Type":"application/json"},keepalive:!0,body:t}).catch(function(){})},dr=function(e,t,n){if(ue()){var o=$("morvo_session_id");if(o||(o=""),W=="morvo"){const r=Be("morvo_last_touch_ts"),i=$("morvo_last_touch_type");Ie=r||Be("morvo_first_touch_ts"),Te=r&&(i==="pdp_click"||i==="basket_add")}else Te=!1,Ie=!1;ur({event:"morvo_purchase",experimentGroup:W,platform:T||"custom",subscriptionKey:ct,shopId:window.location.hostname||ut,sessionId:o,orderId:e,visitorId:re,value:t,currency:n,assistedRecent:Te,influencedLifetime:Ie})}},Wt=function(){if(ue()){if(W=="morvo"){const e=Be("morvo_last_touch_ts"),t=$("morvo_last_touch_type");Ie=e||Be("morvo_first_touch_ts"),Te=e&&(t==="pdp_click"||t==="basket_add")}else Te=!1,Ie=!1;fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({attributes:{event:"morvo_purchase",platform:T,experimentGroup:W,subscriptionKey:ct,shopId:ut,sessionId,visitorId:re,assistedRecent:Te?"1":"0",influencedLifetime:Ie?"1":"0"}})})}},_r=function(){try{var e=window.Shopify&&window.Shopify.customerPrivacy;if(e&&typeof e.currentVisitorConsent=="function")return(e.currentVisitorConsent()||{}).analytics||""}catch{}return""},Sr=function(){["morvo_last_product_ref"].forEach(function(e){$(e)!==null&&q(e,"",-1)})},kr=function(){["morvo_experiment_group","morvo_visitor_id","morvo_session_id","morvo_session_pending","morvo_first_touch_ts","morvo_last_touch_ts","morvo_last_touch_type","morvo_last_product_ref","morvo_shop_id"].forEach(function(e){q(e,"",-1)})},tn=function(){try{if(sessionStorage.getItem("morvo_consent_counted")==="1")return;sessionStorage.setItem("morvo_consent_counted","1")}catch{}bt({event:"morvo_consent_declined",platform:T,subscriptionKey:ye,shopId:window.location.hostname,ts:Date.now()})},Kt=function(){try{if(navigator.webdriver===!0||xr.test(navigator.userAgent||""))return!0}catch{}return!1},Er=function(){$("morvo_session_pending")==="1"&&ue()&&(q("morvo_session_pending","",-1),bt({event:"morvo_session",platform:T,subscriptionKey:ye,shopId:window.location.hostname,experimentGroup:W,sessionId,visitorId:re,ts:Date.now()}))},Cr=function(){if(rn||(rn=!0,Kt()))return;let e=!1;const t=[];function n(){e||(e=!0,on.forEach(function(r){try{window.removeEventListener(r,n,!0)}catch{}}),t.forEach(clearTimeout),Er())}on.forEach(function(r){try{window.addEventListener(r,n,{capture:!0,passive:!0})}catch{}});function o(){if(document.visibilityState==="visible"){n();return}document.addEventListener("visibilitychange",function r(){document.visibilityState==="visible"&&(document.removeEventListener("visibilitychange",r),t.pu
1sh(setTimeout(n,nn)))})}t.push(setTimeout(o,nn))},sn=function(){if(!ue())return;const e=$("morvo_experiment_group");let t=null,n=1;if(e){const o=e.indexOf(".");t=o===-1?e:e.slice(0,o),n=o===-1?1:parseInt(e.slice(o+1),10)||1,t!=="morvo"&&t!=="holdout"&&(t=null)}t&&n===ft?W=t:(W=Math.random()<vo?"morvo":"holdout",q("morvo_experiment_group",ft===1?W:W+"."+ft,365)),window.morvo.experimentGroup=W,window.morvo.forgetPreferences=Uo,re=$("morvo_visitor_id"),re||(re="10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(o^crypto.getRandomValues(new Uint8Array(1))[0]&15>>o/4).toString(16)),q("morvo_visitor_id",re,365)),sessionId=$("morvo_session_id"),sessionId||(sessionId=cr(),q("morvo_session_id",sessionId,1),q("morvo_session_pending","1",1)),$("morvo_session_pending")==="1"&&Cr(),T==="shopify"&&Wt()},Qt=function(e){e!==le&&(le=e,e==="denied"?(kr(),tn()):sn())},Ar=function(e){var t=window.Shopify;if(!t||typeof t.loadFeatures!="function")return e(null);if(t.customerPrivacy)return e(t.customerPrivacy);var n=!1,o=function(){n||(n=!0,e(window.Shopify&&window.Shopify.customerPrivacy||null))};try{t.loadFeatures([{name:"consent-tracking-api",version:"0.1"}],o)}catch{return o()}setTimeout(o,2e3)},Lr=function(e){var t=window.__MORVO_CONSENT__;if(t==="denied")return e("denied");if(t==="granted")return e("granted");var n=we==="opt_in"?"denied":"granted";if(T!=="shopify")return e(n);Ar(function(o){if(!o)return e(n);var r="";try{r=(o.currentVisitorConsent()||{}).analytics||""}catch{}if(r==="no")return e("denied");if(r==="yes")return e("granted");var i=!1;try{i=typeof o.shouldShowBanner=="function"&&o.shouldShowBanner()}catch{}e(i?"denied":n)})},Ze=function(e,t,n){if(t&&t.img&&t.img!=="null"){const l=e.querySelector("a img");l&&(l.src=t.img)}const o=e.querySelector(".basketButton");if(t&&Number(t.price)>0){const l=e.querySelector(".productPrice strong");if(l){var r=e.getAttribute("data-market-handle"),i=r&&ae[r],s=i&&t&&t.id!=null?i.variants[String(t.id)]:null,c=Oe();l.textContent=s>0&&c?ce(s,c.active):ce(Number(t.price),o?o.getAttribute("data-currency"):"")}}const a=T==="static"&&H;if(o&&(T==="shopify"||a)){const l=o.querySelector("span");if(o.classList.contains("added")){o.classList.remove("added");const p=o.querySelector("svg");p&&(p.outerHTML=Io),o.removeAttribute("aria-label"),o.removeAttribute("title")}n&&t&&(a?t.id!=null&&t.sku:!0)?(o.setAttribute("data-vid",String(t.id)),o.setAttribute("data-sku",t.sku!=null?String(t.sku):""),Number(t.price)>0&&o.setAttribute("data-price",String(t.price)),o.disabled=!1,l&&(l.textContent="Add to basket")):(o.setAttribute("data-vid",""),o.disabled=!0,l&&(l.textContent=n===null?"Out of stock":"Choose an option"))}n&&t&&t.id&&e.querySelectorAll("a[href]").forEach(function(l){const d=l.getAttribute("href")||"";d.indexOf("/products/")>-1&&l.setAttribute("href",d.split("?")[0]+"?variant="+encodeURIComponent(String(t.id)))})},Tr=function(e){e&&[{id:"cart-icon-bubble",targets:["#cart-icon-bubble","#shopify-section-cart-icon-bubble"],pick:".shopify-section"},{id:"cart-drawer",targets:["#CartDrawer","#shopify-section-cart-drawer"],pick:"#CartDrawer"},{id:"cart-notification",targets:["#cart-notification","#shopify-section-cart-notification"],pick:".shopify-section"}].forEach(function(n){try{const o=e[n.id];if(!o)return;let r=null;for(let s=0;s<n.targets.length&&!r;s++)r=document.querySelector(n.targets[s]);if(!r)return;const i=new DOMParser().parseFromString(o,"text/html").querySelector(n.pick);i&&(r.innerHTML=i.innerHTML)}catch{}});try{if(typeof window.publish=="function"){const n=window.PUB_SUB_EVENTS&&window.PUB_SUB_EVENTS.cartUpdate||"cart-update";window.publish(n,{source:"morvo"})}}catch{}try{["cart:refresh","cart:updated","cart:build"].forEach(function(n){document.dispatchEvent(new CustomEvent(n,{bubbles:!0,detail:{source:"morvo"}}))})}catch{}try{window.jQuery&&window.jQuery(document.body).trigger("added_to_cart")}catch{}},Ir=function(){try{if(window.routes&&window.routes.cart_url)return window.routes.cart_url}catch{}try{const e=window.wc_add_to_cart_params;if(e&&e.cart_url)return e.cart_url}catch{}return H&&typeof H.cart_url=="string"?H.cart_url:T==="woocommerce"?"/cart/":"/cart"},Mr=function(e){try{const t=window.wc_add_to_cart_params;if(t&&t.wc_ajax_url)return t.wc_ajax_url.replace("%%endpoint%%",e)}catch{}return"/?wc-ajax="+e},Nr=function(e,t,n){e&&Object.keys(e).forEach(function(o){try{const r=document.querySelectorAll(
1o);if(!r.length)return;r.forEach(function(i){const s=document.createElement("div");s.innerHTML=e[o];const c=s.firstElementChild;c&&i.replaceWith(c)})}catch{}});try{window.jQuery&&(window.jQuery(document.body).trigger("wc_fragments_loaded"),window.jQuery(document.body).trigger("added_to_cart",[e,t,window.jQuery()]))}catch{}try{document.dispatchEvent(new CustomEvent("wc_fragments_loaded",{bubbles:!0}))}catch{}},Xt=function(e,t){e.classList.remove("busy"),e.classList.add("added"),e.offsetWidth,t&&(t.textContent="Added to basket");const n=e.querySelector("svg");n&&(n.outerHTML=Kn),e.setAttribute("aria-label","Added to basket. View basket."),e.setAttribute("title","View basket"),setTimeout(function(){e.classList.contains("added")&&t&&(t.textContent="View basket")},2e3)},et=function(e,t,n){e.classList.remove("busy"),t&&(t.textContent=n)},kt=function(e,t,n,o){if(!ue())return;const r=Date.now();if($("morvo_first_touch_ts")||q("morvo_first_touch_ts",r,ee),bt({event:"morvo_product_click",platform:T,subscriptionKey:ct,shopId:ut,sessionId,visitorId:re,productName:e,productUrl:t||null,productPrice:n||null,context:"basket"}),q("morvo_last_touch_ts",r,ee),q("morvo_last_touch_type","basket_add",ee),q("morvo_shop_id",window.location.hostname,365),T==="shopify"&&Wt(),K){const i=Object.assign({},zt,{items:[Jt({title:e,price:n},0)]});o&&(i.currency=o),Number(n)>0&&(i.value=Number(n)),Y("add_to_cart",i)}},It=function(){try{const e=Vt();if(!e){G.innerHTML!==Tt&&(G.innerHTML=Tt);return}if(e.type==="collection"&&v.plp_scope_default&&!x){G.innerHTML!==Tt&&(G.innerHTML=Tt);return}if(e.type==="product"){const a=jo(e);G.innerHTML="";const l=document.createElement("li"),d=document.createElement("strong");d.textContent="What can I help you with?",l.appendChild(d),G.appendChild(l);const p=document.createElement("li");p.setAttribute("data-morvo-scope-label","1"),p.textContent="You're looking at "+a+". Ask me anything about it!",p.style.cssText="background:none;padding:0;border-radius:0;cursor:default;pointer-events:none;font-weight:700;",G.appendChild(p),["What goes with this?","Tell me more about this","Anything similar?","Delivery & returns"].forEach(function(f){const m=document.createElement("li");m.textContent=f,G.appendChild(m)});return}const t=jo(e);let n=null;try{const a=JSON.parse(localStorage.getItem(wt)||"null");a&&a.id===e.id?n=a.choice:a&&localStorage.removeItem(wt)}catch{}G.innerHTML="";const o=document.createElement("li"),r=document.createElement("strong");r.textContent="What can I help you with?",o.appendChild(r),G.appendChild(o);const i="background:none;padding:0;border-radius:0;cursor:default;pointer-events:none;",s=document.createElement("li");s.setAttribute("data-morvo-scope-label","1"),s.textContent="Do you want me to look just at "+t+", or search the whole store?",s.style.cssText=i+"font-weight:700;margin-bottom:8px;",G.appendChild(s);const c=document.createElement("li");c.setAttribute("data-morvo-scope-label","1"),c.textContent="Select an option and then ask away!",c.style.cssText=i,G.appendChild(c),[["Just "+t,"scoped"],["Search the whole store","storewide"]].forEach(function(a){const l=document.createElement("li");l.setAttribute("data-morvo-scope",a[1]),l.setAttribute("data-morvo-scope-id",e.id),l.textContent=(n===a[1]?"\u2713 ":"")+a[0],n===a[1]&&(l.style.fontWeight="700"),G.appendChild(l)})}catch{}},Sn=function(){h.querySelectorAll(".chat-inner .chatGroup").forEach(t=>t.remove()),it()?(fe=xe(),se=vt(),L=localStorage.getItem(I("chatGroup"))||1):(fe=[],L=1),po()},nt=function(){const e=!x&&b.classList.contains("open")&&window.matchMedia("(max-width: 599px)").matches,t=document.body,n=t.dataset.morvoScrollLock==="1";e&&!n?(lo=window.scrollY||document.documentElement.scrollTop||0,t.dataset.morvoScrollLock="1",t.style.position="fixed",t.style.top=-lo+"px",t.style.left="0",t.style.right="0",t.style.width="100%",document.documentElement.style.overscrollBehavior="none"):!e&&n&&(delete t.dataset.morvoScrollLock,t.style.position="",t.style.top="",t.style.left="",t.style.right="",t.style.width="",document.documentElement.style.overscrollBehavior="",window.scrollTo(0,lo))}
1,kn=function(){if(co)try{const t=window.matchMedia&&window.matchMedia("(max-width: 599px)").matches?h.querySelector("#llmPower .outer-wrapper"):R;t&&t.focus({preventScroll:!0})}catch{}},xn=function(){try{return!x&&window.matchMedia&&window.matchMedia("(max-width: 599px)").matches&&b.classList.contains("open")}catch{return!1}},Hr=function(){const e=h.querySelector("#llmPower .outer-wrapper");return e?Array.prototype.slice.call(e.querySelectorAll('a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex="0"]')).filter(function(n){return n.getClientRects().length>0&&!n.closest("[hidden]")}):[]},uo=function(){try{const e=h.querySelector("#llmPower .outer-wrapper");if(!e)return;xn()?e.setAttribute("aria-modal","true"):e.removeAttribute("aria-modal")}catch{}},En=function(){const e=h.activeElement,t=document.activeElement,n=e||(t&&t!==F?t:null);return n&&typeof n.focus=="function"?n:null},Dr=function(){try{const e=Mt;e&&e.isConnected&&e!==F?e.focus({preventScroll:!0}):Ct&&Ct.focus({preventScroll:!0})}catch{}Mt=null},Ue=function(){if(x&&typeof Zt=="function"){Zt();return}b.classList.contains("open")||(Mt=En()),b.classList.toggle("open"),nt(),uo(),b.classList.contains("open")?kn():Dr(),b.classList.contains("open")&&K&&Y("morvo_chat_open",{source:"launcher"})},Cn=function(e){if(x){try{F.scrollIntoView({behavior:"smooth",block:"start"})}catch{}return}if(!b.classList.contains("open")){if(Mt=En(),b.classList.add("open"),nt(),uo(),kn(),e==="nav_icon"&&A&&A.nav_icon&&A.nav_icon.expand!==!1&&!window.matchMedia("(max-width: 599px)").matches)try{st(!0)}catch{}K&&Y("morvo_chat_open",{source:e||"trigger"})}},Nt=function(){Vr()},An=function(){de.classList.remove("introVisible"),po()},jr=function(e){const t=Math.floor((Date.now()-(e||0))/6e4);if(t<1)return"just now";if(t<60)return t+"m ago";const n=Math.floor(t/60);if(n<24)return n+"h ago";const o=Math.floor(n/24);return o===1?"yesterday":o+"d ago"},Ln=function(){const e=localStorage.getItem(I("session_id"));Qe();const t=Re();no.innerHTML="",Rr.style.display=t.length?"none":"block",t.forEach(n=>{const o=document.createElement("li");o.className="history-item"+(n.id===e?" is-current":""),o.dataset.id=n.id;const r=document.createElement("button");r.type="button",r.className="history-open",r.textContent=n.title||"New conversation";const i=document.createElement("span");i.className="history-meta",i.textContent=jr(n.updated_at)+(n.id===e?" - current":""),r.appendChild(i);const s=document.createElement("button");s.type="button",s.className="history-delete",s.setAttribute("aria-label","Delete this chat"),s.innerHTML='<svg viewBox="0 0 5 5" stroke="#222222" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.25 3.84967L3.84969 0.249982" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.84961 3.84967L0.249921 0.249982" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',o.appendChild(r),o.appendChild(s),no.appendChild(o)})},Tn=function(){Q||(Ln(),Ve.hidden=!1,At.hidden=!1,Ve.offsetWidth,b.classList.add("history-open"),K&&Y("morvo_history_open"))},rt=function(){b.classList.remove("history-open"),At.hidden=!0,setTimeout(()=>{Ve.hidden=!0},260)},$r=function(e){const t=Re().find(n=>n&&n.id===e);t&&(Qe(),localStorage.setItem(I("session_id"),t.id),localStorage.setItem(I("chatHistory"),JSON.stringify(t.messages||[])),se=t.id,fe=t.messages||[],po(),L=(t.messages||[]).filter(n=>n&&n.role==="user").length+1,localStorage.setItem(I("chatGroup"),L),rt(),Fe())},po=function(){h.querySelectorAll(".chat-inner .chatGroup").forEach(n=>n.remove()),ie.querySelectorAll(":scope > .follow-ups").forEach(n=>n.remove());let t=0;de.classList.remove("introVisible"),fe=xe(),se=vt(),fe.forEach(n=>{try{const o=n&&n.role,r=n&&n.content;o==="user"?(t++,_o(t),be(r,"user",t)):o==="assistant"?be(r,"assistant",t):o==="products"?gt(r,t,"rebuild"):o==="shade_products"?gt(r&&r.products||[],t,"rebuild",r&&r.shade_rows):o==="split_products"?gt(r&&r.products||[],t,"rebuild",null,r?{from:r.more_from,heading:r.more_heading}:null):o==="compare_select"?qo(r,t,"rebuild"):o==="outfits"?No(r,t,"rebuild"):o==="upsell"?Oo(r,t,"rebuild"):o==="order_form"&&Po(t,"rebuild")}catch{console.warn("Morvo: skipped an unrenderable stored turn")}}),fe.length||(de.classList.add("introVisible"),It(),Fe())},Vr=function(){fe=[],L=1,localStorage.setItem(I("chatGroup"),L),h.querySelectorAll(".chat-inner .chatGroup").forEach(t=>t.remove()),ie.querySelectorAll(":scope > .follow-ups").forEach(t=>t.remove()),Qe(),Do(),fo(),In(),typeof Ge=="function"&&(Ge(),Ge=null),K&&Y("morvo_new_chat")},fo=function(){De&&(De.hidden=!0),je&&(je.hidden=!0)},In=function(){de.classList.toggle("introVisible"),de.classList.contains("introVisible")&&(It(),typeof eo=="function"&&eo()),Fe()},Fe=function(){de.className.includes("introVisible")&&(it()?Et.classList.remove("hide"):Et.classList.add("hide"))},Mn=function(e){let t=e.target;if(t.tagName=="LI"){const n=t.getAttribute&&t.getAttribute("data-morvo-scope");if(n){try{localStorage.setItem("morvo_page_scope_choice",JSON.stringify({id:t.getAttribute("data-morvo-scope-id")||"",choice:n}))}catch{}t.parentElement.querySelectorAll("[data-morvo-scope]").forEach(function(o){o.style.fontWeight="",o.textContent=o.textContent.replace(/^✓ /,"")}),t.style.fontWeight="700",t.textContent="\u2713 "+t.textContent;return}if(t.getAttribute&&t.getAttribute("data-morvo-scope-label")||t.querySelector("strong"))return;it()?(Ge=()=>{Nn(t)},Nt()):Nn(t)}},it=function(){return(JSON.parse(localStorage.getItem(I("chatHistory")))||[]).length>0},Nn=function(e){idea=e.innerText,R.value=idea,In(),pe.click()},mo=function(){to.removeEventListener("click",Ue,!1),oo.removeEventListener("click",mo,!1),window.removeEventListener("popstate",so),clearInterval(Br),b.classList.remove("open"),nt(),b.remove(),F.remove()},st=function(e){if(e){const t=getComputedStyle(b).right;b.style.left=t,b.classList.add("expanded"),$e.setAttribute("aria-label","Collapse to normal width"),$e.setAttribute("title","Collapse to normal width")}else b.style.left="",b.classList.remove("expanded"),$e.setAttribute("aria-label","Expand to full width"),$e.setAttribute("title","Expand to full width")},at=function(e){let t=0;if(e&&e[0]&&e[0].contentRect)t=e[0].contentRect.width;else{const n=getComputedStyle(V);t=V.clientWidth-parseFloat(n.paddingLeft||0)-parseFloat(n.paddingRight||0)}t>0&&b.style.setProperty("--mv-grid-w",t+"px"),x&&t>0&&b.classList.toggle("narrow-grid",t<760)},Gr=function(){const e=window.matchMedia&&window.matchMedia("(max-width: 599px)").matches;let t=!1;try{t=localStorage.getItem(Ot)==="1"}catch{}e?(b.style.left="",b.classList.remove("expanded")):t&&!b.classList.contains("expanded")&&st(!0)},On=function(){const e=!b.classList.contains("expanded");st(e),at(),setTimeout(at,60);try{e?localStorage.setItem(Ot,"1"):localStorage.removeItem(Ot)}catch{}K&&Y(e?"morvo_expand":"morvo_collapse")},Ur=function(){if(Q){Lt=null;try{const t=JSON.stringify({session_id:se}),n=ze+"/api/chat/cancel";var e=!1;navigator.sendBeacon&&(e=navigator.sendBeacon(n,new Blob([t],{type:"text/plain"}))),e||fetch(n,{method:"POST",headers:{"Content-Type":"text/plain"},keepalive:!0,body:t}).catch(function(){})}catch{}try{Q.abort()}catch{}Q=null,K&&Y("morvo_query_stopped")}};window.llmPowerLoaded=!0;const U=()=>new Promise(e=>{if(document.body)return e();document.addEventListener("DOMContentLoaded",()=>e(),{once:!0})});try{[["https://app.morvo.co.uk",!0],["https://morvo.co.uk",!0]].forEac
1h(function(e){var t=document.createElement("link");t.rel="preconnect",t.href=e[0],e[1]&&(t.crossOrigin="anonymous"),(document.head||document.documentElement).appendChild(t)})}catch{}const Z=window.__MORVO_CONFIG__||null,Pt=document.currentScript,qt=Pt&&Pt.src?new URL(Pt.src).searchParams:new URLSearchParams,ye=Z&&Z.site_id||qt.get("site_id"),T=(Z&&Z.platform||qt.get("platform")||"static").toLowerCase();let go=!1,H=null,yo=!0;const ct=ye,ut=Z&&Z.shop_id||qt.get("shop_id"),ze=Z&&Z.api_base?String(Z.api_base).replace(/\/+$/,""):"https://app.morvo.co.uk",qn=ze+"/api/chat";let Te=null,Ie=null,Fr=$("morvo_first_touch_ts");const dt=[];dt.push("Comparing specifications and features...","Filtering out weaker matches...","Ranking the strongest options...","Checking live availability...");let Rn=2500,Je=0,We=null;const ee=30,pt="https://hshymanfvusitagdquaq.supabase.co/functions/v1/ingest-purchases";let vo=.9,ft=1,j=null,te="",ve="",_e=null,Ne=0,Se=!1;const Dn=window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches||!1;var Ee,ae={},he={},ge=null;const Io='<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M3.5 6.5h13l-1.2 9a1.5 1.5 0 0 1-1.49 1.3H6.19a1.5 1.5 0 0 1-1.49-1.3l-1.2-9z" stroke-width="1.33"/><path d="M7 6.5V5a3 3 0 0 1 6 0v1.5" stroke-width="1.33" stroke-linecap="round"/></svg>',Kn='<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M4.5 10.5l3.5 3.5 7.5-8" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>',jt=Object.create(null);let Qn=0,Ye=null,yt=null,qe="launcher",Ke="";const Ro="morvo_page_convos",Bo=20,Ho=["chatHistory","session_id","morvo_page_ctx","chatGroup"];let z=null;const or="morvo_page_ctx",$o={toString:function(){return I(or)}},wt="morvo_page_scope_choice",Gt="morvo_prefs",rr=90*24*60*60*1e3,Ut=["audience","budget_max","budget_about","colours"],Fo="morvo_conversations",ar=20;var le="granted",we="opt_out";const zt={item_list_id:"morvo_assistant",item_list_name:"Morvo assistant"},Jo="morvo_dead_"+ye;try{if(Number(localStorage.getItem(Jo)||0)>Date.now())return}catch{}let Wo="";try{Wo="&page="+encodeURIComponent(String(window.location.pathname||"/").slice(0,512))}catch{}const Xe=await fetch(ze+"/api/widget_config?clientId="+ye+Wo);if(!Xe.ok){if(Xe.status===403){try{localStorage.setItem(Jo,String(Date.now()+24*60*60*1e3))}catch{}console.info("Morvo widget is not enabled for this site.");return}console.error("Failed to load widget config:",Xe.status,Xe.statusText);return}const ne=await Xe.json(),v=JSON.parse(ne.config),Yo=v.font,pr=v.font_size,J=v.examples,fr=ne.excluded_urls,K=ne.ga4!==!1,Ko=v.logo_url,A=v.surfaces&&typeof v.surfaces=="object"&&!Array.isArray(v.surfaces)?v.surfaces:null,Qo=v.position_from_right,mr=v.position_from_right_desktop,Xo=v.position_from_bottom,hr=v.position_from_bottom_desktop,gr=v.position_from_right_mobile,yr=v.position_from_bottom_mobile;typeof ne.holdout_split=="number"&&ne.holdout_split>=.1&&ne.holdout_split<=1&&(vo=ne.holdout_split),typeof ne.holdout_split_version=="number"&&ne.holdout_split_version>=1&&(ft=Math.floor(ne.holdout_split_version));const vr=e=>{const t=String(e||"").trim();if(!t||t.includes("<"))return t;const n=/[.!?]["')\]]*(?=\s)/g;let o;for(;o=n.exec(t);){const r=t.slice(0,o.index+o[0].length);if(/!["')\]]*$/.test(r)&&r.split(/\s+/).length<=6)continue;const i=t.slice(o.index+o[0].length).trim();if(!i)break;return`<span class="tagline-line">${r}</span><span class="tagline-line">${i}</span>`}return t};let _t=v.welcome_message;_t||(_t="I\u2019m your personal shopper, powered by AI. Here to help you find exactly what you need");const wr=typeof v.examples_heading=="string"&&v.examples_heading.trim()?v.examples_heading.trim():"Here are some questions you can ask Morvo:";let Yt=typeof v.composer_placeholder=="string"&&v.composer_placeholder.trim()?v.composer_placeholder.trim():null;const br=typeof v.launcher_tagline=="string"&&v.launcher_tagline.trim()?k(v.launcher_tagline.trim()):"I'm your AI personal shopper",St=typeof v.launcher_icon_url=="string"&&/^https:\/\//.test(v.launcher_icon_url.trim())?k(v.launcher_icon_url.trim()):null;let Zo=wr;try{const e=Array.isArray(v.page_welcomes)?v.page_welcomes:[],t=Me();for(let n=0;n<e.length;n++){const o=e[n];
1if(!o||typeof o.match!="string"||!o.match||t.indexOf(o.match)!==0)continue;const r=/\{name\}/.test(String(o.welcome||"")+String(o.placeholder||"")+String(o.heading||""));let i="";if(r){const c=document.querySelector('meta[property="og:title"]');if(i=(c&&c.content?String(c.content):"").split(/\s+[–—|]\s+/)[0].trim(),!i){const a=(t.split("/").filter(Boolean).pop()||"").replace(/-/g," ").trim();i=a?a.charAt(0).toUpperCase()+a.slice(1):""}i=k(i)}const s=c=>String(c).replace(/\{name\}/g,i);typeof o.welcome=="string"&&o.welcome.trim()&&(_t=s(o.welcome.trim())),typeof o.placeholder=="string"&&o.placeholder.trim()&&(Yt=s(o.placeholder.trim())),typeof o.heading=="string"&&o.heading.trim()&&(Zo=s(o.heading.trim()));break}}catch{}H=v.basket_adapter&&typeof v.basket_adapter=="object"&&typeof v.basket_adapter.url=="string"&&(v.basket_adapter.kind==="graphql"&&typeof v.basket_adapter.query=="string"||v.basket_adapter.kind==="json"&&v.basket_adapter.body&&typeof v.basket_adapter.body=="object")?v.basket_adapter:null,go=v.basket===!0&&(T==="shopify"||T==="woocommerce"||T==="static"&&!!H),yo=v.shopper_memory!==!1;try{const e=v.page_scope;e&&e.id&&(e.type==="product"||e.type==="collection")&&(z={type:e.type,id:String(e.id).slice(0,128)},typeof e.title=="string"&&e.title&&(z.title=String(e.title).slice(0,120)))}catch{}const en=fr.split(",").map(e=>e.trim()).filter(Boolean);we=v.consent_mode==="opt_in"?"opt_in":"opt_out";let W="morvo",re=null;const on=["pointerdown","keydown","touchstart","scroll","mousemove"],nn=1e4,xr=/bot\/\d|crawl|spider|slurp|externalagent|externalhit|storebot|petalbot|mj12bot|bingpreview|headlesschrome|lighthouse|pingdom|uptimerobot|python-requests|curl\/|wget\//i;let rn=!1;window.morvo=window.morvo||{},window.morvo.experimentGroup=W,window.morvo.forgetPreferences=Uo,window.morvoConsent=function(e){Qt(e==="granted"?"granted":"denied")},le=await new Promise(function(e){Lr(e)});try{document.addEventListener("visitorConsentCollected",function(){var e=_r();e==="no"?Qt("denied"):e==="yes"&&Qt("granted")})}catch{}if(Sr(),ue()?sn():tn(),T!=="shopify"){var Ce=0,Ae=20,Le=function(){var e=window.MORVO_ORDER_ID,t=window.MORVO_ORDER_VALUE,n=window.MORVO_ORDER_CURRENCY;if(!e||!n||t===void 0||t===null||t==="")return!1;var o=Number(t);return!isFinite(o)||o<0?!1:(dr(String(e),o,String(n).trim().toUpperCase()),!0)};if(!Le())var P=setInterval(function(){if(Ce++,Le()){clearInterval(P);return}Ce>=Ae&&(clearInterval(P),window.MORVO_ORDER_ID&&console.warn("Morvo: purchase not recorded. MORVO_ORDER_VALUE must be a number and MORVO_ORDER_CURRENCY an ISO code (got "+JSON.stringify(window.MORVO_ORDER_VALUE)+", "+JSON.stringify(window.MORVO_ORDER_CURRENCY)+")."))},100)}if(W==="holdout")return;window.morvoRecordPdpClick=function(e,t,n,o,r){if(!ue())return;let i=Date.now();$("morvo_first_touch_ts")||q("morvo_first_touch_ts",i,ee),bt({event:"morvo_product_click",platform:T,subscriptionKey:ct,shopId:ut,sessionId,visitorId:re,productName:e,productUrl:t||null,productPrice:n||null,context:o||null,productId:r||null}),q("morvo_last_touch_ts",i,ee),q("morvo_last_touch_type","pdp_click",ee),q("morvo_shop_id",window.location.hostname,365),K&&Y("select_item",Object.assign({},zt,{items:[Jt({title:e,price:n},0)]}))},window.morvoVariantChange=function(e){try{const t=e.closest(".product"),n=jt[e.getAttribute("data-reg")];if(!t||!n)return;if(!e.getAttribute("data-axis")){const a=n[Number(e.value)]||null;a&&Ze(t,a,Pe(a)?null:!0);return}const r=[];let i=0;t.querySelectorAll(".variantSelect[data-axis]").forEach(function(a){a.value?r.push({axis:a.getAttribute("data-axis"),value:a.value}):i++});let s=n.filter(function(a){return r.every(function(l){return Mo(a,l.axis,l.value)})});if(i>0){const a=s.filter(function(l){return l.img&&l.img!=="null"});Ze(t,a[0]||null,!1);return}const c=s.filter(function(a){return!Pe(a)});c.length>0?Ze(t,c[0],!0):Ze(t,s[0]||null,s.length>0?null:!1)}catch{}},window.morvoBasketAdd=function(e){if(e.classList.contains("added")){window.location.href=Ir();return}const t=e.getAttribute("data-vid"),n=e.getAttribute("data-sku")||"",o=T==="static"&&!!H&&H.kind==="json"&&!!n;if(!t&&!o||e.classList.contains("busy"))return;const r=e.getAttribute("data-name")||"",i=e.getAttribute("data-url")||"",s=e.getAttribute("data-price")||"",c=e.getAttribute("data-currency")||"",a=e.querySelector("span");if(T==="woocommerce"){e.classList.add("busy"),a&&(a.textContent="Adding\u2026"),fetch(Mr("add_to_cart"),{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},body:"product_id="+encodeURIComponent(t)+"&quantity=1"}).then(function(l){if(!l.ok)throw new Error("wc_add_"+l.status);return l.json()}).then(function(l){if(!l||l.error){const d=l&&l.product_url||i+(i.indexOf("?")>-1?"&":"?")+"add-to-cart="+encodeURIComponent(t);try{kt(r,i,s,c)}catch{}et(e,a,"Add to basket"),window.open(d,"_blank");return}Xt(e,a);try{kt(r,i,s,c)}catch{}try{Nr(l.fragments,l.cart_hash,e)}catch{}}).catch(function(){a&&(a.textContent="Use product page"),setTimeout(function(){et(e,a,"Add to basket")},2500)});return}if(T==="static"&&H){const l=e.getAttribute("data-sku")||"",d=e.getAttribute("data-puuid")||"",p={$variant_id:Number(t),$variant_id_str:String(t),$sku:l,$product_uuid:d,$quantity:1};let f=!1;const m=function(u){if(Array.isArray(u))return u.map(m);if(u&&typeof u=="object"){const O={};for(const S in u)O[S]=m(u[S]);return O}return typeof u=="string"&&u.charAt(0)==="$"?(u==="$sku"&&!l&&(f=!0),u==="$product_uuid"&&!d&&
1(f=!0),u==="$variant_id"&&!t&&(f=!0),p[u]!==void 0?p[u]:u):u},y=H.kind==="json",C=y?m(H.body||{}):{operationName:H.operation_name||void 0,query:H.query,variables:m(H.variables||{})},_=a;if(f){_&&(_.textContent="Use product page"),setTimeout(function(){et(e,_,"Add to basket")},2500);return}e.classList.add("busy"),_&&(_.textContent="Adding\u2026"),fetch(H.url,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)}).then(function(u){if(!u.ok)throw new Error("adapter_"+u.status);return u.json()}).then(function(u){if(!u)throw new Error("adapter_empty");if(y){const O=H.success_path;if(typeof O=="string"&&O){let S=u;const D=O.split(".");for(let B=0;B<D.length&&S!=null;B++)S=S[D[B]];if(S==null)throw new Error("adapter_json_error")}}else if(u.errors||!u.data)throw new Error("adapter_gql_error");Xt(e,_);try{kt(r,i,s,c)}catch{}}).catch(function(){_&&(_.textContent="Use product page"),setTimeout(function(){et(e,_,"Add to basket")},2500)});return}e.classList.add("busy"),a&&(a.textContent="Adding\u2026"),fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Number(t),quantity:1,sections:"cart-icon-bubble,cart-drawer,cart-notification",sections_url:window.location.pathname})}).then(function(l){if(!l.ok)throw new Error("cart_add_"+l.status);return l.json().catch(function(){return{}})}).then(function(l){Xt(e,a);try{kt(r,i,s,c)}catch{}try{Tr(l&&l.sections)}catch{}}).catch(function(){a&&(a.textContent="Use product page"),setTimeout(function(){et(e,a,"Add to basket")},2500)})};const xt=Array.isArray(en)?en.filter(e=>!!(e&&e.trim())):[];if(xt.length>0&&bo(xt))return;await U();const F=document.createElement("div");F.id="llm-power-host",F.style="display:block;position: relative;z-index: 999999;";let x=null,Zt=null,eo=null;if(A&&Array.isArray(A.embed))for(const e of A.embed){if(!e||typeof e.selector!="string"||!e.selector)continue;let t=!0;if(typeof e.path=="string"&&e.path)try{t=new RegExp(e.path,"i").test(Me())}catch{t=!1}if(!t)continue;let n=null;try{n=document.querySelector(e.selector)}catch{n=null}if(n){x={rule:e,anchor:n};break}}try{const e=A&&Array.isArray(A.embed)?A.embed.filter(t=>t&&t.replace===!0&&typeof t.path=="string"&&typeof t.selector=="string").map(t=>({path:t.path,selector:t.selector,title:typeof t.title=="string"?t.title:""})):[];e.length>0?localStorage.setItem("morvo_surfaces_replace",JSON.stringify(e)):localStorage.removeItem("morvo_surfaces_replace")}catch{}if(qe=x?x.rule.replace===!0?"page":/^\/products\//i.test(Me())?"pdp":/^\/collections\//i.test(Me())?"plp":"embed":"launcher",Ke=qe==="launcher"?"":Zn(qe),tr(),x){const t=["beforebegin","afterbegin","beforeend","afterend"].indexOf(x.rule.position)>=0?x.rule.position:"afterend";if(x.rule.replace===!0)for(const n of Array.from(x.anchor.children))n.id!=="llm-power-host"&&(n.style.display="none");if(typeof x.rule.title=="string"&&x.rule.title.trim())try{document.title=x.rule.title.trim()}catch{}F.style="display:block;position: relative;z-index: 5;min-width:0;contain:inline-size;"+(typeof x.rule.host_style=="string"?x.rule.host_style:""),x.anchor.insertAdjacentElement(t,F)}else document.body.appendChild(F);const h=F.attachShadow({mode:"open"}),M=document.createElement("div");if(M.id="llmPower",v.launcher_variant==="raised"&&M.classList.add("raised-launcher"),x){M.classList.add("embedded"),x.rule.variant==="strip"&&M.classList.add("strip");const e=x.rule.height,t=Number(e),n=typeof e=="string"&&/^[0-9a-z().%+\- ]{2,60}$/i.test(e.trim())?e.trim():null,r=x.rule.variant==="strip"&&typeof x.rule.path=="string"&&/collection/i.test(x.rule.path)&&t>=240?Math.round(t*1.1):t;M.style.setProperty("--mv-embed-height",r>=240&&r<=2e3?r+"px":n||"640px")}if(A&&A.launcher===!1&&M.classList.add("no-launcher"),A&&Array.isArray(A.launcher_paths)&&A.launcher_paths.length>0){let e=!1;for(const t of A.launcher_paths)if(!(typeof t!="string"||!t))try{if(new RegExp(t,"i").test(Me())){e=!0;break}}catch{}e||M.classList.add("no-launcher")}(function(){const t=A&&typeof A.corners=="string"?A.corners.toLowerCase():"roun
1d";let n=!1;if(t==="square")n=!0;else if(t==="auto")try{const o=["form[action*='cart'] button[type=submit]","button[name=add]",".product-form__cart-submit",".btn",".button","button.btn","header input[type=search]","input[type=search]",".search__input","a.btn"],r=[];for(const i of o){const s=document.querySelectorAll(i);for(let c=0;c<s.length&&c<3;c++){const a=s[c];if(a.closest("#llm-power-host"))continue;const l=getComputedStyle(a).borderTopLeftRadius,d=parseFloat(l);!Number.isNaN(d)&&a.offsetWidth>40&&a.offsetHeight>20&&r.push(/%$/.test(l)?999:d)}if(r.length>=4)break}r.length>=2&&(r.sort((s,c)=>s-c),n=r[Math.floor(r.length/2)]<5)}catch{n=!1}n&&M.classList.add("square-corners")})();const an=window.matchMedia("(min-width: 600px)"),ln=()=>{if(x){M.style.right="";return}const e=an.matches?mr||Qo:gr||Qo;e?M.style.right=e+"px":M.style.right=""};ln();try{an.addEventListener("change",ln)}catch{}const cn=window.matchMedia("(min-width: 600px)"),un=()=>{if(x){M.style.bottom="",M.style.removeProperty("--mv-gap-bottom");return}const e=cn.matches?hr||Xo:yr||Xo;e?(M.style.bottom=e+"px",M.style.setProperty("--mv-gap-bottom",e+"px")):(M.style.bottom="",M.style.removeProperty("--mv-gap-bottom"))};un();try{cn.addEventListener("change",un)}catch{}typeof v.image_aspect=="string"&&/^[1-9]\d?\/[1-9]\d?$/.test(v.image_aspect)&&M.style.setProperty("--mv-img-aspect",v.image_aspect);let dn="https://morvo.co.uk/widget/morvo-main.webp";if(Ko&&(dn=Ko),M.innerHTML=`
2                <div class="outer-wrapper introVisible" role="dialog" aria-label="Chat assistant" tabindex="-1">
3                    <p class="mv-sr-status" role="status" aria-live="polite" aria-atomic="true" style="position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;"></p>
4                    <div class="header">
5                        <img class="logo-main" src="${dn}" alt="" />
6                        <div class="button-wrap">
7                            <svg class="icon-history styled-button" role="button" tabindex="0" aria-label="Chat history" viewBox="0 0 24 24" fill="none" stroke="#222222" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l3 2"/></svg>
8                            <span class="new-chat styled-button" role="button" tabindex="0" aria-label="New chat" title="New chat"><svg viewBox="0 0 24 24" fill="none" stroke="#222222" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><path d="M12 5v14"/><path d="M5 12h14"/></svg></span>
9                            <span class="resume-chat styled-button hide" role="button" tabindex="0" aria-label="Resume chat" title="Resume chat"><svg viewBox="0 0 24 24" fill="#222222" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.2929 1.29289C10.6834 0.902369 11.3166 0.902369 11.7071 1.29289L14.7071 4.29289C14.8946 4.48043 15 4.73478 15 5C15 5.26522 14.8946 5.51957 14.7071 5.70711L11.7071 8.70711C11.3166 9.09763 10.6834 9.09763 10.2929 8.70711C9.90237 8.31658 9.90237 7.68342 10.2929 7.29289L11.573 6.01281C7.90584 6.23349 5 9.2774 5 13C5 16.866 8.13401 20 12 20C15.866 20 19 16.866 19 13C19 12.4477 19.4477 12 20 12C20.5523 12 21 12.4477 21 13C21 17.9706 16.9706 22 12 22C7.02944 22 3 17.9706 3 13C3 8.16524 6.81226 4.22089 11.5947 4.00896L10.2929 2.70711C9.90237 2.31658 9.90237 1.68342 10.2929 1.29289Z"/></svg></span>
10                            <span class="icon-expand styled-button" role="button" tabindex="0" aria-label="Expand to full width" title="Expand to full width"><svg class="icon-expand-out" viewBox="0 0 24 24" fill="none" stroke="#222222" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><path d="M10 4H4v6"/><path d="M4 4l7 7"/><path d="M14 20h6v-6"/><path d="M20 20l-7-7"/></svg>
10<svg class="icon-expand-in" viewBox="0 0 24 24" fill="none" stroke="#222222" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><path d="M4 10h6V4"/><path d="M11 11L4 4"/><path d="M20 14h-6v6"/><path d="M13 13l7 7"/></svg></span>
11                            <svg class="icon-minimise styled-button" role="button" tabindex="0" aria-label="Minimise chat" stroke="#222222" viewBox="0 0 11 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.666504 4.6667H9.99984" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/></svg>
12                        </div>
13                    </div>
14                    <div class="chat-outer">
15                        <div class="chat-intro chat-intro-top">
16                            <p class="greeting">Good <span></span></p>
17                            <p class="tagline">${vr(_t)}</p>
18                        </div>
19                        <div class="chat-main">
20                            <ul class="ideas">
21                                <li><strong>${Zo}</strong></li>
22                                ${J[0]?`<li role="button" tabindex="0">${J[0]}</li>`:""}
23                                ${J[1]?`<li role="button" tabindex="0">${J[1]}</li>`:""}
24                                ${J[2]?`<li role="button" tabindex="0">${J[2]}</li>`:""}
25                                ${J[3]?`<li role="button" tabindex="0">${J[3]}</li>`:""}
26                                ${J[4]?`<li role="button" tabindex="0">${J[4]}</li>`:""}
27                                ${J[5]?`<li role="button" tabindex="0">${J[5]}</li>`:""}
28                            </ul>
29                            <div class="chat-intro chat-intro-bot">
30                                <p>Don\u2019t worry. If you head to another page, your chat with <a target="_blank" href="https://morvo.co.uk">Morvo</a> will pop back up right where you left off. You won\u2019t lose the conversation!</p>
31                                <!-- The AI-interaction notice moved to the persistent
32                                     .ai-note-persistent line under the composer
33                                     (2026-08-25, WSGR C4): one notice, visible in every
34                                     panel state including restored conversations, instead
35                                     of doubling up on the intro screen. -->
36                            </div>
37                            <div class="chat-inner">
38                                <div class="thinking">
39                                    <img src="${St||"https://morvo.co.uk/widget/morvo-icon.webp"}" alt=""${St?' class="brand-icon"':""} />
40                                    <p id="think-span-wrap">
41                                        <span id="think-span"></span>
42                                        <span id="think-span-anim"></span>
43                                    </p>
44                                </div>
45                            </div>
46                        </div>
47                    </div>
48                    <div class="input">
49                        <select id="model">
50                            <option selected value="deepseek-speciale">D</option>
51                            <option value="gemini">G</option>
52                        </select>
53                        <textarea rows="2" maxlength="2000" aria-label="Ask the shopping assistant" placeholder="${(Yt||"Ask anything. I can help you discover products, compare options, answer questions or simply provide advice...").replace(/"/g,"&quot;")}" tabindex="0"></textarea>
54                        <button class="buttonSend" aria-label="Send"><svg class="icon-send" viewBox="0 0 16 16" fill="none" stroke="#222222" xmlns="http://www.w3.org/2000/svg"><path d="M3.26953 8L11.3437 8" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/><path d="M8 3.33333L12.6667 8L8 12.6667" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/></svg><svg class="icon-stop" viewBox="0 0 16 16" fill="#222222" stroke="none" xmlns="http://www.w3.org/2000/svg"><rect x="4.5" y="4.5" width="7" height="7" rx="1.5"/></svg></button>
55                    </div>
56                    <!-- Persistent AI-transparency line (EU AI Act Art 50, WSGR C4
57                         rec 25/08): panel chrome, not a message, so it is visible
58                         on every open including restored conversations. The
59                         chat-intro copy of the notice stays for first view. -->
60                    <p class="ai-note-persistent">You\u2019re chatting with an AI assistant.</p>
61
62                    <!-- Inside .outer-wrapper on purpose: the wrapper is the
63                         positioning context AND has overflow:hidden, so the
64                         drawer is clipped to the container and slides out from
65                         its own left edge rather than flying in from off-panel. -->
66                    <div class="history-scrim" hidden></div>
67                    <div class="history-panel" hidden aria-label="Chat history">
68                        <div class="history-head">
69                            <p><b>Chat history</b></p>
70                            <svg class="history-close" role="button" tabindex="0" aria-label="Close chat history" viewBox="0 0 5 5" stroke="#222222" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.25 3.84967L3.84969 0.249982" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round"/>
70<path d="M3.84961 3.84967L0.249921 0.249982" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
71                        </div>
72                        <ul class="history-list"></ul>
73                        <p class="history-empty">No previous chats yet.</p>
74                    </div>
75                </div>
76
77                <div class="start">
78                    <svg class="close" role="button" tabindex="0" aria-label="Hide chat button" viewBox="0 0 5 5" stroke="#222222" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.25 3.84967L3.84969 0.249982" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.84961 3.84967L0.249921 0.249982" stroke-width="0.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
79                    <div class="start-wrap" role="button" tabindex="0" aria-label="Open chat">
80                        <p class="tagline">${br}</p>
81                        <div class="power-icon-wrap">
82                            <img src="${St||"https://morvo.co.uk/widget/morvo-icon.webp"}" alt=""${St?' style="animation:none;object-fit:contain;"':""} />
83                        </div>
84                    </div>
85                </div>
86                
87    `,x){const e=M.querySelector(".outer-wrapper");e&&(e.setAttribute("role","region"),e.removeAttribute("aria-modal"))}if(M.style.visibility="hidden",h.appendChild(M),v.first_visit_tagline===!0&&window.matchMedia&&window.matchMedia("(max-width: 599px)").matches){const e=M.querySelector(".start .tagline");e&&(e.style.display="none");let t=!1;try{t=!!localStorage.getItem("morvo_first_visit_shown")}catch{}t||setTimeout(()=>{e&&(e.style.display="block",e.offsetWidth),M.classList.add("first-visit-show"),setTimeout(()=>{M.classList.remove("first-visit-show"),e&&(e.style.display="none")},5600);try{localStorage.setItem("morvo_first_visit_shown","1")}catch{}},500)}const tt=document.createElement("link");tt.rel="stylesheet",tt.href="https://morvo.co.uk/widget/morvo.css?v=207";{let e=!1;const t=()=>{e||(e=!0,M.style.visibility==="hidden"&&(M.style.visibility=""))};tt.addEventListener("load",t,!1),tt.addEventListener("error",t,!1),setTimeout(t,2500)}h.appendChild(tt);const Or=["Raleway","Montserrat","Inter","Roboto","Open Sans","Baloo 2"],ot=Yo;if(ot&&Or.indexOf(ot)!==-1){if(!document.getElementById("morvo-fonts")){const t=document.createElement("link");t.id="morvo-fonts",t.rel="stylesheet",t.href="https://morvo.co.uk/widget/fonts/morvo-fonts.css?v=177",(document.head||document.documentElement).appendChild(t)}const e=document.createElement("style");e.textContent=`
88              :host {
89                font-family: "${ot}", -apple-system, BlinkMacSystemFont, sans-serif;
90              }
91            `,h.appendChild(e)}else ot&&console.info(`Morvo: font "${ot}" is not self-hosted; using the system stack. Add it to scripts/build-widget-fonts.mjs to bundle it.`);const pn=document.createElement("style");if(pn.textContent=`
92              /* style overrides here */
93              :host {
94                  font-family: ${Yo}, sans-serif;                  
95              }
96              #llmPower .start .tagline,
97              #llmPower p ,
98              #llmPower .chat-intro .tagline,
99              #llmPower .chat-main .ideas li,
100              #llmPower .warningDialog { font-size: ${pr}px; }
101
102              /* chat panel scroll fix (post-flexbox restructure) */
103              #llmPower .chat-main { overflow: visible !important; }
104              #llmPower .chat-main .chat-inner {
105                  flex: 1 1 0;
106                  min-height: 0;
107                  overflow-y: auto;
108                  overscroll-behavior: contain;
109                  padding-bottom: 4px;
110              }
111              #llmPower .chat-main .chat-inner::-webkit-scrollbar-button {
112                  display: none; width: 0; height: 0;
113              }
114
115              /* follow-up pills (suggested next questions) */
116              #llmPower .follow-ups {
117                  display: flex;
118                  flex-wrap: nowrap;
119                  gap: 8px;
120                  margin: 0;
121                  padding: 8px 4px 2px;
122                  overflow-x: auto;
123                  overflow-y: visible;
124                  -webkit-overflow-scrolling: touch;
125                  scrollbar-width: none;
126                  flex: 0 0 auto;
127                  border-top: 1px solid rgba(0,0,0,0.08);
128              }
129              #llmPower .outer-wrapper.introVisible .follow-ups { display: none; }
130              #llmPower .follow-ups::-webkit-scrollbar { display: none; }
131              #llmPower .follow-ups.follow-ups-grid {
132                  display: grid;
133                  grid-template-columns: repeat(5, 1fr);
134                  overflow-x: visible;
135              }
136              @media only screen and (max-width: 599px) {
137                  #llmPower .follow-ups.follow-ups-grid { grid-template-columns: repeat(3, 1fr); }
138              }
139              #llmPower .follow-up-pill {
140                  flex: 0 0 auto;
141                  padding: 8px 14px;
142                  border-radius: 50px;
143                  border: 1px solid transparent;
144                  background: #F1F1F1;
145                  color: #222;
146                  font-size: 13px;
147                  font-weight: 600;
148                  font-family: inherit;
149                  cursor: pointer;
150                  white-space: nowrap;
151                  transition: background 0.15s, transform 0.1s;
152              }
153              #llmPower .follow-ups.follow-ups-grid .follow-up-pill {
154                  white-space: normal;
155                  text-align: center;
156              }
157              #llmPower .follow-up-pill:hover { background: #e5e5e5; }
158              #llmPower .follow-up-pill:active { transform: scale(0.97); }
159              /* picture pills (guided flows): image tiles with a caption,
160                 replacing the text pills when the reply carries
161                 follow_up_media. Wrap instead of scroll so all options are
162                 visible at once, quiz-style. */
163              #llmPower .follow-ups.follow-ups-media {
164                  flex-wrap: wrap;
165                  overflow-x: visible;
166                  justify-content: center;
167              }
168              #llmPower .follow-up-pill.media-pill {
169                  display: flex;
170                  flex-direction: column;
171                  align-items: center;
172                  gap: 6px;
173                  padding: 8px 8px 10px;
174                  border-radius: 14px;
175                  width: 92px;
176                  white-space: normal;
177                  text-align: center;
178              }
179              #llmPower .follow-up-pill.media-pill img {
180                  width: 76px;
181                  height: 76px;
182                  object-fit: cover;
183                  border-radius: 50%;
184                  display: block;
185                  pointer-events: none;
186              }
187              @media only screen and (max-width: 599px) {
188                  #llmPower .follow-up-pill.media-pill { width: 84px; }
189                  #llmPower .follow-up-pill.media-pill img { width: 64px; height: 64px; }
190              }
191            `,h.appendChild(pn),typeof v.custom_css=="string"&&v.custom_css.trim()){const e=document.createElement("style");e.textContent=v.custom_css,h.appendChild(e)}const b=h.querySelector("#llmPower"),de=h.querySelector(".outer-wrapper"),ie=h.querySelector(".chat-main"),zr=h.querySelector(".chat-outer"),V=h.querySelector(".chat-inner"),fn=ie.querySelector(".thinking"),He=ie.querySelector("#think-s
191pan"),mn=ie.querySelector("#think-span-anim"),Jr=ie.querySelector("#thinkSpanBar"),Pr="Thinking...",R=h.querySelector(".input textarea"),Wr=h.querySelector(".input #model"),to=h.querySelector("#llmPower .icon-minimise"),hn=h.querySelector("#llmPower .new-chat"),Et=h.querySelector("#llmPower .resume-chat"),Ct=h.querySelector("#llmPower .start-wrap"),oo=h.querySelector("#llmPower .start .close"),G=h.querySelector("#llmPower .ideas"),qr=h.querySelector("#llmPower .greeting span"),pe=h.querySelector(".buttonSend");try{!Yt&&window.matchMedia("(max-width: 719px)").matches&&(R.placeholder="Ask anything. I can help you discover products, compare options or offer advice...")}catch{}const De=h.querySelector(".warningDialog"),je=h.querySelector(".backdrop");De&&(De.hidden=!0),je&&(je.hidden=!0);const $e=h.querySelector("#llmPower .icon-expand"),gn=h.querySelector("#llmPower .icon-history"),Ve=h.querySelector("#llmPower .history-panel"),At=h.querySelector("#llmPower .history-scrim"),no=h.querySelector("#llmPower .history-list"),Rr=h.querySelector("#llmPower .history-empty"),yn=h.querySelector("#llmPower .history-close");Ve.hidden=!0,At.hidden=!0;let fe=[],Yr=!0,L=1,se,Ge=null,Q=null,Lt=null;it()&&(fe=xe(),se=vt(),L=localStorage.getItem(I("chatGroup"))||1);const vn=new Date().getHours();let ro="evening";vn<12?ro="morning":vn<18&&(ro="afternoon"),qr.textContent=ro;const Tt=G.innerHTML;It(),Fe();let wn=location.pathname,io=0;async function so(){let e;try{e=location.pathname}catch{return}if(e===wn)return;wn=e;const t=++io;if(xt.length>0&&(F.style.display=bo(xt)?"none":"block"),b.classList.remove("open"),nt(),de.classList.add("introVisible"),T!=="shopify"&&T!=="woocommerce"){z=null;try{const n=await fetch(ze+"/api/widget_config?clientId="+ye+"&page="+encodeURIComponent(String(e).slice(0,512)));if(n.ok){const o=JSON.parse((await n.json()).config),r=o&&o.page_scope;t===io&&r&&r.id&&(r.type==="product"||r.type==="collection")&&(z={type:r.type,id:String(r.id).slice(0,128)},typeof r.title=="string"&&r.title&&(z.title=String(r.title).slice(0,120)))}}catch{}if(t!==io)return}It(),Fe()}window.addEventListener("popstate",so);const Br=setInterval(so,1e3);h.addEventListener("change",function(e){const t=e.target;t&&t.classList&&t.classList.contains("variantSelect")&&window.morvoVariantChange(t)}),h.addEventListener("click",function(e){const t=e.target&&e.target.closest?e.target.closest(".basketButton"):null;t&&window.morvoBasketAdd(t);const n=e.target&&e.target.closest?e.target.closest(".shadeSwatch"):null;if(n&&!n.disabled)try{const o=n.closest(".shadeBlock"),r=o?o.querySelector(".product"):null,i=r?r.querySelector("[data-reg]"):null,s=i?jt[i.getAttribute("data-reg")]:null,c=n.getAttribute("data-shade"),a=s?s.find(function(l){return String(l.title||"")===c}):null;r&&a&&(o.querySelectorAll(".shadeSwatch.sel").forEach(function(l){l.classList.remove("sel")}),n.classList.add("sel"),Ze(r,a,Pe(a)?null:!0))}catch{}}),to.addEventListener("click",Ue,!1),to.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),Ue())},!1),hn.addEventListener("click",Nt,!1),hn.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),Nt())},!1),Et.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),An())},!1),$e.addEventListener("click",On,!1),$e.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),On())},!1);try{const e=localStorage.getItem(Ot)==="1",t=window.matchMedia&&window.matchMedia("(max-width: 599px)").matches;e&&!t&&!x&&st(!0)}catch{}Et.addEventListener("click",An,!1),Ct.addEventListener("click",Ue,!1),oo.addEventListener("click",mo,!1),oo.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),mo())},!1),Ct.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),Ue())},!1),G.addEventListener("click",Mn,!1),G.addEventListener("keydown",e=>{e.key!=="Enter"&&e.key!==" "||!(e.target&&e.target.closest&&e.target.closest('li[role="button"]'))||(e.preventDefault(),Mn(e))},!1);const bn=()=>{if(!(A&&A.nav_icon&&typeof A.nav_icon.selector=="string")||document.querySelector("[data-morvo-nav-icon]")||document.documentElement.getAttribute("data-morvo-nav-home")==="none")return;const e=A.nav_icon;let t=null;try{t=document.querySelector(e.selector)}catch{t=null}if(t){const n=typeof e.href=="string"&&/^(\/|https:\/\/)/.test(e.href.trim())?e.href.trim():null,o=document.createElement(n?"a":"button");n?o.setAttribute("href",n):(o.type="button",o.setAttribute("data-morvo-trigger","nav_icon")),o.setAttribute("data-morvo-nav-icon","1"),o.setAttribute("aria-label",typeof e.aria=="string"&&e.aria?e.aria:"Personal shopper"),typeof e.class=="string"&&e.class&&(o.className=e.class),o.style.cssText="cursor:pointer;display:inline-flex;align-items:center;gap:6px;background:none;border:0;padding:0;color:inherit;text-decoration:none;"+(typeof e.style=="string"?e.style:"");const r=Number(e.size)>0?Number(e.size):22;if(o.innerHTML='<svg width="'+r+'" height="'+r+'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3l1.8 4.7 4.7 1.8-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/><path d="M19 15l.7 1.8 1.8.7-1.8.7L19 20l-.7-1.8-1.8-.7 1.8-.7z"/><path d="M5 3l.6 1.4L7 5l-1.4.6L5 7l-.6-1.4L3 5l1.4-.6z"/></svg>'+(typeof e.label=="string"&&e.label?"<span>"+k(e.label)+"</span>":""),typeof e.eyebrow=="string"&&e.eyebrow.trim()){const g=e.eyebrow.trim();let w=document.getElementById("morvo-nav-eyebrow");w||(w=document.createElement("span"),w.id="morvo-nav-eyebrow",w.setAttribute("aria-hidden","true"),w.style.cssText="position:fixed;z-index:2147483000;font-size:10px;line-height:1;letter-spacing:.12em;text-transform:uppercase;white-space:nowrap;color:#111;font-family:inherit;pointer-events:none;opacity:0;transition:opacity .15s ease;transform:translateX(-50%);",document.body.appendChild(w)),w.textContent=g;const N=()=>{const me=o.getBoundingClientRect();w.style.left=me.left+me.width/2+"px",w.style.top=me.bottom+6+"px";try{w.style.color=getComputedStyle(o).color||"#111"}catch{w.style.color="#111"}w.style.opacity="1"},X=()=>{w.style.opacity="0"};o.addEventListener("mouseenter",N,!1),o.addEventListener("mouseleave",X,!1),o.addEventListener("focus",N,!1),o.addEventListener("blur",X,!1),window.addEventListener("scroll",X,{passive:!0})}const i=["beforebegin","afterbegin","beforeend","afterend"];t.insertAdjacentElement(i.indexOf(e.position)>=0?e.position:"beforebegin",o);const s=Number(e.max_icons)>0?Number(e.max_icons):3,c=window.matchMedia("(max-width: "+(Number(e.mobile_max_width)>0?Number(e.mobile_max_width):767)+"px)"),a=typeof e.logo_selector=="string"&&e.logo_selector?e.logo_selector:"header .header-logo img, header .header-logo svg, header .header-logo, header [class*=logo] img, header a[href='/'] img",l=g=>{try{return g.matches(a)||!!g.querySelector(a)}catch{return!1}},d=g=>{if(!g||g.nodeType!==1||g.tagName==="SCRIPT"||g.tagName==="STYLE"||g.tagName==="TEMPLATE"||g===o||g.hasAttribute("data-morvo-nav-icon"))return!1;const w=getComputedStyle(g);if(w.display==="none"||w.visibility==="hidden")return!1;if(w.display==="contents")return!0;const N=g.getBoundingClientRect();return N.width>0||N.height>0},p=g=>{let w=0;for(const N of g.children){if(!d(N)||l(N))continue;const X=Array.from(N.children).filter(ho=>
191d(ho)&&!l(ho));getComputedStyle(N).display==="contents"||X.length>1&&!N.querySelector(":scope > svg, :scope > img")?w+=p(N):w+=1}return w},f=t,m=i.indexOf(e.position)>=0?e.position:"beforebegin",y=typeof e.class=="string"?e.class:"",C=()=>{try{return typeof e.right_side_selector=="string"&&document.querySelector(e.right_side_selector)||f.parentElement}catch{return f.parentElement}},_=()=>{try{return typeof e.left_selector=="string"&&e.left_selector?document.querySelector(e.left_selector):null}catch{return null}},u=g=>{try{return typeof e.left_side_selector=="string"&&document.querySelector(e.left_side_selector)||g&&g.parentElement}catch{return g&&g.parentElement}},O=["beforebegin","afterbegin","beforeend","afterend"].indexOf(e.left_position)>=0?e.left_position:"beforeend",S=o.style.cssText,D=g=>{if(g==="right")o.className=y,o.style.cssText=S,(o.parentElement!==f.parentElement||o.nextElementSibling!==f)&&f.insertAdjacentElement(m,o);else if(g==="left"){const w=_();o.className=typeof e.left_class=="string"?e.left_class:y,o.style.cssText=S+"flex:0 0 auto;width:"+r+"px;min-width:"+r+"px;justify-content:center;"+(typeof e.left_style=="string"?e.left_style:"margin-left:10px;"),w&&!w.contains(o)&&w.insertAdjacentElement(O,o)}else o.isConnected&&o.remove();o.setAttribute("data-morvo-nav-home",g),document.documentElement.setAttribute("data-morvo-nav-home",g)},B=()=>{try{if(!c.matches){D("right");return}o.isConnected&&o.remove();const g=C();if(g&&p(g)<s){D("right");return}const w=_(),N=w?u(w):null;if(w&&N&&p(N)<s){D("left");return}D("none")}catch{D("right")}};o.addEventListener("click",g=>{o.getAttribute("data-morvo-nav-home")==="left"&&g.stopPropagation()},!1),B(),setTimeout(B,250);let E=null;window.addEventListener("resize",()=>{clearTimeout(E),E=setTimeout(B,120)})}},_n=()=>
191{if(!(A&&A.nav_icon&&A.nav_icon.menu&&typeof A.nav_icon.menu.selector=="string")||document.querySelector("[data-morvo-nav-menu]"))return;const e=A.nav_icon,t=e.menu;let n=null;try{n=document.querySelector(t.selector)}catch{n=null}if(!n)return;const o=typeof e.href=="string"&&/^(\/|https:\/\/)/.test(e.href.trim())?e.href.trim():null,r=document.createElement("li");r.setAttribute("data-morvo-nav-menu","1"),r.setAttribute("role","presentation"),typeof t.item_class=="string"&&t.item_class&&(r.className=t.item_class);const i=document.createElement(o?"a":"button");o?i.setAttribute("href",o):(i.type="button",i.setAttribute("data-morvo-trigger","nav_menu")),typeof t.link_class=="string"&&t.link_class&&(i.className=t.link_class),i.setAttribute("aria-label",typeof e.aria=="string"&&e.aria?e.aria:"Personal shopper");const s=document.createElement("span");typeof t.image_class=="string"&&t.image_class&&(s.className=t.image_class),s.style.cssText="display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;",s.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3l1.8 4.7 4.7 1.8-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/><path d="M19 15l.7 1.8 1.8.7-1.8.7L19 20l-.7-1.8-1.8-.7 1.8-.7z"/><path d="M5 3l.6 1.4L7 5l-1.4.6L5 7l-.6-1.4L3 5l1.4-.6z"/></svg>';const c=document.createElement("span");typeof t.title_class=="string"&&t.title_class&&(c.className=t.title_class),c.textContent=typeof t.label=="string"&&t.label.trim()?t.label.trim():"Personal Shopper",i.appendChild(s),i.appendChild(c),r.appendChild(i);const a=["afterbegin","beforeend"];n.insertAdjacentElement(a.indexOf(t.position)>=0?t.position:"afterbegin",r)};if(bn(),_n(),A&&A.nav_icon)try{let e=null;new MutationObserver(()=>{(document.querySelector("[data-morvo-nav-icon]")||document.documentElement.getAttribute("data-morvo-nav-home")==="none")&&(!A.nav_icon.menu||document.querySelector("[data-morvo-nav-menu]"))||(clearTimeout(e),e=setTimeout(()=>{bn(),_n()},120))}).observe(document.body,{childList:!0,subtree:!0})}catch{}if(x){b.classList.add("open");const e=()=>{if(window.matchMedia("(max-width: 599px)").matches)b.style.left="",b.classList.remove("expanded");else if(!b.classList.contains("expanded"))try{st(!0)}catch{b.classList.add("expanded")}};e(),window.addEventListener("resize",e);const t=o=>{for(const r of o){if(r===b)break;if(!r||r.nodeType!==1)continue;let i="";try{i=getComputedStyle(r).overflowY}catch{i=""}if((i==="auto"||i==="scroll")&&r.scrollHeight>r.clientHeight+1)return r}return null};b.addEventListener("wheel",o=>{if(Math.abs(o.deltaY)<=Math.abs(o.deltaX))return;const r=typeof o.composedPath=="function"?o.composedPath():[];if(r.some(l=>l&&l.classList&&l.classList.contains("history-panel")))return;const i=o.deltaMode===1?o.deltaY*16:o.deltaMode===2?o.deltaY*window.innerHeight:o.deltaY,s=t(r),c=!s||s.scrollTop<=0,a=!s||s.scrollTop+s.clientHeight>=s.scrollHeight-1;if(i<0&&c||i>0&&a){o.preventDefault();const l=document.documentElement,d=l.style.scrollBehavior;l.style.scrollBehavior="auto";try{window.scrollBy({top:i,left:0,behavior:"instant"})}catch{window.scrollBy(0,i)}l.style.scrollBehavior=d}},{passive:!1});const n=typeof x.rule.grow_height=="string"&&/^[0-9a-z().%+\- ]{2,60}$/i.test(x.rule.grow_height.trim())?x.rule.grow_height.trim():null;if(n&&!window.matchMedia("(max-width: 599px)").matches){const o=h.querySelector("#llmPower .chat-inner")||h.querySelector("#llmPower .chat-main"),r=b.style.getPropertyValue("--mv-embed-height");if(o){let i=!1;const s=()=>{i||(i=!0,b.style.setProperty("--mv-embed-height",n),setTimeout(()=>{try{const c=document.querySelector("header"),a=c?Math.max(0,c.getBoundingClientRect().bottom):0,l=document.documentElement,d=l.style.scrollBehavior;l.style.scrollBehavior="auto",window.scrollTo(0,Math.max(0,F.getBoundingClientRect().top+(window.scrollY||0)-a-8)),l.style.scrollBehavior=d}catch{}},60))};eo=()=>{i&&(i=!1,r&&b.style.setProperty("--mv-embed-height",r))};try{new MutationObserver(()=>{!i&&h.querySelector("#llmPower .chatBubble.assistant, #llmPower .chatBubble.system")&&s()}).observe(o,{childList:!0,subtree:!0})}catch{}}}if(x.rule.variant==="strip"){const o=x.rule;
191b.classList.add("strip-capable");const r=h.querySelector("#llmPower .outer-wrapper"),i=h.querySelector("#llmPower .input"),s=h.querySelector("#llmPower .input textarea");if(r&&i&&s){if(typeof o.placeholder=="string"&&o.placeholder.trim()&&(s.placeholder=o.placeholder.trim()),o.strip_label!==!1&&o.strip_label!==""){const S=document.createElement("div");S.className="strip-label",S.textContent=typeof o.strip_label=="string"&&o.strip_label.trim()?o.strip_label.trim():"Ask our personal shopper",r.insertBefore(S,i)}const c=document.querySelector("h1"),a=(c&&c.textContent?c.textContent:"").replace(/\s+/g," ").trim(),l=S=>/ies$/i.test(S)?S.replace(/ies$/i,"y"):/sses$/i.test(S)?S.replace(/es$/i,""):/s$/i.test(S)?S.replace(/s$/i,""):S,p=(a?a.split(/\s*(?:&|\band\b|,|\/)\s*/i)[0].trim():"").split(" ").filter(Boolean),f=p[p.length-1]||"",m=p.length?[...p.slice(0,-1),/^[a-z]{3,}$/i.test(f)?l(f):f].join(" ").toLowerCase():"",y=S=>String(S).replace(/\{collection\}/g,a).replace(/\{collection_lower\}/g,a.toLowerCase()).replace(/\{item\}/g,m).replace(/\s+/g," ").trim(),C=()=>{try{const S=document.querySelector("header"),D=S?Math.max(0,S.getBoundingClientRect().bottom):0,B=Math.max(0,F.getBoundingClientRect().top+(window.scrollY||0)-D-12),E=document.documentElement,g=E.style.scrollBehavior;E.style.scrollBehavior="auto",window.scrollTo(0,B),E.style.scrollBehavior=g}catch{}},_=()=>{b.classList.contains("strip")&&(b.classList.remove("strip"),s.rows=2,setTimeout(C,80),setTimeout(C,900))};Zt=()=>{b.classList.contains("strip")||(b.classList.add("strip"),s.rows=1)};const u=S=>{_(),s.value=S,pe.click()},O=document.createElement("div");if(O.className="strip-pills",Array.isArray(o.strip_pills))for(const S of o.strip_pills.slice(0,3)){if(typeof S!="string"||!S.trim()||/\{/.test(S)&&!a)continue;const D=y(S);if(!D)continue;const B=document.createElement("button");B.type="button",B.className="strip-pill",B.textContent=D,B.addEventListener("click",()=>u(D),!1),O.appendChild(B)}if(typeof o.strip_action=="string"&&o.strip_action.trim()&&!(/\{/.test(o.strip_action)&&!a)){const S=document.createElement("button");S.type="button",S.className="strip-action",S.textContent=y(o.strip_action),S.addEventListener("click",()=>u(S.textContent||""),!1),O.appendChild(S)}O.children.length>0&&i.insertAdjacentElement("afterend",O),s.rows=1,pe.addEventListener("click",()=>{s.value.trim()&&_()},!1)}}}document.addEventListener("click",e=>{const t=e.target&&e.target.closest&&e.target.closest("[data-morvo-trigger]");t&&(e.preventDefault(),Cn(t.getAttribute("data-morvo-trigger")||"trigger"))},!1),document.addEventListener("keydown",e=>{if(e.key!=="Enter"&&e.key!==" ")return;const t=e.target&&e.target.closest&&e.target.closest("[data-morvo-trigger]");t&&(e.preventDefault(),Cn(t.getAttribute("data-morvo-trigger")||"trigger"))},!1),document.documentElement.classList.add("morvo-ready"),gn.addEventListener("click",Tn,!1),yn.addEventListener("click",rt,!1),gn.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),Tn())},!1),yn.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),rt())},!1),At.addEventListener("click",rt,!1),no.addEventListener("click",e=>{const t=e.target.closest(".history-item");if(!t)return;const n=t.dataset.id;if(e.target.closest(".history-delete")){lr(n),n===localStorage.getItem(I("session_id"))&&(fe=[],L=1,localStorage.setItem(I("chatGroup"),L),h.querySelectorAll(".chat-inner .chatGroup").forEach(o=>o.remove()),ie.querySelectorAll(":scope > .follow-ups").forEach(o=>o.remove()),Do()),Ln(),Fe();return}$r(n)},!1);let ao=!1;window.addEventListener("storage",e=>{if(e.key===I("chatHistory")){if(Q||j){ao=!0;return}Sn()}}),je&&je.addEventListener("click",fo),h.addEventListener("keydown",e=>{if(e.key==="Tab"&&xn()){const t=Hr();if(t.length>0){const n=h.activeElement,o=t.indexOf(n),r=!e.shiftKey&&(o===t.length-1||o===-1),i=e.shiftKey&&(o===0||o===-1);r?(e.preventDefault(),t[0].focus()):i&&(e.preventDefault(),t[t.length-1].focus())}return}e.key==="Escape"&&(De&&!De.hidden?fo():Ve&&!Ve.hidden?rt():!x&&b.classList.contains("open")&&Ue())}),R.addEventListener("input",()=>{R.style.height="auto",R.style.height=R.scrollHeight+R.offsetHeight-R.clientHeight+"px"});let lo=0;window.addEventListener("resize",nt),window.addEventListener("resize",uo);let Mt=null,co=!1;try{document.addEventListener("keydown",e=>{(e.key==="Tab"||e.key==="Enter"||e.key===" "||e.key==="Escape")&&(co=!0)},!0),document.addEventListener("pointerdown",()=>{co=!1},!0)}catch{}R.addEventListener("keydown",e=>{if(e.key==="Enter"&&!e.shiftKey){if(e.preventDefault(),Q)return;pe.click()}}),pe.addEventListener("click",async e=>{if(Q){Ur();return}const t=de.className.includes("introVisible"),n=it();!t||!n?Pn():t&&n&&(Ge=()=>{Pn(),Ge=null},Nt())});const Ot="morvo_expanded";typeof ResizeObserver=="function"?new ResizeObserver(at).observe(V):window.addEventListener("resize",()=>at()),at(),window.addEventListener("resize",Gr);async function Pn(){try{if(ue()&&R&&R.value.trim()!==""){var e=$
191("morvo_first_touch_ts"),t=Be("morvo_last_touch_ts")||Be("morvo_first_touch_ts"),n=Date.now();e||q("morvo_first_touch_ts",n,ee),q("morvo_last_touch_ts",n,ee),q("morvo_last_touch_type","query",ee),T=="shopify"&&(!e||!t)&&Wt()}}catch{}if(se=vt(),R.value!==""){de.classList.remove("introVisible");let o=R.value.trim();const r=nr();b.classList.add("busy"),b.getBoundingClientRect();const i=fn.querySelector("img");i.style.animation="none",mn.style.animation="none",He.getBoundingClientRect(),requestAnimationFrame(()=>{i.style.animation="",mn.style.animation=""}),R.value="",R.dispatchEvent(new Event("input")),oe("user",o),_o(L),be(o,"user",L);try{const s=xe().flatMap(f=>{if(f.role==="outfits"&&Array.isArray(f.content)){try{const m=f.content.flatMap(y=>(y&&y.products||[]).map(C=>C&&C.name)).filter(Boolean);if(m.length)return[{role:"assistant",content:"Shown in bundles: "+m.slice(0,12).map(y=>"**"+String(y).slice(0,90)+"**").join(", ")+"."}]}catch{}return[]}return f.role==="user"||f.role==="assistant"?[f]:[]}).slice(-30).map(f=>({role:f.role,content:f.content})),c="deepseek-speciale";Q=new AbortController,b.classList.add("stoppable"),pe.setAttribute("aria-label","Stop search");const a=await fetch(qn,{signal:Q.signal,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:s,model_name:c,company_id:ye,session_id:se,latest_query:o,visitor_id:re,measurement_session_id:(typeof $=="function"?$("morvo_session_id"):null)||null,device_type:window.matchMedia&&window.matchMedia("(max-width: 599px)").matches?"mobile":"desktop",...function(){var f=Oe();return f&&f.rate?{presentment_currency:f.active,presentment_rate:f.rate}:{}}(),query_source:yt||"typed",...typeof Kt=="function"&&Kt()?{automated:!0}:{},...function(){const f=sr();return f?{shopper_prefs:f}:{}}(),...Array.isArray(Ye)&&Ye.length>0?{compare_ids:Ye}:{},...r?{page_context:r}:{}})});if(!a.ok){const f=await a.json();console.error(f.error||f.detail),be(f.detail,"system",L);return}const l=a.body.getReader(),d=new TextDecoder;let p="";for(;;){const{value:f,done:m}=await l.read();if(m)break;p+=d.decode(f,{stream:!0});const y=p.split(`
192`);p=y.pop();for(const C of y){if(!C)continue;const _=JSON.parse(C);if(_.type==="status"&&(j&&ke(!0),Hn(_.message)),_.type==="prefetch")try{Jn(_)}catch{}if(_.type==="delta"&&Un(_.text,L),_.type==="result"){const u=_.data,O=L;if(oe("assistant",u.summary),u.prefs&&ir(u.prefs),Fn(u.summary)||be(u.summary,"system",L),Array.isArray(u.outfits)&&u.outfits.length>0)u.bundle_label&&u.outfits.forEach(E=>{E&&(E.badge_label=u.bundle_label)}),No(u.outfits,L,"new"),oe("outfits",u.outfits),K&&Y("morvo_outfit_results",{outfit_count:u.outfits.length});else if(Array.isArray(u.compare_select)&&u.compare_select.length>0)qo(u.compare_select,L,"new"),oe("compare_select",u.compare_select);else if(u.order_form)Po(L,"new"),oe("order_form",!0);else if(u.products){const E=typeof u.more_from=="number"&&u.more_heading?{from:u.more_from,heading:String(u.more_heading)}:null;gt(u.products,L,"new",u.shade_rows,E),Array.isArray(u.shade_rows)&&u.shade_rows.length>0?oe("shade_products",{products:u.products,shade_rows:u.shade_rows}):E?oe("split_products",{products:u.products,more_from:E.from,more_heading:E.heading}):oe("products",u.products),K&&Y("view_item_list",Object.assign({},zt,{items:u.products.slice(0,10).map(Jt)}))}if(L===O&&!(Array.isArray(u.outfits)&&u.outfits.length>0)&&!(Array.isArray(u.compare_select)&&u.compare_select.length>0)&&!u.order_form&&!u.products&&(L++,localStorage.setItem(I("chatGroup"),L)),Array.isArray(u.upsell)&&u.upsell.length>0){Oo(u.upsell,O,"new"),oe("upsell",u.upsell);const E=u.upsell.filter(g=>g&&Array.isArray(g.products)&&g.products.length>0);K&&E.length>0&&Y("morvo_upsell_shown",{upsell_kinds:E.map(g=>g.kind).filter(Boolean).join(","),upsell_products:E.reduce((g,w)=>g+w.products.length,0)})}Qe(),ie.querySelectorAll(":scope > .follow-ups").forEach(E=>E.remove());const S=Array.isArray(u.outfits)&&u.outfits.length>0?"bundle_pill":"pill",D=(E,g,w)=>{const N=()=>{R.value=w,yt=S,pe.click(),requestAnimationFrame(()=>{V.scrollTo({top:V.scrollHeight,behavior:"smooth"})})};E.addEventListener("click",()=>{if(g.remove(),Q){Lt=N;return}N()})},B=Array.isArray(u.follow_up_media)?u.follow_up_media.filter(E=>E&&typeof E.label=="string"&&E.label.trim()):[];if(B.length>0){const E=document.createElement("div");E.className="follow-ups follow-ups-media",B.slice(0,12).forEach(w=>{const N=document.createElement("button");if(N.type="button",N.className="follow-up-pill media-pill",typeof w.img=="string"&&/^https:\/\//.test(w.img)){const me=document.createElement("img");me.src=w.img,me.alt=w.label,me.loading="lazy",N.appendChild(me)}const X=document.createElement("span");X.textContent=w.label,N.appendChild(X),D(N,E,w.label),E.appendChild(N)});const g=h.querySelector(".group"+O);g?(g.appendChild(E),setTimeout(()=>{const w=g.offsetTop-80;V.scrollTo({top:w,behavior:"smooth"}),setTimeout(()=>{const N=V.scrollHeight-V.clientHeight,X=Math.max(0,Math.min(w,N));Math.abs(V.scrollTop-X)>24&&(V.scrollTop=X)},450)},0)):ie.appendChild(E)}else if(Array.isArray(u.follow_ups)&&u.follow_ups.length>0){const E=document.createElement("div");E.className="follow-ups"+(u.follow_ups.length>5?" follow-ups-grid":""),u.follow_ups.slice(0,12).forEach(g=>{if(typeof g!="string"||!g.trim())return;const w=document.createElement("button");w.type="button",w.className="follow-up-pill",w.textContent=g,D(w,E,g),E.appendChild(w)}),ie.appendChild(E)}}}}}catch(s){s&&s.name==="AbortError"?be("Search stopped.","system",L):be("Error contacting server."+s,"system",L)}finally{zn(),Q=null;const s=Lt;Lt=null,Ye=null,yt=null,b.classList.remove("busy"),b.classList.remove("stoppable"),pe.setAttribute("aria-label","Send"),He.innerText=Pr,Rt(),ao&&(ao=!1,Sn()),s&&s()}}}}catch(U){console.error("Widget cannot start:",U&&U.name||"",U&&U.message||"",U)}})()}})();})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.