function _toArray(e){return _arrayWithHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableRest()}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function _iterableToArrayLimit(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,l=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}function _arrayWithHoles(e){if(Array.isArray(e))return e}this.window=this.window||{},this.window.NavigationCapture=(e=>{var t=2;function n(e){e=new RegExp("(^| )".concat(e,"=([^;]+)")),e=document.cookie.match(e);if(e)return decodeURI(e[t])}function r(e,t,n){var t=encodeURI(t),r=(r=window.location.hostname.replace("www.",""),2<(r=(o=r).split(".")).length&&"com"===r[r.length-1]&&(o=r.slice(-2).join(".")),3<r.length&&"com"!==r[r.length-1]&&(o=r.slice(-3).join(".")),".".concat(o)),o=new Date,n=(o.setTime(o.getTime()+n),o.toUTCString());document.cookie="".concat(e,"=").concat(t,"; expires=").concat(n,"; path=/; domain=").concat(r)}var o="VtexRCSessionIdv7",a="VtexWorkspace",i="VtexRCMacIdv7",l=18e5,c=31536e6;function s(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function u(){var e=n(o),t=null!=e?e:s();return r(o,t,l),{sessionID:t,isNewSessionID:!e}}function d(){var e=n(i),t=null!=e?e:s();return r(i,t,c),{macID:t,isNewUser:!e}}function w(){return Object.assign(Object.assign({},u()),{userSessionInfo:d(),workspace:null!=(e=null!=(e=null!=(e=(()=>{var e=n(a);return _slicedToArray(null!=(e=null==e?void 0:e.split(":"))?e:[],1)[0]})())?e:(()=>{var e=new RegExp(/[?&]workspace=([^&]+)(&|$)/).exec(window.location.search);return null==e?void 0:e[1]})())?e:(()=>{var e;return null==(e=null==window?void 0:window.__RUNTIME__)?void 0:e.workspace})())?e:"",pageTitle:document.title,url:window.location.href,ref:window.document.referrer,path:window.location.pathname,hostName:window.location.hostname,accountName:null!=(e=null==(e=window.__RUNTIME__)?void 0:e.account)?e:window.jsnomeLoja});var e}var f,v,p="Event",x="https://rc.vtex.com/v8",y=3e5,m=["productView","otherView","categoryView","homeView","departmentView","internalSiteSearchView","cart","cartLoaded","payment","email","orderPlaced","profile","shipping"];function h(t,e){var n,r,o,a;return t?(n=t,e=e,e=Object.assign({},e),r=w(),e=Object.assign(Object.assign({},e),{DataType:e.DataType||p,RequestType:n,SessionId:r.sessionID,MacId:r.userSessionInfo.macID,IsNewUser:r.userSessionInfo.isNewUser,workspace:r.workspace,Url:r.url,Ref:r.ref,Path:r.path,HostName:r.hostName,pageTitle:r.pageTitle,accountName:r.accountName}),n=JSON.stringify(e),null!=m.find(function(e){return e===t})?(o=n,a=x,new Promise(function(e){var t=new XMLHttpRequest;t.timeout=y,t.open("POST",a,!0),t.setRequestHeader("Content-Type","application/json"),t.send(o),t.onload=function(){if(200===t.status||202===t.status)return u(),e(o)}})):void 0):console.error("Event name is not defined")}function b(){if(window.vtexrca){function e(){var e,t=window.vtexrca.q.shift();e=function(){return g(t)},"requestIdleCallback"in window?window.requestIdleCallback(e):setTimeout(e,1)}for(Object.defineProperty(window.vtexrca.q,"push",{value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.forEach(g)}});0<window.vtexrca.q.length;)e()}}function g(e){var e=_toArray(e),t=e[0],n=e.slice(1);switch(t.toLowerCase()){case"sendevent":var r=_slicedToArray(n,2);h(r[0],r[1]);break;case"sendmetric":case"init":break;default:console.error("invalid method name: ".concat(t))}}return window.vtex&&window.vtex.events?null!=(v=null==(f=null==(f=window.vtex)?void 0:f.events)?void 0:f.subscribe)&&v.call(f,"NavigationCapture",h):(window.vtex||(window.vtex={}),window.vtex.events={},window.vtex.events.listeners={},window.vtex.events.listeners.NavigationCapture={callback:h,whitelist:[],blacklist:[]}),b(),e.sendEvent=h,e.sendMetric=function(e){},Object.defineProperty(e,"__esModule",{value:!0}),e})({});
//# sourceMappingURL=rc.js.map