(()=>{let c=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),x="https://api.analytics.sales-marker.jp/event",A="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwiaWF0IjoxNjc4ODAxOTE5fQ.olKX9MVukd8vZypL2gTNqRApxzhgNp8uuPG9mFSMtz0",I={"sales-marker-analytics-tag":"https://app.sales-marker.jp","marketing-marker-analytics-tag":"https://marketing-marker.jp"},f="SalesMarkerAnalyticsTagTest",w="test=sales-marker-analytics-tag",l=performance.now(),u=c(),a=window.location.href,s=!1,r=0,n=null,o=()=>performance.now()-l-r,E=e=>{var g,h;let t=new URL(a),p=(h=(g=/^(?:https?:\/\/)?(?:[^@/\n]+@)?(?:www\.)?([^:/?\n]+)/gim.exec(t.hostname))==null?void 0:g[1])!=null?h:"";return{pathname:t.pathname,domain:p,search:t.search,userAgent:window.navigator.userAgent,createdAt:new Date().toISOString(),version:2,href:a,action:"pageview",duration:e,sessionId:u,hasFocused:document.hasFocus(),visibilityState:document.visibilityState}},i=e=>{let t=E(e);fetch(x,{method:"POST",body:JSON.stringify(t),keepalive:!0,mode:"cors",headers:{Authorization:`Bearer ${A}`,"Content-Type":"application/json"}}).catch(console.error)};setInterval(()=>{document.hasFocus()&&i(o())},1e4);function v(){a!==window.location.href&&(i(o()),a=window.location.href,l=performance.now(),u=c(),r=0,n=null)}let R=()=>{!document.hasFocus()&&!s?(i(o()),s=!0):document.hasFocus()&&(s=!1)};setInterval(()=>{v(),R()},100),setInterval(()=>{let e=performance.now();document.hasFocus()?n!==null&&(r+=e-n,n=null):n===null&&(n=e)},100);let[_]=w.split("="),m=new URLSearchParams(window.location.search).get(_);if(m===null)return;let d=I[m];d!==void 0&&window.opener.postMessage({action:f,message:"ok"},d)})();
