clarity-js 0.8.10 → 0.8.11

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.
@@ -1 +1 @@
1
- !function(){"use strict";var t=Object.freeze({__proto__:null,get queue(){return bt},get start(){return yt},get stop(){return wt},get track(){return dt}}),n=Object.freeze({__proto__:null,get check(){return Tt},get compute(){return xt},get data(){return pt},get start(){return Ot},get stop(){return jt},get trigger(){return Et}}),e=Object.freeze({__proto__:null,get compute(){return Dt},get data(){return Nt},get log(){return qt},get reset(){return Rt},get start(){return Ct},get stop(){return Pt},get updates(){return zt}}),r=Object.freeze({__proto__:null,get callback(){return Gt},get callbacks(){return Xt},get clear(){return Ft},get consent(){return Zt},get data(){return Ut},get electron(){return Vt},get id(){return Jt},get metadata(){return Wt},get save(){return Kt},get shortid(){return tn},get start(){return Bt},get stop(){return Yt}}),a=Object.freeze({__proto__:null,get data(){return cn},get envelope(){return dn},get start(){return sn},get stop(){return ln}}),o={projectId:null,delay:1e3,lean:!1,lite:!1,track:!0,content:!0,drop:[],mask:[],unmask:[],regions:[],cookies:[],fraud:!0,checksum:[],report:null,upload:null,fallback:null,upgrade:null,action:null,dob:null,delayDom:!1,throttleDom:!0,conversions:!1,includeSubdomains:!0};function i(t){return window.Zone&&"__symbol__"in window.Zone?window.Zone.__symbol__(t):t}var u=255,c=!0,s=null,l=null;function d(t,n,e){void 0===n&&(n=!1),void 0===e&&(e=!1);var r=t;if(n)r="".concat("https://").concat("Electron");else{var a=o.drop;if(a&&a.length>0&&t&&t.indexOf("?")>0){var i=t.split("?"),c=i[0],s=i[1];r="".concat(c,"?").concat(s.split("&").map((function(t){return a.some((function(n){return 0===t.indexOf("".concat(n,"="))}))?"".concat(t.split("=")[0],"=").concat("*na*"):t})).join("&"))}}return e&&(r=r.substring(0,u)),r}function p(t,n,e){return function(){if(c&&null===s)try{s=/\p{N}/gu,l=/\p{L}/gu}catch(t){c=!1}}(),t?t.replace(l,n).replace(s,e):t}var f=0;function h(t){void 0===t&&(t=null);var n=t&&t.timeStamp>0?t.timeStamp:performance.now(),e=t&&t.view?t.view.performance.timeOrigin:performance.timeOrigin;return Math.max(Math.round(n+e-f),0)}var v="0.8.10";var g=[],m=null;function y(){}var b=[];function w(){}function k(){}var S=Object.freeze({__proto__:null,checkDocumentStyles:function(t){},compute:function(){},data:m,hashText:w,keys:b,log:y,observe:function(){},reset:function(){},sheetAdoptionState:[],sheetUpdateState:[],start:function(){},state:g,stop:function(){},trigger:k}),_=null;function I(t,n){qn()&&t&&"string"==typeof t&&t.length<255&&(_=n&&"string"==typeof n&&n.length<255?{key:t,value:n}:{value:t},Mt(24))}var M,O=null,T=null;function E(t){t in O||(O[t]=0),t in T||(T[t]=0),O[t]++,T[t]++}function x(t,n){null!==n&&(t in O||(O[t]=0),t in T||(T[t]=0),O[t]+=n,T[t]+=n)}function j(t,n){null!==n&&!1===Number.isNaN(n)&&(t in O||(O[t]=0),(n>O[t]||0===O[t])&&(T[t]=n,O[t]=n))}function N(t,n,e){return window.setTimeout(hn(t),n,e)}function z(t){window.clearTimeout(t)}var A=0,C=0,P=null;function q(){P&&z(P),P=N(D,C),A=h()}function D(){var t=h();M={gap:t-A},Mt(25),M.gap<3e5?P=N(D,C):function(){if(An){I("clarity","suspend"),oe();for(var t=0,n=["mousemove","touchstart"];t<n.length;t++){var e=n[t];gn(document,e,Dn)}for(var r=0,a=["resize","scroll","pageshow"];r<a.length;r++){e=a[r];gn(window,e,Dn)}}}()}var R=Object.freeze({__proto__:null,get data(){return M},reset:q,start:function(){C=6e4,A=0},stop:function(){z(P),A=0,C=0}}),H=null;function U(t){qn()&&o.lean&&(o.lean=!1,H={key:t},Gt(),Kt(),o.upgrade&&o.upgrade(t),Mt(3),o.lite)}var X=Object.freeze({__proto__:null,get data(){return H},start:function(){!o.lean&&o.upgrade&&o.upgrade("Config"),H=null},stop:function(){H=null},upgrade:U});function V(t,n,e,r){return new(e||(e=Promise))((function(a,o){function i(t){try{c(r.next(t))}catch(t){o(t)}}function u(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var n;t.done?a(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(i,u)}c((r=r.apply(t,n||[])).next())}))}function L(t,n){var e,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(c){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(i=0)),i;)try{if(e=1,r&&(a=2&u[0]?r.return:u[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,u[1])).done)return a;switch(r=0,a&&(u=[2&u[0],a.value]),u[0]){case 0:case 1:a=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!a||u[1]>a[0]&&u[1]<a[3])){i.label=u[1];break}if(6===u[0]&&i.label<a[1]){i.label=a[1],a=u;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(u);break}a[2]&&i.ops.pop(),i.trys.pop();continue}u=n.call(t,i)}catch(t){u=[6,t],r=0}finally{e=a=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}var B=null;function Y(t,n){J(t,"string"==typeof n?[n]:n)}function W(t,n,e,r){return void 0===n&&(n=null),void 0===e&&(e=null),void 0===r&&(r=null),V(this,void 0,void 0,(function(){var a,o;return L(this,(function(i){switch(i.label){case 0:return o={},[4,G(t)];case 1:return o.userId=i.sent(),o.userHint=r||((u=t)&&u.length>=5?"".concat(u.substring(0,2)).concat(p(u.substring(2),"*","*")):p(u,"*","*")),J("userId",[(a=o).userId]),J("userHint",[a.userHint]),J("userType",[K(t)]),n&&(J("sessionId",[n]),a.sessionId=n),e&&(J("pageId",[e]),a.pageId=e),[2,a]}var u}))}))}function J(t,n){if(qn()&&t&&n&&"string"==typeof t&&t.length<255){for(var e=(t in B?B[t]:[]),r=0;r<n.length;r++)"string"==typeof n[r]&&n[r].length<255&&e.push(n[r]);B[t]=e}}function Z(){Mt(34)}function F(){B={}}function G(t){return V(this,void 0,void 0,(function(){var n;return L(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),crypto&&t?[4,crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t))]:[3,2];case 1:return n=e.sent(),[2,Array.prototype.map.call(new Uint8Array(n),(function(t){return"00".concat(t.toString(16)).slice(-2)})).join("")];case 2:return[2,""];case 3:return e.sent(),[2,""];case 4:return[2]}}))}))}function K(t){return t&&t.indexOf("@")>0?"email":"string"}var Q="CompressionStream"in window;function $(t){return V(this,void 0,void 0,(function(){var n,e;return L(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),Q?(n=new ReadableStream({start:function(n){return V(this,void 0,void 0,(function(){return L(this,(function(e){return n.enqueue(t),n.close(),[2]}))}))}}).pipeThrough(new TextEncoderStream).pipeThrough(new window.CompressionStream("gzip")),e=Uint8Array.bind,[4,tt(n)]):[3,2];case 1:return[2,new(e.apply(Uint8Array,[void 0,r.sent()]))];case 2:return[3,4];case 3:return r.sent(),[3,4];case 4:return[2,null]}}))}))}function tt(t){return V(this,void 0,void 0,(function(){var n,e,r,a,o;return L(this,(function(i){switch(i.label){case 0:n=t.getReader(),e=[],r=!1,a=[],i.label=1;case 1:return r?[3,3]:[4,n.read()];case 2:return o=i.sent(),r=o.done,a=o.value,r?[2,e]:(e.push.apply(e,a),[3,1]);case 3:return[2,e]}}))}))}var nt=null;function et(t){try{if(!nt)return;for(var n=function(t){try{return JSON.parse(t)}catch(t){return[]}}(t),e=0,r=n;e<r.length;e++){var a=r[e];nt(a)}}catch(t){}}var rt=[S,e,Object.freeze({__proto__:null,compute:Z,get data(){return B},identify:W,reset:F,set:Y,start:function(){F()},stop:function(){F()}}),n,S,r,a,t,R,X,S];function at(){O={},T={},E(5);for(var t=0,n=rt;t<n.length;t++){hn(n[t].start)()}}function ot(){for(var t=0,n=rt.slice().reverse();t<n.length;t++){hn(n[t].stop)()}O={},T={}}function it(){Z(),Dt(),Mt(0),xt()}var ut,ct,st,lt,dt,pt,ft=0,ht=0,vt=null,gt=0,mt=!1;function yt(){lt=!0,ft=0,ht=0,mt=!1,gt=0,ut=[],ct=[],st={},dt=null}function bt(t,n){if(void 0===n&&(n=!0),lt){var e=h(),r=t.length>1?t[1]:null,a=JSON.stringify(t);switch(o.lean?!mt&&ht+a.length>10485760&&(mt=!0):mt=!1,r){case 5:if(mt)break;ft+=a.length;case 37:case 6:case 43:case 45:case 46:if(mt)break;ht+=a.length,ut.push(a);break;default:ct.push(a)}E(25);var i=function(){var t=!1===o.lean&&ft>0?100:cn.sequence*o.delay;return"string"==typeof o.upload?Math.max(Math.min(t,3e4),100):o.delay}();e-gt>2*i&&(z(vt),vt=null),n&&null===vt&&(25!==r&&q(),vt=N(kt,i),gt=e,Tt(ht))}}function wt(){z(vt),kt(!0),ft=0,ht=0,mt=!1,gt=0,ut=[],ct=[],st={},dt=null,lt=!1}function kt(t){return void 0===t&&(t=!1),V(this,void 0,void 0,(function(){var n,e,r,a,i,u,c,s;return L(this,(function(l){switch(l.label){case 0:return vt=null,(n=!1===o.lean&&ht>0&&(ht<1048576||cn.sequence>0))&&j(1,1),it(),e=!0===t,r=JSON.stringify(dn(e)),a="[".concat(ct.join(),"]"),i=n?"[".concat(ut.join(),"]"):"",u=function(t){return t.p.length>0?'{"e":'.concat(t.e,',"a":').concat(t.a,',"p":').concat(t.p,"}"):'{"e":'.concat(t.e,',"a":').concat(t.a,"}")}({e:r,a:a,p:i}),e?(s=null,[3,3]):[3,1];case 1:return[4,$(u)];case 2:s=l.sent(),l.label=3;case 3:return x(2,(c=s)?c.length:u.length),St(u,c,cn.sequence,e),ct=[],n&&(ut=[],ht=0,ft=0,mt=!1),[2]}}))}))}function St(t,n,e,r){if(void 0===r&&(r=!1),"string"==typeof o.upload){var a=o.upload,i=!1;if(r&&"sendBeacon"in navigator)try{(i=navigator.sendBeacon.bind(navigator)(a,t))&&It(e)}catch(t){}if(!1===i){e in st?st[e].attempts++:st[e]={data:t,attempts:1};var u=new XMLHttpRequest;u.open("POST",a,!0),u.timeout=15e3,u.ontimeout=function(){fn(new Error("".concat("Timeout"," : ").concat(a)))},null!==e&&(u.onreadystatechange=function(){hn(_t)(u,e)}),u.withCredentials=!0,n?(u.setRequestHeader("Accept","application/x-clarity-gzip"),u.send(n)):u.send(t)}}else if(o.upload){(0,o.upload)(t),It(e)}}function _t(t,n){var e=st[n];t&&4===t.readyState&&e&&((t.status<200||t.status>208)&&e.attempts<=1?t.status>=400&&t.status<500?Et(6):(0===t.status&&(o.upload=o.fallback?o.fallback:o.upload),St(e.data,null,n)):(dt={sequence:n,attempts:e.attempts,status:t.status},e.attempts>1&&Mt(2),200===t.status&&t.responseText&&function(t){for(var n=t&&t.length>0?t.split("\n"):[],e=0,r=n;e<r.length;e++){var a=r[e],i=a&&a.length>0?a.split(/ (.*)/):[""];switch(i[0]){case"END":Et(6);break;case"UPGRADE":U("Auto");break;case"ACTION":o.action&&i.length>1&&o.action(i[1]);break;case"EXTRACT":i.length>1&&i[1];break;case"SIGNAL":i.length>1&&et(i[1])}}}(t.responseText),0===t.status&&(St(e.data,null,n,!0),Et(3)),t.status>=200&&t.status<=208&&It(n),delete st[n]))}function It(t){1===t&&(Kt(),Gt())}function Mt(t){var n=[h(),t];switch(t){case 4:var e=g;e&&((n=[e.time,e.event]).push(e.data.visible),n.push(e.data.docWidth),n.push(e.data.docHeight),n.push(e.data.screenWidth),n.push(e.data.screenHeight),n.push(e.data.scrollX),n.push(e.data.scrollY),n.push(e.data.pointerX),n.push(e.data.pointerY),n.push(e.data.activityTime),n.push(e.data.scrollTime),n.push(e.data.pointerTime),n.push(e.data.moveX),n.push(e.data.moveY),n.push(e.data.moveTime),n.push(e.data.downX),n.push(e.data.downY),n.push(e.data.downTime),n.push(e.data.upX),n.push(e.data.upY),n.push(e.data.upTime),n.push(e.data.pointerPrevX),n.push(e.data.pointerPrevY),n.push(e.data.pointerPrevTime),bt(n,!1));break;case 25:n.push(M.gap),bt(n);break;case 35:n.push(pt.check),bt(n,!1);break;case 3:n.push(H.key),bt(n);break;case 2:n.push(dt.sequence),n.push(dt.attempts),n.push(dt.status),bt(n,!1);break;case 24:_.key&&n.push(_.key),n.push(_.value),bt(n);break;case 34:var r=Object.keys(B);if(r.length>0){for(var a=0,o=r;a<o.length;a++){var i=o[a];n.push(i),n.push(B[i])}F(),bt(n,!1)}break;case 0:var u=Object.keys(T);if(u.length>0){for(var c=0,s=u;c<s.length;c++){var l=s[c],d=Number.parseInt(l,10);n.push(d),n.push(Math.round(T[l]))}T={},bt(n,!1)}break;case 1:var p=Object.keys(zt);if(p.length>0){for(var f=0,v=p;f<v.length;f++){var y=v[f];d=Number.parseInt(y,10);n.push(d),n.push(zt[y])}Rt(),bt(n,!1)}break;case 36:var w=Object.keys(m);if(w.length>0){for(var k=0,S=w;k<S.length;k++){var I=S[k];d=Number.parseInt(I,10);n.push(d),n.push([].concat.apply([],m[I]))}bt(n,!1)}break;case 40:for(var O=b,E=0,x=Array.from(O);E<x.length;E++){I=x[E];n.push(I);var j=[];for(var y in m[I]){d=Number.parseInt(y,10);j.push(d),j.push(m[I][y])}n.push(j)}bt(n,!1)}}function Ot(){pt={check:0}}function Tt(t){if(0===pt.check){var n=pt.check;n=cn.sequence>=128?1:n,n=cn.pageNum>=128?7:n,n=h()>72e5?2:n,(n=t>10485760?2:n)!==pt.check&&Et(n)}}function Et(t){pt.check=t,5!==t&&(Ft(),oe())}function xt(){0!==pt.check&&Mt(35)}function jt(){pt=null}var Nt=null,zt=null,At=!1;function Ct(){Nt={},zt={},At=!1}function Pt(){Nt={},zt={},At=!1}function qt(t,n){if(n){var e="".concat(n);if(t in Nt||(Nt[t]=[]),Nt[t].indexOf(e)<0){if(Nt[t].length>128)return void(At||(At=!0,Et(5)));Nt[t].push(e),t in zt||(zt[t]=[]),zt[t].push(e)}}}function Dt(){Mt(1)}function Rt(){zt={},At=!1}function Ht(t){qt(36,t.toString())}var Ut=null,Xt=[],Vt=0,Lt=null;function Bt(){var t,n,e;Lt=null;var r=navigator&&"userAgent"in navigator?navigator.userAgent:"",a=null!==(e=null===(n=null===(t=null===Intl||void 0===Intl?void 0:Intl.DateTimeFormat())||void 0===t?void 0:t.resolvedOptions())||void 0===n?void 0:n.timeZone)&&void 0!==e?e:"",i=(new Date).getTimezoneOffset().toString(),u=window.location.ancestorOrigins?Array.from(window.location.ancestorOrigins).toString():"",c=(null===document||void 0===document?void 0:document.title)?document.title:"";Vt=r.indexOf("Electron")>0?1:0;var s,l=function(){var t={session:tn(),ts:Math.round(Date.now()),count:1,upgrade:null,upload:""},n=rn("_clsk",!o.includeSubdomains);if(n){var e=n.includes("^")?n.split("^"):n.split("|");e.length>=5&&t.ts-nn(e[1])<18e5&&(t.session=e[0],t.count=nn(e[2])+1,t.upgrade=nn(e[3]),t.upload=e.length>=6?"".concat("https://").concat(e[5],"/").concat(e[4]):"".concat("https://").concat(e[4]))}return t}(),p=en(),f=o.projectId||function(t,n){void 0===n&&(n=null);for(var e,r=5381,a=r,o=0;o<t.length;o+=2)r=(r<<5)+r^t.charCodeAt(o),o+1<t.length&&(a=(a<<5)+a^t.charCodeAt(o+1));return e=Math.abs(r+11579*a),(n?e%Math.pow(2,n):e).toString(36)}(location.host);Ut={projectId:f,userId:p.id,sessionId:l.session,pageNum:l.count},o.lean=o.track&&null!==l.upgrade?0===l.upgrade:o.lean,o.upload=o.track&&"string"==typeof o.upload&&l.upload&&l.upload.length>8?l.upload:o.upload,qt(0,r),qt(3,c),qt(1,d(location.href,!!Vt)),qt(2,document.referrer),qt(15,function(){var t=tn();if(o.track&&Qt(window,"sessionStorage")){var n=sessionStorage.getItem("_cltk");t=n||t,sessionStorage.setItem("_cltk",t)}return t}()),qt(16,document.documentElement.lang),qt(17,document.dir),qt(26,"".concat(window.devicePixelRatio)),qt(28,p.dob.toString()),qt(29,p.version.toString()),qt(33,u),qt(34,a),qt(35,i),j(0,l.ts),j(1,0),j(35,Vt),navigator&&(qt(9,navigator.language),j(33,navigator.hardwareConcurrency),j(32,navigator.maxTouchPoints),j(34,Math.round(navigator.deviceMemory)),(null==(s=navigator.userAgentData)?void 0:s.getHighEntropyValues)?s.getHighEntropyValues(["model","platform","platformVersion","uaFullVersion"]).then((function(t){if(qt(22,t.platform),qt(23,t.platformVersion),t.brands)for(var n=0,e=t.brands;n<e.length;n++){var r=e[n];qt(24,r.name+"~"+r.version)}qt(25,t.model),j(27,t.mobile?1:0)})):qt(22,navigator.platform)),screen&&(j(14,Math.round(screen.width)),j(15,Math.round(screen.height)),j(16,Math.round(screen.colorDepth)));for(var h=0,v=o.cookies;h<v.length;h++){var g=v[h],m=rn(g);m&&Y(g,m)}!function(t){Ht(t?1:0)}(o.track),$t(p)}function Yt(){Lt=null,Ut=null;for(var t=0,n=Xt;t<n.length;t++){n[t].called=!1}}function Wt(t,n,e){void 0===n&&(n=!0),void 0===e&&(e=!1);var r=o.lean?0:1,a=!1;Ut&&(r||!1===n)&&(t(Ut,!o.lean),a=!0),!e&&a||Xt.push({callback:t,wait:n,recall:e,called:a})}function Jt(){return Ut?[Ut.userId,Ut.sessionId,Ut.pageNum].join("."):""}function Zt(t){if(void 0===t&&(t=!0),!t)return o.track=!1,on("_clsk","",-Number.MAX_VALUE),on("_clck","",-Number.MAX_VALUE),oe(),void window.setTimeout(ae,250);qn()&&(o.track=!0,$t(en(),1),Kt(),Ht(2))}function Ft(){on("_clsk","",0)}function Gt(){!function(t){if(Xt.length>0)for(var n=0;n<Xt.length;n++){var e=Xt[n];!e.callback||e.called||e.wait&&!t||(e.callback(Ut,!o.lean),e.called=!0,e.recall||(Xt.splice(n,1),n--))}}(o.lean?0:1)}function Kt(){if(Ut&&o.track){var t=Math.round(Date.now()),n=o.upload&&"string"==typeof o.upload?o.upload.replace("https://",""):"",e=o.lean?0:1;on("_clsk",[Ut.sessionId,t,Ut.pageNum,e,n].join("|"),1)}}function Qt(t,n){try{return!!t[n]}catch(t){return!1}}function $t(t,n){void 0===n&&(n=null);var e=null===n?t.consent:n,r=Math.ceil((Date.now()+31536e6)/864e5),a=0===t.dob?null===o.dob?0:o.dob:t.dob;(null===t.expiry||Math.abs(r-t.expiry)>=1||t.consent!==e||t.dob!==a)&&on("_clck",[Ut.userId,2,r.toString(36),e,a].join("|"),365)}function tn(){var t,n=Math.floor(Math.random()*Math.pow(2,32));return(null===(t=null===window||void 0===window?void 0:window.crypto)||void 0===t?void 0:t.getRandomValues)&&Uint32Array&&(n=window.crypto.getRandomValues(new Uint32Array(1))[0]),n.toString(36)}function nn(t,n){return void 0===n&&(n=10),Number.parseInt(t,n)}function en(){var t={id:tn(),version:0,expiry:null,consent:0,dob:0},n=rn("_clck",!o.includeSubdomains);if(n&&n.length>0){var e=n.includes("^")?n.split("^"):n.split("|");e.length>1&&(t.version=nn(e[1])),e.length>2&&(t.expiry=nn(e[2],36)),e.length>3&&1===nn(e[3])&&(t.consent=1),e.length>4&&nn(e[1])>1&&(t.dob=nn(e[4])),o.track=o.track||1===t.consent,t.id=o.track?e[0]:t.id}return t}function rn(t,n){var e;if(void 0===n&&(n=!1),Qt(document,"cookie")){var r=document.cookie.split(";");if(r)for(var a=0;a<r.length;a++){var o=r[a].split("=");if(o.length>1&&o[0]&&o[0].trim()===t){for(var i=an(o[1]),u=i[0],c=i[1];u;)u=(e=an(c))[0],c=e[1];return n?c.endsWith("".concat("~","1"))?c.substring(0,c.length-2):null:c}}}return null}function an(t){try{var n=decodeURIComponent(t);return[n!==t,n]}catch(t){}return[!1,t]}function on(t,n,e){if((o.track||""===n)&&((null===navigator||void 0===navigator?void 0:navigator.cookieEnabled)||Qt(document,"cookie"))){var r=function(t){return encodeURIComponent(t)}(n),a=new Date;a.setDate(a.getDate()+e);var i=a?"expires="+a.toUTCString():"",u="".concat(t,"=").concat(r).concat(";").concat(i).concat(";path=/");try{if(null===Lt){for(var c=location.hostname?location.hostname.split("."):[],s=c.length-1;s>=0;s--)if(Lt=".".concat(c[s]).concat(Lt||""),s<c.length-1&&(document.cookie="".concat(u).concat(";").concat("domain=").concat(Lt),rn(t)===n))return;Lt=""}}catch(t){Lt=""}document.cookie=Lt?"".concat(u).concat(";").concat("domain=").concat(Lt):u}}var un,cn=null;function sn(){var t=Ut;cn={version:v,sequence:0,start:0,duration:0,projectId:t.projectId,userId:t.userId,sessionId:t.sessionId,pageNum:t.pageNum,upload:0,end:0,applicationPlatform:0,url:""}}function ln(){cn=null}function dn(t){return cn.start=cn.start+cn.duration,cn.duration=h()-cn.start,cn.sequence++,cn.upload=t&&"sendBeacon"in navigator?1:0,cn.end=t?1:0,cn.applicationPlatform=0,cn.url=d(location.href,!1,!0),[cn.version,cn.sequence,cn.start,cn.duration,cn.projectId,cn.userId,cn.sessionId,cn.pageNum,cn.upload,cn.end,cn.applicationPlatform,cn.url]}function pn(){un=[]}function fn(t){if(un&&-1===un.indexOf(t.message)){var n=o.report;if(n&&n.length>0){var e={v:cn.version,p:cn.projectId,u:cn.userId,s:cn.sessionId,n:cn.pageNum};t.message&&(e.m=t.message),t.stack&&(e.e=t.stack);var r=new XMLHttpRequest;r.open("POST",n,!0),r.send(JSON.stringify(e)),un.push(t.message)}}return t}function hn(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var r=performance.now();try{t.apply(this,n)}catch(t){throw fn(t)}var a=performance.now()-r;x(4,a),a>30&&(E(7),j(6,a),"".concat(t.dn||t.name,"-").concat(a))}}var vn=new Map;function gn(t,n,e,r,a){void 0===r&&(r=!1),void 0===a&&(a=!0),e=hn(e);try{t[i("addEventListener")](n,e,{capture:r,passive:a}),function(t){return vn.has(t)}(t)||vn.set(t,[]),vn.get(t).push({event:n,listener:e,options:{capture:r,passive:a}})}catch(t){}}function mn(){vn.forEach((function(t,n){!function(t,n){for(var e=0,r=t;e<r.length;e++){var a=r[e];try{n[i("removeEventListener")](a.event,a.listener,{capture:a.options.capture,passive:a.options.passive})}catch(t){}}vn.delete(n)}(t,n)})),vn=new Map}var yn=null,bn=null,wn=null,kn=0;function Sn(){return!(kn++>20)}function _n(){_n.dn=1,kn=0,wn!==Mn()&&(oe(),window.setTimeout(In,250))}function In(){ae(),j(29,1)}function Mn(){return location.href?location.href.replace(location.hash,""):location.href}var On=[],Tn=null,En=null,xn=null;function jn(){En&&(xn(),En=null,null===Tn&&zn())}function Nn(){On=[],Tn=null,En=null}function zn(){var t=On.shift();t&&(Tn=t,t.task().then((function(){t.id===Jt()&&(t.resolve(),Tn=null,zn())})).catch((function(n){t.id===Jt()&&(n&&(n.name,n.message,n.stack),Tn=null,zn())})))}var An=!1;function Cn(){An=!0,f=performance.now()+performance.timeOrigin,Nn(),mn(),pn(),wn=Mn(),kn=0,gn(window,"popstate",_n),null===yn&&(yn=history.pushState,history.pushState=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];yn.apply(this,t),qn()&&Sn()&&_n()}),null===bn&&(bn=history.replaceState,history.replaceState=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];bn.apply(this,t),qn()&&Sn()&&_n()})}function Pn(){wn=null,kn=0,pn(),mn(),Nn(),f=0,An=!1}function qn(){return An}function Dn(){Dn.dn=2,ae(),I("clarity","restart")}var Rn=null;function Hn(){Rn=null}function Un(t){Rn={fetchStart:Math.round(t.fetchStart),connectStart:Math.round(t.connectStart),connectEnd:Math.round(t.connectEnd),requestStart:Math.round(t.requestStart),responseStart:Math.round(t.responseStart),responseEnd:Math.round(t.responseEnd),domInteractive:Math.round(t.domInteractive),domComplete:Math.round(t.domComplete),loadEventStart:Math.round(t.loadEventStart),loadEventEnd:Math.round(t.loadEventEnd),redirectCount:Math.round(t.redirectCount),size:t.transferSize?t.transferSize:0,type:t.type,protocol:t.nextHopProtocol,encodedSize:t.encodedBodySize?t.encodedBodySize:0,decodedSize:t.decodedBodySize?t.decodedBodySize:0},function(t){V(this,void 0,void 0,(function(){var n,e;return L(this,(function(r){return n=h(),e=[n,t],29===t&&(e.push(Rn.fetchStart),e.push(Rn.connectStart),e.push(Rn.connectEnd),e.push(Rn.requestStart),e.push(Rn.responseStart),e.push(Rn.responseEnd),e.push(Rn.domInteractive),e.push(Rn.domComplete),e.push(Rn.loadEventStart),e.push(Rn.loadEventEnd),e.push(Rn.redirectCount),e.push(Rn.size),e.push(Rn.type),e.push(Rn.protocol),e.push(Rn.encodedSize),e.push(Rn.decodedSize),Hn(),bt(e)),[2]}))}))}(29)}var Xn,Vn=0,Ln=Number.POSITIVE_INFINITY,Bn=0,Yn=0,Wn=[],Jn=new Map,Zn=function(){return Vn||0},Fn=function(){if(!Wn.length)return-1;var t=Math.min(Wn.length-1,Math.floor((Zn()-Yn)/50));return Wn[t].latency},Gn=function(t){if(t.interactionId&&!(t.duration<40)){!function(t){"interactionCount"in performance?Vn=performance.interactionCount:t.interactionId&&(Ln=Math.min(Ln,t.interactionId),Bn=Math.max(Bn,t.interactionId),Vn=Bn?(Bn-Ln)/7+1:0)}(t);var n=Wn[Wn.length-1],e=Jn.get(t.interactionId);if(e||Wn.length<10||t.duration>(null==n?void 0:n.latency)){if(e)t.duration>e.latency&&(e.latency=t.duration);else{var r={id:t.interactionId,latency:t.duration};Jn.set(r.id,r),Wn.push(r)}if(Wn.sort((function(t,n){return n.latency-t.latency})),Wn.length>10)for(var a=0,o=Wn.splice(10);a<o.length;a++){var i=o[a];Jn.delete(i.id)}}}},Kn=["navigation","resource","longtask","first-input","layout-shift","largest-contentful-paint","event"];function Qn(){Qn.dn=26;try{Xn&&Xn.disconnect(),Xn=new PerformanceObserver(hn($n));for(var t=0,n=Kn;t<n.length;t++){var e=n[t];PerformanceObserver.supportedEntryTypes.indexOf(e)>=0&&("layout-shift"===e&&x(9,0),Xn.observe({type:e,buffered:!0}))}}catch(t){}}function $n(t){$n.dn=27,function(t){for(var n=(!("visibilityState"in document)||"visible"===document.visibilityState),e=0;e<t.length;e++){var r=t[e];switch(r.entryType){case"navigation":Un(r);break;case"resource":var a=r.name;qt(4,ne(a)),a!==o.upload&&a!==o.fallback||j(28,r.duration);break;case"longtask":E(7);break;case"first-input":n&&r.processingStart&&j(10,r.processingStart-r.startTime);break;case"event":n&&"PerformanceEventTiming"in window&&"interactionId"in PerformanceEventTiming.prototype&&(Gn(r),qt(37,Fn().toString()));break;case"layout-shift":n&&!r.hadRecentInput&&x(9,1e3*r.value);break;case"largest-contentful-paint":n&&j(8,r.startTime)}}}(t.getEntries())}function te(){Xn&&Xn.disconnect(),Xn=null,Yn=Zn(),Wn.length=0,Jn.clear()}function ne(t){var n=document.createElement("a");return n.href=t,n.host}var ee=Object.freeze({__proto__:null,start:function t(){t.dn=25,Hn(),function(){navigator&&"connection"in navigator&&qt(27,navigator.connection.effectiveType),window.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&("complete"!==document.readyState?gn(window,"load",N.bind(this,Qn,0)):Qn())}()},stop:function(){te(),Hn()}}),re=[S,S,S,ee];function ae(t){if(void 0===t&&(t=null),function(){try{var t=navigator&&"globalPrivacyControl"in navigator&&!0===navigator.globalPrivacyControl;return!1===An&&"undefined"!=typeof Promise&&window.MutationObserver&&document.createTreeWalker&&"now"in Date&&"now"in performance&&"undefined"!=typeof WeakMap&&!t}catch(t){return!1}}()){!function(t){if(null===t||An)return!1;for(var n in t)n in o&&(o[n]=t[n])}(t),Cn(),at();for(var n=0,e=re;n<e.length;n++){hn(e[n].start)()}null===t&&se()}}function oe(){if(qn()){for(var t=0,n=re.slice().reverse();t<n.length;t++){hn(n[t].stop)()}ot(),Pn(),void 0!==ue&&(ue[ce]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];ue[ce].q||(ue[ce].q=[]),ue[ce].q.push(t),"start"===t[0]&&ue[ce].q.unshift(ue[ce].q.pop())&&se()})}}var ie=Object.freeze({__proto__:null,consent:Zt,event:I,hashText:w,identify:W,metadata:Wt,pause:function(){qn()&&(I("clarity","pause"),null===En&&(En=new Promise((function(t){xn=t}))))},resume:function(){qn()&&(jn(),I("clarity","resume"))},set:Y,signal:function(t){nt=t},start:ae,stop:oe,upgrade:U,version:v}),ue=window,ce="clarity";function se(){var t;if(void 0!==ue){if(null===(t=ue[ce])||void 0===t?void 0:t.v)return console.warn("Error CL001: Multiple Clarity tags detected.");var n=ue[ce]&&ue[ce].q||[];for(ue[ce]=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return ie[t].apply(ie,n)},ue[ce].v=v;n.length>0;)ue[ce].apply(ue,n.shift())}}se()}();
1
+ !function(){"use strict";var t=Object.freeze({__proto__:null,get queue(){return bt},get start(){return yt},get stop(){return wt},get track(){return dt}}),n=Object.freeze({__proto__:null,get check(){return Tt},get compute(){return xt},get data(){return pt},get start(){return Ot},get stop(){return jt},get trigger(){return Et}}),e=Object.freeze({__proto__:null,get compute(){return Dt},get data(){return Nt},get log(){return qt},get reset(){return Rt},get start(){return Ct},get stop(){return Pt},get updates(){return zt}}),r=Object.freeze({__proto__:null,get callback(){return Gt},get callbacks(){return Xt},get clear(){return Ft},get consent(){return Zt},get data(){return Ut},get electron(){return Vt},get id(){return Jt},get metadata(){return Wt},get save(){return Kt},get shortid(){return tn},get start(){return Bt},get stop(){return Yt}}),a=Object.freeze({__proto__:null,get data(){return cn},get envelope(){return dn},get start(){return sn},get stop(){return ln}}),o={projectId:null,delay:1e3,lean:!1,lite:!1,track:!0,content:!0,drop:[],mask:[],unmask:[],regions:[],cookies:[],fraud:!0,checksum:[],report:null,upload:null,fallback:null,upgrade:null,action:null,dob:null,delayDom:!1,throttleDom:!0,conversions:!1,includeSubdomains:!0};function i(t){return window.Zone&&"__symbol__"in window.Zone?window.Zone.__symbol__(t):t}var u=255,c=!0,s=null,l=null;function d(t,n,e){void 0===n&&(n=!1),void 0===e&&(e=!1);var r=t;if(n)r="".concat("https://").concat("Electron");else{var a=o.drop;if(a&&a.length>0&&t&&t.indexOf("?")>0){var i=t.split("?"),c=i[0],s=i[1];r="".concat(c,"?").concat(s.split("&").map((function(t){return a.some((function(n){return 0===t.indexOf("".concat(n,"="))}))?"".concat(t.split("=")[0],"=").concat("*na*"):t})).join("&"))}}return e&&(r=r.substring(0,u)),r}function p(t,n,e){return function(){if(c&&null===s)try{s=/\p{N}/gu,l=/\p{L}/gu}catch(t){c=!1}}(),t?t.replace(l,n).replace(s,e):t}var f=0;function h(t){void 0===t&&(t=null);var n=t&&t.timeStamp>0?t.timeStamp:performance.now(),e=t&&t.view?t.view.performance.timeOrigin:performance.timeOrigin;return Math.max(Math.round(n+e-f),0)}var v="0.8.11";var g=[],m=null;function y(){}var b=[];function w(){}function k(){}var S=Object.freeze({__proto__:null,checkDocumentStyles:function(t){},compute:function(){},data:m,hashText:w,keys:b,log:y,observe:function(){},reset:function(){},sheetAdoptionState:[],sheetUpdateState:[],start:function(){},state:g,stop:function(){},trigger:k}),_=null;function I(t,n){qn()&&t&&"string"==typeof t&&t.length<255&&(_=n&&"string"==typeof n&&n.length<255?{key:t,value:n}:{value:t},Mt(24))}var M,O=null,T=null;function E(t){t in O||(O[t]=0),t in T||(T[t]=0),O[t]++,T[t]++}function x(t,n){null!==n&&(t in O||(O[t]=0),t in T||(T[t]=0),O[t]+=n,T[t]+=n)}function j(t,n){null!==n&&!1===Number.isNaN(n)&&(t in O||(O[t]=0),(n>O[t]||0===O[t])&&(T[t]=n,O[t]=n))}function N(t,n,e){return window.setTimeout(hn(t),n,e)}function z(t){window.clearTimeout(t)}var A=0,C=0,P=null;function q(){P&&z(P),P=N(D,C),A=h()}function D(){var t=h();M={gap:t-A},Mt(25),M.gap<3e5?P=N(D,C):function(){if(An){I("clarity","suspend"),oe();for(var t=0,n=["mousemove","touchstart"];t<n.length;t++){var e=n[t];gn(document,e,Dn)}for(var r=0,a=["resize","scroll","pageshow"];r<a.length;r++){e=a[r];gn(window,e,Dn)}}}()}var R=Object.freeze({__proto__:null,get data(){return M},reset:q,start:function(){C=6e4,A=0},stop:function(){z(P),A=0,C=0}}),H=null;function U(t){qn()&&o.lean&&(o.lean=!1,H={key:t},Gt(),Kt(),o.upgrade&&o.upgrade(t),Mt(3),o.lite)}var X=Object.freeze({__proto__:null,get data(){return H},start:function(){!o.lean&&o.upgrade&&o.upgrade("Config"),H=null},stop:function(){H=null},upgrade:U});function V(t,n,e,r){return new(e||(e=Promise))((function(a,o){function i(t){try{c(r.next(t))}catch(t){o(t)}}function u(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var n;t.done?a(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(i,u)}c((r=r.apply(t,n||[])).next())}))}function L(t,n){var e,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(c){return function(u){if(e)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(i=0)),i;)try{if(e=1,r&&(a=2&u[0]?r.return:u[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,u[1])).done)return a;switch(r=0,a&&(u=[2&u[0],a.value]),u[0]){case 0:case 1:a=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!a||u[1]>a[0]&&u[1]<a[3])){i.label=u[1];break}if(6===u[0]&&i.label<a[1]){i.label=a[1],a=u;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(u);break}a[2]&&i.ops.pop(),i.trys.pop();continue}u=n.call(t,i)}catch(t){u=[6,t],r=0}finally{e=a=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}var B=null;function Y(t,n){J(t,"string"==typeof n?[n]:n)}function W(t,n,e,r){return void 0===n&&(n=null),void 0===e&&(e=null),void 0===r&&(r=null),V(this,void 0,void 0,(function(){var a,o;return L(this,(function(i){switch(i.label){case 0:return o={},[4,G(t)];case 1:return o.userId=i.sent(),o.userHint=r||((u=t)&&u.length>=5?"".concat(u.substring(0,2)).concat(p(u.substring(2),"*","*")):p(u,"*","*")),J("userId",[(a=o).userId]),J("userHint",[a.userHint]),J("userType",[K(t)]),n&&(J("sessionId",[n]),a.sessionId=n),e&&(J("pageId",[e]),a.pageId=e),[2,a]}var u}))}))}function J(t,n){if(qn()&&t&&n&&"string"==typeof t&&t.length<255){for(var e=(t in B?B[t]:[]),r=0;r<n.length;r++)"string"==typeof n[r]&&n[r].length<255&&e.push(n[r]);B[t]=e}}function Z(){Mt(34)}function F(){B={}}function G(t){return V(this,void 0,void 0,(function(){var n;return L(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),crypto&&t?[4,crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t))]:[3,2];case 1:return n=e.sent(),[2,Array.prototype.map.call(new Uint8Array(n),(function(t){return"00".concat(t.toString(16)).slice(-2)})).join("")];case 2:return[2,""];case 3:return e.sent(),[2,""];case 4:return[2]}}))}))}function K(t){return t&&t.indexOf("@")>0?"email":"string"}var Q="CompressionStream"in window;function $(t){return V(this,void 0,void 0,(function(){var n,e;return L(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),Q?(n=new ReadableStream({start:function(n){return V(this,void 0,void 0,(function(){return L(this,(function(e){return n.enqueue(t),n.close(),[2]}))}))}}).pipeThrough(new TextEncoderStream).pipeThrough(new window.CompressionStream("gzip")),e=Uint8Array.bind,[4,tt(n)]):[3,2];case 1:return[2,new(e.apply(Uint8Array,[void 0,r.sent()]))];case 2:return[3,4];case 3:return r.sent(),[3,4];case 4:return[2,null]}}))}))}function tt(t){return V(this,void 0,void 0,(function(){var n,e,r,a,o;return L(this,(function(i){switch(i.label){case 0:n=t.getReader(),e=[],r=!1,a=[],i.label=1;case 1:return r?[3,3]:[4,n.read()];case 2:return o=i.sent(),r=o.done,a=o.value,r?[2,e]:(e.push.apply(e,a),[3,1]);case 3:return[2,e]}}))}))}var nt=null;function et(t){try{if(!nt)return;for(var n=function(t){try{return JSON.parse(t)}catch(t){return[]}}(t),e=0,r=n;e<r.length;e++){var a=r[e];nt(a)}}catch(t){}}var rt=[S,e,Object.freeze({__proto__:null,compute:Z,get data(){return B},identify:W,reset:F,set:Y,start:function(){F()},stop:function(){F()}}),n,S,r,a,t,R,X,S];function at(){O={},T={},E(5);for(var t=0,n=rt;t<n.length;t++){hn(n[t].start)()}}function ot(){for(var t=0,n=rt.slice().reverse();t<n.length;t++){hn(n[t].stop)()}O={},T={}}function it(){Z(),Dt(),Mt(0),xt()}var ut,ct,st,lt,dt,pt,ft=0,ht=0,vt=null,gt=0,mt=!1;function yt(){lt=!0,ft=0,ht=0,mt=!1,gt=0,ut=[],ct=[],st={},dt=null}function bt(t,n){if(void 0===n&&(n=!0),lt){var e=h(),r=t.length>1?t[1]:null,a=JSON.stringify(t);switch(o.lean?!mt&&ht+a.length>10485760&&(mt=!0):mt=!1,r){case 5:if(mt)break;ft+=a.length;case 37:case 6:case 43:case 45:case 46:if(mt)break;ht+=a.length,ut.push(a);break;default:ct.push(a)}E(25);var i=function(){var t=!1===o.lean&&ft>0?100:cn.sequence*o.delay;return"string"==typeof o.upload?Math.max(Math.min(t,3e4),100):o.delay}();e-gt>2*i&&(z(vt),vt=null),n&&null===vt&&(25!==r&&q(),vt=N(kt,i),gt=e,Tt(ht))}}function wt(){z(vt),kt(!0),ft=0,ht=0,mt=!1,gt=0,ut=[],ct=[],st={},dt=null,lt=!1}function kt(t){return void 0===t&&(t=!1),V(this,void 0,void 0,(function(){var n,e,r,a,i,u,c,s;return L(this,(function(l){switch(l.label){case 0:return vt=null,(n=!1===o.lean&&ht>0&&(ht<1048576||cn.sequence>0))&&j(1,1),it(),e=!0===t,r=JSON.stringify(dn(e)),a="[".concat(ct.join(),"]"),i=n?"[".concat(ut.join(),"]"):"",u=function(t){return t.p.length>0?'{"e":'.concat(t.e,',"a":').concat(t.a,',"p":').concat(t.p,"}"):'{"e":'.concat(t.e,',"a":').concat(t.a,"}")}({e:r,a:a,p:i}),e?(s=null,[3,3]):[3,1];case 1:return[4,$(u)];case 2:s=l.sent(),l.label=3;case 3:return x(2,(c=s)?c.length:u.length),St(u,c,cn.sequence,e),ct=[],n&&(ut=[],ht=0,ft=0,mt=!1),[2]}}))}))}function St(t,n,e,r){if(void 0===r&&(r=!1),"string"==typeof o.upload){var a=o.upload,i=!1;if(r&&"sendBeacon"in navigator)try{(i=navigator.sendBeacon.bind(navigator)(a,t))&&It(e)}catch(t){}if(!1===i){e in st?st[e].attempts++:st[e]={data:t,attempts:1};var u=new XMLHttpRequest;u.open("POST",a,!0),u.timeout=15e3,u.ontimeout=function(){fn(new Error("".concat("Timeout"," : ").concat(a)))},null!==e&&(u.onreadystatechange=function(){hn(_t)(u,e)}),u.withCredentials=!0,n?(u.setRequestHeader("Accept","application/x-clarity-gzip"),u.send(n)):u.send(t)}}else if(o.upload){(0,o.upload)(t),It(e)}}function _t(t,n){var e=st[n];t&&4===t.readyState&&e&&((t.status<200||t.status>208)&&e.attempts<=1?t.status>=400&&t.status<500?Et(6):(0===t.status&&(o.upload=o.fallback?o.fallback:o.upload),St(e.data,null,n)):(dt={sequence:n,attempts:e.attempts,status:t.status},e.attempts>1&&Mt(2),200===t.status&&t.responseText&&function(t){for(var n=t&&t.length>0?t.split("\n"):[],e=0,r=n;e<r.length;e++){var a=r[e],i=a&&a.length>0?a.split(/ (.*)/):[""];switch(i[0]){case"END":Et(6);break;case"UPGRADE":U("Auto");break;case"ACTION":o.action&&i.length>1&&o.action(i[1]);break;case"EXTRACT":i.length>1&&i[1];break;case"SIGNAL":i.length>1&&et(i[1])}}}(t.responseText),0===t.status&&(St(e.data,null,n,!0),Et(3)),t.status>=200&&t.status<=208&&It(n),delete st[n]))}function It(t){1===t&&(Kt(),Gt())}function Mt(t){var n=[h(),t];switch(t){case 4:var e=g;e&&((n=[e.time,e.event]).push(e.data.visible),n.push(e.data.docWidth),n.push(e.data.docHeight),n.push(e.data.screenWidth),n.push(e.data.screenHeight),n.push(e.data.scrollX),n.push(e.data.scrollY),n.push(e.data.pointerX),n.push(e.data.pointerY),n.push(e.data.activityTime),n.push(e.data.scrollTime),n.push(e.data.pointerTime),n.push(e.data.moveX),n.push(e.data.moveY),n.push(e.data.moveTime),n.push(e.data.downX),n.push(e.data.downY),n.push(e.data.downTime),n.push(e.data.upX),n.push(e.data.upY),n.push(e.data.upTime),n.push(e.data.pointerPrevX),n.push(e.data.pointerPrevY),n.push(e.data.pointerPrevTime),bt(n,!1));break;case 25:n.push(M.gap),bt(n);break;case 35:n.push(pt.check),bt(n,!1);break;case 3:n.push(H.key),bt(n);break;case 2:n.push(dt.sequence),n.push(dt.attempts),n.push(dt.status),bt(n,!1);break;case 24:_.key&&n.push(_.key),n.push(_.value),bt(n);break;case 34:var r=Object.keys(B);if(r.length>0){for(var a=0,o=r;a<o.length;a++){var i=o[a];n.push(i),n.push(B[i])}F(),bt(n,!1)}break;case 0:var u=Object.keys(T);if(u.length>0){for(var c=0,s=u;c<s.length;c++){var l=s[c],d=Number.parseInt(l,10);n.push(d),n.push(Math.round(T[l]))}T={},bt(n,!1)}break;case 1:var p=Object.keys(zt);if(p.length>0){for(var f=0,v=p;f<v.length;f++){var y=v[f];d=Number.parseInt(y,10);n.push(d),n.push(zt[y])}Rt(),bt(n,!1)}break;case 36:var w=Object.keys(m);if(w.length>0){for(var k=0,S=w;k<S.length;k++){var I=S[k];d=Number.parseInt(I,10);n.push(d),n.push([].concat.apply([],m[I]))}bt(n,!1)}break;case 40:for(var O=b,E=0,x=Array.from(O);E<x.length;E++){I=x[E];n.push(I);var j=[];for(var y in m[I]){d=Number.parseInt(y,10);j.push(d),j.push(m[I][y])}n.push(j)}bt(n,!1)}}function Ot(){pt={check:0}}function Tt(t){if(0===pt.check){var n=pt.check;n=cn.sequence>=128?1:n,n=cn.pageNum>=128?7:n,n=h()>72e5?2:n,(n=t>10485760?2:n)!==pt.check&&Et(n)}}function Et(t){pt.check=t,5!==t&&(Ft(),oe())}function xt(){0!==pt.check&&Mt(35)}function jt(){pt=null}var Nt=null,zt=null,At=!1;function Ct(){Nt={},zt={},At=!1}function Pt(){Nt={},zt={},At=!1}function qt(t,n){if(n){var e="".concat(n);if(t in Nt||(Nt[t]=[]),Nt[t].indexOf(e)<0){if(Nt[t].length>128)return void(At||(At=!0,Et(5)));Nt[t].push(e),t in zt||(zt[t]=[]),zt[t].push(e)}}}function Dt(){Mt(1)}function Rt(){zt={},At=!1}function Ht(t){qt(36,t.toString())}var Ut=null,Xt=[],Vt=0,Lt=null;function Bt(){var t,n,e;Lt=null;var r=navigator&&"userAgent"in navigator?navigator.userAgent:"",a=null!==(e=null===(n=null===(t=null===Intl||void 0===Intl?void 0:Intl.DateTimeFormat())||void 0===t?void 0:t.resolvedOptions())||void 0===n?void 0:n.timeZone)&&void 0!==e?e:"",i=(new Date).getTimezoneOffset().toString(),u=window.location.ancestorOrigins?Array.from(window.location.ancestorOrigins).toString():"",c=(null===document||void 0===document?void 0:document.title)?document.title:"";Vt=r.indexOf("Electron")>0?1:0;var s,l=function(){var t={session:tn(),ts:Math.round(Date.now()),count:1,upgrade:null,upload:""},n=rn("_clsk",!o.includeSubdomains);if(n){var e=n.includes("^")?n.split("^"):n.split("|");e.length>=5&&t.ts-nn(e[1])<18e5&&(t.session=e[0],t.count=nn(e[2])+1,t.upgrade=nn(e[3]),t.upload=e.length>=6?"".concat("https://").concat(e[5],"/").concat(e[4]):"".concat("https://").concat(e[4]))}return t}(),p=en(),f=o.projectId||function(t,n){void 0===n&&(n=null);for(var e,r=5381,a=r,o=0;o<t.length;o+=2)r=(r<<5)+r^t.charCodeAt(o),o+1<t.length&&(a=(a<<5)+a^t.charCodeAt(o+1));return e=Math.abs(r+11579*a),(n?e%Math.pow(2,n):e).toString(36)}(location.host);Ut={projectId:f,userId:p.id,sessionId:l.session,pageNum:l.count},o.lean=o.track&&null!==l.upgrade?0===l.upgrade:o.lean,o.upload=o.track&&"string"==typeof o.upload&&l.upload&&l.upload.length>8?l.upload:o.upload,qt(0,r),qt(3,c),qt(1,d(location.href,!!Vt)),qt(2,document.referrer),qt(15,function(){var t=tn();if(o.track&&Qt(window,"sessionStorage")){var n=sessionStorage.getItem("_cltk");t=n||t,sessionStorage.setItem("_cltk",t)}return t}()),qt(16,document.documentElement.lang),qt(17,document.dir),qt(26,"".concat(window.devicePixelRatio)),qt(28,p.dob.toString()),qt(29,p.version.toString()),qt(33,u),qt(34,a),qt(35,i),j(0,l.ts),j(1,0),j(35,Vt),navigator&&(qt(9,navigator.language),j(33,navigator.hardwareConcurrency),j(32,navigator.maxTouchPoints),j(34,Math.round(navigator.deviceMemory)),(null==(s=navigator.userAgentData)?void 0:s.getHighEntropyValues)?s.getHighEntropyValues(["model","platform","platformVersion","uaFullVersion"]).then((function(t){if(qt(22,t.platform),qt(23,t.platformVersion),t.brands)for(var n=0,e=t.brands;n<e.length;n++){var r=e[n];qt(24,r.name+"~"+r.version)}qt(25,t.model),j(27,t.mobile?1:0)})):qt(22,navigator.platform)),screen&&(j(14,Math.round(screen.width)),j(15,Math.round(screen.height)),j(16,Math.round(screen.colorDepth)));for(var h=0,v=o.cookies;h<v.length;h++){var g=v[h],m=rn(g);m&&Y(g,m)}!function(t){Ht(t?1:0)}(o.track),$t(p)}function Yt(){Lt=null,Ut=null;for(var t=0,n=Xt;t<n.length;t++){n[t].called=!1}}function Wt(t,n,e){void 0===n&&(n=!0),void 0===e&&(e=!1);var r=o.lean?0:1,a=!1;Ut&&(r||!1===n)&&(t(Ut,!o.lean),a=!0),!e&&a||Xt.push({callback:t,wait:n,recall:e,called:a})}function Jt(){return Ut?[Ut.userId,Ut.sessionId,Ut.pageNum].join("."):""}function Zt(t){if(void 0===t&&(t=!0),!t)return o.track=!1,on("_clsk","",-Number.MAX_VALUE),on("_clck","",-Number.MAX_VALUE),oe(),void window.setTimeout(ae,250);qn()&&(o.track=!0,$t(en(),1),Kt(),Ht(2))}function Ft(){on("_clsk","",0)}function Gt(){!function(t){if(Xt.length>0)for(var n=0;n<Xt.length;n++){var e=Xt[n];!e.callback||e.called||e.wait&&!t||(e.callback(Ut,!o.lean),e.called=!0,e.recall||(Xt.splice(n,1),n--))}}(o.lean?0:1)}function Kt(){if(Ut&&o.track){var t=Math.round(Date.now()),n=o.upload&&"string"==typeof o.upload?o.upload.replace("https://",""):"",e=o.lean?0:1;on("_clsk",[Ut.sessionId,t,Ut.pageNum,e,n].join("|"),1)}}function Qt(t,n){try{return!!t[n]}catch(t){return!1}}function $t(t,n){void 0===n&&(n=null);var e=null===n?t.consent:n,r=Math.ceil((Date.now()+31536e6)/864e5),a=0===t.dob?null===o.dob?0:o.dob:t.dob;(null===t.expiry||Math.abs(r-t.expiry)>=1||t.consent!==e||t.dob!==a)&&on("_clck",[Ut.userId,2,r.toString(36),e,a].join("|"),365)}function tn(){var t,n=Math.floor(Math.random()*Math.pow(2,32));return(null===(t=null===window||void 0===window?void 0:window.crypto)||void 0===t?void 0:t.getRandomValues)&&Uint32Array&&(n=window.crypto.getRandomValues(new Uint32Array(1))[0]),n.toString(36)}function nn(t,n){return void 0===n&&(n=10),Number.parseInt(t,n)}function en(){var t={id:tn(),version:0,expiry:null,consent:0,dob:0},n=rn("_clck",!o.includeSubdomains);if(n&&n.length>0){var e=n.includes("^")?n.split("^"):n.split("|");e.length>1&&(t.version=nn(e[1])),e.length>2&&(t.expiry=nn(e[2],36)),e.length>3&&1===nn(e[3])&&(t.consent=1),e.length>4&&nn(e[1])>1&&(t.dob=nn(e[4])),o.track=o.track||1===t.consent,t.id=o.track?e[0]:t.id}return t}function rn(t,n){var e;if(void 0===n&&(n=!1),Qt(document,"cookie")){var r=document.cookie.split(";");if(r)for(var a=0;a<r.length;a++){var o=r[a].split("=");if(o.length>1&&o[0]&&o[0].trim()===t){for(var i=an(o[1]),u=i[0],c=i[1];u;)u=(e=an(c))[0],c=e[1];return n?c.endsWith("".concat("~","1"))?c.substring(0,c.length-2):null:c}}}return null}function an(t){try{var n=decodeURIComponent(t);return[n!==t,n]}catch(t){}return[!1,t]}function on(t,n,e){if((o.track||""===n)&&((null===navigator||void 0===navigator?void 0:navigator.cookieEnabled)||Qt(document,"cookie"))){var r=function(t){return encodeURIComponent(t)}(n),a=new Date;a.setDate(a.getDate()+e);var i=a?"expires="+a.toUTCString():"",u="".concat(t,"=").concat(r).concat(";").concat(i).concat(";path=/");try{if(null===Lt){for(var c=location.hostname?location.hostname.split("."):[],s=c.length-1;s>=0;s--)if(Lt=".".concat(c[s]).concat(Lt||""),s<c.length-1&&(document.cookie="".concat(u).concat(";").concat("domain=").concat(Lt),rn(t)===n))return;Lt=""}}catch(t){Lt=""}document.cookie=Lt?"".concat(u).concat(";").concat("domain=").concat(Lt):u}}var un,cn=null;function sn(){var t=Ut;cn={version:v,sequence:0,start:0,duration:0,projectId:t.projectId,userId:t.userId,sessionId:t.sessionId,pageNum:t.pageNum,upload:0,end:0,applicationPlatform:0,url:""}}function ln(){cn=null}function dn(t){return cn.start=cn.start+cn.duration,cn.duration=h()-cn.start,cn.sequence++,cn.upload=t&&"sendBeacon"in navigator?1:0,cn.end=t?1:0,cn.applicationPlatform=0,cn.url=d(location.href,!1,!0),[cn.version,cn.sequence,cn.start,cn.duration,cn.projectId,cn.userId,cn.sessionId,cn.pageNum,cn.upload,cn.end,cn.applicationPlatform,cn.url]}function pn(){un=[]}function fn(t){if(un&&-1===un.indexOf(t.message)){var n=o.report;if(n&&n.length>0){var e={v:cn.version,p:cn.projectId,u:cn.userId,s:cn.sessionId,n:cn.pageNum};t.message&&(e.m=t.message),t.stack&&(e.e=t.stack);var r=new XMLHttpRequest;r.open("POST",n,!0),r.send(JSON.stringify(e)),un.push(t.message)}}return t}function hn(t){return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var r=performance.now();try{t.apply(this,n)}catch(t){throw fn(t)}var a=performance.now()-r;x(4,a),a>30&&(E(7),j(6,a),"".concat(t.dn||t.name,"-").concat(a))}}var vn=new Map;function gn(t,n,e,r,a){void 0===r&&(r=!1),void 0===a&&(a=!0),e=hn(e);try{t[i("addEventListener")](n,e,{capture:r,passive:a}),function(t){return vn.has(t)}(t)||vn.set(t,[]),vn.get(t).push({event:n,listener:e,options:{capture:r,passive:a}})}catch(t){}}function mn(){vn.forEach((function(t,n){!function(t,n){for(var e=0,r=t;e<r.length;e++){var a=r[e];try{n[i("removeEventListener")](a.event,a.listener,{capture:a.options.capture,passive:a.options.passive})}catch(t){}}vn.delete(n)}(t,n)})),vn=new Map}var yn=null,bn=null,wn=null,kn=0;function Sn(){return!(kn++>20)}function _n(){_n.dn=1,kn=0,wn!==Mn()&&(oe(),window.setTimeout(In,250))}function In(){ae(),j(29,1)}function Mn(){return location.href?location.href.replace(location.hash,""):location.href}var On=[],Tn=null,En=null,xn=null;function jn(){En&&(xn(),En=null,null===Tn&&zn())}function Nn(){On=[],Tn=null,En=null}function zn(){var t=On.shift();t&&(Tn=t,t.task().then((function(){t.id===Jt()&&(t.resolve(),Tn=null,zn())})).catch((function(n){t.id===Jt()&&(n&&(n.name,n.message,n.stack),Tn=null,zn())})))}var An=!1;function Cn(){An=!0,f=performance.now()+performance.timeOrigin,Nn(),mn(),pn(),wn=Mn(),kn=0,gn(window,"popstate",_n),null===yn&&(yn=history.pushState,history.pushState=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];yn.apply(this,t),qn()&&Sn()&&_n()}),null===bn&&(bn=history.replaceState,history.replaceState=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];bn.apply(this,t),qn()&&Sn()&&_n()})}function Pn(){wn=null,kn=0,pn(),mn(),Nn(),f=0,An=!1}function qn(){return An}function Dn(){Dn.dn=2,ae(),I("clarity","restart")}var Rn=null;function Hn(){Rn=null}function Un(t){Rn={fetchStart:Math.round(t.fetchStart),connectStart:Math.round(t.connectStart),connectEnd:Math.round(t.connectEnd),requestStart:Math.round(t.requestStart),responseStart:Math.round(t.responseStart),responseEnd:Math.round(t.responseEnd),domInteractive:Math.round(t.domInteractive),domComplete:Math.round(t.domComplete),loadEventStart:Math.round(t.loadEventStart),loadEventEnd:Math.round(t.loadEventEnd),redirectCount:Math.round(t.redirectCount),size:t.transferSize?t.transferSize:0,type:t.type,protocol:t.nextHopProtocol,encodedSize:t.encodedBodySize?t.encodedBodySize:0,decodedSize:t.decodedBodySize?t.decodedBodySize:0},function(t){V(this,void 0,void 0,(function(){var n,e;return L(this,(function(r){return n=h(),e=[n,t],29===t&&(e.push(Rn.fetchStart),e.push(Rn.connectStart),e.push(Rn.connectEnd),e.push(Rn.requestStart),e.push(Rn.responseStart),e.push(Rn.responseEnd),e.push(Rn.domInteractive),e.push(Rn.domComplete),e.push(Rn.loadEventStart),e.push(Rn.loadEventEnd),e.push(Rn.redirectCount),e.push(Rn.size),e.push(Rn.type),e.push(Rn.protocol),e.push(Rn.encodedSize),e.push(Rn.decodedSize),Hn(),bt(e)),[2]}))}))}(29)}var Xn,Vn=0,Ln=Number.POSITIVE_INFINITY,Bn=0,Yn=0,Wn=[],Jn=new Map,Zn=function(){return Vn||0},Fn=function(){if(!Wn.length)return-1;var t=Math.min(Wn.length-1,Math.floor((Zn()-Yn)/50));return Wn[t].latency},Gn=function(t){if(t.interactionId&&!(t.duration<40)){!function(t){"interactionCount"in performance?Vn=performance.interactionCount:t.interactionId&&(Ln=Math.min(Ln,t.interactionId),Bn=Math.max(Bn,t.interactionId),Vn=Bn?(Bn-Ln)/7+1:0)}(t);var n=Wn[Wn.length-1],e=Jn.get(t.interactionId);if(e||Wn.length<10||t.duration>(null==n?void 0:n.latency)){if(e)t.duration>e.latency&&(e.latency=t.duration);else{var r={id:t.interactionId,latency:t.duration};Jn.set(r.id,r),Wn.push(r)}if(Wn.sort((function(t,n){return n.latency-t.latency})),Wn.length>10)for(var a=0,o=Wn.splice(10);a<o.length;a++){var i=o[a];Jn.delete(i.id)}}}},Kn=["navigation","resource","longtask","first-input","layout-shift","largest-contentful-paint","event"];function Qn(){Qn.dn=26;try{Xn&&Xn.disconnect(),Xn=new PerformanceObserver(hn($n));for(var t=0,n=Kn;t<n.length;t++){var e=n[t];PerformanceObserver.supportedEntryTypes.indexOf(e)>=0&&("layout-shift"===e&&x(9,0),Xn.observe({type:e,buffered:!0}))}}catch(t){}}function $n(t){$n.dn=27,function(t){for(var n=(!("visibilityState"in document)||"visible"===document.visibilityState),e=0;e<t.length;e++){var r=t[e];switch(r.entryType){case"navigation":Un(r);break;case"resource":var a=r.name;qt(4,ne(a)),a!==o.upload&&a!==o.fallback||j(28,r.duration);break;case"longtask":E(7);break;case"first-input":n&&r.processingStart&&j(10,r.processingStart-r.startTime);break;case"event":n&&"PerformanceEventTiming"in window&&"interactionId"in PerformanceEventTiming.prototype&&(Gn(r),qt(37,Fn().toString()));break;case"layout-shift":n&&!r.hadRecentInput&&x(9,1e3*r.value);break;case"largest-contentful-paint":n&&j(8,r.startTime)}}}(t.getEntries())}function te(){Xn&&Xn.disconnect(),Xn=null,Yn=Zn(),Wn.length=0,Jn.clear()}function ne(t){var n=document.createElement("a");return n.href=t,n.host}var ee=Object.freeze({__proto__:null,start:function t(){t.dn=25,Hn(),function(){navigator&&"connection"in navigator&&qt(27,navigator.connection.effectiveType),window.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&("complete"!==document.readyState?gn(window,"load",N.bind(this,Qn,0)):Qn())}()},stop:function(){te(),Hn()}}),re=[S,S,S,ee];function ae(t){if(void 0===t&&(t=null),function(){try{var t=navigator&&"globalPrivacyControl"in navigator&&!0===navigator.globalPrivacyControl;return!1===An&&"undefined"!=typeof Promise&&window.MutationObserver&&document.createTreeWalker&&"now"in Date&&"now"in performance&&"undefined"!=typeof WeakMap&&!t}catch(t){return!1}}()){!function(t){if(null===t||An)return!1;for(var n in t)n in o&&(o[n]=t[n])}(t),Cn(),at();for(var n=0,e=re;n<e.length;n++){hn(e[n].start)()}null===t&&se()}}function oe(){if(qn()){for(var t=0,n=re.slice().reverse();t<n.length;t++){hn(n[t].stop)()}ot(),Pn(),void 0!==ue&&(ue[ce]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];ue[ce].q||(ue[ce].q=[]),ue[ce].q.push(t),"start"===t[0]&&ue[ce].q.unshift(ue[ce].q.pop())&&se()})}}var ie=Object.freeze({__proto__:null,consent:Zt,event:I,hashText:w,identify:W,metadata:Wt,pause:function(){qn()&&(I("clarity","pause"),null===En&&(En=new Promise((function(t){xn=t}))))},resume:function(){qn()&&(jn(),I("clarity","resume"))},set:Y,signal:function(t){nt=t},start:ae,stop:oe,upgrade:U,version:v}),ue=window,ce="clarity";function se(){var t;if(void 0!==ue){if(null===(t=ue[ce])||void 0===t?void 0:t.v)return console.warn("Error CL001: Multiple Clarity tags detected.");var n=ue[ce]&&ue[ce].q||[];for(ue[ce]=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return ie[t].apply(ie,n)},ue[ce].v=v;n.length>0;)ue[ce].apply(ue,n.shift())}}se()}();
package/package.json CHANGED
@@ -1,77 +1,77 @@
1
- {
2
- "name": "clarity-js",
3
- "version": "0.8.10",
4
- "description": "An analytics library that uses web page interactions to generate aggregated insights",
5
- "author": "Microsoft Corp.",
6
- "license": "MIT",
7
- "main": "build/clarity.js",
8
- "module": "build/clarity.module.js",
9
- "unpkg": "build/clarity.min.js",
10
- "extended": "build/clarity.extended.js",
11
- "insight": "build/clarity.insight.js",
12
- "performance": "build/clarity.performance.js",
13
- "types": "types/index.d.ts",
14
- "keywords": [
15
- "clarity",
16
- "Microsoft",
17
- "interactions",
18
- "cursor",
19
- "pointer",
20
- "instrumentation",
21
- "analytics"
22
- ],
23
- "repository": {
24
- "type": "git",
25
- "url": "https://github.com/microsoft/clarity.git",
26
- "directory": "packages/clarity-js"
27
- },
28
- "bugs": {
29
- "url": "https://github.com/microsoft/clarity/issues"
30
- },
31
- "devDependencies": {
32
- "@biomejs/biome": "1.9.4",
33
- "@rollup/plugin-alias": "^5.1.1",
34
- "@rollup/plugin-commonjs": "^28.0.3",
35
- "@rollup/plugin-node-resolve": "^16.0.1",
36
- "@rollup/plugin-terser": "^0.4.4",
37
- "@rollup/plugin-typescript": "^12.1.2",
38
- "@types/chai": "^4.2.21",
39
- "@types/mocha": "^10.0.0",
40
- "@types/resize-observer-browser": "^0.1.6",
41
- "chai": "^4.2.0",
42
- "del-cli": "^5.0.0",
43
- "husky": "^8.0.0",
44
- "lint-staged": "^15.2.9",
45
- "mocha": "^10.2.0",
46
- "playwright": "^1.6.2",
47
- "rollup": "^3.0.0",
48
- "ts-mocha": "^10.0.0",
49
- "tslib": "^2.3.0",
50
- "typescript": "^4.3.5"
51
- },
52
- "scripts": {
53
- "build": "yarn build:clean && yarn build:main",
54
- "build:main": "rollup -c rollup.config.ts --configPlugin @rollup/plugin-typescript",
55
- "build:clean": "del-cli build/*",
56
- "test": "ts-mocha -p test/tsconfig.test.json test/stub.test.ts",
57
- "lint": "biome check --staged",
58
- "lint:fix": "biome check --write --staged",
59
- "lint:fix:unsafe": "biome check --write --unsafe --staged",
60
- "lint:all": "biome check",
61
- "lint:all:fix": "biome check --write",
62
- "lint:changed": "biome check --changed",
63
- "lint:changed:fix": "biome check --changed --write",
64
- "lint:changed:fix:unsafe": "biome check --changed --write --unsafe",
65
- "precommit": "lint-staged"
66
- },
67
- "husky": {
68
- "hooks": {
69
- "pre-commit": "lint-staged"
70
- }
71
- },
72
- "lint-staged": {
73
- "*.ts": [
74
- "tslint --format codeFrame"
75
- ]
76
- }
1
+ {
2
+ "name": "clarity-js",
3
+ "version": "0.8.11",
4
+ "description": "An analytics library that uses web page interactions to generate aggregated insights",
5
+ "author": "Microsoft Corp.",
6
+ "license": "MIT",
7
+ "main": "build/clarity.js",
8
+ "module": "build/clarity.module.js",
9
+ "unpkg": "build/clarity.min.js",
10
+ "extended": "build/clarity.extended.js",
11
+ "insight": "build/clarity.insight.js",
12
+ "performance": "build/clarity.performance.js",
13
+ "types": "types/index.d.ts",
14
+ "keywords": [
15
+ "clarity",
16
+ "Microsoft",
17
+ "interactions",
18
+ "cursor",
19
+ "pointer",
20
+ "instrumentation",
21
+ "analytics"
22
+ ],
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/microsoft/clarity.git",
26
+ "directory": "packages/clarity-js"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/microsoft/clarity/issues"
30
+ },
31
+ "devDependencies": {
32
+ "@biomejs/biome": "1.9.4",
33
+ "@rollup/plugin-alias": "^5.1.1",
34
+ "@rollup/plugin-commonjs": "^28.0.3",
35
+ "@rollup/plugin-node-resolve": "^16.0.1",
36
+ "@rollup/plugin-terser": "^0.4.4",
37
+ "@rollup/plugin-typescript": "^12.1.2",
38
+ "@types/chai": "^4.2.21",
39
+ "@types/mocha": "^10.0.0",
40
+ "@types/resize-observer-browser": "^0.1.6",
41
+ "chai": "^4.2.0",
42
+ "del-cli": "^5.0.0",
43
+ "husky": "^8.0.0",
44
+ "lint-staged": "^15.2.9",
45
+ "mocha": "^10.2.0",
46
+ "playwright": "^1.6.2",
47
+ "rollup": "^3.0.0",
48
+ "ts-mocha": "^10.0.0",
49
+ "tslib": "^2.3.0",
50
+ "typescript": "^4.3.5"
51
+ },
52
+ "scripts": {
53
+ "build": "yarn build:clean && yarn build:main",
54
+ "build:main": "rollup -c rollup.config.ts --configPlugin @rollup/plugin-typescript",
55
+ "build:clean": "del-cli build/*",
56
+ "test": "ts-mocha -p test/tsconfig.test.json test/stub.test.ts",
57
+ "lint": "biome check --staged",
58
+ "lint:fix": "biome check --write --staged",
59
+ "lint:fix:unsafe": "biome check --write --unsafe --staged",
60
+ "lint:all": "biome check",
61
+ "lint:all:fix": "biome check --write",
62
+ "lint:changed": "biome check --changed",
63
+ "lint:changed:fix": "biome check --changed --write",
64
+ "lint:changed:fix:unsafe": "biome check --changed --write --unsafe",
65
+ "precommit": "lint-staged"
66
+ },
67
+ "husky": {
68
+ "hooks": {
69
+ "pre-commit": "lint-staged"
70
+ }
71
+ },
72
+ "lint-staged": {
73
+ "*.ts": [
74
+ "tslint --format codeFrame"
75
+ ]
76
+ }
77
77
  }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Creates a throttled version of the provided function that only executes at most once
