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.
- package/dist/capture/console-interceptor.d.ts +12 -0
- package/dist/capture/dead-click-detector.d.ts +14 -0
- package/dist/capture/dom-recorder.d.ts +8 -0
- package/dist/capture/error-click-detector.d.ts +12 -0
- package/dist/capture/error-tracker.d.ts +16 -0
- package/dist/capture/interaction-enricher.d.ts +17 -0
- package/dist/capture/network-interceptor.d.ts +30 -0
- package/dist/capture/scroll-depth-tracker.d.ts +21 -0
- package/dist/config.d.ts +51 -0
- package/dist/identity/session-manager.d.ts +21 -0
- package/dist/identity/user-identifier.d.ts +21 -0
- package/dist/index.d.ts +29 -0
- package/dist/privacy/masking.d.ts +15 -0
- package/dist/recorder.d.ts +43 -0
- package/dist/surveys.d.ts +8 -0
- package/dist/transport/batch-transport.d.ts +45 -0
- package/dist/transport/beacon-transport.d.ts +17 -0
- package/dist/utils/compression.d.ts +11 -0
- package/dist/utils/idle-callback.d.ts +6 -0
- package/dist/utils/safe-exec.d.ts +5 -0
- package/dist/utils/uuid.d.ts +1 -0
- package/dist/webrec.cjs.js +17 -0
- package/dist/webrec.cjs.js.map +1 -0
- package/dist/webrec.esm.js +17 -0
- package/dist/webrec.esm.js.map +1 -0
- package/dist/webrec.umd.js +17 -0
- package/dist/webrec.umd.js.map +1 -0
- package/package.json +30 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WebRec={})}(this,function(t){"use strict";const e={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 n;function i(t){var e=null==t?void 0:t.host;return Boolean((null==e?void 0:e.shadowRoot)===t)}function r(t){return"[object ShadowRoot]"===Object.prototype.toString.call(t)}function s(t){try{var e=t.rules||t.cssRules;return e?((n=Array.from(e).map(o).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 o(t){var e=t.cssText;if(function(t){return"styleSheet"in t}(t))try{e=s(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"}(n||(n={}));var a=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 l(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 c="__rrweb_original__";var d,h,u=1,p=new RegExp("[^a-z0-9-_:]");function g(){return u++}var m=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,f=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,y=/^(data:)([^,]*),(.*)/i;function b(t,e){return(t||"").replace(m,function(t,n,i,r,s,o){var a,l=i||s||o,c=n||r||"";if(!l)return t;if(!f.test(l))return"url(".concat(c).concat(l).concat(c,")");if(y.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 v=/^[^ \t\n\r\u000c]+/,w=/^[, \t\n\r\u000c]+/;function I(t,e){if(!e||""===e.trim())return e;var n=t.createElement("a");return n.href=e,n.href}function _(t){return Boolean("svg"===t.tagName||t.ownerSVGElement)}function C(){var t=document.createElement("a");return t.href="",t.href}function k(t,e,n,i){return"src"===n||"href"===n&&i&&("use"!==e||"#"!==i[0])||"xlink:href"===n&&i&&"#"!==i[0]?I(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(w),!(n>=e.length);){var s=i(v);if(","===s.slice(-1))s=I(t,s.substring(0,s.length-1)),r.push(s);else{var o="";s=I(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?b(i,C()):"object"===e&&"data"===n&&i?I(t,i):i:I(t,i)}function S(t,e,n){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!n&&S(t.parentNode,e,n);for(var i=t.classList.length;i--;){var r=t.classList[i];if(e.test(r))return!0}return!!n&&S(t.parentNode,e,n)}function A(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(S(i,e,!0))return!0;if(n){if(i.matches(n))return!0;if(i.closest(n))return!0}return!1}function x(t,e){var i=e.doc,r=e.mirror,o=e.blockClass,a=e.blockSelector,u=e.maskTextClass,g=e.maskTextSelector,m=e.inlineStylesheet,f=e.maskInputOptions,y=void 0===f?{}:f,v=e.maskTextFn,w=e.maskInputFn,I=e.dataURLOptions,S=void 0===I?{}:I,x=e.inlineImages,E=e.recordCanvas,T=e.keepIframeSrcFn,R=e.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,r);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:n.Document,childNodes:[],compatMode:t.compatMode}:{type:n.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:n.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:M};case t.ELEMENT_NODE:return function(t,e){for(var i=e.doc,r=e.blockClass,o=e.blockSelector,a=e.inlineStylesheet,u=e.maskInputOptions,g=void 0===u?{}:u,m=e.maskInputFn,f=e.dataURLOptions,y=void 0===f?{}:f,v=e.inlineImages,w=e.recordCanvas,I=e.keepIframeSrcFn,S=e.newlyAddedElement,A=void 0!==S&&S,x=e.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,r,o),T=function(t){if(t instanceof HTMLFormElement)return"form";var e=t.tagName.toLowerCase().trim();return p.test(e)?"div":e}(t),R={},N=t.attributes.length,M=0;M<N;M++){var O=t.attributes[M];R[O.name]=k(i,T,O.name,O.value)}if("link"===T&&a){var D=Array.from(i.styleSheets).find(function(e){return e.href===t.href}),L=null;D&&(L=s(D)),L&&(delete R.rel,delete R.href,R._cssText=b(L,D.href))}if("style"===T&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){(L=s(t.sheet))&&(R._cssText=b(L,C()))}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=l({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=c in r?r[c]: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(y.type,y.quality));else if(!("__context"in t)){var U=t.toDataURL(y.type,y.quality),H=document.createElement("canvas");H.width=t.width,H.height=t.height,U!==H.toDataURL(y.type,y.quality)&&(R.rr_dataURL=U)}if("img"===T&&v){d||(d=i.createElement("canvas"),h=d.getContext("2d"));var B=t,Z=B.crossOrigin;B.crossOrigin="anonymous";var W=function(){try{d.width=B.naturalWidth,d.height=B.naturalHeight,h.drawImage(B,0,0),R.rr_dataURL=d.toDataURL(y.type,y.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||I(R.src)||(t.contentDocument||(R.rr_src=R.src),delete R.src);return{type:n.Element,tagName:T,attributes:R,childNodes:[],isSVG:_(t)||void 0,needBlock:E,rootId:x}}(t,{doc:i,blockClass:o,blockSelector:a,inlineStylesheet:m,maskInputOptions:y,maskInputFn:w,dataURLOptions:S,inlineImages:x,recordCanvas:E,keepIframeSrcFn:T,newlyAddedElement:N,rootId:M});case t.TEXT_NODE:return function(t,e){var i,r=e.maskTextClass,s=e.maskTextSelector,o=e.maskTextFn,a=e.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=b(c,C())}var u;h&&(c="SCRIPT_PLACEHOLDER");!d&&!h&&c&&A(t,r,s)&&(c=o?o(c):c.replace(/[\S]/g,"*"));return{type:n.Text,textContent:c||"",isStyle:d,rootId:a}}(t,{maskTextClass:u,maskTextSelector:g,maskTextFn:v,rootId:M});case t.CDATA_SECTION_NODE:return{type:n.CDATA,textContent:"",rootId:M};case t.COMMENT_NODE:return{type:n.Comment,textContent:t.textContent||"",rootId:M};default:return!1}}function E(t){return void 0===t?"":t.toLowerCase()}function T(t,e){var s,o=e.doc,a=e.mirror,l=e.blockClass,c=e.blockSelector,d=e.maskTextClass,h=e.maskTextSelector,u=e.skipChild,p=void 0!==u&&u,m=e.inlineStylesheet,f=void 0===m||m,y=e.maskInputOptions,b=void 0===y?{}:y,v=e.maskTextFn,w=e.maskInputFn,I=e.slimDOMOptions,_=e.dataURLOptions,C=void 0===_?{}:_,k=e.inlineImages,S=void 0!==k&&k,A=e.recordCanvas,R=void 0!==A&&A,N=e.onSerialize,M=e.onIframeLoad,O=e.iframeLoadTimeout,D=void 0===O?5e3:O,L=e.onStylesheetLoad,F=e.stylesheetLoadTimeout,z=void 0===F?5e3:F,U=e.keepIframeSrcFn,H=void 0===U?function(){return!1}:U,B=e.newlyAddedElement,Z=void 0!==B&&B,W=e.preserveWhiteSpace,G=void 0===W||W,V=x(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,e){if(e.comment&&t.type===n.Comment)return!0;if(t.type===n.Element){if(e.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(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(E(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===E(t.attributes.name)||"icon"===E(t.attributes.rel)||"apple-touch-icon"===E(t.attributes.rel)||"shortcut icon"===E(t.attributes.rel))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&E(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(E(t.attributes.property).match(/^(og|twitter|fb):/)||E(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===E(t.attributes.name)))return!0;if(e.headMetaRobots&&("robots"===E(t.attributes.name)||"googlebot"===E(t.attributes.name)||"bingbot"===E(t.attributes.name)))return!0;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(e.headMetaAuthorship&&("author"===E(t.attributes.name)||"generator"===E(t.attributes.name)||"framework"===E(t.attributes.name)||"publisher"===E(t.attributes.name)||"progid"===E(t.attributes.name)||E(t.attributes.property).match(/^article:/)||E(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&("google-site-verification"===E(t.attributes.name)||"yandex-verification"===E(t.attributes.name)||"csrf-token"===E(t.attributes.name)||"p:domain_verify"===E(t.attributes.name)||"verify-v1"===E(t.attributes.name)||"verification"===E(t.attributes.name)||"shopify-checkout-api-token"===E(t.attributes.name)))return!0}}return!1}(V,I)&&(G||V.type!==n.Text||V.isStyle||V.textContent.replace(/^\s+|\s+$/gm,"").length)?g():-2;var K=Object.assign(V,{id:s});if(a.add(t,K),-2===s)return null;N&&N(t);var q=!p;if(K.type===n.Element){q=q&&!K.needBlock,delete K.needBlock;var j=t.shadowRoot;j&&r(j)&&(K.isShadowHost=!0)}if((K.type===n.Document||K.type===n.Element)&&q){I.headWhitespace&&K.type===n.Element&&"head"===K.tagName&&(G=!1);for(var P={doc:o,mirror:a,blockClass:l,blockSelector:c,maskTextClass:d,maskTextSelector:h,skipChild:p,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++){($=T(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 $;($=T(J[Q],P))&&(r(t.shadowRoot)&&($.isShadow=!0),K.childNodes.push($))}}return t.parentNode&&i(t.parentNode)&&r(t.parentNode)&&(K.isShadow=!0),K.type===n.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=T(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===n.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=T(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 R(t,e,n=document){const i={capture:!0,passive:!0};return n.addEventListener(t,e,i),()=>n.removeEventListener(t,e,i)}const N="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 M={map:{},getId:()=>(console.error(N),-1),getNode:()=>(console.error(N),null),removeNodeFromMap(){console.error(N)},has:()=>(console.error(N),!1),reset(){console.error(N)}};function O(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 D(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)}}),()=>D(t,e,s||{},!0)}function L(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 F(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function z(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function U(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(S(r,e,i))return!0;if(n){if(t.matches(n))return!0;if(i&&null!==r.closest(n))return!0}return!1}function H(t,e){return-2===e.getId(t)}function B(t,e){if(i(t))return!1;const n=e.getId(t);return!e.has(n)||(!t.parentNode||t.parentNode.nodeType!==t.DOCUMENT_NODE)&&(!t.parentNode||B(t.parentNode,e))}function Z(t){return Boolean(t.changedTouches)}function W(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function G(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function V(t){return Boolean(null==t?void 0:t.shadowRoot)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(M=new Proxy(M,{get:(t,e,n)=>("map"===e&&console.error(N),Reflect.get(t,e,n))}));class K{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 q=(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))(q||{}),j=(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))(j||{}),P=(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))(P||{}),Y=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(Y||{});function X(t){return"__ln"in t}class Q{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&&X(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&&X(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 J=(t,e)=>`${t}@${e}`;class ${constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const t=[],e=new Q,n=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=i(r.parentNode)?this.mirror.getId(c):this.mirror.getId(r.parentNode),p=n(r);if(-1===u||-1===p)return e.addNode(r);const g=T(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=>{W(t,this.mirror)&&this.iframeManager.addIframe(t),G(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),V(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()))et(this.removes,t,this.mirror)&&!this.movedSet.has(t.parentNode)||r(t);for(const t of Array.from(this.addedSet.values()))it(this.droppedSet,t)||et(this.removes,t,this.mirror)?it(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),i=n(s.value);-1!==e&&-1!==i&&(t=s)}if(!t)for(let i=e.length-1;i>=0;i--){const r=e.get(i);if(r){const e=this.mirror.getId(r.value.parentNode);if(-1===n(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(!H(t.target,this.mirror))switch(t.type){case"characterData":{const e=t.target.textContent;U(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:A(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=l({maskInputOptions:this.maskInputOptions,tagName:t.target.tagName,type:t.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),U(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]=k(this.doc,e.tagName,t.attributeName,n);break}case"childList":if(U(t.target,this.blockClass,this.blockSelector,!0))return;t.addedNodes.forEach(e=>this.genAdds(e,t.target)),t.removedNodes.forEach(e=>{const n=this.mirror.getId(e),s=i(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);U(t.target,this.blockClass,this.blockSelector,!1)||H(e,this.mirror)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(tt(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===n||B(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[J(n,s)]?tt(this.movedSet,e):this.removes.push({parentId:s,id:n,isShadow:!(!i(t.target)||!r(t.target))||void 0})),this.mapRemoves.push(e))})}},this.genAdds=(t,e)=>{if(this.mirror.hasNode(t)){if(H(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[J(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);U(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 tt(t,e){t.delete(e),e.childNodes.forEach(e=>tt(t,e))}function et(t,e,n){return 0!==t.length&&nt(t,e,n)}function nt(t,e,n){const{parentNode:i}=e;if(!i)return!1;const r=n.getId(i);return!!t.some(t=>t.id===r)||nt(t,i,n)}function it(t,e){return 0!==t.size&&rt(t,e)}function rt(t,e){const{parentNode:n}=e;return!!n&&(!!t.has(n)||rt(t,n))}const st=[],ot="undefined"!=typeof CSSGroupingRule,at="undefined"!=typeof CSSMediaRule,lt="undefined"!=typeof CSSSupportsRule,ct="undefined"!=typeof CSSConditionRule;function dt(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 ht(t,e){var n,i;const r=new $;st.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 ut({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(P).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t]).forEach(s=>{const o=s.toLowerCase(),l=(e=>s=>{const o=dt(s);if(U(o,i,r,!0))return;const a=Z(s)?s.changedTouches[0]:s;if(!a)return;const l=n.getId(o),{clientX:c,clientY:d}=a;t({type:P[e],id:l,x:c,y:d})})(s);a.push(R(o,l,e))}),()=>{a.forEach(t=>t())}}function pt({scrollCb:t,doc:e,mirror:n,blockClass:i,blockSelector:r,sampling:s}){return R("scroll",O(s=>{const o=dt(s);if(!o||U(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 gt(t,e){const n=Object.assign({},t);return e||delete n.userTriggered,n}const mt=["INPUT","TEXTAREA","SELECT"],ft=new WeakMap;function yt(t){return function(t,e){if(ot&&t.parentRule instanceof CSSGroupingRule||at&&t.parentRule instanceof CSSMediaRule||lt&&t.parentRule instanceof CSSSupportsRule||ct&&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 bt(t,e,n){let i,r;return t?(t.ownerNode?i=e.getId(t.ownerNode):r=n.getId(t),{styleId:r,id:i}):{}}function vt({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 wt(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=ht(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=O(e=>{const n=Date.now()-o;t(a.map(t=>(t.timeOffset-=n,t)),e),a=[],o=null},s),c=O(t=>{const e=dt(t),{clientX:n,clientY:r}=Z(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?j.Drag:t instanceof MouseEvent?j.MouseMove:j.TouchMove)},r,{trailing:!1}),d=[R("mousemove",c,n),R("touchmove",c,n),R("drag",c,n)];return()=>{d.forEach(t=>t())}}(t),s=ut(t),o=pt(t),a=function({viewportResizeCb:t}){let e=-1,n=-1;return R("resize",O(()=>{const i=F(),r=z();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:a,sampling:c,userTriggeredOnInput:d}){function h(t){let n=dt(t);const c=t.isTrusted;if(n&&"OPTION"===n.tagName&&(n=n.parentElement),!n||!n.tagName||mt.indexOf(n.tagName)<0||U(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=l({maskInputOptions:o,tagName:n.tagName,type:h,value:p,maskInputFn:a})),u(n,gt({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,gt({text:t.value,isChecked:!g,userTriggered:!1},d))})}function u(e,i){const r=ft.get(e);if(!r||r.text!==i.text||r.isChecked!==i.isChecked){ft.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=>R(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=>D(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=>O(r=>{const o=dt(r);if(!o||U(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=[R("play",s(0)),R("pause",s(1)),R("seeked",s(2)),R("volumechange",s(3)),R("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}=bt(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}=bt(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}=bt(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}=bt(this,e,n.styleMirror);return(r&&-1!==r||s&&-1!==s)&&t({id:r,styleId:s,replaceSync:i}),a.apply(this,[i])});const l={};ot?l.CSSGroupingRule=i.CSSGroupingRule:(at&&(l.CSSMediaRule=i.CSSMediaRule),ct&&(l.CSSConditionRule=i.CSSConditionRule),lt&&(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}=bt(this.parentStyleSheet,e,n.styleMirror);return(o&&-1!==o||a&&-1!==a)&&t({id:o,styleId:a,adds:[{rule:r,index:[...yt(this),s||0]}]}),c[i].insertRule.apply(this,[r,s])},r.prototype.deleteRule=function(r){const{id:s,styleId:o}=bt(this.parentStyleSheet,e,n.styleMirror);return(s&&-1!==s||o&&-1!==o)&&t({id:s,styleId:o,removes:[{index:[...yt(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=vt(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}=bt(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:yt(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}=bt(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:yt(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=L(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;U(o,i,r,!0)||U(c,i,r,!0)||a.push({start:n.getId(o),startOffset:l,end:n.getId(c),endOffset:d})}s({ranges:a})};return a(),R("selectionchange",a)}(t),f=[];for(const e of t.plugins)f.push(e.observer(e.callback,n,e.options));return()=>{st.forEach(t=>t.reset()),i.disconnect(),r(),s(),o(),a(),c(),d(),h(),u(),p(),g(),m(),f.forEach(t=>t())}}class It{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 _t{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new It(g),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new It(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 q.FullSnapshot:return this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t),{timestamp:e.timestamp,type:q.IncrementalSnapshot,data:{source:j.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case q.Meta:case q.Load:case q.DomContentLoaded:return!1;case q.Plugin:return e;case q.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case q.IncrementalSnapshot:switch(e.data.source){case j.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 j.Drag:case j.TouchMove:case j.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case j.ViewportResize:return!1;case j.MediaInteraction:case j.MouseInteraction:case j.Scroll:case j.CanvasMutation:case j.Input:return this.replaceIds(e.data,t,["id"]),e;case j.StyleSheetRule:case j.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case j.Font:return e;case j.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case j.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 Ct{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(L(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){r(t)&&(this.shadowDoms.has(t)||(this.shadowDoms.add(t),ht(Object.assign(Object.assign({},this.bypassOptions),{doc:e,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t),pt(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)),vt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)},0)))}observeAttachShadow(t){if(t.contentWindow){const e=this;this.restorePatches.push(L(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 kt(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 St="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",At="undefined"==typeof Uint8Array?[]:new Uint8Array(256),xt=0;xt<64;xt++)At[St.charCodeAt(xt)]=xt;const Et=new Map;const Tt=(t,e,n)=>{if(!t||!Mt(t,e)&&"object"!=typeof t)return;const i=function(t,e){let n=Et.get(t);return n||(n=new Map,Et.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 Rt(t,e,n){if(t instanceof Array)return t.map(t=>Rt(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+=St[n[e]>>2],r+=St[(3&n[e])<<4|n[e+1]>>4],r+=St[(15&n[e+1])<<2|n[e+2]>>6],r+=St[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:[Rt(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:[Rt(t.data,e,n),t.width,t.height]}}if(Mt(t,e)||"object"==typeof t){return{rr_type:t.constructor.name,index:Tt(t,e,n)}}return t}const Nt=(t,e,n)=>[...t].map(t=>Rt(t,e,n)),Mt=(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 Ot(t,e,n){const i=[];try{const r=L(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(i,...r){return U(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 Dt(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=L(t,s,function(t){return function(...a){const l=t.apply(this,a);if(Tt(l,o,this),!U(this.canvas,i,r,!0)){const t=Nt([...a],o,this),i={type:e,property:s,args:t};n(this.canvas,i)}return l}});a.push(l)}catch(i){const r=D(t,s,{set(t){n(this.canvas,{type:e,property:s,args:[t],setter:!0})}});a.push(r)}return a}var Lt=null;try{var Ft="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");Lt=Ft.Worker}catch(t){}function zt(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 Lt(s,Object.assign({},t,{eval:!0}))}}function Ut(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 Ht="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0);var Bt,Zt=(Bt="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",Ht?zt(Bt):function(t){var e;return function(n){return e=e||Ut(t),new Worker(e,n)}}(Bt));class Wt{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=Ot(e,n,i),o=new Map,a=new Zt;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:Y["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=>{U(e,n,i,!0)||t.push(e)}),t})().forEach(t=>kt(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=Ot(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=L(e.CanvasRenderingContext2D.prototype,o,function(r){return function(...s){return U(this.canvas,n,i,!0)||setTimeout(()=>{const n=Nt([...s],e,this);t(this.canvas,{type:Y["2D"],property:o,args:n})},0),r.apply(this,s)}});r.push(s)}catch(n){const i=D(e.CanvasRenderingContext2D.prototype,o,{set(e){t(this.canvas,{type:Y["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(...Dt(e.WebGLRenderingContext.prototype,Y.WebGL,t,n,i,0,e)),void 0!==e.WebGL2RenderingContext&&r.push(...Dt(e.WebGL2RenderingContext.prototype,Y.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 Gt{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new K,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:o(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 Vt(t){return Object.assign(Object.assign({},t),{timestamp:Date.now()})}let Kt,qt,jt,Pt=!1;const Yt=new a;function Xt(t={}){const{emit:e,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:r="rr-block",blockSelector:s=null,ignoreClass:o="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:E=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),Yt.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 L;!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};Kt=(t,r)=>{var s;if(!(null===(s=st[0])||void 0===s?void 0:s.isFrozen())||t.type===q.FullSnapshot||t.type===q.IncrementalSnapshot&&t.data.source===j.Mutation||st.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===q.FullSnapshot)L=t,U=0;else if(t.type===q.IncrementalSnapshot){if(t.data.source===j.Mutation&&t.data.isAttachIframe)return;U++;const e=i&&U>=i,r=n&&t.timestamp-L.timestamp>n;(e||r)&&qt(!0)}};const B=t=>{Kt(Vt({type:q.IncrementalSnapshot,data:Object.assign({source:j.Mutation},t)}))},Z=t=>Kt(Vt({type:q.IncrementalSnapshot,data:Object.assign({source:j.Scroll},t)})),K=t=>Kt(Vt({type:q.IncrementalSnapshot,data:Object.assign({source:j.CanvasMutation},t)})),P=new Gt({mutationCb:B,adoptedStyleSheetCb:t=>Kt(Vt({type:q.IncrementalSnapshot,data:Object.assign({source:j.AdoptedStyleSheet},t)}))}),Y=new _t({mirror:Yt,mutationCb:B,stylesheetManager:P,recordCrossOriginIframes:_,wrappedEmit:Kt});for(const t of A||[])t.getMirror&&t.getMirror({nodeMirror:Yt,crossOriginIframeMirror:Y.crossOriginIframeMirror,crossOriginIframeStyleMirror:Y.crossOriginIframeStyleMirror});jt=new Wt({recordCanvas:I,mutationCb:K,win:window,blockClass:r,blockSelector:s,mirror:Yt,sampling:b.canvas,dataURLOptions:v});const X=new Ct({mutationCb:B,scrollCb:Z,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:jt,keepIframeSrcFn:x},mirror:Yt});qt=(t=!1)=>{var e,n,i,o,h,u;Kt(Vt({type:q.Meta,data:{href:window.location.href,width:z(),height:F()}}),t),P.reset(),st.forEach(t=>t.lock());const p=function(t,e){var n=e||{},i=n.mirror,r=void 0===i?new a:i,s=n.blockClass,o=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,E=n.onSerialize,R=n.onIframeLoad,N=n.iframeLoadTimeout,M=n.onStylesheetLoad,O=n.stylesheetLoadTimeout,D=n.keepIframeSrcFn;return T(t,{doc:t,mirror:r,blockClass:o,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:E,onIframeLoad:R,iframeLoadTimeout:N,onStylesheetLoad:M,stylesheetLoadTimeout:O,keepIframeSrcFn:void 0===D?function(){return!1}:D,newlyAddedElement:!1})}(document,{mirror:Yt,blockClass:r,blockSelector:s,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskAllInputs:O,maskTextFn:m,slimDOM:D,dataURLOptions:v,recordCanvas:I,inlineImages:S,onSerialize:t=>{W(t,Yt)&&Y.addIframe(t),G(t,Yt)&&P.trackLinkElement(t),V(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");Kt(Vt({type:q.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===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.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}}})),st.forEach(t=>t.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&P.adoptStyleSheets(document.adoptedStyleSheets,Yt.getId(document))};try{const t=[];t.push(R("DOMContentLoaded",()=>{Kt(Vt({type:q.DomContentLoaded,data:{}}))}));const e=t=>{var e;return wt({mutationCb:B,mousemoveCb:(t,e)=>Kt(Vt({type:q.IncrementalSnapshot,data:{source:e,positions:t}})),mouseInteractionCb:t=>Kt(Vt({type:q.IncrementalSnapshot,data:Object.assign({source:j.MouseInteraction},t)})),scrollCb:Z,viewportResizeCb:t=>Kt(Vt({type:q.IncrementalSnapshot,data:Object.assign({source:j.ViewportResize},t)})),inputCb:t=>Kt(Vt({type:q.IncrementalSnapshot,data:Object.assign({source:j.Input},t)})),mediaInteractionCb:t=>Kt(Vt({type:q.IncrementalSnapshot,data:Object.assign({source:j.MediaInteraction},t)})),styleSheetRuleCb:t=>Kt(Vt({type:q.IncrementalSnapshot,data:Object.assign({source:j.StyleSheetRule},t)})),styleDeclarationCb:t=>Kt(Vt({type:q.IncrementalSnapshot,data:Object.assign({source:j.StyleDeclaration},t)})),canvasMutationCb:K,fontCb:t=>Kt(Vt({type:q.IncrementalSnapshot,data:Object.assign({source:j.Font},t)})),selectionCb:t=>{Kt(Vt({type:q.IncrementalSnapshot,data:Object.assign({source:j.Selection},t)}))},blockClass:r,ignoreClass:o,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:Yt,iframeManager:Y,stylesheetManager:P,shadowDomManager:X,canvasManager:jt,ignoreCSSAttributes:E,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=>Kt(Vt({type:q.Plugin,data:{plugin:t.name,payload:e}}))})))||[]},f)};Y.addLoadListener(n=>{t.push(e(n.contentDocument))});const n=()=>{qt(),t.push(e(document)),Pt=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():t.push(R("load",()=>{Kt(Vt({type:q.Load,data:{}})),n()},window)),()=>{t.forEach(t=>t()),Pt=!1}}catch(t){console.warn(t)}}Xt.addCustomEvent=(t,e)=>{if(!Pt)throw new Error("please add custom event after start recording");Kt(Vt({type:q.Custom,data:{tag:t,payload:e}}))},Xt.freezePage=()=>{st.forEach(t=>t.freeze())},Xt.takeFullSnapshot=t=>{if(!Pt)throw new Error("please take full snapshot after start recording");qt(t)},Xt.mirror=Yt;class Qt{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=Xt({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 Jt(t,e){try{return t()}catch(t){return e}}const $t=16384,te=["application/json","text/plain","text/html","text/xml","application/xml","application/x-www-form-urlencoded"];function ee(t){return!!t&&te.some(e=>t.toLowerCase().includes(e))}function ne(t){return t.length>$t?t.substring(0,$t)+"\n[truncated]":t}class ie{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?ne(r.body):void 0;return e(i,r).then(e=>(Jt(()=>{const i=e.headers.get("content-length"),r=i?parseInt(i,10):void 0;if(ee(e.headers.get("content-type"))&&(!r||r<=$t))try{e.clone().text().then(i=>{Jt(()=>{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:ne(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 Jt(()=>{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?ne(e):void 0;return this.addEventListener("loadend",function(){Jt(()=>{var e;let n,c;try{if(""===this.responseType||"text"===this.responseType){n=null===(e=this.responseText)||void 0===e?void 0:e.length;ee(this.getResponseHeader("content-type"))&&this.responseText&&this.responseText.length<=$t&&(c=ne(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 re=["log","warn","error","debug","info"];class se{constructor(){this.originals={},this.active=!1}start(t){if(!this.active&&"undefined"!=typeof console){this.active=!0;for(const e of re){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]")||Jt(()=>{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 re)this.originals[t]&&(console[t]=this.originals[t]);this.originals={}}}}class oe{constructor(){this.errorHandler=null,this.rejectionHandler=null,this.active=!1}start(t){this.active||(this.active=!0,this.errorHandler=e=>{Jt(()=>{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=>{Jt(()=>{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 ae=new Set(["INPUT","TEXTAREA","SELECT"]);function le(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 ce=/\b(modal|dialog|slideover|drawer)\b/i;function de(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 ce.test(e)}function he(t){const e=t.querySelector("h1, h2, h3");return e?(e.textContent||"").trim().substring(0,200):t.getAttribute("aria-label")||""}class ue{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=>{Jt(()=>{const e=t.target;if(!e||!e.tagName)return;const n=e.tagName.toLowerCase(),i=ae.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=le(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=>{Jt(()=>{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=>{Jt(()=>{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:le(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:le(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=>{Jt(()=>{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=de(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(!de(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:he(t),dialog_selector:le(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=de(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(!de(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:le(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 pe=new Set(["A","BUTTON","INPUT","SELECT","TEXTAREA","LABEL","SUMMARY"]),ge=new Set(["button","link","tab","menuitem","checkbox","radio","switch","option"]);class me{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=>{Jt(()=>{var e;const n=t.target;if(!n||!n.tagName)return;if(!function(t){if(pe.has(t.tagName))return!0;const e=t.getAttribute("role");return!(!e||!ge.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 fe(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 ye{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=>{Jt(()=>{const e=t.target;if(!e||!e.tagName)return;const n={timestamp:Date.now(),target:fe(e),x:t.clientX,y:t.clientY};this.clickBuffer.push(n),this.clickBuffer.length>5&&this.clickBuffer.shift()})},this.errorHandler=t=>{Jt(()=>{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=>{Jt(()=>{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 be{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,Jt(()=>{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(()=>{Jt(()=>{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),Jt(()=>t.onNavigate())},history.replaceState=function(e,n,i){t.origReplaceState(e,n,i),Jt(()=>t.onNavigate())},this.popstateHandler=()=>Jt(()=>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 ve(t){let e=t.length;for(;--e>=0;)t[e]=0}const we=256,Ie=286,_e=30,Ce=15,ke=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]),Se=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]),Ae=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),xe=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ee=new Array(576);ve(Ee);const Te=new Array(60);ve(Te);const Re=new Array(512);ve(Re);const Ne=new Array(256);ve(Ne);const Me=new Array(29);ve(Me);const Oe=new Array(_e);function De(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 Le,Fe,ze;function Ue(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}ve(Oe);const He=t=>t<256?Re[t]:Re[256+(t>>>7)],Be=(t,e)=>{t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},Ze=(t,e,n)=>{t.bi_valid>16-n?(t.bi_buf|=e<<t.bi_valid&65535,Be(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)},We=(t,e,n)=>{Ze(t,n[2*e],n[2*e+1])},Ge=(t,e)=>{let n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1},Ve=(t,e,n)=>{const i=new Array(16);let r,s,o=0;for(r=1;r<=Ce;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]=Ge(i[e]++,e))}},Ke=t=>{let e;for(e=0;e<Ie;e++)t.dyn_ltree[2*e]=0;for(e=0;e<_e;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},qe=t=>{t.bi_valid>8?Be(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},je=(t,e,n,i)=>{const r=2*e,s=2*n;return t[r]<t[s]||t[r]===t[s]&&i[e]<=i[n]},Pe=(t,e,n)=>{const i=t.heap[n];let r=n<<1;for(;r<=t.heap_len&&(r<t.heap_len&&je(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!je(e,i,t.heap[r],t.depth));)t.heap[n]=t.heap[r],n=r,r<<=1;t.heap[n]=i},Ye=(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?We(t,r,e):(s=Ne[r],We(t,s+we+1,e),o=ke[s],0!==o&&(r-=Me[s],Ze(t,r,o)),i--,s=He(i),We(t,s,n),o=Se[s],0!==o&&(i-=Oe[s],Ze(t,i,o)))}while(a<t.sym_next);We(t,256,e)},Xe=(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--)Pe(t,n,o);l=s;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Pe(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++,Pe(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<=Ce;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),Ve(n,c,t.bl_count)},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),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))},Je=(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{We(t,r,t.bl_tree)}while(0!==--a);else 0!==r?(r!==s&&(We(t,r,t.bl_tree),a--),We(t,16,t.bl_tree),Ze(t,a-3,2)):a<=10?(We(t,17,t.bl_tree),Ze(t,a-3,3)):(We(t,18,t.bl_tree),Ze(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 $e=!1;const tn=(t,e,n,i)=>{Ze(t,0+(i?1:0),3),qe(t),Be(t,n),Be(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n};var en=(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<we;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0})(t)),Xe(t,t.l_desc),Xe(t,t.d_desc),o=(t=>{let e;for(Qe(t,t.dyn_ltree,t.l_desc.max_code),Qe(t,t.dyn_dtree,t.d_desc.max_code),Xe(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*xe[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?tn(t,e,n,i):4===t.strategy||s===r?(Ze(t,2+(i?1:0),3),Ye(t,Ee,Te)):(Ze(t,4+(i?1:0),3),((t,e,n,i)=>{let r;for(Ze(t,e-257,5),Ze(t,n-1,5),Ze(t,i-4,4),r=0;r<i;r++)Ze(t,t.bl_tree[2*xe[r]+1],3);Je(t,t.dyn_ltree,e-1),Je(t,t.dyn_dtree,n-1)})(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),Ye(t,t.dyn_ltree,t.dyn_dtree)),Ke(t),i&&qe(t)},nn={_tr_init:t=>{$e||((()=>{let t,e,n,i,r;const s=new Array(16);for(n=0,i=0;i<28;i++)for(Me[i]=n,t=0;t<1<<ke[i];t++)Ne[n++]=i;for(Ne[n-1]=i,r=0,i=0;i<16;i++)for(Oe[i]=r,t=0;t<1<<Se[i];t++)Re[r++]=i;for(r>>=7;i<_e;i++)for(Oe[i]=r<<7,t=0;t<1<<Se[i]-7;t++)Re[256+r++]=i;for(e=0;e<=Ce;e++)s[e]=0;for(t=0;t<=143;)Ee[2*t+1]=8,t++,s[8]++;for(;t<=255;)Ee[2*t+1]=9,t++,s[9]++;for(;t<=279;)Ee[2*t+1]=7,t++,s[7]++;for(;t<=287;)Ee[2*t+1]=8,t++,s[8]++;for(Ve(Ee,287,s),t=0;t<_e;t++)Te[2*t+1]=5,Te[2*t]=Ge(t,5);Le=new De(Ee,ke,257,Ie,Ce),Fe=new De(Te,Se,0,_e,Ce),ze=new De(new Array(0),Ae,0,19,7)})(),$e=!0),t.l_desc=new Ue(t.dyn_ltree,Le),t.d_desc=new Ue(t.dyn_dtree,Fe),t.bl_desc=new Ue(t.bl_tree,ze),t.bi_buf=0,t.bi_valid=0,Ke(t)},_tr_stored_block:tn,_tr_flush_block:en,_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*(Ne[n]+we+1)]++,t.dyn_dtree[2*He(e)]++),t.sym_next===t.sym_end),_tr_align:t=>{Ze(t,2,3),We(t,256,Ee),(t=>{16===t.bi_valid?(Be(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 rn=(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 sn=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 on=(t,e,n,i)=>{const r=sn,s=i+n;t^=-1;for(let n=i;n<s;n++)t=t>>>8^r[255&(t^e[n])];return-1^t},an={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"},ln={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:cn,_tr_stored_block:dn,_tr_flush_block:hn,_tr_tally:un,_tr_align:pn}=nn,{Z_NO_FLUSH:gn,Z_PARTIAL_FLUSH:mn,Z_FULL_FLUSH:fn,Z_FINISH:yn,Z_BLOCK:bn,Z_OK:vn,Z_STREAM_END:wn,Z_STREAM_ERROR:In,Z_DATA_ERROR:_n,Z_BUF_ERROR:Cn,Z_DEFAULT_COMPRESSION:kn,Z_FILTERED:Sn,Z_HUFFMAN_ONLY:An,Z_RLE:xn,Z_FIXED:En,Z_DEFAULT_STRATEGY:Tn,Z_UNKNOWN:Rn,Z_DEFLATED:Nn}=ln,Mn=258,On=262,Dn=42,Ln=113,Fn=666,zn=(t,e)=>(t.msg=an[e],e),Un=t=>2*t-(t>4?9:0),Hn=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Bn=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 Zn=(t,e,n)=>(e<<t.hash_shift^n)&t.hash_mask;const Wn=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))},Gn=(t,e)=>{hn(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Wn(t.strm)},Vn=(t,e)=>{t.pending_buf[t.pending++]=e},Kn=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},qn=(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=rn(t.adler,e,r,n):2===t.state.wrap&&(t.adler=on(t.adler,e,r,n)),t.next_in+=r,t.total_in+=r,r)},jn=(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-On?t.strstart-(t.w_size-On):0,c=t.window,d=t.w_mask,h=t.prev,u=t.strstart+Mn;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=Mn-(u-s),s=u-Mn,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},Pn=t=>{const e=t.w_size;let n,i,r;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-On)&&(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),Bn(t),i+=e),0===t.strm.avail_in)break;if(n=qn(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=Zn(t,t.ins_h,t.window[r+1]);t.insert&&(t.ins_h=Zn(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<On&&0!==t.strm.avail_in)},Yn=(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!==yn||e===gn||n!==i+t.strm.avail_in))break;o=e===yn&&n===i+t.strm.avail_in?1:0,dn(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,Wn(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&&(qn(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!==gn&&e!==yn&&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&&(qn(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===yn)&&e!==gn&&0===t.strm.avail_in&&i<=r)&&(n=i>r?r:i,o=e===yn&&0===t.strm.avail_in&&n===i?1:0,dn(t,t.block_start,n,o),t.block_start+=n,Wn(t.strm)),o?3:1)},Xn=(t,e)=>{let n,i;for(;;){if(t.lookahead<On){if(Pn(t),t.lookahead<On&&e===gn)return 1;if(0===t.lookahead)break}if(n=0,t.lookahead>=3&&(t.ins_h=Zn(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-On&&(t.match_length=jn(t,n)),t.match_length>=3)if(i=un(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=Zn(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=Zn(t,t.ins_h,t.window[t.strstart+1]);else i=un(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(Gn(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,e===yn?(Gn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Gn(t,!1),0===t.strm.avail_out)?1:2},Qn=(t,e)=>{let n,i,r;for(;;){if(t.lookahead<On){if(Pn(t),t.lookahead<On&&e===gn)return 1;if(0===t.lookahead)break}if(n=0,t.lookahead>=3&&(t.ins_h=Zn(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-On&&(t.match_length=jn(t,n),t.match_length<=5&&(t.strategy===Sn||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=un(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=Zn(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&&(Gn(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if(i=un(t,0,t.window[t.strstart-1]),i&&Gn(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=un(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===yn?(Gn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Gn(t,!1),0===t.strm.avail_out)?1:2};function Jn(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 $n=[new Jn(0,0,0,0,Yn),new Jn(4,4,8,4,Xn),new Jn(4,5,16,8,Xn),new Jn(4,6,32,32,Xn),new Jn(4,4,16,16,Qn),new Jn(8,16,32,32,Qn),new Jn(8,16,128,128,Qn),new Jn(8,32,128,256,Qn),new Jn(32,128,258,1024,Qn),new Jn(32,258,258,4096,Qn)];function ti(){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=Nn,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),Hn(this.dyn_ltree),Hn(this.dyn_dtree),Hn(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),Hn(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Hn(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 ei=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Dn&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==Ln&&e.status!==Fn?1:0},ni=t=>{if(ei(t))return zn(t,In);t.total_in=t.total_out=0,t.data_type=Rn;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?Dn:Ln,t.adler=2===e.wrap?0:1,e.last_flush=-2,cn(e),vn},ii=t=>{const e=ni(t);var n;return e===vn&&((n=t.state).window_size=2*n.w_size,Hn(n.head),n.max_lazy_match=$n[n.level].max_lazy,n.good_match=$n[n.level].good_length,n.nice_match=$n[n.level].nice_length,n.max_chain_length=$n[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},ri=(t,e,n,i,r,s)=>{if(!t)return In;let o=1;if(e===kn&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),r<1||r>9||n!==Nn||i<8||i>15||e<0||e>9||s<0||s>En||8===i&&1!==o)return zn(t,In);8===i&&(i=9);const a=new ti;return t.state=a,a.strm=t,a.status=Dn,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,ii(t)};var si={deflateInit:(t,e)=>ri(t,e,Nn,15,8,Tn),deflateInit2:ri,deflateReset:ii,deflateResetKeep:ni,deflateSetHeader:(t,e)=>ei(t)||2!==t.state.wrap?In:(t.state.gzhead=e,vn),deflate:(t,e)=>{if(ei(t)||e>bn||e<0)return t?zn(t,In):In;const n=t.state;if(!t.output||0!==t.avail_in&&!t.input||n.status===Fn&&e!==yn)return zn(t,0===t.avail_out?Cn:In);const i=n.last_flush;if(n.last_flush=e,0!==n.pending){if(Wn(t),0===t.avail_out)return n.last_flush=-1,vn}else if(0===t.avail_in&&Un(e)<=Un(i)&&e!==yn)return zn(t,Cn);if(n.status===Fn&&0!==t.avail_in)return zn(t,Cn);if(n.status===Dn&&0===n.wrap&&(n.status=Ln),n.status===Dn){let e=Nn+(n.w_bits-8<<4)<<8,i=-1;if(i=n.strategy>=An||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,Kn(n,e),0!==n.strstart&&(Kn(n,t.adler>>>16),Kn(n,65535&t.adler)),t.adler=1,n.status=Ln,Wn(t),0!==n.pending)return n.last_flush=-1,vn}if(57===n.status)if(t.adler=0,Vn(n,31),Vn(n,139),Vn(n,8),n.gzhead)Vn(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)),Vn(n,255&n.gzhead.time),Vn(n,n.gzhead.time>>8&255),Vn(n,n.gzhead.time>>16&255),Vn(n,n.gzhead.time>>24&255),Vn(n,9===n.level?2:n.strategy>=An||n.level<2?4:0),Vn(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Vn(n,255&n.gzhead.extra.length),Vn(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=on(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(Vn(n,0),Vn(n,0),Vn(n,0),Vn(n,0),Vn(n,0),Vn(n,9===n.level?2:n.strategy>=An||n.level<2?4:0),Vn(n,3),n.status=Ln,Wn(t),0!==n.pending)return n.last_flush=-1,vn;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=on(t.adler,n.pending_buf,n.pending-e,e)),n.gzindex+=r,Wn(t),0!==n.pending)return n.last_flush=-1,vn;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=on(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=on(t.adler,n.pending_buf,n.pending-i,i)),Wn(t),0!==n.pending)return n.last_flush=-1,vn;i=0}e=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,Vn(n,e)}while(0!==e);n.gzhead.hcrc&&n.pending>i&&(t.adler=on(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=on(t.adler,n.pending_buf,n.pending-i,i)),Wn(t),0!==n.pending)return n.last_flush=-1,vn;i=0}e=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,Vn(n,e)}while(0!==e);n.gzhead.hcrc&&n.pending>i&&(t.adler=on(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&&(Wn(t),0!==n.pending))return n.last_flush=-1,vn;Vn(n,255&t.adler),Vn(n,t.adler>>8&255),t.adler=0}if(n.status=Ln,Wn(t),0!==n.pending)return n.last_flush=-1,vn}if(0!==t.avail_in||0!==n.lookahead||e!==gn&&n.status!==Fn){let i=0===n.level?Yn(n,e):n.strategy===An?((t,e)=>{let n;for(;;){if(0===t.lookahead&&(Pn(t),0===t.lookahead)){if(e===gn)return 1;break}if(t.match_length=0,n=un(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(Gn(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===yn?(Gn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Gn(t,!1),0===t.strm.avail_out)?1:2})(n,e):n.strategy===xn?((t,e)=>{let n,i,r,s;const o=t.window;for(;;){if(t.lookahead<=Mn){if(Pn(t),t.lookahead<=Mn&&e===gn)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+Mn;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=Mn-(s-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=un(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=un(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(Gn(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,e===yn?(Gn(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(Gn(t,!1),0===t.strm.avail_out)?1:2})(n,e):$n[n.level].func(n,e);if(3!==i&&4!==i||(n.status=Fn),1===i||3===i)return 0===t.avail_out&&(n.last_flush=-1),vn;if(2===i&&(e===mn?pn(n):e!==bn&&(dn(n,0,0,!1),e===fn&&(Hn(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Wn(t),0===t.avail_out))return n.last_flush=-1,vn}return e!==yn?vn:n.wrap<=0?wn:(2===n.wrap?(Vn(n,255&t.adler),Vn(n,t.adler>>8&255),Vn(n,t.adler>>16&255),Vn(n,t.adler>>24&255),Vn(n,255&t.total_in),Vn(n,t.total_in>>8&255),Vn(n,t.total_in>>16&255),Vn(n,t.total_in>>24&255)):(Kn(n,t.adler>>>16),Kn(n,65535&t.adler)),Wn(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?vn:wn)},deflateEnd:t=>{if(ei(t))return In;const e=t.state.status;return t.state=null,e===Ln?zn(t,_n):vn},deflateSetDictionary:(t,e)=>{let n=e.length;if(ei(t))return In;const i=t.state,r=i.wrap;if(2===r||1===r&&i.status!==Dn||i.lookahead)return In;if(1===r&&(t.adler=rn(t.adler,e,n,0)),i.wrap=0,n>=i.w_size){0===r&&(Hn(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,Pn(i);i.lookahead>=3;){let t=i.strstart,e=i.lookahead-2;do{i.ins_h=Zn(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,Pn(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,vn},deflateInfo:"pako deflate (from Nodeca project)"};const oi=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var ai=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)oi(n,e)&&(t[e]=n[e])}}return t},li=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 ci=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){ci=!1}const di=new Uint8Array(256);for(let t=0;t<256;t++)di[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;di[254]=di[254]=1;var hi=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},ui=(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=di[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&&ci)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)},pi=(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+di[t[n]]>e?n:e};var gi=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 mi=Object.prototype.toString,{Z_NO_FLUSH:fi,Z_SYNC_FLUSH:yi,Z_FULL_FLUSH:bi,Z_FINISH:vi,Z_OK:wi,Z_STREAM_END:Ii,Z_DEFAULT_COMPRESSION:_i,Z_DEFAULT_STRATEGY:Ci,Z_DEFLATED:ki}=ln;function Si(t){this.options=ai({level:_i,method:ki,chunkSize:16384,windowBits:15,memLevel:8,strategy:Ci},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 gi,this.strm.avail_out=0;let n=si.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==wi)throw new Error(an[n]);if(e.header&&si.deflateSetHeader(this.strm,e.header),e.dictionary){let t;if(t="string"==typeof e.dictionary?hi(e.dictionary):"[object ArrayBuffer]"===mi.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,n=si.deflateSetDictionary(this.strm,t),n!==wi)throw new Error(an[n]);this._dict_set=!0}}function Ai(t,e){const n=new Si(e);if(n.push(t,!0),n.err)throw n.msg||an[n.err];return n.result}Si.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?vi:fi,"string"==typeof t?n.input=hi(t):"[object ArrayBuffer]"===mi.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===yi||s===bi)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(r=si.deflate(n,s),r===Ii)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),r=si.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===wi;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},Si.prototype.onData=function(t){this.chunks.push(t)},Si.prototype.onEnd=function(t){t===wi&&(this.result=li(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var xi={Deflate:Si,deflate:Ai,deflateRaw:function(t,e){return(e=e||{}).raw=!0,Ai(t,e)},gzip:function(t,e){return(e=e||{}).gzip=!0,Ai(t,e)}};const Ei=16209;var Ti=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=Ei;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=Ei;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=Ei;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=Ei;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 Ri=15,Ni=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]),Mi=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]),Oi=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]),Di=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 Li=(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<=Ri;m++)A[m]=0;for(f=0;f<i;f++)A[e[n+f]]++;for(v=l,b=Ri;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<=Ri;m++)if(_<<=1,_-=A[m],_<0)return-1;if(_>0&&(0===t||1!==b))return-1;for(x[1]=0,m=1;m<Ri;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=Ni,N=Mi,g=257):(S=Oi,N=Di,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:Fi,Z_BLOCK:zi,Z_TREES:Ui,Z_OK:Hi,Z_STREAM_END:Bi,Z_NEED_DICT:Zi,Z_STREAM_ERROR:Wi,Z_DATA_ERROR:Gi,Z_MEM_ERROR:Vi,Z_BUF_ERROR:Ki,Z_DEFLATED:qi}=ln,ji=16180,Pi=16190,Yi=16191,Xi=16192,Qi=16194,Ji=16199,$i=16200,tr=16206,er=16209,nr=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);function ir(){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 rr=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<ji||e.mode>16211?1:0},sr=t=>{if(rr(t))return Wi;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=ji,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,Hi},or=t=>{if(rr(t))return Wi;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,sr(t)},ar=(t,e)=>{let n;if(rr(t))return Wi;const i=t.state;return e<0?(n=0,e=-e):(n=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?Wi:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=n,i.wbits=e,or(t))},lr=(t,e)=>{if(!t)return Wi;const n=new ir;t.state=n,n.strm=t,n.window=null,n.mode=ji;const i=ar(t,e);return i!==Hi&&(t.state=null),i};let cr,dr,hr=!0;const ur=t=>{if(hr){cr=new Int32Array(512),dr=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(Li(1,t.lens,0,288,cr,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Li(2,t.lens,0,32,dr,0,t.work,{bits:5}),hr=!1}t.lencode=cr,t.lenbits=9,t.distcode=dr,t.distbits=5},pr=(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 gr={inflateReset:or,inflateReset2:ar,inflateResetKeep:sr,inflateInit:t=>lr(t,15),inflateInit2:lr,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(rr(t)||!t.output||!t.input&&0!==t.avail_in)return Wi;n=t.state,n.mode===Yi&&(n.mode=Xi),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=Hi;t:for(;;)switch(n.mode){case ji:if(0===n.wrap){n.mode=Xi;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=on(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=er;break}if((15&c)!==qi){t.msg="unknown compression method",n.mode=er;break}if(c>>>=4,d-=4,_=8+(15&c),0===n.wbits&&(n.wbits=_),_>15||_>n.wbits){t.msg="invalid window size",n.mode=er;break}n.dmax=1<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=512&c?16189:Yi,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)!==qi){t.msg="unknown compression method",n.mode=er;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=er;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=on(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=on(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=on(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=on(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=on(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=on(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=on(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=er;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=Yi;break;case 16189:for(;d<32;){if(0===a)break t;a--,c+=i[s++]<<d,d+=8}t.adler=n.check=nr(c),c=0,d=0,n.mode=Pi;case Pi: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,Zi;t.adler=n.check=1,n.mode=Yi;case Yi:if(e===zi||e===Ui)break t;case Xi:if(n.last){c>>>=7&d,d-=7&d,n.mode=tr;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(ur(n),n.mode=Ji,e===Ui){c>>>=2,d-=2;break t}break;case 2:n.mode=16196;break;case 3:t.msg="invalid block type",n.mode=er}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=er;break}if(n.length=65535&c,c=0,d=0,n.mode=Qi,e===Ui)break t;case Qi: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=Yi;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=er;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=Li(0,n.lens,0,19,n.lencode,0,n.work,A),n.lenbits=A.bits,C){t.msg="invalid code lengths set",n.mode=er;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=er;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=er;break}for(;p--;)n.lens[n.have++]=_}}if(n.mode===er)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=er;break}if(n.lenbits=9,A={bits:n.lenbits},C=Li(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=er;break}if(n.distbits=6,n.distcode=n.distdyn,A={bits:n.distbits},C=Li(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=er;break}if(n.mode=Ji,e===Ui)break t;case Ji:n.mode=$i;case $i: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,Ti(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===Yi&&(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=Yi;break}if(64&y){t.msg="invalid literal/length code",n.mode=er;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=er;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=er;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=er;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=$i);break;case 16205:if(0===l)break t;r[o++]=n.length,l--,n.mode=$i;break;case tr: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?on(n.check,r,u,o-u):rn(n.check,r,u,o-u)),u=l,4&n.wrap&&(n.flags?c:nr(c))!==n.check){t.msg="incorrect data check",n.mode=er;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=er;break}c=0,d=0}n.mode=16208;case 16208:C=Bi;break t;case er:C=Gi;break t;case 16210:return Vi;default:return Wi}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<er&&(n.mode<tr||e!==Fi))&&pr(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?on(n.check,r,u,t.next_out-u):rn(n.check,r,u,t.next_out-u)),t.data_type=n.bits+(n.last?64:0)+(n.mode===Yi?128:0)+(n.mode===Ji||n.mode===Qi?256:0),(0===h&&0===u||e===Fi)&&C===Hi&&(C=Ki),C},inflateEnd:t=>{if(rr(t))return Wi;let e=t.state;return e.window&&(e.window=null),t.state=null,Hi},inflateGetHeader:(t,e)=>{if(rr(t))return Wi;const n=t.state;return 2&n.wrap?(n.head=e,e.done=!1,Hi):Wi},inflateSetDictionary:(t,e)=>{const n=e.length;let i,r,s;return rr(t)?Wi:(i=t.state,0!==i.wrap&&i.mode!==Pi?Wi:i.mode===Pi&&(r=1,r=rn(r,e,n,0),r!==i.check)?Gi:(s=pr(t,e,n,n),s?(i.mode=16210,Vi):(i.havedict=1,Hi)))},inflateInfo:"pako inflate (from Nodeca project)"};var mr=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 fr=Object.prototype.toString,{Z_NO_FLUSH:yr,Z_FINISH:br,Z_OK:vr,Z_STREAM_END:wr,Z_NEED_DICT:Ir,Z_STREAM_ERROR:_r,Z_DATA_ERROR:Cr,Z_MEM_ERROR:kr}=ln;function Sr(t){this.options=ai({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 gi,this.strm.avail_out=0;let n=gr.inflateInit2(this.strm,e.windowBits);if(n!==vr)throw new Error(an[n]);if(this.header=new mr,gr.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=hi(e.dictionary):"[object ArrayBuffer]"===fr.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=gr.inflateSetDictionary(this.strm,e.dictionary),n!==vr)))throw new Error(an[n])}function Ar(t,e){const n=new Sr(e);if(n.push(t),n.err)throw n.msg||an[n.err];return n.result}Sr.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?br:yr,"[object ArrayBuffer]"===fr.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=gr.inflate(n,o),s===Ir&&r&&(s=gr.inflateSetDictionary(n,r),s===vr?s=gr.inflate(n,o):s===Cr&&(s=Ir));n.avail_in>0&&s===wr&&n.state.wrap>0&&0!==t[n.next_in];)gr.inflateReset(n),s=gr.inflate(n,o);switch(s){case _r:case Cr:case Ir:case kr:return this.onEnd(s),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(0===n.avail_out||s===wr))if("string"===this.options.to){let t=pi(n.output,n.next_out),e=n.next_out-t,r=ui(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!==vr||0!==a){if(s===wr)return s=gr.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},Sr.prototype.onData=function(t){this.chunks.push(t)},Sr.prototype.onEnd=function(t){t===vr&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=li(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};var xr={Inflate:Sr,inflate:Ar,inflateRaw:function(t,e){return(e=e||{}).raw=!0,Ar(t,e)},ungzip:Ar};const{Deflate:Er,deflate:Tr,deflateRaw:Rr,gzip:Nr}=xi,{Inflate:Mr,inflate:Or,inflateRaw:Dr,ungzip:Lr}=xr;var Fr={Deflate:Er,deflate:Tr,deflateRaw:Rr,gzip:Nr,Inflate:Mr,inflate:Or,inflateRaw:Dr,ungzip:Lr,constants:ln};class zr{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 Fr.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 Ur{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 Hr(){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 Br="wr_session",Zr="wr_session_ts",Wr="wr_anon_id";class Gr{constructor(t){this.timeout=t,this.sessionId=this.getOrCreateSession(),this.anonymousId=this.getOrCreateAnonymousId()}getOrCreateAnonymousId(){try{const t=localStorage.getItem(Wr);if(t)return t}catch(t){}const t=Hr();try{localStorage.setItem(Wr,t)}catch(t){}return t}getOrCreateSession(){try{const t=sessionStorage.getItem(Br),e=sessionStorage.getItem(Zr);if(t&&e){if(Date.now()-parseInt(e,10)<this.timeout)return this.touch(),t}}catch(t){}const t=Hr();return this.persist(t),t}persist(t){try{sessionStorage.setItem(Br,t),sessionStorage.setItem(Zr,Date.now().toString())}catch(t){}}touch(){try{sessionStorage.setItem(Zr,Date.now().toString())}catch(t){}}getSessionId(){return this.sessionId}getAnonymousId(){return this.anonymousId}getLastActivity(){try{const t=sessionStorage.getItem(Zr);return t?parseInt(t,10):null}catch(t){return null}}reset(){return this.sessionId=Hr(),this.persist(this.sessionId),this.sessionId}}const Vr="wr_identity";class Kr{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(Vr)}catch(t){}}persist(){try{localStorage.setItem(Vr,JSON.stringify({userId:this.userId,traits:this.traits}))}catch(t){}}restore(){try{const t=localStorage.getItem(Vr);if(t){const e=JSON.parse(t);e.userId&&(this.userId=e.userId,this.traits=e.traits||{})}}catch(t){}}}function qr(t,e=2e3){"undefined"!=typeof requestIdleCallback?requestIdleCallback(t,{timeout:e}):setTimeout(()=>t({didTimeout:!0,timeRemaining:()=>0}),1)}class jr{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">×</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="★",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">✓</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 Pr=null;class Yr{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(t){const n=(...e)=>{t.debug&&console.log("%c[WebRec]","color: #a855f7; font-weight: bold;",...e)};if(this.initialized)return void n("Already initialized, skipping");if(!t.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({},e),t),{sampling:Object.assign(Object.assign({},e.sampling),t.sampling),privacy:Object.assign(Object.assign({},e.privacy),t.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 Gr(this.config.sessionTimeout),this.userIdentifier=new Kr,this.domRecorder=new Qt,this.networkInterceptor=new ie,this.consoleInterceptor=new se,this.errorTracker=new oe,this.interactionEnricher=new ue,this.deadClickDetector=new me,this.errorClickDetector=new ye,this.scrollDepthTracker=new be;const r=this.sessionManager.getSessionId(),s=this.sessionManager.getAnonymousId();this.transport=new zr({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 Ur(this.transport,this.config.apiKey),this.transport.setIdentityProvider(()=>({userId:this.userIdentifier.getUserId(),traits:this.userIdentifier.getTraits()})),this.userIdentifier.setCallback((t,e)=>{Jt(()=>{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(()=>{qr(()=>{this.start()})},o):qr(()=>{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":"")),Jt(()=>{this.domRecorder.start(this.config,t=>{this.sessionManager.touch(),this.transport.enqueue(t)})}),this.config.captureNetwork&&Jt(()=>{this.networkInterceptor.start(t=>{this.transport.enqueue({type:5,data:{tag:"recorder:network",payload:t},timestamp:Date.now()})},this.config.endpoint)}),this.config.captureConsole&&Jt(()=>{this.consoleInterceptor.start(t=>{this.transport.enqueue({type:5,data:{tag:"recorder:console",payload:t},timestamp:Date.now()})})}),this.config.captureErrors&&Jt(()=>{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(()=>{})})}),Jt(()=>{this.interactionEnricher.start(t=>{this.sessionManager.touch(),this.transport.enqueue(t)})}),Jt(()=>{this.deadClickDetector.start(t=>{this.transport.enqueue(t)})}),Jt(()=>{this.errorClickDetector.start(t=>{this.transport.enqueue(t)})}),Jt(()=>{this.scrollDepthTracker.start(t=>{this.transport.enqueue(t)})}),this.transport.start(),this.beacon.start(),this.startRouteTracking(),this.startVisibilityTracking(),this.startRageClickDetection(),this.startSessionCheck(),this.captureWebVitals(),Jt(()=>{!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(!Pr){try{sessionStorage.setItem(`wr_survey_shown_${c.survey_id}`,"1")}catch(t){}r("Showing survey:",c.survey_name),Pr=new jr(c,t,e,n(),()=>{Pr=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,Jt(()=>this.domRecorder.stop()),Jt(()=>this.networkInterceptor.stop()),Jt(()=>this.consoleInterceptor.stop()),Jt(()=>this.errorTracker.stop()),Jt(()=>this.interactionEnricher.stop()),Jt(()=>this.deadClickDetector.stop()),Jt(()=>this.errorClickDetector.stop()),Jt(()=>this.scrollDepthTracker.stop()),Jt(()=>this.transport.stop()),Jt(()=>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),Jt(()=>e(location.href))},history.replaceState=function(t,n,r){i(t,n,r),Jt(()=>e(location.href))};const r=()=>Jt(()=>e(location.href));window.addEventListener("popstate",r);const s=()=>Jt(()=>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=Jt(()=>{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(),Jt(()=>{this.domRecorder.stop(),this.domRecorder.start(this.config,t=>{this.sessionManager.touch(),this.transport.enqueue(t)})})}},6e4)}captureWebVitals(){"undefined"!=typeof PerformanceObserver&&(Jt(()=>{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})}),Jt(()=>{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})}),Jt(()=>{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})}),Jt(()=>{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})}),Jt(()=>{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()})}),Jt(()=>{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 Xr=new Yr;const Qr={init(t){Xr.init(t)},identify(t,e){Xr.identify(t,e)},track(t,e){Xr.track(t,e)},stop(){Xr.stop()},start(){Xr.start()},destroy(){Xr.destroy(),Xr=new Yr},getSessionId:()=>Xr.getSessionId(),getSessionUrl:()=>Xr.getSessionUrl(),isRecording:()=>Xr.isRecording()};t.WebRec=Qr,t.default=Qr,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
17
|
+
//# sourceMappingURL=webrec.umd.js.map
|