(function(d){typeof define=="function"&&define.amd?define(d):d()})(function(){"use strict";const d="http://localhost:5184",_="https://adwin.stage.usestyle.ai",S="https://adwin.usestyle.ai",v="https://p.usestyle.ai/api";var h=(t=>(t.Exact="exact",t.Similar="similar",t))(h||{}),u=(t=>(t.AstraJsReady="astra_js_ready",t.AstraDevReady="astra_dev_ready",t.AstraEnableDev="astra_enable_dev",t.AstraDisableDev="astra_disable_dev",t.AstraSaveDev="astra_save_dev",t.AstraAddEvent="astra_add_event",t.AstraRemoveEvent="astra_remove_event",t.AstraSetEvents="astra_set_events",t))(u||{});const n={events:[],eventRefs:{},devMode:!1,targetWindow:window,targetDocument:document},m=[d,S,_],D=t=>{var e;for(const r of m)(e=n.targetWindow.opener)==null||e.postMessage(t,r)},I=()=>{if(!(window.self===window.parent||window.location.href!=="about:srcdoc")){try{n.targetDocument=window.parent.document}catch{return}n.targetWindow=window.parent}},w=t=>{var r;const e=[];for(;t;){if(t.id){e.unshift(`/*[@id="${t.id}"]`);break}const a=((r=t.parentNode)==null?void 0:r.childNodes)??[];let o=1;for(let s=0;s{const e=t.tagName.toLowerCase();if(e==="a")return"a";if(e==="button")return"button";if(e==="input"){const r=t.getAttribute("type");if(r==="submit"||r==="button")return`input[type='${r}']`}else if(t.getAttribute("role")==="button")return`${e}[role='button']`},L=t=>{var r;const e=t.tagName.toLowerCase();return e==="a"?t.href:e==="input"?t.value:t.textContent?(r=t.textContent)==null?void 0:r.trim().toLowerCase():t.innerText?t.innerText.trim().toLowerCase():""},f=(t,e)=>e.matchType===h.Exact?e.path===n.targetWindow.location.pathname&&e.xpath===w(t):e.tagType!==C(t)?!1:L(t)===e.content||w(t)===e.xpath,l=["button","a[href]:not([href=''])","[role='button']","input[type='submit']","input[type='button']"],E=(t,e)=>{const{eventRefs:r}=n;e.addEventListener("click",r[t.id],!0)},R=(t,e)=>{const{eventRefs:r}=n;e.removeEventListener("click",r[t.id],!0)},T=t=>{Array.from(n.targetDocument.querySelectorAll(l.join(","))).forEach(r=>{f(r,t)&&E(t,r)})},W=t=>{if(!n.eventRefs[t.id])return;Array.from(n.targetDocument.querySelectorAll(l.join(","))).forEach(r=>{f(r,t)&&R(t,r)})},y=(t,e)=>{t.forEach(r=>{f(e,r)&&E(r,e)})},$=t=>{const e=new MutationObserver(r=>{r.forEach(a=>{a.type==="childList"&&a.addedNodes.forEach(o=>{if(o.nodeType===Node.ELEMENT_NODE){const s=o;s.matches(l.join(","))?y(t,s):s.querySelectorAll(l.join(",")).forEach(c=>y(t,c))}})})});return e.observe(document,{childList:!0,subtree:!0}),e},N=t=>{if(n.devMode)return;const e={send_to:`${n.gAdsTagId}/${t}`};n.targetWindow.gtag("event","conversion",e)},x=()=>{const{gAdsTagId:t,gAnalyticsMeasurementId:e}=n;if(!t&&!e||n.gInstalled)return;const r=n.targetDocument.createElement("script");r.async=!0,r.src=`https://www.googletagmanager.com/gtag/js?id=${t??e}`,r.onload=()=>n.gInstalled=!0,n.targetDocument.head.appendChild(r),n.targetWindow.dataLayer=n.targetWindow.dataLayer||[],n.targetWindow.gtag=function(){n.targetWindow.dataLayer.push(arguments)},n.targetWindow.gtag("js",new Date),t&&n.targetWindow.gtag("config",t),e&&n.targetWindow.gtag("config",e)},j=`${v}/v1/a`,M=async()=>{try{const t=await fetch(`${j}?domain=${encodeURIComponent(n.targetWindow.location.hostname)}`),{success:e,data:r,error:a}=await t.json();if(!e)throw new Error(a);return r}catch(t){return console.error(t),null}},O=`${v}/v1/astra`,P=async()=>{try{const t=await fetch(`${O}?page=${encodeURIComponent(n.targetWindow.location.href)}`),{success:e,data:r,error:a}=await t.json();if(!e)throw new Error(a);return{siteTag:r.siteTag,conversionEvents:r.conversionEvents}}catch(t){return console.error(t),null}};let A=null,g=null;const p=async()=>{if(n.targetWindow.location.pathname===A)return;A=n.targetWindow.location.pathname;const{events:t}=n;g&&(g.disconnect(),g=null),t.forEach(a=>{W(a)}),n.eventRefs={};const[e,r]=await Promise.all([P(),M()]);e&&(n.gAdsTagId=e.siteTag.gId,n.events=e.conversionEvents),r&&(n.gAnalyticsMeasurementId=r),x(),e&&(e.conversionEvents.forEach(a=>{const o=N.bind(null,a.gPixelId);n.eventRefs[a.id]=o,T(a)}),g=$(e.conversionEvents))},k=history.pushState;history.pushState=function(){k.apply(history,arguments),p()};const z=history.replaceState;history.replaceState=function(){z.apply(history,arguments),p()};const B="https://p.usestyle.ai/astra/editor";let i;I();const q=()=>{n.devMode||(n.devMode=!0,i=n.targetDocument.createElement("script"),i.src=B,i.id="astra-editor-script",n.targetDocument.head.appendChild(i))},F=()=>{n.devMode=!1,i.remove()},G=t=>{if(!m.includes(t.origin)||!t.data.type)return;const{type:e}=t.data;e===u.AstraEnableDev?q():e===u.AstraDisableDev&&F()},b=async()=>{window.astraScriptInitialized!==!0&&(window.astraScriptInitialized=!0,p(),n.targetWindow.addEventListener("message",G),D({type:u.AstraJsReady}))};document.readyState==="loading"?n.targetDocument.addEventListener("DOMContentLoaded",b):b()}); (function(w){typeof define=="function"&&define.amd?define(w):w()})(function(){"use strict";const w="https://seonaapi.usestyle.ai/api",M="http://localhost:5181",R="https://seona.stage.usestyle.ai",k="https://seona.usestyle.ai";var f=(t=>(t.HeadingPromotion="H1_PROMOTION",t.HeadingDemotion="H1_DEMOTION",t.AnchorTarget="ADD_LINK_TARGET",t.AnchorTitle="ADD_LINK_TITLE",t.MetaDescription="OPTIMIZE_DESCRIPTION",t.DocumentTitle="OPTIMIZE_TITLE",t.MetaOpenGraph="ADD_OG_SITE_TAG",t.MetaViewport="META_VIEWPORT",t.LinkCanonical="LINK_CANONICAL",t.ImageAlternateText="ADD_ALT_TAG",t))(f||{}),u=(t=>(t.Active="ACTIVE",t.Modified="EDITED",t.Disabled="REJECTED",t))(u||{});const $=t=>{var n;const o=[];for(;t;){if(t.id){o.unshift(`/*[@id="${t.id}"]`);break}const i=((n=t.parentNode)==null?void 0:n.childNodes)??[];let a=1;for(let r=0;r{try{const{hostname:t,pathname:o}=c.targetWindow.location,n=await fetch(`${H}?url=${encodeURIComponent(`https://${t}${o}`)}`),{success:i,data:a,error:r}=await n.json();if(!i)throw new Error(r);return a.codeChanges.filter((e,s,l)=>l.findIndex(({xpath:p,type:d})=>p===e.xpath&&d===e.type)===s).map(e=>({...e,data:JSON.parse(e.data)}))}catch{return[]}},y=t=>c.targetDocument.evaluate(t,c.targetDocument,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue,V={apply:t=>{var l;const{data:{href:o},status:n,xpath:i,id:a}=t,{initialState:r}=c,e=y(i);if(!e||e.href!==o)return;let s="_blank";n===u.Disabled&&(s=(l=r[a])==null?void 0:l.target),r[a]||(r[a]={target:e.target}),e.target=s},property:"target"},B={apply:t=>{var p;const{data:{href:o,title:n},status:i,xpath:a,id:r}=t,{initialState:e}=c,s=y(a);if(!s||s.href!==o)return;let l=n;i===u.Disabled&&(l=(p=e[r])==null?void 0:p.title),e[r]||(e[r]={title:s.title}),s.title=l},property:"title"},G={apply:t=>{var p,d;const{data:{textContent:o},status:n,xpath:i,id:a}=t,{initialState:r}=c,e=y(i);let s=o;if(n===u.Disabled){if(!e)return;if(!((p=r[a])!=null&&p.textContent)){e.remove();return}s=(d=r[a])==null?void 0:d.textContent}if(e){r[a]||(r[a]={textContent:e.textContent}),e.textContent=s;return}const l=c.targetDocument.createElement("title");l.textContent=s,c.targetDocument.head.appendChild(l)},verify:t=>t.tagName.toLowerCase()==="title"},x=(t,o)=>{var i;o.innerHTML=t.innerHTML;for(const a of t.attributes)o.setAttribute(a.name,a.value);(i=t.parentElement)==null||i.insertBefore(o,t);const n=c.targetWindow.getComputedStyle(t);for(const a in n){const r=n.getPropertyValue(a);if(!r)continue;t.style.setProperty(a,"unset");const e=n.getPropertyValue(a);r!==e&&(o.style[a]=r)}},X={apply:({xpath:t,status:o})=>{const n=o===u.Disabled,{modifiedXPaths:i}=c,a=y(n?i[t]:t);if(!a)return;const r=c.targetDocument.createElement(n?"h1":"h2");if(x(a,r),a.remove(),n){delete i[t];return}i[t]=$(r)},verify:(t,o)=>t.tagName.toLowerCase()==="h1"&&$(t)===o.xpath},F={apply:t=>{const{data:{tagName:o},status:n,xpath:i}=t,a=n===u.Disabled,{modifiedXPaths:r}=c,e=y(a?r[i]:i);if(!e)return;const s=c.targetDocument.createElement(a?o:"h1");if(x(e,s),e.remove(),a){delete r[i];return}r[i]=$(s)},verify:(t,o)=>t.tagName.toLowerCase()!=="h1"&&$(t)===o.xpath},j={apply:t=>{var p;const{data:{alt:o,src:n},status:i,xpath:a,id:r}=t,{initialState:e}=c,s=y(a);if(!s||s.src!==n)return;let l=o;i===u.Disabled&&(l=(p=e[r])==null?void 0:p.alt),e[r]||(e[r]={alt:s.alt}),s.alt=l},property:"alt"},z={apply:t=>{var p,d;const{data:{href:o},status:n,xpath:i,id:a}=t,{initialState:r}=c,e=y(i);let s=o;if(n===u.Disabled){if(!e)return;if(!((p=r[a])!=null&&p.href)){e.remove();return}s=(d=r[a])==null?void 0:d.href}if(e){r[a]||(r[a]={href:e.href}),e.href=s;return}const l=c.targetDocument.createElement("link");l.rel="canonical",l.href=s,c.targetDocument.head.appendChild(l)},verify:t=>t.tagName.toLowerCase()==="link"&&t.rel==="canonical",property:"href"},q={apply:t=>{var p,d;const{data:{content:o},status:n,xpath:i,id:a}=t,{initialState:r}=c,e=y(i);let s=o;if(n===u.Disabled){if(!e)return;if(!((p=r[a])!=null&&p.content)){e.remove();return}s=(d=r[a])==null?void 0:d.content}if(e){r[a]||(r[a]={content:e.content}),e.content=s;return}const l=c.targetDocument.createElement("meta");l.name="description",l.content=s,c.targetDocument.head.appendChild(l)},verify:t=>t.tagName.toLowerCase()==="meta"&&t.name==="description",property:"content"},U={apply:t=>{var O,P;const{data:{content:o,name:n,property:i},status:a,xpath:r,id:e}=t,{initialState:s}=c,l=y(r);let p=o;if(a===u.Disabled){if(!l)return;if(!((O=s[e])!=null&&O.content)){l.remove();return}p=(P=s[e])==null?void 0:P.content}if(l){s[e]||(s[e]={content:l.content}),l.content=p;return}const d=c.targetDocument.createElement("meta");n&&d.setAttribute("name",n),i&&d.setAttribute("property",i),d.content=p,c.targetDocument.head.appendChild(d)},verify:(t,o)=>{if(t.tagName.toLowerCase()!=="meta")return!1;const{data:{name:n,property:i}}=o;return n?t.name===n:t.getAttribute("property")===i},property:"content"},K={apply:t=>{var p,d;const{data:{content:o},status:n,xpath:i,id:a}=t,{initialState:r}=c,e=y(i);let s=o;if(n===u.Disabled){if(!e)return;if(!((p=r[a])!=null&&p.content)){e.remove();return}s=(d=r[a])==null?void 0:d.content}if(e){r[a]||(r[a]={content:e.content}),e.content=s;return}const l=c.targetDocument.createElement("meta");l.name="viewport",l.content=s,c.targetDocument.head.appendChild(l)},verify:t=>t.tagName.toLowerCase()==="meta"&&t.name==="viewport",property:"content"},E={[f.HeadingDemotion]:X,[f.HeadingPromotion]:F,[f.ImageAlternateText]:j,[f.AnchorTarget]:V,[f.AnchorTitle]:B,[f.MetaDescription]:q,[f.MetaOpenGraph]:U,[f.DocumentTitle]:G,[f.MetaViewport]:K,[f.LinkCanonical]:z};let g=[],C=null,v={};const J=8,T=(t,o)=>{if(t instanceof HTMLElement&&["title","h1","h2","h3","h4","h5","h6","meta","link","a","img"].includes(t.tagName.toLowerCase()))for(const n of o){if(v[n.id]===J)continue;const{verify:i,property:a,apply:r}=E[n.type];if(!(i?i(t,n):$(t)===n.xpath)||n.type===f.AnchorTarget&&t.target==="_blank"||a&&t[a]===n.data[a])continue;const s=v[n.id]||0;v[n.id]=s+1,r(n)}},m=new MutationObserver(t=>{for(const{target:o,addedNodes:n}of t){T(o,g);for(const i of n)T(i,g)}}),b=async()=>{const t=c.targetWindow.location.pathname;if(t!==C){if(C=t,v={},m==null||m.disconnect(),g){c.initialState={};const o=g.filter(({status:n})=>n!==u.Disabled).map(n=>({...n,status:u.Disabled}));for(const n of o)E[n.type].apply(n)}g=await W();for(const o of g)E[o.type].apply(o);m==null||m.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["alt","property","content","title","target","href"]})}},Z=history.pushState;history.pushState=function(...t){Z.apply(history,t),b()};const Y=history.replaceState;history.replaceState=function(...t){Y.apply(history,t),b()};const S=[k,M,R],A=t=>{var o;for(const n of S)(o=c.targetWindow.top)==null||o.postMessage(t,n)};let D=null,h=null;const _="#b523f9",Q=()=>{const t=c.targetDocument.createElement("div");return t.style.height="24px",t.style.width="24px",t.style.position="fixed",t.style.zIndex="2147483647",t.style.backgroundColor=_,t.style.borderRadius="50%",t.style.pointerEvents="none",t.style.boxShadow="0 0 256px 256px white",t},tt=()=>{const t=c.targetDocument.createElement("div");return t.style.height="24px",t.style.width="24px",t.style.position="absolute",t.style.left="0",t.style.top="0",t.style.borderRadius="50%",t.style.border=`4px solid ${_}`,t.style.boxSizing="border-box",t},L=()=>{if(!D||!h)return;const{left:t,right:o,top:n,bottom:i}=D.getBoundingClientRect(),{left:a,top:r}=h.getBoundingClientRect(),e=t+(o-t)/2-12,s=n+(i-n)/2-12;(a!==e||r!==s)&&(h.style.left=e+"px",h.style.top=s+"px"),requestAnimationFrame(L)},I={locate:t=>{const{modifiedXPaths:o}=c;if(h==null||h.remove(),D=t?y(o[t]??t):null,!D){A("seonajsplugin_not_found");return}const{x:n,y:i,width:a,height:r}=D.getBoundingClientRect();if(n===0&&i===0&&a===0&&r===0){A("seonajsplugin_hidden");return}const e=Q(),s=tt();e.appendChild(s),s.animate([{transform:"scale(1)",opacity:1},{transform:"scale(4)",opacity:0}],{duration:1e3,iterations:4}).addEventListener("finish",()=>{e.remove()}),D.scrollIntoView({behavior:"smooth",inline:"center",block:"center"}),h=e,c.targetDocument.body.append(h),requestAnimationFrame(L)},update:t=>{var o;(o=E[t.type])==null||o.apply(t)}},et=t=>{var i;if(!S.includes(t.origin)||!t.data.type||!t.data.payload)return;const{type:o,payload:n}=t.data;(i=I[o])==null||i.call(I,n)},nt=()=>{c.targetWindow!==c.targetWindow.top&&(c.targetWindow.addEventListener("message",et),A("seonajsplugin"),A({type:"initialize",payload:c.targetWindow.location.href}))},ot=()=>{if(!(window.self===window.parent||window.location.href!=="about:srcdoc")){try{c.targetDocument=window.parent.document}catch(t){console.error(t);return}c.targetWindow=window.parent}},N=async()=>{await b(),nt()};ot(),c.targetDocument.readyState==="loading"?c.targetDocument.addEventListener("DOMContentLoaded",N):N()});