webrec-sdk 1.0.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.
@@ -0,0 +1,17 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={endpoint:"https://api.webrec.app/v1",maskAllInputs:!0,blockClass:"wr-block",ignoreClass:"wr-ignore",blockSelector:"[data-wr-block]",ignoreSelector:"[data-wr-ignore]",captureNetwork:!0,captureConsole:!0,captureErrors:!0,recordCanvas:!1,collectFonts:!0,batchSize:50,flushInterval:5e3,maxQueueSize:2e3,maxRetries:3,sessionTimeout:18e5,sampleRate:100,minTimeOnPage:0,minSessionDuration:0,ignoreUrls:[],allowUrls:[],respectDoNotTrack:!0,startDelay:0,debug:!1,sampling:{mousemove:50,scroll:150,input:"last"},privacy:{maskInputs:!0,maskTextContent:!1,blockSelectors:[],ignoreSelectors:[]}};var e;function n(t){var e=null==t?void 0:t.host;return Boolean((null==e?void 0:e.shadowRoot)===t)}function i(t){return"[object ShadowRoot]"===Object.prototype.toString.call(t)}function r(t){try{var e=t.rules||t.cssRules;return e?((n=Array.from(e).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(t){return null}var n}function s(t){var e=t.cssText;if(function(t){return"styleSheet"in t}(t))try{e=r(t.styleSheet)||e}catch(t){}return e}!function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"}(e||(e={}));var o=function(){function t(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return t.prototype.getId=function(t){var e;if(!t)return-1;var n=null===(e=this.getMeta(t))||void 0===e?void 0:e.id;return null!=n?n:-1},t.prototype.getNode=function(t){return this.idNodeMap.get(t)||null},t.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},t.prototype.getMeta=function(t){return this.nodeMetaMap.get(t)||null},t.prototype.removeNodeFromMap=function(t){var e=this,n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(function(t){return e.removeNodeFromMap(t)})},t.prototype.has=function(t){return this.idNodeMap.has(t)},t.prototype.hasNode=function(t){return this.nodeMetaMap.has(t)},t.prototype.add=function(t,e){var n=e.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,e)},t.prototype.replace=function(t,e){var n=this.getNode(t);if(n){var i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(e,i)}this.idNodeMap.set(t,e)},t.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},t}();function a(t){var e=t.maskInputOptions,n=t.tagName,i=t.type,r=t.value,s=t.maskInputFn,o=r||"";return(e[n.toLowerCase()]||e[i])&&(o=s?s(o):"*".repeat(o.length)),o}var l="__rrweb_original__";var c,d,h=1,u=new RegExp("[^a-z0-9-_:]");function p(){return h++}var g=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,m=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,f=/^(data:)([^,]*),(.*)/i;function y(t,e){return(t||"").replace(g,function(t,n,i,r,s,o){var a,l=i||s||o,c=n||r||"";if(!l)return t;if(!m.test(l))return"url(".concat(c).concat(l).concat(c,")");if(f.test(l))return"url(".concat(c).concat(l).concat(c,")");if("/"===l[0])return"url(".concat(c).concat((a=e,(a.indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+l)).concat(c,")");var d=e.split("/"),h=l.split("/");d.pop();for(var u=0,p=h;u<p.length;u++){var g=p[u];"."!==g&&(".."===g?d.pop():d.push(g))}return"url(".concat(c).concat(d.join("/")).concat(c,")")})}var b=/^[^ \t\n\r\u000c]+/,v=/^[, \t\n\r\u000c]+/;function w(t,e){if(!e||""===e.trim())return e;var n=t.createElement("a");return n.href=e,n.href}function I(t){return Boolean("svg"===t.tagName||t.ownerSVGElement)}function _(){var t=document.createElement("a");return t.href="",t.href}function C(t,e,n,i){return"src"===n||"href"===n&&i&&("use"!==e||"#"!==i[0])||"xlink:href"===n&&i&&"#"!==i[0]?w(t,i):"background"!==n||!i||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===n&&i?function(t,e){if(""===e.trim())return e;var n=0;function i(t){var i,r=t.exec(e.substring(n));return r?(i=r[0],n+=i.length,i):""}for(var r=[];i(v),!(n>=e.length);){var s=i(b);if(","===s.slice(-1))s=w(t,s.substring(0,s.length-1)),r.push(s);else{var o="";s=w(t,s);for(var a=!1;;){var l=e.charAt(n);if(""===l){r.push((s+o).trim());break}if(a)")"===l&&(a=!1);else{if(","===l){n+=1,r.push((s+o).trim());break}"("===l&&(a=!0)}o+=l,n+=1}}}return r.join(", ")}(t,i):"style"===n&&i?y(i,_()):"object"===e&&"data"===n&&i?w(t,i):i:w(t,i)}function k(t,e,n){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!n&&k(t.parentNode,e,n);for(var i=t.classList.length;i--;){var r=t.classList[i];if(e.test(r))return!0}return!!n&&k(t.parentNode,e,n)}function S(t,e,n){var i=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(null===i)return!1;if("string"==typeof e){if(i.classList.contains(e))return!0;if(i.closest(".".concat(e)))return!0}else if(k(i,e,!0))return!0;if(n){if(i.matches(n))return!0;if(i.closest(n))return!0}return!1}function A(t,n){var i=n.doc,s=n.mirror,o=n.blockClass,h=n.blockSelector,p=n.maskTextClass,g=n.maskTextSelector,m=n.inlineStylesheet,f=n.maskInputOptions,b=void 0===f?{}:f,v=n.maskTextFn,w=n.maskInputFn,k=n.dataURLOptions,A=void 0===k?{}:k,x=n.inlineImages,E=n.recordCanvas,T=n.keepIframeSrcFn,R=n.newlyAddedElement,N=void 0!==R&&R,M=function(t,e){if(!e.hasNode(t))return;var n=e.getId(t);return 1===n?void 0:n}(i,s);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.Document,childNodes:[],compatMode:t.compatMode}:{type:e.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:M};case t.ELEMENT_NODE:return function(t,n){for(var i=n.doc,s=n.blockClass,o=n.blockSelector,h=n.inlineStylesheet,p=n.maskInputOptions,g=void 0===p?{}:p,m=n.maskInputFn,f=n.dataURLOptions,b=void 0===f?{}:f,v=n.inlineImages,w=n.recordCanvas,k=n.keepIframeSrcFn,S=n.newlyAddedElement,A=void 0!==S&&S,x=n.rootId,E=function(t,e,n){if("string"==typeof e){if(t.classList.contains(e))return!0}else for(var i=t.classList.length;i--;){var r=t.classList[i];if(e.test(r))return!0}return!!n&&t.matches(n)}(t,s,o),T=function(t){if(t instanceof HTMLFormElement)return"form";var e=t.tagName.toLowerCase().trim();return u.test(e)?"div":e}(t),R={},N=t.attributes.length,M=0;M<N;M++){var O=t.attributes[M];R[O.name]=C(i,T,O.name,O.value)}if("link"===T&&h){var D=Array.from(i.styleSheets).find(function(e){return e.href===t.href}),L=null;D&&(L=r(D)),L&&(delete R.rel,delete R.href,R._cssText=y(L,D.href))}if("style"===T&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){(L=r(t.sheet))&&(R._cssText=y(L,_()))}if("input"===T||"textarea"===T||"select"===T){var F=t.value,z=t.checked;"radio"!==R.type&&"checkbox"!==R.type&&"submit"!==R.type&&"button"!==R.type&&F?R.value=a({type:R.type,tagName:T,value:F,maskInputOptions:g,maskInputFn:m}):z&&(R.checked=z)}"option"===T&&(t.selected&&!g.select?R.selected=!0:delete R.selected);if("canvas"===T&&w)if("2d"===t.__context)(function(t){var e=t.getContext("2d");if(!e)return!0;for(var n=0;n<t.width;n+=50)for(var i=0;i<t.height;i+=50){var r=e.getImageData,s=l in r?r[l]:r;if(new Uint32Array(s.call(e,n,i,Math.min(50,t.width-n),Math.min(50,t.height-i)).data.buffer).some(function(t){return 0!==t}))return!1}return!0})(t)||(R.rr_dataURL=t.toDataURL(b.type,b.quality));else if(!("__context"in t)){var U=t.toDataURL(b.type,b.quality),H=document.createElement("canvas");H.width=t.width,H.height=t.height,U!==H.toDataURL(b.type,b.quality)&&(R.rr_dataURL=U)}if("img"===T&&v){c||(c=i.createElement("canvas"),d=c.getContext("2d"));var B=t,Z=B.crossOrigin;B.crossOrigin="anonymous";var W=function(){try{c.width=B.naturalWidth,c.height=B.naturalHeight,d.drawImage(B,0,0),R.rr_dataURL=c.toDataURL(b.type,b.quality)}catch(t){console.warn("Cannot inline img src=".concat(B.currentSrc,"! Error: ").concat(t))}Z?R.crossOrigin=Z:B.removeAttribute("crossorigin")};B.complete&&0!==B.naturalWidth?W():B.onload=W}"audio"!==T&&"video"!==T||(R.rr_mediaState=t.paused?"paused":"played",R.rr_mediaCurrentTime=t.currentTime);A||(t.scrollLeft&&(R.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(R.rr_scrollTop=t.scrollTop));if(E){var G=t.getBoundingClientRect(),V=G.width,K=G.height;R={class:R.class,rr_width:"".concat(V,"px"),rr_height:"".concat(K,"px")}}"iframe"!==T||k(R.src)||(t.contentDocument||(R.rr_src=R.src),delete R.src);return{type:e.Element,tagName:T,attributes:R,childNodes:[],isSVG:I(t)||void 0,needBlock:E,rootId:x}}(t,{doc:i,blockClass:o,blockSelector:h,inlineStylesheet:m,maskInputOptions:b,maskInputFn:w,dataURLOptions:A,inlineImages:x,recordCanvas:E,keepIframeSrcFn:T,newlyAddedElement:N,rootId:M});case t.TEXT_NODE:return function(t,n){var i,r=n.maskTextClass,s=n.maskTextSelector,o=n.maskTextFn,a=n.rootId,l=t.parentNode&&t.parentNode.tagName,c=t.textContent,d="STYLE"===l||void 0,h="SCRIPT"===l||void 0;if(d&&c){try{t.nextSibling||t.previousSibling||(null===(i=t.parentNode.sheet)||void 0===i?void 0:i.cssRules)&&(c=(u=t.parentNode.sheet).cssRules?Array.from(u.cssRules).map(function(t){return t.cssText||""}).join(""):"")}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(e),t)}c=y(c,_())}var u;h&&(c="SCRIPT_PLACEHOLDER");!d&&!h&&c&&S(t,r,s)&&(c=o?o(c):c.replace(/[\S]/g,"*"));return{type:e.Text,textContent:c||"",isStyle:d,rootId:a}}(t,{maskTextClass:p,maskTextSelector:g,maskTextFn:v,rootId:M});case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:"",rootId:M};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||"",rootId:M};default:return!1}}function x(t){return void 0===t?"":t.toLowerCase()}function E(t,r){var s,o=r.doc,a=r.mirror,l=r.blockClass,c=r.blockSelector,d=r.maskTextClass,h=r.maskTextSelector,u=r.skipChild,g=void 0!==u&&u,m=r.inlineStylesheet,f=void 0===m||m,y=r.maskInputOptions,b=void 0===y?{}:y,v=r.maskTextFn,w=r.maskInputFn,I=r.slimDOMOptions,_=r.dataURLOptions,C=void 0===_?{}:_,k=r.inlineImages,S=void 0!==k&&k,T=r.recordCanvas,R=void 0!==T&&T,N=r.onSerialize,M=r.onIframeLoad,O=r.iframeLoadTimeout,D=void 0===O?5e3:O,L=r.onStylesheetLoad,F=r.stylesheetLoadTimeout,z=void 0===F?5e3:F,U=r.keepIframeSrcFn,H=void 0===U?function(){return!1}:U,B=r.newlyAddedElement,Z=void 0!==B&&B,W=r.preserveWhiteSpace,G=void 0===W||W,V=A(t,{doc:o,mirror:a,blockClass:l,blockSelector:c,maskTextClass:d,maskTextSelector:h,inlineStylesheet:f,maskInputOptions:b,maskTextFn:v,maskInputFn:w,dataURLOptions:C,inlineImages:S,recordCanvas:R,keepIframeSrcFn:H,newlyAddedElement:Z});if(!V)return console.warn(t,"not serialized"),null;s=a.hasNode(t)?a.getId(t):!function(t,n){if(n.comment&&t.type===e.Comment)return!0;if(t.type===e.Element){if(n.script&&("script"===t.tagName||"link"===t.tagName&&"preload"===t.attributes.rel&&"script"===t.attributes.as||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")))return!0;if(n.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(x(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===x(t.attributes.name)||"icon"===x(t.attributes.rel)||"apple-touch-icon"===x(t.attributes.rel)||"shortcut icon"===x(t.attributes.rel))))return!0;if("meta"===t.tagName){if(n.headMetaDescKeywords&&x(t.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(x(t.attributes.property).match(/^(og|twitter|fb):/)||x(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===x(t.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===x(t.attributes.name)||"googlebot"===x(t.attributes.name)||"bingbot"===x(t.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===x(t.attributes.name)||"generator"===x(t.attributes.name)||"framework"===x(t.attributes.name)||"publisher"===x(t.attributes.name)||"progid"===x(t.attributes.name)||x(t.attributes.property).match(/^article:/)||x(t.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===x(t.attributes.name)||"yandex-verification"===x(t.attributes.name)||"csrf-token"===x(t.attributes.name)||"p:domain_verify"===x(t.attributes.name)||"verify-v1"===x(t.attributes.name)||"verification"===x(t.attributes.name)||"shopify-checkout-api-token"===x(t.attributes.name)))return!0}}return!1}(V,I)&&(G||V.type!==e.Text||V.isStyle||V.textContent.replace(/^\s+|\s+$/gm,"").length)?p():-2;var K=Object.assign(V,{id:s});if(a.add(t,K),-2===s)return null;N&&N(t);var q=!g;if(K.type===e.Element){q=q&&!K.needBlock,delete K.needBlock;var j=t.shadowRoot;j&&i(j)&&(K.isShadowHost=!0)}if((K.type===e.Document||K.type===e.Element)&&q){I.headWhitespace&&K.type===e.Element&&"head"===K.tagName&&(G=!1);for(var P={doc:o,mirror:a,blockClass:l,blockSelector:c,maskTextClass:d,maskTextSelector:h,skipChild:g,inlineStylesheet:f,maskInputOptions:b,maskTextFn:v,maskInputFn:w,slimDOMOptions:I,dataURLOptions:C,inlineImages:S,recordCanvas:R,preserveWhiteSpace:G,onSerialize:N,onIframeLoad:M,iframeLoadTimeout:D,onStylesheetLoad:L,stylesheetLoadTimeout:z,keepIframeSrcFn:H},Y=0,X=Array.from(t.childNodes);Y<X.length;Y++){($=E(X[Y],P))&&K.childNodes.push($)}if(function(t){return t.nodeType===t.ELEMENT_NODE}(t)&&t.shadowRoot)for(var Q=0,J=Array.from(t.shadowRoot.childNodes);Q<J.length;Q++){var $;($=E(J[Q],P))&&(i(t.shadowRoot)&&($.isShadow=!0),K.childNodes.push($))}}return t.parentNode&&n(t.parentNode)&&i(t.parentNode)&&(K.isShadow=!0),K.type===e.Element&&"iframe"===K.tagName&&function(t,e,n){var i=t.contentWindow;if(i){var r,s=!1;try{r=i.document.readyState}catch(t){return}if("complete"===r){var o="about:blank";if(i.location.href!==o||t.src===o||""===t.src)return setTimeout(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}else{var a=setTimeout(function(){s||(e(),s=!0)},n);t.addEventListener("load",function(){clearTimeout(a),s=!0,e()})}}}(t,function(){var e=t.contentDocument;if(e&&M){var n=E(e,{doc:e,mirror:a,blockClass:l,blockSelector:c,maskTextClass:d,maskTextSelector:h,skipChild:!1,inlineStylesheet:f,maskInputOptions:b,maskTextFn:v,maskInputFn:w,slimDOMOptions:I,dataURLOptions:C,inlineImages:S,recordCanvas:R,preserveWhiteSpace:G,onSerialize:N,onIframeLoad:M,iframeLoadTimeout:D,onStylesheetLoad:L,stylesheetLoadTimeout:z,keepIframeSrcFn:H});n&&M(t,n)}},D),K.type===e.Element&&"link"===K.tagName&&"stylesheet"===K.attributes.rel&&function(t,e,n){var i,r=!1;try{i=t.sheet}catch(t){return}if(!i){var s=setTimeout(function(){r||(e(),r=!0)},n);t.addEventListener("load",function(){clearTimeout(s),r=!0,e()})}}(t,function(){if(L){var e=E(t,{doc:o,mirror:a,blockClass:l,blockSelector:c,maskTextClass:d,maskTextSelector:h,skipChild:!1,inlineStylesheet:f,maskInputOptions:b,maskTextFn:v,maskInputFn:w,slimDOMOptions:I,dataURLOptions:C,inlineImages:S,recordCanvas:R,preserveWhiteSpace:G,onSerialize:N,onIframeLoad:M,iframeLoadTimeout:D,onStylesheetLoad:L,stylesheetLoadTimeout:z,keepIframeSrcFn:H});e&&L(t,e)}},z),K}function T(t,e,n=document){const i={capture:!0,passive:!0};return n.addEventListener(t,e,i),()=>n.removeEventListener(t,e,i)}const R="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 N={map:{},getId:()=>(console.error(R),-1),getNode:()=>(console.error(R),null),removeNodeFromMap(){console.error(R)},has:()=>(console.error(R),!1),reset(){console.error(R)}};function M(t,e,n={}){let i=null,r=0;return function(...s){const o=Date.now();r||!1!==n.leading||(r=o);const a=e-(o-r),l=this;a<=0||a>e?(i&&(clearTimeout(i),i=null),r=o,t.apply(l,s)):i||!1===n.trailing||(i=setTimeout(()=>{r=!1===n.leading?0:Date.now(),i=null,t.apply(l,s)},a))}}function O(t,e,n,i,r=window){const s=r.Object.getOwnPropertyDescriptor(t,e);return r.Object.defineProperty(t,e,i?n:{set(t){setTimeout(()=>{n.set.call(this,t)},0),s&&s.set&&s.set.call(this,t)}}),()=>O(t,e,s||{},!0)}function D(t,e,n){try{if(!(e in t))return()=>{};const i=t[e],r=n(i);return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:i}})),t[e]=r,()=>{t[e]=i}}catch(t){return()=>{}}}function L(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function F(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function z(t,e,n,i){if(!t)return!1;const r=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(!r)return!1;if("string"==typeof e){if(r.classList.contains(e))return!0;if(i&&null!==r.closest("."+e))return!0}else if(k(r,e,i))return!0;if(n){if(t.matches(n))return!0;if(i&&null!==r.closest(n))return!0}return!1}function U(t,e){return-2===e.getId(t)}function H(t,e){if(n(t))return!1;const i=e.getId(t);return!e.has(i)||(!t.parentNode||t.parentNode.nodeType!==t.DOCUMENT_NODE)&&(!t.parentNode||H(t.parentNode,e))}function B(t){return Boolean(t.changedTouches)}function Z(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function W(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function G(t){return Boolean(null==t?void 0:t.shadowRoot)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(N=new Proxy(N,{get:(t,e,n)=>("map"===e&&console.error(R),Reflect.get(t,e,n))}));class V{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){var e;return null!==(e=this.styleIDMap.get(t))&&void 0!==e?e:-1}has(t){return this.styleIDMap.has(t)}add(t,e){if(this.has(t))return this.getId(t);let n;return n=void 0===e?this.id++:e,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var K=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(K||{}),q=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t))(q||{}),j=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(j||{}),P=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(P||{});function Y(t){return"__ln"in t}class X{constructor(){this.length=0,this.head=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let e=this.head;for(let n=0;n<t;n++)e=(null==e?void 0:e.next)||null;return e}addNode(t){const e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&Y(t.previousSibling)){const n=t.previousSibling.__ln.next;e.next=n,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,n&&(n.previous=e)}else if(t.nextSibling&&Y(t.nextSibling)&&t.nextSibling.__ln.previous){const n=t.nextSibling.__ln.previous;e.previous=n,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,n&&(n.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;this.length++}removeNode(t){const e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next&&(e.next.previous=e.previous)):(this.head=e.next,this.head&&(this.head.previous=null)),t.__ln&&delete t.__ln,this.length--)}}const Q=(t,e)=>`${t}@${e}`;class J{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=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const t=[],e=new X,i=t=>{let e=t,n=-2;for(;-2===n;)e=e&&e.nextSibling,n=e&&this.mirror.getId(e);return n},r=r=>{var s,o,a,l;let c=null;(null===(o=null===(s=r.getRootNode)||void 0===s?void 0:s.call(r))||void 0===o?void 0:o.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&r.getRootNode().host&&(c=r.getRootNode().host);let d=c;for(;(null===(l=null===(a=null==d?void 0:d.getRootNode)||void 0===a?void 0:a.call(d))||void 0===l?void 0:l.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&d.getRootNode().host;)d=d.getRootNode().host;const h=!(this.doc.contains(r)||d&&this.doc.contains(d));if(!r.parentNode||h)return;const u=n(r.parentNode)?this.mirror.getId(c):this.mirror.getId(r.parentNode),p=i(r);if(-1===u||-1===p)return e.addNode(r);const g=E(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:t=>{Z(t,this.mirror)&&this.iframeManager.addIframe(t),W(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),G(r)&&this.shadowDomManager.addShadowRoot(r.shadowRoot,this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});g&&t.push({parentId:u,nextId:p,node:g})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const t of Array.from(this.movedSet.values()))tt(this.removes,t,this.mirror)&&!this.movedSet.has(t.parentNode)||r(t);for(const t of Array.from(this.addedSet.values()))nt(this.droppedSet,t)||tt(this.removes,t,this.mirror)?nt(this.movedSet,t)?r(t):this.droppedSet.add(t):r(t);let s=null;for(;e.length;){let t=null;if(s){const e=this.mirror.getId(s.value.parentNode),n=i(s.value);-1!==e&&-1!==n&&(t=s)}if(!t)for(let n=e.length-1;n>=0;n--){const r=e.get(n);if(r){const e=this.mirror.getId(r.value.parentNode);if(-1===i(r.value))continue;if(-1!==e){t=r;break}{const e=r.value;if(e.parentNode&&e.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=e.parentNode.host;if(-1!==this.mirror.getId(n)){t=r;break}}}}}if(!t){for(;e.head;)e.removeNode(e.head.value);break}s=t.previous,e.removeNode(t.value),r(t.value)}const o={texts:this.texts.map(t=>({id:this.mirror.getId(t.node),value:t.value})).filter(t=>this.mirror.has(t.id)),attributes:this.attributes.map(t=>({id:this.mirror.getId(t.node),attributes:t.attributes})).filter(t=>this.mirror.has(t.id)),removes:this.removes,adds:t};(o.texts.length||o.attributes.length||o.removes.length||o.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(o))},this.processMutation=t=>{if(!U(t.target,this.mirror))switch(t.type){case"characterData":{const e=t.target.textContent;z(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:S(t.target,this.maskTextClass,this.maskTextSelector)&&e?this.maskTextFn?this.maskTextFn(e):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{const e=t.target;let n=t.target.getAttribute(t.attributeName);if("value"===t.attributeName&&(n=a({maskInputOptions:this.maskInputOptions,tagName:t.target.tagName,type:t.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),z(t.target,this.blockClass,this.blockSelector,!1)||n===t.oldValue)return;let i=this.attributes.find(e=>e.node===t.target);if("IFRAME"===e.tagName&&"src"===t.attributeName&&!this.keepIframeSrcFn(n)){if(e.contentDocument)return;t.attributeName="rr_src"}if(i||(i={node:t.target,attributes:{}},this.attributes.push(i)),"style"===t.attributeName){const n=this.doc.createElement("span");t.oldValue&&n.setAttribute("style",t.oldValue),void 0!==i.attributes.style&&null!==i.attributes.style||(i.attributes.style={});const r=i.attributes.style;for(const t of Array.from(e.style)){const i=e.style.getPropertyValue(t),s=e.style.getPropertyPriority(t);i===n.style.getPropertyValue(t)&&s===n.style.getPropertyPriority(t)||(r[t]=""===s?i:[i,s])}for(const t of Array.from(n.style))""===e.style.getPropertyValue(t)&&(r[t]=!1)}else i.attributes[t.attributeName]=C(this.doc,e.tagName,t.attributeName,n);break}case"childList":if(z(t.target,this.blockClass,this.blockSelector,!0))return;t.addedNodes.forEach(e=>this.genAdds(e,t.target)),t.removedNodes.forEach(e=>{const r=this.mirror.getId(e),s=n(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);z(t.target,this.blockClass,this.blockSelector,!1)||U(e,this.mirror)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?($(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===r||H(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Q(r,s)]?$(this.movedSet,e):this.removes.push({parentId:s,id:r,isShadow:!(!n(t.target)||!i(t.target))||void 0})),this.mapRemoves.push(e))})}},this.genAdds=(t,e)=>{if(this.mirror.hasNode(t)){if(U(t,this.mirror))return;this.movedSet.add(t);let n=null;e&&this.mirror.hasNode(e)&&(n=this.mirror.getId(e)),n&&-1!==n&&(this.movedMap[Q(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);z(t,this.blockClass,this.blockSelector,!1)||t.childNodes.forEach(t=>this.genAdds(t))}}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(e=>{this[e]=t[e]})}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 $(t,e){t.delete(e),e.childNodes.forEach(e=>$(t,e))}function tt(t,e,n){return 0!==t.length&&et(t,e,n)}function et(t,e,n){const{parentNode:i}=e;if(!i)return!1;const r=n.getId(i);return!!t.some(t=>t.id===r)||et(t,i,n)}function nt(t,e){return 0!==t.size&&it(t,e)}function it(t,e){const{parentNode:n}=e;return!!n&&(!!t.has(n)||it(t,n))}const rt=[],st="undefined"!=typeof CSSGroupingRule,ot="undefined"!=typeof CSSMediaRule,at="undefined"!=typeof CSSSupportsRule,lt="undefined"!=typeof CSSConditionRule;function ct(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0];return t.target}catch(e){return t.target}}function dt(t,e){var n,i;const r=new J;rt.push(r),r.init(t);let s=window.MutationObserver||window.__rrMutationObserver;const o=null===(i=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===i?void 0:i.call(n,"MutationObserver");o&&window[o]&&(s=window[o]);const a=new s(r.processMutations.bind(r));return a.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function ht({mouseInteractionCb:t,doc:e,mirror:n,blockClass:i,blockSelector:r,sampling:s}){if(!1===s.mouseInteraction)return()=>{};const o=!0===s.mouseInteraction||void 0===s.mouseInteraction?{}:s.mouseInteraction,a=[];return Object.keys(j).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t]).forEach(s=>{const o=s.toLowerCase(),l=(e=>s=>{const o=ct(s);if(z(o,i,r,!0))return;const a=B(s)?s.changedTouches[0]:s;if(!a)return;const l=n.getId(o),{clientX:c,clientY:d}=a;t({type:j[e],id:l,x:c,y:d})})(s);a.push(T(o,l,e))}),()=>{a.forEach(t=>t())}}function ut({scrollCb:t,doc:e,mirror:n,blockClass:i,blockSelector:r,sampling:s}){return T("scroll",M(s=>{const o=ct(s);if(!o||z(o,i,r,!0))return;const a=n.getId(o);if(o===e){const n=e.scrollingElement||e.documentElement;t({id:a,x:n.scrollLeft,y:n.scrollTop})}else t({id:a,x:o.scrollLeft,y:o.scrollTop})},s.scroll||100),e)}function pt(t,e){const n=Object.assign({},t);return e||delete n.userTriggered,n}const gt=["INPUT","TEXTAREA","SELECT"],mt=new WeakMap;function ft(t){return function(t,e){if(st&&t.parentRule instanceof CSSGroupingRule||ot&&t.parentRule instanceof CSSMediaRule||at&&t.parentRule instanceof CSSSupportsRule||lt&&t.parentRule instanceof CSSConditionRule){const n=Array.from(t.parentRule.cssRules).indexOf(t);e.unshift(n)}else if(t.parentStyleSheet){const n=Array.from(t.parentStyleSheet.cssRules).indexOf(t);e.unshift(n)}return e}(t,[])}function yt(t,e,n){let i,r;return t?(t.ownerNode?i=e.getId(t.ownerNode):r=n.getId(t),{styleId:r,id:i}):{}}function bt({mirror:t,stylesheetManager:e},n){var i,r,s;let o=null;o="#document"===n.nodeName?t.getId(n):t.getId(n.host);const a="#document"===n.nodeName?null===(i=n.defaultView)||void 0===i?void 0:i.Document:null===(s=null===(r=n.ownerDocument)||void 0===r?void 0:r.defaultView)||void 0===s?void 0:s.ShadowRoot,l=Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets");return null!==o&&-1!==o&&a&&l?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var t;return null===(t=l.get)||void 0===t?void 0:t.call(this)},set(t){var n;const i=null===(n=l.set)||void 0===n?void 0:n.call(this,t);if(null!==o&&-1!==o)try{e.adoptStyleSheets(t,o)}catch(t){}return i}}),()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}):()=>{}}function vt(t,e={}){const n=t.doc.defaultView;if(!n)return()=>{};!function(t,e){const{mutationCb:n,mousemoveCb:i,mouseInteractionCb:r,scrollCb:s,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:d,canvasMutationCb:h,fontCb:u,selectionCb:p}=t;t.mutationCb=(...t)=>{e.mutation&&e.mutation(...t),n(...t)},t.mousemoveCb=(...t)=>{e.mousemove&&e.mousemove(...t),i(...t)},t.mouseInteractionCb=(...t)=>{e.mouseInteraction&&e.mouseInteraction(...t),r(...t)},t.scrollCb=(...t)=>{e.scroll&&e.scroll(...t),s(...t)},t.viewportResizeCb=(...t)=>{e.viewportResize&&e.viewportResize(...t),o(...t)},t.inputCb=(...t)=>{e.input&&e.input(...t),a(...t)},t.mediaInteractionCb=(...t)=>{e.mediaInteaction&&e.mediaInteaction(...t),l(...t)},t.styleSheetRuleCb=(...t)=>{e.styleSheetRule&&e.styleSheetRule(...t),c(...t)},t.styleDeclarationCb=(...t)=>{e.styleDeclaration&&e.styleDeclaration(...t),d(...t)},t.canvasMutationCb=(...t)=>{e.canvasMutation&&e.canvasMutation(...t),h(...t)},t.fontCb=(...t)=>{e.font&&e.font(...t),u(...t)},t.selectionCb=(...t)=>{e.selection&&e.selection(...t),p(...t)}}(t,e);const i=dt(t,t.doc),r=function({mousemoveCb:t,sampling:e,doc:n,mirror:i}){if(!1===e.mousemove)return()=>{};const r="number"==typeof e.mousemove?e.mousemove:50,s="number"==typeof e.mousemoveCallback?e.mousemoveCallback:500;let o,a=[];const l=M(e=>{const n=Date.now()-o;t(a.map(t=>(t.timeOffset-=n,t)),e),a=[],o=null},s),c=M(t=>{const e=ct(t),{clientX:n,clientY:r}=B(t)?t.changedTouches[0]:t;o||(o=Date.now()),a.push({x:n,y:r,id:i.getId(e),timeOffset:Date.now()-o}),l("undefined"!=typeof DragEvent&&t instanceof DragEvent?q.Drag:t instanceof MouseEvent?q.MouseMove:q.TouchMove)},r,{trailing:!1}),d=[T("mousemove",c,n),T("touchmove",c,n),T("drag",c,n)];return()=>{d.forEach(t=>t())}}(t),s=ht(t),o=ut(t),l=function({viewportResizeCb:t}){let e=-1,n=-1;return T("resize",M(()=>{const i=L(),r=F();e===i&&n===r||(t({width:Number(r),height:Number(i)}),e=i,n=r)},200),window)}(t),c=function({inputCb:t,doc:e,mirror:n,blockClass:i,blockSelector:r,ignoreClass:s,maskInputOptions:o,maskInputFn:l,sampling:c,userTriggeredOnInput:d}){function h(t){let n=ct(t);const c=t.isTrusted;if(n&&"OPTION"===n.tagName&&(n=n.parentElement),!n||!n.tagName||gt.indexOf(n.tagName)<0||z(n,i,r,!0))return;const h=n.type;if(n.classList.contains(s))return;let p=n.value,g=!1;"radio"===h||"checkbox"===h?g=n.checked:(o[n.tagName.toLowerCase()]||o[h])&&(p=a({maskInputOptions:o,tagName:n.tagName,type:h,value:p,maskInputFn:l})),u(n,pt({text:p,isChecked:g,userTriggered:c},d));const m=n.name;"radio"===h&&m&&g&&e.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach(t=>{t!==n&&u(t,pt({text:t.value,isChecked:!g,userTriggered:!1},d))})}function u(e,i){const r=mt.get(e);if(!r||r.text!==i.text||r.isChecked!==i.isChecked){mt.set(e,i);const r=n.getId(e);t(Object.assign(Object.assign({},i),{id:r}))}}const p=("last"===c.input?["change"]:["input","change"]).map(t=>T(t,h,e)),g=e.defaultView;if(!g)return()=>{p.forEach(t=>t())};const m=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),f=[[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(...f.map(t=>O(t[0],t[1],{set(){h({target:this})}},!1,g))),()=>{p.forEach(t=>t())}}(t),d=function({mediaInteractionCb:t,blockClass:e,blockSelector:n,mirror:i,sampling:r}){const s=s=>M(r=>{const o=ct(r);if(!o||z(o,e,n,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:d}=o;t({type:s,id:i.getId(o),currentTime:a,volume:l,muted:c,playbackRate:d})},r.media||500),o=[T("play",s(0)),T("pause",s(1)),T("seeked",s(2)),T("volumechange",s(3)),T("ratechange",s(4))];return()=>{o.forEach(t=>t())}}(t),h=function({styleSheetRuleCb:t,mirror:e,stylesheetManager:n},{win:i}){const r=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=function(i,s){const{id:o,styleId:a}=yt(this,e,n.styleMirror);return(o&&-1!==o||a&&-1!==a)&&t({id:o,styleId:a,adds:[{rule:i,index:s}]}),r.apply(this,[i,s])};const s=i.CSSStyleSheet.prototype.deleteRule;let o,a;i.CSSStyleSheet.prototype.deleteRule=function(i){const{id:r,styleId:o}=yt(this,e,n.styleMirror);return(r&&-1!==r||o&&-1!==o)&&t({id:r,styleId:o,removes:[{index:i}]}),s.apply(this,[i])},i.CSSStyleSheet.prototype.replace&&(o=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=function(i){const{id:r,styleId:s}=yt(this,e,n.styleMirror);return(r&&-1!==r||s&&-1!==s)&&t({id:r,styleId:s,replace:i}),o.apply(this,[i])}),i.CSSStyleSheet.prototype.replaceSync&&(a=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=function(i){const{id:r,styleId:s}=yt(this,e,n.styleMirror);return(r&&-1!==r||s&&-1!==s)&&t({id:r,styleId:s,replaceSync:i}),a.apply(this,[i])});const l={};st?l.CSSGroupingRule=i.CSSGroupingRule:(ot&&(l.CSSMediaRule=i.CSSMediaRule),lt&&(l.CSSConditionRule=i.CSSConditionRule),at&&(l.CSSSupportsRule=i.CSSSupportsRule));const c={};return Object.entries(l).forEach(([i,r])=>{c[i]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=function(r,s){const{id:o,styleId:a}=yt(this.parentStyleSheet,e,n.styleMirror);return(o&&-1!==o||a&&-1!==a)&&t({id:o,styleId:a,adds:[{rule:r,index:[...ft(this),s||0]}]}),c[i].insertRule.apply(this,[r,s])},r.prototype.deleteRule=function(r){const{id:s,styleId:o}=yt(this.parentStyleSheet,e,n.styleMirror);return(s&&-1!==s||o&&-1!==o)&&t({id:s,styleId:o,removes:[{index:[...ft(this),r]}]}),c[i].deleteRule.apply(this,[r])}}),()=>{i.CSSStyleSheet.prototype.insertRule=r,i.CSSStyleSheet.prototype.deleteRule=s,o&&(i.CSSStyleSheet.prototype.replace=o),a&&(i.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([t,e])=>{e.prototype.insertRule=c[t].insertRule,e.prototype.deleteRule=c[t].deleteRule})}}(t,{win:n}),u=bt(t,t.doc),p=function({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:n,stylesheetManager:i},{win:r}){const s=r.CSSStyleDeclaration.prototype.setProperty;r.CSSStyleDeclaration.prototype.setProperty=function(r,o,a){var l;if(n.has(r))return s.apply(this,[r,o,a]);const{id:c,styleId:d}=yt(null===(l=this.parentRule)||void 0===l?void 0:l.parentStyleSheet,e,i.styleMirror);return(c&&-1!==c||d&&-1!==d)&&t({id:c,styleId:d,set:{property:r,value:o,priority:a},index:ft(this.parentRule)}),s.apply(this,[r,o,a])};const o=r.CSSStyleDeclaration.prototype.removeProperty;return r.CSSStyleDeclaration.prototype.removeProperty=function(r){var s;if(n.has(r))return o.apply(this,[r]);const{id:a,styleId:l}=yt(null===(s=this.parentRule)||void 0===s?void 0:s.parentStyleSheet,e,i.styleMirror);return(a&&-1!==a||l&&-1!==l)&&t({id:a,styleId:l,remove:{property:r},index:ft(this.parentRule)}),o.apply(this,[r])},()=>{r.CSSStyleDeclaration.prototype.setProperty=s,r.CSSStyleDeclaration.prototype.removeProperty=o}}(t,{win:n}),g=t.collectFonts?function({fontCb:t,doc:e}){const n=e.defaultView;if(!n)return()=>{};const i=[],r=new WeakMap,s=n.FontFace;n.FontFace=function(t,e,n){const i=new s(t,e,n);return r.set(i,{family:t,buffer:"string"!=typeof e,descriptors:n,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),i};const o=D(e.fonts,"add",function(e){return function(n){return setTimeout(()=>{const e=r.get(n);e&&(t(e),r.delete(n))},0),e.apply(this,[n])}});return i.push(()=>{n.FontFace=s}),i.push(o),()=>{i.forEach(t=>t())}}(t):()=>{},m=function(t){const{doc:e,mirror:n,blockClass:i,blockSelector:r,selectionCb:s}=t;let o=!0;const a=()=>{const t=e.getSelection();if(!t||o&&(null==t?void 0:t.isCollapsed))return;o=t.isCollapsed||!1;const a=[],l=t.rangeCount||0;for(let e=0;e<l;e++){const s=t.getRangeAt(e),{startContainer:o,startOffset:l,endContainer:c,endOffset:d}=s;z(o,i,r,!0)||z(c,i,r,!0)||a.push({start:n.getId(o),startOffset:l,end:n.getId(c),endOffset:d})}s({ranges:a})};return a(),T("selectionchange",a)}(t),f=[];for(const e of t.plugins)f.push(e.observer(e.callback,n,e.options));return()=>{rt.forEach(t=>t.reset()),i.disconnect(),r(),s(),o(),l(),c(),d(),h(),u(),p(),g(),m(),f.forEach(t=>t())}}class wt{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,e,n,i){const r=n||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t);let o=r.get(e);return o||(o=this.generateIdFn(),r.set(e,o),s.set(o,e)),o}getIds(t,e){const n=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return e.map(e=>this.getId(t,e,n,i))}getRemoteId(t,e,n){const i=n||this.getRemoteIdToIdMap(t);if("number"!=typeof e)return e;const r=i.get(e);return r||-1}getRemoteIds(t,e){const n=this.getRemoteIdToIdMap(t);return e.map(e=>this.getRemoteId(t,e,n))}reset(t){if(!t)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let e=this.iframeIdToRemoteIdMap.get(t);return e||(e=new Map,this.iframeIdToRemoteIdMap.set(t,e)),e}getRemoteIdToIdMap(t){let e=this.iframeRemoteIdToIdMap.get(t);return e||(e=new Map,this.iframeRemoteIdToIdMap.set(t,e)),e}}class It{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new wt(p),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new wt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,e){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){if("rrweb"===t.data.type){if(!t.source)return;const e=this.crossOriginIframeMap.get(t.source);if(!e)return;const n=this.transformCrossOriginEvent(e,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}}transformCrossOriginEvent(t,e){var n;switch(e.type){case K.FullSnapshot:return this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t),{timestamp:e.timestamp,type:K.IncrementalSnapshot,data:{source:q.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case K.Meta:case K.Load:case K.DomContentLoaded:return!1;case K.Plugin:return e;case K.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case K.IncrementalSnapshot:switch(e.data.source){case q.Mutation:return e.data.adds.forEach(e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t)}),e.data.removes.forEach(e=>{this.replaceIds(e,t,["parentId","id"])}),e.data.attributes.forEach(e=>{this.replaceIds(e,t,["id"])}),e.data.texts.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case q.Drag:case q.TouchMove:case q.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case q.ViewportResize:return!1;case q.MediaInteraction:case q.MouseInteraction:case q.Scroll:case q.CanvasMutation:case q.Input:return this.replaceIds(e.data,t,["id"]),e;case q.StyleSheetRule:case q.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case q.Font:return e;case q.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case q.AdoptedStyleSheet:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null===(n=e.data.styles)||void 0===n||n.forEach(e=>{this.replaceStyleIds(e,t,["styleId"])}),e}}}replace(t,e,n,i){for(const r of i)(Array.isArray(e[r])||"number"==typeof e[r])&&(Array.isArray(e[r])?e[r]=t.getIds(n,e[r]):e[r]=t.getId(n,e[r]));return e}replaceIds(t,e,n){return this.replace(this.crossOriginIframeMirror,t,e,n)}replaceStyleIds(t,e,n){return this.replace(this.crossOriginIframeStyleMirror,t,e,n)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id"]),"childNodes"in t&&t.childNodes.forEach(t=>{this.replaceIdOnNode(t,e)})}}class _t{constructor(t){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror;const e=this;this.restorePatches.push(D(Element.prototype,"attachShadow",function(t){return function(n){const i=t.call(this,n);return this.shadowRoot&&e.addShadowRoot(this.shadowRoot,this.ownerDocument),i}}))}addShadowRoot(t,e){i(t)&&(this.shadowDoms.has(t)||(this.shadowDoms.add(t),dt(Object.assign(Object.assign({},this.bypassOptions),{doc:e,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t),ut(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),bt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)},0)))}observeAttachShadow(t){if(t.contentWindow){const e=this;this.restorePatches.push(D(t.contentWindow.HTMLElement.prototype,"attachShadow",function(n){return function(i){const r=n.call(this,i);return this.shadowRoot&&e.addShadowRoot(this.shadowRoot,t.contentDocument),r}}))}}reset(){this.restorePatches.forEach(t=>t()),this.shadowDoms=new WeakSet}}
2
+ /*! *****************************************************************************
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+ ***************************************************************************** */function Ct(t,e,n,i){return new(n||(n=Promise))(function(e,r){function s(t){try{a(i.next(t))}catch(t){r(t)}}function o(t){try{a(i.throw(t))}catch(t){r(t)}}function a(t){var i;t.done?e(t.value):(i=t.value,i instanceof n?i:new n(function(t){t(i)})).then(s,o)}a((i=i.apply(t,[])).next())})}for(var kt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",St="undefined"==typeof Uint8Array?[]:new Uint8Array(256),At=0;At<64;At++)St[kt.charCodeAt(At)]=At;const xt=new Map;const Et=(t,e,n)=>{if(!t||!Nt(t,e)&&"object"!=typeof t)return;const i=function(t,e){let n=xt.get(t);return n||(n=new Map,xt.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}(n,t.constructor.name);let r=i.indexOf(t);return-1===r&&(r=i.length,i.push(t)),r};function Tt(t,e,n){if(t instanceof Array)return t.map(t=>Tt(t,e,n));if(null===t)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray){return{rr_type:t.constructor.name,args:[Object.values(t)]}}if(t instanceof ArrayBuffer){const e=t.constructor.name,n=function(t){var e,n=new Uint8Array(t),i=n.length,r="";for(e=0;e<i;e+=3)r+=kt[n[e]>>2],r+=kt[(3&n[e])<<4|n[e+1]>>4],r+=kt[(15&n[e+1])<<2|n[e+2]>>6],r+=kt[63&n[e+2]];return i%3==2?r=r.substring(0,r.length-1)+"=":i%3==1&&(r=r.substring(0,r.length-2)+"=="),r}(t);return{rr_type:e,base64:n}}if(t instanceof DataView){return{rr_type:t.constructor.name,args:[Tt(t.buffer,e,n),t.byteOffset,t.byteLength]}}if(t instanceof HTMLImageElement){const e=t.constructor.name,{src:n}=t;return{rr_type:e,src:n}}if(t instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:t.toDataURL()}}if(t instanceof ImageData){return{rr_type:t.constructor.name,args:[Tt(t.data,e,n),t.width,t.height]}}if(Nt(t,e)||"object"==typeof t){return{rr_type:t.constructor.name,index:Et(t,e,n)}}return t}const Rt=(t,e,n)=>[...t].map(t=>Tt(t,e,n)),Nt=(t,e)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(t=>"function"==typeof e[t]);return Boolean(n.find(n=>t instanceof e[n]))};function Mt(t,e,n){const i=[];try{const r=D(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(i,...r){return z(this,e,n,!0)||"__context"in this||(this.__context=i),t.apply(this,[i,...r])}});i.push(r)}catch(t){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(t=>t())}}function Ot(t,e,n,i,r,s,o){const a=[],l=Object.getOwnPropertyNames(t);for(const s of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(s))try{if("function"!=typeof t[s])continue;const l=D(t,s,function(t){return function(...a){const l=t.apply(this,a);if(Et(l,o,this),!z(this.canvas,i,r,!0)){const t=Rt([...a],o,this),i={type:e,property:s,args:t};n(this.canvas,i)}return l}});a.push(l)}catch(i){const r=O(t,s,{set(t){n(this.canvas,{type:e,property:s,args:[t],setter:!0})}});a.push(r)}return a}var Dt=null;try{var Lt="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");Dt=Lt.Worker}catch(t){}function Ft(t,e,n){var i=function(t){return Buffer.from(t,"base64").toString("utf8")}(t),r=i.indexOf("\n",10)+1,s=i.substring(r)+"";return function(t){return new Dt(s,Object.assign({},t,{eval:!0}))}}function zt(t,e,n){var i=function(t){return atob(t)}(t),r=i.indexOf("\n",10)+1,s=i.substring(r)+"",o=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(o)}var Ut="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0);var Ht,Bt=(Ht="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",Ut?Ft(Ht):function(t){var e;return function(n){return e=e||zt(t),new Worker(e,n)}}(Ht));class Zt{constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(t,e)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)};const{sampling:e="all",win:n,blockClass:i,blockSelector:r,recordCanvas:s,dataURLOptions:o}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&"all"===e&&this.initCanvasMutationObserver(n,i,r),s&&"number"==typeof e&&this.initCanvasFPSObserver(e,n,i,r,{dataURLOptions:o})}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(t,e,n,i,r){const s=Mt(e,n,i),o=new Map,a=new Bt;a.onmessage=t=>{const{id:e}=t.data;if(o.set(e,!1),!("base64"in t.data))return;const{base64:n,type:i,width:r,height:s}=t.data;this.mutationCb({id:e,type:P["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:i}]},0,0]}]})};const l=1e3/t;let c,d=0;const h=t=>{d&&t-d<l||(d=t,(()=>{const t=[];return e.document.querySelectorAll("canvas").forEach(e=>{z(e,n,i,!0)||t.push(e)}),t})().forEach(t=>Ct(this,0,void 0,function*(){var e;const n=this.mirror.getId(t);if(o.get(n))return;if(o.set(n,!0),["webgl","webgl2"].includes(t.__context)){const n=t.getContext(t.__context);!1===(null===(e=null==n?void 0:n.getContextAttributes())||void 0===e?void 0:e.preserveDrawingBuffer)&&(null==n||n.clear(n.COLOR_BUFFER_BIT))}const i=yield createImageBitmap(t);a.postMessage({id:n,bitmap:i,width:t.width,height:t.height,dataURLOptions:r.dataURLOptions},[i])}))),c=requestAnimationFrame(h)};c=requestAnimationFrame(h),this.resetObservers=()=>{s(),cancelAnimationFrame(c)}}initCanvasMutationObserver(t,e,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=Mt(t,e,n),r=function(t,e,n,i){const r=[],s=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const o of s)try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[o])continue;const s=D(e.CanvasRenderingContext2D.prototype,o,function(r){return function(...s){return z(this.canvas,n,i,!0)||setTimeout(()=>{const n=Rt([...s],e,this);t(this.canvas,{type:P["2D"],property:o,args:n})},0),r.apply(this,s)}});r.push(s)}catch(n){const i=O(e.CanvasRenderingContext2D.prototype,o,{set(e){t(this.canvas,{type:P["2D"],property:o,args:[e],setter:!0})}});r.push(i)}return()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,n),s=function(t,e,n,i){const r=[];return r.push(...Ot(e.WebGLRenderingContext.prototype,P.WebGL,t,n,i,0,e)),void 0!==e.WebGL2RenderingContext&&r.push(...Ot(e.WebGL2RenderingContext.prototype,P.WebGL2,t,n,i,0,e)),()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,n,this.mirror);this.resetObservers=()=>{i(),r(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=e=>{this.rafStamps.latestId=e,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,e)=>{const n=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,e){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(t);if(!n||-1===e)return;const i=n.map(t=>{const e=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}(t,["type"]);return e}),{type:r}=n[0];this.mutationCb({id:e,type:r,commands:i}),this.pendingCanvasMutations.delete(t)}}class Wt{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new V,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){if(0===t.length)return;const n={id:e,styleIds:[]},i=[];for(const e of t){let t;if(this.styleMirror.has(e))t=this.styleMirror.getId(e);else{t=this.styleMirror.add(e);const n=Array.from(e.rules||CSSRule);i.push({styleId:t,rules:n.map((t,e)=>({rule:s(t),index:e}))})}n.styleIds.push(t)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}function Gt(t){return Object.assign(Object.assign({},t),{timestamp:Date.now()})}let Vt,Kt,qt,jt=!1;const Pt=new o;function Yt(t={}){const{emit:e,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:r="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:d=!0,maskAllInputs:h,maskInputOptions:u,slimDOMOptions:p,maskInputFn:g,maskTextFn:m,hooks:f,packFn:y,sampling:b={},dataURLOptions:v={},mousemoveWait:w,recordCanvas:I=!1,recordCrossOriginIframes:_=!1,userTriggeredOnInput:C=!1,collectFonts:k=!1,inlineImages:S=!1,plugins:A,keepIframeSrcFn:x=()=>!1,ignoreCSSAttributes:R=new Set([])}=t,N=!_||window.parent===window;let M=!1;if(!N)try{window.parent.document,M=!1}catch(t){M=!0}if(N&&!e)throw new Error("emit function is required");void 0!==w&&void 0===b.mousemove&&(b.mousemove=w),Pt.reset();const O=!0===h?{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!==u?u:{password:!0},D=!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 z;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...t)=>{let e=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do{if(this===e)return!0}while(e=e&&e.parentNode);return!1})}();let U=0;const H=t=>{for(const e of A||[])e.eventProcessor&&(t=e.eventProcessor(t));return y&&(t=y(t)),t};Vt=(t,r)=>{var s;if(!(null===(s=rt[0])||void 0===s?void 0:s.isFrozen())||t.type===K.FullSnapshot||t.type===K.IncrementalSnapshot&&t.data.source===q.Mutation||rt.forEach(t=>t.unfreeze()),N)null==e||e(H(t),r);else if(M){const e={type:"rrweb",event:H(t),isCheckout:r};window.parent.postMessage(e,"*")}if(t.type===K.FullSnapshot)z=t,U=0;else if(t.type===K.IncrementalSnapshot){if(t.data.source===q.Mutation&&t.data.isAttachIframe)return;U++;const e=i&&U>=i,r=n&&t.timestamp-z.timestamp>n;(e||r)&&Kt(!0)}};const B=t=>{Vt(Gt({type:K.IncrementalSnapshot,data:Object.assign({source:q.Mutation},t)}))},V=t=>Vt(Gt({type:K.IncrementalSnapshot,data:Object.assign({source:q.Scroll},t)})),j=t=>Vt(Gt({type:K.IncrementalSnapshot,data:Object.assign({source:q.CanvasMutation},t)})),P=new Wt({mutationCb:B,adoptedStyleSheetCb:t=>Vt(Gt({type:K.IncrementalSnapshot,data:Object.assign({source:q.AdoptedStyleSheet},t)}))}),Y=new It({mirror:Pt,mutationCb:B,stylesheetManager:P,recordCrossOriginIframes:_,wrappedEmit:Vt});for(const t of A||[])t.getMirror&&t.getMirror({nodeMirror:Pt,crossOriginIframeMirror:Y.crossOriginIframeMirror,crossOriginIframeStyleMirror:Y.crossOriginIframeStyleMirror});qt=new Zt({recordCanvas:I,mutationCb:j,win:window,blockClass:r,blockSelector:s,mirror:Pt,sampling:b.canvas,dataURLOptions:v});const X=new _t({mutationCb:B,scrollCb:V,bypassOptions:{blockClass:r,blockSelector:s,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskInputOptions:O,dataURLOptions:v,maskTextFn:m,maskInputFn:g,recordCanvas:I,inlineImages:S,sampling:b,slimDOMOptions:D,iframeManager:Y,stylesheetManager:P,canvasManager:qt,keepIframeSrcFn:x},mirror:Pt});Kt=(t=!1)=>{var e,n,i,a,h,u;Vt(Gt({type:K.Meta,data:{href:window.location.href,width:F(),height:L()}}),t),P.reset(),rt.forEach(t=>t.lock());const p=function(t,e){var n=e||{},i=n.mirror,r=void 0===i?new o:i,s=n.blockClass,a=void 0===s?"rr-block":s,l=n.blockSelector,c=void 0===l?null:l,d=n.maskTextClass,h=void 0===d?"rr-mask":d,u=n.maskTextSelector,p=void 0===u?null:u,g=n.inlineStylesheet,m=void 0===g||g,f=n.inlineImages,y=void 0!==f&&f,b=n.recordCanvas,v=void 0!==b&&b,w=n.maskAllInputs,I=void 0!==w&&w,_=n.maskTextFn,C=n.maskInputFn,k=n.slimDOM,S=void 0!==k&&k,A=n.dataURLOptions,x=n.preserveWhiteSpace,T=n.onSerialize,R=n.onIframeLoad,N=n.iframeLoadTimeout,M=n.onStylesheetLoad,O=n.stylesheetLoadTimeout,D=n.keepIframeSrcFn;return E(t,{doc:t,mirror:r,blockClass:a,blockSelector:c,maskTextClass:h,maskTextSelector:p,skipChild:!1,inlineStylesheet:m,maskInputOptions:!0===I?{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===I?{password:!0}:I,maskTextFn:_,maskInputFn:C,slimDOMOptions:!0===S||"all"===S?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===S,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===S?{}:S,dataURLOptions:A,inlineImages:y,recordCanvas:v,preserveWhiteSpace:x,onSerialize:T,onIframeLoad:R,iframeLoadTimeout:N,onStylesheetLoad:M,stylesheetLoadTimeout:O,keepIframeSrcFn:void 0===D?function(){return!1}:D,newlyAddedElement:!1})}(document,{mirror:Pt,blockClass:r,blockSelector:s,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskAllInputs:O,maskTextFn:m,slimDOM:D,dataURLOptions:v,recordCanvas:I,inlineImages:S,onSerialize:t=>{Z(t,Pt)&&Y.addIframe(t),W(t,Pt)&&P.trackLinkElement(t),G(t)&&X.addShadowRoot(t.shadowRoot,document)},onIframeLoad:(t,e)=>{Y.attachIframe(t,e),X.observeAttachShadow(t)},onStylesheetLoad:(t,e)=>{P.attachLinkElement(t,e)},keepIframeSrcFn:x});if(!p)return console.warn("Failed to snapshot the document");Vt(Gt({type:K.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===(e=null===document||void 0===document?void 0:document.body)||void 0===e?void 0:e.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(i=null===document||void 0===document?void 0:document.body)||void 0===i?void 0:i.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(h=null===(a=null===document||void 0===document?void 0:document.body)||void 0===a?void 0:a.parentElement)||void 0===h?void 0:h.scrollTop)||(null===(u=null===document||void 0===document?void 0:document.body)||void 0===u?void 0:u.scrollTop)||0}}})),rt.forEach(t=>t.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&P.adoptStyleSheets(document.adoptedStyleSheets,Pt.getId(document))};try{const t=[];t.push(T("DOMContentLoaded",()=>{Vt(Gt({type:K.DomContentLoaded,data:{}}))}));const e=t=>{var e;return vt({mutationCb:B,mousemoveCb:(t,e)=>Vt(Gt({type:K.IncrementalSnapshot,data:{source:e,positions:t}})),mouseInteractionCb:t=>Vt(Gt({type:K.IncrementalSnapshot,data:Object.assign({source:q.MouseInteraction},t)})),scrollCb:V,viewportResizeCb:t=>Vt(Gt({type:K.IncrementalSnapshot,data:Object.assign({source:q.ViewportResize},t)})),inputCb:t=>Vt(Gt({type:K.IncrementalSnapshot,data:Object.assign({source:q.Input},t)})),mediaInteractionCb:t=>Vt(Gt({type:K.IncrementalSnapshot,data:Object.assign({source:q.MediaInteraction},t)})),styleSheetRuleCb:t=>Vt(Gt({type:K.IncrementalSnapshot,data:Object.assign({source:q.StyleSheetRule},t)})),styleDeclarationCb:t=>Vt(Gt({type:K.IncrementalSnapshot,data:Object.assign({source:q.StyleDeclaration},t)})),canvasMutationCb:j,fontCb:t=>Vt(Gt({type:K.IncrementalSnapshot,data:Object.assign({source:q.Font},t)})),selectionCb:t=>{Vt(Gt({type:K.IncrementalSnapshot,data:Object.assign({source:q.Selection},t)}))},blockClass:r,ignoreClass:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:O,inlineStylesheet:d,sampling:b,recordCanvas:I,inlineImages:S,userTriggeredOnInput:C,collectFonts:k,doc:t,maskInputFn:g,maskTextFn:m,keepIframeSrcFn:x,blockSelector:s,slimDOMOptions:D,dataURLOptions:v,mirror:Pt,iframeManager:Y,stylesheetManager:P,shadowDomManager:X,canvasManager:qt,ignoreCSSAttributes:R,plugins:(null===(e=null==A?void 0:A.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({observer:t.observer,options:t.options,callback:e=>Vt(Gt({type:K.Plugin,data:{plugin:t.name,payload:e}}))})))||[]},f)};Y.addLoadListener(n=>{t.push(e(n.contentDocument))});const n=()=>{Kt(),t.push(e(document)),jt=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():t.push(T("load",()=>{Vt(Gt({type:K.Load,data:{}})),n()},window)),()=>{t.forEach(t=>t()),jt=!1}}catch(t){console.warn(t)}}Yt.addCustomEvent=(t,e)=>{if(!jt)throw new Error("please add custom event after start recording");Vt(Gt({type:K.Custom,data:{tag:t,payload:e}}))},Yt.freezePage=()=>{rt.forEach(t=>t.freeze())},Yt.takeFullSnapshot=t=>{if(!jt)throw new Error("please take full snapshot after start recording");Kt(t)},Yt.mirror=Pt;class Xt{constructor(){this.stopFn=null}start(t,e){var n,i,r,s,o,a;if(this.stopFn)return;const l=function(t){var e,n,i,r,s,o;return{maskAllInputs:null===(e=t.maskAllInputs)||void 0===e||e,maskInputOptions:{password:!0,email:null===(i=null===(n=t.privacy)||void 0===n?void 0:n.maskInputs)||void 0===i||i,tel:null===(s=null===(r=t.privacy)||void 0===r?void 0:r.maskInputs)||void 0===s||s},maskTextClass:t.blockClass||"wr-block",maskTextSelector:t.blockSelector||"[data-wr-block]",blockClass:t.blockClass||"wr-block",blockSelector:t.blockSelector||"[data-wr-block]",ignoreClass:t.ignoreClass||"wr-ignore",maskTextFn:(null===(o=t.privacy)||void 0===o?void 0:o.maskTextContent)?t=>t.replace(/\S/g,"*"):void 0}}(t);this.stopFn=Yt({emit:e,maskAllInputs:l.maskAllInputs,maskInputOptions:l.maskInputOptions,blockClass:l.blockClass,blockSelector:l.blockSelector,ignoreClass:l.ignoreClass,maskTextClass:l.maskTextClass,maskTextSelector:l.maskTextSelector,maskTextFn:l.maskTextFn,sampling:{mousemove:"number"==typeof(null===(n=t.sampling)||void 0===n?void 0:n.mousemove)?t.sampling.mousemove:!1!==(null===(i=t.sampling)||void 0===i?void 0:i.mousemove)&&50,scroll:(null===(r=t.sampling)||void 0===r?void 0:r.scroll)||150,input:(null===(s=t.sampling)||void 0===s?void 0:s.input)||"last"},recordCanvas:null!==(o=t.recordCanvas)&&void 0!==o&&o,collectFonts:null===(a=t.collectFonts)||void 0===a||a,inlineStylesheet:!0})||null}stop(){this.stopFn&&(this.stopFn(),this.stopFn=null)}isRecording(){return null!==this.stopFn}}function Qt(t,e){try{return t()}catch(t){return e}}const Jt=16384,$t=["application/json","text/plain","text/html","text/xml","application/xml","application/x-www-form-urlencoded"];function te(t){return!!t&&$t.some(e=>t.toLowerCase().includes(e))}function ee(t){return t.length>Jt?t.substring(0,Jt)+"\n[truncated]":t}class ne{constructor(){this.originalFetch=null,this.originalXHROpen=null,this.originalXHRSend=null,this.active=!1,this.sdkEndpoint=""}start(t,e){this.active||(this.active=!0,this.sdkEndpoint=e||"",this.interceptFetch(t),this.interceptXHR(t))}isSdkUrl(t){return!!this.sdkEndpoint&&t.startsWith(this.sdkEndpoint)}interceptFetch(t){if("undefined"==typeof fetch)return;this.originalFetch=window.fetch.bind(window);const e=this.originalFetch,n=this;window.fetch=function(i,r){const s=Date.now(),o=(null==r?void 0:r.method)||"GET",a="string"==typeof i?i:i instanceof URL?i.href:i.url;if(n.isSdkUrl(a))return e(i,r);const l=(null==r?void 0:r.body)&&"string"==typeof r.body?r.body.length:0,c=(null==r?void 0:r.body)&&"string"==typeof r.body?ee(r.body):void 0;return e(i,r).then(e=>(Qt(()=>{const i=e.headers.get("content-length"),r=i?parseInt(i,10):void 0;if(te(e.headers.get("content-type"))&&(!r||r<=Jt))try{e.clone().text().then(i=>{Qt(()=>{t({method:o.toUpperCase(),url:n.sanitizeUrl(a),status:e.status,duration:Date.now()-s,requestSize:l,responseSize:null!=r?r:i.length,requestBody:c,responseBody:ee(i),type:"fetch"})})}).catch(()=>{t({method:o.toUpperCase(),url:n.sanitizeUrl(a),status:e.status,duration:Date.now()-s,requestSize:l,responseSize:r,requestBody:c,type:"fetch"})})}catch(i){t({method:o.toUpperCase(),url:n.sanitizeUrl(a),status:e.status,duration:Date.now()-s,requestSize:l,responseSize:r,requestBody:c,type:"fetch"})}else t({method:o.toUpperCase(),url:n.sanitizeUrl(a),status:e.status,duration:Date.now()-s,requestSize:l,responseSize:r,requestBody:c,type:"fetch"})}),e),e=>{throw Qt(()=>{t({method:o.toUpperCase(),url:n.sanitizeUrl(a),status:0,duration:Date.now()-s,requestSize:l,requestBody:c,type:"fetch"})}),e})}}interceptXHR(t){if("undefined"==typeof XMLHttpRequest)return;this.originalXHROpen=XMLHttpRequest.prototype.open,this.originalXHRSend=XMLHttpRequest.prototype.send;const e=this.originalXHROpen,n=this.originalXHRSend,i=this;XMLHttpRequest.prototype.open=function(t,n,...r){return this._wrMethod=t,this._wrUrl="string"==typeof n?n:n.toString(),this._wrSkip=i.isSdkUrl(this._wrUrl),e.apply(this,[t,n,...r])},XMLHttpRequest.prototype.send=function(e){if(this._wrSkip)return n.call(this,e);const r=Date.now(),s=this._wrMethod||"GET",o=this._wrUrl||"",a=e&&"string"==typeof e?e.length:0,l=e&&"string"==typeof e?ee(e):void 0;return this.addEventListener("loadend",function(){Qt(()=>{var e;let n,c;try{if(""===this.responseType||"text"===this.responseType){n=null===(e=this.responseText)||void 0===e?void 0:e.length;te(this.getResponseHeader("content-type"))&&this.responseText&&this.responseText.length<=Jt&&(c=ee(this.responseText))}else{const t=this.getResponseHeader("content-length");n=t?parseInt(t,10):void 0}}catch(t){}t({method:s.toUpperCase(),url:i.sanitizeUrl(o),status:this.status,duration:Date.now()-r,requestSize:a,responseSize:n,requestBody:l,responseBody:c,type:"xhr"})})}),n.call(this,e)}}sanitizeUrl(t){try{const e=new URL(t,location.href),n=["token","key","password","secret","auth","access_token","api_key","apikey","jwt","session_token"];for(const t of n)e.searchParams.has(t)&&e.searchParams.set(t,"[REDACTED]");return e.toString()}catch(e){return t}}stop(){this.active&&(this.active=!1,this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.originalXHROpen&&(XMLHttpRequest.prototype.open=this.originalXHROpen,this.originalXHROpen=null),this.originalXHRSend&&(XMLHttpRequest.prototype.send=this.originalXHRSend,this.originalXHRSend=null))}}const ie=["log","warn","error","debug","info"];class re{constructor(){this.originals={},this.active=!1}start(t){if(!this.active&&"undefined"!=typeof console){this.active=!0;for(const e of ie){const n=console[e];"function"==typeof n&&(this.originals[e]=n,console[e]=(...i)=>{n.apply(console,i),i.length>0&&"string"==typeof i[0]&&i[0].includes("__wr_sdk__")||i.length>=2&&"string"==typeof i[0]&&i[0].includes("[WebRec]")||Qt(()=>{const n=i.map(t=>{if("string"==typeof t)return t;try{return JSON.stringify(t)}catch(e){return String(t)}}).join(" ");t({level:e,message:n.substring(0,5e3),url:"undefined"!=typeof location?location.href:""})})})}}}stop(){if(this.active){this.active=!1;for(const t of ie)this.originals[t]&&(console[t]=this.originals[t]);this.originals={}}}}class se{constructor(){this.errorHandler=null,this.rejectionHandler=null,this.active=!1}start(t){this.active||(this.active=!0,this.errorHandler=e=>{Qt(()=>{var n,i;("Script error."!==e.message||e.filename||e.lineno)&&t({type:(null===(n=e.error)||void 0===n?void 0:n.name)||"Error",message:e.message||"Unknown error",stack:null===(i=e.error)||void 0===i?void 0:i.stack,url:e.filename,line:e.lineno,column:e.colno})})},this.rejectionHandler=e=>{Qt(()=>{const n=e.reason;t({type:"UnhandledRejection",message:(null==n?void 0:n.message)||String(n),stack:null==n?void 0:n.stack,url:"undefined"!=typeof location?location.href:void 0})})},window.addEventListener("error",this.errorHandler),window.addEventListener("unhandledrejection",this.rejectionHandler))}stop(){this.active&&(this.active=!1,this.errorHandler&&(window.removeEventListener("error",this.errorHandler),this.errorHandler=null),this.rejectionHandler&&(window.removeEventListener("unhandledrejection",this.rejectionHandler),this.rejectionHandler=null))}}const oe=new Set(["INPUT","TEXTAREA","SELECT"]);function ae(t){const e=[];let n=t,i=0;for(;n&&i<3;){const t=n.tagName.toLowerCase();if(n.id){e.unshift(`${t}#${n.id}`);break}const r=n.className&&"string"==typeof n.className?n.className.trim().split(/\s+/).filter(Boolean).join("."):"",s=n.getAttribute("aria-label");r?e.unshift(`${t}.${r}`):s?e.unshift(`${t}[aria-label="${s}"]`):e.unshift(t),n=n.parentElement,i++}return e.join(" > ")}const le=/\b(modal|dialog|slideover|drawer)\b/i;function ce(t){if("DIALOG"===t.tagName)return!0;if("dialog"===t.getAttribute("role"))return!0;if("true"===t.getAttribute("aria-modal"))return!0;const e="string"==typeof t.className?t.className:"";return le.test(e)}function de(t){const e=t.querySelector("h1, h2, h3");return e?(e.textContent||"").trim().substring(0,200):t.getAttribute("aria-label")||""}class he{constructor(){this.callback=null,this.observer=null,this.clickHandler=null,this.submitHandler=null,this.changeHandler=null,this.active=!1,this.dialogDebounceMap=new Map}start(t){this.active||(this.active=!0,this.callback=t,this.startClickCapture(),this.startSubmitCapture(),this.startChangeCapture(),this.startDialogDetection())}stop(){this.active&&(this.active=!1,this.clickHandler&&(document.removeEventListener("click",this.clickHandler,!0),this.clickHandler=null),this.submitHandler&&(document.removeEventListener("submit",this.submitHandler,!0),this.submitHandler=null),this.changeHandler&&(document.removeEventListener("change",this.changeHandler,!0),this.changeHandler=null),this.observer&&(this.observer.disconnect(),this.observer=null),this.dialogDebounceMap.clear(),this.callback=null)}startClickCapture(){"undefined"!=typeof document&&(this.clickHandler=t=>{Qt(()=>{const e=t.target;if(!e||!e.tagName)return;const n=e.tagName.toLowerCase(),i=oe.has(e.tagName)?"":function(t){let e="";for(let n=0;n<t.childNodes.length;n++){const i=t.childNodes[n];i.nodeType===Node.TEXT_NODE&&(e+=i.textContent||"")}return e.trim().substring(0,200)}(e),r=e.id||"",s="string"==typeof e.className?e.className:"",o=e.getAttribute("aria-label")||"",a=e.getAttribute("role")||"",l=e.getAttribute("href")||"",c=function(t){const e={};if(!(t instanceof HTMLElement&&t.dataset))return e;let n=0;for(const[i,r]of Object.entries(t.dataset)){if(n>=10)break;e[i]=r||"",n++}return e}(e),d=ae(e),h=e.closest("form"),u=(null==h?void 0:h.getAttribute("action"))||"",p=(null==h?void 0:h.id)||"";this.emit({type:5,timestamp:Date.now(),data:{tag:"recorder:enriched_click",payload:{element_tag:n,element_text:i,element_selector:d,element_classes:s,element_id:r,element_aria_label:o,element_role:a,element_href:l,element_data_attrs:c,parent_form_action:u,parent_form_id:p,page_url:window.location.href,click_x:t.clientX,click_y:t.clientY,viewport_width:window.innerWidth,viewport_height:window.innerHeight}}})})},document.addEventListener("click",this.clickHandler,{capture:!0}))}startSubmitCapture(){"undefined"!=typeof document&&(this.submitHandler=t=>{Qt(()=>{const e=t.target;if(!e||"FORM"!==e.tagName)return;const n=e.querySelectorAll("input, select, textarea").length;this.emit({type:5,timestamp:Date.now(),data:{tag:"recorder:form_submit",payload:{form_action:e.getAttribute("action")||"",form_id:e.id||"",form_name:e.getAttribute("name")||"",form_method:e.getAttribute("method")||"",field_count:n,page_url:window.location.href}}})})},document.addEventListener("submit",this.submitHandler,{capture:!0}))}startChangeCapture(){"undefined"!=typeof document&&(this.changeHandler=t=>{Qt(()=>{const e=t.target;if(!e||!e.tagName)return;const n=e.tagName;if("SELECT"===n){const t=e,n=t.options[t.selectedIndex],i=n?(n.textContent||"").trim().substring(0,200):"";this.emit({type:5,timestamp:Date.now(),data:{tag:"recorder:select_change",payload:{element_selector:ae(e),element_id:e.id||"",element_name:e.getAttribute("name")||"",selected_text:i,page_url:window.location.href}}})}else if("INPUT"===n){const t=e,n=(t.type||"").toLowerCase();"checkbox"!==n&&"radio"!==n||this.emit({type:5,timestamp:Date.now(),data:{tag:"recorder:checkbox_change",payload:{element_selector:ae(e),element_id:e.id||"",element_name:e.getAttribute("name")||"",input_type:n,checked:t.checked,page_url:window.location.href}}})}})},document.addEventListener("change",this.changeHandler,{capture:!0}))}startDialogDetection(){"undefined"!=typeof document&&"undefined"!=typeof MutationObserver&&(this.observer=new MutationObserver(t=>{Qt(()=>{const e=Date.now();for(const n of t){for(let t=0;t<n.addedNodes.length;t++){const i=n.addedNodes[t];if(i.nodeType!==Node.ELEMENT_NODE)continue;const r=i,s=ce(r)?[r]:Array.from(r.querySelectorAll('[role="dialog"], [aria-modal="true"], dialog, [class*="modal"], [class*="dialog"], [class*="slideover"], [class*="drawer"]'));for(const t of s){if(!ce(t))continue;const n=this.dialogDebounceMap.get(t);n&&e-n<200||(this.dialogDebounceMap.set(t,e),this.emit({type:5,timestamp:e,data:{tag:"recorder:dialog_open",payload:{dialog_title:de(t),dialog_selector:ae(t),page_url:window.location.href}}}))}}for(let t=0;t<n.removedNodes.length;t++){const i=n.removedNodes[t];if(i.nodeType!==Node.ELEMENT_NODE)continue;const r=i,s=ce(r)?[r]:Array.from(r.querySelectorAll('[role="dialog"], [aria-modal="true"], dialog, [class*="modal"], [class*="dialog"], [class*="slideover"], [class*="drawer"]'));for(const t of s){if(!ce(t))continue;const n=this.dialogDebounceMap.get(t);n&&e-n<200||(this.dialogDebounceMap.set(t,e),this.emit({type:5,timestamp:e,data:{tag:"recorder:dialog_close",payload:{dialog_selector:ae(t),page_url:window.location.href}}}))}}}})}),document.body&&this.observer.observe(document.body,{childList:!0,subtree:!0}))}emit(t){this.callback&&this.callback(t)}}const ue=new Set(["A","BUTTON","INPUT","SELECT","TEXTAREA","LABEL","SUMMARY"]),pe=new Set(["button","link","tab","menuitem","checkbox","radio","switch","option"]);class ge{constructor(){this.callback=null,this.clickHandler=null,this.pendingClicks=[],this.active=!1,this.origXhrOpen=null,this.origFetch=null,this.activeNetworkCount=0}start(t){this.active||"undefined"==typeof document||(this.active=!0,this.callback=t,this.interceptNetwork(),this.clickHandler=t=>{Qt(()=>{var e;const n=t.target;if(!n||!n.tagName)return;if(!function(t){if(ue.has(t.tagName))return!0;const e=t.getAttribute("role");return!(!e||!pe.has(e))||(!!t.closest('a, button, [role="button"], [role="link"]')||"pointer"===window.getComputedStyle(t).cursor)}(n))return;const i=n.tagName;if("INPUT"===i){const t=null===(e=n.type)||void 0===e?void 0:e.toLowerCase();if("text"===t||"password"===t||"email"===t||"search"===t||"tel"===t||"number"===t||"url"===t)return}if("TEXTAREA"===i)return;const r=function(t){const e=[];let n=t,i=0;for(;n&&i<3;){const t=n.tagName.toLowerCase();if(n.id){e.unshift(`${t}#${n.id}`);break}const r=n.className&&"string"==typeof n.className?n.className.trim().split(/\s+/).filter(Boolean).slice(0,3).join("."):"";r?e.unshift(`${t}.${r}`):e.unshift(t),n=n.parentElement,i++}return e.join(" > ")}(n),s=function(t){let e="";for(let n=0;n<t.childNodes.length;n++){const i=t.childNodes[n];i.nodeType===Node.TEXT_NODE&&(e+=i.textContent||"")}return e.trim().substring(0,200)}(n),o=location.href,a=Date.now(),l=t.clientX,c=t.clientY,d=this.activeNetworkCount;let h=!1;const u=new MutationObserver(()=>{h=!0,m()}),p=[n,n.parentElement,document.body].filter(Boolean);for(const t of p)u.observe(t,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const g={target:n,x:l,y:c,selector:r,text:s,url:o,timestamp:a,timer:0,observer:u,resolved:!1,networkActive:!1},m=()=>{if(g.resolved)return;g.resolved=!0,clearTimeout(g.timer),u.disconnect();const t=this.pendingClicks.indexOf(g);t>=0&&this.pendingClicks.splice(t,1)},f=location.href;g.timer=setTimeout(()=>{g.resolved||(location.href===f?this.activeNetworkCount>d?m():(m(),this.callback&&this.callback({type:5,timestamp:a,data:{tag:"recorder:dead_click",payload:{x:l,y:c,target_selector:r,target_text:s,url:o,timestamp:a}}})):m())},2e3),this.pendingClicks.push(g)})},document.addEventListener("click",this.clickHandler,{capture:!0}))}stop(){if(this.active){this.active=!1,this.clickHandler&&(document.removeEventListener("click",this.clickHandler,!0),this.clickHandler=null);for(const t of this.pendingClicks)clearTimeout(t.timer),t.observer.disconnect();this.pendingClicks=[],this.restoreNetwork(),this.callback=null}}interceptNetwork(){if("undefined"==typeof window)return;const t=this;this.origXhrOpen=XMLHttpRequest.prototype.open;const e=this.origXhrOpen;XMLHttpRequest.prototype.open=function(...n){t.activeNetworkCount++;const i=()=>{t.activeNetworkCount=Math.max(0,t.activeNetworkCount-1)};return this.addEventListener("loadend",i,{once:!0}),this.addEventListener("error",i,{once:!0}),this.addEventListener("abort",i,{once:!0}),e.apply(this,n)},this.origFetch=window.fetch;const n=this.origFetch;window.fetch=function(...e){return t.activeNetworkCount++,n.apply(this,e).then(e=>(t.activeNetworkCount=Math.max(0,t.activeNetworkCount-1),e),e=>{throw t.activeNetworkCount=Math.max(0,t.activeNetworkCount-1),e})}}restoreNetwork(){this.origXhrOpen&&(XMLHttpRequest.prototype.open=this.origXhrOpen,this.origXhrOpen=null),this.origFetch&&"undefined"!=typeof window&&(window.fetch=this.origFetch,this.origFetch=null),this.activeNetworkCount=0}}function me(t){const e=[];let n=t,i=0;for(;n&&i<3;){const t=n.tagName.toLowerCase();if(n.id){e.unshift(`${t}#${n.id}`);break}const r=n.className&&"string"==typeof n.className?n.className.trim().split(/\s+/).filter(Boolean).slice(0,3).join("."):"";r?e.unshift(`${t}.${r}`):e.unshift(t),n=n.parentElement,i++}return e.join(" > ")}class fe{constructor(){this.callback=null,this.clickHandler=null,this.errorHandler=null,this.rejectionHandler=null,this.clickBuffer=[],this.active=!1}start(t){this.active||"undefined"==typeof window||(this.active=!0,this.callback=t,this.clickHandler=t=>{Qt(()=>{const e=t.target;if(!e||!e.tagName)return;const n={timestamp:Date.now(),target:me(e),x:t.clientX,y:t.clientY};this.clickBuffer.push(n),this.clickBuffer.length>5&&this.clickBuffer.shift()})},this.errorHandler=t=>{Qt(()=>{var e;("Script error."!==t.message||t.filename||t.lineno)&&this.checkForCorrelatedClick((null===(e=t.error)||void 0===e?void 0:e.name)||"Error",t.message||String(t.error)||"Unknown error",location.href)})},this.rejectionHandler=t=>{Qt(()=>{const e=t.reason,n=(null==e?void 0:e.name)||"UnhandledRejection",i=(null==e?void 0:e.message)||String(e)||"Unhandled promise rejection";this.checkForCorrelatedClick(n,i,location.href)})},document.addEventListener("click",this.clickHandler,{capture:!0}),window.addEventListener("error",this.errorHandler),window.addEventListener("unhandledrejection",this.rejectionHandler))}stop(){this.active&&(this.active=!1,this.clickHandler&&(document.removeEventListener("click",this.clickHandler,!0),this.clickHandler=null),this.errorHandler&&(window.removeEventListener("error",this.errorHandler),this.errorHandler=null),this.rejectionHandler&&(window.removeEventListener("unhandledrejection",this.rejectionHandler),this.rejectionHandler=null),this.clickBuffer=[],this.callback=null)}checkForCorrelatedClick(t,e,n){const i=Date.now();for(let r=this.clickBuffer.length-1;r>=0;r--){const s=this.clickBuffer[r];if(i-s.timestamp>1e3)break;this.callback&&this.callback({type:5,timestamp:i,data:{tag:"recorder:error_click",payload:{click_x:s.x,click_y:s.y,click_target:s.target,click_timestamp:s.timestamp,error_type:t.substring(0,200),error_message:e.substring(0,2e3),url:n}}});break}}}class ye{constructor(){this.callback=null,this.scrollHandler=null,this.visibilityHandler=null,this.active=!1,this.maxDepthPercent=0,this.currentUrl="",this.throttleTimer=null,this.lastEmittedUrl="",this.origPushState=null,this.origReplaceState=null,this.popstateHandler=null}start(t){this.active||"undefined"==typeof window||(this.active=!0,this.callback=t,this.currentUrl=location.href,this.maxDepthPercent=this.calculateDepth(),this.scrollHandler=()=>{this.throttleTimer||(this.throttleTimer=setTimeout(()=>{this.throttleTimer=null,Qt(()=>{const t=this.calculateDepth();t>this.maxDepthPercent&&(this.maxDepthPercent=t)})},500))},this.visibilityHandler=()=>{"hidden"===document.visibilityState&&this.emitDepth()},window.addEventListener("scroll",this.scrollHandler,{passive:!0}),document.addEventListener("visibilitychange",this.visibilityHandler),this.interceptNavigation())}stop(){this.active&&(this.active=!1,this.emitDepth(),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null),this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null),this.throttleTimer&&(clearTimeout(this.throttleTimer),this.throttleTimer=null),this.restoreNavigation(),this.callback=null)}calculateDepth(){var t,e,n,i;const r=window.scrollY||document.documentElement.scrollTop||0,s=window.innerHeight||document.documentElement.clientHeight||0,o=Math.max((null===(t=document.body)||void 0===t?void 0:t.scrollHeight)||0,(null===(e=document.documentElement)||void 0===e?void 0:e.scrollHeight)||0,(null===(n=document.body)||void 0===n?void 0:n.offsetHeight)||0,(null===(i=document.documentElement)||void 0===i?void 0:i.offsetHeight)||0);if(o<=s)return 100;const a=o-s;if(a<=0)return 100;return Math.min(100,Math.round(r/a*100))}emitDepth(){var t,e;if(!this.callback)return;if(!this.currentUrl)return;if(this.currentUrl===this.lastEmittedUrl&&0===this.maxDepthPercent)return;const n=window.innerHeight||document.documentElement.clientHeight||0,i=Math.max((null===(t=document.body)||void 0===t?void 0:t.scrollHeight)||0,(null===(e=document.documentElement)||void 0===e?void 0:e.scrollHeight)||0);this.callback({type:5,timestamp:Date.now(),data:{tag:"recorder:scroll_depth",payload:{url:this.currentUrl,max_depth_percent:this.maxDepthPercent,viewport_height:n,document_height:i}}}),this.lastEmittedUrl=this.currentUrl}onNavigate(){const t=location.href;t!==this.currentUrl&&(this.emitDepth(),this.currentUrl=t,this.maxDepthPercent=0,setTimeout(()=>{Qt(()=>{this.maxDepthPercent=this.calculateDepth()})},100))}interceptNavigation(){this.origPushState=history.pushState.bind(history),this.origReplaceState=history.replaceState.bind(history);const t=this;history.pushState=function(e,n,i){t.origPushState(e,n,i),Qt(()=>t.onNavigate())},history.replaceState=function(e,n,i){t.origReplaceState(e,n,i),Qt(()=>t.onNavigate())},this.popstateHandler=()=>Qt(()=>this.onNavigate()),window.addEventListener("popstate",this.popstateHandler)}restoreNavigation(){this.origPushState&&(history.pushState=this.origPushState,this.origPushState=null),this.origReplaceState&&(history.replaceState=this.origReplaceState,this.origReplaceState=null),this.popstateHandler&&(window.removeEventListener("popstate",this.popstateHandler),this.popstateHandler=null)}}
16
+ /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function be(t){let e=t.length;for(;--e>=0;)t[e]=0}const ve=256,we=286,Ie=30,_e=15,Ce=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ke=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Se=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ae=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),xe=new Array(576);be(xe);const Ee=new Array(60);be(Ee);const Te=new Array(512);be(Te);const Re=new Array(256);be(Re);const Ne=new Array(29);be(Ne);const Me=new Array(Ie);function Oe(t,e,n,i,r){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=i,this.max_length=r,this.has_stree=t&&t.length}let De,Le,Fe;function ze(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}be(Me);const Ue=t=>t<256?Te[t]:Te[256+(t>>>7)],He=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Be=(t,e,n)=>{t.bi_valid>16-n?(t.bi_buf|=e<<t.bi_valid&65535,He(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=n-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)},Ze=(t,e,n)=>{Be(t,n[2*e],n[2*e+1])},We=(t,e)=>{let n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1},Ge=(t,e,n)=>{const i=new Array(16);let r,s,o=0;for(r=1;r<=_e;r++)o=o+n[r-1]<<1,i[r]=o;for(s=0;s<=e;s++){let e=t[2*s+1];0!==e&&(t[2*s]=We(i[e]++,e))}},Ve=t=>{let e;for(e=0;e<we;e++)t.dyn_ltree[2*e]=0;for(e=0;e<Ie;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},Ke=t=>{t.bi_valid>8?He(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},qe=(t,e,n,i)=>{const r=2*e,s=2*n;return t[r]<t[s]||t[r]===t[s]&&i[e]<=i[n]},je=(t,e,n)=>{const i=t.heap[n];let r=n<<1;for(;r<=t.heap_len&&(r<t.heap_len&&qe(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!qe(e,i,t.heap[r],t.depth));)t.heap[n]=t.heap[r],n=r,r<<=1;t.heap[n]=i},Pe=(t,e,n)=>{let i,r,s,o,a=0;if(0!==t.sym_next)do{i=255&t.pending_buf[t.sym_buf+a++],i+=(255&t.pending_buf[t.sym_buf+a++])<<8,r=t.pending_buf[t.sym_buf+a++],0===i?Ze(t,r,e):(s=Re[r],Ze(t,s+ve+1,e),o=Ce[s],0!==o&&(r-=Ne[s],Be(t,r,o)),i--,s=Ue(i),Ze(t,s,n),o=ke[s],0!==o&&(i-=Me[s],Be(t,i,o)))}while(a<t.sym_next);Ze(t,256,e)},Ye=(t,e)=>{const n=e.dyn_tree,i=e.stat_desc.static_tree,r=e.stat_desc.has_stree,s=e.stat_desc.elems;let o,a,l,c=-1;for(t.heap_len=0,t.heap_max=573,o=0;o<s;o++)0!==n[2*o]?(t.heap[++t.heap_len]=c=o,t.depth[o]=0):n[2*o+1]=0;for(;t.heap_len<2;)l=t.heap[++t.heap_len]=c<2?++c:0,n[2*l]=1,t.depth[l]=0,t.opt_len--,r&&(t.static_len-=i[2*l+1]);for(e.max_code=c,o=t.heap_len>>1;o>=1;o--)je(t,n,o);l=s;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],je(t,n,1),a=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=a,n[2*l]=n[2*o]+n[2*a],t.depth[l]=(t.depth[o]>=t.depth[a]?t.depth[o]:t.depth[a])+1,n[2*o+1]=n[2*a+1]=l,t.heap[1]=l++,je(t,n,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],((t,e)=>{const n=e.dyn_tree,i=e.max_code,r=e.stat_desc.static_tree,s=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let c,d,h,u,p,g,m=0;for(u=0;u<=_e;u++)t.bl_count[u]=0;for(n[2*t.heap[t.heap_max]+1]=0,c=t.heap_max+1;c<573;c++)d=t.heap[c],u=n[2*n[2*d+1]+1]+1,u>l&&(u=l,m++),n[2*d+1]=u,d>i||(t.bl_count[u]++,p=0,d>=a&&(p=o[d-a]),g=n[2*d],t.opt_len+=g*(u+p),s&&(t.static_len+=g*(r[2*d+1]+p)));if(0!==m){do{for(u=l-1;0===t.bl_count[u];)u--;t.bl_count[u]--,t.bl_count[u+1]+=2,t.bl_count[l]--,m-=2}while(m>0);for(u=l;0!==u;u--)for(d=t.bl_count[u];0!==d;)h=t.heap[--c],h>i||(n[2*h+1]!==u&&(t.opt_len+=(u-n[2*h+1])*n[2*h],n[2*h+1]=u),d--)}})(t,e),Ge(n,c,t.bl_count)},Xe=(t,e,n)=>{let i,r,s=-1,o=e[1],a=0,l=7,c=4;for(0===o&&(l=138,c=3),e[2*(n+1)+1]=65535,i=0;i<=n;i++)r=o,o=e[2*(i+1)+1],++a<l&&r===o||(a<c?t.bl_tree[2*r]+=a:0!==r?(r!==s&&t.bl_tree[2*r]++,t.bl_tree[32]++):a<=10?t.bl_tree[34]++:t.bl_tree[36]++,a=0,s=r,0===o?(l=138,c=3):r===o?(l=6,c=3):(l=7,c=4))},Qe=(t,e,n)=>{let i,r,s=-1,o=e[1],a=0,l=7,c=4;for(0===o&&(l=138,c=3),i=0;i<=n;i++)if(r=o,o=e[2*(i+1)+1],!(++a<l&&r===o)){if(a<c)do{Ze(t,r,t.bl_tree)}while(0!==--a);else 0!==r?(r!==s&&(Ze(t,r,t.bl_tree),a--),Ze(t,16,t.bl_tree),Be(t,a-3,2)):a<=10?(Ze(t,17,t.bl_tree),Be(t,a-3,3)):(Ze(t,18,t.bl_tree),Be(t,a-11,7));a=0,s=r,0===o?(l=138,c=3):r===o?(l=6,c=3):(l=7,c=4)}};let Je=!1;const $e=(t,e,n,i)=>{Be(t,0+(i?1:0),3),Ke(t),He(t,n),He(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n};var tn=(t,e,n,i)=>{let r,s,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=(t=>{let e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<ve;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),Ye(t,t.l_desc),Ye(t,t.d_desc),o=(t=>{let e;for(Xe(t,t.dyn_ltree,t.l_desc.max_code),Xe(t,t.dyn_dtree,t.d_desc.max_code),Ye(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*Ae[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e})(t),r=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=r&&(r=s)):r=s=n+5,n+4<=r&&-1!==e?$e(t,e,n,i):4===t.strategy||s===r?(Be(t,2+(i?1:0),3),Pe(t,xe,Ee)):(Be(t,4+(i?1:0),3),((t,e,n,i)=>{let r;for(Be(t,e-257,5),Be(t,n-1,5),Be(t,i-4,4),r=0;r<i;r++)Be(t,t.bl_tree[2*Ae[r]+1],3);Qe(t,t.dyn_ltree,e-1),Qe(t,t.dyn_dtree,n-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),Pe(t,t.dyn_ltree,t.dyn_dtree)),Ve(t),i&&Ke(t)},en={_tr_init:t=>{Je||((()=>{let t,e,n,i,r;const s=new Array(16);for(n=0,i=0;i<28;i++)for(Ne[i]=n,t=0;t<1<<Ce[i];t++)Re[n++]=i;for(Re[n-1]=i,r=0,i=0;i<16;i++)for(Me[i]=r,t=0;t<1<<ke[i];t++)Te[r++]=i;for(r>>=7;i<Ie;i++)for(Me[i]=r<<7,t=0;t<1<<ke[i]-7;t++)Te[256+r++]=i;for(e=0;e<=_e;e++)s[e]=0;for(t=0;t<=143;)xe[2*t+1]=8,t++,s[8]++;for(;t<=255;)xe[2*t+1]=9,t++,s[9]++;for(;t<=279;)xe[2*t+1]=7,t++,s[7]++;for(;t<=287;)xe[2*t+1]=8,t++,s[8]++;for(Ge(xe,287,s),t=0;t<Ie;t++)Ee[2*t+1]=5,Ee[2*t]=We(t,5);De=new Oe(xe,Ce,257,we,_e),Le=new Oe(Ee,ke,0,Ie,_e),Fe=new Oe(new Array(0),Se,0,19,7)})(),Je=!0),t.l_desc=new ze(t.dyn_ltree,De),t.d_desc=new ze(t.dyn_dtree,Le),t.bl_desc=new ze(t.bl_tree,Fe),t.bi_buf=0,t.bi_valid=0,Ve(t)},_tr_stored_block:$e,_tr_flush_block:tn,_tr_tally:(t,e,n)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=n,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(Re[n]+ve+1)]++,t.dyn_dtree[2*Ue(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{Be(t,2,3),Ze(t,256,xe),(t=>{16===t.bi_valid?(He(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)})(t)}};var nn=(t,e,n,i)=>{let r=65535&t,s=t>>>16&65535,o=0;for(;0!==n;){o=n>2e3?2e3:n,n-=o;do{r=r+e[i++]|0,s=s+r|0}while(--o);r%=65521,s%=65521}return r|s<<16};const rn=new Uint32Array((()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e})());var sn=(t,e,n,i)=>{const r=rn,s=i+n;t^=-1;for(let n=i;n<s;n++)t=t>>>8^r[255&(t^e[n])];return-1^t},on={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},an={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:ln,_tr_stored_block:cn,_tr_flush_block:dn,_tr_tally:hn,_tr_align:un}=en,{Z_NO_FLUSH:pn,Z_PARTIAL_FLUSH:gn,Z_FULL_FLUSH:mn,Z_FINISH:fn,Z_BLOCK:yn,Z_OK:bn,Z_STREAM_END:vn,Z_STREAM_ERROR:wn,Z_DATA_ERROR:In,Z_BUF_ERROR:_n,Z_DEFAULT_COMPRESSION:Cn,Z_FILTERED:kn,Z_HUFFMAN_ONLY:Sn,Z_RLE:An,Z_FIXED:xn,Z_DEFAULT_STRATEGY:En,Z_UNKNOWN:Tn,Z_DEFLATED:Rn}=an,Nn=258,Mn=262,On=42,Dn=113,Ln=666,Fn=(t,e)=>(t.msg=on[e],e),zn=t=>2*t-(t>4?9:0),Un=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Hn=t=>{let e,n,i,r=t.w_size;e=t.hash_size,i=e;do{n=t.head[--i],t.head[i]=n>=r?n-r:0}while(--e);e=r,i=e;do{n=t.prev[--i],t.prev[i]=n>=r?n-r:0}while(--e)};let Bn=(t,e,n)=>(e<<t.hash_shift^n)&t.hash_mask;const Zn=t=>{const e=t.state;let n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+n),t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))},Wn=(t,e)=>{dn(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Zn(t.strm)},Gn=(t,e)=>{t.pending_buf[t.pending++]=e},Vn=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},Kn=(t,e,n,i)=>{let r=t.avail_in;return r>i&&(r=i),0===r?0:(t.avail_in-=r,e.set(t.input.subarray(t.next_in,t.next_in+r),n),1===t.state.wrap?t.adler=nn(t.adler,e,r,n):2===t.state.wrap&&(t.adler=sn(t.adler,e,r,n)),t.next_in+=r,t.total_in+=r,r)},qn=(t,e)=>{let n,i,r=t.max_chain_length,s=t.strstart,o=t.prev_length,a=t.nice_match;const l=t.strstart>t.w_size-Mn?t.strstart-(t.w_size-Mn):0,c=t.window,d=t.w_mask,h=t.prev,u=t.strstart+Nn;let p=c[s+o-1],g=c[s+o];t.prev_length>=t.good_match&&(r>>=2),a>t.lookahead&&(a=t.lookahead);do{if(n=e,c[n+o]===g&&c[n+o-1]===p&&c[n]===c[s]&&c[++n]===c[s+1]){s+=2,n++;do{}while(c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&s<u);if(i=Nn-(u-s),s=u-Nn,i>o){if(t.match_start=e,o=i,i>=a)break;p=c[s+o-1],g=c[s+o]}}}while((e=h[e&d])>l&&0!==--r);return o<=t.lookahead?o:t.lookahead},jn=t=>{const e=t.w_size;let n,i,r;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-Mn)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Hn(t),i+=e),0===t.strm.avail_in)break;if(n=Kn(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=n,t.lookahead+t.insert>=3)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=Bn(t,t.ins_h,t.window[r+1]);t.insert&&(t.ins_h=Bn(t,t.ins_h,t.window[r+3-1]),t.prev[r&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=r,r++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<Mn&&0!==t.strm.avail_in)},Pn=(t,e)=>{let n,i,r,s=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,o=0,a=t.strm.avail_in;do{if(n=65535,r=t.bi_valid+42>>3,t.strm.avail_out<r)break;if(r=t.strm.avail_out-r,i=t.strstart-t.block_start,n>i+t.strm.avail_in&&(n=i+t.strm.avail_in),n>r&&(n=r),n<s&&(0===n&&e!==fn||e===pn||n!==i+t.strm.avail_in))break;o=e===fn&&n===i+t.strm.avail_in?1:0,cn(t,0,0,o),t.pending_buf[t.pending-4]=n,t.pending_buf[t.pending-3]=n>>8,t.pending_buf[t.pending-2]=~n,t.pending_buf[t.pending-1]=~n>>8,Zn(t.strm),i&&(i>n&&(i=n),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,n-=i),n&&(Kn(t.strm,t.strm.output,t.strm.next_out,n),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n)}while(0===o);return a-=t.strm.avail_in,a&&(a>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=a&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-a,t.strm.next_in),t.strstart),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),o?4:e!==pn&&e!==fn&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(r=t.window_size-t.strstart,t.strm.avail_in>r&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,r+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),r>t.strm.avail_in&&(r=t.strm.avail_in),r&&(Kn(t.strm,t.window,t.strstart,r),t.strstart+=r,t.insert+=r>t.w_size-t.insert?t.w_size-t.insert:r),t.high_water<t.strstart&&(t.high_water=t.strstart),r=t.bi_valid+42>>3,r=t.pending_buf_size-r>65535?65535:t.pending_buf_size-r,s=r>t.w_size?t.w_size:r,i=t.strstart-t.block_start,(i>=s||(i||e===fn)&&e!==pn&&0===t.strm.avail_in&&i<=r)&&(n=i>r?r:i,o=e===fn&&0===t.strm.avail_in&&n===i?1:0,cn(t,t.block_start,n,o),t.block_start+=n,Zn(t.strm)),o?3:1)},Yn=(t,e)=>{let n,i;for(;;){if(t.lookahead<Mn){if(jn(t),t.lookahead<Mn&&e===pn)return 1;if(0===t.lookahead)break}if(n=0,t.lookahead>=3&&(t.ins_h=Bn(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-Mn&&(t.match_length=qn(t,n)),t.match_length>=3)if(i=hn(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=Bn(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!==--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Bn(t,t.ins_h,t.window[t.strstart+1]);else i=hn(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(Wn(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===fn?(Wn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Wn(t,!1),0===t.strm.avail_out)?1:2},Xn=(t,e)=>{let n,i,r;for(;;){if(t.lookahead<Mn){if(jn(t),t.lookahead<Mn&&e===pn)return 1;if(0===t.lookahead)break}if(n=0,t.lookahead>=3&&(t.ins_h=Bn(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==n&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-Mn&&(t.match_length=qn(t,n),t.match_length<=5&&(t.strategy===kn||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){r=t.strstart+t.lookahead-3,i=hn(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=r&&(t.ins_h=Bn(t,t.ins_h,t.window[t.strstart+3-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!==--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(Wn(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(i=hn(t,0,t.window[t.strstart-1]),i&&Wn(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=hn(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===fn?(Wn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Wn(t,!1),0===t.strm.avail_out)?1:2};function Qn(t,e,n,i,r){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=i,this.func=r}const Jn=[new Qn(0,0,0,0,Pn),new Qn(4,4,8,4,Yn),new Qn(4,5,16,8,Yn),new Qn(4,6,32,32,Yn),new Qn(4,4,16,16,Xn),new Qn(8,16,32,32,Xn),new Qn(8,16,128,128,Xn),new Qn(8,32,128,256,Xn),new Qn(32,128,258,1024,Xn),new Qn(32,258,258,4096,Xn)];function $n(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Rn,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Un(this.dyn_ltree),Un(this.dyn_dtree),Un(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Un(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Un(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const ti=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==On&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Dn&&e.status!==Ln?1:0},ei=t=>{if(ti(t))return Fn(t,wn);t.total_in=t.total_out=0,t.data_type=Tn;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?On:Dn,t.adler=2===e.wrap?0:1,e.last_flush=-2,ln(e),bn},ni=t=>{const e=ei(t);var n;return e===bn&&((n=t.state).window_size=2*n.w_size,Un(n.head),n.max_lazy_match=Jn[n.level].max_lazy,n.good_match=Jn[n.level].good_length,n.nice_match=Jn[n.level].nice_length,n.max_chain_length=Jn[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),e},ii=(t,e,n,i,r,s)=>{if(!t)return wn;let o=1;if(e===Cn&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),r<1||r>9||n!==Rn||i<8||i>15||e<0||e>9||s<0||s>xn||8===i&&1!==o)return Fn(t,wn);8===i&&(i=9);const a=new $n;return t.state=a,a.strm=t,a.status=On,a.wrap=o,a.gzhead=null,a.w_bits=i,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=r+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<r+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=e,a.strategy=s,a.method=n,ni(t)};var ri={deflateInit:(t,e)=>ii(t,e,Rn,15,8,En),deflateInit2:ii,deflateReset:ni,deflateResetKeep:ei,deflateSetHeader:(t,e)=>ti(t)||2!==t.state.wrap?wn:(t.state.gzhead=e,bn),deflate:(t,e)=>{if(ti(t)||e>yn||e<0)return t?Fn(t,wn):wn;const n=t.state;if(!t.output||0!==t.avail_in&&!t.input||n.status===Ln&&e!==fn)return Fn(t,0===t.avail_out?_n:wn);const i=n.last_flush;if(n.last_flush=e,0!==n.pending){if(Zn(t),0===t.avail_out)return n.last_flush=-1,bn}else if(0===t.avail_in&&zn(e)<=zn(i)&&e!==fn)return Fn(t,_n);if(n.status===Ln&&0!==t.avail_in)return Fn(t,_n);if(n.status===On&&0===n.wrap&&(n.status=Dn),n.status===On){let e=Rn+(n.w_bits-8<<4)<<8,i=-1;if(i=n.strategy>=Sn||n.level<2?0:n.level<6?1:6===n.level?2:3,e|=i<<6,0!==n.strstart&&(e|=32),e+=31-e%31,Vn(n,e),0!==n.strstart&&(Vn(n,t.adler>>>16),Vn(n,65535&t.adler)),t.adler=1,n.status=Dn,Zn(t),0!==n.pending)return n.last_flush=-1,bn}if(57===n.status)if(t.adler=0,Gn(n,31),Gn(n,139),Gn(n,8),n.gzhead)Gn(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Gn(n,255&n.gzhead.time),Gn(n,n.gzhead.time>>8&255),Gn(n,n.gzhead.time>>16&255),Gn(n,n.gzhead.time>>24&255),Gn(n,9===n.level?2:n.strategy>=Sn||n.level<2?4:0),Gn(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Gn(n,255&n.gzhead.extra.length),Gn(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=sn(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Gn(n,0),Gn(n,0),Gn(n,0),Gn(n,0),Gn(n,0),Gn(n,9===n.level?2:n.strategy>=Sn||n.level<2?4:0),Gn(n,3),n.status=Dn,Zn(t),0!==n.pending)return n.last_flush=-1,bn;if(69===n.status){if(n.gzhead.extra){let e=n.pending,i=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let r=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>e&&(t.adler=sn(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex+=r,Zn(t),0!==n.pending)return n.last_flush=-1,bn;e=0,i-=r}let r=new Uint8Array(n.gzhead.extra);n.pending_buf.set(r.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>e&&(t.adler=sn(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let e,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=sn(t.adler,n.pending_buf,n.pending-i,i)),Zn(t),0!==n.pending)return n.last_flush=-1,bn;i=0}e=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,Gn(n,e)}while(0!==e);n.gzhead.hcrc&&n.pending>i&&(t.adler=sn(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let e,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=sn(t.adler,n.pending_buf,n.pending-i,i)),Zn(t),0!==n.pending)return n.last_flush=-1,bn;i=0}e=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,Gn(n,e)}while(0!==e);n.gzhead.hcrc&&n.pending>i&&(t.adler=sn(t.adler,n.pending_buf,n.pending-i,i))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Zn(t),0!==n.pending))return n.last_flush=-1,bn;Gn(n,255&t.adler),Gn(n,t.adler>>8&255),t.adler=0}if(n.status=Dn,Zn(t),0!==n.pending)return n.last_flush=-1,bn}if(0!==t.avail_in||0!==n.lookahead||e!==pn&&n.status!==Ln){let i=0===n.level?Pn(n,e):n.strategy===Sn?((t,e)=>{let n;for(;;){if(0===t.lookahead&&(jn(t),0===t.lookahead)){if(e===pn)return 1;break}if(t.match_length=0,n=hn(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(Wn(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===fn?(Wn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Wn(t,!1),0===t.strm.avail_out)?1:2})(n,e):n.strategy===An?((t,e)=>{let n,i,r,s;const o=t.window;for(;;){if(t.lookahead<=Nn){if(jn(t),t.lookahead<=Nn&&e===pn)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(r=t.strstart-1,i=o[r],i===o[++r]&&i===o[++r]&&i===o[++r])){s=t.strstart+Nn;do{}while(i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&r<s);t.match_length=Nn-(s-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=hn(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=hn(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(Wn(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===fn?(Wn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Wn(t,!1),0===t.strm.avail_out)?1:2})(n,e):Jn[n.level].func(n,e);if(3!==i&&4!==i||(n.status=Ln),1===i||3===i)return 0===t.avail_out&&(n.last_flush=-1),bn;if(2===i&&(e===gn?un(n):e!==yn&&(cn(n,0,0,!1),e===mn&&(Un(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Zn(t),0===t.avail_out))return n.last_flush=-1,bn}return e!==fn?bn:n.wrap<=0?vn:(2===n.wrap?(Gn(n,255&t.adler),Gn(n,t.adler>>8&255),Gn(n,t.adler>>16&255),Gn(n,t.adler>>24&255),Gn(n,255&t.total_in),Gn(n,t.total_in>>8&255),Gn(n,t.total_in>>16&255),Gn(n,t.total_in>>24&255)):(Vn(n,t.adler>>>16),Vn(n,65535&t.adler)),Zn(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?bn:vn)},deflateEnd:t=>{if(ti(t))return wn;const e=t.state.status;return t.state=null,e===Dn?Fn(t,In):bn},deflateSetDictionary:(t,e)=>{let n=e.length;if(ti(t))return wn;const i=t.state,r=i.wrap;if(2===r||1===r&&i.status!==On||i.lookahead)return wn;if(1===r&&(t.adler=nn(t.adler,e,n,0)),i.wrap=0,n>=i.w_size){0===r&&(Un(i.head),i.strstart=0,i.block_start=0,i.insert=0);let t=new Uint8Array(i.w_size);t.set(e.subarray(n-i.w_size,n),0),e=t,n=i.w_size}const s=t.avail_in,o=t.next_in,a=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,jn(i);i.lookahead>=3;){let t=i.strstart,e=i.lookahead-2;do{i.ins_h=Bn(i,i.ins_h,i.window[t+3-1]),i.prev[t&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=t,t++}while(--e);i.strstart=t,i.lookahead=2,jn(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=o,t.input=a,t.avail_in=s,i.wrap=r,bn},deflateInfo:"pako deflate (from Nodeca project)"};const si=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var oi=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const e in n)si(n,e)&&(t[e]=n[e])}}return t},ai=t=>{let e=0;for(let n=0,i=t.length;n<i;n++)e+=t[n].length;const n=new Uint8Array(e);for(let e=0,i=0,r=t.length;e<r;e++){let r=t[e];n.set(r,i),i+=r.length}return n};let li=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){li=!1}const ci=new Uint8Array(256);for(let t=0;t<256;t++)ci[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;ci[254]=ci[254]=1;var di=t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,n,i,r,s,o=t.length,a=0;for(r=0;r<o;r++)n=t.charCodeAt(r),55296==(64512&n)&&r+1<o&&(i=t.charCodeAt(r+1),56320==(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),r++)),a+=n<128?1:n<2048?2:n<65536?3:4;for(e=new Uint8Array(a),s=0,r=0;s<a;r++)n=t.charCodeAt(r),55296==(64512&n)&&r+1<o&&(i=t.charCodeAt(r+1),56320==(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),r++)),n<128?e[s++]=n:n<2048?(e[s++]=192|n>>>6,e[s++]=128|63&n):n<65536?(e[s++]=224|n>>>12,e[s++]=128|n>>>6&63,e[s++]=128|63&n):(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63,e[s++]=128|n>>>6&63,e[s++]=128|63&n);return e},hi=(t,e)=>{const n=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let i,r;const s=new Array(2*n);for(r=0,i=0;i<n;){let e=t[i++];if(e<128){s[r++]=e;continue}let o=ci[e];if(o>4)s[r++]=65533,i+=o-1;else{for(e&=2===o?31:3===o?15:7;o>1&&i<n;)e=e<<6|63&t[i++],o--;o>1?s[r++]=65533:e<65536?s[r++]=e:(e-=65536,s[r++]=55296|e>>10&1023,s[r++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&li)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let i=0;i<e;i++)n+=String.fromCharCode(t[i]);return n})(s,r)},ui=(t,e)=>{(e=e||t.length)>t.length&&(e=t.length);let n=e-1;for(;n>=0&&128==(192&t[n]);)n--;return n<0||0===n?e:n+ci[t[n]]>e?n:e};var pi=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const gi=Object.prototype.toString,{Z_NO_FLUSH:mi,Z_SYNC_FLUSH:fi,Z_FULL_FLUSH:yi,Z_FINISH:bi,Z_OK:vi,Z_STREAM_END:wi,Z_DEFAULT_COMPRESSION:Ii,Z_DEFAULT_STRATEGY:_i,Z_DEFLATED:Ci}=an;function ki(t){this.options=oi({level:Ii,method:Ci,chunkSize:16384,windowBits:15,memLevel:8,strategy:_i},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new pi,this.strm.avail_out=0;let n=ri.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==vi)throw new Error(on[n]);if(e.header&&ri.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?di(e.dictionary):"[object ArrayBuffer]"===gi.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,n=ri.deflateSetDictionary(this.strm,t),n!==vi)throw new Error(on[n]);this._dict_set=!0}}function Si(t,e){const n=new ki(e);if(n.push(t,!0),n.err)throw n.msg||on[n.err];return n.result}ki.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize;let r,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?bi:mi,"string"==typeof t?n.input=di(t):"[object ArrayBuffer]"===gi.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),(s===fi||s===yi)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(r=ri.deflate(n,s),r===wi)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),r=ri.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===vi;if(0!==n.avail_out){if(s>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},ki.prototype.onData=function(t){this.chunks.push(t)},ki.prototype.onEnd=function(t){t===vi&&(this.result=ai(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Ai={Deflate:ki,deflate:Si,deflateRaw:function(t,e){return(e=e||{}).raw=!0,Si(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,Si(t,e)}};const xi=16209;var Ei=function(t,e){let n,i,r,s,o,a,l,c,d,h,u,p,g,m,f,y,b,v,w,I,_,C,k,S;const A=t.state;n=t.next_in,k=t.input,i=n+(t.avail_in-5),r=t.next_out,S=t.output,s=r-(e-t.avail_out),o=r+(t.avail_out-257),a=A.dmax,l=A.wsize,c=A.whave,d=A.wnext,h=A.window,u=A.hold,p=A.bits,g=A.lencode,m=A.distcode,f=(1<<A.lenbits)-1,y=(1<<A.distbits)-1;t:do{p<15&&(u+=k[n++]<<p,p+=8,u+=k[n++]<<p,p+=8),b=g[u&f];e:for(;;){if(v=b>>>24,u>>>=v,p-=v,v=b>>>16&255,0===v)S[r++]=65535&b;else{if(!(16&v)){if(64&v){if(32&v){A.mode=16191;break t}t.msg="invalid literal/length code",A.mode=xi;break t}b=g[(65535&b)+(u&(1<<v)-1)];continue e}for(w=65535&b,v&=15,v&&(p<v&&(u+=k[n++]<<p,p+=8),w+=u&(1<<v)-1,u>>>=v,p-=v),p<15&&(u+=k[n++]<<p,p+=8,u+=k[n++]<<p,p+=8),b=m[u&y];;){if(v=b>>>24,u>>>=v,p-=v,v=b>>>16&255,16&v){if(I=65535&b,v&=15,p<v&&(u+=k[n++]<<p,p+=8,p<v&&(u+=k[n++]<<p,p+=8)),I+=u&(1<<v)-1,I>a){t.msg="invalid distance too far back",A.mode=xi;break t}if(u>>>=v,p-=v,v=r-s,I>v){if(v=I-v,v>c&&A.sane){t.msg="invalid distance too far back",A.mode=xi;break t}if(_=0,C=h,0===d){if(_+=l-v,v<w){w-=v;do{S[r++]=h[_++]}while(--v);_=r-I,C=S}}else if(d<v){if(_+=l+d-v,v-=d,v<w){w-=v;do{S[r++]=h[_++]}while(--v);if(_=0,d<w){v=d,w-=v;do{S[r++]=h[_++]}while(--v);_=r-I,C=S}}}else if(_+=d-v,v<w){w-=v;do{S[r++]=h[_++]}while(--v);_=r-I,C=S}for(;w>2;)S[r++]=C[_++],S[r++]=C[_++],S[r++]=C[_++],w-=3;w&&(S[r++]=C[_++],w>1&&(S[r++]=C[_++]))}else{_=r-I;do{S[r++]=S[_++],S[r++]=S[_++],S[r++]=S[_++],w-=3}while(w>2);w&&(S[r++]=S[_++],w>1&&(S[r++]=S[_++]))}break}if(64&v){t.msg="invalid distance code",A.mode=xi;break t}b=m[(65535&b)+(u&(1<<v)-1)]}}break}}while(n<i&&r<o);w=p>>3,n-=w,p-=w<<3,u&=(1<<p)-1,t.next_in=n,t.next_out=r,t.avail_in=n<i?i-n+5:5-(n-i),t.avail_out=r<o?o-r+257:257-(r-o),A.hold=u,A.bits=p};const Ti=15,Ri=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Ni=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Mi=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Oi=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Di=(t,e,n,i,r,s,o,a)=>{const l=a.bits;let c,d,h,u,p,g,m=0,f=0,y=0,b=0,v=0,w=0,I=0,_=0,C=0,k=0,S=null;const A=new Uint16Array(16),x=new Uint16Array(16);let E,T,R,N=null;for(m=0;m<=Ti;m++)A[m]=0;for(f=0;f<i;f++)A[e[n+f]]++;for(v=l,b=Ti;b>=1&&0===A[b];b--);if(v>b&&(v=b),0===b)return r[s++]=20971520,r[s++]=20971520,a.bits=1,0;for(y=1;y<b&&0===A[y];y++);for(v<y&&(v=y),_=1,m=1;m<=Ti;m++)if(_<<=1,_-=A[m],_<0)return-1;if(_>0&&(0===t||1!==b))return-1;for(x[1]=0,m=1;m<Ti;m++)x[m+1]=x[m]+A[m];for(f=0;f<i;f++)0!==e[n+f]&&(o[x[e[n+f]]++]=f);if(0===t?(S=N=o,g=20):1===t?(S=Ri,N=Ni,g=257):(S=Mi,N=Oi,g=0),k=0,f=0,m=y,p=s,w=v,I=0,h=-1,C=1<<v,u=C-1,1===t&&C>852||2===t&&C>592)return 1;for(;;){E=m-I,o[f]+1<g?(T=0,R=o[f]):o[f]>=g?(T=N[o[f]-g],R=S[o[f]-g]):(T=96,R=0),c=1<<m-I,d=1<<w,y=d;do{d-=c,r[p+(k>>I)+d]=E<<24|T<<16|R}while(0!==d);for(c=1<<m-1;k&c;)c>>=1;if(0!==c?(k&=c-1,k+=c):k=0,f++,0===--A[m]){if(m===b)break;m=e[n+o[f]]}if(m>v&&(k&u)!==h){for(0===I&&(I=v),p+=y,w=m-I,_=1<<w;w+I<b&&(_-=A[w+I],!(_<=0));)w++,_<<=1;if(C+=1<<w,1===t&&C>852||2===t&&C>592)return 1;h=k&u,r[h]=v<<24|w<<16|p-s}}return 0!==k&&(r[p+k]=m-I<<24|64<<16),a.bits=v,0};const{Z_FINISH:Li,Z_BLOCK:Fi,Z_TREES:zi,Z_OK:Ui,Z_STREAM_END:Hi,Z_NEED_DICT:Bi,Z_STREAM_ERROR:Zi,Z_DATA_ERROR:Wi,Z_MEM_ERROR:Gi,Z_BUF_ERROR:Vi,Z_DEFLATED:Ki}=an,qi=16180,ji=16190,Pi=16191,Yi=16192,Xi=16194,Qi=16199,Ji=16200,$i=16206,tr=16209,er=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function nr(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const ir=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<qi||e.mode>16211?1:0},rr=t=>{if(ir(t))return Zi;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=qi,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,Ui},sr=t=>{if(ir(t))return Zi;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,rr(t)},or=(t,e)=>{let n;if(ir(t))return Zi;const i=t.state;return e<0?(n=0,e=-e):(n=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Zi:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=n,i.wbits=e,sr(t))},ar=(t,e)=>{if(!t)return Zi;const n=new nr;t.state=n,n.strm=t,n.window=null,n.mode=qi;const i=or(t,e);return i!==Ui&&(t.state=null),i};let lr,cr,dr=!0;const hr=t=>{if(dr){lr=new Int32Array(512),cr=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Di(1,t.lens,0,288,lr,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Di(2,t.lens,0,32,cr,0,t.work,{bits:5}),dr=!1}t.lencode=lr,t.lenbits=9,t.distcode=cr,t.distbits=5},ur=(t,e,n,i)=>{let r;const s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(e.subarray(n-s.wsize,n),0),s.wnext=0,s.whave=s.wsize):(r=s.wsize-s.wnext,r>i&&(r=i),s.window.set(e.subarray(n-i,n-i+r),s.wnext),(i-=r)?(s.window.set(e.subarray(n-i,n),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=r))),0};var pr={inflateReset:sr,inflateReset2:or,inflateResetKeep:rr,inflateInit:t=>ar(t,15),inflateInit2:ar,inflate:(t,e)=>{let n,i,r,s,o,a,l,c,d,h,u,p,g,m,f,y,b,v,w,I,_,C,k=0;const S=new Uint8Array(4);let A,x;const E=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ir(t)||!t.output||!t.input&&0!==t.avail_in)return Zi;n=t.state,n.mode===Pi&&(n.mode=Yi),o=t.next_out,r=t.output,l=t.avail_out,s=t.next_in,i=t.input,a=t.avail_in,c=n.hold,d=n.bits,h=a,u=l,C=Ui;t:for(;;)switch(n.mode){case qi:if(0===n.wrap){n.mode=Yi;break}for(;d<16;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}if(2&n.wrap&&35615===c){0===n.wbits&&(n.wbits=15),n.check=0,S[0]=255&c,S[1]=c>>>8&255,n.check=sn(n.check,S,2,0),c=0,d=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){t.msg="incorrect header check",n.mode=tr;break}if((15&c)!==Ki){t.msg="unknown compression method",n.mode=tr;break}if(c>>>=4,d-=4,_=8+(15&c),0===n.wbits&&(n.wbits=_),_>15||_>n.wbits){t.msg="invalid window size",n.mode=tr;break}n.dmax=1<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=512&c?16189:Pi,c=0,d=0;break;case 16181:for(;d<16;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}if(n.flags=c,(255&n.flags)!==Ki){t.msg="unknown compression method",n.mode=tr;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=tr;break}n.head&&(n.head.text=c>>8&1),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,n.check=sn(n.check,S,2,0)),c=0,d=0,n.mode=16182;case 16182:for(;d<32;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}n.head&&(n.head.time=c),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,S[2]=c>>>16&255,S[3]=c>>>24&255,n.check=sn(n.check,S,4,0)),c=0,d=0,n.mode=16183;case 16183:for(;d<16;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}n.head&&(n.head.xflags=255&c,n.head.os=c>>8),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,n.check=sn(n.check,S,2,0)),c=0,d=0,n.mode=16184;case 16184:if(1024&n.flags){for(;d<16;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}n.length=c,n.head&&(n.head.extra_len=c),512&n.flags&&4&n.wrap&&(S[0]=255&c,S[1]=c>>>8&255,n.check=sn(n.check,S,2,0)),c=0,d=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(p=n.length,p>a&&(p=a),p&&(n.head&&(_=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(i.subarray(s,s+p),_)),512&n.flags&&4&n.wrap&&(n.check=sn(n.check,i,p,s)),a-=p,s+=p,n.length-=p),n.length))break t;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===a)break t;p=0;do{_=i[s+p++],n.head&&_&&n.length<65536&&(n.head.name+=String.fromCharCode(_))}while(_&&p<a);if(512&n.flags&&4&n.wrap&&(n.check=sn(n.check,i,p,s)),a-=p,s+=p,_)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===a)break t;p=0;do{_=i[s+p++],n.head&&_&&n.length<65536&&(n.head.comment+=String.fromCharCode(_))}while(_&&p<a);if(512&n.flags&&4&n.wrap&&(n.check=sn(n.check,i,p,s)),a-=p,s+=p,_)break t}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;d<16;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}if(4&n.wrap&&c!==(65535&n.check)){t.msg="header crc mismatch",n.mode=tr;break}c=0,d=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Pi;break;case 16189:for(;d<32;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}t.adler=n.check=er(c),c=0,d=0,n.mode=ji;case ji:if(0===n.havedict)return t.next_out=o,t.avail_out=l,t.next_in=s,t.avail_in=a,n.hold=c,n.bits=d,Bi;t.adler=n.check=1,n.mode=Pi;case Pi:if(e===Fi||e===zi)break t;case Yi:if(n.last){c>>>=7&d,d-=7&d,n.mode=$i;break}for(;d<3;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}switch(n.last=1&c,c>>>=1,d-=1,3&c){case 0:n.mode=16193;break;case 1:if(hr(n),n.mode=Qi,e===zi){c>>>=2,d-=2;break t}break;case 2:n.mode=16196;break;case 3:t.msg="invalid block type",n.mode=tr}c>>>=2,d-=2;break;case 16193:for(c>>>=7&d,d-=7&d;d<32;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}if((65535&c)!=(c>>>16^65535)){t.msg="invalid stored block lengths",n.mode=tr;break}if(n.length=65535&c,c=0,d=0,n.mode=Xi,e===zi)break t;case Xi:n.mode=16195;case 16195:if(p=n.length,p){if(p>a&&(p=a),p>l&&(p=l),0===p)break t;r.set(i.subarray(s,s+p),o),a-=p,s+=p,l-=p,o+=p,n.length-=p;break}n.mode=Pi;break;case 16196:for(;d<14;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}if(n.nlen=257+(31&c),c>>>=5,d-=5,n.ndist=1+(31&c),c>>>=5,d-=5,n.ncode=4+(15&c),c>>>=4,d-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=tr;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;d<3;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}n.lens[E[n.have++]]=7&c,c>>>=3,d-=3}for(;n.have<19;)n.lens[E[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,A={bits:n.lenbits},C=Di(0,n.lens,0,19,n.lencode,0,n.work,A),n.lenbits=A.bits,C){t.msg="invalid code lengths set",n.mode=tr;break}n.have=0,n.mode=16198;case 16198:for(;n.have<n.nlen+n.ndist;){for(;k=n.lencode[c&(1<<n.lenbits)-1],f=k>>>24,y=k>>>16&255,b=65535&k,!(f<=d);){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}if(b<16)c>>>=f,d-=f,n.lens[n.have++]=b;else{if(16===b){for(x=f+2;d<x;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}if(c>>>=f,d-=f,0===n.have){t.msg="invalid bit length repeat",n.mode=tr;break}_=n.lens[n.have-1],p=3+(3&c),c>>>=2,d-=2}else if(17===b){for(x=f+3;d<x;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}c>>>=f,d-=f,_=0,p=3+(7&c),c>>>=3,d-=3}else{for(x=f+7;d<x;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}c>>>=f,d-=f,_=0,p=11+(127&c),c>>>=7,d-=7}if(n.have+p>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=tr;break}for(;p--;)n.lens[n.have++]=_}}if(n.mode===tr)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=tr;break}if(n.lenbits=9,A={bits:n.lenbits},C=Di(1,n.lens,0,n.nlen,n.lencode,0,n.work,A),n.lenbits=A.bits,C){t.msg="invalid literal/lengths set",n.mode=tr;break}if(n.distbits=6,n.distcode=n.distdyn,A={bits:n.distbits},C=Di(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,A),n.distbits=A.bits,C){t.msg="invalid distances set",n.mode=tr;break}if(n.mode=Qi,e===zi)break t;case Qi:n.mode=Ji;case Ji:if(a>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=s,t.avail_in=a,n.hold=c,n.bits=d,Ei(t,u),o=t.next_out,r=t.output,l=t.avail_out,s=t.next_in,i=t.input,a=t.avail_in,c=n.hold,d=n.bits,n.mode===Pi&&(n.back=-1);break}for(n.back=0;k=n.lencode[c&(1<<n.lenbits)-1],f=k>>>24,y=k>>>16&255,b=65535&k,!(f<=d);){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}if(y&&!(240&y)){for(v=f,w=y,I=b;k=n.lencode[I+((c&(1<<v+w)-1)>>v)],f=k>>>24,y=k>>>16&255,b=65535&k,!(v+f<=d);){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}c>>>=v,d-=v,n.back+=v}if(c>>>=f,d-=f,n.back+=f,n.length=b,0===y){n.mode=16205;break}if(32&y){n.back=-1,n.mode=Pi;break}if(64&y){t.msg="invalid literal/length code",n.mode=tr;break}n.extra=15&y,n.mode=16201;case 16201:if(n.extra){for(x=n.extra;d<x;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}n.length+=c&(1<<n.extra)-1,c>>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;k=n.distcode[c&(1<<n.distbits)-1],f=k>>>24,y=k>>>16&255,b=65535&k,!(f<=d);){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}if(!(240&y)){for(v=f,w=y,I=b;k=n.distcode[I+((c&(1<<v+w)-1)>>v)],f=k>>>24,y=k>>>16&255,b=65535&k,!(v+f<=d);){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}c>>>=v,d-=v,n.back+=v}if(c>>>=f,d-=f,n.back+=f,64&y){t.msg="invalid distance code",n.mode=tr;break}n.offset=b,n.extra=15&y,n.mode=16203;case 16203:if(n.extra){for(x=n.extra;d<x;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}n.offset+=c&(1<<n.extra)-1,c>>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=tr;break}n.mode=16204;case 16204:if(0===l)break t;if(p=u-l,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=tr;break}p>n.wnext?(p-=n.wnext,g=n.wsize-p):g=n.wnext-p,p>n.length&&(p=n.length),m=n.window}else m=r,g=o-n.offset,p=n.length;p>l&&(p=l),l-=p,n.length-=p;do{r[o++]=m[g++]}while(--p);0===n.length&&(n.mode=Ji);break;case 16205:if(0===l)break t;r[o++]=n.length,l--,n.mode=Ji;break;case $i:if(n.wrap){for(;d<32;){if(0===a)break t;a--,c|=i[s++]<<d,d+=8}if(u-=l,t.total_out+=u,n.total+=u,4&n.wrap&&u&&(t.adler=n.check=n.flags?sn(n.check,r,u,o-u):nn(n.check,r,u,o-u)),u=l,4&n.wrap&&(n.flags?c:er(c))!==n.check){t.msg="incorrect data check",n.mode=tr;break}c=0,d=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;d<32;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}if(4&n.wrap&&c!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=tr;break}c=0,d=0}n.mode=16208;case 16208:C=Hi;break t;case tr:C=Wi;break t;case 16210:return Gi;default:return Zi}return t.next_out=o,t.avail_out=l,t.next_in=s,t.avail_in=a,n.hold=c,n.bits=d,(n.wsize||u!==t.avail_out&&n.mode<tr&&(n.mode<$i||e!==Li))&&ur(t,t.output,t.next_out,u-t.avail_out),h-=t.avail_in,u-=t.avail_out,t.total_in+=h,t.total_out+=u,n.total+=u,4&n.wrap&&u&&(t.adler=n.check=n.flags?sn(n.check,r,u,t.next_out-u):nn(n.check,r,u,t.next_out-u)),t.data_type=n.bits+(n.last?64:0)+(n.mode===Pi?128:0)+(n.mode===Qi||n.mode===Xi?256:0),(0===h&&0===u||e===Li)&&C===Ui&&(C=Vi),C},inflateEnd:t=>{if(ir(t))return Zi;let e=t.state;return e.window&&(e.window=null),t.state=null,Ui},inflateGetHeader:(t,e)=>{if(ir(t))return Zi;const n=t.state;return 2&n.wrap?(n.head=e,e.done=!1,Ui):Zi},inflateSetDictionary:(t,e)=>{const n=e.length;let i,r,s;return ir(t)?Zi:(i=t.state,0!==i.wrap&&i.mode!==ji?Zi:i.mode===ji&&(r=1,r=nn(r,e,n,0),r!==i.check)?Wi:(s=ur(t,e,n,n),s?(i.mode=16210,Gi):(i.havedict=1,Ui)))},inflateInfo:"pako inflate (from Nodeca project)"};var gr=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const mr=Object.prototype.toString,{Z_NO_FLUSH:fr,Z_FINISH:yr,Z_OK:br,Z_STREAM_END:vr,Z_NEED_DICT:wr,Z_STREAM_ERROR:Ir,Z_DATA_ERROR:_r,Z_MEM_ERROR:Cr}=an;function kr(t){this.options=oi({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(15&e.windowBits||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new pi,this.strm.avail_out=0;let n=pr.inflateInit2(this.strm,e.windowBits);if(n!==br)throw new Error(on[n]);if(this.header=new gr,pr.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=di(e.dictionary):"[object ArrayBuffer]"===mr.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=pr.inflateSetDictionary(this.strm,e.dictionary),n!==br)))throw new Error(on[n])}function Sr(t,e){const n=new kr(e);if(n.push(t),n.err)throw n.msg||on[n.err];return n.result}kr.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let s,o,a;if(this.ended)return!1;for(o=e===~~e?e:!0===e?yr:fr,"[object ArrayBuffer]"===mr.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),s=pr.inflate(n,o),s===wr&&r&&(s=pr.inflateSetDictionary(n,r),s===br?s=pr.inflate(n,o):s===_r&&(s=wr));n.avail_in>0&&s===vr&&n.state.wrap>0&&0!==t[n.next_in];)pr.inflateReset(n),s=pr.inflate(n,o);switch(s){case Ir:case _r:case wr:case Cr:return this.onEnd(s),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(0===n.avail_out||s===vr))if("string"===this.options.to){let t=ui(n.output,n.next_out),e=n.next_out-t,r=hi(n.output,t);n.next_out=e,n.avail_out=i-e,e&&n.output.set(n.output.subarray(t,t+e),0),this.onData(r)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(s!==br||0!==a){if(s===vr)return s=pr.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},kr.prototype.onData=function(t){this.chunks.push(t)},kr.prototype.onEnd=function(t){t===br&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=ai(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var Ar={Inflate:kr,inflate:Sr,inflateRaw:function(t,e){return(e=e||{}).raw=!0,Sr(t,e)},ungzip:Sr};const{Deflate:xr,deflate:Er,deflateRaw:Tr,gzip:Rr}=Ai,{Inflate:Nr,inflate:Mr,inflateRaw:Or,ungzip:Dr}=Ar;var Lr={Deflate:xr,deflate:Er,deflateRaw:Tr,gzip:Rr,Inflate:Nr,inflate:Mr,inflateRaw:Or,ungzip:Dr,constants:an};class Fr{constructor(t,e,n){this.queue=[],this.timer=null,this.seq=0,this.flushing=!1,this.identityProvider=null,this.config=t,this.sessionId=e,this.anonymousId=n||""}setIdentityProvider(t){this.identityProvider=t}start(){if(this.timer)return;const t=this.config.flushInterval*(.8+.4*Math.random());this.timer=setInterval(()=>this.flush(),t)}stop(){this.timer&&(clearInterval(this.timer),this.timer=null),this.flush()}enqueue(t){const e=this.config.maxQueueSize||2e3;this.queue.length>=e&&this.queue.splice(0,Math.floor(.1*e)),this.queue.push(t),this.queue.length>=this.config.batchSize&&this.flush()}flush(){var t;if(0===this.queue.length||this.flushing)return;const e=this.config.minSessionDuration||0;if(e>0&&this.config.sessionStartTime){if((Date.now()-this.config.sessionStartTime)/1e3<e)return}const n=this.queue.splice(0);this.seq++,this.flushing=!0,this.config.debug&&console.log("%c[WebRec]","color: #a855f7; font-weight: bold;",`Flushing batch #${this.seq}: ${n.length} events`);const i=null===(t=this.identityProvider)||void 0===t?void 0:t.call(this),r={url:"undefined"!=typeof location?location.href:"",userAgent:"undefined"!=typeof navigator?navigator.userAgent:"",screenWidth:"undefined"!=typeof screen?screen.width:0,screenHeight:"undefined"!=typeof screen?screen.height:0,timestamp:Date.now(),seq:this.seq};(null==i?void 0:i.userId)&&(r.user_id=i.userId,r.user_traits=i.traits);const s=JSON.stringify({session_id:this.sessionId,anonymous_id:this.anonymousId||void 0,events:n,meta:r});this.sendWithRetry(s,n,0)}async sendWithRetry(t,e,n){var i;const r=null!==(i=this.config.maxRetries)&&void 0!==i?i:3;try{const i=await async function(t){if("undefined"!=typeof CompressionStream)try{const e=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")).getReader(),n=[];let i=0;for(;;){const{done:t,value:r}=await e.read();if(t)break;n.push(r),i+=r.byteLength}const r=new Uint8Array(i);let s=0;for(const t of n)r.set(t,s),s+=t.byteLength;return r}catch(t){}return Lr.gzip(t)}(t),s=new Blob([i],{type:"application/json"}),o=i.byteLength<6e4,a=await fetch(this.config.endpoint+"/ingest",{method:"POST",headers:{"Content-Type":"application/json","Content-Encoding":"gzip","x-webrec-key":this.config.apiKey},body:s,keepalive:o});if(this.flushing=!1,a.status>=500&&n<r)return void this.retryBatch(t,e,n)}catch(i){if(this.flushing=!1,n<r)return void this.retryBatch(t,e,n);if(n===r)try{const e=t.length<6e4;fetch(this.config.endpoint+"/ingest",{method:"POST",headers:{"Content-Type":"application/json","x-webrec-key":this.config.apiKey},body:t,keepalive:e}).catch(()=>{})}catch(t){}}}retryBatch(t,e,n){const i=1e3*Math.pow(2,n)+500*Math.random();setTimeout(()=>this.sendWithRetry(t,e,n+1),i)}drainQueue(){return this.queue.splice(0)}getQueueLength(){return this.queue.length}updateSessionId(t){this.sessionId=t}getSessionId(){return this.sessionId}getAnonymousId(){return this.anonymousId}getEndpoint(){return this.config.endpoint}}class zr{constructor(t,e){this.active=!1,this.visibilityHandler=null,this.pagehideHandler=null,this.beforeunloadHandler=null,this.sendChunk=()=>{},this.transport=t,this.apiKey=e}start(){if(this.active)return;if("undefined"==typeof navigator||"undefined"==typeof window)return;this.active=!0;const t=()=>{var t;const e=this.transport.drainQueue();if(0===e.length)return;const n=JSON.stringify({session_id:this.transport.getSessionId(),anonymous_id:this.transport.getAnonymousId()||void 0,events:e,meta:{url:"undefined"!=typeof location?location.href:"",userAgent:"undefined"!=typeof navigator?navigator.userAgent:"",timestamp:Date.now(),beacon:!0}}),i=new Blob([n],{type:"application/json"});if(i.size>63e3){const t=Math.floor(e.length/2);return this.sendChunk(e.slice(0,t)),void this.sendChunk(e.slice(t))}const r=`${this.transport.getEndpoint()}/ingest?key=${encodeURIComponent(this.apiKey)}`;if(!(null===(t=navigator.sendBeacon)||void 0===t?void 0:t.call(navigator,r,i)))try{const t=new XMLHttpRequest;t.open("POST",this.transport.getEndpoint()+"/ingest",!1),t.setRequestHeader("Content-Type","application/json"),t.setRequestHeader("x-webrec-key",this.apiKey),t.send(n)}catch(t){}};this.sendChunk=t=>{var e;if(0===t.length)return;const n=JSON.stringify({session_id:this.transport.getSessionId(),anonymous_id:this.transport.getAnonymousId()||void 0,events:t,meta:{url:"undefined"!=typeof location?location.href:"",userAgent:"undefined"!=typeof navigator?navigator.userAgent:"",timestamp:Date.now(),beacon:!0}}),i=new Blob([n],{type:"application/json"}),r=`${this.transport.getEndpoint()}/ingest?key=${encodeURIComponent(this.apiKey)}`;null===(e=navigator.sendBeacon)||void 0===e||e.call(navigator,r,i)},this.visibilityHandler=()=>{"hidden"===document.visibilityState&&t()},this.pagehideHandler=()=>t(),this.beforeunloadHandler=()=>t(),document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler),window.addEventListener("beforeunload",this.beforeunloadHandler)}stop(){this.active&&(this.active=!1,this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null),this.pagehideHandler&&(window.removeEventListener("pagehide",this.pagehideHandler),this.pagehideHandler=null),this.beforeunloadHandler&&(window.removeEventListener("beforeunload",this.beforeunloadHandler),this.beforeunloadHandler=null))}}function Ur(){if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();if("undefined"!=typeof crypto&&crypto.getRandomValues){const t=new Uint8Array(16);crypto.getRandomValues(t),t[6]=15&t[6]|64,t[8]=63&t[8]|128;const e=Array.from(t,t=>t.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}const Hr="wr_session",Br="wr_session_ts",Zr="wr_anon_id";class Wr{constructor(t){this.timeout=t,this.sessionId=this.getOrCreateSession(),this.anonymousId=this.getOrCreateAnonymousId()}getOrCreateAnonymousId(){try{const t=localStorage.getItem(Zr);if(t)return t}catch(t){}const t=Ur();try{localStorage.setItem(Zr,t)}catch(t){}return t}getOrCreateSession(){try{const t=sessionStorage.getItem(Hr),e=sessionStorage.getItem(Br);if(t&&e){if(Date.now()-parseInt(e,10)<this.timeout)return this.touch(),t}}catch(t){}const t=Ur();return this.persist(t),t}persist(t){try{sessionStorage.setItem(Hr,t),sessionStorage.setItem(Br,Date.now().toString())}catch(t){}}touch(){try{sessionStorage.setItem(Br,Date.now().toString())}catch(t){}}getSessionId(){return this.sessionId}getAnonymousId(){return this.anonymousId}getLastActivity(){try{const t=sessionStorage.getItem(Br);return t?parseInt(t,10):null}catch(t){return null}}reset(){return this.sessionId=Ur(),this.persist(this.sessionId),this.sessionId}}const Gr="wr_identity";class Vr{constructor(){this.userId=null,this.traits={},this.onIdentify=null,this.restore()}setCallback(t){this.onIdentify=t,this.userId&&t(this.userId,this.traits)}identify(t,e){this.userId=t,this.traits=e||{},this.persist(),this.onIdentify&&this.onIdentify(t,this.traits)}getUserId(){return this.userId}getTraits(){return this.traits}reidentify(){this.userId&&this.onIdentify&&this.onIdentify(this.userId,this.traits)}reset(){this.userId=null,this.traits={};try{localStorage.removeItem(Gr)}catch(t){}}persist(){try{localStorage.setItem(Gr,JSON.stringify({userId:this.userId,traits:this.traits}))}catch(t){}}restore(){try{const t=localStorage.getItem(Gr);if(t){const e=JSON.parse(t);e.userId&&(this.userId=e.userId,this.traits=e.traits||{})}}catch(t){}}}function Kr(t,e=2e3){"undefined"!=typeof requestIdleCallback?requestIdleCallback(t,{timeout:e}):setTimeout(()=>t({didTimeout:!0,timeRemaining:()=>0}),1)}class qr{constructor(t,e,n,i,r){this.answers={},this.currentIdx=0,this.survey=t,this.endpoint=e,this.apiKey=n,this.sessionId=i,this.onDismiss=r;const s=document.createElement("div");s.id=`wr-survey-${t.survey_id}`,document.body.appendChild(s),this.shadow=s.attachShadow({mode:"closed"}),this.container=document.createElement("div"),this.shadow.appendChild(this.container);const o=document.createElement("style"),a=t.appearance||{},l=a.primary_color||"#6366f1",c=a.theme||"light";o.textContent=function(t,e){const n="dark"===e?"#e2e2e8":"#1a1a2e",i="dark"===e?"#8888a0":"#6b6b80",r="dark"===e?"#2e2e40":"#e5e5ec",s="dark"===e?"#28283a":"#f7f7fa";return`\n :host { all: initial; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }\n * { box-sizing: border-box; margin: 0; padding: 0; }\n .wr-survey-container {\n position: fixed; z-index: 2147483647;\n max-width: 360px; width: calc(100vw - 32px);\n background: ${"dark"===e?"#1e1e2e":"#ffffff"}; color: ${n};\n border-radius: 12px; border: 1px solid ${r};\n box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 4px 16px rgba(0,0,0,0.1);\n overflow: hidden;\n animation: wr-slide-in 0.3s ease-out;\n }\n .wr-survey-container.wr-pos-bottom-right { bottom: 20px; right: 20px; }\n .wr-survey-container.wr-pos-bottom-left { bottom: 20px; left: 20px; }\n .wr-survey-container.wr-pos-bottom-center { bottom: 20px; left: 50%; transform: translateX(-50%); }\n @keyframes wr-slide-in {\n from { opacity: 0; transform: translateY(20px); }\n to { opacity: 1; transform: translateY(0); }\n }\n .wr-header {\n display: flex; align-items: center; justify-content: space-between;\n padding: 14px 16px 10px; border-bottom: 1px solid ${r};\n }\n .wr-title { font-size: 13px; font-weight: 600; color: ${n}; }\n .wr-close {\n background: none; border: none; cursor: pointer; color: ${i};\n font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 4px;\n }\n .wr-close:hover { background: ${s}; }\n .wr-body { padding: 16px; }\n .wr-question-text { font-size: 14px; font-weight: 500; margin-bottom: 14px; line-height: 1.4; color: ${n}; }\n .wr-progress { font-size: 11px; color: ${i}; margin-bottom: 8px; }\n\n /* NPS */\n .wr-nps-row { display: flex; gap: 4px; flex-wrap: wrap; }\n .wr-nps-btn {\n width: 28px; height: 28px; border-radius: 6px; border: 1px solid ${r};\n background: ${s}; color: ${n}; font-size: 11px; font-weight: 600;\n cursor: pointer; display: flex; align-items: center; justify-content: center;\n transition: all 0.15s;\n }\n .wr-nps-btn:hover { border-color: ${t}; }\n .wr-nps-btn.wr-selected { background: ${t}; color: #fff; border-color: ${t}; }\n .wr-nps-labels { display: flex; justify-content: space-between; margin-top: 4px; font-size: 10px; color: ${i}; }\n\n /* Rating (stars) */\n .wr-rating-row { display: flex; gap: 6px; }\n .wr-star {\n font-size: 24px; cursor: pointer; color: ${r}; transition: color 0.15s;\n background: none; border: none; padding: 0; line-height: 1;\n }\n .wr-star.wr-filled { color: #f59e0b; }\n .wr-star:hover { color: #f59e0b; }\n\n /* Choice */\n .wr-choice-list { display: flex; flex-direction: column; gap: 6px; }\n .wr-choice-item {\n display: flex; align-items: center; gap: 8px; padding: 8px 12px;\n border: 1px solid ${r}; border-radius: 8px; cursor: pointer;\n background: ${s}; font-size: 13px; transition: all 0.15s;\n }\n .wr-choice-item:hover { border-color: ${t}; }\n .wr-choice-item.wr-selected { border-color: ${t}; background: ${t}10; }\n .wr-choice-item input { accent-color: ${t}; }\n\n /* Open text */\n .wr-textarea {\n width: 100%; min-height: 80px; padding: 10px 12px; border-radius: 8px;\n border: 1px solid ${r}; background: ${s}; color: ${n};\n font-size: 13px; font-family: inherit; resize: vertical; outline: none;\n }\n .wr-textarea:focus { border-color: ${t}; }\n\n /* Buttons */\n .wr-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid ${r}; }\n .wr-btn {\n padding: 7px 16px; border-radius: 8px; font-size: 12px; font-weight: 600;\n cursor: pointer; border: none; transition: all 0.15s;\n }\n .wr-btn-primary { background: ${t}; color: #fff; }\n .wr-btn-primary:hover { filter: brightness(1.1); }\n .wr-btn-secondary { background: ${s}; color: ${i}; border: 1px solid ${r}; }\n .wr-btn-secondary:hover { background: ${r}; }\n\n /* Thank you */\n .wr-thankyou { text-align: center; padding: 24px 16px; }\n .wr-thankyou-icon { font-size: 32px; margin-bottom: 8px; }\n .wr-thankyou-text { font-size: 14px; font-weight: 500; color: ${n}; }\n .wr-thankyou-sub { font-size: 12px; color: ${i}; margin-top: 4px; }\n `}(l,c),this.shadow.appendChild(o),this.render()}render(){var t;const e=this.survey.questions[this.currentIdx];if(!e)return void this.showThankYou();const n=`wr-pos-${(null===(t=this.survey.appearance)||void 0===t?void 0:t.position)||"bottom-right"}`;this.container.innerHTML=`\n <div class="wr-survey-container ${n}">\n <div class="wr-header">\n <span class="wr-title">${this.escapeHtml(this.survey.survey_name)}</span>\n <button class="wr-close" data-action="close">&times;</button>\n </div>\n <div class="wr-body">\n <div class="wr-progress">${this.currentIdx+1} of ${this.survey.questions.length}</div>\n <div class="wr-question-text">${this.escapeHtml(e.text)}</div>\n <div class="wr-question-content" id="wr-qc"></div>\n </div>\n <div class="wr-actions">\n <button class="wr-btn wr-btn-secondary" data-action="skip">Skip</button>\n <button class="wr-btn wr-btn-primary" data-action="next">${this.currentIdx===this.survey.questions.length-1?"Submit":"Next"}</button>\n </div>\n </div>\n `;const i=this.shadow.getElementById("wr-qc");i&&this.renderQuestion(e,i),this.container.querySelectorAll("[data-action]").forEach(t=>{t.addEventListener("click",t=>{const e=t.currentTarget.getAttribute("data-action");"close"===e?this.close():("skip"===e||"next"===e)&&this.nextQuestion()})})}renderQuestion(t,e){switch(t.type){case"nps":this.renderNPS(t,e);break;case"rating":this.renderRating(t,e);break;case"single_choice":this.renderSingleChoice(t,e);break;case"multiple_choice":this.renderMultipleChoice(t,e);break;case"open_text":this.renderOpenText(t,e)}}renderNPS(t,e){const n=document.createElement("div");n.className="wr-nps-row";for(let e=0;e<=10;e++){const i=document.createElement("button");i.className="wr-nps-btn"+(this.answers[t.id]===e?" wr-selected":""),i.textContent=String(e),i.addEventListener("click",()=>{this.answers[t.id]=e,n.querySelectorAll(".wr-nps-btn").forEach(t=>t.classList.remove("wr-selected")),i.classList.add("wr-selected")}),n.appendChild(i)}e.appendChild(n);const i=document.createElement("div");i.className="wr-nps-labels",i.innerHTML="<span>Not likely</span><span>Very likely</span>",e.appendChild(i)}renderRating(t,e){const n=document.createElement("div");n.className="wr-rating-row";const i=this.answers[t.id]||0;for(let e=1;e<=5;e++){const r=document.createElement("button");r.className="wr-star"+(e<=i?" wr-filled":""),r.innerHTML="&#9733;",r.addEventListener("click",()=>{this.answers[t.id]=e,n.querySelectorAll(".wr-star").forEach((t,n)=>{t.classList.toggle("wr-filled",n<e)})}),n.appendChild(r)}e.appendChild(n)}renderSingleChoice(t,e){const n=document.createElement("div");n.className="wr-choice-list",(t.options||[]).forEach(e=>{const i=document.createElement("label");i.className="wr-choice-item"+(this.answers[t.id]===e?" wr-selected":""),i.innerHTML=`<input type="radio" name="wr-q-${t.id}" value="${this.escapeHtml(e)}" ${this.answers[t.id]===e?"checked":""} /> ${this.escapeHtml(e)}`,i.querySelector("input").addEventListener("change",()=>{this.answers[t.id]=e,n.querySelectorAll(".wr-choice-item").forEach(t=>t.classList.remove("wr-selected")),i.classList.add("wr-selected")}),n.appendChild(i)}),e.appendChild(n)}renderMultipleChoice(t,e){const n=document.createElement("div");n.className="wr-choice-list",this.answers[t.id]||(this.answers[t.id]=[]),(t.options||[]).forEach(e=>{const i=this.answers[t.id].includes(e),r=document.createElement("label");r.className="wr-choice-item"+(i?" wr-selected":""),r.innerHTML=`<input type="checkbox" value="${this.escapeHtml(e)}" ${i?"checked":""} /> ${this.escapeHtml(e)}`,r.querySelector("input").addEventListener("change",n=>{const i=n.target.checked,s=this.answers[t.id];i&&!s.includes(e)?s.push(e):i||(this.answers[t.id]=s.filter(t=>t!==e)),r.classList.toggle("wr-selected",i)}),n.appendChild(r)}),e.appendChild(n)}renderOpenText(t,e){const n=document.createElement("textarea");n.className="wr-textarea",n.placeholder="Type your answer...",n.value=this.answers[t.id]||"",n.addEventListener("input",()=>{this.answers[t.id]=n.value}),e.appendChild(n)}nextQuestion(){this.currentIdx++,this.currentIdx>=this.survey.questions.length?this.submit():this.render()}async submit(){try{await fetch(`${this.endpoint}/surveys/respond`,{method:"POST",headers:{"Content-Type":"application/json","x-webrec-key":this.apiKey},body:JSON.stringify({survey_id:this.survey.survey_id,session_id:this.sessionId,answers:this.answers,page_url:"undefined"!=typeof location?location.href:null}),keepalive:!0})}catch(t){}try{const t=`wr_survey_${this.survey.survey_id}`;sessionStorage.setItem(t,"1")}catch(t){}this.showThankYou()}showThankYou(){var t;const e=`wr-pos-${(null===(t=this.survey.appearance)||void 0===t?void 0:t.position)||"bottom-right"}`;this.container.innerHTML=`\n <div class="wr-survey-container ${e}">\n <div class="wr-thankyou">\n <div class="wr-thankyou-icon">&#10003;</div>\n <div class="wr-thankyou-text">Thank you!</div>\n <div class="wr-thankyou-sub">Your feedback helps us improve.</div>\n </div>\n </div>\n `,setTimeout(()=>this.close(),2500)}close(){var t;try{sessionStorage.setItem(`wr_survey_${this.survey.survey_id}`,"1")}catch(t){}const e=null===(t=this.container.parentElement)||void 0===t?void 0:t.host;(null==e?void 0:e.parentElement)&&e.parentElement.removeChild(e),this.onDismiss()}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}}let jr=null;class Pr{constructor(){this.initialized=!1,this.recording=!1,this.sampled=!1,this.initTime=0,this.routeChangeCleanup=null,this.visibilityCleanup=null,this.rageClickCleanup=null,this.sessionCheckTimer=null}log(...t){var e;(null===(e=this.config)||void 0===e?void 0:e.debug)&&console.log("%c[WebRec]","color: #a855f7; font-weight: bold;",...t)}init(e){const n=(...t)=>{e.debug&&console.log("%c[WebRec]","color: #a855f7; font-weight: bold;",...t)};if(this.initialized)return void n("Already initialized, skipping");if(!e.apiKey)return void console.warn("[WebRec] apiKey is required");if("undefined"!=typeof location)try{if(new URLSearchParams(location.search).has("__wr_norecord"))return void n("Bailing: __wr_norecord param detected")}catch(t){}if(this.config=Object.assign(Object.assign(Object.assign({},t),e),{sampling:Object.assign(Object.assign({},t.sampling),e.sampling),privacy:Object.assign(Object.assign({},t.privacy),e.privacy)}),this.config.respectDoNotTrack&&"undefined"!=typeof navigator){const t="1"===navigator.doNotTrack,e=!0===navigator.globalPrivacyControl;if(t||e)return void this.log("Bailing: Do Not Track is enabled (DNT:",t,", GPC:",e,")")}const i=Math.max(0,Math.min(100,this.config.sampleRate));if(i<100){let t;try{const e=sessionStorage.getItem("wr_sampled");null!==e?t="1"===e:(t=100*Math.random()<i,sessionStorage.setItem("wr_sampled",t?"1":"0"))}catch(e){t=100*Math.random()<i}if(!t)return void this.log("Bailing: Not sampled (rate:",i,"%)")}if(this.sampled=!0,"undefined"!=typeof location){const t=location.href;if(this.config.ignoreUrls.length>0)for(const e of this.config.ignoreUrls)try{if(new RegExp(e).test(t))return void this.log("Bailing: URL matched ignoreUrls pattern:",e)}catch(t){n("Invalid ignoreUrls regex pattern:",e,t)}if(this.config.allowUrls.length>0){let e=!1;for(const i of this.config.allowUrls)try{if(new RegExp(i).test(t)){e=!0;break}}catch(t){n("Invalid allowUrls regex pattern:",i,t)}if(!e)return void this.log("Bailing: URL did not match any allowUrls pattern")}}this.log("Initializing...",{endpoint:this.config.endpoint,sampleRate:this.config.sampleRate}),this.initTime=Date.now(),this.sessionManager=new Wr(this.config.sessionTimeout),this.userIdentifier=new Vr,this.domRecorder=new Xt,this.networkInterceptor=new ne,this.consoleInterceptor=new re,this.errorTracker=new se,this.interactionEnricher=new he,this.deadClickDetector=new ge,this.errorClickDetector=new fe,this.scrollDepthTracker=new ye;const r=this.sessionManager.getSessionId(),s=this.sessionManager.getAnonymousId();this.transport=new Fr({endpoint:this.config.endpoint,apiKey:this.config.apiKey,batchSize:this.config.batchSize,flushInterval:this.config.flushInterval,maxQueueSize:this.config.maxQueueSize,maxRetries:this.config.maxRetries,minSessionDuration:this.config.minSessionDuration,sessionStartTime:this.initTime,sdkEndpoint:this.config.endpoint,debug:this.config.debug},r,s),this.beacon=new zr(this.transport,this.config.apiKey),this.transport.setIdentityProvider(()=>({userId:this.userIdentifier.getUserId(),traits:this.userIdentifier.getTraits()})),this.userIdentifier.setCallback((t,e)=>{Qt(()=>{fetch(this.config.endpoint+"/identify",{method:"POST",headers:{"Content-Type":"application/json","x-webrec-key":this.config.apiKey},body:JSON.stringify({session_id:this.sessionManager.getSessionId(),anonymous_id:this.sessionManager.getAnonymousId(),user_id:t,traits:e}),keepalive:!0}).catch(()=>{})})}),this.initialized=!0,this.log("Initialized. Session ID:",r);const o=this.config.startDelay;o>0?setTimeout(()=>{Kr(()=>{this.start()})},o):Kr(()=>{this.start()})}start(){this.initialized&&!this.recording&&(this.recording=!0,this.log("Starting capture: DOM"+(this.config.captureNetwork?", Network":"")+(this.config.captureConsole?", Console":"")+(this.config.captureErrors?", Errors":"")),Qt(()=>{this.domRecorder.start(this.config,t=>{this.sessionManager.touch(),this.transport.enqueue(t)})}),this.config.captureNetwork&&Qt(()=>{this.networkInterceptor.start(t=>{this.transport.enqueue({type:5,data:{tag:"recorder:network",payload:t},timestamp:Date.now()})},this.config.endpoint)}),this.config.captureConsole&&Qt(()=>{this.consoleInterceptor.start(t=>{this.transport.enqueue({type:5,data:{tag:"recorder:console",payload:t},timestamp:Date.now()})})}),this.config.captureErrors&&Qt(()=>{this.errorTracker.start(t=>{this.transport.enqueue({type:5,data:{tag:"recorder:error",payload:t},timestamp:Date.now()}),fetch(this.config.endpoint+"/error",{method:"POST",headers:{"Content-Type":"application/json","x-webrec-key":this.config.apiKey},body:JSON.stringify({session_id:this.sessionManager.getSessionId(),error:t}),keepalive:!0}).catch(()=>{})})}),Qt(()=>{this.interactionEnricher.start(t=>{this.sessionManager.touch(),this.transport.enqueue(t)})}),Qt(()=>{this.deadClickDetector.start(t=>{this.transport.enqueue(t)})}),Qt(()=>{this.errorClickDetector.start(t=>{this.transport.enqueue(t)})}),Qt(()=>{this.scrollDepthTracker.start(t=>{this.transport.enqueue(t)})}),this.transport.start(),this.beacon.start(),this.startRouteTracking(),this.startVisibilityTracking(),this.startRageClickDetection(),this.startSessionCheck(),this.captureWebVitals(),Qt(()=>{!function(t,e,n,i=!1){if("undefined"==typeof window||"undefined"==typeof document)return;const r=(...t)=>{i&&console.log("%c[WebRec:Surveys]","color: #a855f7; font-weight: bold;",...t)};setTimeout(async()=>{var i;try{const s=encodeURIComponent(location.href),o=await fetch(`${t}/surveys?url=${s}`,{headers:{"x-webrec-key":e}});if(!o.ok)return void r("Failed to fetch surveys:",o.status);const a=(await o.json()).surveys||[];if(r(`Fetched ${a.length} active surveys`),0===a.length)return;const l=a.filter(t=>{try{return!sessionStorage.getItem(`wr_survey_${t.survey_id}`)}catch(t){return!0}});if(0===l.length)return void r("All surveys already responded to in this session");const c=l.find(t=>{const e=t.targeting||{};if(void 0!==e.show_to_percent&&e.show_to_percent<100&&100*Math.random()>=e.show_to_percent)return!1;if(e.show_once_per_session)try{if(sessionStorage.getItem(`wr_survey_shown_${t.survey_id}`))return!1}catch(t){}return!0});if(!c)return void r("No survey passed targeting filters");const d=1e3*((null===(i=c.targeting)||void 0===i?void 0:i.show_after_seconds)||0),h=()=>{if(!jr){try{sessionStorage.setItem(`wr_survey_shown_${c.survey_id}`,"1")}catch(t){}r("Showing survey:",c.survey_name),jr=new qr(c,t,e,n(),()=>{jr=null})}};d>0?setTimeout(h,d):h()}catch(t){r("Error initializing surveys:",t)}},3e3)}(this.config.endpoint,this.config.apiKey,()=>this.sessionManager.getSessionId(),this.config.debug)}))}stop(){this.recording&&(this.recording=!1,Qt(()=>this.domRecorder.stop()),Qt(()=>this.networkInterceptor.stop()),Qt(()=>this.consoleInterceptor.stop()),Qt(()=>this.errorTracker.stop()),Qt(()=>this.interactionEnricher.stop()),Qt(()=>this.deadClickDetector.stop()),Qt(()=>this.errorClickDetector.stop()),Qt(()=>this.scrollDepthTracker.stop()),Qt(()=>this.transport.stop()),Qt(()=>this.beacon.stop()),this.routeChangeCleanup&&(this.routeChangeCleanup(),this.routeChangeCleanup=null),this.visibilityCleanup&&(this.visibilityCleanup(),this.visibilityCleanup=null),this.rageClickCleanup&&(this.rageClickCleanup(),this.rageClickCleanup=null),this.sessionCheckTimer&&(clearInterval(this.sessionCheckTimer),this.sessionCheckTimer=null))}destroy(){this.stop(),this.initialized=!1,this.sampled=!1,this.recording=!1}identify(t,e){this.initialized&&this.userIdentifier.identify(t,e)}track(t,e){this.recording&&this.transport.enqueue({type:5,data:{tag:"recorder:custom",payload:{event:t,properties:e||{},url:"undefined"!=typeof location?location.href:""}},timestamp:Date.now()})}getSessionId(){return this.initialized?this.sessionManager.getSessionId():null}getSessionUrl(){const t=this.getSessionId();return t?`https://app.webrec.app/sessions/${t}`:null}isRecording(){return this.recording}startRouteTracking(){if("undefined"==typeof window)return;let t=location.href;const e=e=>{if(e===t)return;const n=t;t=e,this.transport.enqueue({type:5,data:{tag:"recorder:navigation",payload:{from:n,to:e}},timestamp:Date.now()})},n=history.pushState.bind(history),i=history.replaceState.bind(history);history.pushState=function(t,i,r){n(t,i,r),Qt(()=>e(location.href))},history.replaceState=function(t,n,r){i(t,n,r),Qt(()=>e(location.href))};const r=()=>Qt(()=>e(location.href));window.addEventListener("popstate",r);const s=()=>Qt(()=>e(location.href));window.addEventListener("hashchange",s),this.routeChangeCleanup=()=>{history.pushState=n,history.replaceState=i,window.removeEventListener("popstate",r),window.removeEventListener("hashchange",s)}}startVisibilityTracking(){if("undefined"==typeof document)return;const t=()=>{const t="hidden"===document.visibilityState;this.transport.enqueue({type:5,data:{tag:"recorder:visibility",payload:{hidden:t}},timestamp:Date.now()})};document.addEventListener("visibilitychange",t),this.visibilityCleanup=()=>document.removeEventListener("visibilitychange",t)}startRageClickDetection(){if("undefined"==typeof window)return;const t=[],e=e=>{const n=Date.now(),i=Qt(()=>{var t;const n=e.target;return(null===(t=null==n?void 0:n.tagName)||void 0===t?void 0:t.toLowerCase())+((null==n?void 0:n.id)?`#${n.id}`:"")+((null==n?void 0:n.className)?`.${String(n.className).split(" ")[0]}`:"")})||"unknown";for(t.push({x:e.clientX,y:e.clientY,time:n,target:i});t.length>0&&n-t[0].time>800;)t.shift();const r=t.filter(t=>Math.abs(t.x-e.clientX)<30&&Math.abs(t.y-e.clientY)<30);r.length>=3&&(this.transport.enqueue({type:5,data:{tag:"recorder:rage_click",payload:{x:e.clientX,y:e.clientY,clickCount:r.length,target:i,url:location.href}},timestamp:n}),t.length=0)};document.addEventListener("click",e,!0),this.rageClickCleanup=()=>document.removeEventListener("click",e,!0)}startSessionCheck(){this.sessionCheckTimer=setInterval(()=>{if(!this.recording)return;const t=this.sessionManager.getLastActivity();if(t&&Date.now()-t>this.config.sessionTimeout){this.log("Session expired after inactivity, rotating..."),this.transport.flush();const t=this.sessionManager.reset();this.transport.updateSessionId(t),this.log("New session ID:",t),this.userIdentifier.reidentify(),Qt(()=>{this.domRecorder.stop(),this.domRecorder.start(this.config,t=>{this.sessionManager.touch(),this.transport.enqueue(t)})})}},6e4)}captureWebVitals(){"undefined"!=typeof PerformanceObserver&&(Qt(()=>{new PerformanceObserver(t=>{var e;const n=t.getEntries(),i=n[n.length-1];i&&this.transport.enqueue({type:5,data:{tag:"recorder:web_vital",payload:{metric:"LCP",value:i.startTime,element:null===(e=i.element)||void 0===e?void 0:e.tagName}},timestamp:Date.now()})}).observe({type:"largest-contentful-paint",buffered:!0})}),Qt(()=>{new PerformanceObserver(t=>{for(const e of t.getEntries())"first-contentful-paint"===e.name&&this.transport.enqueue({type:5,data:{tag:"recorder:web_vital",payload:{metric:"FCP",value:e.startTime}},timestamp:Date.now()})}).observe({type:"paint",buffered:!0})}),Qt(()=>{let t=0;new PerformanceObserver(e=>{for(const n of e.getEntries())n.hadRecentInput||(t+=n.value)}).observe({type:"layout-shift",buffered:!0});document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&t>0&&this.transport.enqueue({type:5,data:{tag:"recorder:web_vital",payload:{metric:"CLS",value:t}},timestamp:Date.now()})},{once:!0})}),Qt(()=>{let t=0;const e=new PerformanceObserver(e=>{for(const n of e.getEntries()){const e=n.duration||n.duration;e>t&&(t=e)}});try{e.observe({type:"event",buffered:!0,durationThreshold:40})}catch(t){}document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&t>0&&this.transport.enqueue({type:5,data:{tag:"recorder:web_vital",payload:{metric:"INP",value:t}},timestamp:Date.now()})},{once:!0})}),Qt(()=>{var t,e;const n=null===(e=null===(t=performance.getEntriesByType)||void 0===t?void 0:t.call(performance,"navigation"))||void 0===e?void 0:e[0];n&&n.responseStart>0&&this.transport.enqueue({type:5,data:{tag:"recorder:web_vital",payload:{metric:"TTFB",value:n.responseStart}},timestamp:Date.now()})}),Qt(()=>{new PerformanceObserver(t=>{for(const e of t.getEntries())e.duration>50&&this.transport.enqueue({type:5,data:{tag:"recorder:long_task",payload:{duration:e.duration,startTime:e.startTime}},timestamp:Date.now()})}).observe({type:"longtask",buffered:!0})}))}}let Yr=new Pr;const Xr={init(t){Yr.init(t)},identify(t,e){Yr.identify(t,e)},track(t,e){Yr.track(t,e)},stop(){Yr.stop()},start(){Yr.start()},destroy(){Yr.destroy(),Yr=new Pr},getSessionId:()=>Yr.getSessionId(),getSessionUrl:()=>Yr.getSessionUrl(),isRecording:()=>Yr.isRecording()};exports.WebRec=Xr,exports.default=Xr;
17
+ //# sourceMappingURL=webrec.cjs.js.map