humanbehavior-js 0.0.8 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).HumanBehaviorTracker={})}(this,(function(e){"use strict";function t(e,t,n,o){return new(n||(n=Promise))((function(r,s){function i(e){try{c(o.next(e))}catch(e){s(e)}}function a(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))}var n;function o(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function r(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function s(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t).map(i).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n):null}catch(e){return null}var n}function i(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=s(e.styleSheet)||t}catch(e){}return t}"function"==typeof SuppressedError&&SuppressedError,function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(n||(n={}));var a=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var n=this.getNode(e);if(n){var o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(t,o)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function c(e){var t=e.maskInputOptions,n=e.tagName,o=e.type,r=e.value,s=e.maskInputFn,i=r||"";return(t[n.toLowerCase()]||t[o])&&(i=s?s(i):"*".repeat(i.length)),i}var d="__rrweb_original__";var l,u,h=1,p=new RegExp("[^a-z0-9-_:]");function g(){return h++}var m=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,I=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,f=/^(data:)([^,]*),(.*)/i;function y(e,t){return(e||"").replace(m,(function(e,n,o,r,s,i){var a,c=o||s||i,d=n||r||"";if(!c)return e;if(!I.test(c))return"url(".concat(d).concat(c).concat(d,")");if(f.test(c))return"url(".concat(d).concat(c).concat(d,")");if("/"===c[0])return"url(".concat(d).concat((a=t,(a.indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+c)).concat(d,")");var l=t.split("/"),u=c.split("/");l.pop();for(var h=0,p=u;h<p.length;h++){var g=p[h];"."!==g&&(".."===g?l.pop():l.push(g))}return"url(".concat(d).concat(l.join("/")).concat(d,")")}))}var C=/^[^ \t\n\r\u000c]+/,v=/^[, \t\n\r\u000c]+/;function S(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function b(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function A(){var e=document.createElement("a");return e.href="",e.href}function w(e,t,n,o){return"src"===n||"href"===n&&o&&("use"!==t||"#"!==o[0])||"xlink:href"===n&&o&&"#"!==o[0]?S(e,o):"background"!==n||!o||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n&&o?function(e,t){if(""===t.trim())return t;var n=0;function o(e){var o,r=e.exec(t.substring(n));return r?(o=r[0],n+=o.length,o):""}for(var r=[];o(v),!(n>=t.length);){var s=o(C);if(","===s.slice(-1))s=S(e,s.substring(0,s.length-1)),r.push(s);else{var i="";s=S(e,s);for(var a=!1;;){var c=t.charAt(n);if(""===c){r.push((s+i).trim());break}if(a)")"===c&&(a=!1);else{if(","===c){n+=1,r.push((s+i).trim());break}"("===c&&(a=!0)}i+=c,n+=1}}}return r.join(", ")}(e,o):"style"===n&&o?y(o,A()):"object"===t&&"data"===n&&o?S(e,o):o:S(e,o)}function k(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&k(e.parentNode,t,n);for(var o=e.classList.length;o--;){var r=e.classList[o];if(t.test(r))return!0}return!!n&&k(e.parentNode,t,n)}function M(e,t,n){var o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===o)return!1;if("string"==typeof t){if(o.classList.contains(t))return!0;if(o.closest(".".concat(t)))return!0}else if(k(o,t,!0))return!0;if(n){if(o.matches(n))return!0;if(o.closest(n))return!0}return!1}function T(e,t){var o=t.doc,r=t.mirror,i=t.blockClass,a=t.blockSelector,h=t.maskTextClass,g=t.maskTextSelector,m=t.inlineStylesheet,I=t.maskInputOptions,f=void 0===I?{}:I,C=t.maskTextFn,v=t.maskInputFn,S=t.dataURLOptions,k=void 0===S?{}:S,T=t.inlineImages,E=t.recordCanvas,R=t.keepIframeSrcFn,N=t.newlyAddedElement,O=void 0!==N&&N,x=function(e,t){if(!t.hasNode(e))return;var n=t.getId(e);return 1===n?void 0:n}(o,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:n.Document,childNodes:[],compatMode:e.compatMode}:{type:n.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:n.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:x};case e.ELEMENT_NODE:return function(e,t){for(var o=t.doc,r=t.blockClass,i=t.blockSelector,a=t.inlineStylesheet,h=t.maskInputOptions,g=void 0===h?{}:h,m=t.maskInputFn,I=t.dataURLOptions,f=void 0===I?{}:I,C=t.inlineImages,v=t.recordCanvas,S=t.keepIframeSrcFn,k=t.newlyAddedElement,M=void 0!==k&&k,T=t.rootId,E=function(e,t,n){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var o=e.classList.length;o--;){var r=e.classList[o];if(t.test(r))return!0}return!!n&&e.matches(n)}(e,r,i),R=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return p.test(t)?"div":t}(e),N={},O=e.attributes.length,x=0;x<O;x++){var F=e.attributes[x];N[F.name]=w(o,R,F.name,F.value)}if("link"===R&&a){var L=Array.from(o.styleSheets).find((function(t){return t.href===e.href})),D=null;L&&(D=s(L)),D&&(delete N.rel,delete N.href,N._cssText=y(D,L.href))}if("style"===R&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){(D=s(e.sheet))&&(N._cssText=y(D,A()))}if("input"===R||"textarea"===R||"select"===R){var U=e.value,B=e.checked;"radio"!==N.type&&"checkbox"!==N.type&&"submit"!==N.type&&"button"!==N.type&&U?N.value=c({type:N.type,tagName:R,value:U,maskInputOptions:g,maskInputFn:m}):B&&(N.checked=B)}"option"===R&&(e.selected&&!g.select?N.selected=!0:delete N.selected);if("canvas"===R&&v)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var n=0;n<e.width;n+=50)for(var o=0;o<e.height;o+=50){var r=t.getImageData,s=d in r?r[d]:r;if(new Uint32Array(s.call(t,n,o,Math.min(50,e.width-n),Math.min(50,e.height-o)).data.buffer).some((function(e){return 0!==e})))return!1}return!0})(e)||(N.rr_dataURL=e.toDataURL(f.type,f.quality));else if(!("__context"in e)){var W=e.toDataURL(f.type,f.quality),Z=document.createElement("canvas");Z.width=e.width,Z.height=e.height,W!==Z.toDataURL(f.type,f.quality)&&(N.rr_dataURL=W)}if("img"===R&&C){l||(l=o.createElement("canvas"),u=l.getContext("2d"));var V=e,K=V.crossOrigin;V.crossOrigin="anonymous";var G=function(){try{l.width=V.naturalWidth,l.height=V.naturalHeight,u.drawImage(V,0,0),N.rr_dataURL=l.toDataURL(f.type,f.quality)}catch(e){console.warn("Cannot inline img src=".concat(V.currentSrc,"! Error: ").concat(e))}K?N.crossOrigin=K:V.removeAttribute("crossorigin")};V.complete&&0!==V.naturalWidth?G():V.onload=G}"audio"!==R&&"video"!==R||(N.rr_mediaState=e.paused?"paused":"played",N.rr_mediaCurrentTime=e.currentTime);M||(e.scrollLeft&&(N.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(N.rr_scrollTop=e.scrollTop));if(E){var _=e.getBoundingClientRect(),z=_.width,P=_.height;N={class:N.class,rr_width:"".concat(z,"px"),rr_height:"".concat(P,"px")}}"iframe"!==R||S(N.src)||(e.contentDocument||(N.rr_src=N.src),delete N.src);return{type:n.Element,tagName:R,attributes:N,childNodes:[],isSVG:b(e)||void 0,needBlock:E,rootId:T}}(e,{doc:o,blockClass:i,blockSelector:a,inlineStylesheet:m,maskInputOptions:f,maskInputFn:v,dataURLOptions:k,inlineImages:T,recordCanvas:E,keepIframeSrcFn:R,newlyAddedElement:O,rootId:x});case e.TEXT_NODE:return function(e,t){var o,r=t.maskTextClass,s=t.maskTextSelector,i=t.maskTextFn,a=t.rootId,c=e.parentNode&&e.parentNode.tagName,d=e.textContent,l="STYLE"===c||void 0,u="SCRIPT"===c||void 0;if(l&&d){try{e.nextSibling||e.previousSibling||(null===(o=e.parentNode.sheet)||void 0===o?void 0:o.cssRules)&&(d=(h=e.parentNode.sheet).cssRules?Array.from(h.cssRules).map((function(e){return e.cssText||""})).join(""):"")}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}d=y(d,A())}var h;u&&(d="SCRIPT_PLACEHOLDER");!l&&!u&&d&&M(e,r,s)&&(d=i?i(d):d.replace(/[\S]/g,"*"));return{type:n.Text,textContent:d||"",isStyle:l,rootId:a}}(e,{maskTextClass:h,maskTextSelector:g,maskTextFn:C,rootId:x});case e.CDATA_SECTION_NODE:return{type:n.CDATA,textContent:"",rootId:x};case e.COMMENT_NODE:return{type:n.Comment,textContent:e.textContent||"",rootId:x};default:return!1}}function E(e){return void 0===e?"":e.toLowerCase()}function R(e,t){var s,i=t.doc,a=t.mirror,c=t.blockClass,d=t.blockSelector,l=t.maskTextClass,u=t.maskTextSelector,h=t.skipChild,p=void 0!==h&&h,m=t.inlineStylesheet,I=void 0===m||m,f=t.maskInputOptions,y=void 0===f?{}:f,C=t.maskTextFn,v=t.maskInputFn,S=t.slimDOMOptions,b=t.dataURLOptions,A=void 0===b?{}:b,w=t.inlineImages,k=void 0!==w&&w,M=t.recordCanvas,N=void 0!==M&&M,O=t.onSerialize,x=t.onIframeLoad,F=t.iframeLoadTimeout,L=void 0===F?5e3:F,D=t.onStylesheetLoad,U=t.stylesheetLoadTimeout,B=void 0===U?5e3:U,W=t.keepIframeSrcFn,Z=void 0===W?function(){return!1}:W,V=t.newlyAddedElement,K=void 0!==V&&V,G=t.preserveWhiteSpace,_=void 0===G||G,z=T(e,{doc:i,mirror:a,blockClass:c,blockSelector:d,maskTextClass:l,maskTextSelector:u,inlineStylesheet:I,maskInputOptions:y,maskTextFn:C,maskInputFn:v,dataURLOptions:A,inlineImages:k,recordCanvas:N,keepIframeSrcFn:Z,newlyAddedElement:K});if(!z)return console.warn(e,"not serialized"),null;s=a.hasNode(e)?a.getId(e):!function(e,t){if(t.comment&&e.type===n.Comment)return!0;if(e.type===n.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&"preload"===e.attributes.rel&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(E(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===E(e.attributes.name)||"icon"===E(e.attributes.rel)||"apple-touch-icon"===E(e.attributes.rel)||"shortcut icon"===E(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&E(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(E(e.attributes.property).match(/^(og|twitter|fb):/)||E(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===E(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===E(e.attributes.name)||"googlebot"===E(e.attributes.name)||"bingbot"===E(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===E(e.attributes.name)||"generator"===E(e.attributes.name)||"framework"===E(e.attributes.name)||"publisher"===E(e.attributes.name)||"progid"===E(e.attributes.name)||E(e.attributes.property).match(/^article:/)||E(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===E(e.attributes.name)||"yandex-verification"===E(e.attributes.name)||"csrf-token"===E(e.attributes.name)||"p:domain_verify"===E(e.attributes.name)||"verify-v1"===E(e.attributes.name)||"verification"===E(e.attributes.name)||"shopify-checkout-api-token"===E(e.attributes.name)))return!0}}return!1}(z,S)&&(_||z.type!==n.Text||z.isStyle||z.textContent.replace(/^\s+|\s+$/gm,"").length)?g():-2;var P=Object.assign(z,{id:s});if(a.add(e,P),-2===s)return null;O&&O(e);var J=!p;if(P.type===n.Element){J=J&&!P.needBlock,delete P.needBlock;var j=e.shadowRoot;j&&r(j)&&(P.isShadowHost=!0)}if((P.type===n.Document||P.type===n.Element)&&J){S.headWhitespace&&P.type===n.Element&&"head"===P.tagName&&(_=!1);for(var Y={doc:i,mirror:a,blockClass:c,blockSelector:d,maskTextClass:l,maskTextSelector:u,skipChild:p,inlineStylesheet:I,maskInputOptions:y,maskTextFn:C,maskInputFn:v,slimDOMOptions:S,dataURLOptions:A,inlineImages:k,recordCanvas:N,preserveWhiteSpace:_,onSerialize:O,onIframeLoad:x,iframeLoadTimeout:L,onStylesheetLoad:D,stylesheetLoadTimeout:B,keepIframeSrcFn:Z},H=0,Q=Array.from(e.childNodes);H<Q.length;H++){($=R(Q[H],Y))&&P.childNodes.push($)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(var q=0,X=Array.from(e.shadowRoot.childNodes);q<X.length;q++){var $;($=R(X[q],Y))&&(r(e.shadowRoot)&&($.isShadow=!0),P.childNodes.push($))}}return e.parentNode&&o(e.parentNode)&&r(e.parentNode)&&(P.isShadow=!0),P.type===n.Element&&"iframe"===P.tagName&&function(e,t,n){var o=e.contentWindow;if(o){var r,s=!1;try{r=o.document.readyState}catch(e){return}if("complete"===r){var i="about:blank";if(o.location.href!==i||e.src===i||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var a=setTimeout((function(){s||(t(),s=!0)}),n);e.addEventListener("load",(function(){clearTimeout(a),s=!0,t()}))}}}(e,(function(){var t=e.contentDocument;if(t&&x){var n=R(t,{doc:t,mirror:a,blockClass:c,blockSelector:d,maskTextClass:l,maskTextSelector:u,skipChild:!1,inlineStylesheet:I,maskInputOptions:y,maskTextFn:C,maskInputFn:v,slimDOMOptions:S,dataURLOptions:A,inlineImages:k,recordCanvas:N,preserveWhiteSpace:_,onSerialize:O,onIframeLoad:x,iframeLoadTimeout:L,onStylesheetLoad:D,stylesheetLoadTimeout:B,keepIframeSrcFn:Z});n&&x(e,n)}}),L),P.type===n.Element&&"link"===P.tagName&&"stylesheet"===P.attributes.rel&&function(e,t,n){var o,r=!1;try{o=e.sheet}catch(e){return}if(!o){var s=setTimeout((function(){r||(t(),r=!0)}),n);e.addEventListener("load",(function(){clearTimeout(s),r=!0,t()}))}}(e,(function(){if(D){var t=R(e,{doc:i,mirror:a,blockClass:c,blockSelector:d,maskTextClass:l,maskTextSelector:u,skipChild:!1,inlineStylesheet:I,maskInputOptions:y,maskTextFn:C,maskInputFn:v,slimDOMOptions:S,dataURLOptions:A,inlineImages:k,recordCanvas:N,preserveWhiteSpace:_,onSerialize:O,onIframeLoad:x,iframeLoadTimeout:L,onStylesheetLoad:D,stylesheetLoadTimeout:B,keepIframeSrcFn:Z});t&&D(e,t)}}),B),P}function N(e,t,n=document){const o={capture:!0,passive:!0};return n.addEventListener(e,t,o),()=>n.removeEventListener(e,t,o)}const O="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let x={map:{},getId:()=>(console.error(O),-1),getNode:()=>(console.error(O),null),removeNodeFromMap(){console.error(O)},has:()=>(console.error(O),!1),reset(){console.error(O)}};function F(e,t,n={}){let o=null,r=0;return function(...s){const i=Date.now();r||!1!==n.leading||(r=i);const a=t-(i-r),c=this;a<=0||a>t?(o&&(clearTimeout(o),o=null),r=i,e.apply(c,s)):o||!1===n.trailing||(o=setTimeout((()=>{r=!1===n.leading?0:Date.now(),o=null,e.apply(c,s)}),a))}}function L(e,t,n,o,r=window){const s=r.Object.getOwnPropertyDescriptor(e,t);return r.Object.defineProperty(e,t,o?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),s&&s.set&&s.set.call(this,e)}}),()=>L(e,t,s||{},!0)}function D(e,t,n){try{if(!(t in e))return()=>{};const o=e[t],r=n(o);return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:o}})),e[t]=r,()=>{e[t]=o}}catch(e){return()=>{}}}function U(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function B(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function W(e,t,n,o){if(!e)return!1;const r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!r)return!1;if("string"==typeof t){if(r.classList.contains(t))return!0;if(o&&null!==r.closest("."+t))return!0}else if(k(r,t,o))return!0;if(n){if(e.matches(n))return!0;if(o&&null!==r.closest(n))return!0}return!1}function Z(e,t){return-2===t.getId(e)}function V(e,t){if(o(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||V(e.parentNode,t))}function K(e){return Boolean(e.changedTouches)}function G(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function _(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function z(e){return Boolean(null==e?void 0:e.shadowRoot)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(x=new Proxy(x,{get:(e,t,n)=>("map"===t&&console.error(O),Reflect.get(e,t,n))}));class P{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var J=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(J||{}),j=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(j||{}),Y=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Y||{}),H=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(H||{});function Q(e){return"__ln"in e}class q{constructor(){this.length=0,this.head=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Q(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&Q(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next&&(t.next.previous=t.previous)):(this.head=t.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)}}const X=(e,t)=>`${e}@${t}`;class ${constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new q,n=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},r=r=>{var s,i,a,c;let d=null;(null===(i=null===(s=r.getRootNode)||void 0===s?void 0:s.call(r))||void 0===i?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&r.getRootNode().host&&(d=r.getRootNode().host);let l=d;for(;(null===(c=null===(a=null==l?void 0:l.getRootNode)||void 0===a?void 0:a.call(l))||void 0===c?void 0:c.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&l.getRootNode().host;)l=l.getRootNode().host;const u=!(this.doc.contains(r)||l&&this.doc.contains(l));if(!r.parentNode||u)return;const h=o(r.parentNode)?this.mirror.getId(d):this.mirror.getId(r.parentNode),p=n(r);if(-1===h||-1===p)return t.addNode(r);const g=R(r,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{G(e,this.mirror)&&this.iframeManager.addIframe(e),_(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),z(r)&&this.shadowDomManager.addShadowRoot(r.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});g&&e.push({parentId:h,nextId:p,node:g})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of Array.from(this.movedSet.values()))te(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||r(e);for(const e of Array.from(this.addedSet.values()))oe(this.droppedSet,e)||te(this.removes,e,this.mirror)?oe(this.movedSet,e)?r(e):this.droppedSet.add(e):r(e);let s=null;for(;t.length;){let e=null;if(s){const t=this.mirror.getId(s.value.parentNode),o=n(s.value);-1!==t&&-1!==o&&(e=s)}if(!e)for(let o=t.length-1;o>=0;o--){const r=t.get(o);if(r){const t=this.mirror.getId(r.value.parentNode);if(-1===n(r.value))continue;if(-1!==t){e=r;break}{const t=r.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=t.parentNode.host;if(-1!==this.mirror.getId(n)){e=r;break}}}}}if(!e){for(;t.head;)t.removeNode(t.head.value);break}s=e.previous,t.removeNode(e.value),r(e.value)}const i={texts:this.texts.map((e=>({id:this.mirror.getId(e.node),value:e.value}))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>({id:this.mirror.getId(e.node),attributes:e.attributes}))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(i.texts.length||i.attributes.length||i.removes.length||i.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(i))},this.processMutation=e=>{if(!Z(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;W(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:M(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.target.getAttribute(e.attributeName);if("value"===e.attributeName&&(n=c({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),W(e.target,this.blockClass,this.blockSelector,!1)||n===e.oldValue)return;let o=this.attributes.find((t=>t.node===e.target));if("IFRAME"===t.tagName&&"src"===e.attributeName&&!this.keepIframeSrcFn(n)){if(t.contentDocument)return;e.attributeName="rr_src"}if(o||(o={node:e.target,attributes:{}},this.attributes.push(o)),"style"===e.attributeName){const n=this.doc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue),void 0!==o.attributes.style&&null!==o.attributes.style||(o.attributes.style={});const r=o.attributes.style;for(const e of Array.from(t.style)){const o=t.style.getPropertyValue(e),s=t.style.getPropertyPriority(e);o===n.style.getPropertyValue(e)&&s===n.style.getPropertyPriority(e)||(r[e]=""===s?o:[o,s])}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(r[e]=!1)}else o.attributes[e.attributeName]=w(this.doc,t.tagName,e.attributeName,n);break}case"childList":if(W(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),s=o(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);W(e.target,this.blockClass,this.blockSelector,!1)||Z(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(ee(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||V(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[X(n,s)]?ee(this.movedSet,t):this.removes.push({parentId:s,id:n,isShadow:!(!o(e.target)||!r(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(this.mirror.hasNode(e)){if(Z(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[X(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);W(e,this.blockClass,this.blockSelector,!1)||e.childNodes.forEach((e=>this.genAdds(e)))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function ee(e,t){e.delete(t),t.childNodes.forEach((t=>ee(e,t)))}function te(e,t,n){return 0!==e.length&&ne(e,t,n)}function ne(e,t,n){const{parentNode:o}=t;if(!o)return!1;const r=n.getId(o);return!!e.some((e=>e.id===r))||ne(e,o,n)}function oe(e,t){return 0!==e.size&&re(e,t)}function re(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||re(e,n))}const se=[],ie="undefined"!=typeof CSSGroupingRule,ae="undefined"!=typeof CSSMediaRule,ce="undefined"!=typeof CSSSupportsRule,de="undefined"!=typeof CSSConditionRule;function le(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch(t){return e.target}}function ue(e,t){var n,o;const r=new $;se.push(r),r.init(e);let s=window.MutationObserver||window.__rrMutationObserver;const i=null===(o=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===o?void 0:o.call(n,"MutationObserver");i&&window[i]&&(s=window[i]);const a=new s(r.processMutations.bind(r));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function he({mouseInteractionCb:e,doc:t,mirror:n,blockClass:o,blockSelector:r,sampling:s}){if(!1===s.mouseInteraction)return()=>{};const i=!0===s.mouseInteraction||void 0===s.mouseInteraction?{}:s.mouseInteraction,a=[];return Object.keys(Y).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==i[e])).forEach((s=>{const i=s.toLowerCase(),c=(t=>s=>{const i=le(s);if(W(i,o,r,!0))return;const a=K(s)?s.changedTouches[0]:s;if(!a)return;const c=n.getId(i),{clientX:d,clientY:l}=a;e({type:Y[t],id:c,x:d,y:l})})(s);a.push(N(i,c,t))})),()=>{a.forEach((e=>e()))}}function pe({scrollCb:e,doc:t,mirror:n,blockClass:o,blockSelector:r,sampling:s}){return N("scroll",F((s=>{const i=le(s);if(!i||W(i,o,r,!0))return;const a=n.getId(i);if(i===t){const n=t.scrollingElement||t.documentElement;e({id:a,x:n.scrollLeft,y:n.scrollTop})}else e({id:a,x:i.scrollLeft,y:i.scrollTop})}),s.scroll||100),t)}function ge(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const me=["INPUT","TEXTAREA","SELECT"],Ie=new WeakMap;function fe(e){return function(e,t){if(ie&&e.parentRule instanceof CSSGroupingRule||ae&&e.parentRule instanceof CSSMediaRule||ce&&e.parentRule instanceof CSSSupportsRule||de&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function ye(e,t,n){let o,r;return e?(e.ownerNode?o=t.getId(e.ownerNode):r=n.getId(e),{styleId:r,id:o}):{}}function Ce({mirror:e,stylesheetManager:t},n){var o,r,s;let i=null;i="#document"===n.nodeName?e.getId(n):e.getId(n.host);const a="#document"===n.nodeName?null===(o=n.defaultView)||void 0===o?void 0:o.Document:null===(s=null===(r=n.ownerDocument)||void 0===r?void 0:r.defaultView)||void 0===s?void 0:s.ShadowRoot,c=Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets");return null!==i&&-1!==i&&a&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var n;const o=null===(n=c.set)||void 0===n?void 0:n.call(this,e);if(null!==i&&-1!==i)try{t.adoptStyleSheets(e,i)}catch(e){}return o}}),()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}):()=>{}}function ve(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};!function(e,t){const{mutationCb:n,mousemoveCb:o,mouseInteractionCb:r,scrollCb:s,viewportResizeCb:i,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:d,styleDeclarationCb:l,canvasMutationCb:u,fontCb:h,selectionCb:p}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),o(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),r(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),s(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),i(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),d(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),l(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),u(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)}}(e,t);const o=ue(e,e.doc),r=function({mousemoveCb:e,sampling:t,doc:n,mirror:o}){if(!1===t.mousemove)return()=>{};const r="number"==typeof t.mousemove?t.mousemove:50,s="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let i,a=[];const c=F((t=>{const n=Date.now()-i;e(a.map((e=>(e.timeOffset-=n,e))),t),a=[],i=null}),s),d=F((e=>{const t=le(e),{clientX:n,clientY:r}=K(e)?e.changedTouches[0]:e;i||(i=Date.now()),a.push({x:n,y:r,id:o.getId(t),timeOffset:Date.now()-i}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?j.Drag:e instanceof MouseEvent?j.MouseMove:j.TouchMove)}),r,{trailing:!1}),l=[N("mousemove",d,n),N("touchmove",d,n),N("drag",d,n)];return()=>{l.forEach((e=>e()))}}(e),s=he(e),i=pe(e),a=function({viewportResizeCb:e}){let t=-1,n=-1;return N("resize",F((()=>{const o=U(),r=B();t===o&&n===r||(e({width:Number(r),height:Number(o)}),t=o,n=r)}),200),window)}(e),d=function({inputCb:e,doc:t,mirror:n,blockClass:o,blockSelector:r,ignoreClass:s,maskInputOptions:i,maskInputFn:a,sampling:d,userTriggeredOnInput:l}){function u(e){let n=le(e);const d=e.isTrusted;if(n&&"OPTION"===n.tagName&&(n=n.parentElement),!n||!n.tagName||me.indexOf(n.tagName)<0||W(n,o,r,!0))return;const u=n.type;if(n.classList.contains(s))return;let p=n.value,g=!1;"radio"===u||"checkbox"===u?g=n.checked:(i[n.tagName.toLowerCase()]||i[u])&&(p=c({maskInputOptions:i,tagName:n.tagName,type:u,value:p,maskInputFn:a})),h(n,ge({text:p,isChecked:g,userTriggered:d},l));const m=n.name;"radio"===u&&m&&g&&t.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach((e=>{e!==n&&h(e,ge({text:e.value,isChecked:!g,userTriggered:!1},l))}))}function h(t,o){const r=Ie.get(t);if(!r||r.text!==o.text||r.isChecked!==o.isChecked){Ie.set(t,o);const r=n.getId(t);e(Object.assign(Object.assign({},o),{id:r}))}}const p=("last"===d.input?["change"]:["input","change"]).map((e=>N(e,u,t))),g=t.defaultView;if(!g)return()=>{p.forEach((e=>e()))};const m=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),I=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&p.push(...I.map((e=>L(e[0],e[1],{set(){u({target:this})}},!1,g)))),()=>{p.forEach((e=>e()))}}(e),l=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:o,sampling:r}){const s=s=>F((r=>{const i=le(r);if(!i||W(i,t,n,!0))return;const{currentTime:a,volume:c,muted:d,playbackRate:l}=i;e({type:s,id:o.getId(i),currentTime:a,volume:c,muted:d,playbackRate:l})}),r.media||500),i=[N("play",s(0)),N("pause",s(1)),N("seeked",s(2)),N("volumechange",s(3)),N("ratechange",s(4))];return()=>{i.forEach((e=>e()))}}(e),u=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:o}){const r=o.CSSStyleSheet.prototype.insertRule;o.CSSStyleSheet.prototype.insertRule=function(o,s){const{id:i,styleId:a}=ye(this,t,n.styleMirror);return(i&&-1!==i||a&&-1!==a)&&e({id:i,styleId:a,adds:[{rule:o,index:s}]}),r.apply(this,[o,s])};const s=o.CSSStyleSheet.prototype.deleteRule;let i,a;o.CSSStyleSheet.prototype.deleteRule=function(o){const{id:r,styleId:i}=ye(this,t,n.styleMirror);return(r&&-1!==r||i&&-1!==i)&&e({id:r,styleId:i,removes:[{index:o}]}),s.apply(this,[o])},o.CSSStyleSheet.prototype.replace&&(i=o.CSSStyleSheet.prototype.replace,o.CSSStyleSheet.prototype.replace=function(o){const{id:r,styleId:s}=ye(this,t,n.styleMirror);return(r&&-1!==r||s&&-1!==s)&&e({id:r,styleId:s,replace:o}),i.apply(this,[o])}),o.CSSStyleSheet.prototype.replaceSync&&(a=o.CSSStyleSheet.prototype.replaceSync,o.CSSStyleSheet.prototype.replaceSync=function(o){const{id:r,styleId:s}=ye(this,t,n.styleMirror);return(r&&-1!==r||s&&-1!==s)&&e({id:r,styleId:s,replaceSync:o}),a.apply(this,[o])});const c={};ie?c.CSSGroupingRule=o.CSSGroupingRule:(ae&&(c.CSSMediaRule=o.CSSMediaRule),de&&(c.CSSConditionRule=o.CSSConditionRule),ce&&(c.CSSSupportsRule=o.CSSSupportsRule));const d={};return Object.entries(c).forEach((([o,r])=>{d[o]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=function(r,s){const{id:i,styleId:a}=ye(this.parentStyleSheet,t,n.styleMirror);return(i&&-1!==i||a&&-1!==a)&&e({id:i,styleId:a,adds:[{rule:r,index:[...fe(this),s||0]}]}),d[o].insertRule.apply(this,[r,s])},r.prototype.deleteRule=function(r){const{id:s,styleId:i}=ye(this.parentStyleSheet,t,n.styleMirror);return(s&&-1!==s||i&&-1!==i)&&e({id:s,styleId:i,removes:[{index:[...fe(this),r]}]}),d[o].deleteRule.apply(this,[r])}})),()=>{o.CSSStyleSheet.prototype.insertRule=r,o.CSSStyleSheet.prototype.deleteRule=s,i&&(o.CSSStyleSheet.prototype.replace=i),a&&(o.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach((([e,t])=>{t.prototype.insertRule=d[e].insertRule,t.prototype.deleteRule=d[e].deleteRule}))}}(e,{win:n}),h=Ce(e,e.doc),p=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:o},{win:r}){const s=r.CSSStyleDeclaration.prototype.setProperty;r.CSSStyleDeclaration.prototype.setProperty=function(r,i,a){var c;if(n.has(r))return s.apply(this,[r,i,a]);const{id:d,styleId:l}=ye(null===(c=this.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,o.styleMirror);return(d&&-1!==d||l&&-1!==l)&&e({id:d,styleId:l,set:{property:r,value:i,priority:a},index:fe(this.parentRule)}),s.apply(this,[r,i,a])};const i=r.CSSStyleDeclaration.prototype.removeProperty;return r.CSSStyleDeclaration.prototype.removeProperty=function(r){var s;if(n.has(r))return i.apply(this,[r]);const{id:a,styleId:c}=ye(null===(s=this.parentRule)||void 0===s?void 0:s.parentStyleSheet,t,o.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,remove:{property:r},index:fe(this.parentRule)}),i.apply(this,[r])},()=>{r.CSSStyleDeclaration.prototype.setProperty=s,r.CSSStyleDeclaration.prototype.removeProperty=i}}(e,{win:n}),g=e.collectFonts?function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const o=[],r=new WeakMap,s=n.FontFace;n.FontFace=function(e,t,n){const o=new s(e,t,n);return r.set(o,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),o};const i=D(t.fonts,"add",(function(t){return function(n){return setTimeout((()=>{const t=r.get(n);t&&(e(t),r.delete(n))}),0),t.apply(this,[n])}}));return o.push((()=>{n.FontFace=s})),o.push(i),()=>{o.forEach((e=>e()))}}(e):()=>{},m=function(e){const{doc:t,mirror:n,blockClass:o,blockSelector:r,selectionCb:s}=e;let i=!0;const a=()=>{const e=t.getSelection();if(!e||i&&(null==e?void 0:e.isCollapsed))return;i=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const s=e.getRangeAt(t),{startContainer:i,startOffset:c,endContainer:d,endOffset:l}=s;W(i,o,r,!0)||W(d,o,r,!0)||a.push({start:n.getId(i),startOffset:c,end:n.getId(d),endOffset:l})}s({ranges:a})};return a(),N("selectionchange",a)}(e),I=[];for(const t of e.plugins)I.push(t.observer(t.callback,n,t.options));return()=>{se.forEach((e=>e.reset())),o.disconnect(),r(),s(),i(),a(),d(),l(),u(),h(),p(),g(),m(),I.forEach((e=>e()))}}class Se{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,o){const r=n||this.getIdToRemoteIdMap(e),s=o||this.getRemoteIdToIdMap(e);let i=r.get(t);return i||(i=this.generateIdFn(),r.set(t,i),s.set(i,t)),i}getIds(e,t){const n=this.getIdToRemoteIdMap(e),o=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,o)))}getRemoteId(e,t,n){const o=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const r=o.get(t);return r||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class be{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Se(g),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Se(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){if("rrweb"===e.data.type){if(!e.source)return;const t=this.crossOriginIframeMap.get(e.source);if(!t)return;const n=this.transformCrossOriginEvent(t,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}}transformCrossOriginEvent(e,t){var n;switch(t.type){case J.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e),{timestamp:t.timestamp,type:J.IncrementalSnapshot,data:{source:j.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case J.Meta:case J.Load:case J.DomContentLoaded:return!1;case J.Plugin:return t;case J.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case J.IncrementalSnapshot:switch(t.data.source){case j.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case j.Drag:case j.TouchMove:case j.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case j.ViewportResize:return!1;case j.MediaInteraction:case j.MouseInteraction:case j.Scroll:case j.CanvasMutation:case j.Input:return this.replaceIds(t.data,e,["id"]),t;case j.StyleSheetRule:case j.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case j.Font:return t;case j.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case j.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}}replace(e,t,n,o){for(const r of o)(Array.isArray(t[r])||"number"==typeof t[r])&&(Array.isArray(t[r])?t[r]=e.getIds(n,t[r]):t[r]=e.getId(n,t[r]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}}class Ae{constructor(e){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;const t=this;this.restorePatches.push(D(Element.prototype,"attachShadow",(function(e){return function(n){const o=e.call(this,n);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,this.ownerDocument),o}})))}addShadowRoot(e,t){r(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),ue(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),pe(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),Ce({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)}),0)))}observeAttachShadow(e){if(e.contentWindow){const t=this;this.restorePatches.push(D(e.contentWindow.HTMLElement.prototype,"attachShadow",(function(n){return function(o){const r=n.call(this,o);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,e.contentDocument),r}})))}}reset(){this.restorePatches.forEach((e=>e())),this.shadowDoms=new WeakSet}}
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).HumanBehaviorTracker={})}(this,function(e){"use strict";function t(e,t,n,o){return new(n||(n=Promise))(function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((o=o.apply(e,t||[])).next())})}var n;function o(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function i(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function r(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t).map(s).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n):null}catch(e){return null}var n}function s(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=r(e.styleSheet)||t}catch(e){}return t}"function"==typeof SuppressedError&&SuppressedError,function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(n||(n={}));var a=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(function(e){return t.removeNodeFromMap(e)})},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var n=this.getNode(e);if(n){var o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(t,o)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function c(e){var t=e.maskInputOptions,n=e.tagName,o=e.type,i=e.value,r=e.maskInputFn,s=i||"";return(t[n.toLowerCase()]||t[o])&&(s=r?r(s):"*".repeat(s.length)),s}var l="__rrweb_original__";var d,u,h=1,g=new RegExp("[^a-z0-9-_:]");function p(){return h++}var m=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,f=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,I=/^(data:)([^,]*),(.*)/i;function y(e,t){return(e||"").replace(m,function(e,n,o,i,r,s){var a,c=o||r||s,l=n||i||"";if(!c)return e;if(!f.test(c))return"url(".concat(l).concat(c).concat(l,")");if(I.test(c))return"url(".concat(l).concat(c).concat(l,")");if("/"===c[0])return"url(".concat(l).concat((a=t,(a.indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+c)).concat(l,")");var d=t.split("/"),u=c.split("/");d.pop();for(var h=0,g=u;h<g.length;h++){var p=g[h];"."!==p&&(".."===p?d.pop():d.push(p))}return"url(".concat(l).concat(d.join("/")).concat(l,")")})}var C=/^[^ \t\n\r\u000c]+/,v=/^[, \t\n\r\u000c]+/;function b(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function S(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function w(){var e=document.createElement("a");return e.href="",e.href}function A(e,t,n,o){return"src"===n||"href"===n&&o&&("use"!==t||"#"!==o[0])||"xlink:href"===n&&o&&"#"!==o[0]?b(e,o):"background"!==n||!o||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n&&o?function(e,t){if(""===t.trim())return t;var n=0;function o(e){var o,i=e.exec(t.substring(n));return i?(o=i[0],n+=o.length,o):""}for(var i=[];o(v),!(n>=t.length);){var r=o(C);if(","===r.slice(-1))r=b(e,r.substring(0,r.length-1)),i.push(r);else{var s="";r=b(e,r);for(var a=!1;;){var c=t.charAt(n);if(""===c){i.push((r+s).trim());break}if(a)")"===c&&(a=!1);else{if(","===c){n+=1,i.push((r+s).trim());break}"("===c&&(a=!0)}s+=c,n+=1}}}return i.join(", ")}(e,o):"style"===n&&o?y(o,w()):"object"===t&&"data"===n&&o?b(e,o):o:b(e,o)}function k(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&k(e.parentNode,t,n);for(var o=e.classList.length;o--;){var i=e.classList[o];if(t.test(i))return!0}return!!n&&k(e.parentNode,t,n)}function E(e,t,n){var o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===o)return!1;if("string"==typeof t){if(o.classList.contains(t))return!0;if(o.closest(".".concat(t)))return!0}else if(k(o,t,!0))return!0;if(n){if(o.matches(n))return!0;if(o.closest(n))return!0}return!1}function T(e,t){var o=t.doc,i=t.mirror,s=t.blockClass,a=t.blockSelector,h=t.maskTextClass,p=t.maskTextSelector,m=t.inlineStylesheet,f=t.maskInputOptions,I=void 0===f?{}:f,C=t.maskTextFn,v=t.maskInputFn,b=t.dataURLOptions,k=void 0===b?{}:b,T=t.inlineImages,R=t.recordCanvas,M=t.keepIframeSrcFn,N=t.newlyAddedElement,O=void 0!==N&&N,F=function(e,t){if(!t.hasNode(e))return;var n=t.getId(e);return 1===n?void 0:n}(o,i);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:n.Document,childNodes:[],compatMode:e.compatMode}:{type:n.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:n.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:F};case e.ELEMENT_NODE:return function(e,t){for(var o=t.doc,i=t.blockClass,s=t.blockSelector,a=t.inlineStylesheet,h=t.maskInputOptions,p=void 0===h?{}:h,m=t.maskInputFn,f=t.dataURLOptions,I=void 0===f?{}:f,C=t.inlineImages,v=t.recordCanvas,b=t.keepIframeSrcFn,k=t.newlyAddedElement,E=void 0!==k&&k,T=t.rootId,R=function(e,t,n){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var o=e.classList.length;o--;){var i=e.classList[o];if(t.test(i))return!0}return!!n&&e.matches(n)}(e,i,s),M=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return g.test(t)?"div":t}(e),N={},O=e.attributes.length,F=0;F<O;F++){var x=e.attributes[F];N[x.name]=A(o,M,x.name,x.value)}if("link"===M&&a){var L=Array.from(o.styleSheets).find(function(t){return t.href===e.href}),D=null;L&&(D=r(L)),D&&(delete N.rel,delete N.href,N._cssText=y(D,L.href))}if("style"===M&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){(D=r(e.sheet))&&(N._cssText=y(D,w()))}if("input"===M||"textarea"===M||"select"===M){var U=e.value,B=e.checked;"radio"!==N.type&&"checkbox"!==N.type&&"submit"!==N.type&&"button"!==N.type&&U?N.value=c({type:N.type,tagName:M,value:U,maskInputOptions:p,maskInputFn:m}):B&&(N.checked=B)}"option"===M&&(e.selected&&!p.select?N.selected=!0:delete N.selected);if("canvas"===M&&v)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var n=0;n<e.width;n+=50)for(var o=0;o<e.height;o+=50){var i=t.getImageData,r=l in i?i[l]:i;if(new Uint32Array(r.call(t,n,o,Math.min(50,e.width-n),Math.min(50,e.height-o)).data.buffer).some(function(e){return 0!==e}))return!1}return!0})(e)||(N.rr_dataURL=e.toDataURL(I.type,I.quality));else if(!("__context"in e)){var W=e.toDataURL(I.type,I.quality),G=document.createElement("canvas");G.width=e.width,G.height=e.height,W!==G.toDataURL(I.type,I.quality)&&(N.rr_dataURL=W)}if("img"===M&&C){d||(d=o.createElement("canvas"),u=d.getContext("2d"));var Z=e,V=Z.crossOrigin;Z.crossOrigin="anonymous";var _=function(){try{d.width=Z.naturalWidth,d.height=Z.naturalHeight,u.drawImage(Z,0,0),N.rr_dataURL=d.toDataURL(I.type,I.quality)}catch(e){console.warn("Cannot inline img src=".concat(Z.currentSrc,"! Error: ").concat(e))}V?N.crossOrigin=V:Z.removeAttribute("crossorigin")};Z.complete&&0!==Z.naturalWidth?_():Z.onload=_}"audio"!==M&&"video"!==M||(N.rr_mediaState=e.paused?"paused":"played",N.rr_mediaCurrentTime=e.currentTime);E||(e.scrollLeft&&(N.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(N.rr_scrollTop=e.scrollTop));if(R){var K=e.getBoundingClientRect(),z=K.width,j=K.height;N={class:N.class,rr_width:"".concat(z,"px"),rr_height:"".concat(j,"px")}}"iframe"!==M||b(N.src)||(e.contentDocument||(N.rr_src=N.src),delete N.src);return{type:n.Element,tagName:M,attributes:N,childNodes:[],isSVG:S(e)||void 0,needBlock:R,rootId:T}}(e,{doc:o,blockClass:s,blockSelector:a,inlineStylesheet:m,maskInputOptions:I,maskInputFn:v,dataURLOptions:k,inlineImages:T,recordCanvas:R,keepIframeSrcFn:M,newlyAddedElement:O,rootId:F});case e.TEXT_NODE:return function(e,t){var o,i=t.maskTextClass,r=t.maskTextSelector,s=t.maskTextFn,a=t.rootId,c=e.parentNode&&e.parentNode.tagName,l=e.textContent,d="STYLE"===c||void 0,u="SCRIPT"===c||void 0;if(d&&l){try{e.nextSibling||e.previousSibling||(null===(o=e.parentNode.sheet)||void 0===o?void 0:o.cssRules)&&(l=(h=e.parentNode.sheet).cssRules?Array.from(h.cssRules).map(function(e){return e.cssText||""}).join(""):"")}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}l=y(l,w())}var h;u&&(l="SCRIPT_PLACEHOLDER");!d&&!u&&l&&E(e,i,r)&&(l=s?s(l):l.replace(/[\S]/g,"*"));return{type:n.Text,textContent:l||"",isStyle:d,rootId:a}}(e,{maskTextClass:h,maskTextSelector:p,maskTextFn:C,rootId:F});case e.CDATA_SECTION_NODE:return{type:n.CDATA,textContent:"",rootId:F};case e.COMMENT_NODE:return{type:n.Comment,textContent:e.textContent||"",rootId:F};default:return!1}}function R(e){return void 0===e?"":e.toLowerCase()}function M(e,t){var r,s=t.doc,a=t.mirror,c=t.blockClass,l=t.blockSelector,d=t.maskTextClass,u=t.maskTextSelector,h=t.skipChild,g=void 0!==h&&h,m=t.inlineStylesheet,f=void 0===m||m,I=t.maskInputOptions,y=void 0===I?{}:I,C=t.maskTextFn,v=t.maskInputFn,b=t.slimDOMOptions,S=t.dataURLOptions,w=void 0===S?{}:S,A=t.inlineImages,k=void 0!==A&&A,E=t.recordCanvas,N=void 0!==E&&E,O=t.onSerialize,F=t.onIframeLoad,x=t.iframeLoadTimeout,L=void 0===x?5e3:x,D=t.onStylesheetLoad,U=t.stylesheetLoadTimeout,B=void 0===U?5e3:U,W=t.keepIframeSrcFn,G=void 0===W?function(){return!1}:W,Z=t.newlyAddedElement,V=void 0!==Z&&Z,_=t.preserveWhiteSpace,K=void 0===_||_,z=T(e,{doc:s,mirror:a,blockClass:c,blockSelector:l,maskTextClass:d,maskTextSelector:u,inlineStylesheet:f,maskInputOptions:y,maskTextFn:C,maskInputFn:v,dataURLOptions:w,inlineImages:k,recordCanvas:N,keepIframeSrcFn:G,newlyAddedElement:V});if(!z)return console.warn(e,"not serialized"),null;r=a.hasNode(e)?a.getId(e):!function(e,t){if(t.comment&&e.type===n.Comment)return!0;if(e.type===n.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&"preload"===e.attributes.rel&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(R(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===R(e.attributes.name)||"icon"===R(e.attributes.rel)||"apple-touch-icon"===R(e.attributes.rel)||"shortcut icon"===R(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&R(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(R(e.attributes.property).match(/^(og|twitter|fb):/)||R(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===R(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===R(e.attributes.name)||"googlebot"===R(e.attributes.name)||"bingbot"===R(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===R(e.attributes.name)||"generator"===R(e.attributes.name)||"framework"===R(e.attributes.name)||"publisher"===R(e.attributes.name)||"progid"===R(e.attributes.name)||R(e.attributes.property).match(/^article:/)||R(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===R(e.attributes.name)||"yandex-verification"===R(e.attributes.name)||"csrf-token"===R(e.attributes.name)||"p:domain_verify"===R(e.attributes.name)||"verify-v1"===R(e.attributes.name)||"verification"===R(e.attributes.name)||"shopify-checkout-api-token"===R(e.attributes.name)))return!0}}return!1}(z,b)&&(K||z.type!==n.Text||z.isStyle||z.textContent.replace(/^\s+|\s+$/gm,"").length)?p():-2;var j=Object.assign(z,{id:r});if(a.add(e,j),-2===r)return null;O&&O(e);var P=!g;if(j.type===n.Element){P=P&&!j.needBlock,delete j.needBlock;var J=e.shadowRoot;J&&i(J)&&(j.isShadowHost=!0)}if((j.type===n.Document||j.type===n.Element)&&P){b.headWhitespace&&j.type===n.Element&&"head"===j.tagName&&(K=!1);for(var Y={doc:s,mirror:a,blockClass:c,blockSelector:l,maskTextClass:d,maskTextSelector:u,skipChild:g,inlineStylesheet:f,maskInputOptions:y,maskTextFn:C,maskInputFn:v,slimDOMOptions:b,dataURLOptions:w,inlineImages:k,recordCanvas:N,preserveWhiteSpace:K,onSerialize:O,onIframeLoad:F,iframeLoadTimeout:L,onStylesheetLoad:D,stylesheetLoadTimeout:B,keepIframeSrcFn:G},H=0,Q=Array.from(e.childNodes);H<Q.length;H++){($=M(Q[H],Y))&&j.childNodes.push($)}if(function(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(var q=0,X=Array.from(e.shadowRoot.childNodes);q<X.length;q++){var $;($=M(X[q],Y))&&(i(e.shadowRoot)&&($.isShadow=!0),j.childNodes.push($))}}return e.parentNode&&o(e.parentNode)&&i(e.parentNode)&&(j.isShadow=!0),j.type===n.Element&&"iframe"===j.tagName&&function(e,t,n){var o=e.contentWindow;if(o){var i,r=!1;try{i=o.document.readyState}catch(e){return}if("complete"===i){var s="about:blank";if(o.location.href!==s||e.src===s||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var a=setTimeout(function(){r||(t(),r=!0)},n);e.addEventListener("load",function(){clearTimeout(a),r=!0,t()})}}}(e,function(){var t=e.contentDocument;if(t&&F){var n=M(t,{doc:t,mirror:a,blockClass:c,blockSelector:l,maskTextClass:d,maskTextSelector:u,skipChild:!1,inlineStylesheet:f,maskInputOptions:y,maskTextFn:C,maskInputFn:v,slimDOMOptions:b,dataURLOptions:w,inlineImages:k,recordCanvas:N,preserveWhiteSpace:K,onSerialize:O,onIframeLoad:F,iframeLoadTimeout:L,onStylesheetLoad:D,stylesheetLoadTimeout:B,keepIframeSrcFn:G});n&&F(e,n)}},L),j.type===n.Element&&"link"===j.tagName&&"stylesheet"===j.attributes.rel&&function(e,t,n){var o,i=!1;try{o=e.sheet}catch(e){return}if(!o){var r=setTimeout(function(){i||(t(),i=!0)},n);e.addEventListener("load",function(){clearTimeout(r),i=!0,t()})}}(e,function(){if(D){var t=M(e,{doc:s,mirror:a,blockClass:c,blockSelector:l,maskTextClass:d,maskTextSelector:u,skipChild:!1,inlineStylesheet:f,maskInputOptions:y,maskTextFn:C,maskInputFn:v,slimDOMOptions:b,dataURLOptions:w,inlineImages:k,recordCanvas:N,preserveWhiteSpace:K,onSerialize:O,onIframeLoad:F,iframeLoadTimeout:L,onStylesheetLoad:D,stylesheetLoadTimeout:B,keepIframeSrcFn:G});t&&D(e,t)}},B),j}function N(e,t,n=document){const o={capture:!0,passive:!0};return n.addEventListener(e,t,o),()=>n.removeEventListener(e,t,o)}const O="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let F={map:{},getId:()=>(console.error(O),-1),getNode:()=>(console.error(O),null),removeNodeFromMap(){console.error(O)},has:()=>(console.error(O),!1),reset(){console.error(O)}};function x(e,t,n={}){let o=null,i=0;return function(...r){const s=Date.now();i||!1!==n.leading||(i=s);const a=t-(s-i),c=this;a<=0||a>t?(o&&(clearTimeout(o),o=null),i=s,e.apply(c,r)):o||!1===n.trailing||(o=setTimeout(()=>{i=!1===n.leading?0:Date.now(),o=null,e.apply(c,r)},a))}}function L(e,t,n,o,i=window){const r=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,o?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),r&&r.set&&r.set.call(this,e)}}),()=>L(e,t,r||{},!0)}function D(e,t,n){try{if(!(t in e))return()=>{};const o=e[t],i=n(o);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:o}})),e[t]=i,()=>{e[t]=o}}catch(e){return()=>{}}}function U(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function B(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function W(e,t,n,o){if(!e)return!1;const i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!i)return!1;if("string"==typeof t){if(i.classList.contains(t))return!0;if(o&&null!==i.closest("."+t))return!0}else if(k(i,t,o))return!0;if(n){if(e.matches(n))return!0;if(o&&null!==i.closest(n))return!0}return!1}function G(e,t){return-2===t.getId(e)}function Z(e,t){if(o(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||Z(e.parentNode,t))}function V(e){return Boolean(e.changedTouches)}function _(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function K(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function z(e){return Boolean(null==e?void 0:e.shadowRoot)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(F=new Proxy(F,{get:(e,t,n)=>("map"===t&&console.error(O),Reflect.get(e,t,n))}));class j{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var P=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(P||{}),J=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(J||{}),Y=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Y||{}),H=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(H||{});function Q(e){return"__ln"in e}class q{constructor(){this.length=0,this.head=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Q(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&Q(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next&&(t.next.previous=t.previous)):(this.head=t.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)}}const X=(e,t)=>`${e}@${t}`;class ${constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new q,n=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},i=i=>{var r,s,a,c;let l=null;(null===(s=null===(r=i.getRootNode)||void 0===r?void 0:r.call(i))||void 0===s?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&i.getRootNode().host&&(l=i.getRootNode().host);let d=l;for(;(null===(c=null===(a=null==d?void 0:d.getRootNode)||void 0===a?void 0:a.call(d))||void 0===c?void 0:c.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&d.getRootNode().host;)d=d.getRootNode().host;const u=!(this.doc.contains(i)||d&&this.doc.contains(d));if(!i.parentNode||u)return;const h=o(i.parentNode)?this.mirror.getId(l):this.mirror.getId(i.parentNode),g=n(i);if(-1===h||-1===g)return t.addNode(i);const p=M(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{_(e,this.mirror)&&this.iframeManager.addIframe(e),K(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),z(i)&&this.shadowDomManager.addShadowRoot(i.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});p&&e.push({parentId:h,nextId:g,node:p})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of Array.from(this.movedSet.values()))te(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||i(e);for(const e of Array.from(this.addedSet.values()))oe(this.droppedSet,e)||te(this.removes,e,this.mirror)?oe(this.movedSet,e)?i(e):this.droppedSet.add(e):i(e);let r=null;for(;t.length;){let e=null;if(r){const t=this.mirror.getId(r.value.parentNode),o=n(r.value);-1!==t&&-1!==o&&(e=r)}if(!e)for(let o=t.length-1;o>=0;o--){const i=t.get(o);if(i){const t=this.mirror.getId(i.value.parentNode);if(-1===n(i.value))continue;if(-1!==t){e=i;break}{const t=i.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=t.parentNode.host;if(-1!==this.mirror.getId(n)){e=i;break}}}}}if(!e){for(;t.head;)t.removeNode(t.head.value);break}r=e.previous,t.removeNode(e.value),i(e.value)}const s={texts:this.texts.map(e=>({id:this.mirror.getId(e.node),value:e.value})).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>({id:this.mirror.getId(e.node),attributes:e.attributes})).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};(s.texts.length||s.attributes.length||s.removes.length||s.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.processMutation=e=>{if(!G(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;W(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:E(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.target.getAttribute(e.attributeName);if("value"===e.attributeName&&(n=c({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),W(e.target,this.blockClass,this.blockSelector,!1)||n===e.oldValue)return;let o=this.attributes.find(t=>t.node===e.target);if("IFRAME"===t.tagName&&"src"===e.attributeName&&!this.keepIframeSrcFn(n)){if(t.contentDocument)return;e.attributeName="rr_src"}if(o||(o={node:e.target,attributes:{}},this.attributes.push(o)),"style"===e.attributeName){const n=this.doc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue),void 0!==o.attributes.style&&null!==o.attributes.style||(o.attributes.style={});const i=o.attributes.style;for(const e of Array.from(t.style)){const o=t.style.getPropertyValue(e),r=t.style.getPropertyPriority(e);o===n.style.getPropertyValue(e)&&r===n.style.getPropertyPriority(e)||(i[e]=""===r?o:[o,r])}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(i[e]=!1)}else o.attributes[e.attributeName]=A(this.doc,t.tagName,e.attributeName,n);break}case"childList":if(W(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const n=this.mirror.getId(t),r=o(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);W(e.target,this.blockClass,this.blockSelector,!1)||G(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(ee(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Z(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[X(n,r)]?ee(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!o(e.target)||!i(e.target))||void 0})),this.mapRemoves.push(t))})}},this.genAdds=(e,t)=>{if(this.mirror.hasNode(e)){if(G(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[X(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);W(e,this.blockClass,this.blockSelector,!1)||e.childNodes.forEach(e=>this.genAdds(e))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function ee(e,t){e.delete(t),t.childNodes.forEach(t=>ee(e,t))}function te(e,t,n){return 0!==e.length&&ne(e,t,n)}function ne(e,t,n){const{parentNode:o}=t;if(!o)return!1;const i=n.getId(o);return!!e.some(e=>e.id===i)||ne(e,o,n)}function oe(e,t){return 0!==e.size&&ie(e,t)}function ie(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||ie(e,n))}const re=[],se="undefined"!=typeof CSSGroupingRule,ae="undefined"!=typeof CSSMediaRule,ce="undefined"!=typeof CSSSupportsRule,le="undefined"!=typeof CSSConditionRule;function de(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch(t){return e.target}}function ue(e,t){var n,o;const i=new $;re.push(i),i.init(e);let r=window.MutationObserver||window.__rrMutationObserver;const s=null===(o=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===o?void 0:o.call(n,"MutationObserver");s&&window[s]&&(r=window[s]);const a=new r(i.processMutations.bind(i));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function he({mouseInteractionCb:e,doc:t,mirror:n,blockClass:o,blockSelector:i,sampling:r}){if(!1===r.mouseInteraction)return()=>{};const s=!0===r.mouseInteraction||void 0===r.mouseInteraction?{}:r.mouseInteraction,a=[];return Object.keys(Y).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e]).forEach(r=>{const s=r.toLowerCase(),c=(t=>r=>{const s=de(r);if(W(s,o,i,!0))return;const a=V(r)?r.changedTouches[0]:r;if(!a)return;const c=n.getId(s),{clientX:l,clientY:d}=a;e({type:Y[t],id:c,x:l,y:d})})(r);a.push(N(s,c,t))}),()=>{a.forEach(e=>e())}}function ge({scrollCb:e,doc:t,mirror:n,blockClass:o,blockSelector:i,sampling:r}){return N("scroll",x(r=>{const s=de(r);if(!s||W(s,o,i,!0))return;const a=n.getId(s);if(s===t){const n=t.scrollingElement||t.documentElement;e({id:a,x:n.scrollLeft,y:n.scrollTop})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})},r.scroll||100),t)}function pe(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const me=["INPUT","TEXTAREA","SELECT"],fe=new WeakMap;function Ie(e){return function(e,t){if(se&&e.parentRule instanceof CSSGroupingRule||ae&&e.parentRule instanceof CSSMediaRule||ce&&e.parentRule instanceof CSSSupportsRule||le&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function ye(e,t,n){let o,i;return e?(e.ownerNode?o=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:o}):{}}function Ce({mirror:e,stylesheetManager:t},n){var o,i,r;let s=null;s="#document"===n.nodeName?e.getId(n):e.getId(n.host);const a="#document"===n.nodeName?null===(o=n.defaultView)||void 0===o?void 0:o.Document:null===(r=null===(i=n.ownerDocument)||void 0===i?void 0:i.defaultView)||void 0===r?void 0:r.ShadowRoot,c=Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets");return null!==s&&-1!==s&&a&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var n;const o=null===(n=c.set)||void 0===n?void 0:n.call(this,e);if(null!==s&&-1!==s)try{t.adoptStyleSheets(e,s)}catch(e){}return o}}),()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}):()=>{}}function ve(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};!function(e,t){const{mutationCb:n,mousemoveCb:o,mouseInteractionCb:i,scrollCb:r,viewportResizeCb:s,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:d,canvasMutationCb:u,fontCb:h,selectionCb:g}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),o(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),i(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),r(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),s(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),d(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),u(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),g(...e)}}(e,t);const o=ue(e,e.doc),i=function({mousemoveCb:e,sampling:t,doc:n,mirror:o}){if(!1===t.mousemove)return()=>{};const i="number"==typeof t.mousemove?t.mousemove:50,r="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let s,a=[];const c=x(t=>{const n=Date.now()-s;e(a.map(e=>(e.timeOffset-=n,e)),t),a=[],s=null},r),l=x(e=>{const t=de(e),{clientX:n,clientY:i}=V(e)?e.changedTouches[0]:e;s||(s=Date.now()),a.push({x:n,y:i,id:o.getId(t),timeOffset:Date.now()-s}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?J.Drag:e instanceof MouseEvent?J.MouseMove:J.TouchMove)},i,{trailing:!1}),d=[N("mousemove",l,n),N("touchmove",l,n),N("drag",l,n)];return()=>{d.forEach(e=>e())}}(e),r=he(e),s=ge(e),a=function({viewportResizeCb:e}){let t=-1,n=-1;return N("resize",x(()=>{const o=U(),i=B();t===o&&n===i||(e({width:Number(i),height:Number(o)}),t=o,n=i)},200),window)}(e),l=function({inputCb:e,doc:t,mirror:n,blockClass:o,blockSelector:i,ignoreClass:r,maskInputOptions:s,maskInputFn:a,sampling:l,userTriggeredOnInput:d}){function u(e){let n=de(e);const l=e.isTrusted;if(n&&"OPTION"===n.tagName&&(n=n.parentElement),!n||!n.tagName||me.indexOf(n.tagName)<0||W(n,o,i,!0))return;const u=n.type;if(n.classList.contains(r))return;let g=n.value,p=!1;"radio"===u||"checkbox"===u?p=n.checked:(s[n.tagName.toLowerCase()]||s[u])&&(g=c({maskInputOptions:s,tagName:n.tagName,type:u,value:g,maskInputFn:a})),h(n,pe({text:g,isChecked:p,userTriggered:l},d));const m=n.name;"radio"===u&&m&&p&&t.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach(e=>{e!==n&&h(e,pe({text:e.value,isChecked:!p,userTriggered:!1},d))})}function h(t,o){const i=fe.get(t);if(!i||i.text!==o.text||i.isChecked!==o.isChecked){fe.set(t,o);const i=n.getId(t);e(Object.assign(Object.assign({},o),{id:i}))}}const g=("last"===l.input?["change"]:["input","change"]).map(e=>N(e,u,t)),p=t.defaultView;if(!p)return()=>{g.forEach(e=>e())};const m=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),f=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&g.push(...f.map(e=>L(e[0],e[1],{set(){u({target:this})}},!1,p))),()=>{g.forEach(e=>e())}}(e),d=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:o,sampling:i}){const r=r=>x(i=>{const s=de(i);if(!s||W(s,t,n,!0))return;const{currentTime:a,volume:c,muted:l,playbackRate:d}=s;e({type:r,id:o.getId(s),currentTime:a,volume:c,muted:l,playbackRate:d})},i.media||500),s=[N("play",r(0)),N("pause",r(1)),N("seeked",r(2)),N("volumechange",r(3)),N("ratechange",r(4))];return()=>{s.forEach(e=>e())}}(e),u=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:o}){const i=o.CSSStyleSheet.prototype.insertRule;o.CSSStyleSheet.prototype.insertRule=function(o,r){const{id:s,styleId:a}=ye(this,t,n.styleMirror);return(s&&-1!==s||a&&-1!==a)&&e({id:s,styleId:a,adds:[{rule:o,index:r}]}),i.apply(this,[o,r])};const r=o.CSSStyleSheet.prototype.deleteRule;let s,a;o.CSSStyleSheet.prototype.deleteRule=function(o){const{id:i,styleId:s}=ye(this,t,n.styleMirror);return(i&&-1!==i||s&&-1!==s)&&e({id:i,styleId:s,removes:[{index:o}]}),r.apply(this,[o])},o.CSSStyleSheet.prototype.replace&&(s=o.CSSStyleSheet.prototype.replace,o.CSSStyleSheet.prototype.replace=function(o){const{id:i,styleId:r}=ye(this,t,n.styleMirror);return(i&&-1!==i||r&&-1!==r)&&e({id:i,styleId:r,replace:o}),s.apply(this,[o])}),o.CSSStyleSheet.prototype.replaceSync&&(a=o.CSSStyleSheet.prototype.replaceSync,o.CSSStyleSheet.prototype.replaceSync=function(o){const{id:i,styleId:r}=ye(this,t,n.styleMirror);return(i&&-1!==i||r&&-1!==r)&&e({id:i,styleId:r,replaceSync:o}),a.apply(this,[o])});const c={};se?c.CSSGroupingRule=o.CSSGroupingRule:(ae&&(c.CSSMediaRule=o.CSSMediaRule),le&&(c.CSSConditionRule=o.CSSConditionRule),ce&&(c.CSSSupportsRule=o.CSSSupportsRule));const l={};return Object.entries(c).forEach(([o,i])=>{l[o]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=function(i,r){const{id:s,styleId:a}=ye(this.parentStyleSheet,t,n.styleMirror);return(s&&-1!==s||a&&-1!==a)&&e({id:s,styleId:a,adds:[{rule:i,index:[...Ie(this),r||0]}]}),l[o].insertRule.apply(this,[i,r])},i.prototype.deleteRule=function(i){const{id:r,styleId:s}=ye(this.parentStyleSheet,t,n.styleMirror);return(r&&-1!==r||s&&-1!==s)&&e({id:r,styleId:s,removes:[{index:[...Ie(this),i]}]}),l[o].deleteRule.apply(this,[i])}}),()=>{o.CSSStyleSheet.prototype.insertRule=i,o.CSSStyleSheet.prototype.deleteRule=r,s&&(o.CSSStyleSheet.prototype.replace=s),a&&(o.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule})}}(e,{win:n}),h=Ce(e,e.doc),g=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:o},{win:i}){const r=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=function(i,s,a){var c;if(n.has(i))return r.apply(this,[i,s,a]);const{id:l,styleId:d}=ye(null===(c=this.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,o.styleMirror);return(l&&-1!==l||d&&-1!==d)&&e({id:l,styleId:d,set:{property:i,value:s,priority:a},index:Ie(this.parentRule)}),r.apply(this,[i,s,a])};const s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=function(i){var r;if(n.has(i))return s.apply(this,[i]);const{id:a,styleId:c}=ye(null===(r=this.parentRule)||void 0===r?void 0:r.parentStyleSheet,t,o.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,remove:{property:i},index:Ie(this.parentRule)}),s.apply(this,[i])},()=>{i.CSSStyleDeclaration.prototype.setProperty=r,i.CSSStyleDeclaration.prototype.removeProperty=s}}(e,{win:n}),p=e.collectFonts?function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const o=[],i=new WeakMap,r=n.FontFace;n.FontFace=function(e,t,n){const o=new r(e,t,n);return i.set(o,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),o};const s=D(t.fonts,"add",function(t){return function(n){return setTimeout(()=>{const t=i.get(n);t&&(e(t),i.delete(n))},0),t.apply(this,[n])}});return o.push(()=>{n.FontFace=r}),o.push(s),()=>{o.forEach(e=>e())}}(e):()=>{},m=function(e){const{doc:t,mirror:n,blockClass:o,blockSelector:i,selectionCb:r}=e;let s=!0;const a=()=>{const e=t.getSelection();if(!e||s&&(null==e?void 0:e.isCollapsed))return;s=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const r=e.getRangeAt(t),{startContainer:s,startOffset:c,endContainer:l,endOffset:d}=r;W(s,o,i,!0)||W(l,o,i,!0)||a.push({start:n.getId(s),startOffset:c,end:n.getId(l),endOffset:d})}r({ranges:a})};return a(),N("selectionchange",a)}(e),f=[];for(const t of e.plugins)f.push(t.observer(t.callback,n,t.options));return()=>{re.forEach(e=>e.reset()),o.disconnect(),i(),r(),s(),a(),l(),d(),u(),h(),g(),p(),m(),f.forEach(e=>e())}}class be{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,o){const i=n||this.getIdToRemoteIdMap(e),r=o||this.getRemoteIdToIdMap(e);let s=i.get(t);return s||(s=this.generateIdFn(),i.set(t,s),r.set(s,t)),s}getIds(e,t){const n=this.getIdToRemoteIdMap(e),o=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,n,o))}getRemoteId(e,t,n){const o=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const i=o.get(t);return i||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,n))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class Se{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new be(p),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new be(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){if("rrweb"===e.data.type){if(!e.source)return;const t=this.crossOriginIframeMap.get(e.source);if(!t)return;const n=this.transformCrossOriginEvent(t,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}}transformCrossOriginEvent(e,t){var n;switch(t.type){case P.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e),{timestamp:t.timestamp,type:P.IncrementalSnapshot,data:{source:J.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case P.Meta:case P.Load:case P.DomContentLoaded:return!1;case P.Plugin:return t;case P.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case P.IncrementalSnapshot:switch(t.data.source){case J.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case J.Drag:case J.TouchMove:case J.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case J.ViewportResize:return!1;case J.MediaInteraction:case J.MouseInteraction:case J.Scroll:case J.CanvasMutation:case J.Input:return this.replaceIds(t.data,e,["id"]),t;case J.StyleSheetRule:case J.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case J.Font:return t;case J.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case J.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}}replace(e,t,n,o){for(const i of o)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(n,t[i]):t[i]=e.getId(n,t[i]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}}class we{constructor(e){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;const t=this;this.restorePatches.push(D(Element.prototype,"attachShadow",function(e){return function(n){const o=e.call(this,n);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,this.ownerDocument),o}}))}addShadowRoot(e,t){i(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),ue(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),ge(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),Ce({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)},0)))}observeAttachShadow(e){if(e.contentWindow){const t=this;this.restorePatches.push(D(e.contentWindow.HTMLElement.prototype,"attachShadow",function(n){return function(o){const i=n.call(this,o);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,e.contentDocument),i}}))}}reset(){this.restorePatches.forEach(e=>e()),this.shadowDoms=new WeakSet}}
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -12,5 +12,5 @@
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */function we(e,t,n,o){return new(n||(n=Promise))((function(t,r){function s(e){try{a(o.next(e))}catch(e){r(e)}}function i(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var o;e.done?t(e.value):(o=e.value,o instanceof n?o:new n((function(e){e(o)}))).then(s,i)}a((o=o.apply(e,[])).next())}))}for(var ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Me="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Te=0;Te<64;Te++)Me[ke.charCodeAt(Te)]=Te;const Ee=new Map;const Re=(e,t,n)=>{if(!e||!xe(e,t)&&"object"!=typeof e)return;const o=function(e,t){let n=Ee.get(e);return n||(n=new Map,Ee.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let r=o.indexOf(e);return-1===r&&(r=o.length,o.push(e)),r};function Ne(e,t,n){if(e instanceof Array)return e.map((e=>Ne(e,t,n)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){const t=e.constructor.name,n=function(e){var t,n=new Uint8Array(e),o=n.length,r="";for(t=0;t<o;t+=3)r+=ke[n[t]>>2],r+=ke[(3&n[t])<<4|n[t+1]>>4],r+=ke[(15&n[t+1])<<2|n[t+2]>>6],r+=ke[63&n[t+2]];return o%3==2?r=r.substring(0,r.length-1)+"=":o%3==1&&(r=r.substring(0,r.length-2)+"=="),r}(e);return{rr_type:t,base64:n}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[Ne(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[Ne(e.data,t,n),e.width,e.height]}}if(xe(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:Re(e,t,n)}}return e}const Oe=(e,t,n)=>[...e].map((e=>Ne(e,t,n))),xe=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(n.find((n=>e instanceof t[n])))};function Fe(e,t,n){const o=[];try{const r=D(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(o,...r){return W(this,t,n,!0)||"__context"in this||(this.__context=o),e.apply(this,[o,...r])}}));o.push(r)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach((e=>e()))}}function Le(e,t,n,o,r,s,i){const a=[],c=Object.getOwnPropertyNames(e);for(const s of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(s))try{if("function"!=typeof e[s])continue;const c=D(e,s,(function(e){return function(...a){const c=e.apply(this,a);if(Re(c,i,this),!W(this.canvas,o,r,!0)){const e=Oe([...a],i,this),o={type:t,property:s,args:e};n(this.canvas,o)}return c}}));a.push(c)}catch(o){const r=L(e,s,{set(e){n(this.canvas,{type:t,property:s,args:[e],setter:!0})}});a.push(r)}return a}var De=null;try{var Ue="undefined"!=typeof module&&"function"==typeof module.require&&module.require("worker_threads")||"function"==typeof __non_webpack_require__&&__non_webpack_require__("worker_threads")||"function"==typeof require&&require("worker_threads");De=Ue.Worker}catch(e){}function Be(e,t,n){var o=function(e){return Buffer.from(e,"base64").toString("utf8")}(e),r=o.indexOf("\n",10)+1,s=o.substring(r)+"";return function(e){return new De(s,Object.assign({},e,{eval:!0}))}}function We(e,t,n){var o=function(e){return atob(e)}(e),r=o.indexOf("\n",10)+1,s=o.substring(r)+"",i=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(i)}var Ze="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0);var Ve,Ke=(Ve="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",Ze?Be(Ve):function(e){var t;return function(n){return t=t||We(e),new Worker(t,n)}}(Ve));class Ge{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:o,blockSelector:r,recordCanvas:s,dataURLOptions:i}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&"all"===t&&this.initCanvasMutationObserver(n,o,r),s&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,o,r,{dataURLOptions:i})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,n,o,r){const s=Fe(t,n,o),i=new Map,a=new Ke;a.onmessage=e=>{const{id:t}=e.data;if(i.set(t,!1),!("base64"in e.data))return;const{base64:n,type:o,width:r,height:s}=e.data;this.mutationCb({id:t,type:H["2D"],commands:[{property:"clearRect",args:[0,0,r,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:o}]},0,0]}]})};const c=1e3/e;let d,l=0;const u=e=>{l&&e-l<c||(l=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{W(t,n,o,!0)||e.push(t)})),e})().forEach((e=>we(this,0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(i.get(n))return;if(i.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&(null==n||n.clear(n.COLOR_BUFFER_BIT))}const o=yield createImageBitmap(e);a.postMessage({id:n,bitmap:o,width:e.width,height:e.height,dataURLOptions:r.dataURLOptions},[o])}))))),d=requestAnimationFrame(u)};d=requestAnimationFrame(u),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=Fe(e,t,n),r=function(e,t,n,o){const r=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const i of s)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[i])continue;const s=D(t.CanvasRenderingContext2D.prototype,i,(function(r){return function(...s){return W(this.canvas,n,o,!0)||setTimeout((()=>{const n=Oe([...s],t,this);e(this.canvas,{type:H["2D"],property:i,args:n})}),0),r.apply(this,s)}}));r.push(s)}catch(n){const o=L(t.CanvasRenderingContext2D.prototype,i,{set(t){e(this.canvas,{type:H["2D"],property:i,args:[t],setter:!0})}});r.push(o)}return()=>{r.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),s=function(e,t,n,o){const r=[];return r.push(...Le(t.WebGLRenderingContext.prototype,H.WebGL,e,n,o,0,t)),void 0!==t.WebGL2RenderingContext&&r.push(...Le(t.WebGL2RenderingContext.prototype,H.WebGL2,e,n,o,0,t)),()=>{r.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{o(),r(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const o=n.map((e=>{const t=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["type"]);return t})),{type:r}=n[0];this.mutationCb({id:t,type:r,commands:o}),this.pendingCanvasMutations.delete(e)}}class _e{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new P,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},o=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);const n=Array.from(t.rules||CSSRule);o.push({styleId:e,rules:n.map(((e,t)=>({rule:i(e),index:t})))})}n.styleIds.push(e)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}function ze(e){return Object.assign(Object.assign({},e),{timestamp:Date.now()})}let Pe,Je,je,Ye=!1;const He=new a;function Qe(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:o,blockClass:r="rr-block",blockSelector:s=null,ignoreClass:i="rr-ignore",maskTextClass:c="rr-mask",maskTextSelector:d=null,inlineStylesheet:l=!0,maskAllInputs:u,maskInputOptions:h,slimDOMOptions:p,maskInputFn:g,maskTextFn:m,hooks:I,packFn:f,sampling:y={},dataURLOptions:C={},mousemoveWait:v,recordCanvas:S=!1,recordCrossOriginIframes:b=!1,userTriggeredOnInput:A=!1,collectFonts:w=!1,inlineImages:k=!1,plugins:M,keepIframeSrcFn:T=()=>!1,ignoreCSSAttributes:E=new Set([])}=e,O=!b||window.parent===window;let x=!1;if(!O)try{window.parent.document,x=!1}catch(e){x=!0}if(O&&!t)throw new Error("emit function is required");void 0!==v&&void 0===y.mousemove&&(y.mousemove=v),He.reset();const F=!0===u?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==h?h:{password:!0},L=!0===p||"all"===p?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===p,headMetaDescKeywords:"all"===p}:p||{};let D;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let W=0;const Z=e=>{for(const t of M||[])t.eventProcessor&&(e=t.eventProcessor(e));return f&&(e=f(e)),e};Pe=(e,r)=>{var s;if(!(null===(s=se[0])||void 0===s?void 0:s.isFrozen())||e.type===J.FullSnapshot||e.type===J.IncrementalSnapshot&&e.data.source===j.Mutation||se.forEach((e=>e.unfreeze())),O)null==t||t(Z(e),r);else if(x){const t={type:"rrweb",event:Z(e),isCheckout:r};window.parent.postMessage(t,"*")}if(e.type===J.FullSnapshot)D=e,W=0;else if(e.type===J.IncrementalSnapshot){if(e.data.source===j.Mutation&&e.data.isAttachIframe)return;W++;const t=o&&W>=o,r=n&&e.timestamp-D.timestamp>n;(t||r)&&Je(!0)}};const V=e=>{Pe(ze({type:J.IncrementalSnapshot,data:Object.assign({source:j.Mutation},e)}))},K=e=>Pe(ze({type:J.IncrementalSnapshot,data:Object.assign({source:j.Scroll},e)})),P=e=>Pe(ze({type:J.IncrementalSnapshot,data:Object.assign({source:j.CanvasMutation},e)})),Y=new _e({mutationCb:V,adoptedStyleSheetCb:e=>Pe(ze({type:J.IncrementalSnapshot,data:Object.assign({source:j.AdoptedStyleSheet},e)}))}),H=new be({mirror:He,mutationCb:V,stylesheetManager:Y,recordCrossOriginIframes:b,wrappedEmit:Pe});for(const e of M||[])e.getMirror&&e.getMirror({nodeMirror:He,crossOriginIframeMirror:H.crossOriginIframeMirror,crossOriginIframeStyleMirror:H.crossOriginIframeStyleMirror});je=new Ge({recordCanvas:S,mutationCb:P,win:window,blockClass:r,blockSelector:s,mirror:He,sampling:y.canvas,dataURLOptions:C});const Q=new Ae({mutationCb:V,scrollCb:K,bypassOptions:{blockClass:r,blockSelector:s,maskTextClass:c,maskTextSelector:d,inlineStylesheet:l,maskInputOptions:F,dataURLOptions:C,maskTextFn:m,maskInputFn:g,recordCanvas:S,inlineImages:k,sampling:y,slimDOMOptions:L,iframeManager:H,stylesheetManager:Y,canvasManager:je,keepIframeSrcFn:T},mirror:He});Je=(e=!1)=>{var t,n,o,i,u,h;Pe(ze({type:J.Meta,data:{href:window.location.href,width:B(),height:U()}}),e),Y.reset(),se.forEach((e=>e.lock()));const p=function(e,t){var n=t||{},o=n.mirror,r=void 0===o?new a:o,s=n.blockClass,i=void 0===s?"rr-block":s,c=n.blockSelector,d=void 0===c?null:c,l=n.maskTextClass,u=void 0===l?"rr-mask":l,h=n.maskTextSelector,p=void 0===h?null:h,g=n.inlineStylesheet,m=void 0===g||g,I=n.inlineImages,f=void 0!==I&&I,y=n.recordCanvas,C=void 0!==y&&y,v=n.maskAllInputs,S=void 0!==v&&v,b=n.maskTextFn,A=n.maskInputFn,w=n.slimDOM,k=void 0!==w&&w,M=n.dataURLOptions,T=n.preserveWhiteSpace,E=n.onSerialize,N=n.onIframeLoad,O=n.iframeLoadTimeout,x=n.onStylesheetLoad,F=n.stylesheetLoadTimeout,L=n.keepIframeSrcFn;return R(e,{doc:e,mirror:r,blockClass:i,blockSelector:d,maskTextClass:u,maskTextSelector:p,skipChild:!1,inlineStylesheet:m,maskInputOptions:!0===S?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===S?{password:!0}:S,maskTextFn:b,maskInputFn:A,slimDOMOptions:!0===k||"all"===k?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===k,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===k?{}:k,dataURLOptions:M,inlineImages:f,recordCanvas:C,preserveWhiteSpace:T,onSerialize:E,onIframeLoad:N,iframeLoadTimeout:O,onStylesheetLoad:x,stylesheetLoadTimeout:F,keepIframeSrcFn:void 0===L?function(){return!1}:L,newlyAddedElement:!1})}(document,{mirror:He,blockClass:r,blockSelector:s,maskTextClass:c,maskTextSelector:d,inlineStylesheet:l,maskAllInputs:F,maskTextFn:m,slimDOM:L,dataURLOptions:C,recordCanvas:S,inlineImages:k,onSerialize:e=>{G(e,He)&&H.addIframe(e),_(e,He)&&Y.trackLinkElement(e),z(e)&&Q.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{H.attachIframe(e,t),Q.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{Y.attachLinkElement(e,t)},keepIframeSrcFn:T});if(!p)return console.warn("Failed to snapshot the document");Pe(ze({type:J.FullSnapshot,data:{node:p,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(n=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(u=null===(i=null===document||void 0===document?void 0:document.body)||void 0===i?void 0:i.parentElement)||void 0===u?void 0:u.scrollTop)||(null===(h=null===document||void 0===document?void 0:document.body)||void 0===h?void 0:h.scrollTop)||0}}})),se.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Y.adoptStyleSheets(document.adoptedStyleSheets,He.getId(document))};try{const e=[];e.push(N("DOMContentLoaded",(()=>{Pe(ze({type:J.DomContentLoaded,data:{}}))})));const t=e=>{var t;return ve({mutationCb:V,mousemoveCb:(e,t)=>Pe(ze({type:J.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>Pe(ze({type:J.IncrementalSnapshot,data:Object.assign({source:j.MouseInteraction},e)})),scrollCb:K,viewportResizeCb:e=>Pe(ze({type:J.IncrementalSnapshot,data:Object.assign({source:j.ViewportResize},e)})),inputCb:e=>Pe(ze({type:J.IncrementalSnapshot,data:Object.assign({source:j.Input},e)})),mediaInteractionCb:e=>Pe(ze({type:J.IncrementalSnapshot,data:Object.assign({source:j.MediaInteraction},e)})),styleSheetRuleCb:e=>Pe(ze({type:J.IncrementalSnapshot,data:Object.assign({source:j.StyleSheetRule},e)})),styleDeclarationCb:e=>Pe(ze({type:J.IncrementalSnapshot,data:Object.assign({source:j.StyleDeclaration},e)})),canvasMutationCb:P,fontCb:e=>Pe(ze({type:J.IncrementalSnapshot,data:Object.assign({source:j.Font},e)})),selectionCb:e=>{Pe(ze({type:J.IncrementalSnapshot,data:Object.assign({source:j.Selection},e)}))},blockClass:r,ignoreClass:i,maskTextClass:c,maskTextSelector:d,maskInputOptions:F,inlineStylesheet:l,sampling:y,recordCanvas:S,inlineImages:k,userTriggeredOnInput:A,collectFonts:w,doc:e,maskInputFn:g,maskTextFn:m,keepIframeSrcFn:T,blockSelector:s,slimDOMOptions:L,dataURLOptions:C,mirror:He,iframeManager:H,stylesheetManager:Y,shadowDomManager:Q,canvasManager:je,ignoreCSSAttributes:E,plugins:(null===(t=null==M?void 0:M.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>Pe(ze({type:J.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},I)};H.addLoadListener((n=>{e.push(t(n.contentDocument))}));const n=()=>{Je(),e.push(t(document)),Ye=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():e.push(N("load",(()=>{Pe(ze({type:J.Load,data:{}})),n()}),window)),()=>{e.forEach((e=>e())),Ye=!1}}catch(e){console.warn(e)}}Qe.addCustomEvent=(e,t)=>{if(!Ye)throw new Error("please add custom event after start recording");Pe(ze({type:J.Custom,data:{tag:e,payload:t}}))},Qe.freezePage=()=>{se.forEach((e=>e.freeze()))},Qe.takeFullSnapshot=e=>{if(!Ye)throw new Error("please take full snapshot after start recording");Je(e)},Qe.mirror=He;const qe=[];for(let e=0;e<256;++e)qe.push((e+256).toString(16).slice(1));let Xe;const $e=new Uint8Array(16);const et={};function tt(e,t,n){let o;{const e=Date.now(),r=function(){if(!Xe){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Xe=crypto.getRandomValues.bind(crypto)}return Xe($e)}();!function(e,t,n){e.msecs??=-1/0,e.nsecs??=0,t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0);e.node||(e.node=n.slice(10,16),e.node[0]|=1,e.clockseq=16383&(n[8]<<8|n[9]));e.msecs=t}(et,e,r),o=function(e,t,n,o,r,s,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(s){if(i<0||i+16>s.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`)}else s=new Uint8Array(16),i=0;t??=Date.now(),n??=0,o??=16383&(e[8]<<8|e[9]),r??=e.slice(10,16);const a=(1e4*(268435455&(t+=122192928e5))+n)%4294967296;s[i++]=a>>>24&255,s[i++]=a>>>16&255,s[i++]=a>>>8&255,s[i++]=255&a;const c=t/4294967296*1e4&268435455;s[i++]=c>>>8&255,s[i++]=255&c,s[i++]=c>>>24&15|16,s[i++]=c>>>16&255,s[i++]=o>>>8|128,s[i++]=255&o;for(let e=0;e<6;++e)s[i++]=r[e];return s}(r,et.msecs,et.nsecs,et.clockseq,et.node,t,n)}return t??function(e,t=0){return(qe[e[t+0]]+qe[e[t+1]]+qe[e[t+2]]+qe[e[t+3]]+"-"+qe[e[t+4]]+qe[e[t+5]]+"-"+qe[e[t+6]]+qe[e[t+7]]+"-"+qe[e[t+8]]+qe[e[t+9]]+"-"+qe[e[t+10]]+qe[e[t+11]]+qe[e[t+12]]+qe[e[t+13]]+qe[e[t+14]]+qe[e[t+15]]).toLowerCase()}(o)}const nt=10485760;function ot(e,t,n){return(new TextEncoder).encode(JSON.stringify({sessionId:n,events:[...e,t]})).length>nt}function rt(e,t){const n=(new TextEncoder).encode(JSON.stringify({sessionId:t,events:[e]})).length;if(n>nt)throw new Error(`Single event size (${n} bytes) exceeds maximum chunk size (10485760 bytes)`)}class st{constructor({apiKey:e,ingestionUrl:t}){this.apiKey=e,this.baseUrl=t}init(e,n){return t(this,void 0,void 0,(function*(){let t=null,o=null;"undefined"!=typeof window&&(t=window.location.href,o=document.referrer);const r=yield fetch(`${this.baseUrl}/api/ingestion/init`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,Referer:o||""},body:JSON.stringify({sessionId:e,endUserId:n,entryURL:t,referrer:o})});if(!r.ok)throw new Error(`Failed to initialize ingestion: ${r.statusText}`);const s=yield r.json();return{sessionId:s.sessionId,endUserId:s.endUserId}}))}sendEvents(e,n,o){return t(this,void 0,void 0,(function*(){const t=yield fetch(`${this.baseUrl}/api/ingestion/events`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({sessionId:n,events:e,endUserId:o})});if(!t.ok)throw new Error(`Failed to send events: ${t.statusText}`)}))}sendEventsChunked(e,n){return t(this,void 0,void 0,(function*(){try{const t=[];let o=[];for(const r of e)if(ot(o,r,n)){if(o.length>0){const e=yield fetch(`${this.baseUrl}/api/ingestion/events`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({sessionId:n,events:o})});if(!e.ok)throw new Error(`Failed to send events: ${e.statusText}`);t.push(yield e.json()),o=[]}rt(r,n),o=[r]}else o.push(r);if(o.length>0){const e=yield fetch(`${this.baseUrl}/api/ingestion/events`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({sessionId:n,events:o})});if(!e.ok)throw new Error(`Failed to send events: ${e.statusText}`);t.push(yield e.json())}return t.flat()}catch(e){throw console.error("Error sending events:",e),e}}))}sendUserData(e,n,o){return t(this,void 0,void 0,(function*(){try{const t=yield fetch(`${this.baseUrl}/api/ingestion/user`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({userId:e,userAttributes:n,sessionId:o})});if(!t.ok)throw new Error(`Failed to send user data: ${t.statusText} with API key: ${this.apiKey}`);return yield t.json()}catch(e){throw console.error("Error sending user data:",e),e}}))}sendUserAuth(e,n,o,r){return t(this,void 0,void 0,(function*(){try{const t=yield fetch(`${this.baseUrl}/api/ingestion/user/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({userId:e,userAttributes:n,sessionId:o,authFields:r})});if(!t.ok)throw new Error(`Failed to authenticate user: ${t.statusText} with API key: ${this.apiKey}`);return yield t.json()}catch(e){throw console.error("Error authenticating user:",e),e}}))}sendSessionComplete(e){return t(this,void 0,void 0,(function*(){const t=yield fetch(`${this.baseUrl}/api/ingestion/sessionComplete`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({sessionId:e})});if(!t.ok)throw new Error(`Failed to send session complete: ${t.statusText}`)}))}sendCustomEvent(e,n,o){return t(this,void 0,void 0,(function*(){let t=0;for(;t<3;)try{const t=yield fetch(`${this.baseUrl}/api/ingestion/customEvent`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({name:e,properties:n,sessionId:o,timestamp:(new Date).toISOString()})});if(!t.ok)throw new Error(`Failed to send custom event: ${t.statusText}`);return yield t.json()}catch(e){if(t++,3===t)throw console.error("Error sending custom event after max retries:",e),e;yield new Promise((e=>setTimeout(e,1e3*Math.pow(2,t))))}}))}sendCustomEvents(e,n){return t(this,void 0,void 0,(function*(){let t=0;for(;t<3;)try{const t=yield fetch(`${this.baseUrl}/api/ingestion/customEvent/batch`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({events:e.map((e=>Object.assign(Object.assign({},e),{sessionId:n})))})});if(!t.ok)throw new Error(`Failed to send custom events: ${t.statusText}`);return yield t.json()}catch(e){if(t++,3===t)throw console.error("Error sending custom events after max retries:",e),e;yield new Promise((e=>setTimeout(e,1e3*Math.pow(2,t))))}}))}sendBeaconEvents(e,t,n=!1){const o=new URLSearchParams;o.append("events",encodeURIComponent(JSON.stringify(e))),o.append("sessionId",encodeURIComponent(t)),o.append("timestamp",encodeURIComponent(Date.now().toString())),o.append("apiKey",encodeURIComponent(this.apiKey)),n&&(console.log("Session complete beacon sending"),localStorage.setItem("koalaware_session_complete",Date.now().toString()),o.append("sessionComplete",encodeURIComponent("true"))),navigator.sendBeacon(`${this.baseUrl}/api/ingestion/events`,o)}sendBeaconSessionComplete(e){const t=new URLSearchParams;t.append("sessionId",e),t.append("apiKey",this.apiKey),t.append("sessionComplete","true"),navigator.sendBeacon(`${this.baseUrl}/api/ingestion/sessionComplete`,t)}sendBeaconCustomEvent(e,t,n){const o=new URLSearchParams;return o.append("name",encodeURIComponent(e)),o.append("properties",encodeURIComponent(JSON.stringify(t))),o.append("sessionId",encodeURIComponent(n)),o.append("timestamp",encodeURIComponent((new Date).toISOString())),o.append("apiKey",encodeURIComponent(this.apiKey)),navigator.sendBeacon(`${this.baseUrl}/api/ingestion/customEvent`,o)}sendBeaconCustomEvents(e,t){const n=new URLSearchParams;return n.append("events",encodeURIComponent(JSON.stringify(e.map((e=>Object.assign(Object.assign({},e),{sessionId:t})))))),n.append("apiKey",encodeURIComponent(this.apiKey)),navigator.sendBeacon(`${this.baseUrl}/api/ingestion/customEvent/batch`,n)}}const it="undefined"!=typeof window;class at{constructor(e){this.redactedText="[REDACTED]",this.userSelectedFields=new Set,this.excludeSelectors=['[data-no-redact="true"]',".human-behavior-no-redact"],(null==e?void 0:e.redactedText)&&(this.redactedText=e.redactedText),(null==e?void 0:e.excludeSelectors)&&(this.excludeSelectors=[...this.excludeSelectors,...e.excludeSelectors]),(null==e?void 0:e.userFields)&&this.setFieldsToRedact(e.userFields)}setFieldsToRedact(e){this.userSelectedFields.clear(),e.forEach((e=>this.userSelectedFields.add(e))),e.length>0?(console.log(`Redaction: Active for ${e.length} field(s):`,e),e.forEach((e=>{const t=document.querySelectorAll(e);console.log(`Redaction: Found ${t.length} element(s) for selector '${e}'`),t.forEach(((t,n)=>{console.log(`Redaction: Element ${n} for '${e}':`,t)}))}))):console.log("Redaction: Disabled - no fields selected")}isActive(){return this.userSelectedFields.size>0}getSelectedFields(){return Array.from(this.userSelectedFields)}processEvent(e){if(0===this.userSelectedFields.size)return e;const t=JSON.parse(JSON.stringify(e));if(3===t.type)if(5===t.data.source){this.isFieldSelected(t.data)&&(console.log("Redaction: Processing input event for redaction"),this.redactInputEvent(t.data))}else 0===t.data.source?this.redactDOMEvent(t.data):2===t.data.source&&this.redactMouseEvent(t.data);else 2===t.type&&this.redactFullSnapshot(t.data);return t}redactInputEvent(e){if(!this.isFieldSelected(e))return;console.log("Redaction: Redacting input event with text:",e.text);["text","value","content","data","input","textContent"].forEach((t=>{void 0!==e[t]&&"string"==typeof e[t]&&(e[t]=this.redactedText,console.log(`Redaction: Redacted property '${t}'`))})),Object.keys(e).forEach((t=>{"string"==typeof e[t]&&e[t].length>0&&(e[t]=this.redactedText,console.log(`Redaction: Redacted additional property '${t}'`))})),e.attributes&&"object"==typeof e.attributes&&e.attributes.value&&"string"==typeof e.attributes.value&&(e.attributes.value=this.redactedText,console.log("Redaction: Redacted nested value attribute")),console.log("Redaction: Input event redaction complete")}redactDOMEvent(e){e.texts&&Array.isArray(e.texts)&&e.texts.forEach((e=>{e.text&&"string"==typeof e.text&&this.shouldRedactDOMChange(e)&&(e.text=this.redactedText)})),e.attributes&&Array.isArray(e.attributes)&&e.attributes.forEach((e=>{e.attributes&&e.attributes.value&&"string"==typeof e.attributes.value&&this.shouldRedactDOMChange(e)&&(e.attributes.value=this.redactedText)})),e.adds&&Array.isArray(e.adds)&&e.adds.forEach((e=>{e.node&&e.node.textContent&&"string"==typeof e.node.textContent&&this.shouldRedactDOMChange(e)&&(e.node.textContent=this.redactedText)}))}shouldRedactDOMChange(e){if(!it)return!1;try{const t=e.id;if(void 0!==t){let e=document.querySelector(`[data-rrweb-id="${t}"]`);if(e)return this.shouldRedactElement(e)}const n=e.nodeId;if(void 0!==n){const e=document.querySelector(`[data-rrweb-id="${n}"]`);if(e)return this.shouldRedactElement(e)}return!1}catch(e){return console.warn("Error checking if DOM change should be redacted:",e),!1}}redactMouseEvent(e){e.text&&"string"==typeof e.text&&this.isFieldSelected(e)&&(e.text=this.redactedText)}redactFullSnapshot(e){e.node&&2===e.node.type&&this.redactNode(e.node)}redactNode(e){e&&(2!==e.type||!e.tagName||"input"!==e.tagName.toLowerCase()&&"textarea"!==e.tagName.toLowerCase()||this.shouldRedactNode(e)&&(e.attributes&&e.attributes.value&&(e.attributes.value=this.redactedText),e.textContent&&(e.textContent=this.redactedText)),e.childNodes&&Array.isArray(e.childNodes)&&e.childNodes.forEach((e=>{this.redactNode(e)})))}shouldRedactNode(e){if(!e.attributes)return!1;for(const t of this.userSelectedFields)if(this.selectorMatchesNode(t,e))return!0;return!1}selectorMatchesNode(e,t){if(!t.attributes)return!1;try{const n=document.createElement(t.tagName||"div");return t.attributes&&Object.keys(t.attributes).forEach((e=>{n.setAttribute(e,t.attributes[e])})),n.matches(e)}catch(n){return this.basicSelectorMatch(e,t)}}basicSelectorMatch(e,t){if(!t.attributes)return!1;if(e.includes("input[type=")){const n=e.match(/input\[type="([^"]+)"\]/);if(n&&"input"===t.tagName&&t.attributes.type===n[1])return!0}if(e.startsWith("#")){const n=e.substring(1);return t.attributes.id===n}if(e.startsWith(".")){const n=e.substring(1);return t.attributes.class&&t.attributes.class.includes(n)}return!e.includes("[")&&!e.includes(".")&&(t.tagName&&t.tagName.toLowerCase()===e.toLowerCase())}isFieldSelected(e){if(!it)return!1;try{if(5===e.source){const t=e.id;if(void 0!==t){let n=document.querySelector(`[data-rrweb-id="${t}"]`);if(n)return this.shouldRedactElement(n);if(void 0!==e.nodeId&&(n=document.querySelector(`[data-rrweb-id="${e.nodeId}"]`),n))return this.shouldRedactElement(n);for(const e of this.userSelectedFields){const t=document.querySelectorAll(e);if(t.length>0)for(const n of t)if(n===document.activeElement)return console.log("Redaction: Found focused element matching selector:",e),!0}const o=document.activeElement;return!(!o||!this.shouldRedactElement(o))&&(console.log("Redaction: Active element should be redacted"),!0)}}const t=e.id;if(void 0!==t){let e=document.querySelector(`[data-rrweb-id="${t}"]`);if(e)return this.shouldRedactElement(e)}const n=e.nodeId;if(void 0!==n){const e=document.querySelector(`[data-rrweb-id="${n}"]`);if(e)return this.shouldRedactElement(e)}if(e.target&&e.target.id){const t=document.querySelector(`[data-rrweb-id="${e.target.id}"]`);if(t)return this.shouldRedactElement(t)}return!1}catch(e){return console.warn("Error checking if field should be redacted:",e),!1}}shouldRedactElement(e){for(const t of this.excludeSelectors)if(e.matches(t)||e.closest(t))return!1;for(const t of this.userSelectedFields)if(e.matches(t))return!0;return!1}getOriginalValue(e){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return e.value}isElementRedacted(e){return this.shouldRedactElement(e)}}const ct=new at,dt="undefined"!=typeof window;class lt{constructor(e,t){if(this.eventIngestionQueue=[],this.queueSizeBytes=0,this.rejectedEvents=[],this.isProcessingRejectedEvents=!1,this.userProperties={},this.isProcessing=!1,this.flushInterval=null,this.FLUSH_INTERVAL_MS=5e3,this.endUserId=null,this.initialized=!1,this.initializationPromise=null,!e)throw new Error("Human Behavior API Key is required");this.api=new st({apiKey:e,ingestionUrl:t||"http://3.137.217.33:3000"}),this.apiKey=e,this.redactionManager=new at;const n=dt?localStorage.getItem("human_behavior_session_id"):null,o=dt?localStorage.getItem("human_behavior_last_activity"):null,r=Date.now()-18e5,s=o&&parseInt(o)>r;this.sessionId=n&&s?n:tt(),n&&s||!dt||localStorage.setItem("human_behavior_session_id",this.sessionId),this.initializationPromise=this.init()}init(){return t(this,void 0,void 0,(function*(){try{const e=this.getCookie(`human_behavior_end_user_id_${this.apiKey}`),{sessionId:t,endUserId:n}=yield this.api.init(this.sessionId,e);this.sessionId=t,this.endUserId=n,this.setCookie(`human_behavior_end_user_id_${this.apiKey}`,n,365),dt?(this.setupPageUnloadHandler(),this.start(),this.processRejectedEvents()):console.warn("HumanBehaviorTracker initialized in a non-browser environment. Session tracking is disabled."),this.initialized=!0,console.log("HumanBehaviorTracker initialized")}catch(e){throw console.error("Failed to initialize HumanBehaviorTracker:",e),e}}))}ensureInitialized(){return t(this,void 0,void 0,(function*(){if(!this.initializationPromise)throw new Error("HumanBehaviorTracker initialization failed");yield this.initializationPromise}))}static logToStorage(e){try{const t=JSON.parse(localStorage.getItem("human_behavior_logs")||"[]");t.push(`${(new Date).toISOString()}: ${e}`),localStorage.setItem("human_behavior_logs",JSON.stringify(t))}catch(e){console.error("Failed to log to storage:",e)}}setupPageUnloadHandler(){dt&&(console.log("Setting up page unload handler"),window.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(console.log("Page hidden - sending pending events"),this.api.sendBeaconEvents(this.eventIngestionQueue,this.sessionId))})),window.addEventListener("beforeunload",(()=>{localStorage.setItem("human_behavior_last_activity",Date.now().toString()),this.api.sendBeaconEvents(this.eventIngestionQueue,this.sessionId)})),setInterval((()=>{localStorage.setItem("human_behavior_last_activity",Date.now().toString())}),6e4))}viewLogs(){try{const e=JSON.parse(localStorage.getItem("human_behavior_logs")||"[]");console.log("HumanBehavior Logs:",e),localStorage.removeItem("human_behavior_logs")}catch(e){console.error("Failed to read logs:",e)}}addUserInfo(e){return t(this,void 0,void 0,(function*(){if(yield this.ensureInitialized(),!this.endUserId)throw new Error("Cannot add user info before tracker initialization");this.userProperties=e,yield this.api.sendUserData(this.endUserId,e,this.sessionId)}))}auth(e){return t(this,void 0,void 0,(function*(){if(yield this.ensureInitialized(),!this.endUserId)throw new Error("Cannot authenticate before tracker initialization");if(!this.userProperties||0===Object.keys(this.userProperties).length)throw new Error("No user info available. Call addUserInfo() first.");yield this.api.sendUserAuth(this.endUserId,this.userProperties,this.sessionId,e)}))}customEvent(e){return t(this,arguments,void 0,(function*(e,t={}){yield this.ensureInitialized(),this.api.sendBeaconCustomEvent(e,t,this.sessionId)}))}start(){return t(this,void 0,void 0,(function*(){yield this.ensureInitialized(),dt&&(this.flushInterval=window.setInterval((()=>{this.flush()}),this.FLUSH_INTERVAL_MS),Qe({emit:e=>{this.addEvent(e)},inlineStylesheet:!0,recordCanvas:!0,collectFonts:!0,blockClass:"rr-block",ignoreClass:"rr-ignore",maskTextClass:"rr-ignore"}))}))}stop(){return t(this,void 0,void 0,(function*(){yield this.ensureInitialized(),dt&&this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null)}))}addEvent(e){return t(this,void 0,void 0,(function*(){yield this.ensureInitialized();const t=this.redactionManager.processEvent(e),n=(new TextEncoder).encode(JSON.stringify(t)).length;this.eventIngestionQueue.push(t),this.queueSizeBytes+=n}))}processRejectedEvents(){return t(this,void 0,void 0,(function*(){if(!this.isProcessingRejectedEvents&&0!==this.rejectedEvents.length){this.isProcessingRejectedEvents=!0;try{const e=tt();dt&&localStorage.setItem("human_behavior_session_id",e),this.api.sendBeaconEvents(this.rejectedEvents,e),this.rejectedEvents=[],this.sessionId=e}catch(e){console.error("Failed to process rejected events:",e)}finally{this.isProcessingRejectedEvents=!1}}}))}flush(){return t(this,void 0,void 0,(function*(){var e;if(!this.isProcessing&&this.initialized){this.isProcessing=!0;try{const t=this.eventIngestionQueue;if(this.eventIngestionQueue=[],this.queueSizeBytes=0,t.length>0){console.log("Flushing events:",t);try{yield this.api.sendEvents(t,this.sessionId,this.endUserId)}catch(n){if(!(null===(e=n.message)||void 0===e?void 0:e.includes("ERROR: Session already completed")))throw n;console.log("Session expired, storing events for retry"),this.rejectedEvents.push(...t),this.processRejectedEvents()}}}finally{this.isProcessing=!1}}}))}setCookie(e,t,n){if(!dt)return;const o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3);const r=`expires=${o.toUTCString()}`;document.cookie=`${e}=${t};${r};path=/;SameSite=Lax`}getCookie(e){if(!dt)return null;const t=e+"=",n=document.cookie.split(";");for(let e=0;e<n.length;e++){let o=n[e];for(;" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return null}redact(e){return t(this,void 0,void 0,(function*(){yield this.ensureInitialized(),dt?this.redactionManager=new at(e):console.warn("Redaction is only available in browser environments")}))}setRedactedFields(e){dt?this.redactionManager.setFieldsToRedact(e):console.warn("Redaction is only available in browser environments")}isRedactionActive(){return this.redactionManager.isActive()}getRedactedFields(){return this.redactionManager.getSelectedFields()}}dt&&(window.HumanBehaviorTracker=lt),"undefined"!=typeof window&&(window.HumanBehaviorTracker=lt),e.HumanBehaviorAPI=st,e.HumanBehaviorTracker=lt,e.MAX_CHUNK_SIZE_BYTES=nt,e.RedactionManager=at,e.default=lt,e.isChunkSizeExceeded=ot,e.redactionManager=ct,e.validateSingleEventSize=rt,Object.defineProperty(e,"__esModule",{value:!0})}));
15
+ ***************************************************************************** */function Ae(e,t,n,o){return new(n||(n=Promise))(function(t,i){function r(e){try{a(o.next(e))}catch(e){i(e)}}function s(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var o;e.done?t(e.value):(o=e.value,o instanceof n?o:new n(function(e){e(o)})).then(r,s)}a((o=o.apply(e,[])).next())})}for(var ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ee="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Te=0;Te<64;Te++)Ee[ke.charCodeAt(Te)]=Te;const Re=new Map;const Me=(e,t,n)=>{if(!e||!Fe(e,t)&&"object"!=typeof e)return;const o=function(e,t){let n=Re.get(e);return n||(n=new Map,Re.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let i=o.indexOf(e);return-1===i&&(i=o.length,o.push(e)),i};function Ne(e,t,n){if(e instanceof Array)return e.map(e=>Ne(e,t,n));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){const t=e.constructor.name,n=function(e){var t,n=new Uint8Array(e),o=n.length,i="";for(t=0;t<o;t+=3)i+=ke[n[t]>>2],i+=ke[(3&n[t])<<4|n[t+1]>>4],i+=ke[(15&n[t+1])<<2|n[t+2]>>6],i+=ke[63&n[t+2]];return o%3==2?i=i.substring(0,i.length-1)+"=":o%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e);return{rr_type:t,base64:n}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[Ne(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[Ne(e.data,t,n),e.width,e.height]}}if(Fe(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:Me(e,t,n)}}return e}const Oe=(e,t,n)=>[...e].map(e=>Ne(e,t,n)),Fe=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(n.find(n=>e instanceof t[n]))};function xe(e,t,n){const o=[];try{const i=D(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(o,...i){return W(this,t,n,!0)||"__context"in this||(this.__context=o),e.apply(this,[o,...i])}});o.push(i)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(e=>e())}}function Le(e,t,n,o,i,r,s){const a=[],c=Object.getOwnPropertyNames(e);for(const r of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(r))try{if("function"!=typeof e[r])continue;const c=D(e,r,function(e){return function(...a){const c=e.apply(this,a);if(Me(c,s,this),!W(this.canvas,o,i,!0)){const e=Oe([...a],s,this),o={type:t,property:r,args:e};n(this.canvas,o)}return c}});a.push(c)}catch(o){const i=L(e,r,{set(e){n(this.canvas,{type:t,property:r,args:[e],setter:!0})}});a.push(i)}return a}var De=null;try{var Ue="undefined"!=typeof module&&"function"==typeof module.require&&module.require("worker_threads")||"function"==typeof __non_webpack_require__&&__non_webpack_require__("worker_threads")||"function"==typeof require&&require("worker_threads");De=Ue.Worker}catch(e){}function Be(e,t,n){var o=function(e){return Buffer.from(e,"base64").toString("utf8")}(e),i=o.indexOf("\n",10)+1,r=o.substring(i)+"";return function(e){return new De(r,Object.assign({},e,{eval:!0}))}}function We(e,t,n){var o=function(e){return atob(e)}(e),i=o.indexOf("\n",10)+1,r=o.substring(i)+"",s=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(s)}var Ge="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0);var Ze,Ve=(Ze="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",Ge?Be(Ze):function(e){var t;return function(n){return t=t||We(e),new Worker(t,n)}}(Ze));class _e{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:o,blockSelector:i,recordCanvas:r,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,r&&"all"===t&&this.initCanvasMutationObserver(n,o,i),r&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,o,i,{dataURLOptions:s})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,n,o,i){const r=xe(t,n,o),s=new Map,a=new Ve;a.onmessage=e=>{const{id:t}=e.data;if(s.set(t,!1),!("base64"in e.data))return;const{base64:n,type:o,width:i,height:r}=e.data;this.mutationCb({id:t,type:H["2D"],commands:[{property:"clearRect",args:[0,0,i,r]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:o}]},0,0]}]})};const c=1e3/e;let l,d=0;const u=e=>{d&&e-d<c||(d=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach(t=>{W(t,n,o,!0)||e.push(t)}),e})().forEach(e=>Ae(this,0,void 0,function*(){var t;const n=this.mirror.getId(e);if(s.get(n))return;if(s.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&(null==n||n.clear(n.COLOR_BUFFER_BIT))}const o=yield createImageBitmap(e);a.postMessage({id:n,bitmap:o,width:e.width,height:e.height,dataURLOptions:i.dataURLOptions},[o])}))),l=requestAnimationFrame(u)};l=requestAnimationFrame(u),this.resetObservers=()=>{r(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=xe(e,t,n),i=function(e,t,n,o){const i=[],r=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of r)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[s])continue;const r=D(t.CanvasRenderingContext2D.prototype,s,function(i){return function(...r){return W(this.canvas,n,o,!0)||setTimeout(()=>{const n=Oe([...r],t,this);e(this.canvas,{type:H["2D"],property:s,args:n})},0),i.apply(this,r)}});i.push(r)}catch(n){const o=L(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:H["2D"],property:s,args:[t],setter:!0})}});i.push(o)}return()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n),r=function(e,t,n,o){const i=[];return i.push(...Le(t.WebGLRenderingContext.prototype,H.WebGL,e,n,o,0,t)),void 0!==t.WebGL2RenderingContext&&i.push(...Le(t.WebGL2RenderingContext.prototype,H.WebGL2,e,n,o,0,t)),()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{o(),i(),r()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const o=n.map(e=>{const t=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(e);i<o.length;i++)t.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(n[o[i]]=e[o[i]])}return n}(e,["type"]);return t}),{type:i}=n[0];this.mutationCb({id:t,type:i,commands:o}),this.pendingCanvasMutations.delete(e)}}class Ke{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new j,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},o=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);const n=Array.from(t.rules||CSSRule);o.push({styleId:e,rules:n.map((e,t)=>({rule:s(e),index:t}))})}n.styleIds.push(e)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}function ze(e){return Object.assign(Object.assign({},e),{timestamp:Date.now()})}let je,Pe,Je,Ye=!1;const He=new a;function Qe(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:o,blockClass:i="rr-block",blockSelector:r=null,ignoreClass:s="rr-ignore",maskTextClass:c="rr-mask",maskTextSelector:l=null,inlineStylesheet:d=!0,maskAllInputs:u,maskInputOptions:h,slimDOMOptions:g,maskInputFn:p,maskTextFn:m,hooks:f,packFn:I,sampling:y={},dataURLOptions:C={},mousemoveWait:v,recordCanvas:b=!1,recordCrossOriginIframes:S=!1,userTriggeredOnInput:w=!1,collectFonts:A=!1,inlineImages:k=!1,plugins:E,keepIframeSrcFn:T=()=>!1,ignoreCSSAttributes:R=new Set([])}=e,O=!S||window.parent===window;let F=!1;if(!O)try{window.parent.document,F=!1}catch(e){F=!0}if(O&&!t)throw new Error("emit function is required");void 0!==v&&void 0===y.mousemove&&(y.mousemove=v),He.reset();const x=!0===u?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==h?h:{password:!0},L=!0===g||"all"===g?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===g,headMetaDescKeywords:"all"===g}:g||{};let D;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let W=0;const G=e=>{for(const t of E||[])t.eventProcessor&&(e=t.eventProcessor(e));return I&&(e=I(e)),e};je=(e,i)=>{var r;if(!(null===(r=re[0])||void 0===r?void 0:r.isFrozen())||e.type===P.FullSnapshot||e.type===P.IncrementalSnapshot&&e.data.source===J.Mutation||re.forEach(e=>e.unfreeze()),O)null==t||t(G(e),i);else if(F){const t={type:"rrweb",event:G(e),isCheckout:i};window.parent.postMessage(t,"*")}if(e.type===P.FullSnapshot)D=e,W=0;else if(e.type===P.IncrementalSnapshot){if(e.data.source===J.Mutation&&e.data.isAttachIframe)return;W++;const t=o&&W>=o,i=n&&e.timestamp-D.timestamp>n;(t||i)&&Pe(!0)}};const Z=e=>{je(ze({type:P.IncrementalSnapshot,data:Object.assign({source:J.Mutation},e)}))},V=e=>je(ze({type:P.IncrementalSnapshot,data:Object.assign({source:J.Scroll},e)})),j=e=>je(ze({type:P.IncrementalSnapshot,data:Object.assign({source:J.CanvasMutation},e)})),Y=new Ke({mutationCb:Z,adoptedStyleSheetCb:e=>je(ze({type:P.IncrementalSnapshot,data:Object.assign({source:J.AdoptedStyleSheet},e)}))}),H=new Se({mirror:He,mutationCb:Z,stylesheetManager:Y,recordCrossOriginIframes:S,wrappedEmit:je});for(const e of E||[])e.getMirror&&e.getMirror({nodeMirror:He,crossOriginIframeMirror:H.crossOriginIframeMirror,crossOriginIframeStyleMirror:H.crossOriginIframeStyleMirror});Je=new _e({recordCanvas:b,mutationCb:j,win:window,blockClass:i,blockSelector:r,mirror:He,sampling:y.canvas,dataURLOptions:C});const Q=new we({mutationCb:Z,scrollCb:V,bypassOptions:{blockClass:i,blockSelector:r,maskTextClass:c,maskTextSelector:l,inlineStylesheet:d,maskInputOptions:x,dataURLOptions:C,maskTextFn:m,maskInputFn:p,recordCanvas:b,inlineImages:k,sampling:y,slimDOMOptions:L,iframeManager:H,stylesheetManager:Y,canvasManager:Je,keepIframeSrcFn:T},mirror:He});Pe=(e=!1)=>{var t,n,o,s,u,h;je(ze({type:P.Meta,data:{href:window.location.href,width:B(),height:U()}}),e),Y.reset(),re.forEach(e=>e.lock());const g=function(e,t){var n=t||{},o=n.mirror,i=void 0===o?new a:o,r=n.blockClass,s=void 0===r?"rr-block":r,c=n.blockSelector,l=void 0===c?null:c,d=n.maskTextClass,u=void 0===d?"rr-mask":d,h=n.maskTextSelector,g=void 0===h?null:h,p=n.inlineStylesheet,m=void 0===p||p,f=n.inlineImages,I=void 0!==f&&f,y=n.recordCanvas,C=void 0!==y&&y,v=n.maskAllInputs,b=void 0!==v&&v,S=n.maskTextFn,w=n.maskInputFn,A=n.slimDOM,k=void 0!==A&&A,E=n.dataURLOptions,T=n.preserveWhiteSpace,R=n.onSerialize,N=n.onIframeLoad,O=n.iframeLoadTimeout,F=n.onStylesheetLoad,x=n.stylesheetLoadTimeout,L=n.keepIframeSrcFn;return M(e,{doc:e,mirror:i,blockClass:s,blockSelector:l,maskTextClass:u,maskTextSelector:g,skipChild:!1,inlineStylesheet:m,maskInputOptions:!0===b?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===b?{password:!0}:b,maskTextFn:S,maskInputFn:w,slimDOMOptions:!0===k||"all"===k?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===k,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===k?{}:k,dataURLOptions:E,inlineImages:I,recordCanvas:C,preserveWhiteSpace:T,onSerialize:R,onIframeLoad:N,iframeLoadTimeout:O,onStylesheetLoad:F,stylesheetLoadTimeout:x,keepIframeSrcFn:void 0===L?function(){return!1}:L,newlyAddedElement:!1})}(document,{mirror:He,blockClass:i,blockSelector:r,maskTextClass:c,maskTextSelector:l,inlineStylesheet:d,maskAllInputs:x,maskTextFn:m,slimDOM:L,dataURLOptions:C,recordCanvas:b,inlineImages:k,onSerialize:e=>{_(e,He)&&H.addIframe(e),K(e,He)&&Y.trackLinkElement(e),z(e)&&Q.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{H.attachIframe(e,t),Q.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{Y.attachLinkElement(e,t)},keepIframeSrcFn:T});if(!g)return console.warn("Failed to snapshot the document");je(ze({type:P.FullSnapshot,data:{node:g,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(n=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(u=null===(s=null===document||void 0===document?void 0:document.body)||void 0===s?void 0:s.parentElement)||void 0===u?void 0:u.scrollTop)||(null===(h=null===document||void 0===document?void 0:document.body)||void 0===h?void 0:h.scrollTop)||0}}})),re.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Y.adoptStyleSheets(document.adoptedStyleSheets,He.getId(document))};try{const e=[];e.push(N("DOMContentLoaded",()=>{je(ze({type:P.DomContentLoaded,data:{}}))}));const t=e=>{var t;return ve({mutationCb:Z,mousemoveCb:(e,t)=>je(ze({type:P.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>je(ze({type:P.IncrementalSnapshot,data:Object.assign({source:J.MouseInteraction},e)})),scrollCb:V,viewportResizeCb:e=>je(ze({type:P.IncrementalSnapshot,data:Object.assign({source:J.ViewportResize},e)})),inputCb:e=>je(ze({type:P.IncrementalSnapshot,data:Object.assign({source:J.Input},e)})),mediaInteractionCb:e=>je(ze({type:P.IncrementalSnapshot,data:Object.assign({source:J.MediaInteraction},e)})),styleSheetRuleCb:e=>je(ze({type:P.IncrementalSnapshot,data:Object.assign({source:J.StyleSheetRule},e)})),styleDeclarationCb:e=>je(ze({type:P.IncrementalSnapshot,data:Object.assign({source:J.StyleDeclaration},e)})),canvasMutationCb:j,fontCb:e=>je(ze({type:P.IncrementalSnapshot,data:Object.assign({source:J.Font},e)})),selectionCb:e=>{je(ze({type:P.IncrementalSnapshot,data:Object.assign({source:J.Selection},e)}))},blockClass:i,ignoreClass:s,maskTextClass:c,maskTextSelector:l,maskInputOptions:x,inlineStylesheet:d,sampling:y,recordCanvas:b,inlineImages:k,userTriggeredOnInput:w,collectFonts:A,doc:e,maskInputFn:p,maskTextFn:m,keepIframeSrcFn:T,blockSelector:r,slimDOMOptions:L,dataURLOptions:C,mirror:He,iframeManager:H,stylesheetManager:Y,shadowDomManager:Q,canvasManager:Je,ignoreCSSAttributes:R,plugins:(null===(t=null==E?void 0:E.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>je(ze({type:P.Plugin,data:{plugin:e.name,payload:t}}))})))||[]},f)};H.addLoadListener(n=>{e.push(t(n.contentDocument))});const n=()=>{Pe(),e.push(t(document)),Ye=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():e.push(N("load",()=>{je(ze({type:P.Load,data:{}})),n()},window)),()=>{e.forEach(e=>e()),Ye=!1}}catch(e){console.warn(e)}}Qe.addCustomEvent=(e,t)=>{if(!Ye)throw new Error("please add custom event after start recording");je(ze({type:P.Custom,data:{tag:e,payload:t}}))},Qe.freezePage=()=>{re.forEach(e=>e.freeze())},Qe.takeFullSnapshot=e=>{if(!Ye)throw new Error("please take full snapshot after start recording");Pe(e)},Qe.mirror=He;const qe=[];for(let e=0;e<256;++e)qe.push((e+256).toString(16).slice(1));let Xe;const $e=new Uint8Array(16);const et={};function tt(e,t,n){let o;{const e=Date.now(),i=function(){if(!Xe){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Xe=crypto.getRandomValues.bind(crypto)}return Xe($e)}();!function(e,t,n){e.msecs??=-1/0,e.nsecs??=0,t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0);e.node||(e.node=n.slice(10,16),e.node[0]|=1,e.clockseq=16383&(n[8]<<8|n[9]));e.msecs=t}(et,e,i),o=function(e,t,n,o,i,r,s=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(r){if(s<0||s+16>r.length)throw new RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`)}else r=new Uint8Array(16),s=0;t??=Date.now(),n??=0,o??=16383&(e[8]<<8|e[9]),i??=e.slice(10,16);const a=(1e4*(268435455&(t+=122192928e5))+n)%4294967296;r[s++]=a>>>24&255,r[s++]=a>>>16&255,r[s++]=a>>>8&255,r[s++]=255&a;const c=t/4294967296*1e4&268435455;r[s++]=c>>>8&255,r[s++]=255&c,r[s++]=c>>>24&15|16,r[s++]=c>>>16&255,r[s++]=o>>>8|128,r[s++]=255&o;for(let e=0;e<6;++e)r[s++]=i[e];return r}(i,et.msecs,et.nsecs,et.clockseq,et.node,t,n)}return t??function(e,t=0){return(qe[e[t+0]]+qe[e[t+1]]+qe[e[t+2]]+qe[e[t+3]]+"-"+qe[e[t+4]]+qe[e[t+5]]+"-"+qe[e[t+6]]+qe[e[t+7]]+"-"+qe[e[t+8]]+qe[e[t+9]]+"-"+qe[e[t+10]]+qe[e[t+11]]+qe[e[t+12]]+qe[e[t+13]]+qe[e[t+14]]+qe[e[t+15]]).toLowerCase()}(o)}var nt;e.LogLevel=void 0,(nt=e.LogLevel||(e.LogLevel={}))[nt.NONE=0]="NONE",nt[nt.ERROR=1]="ERROR",nt[nt.WARN=2]="WARN",nt[nt.INFO=3]="INFO",nt[nt.DEBUG=4]="DEBUG";const ot=new class{constructor(t){this.config={level:e.LogLevel.ERROR,enableConsole:!0,enableStorage:!1},this.isBrowser="undefined"!=typeof window,t&&(this.config=Object.assign(Object.assign({},this.config),t))}setConfig(e){this.config=Object.assign(Object.assign({},this.config),e)}shouldLog(e){return e<=this.config.level}formatMessage(e,t,...n){return`[HumanBehavior ${e}] ${(new Date).toISOString()}: ${t}`}error(t,...n){if(!this.shouldLog(e.LogLevel.ERROR))return;const o=this.formatMessage("ERROR",t);this.config.enableConsole&&console.error(o,...n),this.config.enableStorage&&this.isBrowser&&this.logToStorage(o,n)}warn(t,...n){if(!this.shouldLog(e.LogLevel.WARN))return;const o=this.formatMessage("WARN",t);this.config.enableConsole&&console.warn(o,...n),this.config.enableStorage&&this.isBrowser&&this.logToStorage(o,n)}info(t,...n){if(!this.shouldLog(e.LogLevel.INFO))return;const o=this.formatMessage("INFO",t);this.config.enableConsole&&console.log(o,...n),this.config.enableStorage&&this.isBrowser&&this.logToStorage(o,n)}debug(t,...n){if(!this.shouldLog(e.LogLevel.DEBUG))return;const o=this.formatMessage("DEBUG",t);this.config.enableConsole&&console.log(o,...n),this.config.enableStorage&&this.isBrowser&&this.logToStorage(o,n)}logToStorage(e,t){try{const n=JSON.parse(localStorage.getItem("human_behavior_logs")||"[]"),o={message:e,args:t.length>0?t:void 0,timestamp:Date.now()};n.push(o),n.length>1e3&&n.splice(0,n.length-1e3),localStorage.setItem("human_behavior_logs",JSON.stringify(n))}catch(e){}}getLogs(){if(!this.isBrowser)return[];try{return JSON.parse(localStorage.getItem("human_behavior_logs")||"[]")}catch(e){return[]}}clearLogs(){this.isBrowser&&localStorage.removeItem("human_behavior_logs")}},it=(e,...t)=>ot.error(e,...t),rt=(e,...t)=>ot.warn(e,...t),st=(e,...t)=>ot.info(e,...t),at=(e,...t)=>ot.debug(e,...t),ct=10485760;function lt(e,t,n){return(new TextEncoder).encode(JSON.stringify({sessionId:n,events:[...e,t]})).length>ct}function dt(e,t){const n=(new TextEncoder).encode(JSON.stringify({sessionId:t,events:[e]})).length;if(n>ct)throw new Error(`Single event size (${n} bytes) exceeds maximum chunk size (10485760 bytes)`)}class ut{constructor({apiKey:e,ingestionUrl:t}){this.apiKey=e,this.baseUrl=t}init(e,n){return t(this,void 0,void 0,function*(){let t=null,o=null;"undefined"!=typeof window&&(t=window.location.href,o=document.referrer);const i=yield fetch(`${this.baseUrl}/api/ingestion/init`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,Referer:o||""},body:JSON.stringify({sessionId:e,endUserId:n,entryURL:t,referrer:o})});if(!i.ok)throw new Error(`Failed to initialize ingestion: ${i.statusText}`);const r=yield i.json();return{sessionId:r.sessionId,endUserId:r.endUserId}})}sendEvents(e,n,o){return t(this,void 0,void 0,function*(){const t=yield fetch(`${this.baseUrl}/api/ingestion/events`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({sessionId:n,events:e,endUserId:o})});if(!t.ok)throw new Error(`Failed to send events: ${t.statusText}`)})}sendEventsChunked(e,n){return t(this,void 0,void 0,function*(){try{const t=[];let o=[];for(const i of e)if(lt(o,i,n)){if(o.length>0){const e=yield fetch(`${this.baseUrl}/api/ingestion/events`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({sessionId:n,events:o})});if(!e.ok)throw new Error(`Failed to send events: ${e.statusText}`);t.push(yield e.json()),o=[]}dt(i,n),o=[i]}else o.push(i);if(o.length>0){const e=yield fetch(`${this.baseUrl}/api/ingestion/events`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({sessionId:n,events:o})});if(!e.ok)throw new Error(`Failed to send events: ${e.statusText}`);t.push(yield e.json())}return t.flat()}catch(e){throw it("Error sending events:",e),e}})}sendUserData(e,n,o){return t(this,void 0,void 0,function*(){try{const t=yield fetch(`${this.baseUrl}/api/ingestion/user`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({userId:e,userAttributes:n,sessionId:o})});if(!t.ok)throw new Error(`Failed to send user data: ${t.statusText} with API key: ${this.apiKey}`);return yield t.json()}catch(e){throw it("Error sending user data:",e),e}})}sendUserAuth(e,n,o,i){return t(this,void 0,void 0,function*(){try{const t=yield fetch(`${this.baseUrl}/api/ingestion/user/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({userId:e,userAttributes:n,sessionId:o,authFields:i})});if(!t.ok)throw new Error(`Failed to authenticate user: ${t.statusText} with API key: ${this.apiKey}`);return yield t.json()}catch(e){throw it("Error authenticating user:",e),e}})}sendBeaconEvents(e,t){const n=new URLSearchParams;n.append("events",encodeURIComponent(JSON.stringify(e))),n.append("sessionId",encodeURIComponent(t)),n.append("timestamp",encodeURIComponent(Date.now().toString())),n.append("apiKey",encodeURIComponent(this.apiKey)),navigator.sendBeacon(`${this.baseUrl}/api/ingestion/events`,n)}}const ht="undefined"!=typeof window;class gt{constructor(e){this.redactedText="[REDACTED]",this.userSelectedFields=new Set,this.excludeSelectors=['[data-no-redact="true"]',".human-behavior-no-redact"],(null==e?void 0:e.redactedText)&&(this.redactedText=e.redactedText),(null==e?void 0:e.excludeSelectors)&&(this.excludeSelectors=[...this.excludeSelectors,...e.excludeSelectors]),(null==e?void 0:e.userFields)&&this.setFieldsToRedact(e.userFields)}setFieldsToRedact(e){this.userSelectedFields.clear(),e.forEach(e=>this.userSelectedFields.add(e)),e.length>0?(at(`Redaction: Active for ${e.length} field(s):`,e),e.forEach(e=>{const t=document.querySelectorAll(e);at(`Redaction: Found ${t.length} element(s) for selector '${e}'`),t.forEach((t,n)=>{at(`Redaction: Element ${n} for '${e}':`,t)})})):at("Redaction: Disabled - no fields selected")}isActive(){return this.userSelectedFields.size>0}getSelectedFields(){return Array.from(this.userSelectedFields)}processEvent(e){if(0===this.userSelectedFields.size)return e;const t=JSON.parse(JSON.stringify(e));if(3===t.type)if(5===t.data.source){this.isFieldSelected(t.data)&&(at("Redaction: Processing input event for redaction"),this.redactInputEvent(t.data))}else 0===t.data.source?this.redactDOMEvent(t.data):2===t.data.source&&this.redactMouseEvent(t.data);else 2===t.type&&this.redactFullSnapshot(t.data);return t}redactInputEvent(e){if(!this.isFieldSelected(e))return;at("Redaction: Redacting input event with text:",e.text);["text","value","content","data","input","textContent"].forEach(t=>{void 0!==e[t]&&"string"==typeof e[t]&&(e[t]=this.redactedText,at(`Redaction: Redacted property '${t}'`))}),Object.keys(e).forEach(t=>{"string"==typeof e[t]&&e[t].length>0&&(e[t]=this.redactedText,at(`Redaction: Redacted additional property '${t}'`))}),e.attributes&&"object"==typeof e.attributes&&e.attributes.value&&"string"==typeof e.attributes.value&&(e.attributes.value=this.redactedText,at("Redaction: Redacted nested value attribute")),at("Redaction: Input event redaction complete")}redactDOMEvent(e){e.texts&&Array.isArray(e.texts)&&e.texts.forEach(e=>{e.text&&"string"==typeof e.text&&this.shouldRedactDOMChange(e)&&(e.text=this.redactedText)}),e.attributes&&Array.isArray(e.attributes)&&e.attributes.forEach(e=>{e.attributes&&e.attributes.value&&"string"==typeof e.attributes.value&&this.shouldRedactDOMChange(e)&&(e.attributes.value=this.redactedText)}),e.adds&&Array.isArray(e.adds)&&e.adds.forEach(e=>{e.node&&e.node.textContent&&"string"==typeof e.node.textContent&&this.shouldRedactDOMChange(e)&&(e.node.textContent=this.redactedText)})}shouldRedactDOMChange(e){if(!ht)return!1;try{const t=e.id;if(void 0!==t){let e=document.querySelector(`[data-rrweb-id="${t}"]`);if(e)return this.shouldRedactElement(e)}const n=e.nodeId;if(void 0!==n){const e=document.querySelector(`[data-rrweb-id="${n}"]`);if(e)return this.shouldRedactElement(e)}return!1}catch(e){return rt("Error checking if DOM change should be redacted:",e),!1}}redactMouseEvent(e){e.text&&"string"==typeof e.text&&this.isFieldSelected(e)&&(e.text=this.redactedText)}redactFullSnapshot(e){e.node&&2===e.node.type&&this.redactNode(e.node)}redactNode(e){e&&(2!==e.type||!e.tagName||"input"!==e.tagName.toLowerCase()&&"textarea"!==e.tagName.toLowerCase()||this.shouldRedactNode(e)&&(e.attributes&&e.attributes.value&&(e.attributes.value=this.redactedText),e.textContent&&(e.textContent=this.redactedText)),e.childNodes&&Array.isArray(e.childNodes)&&e.childNodes.forEach(e=>{this.redactNode(e)}))}shouldRedactNode(e){if(!e.attributes)return!1;for(const t of this.userSelectedFields)if(this.selectorMatchesNode(t,e))return!0;return!1}selectorMatchesNode(e,t){if(!t.attributes)return!1;try{const n=document.createElement(t.tagName||"div");return t.attributes&&Object.keys(t.attributes).forEach(e=>{n.setAttribute(e,t.attributes[e])}),n.matches(e)}catch(n){return this.basicSelectorMatch(e,t)}}basicSelectorMatch(e,t){if(!t.attributes)return!1;if(e.includes("input[type=")){const n=e.match(/input\[type="([^"]+)"\]/);if(n&&"input"===t.tagName&&t.attributes.type===n[1])return!0}if(e.startsWith("#")){const n=e.substring(1);return t.attributes.id===n}if(e.startsWith(".")){const n=e.substring(1);return t.attributes.class&&t.attributes.class.includes(n)}return!e.includes("[")&&!e.includes(".")&&(t.tagName&&t.tagName.toLowerCase()===e.toLowerCase())}isFieldSelected(e){if(!ht)return!1;try{if(5===e.source){const t=e.id;if(void 0!==t){let n=document.querySelector(`[data-rrweb-id="${t}"]`);if(n)return this.shouldRedactElement(n);if(void 0!==e.nodeId&&(n=document.querySelector(`[data-rrweb-id="${e.nodeId}"]`),n))return this.shouldRedactElement(n);for(const e of this.userSelectedFields){const t=document.querySelectorAll(e);if(t.length>0)for(const n of t)if(n===document.activeElement)return at("Redaction: Found focused element matching selector:",e),!0}const o=document.activeElement;return!(!o||!this.shouldRedactElement(o))&&(at("Redaction: Active element should be redacted"),!0)}}const t=e.id;if(void 0!==t){let e=document.querySelector(`[data-rrweb-id="${t}"]`);if(e)return this.shouldRedactElement(e)}const n=e.nodeId;if(void 0!==n){const e=document.querySelector(`[data-rrweb-id="${n}"]`);if(e)return this.shouldRedactElement(e)}if(e.target&&e.target.id){const t=document.querySelector(`[data-rrweb-id="${e.target.id}"]`);if(t)return this.shouldRedactElement(t)}return!1}catch(e){return rt("Error checking if field should be redacted:",e),!1}}shouldRedactElement(e){for(const t of this.excludeSelectors)if(e.matches(t)||e.closest(t))return!1;for(const t of this.userSelectedFields)if(e.matches(t))return!0;return!1}getOriginalValue(e){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return e.value}isElementRedacted(e){return this.shouldRedactElement(e)}}const pt=new gt,mt="undefined"!=typeof window;class ft{static init(e,t){if(mt&&window.__humanBehaviorGlobalTracker)return at("Tracker already initialized, returning existing instance"),window.__humanBehaviorGlobalTracker;(null==t?void 0:t.logLevel)&&this.configureLogging({level:t.logLevel});const n=new ft(e,null==t?void 0:t.ingestionUrl);if((null==t?void 0:t.redactFields)&&n.setRedactedFields(t.redactFields),mt){const e=n.api.baseUrl+"/api/ingestion/health";fetch(e,{method:"HEAD"}).then(()=>at("Connection test successful")).catch(e=>{rt("Connection test failed - ad blocker may be active:",e.message),n._connectionBlocked=!0})}return n.start(),n}constructor(e,t){if(this.eventIngestionQueue=[],this.queueSizeBytes=0,this.rejectedEvents=[],this.isProcessingRejectedEvents=!1,this.userProperties={},this.isProcessing=!1,this.flushInterval=null,this.FLUSH_INTERVAL_MS=5e3,this.endUserId=null,this.initialized=!1,this.initializationPromise=null,this.originalConsole=null,this.consoleTrackingEnabled=!1,this.navigationTrackingEnabled=!1,this.currentUrl="",this.previousUrl="",this.originalPushState=null,this.originalReplaceState=null,this.navigationListeners=[],this._connectionBlocked=!1,!e)throw new Error("Human Behavior API Key is required");if(this.api=new ut({apiKey:e,ingestionUrl:t||"http://3.137.217.33:3000"}),this.apiKey=e,this.redactionManager=new gt,mt){const e=localStorage.getItem("human_behavior_session_id"),t=localStorage.getItem("human_behavior_last_activity"),n=Date.now()-18e5;e&&t&&parseInt(t)>n?(this.sessionId=e,at(`Reusing existing session: ${this.sessionId}`)):(this.sessionId=tt(),at(`Creating new session: ${this.sessionId}`),localStorage.setItem("human_behavior_session_id",this.sessionId)),this.currentUrl=window.location.href,window.__humanBehaviorGlobalTracker=this}else this.sessionId=tt();this.initializationPromise=this.init()}init(){return t(this,void 0,void 0,function*(){try{const e=this.getCookie(`human_behavior_end_user_id_${this.apiKey}`);at(`Initializing with sessionId: ${this.sessionId}, userId: ${e}`);const{sessionId:t,endUserId:n}=yield this.api.init(this.sessionId,e);t!==this.sessionId&&(at(`Server returned different sessionId: ${t} (client had: ${this.sessionId})`),this.sessionId=t,mt&&localStorage.setItem("human_behavior_session_id",this.sessionId)),this.endUserId=n,this.setCookie(`human_behavior_end_user_id_${this.apiKey}`,n,365),mt?(this.setupPageUnloadHandler(),this.setupNavigationTracking(),this.processRejectedEvents()):rt("HumanBehaviorTracker initialized in a non-browser environment. Session tracking is disabled."),this.initialized=!0,st(`HumanBehaviorTracker initialized with sessionId: ${this.sessionId}, endUserId: ${n}`)}catch(e){throw it("Failed to initialize HumanBehaviorTracker:",e),e}})}ensureInitialized(){return t(this,void 0,void 0,function*(){if(!this.initializationPromise)throw new Error("HumanBehaviorTracker initialization failed");yield this.initializationPromise})}setupNavigationTracking(){if(!mt||this.navigationTrackingEnabled)return;this.navigationTrackingEnabled=!0,at("Setting up navigation tracking"),this.originalPushState=history.pushState,this.originalReplaceState=history.replaceState,history.pushState=(...e)=>{this.previousUrl=this.currentUrl,this.currentUrl=window.location.href,this.originalPushState.apply(history,e),this.trackNavigationEvent("pushState",this.previousUrl,this.currentUrl)},history.replaceState=(...e)=>{this.previousUrl=this.currentUrl,this.currentUrl=window.location.href,this.originalReplaceState.apply(history,e),this.trackNavigationEvent("replaceState",this.previousUrl,this.currentUrl)};const e=()=>{this.previousUrl=this.currentUrl,this.currentUrl=window.location.href,this.trackNavigationEvent("popstate",this.previousUrl,this.currentUrl)};window.addEventListener("popstate",e),this.navigationListeners.push(()=>{window.removeEventListener("popstate",e)});const t=()=>{this.previousUrl=this.currentUrl,this.currentUrl=window.location.href,this.trackNavigationEvent("hashchange",this.previousUrl,this.currentUrl)};window.addEventListener("hashchange",t),this.navigationListeners.push(()=>{window.removeEventListener("hashchange",t)}),this.trackNavigationEvent("pageLoad","",this.currentUrl)}trackNavigationEvent(e,n,o){return t(this,void 0,void 0,function*(){if(this.initialized)try{const t={type:e,from:n,to:o,timestamp:(new Date).toISOString(),pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,referrer:document.referrer};yield this.addEvent({type:5,data:{payload:Object.assign({eventType:"navigation"},t)},timestamp:Date.now()}),at(`Navigation tracked: ${e} from ${n} to ${o}`)}catch(e){it("Failed to track navigation event:",e)}})}trackPageView(e){return t(this,void 0,void 0,function*(){if(this.initialized)try{const t={url:e||window.location.href,pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,referrer:document.referrer,timestamp:(new Date).toISOString()};yield this.addEvent({type:5,data:{payload:Object.assign({eventType:"pageview"},t)},timestamp:Date.now()}),at(`Pageview tracked: ${t.url}`)}catch(e){it("Failed to track pageview event:",e)}})}customEvent(e,n){return t(this,void 0,void 0,function*(){if(this.initialized)try{const t={eventName:e,properties:n||{},timestamp:(new Date).toISOString(),url:window.location.href,pathname:window.location.pathname};yield this.addEvent({type:5,data:{payload:Object.assign({eventType:"custom"},t)},timestamp:Date.now()}),at(`Custom event tracked: ${e}`,n)}catch(e){it("Failed to track custom event:",e)}})}cleanupNavigationTracking(){this.navigationTrackingEnabled&&(this.originalPushState&&(history.pushState=this.originalPushState),this.originalReplaceState&&(history.replaceState=this.originalReplaceState),this.navigationListeners.forEach(e=>e()),this.navigationListeners=[],this.navigationTrackingEnabled=!1,at("Navigation tracking cleaned up"))}static logToStorage(e){st(e)}static configureLogging(e){ot.setConfig({level:{none:0,error:1,warn:2,info:3,debug:4}[e.level||"error"],enableConsole:!1!==e.enableConsole,enableStorage:e.enableStorage||!1})}enableConsoleTracking(){mt&&!this.consoleTrackingEnabled&&(this.originalConsole={log:console.log,warn:console.warn,error:console.error},console.log=(...e)=>{this.trackConsoleEvent("log",e),this.originalConsole.log(...e)},console.warn=(...e)=>{this.trackConsoleEvent("warn",e),this.originalConsole.warn(...e)},console.error=(...e)=>{this.trackConsoleEvent("error",e),this.originalConsole.error(...e)},this.consoleTrackingEnabled=!0,at("Console tracking enabled"))}disableConsoleTracking(){mt&&this.consoleTrackingEnabled&&(this.originalConsole&&(console.log=this.originalConsole.log,console.warn=this.originalConsole.warn,console.error=this.originalConsole.error),this.consoleTrackingEnabled=!1,at("Console tracking disabled"))}trackConsoleEvent(e,t){if(this.initialized)try{const n={level:e,message:t.map(e=>"object"==typeof e?JSON.stringify(e):String(e)).join(" "),timestamp:(new Date).toISOString(),url:window.location.href};this.addEvent({type:5,data:{payload:Object.assign({eventType:"console"},n)},timestamp:Date.now()}).catch(e=>{it("Failed to track console event:",e)})}catch(e){it("Error in trackConsoleEvent:",e)}}setupPageUnloadHandler(){if(!mt)return;at("Setting up page unload handler"),window.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&(at("Page hidden - sending pending events"),this.api.sendBeaconEvents(this.eventIngestionQueue,this.sessionId))}),window.addEventListener("beforeunload",()=>{this.api.sendBeaconEvents(this.eventIngestionQueue,this.sessionId)});const e=()=>{localStorage.setItem("human_behavior_last_activity",Date.now().toString())};window.addEventListener("click",e),window.addEventListener("keydown",e),window.addEventListener("scroll",e),window.addEventListener("mousemove",e)}viewLogs(){try{const e=ot.getLogs();console.log("HumanBehavior Logs:",e),ot.clearLogs()}catch(e){it("Failed to read logs:",e)}}addUserInfo(e){return t(this,void 0,void 0,function*(){if(yield this.ensureInitialized(),!this.endUserId)throw new Error("Cannot add user info before tracker initialization");this.userProperties=e,yield this.api.sendUserData(this.endUserId,e,this.sessionId)})}auth(e){return t(this,void 0,void 0,function*(){if(yield this.ensureInitialized(),!this.endUserId)throw new Error("Cannot authenticate before tracker initialization");if(!this.userProperties||0===Object.keys(this.userProperties).length)throw new Error("No user info available. Call addUserInfo() first.");yield this.api.sendUserAuth(this.endUserId,this.userProperties,this.sessionId,e)})}start(){return t(this,void 0,void 0,function*(){yield this.ensureInitialized(),mt&&(this.flushInterval=window.setInterval(()=>{this.flush()},this.FLUSH_INTERVAL_MS),this.enableConsoleTracking(),Qe({emit:e=>{this.addEvent(e)},inlineStylesheet:!0,recordCanvas:!0,collectFonts:!0,blockClass:"rr-block",ignoreClass:"rr-ignore",maskTextClass:"rr-ignore"}))})}stop(){return t(this,void 0,void 0,function*(){yield this.ensureInitialized(),mt&&(this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null),this.disableConsoleTracking(),this.cleanupNavigationTracking())})}addEvent(e){return t(this,void 0,void 0,function*(){yield this.ensureInitialized();const t=this.redactionManager.processEvent(e),n=(new TextEncoder).encode(JSON.stringify(t)).length;this.eventIngestionQueue.push(t),this.queueSizeBytes+=n})}processRejectedEvents(){return t(this,void 0,void 0,function*(){if(!this.isProcessingRejectedEvents&&0!==this.rejectedEvents.length){this.isProcessingRejectedEvents=!0;try{const e=tt();mt&&localStorage.setItem("human_behavior_session_id",e),this.api.sendBeaconEvents(this.rejectedEvents,e),this.rejectedEvents=[],this.sessionId=e}catch(e){it("Failed to process rejected events:",e)}finally{this.isProcessingRejectedEvents=!1}}})}flush(){return t(this,void 0,void 0,function*(){var e,t,n,o;if(!this.isProcessing&&this.initialized){this.isProcessing=!0;try{const i=this.eventIngestionQueue;if(this.eventIngestionQueue=[],this.queueSizeBytes=0,i.length>0){at("Flushing events:",i);try{yield this.api.sendEvents(i,this.sessionId,this.endUserId)}catch(r){if(null===(e=r.message)||void 0===e?void 0:e.includes("ERROR: Session already completed"))st("Session expired, storing events for retry"),this.rejectedEvents.push(...i),this.processRejectedEvents();else{if(!((null===(t=r.message)||void 0===t?void 0:t.includes("ERR_BLOCKED_BY_CLIENT"))||(null===(n=r.message)||void 0===n?void 0:n.includes("Failed to fetch"))||(null===(o=r.message)||void 0===o?void 0:o.includes("NetworkError"))))throw r;rt("Request blocked by ad blocker or network issue, storing events for retry"),this.rejectedEvents.push(...i)}}}}finally{this.isProcessing=!1}}})}setCookie(e,t,n){if(!mt)return;const o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3);const i=`expires=${o.toUTCString()}`;document.cookie=`${e}=${t};${i};path=/;SameSite=Lax`}getCookie(e){if(!mt)return null;const t=e+"=",n=document.cookie.split(";");for(let e=0;e<n.length;e++){let o=n[e];for(;" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return null}redact(e){return t(this,void 0,void 0,function*(){yield this.ensureInitialized(),mt?this.redactionManager=new gt(e):rt("Redaction is only available in browser environments")})}setRedactedFields(e){mt?this.redactionManager.setFieldsToRedact(e):rt("Redaction is only available in browser environments")}isRedactionActive(){return this.redactionManager.isActive()}getRedactedFields(){return this.redactionManager.getSelectedFields()}getSessionId(){return this.sessionId}getCurrentUrl(){return this.currentUrl}testConnection(){return t(this,void 0,void 0,function*(){try{return yield this.api.init(this.sessionId,this.endUserId),{success:!0}}catch(e){return{success:!1,error:e.message||"Unknown error"}}})}getConnectionStatus(){const e=[];let t=!1;return this.rejectedEvents.length>0&&(t=!0,e.push("Some requests may be blocked by ad blockers")),this._connectionBlocked&&(t=!0,e.push("Initial connection test failed - ad blocker may be active")),"undefined"==typeof window&&e.push("Not running in browser environment"),void 0===navigator.sendBeacon&&e.push("sendBeacon not available, using fetch fallback"),{blocked:t,recommendations:e}}}mt&&(window.HumanBehaviorTracker=ft),"undefined"!=typeof window&&(window.HumanBehaviorTracker=ft),e.HumanBehaviorAPI=ut,e.HumanBehaviorTracker=ft,e.MAX_CHUNK_SIZE_BYTES=ct,e.RedactionManager=gt,e.default=ft,e.isChunkSizeExceeded=lt,e.logDebug=at,e.logError=it,e.logInfo=st,e.logWarn=rt,e.logger=ot,e.redactionManager=pt,e.validateSingleEventSize=dt,Object.defineProperty(e,"__esModule",{value:!0})});
16
16
  //# sourceMappingURL=index.min.js.map