3
+ * every specified duration in milliseconds, ensuring the last event is not lost.
4
+ * @param func - The function to throttle.
5
+ * @param duration - The duration in milliseconds to wait before allowing the next execution.
6
+ * @returns A throttled version of the provided function.
7
+ */
8
+ export default function throttle<T extends (...args: any[]) => void>(func: T, duration: number): T {
9
+ let lastExecutionTime = 0;
10
+ let timeoutId: ReturnType<typeof setTimeout> | null = null;
11
+ let lastArgs: Parameters<T> | null = null;
12
+
13
+ return function (...args: Parameters<T>) {
14
+ const now = performance.now();
15
+ const timeSinceLastExecution = now - lastExecutionTime;
16
+
17
+ // If the function is called during the throttling period, store the arguments to ensure we don't drop the last event
18
+ if (lastExecutionTime !== 0 && timeSinceLastExecution < duration) {
19
+ lastArgs = args;
20
+
21
+ if (timeoutId) return;
22
+
23
+ timeoutId = setTimeout(() => {
24
+ lastExecutionTime = performance.now();
25
+ func.apply(this, lastArgs!);
26
+ lastArgs = null;
27
+ timeoutId = null;
28
+ }, duration - timeSinceLastExecution);
29
+ } else {
30
+ // Execute immediately if outside the throttling period (including the first run)
31
+ lastExecutionTime = now;
32
+ func.apply(this, args);
33
+ }
34
+ } as T;
35
+ }
@@ -1,2 +1,2 @@
1
- const version = "0.8.10";
1
+ const version = "0.8.11";
2
2
  export default version;
