posthog-js 1.429.2 → 1.429.3
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/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/conversations.js +1 -1
- package/dist/customizations.d.ts +2 -0
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/dead-clicks-autocapture.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/default-extensions.js.map +1 -1
- package/dist/exception-autocapture.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/extension-bundles.js.map +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +2 -0
- package/dist/module.full.d.ts +2 -0
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.d.ts +2 -0
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/module.no-external.d.ts +2 -0
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.js.map +1 -1
- package/dist/module.slim.no-external.d.ts +2 -0
- package/dist/module.slim.no-external.js +1 -1
- package/dist/module.slim.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/product-tours.js +1 -1
- package/dist/src/extensions/surveys.d.ts +2 -0
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.d.ts +2 -0
- package/dist/surveys.js +1 -1
- package/dist/surveys.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/extensions/surveys.d.ts +2 -0
- package/lib/src/extensions/surveys.js +18 -1
- package/lib/src/extensions/surveys.js.map +1 -1
- package/lib/src/feature-flags-config.js +5 -5
- package/lib/src/feature-flags-config.js.map +1 -1
- package/lib/src/posthog-core.js +3 -7
- package/lib/src/posthog-core.js.map +1 -1
- package/package.json +4 -4
package/dist/customizations.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e="0.8.2",n={DEBUG:!1,LIB_VERSION:e,LIB_NAME:"browser-common",JS_SDK_VERSION:e};function t(e,n){return-1!==e.indexOf(n)}n.DEBUG=!1,n.LIB_VERSION="1.429.2",n.LIB_NAME="web";const i=Object.prototype,r=i.hasOwnProperty,o=i.toString,l=Array.isArray||function(e){return"[object Array]"===o.call(e)},a=e=>"function"==typeof e,d=e=>e===Object(e)&&!l(e),u=e=>{if(d(e)){for(const n in e)if(r.call(e,n))return!1;return!0}return!1},c=e=>void 0===e,s=e=>c(e)||(e=>null===e)(e),f=e=>"[object Number]"==o.call(e)&&e==e;function p(e,n,t,i,r){return n>t&&(i.warn("min cannot be greater than max."),n=t),f(e)?e>t?(i.warn(" cannot be greater than max: "+t+". Using max value instead."),t):n>e?(i.warn(" cannot be less than min: "+n+". Using min value instead."),n):e:(i.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+r),p(null!=r?r:t,n,t,i))}var b=class{constructor(e){this.C={},this.I=e.I,this.R=p(e.bucketSize,0,100,e.$),this.A=p(e.refillRate,0,this.R,e.$),this.O=p(e.refillInterval,0,864e5,e.$)}F(e,n){const t=Math.floor((n-e.lastAccess)/this.O);t>0&&(e.tokens=Math.min(e.tokens+t*this.A,this.R),e.lastAccess=e.lastAccess+t*this.O)}consumeRateLimit(e){var n;const t=Date.now(),i=String(e);let r=this.C[i];return r?this.F(r,t):(r={tokens:this.R,lastAccess:t},this.C[i]=r),0===r.tokens||(r.tokens--,0===r.tokens&&(null===(n=this.I)||void 0===n||n.call(this,e)),0===r.tokens)}stop(){this.C={}}};const g="Mobile",v="Android",w="Tablet",h="Android Tablet",m="iPad",x="Apple Watch",_="Safari",E="BlackBerry",S="Samsung Internet",R="Chrome",O="Chrome iOS",y="Internet Explorer",B="Internet Explorer Mobile",A="Opera",k="Microsoft Edge",M="Firefox",P="Firefox iOS",T="Nintendo",C="PlayStation",I="Xbox",W="Android Mobile",j="Mobile Safari",F="Windows",D="Windows Phone",N="Nokia",G="Ouya",L="Generic "+g.toLowerCase(),U="Generic "+w.toLowerCase(),K="Konqueror",V="Oculus Browser",z="Vivaldi",X="Yandex",H="Whale",q="DuckDuckGo",Y="Pale Moon",Q="Waterfox",Z="Brave",J="Claude",ee="Codex",ne="ChatGPT",te="Google Search App",ie=new RegExp("Version/(\\d+(\\.\\d+)?)"),re=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),oe=new RegExp(I,"i"),le=new RegExp("PlayStation \\w+","i"),ae=new RegExp("Nintendo \\w+","i"),de=new RegExp("BlackBerry|PlayBook|BB10","i"),ue={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},ce=function(e,n,i,r){n=n||"";const o=function(e){return(null==e?void 0:e.brave)?Z:null}(i);return o||((null==r?void 0:r.detectGoogleSearchApp)&&t(e,"GSA/")?te:t(e," OPR/")&&t(e,"Mini")?"Opera Mini":t(e," OPR/")?A:de.test(e)?E:t(e,"IEMobile")||t(e,"WPDesktop")?B:t(e,"OculusBrowser")?V:t(e,"SamsungBrowser")?S:t(e,"Edge")||t(e,"Edg/")?k:t(e,"Vivaldi/")?z:t(e,"YaBrowser/")?X:t(e,"Whale/")?H:t(e,"DuckDuckGo/")||t(e,"Ddg/")?q:t(e,"Claude/")?J:t(e,"Codex/")?ee:t(e,"ChatGPT/")?ne:t(e,"FBIOS")?"Facebook Mobile":t(e,"UCWEB")||t(e,"UCBrowser")?"UC Browser":t(e,"CriOS")?O:t(e,"CrMo")||t(e,R)?R:t(e,v)&&t(e,_)?W:t(e,"FxiOS")?P:t(e.toLowerCase(),K.toLowerCase())?K:t(e,"Brave/")?Z:((e,n)=>n&&t(n,"Apple")||function(e){return t(e,_)&&!t(e,R)&&!t(e,v)}(e))(e,n)?t(e,g)?j:_:t(e,"PaleMoon/")?Y:t(e,"Waterfox/")?Q:t(e,M)?M:t(e,"MSIE")||t(e,"Trident/")?y:t(e,"Gecko")?M:"")},se={[B]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[k]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[R]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[O]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[_]:[ie],[j]:[ie],[A]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[M]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[P]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[K]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[E]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),ie],[W]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[S]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[V]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[z]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[X]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[H]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Z]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[J]:[re],[ee]:[re],[ne]:[re],[q]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Y]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Q]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[te]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[y]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},fe=function(e,n,t,i){const r=ce(e,n,t,i),o=se[r];if(c(o))return null;for(let n=0;o.length>n;n++){const t=e.match(o[n]);if(t)return parseFloat(t[t.length-2])}return null},pe=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[I,e&&e[1]||""]],[new RegExp(T,"i"),[T,""]],[new RegExp(C,"i"),[C,""]],[de,[E,""]],[new RegExp(F,"i"),(e,n)=>{if(/Phone/.test(n)||/WPDesktop/.test(n))return[D,""];if(new RegExp(g).test(n)&&!/IEMobile\b/.test(n))return["Windows Mobile",""];const t=/Windows NT ([0-9.]+)/i.exec(n);if(t&&t[1]){let e=ue[t[1]]||"";return/arm/i.test(n)&&(e="RT"),[F,e]}return[F,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let n="";return e&&e.length>=3&&(n=c(e[2])?e[3]:e[2]),["watchOS",n]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[v,[e[2],e[3],e[4]||"0"].join(".")]:[v,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const n=["Mac OS X",""];return e&&e[1]&&(n[1]=[e[1],e[2],e[3]||"0"].join(".")),n}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],be=function(e){return ae.test(e)?T:le.test(e)?C:oe.test(e)?I:new RegExp(G,"i").test(e)?G:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?D:/iPad/.test(e)?m:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?x:de.test(e)?E:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(N,"i").test(e)?N:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(g).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?v:h:new RegExp("(pda|Mobile)","i").test(e)?L:new RegExp(w,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?U:""},ge=function(e,n){var t;const i=be(e);return i===m||i===h||"Kobo"===i||"Kindle Fire"===i||i===U?w:i===T||i===I||i===C||i===G?"Console":i===x?"Wearable":i?g:"Android"===(null==n?void 0:n.userAgentDataPlatform)&&(null!==(t=null==n?void 0:n.maxTouchPoints)&&void 0!==t?t:0)>0?600>Math.min(null!==(r=null==n?void 0:n.screenWidth)&&void 0!==r?r:0,null!==(o=null==n?void 0:n.screenHeight)&&void 0!==o?o:0)/(null!==(l=null==n?void 0:n.devicePixelRatio)&&void 0!==l?l:1)?g:w:"Desktop";var r,o,l},ve=/\bFBAV\/(\d+(?:\.\d+)*)/i,we=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",ve],[/\bFBAN\/EMA\b/i,"Facebook Lite",ve],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",ve],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]];function he(e){return he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},he(e)}function me(e,n,t){return(n=function(e){var n=function(e){if("object"!=he(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var t=n.call(e,"string");if("object"!=he(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==he(n)?n:n+""}(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function xe(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function _e(e){for(var n=1;arguments.length>n;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?xe(Object(t),!0).forEach(function(n){me(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):xe(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function Ee(e,n){if(null==e)return{};var t,i,r=function(e,n){if(null==e)return{};var t={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(n.includes(i))continue;t[i]=e[i]}return t}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;o.length>i;i++)n.includes(t=o[i])||{}.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}const Se="u">typeof window?window:void 0,$e="u">typeof globalThis?globalThis:Se,Re=null==$e?void 0:$e.navigator,Oe=null==$e?void 0:$e.document,ye=null==$e?void 0:$e.location;null!=$e&&$e.XMLHttpRequest&&new $e.XMLHttpRequest;const Be=null==Re?void 0:Re.userAgent,Ae=(e,{debugEnabled:t}={})=>{const i={N(i,...r){Se&&(n.DEBUG||Se.POSTHOG_DEBUG||t)&&!c(Se.console)&&Se.console&&("__rrweb_original__"in Se.console[i]?Se.console[i].__rrweb_original__:Se.console[i])(e,...r)},debug(...e){i.N("debug",...e)},info(...e){i.N("log",...e)},warn(...e){i.N("warn",...e)},error(...e){i.N("error",...e)},critical(...n){console.error(e,...n)},uninitializedWarning(e){i.error(`You must initialize PostHog before calling ${e}`)},createLogger:(n,t)=>Ae(`${e} ${n}`,t)};return i},ke=Ae("[PostHog.js]"),Me=ke.createLogger;function Pe(e,n){if(!s(e))if(l(e))e.forEach(n);else if(e instanceof FormData)e.forEach((e,t)=>n(e,t));else for(const t in e)r.call(e,t)&&n(e[t],t)}const Te=function(e,...n){for(const t of n)for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e},Ce=function(e,n,t){if(!e||!n||!n.length)return e;const i=e.split("#"),r=i[1],o=(i[0]||"").split("?"),a=o[1],d=o[0],u=(a||"").split("&"),c=[];for(let e=0;u.length>e;e++){const i=u[e].split("=");l(i)&&(n.includes(i[0])?c.push(i[0]+"="+t):c.push(u[e]))}let s=d;return null!=a&&(s+="?"+c.join("&")),null!=r&&(s+="#"+r),s},Ie=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],We=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ie],je=["$app_build","$app_name","$app_namespace","$app_version","$browser","$browser_version","$device_type","$current_url","$pathname","$os","$os_name","$os_version","$referring_domain","$referrer","$screen_height","$screen_width","$viewport_height","$viewport_width","$raw_user_agent"],Fe="<masked>",De=["li_fat_id"];function Ne(){return navigator.language||navigator.userLanguage}function Ge(){const e=Ne();return"string"==typeof e?e.split("-")[0]:void 0}const Le="$direct";function Ue(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ke(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function Ve(e,t,i,r=!1){var l,d,u,s;if(!Be)return{};const p=e?[...Ie,...t||[]]:[],[b,g]=function(e){for(let n=0;pe.length>n;n++){const[t,i]=pe[n],r=t.exec(e),o=r&&(a(i)?i(r,e):i);if(o)return o}return["",""]}(Be),[v,w]=function(e){for(let n=0;we.length>n;n++){const[t,i,r]=we[n],o=e.match(t);if(o){const n=r&&e.match(r)||o;return[i,(null==n?void 0:n[1])||""]}}return["",""]}(Be),h=function(){const e="u">typeof navigator?navigator:void 0;return(null==e?void 0:e.brave)?{brave:!0}:{}}(),m={};c(i)||(m.detectGoogleSearchApp=i);const x={},_=null===(l=navigator)||void 0===l||null===(l=l.userAgentData)||void 0===l?void 0:l.platform,E=null===(d=navigator)||void 0===d?void 0:d.maxTouchPoints,S=null==Se||null===(u=Se.screen)||void 0===u?void 0:u.width,R=null==Se||null===(s=Se.screen)||void 0===s?void 0:s.height,O=null==Se?void 0:Se.devicePixelRatio;c(_)||(x.userAgentDataPlatform=_),c(E)||(x.maxTouchPoints=E),c(S)||(x.screenWidth=S),c(R)||(x.screenHeight=R),c(O)||(x.devicePixelRatio=O);const y=Te(function(e){const n={};return Pe(e,function(e,t){("[object String]"==o.call(e)&&e.length>0||f(e))&&(n[t]=e)}),n}({$os:b,$os_version:g,$browser:ce(Be,navigator.vendor,h,m),$webview_app:v,$webview_app_version:w,$device:be(Be),$device_type:ge(Be,x),$timezone:Ue(),$timezone_offset:Ke()}),{$current_url:Ce(r?(B=null==ye?void 0:ye.href,B?B.split("#")[0]:B):null==ye?void 0:ye.href,p,Fe),$host:null==ye?void 0:ye.host,$pathname:null==ye?void 0:ye.pathname,$raw_user_agent:Be.length>1e3?Be.substring(0,997)+"...":Be,$browser_version:fe(Be,navigator.vendor,h,m),$browser_language:Ne(),$browser_language_prefix:Ge(),$screen_height:null==Se?void 0:Se.screen.height,$screen_width:null==Se?void 0:Se.screen.width,$viewport_height:null==Se?void 0:Se.innerHeight,$viewport_width:null==Se?void 0:Se.innerWidth,$lib:n.LIB_NAME,$lib_version:n.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});var B;return n.SDK_DIST_CHANNEL&&(y.$sdk_dist_channel=n.SDK_DIST_CHANNEL),y}const ze=e=>{const n=Te({},Ve(e.config.mask_personal_data_properties,e.config.custom_personal_data_properties,e.config.detect_google_search_app,e.config.disable_capture_url_hashes),function(e,n,t){if(!Oe)return{};const i=n?[...Ie,...t||[]]:[],r=function(e,n){const t=We.concat(n||[]),i={};return Pe(t,function(n){const t=function(e,n){const t=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let i;for(let e=0;t.length>e;e++){const r=t[e].split("=");if(r[0]===n){i=r;break}}if(!l(i)||2>i.length)return"";{let e=i[1];try{e=decodeURIComponent(e)}catch(n){ke.error("Skipping decoding for malformed query param: "+e)}return e.replace(/\+/g," ")}}(e,n);i[n]=t||null}),i}(Ce(Oe.URL,i,Fe),e),o=function(){const e={};return Pe(De,function(n){const t=(e=>{if(Oe){try{const n=e+"=",t=Oe.cookie.split(";").filter(e=>e.length);for(let e=0;t.length>e;e++){let i=t[e];for(;" "==i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(n))return decodeURIComponent(i.substring(n.length,i.length))}}catch(e){}return null}})(n);e[n]=t||null}),e}();return Te(o,r)}(e.config.custom_campaign_params,e.config.mask_personal_data_properties,e.config.custom_personal_data_properties),{$referrer:(null==Oe?void 0:Oe.referrer)||Le,$referring_domain:(null==Oe?void 0:Oe.referrer)&&(null===(r=(e=>{const n=null==Oe?void 0:Oe.createElement("a");return c(n)?null:(n.href=e,n)})(Oe.referrer))||void 0===r?void 0:r.host)||Le}),i={};var r;Pe(n,function(e,n){(t(We,n)||t(je,n))&&(i[n]=e)}),e.setPersonPropertiesForFlags(i)};function Xe(e,n){return[...e||[],...l(n)?n:[n]]}function He(e,n){return(c(e)?1:e)*n}function qe(e,n){return function(e){let n=0;for(let t=0;e.length>t;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return Math.abs(n)}(e)%100<p(100*n,0,100,ke)}function Ye(e){return n=>n&&qe(n.properties.distinct_id,e)?_e(_e({},n),{},{properties:_e(_e({},n.properties),{},{$sample_type:["sampleByDistinctId"],$sample_threshold:e})}):null}function Qe(e){return n=>n&&qe(n.properties.$session_id,e)?_e(_e({},n),{},{properties:_e(_e({},n.properties),{},{$sample_type:Xe(n.properties.$sample_type,"sampleBySessionId"),$sample_threshold:He(n.properties.$sample_threshold,e)})}):null}function Ze(e,n){return i=>{var r,o,l;return i?t(e,i.event)?100*Math.random()<p(100*n,0,100,ke)?_e(_e({},i),{},{properties:_e(_e({},i.properties),{},{$sample_type:Xe(null===(r=i.properties)||void 0===r?void 0:r.$sample_type,"sampleByEvent"),$sample_threshold:He(null===(o=i.properties)||void 0===o?void 0:o.$sample_threshold,n),$sampled_events:Xe(null===(l=i.properties)||void 0===l?void 0:l.$sampled_events,e)})}):null:i:null}}const Je=e=>(console.log("Would have sent event:",e),null),en=["type"];function nn(e){const{type:n,executionTimeMs:t}=e;return`${n}${s(t)?"":` (${t.toFixed(2)}ms)`}`}const tn=Me("[PostHog Action RateLimiting]");function rn(e,n){console.log(e,n)}const on=e=>(n,t)=>{var i;null==e||null===(i=e.sessionRecording)||void 0===i||i.tryAddCustomEvent("app-state",{title:n,stateEvent:t})};function ln(e,n,t=5){if("object"!=typeof e||"object"!=typeof n)return{};if(e===n)return{};if(!e&&n)return n;if(!n||!e)return{};const i={},r=new Set([...Object.keys(e),...Object.keys(n)]);for(const o of r){const r=e[o],l=n[o];if(c(r))i[o]=l;else if(c(l))i[o]=r;else if(!(r===l||s(r)&&s(l)))if(d(r)&&d(l))if(t>1){const e=ln(r,l,t-1);u(e)||(i[o]=e)}else i[o]="max depth reached, checking for changed value";else i[o]=l}return i}const an=(()=>{let e=null,n=0,t=null;return{info(i){t!==i&&(n=0,t=i),n++,e&&clearTimeout(e),e=setTimeout(()=>{tn.info(1===n?`action "${i}" has been rate limited`:`action "${i}" has been rate limited (${n} times)`),n=0,e=null},1e3)}}})();function dn(e={}){const n=un(e);return{name:"posthog-kea-logger",events:{beforeReduxStore(e){e.middleware.push(n)}}}}function un(e={}){const{maskAction:n,maskState:t,titleFunction:i=nn,logger:r=rn,include:o={prevState:!0,nextState:!1,changedState:!0},rateLimiterRefillRate:l=1,rateLimiterBucketSize:a=10,__stateComparisonDepth:d}=e,u=new b({refillRate:l,bucketSize:a,refillInterval:1e3,$:tn});return e=>l=>a=>{const c=a,s=e.getState(),f=performance.now(),p=l(c),b=performance.now()-f,g=e.getState(),v=n?n(c):c;if(!v)return p;if(u.consumeRateLimit(c.type))an.info(c.type);else try{const e=t?t(s,v):s,n=t?t(g,v):g,l=o.changedState?ln(e,n,null!=d?d:5):void 0,{type:a}=v,u={type:a,payload:Ee(v,en),timestamp:Date.now(),executionTimeMs:b,prevState:o.prevState?e:void 0,nextState:o.nextState?n:void 0,changedState:o.changedState?l:void 0},c=i(u);r(c,u)}catch(e){tn.error("Error logging state:",e)}return p}}export{rn as browserConsoleLogger,dn as posthogKeaLogger,un as posthogReduxLogger,Je as printAndDropEverything,Ye as sampleByDistinctId,Ze as sampleByEvent,Qe as sampleBySessionId,on as sessionRecordingLoggerForPostHogInstance,ze as setAllPersonProfilePropertiesAsPersonPropertiesForFlags};
|
|
1
|
+
const e="0.8.2",n={DEBUG:!1,LIB_VERSION:e,LIB_NAME:"browser-common",JS_SDK_VERSION:e};function t(e,n){return-1!==e.indexOf(n)}n.DEBUG=!1,n.LIB_VERSION="1.429.3",n.LIB_NAME="web";const i=Object.prototype,r=i.hasOwnProperty,o=i.toString,l=Array.isArray||function(e){return"[object Array]"===o.call(e)},a=e=>"function"==typeof e,d=e=>e===Object(e)&&!l(e),u=e=>{if(d(e)){for(const n in e)if(r.call(e,n))return!1;return!0}return!1},c=e=>void 0===e,s=e=>c(e)||(e=>null===e)(e),f=e=>"[object Number]"==o.call(e)&&e==e;function p(e,n,t,i,r){return n>t&&(i.warn("min cannot be greater than max."),n=t),f(e)?e>t?(i.warn(" cannot be greater than max: "+t+". Using max value instead."),t):n>e?(i.warn(" cannot be less than min: "+n+". Using min value instead."),n):e:(i.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+r),p(null!=r?r:t,n,t,i))}var b=class{constructor(e){this.C={},this.I=e.I,this.R=p(e.bucketSize,0,100,e.$),this.A=p(e.refillRate,0,this.R,e.$),this.O=p(e.refillInterval,0,864e5,e.$)}F(e,n){const t=Math.floor((n-e.lastAccess)/this.O);t>0&&(e.tokens=Math.min(e.tokens+t*this.A,this.R),e.lastAccess=e.lastAccess+t*this.O)}consumeRateLimit(e){var n;const t=Date.now(),i=String(e);let r=this.C[i];return r?this.F(r,t):(r={tokens:this.R,lastAccess:t},this.C[i]=r),0===r.tokens||(r.tokens--,0===r.tokens&&(null===(n=this.I)||void 0===n||n.call(this,e)),0===r.tokens)}stop(){this.C={}}};const g="Mobile",v="Android",w="Tablet",h="Android Tablet",m="iPad",x="Apple Watch",_="Safari",E="BlackBerry",S="Samsung Internet",R="Chrome",O="Chrome iOS",y="Internet Explorer",B="Internet Explorer Mobile",A="Opera",k="Microsoft Edge",M="Firefox",P="Firefox iOS",T="Nintendo",C="PlayStation",I="Xbox",W="Android Mobile",j="Mobile Safari",F="Windows",D="Windows Phone",N="Nokia",G="Ouya",L="Generic "+g.toLowerCase(),U="Generic "+w.toLowerCase(),K="Konqueror",V="Oculus Browser",z="Vivaldi",X="Yandex",H="Whale",q="DuckDuckGo",Y="Pale Moon",Q="Waterfox",Z="Brave",J="Claude",ee="Codex",ne="ChatGPT",te="Google Search App",ie=new RegExp("Version/(\\d+(\\.\\d+)?)"),re=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),oe=new RegExp(I,"i"),le=new RegExp("PlayStation \\w+","i"),ae=new RegExp("Nintendo \\w+","i"),de=new RegExp("BlackBerry|PlayBook|BB10","i"),ue={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},ce=function(e,n,i,r){n=n||"";const o=function(e){return(null==e?void 0:e.brave)?Z:null}(i);return o||((null==r?void 0:r.detectGoogleSearchApp)&&t(e,"GSA/")?te:t(e," OPR/")&&t(e,"Mini")?"Opera Mini":t(e," OPR/")?A:de.test(e)?E:t(e,"IEMobile")||t(e,"WPDesktop")?B:t(e,"OculusBrowser")?V:t(e,"SamsungBrowser")?S:t(e,"Edge")||t(e,"Edg/")?k:t(e,"Vivaldi/")?z:t(e,"YaBrowser/")?X:t(e,"Whale/")?H:t(e,"DuckDuckGo/")||t(e,"Ddg/")?q:t(e,"Claude/")?J:t(e,"Codex/")?ee:t(e,"ChatGPT/")?ne:t(e,"FBIOS")?"Facebook Mobile":t(e,"UCWEB")||t(e,"UCBrowser")?"UC Browser":t(e,"CriOS")?O:t(e,"CrMo")||t(e,R)?R:t(e,v)&&t(e,_)?W:t(e,"FxiOS")?P:t(e.toLowerCase(),K.toLowerCase())?K:t(e,"Brave/")?Z:((e,n)=>n&&t(n,"Apple")||function(e){return t(e,_)&&!t(e,R)&&!t(e,v)}(e))(e,n)?t(e,g)?j:_:t(e,"PaleMoon/")?Y:t(e,"Waterfox/")?Q:t(e,M)?M:t(e,"MSIE")||t(e,"Trident/")?y:t(e,"Gecko")?M:"")},se={[B]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[k]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[R]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[O]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[_]:[ie],[j]:[ie],[A]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[M]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[P]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[K]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[E]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),ie],[W]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[S]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[V]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[z]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[X]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[H]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Z]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[J]:[re],[ee]:[re],[ne]:[re],[q]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Y]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Q]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[te]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[y]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},fe=function(e,n,t,i){const r=ce(e,n,t,i),o=se[r];if(c(o))return null;for(let n=0;o.length>n;n++){const t=e.match(o[n]);if(t)return parseFloat(t[t.length-2])}return null},pe=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[I,e&&e[1]||""]],[new RegExp(T,"i"),[T,""]],[new RegExp(C,"i"),[C,""]],[de,[E,""]],[new RegExp(F,"i"),(e,n)=>{if(/Phone/.test(n)||/WPDesktop/.test(n))return[D,""];if(new RegExp(g).test(n)&&!/IEMobile\b/.test(n))return["Windows Mobile",""];const t=/Windows NT ([0-9.]+)/i.exec(n);if(t&&t[1]){let e=ue[t[1]]||"";return/arm/i.test(n)&&(e="RT"),[F,e]}return[F,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let n="";return e&&e.length>=3&&(n=c(e[2])?e[3]:e[2]),["watchOS",n]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[v,[e[2],e[3],e[4]||"0"].join(".")]:[v,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const n=["Mac OS X",""];return e&&e[1]&&(n[1]=[e[1],e[2],e[3]||"0"].join(".")),n}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],be=function(e){return ae.test(e)?T:le.test(e)?C:oe.test(e)?I:new RegExp(G,"i").test(e)?G:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?D:/iPad/.test(e)?m:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?x:de.test(e)?E:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(N,"i").test(e)?N:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(g).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?v:h:new RegExp("(pda|Mobile)","i").test(e)?L:new RegExp(w,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?U:""},ge=function(e,n){var t;const i=be(e);return i===m||i===h||"Kobo"===i||"Kindle Fire"===i||i===U?w:i===T||i===I||i===C||i===G?"Console":i===x?"Wearable":i?g:"Android"===(null==n?void 0:n.userAgentDataPlatform)&&(null!==(t=null==n?void 0:n.maxTouchPoints)&&void 0!==t?t:0)>0?600>Math.min(null!==(r=null==n?void 0:n.screenWidth)&&void 0!==r?r:0,null!==(o=null==n?void 0:n.screenHeight)&&void 0!==o?o:0)/(null!==(l=null==n?void 0:n.devicePixelRatio)&&void 0!==l?l:1)?g:w:"Desktop";var r,o,l},ve=/\bFBAV\/(\d+(?:\.\d+)*)/i,we=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",ve],[/\bFBAN\/EMA\b/i,"Facebook Lite",ve],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",ve],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]];function he(e){return he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},he(e)}function me(e,n,t){return(n=function(e){var n=function(e){if("object"!=he(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var t=n.call(e,"string");if("object"!=he(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==he(n)?n:n+""}(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function xe(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,i)}return t}function _e(e){for(var n=1;arguments.length>n;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?xe(Object(t),!0).forEach(function(n){me(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):xe(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function Ee(e,n){if(null==e)return{};var t,i,r=function(e,n){if(null==e)return{};var t={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(n.includes(i))continue;t[i]=e[i]}return t}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;o.length>i;i++)n.includes(t=o[i])||{}.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}const Se="u">typeof window?window:void 0,$e="u">typeof globalThis?globalThis:Se,Re=null==$e?void 0:$e.navigator,Oe=null==$e?void 0:$e.document,ye=null==$e?void 0:$e.location;null!=$e&&$e.XMLHttpRequest&&new $e.XMLHttpRequest;const Be=null==Re?void 0:Re.userAgent,Ae=(e,{debugEnabled:t}={})=>{const i={N(i,...r){Se&&(n.DEBUG||Se.POSTHOG_DEBUG||t)&&!c(Se.console)&&Se.console&&("__rrweb_original__"in Se.console[i]?Se.console[i].__rrweb_original__:Se.console[i])(e,...r)},debug(...e){i.N("debug",...e)},info(...e){i.N("log",...e)},warn(...e){i.N("warn",...e)},error(...e){i.N("error",...e)},critical(...n){console.error(e,...n)},uninitializedWarning(e){i.error(`You must initialize PostHog before calling ${e}`)},createLogger:(n,t)=>Ae(`${e} ${n}`,t)};return i},ke=Ae("[PostHog.js]"),Me=ke.createLogger;function Pe(e,n){if(!s(e))if(l(e))e.forEach(n);else if(e instanceof FormData)e.forEach((e,t)=>n(e,t));else for(const t in e)r.call(e,t)&&n(e[t],t)}const Te=function(e,...n){for(const t of n)for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e},Ce=function(e,n,t){if(!e||!n||!n.length)return e;const i=e.split("#"),r=i[1],o=(i[0]||"").split("?"),a=o[1],d=o[0],u=(a||"").split("&"),c=[];for(let e=0;u.length>e;e++){const i=u[e].split("=");l(i)&&(n.includes(i[0])?c.push(i[0]+"="+t):c.push(u[e]))}let s=d;return null!=a&&(s+="?"+c.join("&")),null!=r&&(s+="#"+r),s},Ie=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],We=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ie],je=["$app_build","$app_name","$app_namespace","$app_version","$browser","$browser_version","$device_type","$current_url","$pathname","$os","$os_name","$os_version","$referring_domain","$referrer","$screen_height","$screen_width","$viewport_height","$viewport_width","$raw_user_agent"],Fe="<masked>",De=["li_fat_id"];function Ne(){return navigator.language||navigator.userLanguage}function Ge(){const e=Ne();return"string"==typeof e?e.split("-")[0]:void 0}const Le="$direct";function Ue(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ke(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function Ve(e,t,i,r=!1){var l,d,u,s;if(!Be)return{};const p=e?[...Ie,...t||[]]:[],[b,g]=function(e){for(let n=0;pe.length>n;n++){const[t,i]=pe[n],r=t.exec(e),o=r&&(a(i)?i(r,e):i);if(o)return o}return["",""]}(Be),[v,w]=function(e){for(let n=0;we.length>n;n++){const[t,i,r]=we[n],o=e.match(t);if(o){const n=r&&e.match(r)||o;return[i,(null==n?void 0:n[1])||""]}}return["",""]}(Be),h=function(){const e="u">typeof navigator?navigator:void 0;return(null==e?void 0:e.brave)?{brave:!0}:{}}(),m={};c(i)||(m.detectGoogleSearchApp=i);const x={},_=null===(l=navigator)||void 0===l||null===(l=l.userAgentData)||void 0===l?void 0:l.platform,E=null===(d=navigator)||void 0===d?void 0:d.maxTouchPoints,S=null==Se||null===(u=Se.screen)||void 0===u?void 0:u.width,R=null==Se||null===(s=Se.screen)||void 0===s?void 0:s.height,O=null==Se?void 0:Se.devicePixelRatio;c(_)||(x.userAgentDataPlatform=_),c(E)||(x.maxTouchPoints=E),c(S)||(x.screenWidth=S),c(R)||(x.screenHeight=R),c(O)||(x.devicePixelRatio=O);const y=Te(function(e){const n={};return Pe(e,function(e,t){("[object String]"==o.call(e)&&e.length>0||f(e))&&(n[t]=e)}),n}({$os:b,$os_version:g,$browser:ce(Be,navigator.vendor,h,m),$webview_app:v,$webview_app_version:w,$device:be(Be),$device_type:ge(Be,x),$timezone:Ue(),$timezone_offset:Ke()}),{$current_url:Ce(r?(B=null==ye?void 0:ye.href,B?B.split("#")[0]:B):null==ye?void 0:ye.href,p,Fe),$host:null==ye?void 0:ye.host,$pathname:null==ye?void 0:ye.pathname,$raw_user_agent:Be.length>1e3?Be.substring(0,997)+"...":Be,$browser_version:fe(Be,navigator.vendor,h,m),$browser_language:Ne(),$browser_language_prefix:Ge(),$screen_height:null==Se?void 0:Se.screen.height,$screen_width:null==Se?void 0:Se.screen.width,$viewport_height:null==Se?void 0:Se.innerHeight,$viewport_width:null==Se?void 0:Se.innerWidth,$lib:n.LIB_NAME,$lib_version:n.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});var B;return n.SDK_DIST_CHANNEL&&(y.$sdk_dist_channel=n.SDK_DIST_CHANNEL),y}const ze=e=>{const n=Te({},Ve(e.config.mask_personal_data_properties,e.config.custom_personal_data_properties,e.config.detect_google_search_app,e.config.disable_capture_url_hashes),function(e,n,t){if(!Oe)return{};const i=n?[...Ie,...t||[]]:[],r=function(e,n){const t=We.concat(n||[]),i={};return Pe(t,function(n){const t=function(e,n){const t=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let i;for(let e=0;t.length>e;e++){const r=t[e].split("=");if(r[0]===n){i=r;break}}if(!l(i)||2>i.length)return"";{let e=i[1];try{e=decodeURIComponent(e)}catch(n){ke.error("Skipping decoding for malformed query param: "+e)}return e.replace(/\+/g," ")}}(e,n);i[n]=t||null}),i}(Ce(Oe.URL,i,Fe),e),o=function(){const e={};return Pe(De,function(n){const t=(e=>{if(Oe){try{const n=e+"=",t=Oe.cookie.split(";").filter(e=>e.length);for(let e=0;t.length>e;e++){let i=t[e];for(;" "==i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(n))return decodeURIComponent(i.substring(n.length,i.length))}}catch(e){}return null}})(n);e[n]=t||null}),e}();return Te(o,r)}(e.config.custom_campaign_params,e.config.mask_personal_data_properties,e.config.custom_personal_data_properties),{$referrer:(null==Oe?void 0:Oe.referrer)||Le,$referring_domain:(null==Oe?void 0:Oe.referrer)&&(null===(r=(e=>{const n=null==Oe?void 0:Oe.createElement("a");return c(n)?null:(n.href=e,n)})(Oe.referrer))||void 0===r?void 0:r.host)||Le}),i={};var r;Pe(n,function(e,n){(t(We,n)||t(je,n))&&(i[n]=e)}),e.setPersonPropertiesForFlags(i)};function Xe(e,n){return[...e||[],...l(n)?n:[n]]}function He(e,n){return(c(e)?1:e)*n}function qe(e,n){return function(e){let n=0;for(let t=0;e.length>t;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return Math.abs(n)}(e)%100<p(100*n,0,100,ke)}function Ye(e){return n=>n&&qe(n.properties.distinct_id,e)?_e(_e({},n),{},{properties:_e(_e({},n.properties),{},{$sample_type:["sampleByDistinctId"],$sample_threshold:e})}):null}function Qe(e){return n=>n&&qe(n.properties.$session_id,e)?_e(_e({},n),{},{properties:_e(_e({},n.properties),{},{$sample_type:Xe(n.properties.$sample_type,"sampleBySessionId"),$sample_threshold:He(n.properties.$sample_threshold,e)})}):null}function Ze(e,n){return i=>{var r,o,l;return i?t(e,i.event)?100*Math.random()<p(100*n,0,100,ke)?_e(_e({},i),{},{properties:_e(_e({},i.properties),{},{$sample_type:Xe(null===(r=i.properties)||void 0===r?void 0:r.$sample_type,"sampleByEvent"),$sample_threshold:He(null===(o=i.properties)||void 0===o?void 0:o.$sample_threshold,n),$sampled_events:Xe(null===(l=i.properties)||void 0===l?void 0:l.$sampled_events,e)})}):null:i:null}}const Je=e=>(console.log("Would have sent event:",e),null),en=["type"];function nn(e){const{type:n,executionTimeMs:t}=e;return`${n}${s(t)?"":` (${t.toFixed(2)}ms)`}`}const tn=Me("[PostHog Action RateLimiting]");function rn(e,n){console.log(e,n)}const on=e=>(n,t)=>{var i;null==e||null===(i=e.sessionRecording)||void 0===i||i.tryAddCustomEvent("app-state",{title:n,stateEvent:t})};function ln(e,n,t=5){if("object"!=typeof e||"object"!=typeof n)return{};if(e===n)return{};if(!e&&n)return n;if(!n||!e)return{};const i={},r=new Set([...Object.keys(e),...Object.keys(n)]);for(const o of r){const r=e[o],l=n[o];if(c(r))i[o]=l;else if(c(l))i[o]=r;else if(!(r===l||s(r)&&s(l)))if(d(r)&&d(l))if(t>1){const e=ln(r,l,t-1);u(e)||(i[o]=e)}else i[o]="max depth reached, checking for changed value";else i[o]=l}return i}const an=(()=>{let e=null,n=0,t=null;return{info(i){t!==i&&(n=0,t=i),n++,e&&clearTimeout(e),e=setTimeout(()=>{tn.info(1===n?`action "${i}" has been rate limited`:`action "${i}" has been rate limited (${n} times)`),n=0,e=null},1e3)}}})();function dn(e={}){const n=un(e);return{name:"posthog-kea-logger",events:{beforeReduxStore(e){e.middleware.push(n)}}}}function un(e={}){const{maskAction:n,maskState:t,titleFunction:i=nn,logger:r=rn,include:o={prevState:!0,nextState:!1,changedState:!0},rateLimiterRefillRate:l=1,rateLimiterBucketSize:a=10,__stateComparisonDepth:d}=e,u=new b({refillRate:l,bucketSize:a,refillInterval:1e3,$:tn});return e=>l=>a=>{const c=a,s=e.getState(),f=performance.now(),p=l(c),b=performance.now()-f,g=e.getState(),v=n?n(c):c;if(!v)return p;if(u.consumeRateLimit(c.type))an.info(c.type);else try{const e=t?t(s,v):s,n=t?t(g,v):g,l=o.changedState?ln(e,n,null!=d?d:5):void 0,{type:a}=v,u={type:a,payload:Ee(v,en),timestamp:Date.now(),executionTimeMs:b,prevState:o.prevState?e:void 0,nextState:o.nextState?n:void 0,changedState:o.changedState?l:void 0},c=i(u);r(c,u)}catch(e){tn.error("Error logging state:",e)}return p}}export{rn as browserConsoleLogger,dn as posthogKeaLogger,un as posthogReduxLogger,Je as printAndDropEverything,Ye as sampleByDistinctId,Ze as sampleByEvent,Qe as sampleBySessionId,on as sessionRecordingLoggerForPostHogInstance,ze as setAllPersonProfilePropertiesAsPersonPropertiesForFlags};
|
|
2
2
|
//# sourceMappingURL=customizations.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){const t="u">typeof window?window:void 0,e="u">typeof globalThis?globalThis:t,i=null==e?void 0:e.document;null!=e&&e.XMLHttpRequest&&new e.XMLHttpRequest;const n="undefined"!=typeof globalThis?globalThis:t;n&&"undefined"==typeof self&&(n.self=n),n&&"undefined"==typeof File&&(n.File=function(){});const s=null!=t?t:{};function r(t,e){return-1!==t.indexOf(e)}const o=function(t){return t.trim()},u=Object.prototype,l=u.hasOwnProperty,c=u.toString,a=Array.isArray||function(t){return"[object Array]"===c.call(t)},h=t=>"function"==typeof t,d=t=>void 0===t,f=t=>"[object String]"==c.call(t),v=t=>null===t,_=t=>d(t)||v(t),p=t=>"[object Number]"==c.call(t)&&t==t;function b(t){return t?t.split("#")[0]:t}function m(t){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},m(t)}function g(t,e,i){return(e=function(t){var e=function(t){if("object"!=m(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=m(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==m(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function y(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function w(t){for(var e=1;arguments.length>e;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?y(Object(i),!0).forEach(function(e){g(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):y(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}const k=(e,{debugEnabled:i}={})=>{const n={N(n,...s){t&&(t.POSTHOG_DEBUG||i)&&!d(t.console)&&t.console&&("__rrweb_original__"in t.console[n]?t.console[n].__rrweb_original__:t.console[n])(e,...s)},debug(...t){n.N("debug",...t)},info(...t){n.N("log",...t)},warn(...t){n.N("warn",...t)},error(...t){n.N("error",...t)},critical(...t){console.error(e,...t)},uninitializedWarning(t){n.error(`You must initialize PostHog before calling ${t}`)},createLogger:(t,i)=>k(`${e} ${t}`,i)};return n},C=k("[PostHog.js]"),O=C.createLogger;function x(t,e){if(!_(t))if(a(t))t.forEach(e);else if(t instanceof FormData)t.forEach((t,i)=>e(t,i));else for(const i in t)l.call(t,i)&&e(t[i],i)}const j=function(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&(t[e]=i[e]);return t};function A(t){const e=Object.keys(t);let i=e.length;const n=new Array(i);for(;i--;)n[i]=[e[i],t[e[i]]];return n}function S(t,e,i,n){const{capture:s=!1,passive:r=!0}=null!=n?n:{};null==t||t.addEventListener(e,i,{capture:s,passive:r})}function D(t){return!!t&&1===t.nodeType}function E(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function T(t){return!!t&&11===t.nodeType&&D(t.host)}function M(t){return t?o(t).split(/\s+/):[]}function L(t){let e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return M(e)}function R(t){let e="";return q(t)&&!B(t)&&t.childNodes&&t.childNodes.length&&x(t.childNodes,function(t){var i,n;(function(t){return!!t&&3===t.nodeType})(t)&&t.textContent&&(e+=null!==(i=_(n=t.textContent)?null:o(n).split(/(\s+)/).filter(t=>tt(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))&&void 0!==i?i:"")}),o(e)}function I(t){var e;return d(t.target)?t.srcElement||null:(null===(e=t.target)||void 0===e?void 0:e.shadowRoot)?t.composedPath()[0]||null:t.target||null}const z=["a","button","form","input","select","textarea","label"];function H(t,e){const i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}function P(t){const e=t.parentNode;return!(!e||!D(e))&&e}const U=[".ph-no-deadclick",".ph-no-capture"];const Z=["","text","search","email","password","url","tel","number"];function F(t){return!(!t||!D(t))&&(!!E(t,"textarea")||(E(t,"input")?r(Z,(t.getAttribute("type")||"").toLowerCase()):function(t){var e;if(t.isContentEditable)return!0;const i=null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return"true"===i||""===i}(t)))}const G=t=>!t||E(t,"html")||!D(t),W=(e,i)=>{if(!t||G(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const s=[e];let r=e;for(;r.parentNode&&!E(r,"body");){if(T(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const e=P(r);if(!e)break;if(i||z.indexOf(e.tagName.toLowerCase())>-1)n=!0;else try{const i=t.getComputedStyle(e);i&&"pointer"===i.getPropertyValue("cursor")&&(n=!0)}catch(t){}s.push(e),r=e}return{parentIsUsefulElement:n,targetElementList:s}};function q(t){const e=new Set;let i=0;for(let n=t;n.parentNode&&!E(n,"body");n=n.parentNode){if(i++>=1e3||e.has(n))return!1;e.add(n);const t=L(n);if(r(t,"ph-sensitive")||r(t,"ph-no-capture"))return!1}if(r(L(t),"ph-include"))return!0;const n=t.type||"";if(f(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}const s=t.name||t.id||"";return!f(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function B(t){return!!(E(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||E(t,"select")||E(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const N=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),V=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,K=[16,15,14,13],Y=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),J=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Q=/[0-9A-Za-z_]/;function X(t){let e=0,i=!1;for(let n=t.length-1;n>=0;n--){let s=t.charCodeAt(n)-48;i&&(s*=2,s>9&&(s-=9)),e+=s,i=!i}return e%10==0}function tt(t,e=!0){if(_(t))return!1;if(f(t)){if(t=o(t),e?N.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(V.lastIndex=0;e=V.exec(t);){const t=e[2];if(!t)continue;const i=t.replace(/[- ]/g,"");for(let t=0;i.length>t;t++)for(const e of K){const n=t+e;if(i.length>=n){const e=i.slice(t,n);if(N.test(e)&&X(e))return!0}}}return!1}(t))return!1;if(e?Y.test(t):function(t){let e;for(J.lastIndex=0;e=J.exec(t);){const t=e[1],i=e[3];if(!(t&&i&&Q.test(t)&&Q.test(i)))return!0}return!1}(t))return!1}return!0}function et(t){let e=R(t);return e=`${e} ${it(t)}`.trim(),tt(e)?e:""}function it(t){let e="";return t&&t.childNodes&&t.childNodes.length&&x(t.childNodes,function(t){var i;if(t&&"span"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=R(t);e=`${e} ${i}`.trim(),t.childNodes&&t.childNodes.length&&(e=`${e} ${it(t)}`.trim())}catch(t){C.error("[AutoCapture]",t)}}),e}function nt(t){return t.replace(/"|\\"/g,'\\"')}function st(t){const e=t.attr__class;if(e)return a(e)?e:M(e)}function rt(t,e){return e.length>t?e.slice(0,t)+"...":e}function ot(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do{e=e.previousSibling}while(e&&!D(e));return e}function ut(e,{e:n,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:u,elementsChainAsString:l,disableCaptureUrlHashes:c}){var h,v;if(!D(e))return{props:{}};const _=[e],p=new Set([e]);let m=e;for(;m.parentNode&&!E(m,"body")&&1e3>_.length;){if(T(m.parentNode)){const t=m.parentNode.host;if(p.has(t))break;p.add(t),_.push(t),m=t;continue}if(!D(m.parentNode))break;if(p.has(m.parentNode))break;p.add(m.parentNode),_.push(m.parentNode),m=m.parentNode}const g="click"===n.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?_.findIndex(t=>E(t,"button")||E(t,"a")):-1;g>0&&(o=o||_.slice(0,g+1).some(t=>!q(t)||B(t)));const y=[],k={};let C,O=!1,S=!1;if(x(_,t=>{const e=q(t);if(E(t,"a")){const i=t.getAttribute("href");O=!!(e&&i&&tt(i))&&(c?b(i):i)}r(L(t),"ph-no-capture")&&(S=!0),y.push(function(t,e,i,n,s=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};z.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?rt(1024,et(t)):rt(1024,R(t)));const u=L(t);u.length>0&&(o.classes=u.filter(function(t){return""!==t})),x(t.attributes,function(i){var r;if((!B(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!e&&tt(i.value)&&(!f(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=i.value;"class"===i.name&&(t=M(t).join(" ")),o["attr__"+i.name]=rt(1024,"href"===i.name&&s?b(t):t)}});let l=1,c=1,a=t;for(;a=ot(a);)l++,a.tagName===t.tagName&&c++;return o.nth_child=l,o.nth_of_type=c,o}(t,s,o,u,c)),x(function(t){if(!q(t))return{};const e={};return x(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const i=t.name.replace("data-ph-capture-attribute-",""),n=t.value;i&&n&&tt(n)&&(e[i]=n)}}),e}(t),(t,e)=>{({}).hasOwnProperty.call(k,e)||(k[e]=t)})}),S)return{props:{},explicitNoCapture:S};if(g>0&&(e=_[g],y.splice(0,g)),o||(y[0].$el_text=E(e,"a")||E(e,"button")?et(e):R(e)),O){var I,H;y[0].attr__href=O;const e=null===(I=(t=>{const e=null==i?void 0:i.createElement("a");return d(e)?null:(e.href=t,e)})(O))||void 0===I?void 0:I.host,n=null==t||null===(H=t.location)||void 0===H?void 0:H.host;e&&n&&e!==n&&(C=O)}return{props:j((U=n.type,{$event_type:U,$ce_version:1}),l?{}:{$elements:y},{$elements_chain:(P=y,a(P)?function(t){return t.map(t=>{var e,i;let n="";if(t.tag_name&&(n+=t.tag_name),t.attr_class){t.attr_class.sort();for(const e of t.attr_class)n+=`.${e.replace(/"/g,"")}`}const s=w(w(w(w({},t.text?{text:t.text}:{}),{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{}),t.attr_id?{attr_id:t.attr_id}:{}),t.attributes),r={};return A(s).sort(([t],[e])=>function(t,e){return e>t?-1:t>e?1:0}(t,e)).forEach(([t,e])=>r[nt(t.toString())]=nt(e.toString())),n+=":",n+=A(r).map(([t,e])=>`${t}="${e}"`).join(""),n}).join(";")}(function(t){return t.map(t=>{var e,i;const n={text:null===(e=t.$el_text)||void 0===e?void 0:e.slice(0,400),tag_name:t.tag_name,href:null===(i=t.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:st(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return A(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,e])=>n.attributes[t]=e),n})}(P)):"")},(null===(h=y[0])||void 0===h?void 0:h.$el_text)?{$el_text:null===(v=y[0])||void 0===v?void 0:v.$el_text}:{},C&&"click"===n.type?{$external_click_url:C}:{},k),target:e};var P,U}O("[AutoCapture]");const lt={};function ct(t,e){const i=I(t);return i?w({node:i,originalEvent:t,timestamp:Date.now()},e):null}function at(t,e){return Math.abs(t)<Math.abs(e)?0>e?"up":"down":0>t?"left":"right"}function ht(t){return"swipe"===t.type?"$dead_swipe":"$dead_click"}const dt="canvas,video,audio,embed,object";function ft(t,e){return p(t)&&t>=e}function vt(t,e=1e3){return t>=0&&e>t?t:void 0}function _t(t,e,i=1e3){return p(e)?vt(t-e,i):void 0}var pt=class{lr(t){var e,i,n,s,r,o,u,l;const c=this.ur((null==t?void 0:t.__onCapture)||this.cr.bind(this));return{element_attribute_ignorelist:null!==(e=null==t?void 0:t.element_attribute_ignorelist)&&void 0!==e?e:c.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==t?void 0:t.scroll_threshold_ms)&&void 0!==i?i:c.scroll_threshold_ms,selection_change_threshold_ms:null!==(n=null==t?void 0:t.selection_change_threshold_ms)&&void 0!==n?n:c.selection_change_threshold_ms,mutation_threshold_ms:null!==(s=null==t?void 0:t.mutation_threshold_ms)&&void 0!==s?s:c.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==t?void 0:t.capture_clicks_with_modifier_keys)&&void 0!==r?r:c.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==t?void 0:t.capture_dead_swipes)&&void 0!==o?o:c.capture_dead_swipes,swipe_threshold_px:null!==(u=null==t?void 0:t.swipe_threshold_px)&&void 0!==u?u:c.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==t?void 0:t.max_dead_swipes_per_page_load)&&void 0!==l?l:c.max_dead_swipes_per_page_load,css_selector_ignorelist:null==t?void 0:t.css_selector_ignorelist,__onCapture:c.__onCapture}}constructor(t,e){this.instance=t,this.dr=!1,this.hr=[],this.vr=0,this.ur=t=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:t}),this.pr=()=>{clearTimeout(this.mr),this.mr=void 0,this.gr=void 0},this.yr=t=>{if(this.pr(),0===t.button){const e={path:t.composedPath(),trusted:t.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},n=null==i?void 0:i.getSelection();e.selectionInitiallyRelated="Range"===(null==n?void 0:n.type)&&this.br(n,e),this.gr=e}},this.wr=t=>{v(t.relatedTarget)&&this.pr()},this.kr=t=>{const e=this.gr,i=t;if(!e||0!==i.button||t.isTrusted!==e.trusted)return;const n=t.composedPath();for(const t of e.path)if(D(t)&&-1!==n.indexOf(t)){e.clickTarget=t;break}e.clickDetail=i.detail,this.mr=s.setTimeout(this.pr,0)},this._r=t=>{const e=t,i=ct(e,{type:"click"}),n=this.gr;i&&n&&0===e.button&&e.detail>0&&e.detail===n.clickDetail&&t.isTrusted===n.trusted&&i.node===n.clickTarget&&(i.selectionChangedDuringGesture=n.selectionChanged&&this.Sr.selection_change_threshold_ms>0,this.pr()),v(i)||this.Cr(i)||this.Mr(i),this.Ir()},this.Tr=()=>{const t=Date.now();this.Rr=t,t%50==0&&this.hr.forEach(e=>{d(e.scrollDelayMs)&&(e.scrollDelayMs=t-e.timestamp)})},this.$r=t=>{var e,n;const s=null==i?void 0:i.getSelection(),r=this.dr;this.dr="Range"===(null==s?void 0:s.type);const o=null==s?void 0:s.focusNode,u=o&&(D(o)?o:o.parentElement),l=null==i?void 0:i.activeElement;let c=l;for(;null==c||null===(e=c.shadowRoot)||void 0===e?void 0:e.activeElement;)c=c.shadowRoot.activeElement;const a=F(I(t))||F(null!=u?u:null)||F(null!==(n=c)&&void 0!==n?n:null),h="Caret"===(null==s?void 0:s.type)&&c&&!c.shadowRoot&&o&&o!==l&&o.contains(null!=l?l:null);if(!(r||this.dr||a||h))return;const f=Date.now();this.Er=f;const v=this.gr;if(v&&(r||this.dr||a)){const e=I(t);let i;if(F(e))i=e;else if("Caret"===(null==s?void 0:s.type)){var _;F(null!==(_=c)&&void 0!==_?_:null)||h?i=c:a&&(i=u)}const n=i?this.Ar(i,v):s&&(o||s.anchorNode)?this.br(s,v):r&&!this.dr&&v.selectionInitiallyRelated;v.selectionChanged=v.selectionChanged||n}this.hr.forEach(t=>{const e=f-t.timestamp;0>e||!d(t.selectionChangedDelayMs)&&e>=t.selectionChangedDelayMs||(t.selectionChangedDelayMs=e)})},this.an=()=>{"hidden"===(null==i?void 0:i.visibilityState)&&this.pr();const t=Date.now();this.Or=t,this.Lr("visibilityChangedDelayMs",t)},this.Pr=()=>{const t=Date.now();this.Dr=t,this.Lr("focusChangedDelayMs",t)},this.Fr=t=>{const e=t.touches,i=1===(null==e?void 0:e.length)?e[0]:void 0;this.Nr=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this.qr=()=>{this.Nr=void 0},this.jr=t=>{var e;const n=this.Nr;if(this.Nr=void 0,d(n)||this.vr>=this.Sr.max_dead_swipes_per_page_load)return;const s=t,r=null===(e=s.changedTouches)||void 0===e?void 0:e[0];if(!r)return;const o=r.clientX-n.x,u=r.clientY-n.y,l=o*o+u*u,c=this.Sr.swipe_threshold_px;if(c*c>l)return;if([this.Rr,this.Br,this.Er].some(t=>p(t)&&t>=n.timestamp))return;var a,h;if(this.Hr()&&(null!==(a=null==i||null===(h=i.elementsFromPoint)||void 0===h?void 0:h.call(i,n.x,n.y))&&void 0!==a?a:[]).some(t=>{var e;return null===(e=t.matches)||void 0===e?void 0:e.call(t,dt)}))return;const f=ct(s,{type:"swipe",swipeDirection:at(o,u),swipeDistancePx:Math.round(Math.sqrt(l))});v(f)||this.Cr(f)||this.Mr(f),this.Ir()},this.Sr=this.lr(e),this._onCapture=this.Sr.__onCapture}start(t){this.Ur(),this.zr(),this.Wr(),this.Vr(),this.Zr(),this.Gr(t),this.Sr.capture_dead_swipes&&this.Qr()}Gr(e){if(!this.Jr){const i=function(e){return function(e,i){const n=lt[e];if(n)return n;let s=i[e];if(h(o=s)&&-1!==o.toString().indexOf("[native code]")&&!(null==t?void 0:t.Zone))return lt[e]=s.bind(i);var o;const u=i.document;if(u&&h(u.createElement)){let t,n=!1;try{t=u.createElement("iframe"),t.hidden=!0,u.head.appendChild(t);const o=t.contentWindow;var l,c;o&&o[e]&&(s=o[e],"MutationObserver"===e&&r(a=null!==(l=null===(c=i.navigator)||void 0===c?void 0:c.userAgent)&&void 0!==l?l:"","AppleWebKit")&&!r(a,"Chrome")&&(t.classList.add("rr-block","ph-no-capture"),n=!0))}catch(t){C.warn(`Could not create sandbox iframe for ${e} check, bailing to assignableWindow.${e}: `,t)}finally{!n&&(null==t?void 0:t.parentNode)&&t.parentNode.removeChild(t)}}var a;return s&&h(s)?lt[e]=s.bind(i):s}("MutationObserver",e)}(s);this.Jr=new i(t=>{this.Kr(t)}),this.Jr.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var t;null===(t=this.Jr)||void 0===t||t.disconnect(),this.Jr=void 0,s.removeEventListener("click",this._r),s.removeEventListener("mousedown",this.yr,{capture:!0}),s.removeEventListener("mouseup",this.kr,{capture:!0}),s.removeEventListener("mouseout",this.wr,{capture:!0}),s.removeEventListener("dragstart",this.pr,{capture:!0}),s.removeEventListener("pointercancel",this.pr,{capture:!0}),s.removeEventListener("blur",this.pr),this.pr(),s.removeEventListener("scroll",this.Tr,{capture:!0}),null==i||i.removeEventListener("selectionchange",this.$r),s.removeEventListener("touchstart",this.Fr,{capture:!0}),s.removeEventListener("touchend",this.jr,{capture:!0}),s.removeEventListener("touchcancel",this.qr,{capture:!0}),null==i||i.removeEventListener("visibilitychange",this.an),s.removeEventListener("blur",this.Pr),s.removeEventListener("focus",this.Pr),this.Nr=void 0}Kr(t){this.Br=Date.now()}Ur(){S(s,"click",this._r),S(s,"mousedown",this.yr,{capture:!0}),S(s,"mouseup",this.kr,{capture:!0}),S(s,"mouseout",this.wr,{capture:!0}),S(s,"dragstart",this.pr,{capture:!0}),S(s,"pointercancel",this.pr,{capture:!0}),S(s,"blur",this.pr)}Mr(t){t.selectionChangedDelayMs=_t(t.timestamp,this.Er,this.Sr.selection_change_threshold_ms),t.visibilityChangedDelayMs=_t(t.timestamp,this.Or),t.focusChangedDelayMs=_t(t.timestamp,this.Dr),this.hr.push(t)}Ir(){this.hr.length&&d(this.Xr)&&(this.Xr=s.setTimeout(()=>{this.Yr()},1e3))}zr(){S(s,"scroll",this.Tr,{capture:!0})}Wr(){var t;this.dr="Range"===(null==i||null===(t=i.getSelection())||void 0===t?void 0:t.type),S(i,"selectionchange",this.$r)}Ar(t,e){const i=e.path[0];for(;t;){if(-1!==e.path.indexOf(t)||D(i)&&i.contains(t))return!0;t=t.getRootNode().host}return!1}br(t,e){const i=e.path[0],n=t.rangeCount>0?t.getRangeAt(0):void 0;if(n&&D(i)&&n.startContainer.getRootNode()===i.getRootNode()){var s;if(!n.collapsed)return n.intersectsNode(i);const t=D(n.startContainer)&&null!==(s=n.startContainer.childNodes[n.startOffset])&&void 0!==s?s:n.startContainer;return this.Ar(t,e)}return this.Ar(t.focusNode,e)||this.Ar(t.anchorNode,e)}Vr(){S(i,"visibilitychange",this.an)}Zr(){S(s,"blur",this.Pr),S(s,"focus",this.Pr)}Lr(t,e){this.hr.forEach(i=>{const n=vt(e-i.timestamp);p(n)&&(d(i[t])||i[t]>n)&&(i[t]=n)})}Qr(){S(s,"touchstart",this.Fr,{capture:!0,passive:!0}),S(s,"touchend",this.jr,{capture:!0,passive:!0}),S(s,"touchcancel",this.qr,{capture:!0,passive:!0})}Hr(){const t=d(this.eo)||p(this.Br)&&this.Br>this.eo;return(d(this.no)||t)&&(this.eo=Date.now(),this.no=!!(null==i?void 0:i.querySelector(dt))),!!this.no}Cr(t){return!t||("swipe"===t.type?this.io(t):this.ro(t))}io(e){return!((!((i=e.node)instanceof Element)||"__POSTHOG_TOOLBAR__"!==i.id&&!(null===(n=i.closest)||void 0===n?void 0:n.call(i,".toolbar-global-fade-container")))&&!this.hr.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!E(e.node,"html")&&D(e.node)&&function(e,i){var n;if(!t||G(e))return!1;const s="[object Boolean]"===c.call(i)?U:null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:U,{targetElementList:r}=W(e,!1);return!function(t,e){if(d(e))return!0;for(const i of t)if(e.some(t=>H(i,t)))return!0;return!1}(r,s)}(e.node,{css_selector_ignorelist:this.Sr.css_selector_ignorelist}));var i,n}ro(e){return!(this.Sr.capture_clicks_with_modifier_keys||(i=e.originalEvent,!(i.ctrlKey||i.metaKey||i.altKey||i.shiftKey)))||!!this.io(e)||function(e){if(!t||G(e))return!1;const{targetElementList:i}=W(e,!1);return i.some(t=>E(t,"a"))}(e.node);var i}Yr(){if(!this.hr.length)return;clearTimeout(this.Xr),this.Xr=void 0;const t=this.hr;this.hr=[];for(const i of t){var e;i.mutationDelayMs=null!==(e=i.mutationDelayMs)&&void 0!==e?e:this.Br&&this.Br>=i.timestamp?this.Br-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const t=ft(i.scrollDelayMs,this.Sr.scroll_threshold_ms),n=ft(i.selectionChangedDelayMs,this.Sr.selection_change_threshold_ms),s=ft(i.mutationDelayMs,this.Sr.mutation_threshold_ms),r=ft(i.absoluteDelayMs,1.1*this.Sr.mutation_threshold_ms),o=p(i.scrollDelayMs)&&this.Sr.scroll_threshold_ms>i.scrollDelayMs,u=p(i.mutationDelayMs)&&this.Sr.mutation_threshold_ms>i.mutationDelayMs,l=i.selectionChangedDuringGesture||p(i.selectionChangedDelayMs)&&this.Sr.selection_change_threshold_ms>i.selectionChangedDelayMs,c=p(i.visibilityChangedDelayMs),a=p(i.focusChangedDelayMs);if(!(o||u||l||c||a))if(t||s||r||n){const e=ht(i);if("$dead_swipe"===e){if(this.vr>=this.Sr.max_dead_swipes_per_page_load)continue;this.vr++}this._onCapture(i,{[`${e}_last_mutation_timestamp`]:this.Br,[`${e}_event_timestamp`]:i.timestamp,[`${e}_scroll_timeout`]:t,[`${e}_mutation_timeout`]:s,[`${e}_absolute_timeout`]:r,[`${e}_selection_changed_timeout`]:n,[`${e}_visibility_changed_timeout`]:!1})}else this.Sr.mutation_threshold_ms>i.absoluteDelayMs&&this.hr.push(i)}this.Ir()}cr(t,e){const i=ht(t);this.instance.capture(i,w(w(w({},e),ut(t.node,{e:t.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Sr.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:t.scrollDelayMs,[`${i}_mutation_delay_ms`]:t.mutationDelayMs,[`${i}_absolute_delay_ms`]:t.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:t.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:t.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:t.focusChangedDelayMs,$dead_swipe_direction:t.swipeDirection,$dead_swipe_distance_px:t.swipeDistancePx}),{timestamp:new Date(t.timestamp)})}};s.__PosthogExtensions__=s.__PosthogExtensions__||{},s.__PosthogExtensions__.initDeadClicksAutocapture=(t,e)=>new pt(t,e)}();
|
|
1
|
+
!function(){const t="u">typeof window?window:void 0,e="u">typeof globalThis?globalThis:t,i=null==e?void 0:e.document;null!=e&&e.XMLHttpRequest&&new e.XMLHttpRequest;const n="undefined"!=typeof globalThis?globalThis:t;n&&"undefined"==typeof self&&(n.self=n),n&&"undefined"==typeof File&&(n.File=function(){});const s=null!=t?t:{};function r(t,e){return-1!==t.indexOf(e)}const o=function(t){return t.trim()},u=Object.prototype,l=u.hasOwnProperty,c=u.toString,a=Array.isArray||function(t){return"[object Array]"===c.call(t)},h=t=>"function"==typeof t,d=t=>void 0===t,f=t=>"[object String]"==c.call(t),v=t=>null===t,_=t=>d(t)||v(t),p=t=>"[object Number]"==c.call(t)&&t==t;function b(t){return t?t.split("#")[0]:t}function m(t){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},m(t)}function g(t,e,i){return(e=function(t){var e=function(t){if("object"!=m(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=m(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==m(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function y(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function w(t){for(var e=1;arguments.length>e;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?y(Object(i),!0).forEach(function(e){g(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):y(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}const k=(e,{debugEnabled:i}={})=>{const n={N(n,...s){t&&(t.POSTHOG_DEBUG||i)&&!d(t.console)&&t.console&&("__rrweb_original__"in t.console[n]?t.console[n].__rrweb_original__:t.console[n])(e,...s)},debug(...t){n.N("debug",...t)},info(...t){n.N("log",...t)},warn(...t){n.N("warn",...t)},error(...t){n.N("error",...t)},critical(...t){console.error(e,...t)},uninitializedWarning(t){n.error(`You must initialize PostHog before calling ${t}`)},createLogger:(t,i)=>k(`${e} ${t}`,i)};return n},C=k("[PostHog.js]"),O=C.createLogger;function x(t,e){if(!_(t))if(a(t))t.forEach(e);else if(t instanceof FormData)t.forEach((t,i)=>e(t,i));else for(const i in t)l.call(t,i)&&e(t[i],i)}const j=function(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&(t[e]=i[e]);return t};function A(t){const e=Object.keys(t);let i=e.length;const n=new Array(i);for(;i--;)n[i]=[e[i],t[e[i]]];return n}function S(t,e,i,n){const{capture:s=!1,passive:r=!0}=null!=n?n:{};null==t||t.addEventListener(e,i,{capture:s,passive:r})}function D(t){return!!t&&1===t.nodeType}function E(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function T(t){return!!t&&11===t.nodeType&&D(t.host)}function M(t){return t?o(t).split(/\s+/):[]}function L(t){let e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return M(e)}function R(t){let e="";return q(t)&&!B(t)&&t.childNodes&&t.childNodes.length&&x(t.childNodes,function(t){var i,n;(function(t){return!!t&&3===t.nodeType})(t)&&t.textContent&&(e+=null!==(i=_(n=t.textContent)?null:o(n).split(/(\s+)/).filter(t=>tt(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))&&void 0!==i?i:"")}),o(e)}function I(t){var e;return d(t.target)?t.srcElement||null:(null===(e=t.target)||void 0===e?void 0:e.shadowRoot)?t.composedPath()[0]||null:t.target||null}const z=["a","button","form","input","select","textarea","label"];function H(t,e){const i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}function P(t){const e=t.parentNode;return!(!e||!D(e))&&e}const U=[".ph-no-deadclick",".ph-no-capture"];const Z=["","text","search","email","password","url","tel","number"];function F(t){return!(!t||!D(t))&&(!!E(t,"textarea")||(E(t,"input")?r(Z,(t.getAttribute("type")||"").toLowerCase()):function(t){var e;if(t.isContentEditable)return!0;const i=null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return"true"===i||""===i}(t)))}const G=t=>!t||E(t,"html")||!D(t),W=(e,i)=>{if(!t||G(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const s=[e];let r=e;for(;r.parentNode&&!E(r,"body");){if(T(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const e=P(r);if(!e)break;if(i||z.indexOf(e.tagName.toLowerCase())>-1)n=!0;else try{const i=t.getComputedStyle(e);i&&"pointer"===i.getPropertyValue("cursor")&&(n=!0)}catch(t){}s.push(e),r=e}return{parentIsUsefulElement:n,targetElementList:s}};function q(t){const e=new Set;let i=0;for(let n=t;n.parentNode&&!E(n,"body");n=n.parentNode){if(i++>=1e3||e.has(n))return!1;e.add(n);const t=L(n);if(r(t,"ph-sensitive")||r(t,"ph-no-capture"))return!1}if(r(L(t),"ph-include"))return!0;const n=t.type||"";if(f(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}const s=t.name||t.id||"";return!f(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function B(t){return!!(E(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||E(t,"select")||E(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const N=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),V=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,K=[16,15,14,13],Y=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),J=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Q=/[0-9A-Za-z_]/;function X(t){let e=0,i=!1;for(let n=t.length-1;n>=0;n--){let s=t.charCodeAt(n)-48;i&&(s*=2,s>9&&(s-=9)),e+=s,i=!i}return e%10==0}function tt(t,e=!0){if(_(t))return!1;if(f(t)){if(t=o(t),e?N.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(V.lastIndex=0;e=V.exec(t);){const t=e[2];if(!t)continue;const i=t.replace(/[- ]/g,"");for(let t=0;i.length>t;t++)for(const e of K){const n=t+e;if(i.length>=n){const e=i.slice(t,n);if(N.test(e)&&X(e))return!0}}}return!1}(t))return!1;if(e?Y.test(t):function(t){let e;for(J.lastIndex=0;e=J.exec(t);){const t=e[1],i=e[3];if(!(t&&i&&Q.test(t)&&Q.test(i)))return!0}return!1}(t))return!1}return!0}function et(t){let e=R(t);return e=`${e} ${it(t)}`.trim(),tt(e)?e:""}function it(t){let e="";return t&&t.childNodes&&t.childNodes.length&&x(t.childNodes,function(t){var i;if(t&&"span"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=R(t);e=`${e} ${i}`.trim(),t.childNodes&&t.childNodes.length&&(e=`${e} ${it(t)}`.trim())}catch(t){C.error("[AutoCapture]",t)}}),e}function nt(t){return t.replace(/"|\\"/g,'\\"')}function st(t){const e=t.attr__class;if(e)return a(e)?e:M(e)}function rt(t,e){return e.length>t?e.slice(0,t)+"...":e}function ot(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do{e=e.previousSibling}while(e&&!D(e));return e}function ut(e,{e:n,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:u,elementsChainAsString:l,disableCaptureUrlHashes:c}){var h,v;if(!D(e))return{props:{}};const _=[e],p=new Set([e]);let m=e;for(;m.parentNode&&!E(m,"body")&&1e3>_.length;){if(T(m.parentNode)){const t=m.parentNode.host;if(p.has(t))break;p.add(t),_.push(t),m=t;continue}if(!D(m.parentNode))break;if(p.has(m.parentNode))break;p.add(m.parentNode),_.push(m.parentNode),m=m.parentNode}const g="click"===n.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?_.findIndex(t=>E(t,"button")||E(t,"a")):-1;g>0&&(o=o||_.slice(0,g+1).some(t=>!q(t)||B(t)));const y=[],k={};let C,O=!1,S=!1;if(x(_,t=>{const e=q(t);if(E(t,"a")){const i=t.getAttribute("href");O=!!(e&&i&&tt(i))&&(c?b(i):i)}r(L(t),"ph-no-capture")&&(S=!0),y.push(function(t,e,i,n,s=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};z.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?rt(1024,et(t)):rt(1024,R(t)));const u=L(t);u.length>0&&(o.classes=u.filter(function(t){return""!==t})),x(t.attributes,function(i){var r;if((!B(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!e&&tt(i.value)&&(!f(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=i.value;"class"===i.name&&(t=M(t).join(" ")),o["attr__"+i.name]=rt(1024,"href"===i.name&&s?b(t):t)}});let l=1,c=1,a=t;for(;a=ot(a);)l++,a.tagName===t.tagName&&c++;return o.nth_child=l,o.nth_of_type=c,o}(t,s,o,u,c)),x(function(t){if(!q(t))return{};const e={};return x(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const i=t.name.replace("data-ph-capture-attribute-",""),n=t.value;i&&n&&tt(n)&&(e[i]=n)}}),e}(t),(t,e)=>{({}).hasOwnProperty.call(k,e)||(k[e]=t)})}),S)return{props:{},explicitNoCapture:S};if(g>0&&(e=_[g],y.splice(0,g)),o||(y[0].$el_text=E(e,"a")||E(e,"button")?et(e):R(e)),O){var I,H;y[0].attr__href=O;const e=null===(I=(t=>{const e=null==i?void 0:i.createElement("a");return d(e)?null:(e.href=t,e)})(O))||void 0===I?void 0:I.host,n=null==t||null===(H=t.location)||void 0===H?void 0:H.host;e&&n&&e!==n&&(C=O)}return{props:j((U=n.type,{$event_type:U,$ce_version:1}),l?{}:{$elements:y},{$elements_chain:(P=y,a(P)?function(t){return t.map(t=>{var e,i;let n="";if(t.tag_name&&(n+=t.tag_name),t.attr_class){t.attr_class.sort();for(const e of t.attr_class)n+=`.${e.replace(/"/g,"")}`}const s=w(w(w(w({},t.text?{text:t.text}:{}),{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{}),t.attr_id?{attr_id:t.attr_id}:{}),t.attributes),r={};return A(s).sort(([t],[e])=>function(t,e){return e>t?-1:t>e?1:0}(t,e)).forEach(([t,e])=>r[nt(t.toString())]=nt(e.toString())),n+=":",n+=A(r).map(([t,e])=>`${t}="${e}"`).join(""),n}).join(";")}(function(t){return t.map(t=>{var e,i;const n={text:null===(e=t.$el_text)||void 0===e?void 0:e.slice(0,400),tag_name:t.tag_name,href:null===(i=t.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:st(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return A(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,e])=>n.attributes[t]=e),n})}(P)):"")},(null===(h=y[0])||void 0===h?void 0:h.$el_text)?{$el_text:null===(v=y[0])||void 0===v?void 0:v.$el_text}:{},C&&"click"===n.type?{$external_click_url:C}:{},k),target:e};var P,U}O("[AutoCapture]");const lt={};function ct(t,e){const i=I(t);return i?w({node:i,originalEvent:t,timestamp:Date.now()},e):null}function at(t,e){return Math.abs(t)<Math.abs(e)?0>e?"up":"down":0>t?"left":"right"}function ht(t){return"swipe"===t.type?"$dead_swipe":"$dead_click"}const dt="canvas,video,audio,embed,object";function ft(t,e){return p(t)&&t>=e}function vt(t,e=1e3){return t>=0&&e>t?t:void 0}function _t(t,e,i=1e3){return p(e)?vt(t-e,i):void 0}var pt=class{cr(t){var e,i,n,s,r,o,u,l;const c=this.dr((null==t?void 0:t.__onCapture)||this.hr.bind(this));return{element_attribute_ignorelist:null!==(e=null==t?void 0:t.element_attribute_ignorelist)&&void 0!==e?e:c.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==t?void 0:t.scroll_threshold_ms)&&void 0!==i?i:c.scroll_threshold_ms,selection_change_threshold_ms:null!==(n=null==t?void 0:t.selection_change_threshold_ms)&&void 0!==n?n:c.selection_change_threshold_ms,mutation_threshold_ms:null!==(s=null==t?void 0:t.mutation_threshold_ms)&&void 0!==s?s:c.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==t?void 0:t.capture_clicks_with_modifier_keys)&&void 0!==r?r:c.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==t?void 0:t.capture_dead_swipes)&&void 0!==o?o:c.capture_dead_swipes,swipe_threshold_px:null!==(u=null==t?void 0:t.swipe_threshold_px)&&void 0!==u?u:c.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==t?void 0:t.max_dead_swipes_per_page_load)&&void 0!==l?l:c.max_dead_swipes_per_page_load,css_selector_ignorelist:null==t?void 0:t.css_selector_ignorelist,__onCapture:c.__onCapture}}constructor(t,e){this.instance=t,this.vr=!1,this.pr=[],this.mr=0,this.dr=t=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:t}),this.gr=()=>{clearTimeout(this.yr),this.yr=void 0,this.br=void 0},this.wr=t=>{if(this.gr(),0===t.button){const e={path:t.composedPath(),trusted:t.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},n=null==i?void 0:i.getSelection();e.selectionInitiallyRelated="Range"===(null==n?void 0:n.type)&&this.kr(n,e),this.br=e}},this._r=t=>{v(t.relatedTarget)&&this.gr()},this.Sr=t=>{const e=this.br,i=t;if(!e||0!==i.button||t.isTrusted!==e.trusted)return;const n=t.composedPath();for(const t of e.path)if(D(t)&&-1!==n.indexOf(t)){e.clickTarget=t;break}e.clickDetail=i.detail,this.yr=s.setTimeout(this.gr,0)},this.Cr=t=>{const e=t,i=ct(e,{type:"click"}),n=this.br;i&&n&&0===e.button&&e.detail>0&&e.detail===n.clickDetail&&t.isTrusted===n.trusted&&i.node===n.clickTarget&&(i.selectionChangedDuringGesture=n.selectionChanged&&this.Mr.selection_change_threshold_ms>0,this.gr()),v(i)||this.Ir(i)||this.Tr(i),this.Rr()},this.$r=()=>{const t=Date.now();this.Er=t,t%50==0&&this.pr.forEach(e=>{d(e.scrollDelayMs)&&(e.scrollDelayMs=t-e.timestamp)})},this.Ar=t=>{var e,n;const s=null==i?void 0:i.getSelection(),r=this.vr;this.vr="Range"===(null==s?void 0:s.type);const o=null==s?void 0:s.focusNode,u=o&&(D(o)?o:o.parentElement),l=null==i?void 0:i.activeElement;let c=l;for(;null==c||null===(e=c.shadowRoot)||void 0===e?void 0:e.activeElement;)c=c.shadowRoot.activeElement;const a=F(I(t))||F(null!=u?u:null)||F(null!==(n=c)&&void 0!==n?n:null),h="Caret"===(null==s?void 0:s.type)&&c&&!c.shadowRoot&&o&&o!==l&&o.contains(null!=l?l:null);if(!(r||this.vr||a||h))return;const f=Date.now();this.Or=f;const v=this.br;if(v&&(r||this.vr||a)){const e=I(t);let i;if(F(e))i=e;else if("Caret"===(null==s?void 0:s.type)){var _;F(null!==(_=c)&&void 0!==_?_:null)||h?i=c:a&&(i=u)}const n=i?this.Lr(i,v):s&&(o||s.anchorNode)?this.kr(s,v):r&&!this.vr&&v.selectionInitiallyRelated;v.selectionChanged=v.selectionChanged||n}this.pr.forEach(t=>{const e=f-t.timestamp;0>e||!d(t.selectionChangedDelayMs)&&e>=t.selectionChangedDelayMs||(t.selectionChangedDelayMs=e)})},this.an=()=>{"hidden"===(null==i?void 0:i.visibilityState)&&this.gr();const t=Date.now();this.Pr=t,this.Dr("visibilityChangedDelayMs",t)},this.Fr=()=>{const t=Date.now();this.Nr=t,this.Dr("focusChangedDelayMs",t)},this.qr=t=>{const e=t.touches,i=1===(null==e?void 0:e.length)?e[0]:void 0;this.jr=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this.Br=()=>{this.jr=void 0},this.Hr=t=>{var e;const n=this.jr;if(this.jr=void 0,d(n)||this.mr>=this.Mr.max_dead_swipes_per_page_load)return;const s=t,r=null===(e=s.changedTouches)||void 0===e?void 0:e[0];if(!r)return;const o=r.clientX-n.x,u=r.clientY-n.y,l=o*o+u*u,c=this.Mr.swipe_threshold_px;if(c*c>l)return;if([this.Er,this.Ur,this.Or].some(t=>p(t)&&t>=n.timestamp))return;var a,h;if(this.zr()&&(null!==(a=null==i||null===(h=i.elementsFromPoint)||void 0===h?void 0:h.call(i,n.x,n.y))&&void 0!==a?a:[]).some(t=>{var e;return null===(e=t.matches)||void 0===e?void 0:e.call(t,dt)}))return;const f=ct(s,{type:"swipe",swipeDirection:at(o,u),swipeDistancePx:Math.round(Math.sqrt(l))});v(f)||this.Ir(f)||this.Tr(f),this.Rr()},this.Mr=this.cr(e),this._onCapture=this.Mr.__onCapture}start(t){this.Wr(),this.Vr(),this.Zr(),this.Gr(),this.Qr(),this.Jr(t),this.Mr.capture_dead_swipes&&this.Kr()}Jr(e){if(!this.Xr){const i=function(e){return function(e,i){const n=lt[e];if(n)return n;let s=i[e];if(h(o=s)&&-1!==o.toString().indexOf("[native code]")&&!(null==t?void 0:t.Zone))return lt[e]=s.bind(i);var o;const u=i.document;if(u&&h(u.createElement)){let t,n=!1;try{t=u.createElement("iframe"),t.hidden=!0,u.head.appendChild(t);const o=t.contentWindow;var l,c;o&&o[e]&&(s=o[e],"MutationObserver"===e&&r(a=null!==(l=null===(c=i.navigator)||void 0===c?void 0:c.userAgent)&&void 0!==l?l:"","AppleWebKit")&&!r(a,"Chrome")&&(t.classList.add("rr-block","ph-no-capture"),n=!0))}catch(t){C.warn(`Could not create sandbox iframe for ${e} check, bailing to assignableWindow.${e}: `,t)}finally{!n&&(null==t?void 0:t.parentNode)&&t.parentNode.removeChild(t)}}var a;return s&&h(s)?lt[e]=s.bind(i):s}("MutationObserver",e)}(s);this.Xr=new i(t=>{this.Yr(t)}),this.Xr.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var t;null===(t=this.Xr)||void 0===t||t.disconnect(),this.Xr=void 0,s.removeEventListener("click",this.Cr),s.removeEventListener("mousedown",this.wr,{capture:!0}),s.removeEventListener("mouseup",this.Sr,{capture:!0}),s.removeEventListener("mouseout",this._r,{capture:!0}),s.removeEventListener("dragstart",this.gr,{capture:!0}),s.removeEventListener("pointercancel",this.gr,{capture:!0}),s.removeEventListener("blur",this.gr),this.gr(),s.removeEventListener("scroll",this.$r,{capture:!0}),null==i||i.removeEventListener("selectionchange",this.Ar),s.removeEventListener("touchstart",this.qr,{capture:!0}),s.removeEventListener("touchend",this.Hr,{capture:!0}),s.removeEventListener("touchcancel",this.Br,{capture:!0}),null==i||i.removeEventListener("visibilitychange",this.an),s.removeEventListener("blur",this.Fr),s.removeEventListener("focus",this.Fr),this.jr=void 0}Yr(t){this.Ur=Date.now()}Wr(){S(s,"click",this.Cr),S(s,"mousedown",this.wr,{capture:!0}),S(s,"mouseup",this.Sr,{capture:!0}),S(s,"mouseout",this._r,{capture:!0}),S(s,"dragstart",this.gr,{capture:!0}),S(s,"pointercancel",this.gr,{capture:!0}),S(s,"blur",this.gr)}Tr(t){t.selectionChangedDelayMs=_t(t.timestamp,this.Or,this.Mr.selection_change_threshold_ms),t.visibilityChangedDelayMs=_t(t.timestamp,this.Pr),t.focusChangedDelayMs=_t(t.timestamp,this.Nr),this.pr.push(t)}Rr(){this.pr.length&&d(this.eo)&&(this.eo=s.setTimeout(()=>{this.no()},1e3))}Vr(){S(s,"scroll",this.$r,{capture:!0})}Zr(){var t;this.vr="Range"===(null==i||null===(t=i.getSelection())||void 0===t?void 0:t.type),S(i,"selectionchange",this.Ar)}Lr(t,e){const i=e.path[0];for(;t;){if(-1!==e.path.indexOf(t)||D(i)&&i.contains(t))return!0;t=t.getRootNode().host}return!1}kr(t,e){const i=e.path[0],n=t.rangeCount>0?t.getRangeAt(0):void 0;if(n&&D(i)&&n.startContainer.getRootNode()===i.getRootNode()){var s;if(!n.collapsed)return n.intersectsNode(i);const t=D(n.startContainer)&&null!==(s=n.startContainer.childNodes[n.startOffset])&&void 0!==s?s:n.startContainer;return this.Lr(t,e)}return this.Lr(t.focusNode,e)||this.Lr(t.anchorNode,e)}Gr(){S(i,"visibilitychange",this.an)}Qr(){S(s,"blur",this.Fr),S(s,"focus",this.Fr)}Dr(t,e){this.pr.forEach(i=>{const n=vt(e-i.timestamp);p(n)&&(d(i[t])||i[t]>n)&&(i[t]=n)})}Kr(){S(s,"touchstart",this.qr,{capture:!0,passive:!0}),S(s,"touchend",this.Hr,{capture:!0,passive:!0}),S(s,"touchcancel",this.Br,{capture:!0,passive:!0})}zr(){const t=d(this.io)||p(this.Ur)&&this.Ur>this.io;return(d(this.ro)||t)&&(this.io=Date.now(),this.ro=!!(null==i?void 0:i.querySelector(dt))),!!this.ro}Ir(t){return!t||("swipe"===t.type?this.oo(t):this.so(t))}oo(e){return!((!((i=e.node)instanceof Element)||"__POSTHOG_TOOLBAR__"!==i.id&&!(null===(n=i.closest)||void 0===n?void 0:n.call(i,".toolbar-global-fade-container")))&&!this.pr.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!E(e.node,"html")&&D(e.node)&&function(e,i){var n;if(!t||G(e))return!1;const s="[object Boolean]"===c.call(i)?U:null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:U,{targetElementList:r}=W(e,!1);return!function(t,e){if(d(e))return!0;for(const i of t)if(e.some(t=>H(i,t)))return!0;return!1}(r,s)}(e.node,{css_selector_ignorelist:this.Mr.css_selector_ignorelist}));var i,n}so(e){return!(this.Mr.capture_clicks_with_modifier_keys||(i=e.originalEvent,!(i.ctrlKey||i.metaKey||i.altKey||i.shiftKey)))||!!this.oo(e)||function(e){if(!t||G(e))return!1;const{targetElementList:i}=W(e,!1);return i.some(t=>E(t,"a"))}(e.node);var i}no(){if(!this.pr.length)return;clearTimeout(this.eo),this.eo=void 0;const t=this.pr;this.pr=[];for(const i of t){var e;i.mutationDelayMs=null!==(e=i.mutationDelayMs)&&void 0!==e?e:this.Ur&&this.Ur>=i.timestamp?this.Ur-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const t=ft(i.scrollDelayMs,this.Mr.scroll_threshold_ms),n=ft(i.selectionChangedDelayMs,this.Mr.selection_change_threshold_ms),s=ft(i.mutationDelayMs,this.Mr.mutation_threshold_ms),r=ft(i.absoluteDelayMs,1.1*this.Mr.mutation_threshold_ms),o=p(i.scrollDelayMs)&&this.Mr.scroll_threshold_ms>i.scrollDelayMs,u=p(i.mutationDelayMs)&&this.Mr.mutation_threshold_ms>i.mutationDelayMs,l=i.selectionChangedDuringGesture||p(i.selectionChangedDelayMs)&&this.Mr.selection_change_threshold_ms>i.selectionChangedDelayMs,c=p(i.visibilityChangedDelayMs),a=p(i.focusChangedDelayMs);if(!(o||u||l||c||a))if(t||s||r||n){const e=ht(i);if("$dead_swipe"===e){if(this.mr>=this.Mr.max_dead_swipes_per_page_load)continue;this.mr++}this._onCapture(i,{[`${e}_last_mutation_timestamp`]:this.Ur,[`${e}_event_timestamp`]:i.timestamp,[`${e}_scroll_timeout`]:t,[`${e}_mutation_timeout`]:s,[`${e}_absolute_timeout`]:r,[`${e}_selection_changed_timeout`]:n,[`${e}_visibility_changed_timeout`]:!1})}else this.Mr.mutation_threshold_ms>i.absoluteDelayMs&&this.pr.push(i)}this.Rr()}hr(t,e){const i=ht(t);this.instance.capture(i,w(w(w({},e),ut(t.node,{e:t.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Mr.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:t.scrollDelayMs,[`${i}_mutation_delay_ms`]:t.mutationDelayMs,[`${i}_absolute_delay_ms`]:t.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:t.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:t.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:t.focusChangedDelayMs,$dead_swipe_direction:t.swipeDirection,$dead_swipe_distance_px:t.swipeDistancePx}),{timestamp:new Date(t.timestamp)})}};s.__PosthogExtensions__=s.__PosthogExtensions__||{},s.__PosthogExtensions__.initDeadClicksAutocapture=(t,e)=>new pt(t,e)}();
|
|
2
2
|
//# sourceMappingURL=dead-clicks-autocapture.js.map
|