@@ -139,7 +139,7 @@ function similar(last: PointerState, current: PointerState): boolean {
139
139
  const gap = current.time - last.time;
140
140
  const match = current.data.target === last.data.target;
141
141
  const sameId = current.data.id !== undefined ? current.data.id === last.data.id : true;
142
- return current.event === last.event && match && distance < Setting.Distance && gap < Setting.Interval && sameId;
142
+ return current.event === last.event && match && distance < Setting.Distance && gap < Setting.PointerInterval && sameId;
143
143
  }
144
144
 
145
145
  export function stop(): void {
@@ -5,6 +5,7 @@ import { bind } from "@src/core/event";
5
5
  import { schedule } from "@src/core/task";
6
6
  import { time } from "@src/core/time";
7
7
  import { clearTimeout, setTimeout } from "@src/core/timeout";
8
+ import throttle from "@src/core/throttle";
8
9
  import * as dimension from "@src/data/dimension";
9
10
  import { iframe } from "@src/layout/dom";
10
11
  import { metadata, target } from "@src/layout/target";
@@ -23,7 +24,7 @@ export function start(): void {
23
24
  export function observe(root: Node): void {
24
25
  const frame = iframe(root);
25
26
  const node = frame ? frame.contentWindow : root === document ? window : root;
26
- bind(node, "scroll", recompute, true);
27
+ bind(node, "scroll", throttledRecompute, true);
27
28
  }
28
29
 
29
30
  function recompute(event: UIEvent = null): void {
@@ -73,6 +74,8 @@ function recompute(event: UIEvent = null): void {
73
74
  timeout = setTimeout(process, Setting.LookAhead, Event.Scroll);
74
75
  }
75
76
 
77
+ const throttledRecompute = throttle(recompute, Setting.Throttle);
78
+
76
79
  function getPositionNode(x: number, y: number): Node {
77
80
  let node: Node;
78
81
  if ("caretPositionFromPoint" in document) {
@@ -104,7 +107,7 @@ function process(event: Event): void {
104
107
  function similar(last: ScrollState, current: ScrollState): boolean {
105
108
  const dx = last.data.x - current.data.x;
106
109
  const dy = last.data.y - current.data.y;
107
- return dx * dx + dy * dy < Setting.Distance * Setting.Distance && current.time - last.time < Setting.Interval;
110
+ return dx * dx + dy * dy < Setting.Distance * Setting.Distance && current.time - last.time < Setting.ScrollInterval;
108
111
  }
109
112
 
110
113
  export function compute(): void {
@@ -102,7 +102,7 @@ function handler(entries: IntersectionObserverEntry[]): void {
102
102
  // that cannot ever be seen by the user. In some cases, websites will have a multiple copy of the same region
103
103
  // like search box - one for desktop, and another for mobile. In those cases, CSS media queries determine which one should be visible.
104
104
  // Also, if these regions ever become non-zero width or height (through AJAX, user action or orientation change) - we will automatically start monitoring them from that point onwards
105
- if (regionMap.has(target) && rect.width + rect.height > 0 && viewport.width > 0 && viewport.height > 0) {
105
+ if (regionMap.has(target) && rect.width + rect.height > 0 && viewport && viewport.width > 0 && viewport.height > 0) {
106
106
  const id = target ? dom.getId(target) : null;
107
107
  const data =
108
108
  id in regions
@@ -15,7 +15,9 @@ export const enum Setting {
15
15
  LookAhead = 500, // 500ms
16
16
  InputLookAhead = 1000, // 1s
17
17
  Distance = 20, // 20 pixels
18
- Interval = 25, // 25 milliseconds
18
+ ScrollInterval = 50, // 25 milliseconds
19
+ PointerInterval = 25, // 25 milliseconds
20
+ Throttle = 25, // 25 milliseconds
19
21
  // biome-ignore lint/style/useLiteralEnumMembers: Time.Second is a const enum, it is compiled to a number
20
22
  TimelineSpan = 2 * Time.Second, // 2 seconds
21
23
  }