From 1a2c7617d2ba9eebcee2f20f74510d2dd73789bc Mon Sep 17 00:00:00 2001 From: Nikhil Sonti Date: Sun, 18 May 2025 18:05:02 +0100 Subject: [PATCH] updates to AI chat files --- files/ai_side_panel/background.js | 2 +- files/ai_side_panel/content.js | 2 +- files/ai_side_panel/sidepanel.js | 2 +- files/ai_side_panel/styles/chat.css | 157 ++-------------------------- 4 files changed, 10 insertions(+), 153 deletions(-) diff --git a/files/ai_side_panel/background.js b/files/ai_side_panel/background.js index 6def2fb9c..0bd48b8a5 100644 --- a/files/ai_side_panel/background.js +++ b/files/ai_side_panel/background.js @@ -1,2 +1,2 @@ /*! For license information please see background.js.LICENSE.txt */ -(()=>{"use strict";var t="get_page_content",e="close_panel",r="ping_content_script",n="heartbeat",o="heartbeat_ack",a="request_page_content",c="page_content_ready",i="refresh_tab_content",s="get_tabs",u="tabs_list",p="ping_content_script",l="pong_content_script",f="close_panel",h="error";const d={OPENAI_API_KEY:"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",DEV_MODE:!1};const g={debug:function(t,e,r){if(d.DEV_MODE){var n=(new Date).toISOString();"[".concat(n,"] [").concat(t,"] DEBUG: ").concat(e)}},info:function(t,e,r){if(d.DEV_MODE){var n=(new Date).toISOString();"[".concat(n,"] [").concat(t,"] INFO: ").concat(e)}},warn:function(t,e,r){var n=(new Date).toISOString();"[".concat(n,"] [").concat(t,"] WARN: ").concat(e)},error:function(t,e,r){var n=(new Date).toISOString();"[".concat(n,"] [").concat(t,"] ERROR: ").concat(e)}};function b(t){return b="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},b(t)}function m(){m=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,c=Object.create(a.prototype),i=new K(n||[]);return o(c,"_invoke",{value:R(t,r,i)}),c}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=p;var f="suspendedStart",h="suspendedYield",d="executing",g="completed",y={};function v(){}function w(){}function O(){}var E={};u(E,c,(function(){return this}));var D=Object.getPrototypeOf,N=D&&D(D(k([])));N&&N!==r&&n.call(N,c)&&(E=N);var U=O.prototype=v.prototype=Object.create(E);function A(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(o,a,c,i){var s=l(t[o],t,a);if("throw"!==s.type){var u=s.arg,p=u.value;return p&&"object"==b(p)&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,i)}),(function(t){r("throw",t,c,i)})):e.resolve(p).then((function(t){u.value=t,c(u)}),(function(t){return r("throw",t,c,i)}))}i(s.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function R(e,r,n){var o=f;return function(a,c){if(o===d)throw Error("Generator is already running");if(o===g){if("throw"===a)throw c;return{value:t,done:!0}}for(n.method=a,n.arg=c;;){var i=n.delegate;if(i){var s=x(i,n);if(s){if(s===y)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===f)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=l(e,r,n);if("normal"===u.type){if(o=n.done?g:h,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=g,n.method="throw",n.arg=u.arg)}}}function x(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,x(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=l(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var c=a.arg;return c?c.done?(r[e.resultName]=c.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):c:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function G(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function B(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function K(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(G,this),this.reset(!0)}function k(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o=0;--a){var c=this.tryEntries[a],i=c.completion;if("root"===c.tryLoc)return o("end");if(c.tryLoc<=this.prev){var s=n.call(c,"catchLoc"),u=n.call(c,"finallyLoc");if(s&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),B(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;B(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:k(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function y(t,e,r,n,o,a,c){try{var i=t[a](c),s=i.value}catch(t){return void r(t)}i.done?e(s):Promise.resolve(s).then(n,o)}function v(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function c(t){y(a,n,o,c,i,"next",t)}function i(t){y(a,n,o,c,i,"throw",t)}c(void 0)}))}}var w=null,O=!1,E=new Map,D=null;function N(t){w!==t&&(g.info("BACKGROUND","Updating lastActiveTabId from ".concat(w," to ").concat(t)),w=t)}function U(){return A.apply(this,arguments)}function A(){return(A=v(m().mark((function e(){var r,n,o;return m().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(D){e.next=3;break}return g.debug("BACKGROUND","Cannot prefetch - no port connection"),e.abrupt("return");case 3:return e.prev=3,e.next=6,new Promise((function(t){chrome.tabs.query({active:!0,currentWindow:!0},(function(e){if(chrome.runtime.lastError)return g.error("BACKGROUND","Error querying active tab:",chrome.runtime.lastError),void t([]);t(e)}))}));case 6:if((r=e.sent)&&0!==r.length){e.next=10;break}return g.debug("BACKGROUND","No active tab found for prefetching"),e.abrupt("return");case 10:if("number"==typeof(n=r[0]).id){e.next=14;break}return g.debug("BACKGROUND","Active tab has no ID, cannot prefetch"),e.abrupt("return");case 14:if(o=n.id,n.url&&n.url.startsWith("http")){e.next=18;break}return g.debug("BACKGROUND","Skipping prefetch for non-HTTP URL: ".concat(n.url)),e.abrupt("return");case 18:if(N(o),!E.has(o)){e.next=23;break}return g.debug("BACKGROUND","Content for tab ".concat(o," already in cache")),D&&D.postMessage({type:c,data:E.get(o)}),e.abrupt("return");case 23:return g.info("BACKGROUND","Prefetching content for active tab: ".concat(o)),e.next=26,x(o);case 26:chrome.tabs.sendMessage(o,{action:t},(function(t){chrome.runtime.lastError?g.error("BACKGROUND","Error prefetching page content:",chrome.runtime.lastError):t&&t.success&&(E.set(o,t.data),g.info("BACKGROUND","Successfully prefetched and cached content for tab: ".concat(o)),D&&D.postMessage({type:c,data:t.data}))})),e.next=32;break;case 29:e.prev=29,e.t0=e.catch(3),g.error("BACKGROUND","Error in prefetch function:",e.t0);case 32:case"end":return e.stop()}}),e,null,[[3,29]])})))).apply(this,arguments)}function C(t){return R.apply(this,arguments)}function R(){return(R=v(m().mark((function t(e){var r,n;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,new Promise((function(t){chrome.tabs.get(e,(function(e){chrome.runtime.lastError?t(void 0):t(e.url)}))}));case 3:if((r=t.sent)&&r.startsWith("http")){t.next=6;break}return t.abrupt("return",!1);case 6:return t.next=8,chrome.scripting.executeScript({target:{tabId:e},func:function(){return Object.prototype.hasOwnProperty.call(window,"__AI_SIDE_PANEL_LOADED")}});case 8:return n=t.sent,t.abrupt("return",!!(n&&n[0]&&n[0].result));case 12:return t.prev=12,t.t0=t.catch(0),g.error("BACKGROUND","Failed to check script injection status:",t.t0),t.abrupt("return",!1);case 16:case"end":return t.stop()}}),t,null,[[0,12]])})))).apply(this,arguments)}function x(t){return G.apply(this,arguments)}function G(){return(G=v(m().mark((function t(e){var r;return m().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,new Promise((function(t){chrome.tabs.get(e,(function(e){chrome.runtime.lastError?t(void 0):t(e.url)}))}));case 3:if((r=t.sent)&&r.startsWith("http")){t.next=7;break}return g.debug("BACKGROUND","Skipping injection for non-http URL: ".concat(r)),t.abrupt("return");case 7:return t.next=9,C(e);case 9:if(!t.sent){t.next=13;break}return g.debug("BACKGROUND","Content script already injected, skipping..."),t.abrupt("return");case 13:return t.next=15,chrome.scripting.executeScript({target:{tabId:e},files:["content.js"]});case 15:g.info("BACKGROUND","Content script successfully injected into tab",e),t.next=21;break;case 18:t.prev=18,t.t0=t.catch(0),g.error("BACKGROUND","Failed to inject content script:",t.t0);case 21:case"end":return t.stop()}}),t,null,[[0,18]])})))).apply(this,arguments)}chrome.runtime.onConnect.addListener((function(e){"side-panel-connection"===e.name&&(g.info("BACKGROUND","Side panel connected"),D=e,O=!0,U().catch((function(t){g.error("BACKGROUND","Error prefetching active tab content:",t)})),e.onMessage.addListener(function(){var d=v(m().mark((function d(b){var y,v;return m().wrap((function(d){for(;;)switch(d.prev=d.next){case 0:d.prev=0,d.t0=b.type,d.next=d.t0===n?4:d.t0===f?6:d.t0===a?9:d.t0===i?29:d.t0===s?39:d.t0===p?41:45;break;case 4:return e.postMessage({type:o}),d.abrupt("break",46);case 6:return g.info("BACKGROUND","Received close panel request from side panel"),O=!1,d.abrupt("break",46);case 9:if(b.tabId){d.next=11;break}return d.abrupt("return",e.postMessage({type:h,error:"No tab ID provided"}));case 11:if(N(b.tabId),g.info("BACKGROUND","Requesting page content for tab ".concat(b.tabId)),!E.has(b.tabId)){d.next=18;break}return g.info("BACKGROUND","Using cached content for tab: ".concat(b.tabId)),y=E.get(b.tabId),e.postMessage({type:c,data:y}),d.abrupt("return");case 18:return d.prev=18,d.next=21,x(b.tabId);case 21:chrome.tabs.sendMessage(b.tabId,{action:t},(function(t){if(chrome.runtime.lastError)return g.error("BACKGROUND","Error getting page content:",chrome.runtime.lastError),void e.postMessage({type:h,error:chrome.runtime.lastError.message||"Failed to get page content"});t&&t.success?(E.set(b.tabId,t.data),e.postMessage({type:c,data:t.data})):e.postMessage({type:h,error:(null==t?void 0:t.error)||"Failed to get page content"})})),d.next=28;break;case 24:d.prev=24,d.t1=d.catch(18),g.error("BACKGROUND","Error processing page content request:",d.t1),e.postMessage({type:h,error:d.t1 instanceof Error?d.t1.message:"Failed to get page content"});case 28:return d.abrupt("break",46);case 29:if(!b.tabId){d.next=37;break}return g.info("BACKGROUND","Refreshing content for tab ".concat(b.tabId)),E.delete(b.tabId),d.next=34,x(b.tabId);case 34:chrome.tabs.sendMessage(b.tabId,{action:t},(function(t){if(chrome.runtime.lastError)return g.error("BACKGROUND","Error refreshing page content:",chrome.runtime.lastError),void e.postMessage({type:h,error:chrome.runtime.lastError.message||"Failed to refresh page content"});t&&t.success?(E.set(b.tabId,t.data),e.postMessage({type:c,data:t.data})):e.postMessage({type:h,error:(null==t?void 0:t.error)||"Failed to refresh page content"})})),d.next=38;break;case 37:U().catch((function(t){g.error("BACKGROUND","Error refreshing active tab content:",t),e.postMessage({type:h,error:t instanceof Error?t.message:"Unknown error refreshing tab content"})}));case 38:return d.abrupt("break",46);case 39:try{chrome.tabs.query({currentWindow:!0},(function(t){if(chrome.runtime.lastError){var r=chrome.runtime.lastError.message||"Failed to get tabs";return g.error("BACKGROUND","Error getting tabs:",r),void e.postMessage({type:h,error:r})}var n=t.filter((function(t){return t.url&&t.url.startsWith("http")})).map((function(t){return{id:t.id,title:t.title||"",url:t.url||"",favIconUrl:t.favIconUrl||""}}));g.debug("BACKGROUND","Sending ".concat(n.length," tabs to sidepanel")),e.postMessage({type:u,data:n})}))}catch(t){v=t instanceof Error?t.message:"Unknown error fetching tabs",g.error("BACKGROUND","Error in get_tabs handler:",v),e.postMessage({type:h,error:v})}return d.abrupt("break",46);case 41:if(b.tabId){d.next=43;break}return d.abrupt("return",e.postMessage({type:h,error:"No tab ID provided"}));case 43:try{chrome.tabs.sendMessage(b.tabId,{action:r},(function(t){if(chrome.runtime.lastError)return g.error("BACKGROUND","Error pinging content script:",chrome.runtime.lastError),void e.postMessage({type:h,error:"Content script not available"});e.postMessage({type:l,data:t})}))}catch(t){g.error("BACKGROUND","Error in ping_content_script handler:",t),e.postMessage({type:h,error:"Content script not available"})}return d.abrupt("break",46);case 45:return d.abrupt("return",e.postMessage({type:h,error:"Unknown message type"}));case 46:d.next=52;break;case 48:d.prev=48,d.t2=d.catch(0),g.error("BACKGROUND","Error handling port message:",d.t2),e.postMessage({type:h,error:d.t2 instanceof Error?d.t2.message:"Unknown error"});case 52:case"end":return d.stop()}}),d,null,[[0,48],[18,24]])})));return function(t){return d.apply(this,arguments)}}()),e.onDisconnect.addListener((function(){g.info("BACKGROUND","Side panel disconnected"),D=null,O=!1})))})),chrome.commands.onCommand.addListener((function(t){"toggle-panel"===t&&(g.info("BACKGROUND","Toggle panel keyboard shortcut triggered"),g.info("BACKGROUND","Toggle visibility called"),g.info("BACKGROUND","Current panel state: ".concat(O?"open":"closed")),O?(g.info("BACKGROUND","Panel is open, attempting to close"),D?D.postMessage({type:f}):(chrome.runtime.sendMessage({action:e}).catch((function(t){g.info("BACKGROUND","Error sending close message: ".concat(t.message))})),O=!1)):(g.info("BACKGROUND","Panel is closed, attempting to open"),chrome.windows.getCurrent((function(t){var e=t.id;void 0!==e&&chrome.tabs.query({active:!0,currentWindow:!0},(function(t){if(t&&t.length>0&&void 0!==t[0].id)try{chrome.sidePanel.open({windowId:e,tabId:t[0].id}),O=!0,g.info("BACKGROUND","Side panel opened successfully")}catch(t){g.error("BACKGROUND","Error opening panel: ".concat(t.message))}else try{chrome.sidePanel.open({windowId:e}),O=!0,g.info("BACKGROUND","Side panel opened successfully with windowId only")}catch(t){g.error("BACKGROUND","Error opening panel: ".concat(t.message))}}))}))))})),chrome.action&&chrome.action.onClicked.addListener((function(t){t.id&&(w=t.id)}));try{chrome.sidePanel.setPanelBehavior({openPanelOnActionClick:!0})}catch(t){g.error("BACKGROUND","Error setting panel behavior:",t)}g.info("BACKGROUND","Background script initialized"),chrome.tabs&&chrome.tabs.onUpdated?chrome.tabs.onUpdated.addListener((function(t,e,r){var n;t&&"loading"===e.status&&e.url&&(g.info("BACKGROUND","Tab ".concat(t," navigating to new URL, clearing from cache")),E.delete(t)),t&&"complete"===e.status&&null!==(n=r.url)&&void 0!==n&&n.startsWith("http")&&(g.info("BACKGROUND","Tab ".concat(t," finished loading: ").concat(r.url)),x(t).catch((function(t){g.error("BACKGROUND","Error injecting content script:",t)})),r.active&&(w=t))})):g.error("BACKGROUND","chrome.tabs.onUpdated is not available"),chrome.tabs&&chrome.tabs.onActivated&&chrome.tabs.onActivated.addListener((function(t){t.tabId&&(g.info("BACKGROUND","Tab activated: ".concat(t.tabId)),w=t.tabId)})),chrome.tabs&&chrome.tabs.onRemoved&&chrome.tabs.onRemoved.addListener((function(t){g.info("BACKGROUND","Tab ".concat(t," closed, clearing from cache")),E.delete(t)}))})(); \ No newline at end of file +(()=>{"use strict";var e="get_page_content",t="close_panel",i="ping_content_script",r="heartbeat",n="heartbeat_ack",s="request_page_content",o="page_content_ready",a="refresh_tab_content",l="get_tabs",c="tabs_list",u="ping_content_script",h="pong_content_script",d="close_panel",p="posthog",g="error";const v={LITE_LLM_KEY:"sk-M6Osg4w_eRqZTgYeZAZtnQ",BASE_URL:"http://llm.nxtscape.ai",DEV_MODE:!1};const f={debug:function(e,t,i){if(v.DEV_MODE){var r=(new Date).toISOString();"[".concat(r,"] [").concat(e,"] DEBUG: ").concat(t)}},info:function(e,t,i){if(v.DEV_MODE){var r=(new Date).toISOString();"[".concat(r,"] [").concat(e,"] INFO: ").concat(t)}},warn:function(e,t,i){var r=(new Date).toISOString();"[".concat(r,"] [").concat(e,"] WARN: ").concat(t)},error:function(e,t,i){var r=(new Date).toISOString();"[".concat(r,"] [").concat(e,"] ERROR: ").concat(t)}};var _,m="undefined"!=typeof window?window:void 0,y="undefined"!=typeof globalThis?globalThis:m,b=Array.prototype,w=b.forEach,E=b.indexOf,k=null==y?void 0:y.navigator,x=null==y?void 0:y.document,S=null==y?void 0:y.location,I=null==y?void 0:y.fetch,F=null!=y&&y.XMLHttpRequest&&"withCredentials"in new y.XMLHttpRequest?y.XMLHttpRequest:void 0,R=null==y?void 0:y.AbortController,O=null==k?void 0:k.userAgent,$=null!=m?m:{},C={DEBUG:!1,LIB_VERSION:"1.242.2"},P="$copy_autocapture",M=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];!function(e){e.GZipJS="gzip-js",e.Base64="base64"}(_||(_={}));var A=["fatal","error","warning","log","info","debug"];function D(e,t){return-1!==e.indexOf(t)}var T=function(e){return e.trim()},L=function(e){return e.replace(/^\$/,"")},N=Array.isArray,B=Object.prototype,U=B.hasOwnProperty,q=B.toString,j=N||function(e){return"[object Array]"===q.call(e)},G=e=>"function"==typeof e,H=e=>e===Object(e)&&!j(e),W=e=>{if(H(e)){for(var t in e)if(U.call(e,t))return!1;return!0}return!1},K=e=>void 0===e,z=e=>"[object String]"==q.call(e),V=e=>z(e)&&0===e.trim().length,Y=e=>null===e,J=e=>K(e)||Y(e),X=e=>"[object Number]"==q.call(e),Z=e=>"[object Boolean]"===q.call(e),Q=e=>D(M,e),ee=e=>{var t={t:function(t){if(m&&(C.DEBUG||$.POSTHOG_DEBUG)&&!K(m.console)&&m.console){for(var i=("__rrweb_original__"in m.console[t]?m.console[t].__rrweb_original__:m.console[t]),r=arguments.length,n=new Array(r>1?r-1:0),s=1;s{t.error("You must initialize PostHog before calling "+e)},createLogger:t=>ee(e+" "+t)};return t},te=ee("[PostHog.js]"),ie=te.createLogger,re=ie("[ExternalScriptsLoader]"),ne=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return re.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==x?void 0:x.querySelectorAll("script");if(r)for(var n=0;n{if(!x)return i("document not found");var r=x.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=t,r.onload=e=>i(void 0,e),r.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");var n,s=x.querySelectorAll("body > script");s.length>0?null==(n=s[0].parentNode)||n.insertBefore(r,s[0]):x.body.appendChild(r)};null!=x&&x.body?s():null==x||x.addEventListener("DOMContentLoaded",s)};function se(){return se=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0||(n[i]=e[i]);return n}$.__PosthogExtensions__=$.__PosthogExtensions__||{},$.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{var r="/static/"+t+".js?v="+e.version;if("remote-config"===t&&(r="/array/"+e.config.token+"/config.js"),"toolbar"===t){var n=3e5;r=r+"&t="+Math.floor(Date.now()/n)*n}var s=e.requestRouter.endpointFor("assets",r);ne(e,s,i)},$.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var r=e.requestRouter.endpointFor("api",t);ne(e,r,i)};var ae={};function le(e,t,i){if(j(e))if(w&&e.forEach===w)e.forEach(t,i);else if("length"in e&&e.length===+e.length)for(var r=0,n=e.length;re instanceof FormData)(e)){for(var r of e.entries())if(t.call(i,r[1],r[0])===ae)return}else for(var n in e)if(U.call(e,n)&&t.call(i,e[n],n)===ae)return}}var ue=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r0||X(e))&&(t[i]=e)})),t};var fe=["herokuapp.com","vercel.app","netlify.app"];function _e(e){var t=null==e?void 0:e.hostname;if(!z(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of fe)if(i===r)return!1;return!0}function me(e,t){for(var i=0;it.match(e))))}function dt(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return ut(t)}function pt(e){return J(e)?null:T(e).split(/(\s+)/).filter((e=>It(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function gt(e){var t="";return mt(e)&&!yt(e)&&e.childNodes&&e.childNodes.length&&ce(e.childNodes,(function(e){var i;lt(e)&&e.textContent&&(t+=null!==(i=pt(e.textContent))&&void 0!==i?i:"")})),T(t)}function vt(e){return K(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var ft=["a","button","form","input","select","textarea","label"];function _t(e){var t=e.parentNode;return!(!t||!ot(t))&&t}function mt(e){for(var t=e;t.parentNode&&!at(t,"body");t=t.parentNode){var i=dt(t);if(D(i,"ph-sensitive")||D(i,"ph-no-capture"))return!1}if(D(dt(e),"ph-include"))return!0;var r=e.type||"";if(z(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var n=e.name||e.id||"";return!z(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function yt(e){return!!(at(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||at(e,"select")||at(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var bt="(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})",wt=new RegExp("^(?:"+bt+")$"),Et=new RegExp(bt),kt="\\d{3}-?\\d{2}-?\\d{4}",xt=new RegExp("^("+kt+")$"),St=new RegExp("("+kt+")");function It(e,t){if(void 0===t&&(t=!0),J(e))return!1;if(z(e)){if(e=T(e),(t?wt:Et).test((e||"").replace(/[- ]/g,"")))return!1;if((t?xt:St).test(e))return!1}return!0}function Ft(e){var t=gt(e);return It(t=(t+" "+Rt(e)).trim())?t:""}function Rt(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ce(e.childNodes,(function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var r=gt(e);t=(t+" "+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Rt(e)).trim())}catch(e){te.error("[AutoCapture]",e)}})),t}function Ot(e){return function(e){var t=e.map((e=>{var t,i,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))r+="."+n.replace(/"/g,"");var s=se({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return de(s).sort(((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)})).forEach((e=>{var[t,i]=e;return o[$t(t.toString())]=$t(i.toString())})),(r+=":")+de(o).map((e=>{var[t,i]=e;return t+'="'+i+'"'})).join("")}));return t.join(";")}(function(e){return e.map((e=>{var t,i,r={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:Ct(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return de(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,i]=e;return r.attributes[t]=i})),r}))}(e))}function $t(e){return e.replace(/"|\\"/g,'\\"')}function Ct(e){var t=e.attr__class;return t?j(t)?t:ut(t):void 0}class Pt{constructor(){this.clicks=[]}isRageClick(e,t,i){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&i-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:i}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var Mt=["localhost","127.0.0.1"],At=e=>{var t=null==x?void 0:x.createElement("a");return K(t)?null:(t.href=e,t)},Dt=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),n=0;ne?t.slice(0,e)+"...":t}function Ut(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!ot(t));return t}function qt(e,t){for(var i,r,{e:n,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=t,c=[e],u=e;u.parentNode&&!at(u,"body");)ct(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var h,d=[],p={},g=!1,v=!1;if(ce(c,(e=>{var t=mt(e);"a"===e.tagName.toLowerCase()&&(g=e.getAttribute("href"),g=t&&g&&It(g)&&g),D(dt(e),"ph-no-capture")&&(v=!0),d.push(function(e,t,i,r){var n=e.tagName.toLowerCase(),s={tag_name:n};ft.indexOf(n)>-1&&!i&&("a"===n.toLowerCase()||"button"===n.toLowerCase()?s.$el_text=Bt(1024,Ft(e)):s.$el_text=Bt(1024,gt(e)));var o=dt(e);o.length>0&&(s.classes=o.filter((function(e){return""!==e}))),ce(e.attributes,(function(i){var n;if((!yt(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!t&&It(i.value)&&(n=i.name,!z(n)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var o=i.value;"class"===i.name&&(o=ut(o).join(" ")),s["attr__"+i.name]=Bt(1024,o)}}));for(var a=1,l=1,c=e;c=Ut(c);)a++,c.tagName===e.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}(e,s,o,a));var i=function(e){if(!mt(e))return{};var t={};return ce(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),r=e.value;i&&r&&It(r)&&(t[i]=r)}})),t}(e);ue(p,i)})),v)return{props:{},explicitNoCapture:v};if(o||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?d[0].$el_text=Ft(e):d[0].$el_text=gt(e)),g){var f,_;d[0].attr__href=g;var y=null==(f=At(g))?void 0:f.host,b=null==m||null==(_=m.location)?void 0:_.host;y&&b&&y!==b&&(h=g)}return{props:ue({$event_type:n.type,$ce_version:1},l?{}:{$elements:d},{$elements_chain:Ot(d)},null!=(i=d[0])&&i.$el_text?{$el_text:null==(r=d[0])?void 0:r.$el_text}:{},h&&"click"===n.type?{$external_click_url:h}:{},p)}}class jt{constructor(e){this.i=!1,this.o=null,this.rageclicks=new Pt,this.h=!1,this.instance=e,this.m=null}get S(){var e,t,i=H(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map((e=>new RegExp(e))),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map((e=>new RegExp(e))),i}$(){if(this.isBrowserSupported()){if(m&&x){var e=e=>{e=e||(null==m?void 0:m.event);try{this.k(e)}catch(e){Nt.error("Failed to capture event",e)}};if(ye(x,"submit",e,{capture:!0}),ye(x,"change",e,{capture:!0}),ye(x,"click",e,{capture:!0}),this.S.capture_copied_text){var t=e=>{e=e||(null==m?void 0:m.event),this.k(e,P)};ye(x,"copy",t,{capture:!0}),ye(x,"cut",t,{capture:!0})}}}else Nt.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.i&&(this.$(),this.i=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.h=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ke]:!!e.autocapture_opt_out}),this.o=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.m=e}getElementSelectors(e){var t,i=[];return null==(t=this.m)||t.forEach((t=>{var r=null==x?void 0:x.querySelectorAll(t);null==r||r.forEach((r=>{e===r&&i.push(t)}))})),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[ke],r=this.o;if(Y(r)&&!Z(i)&&!this.instance.config.advanced_disable_decide)return!1;var n=null!==(t=this.o)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!n}k(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,r=vt(e);lt(r)&&(r=r.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.k(e,"$rageclick");var n=t===P;if(r&&function(e,t,i,r,n){var s,o,a;if(void 0===i&&(i=void 0),!m||!e||at(e,"html")||!ot(e))return!1;if(null!=(s=i)&&s.url_allowlist&&!ht(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&ht(i.url_ignorelist))return!1;if(null!=(a=i)&&a.dom_event_allowlist){var l=i.dom_event_allowlist;if(l&&!l.some((e=>t.type===e)))return!1}for(var c=!1,u=[e],h=!0,d=e;d.parentNode&&!at(d,"body");)if(ct(d.parentNode))u.push(d.parentNode.host),d=d.parentNode.host;else{if(!(h=_t(d)))break;if(r||ft.indexOf(h.tagName.toLowerCase())>-1)c=!0;else{var p=m.getComputedStyle(h);p&&"pointer"===p.getPropertyValue("cursor")&&(c=!0)}u.push(h),d=h}if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(K(i))return!0;var r=function(e){if(i.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var n of e){var s=r(n);if("object"==typeof s)return s.v}return!1}(u,i))return!1;if(!function(e,t){var i=null==t?void 0:t.css_selector_allowlist;if(K(i))return!0;var r=function(e){if(i.some((t=>e.matches(t))))return{v:!0}};for(var n of e){var s=r(n);if("object"==typeof s)return s.v}return!1}(u,i))return!1;var g=m.getComputedStyle(e);if(g&&"pointer"===g.getPropertyValue("cursor")&&"click"===t.type)return!0;var v=e.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return c?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(ft.indexOf(v)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this.S,n,n?["copy","cut"]:void 0)){var{props:s,explicitNoCapture:o}=qt(r,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.S.element_attribute_ignorelist,elementsChainAsString:this.h});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(s.$element_selectors=a),t===P){var l,c=pt(null==m||null==(l=m.getSelection())?void 0:l.toString()),u=e.type||"clipboard";if(!c)return!1;s.$selected_content=c,s.$copy_type=u}return this.instance.capture(t,s),!0}}}isBrowserSupported(){return G(null==x?void 0:x.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return X(e)&&isFinite(e)&&Math.floor(e)===e});var Gt="0123456789abcdef";class Ht{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||e<0||t<0||i<0||r<0||e>0xffffffffffff||t>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new Ht(n)}toString(){for(var e="",t=0;t>>4)+Gt.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Ht(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class Wt{constructor(){this.I=0,this.P=0,this.R=new Vt}generate(){var e=this.generateOrAbort();if(K(e)){this.I=0;var t=this.generateOrAbort();if(K(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.I)this.I=e,this.T();else{if(!(e+1e4>this.I))return;this.P++,this.P>4398046511103&&(this.I++,this.T())}return Ht.fromFieldsV7(this.I,Math.trunc(this.P/Math.pow(2,30)),this.P&Math.pow(2,30)-1,this.R.nextUint32())}T(){this.P=1024*this.R.nextUint32()+(1023&this.R.nextUint32())}}var Kt,zt=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;tcrypto.getRandomValues(e));class Vt{constructor(){this.M=new Uint32Array(8),this.C=1/0}nextUint32(){return this.C>=this.M.length&&(zt(this.M),this.C=0),this.M[this.C++]}}var Yt=()=>Jt().toString(),Jt=()=>(Kt||(Kt=new Wt)).generate(),Xt="",Zt=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Qt,ei={O:()=>!!x,F:function(e){te.error("cookieStore error: "+e)},A:function(e){if(x){try{for(var t=e+"=",i=x.cookie.split(";").filter((e=>e.length)),r=0;r{var t=e.match(Zt);return t?t[0]:""})(e);r!==i&&te.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(x.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+24*i*60*60*1e3),s="; expires="+l.toUTCString()}n&&(o="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&te.warn("cookieStore warning: large cookie, len="+c.length),x.cookie=c,c}catch(e){return}},L:function(e,t){try{ei.j(e,"",-1,t)}catch(e){return}}},ti=null,ii={O:function(){if(!Y(ti))return ti;var e=!0;if(K(m))e=!1;else try{var t="__mplssupport__";ii.j(t,"xyz"),'"xyz"'!==ii.A(t)&&(e=!1),ii.L(t)}catch(t){e=!1}return e||te.error("localStorage unsupported; falling back to cookie store"),ti=e,e},F:function(e){te.error("localStorage error: "+e)},A:function(e){try{return null==m?void 0:m.localStorage.getItem(e)}catch(e){ii.F(e)}return null},D:function(e){try{return JSON.parse(ii.A(e))||{}}catch(e){}return null},j:function(e,t){try{null==m||m.localStorage.setItem(e,JSON.stringify(t))}catch(e){ii.F(e)}},L:function(e){try{null==m||m.localStorage.removeItem(e)}catch(e){ii.F(e)}}},ri=["distinct_id",Le,Ne,tt,et],ni=se({},ii,{D:function(e){try{var t={};try{t=ei.D(e)||{}}catch(e){}var i=ue(t,JSON.parse(ii.A(e)||"{}"));return ii.j(e,i),i}catch(e){}return null},j:function(e,t,i,r,n,s){try{ii.j(e,t,void 0,void 0,s);var o={};ri.forEach((e=>{t[e]&&(o[e]=t[e])})),Object.keys(o).length&&ei.j(e,o,i,r,n,s)}catch(e){ii.F(e)}},L:function(e,t){try{null==m||m.localStorage.removeItem(e),ei.L(e,t)}catch(e){ii.F(e)}}}),si={},oi={O:function(){return!0},F:function(e){te.error("memoryStorage error: "+e)},A:function(e){return si[e]||null},D:function(e){return si[e]||null},j:function(e,t){si[e]=t},L:function(e){delete si[e]}},ai=null,li={O:function(){if(!Y(ai))return ai;if(ai=!0,K(m))ai=!1;else try{var e="__support__";li.j(e,"xyz"),'"xyz"'!==li.A(e)&&(ai=!1),li.L(e)}catch(e){ai=!1}return ai},F:function(e){te.error("sessionStorage error: ",e)},A:function(e){try{return null==m?void 0:m.sessionStorage.getItem(e)}catch(e){li.F(e)}return null},D:function(e){try{return JSON.parse(li.A(e))||null}catch(e){}return null},j:function(e,t){try{null==m||m.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){li.F(e)}},L:function(e){try{null==m||m.sessionStorage.removeItem(e)}catch(e){li.F(e)}}};!function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"}(Qt||(Qt={}));class ci{constructor(e){this._instance=e}get S(){return this._instance.config}get consent(){return this.N()?Qt.DENIED:this.U}isOptedOut(){return this.consent===Qt.DENIED||this.consent===Qt.PENDING&&this.S.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(e){this.q.j(this.B,e?1:0,this.S.cookie_expiration,this.S.cross_subdomain_cookie,this.S.secure_cookie)}reset(){this.q.L(this.B,this.S.cross_subdomain_cookie)}get B(){var{token:e,opt_out_capturing_cookie_prefix:t}=this._instance.config;return(t||"__ph_opt_in_out_")+e}get U(){var e=this.q.A(this.B);return"1"===e?Qt.GRANTED:"0"===e?Qt.DENIED:Qt.PENDING}get q(){if(!this.H){var e=this.S.opt_out_capturing_persistence_type;this.H="localStorage"===e?ii:ei;var t="localStorage"===e?ei:ii;t.A(this.B)&&(this.H.A(this.B)||this.optInOut("1"===t.A(this.B)),t.L(this.B,this.S.cross_subdomain_cookie))}return this.H}N(){return!!this.S.respect_dnt&&!!me([null==k?void 0:k.doNotTrack,null==k?void 0:k.msDoNotTrack,$.doNotTrack],(e=>D([!0,1,"1","yes"],e)))}}var ui=ie("[Dead Clicks]"),hi=()=>!0,di=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(Fe)),r=e.instance.config.capture_dead_clicks;return Z(r)?r:i};class pi{get lazyLoadedDeadClicksAutocapture(){return this.W}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Fe]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.G((()=>{this.J()}))}G(e){var t,i;null!=(t=$.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=$.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?ui.error("failed to load script",t):e()}))}J(){var e;if(x){if(!this.W&&null!=(e=$.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=H(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.W=$.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.W.start(x),ui.info("starting...")}}else ui.error("`document` not found. Cannot start.")}stop(){this.W&&(this.W.stop(),this.W=void 0,ui.info("stopping..."))}}var gi=ie("[ExceptionAutocapture]");class vi{constructor(e){var t;this.V=()=>{var e;if(m&&this.isEnabled&&null!=(e=$.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=$.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=$.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=$.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.K&&this.S.capture_unhandled_errors&&(this.K=t(this.captureException.bind(this))),!this.Y&&this.S.capture_unhandled_rejections&&(this.Y=i(this.captureException.bind(this))),!this.X&&this.S.capture_console_errors&&(this.X=r(this.captureException.bind(this)))}catch(e){gi.error("failed to start",e),this.Z()}}},this._instance=e,this.tt=!(null==(t=this._instance.persistence)||!t.props[Se]),this.S=this.it(),this.startIfEnabled()}it(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return H(e)?t=se({},t,e):(K(e)?this.tt:e)&&(t=se({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.S.capture_console_errors||this.S.capture_unhandled_errors||this.S.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(gi.info("enabled"),this.G(this.V))}G(e){var t,i;null!=(t=$.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=$.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return gi.error("failed to load script",t);e()}))}Z(){var e,t,i;null==(e=this.K)||e.call(this),this.K=void 0,null==(t=this.Y)||t.call(this),this.Y=void 0,null==(i=this.X)||i.call(this),this.X=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.tt=!!t||!1,this.S=this.it(),this._instance.persistence&&this._instance.persistence.register({[Se]:this.tt}),this.startIfEnabled()}captureException(e){var t=this._instance.requestRouter.endpointFor("ui");e.$exception_personURL=t+"/project/"+this._instance.config.token+"/person/"+this._instance.get_distinct_id(),this._instance.exceptions.sendExceptionEvent(e)}}function fi(e){return!K(Event)&&_i(e,Event)}function _i(e,t){try{return e instanceof t}catch(e){return!1}}function mi(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return _i(e,Error)}}function yi(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function bi(e){return yi(e,"DOMError")}var wi=/\(error: (.*)\)/,Ei="?";function ki(e,t,i,r){var n={platform:"web:javascript",filename:e,function:""===t?Ei:t,in_app:!0};return K(i)||(n.lineno=i),K(r)||(n.colno=r),n}var xi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Si=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ii=/\((\S*)(?::(\d+))(?::(\d+))\)/,Fi=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ri=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Oi=function(){for(var e=arguments.length,t=new Array(e),i=0;ie[0]-t[0])).map((e=>e[1]));return function(e,t){void 0===t&&(t=0);for(var i=[],n=e.split("\n"),s=t;s1024)){var a=wi.test(o)?o.replace(wi,"$1"):o;if(!a.match(/\S*Error: /)){for(var l of r){var c=l(a);if(c){i.push(c);break}}if(i.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map((e=>se({},e,{filename:e.filename||$i(t).filename,function:e.function||Ei})))}(i)}}([30,e=>{var t=xi.exec(e);if(t){var[,i,r,n]=t;return ki(i,Ei,+r,+n)}var s=Si.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){var o=Ii.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}var[a,l]=Ai(s[1]||Ei,s[2]);return ki(l,a,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}}],[50,e=>{var t=Fi.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var i=Ri.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}var r=t[3],n=t[1]||Ei;return[n,r]=Ai(n,r),ki(r,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]);function $i(e){return e[e.length-1]||{}}var Ci,Pi,Mi,Ai=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return i||r?[-1!==e.indexOf("@")?e.split("@")[0]:Ei,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Di=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function Ti(e,t){void 0===t&&(t=0);var i=e.stacktrace||e.stack||"",r=function(e){return e&&Li.test(e.message)?1:0}(e);try{var n=Oi,s=function(e,t){var i=function(e){var t=globalThis._posthogChunkIds;if(!t)return{};var i=Object.keys(t);return Mi&&i.length===Pi||(Pi=i.length,Mi=i.reduce(((i,r)=>{Ci||(Ci={});var n=Ci[r];if(n)i[n[0]]=n[1];else for(var s=e(r),o=s.length-1;o>=0;o--){var a=s[o],l=null==a?void 0:a.filename,c=t[r];if(l&&c){i[l]=c,Ci[r]=[l,c];break}}return i}),{})),Mi}(t);return e.forEach((e=>{e.filename&&(e.chunk_id=i[e.filename])})),e}(n(i,r),n);return s.slice(0,s.length-t)}catch(e){}return[]}var Li=/Minified React error #\d+;/i;function Ni(e,t){var i=function(e,t){var i,r,n=Ti(e),s=null===(i=null==t?void 0:t.handled)||void 0===i||i,o=null!==(r=null==t?void 0:t.synthetic)&&void 0!==r&&r;return{type:null!=t&&t.overrideExceptionType?t.overrideExceptionType:e.name,value:function(e){var t=e.message;return t.error&&"string"==typeof t.error.message?String(t.error.message):String(t)}(e),stacktrace:{frames:n,type:"raw"},mechanism:{handled:s,synthetic:o}}}(e,t);return e.cause&&mi(e.cause)&&e.cause!==e?[i,...Ni(e.cause,{handled:null==t?void 0:t.handled,synthetic:null==t?void 0:t.synthetic})]:[i]}function Bi(e,t){return{$exception_list:Ni(e,t),$exception_level:"error"}}function Ui(e,t){var i,r,n,s=null===(i=null==t?void 0:t.handled)||void 0===i||i,o=null===(r=null==t?void 0:t.synthetic)||void 0===r||r,a={type:null!=t&&t.overrideExceptionType?t.overrideExceptionType:null!==(n=null==t?void 0:t.defaultExceptionType)&&void 0!==n?n:"Error",value:e||(null==t?void 0:t.defaultExceptionMessage),mechanism:{handled:s,synthetic:o}};if(null!=t&&t.syntheticException){var l=Ti(t.syntheticException,1);l.length&&(a.stacktrace={frames:l,type:"raw"})}return{$exception_list:[a],$exception_level:"error"}}function qi(e){return z(e)&&!V(e)&&A.indexOf(e)>=0}function ji(e,t){var{error:i,event:r}=e,n={$exception_list:[]},s=i||r;if(bi(s)||function(e){return yi(e,"DOMException")}(s)){var o=s;if(function(e){return"stack"in e}(s))n=Bi(s,t);else{var a=o.name||(bi(o)?"DOMError":"DOMException"),l=o.message?a+": "+o.message:a;n=Ui(l,se({},t,{overrideExceptionType:bi(o)?"DOMError":"DOMException",defaultExceptionMessage:l}))}return"code"in o&&(n.$exception_DOMException_code=""+o.code),n}if(function(e){return yi(e,"ErrorEvent")}(s)&&s.error)return Bi(s.error,t);if(mi(s))return Bi(s,t);if(function(e){return yi(e,"Object")}(s)||fi(s))return function(e,t){var i,r,n=null===(i=null==t?void 0:t.handled)||void 0===i||i,s=null===(r=null==t?void 0:t.synthetic)||void 0===r||r,o=null!=t&&t.overrideExceptionType?t.overrideExceptionType:fi(e)?e.constructor.name:"Error",a="Non-Error 'exception' captured with keys: "+function(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var n=i.slice(0,r).join(", ");if(!(n.length>t))return r===i.length||n.length<=t?n:n.slice(0,t)+"..."}return""}(e),l={type:o,value:a,mechanism:{handled:n,synthetic:s}};if(null!=t&&t.syntheticException){var c=Ti(null==t?void 0:t.syntheticException,1);c.length&&(l.stacktrace={frames:c,type:"raw"})}return{$exception_list:[l],$exception_level:qi(e.level)?e.level:"error"}}(s,t);if(K(i)&&z(r)){var c="Error",u=r,h=r.match(Di);return h&&(c=h[1],u=h[2]),Ui(u,se({},t,{overrideExceptionType:c,defaultExceptionMessage:u}))}return Ui(s,t)}function Gi(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],n=i(r);return G(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=n,()=>{e[t]=r}}catch(e){return()=>{}}}class Hi{constructor(e){var t;this._instance=e,this.et=(null==m||null==(t=m.location)?void 0:t.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(te.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.rt&&this.rt(),this.rt=void 0,te.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(m&&m.history){var i=this;null!=(e=m.history.pushState)&&e.__posthog_wrapped__||Gi(m.history,"pushState",(e=>function(t,r,n){e.call(this,t,r,n),i.st("pushState")})),null!=(t=m.history.replaceState)&&t.__posthog_wrapped__||Gi(m.history,"replaceState",(e=>function(t,r,n){e.call(this,t,r,n),i.st("replaceState")})),this.nt()}}st(e){try{var t,i=null==m||null==(t=m.location)?void 0:t.pathname;if(!i)return;i!==this.et&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.et=i}catch(t){te.error("Error capturing "+e+" pageview",t)}}nt(){if(!this.rt){var e=()=>{this.st("popstate")};ye(m,"popstate",e),this.rt=()=>{m&&m.removeEventListener("popstate",e)}}}}function Wi(e){var t,i;return(null==(t=JSON.stringify(e,(i=[],function(e,t){if(H(t)){for(;i.length>0&&i[i.length-1]!==this;)i.pop();return i.includes(t)?"[Circular]":(i.push(t),t)}return t})))?void 0:t.length)||0}function Ki(e,t){if(void 0===t&&(t=6606028.8),e.size>=t&&e.data.length>1){var i=Math.floor(e.data.length/2),r=e.data.slice(0,i),n=e.data.slice(i);return[Ki({size:Wi(r),data:r,sessionId:e.sessionId,windowId:e.windowId}),Ki({size:Wi(n),data:n,sessionId:e.sessionId,windowId:e.windowId})].flatMap((e=>e))}return[e]}var zi=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(zi||{}),Vi=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Vi||{}),Yi="[SessionRecording]",Ji="redacted",Xi={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com"]},Zi=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],Qi=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],er=["/s/","/e/","/i/"];function tr(e,t,i,r){if(J(e))return e;var n=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return z(n)&&(n=parseInt(n)),n>i?Yi+" "+r+" body too large to record ("+n+" bytes)":e}function ir(e,t){if(J(e))return e;var i=e;return It(i,!1)||(i=Yi+" "+t+" body "+Ji),ce(Qi,(e=>{var r,n;null!=(r=i)&&r.length&&-1!==(null==(n=i)?void 0:n.indexOf(e))&&(i=Yi+" "+t+" body "+Ji+" as might contain: "+e)})),i}function rr(e,t,i,r,n){return t>i&&(te.warn("min cannot be greater than max."),t=i),X(e)?e>i?(r&&te.warn(r+" cannot be greater than max: "+i+". Using max value instead."),i):e{Object.keys(this.ht).forEach((e=>{this.ht[e]=this.ht[e]+this.lt,this.ht[e]>=this.ot&&delete this.ht[e]}))},this.vt=e=>{var t=this._rrweb.mirror.getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var i=t.closest("svg");if(i)return[this._rrweb.mirror.getId(i),i]}return[e,t]},this.ct=e=>{var t,i,r,n,s,o,a,l;return(null!==(t=null==(i=e.removes)?void 0:i.length)&&void 0!==t?t:0)+(null!==(r=null==(n=e.attributes)?void 0:n.length)&&void 0!==r?r:0)+(null!==(s=null==(o=e.texts)?void 0:o.length)&&void 0!==s?s:0)+(null!==(a=null==(l=e.adds)?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;var t=e.data,i=this.ct(t);t.attributes&&(t.attributes=t.attributes.filter((e=>{var t,i,r,[n,s]=this.vt(e.id);return 0!==this.ht[n]&&(this.ht[n]=null!==(t=this.ht[n])&&void 0!==t?t:this.ot,this.ht[n]=Math.max(this.ht[n]-1,0),0===this.ht[n]&&(this.ut[n]||(this.ut[n]=!0,null==(i=(r=this.ft).onBlockedNode)||i.call(r,n,s))),e)})));var r=this.ct(t);return 0!==r||i===r?e:void 0},this._rrweb=e,this.ft=t,this.lt=rr(null!==(i=this.ft.refillRate)&&void 0!==i?i:this.lt,0,100,"mutation throttling refill rate"),this.ot=rr(null!==(r=this.ft.bucketSize)&&void 0!==r?r:this.ot,0,100,"mutation throttling bucket size"),setInterval((()=>{this.dt()}),1e3)}}var sr=Uint8Array,or=Uint16Array,ar=Uint32Array,lr=new sr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),cr=new sr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ur=new sr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hr=function(e,t){for(var i=new or(31),r=0;r<31;++r)i[r]=t+=1<>>1|(21845&_r)<<1;mr=(61680&(mr=(52428&mr)>>>2|(13107&mr)<<2))>>>4|(3855&mr)<<4,fr[_r]=((65280&mr)>>>8|(255&mr)<<8)>>>1}var yr=function(e,t,i){for(var r=e.length,n=0,s=new or(t);n>>l]=c}else for(o=new or(r),n=0;n>>15-e[n];return o},br=new sr(288);for(_r=0;_r<144;++_r)br[_r]=8;for(_r=144;_r<256;++_r)br[_r]=9;for(_r=256;_r<280;++_r)br[_r]=7;for(_r=280;_r<288;++_r)br[_r]=8;var wr=new sr(32);for(_r=0;_r<32;++_r)wr[_r]=5;var Er=yr(br,9,0),kr=yr(wr,5,0),xr=function(e){return(e/8|0)+(7&e&&1)},Sr=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof or?or:e instanceof ar?ar:sr)(i-t);return r.set(e.subarray(t,i)),r},Ir=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>>8},Fr=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>>8,e[r+2]|=i>>>16},Rr=function(e,t){for(var i=[],r=0;rd&&(d=s[r].s);var p=new or(d+1),g=Or(i[u-1],p,0);if(g>t){r=0;var v=0,f=g-t,_=1<t))break;v+=_-(1<>>=f;v>0;){var y=s[r].s;p[y]=0&&v;--r){var b=s[r].s;p[b]==t&&(--p[b],++v)}g=t}return[new sr(p),g]},Or=function(e,t,i){return-1==e.s?Math.max(Or(e.l,t,i+1),Or(e.r,t,i+1)):t[e.s]=i},$r=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new or(++t),r=0,n=e[0],s=1,o=function(e){i[r++]=e},a=1;a<=t;++a)if(e[a]==n&&a!=t)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=e[a]}return[i.subarray(0,r),t]},Cr=function(e,t){for(var i=0,r=0;r>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var s=0;s4&&!I[ur[R-1]];--R);var O,$,C,P,M=c+5<<3,A=Cr(n,br)+Cr(s,wr)+o,D=Cr(n,d)+Cr(s,v)+o+14+3*R+Cr(k,I)+(2*k[16]+3*k[17]+7*k[18]);if(M<=A&&M<=D)return Pr(t,u,e.subarray(l,l+c));if(Ir(t,u,1+(D15&&(Ir(t,u,B[x]>>>5&127),u+=B[x]>>>12)}}}else O=Er,$=br,C=kr,P=wr;for(x=0;x255){U=r[x]>>>18&31,Fr(t,u,O[U+257]),u+=$[U+257],U>7&&(Ir(t,u,r[x]>>>23&31),u+=lr[U]);var q=31&r[x];Fr(t,u,C[q]),u+=P[q],q>3&&(Fr(t,u,r[x]>>>5&8191),u+=cr[q])}else Fr(t,u,O[r[x]]),u+=$[r[x]];return Fr(t,u,O[256]),u+$[256]},Ar=new ar([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Dr=function(){for(var e=new ar(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Tr=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Lr(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p:function(t){for(var i=e,r=0;r>>8;e=i},d:function(){return 4294967295^e}}}(),r=e.length;i.p(e);var n=function(e,t,i,r,n){return function(e,t,i,r,n,s){var o=e.length,a=new sr(r+o+5*(1+Math.floor(o/7e3))+n),l=a.subarray(r,a.length-n),c=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var h=u+65535;h>>13,g=8191&d,v=(1<7e3||I>24576)&&P>423){c=Mr(e,l,0,w,E,k,S,I,R,u-R,c),I=x=S=0,R=u;for(var M=0;M<286;++M)E[M]=0;for(M=0;M<30;++M)k[M]=0}var A=2,D=0,T=g,L=$-C&32767;if(P>2&&O==b(u-L))for(var N=Math.min(p,P)-1,B=Math.min(32767,u),U=Math.min(258,P);L<=B&&--T&&$!=C;){if(e[u+A]==e[u+A-L]){for(var q=0;qA){if(A=q,D=L,q>N)break;var j=Math.min(L,q-2),G=0;for(M=0;MG&&(G=W,C=H)}}}L+=($=C)-(C=f[$])+32768&32767}if(D){w[I++]=268435456|gr[A]<<18|vr[D];var K=31&gr[A],z=31&vr[D];S+=lr[K]+cr[z],++E[257+K],++k[z],F=u+A,++x}else w[I++]=e[u],++E[e[u]]}}c=Mr(e,l,s,w,E,k,S,I,R,u-R,c)}return Sr(a,0,r+xr(c)+n)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,i,r,!n)}(e,t,function(e){return 10+(e.filename&&e.filename.length+1||0)}(t),8),s=n.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Tr(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;r<=i.length;++r)e[r+10]=i.charCodeAt(r)}}(n,t),Tr(n,s-8,i.d()),Tr(n,s-4,r),n}function Nr(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new sr(e.length+(e.length>>>1)),n=0,s=function(e){r[n++]=e},o=0;or.length){var a=new sr(n+8+(i-o<<1));a.set(r),r=a}var l=e.charCodeAt(o);l<128||t?s(l):l<2048?(s(192|l>>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),s(128|l>>>12&63),s(128|l>>>6&63),s(128|63&l)):(s(224|l>>>12),s(128|l>>>6&63),s(128|63&l))}return Sr(r,0,n)}var Br="disabled",Ur="sampled",qr="active",jr="buffering",Gr="paused",Hr="trigger",Wr=Hr+"_activated",Kr=Hr+"_pending",zr=Hr+"_"+Br;function Vr(e,t){return t.some((t=>"regex"===t.matching&&new RegExp(t.url).test(e)))}class Yr{constructor(e){this.gt=e}triggerStatus(e){var t=this.gt.map((t=>t.triggerStatus(e)));return t.includes(Wr)?Wr:t.includes(Kr)?Kr:zr}stop(){this.gt.forEach((e=>e.stop()))}}class Jr{constructor(e){this.gt=e}triggerStatus(e){var t=new Set;for(var i of this.gt)t.add(i.triggerStatus(e));switch(t.delete(zr),t.size){case 0:return zr;case 1:return Array.from(t)[0];default:return Kr}}stop(){this.gt.forEach((e=>e.stop()))}}class Xr{triggerStatus(){return Kr}stop(){}}class Zr{constructor(e){this._t=[],this.bt=[],this.urlBlocked=!1,this._instance=e}onRemoteConfig(e){var t,i;this._t=(null==(t=e.sessionRecording)?void 0:t.urlTriggers)||[],this.bt=(null==(i=e.sessionRecording)?void 0:i.urlBlocklist)||[]}wt(e){var t;return 0===this._t.length?zr:(null==(t=this._instance)?void 0:t.get_property(Be))===e?Wr:Kr}triggerStatus(e){var t=this.wt(e),i=t===Wr?Wr:t===Kr?Kr:zr;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:i}),i}checkUrlTriggerConditions(e,t,i){if(void 0!==m&&m.location.href){var r=m.location.href,n=this.urlBlocked,s=Vr(r,this.bt);n&&s||(s&&!n?e():!s&&n&&t(),Vr(r,this._t)&&i("url"))}}stop(){}}class Qr{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this.yt=()=>{},this._instance=e}triggerStatus(){var e=Kr;return J(this.linkedFlag)&&(e=zr),this.linkedFlagSeen&&(e=Wr),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:e}),e}onRemoteConfig(e,t){var i;if(this.linkedFlag=(null==(i=e.sessionRecording)?void 0:i.linkedFlag)||null,!J(this.linkedFlag)&&!this.linkedFlagSeen){var r=z(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=z(this.linkedFlag)?null:this.linkedFlag.variant;this.yt=this._instance.onFeatureFlags(((e,i)=>{var s=H(i)&&r in i&&(n?i[r]===n:!0===i[r]);s&&t(r,n),this.linkedFlagSeen=s}))}}stop(){this.yt()}}class en{constructor(e){this.St=[],this._instance=e}onRemoteConfig(e){var t;this.St=(null==(t=e.sessionRecording)?void 0:t.eventTriggers)||[]}$t(e){var t;return 0===this.St.length?zr:(null==(t=this._instance)?void 0:t.get_property(Ue))===e?Wr:Kr}triggerStatus(e){var t=this.$t(e),i=t===Wr?Wr:t===Kr?Kr:zr;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:i}),i}stop(){}}function tn(e){return e.isRecordingEnabled?jr:Br}function rn(e){if(!e.receivedDecide)return jr;if(!e.isRecordingEnabled)return Br;if(e.urlTriggerMatching.urlBlocked)return Gr;var t=!0===e.isSampled,i=new Yr([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?Ur:i===Wr?qr:i===Kr?jr:!1===e.isSampled?Br:qr}function nn(e){if(!e.receivedDecide)return jr;if(!e.isRecordingEnabled)return Br;if(e.urlTriggerMatching.urlBlocked)return Gr;var t=new Jr([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),i=t!==zr,r=Z(e.isSampled);return i&&t===Kr?jr:i&&t===zr||r&&!e.isSampled?Br:!0===e.isSampled?Ur:qr}var sn="[SessionRecording]",on=ie(sn);function an(){var e,t;return null==$||null==(e=$.__PosthogExtensions__)||null==(t=e.rrweb)?void 0:t.record}var ln=[Vi.MouseMove,Vi.MouseInteraction,Vi.Scroll,Vi.ViewportResize,Vi.Input,Vi.TouchMove,Vi.MediaInteraction,Vi.Drag],cn=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function un(e){return function(e){for(var t="",i=0;i{this.Zt()},this.ti=()=>{this.ii("browser offline",{})},this.ei=()=>{this.ii("browser online",{})},this.ri=()=>{if(null!=x&&x.visibilityState){var e="window "+x.visibilityState;this.ii(e,{})}},this._instance=e,this.Et=!1,this.si="/s/",this.ni=void 0,this.Nt=!1,!this._instance.sessionManager)throw on.error("started without valid sessionManager"),new Error(sn+" started without valid sessionManager. This is a bug.");if(this._instance.config.__preview_experimental_cookieless_mode)throw new Error(sn+" cannot be used with __preview_experimental_cookieless_mode.");this.Bt=new Qr(this._instance),this.Ut=new Zr(this._instance),this.qt=new en(this._instance);var{sessionId:t,windowId:i}=this.It.checkAndGetSessionAndWindowId();this.kt=t,this.oi=i,this.M=this.ai(),this.xt>=this.It.sessionTimeoutMs&&on.warn("session_idle_threshold_ms ("+this.xt+") is greater than the session timeout ("+this.It.sessionTimeoutMs+"). Session will never be detected as idle")}startIfEnabledOrStop(e){this.Ct?(this.li(e),ye(m,"beforeunload",this.Qt),ye(m,"offline",this.ti),ye(m,"online",this.ei),ye(m,"visibilitychange",this.ri),this.hi(),this.ui(),J(this.Jt)&&(this.Jt=this._instance.on("eventCaptured",(e=>{try{if("$pageview"===e.event){var t=null!=e&&e.properties.$current_url?this.di(null==e?void 0:e.properties.$current_url):"";if(!t)return;this.ii("$pageview",{href:t})}}catch(e){on.error("Could not add $pageview to rrweb session",e)}}))),this.Vt||(this.Vt=this.It.onSessionId(((e,t,i)=>{var r,n,s,o;i&&(this.ii("$session_id_change",{sessionId:e,windowId:t,changeReason:i}),null==(r=this._instance)||null==(n=r.persistence)||n.unregister(Ue),null==(s=this._instance)||null==(o=s.persistence)||o.unregister(Be))})))):this.stopRecording()}stopRecording(){var e,t,i,r;this.Et&&this.ni&&(this.ni(),this.ni=void 0,this.Et=!1,null==m||m.removeEventListener("beforeunload",this.Qt),null==m||m.removeEventListener("offline",this.ti),null==m||m.removeEventListener("online",this.ei),null==m||m.removeEventListener("visibilitychange",this.ri),this.ai(),clearInterval(this.vi),null==(e=this.Jt)||e.call(this),this.Jt=void 0,null==(t=this.Xt)||t.call(this),this.Xt=void 0,null==(i=this.Vt)||i.call(this),this.Vt=void 0,null==(r=this.Yt)||r.call(this),this.Yt=void 0,this.qt.stop(),this.Ut.stop(),this.Bt.stop(),on.info("stopped"))}ci(){var e;null==(e=this._instance.persistence)||e.unregister(Ne)}fi(e){var t,i=this.kt!==e,r=this.jt;if(X(r)){var n=this.Tt,s=i||!Z(n),o=s?function(e,t){return function(e){for(var t=0,i=0;i{this.pi("linked_flag_matched",{flag:e,variant:t})})),this.Nt=!0,this.startIfEnabledOrStop()}hi(){X(this.jt)&&J(this.Yt)&&(this.Yt=this.It.onSessionId((e=>{this.fi(e)})))}gi(e){if(this._instance.persistence){var t,i=this._instance.persistence,r=()=>{var t,r,n,s,o,a,l,c,u,h=null==(t=e.sessionRecording)?void 0:t.sampleRate,d=J(h)?null:parseFloat(h);J(d)&&this.ci();var p=null==(r=e.sessionRecording)?void 0:r.minimumDurationMilliseconds;i.register({[Oe]:!!e.sessionRecording,[$e]:null==(n=e.sessionRecording)?void 0:n.consoleLogRecordingEnabled,[Ce]:se({capturePerformance:e.capturePerformance},null==(s=e.sessionRecording)?void 0:s.networkPayloadCapture),[Pe]:null==(o=e.sessionRecording)?void 0:o.masking,[Me]:{enabled:null==(a=e.sessionRecording)?void 0:a.recordCanvas,fps:null==(l=e.sessionRecording)?void 0:l.canvasFps,quality:null==(c=e.sessionRecording)?void 0:c.canvasQuality},[Ae]:d,[De]:K(p)?null:p,[Te]:null==(u=e.sessionRecording)?void 0:u.scriptConfig})};r(),null==(t=this.Kt)||t.call(this),this.Kt=this.It.onSessionId(r)}}log(e,t){var i;void 0===t&&(t="log"),null==(i=this._instance.sessionRecording)||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}li(e){var t;K(Object.assign)||K(Array.from)||(this.Et||this._instance.config.disable_session_recording||this._instance.consent.isOptedOut())||(this.Et=!0,this.It.checkAndGetSessionAndWindowId(),an()?this.mi():null==(t=$.__PosthogExtensions__)||null==t.loadExternalDependency||t.loadExternalDependency(this._instance,this.bi,(e=>{if(e)return on.error("could not load recorder",e);this.mi()})),on.info("starting"),this.status===qr&&this.pi(e||"recording_initialized"))}get bi(){var e,t,i;return(null==(e=this._instance)||null==(t=e.persistence)||null==(i=t.get_property(Te))?void 0:i.script)||"recorder"}wi(e){var t;return 3===e.type&&-1!==ln.indexOf(null==(t=e.data)?void 0:t.source)}yi(e){var t=this.wi(e);t||this.Wt||e.timestamp-this.Gt>this.xt&&(this.Wt=!0,clearInterval(this.vi),this.ii("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this.Gt,threshold:this.xt,bufferLength:this.M.data.length,bufferSize:this.M.size}),this.Zt());var i=!1;if(t&&(this.Gt=e.timestamp,this.Wt)){var r="unknown"===this.Wt;this.Wt=!1,r||(this.ii("sessionNoLongerIdle",{reason:"user activity",type:e.type}),i=!0)}if(!this.Wt){var{windowId:n,sessionId:s}=this.It.checkAndGetSessionAndWindowId(!t,e.timestamp),o=this.kt!==s,a=this.oi!==n;this.oi=n,this.kt=s,o||a?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):i&&this.Si()}}$i(e){try{return e.rrwebMethod(),!0}catch(t){return this.Ht.length<10?this.Ht.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):on.warn("could not emit queued rrweb event.",t,e),!1}}ii(e,t){return this.$i(cn((()=>an().addCustomEvent(e,t))))}ki(){return this.$i(cn((()=>an().takeFullSnapshot())))}mi(){var e,t,i,r,n={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},s=this._instance.config.session_recording;for(var[o,a]of Object.entries(s||{}))o in n&&("maskInputOptions"===o?n.maskInputOptions=se({password:!0},a):n[o]=a);this.Ft&&this.Ft.enabled&&(n.recordCanvas=!0,n.sampling={canvas:this.Ft.fps},n.dataURLOptions={type:"image/webp",quality:this.Ft.quality}),this.Dt&&(n.maskAllInputs=null===(t=this.Dt.maskAllInputs)||void 0===t||t,n.maskTextSelector=null!==(i=this.Dt.maskTextSelector)&&void 0!==i?i:void 0,n.blockSelector=null!==(r=this.Dt.blockSelector)&&void 0!==r?r:void 0);var l=an();if(l){this.xi=null!==(e=this.xi)&&void 0!==e?e:new nr(l,{refillRate:this._instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this._instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(e,t)=>{var i="Too many mutations on node '"+e+"'. Rate limiting. This could be due to SVG animations or something similar";on.info(i,{node:t}),this.log(sn+" "+i,"warn")}});var c=this.Ei();this.ni=l(se({emit:e=>{this.onRRwebEmit(e)},plugins:c},n)),this.Gt=Date.now(),this.Wt=Z(this.Wt)?this.Wt:"unknown",this.ii("$session_options",{sessionRecordingOptions:n,activePlugins:c.map((e=>null==e?void 0:e.name))}),this.ii("$posthog_config",{config:this._instance.config})}else on.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}Si(){if(this.vi&&clearInterval(this.vi),!0!==this.Wt){var e=this.Pt;e&&(this.vi=setInterval((()=>{this.ki()}),e))}}Ei(){var e,t,i,r,n=[],s=null==(e=$.__PosthogExtensions__)||null==(t=e.rrwebPlugins)?void 0:t.getRecordConsolePlugin;s&&this.Ot&&n.push(s());var o=null==(i=$.__PosthogExtensions__)||null==(r=i.rrwebPlugins)?void 0:r.getRecordNetworkPlugin;return this.At&&G(o)&&(!Mt.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?n.push(o(((e,t)=>{var i,r,n,s={payloadSizeLimitBytes:Xi.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Xi.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...Xi.payloadHostDenyList]},o=!1!==e.session_recording.recordHeaders&&t.recordHeaders,a=!1!==e.session_recording.recordBody&&t.recordBody,l=!1!==e.capture_performance&&t.recordPerformance,c=(i=s,n=Math.min(1e6,null!==(r=i.payloadSizeLimitBytes)&&void 0!==r?r:1e6),e=>(null!=e&&e.requestBody&&(e.requestBody=tr(e.requestBody,e.requestHeaders,n,"Request")),null!=e&&e.responseBody&&(e.responseBody=tr(e.responseBody,e.responseHeaders,n,"Response")),e)),u=t=>{return c(((e,t)=>{var i,r=At(e.name),n=0===t.indexOf("http")?null==(i=At(t))?void 0:i.pathname:t;"/"===n&&(n="");var s=null==r?void 0:r.pathname.replace(n||"","");if(!(r&&s&&er.some((e=>0===s.indexOf(e)))))return e})((r=(i=t).requestHeaders,J(r)||ce(Object.keys(null!=r?r:{}),(e=>{Zi.includes(e.toLowerCase())&&(r[e]=Ji)})),i),e.api_host));var i,r},h=G(e.session_recording.maskNetworkRequestFn);return h&&G(e.session_recording.maskCapturedNetworkRequestFn)&&te.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{var i=e.session_recording.maskNetworkRequestFn({url:t.name});return se({},t,{name:null==i?void 0:i.url})}),s.maskRequestFn=G(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var i,r=u(t);return r&&null!==(i=null==e.session_recording.maskCapturedNetworkRequestFn?void 0:e.session_recording.maskCapturedNetworkRequestFn(r))&&void 0!==i?i:void 0}:e=>function(e){if(!K(e))return e.requestBody=ir(e.requestBody,"Request"),e.responseBody=ir(e.responseBody,"Response"),e}(u(e)),se({},Xi,s,{recordHeaders:o,recordBody:a,recordPerformance:l,recordInitialRequests:l})})(this._instance.config,this.At))):on.info("NetworkCapture not started because we are on localhost.")),n}onRRwebEmit(e){var t;if(this.Ii(),e&&H(e)){if(e.type===zi.Meta){var i=this.di(e.data.href);if(this.Pi=i,!i)return;e.data.href=i}else this.Ri();if(this.Ut.checkUrlTriggerConditions((()=>this.Ti()),(()=>this.Mi()),(e=>this.Ci(e))),!this.Ut.urlBlocked||(r=e).type===zi.Custom&&"recording paused"===r.data.tag){var r;e.type===zi.FullSnapshot&&this.Si(),e.type===zi.FullSnapshot&&this.Nt&&this.Rt.triggerStatus(this.sessionId)===Kr&&this.ai();var n=this.xi?this.xi.throttleMutations(e):e;if(n){var s=function(e){var t=e;if(t&&H(t)&&6===t.type&&H(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));for(var i=[],r=0;r2e3?i.push(t.data.payload.payload[r].slice(0,2e3)+"...[truncated]"):i.push(t.data.payload.payload[r]);return t.data.payload.payload=i,e}return e}(n);if(this.yi(s),!0!==this.Wt||hn(s)){if(hn(s)){var o=s.data.payload;if(o){var a=o.lastActivityTimestamp,l=o.threshold;s.timestamp=a+l}}var c=null===(t=this._instance.config.session_recording.compress_events)||void 0===t||t?function(e){if(Wi(e)<1024)return e;try{if(e.type===zi.FullSnapshot)return se({},e,{data:un(e.data),cv:"2024-10"});if(e.type===zi.IncrementalSnapshot&&e.data.source===Vi.Mutation)return se({},e,{cv:"2024-10",data:se({},e.data,{texts:un(e.data.texts),attributes:un(e.data.attributes),removes:un(e.data.removes),adds:un(e.data.adds)})});if(e.type===zi.IncrementalSnapshot&&e.data.source===Vi.StyleSheetRule)return se({},e,{cv:"2024-10",data:se({},e.data,{adds:e.data.adds?un(e.data.adds):void 0,removes:e.data.removes?un(e.data.removes):void 0})})}catch(e){on.error("could not compress event - will use uncompressed event",e)}return e}(s):s,u={$snapshot_bytes:Wi(c),$snapshot_data:c,$session_id:this.kt,$window_id:this.oi};this.status!==Br?this.Oi(u):this.ai()}}}}}Ri(){if(!this._instance.config.capture_pageview&&m){var e=this.di(m.location.href);this.Pi!==e&&(this.ii("$url_changed",{href:e}),this.Pi=e)}}Ii(){if(this.Ht.length){var e=[...this.Ht];this.Ht=[],e.forEach((e=>{Date.now()-e.enqueuedAt<=2e3&&this.$i(e)}))}}di(e){var t=this._instance.config.session_recording;if(t.maskNetworkRequestFn){var i,r={url:e};return null==(i=r=t.maskNetworkRequestFn(r))?void 0:i.url}return e}ai(){return this.M={size:0,data:[],sessionId:this.kt,windowId:this.oi},this.M}Zt(){this.Fi&&(clearTimeout(this.Fi),this.Fi=void 0);var e=this.Lt,t=this.Mt,i=X(t)&&t>=0,r=X(e)&&i&&t{this.Zt()}),2e3),this.M):(this.M.data.length>0&&Ki(this.M).forEach((e=>{this.Ai({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:"web",$lib_version:C.LIB_VERSION})})),this.ai())}Oi(e){var t,i=2+((null==(t=this.M)?void 0:t.data.length)||0);!this.Wt&&(this.M.size+e.$snapshot_bytes+i>943718.4||this.M.sessionId!==this.kt)&&(this.M=this.Zt()),this.M.size+=e.$snapshot_bytes,this.M.data.push(e.$snapshot_data),this.Fi||this.Wt||(this.Fi=setTimeout((()=>{this.Zt()}),2e3))}Ai(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this.si),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}Ci(e){var t,i;this.Rt.triggerStatus(this.sessionId)===Kr&&(null==(t=this._instance)||null==(i=t.persistence)||i.register({["url"===e?Be:Ue]:this.kt}),this.Zt(),this.pi(e+"_trigger_matched"))}Ti(){this.Ut.urlBlocked||(this.Ut.urlBlocked=!0,clearInterval(this.vi),on.info("recording paused due to URL blocker"),this.ii("recording paused",{reason:"url blocker"}))}Mi(){this.Ut.urlBlocked&&(this.Ut.urlBlocked=!1,this.ki(),this.Si(),this.ii("recording resumed",{reason:"left blocked url"}),on.info("recording resumed"))}ui(){0!==this.qt.St.length&&J(this.Xt)&&(this.Xt=this._instance.on("eventCaptured",(e=>{try{this.qt.St.includes(e.event)&&this.Ci("event")}catch(e){on.error("Could not activate event trigger",e)}})))}overrideLinkedFlag(){this.Bt.linkedFlagSeen=!0,this.ki(),this.pi("linked_flag_overridden")}overrideSampling(){var e;null==(e=this._instance.persistence)||e.register({[Ne]:!0}),this.ki(),this.pi("sampling_overridden")}overrideTrigger(e){this.Ci(e)}pi(e,t){this._instance.register_for_session({$session_recording_start_reason:e}),on.info(e.replace("_"," "),t),D(["recording_initialized","session_id_changed"],e)||this.ii(e,t)}get sdkDebugProperties(){var{sessionStartTimestamp:e}=this.It.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.M.data.length,$sdk_debug_replay_internal_buffer_size:this.M.size,$sdk_debug_current_session_duration:this.Mt,$sdk_debug_session_start:e}}}var pn=ie("[SegmentIntegration]");var gn="posthog-js";function vn(e,t){var{organization:i,projectId:r,prefix:n,severityAllowList:s=["error"]}=void 0===t?{}:t;return t=>{var o,a,l,c,u;if("*"!==s&&!s.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var d=(null==(o=t.exception)?void 0:o.values)||[],p=d.map((e=>se({},e,{stacktrace:e.stacktrace?se({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>se({},e,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(a=d[0])?void 0:a.value)||t.message,$exception_type:null==(l=d[0])?void 0:l.type,$exception_personURL:h,$exception_level:t.level,$exception_list:p,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=d[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(u=d[0])?void 0:u.type,$sentry_tags:t.tags};return i&&r&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+t.event_id),e.exceptions.sendExceptionEvent(g),t}}class fn{constructor(e,t,i,r,n){this.name=gn,this.setupOnce=function(s){s(vn(e,{organization:t,projectId:i,prefix:r,severityAllowList:n}))}}}var _n,mn=null!=m&&m.location?Lt(m.location.hash,"__posthog")||Lt(location.hash,"state"):null,yn="_postHogToolbarParams",bn=ie("[Toolbar]");!function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(_n||(_n={}));class wn{constructor(e){this.instance=e}Di(e){$.ph_toolbar_state=e}ji(){var e;return null!==(e=$.ph_toolbar_state)&&void 0!==e?e:_n.UNINITIALIZED}maybeLoadToolbar(e,t,i){var r,n;if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),!m||!x)return!1;e=null!==(r=e)&&void 0!==r?r:m.location,i=null!==(n=i)&&void 0!==n?n:m.history;try{if(!t){try{m.localStorage.setItem("test","test"),m.localStorage.removeItem("test")}catch(e){return!1}t=null==m?void 0:m.localStorage}var s,o=mn||Lt(e.hash,"__posthog")||Lt(e.hash,"state"),a=o?pe((()=>JSON.parse(atob(decodeURIComponent(o)))))||pe((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(yn)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}Li(e){var t=$.ph_load_toolbar||$.ph_load_editor;!J(t)&&G(t)?t(e,this.instance):bn.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==x||!x.getElementById(it));if(!m||t)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=se({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(m.localStorage.setItem(yn,JSON.stringify(se({},r,{source:void 0}))),this.ji()===_n.LOADED)this.Li(r);else if(this.ji()===_n.UNINITIALIZED){var n;this.Di(_n.LOADING),null==(n=$.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return bn.error("[Toolbar] Failed to load",e),void this.Di(_n.UNINITIALIZED);this.Di(_n.LOADED),this.Li(r)})),ye(m,"turbolinks:load",(()=>{this.Di(_n.UNINITIALIZED),this.loadToolbar(r)}))}return!0}Ni(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}var En=ie("[TracingHeaders]");class kn{constructor(e){this.zi=void 0,this.Ui=void 0,this.V=()=>{var e,t,i,r;K(this.zi)&&(null==(e=$.__PosthogExtensions__)||null==(t=e.tracingHeadersPatchFns)||t._patchXHR(this._instance.sessionManager)),K(this.Ui)&&(null==(i=$.__PosthogExtensions__)||null==(r=i.tracingHeadersPatchFns)||r._patchFetch(this._instance.sessionManager))},this._instance=e}G(e){var t,i;null!=(t=$.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=$.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return En.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.G(this.V):(null==(e=this.zi)||e.call(this),null==(t=this.Ui)||t.call(this),this.zi=void 0,this.Ui=void 0)}}var xn=ie("[Web Vitals]"),Sn=9e5;class In{constructor(e){var t;this.qi=!1,this.i=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Bi=()=>{clearTimeout(this.Hi),0!==this.M.metrics.length&&(this._instance.capture("$web_vitals",this.M.metrics.reduce(((e,t)=>se({},e,{["$web_vitals_"+t.name+"_event"]:se({},t),["$web_vitals_"+t.name+"_value"]:t.value})),{})),this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Wi=e=>{var t,i=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(K(i))xn.error("Could not read session ID. Dropping metrics!");else{this.M=this.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Gi();K(r)||(J(null==e?void 0:e.name)||J(null==e?void 0:e.value)?xn.error("Invalid metric received",e):this.Ji&&e.value>=this.Ji?xn.error("Ignoring metric with value >= "+this.Ji,e):(this.M.url!==r&&(this.Bi(),this.Hi=setTimeout(this.Bi,this.flushToCaptureTimeoutMs)),K(this.M.url)&&(this.M.url=r),this.M.firstMetricTimestamp=K(this.M.firstMetricTimestamp)?Date.now():this.M.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.M.metrics.push(se({},e,{$current_url:r,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.M.metrics.length===this.allowedMetrics.length&&this.Bi()))}},this.V=()=>{var e,t,i,r,n=$.__PosthogExtensions__;K(n)||K(n.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:r}=n.postHogWebVitalsCallbacks),e&&t&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.Wi.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.Wi.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Wi.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.Wi.bind(this)),this.i=!0):xn.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.qi=!(null==(t=this._instance.persistence)||!t.props[Ie]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=H(this._instance.config.capture_performance)?null==(e=this._instance.config.capture_performance)?void 0:e.web_vitals_allowed_metrics:void 0;return K(i)?(null==(t=this._instance.persistence)?void 0:t.props[Re])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(H(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Ji(){var e=H(this._instance.config.capture_performance)&&X(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Sn;return 0{t?xn.error("failed to load script",t):e()}))}Gi(){var e=m?m.location.href:void 0;return e||xn.error("Could not determine current URL"),e}}var Fn=ie("[Heatmaps]");function Rn(e){return H(e)&&"clientX"in e&&"clientY"in e&&X(e.clientX)&&X(e.clientY)}class On{constructor(e){var t;this.rageclicks=new Pt,this.qi=!1,this.i=!1,this.Vi=null,this.instance=e,this.qi=!(null==(t=this.instance.persistence)||!t.props[xe])}get flushIntervalMilliseconds(){var e=5e3;return H(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return K(this.instance.config.capture_heatmaps)?K(this.instance.config.enable_heatmaps)?this.qi:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.i)return;Fn.info("starting..."),this.Ki(),this.Vi=setInterval(this.Yi.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval(null!==(e=this.Vi)&&void 0!==e?e:void 0),null==(t=this.Xi)||t.stop(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[xe]:t}),this.qi=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.M;return this.M=void 0,e}Qi(e){this.Zi(e.originalEvent,"deadclick")}Ki(){m&&x&&(ye(m,"beforeunload",this.Yi.bind(this)),ye(x,"click",(e=>this.Zi(e||(null==m?void 0:m.event))),{capture:!0}),ye(x,"mousemove",(e=>this.te(e||(null==m?void 0:m.event))),{capture:!0}),this.Xi=new pi(this.instance,hi,this.Qi.bind(this)),this.Xi.startIfEnabled(),this.i=!0)}ie(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),s=function(e,t,i){for(var r=e;r&&ot(r)&&!at(r,"body");){if(r===i)return!1;if(D(t,null==m?void 0:m.getComputedStyle(r).position))return!0;r=_t(r)}return!1}(vt(e),["fixed","sticky"],n);return{x:e.clientX+(s?0:r),y:e.clientY+(s?0:i),target_fixed:s,type:t}}Zi(e,t){var i;if(void 0===t&&(t="click"),!st(e.target)&&Rn(e)){var r=this.ie(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.ee(se({},r,{type:"rageclick"})),this.ee(r)}}te(e){!st(e.target)&&Rn(e)&&(clearTimeout(this.re),this.re=setTimeout((()=>{this.ee(this.ie(e,"mousemove"))}),500))}ee(e){if(m){var t=m.location.href;this.M=this.M||{},this.M[t]||(this.M[t]=[]),this.M[t].push(e)}}Yi(){this.M&&!W(this.M)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class $n{constructor(e){this._instance=e}doPageView(e,t){var i,r=this.se(e,t);return this.ne={pathname:null!==(i=null==m?void 0:m.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.se(e,null==(t=this.ne)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.ne)?void 0:e.pageViewId}}se(e,t){var i=this.ne;if(!i)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:s,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:u}=n;if(!(K(s)||K(o)||K(a)||K(l)||K(c)||K(u))){s=Math.ceil(s),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);var h=s<=1?1:rr(o/s,0,1),d=s<=1?1:rr(a/s,0,1),p=l<=1?1:rr(c/l,0,1),g=l<=1?1:rr(u/l,0,1);r=ue(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:g})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}}class Cn{constructor(e){this._instance=e}sendExceptionEvent(e){this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}var Pn="Mobile",Mn="iOS",An="Android",Dn="Tablet",Tn=An+" "+Dn,Ln="iPad",Nn="Apple",Bn=Nn+" Watch",Un="Safari",qn="BlackBerry",jn="Samsung",Gn=jn+"Browser",Hn=jn+" Internet",Wn="Chrome",Kn=Wn+" OS",zn=Wn+" "+Mn,Vn="Internet Explorer",Yn=Vn+" "+Pn,Jn="Opera",Xn=Jn+" Mini",Zn="Edge",Qn="Microsoft "+Zn,es="Firefox",ts=es+" "+Mn,is="Nintendo",rs="PlayStation",ns="Xbox",ss=An+" "+Pn,os=Pn+" "+Un,as="Windows",ls=as+" Phone",cs="Nokia",us="Ouya",hs="Generic",ds=hs+" "+Pn.toLowerCase(),ps=hs+" "+Dn.toLowerCase(),gs="Konqueror",vs="(\\d+(\\.\\d+)?)",fs=new RegExp("Version/"+vs),_s=new RegExp(ns,"i"),ms=new RegExp(rs+" \\w+","i"),ys=new RegExp(is+" \\w+","i"),bs=new RegExp(qn+"|PlayBook|BB10","i"),ws={"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"},Es=function(e,t){return t=t||"",D(e," OPR/")&&D(e,"Mini")?Xn:D(e," OPR/")?Jn:bs.test(e)?qn:D(e,"IE"+Pn)||D(e,"WPDesktop")?Yn:D(e,Gn)?Hn:D(e,Zn)||D(e,"Edg/")?Qn:D(e,"FBIOS")?"Facebook "+Pn:D(e,"UCWEB")||D(e,"UCBrowser")?"UC Browser":D(e,"CriOS")?zn:D(e,"CrMo")||D(e,Wn)?Wn:D(e,An)&&D(e,Un)?ss:D(e,"FxiOS")?ts:D(e.toLowerCase(),gs.toLowerCase())?gs:((e,t)=>t&&D(t,Nn)||function(e){return D(e,Un)&&!D(e,Wn)&&!D(e,An)}(e))(e,t)?D(e,Pn)?os:Un:D(e,es)?es:D(e,"MSIE")||D(e,"Trident/")?Vn:D(e,"Gecko")?es:""},ks={[Yn]:[new RegExp("rv:"+vs)],[Qn]:[new RegExp(Zn+"?\\/"+vs)],[Wn]:[new RegExp("("+Wn+"|CrMo)\\/"+vs)],[zn]:[new RegExp("CriOS\\/"+vs)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+vs)],[Un]:[fs],[os]:[fs],[Jn]:[new RegExp("(Opera|OPR)\\/"+vs)],[es]:[new RegExp(es+"\\/"+vs)],[ts]:[new RegExp("FxiOS\\/"+vs)],[gs]:[new RegExp("Konqueror[:/]?"+vs,"i")],[qn]:[new RegExp(qn+" "+vs),fs],[ss]:[new RegExp("android\\s"+vs,"i")],[Hn]:[new RegExp(Gn+"\\/"+vs)],[Vn]:[new RegExp("(rv:|MSIE )"+vs)],Mozilla:[new RegExp("rv:"+vs)]},xs=function(e,t){var i=Es(e,t),r=ks[i];if(K(r))return null;for(var n=0;n[ns,e&&e[1]||""]],[new RegExp(is,"i"),[is,""]],[new RegExp(rs,"i"),[rs,""]],[bs,[qn,""]],[new RegExp(as,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[ls,""];if(new RegExp(Pn).test(t)&&!/IEMobile\b/.test(t))return[as+" "+Pn,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=i[1],n=ws[r]||"";return/arm/i.test(t)&&(n="RT"),[as,n]}return[as,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[Mn,t.join(".")]}return[Mn,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=K(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+An+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+An+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[An,t.join(".")]}return[An,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var i=[e[1],e[2],e[3]||"0"];t[1]=i.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Kn,""]],[/Linux|debian/i,["Linux",""]]],Is=function(e){return ys.test(e)?is:ms.test(e)?rs:_s.test(e)?ns:new RegExp(us,"i").test(e)?us:new RegExp("("+ls+"|WPDesktop)","i").test(e)?ls:/iPad/.test(e)?Ln:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Bn:bs.test(e)?qn:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(cs,"i").test(e)?cs:/(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(Pn).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)?An:Tn:An:new RegExp("(pda|"+Pn+")","i").test(e)?ds:new RegExp(Dn,"i").test(e)&&!new RegExp(Dn+" pc","i").test(e)?ps:""},Fs="https?://(.*)",Rs=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Os=he(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Rs),$s="";function Cs(e,t,i){if(!x)return{};var r=t?he([],Rs,i||[]):[];return Ps(Tt(x.URL,r,$s),e)}function Ps(e,t){var i=Os.concat(t||[]),r={};return ce(i,(function(t){var i=Dt(e,t);r[t]=i||null})),r}function Ms(e){var t=function(e){return e?0===e.search(Fs+"google.([^/?]*)")?"google":0===e.search(Fs+"bing.com")?"bing":0===e.search(Fs+"yahoo.com")?"yahoo":0===e.search(Fs+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",r={};if(!Y(t)){r.$search_engine=t;var n=x?Dt(x.referrer,i):"";n.length&&(r.ph_keyword=n)}return r}function As(){return navigator.language||navigator.userLanguage}function Ds(){return(null==x?void 0:x.referrer)||"$direct"}function Ts(e,t){var i=e?he([],Rs,t||[]):[],r=null==S?void 0:S.href.substring(0,1e3);return{r:Ds().substring(0,1e3),u:r?Tt(r,i,$s):void 0}}function Ls(e){var t,{r:i,u:r}=e,n={$referrer:i,$referring_domain:null==i?void 0:"$direct"==i?"$direct":null==(t=At(i))?void 0:t.host};if(r){n.$current_url=r;var s=At(r);n.$host=null==s?void 0:s.host,n.$pathname=null==s?void 0:s.pathname;var o=Ps(r);ue(n,o)}if(i){var a=Ms(i);ue(n,a)}return n}function Ns(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Bs(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function Us(e,t){if(!O)return{};var i,r,n,s=e?he([],Rs,t||[]):[],[o,a]=function(e){for(var t=0;t1e3?O.substring(0,997)+"...":O,$browser_version:xs(O,navigator.vendor),$browser_language:As(),$browser_language_prefix:(i=As(),"string"==typeof i?i.split("-")[0]:void 0),$screen_height:null==m?void 0:m.screen.height,$screen_width:null==m?void 0:m.screen.width,$viewport_height:null==m?void 0:m.innerHeight,$viewport_width:null==m?void 0:m.innerWidth,$lib:"web",$lib_version:C.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var qs,js=ie("[FeatureFlags]"),Gs="$active_feature_flags",Hs="$override_feature_flags",Ws="$feature_flag_payloads",Ks="$override_feature_flag_payloads",zs="$feature_flag_request_id",Vs=e=>{var t={};for(var[i,r]of de(e||{}))r&&(t[i]=r);return t};!function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"}(qs||(qs={}));class Ys{constructor(e){this.oe=!1,this.ae=!1,this.le=!1,this.he=!1,this.ue=!1,this.de=!1,this.ve=!1,this._instance=e,this.featureFlagEventHandlers=[]}decide(){if(this._instance.config.__preview_remote_config)this.de=!0;else{var e=!this.ce&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.fe({disableFlags:e})}}get hasLoadedFlags(){return this.ae}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(Ge),t=this._instance.get_property(Hs),i=this._instance.get_property(Ks);if(!i&&!t)return e||{};var r=ue({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var s of n){var o,a,l=r[s],c=null==t?void 0:t[s],u=K(c)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!c,h=K(c)?l.variant:"string"==typeof c?c:void 0,d=null==i?void 0:i[s],p=se({},l,{enabled:u,variant:u?null!=h?h:null==l?void 0:l.variant:void 0});u!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),h!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),d&&(p.metadata=se({},null==l?void 0:l.metadata,{payload:d,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[s]=p}return this.oe||(js.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:r}),this.oe=!0),r}getFlagVariants(){var e=this._instance.get_property(qe),t=this._instance.get_property(Hs);if(!t)return e||{};for(var i=ue({},e),r=Object.keys(t),n=0;n{this.fe()}),5))}pe(){clearTimeout(this.ce),this.ce=void 0}ensureFlagsLoaded(){this.ae||this.le||this.ce||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.he=e}fe(e){var t;if(this.pe(),!this._instance.config.advanced_disable_decide)if(this.le)this.ue=!0;else{var i={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:se({},(null==(t=this._instance.persistence)?void 0:t.get_initial_props())||{},this._instance.get_property(He)||{}),group_properties:this._instance.get_property(We)};(null!=e&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0);var r=this._instance.config.__preview_flags_v2&&this._instance.config.__preview_remote_config;r&&(i.timezone=Ns()),this.le=!0,this._instance.ge({method:"POST",url:this._instance.requestRouter.endpointFor("api",r?"/flags/?v=2":"/decide/?v=4"),data:i,compression:this._instance.config.disable_compression?void 0:_.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var t,r,n,s=!0;200===e.statusCode&&(this.ue||(this.$anon_distinct_id=void 0),s=!1),this.le=!1,this.de||(this.de=!0,this._instance._e(null!==(n=e.json)&&void 0!==n?n:{})),i.disable_flags&&!this.ue||(this.ve=!s,e.json&&null!=(t=e.json.quotaLimited)&&t.includes(qs.FeatureFlags)?js.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(this.receivedFeatureFlags(null!==(r=e.json)&&void 0!==r?r:{},s),this.ue&&(this.ue=!1,this.fe())))}})}}getFeatureFlag(e,t){if(void 0===t&&(t={}),this.ae||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],r=""+i,n=this._instance.get_property(zs)||void 0,s=this._instance.get_property(Ve)||{};if((t.send_event||!("send_event"in t))&&(!(e in s)||!s[e].includes(r))){var o,a,l,c,u,h,d,p,g,v,f;j(s[e])?s[e].push(r):s[e]=[r],null==(o=this._instance.persistence)||o.register({[Ve]:s});var _=this.getFeatureFlagDetails(e),m={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:n,$feature_flag_bootstrapped_response:(null==(a=this._instance.config.bootstrap)||null==(l=a.featureFlags)?void 0:l[e])||null,$feature_flag_bootstrapped_payload:(null==(c=this._instance.config.bootstrap)||null==(u=c.featureFlagPayloads)?void 0:u[e])||null,$used_bootstrap_value:!this.ve};K(null==_||null==(h=_.metadata)?void 0:h.version)||(m.$feature_flag_version=_.metadata.version);var y,b=null!==(d=null==_||null==(p=_.reason)?void 0:p.description)&&void 0!==d?d:null==_||null==(g=_.reason)?void 0:g.code;b&&(m.$feature_flag_reason=b),null!=_&&null!=(v=_.metadata)&&v.id&&(m.$feature_flag_id=_.metadata.id),K(null==_?void 0:_.original_variant)&&K(null==_?void 0:_.original_enabled)||(m.$feature_flag_original_response=K(_.original_variant)?_.original_enabled:_.original_variant),null!=_&&null!=(f=_.metadata)&&f.original_payload&&(m.$feature_flag_original_payload=null==_||null==(y=_.metadata)?void 0:y.original_payload),this._instance.capture("$feature_flag_called",m)}return i}js.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token;this._instance.ge({method:"POST",url:this._instance.requestRouter.endpointFor("api","/decide/?v=4"),data:{distinct_id:this._instance.get_distinct_id(),token:i},compression:this._instance.config.disable_compression?void 0:_.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:i=>{var r,n=null==(r=i.json)?void 0:r.featureFlagPayloads;t((null==n?void 0:n[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),this.ae||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);js.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ae=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(e,t,i,r,n){void 0===i&&(i={}),void 0===r&&(r={}),void 0===n&&(n={});var s=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>{var i;return[e,null!==(i=t[e].variant)&&void 0!==i?i:t[e].enabled]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>{var i;return null==(i=t[e].metadata)?void 0:i.payload})).map((e=>{var i;return[e,null==(i=t[e].metadata)?void 0:i.payload]})))):js.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e),o=s.flags,a=s.featureFlags,l=s.featureFlagPayloads;if(a){var c=e.requestId;if(j(a)){js.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var u={};if(a)for(var h=0;hthis.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t){var i,r=(this._instance.get_property(je)||[]).find((t=>t.flagKey===e)),n={["$feature_enrollment/"+e]:t},s={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(s.$early_access_feature_name=r.name),this._instance.capture("$feature_enrollment_update",s),this.setPersonPropertiesForFlags(n,!1);var o=se({},this.getFlagVariants(),{[e]:t});null==(i=this._instance.persistence)||i.register({[Gs]:Object.keys(Vs(o)),[qe]:o}),this.me()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var r=this._instance.get_property(je),n=i?"&"+i.map((e=>"stage="+e)).join("&"):"";if(r&&!t)return e(r);this._instance.ge({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+n),method:"GET",callback:t=>{var i;if(t.json){var r=t.json.earlyAccessFeatures;return null==(i=this._instance.persistence)||i.register({[je]:r}),e(r)}}})}be(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,i)=>(e[i]=t[i],e)),{})}}me(e){var{flags:t,flagVariants:i}=this.be();this.featureFlagEventHandlers.forEach((r=>r(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._instance.get_property(He)||{};this._instance.register({[He]:se({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(He)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._instance.get_property(We)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((t=>{i[t]=se({},i[t],e[t]),delete e[t]})),this._instance.register({[We]:se({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(We)||{};this._instance.register({[We]:se({},t,{[e]:{}})})}else this._instance.unregister(We)}}var Js=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Xs{constructor(e){this.S=e,this.props={},this.we=!1,this.ye=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.q=this.Se(e),this.load(),e.debug&&te.info("Persistence loaded",e.persistence,se({},this.props)),this.update_config(e,e),this.save()}Se(e){-1===Js.indexOf(e.persistence.toLowerCase())&&(te.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&ii.O()?ii:"localstorage+cookie"===t&&ni.O()?ni:"sessionstorage"===t&&li.O()?li:"memory"===t?oi:"cookie"===t?ei:ni.O()?ni:ei}properties(){var e={};return ce(this.props,(function(t,i){if(i===qe&&H(t))for(var r=Object.keys(t),n=0;n{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(H(e)){this.ke=K(t)?this.Ie:t;var i=!1;if(ce(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=t,i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.we){var e=Cs(this.S.custom_campaign_params,this.S.mask_personal_data_properties,this.S.custom_personal_data_properties);W(ve(e))||this.register(e),this.we=!0}}update_search_keyword(){var e;this.register((e=null==x?void 0:x.referrer)?Ms(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Ds(),$referring_domain:null!=x&&x.referrer&&(null==(e=At(x.referrer))?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Ze]||this.props[Qe]||this.register_once({[et]:Ts(this.S.mask_personal_data_properties,this.S.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};ce([Qe,Ze],(t=>{var i=this.props[t];i&&ce(i,(function(t,i){e["$initial_"+L(i)]=t}))}));var t,i,r=this.props[et];if(r){var n=(t=Ls(r),i={},ce(t,(function(e,t){i["$initial_"+L(t)]=e})),i);ue(e,n)}return e}safe_merge(e){return ce(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t){if(this.Ie=this.ke=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var i=this.Se(e),r=this.props;this.clear(),this.q=i,this.props=r,this.save()}}set_disabled(e){this.$e=e,this.$e?this.remove():this.save()}set_cross_subdomain(e){e!==this.xe&&(this.xe=e,this.remove(),this.save())}set_secure(e){e!==this.Ee&&(this.Ee=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[Ee]||{};i[e]=t,this.props[Ee]=i,this.save()}remove_event_timer(e){var t=(this.props[Ee]||{})[e];return K(t)||(delete this.props[Ee][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}class Zs{constructor(){this.Pe={},this.Pe={}}on(e,t){return this.Pe[e]||(this.Pe[e]=[]),this.Pe[e].push(t),()=>{this.Pe[e]=this.Pe[e].filter((e=>e!==t))}}emit(e,t){for(var i of this.Pe[e]||[])i(t);for(var r of this.Pe["*"]||[])r(e,t)}}var Qs=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};class eo{constructor(e){this.Re=new Zs,this.Te=(e,t)=>this.Me(e,t)&&this.Ce(e,t)&&this.Oe(e,t),this.Me=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.Fe=new Set,this.Ae=new Set}init(){var e,t;K(null==(e=this._instance)?void 0:e.De)||(null==(t=this._instance)||t.De(((e,t)=>{this.on(e,t)})))}register(e){var t,i;if(!K(null==(t=this._instance)?void 0:t.De)&&(e.forEach((e=>{var t,i;null==(t=this.Ae)||t.add(e),null==(i=e.steps)||i.forEach((e=>{var t;null==(t=this.Fe)||t.add((null==e?void 0:e.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r,n=new Set;e.forEach((e=>{var t;null==(t=e.steps)||t.forEach((e=>{null!=e&&e.selector&&n.add(null==e?void 0:e.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(n)}}on(e,t){var i;null!=t&&0!=e.length&&(this.Fe.has(e)||this.Fe.has(null==t?void 0:t.event))&&this.Ae&&(null==(i=this.Ae)?void 0:i.size)>0&&this.Ae.forEach((e=>{this.je(t,e)&&this.Re.emit("actionCaptured",e.name)}))}Le(e){this.onAction("actionCaptured",(t=>e(t)))}je(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.Te(e,i))return!0;return!1}onAction(e,t){return this.Re.on(e,t)}Ce(e,t){if(null!=t&&t.url){var i,r=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!eo.Ne(r,null==t?void 0:t.url,(null==t?void 0:t.url_matching)||"contains"))return!1}return!0}static Ne(e,t,i){switch(i){case"regex":return!!m&&Qs(e,t);case"exact":return t===e;case"contains":var r=eo.ze(t).replace(/_/g,".").replace(/%/g,".*");return Qs(e,r);default:return!1}}static ze(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Oe(e,t){if((null!=t&&t.href||null!=t&&t.tag_name||null!=t&&t.text)&&!this.Ue(e).some((e=>!(null!=t&&t.href&&!eo.Ne(e.href||"",null==t?void 0:t.href,(null==t?void 0:t.href_matching)||"exact")||null!=t&&t.tag_name&&e.tag_name!==(null==t?void 0:t.tag_name)||null!=t&&t.text&&!eo.Ne(e.text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact")&&!eo.Ne(e.$el_text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact")))))return!1;if(null!=t&&t.selector){var i,r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(!r)return!1;if(!r.includes(null==t?void 0:t.selector))return!1}return!0}Ue(e){return null==(null==e?void 0:e.properties.$elements)?[]:null==e?void 0:e.properties.$elements}}var to=ie("[Surveys]");class io{constructor(e){this._instance=e,this.qe=new Map,this.Be=new Map}register(e){var t;K(null==(t=this._instance)?void 0:t.De)||(this.He(e),this.We(e))}We(e){var t=e.filter((e=>{var t,i,r,n;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(r=i.actions)||null==(n=r.values)?void 0:n.length)>0}));0!==t.length&&(null==this.Ge&&(this.Ge=new eo(this._instance),this.Ge.init(),this.Ge.Le((e=>{this.onAction(e)}))),t.forEach((e=>{var t,i,r,n,s,o,a,l,c,u;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(r=i.actions)&&r.values&&(null==(n=e.conditions)||null==(s=n.actions)||null==(o=s.values)?void 0:o.length)>0&&(null==(a=this.Ge)||a.register(e.conditions.actions.values),null==(l=e.conditions)||null==(c=l.actions)||null==(u=c.values)||u.forEach((t=>{if(t&&t.name){var i=this.Be.get(t.name);i&&i.push(e.id),this.Be.set(t.name,i||[e.id])}})))})))}He(e){var t;0!==e.filter((e=>{var t,i,r,n;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(r=i.events)||null==(n=r.values)?void 0:n.length)>0})).length&&(null==(t=this._instance)||t.De(((e,t)=>{this.onEvent(e,t)})),e.forEach((e=>{var t,i,r;null==(t=e.conditions)||null==(i=t.events)||null==(r=i.values)||r.forEach((t=>{if(t&&t.name){var i=this.qe.get(t.name);i&&i.push(e.id),this.qe.set(t.name,i||[e.id])}}))})))}onEvent(e,t){var i,r,n=(null==(i=this._instance)||null==(r=i.persistence)?void 0:r.props[ze])||[];if("survey shown"===e&&t&&n.length>0){var s;to.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:n});var o=null==t||null==(s=t.properties)?void 0:s.$survey_id;if(o){var a=n.indexOf(o);a>=0&&(n.splice(a,1),this.Je(n))}}else this.qe.has(e)&&(to.info("survey event matched, updating activated surveys",{event:e,surveys:this.qe.get(e)}),this.Je(n.concat(this.qe.get(e)||[])))}onAction(e){var t,i,r=(null==(t=this._instance)||null==(i=t.persistence)?void 0:i.props[ze])||[];this.Be.has(e)&&this.Je(r.concat(this.Be.get(e)||[]))}Je(e){var t,i;null==(t=this._instance)||null==(i=t.persistence)||i.register({[ze]:[...new Set(e)]})}getSurveys(){var e,t;return(null==(e=this._instance)||null==(t=e.persistence)?void 0:t.props[ze])||[]}getEventToSurveys(){return this.qe}Ve(){return this.Ge}}class ro{constructor(e){this.Ke=null,this.Ye=!1,this.Xe=!1,this.Qe=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){var t=e.surveys;if(J(t))return to.warn("Decide not loaded yet. Not loading surveys.");var i=j(t);this.Ze=i?t.length>0:t,to.info("decide response received, hasSurveys: "+this.Ze),this.Ze&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;tlocalStorage.removeItem(e)))}loadIfEnabled(){if(!this.Ke)if(this.Xe)to.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)to.info("Disabled. Not loading surveys.");else if(this.Ze){var e=null==$?void 0:$.__PosthogExtensions__;if(e){this.Xe=!0;try{var t=e.generateSurveys;if(t)return void this.tr(t);var i=e.loadExternalDependency;if(!i)return void this.ir("PostHog loadExternalDependency extension not found.");i(this._instance,"surveys",(t=>{t||!e.generateSurveys?this.ir("Could not load surveys script",t):this.tr(e.generateSurveys)}))}catch(e){throw this.ir("Error initializing surveys",e),e}finally{this.Xe=!1}}else to.error("PostHog Extensions not found.")}else to.info("No surveys to load.")}tr(e){this.Ke=e(this._instance),this._surveyEventReceiver=new io(this._instance),to.info("Surveys loaded successfully"),this.er({isLoaded:!0})}ir(e,t){to.error(e,t),this.er({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Qe.push(e),this.Ke&&this.er({isLoaded:!0}),()=>{this.Qe=this.Qe.filter((t=>t!==e))}}getSurveys(e,t){if(void 0===t&&(t=!1),this._instance.config.disable_surveys)return to.info("Disabled. Not loading surveys."),e([]);var i=this._instance.get_property(Ke);if(i&&!t)return e(i,{isLoaded:!0});if(this.Ye)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.Ye=!0,this._instance.ge({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:t=>{var i;this.Ye=!1;var r=t.statusCode;if(200!==r||!t.json){var n="Surveys API could not be loaded, status: "+r;return to.error(n),e([],{isLoaded:!1,error:n})}var s,o=t.json.surveys||[],a=o.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t,i,r;return!(null==(t=e.conditions)||null==(i=t.events)||null==(r=i.values)||!r.length)}(e)||function(e){var t,i,r;return!(null==(t=e.conditions)||null==(i=t.actions)||null==(r=i.values)||!r.length)}(e))));return a.length>0&&(null==(s=this._surveyEventReceiver)||s.register(a)),null==(i=this._instance.persistence)||i.register({[Ke]:o}),e(o,{isLoaded:!0})}})}catch(e){throw this.Ye=!1,e}}er(e){for(var t of this.Qe)try{e.isLoaded?this.getSurveys(t):t([],e)}catch(e){to.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!J(this.Ke))return this.Ke.getActiveMatchingSurveys(e,t);to.warn("init was not called")}rr(e){var t=null;return this.getSurveys((i=>{var r;t=null!==(r=i.find((t=>t.id===e)))&&void 0!==r?r:null})),t}sr(e){if(J(this.Ke))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t="string"==typeof e?this.rr(e):e;return t?this.Ke.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(J(this.Ke))return to.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.sr(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return J(this.Ke)?(to.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((i=>{this.getSurveys((t=>{var r,n=null!==(r=t.find((t=>t.id===e)))&&void 0!==r?r:null;if(n){var s=this.sr(n);i({visible:s.eligible,disabledReason:s.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t){if(J(this.Ke))to.warn("init was not called");else{var i=this.rr(e),r=null==x?void 0:x.querySelector(t);i?r?this.Ke.renderSurvey(i,r):to.warn("Survey element not found"):to.warn("Survey not found")}}}var no=ie("[RateLimiter]");class so{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{no.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void no.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.captureEventsPerSecond=(null==(t=e.config.rate_limiting)?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(i=e.config.rate_limiting)?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,r;void 0===e&&(e=!1);var n=(new Date).getTime(),s=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(Xe))&&void 0!==t?t:{tokens:this.captureEventsBurstLimit,last:n};s.tokens+=(n-s.last)/1e3*this.captureEventsPerSecond,s.last=n,s.tokens>this.captureEventsBurstLimit&&(s.tokens=this.captureEventsBurstLimit);var o=s.tokens<1;return o||e||(s.tokens=Math.max(0,s.tokens-1)),!o||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,null==(r=this.instance.persistence)||r.set_property(Xe,s),{isRateLimited:o,remainingTokens:s.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()e(this.remoteConfig))):(oo.error("PostHog Extensions not found. Cannot load remote config."),e())}ar(e){this._instance.ge({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return oo.info("Using preloaded remote config",this.remoteConfig),void this._e(this.remoteConfig);if(this._instance.config.advanced_disable_decide)return void oo.warn("Remote config is disabled. Falling back to local config.");this.nr((e=>{if(!e)return oo.info("No config found after loading remote JS config. Falling back to JSON."),void this.ar((e=>{this._e(e)}));this._e(e)}))}catch(e){oo.error("Error loading remote config",e)}}_e(e){e?this._instance.config.__preview_remote_config?(this._instance._e(e),!1!==e.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):oo.info("__preview_remote_config is disabled. Logging config instead",e):oo.error("Failed to fetch remote config from PostHog.")}}var lo=!!F||!!I,co="text/plain",uo=(e,t)=>{var[i,r]=e.split("?"),n=se({},t);null==r||r.split("&").forEach((e=>{var[t]=e.split("=");delete n[t]}));var s=function(e,t){var i,r;void 0===t&&(t="&");var n=[];return ce(e,(function(e,t){K(e)||K(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),n[n.length]=r+"="+i)})),n.join(t)}(n);return i+"?"+(s?(r?r+"&":"")+s:r)},ho=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),po=e=>{var{data:t,compression:i}=e;if(t){if(i===_.GZipJS){var r=Lr(Nr(ho(t)),{mtime:0}),n=new Blob([r],{type:co});return{contentType:co,body:n,estimatedSize:n.size}}if(i===_.Base64){var s=function(e){var t,i,r,n,s,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,c="",u=[];if(!e)return e;e=function(e){var t,i,r,n,s="";for(t=i=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,n=0;n127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),Y(a)||(i>t&&(s+=e.substring(t,i)),s+=a,t=i=n+1)}return i>t&&(s+=e.substring(t,e.length)),s}(e);do{t=(s=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,i=s>>12&63,r=s>>6&63,n=63&s,u[l++]=o.charAt(t)+o.charAt(i)+o.charAt(r)+o.charAt(n)}while(a"data="+encodeURIComponent("string"==typeof e?e:ho(e)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=ho(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},go=[];I&&go.push({transport:"fetch",method:e=>{var t,i,{contentType:r,body:n,estimatedSize:s}=null!==(t=po(e))&&void 0!==t?t:{},o=new Headers;ce(e.headers,(function(e,t){o.append(t,e)})),r&&o.append("Content-Type",r);var a=e.url,l=null;if(R){var c=new R;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),e.timeout)}}I(a,se({method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&(s||0)<52428.8,body:n,signal:null==(i=l)?void 0:i.signal},e.fetchOptions)).then((t=>t.text().then((i=>{var r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(e){te.error(e)}null==e.callback||e.callback(r)})))).catch((t=>{te.error(t),null==e.callback||e.callback({statusCode:0,text:t})})).finally((()=>l?clearTimeout(l.timeout):null))}}),F&&go.push({transport:"XHR",method:e=>{var t,i=new F;i.open(e.method||"GET",e.url,!0);var{contentType:r,body:n}=null!==(t=po(e))&&void 0!==t?t:{};ce(e.headers,(function(e,t){i.setRequestHeader(t,e)})),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),i.withCredentials=!0,i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(n)}}),null!=k&&k.sendBeacon&&go.push({transport:"sendBeacon",method:e=>{var t=uo(e.url,{beacon:"1"});try{var i,{contentType:r,body:n}=null!==(i=po(e))&&void 0!==i?i:{},s="string"==typeof n?new Blob([n],{type:r}):n;k.sendBeacon(t,s)}catch(e){}}});var vo=3e3;class fo{constructor(e,t){this.lr=!0,this.hr=[],this.ur=rr((null==t?void 0:t.flush_interval_ms)||vo,250,5e3,"flush interval",vo),this.dr=e}enqueue(e){this.hr.push(e),this.vr||this.cr()}unload(){this.pr();var e=this.hr.length>0?this.gr():{},t=Object.values(e);[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))].map((e=>{this.dr(se({},e,{transport:"sendBeacon"}))}))}enable(){this.lr=!1,this.cr()}cr(){var e=this;this.lr||(this.vr=setTimeout((()=>{if(this.pr(),this.hr.length>0){var t=this.gr(),i=function(i){var r=t[i],n=(new Date).getTime();r.data&&j(r.data)&&ce(r.data,(e=>{e.offset=Math.abs(e.timestamp-n),delete e.timestamp})),e.dr(r)};for(var r in t)i(r)}}),this.ur))}pr(){clearTimeout(this.vr),this.vr=void 0}gr(){var e={};return ce(this.hr,(t=>{var i,r=t,n=(r?r.batchKey:null)||r.url;K(e[n])&&(e[n]=se({},r,{data:[]})),null==(i=e[n].data)||i.push(r.data)})),this.hr=[],e}}var _o=["retriesPerformedSoFar"];class mo{constructor(e){this._r=!1,this.mr=3e3,this.hr=[],this._instance=e,this.hr=[],this.br=!0,!K(m)&&"onLine"in m.navigator&&(this.br=m.navigator.onLine,ye(m,"online",(()=>{this.br=!0,this.Yi()})),ye(m,"offline",(()=>{this.br=!1})))}get length(){return this.hr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=oe(e,_o);X(t)&&t>0&&(i.url=uo(i.url,{retry_count:t})),this._instance.ge(se({},i,{callback:e=>{200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this.wr(se({retriesPerformedSoFar:t},i)):null==i.callback||i.callback(e)}}))}wr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,r=Math.min(18e5,t),n=(Math.random()-.5)*(r-i);return Math.ceil(r+n)}(t),r=Date.now()+i;this.hr.push({retryAt:r,requestOptions:e});var n="Enqueued failed request for retry in "+i;navigator.onLine||(n+=" (Browser is offline)"),te.warn(n),this._r||(this._r=!0,this.yr())}yr(){this.Sr&&clearTimeout(this.Sr),this.Sr=setTimeout((()=>{this.br&&this.hr.length>0&&this.Yi(),this.yr()}),this.mr)}Yi(){var e=Date.now(),t=[],i=this.hr.filter((i=>i.retryAt0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Sr&&(clearTimeout(this.Sr),this.Sr=void 0),this.hr))try{this._instance.ge(se({},e,{transport:"sendBeacon"}))}catch(e){te.error(e)}this.hr=[]}}class yo{constructor(e){this.$r=()=>{var e,t,i,r;this.kr||(this.kr={});var n=this.scrollElement(),s=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,a=s+((null==n?void 0:n.clientHeight)||0),l=(null==n?void 0:n.scrollHeight)||0;this.kr.lastScrollY=Math.ceil(s),this.kr.maxScrollY=Math.max(s,null!==(e=this.kr.maxScrollY)&&void 0!==e?e:0),this.kr.maxScrollHeight=Math.max(o,null!==(t=this.kr.maxScrollHeight)&&void 0!==t?t:0),this.kr.lastContentY=a,this.kr.maxContentY=Math.max(a,null!==(i=this.kr.maxContentY)&&void 0!==i?i:0),this.kr.maxContentHeight=Math.max(l,null!==(r=this.kr.maxContentHeight)&&void 0!==r?r:0)},this._instance=e}getContext(){return this.kr}resetContext(){var e=this.kr;return setTimeout(this.$r,0),e}startMeasuringScrollPosition(){ye(m,"scroll",this.$r,{capture:!0}),ye(m,"scrollend",this.$r,{capture:!0}),ye(m,"resize",this.$r)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==m?void 0:m.document.documentElement;var e=j(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=null==m?void 0:m.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return m&&(m.scrollY||m.pageYOffset||m.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return m&&(m.scrollX||m.pageXOffset||m.document.documentElement.scrollLeft)||0}}var bo=e=>Ts(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class wo{constructor(e,t,i,r){this.Er=e=>{var t=this.Ir();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.Pr(this._instance)};this.Rr.register({[Je]:i})}},this._instance=e,this.Tr=t,this.Rr=i,this.Pr=r||bo,this.Tr.onSessionId(this.Er)}Ir(){return this.Rr.props[Je]}getSetOnceProps(){var e,t=null==(e=this.Ir())?void 0:e.props;return t?"r"in t?Ls(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return ce(ve(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+L(i)]=t})),e}}var Eo=ie("[SessionId]");class ko{constructor(e,t,i){var r;if(this.Mr=[],!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.S=e.config,this.Rr=e.persistence,this.oi=void 0,this.kt=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Cr=t||Yt,this.Or=i||Yt;var n=this.S.persistence_name||this.S.token,s=this.S.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*rr(s,60,36e3,"session_idle_timeout_seconds",1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Fr(),this.Ar="ph_"+n+"_window_id",this.Dr="ph_"+n+"_primary_window_exists",this.jr()){var o=li.D(this.Ar),a=li.D(this.Dr);o&&!a?this.oi=o:li.L(this.Ar),li.j(this.Dr,!0)}if(null!=(r=this.S.bootstrap)&&r.sessionID)try{var l=(()=>{var e=this.S.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.Lr(this.S.bootstrap.sessionID,(new Date).getTime(),l)}catch(e){Eo.error("Invalid sessionID in bootstrap",e)}this.Nr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return K(this.Mr)&&(this.Mr=[]),this.Mr.push(e),this.kt&&e(this.kt,this.oi),()=>{this.Mr=this.Mr.filter((t=>t!==e))}}jr(){return"memory"!==this.S.persistence&&!this.Rr.$e&&li.O()}zr(e){e!==this.oi&&(this.oi=e,this.jr()&&li.j(this.Ar,e))}Ur(){return this.oi?this.oi:this.jr()?li.D(this.Ar):null}Lr(e,t,i){e===this.kt&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.kt=e,this.Rr.register({[Le]:[t,e,i]}))}qr(){if(this.kt&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.kt,this._sessionStartTimestamp];var e=this.Rr.props[Le];return j(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Lr(null,null,null)}Nr(){ye(m,"beforeunload",(()=>{this.jr()&&li.L(this.Dr)}),{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.S.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var i=t||(new Date).getTime(),[r,n,s]=this.qr(),o=this.Ur(),a=X(s)&&s>0&&Math.abs(i-s)>864e5,l=!1,c=!n,u=!e&&Math.abs(i-r)>this.sessionTimeoutMs;c||u||a?(n=this.Cr(),o=this.Or(),Eo.info("new session ID generated",{sessionId:n,windowId:o,changeReason:{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}}),s=i,l=!0):o||(o=this.Or(),l=!0);var h=0===r||!e||a?i:r,d=0===s?(new Date).getTime():s;return this.zr(o),this.Lr(n,h,d),e||this.Fr(),l&&this.Mr.forEach((e=>e(n,o,l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0))),{sessionId:n,windowId:o,sessionStartTimestamp:d,changeReason:l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}Fr(){clearTimeout(this.Br),this.Br=setTimeout((()=>{this.resetSessionId()}),1.1*this.sessionTimeoutMs)}}var xo=["$set_once","$set"],So=ie("[SiteApps]");class Io{constructor(e){this._instance=e,this.Hr=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Wr(e,t){if(t){var i=this.globalsForEvent(t);this.Hr.push(i),this.Hr.length>1e3&&(this.Hr=this.Hr.slice(10))}}get siteAppLoaders(){var e,t;return null==(e=$._POSTHOG_REMOTE_CONFIG)||null==(t=e[this._instance.config.token])?void 0:t.siteApps}init(){if(this.isEnabled){var e=this._instance.De(this.Wr.bind(this));this.Gr=()=>{e(),this.Hr=[],this.Gr=void 0}}}globalsForEvent(e){var t,i,r,n,s,o,a;if(!e)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[h,d]of Object.entries(u))l[h]={id:c[h],type:h,properties:d};var{$set_once:p,$set:g}=e;return{event:se({},oe(e,xo),{properties:se({},e.properties,g?{$set:se({},null!==(t=null==(i=e.properties)?void 0:i.$set)&&void 0!==t?t:{},g)}:{},p?{$set_once:se({},null!==(r=null==(n=e.properties)?void 0:n.$set_once)&&void 0!==r?r:{},p)}:{}),elements_chain:null!==(s=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==s?s:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.Hr.length&&(So.info("Processing "+this.Hr.length+" events for site app with id "+e.id),this.Hr.forEach((e=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&(null==(i=this.Gr)||i.call(this))},r=!1,n=n=>{t.errored=!n,t.loaded=!0,So.info("Site app with id "+e.id+" "+(n?"loaded":"errored")),r&&i()};try{var{processEvent:s}=e.init({posthog:this._instance,callback:e=>{n(e)}});s&&(t.processEvent=s),r=!0}catch(t){So.error("Error while initializing PostHog app with config id "+e.id,t),n(!1)}if(r&&t.loaded)try{i()}catch(i){So.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}Jr(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}Vr(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){So.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,r,n=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.Jr(),void this._instance.on("eventCaptured",(e=>this.Vr(e)))):void So.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Gr)||i.call(this),null!=(r=e.siteApps)&&r.length)if(this.isEnabled){var s=function(e,t){var i;$["__$$ph_site_app_"+e]=n._instance,null==(i=$.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(n._instance,t,(t=>{if(t)return So.error("Error while initializing PostHog app with config id "+e,t)}))};for(var{id:o,url:a}of e.siteApps)s(o,a)}else So.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var Fo,Ro=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","bytespider"],Oo=function(e,t){if(!e)return!1;var i=e.toLowerCase();return Ro.concat(t||[]).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))},$o=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&Oo(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some((e=>Oo(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver};function Co(e,t,i){return ho({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}!function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"}(Fo||(Fo={}));var Po="i.posthog.com";class Mo{constructor(e){this.Kr={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Po,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Kr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Kr[this.apiHost]=Fo.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Kr[this.apiHost]=Fo.EU:this.Kr[this.apiHost]=Fo.CUSTOM),this.Kr[this.apiHost]}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if(this.region===Fo.CUSTOM)return this.apiHost+t;var i=Po+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var Ao={icontains:(e,t)=>!!m&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!m&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!m&&Qs(t.href,e),not_regex:(e,t)=>!!m&&!Qs(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Do{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{Do.Yr("retrieved web experiments from the server"),t.Xr=new Map,e.forEach((e=>{if(e.feature_flag_key){var i;t.Xr&&(Do.Yr("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t.Xr)||i.set(e.feature_flag_key,e));var r=t._instance.getFeatureFlag(e.feature_flag_key);z(r)&&e.variants[r]&&t.Qr(e.name,r,e.variants[r].transforms)}else if(e.variants)for(var n in e.variants){var s=e.variants[n];Do.Zr(s)&&t.Qr(e.name,n,s.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}onFeatureFlags(e){if(this._is_bot())Do.Yr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(J(this.Xr))return this.Xr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Do.Yr("applying feature flags",e),e.forEach((e=>{var t;if(this.Xr&&null!=(t=this.Xr)&&t.has(e)){var i,r=this._instance.getFeatureFlag(e),n=null==(i=this.Xr)?void 0:i.get(e);r&&null!=n&&n.variants[r]&&this.Qr(n.name,r,n.variants[r].transforms)}}))}}previewWebExperiment(){var e=Do.getWindowLocation();if(null!=e&&e.search){var t=Dt(null==e?void 0:e.search,"__experiment_id"),i=Dt(null==e?void 0:e.search,"__experiment_variant");t&&i&&(Do.Yr("previewing web experiments "+t+" && "+i),this.getWebExperiments((e=>{this.ts(parseInt(t),i,e)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance.ge({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);var i=t.json.experiments||[];return e(i)}})}ts(e,t,i){var r=i.filter((t=>t.id===e));r&&r.length>0&&(Do.Yr("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.Qr(r[0].name,t,r[0].variants[t].transforms))}static Zr(e){return!J(e.conditions)&&Do.es(e)&&Do.rs(e)}static es(e){var t;if(J(e.conditions)||J(null==(t=e.conditions)?void 0:t.url))return!0;var i,r,n,s=Do.getWindowLocation();return!!s&&(null==(i=e.conditions)||!i.url||Ao[null!==(r=null==(n=e.conditions)?void 0:n.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,s))}static getWindowLocation(){return null==m?void 0:m.location}static rs(e){var t;if(J(e.conditions)||J(null==(t=e.conditions)?void 0:t.utm))return!0;var i=Cs();if(i.utm_source){var r,n,s,o,a,l,c,u,h,d,p,g,v,f,_,m,y=null==(r=e.conditions)||null==(n=r.utm)||!n.utm_campaign||(null==(s=e.conditions)||null==(o=s.utm)?void 0:o.utm_campaign)==i.utm_campaign,b=null==(a=e.conditions)||null==(l=a.utm)||!l.utm_source||(null==(c=e.conditions)||null==(u=c.utm)?void 0:u.utm_source)==i.utm_source,w=null==(h=e.conditions)||null==(d=h.utm)||!d.utm_medium||(null==(p=e.conditions)||null==(g=p.utm)?void 0:g.utm_medium)==i.utm_medium,E=null==(v=e.conditions)||null==(f=v.utm)||!f.utm_term||(null==(_=e.conditions)||null==(m=_.utm)?void 0:m.utm_term)==i.utm_term;return y&&w&&E&&b}return!1}static Yr(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r{if(i.selector){var r;Do.Yr("applying transform of variant "+t+" for experiment "+e+" ",i);var n=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==n||n.forEach((e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)}))}})):Do.Yr("Control variants leave the page unmodified.")}_is_bot(){return k&&this._instance?$o(k,this._instance.config.custom_blocked_useragents):void 0}}var To,Lo,No,Bo,Uo,qo,jo={},Go=()=>{},Ho="posthog",Wo=!lo&&-1===(null==O?void 0:O.indexOf("MSIE"))&&-1===(null==O?void 0:O.indexOf("Mozilla")),Ko=()=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:_e(null==x?void 0:x.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Go,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:S&&z(null==S?void 0:S.search)&&-1!==S.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==m||null==(e=m.location)?void 0:e.protocol),ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;te.error(t)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:vo},_onCapture:Go}},zo=e=>{var t={};K(e.process_person)||(t.person_profiles=e.process_person),K(e.xhr_headers)||(t.request_headers=e.xhr_headers),K(e.cookie_name)||(t.persistence_name=e.cookie_name),K(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),K(e.store_google)||(t.save_campaign_params=e.store_google),K(e.verbose)||(t.debug=e.verbose);var i=ue({},t,e);return j(e.property_blacklist)&&(K(e.property_denylist)?i.property_denylist=e.property_blacklist:j(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:te.error("Invalid value for property_denylist config: "+e.property_denylist)),i};class Vo{constructor(){this.__forceAllowLocalhost=!1}get ss(){return this.__forceAllowLocalhost}set ss(e){te.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Yo{get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){this.webPerformance=new Vo,this.ns=!1,this.version=C.LIB_VERSION,this.os=new Zs,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ko(),this.SentryIntegration=fn,this.sentryIntegration=e=>function(e,t){var i=vn(e,t);return{name:gn,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.ls=!1,this.hs=null,this.us=null,this.ds=null,this.featureFlags=new Ys(this),this.toolbar=new wn(this),this.scrollManager=new yo(this),this.pageViewManager=new $n(this),this.surveys=new ro(this),this.experiments=new Do(this),this.exceptions=new Cn(this),this.rateLimiter=new so(this),this.requestRouter=new Mo(this),this.consent=new ci(this),this.people={set:(e,t,i)=>{var r=z(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=z(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(e=>te.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==Ho){var r,n=null!==(r=jo[i])&&void 0!==r?r:new Yo;return n._init(e,t,i),jo[i]=n,jo[Ho][i]=n,n}return this._init(e,t,i)}_init(e,t,i){var r,n;if(void 0===t&&(t={}),K(e)||V(e))return te.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return te.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.vs=[],t.person_profiles&&(this.us=t.person_profiles),this.set_config(ue({},Ko(),zo(t),{name:i,token:e})),this.config.on_xhr_error&&te.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:_.GZipJS,this.persistence=new Xs(this.config),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Xs(se({},this.config,{persistence:"sessionStorage"}));var s=se({},this.persistence.props),o=se({},this.sessionPersistence.props);if(this.cs=new fo((e=>this.fs(e)),this.config.request_queue_config),this.ps=new mo(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new ko(this),this.sessionPropsManager=new wo(this,this.sessionManager,this.persistence)),new kn(this).startIfEnabledOrStop(),this.siteApps=new Io(this),null==(r=this.siteApps)||r.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new dn(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new jt(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new On(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new In(this),this.exceptionObserver=new vi(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new pi(this,di),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new Hi(this),this.historyAutocapture.startIfEnabled(),C.DEBUG=C.DEBUG||this.config.debug,C.DEBUG&&te.info("Starting in debug mode",{this:this,config:t,thisC:se({},this.config),p:s,s:o}),this.gs(),void 0!==(null==(n=t.bootstrap)?void 0:n.distinctID)){var a,l,c=this.config.get_device_id(Yt()),u=null!=(a=t.bootstrap)&&a.isIdentifiedID?c:t.bootstrap.distinctID;this.persistence.set_property(Ye,null!=(l=t.bootstrap)&&l.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:u})}if(this._s()){var h,d,p=Object.keys((null==(h=t.bootstrap)?void 0:h.featureFlags)||{}).filter((e=>{var i,r;return!(null==(i=t.bootstrap)||null==(r=i.featureFlags)||!r[e])})).reduce(((e,i)=>{var r,n;return e[i]=(null==(r=t.bootstrap)||null==(n=r.featureFlags)?void 0:n[i])||!1,e}),{}),g=Object.keys((null==(d=t.bootstrap)?void 0:d.featureFlagPayloads)||{}).filter((e=>p[e])).reduce(((e,i)=>{var r,n,s,o;return null!=(r=t.bootstrap)&&null!=(n=r.featureFlagPayloads)&&n[i]&&(e[i]=null==(s=t.bootstrap)||null==(o=s.featureFlagPayloads)?void 0:o[i]),e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:p,featureFlagPayloads:g})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:rt,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(Yt());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(Ye,"anonymous")}return ye(m,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var r=i=>{var r=()=>i.anonymousId()||Yt();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(Ye,"identified")),t()},n=i.user();"then"in n&&G(n.then)?n.then((e=>r(e))):r(n)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||pn.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(pn.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(pn.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,"$pageview"),identify:e=>t(e,"$identify"),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this.bs())):this.bs(),G(this.config._onCapture)&&this.config._onCapture!==Go&&(te.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this}_e(e){var t,i,r,n,s,o,a,l;if(!x||!x.body)return te.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._e(e)}),500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=D(e.supportedCompression,_.GZipJS)?_.GZipJS:D(e.supportedCompression,_.Base64)?_.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.us?this.us:"identified_only"}),null==(i=this.siteApps)||i.onRemoteConfig(e),null==(r=this.sessionRecording)||r.onRemoteConfig(e),null==(n=this.autocapture)||n.onRemoteConfig(e),null==(s=this.heatmaps)||s.onRemoteConfig(e),this.surveys.onRemoteConfig(e),null==(o=this.webVitalsAutocapture)||o.onRemoteConfig(e),null==(a=this.exceptionObserver)||a.onRemoteConfig(e),null==(l=this.deadClicksAutocapture)||l.onRemoteConfig(e)}bs(){try{this.config.loaded(this)}catch(e){te.critical("`loaded` function failed",e)}this.ws(),this.config.capture_pageview&&setTimeout((()=>{this.consent.isOptedIn()&&this.ys()}),1),new ao(this).load(),this.featureFlags.decide()}ws(){var e;this.has_opted_out_capturing()||this.config.request_batching&&(null==(e=this.cs)||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||le(this.__request_queue,(e=>this.fs(e))),this.__request_queue=[],this.ws()}_handle_unload(){var e,t;this.config.request_batching?(this.Ss()&&this.capture("$pageleave"),null==(e=this.cs)||e.unload(),null==(t=this.ps)||t.unload()):this.Ss()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}ge(e){this.__loaded&&(Wo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=uo(e.url,{ip:this.config.ip?1:0}),e.headers=se({},this.config.request_headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,r,n=se({},e);n.timeout=n.timeout||6e4,n.url=uo(n.url,{_:(new Date).getTime().toString(),ver:C.LIB_VERSION,compression:n.compression});var s=null!==(t=n.transport)&&void 0!==t?t:"fetch",o=null!==(i=null==(r=me(go,(e=>e.transport===s)))?void 0:r.method)&&void 0!==i?i:go[0].method;if(!o)throw new Error("No available transport method");o(n)})(se({},e,{callback:t=>{var i,r;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&(null==(i=(r=this.config).on_request_error)||i.call(r,t)),null==e.callback||e.callback(t)}}))))}fs(e){this.ps?this.ps.retriableRequest(e):this.ge(e)}_execute_array(e){var t,i=[],r=[],n=[];le(e,(e=>{e&&(t=e[0],j(t)?n.push(e):G(e)?e.call(this):j(e)&&"alias"===t?i.push(e):j(e)&&-1!==t.indexOf("capture")&&G(this[t])?n.push(e):r.push(e))}));var s=function(e,t){le(e,(function(e){if(j(e[0])){var i=t;ce(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};s(i,this),s(r,this),s(n,this)}_s(){var e,t;return(null==(e=this.config.bootstrap)?void 0:e.featureFlags)&&Object.keys(null==(t=this.config.bootstrap)?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.cs){if(!this.consent.isOptedOut())if(!K(e)&&z(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var n=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==n||!n.isRateLimited){null!=t&&t.$current_url&&!z(null==t?void 0:t.$current_url)&&(te.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var s=new Date,o=(null==i?void 0:i.timestamp)||s,a=Yt(),l={uuid:a,event:e,properties:this.calculateEventProperties(e,t||{},o,a)};n&&(l.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens),(null==i?void 0:i.$set)&&(l.$set=null==i?void 0:i.$set);var c=this.$s(null==i?void 0:i.$set_once);c&&(l.$set_once=c),(l=function(e,t){return i=e,r=e=>z(e)&&!Y(t)?e.slice(0,t):e,n=new Set,function e(t,i){return t!==Object(t)?r?r(t):t:n.has(t)?void 0:(n.add(t),j(t)?(s=[],le(t,(t=>{s.push(e(t))}))):(s={},ce(t,((t,i)=>{n.has(t)||(s[i]=e(t,i))}))),s);var s}(i);var i,r,n}(l,null!=i&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,K(null==i?void 0:i.timestamp)||(l.properties.$event_time_override_provided=!0,l.properties.$event_time_override_system_time=s);var u=se({},l.properties.$set,l.$set);if(W(u)||this.setPersonPropertiesForFlags(u),!J(this.config.before_send)){var h=this.ks(l);if(!h)return;l=h}this.os.emit("eventCaptured",l);var d={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:l,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.fs(d):this.cs.enqueue(d),l}te.critical("This capture call is ignored due to client rate limiting.")}}else te.error("No event name provided to posthog.capture")}else te.uninitializedWarning("posthog.capture")}De(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,i,r,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var s=n?void 0:this.persistence.remove_event_timer(e),o=se({},t);if(o.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(o.$cookieless_mode=!0),"$snapshot"===e){var a=se({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!z(o.distinct_id)&&!X(o.distinct_id)||V(o.distinct_id))&&te.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var l,c=Us(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:u,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime());o.$session_id=u,o.$window_id=h}this.sessionPropsManager&&ue(o,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&ue(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null==(d=this.ps)?void 0:d.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===Fo.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),l="$pageview"!==e||n?"$pageleave"!==e||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),o=ue(o,l),"$pageview"===e&&x&&(o.title=x.title),!K(s)){var p=i.getTime()-s;o.$duration=parseFloat((p/1e3).toFixed(3))}O&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=ue({},c,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),j(this.config.property_denylist)?ce(this.config.property_denylist,(function(e){delete o[e]})):te.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(te.error("sanitize_properties is deprecated. Use before_send instead"),o=g(o,e));var v=this.xs();return o.$process_person_profile=v,v&&!n&&this.Es("_calculate_event_properties"),o}$s(e){var t;if(!this.persistence||!this.xs())return e;if(this.ns)return e;var i=this.persistence.get_initial_props(),r=null==(t=this.sessionPropsManager)?void 0:t.getSetOnceProps(),n=ue({},i,r||{},e||{}),s=this.config.sanitize_properties;return s&&(te.error("sanitize_properties is deprecated. Use before_send instead"),n=s(n,"$set_once")),this.ns=!0,W(n)?void 0:n}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var r;null==(r=this.persistence)||r.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}Is(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(e){return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}getEarlyAccessFeatures(e,t,i){return void 0===t&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.os.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return void 0===t&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return te.uninitializedWarning("posthog.identify");if(X(e)&&(e=e.toString(),te.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e){if(["distinct_id","distinctid"].includes(e.toLowerCase()))te.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(this.Es("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==r&&e!==this.get_property(we)&&(this.unregister(we),this.register({distinct_id:e}));var s="anonymous"===(this.persistence.get_property(Ye)||"anonymous");e!==r&&s?(this.persistence.set_property(Ye,"identified"),this.setPersonPropertiesForFlags(se({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this.ds=Co(e,t,i),this.featureFlags.setAnonymousDistinctId(r)):(t||i)&&this.setPersonProperties(t,i),e!==r&&(this.reloadFeatureFlags(),this.unregister(Ve))}}else te.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Es("posthog.setPersonProperties")){var i=Co(this.get_distinct_id(),e,t);this.ds!==i?(this.setPersonPropertiesForFlags(se({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.ds=i):te.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){if(this.Es("posthog.group")){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:se({},r,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),r[e]===t||i||this.reloadFeatureFlags()}}else te.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0),this.Es("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,r,n;if(te.info("reset"),!this.__loaded)return te.uninitializedWarning("posthog.reset");var s=this.get_property("$device_id");if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),this.surveys.reset(),null==(r=this.persistence)||r.set_property(Ye,"anonymous"),null==(n=this.sessionManager)||n.resetSessionId(),this.ds=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:rt,$device_id:null},"");else{var o=this.config.get_device_id(Yt());this.register_once({distinct_id:o,$device_id:e?o:s},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var n,s=null!==(n=e.timestampLookBack)&&void 0!==n?n:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-s,0)}return r}alias(e,t){return e===this.get_property(be)?(te.critical("Attempting to create alias for existing People user - aborting."),-2):this.Es("posthog.alias")?(K(t)&&(t=this.get_distinct_id()),e!==t?(this.Is(we,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(te.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t,i,r,n,s=se({},this.config);H(e)&&(ue(this.config,zo(e)),null==(t=this.persistence)||t.update_config(this.config,s),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Xs(se({},this.config,{persistence:"sessionStorage"})),ii.O()&&"true"===ii.A("ph_debug")&&(this.config.debug=!0),this.config.debug&&(C.DEBUG=!0,te.info("set_config",JSON.stringify({config:e,oldConfig:s,newConfig:se({},this.config)},null,2))),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),null==(r=this.autocapture)||r.startIfEnabled(),null==(n=this.heatmaps)||n.startIfEnabled(),this.surveys.loadIfEnabled(),this.gs())}startSessionRecording(e){var t,i,r,n,s,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("url")),a.event_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(se({},ji((e=>e instanceof Error)(e)?{error:e,event:e.message}:{event:e},{syntheticException:i}),t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:Ho;return t!==Ho&&(t=Ho+"."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property(Ye))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property(Ye))}xs(){var e,t,i,r;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&W(this.getGroups())&&(null==(e=this.persistence)||null==(t=e.props)||!t[we])&&(null==(i=this.persistence)||null==(r=i.props)||!r[tt]))}Ss(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.xs()||this.Es("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Es(e){return"never"===this.config.person_profiles?(te.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Is(tt,!0),!0)}gs(){var e,t,i,r,n=this.consent.isOptedOut(),s=this.config.opt_out_persistence_by_default,o=this.config.disable_persistence||n&&!!s;(null==(e=this.persistence)?void 0:e.$e)!==o&&(null==(i=this.persistence)||i.set_disabled(o)),(null==(t=this.sessionPersistence)?void 0:t.$e)!==o&&(null==(r=this.sessionPersistence)||r.set_disabled(o))}opt_in_capturing(e){var t;this.consent.optInOut(!0),this.gs(),(K(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(t=null==e?void 0:e.captureEventName)&&void 0!==t?t:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.ys()}opt_out_capturing(){this.consent.optInOut(!1),this.gs()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this.gs()}_is_bot(){return k?$o(k,this.config.custom_blocked_useragents):void 0}ys(){x&&("visible"===x.visibilityState?this.ls||(this.ls=!0,this.capture("$pageview",{title:x.title},{send_instantly:!0}),this.hs&&(x.removeEventListener("visibilitychange",this.hs),this.hs=null)):this.hs||(this.hs=this.ys.bind(this),ye(x,"visibilitychange",this.hs)))}debug(e){!1===e?(null==m||m.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(null==m||m.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}ks(e){if(J(this.config.before_send))return e;var t=j(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),J(i)){var n="Event '"+e.event+"' was rejected in beforeSend function";return Q(e.event)?te.warn(n+". This can cause unexpected behavior."):te.info(n),null}i.properties&&!W(i.properties)||te.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager.ne)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}}!function(e,t){for(var i=0;i=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var l=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(l&&c){if(this.prev=0;--i){var n=this.tryEntries[i];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),O(i),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var r=i.completion;if("throw"===r.type){var n=r.arg;O(i)}return n}}throw Error("illegal catch attempt")},delegateYield:function(t,i,r){return this.delegate={iterator:C(t),resultName:i,nextLoc:r},"next"===this.method&&(this.arg=e),f}},t}function ea(e,t,i,r,n,s,o){try{var a=e[s](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(r,n)}function ta(e){return function(){var t=this,i=arguments;return new Promise((function(r,n){var s=e.apply(t,i);function o(e){ea(s,r,n,o,a,"next",e)}function a(e){ea(s,r,n,o,a,"throw",e)}o(void 0)}))}}function ia(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{var i="nxtscape_chat:".concat(e);Xo.capture(i,t),f.info("BACKGROUND","Captured PostHog event: ".concat(e),t)}catch(e){f.error("BACKGROUND","Error capturing PostHog event:",e)}}Xo.init("phc_nWs0kBH4Kx4lYOQNFL4lzUncjnEHuDPsCwhewmEgOOJ",{api_host:"https://us.i.posthog.com",person_profiles:"identified_only"});var ra=null,na=!1,sa=new Map,oa=null;function aa(e){ra!==e&&(f.info("BACKGROUND","Updating lastActiveTabId from ".concat(ra," to ").concat(e)),ra=e)}function la(){return ca.apply(this,arguments)}function ca(){return(ca=ta(Qo().mark((function t(){var i,r,n;return Qo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(oa){t.next=3;break}return f.debug("BACKGROUND","Cannot prefetch - no port connection"),t.abrupt("return");case 3:return t.prev=3,t.next=6,new Promise((function(e){chrome.tabs.query({active:!0,currentWindow:!0},(function(t){if(chrome.runtime.lastError)return f.error("BACKGROUND","Error querying active tab:",chrome.runtime.lastError),void e([]);e(t)}))}));case 6:if((i=t.sent)&&0!==i.length){t.next=10;break}return f.debug("BACKGROUND","No active tab found for prefetching"),t.abrupt("return");case 10:if("number"==typeof(r=i[0]).id){t.next=14;break}return f.debug("BACKGROUND","Active tab has no ID, cannot prefetch"),t.abrupt("return");case 14:if(n=r.id,r.url&&r.url.startsWith("http")){t.next=18;break}return f.debug("BACKGROUND","Skipping prefetch for non-HTTP URL: ".concat(r.url)),t.abrupt("return");case 18:if(aa(n),!sa.has(n)){t.next=23;break}return f.debug("BACKGROUND","Content for tab ".concat(n," already in cache")),oa&&oa.postMessage({type:o,data:sa.get(n)}),t.abrupt("return");case 23:return f.info("BACKGROUND","Prefetching content for active tab: ".concat(n)),t.next=26,da(n);case 26:chrome.tabs.sendMessage(n,{action:e},(function(e){chrome.runtime.lastError?f.error("BACKGROUND","Error prefetching page content:",chrome.runtime.lastError):e&&e.success&&(sa.set(n,e.data),f.info("BACKGROUND","Successfully prefetched and cached content for tab: ".concat(n)),oa&&oa.postMessage({type:o,data:e.data}))})),t.next=32;break;case 29:t.prev=29,t.t0=t.catch(3),f.error("BACKGROUND","Error in prefetch function:",t.t0);case 32:case"end":return t.stop()}}),t,null,[[3,29]])})))).apply(this,arguments)}function ua(e){return ha.apply(this,arguments)}function ha(){return(ha=ta(Qo().mark((function e(t){var i,r;return Qo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,new Promise((function(e){chrome.tabs.get(t,(function(t){chrome.runtime.lastError?e(void 0):e(t.url)}))}));case 3:if((i=e.sent)&&i.startsWith("http")){e.next=6;break}return e.abrupt("return",!1);case 6:return e.next=8,chrome.scripting.executeScript({target:{tabId:t},func:function(){return Object.prototype.hasOwnProperty.call(window,"__AI_SIDE_PANEL_LOADED")}});case 8:return r=e.sent,e.abrupt("return",!!(r&&r[0]&&r[0].result));case 12:return e.prev=12,e.t0=e.catch(0),f.error("BACKGROUND","Failed to check script injection status:",e.t0),e.abrupt("return",!1);case 16:case"end":return e.stop()}}),e,null,[[0,12]])})))).apply(this,arguments)}function da(e){return pa.apply(this,arguments)}function pa(){return(pa=ta(Qo().mark((function e(t){var i;return Qo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,new Promise((function(e){chrome.tabs.get(t,(function(t){chrome.runtime.lastError?e(void 0):e(t.url)}))}));case 3:if((i=e.sent)&&i.startsWith("http")){e.next=7;break}return f.debug("BACKGROUND","Skipping injection for non-http URL: ".concat(i)),e.abrupt("return");case 7:return e.next=9,ua(t);case 9:if(!e.sent){e.next=13;break}return f.debug("BACKGROUND","Content script already injected, skipping..."),e.abrupt("return");case 13:return e.next=15,chrome.scripting.executeScript({target:{tabId:t},files:["content.js"]});case 15:f.info("BACKGROUND","Content script successfully injected into tab",t),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(0),f.error("BACKGROUND","Failed to inject content script:",e.t0);case 21:case"end":return e.stop()}}),e,null,[[0,18]])})))).apply(this,arguments)}chrome.runtime.onConnect.addListener((function(t){"side-panel-connection"===t.name&&(f.info("BACKGROUND","Side panel connected"),oa=t,na=!0,la().catch((function(e){f.error("BACKGROUND","Error prefetching active tab content:",e)})),t.onMessage.addListener(function(){var v=ta(Qo().mark((function v(_){var m,y,b,w;return Qo().wrap((function(v){for(;;)switch(v.prev=v.next){case 0:v.prev=0,v.t0=_.type,v.next=v.t0===r?4:v.t0===d?6:v.t0===s?9:v.t0===a?29:v.t0===l?39:v.t0===u?41:v.t0===p?45:51;break;case 4:return t.postMessage({type:n}),v.abrupt("break",52);case 6:return f.info("BACKGROUND","Received close panel request from side panel"),na=!1,v.abrupt("break",52);case 9:if(_.tabId){v.next=11;break}return v.abrupt("return",t.postMessage({type:g,error:"No tab ID provided"}));case 11:if(aa(_.tabId),f.info("BACKGROUND","Requesting page content for tab ".concat(_.tabId)),!sa.has(_.tabId)){v.next=18;break}return f.info("BACKGROUND","Using cached content for tab: ".concat(_.tabId)),m=sa.get(_.tabId),t.postMessage({type:o,data:m}),v.abrupt("return");case 18:return v.prev=18,v.next=21,da(_.tabId);case 21:chrome.tabs.sendMessage(_.tabId,{action:e},(function(e){if(chrome.runtime.lastError)return f.error("BACKGROUND","Error getting page content:",chrome.runtime.lastError),void t.postMessage({type:g,error:chrome.runtime.lastError.message||"Failed to get page content"});e&&e.success?(sa.set(_.tabId,e.data),t.postMessage({type:o,data:e.data})):t.postMessage({type:g,error:(null==e?void 0:e.error)||"Failed to get page content"})})),v.next=28;break;case 24:v.prev=24,v.t1=v.catch(18),f.error("BACKGROUND","Error processing page content request:",v.t1),t.postMessage({type:g,error:v.t1 instanceof Error?v.t1.message:"Failed to get page content"});case 28:return v.abrupt("break",52);case 29:if(!_.tabId){v.next=37;break}return f.info("BACKGROUND","Refreshing content for tab ".concat(_.tabId)),sa.delete(_.tabId),v.next=34,da(_.tabId);case 34:chrome.tabs.sendMessage(_.tabId,{action:e},(function(e){if(chrome.runtime.lastError)return f.error("BACKGROUND","Error refreshing page content:",chrome.runtime.lastError),void t.postMessage({type:g,error:chrome.runtime.lastError.message||"Failed to refresh page content"});e&&e.success?(sa.set(_.tabId,e.data),t.postMessage({type:o,data:e.data})):t.postMessage({type:g,error:(null==e?void 0:e.error)||"Failed to refresh page content"})})),v.next=38;break;case 37:la().catch((function(e){f.error("BACKGROUND","Error refreshing active tab content:",e),t.postMessage({type:g,error:e instanceof Error?e.message:"Unknown error refreshing tab content"})}));case 38:return v.abrupt("break",52);case 39:try{chrome.tabs.query({currentWindow:!0},(function(e){if(chrome.runtime.lastError){var i=chrome.runtime.lastError.message||"Failed to get tabs";return f.error("BACKGROUND","Error getting tabs:",i),void t.postMessage({type:g,error:i})}var r=e.filter((function(e){return e.url&&e.url.startsWith("http")})).map((function(e){return{id:e.id,title:e.title||"",url:e.url||"",favIconUrl:e.favIconUrl||""}}));f.debug("BACKGROUND","Sending ".concat(r.length," tabs to sidepanel")),t.postMessage({type:c,data:r})}))}catch(e){y=e instanceof Error?e.message:"Unknown error fetching tabs",f.error("BACKGROUND","Error in get_tabs handler:",y),t.postMessage({type:g,error:y})}return v.abrupt("break",52);case 41:if(_.tabId){v.next=43;break}return v.abrupt("return",t.postMessage({type:g,error:"No tab ID provided"}));case 43:try{chrome.tabs.sendMessage(_.tabId,{action:i},(function(e){if(chrome.runtime.lastError)return f.error("BACKGROUND","Error pinging content script:",chrome.runtime.lastError),void t.postMessage({type:g,error:"Content script not available"});t.postMessage({type:h,data:e})}))}catch(e){f.error("BACKGROUND","Error in ping_content_script handler:",e),t.postMessage({type:g,error:"Content script not available"})}return v.abrupt("break",52);case 45:if(b=_.event,w=_.properties,b&&"string"==typeof b){v.next=49;break}return t.postMessage({type:g,error:"No event name provided for PostHog"}),v.abrupt("break",52);case 49:return ia(b,w||{}),v.abrupt("break",52);case 51:return v.abrupt("return",t.postMessage({type:g,error:"Unknown message type"}));case 52:v.next=58;break;case 54:v.prev=54,v.t2=v.catch(0),f.error("BACKGROUND","Error handling port message:",v.t2),t.postMessage({type:g,error:v.t2 instanceof Error?v.t2.message:"Unknown error"});case 58:case"end":return v.stop()}}),v,null,[[0,54],[18,24]])})));return function(e){return v.apply(this,arguments)}}()),t.onDisconnect.addListener((function(){f.info("BACKGROUND","Side panel disconnected"),oa=null,na=!1})))})),chrome.commands.onCommand.addListener((function(e){"toggle-panel"===e&&(f.info("BACKGROUND","Toggle panel keyboard shortcut triggered"),f.info("BACKGROUND","Toggle visibility called"),f.info("BACKGROUND","Current panel state: ".concat(na?"open":"closed")),na?(f.info("BACKGROUND","Panel is open, attempting to close"),oa?oa.postMessage({type:d}):(chrome.runtime.sendMessage({action:t}).catch((function(e){f.info("BACKGROUND","Error sending close message: ".concat(e.message))})),na=!1)):(f.info("BACKGROUND","Panel is closed, attempting to open"),chrome.windows.getCurrent((function(e){var t=e.id;void 0!==t&&chrome.tabs.query({active:!0,currentWindow:!0},(function(e){if(e&&e.length>0&&void 0!==e[0].id)try{chrome.sidePanel.open({windowId:t,tabId:e[0].id}),na=!0,f.info("BACKGROUND","Side panel opened successfully")}catch(e){f.error("BACKGROUND","Error opening panel: ".concat(e.message))}else try{chrome.sidePanel.open({windowId:t}),na=!0,f.info("BACKGROUND","Side panel opened successfully with windowId only")}catch(e){f.error("BACKGROUND","Error opening panel: ".concat(e.message))}}))}))))})),chrome.action&&chrome.action.onClicked.addListener((function(e){e.id&&(ra=e.id)}));try{chrome.sidePanel.setPanelBehavior({openPanelOnActionClick:!0})}catch(e){f.error("BACKGROUND","Error setting panel behavior:",e)}f.info("BACKGROUND","Background script initialized"),chrome.tabs&&chrome.tabs.onUpdated?chrome.tabs.onUpdated.addListener((function(e,t,i){var r;e&&"loading"===t.status&&t.url&&(f.info("BACKGROUND","Tab ".concat(e," navigating to new URL, clearing from cache")),sa.delete(e)),e&&"complete"===t.status&&null!==(r=i.url)&&void 0!==r&&r.startsWith("http")&&(f.info("BACKGROUND","Tab ".concat(e," finished loading: ").concat(i.url)),da(e).catch((function(e){f.error("BACKGROUND","Error injecting content script:",e)})),i.active&&(ra=e))})):f.error("BACKGROUND","chrome.tabs.onUpdated is not available"),chrome.tabs&&chrome.tabs.onActivated&&chrome.tabs.onActivated.addListener((function(e){e.tabId&&(f.info("BACKGROUND","Tab activated: ".concat(e.tabId)),ra=e.tabId)})),chrome.tabs&&chrome.tabs.onRemoved&&chrome.tabs.onRemoved.addListener((function(e){f.info("BACKGROUND","Tab ".concat(e," closed, clearing from cache")),sa.delete(e)}))})(); \ No newline at end of file diff --git a/files/ai_side_panel/content.js b/files/ai_side_panel/content.js index 907cc7b7a..b09a8b51c 100644 --- a/files/ai_side_panel/content.js +++ b/files/ai_side_panel/content.js @@ -1 +1 @@ -(()=>{"use strict";var t="get_page_content",n="ping_content_script";const e={OPENAI_API_KEY:"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",DEV_MODE:!1};const r={debug:function(t,n,r){if(e.DEV_MODE){var o=(new Date).toISOString();"[".concat(o,"] [").concat(t,"] DEBUG: ").concat(n)}},info:function(t,n,r){if(e.DEV_MODE){var o=(new Date).toISOString();"[".concat(o,"] [").concat(t,"] INFO: ").concat(n)}},warn:function(t,n,e){var r=(new Date).toISOString();"[".concat(r,"] [").concat(t,"] WARN: ").concat(n)},error:function(t,n,e){var r=(new Date).toISOString();"[".concat(r,"] [").concat(t,"] ERROR: ").concat(n)}};function o(t,n){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=i(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return c=t.done,t},e:function(t){l=!0,a=t},f:function(){try{c||null==e.return||e.return()}finally{if(l)throw a}}}}function a(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(e=e.call(t)).next,0===n){if(Object(e)!==e)return;l=!1}else for(;!(l=(r=a.call(e)).done)&&(c.push(r.value),c.length!==n);l=!0);}catch(t){u=!0,o=t}finally{try{if(!l&&null!=e.return&&(i=e.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(t,n)||i(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,n){if(t){if("string"==typeof t)return c(t,n);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?c(t,n):void 0}}function c(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e50?"...":""))):r.debug("CONTENT","No meta description found");var d=Array.from(document.querySelectorAll("h1, h2, h3")).slice(0,50).map((function(t){var n;return(null===(n=t.textContent)||void 0===n?void 0:n.trim())||""})).filter((function(t){return t.length>0}));r.debug("CONTENT","Found ".concat(d.length," headings on the page"));var s="",f=15e3;r.debug("CONTENT","Starting content extraction with selectors");for(var g={},h=0,v=["main","article","#content",".content","#main",".main",'[role="main"]',"#siteTable",".Post",".richTextContainer",".post-content",".entry-content",".page-content",".post-body",".article-content",".article-body",".story-body",".story-content",".comment",".md",".blog-content",".blog-post",".news-article",'[class*="content"]','[class*="article"]','[class*="post"]','[class*="main"]','[data-testid*="content"]',".wikipedia-content","#readme",".entry",".thread",".tweet",".ytd-video-primary-info-renderer",".video-details",".item-page",".answer",".question"];h0&&(p.push(O),(N+=O.length)>=f))break}}if(g[m]=N,N>1e3){s=p.join("\n").substring(0,f),r.debug("CONTENT","Found content with selector ".concat(m,", length: ").concat(s.length));break}}}if(Object.entries(g).filter((function(t){var n=a(t,2);n[0];return n[1]>0})).sort((function(t,n){return n[1]-t[1]})).forEach((function(t){var n=a(t,2);n[0],n[1]})),s.length<200){r.debug("CONTENT","No substantial content found with selectors, trying paragraph extraction");var C=function(){var t=document.querySelectorAll('p, .paragraph, div[class*="paragraph"], div[class*="text"], div[class*="body"], span[class*="text"]');r.debug("CONTENT","Found ".concat(t.length," potential text containers for paragraph extraction"));var n=[],e=40,a=200;return t.forEach((function(t){var r;if(!function(t){var n=["nav","header","footer","aside",'[role="navigation"]','[role="banner"]','[role="contentinfo"]',".navigation",".menu",".sidebar",".comment",".widget",".ad",".advertisement",".banner",".header",".footer",".nav","#header","#footer","#sidebar","#navigation","#menu",'[class*="cookie"]','[class*="popup"]','[id*="cookie"]','[id*="popup"]','[class*="modal"]','[id*="modal"]'],e=t;for(;e&&e!==document.body;){var r,a=o(n);try{for(a.s();!(r=a.n()).done;){var i=r.value;try{if(e.matches(i))return!0}catch(t){continue}}}catch(t){a.e(t)}finally{a.f()}e=e.parentElement}return!1}(t)){var i=(null===(r=t.textContent)||void 0===r?void 0:r.trim())||"";if(i.length>=e&&!n.includes(i)){var c=i.replace(/\s+/g," ");if(n.push(c),n.length>=a)return}}})),r.debug("CONTENT","Extracted ".concat(n.length," significant paragraphs")),n}();C.length>0&&(s=C.join("\n").substring(0,f),r.debug("CONTENT","Found ".concat(C.length," paragraphs, total length: ").concat(s.length)))}s.length<200&&(r.debug("CONTENT","Still no substantial content, using body extraction fallback"),s=function(){var t=document.createElement("div");t.innerHTML=document.body.innerHTML,["script","style","noscript","svg","iframe","form","button","nav","header","footer","aside",'[role="navigation"]','[role="banner"]',".navigation",".menu",".nav",".sidebar",".comments",".widget",".ad",".advertisement",".banner",".promo",".recommended","#header","#footer","#sidebar","#navigation","#comments",'[class*="cookie"]','[class*="popup"]','[class*="modal"]',"img","picture","figure","video","audio","canvas"].forEach((function(n){t.querySelectorAll(n).forEach((function(t){return t.remove()}))}));var n=t.textContent||"";return n=n.trim().replace(/\s+/g," ").replace(/\n+/g,"\n").substring(0,15e3)}(),r.debug("CONTENT","Extracted from body, length: ".concat(s.length))),s.length<200&&(s=function(){var t=[];function n(e){if(e.nodeType===Node.TEXT_NODE){var r,o=null===(r=e.textContent)||void 0===r?void 0:r.trim();o&&o.length>10&&t.push(e)}else{if(e.nodeType===Node.ELEMENT_NODE){var a=e;if(null===a.offsetParent||"SCRIPT"===a.tagName||"STYLE"===a.tagName||"NOSCRIPT"===a.tagName||"DIV"===a.tagName&&(a.classList.contains("hidden")||"none"===a.style.display||"hidden"===a.style.visibility))return}for(var i=0;i=0&&r.left>=0&&r.bottom<=e&&r.right<=window.innerWidth})),o="";r.length>0&&(o=r.map((function(t){var n;return null===(n=t.textContent)||void 0===n?void 0:n.trim()})).filter((function(t){return t&&t.length>0})).join("\n"));o.length<200&&t.length>r.length&&(o=t.map((function(t){var n;return null===(n=t.textContent)||void 0===n?void 0:n.trim()})).filter((function(t){return t&&t.length>0})).join("\n"));return o.substring(0,15e3)}());var w={title:e,url:i,description:l,headings:d,content:s,faviconUrl:c,text:s};return r.info("CONTENT",'Page content extracted: Title="'.concat(w.title,'", URL=').concat(w.url,", Content length=").concat((null===(n=w.content)||void 0===n?void 0:n.length)||0,")")),w}window.__CHAT_LOADED=!0,chrome.runtime.onMessage.addListener((function(e,o,a){if(e.action===t){r.info("CONTENT","Received GET_PAGE_CONTENT message from ".concat(o.tab?"tab "+o.tab.id:"extension"));try{var i,c;r.info("CONTENT","Starting content extraction for ".concat(window.location.href));var u=performance.now(),d=l(),s=performance.now();r.info("CONTENT","Content extraction completed in ".concat((s-u).toFixed(2),"ms, sending response")),r.info("CONTENT","Extracted ".concat((null===(i=d.content)||void 0===i?void 0:i.length)||0," characters of content, ").concat((null===(c=d.headings)||void 0===c?void 0:c.length)||0," headings")),a({success:!0,data:d})}catch(t){r.error("CONTENT","Error getting page content:",t),a({success:!1,error:t.message})}return!0}if(e.action===n)return r.info("CONTENT","Received PING from ".concat(o.tab?"tab "+o.tab.id:"extension")),a({success:!0,message:"PONG",timestamp:Date.now()}),!0})),r.info("CONTENT","Chat content script loaded")})(); \ No newline at end of file +(()=>{"use strict";var t="get_page_content",n="ping_content_script";const e={LITE_LLM_KEY:"sk-M6Osg4w_eRqZTgYeZAZtnQ",BASE_URL:"http://llm.nxtscape.ai",DEV_MODE:!1};const r={debug:function(t,n,r){if(e.DEV_MODE){var o=(new Date).toISOString();"[".concat(o,"] [").concat(t,"] DEBUG: ").concat(n)}},info:function(t,n,r){if(e.DEV_MODE){var o=(new Date).toISOString();"[".concat(o,"] [").concat(t,"] INFO: ").concat(n)}},warn:function(t,n,e){var r=(new Date).toISOString();"[".concat(r,"] [").concat(t,"] WARN: ").concat(n)},error:function(t,n,e){var r=(new Date).toISOString();"[".concat(r,"] [").concat(t,"] ERROR: ").concat(n)}};function o(t,n){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=i(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,l=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return c=t.done,t},e:function(t){l=!0,a=t},f:function(){try{c||null==e.return||e.return()}finally{if(l)throw a}}}}function a(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(e=e.call(t)).next,0===n){if(Object(e)!==e)return;l=!1}else for(;!(l=(r=a.call(e)).done)&&(c.push(r.value),c.length!==n);l=!0);}catch(t){u=!0,o=t}finally{try{if(!l&&null!=e.return&&(i=e.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(t,n)||i(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,n){if(t){if("string"==typeof t)return c(t,n);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?c(t,n):void 0}}function c(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e50?"...":""))):r.debug("CONTENT","No meta description found");var d=Array.from(document.querySelectorAll("h1, h2, h3")).slice(0,50).map((function(t){var n;return(null===(n=t.textContent)||void 0===n?void 0:n.trim())||""})).filter((function(t){return t.length>0}));r.debug("CONTENT","Found ".concat(d.length," headings on the page"));var s="",f=15e3;r.debug("CONTENT","Starting content extraction with selectors");for(var g={},v=0,h=["main","article","#content",".content","#main",".main",'[role="main"]',"#siteTable",".Post",".richTextContainer",".post-content",".entry-content",".page-content",".post-body",".article-content",".article-body",".story-body",".story-content",".comment",".md",".blog-content",".blog-post",".news-article",'[class*="content"]','[class*="article"]','[class*="post"]','[class*="main"]','[data-testid*="content"]',".wikipedia-content","#readme",".entry",".thread",".tweet",".ytd-video-primary-info-renderer",".video-details",".item-page",".answer",".question"];v0&&(b.push(C),(T+=C.length)>=f))break}}if(g[m]=T,T>1e3){s=b.join("\n").substring(0,f),r.debug("CONTENT","Found content with selector ".concat(m,", length: ").concat(s.length));break}}}if(Object.entries(g).filter((function(t){var n=a(t,2);n[0];return n[1]>0})).sort((function(t,n){return n[1]-t[1]})).forEach((function(t){var n=a(t,2);n[0],n[1]})),s.length<200){r.debug("CONTENT","No substantial content found with selectors, trying paragraph extraction");var O=function(){var t=document.querySelectorAll('p, .paragraph, div[class*="paragraph"], div[class*="text"], div[class*="body"], span[class*="text"]');r.debug("CONTENT","Found ".concat(t.length," potential text containers for paragraph extraction"));var n=[],e=40,a=200;return t.forEach((function(t){var r;if(!function(t){var n=["nav","header","footer","aside",'[role="navigation"]','[role="banner"]','[role="contentinfo"]',".navigation",".menu",".sidebar",".comment",".widget",".ad",".advertisement",".banner",".header",".footer",".nav","#header","#footer","#sidebar","#navigation","#menu",'[class*="cookie"]','[class*="popup"]','[id*="cookie"]','[id*="popup"]','[class*="modal"]','[id*="modal"]'],e=t;for(;e&&e!==document.body;){var r,a=o(n);try{for(a.s();!(r=a.n()).done;){var i=r.value;try{if(e.matches(i))return!0}catch(t){continue}}}catch(t){a.e(t)}finally{a.f()}e=e.parentElement}return!1}(t)){var i=(null===(r=t.textContent)||void 0===r?void 0:r.trim())||"";if(i.length>=e&&!n.includes(i)){var c=i.replace(/\s+/g," ");if(n.push(c),n.length>=a)return}}})),r.debug("CONTENT","Extracted ".concat(n.length," significant paragraphs")),n}();O.length>0&&(s=O.join("\n").substring(0,f),r.debug("CONTENT","Found ".concat(O.length," paragraphs, total length: ").concat(s.length)))}s.length<200&&(r.debug("CONTENT","Still no substantial content, using body extraction fallback"),s=function(){var t=document.createElement("div");t.innerHTML=document.body.innerHTML,["script","style","noscript","svg","iframe","form","button","nav","header","footer","aside",'[role="navigation"]','[role="banner"]',".navigation",".menu",".nav",".sidebar",".comments",".widget",".ad",".advertisement",".banner",".promo",".recommended","#header","#footer","#sidebar","#navigation","#comments",'[class*="cookie"]','[class*="popup"]','[class*="modal"]',"img","picture","figure","video","audio","canvas"].forEach((function(n){t.querySelectorAll(n).forEach((function(t){return t.remove()}))}));var n=t.textContent||"";return n=n.trim().replace(/\s+/g," ").replace(/\n+/g,"\n").substring(0,15e3)}(),r.debug("CONTENT","Extracted from body, length: ".concat(s.length))),s.length<200&&(s=function(){var t=[];function n(e){if(e.nodeType===Node.TEXT_NODE){var r,o=null===(r=e.textContent)||void 0===r?void 0:r.trim();o&&o.length>10&&t.push(e)}else{if(e.nodeType===Node.ELEMENT_NODE){var a=e;if(null===a.offsetParent||"SCRIPT"===a.tagName||"STYLE"===a.tagName||"NOSCRIPT"===a.tagName||"DIV"===a.tagName&&(a.classList.contains("hidden")||"none"===a.style.display||"hidden"===a.style.visibility))return}for(var i=0;i=0&&r.left>=0&&r.bottom<=e&&r.right<=window.innerWidth})),o="";r.length>0&&(o=r.map((function(t){var n;return null===(n=t.textContent)||void 0===n?void 0:n.trim()})).filter((function(t){return t&&t.length>0})).join("\n"));o.length<200&&t.length>r.length&&(o=t.map((function(t){var n;return null===(n=t.textContent)||void 0===n?void 0:n.trim()})).filter((function(t){return t&&t.length>0})).join("\n"));return o.substring(0,15e3)}());var w={title:e,url:i,description:l,headings:d,content:s,faviconUrl:c,text:s};return r.info("CONTENT",'Page content extracted: Title="'.concat(w.title,'", URL=').concat(w.url,", Content length=").concat((null===(n=w.content)||void 0===n?void 0:n.length)||0,")")),w}window.__CHAT_LOADED=!0,chrome.runtime.onMessage.addListener((function(e,o,a){if(e.action===t){r.info("CONTENT","Received GET_PAGE_CONTENT message from ".concat(o.tab?"tab "+o.tab.id:"extension"));try{var i,c;r.info("CONTENT","Starting content extraction for ".concat(window.location.href));var u=performance.now(),d=l(),s=performance.now();r.info("CONTENT","Content extraction completed in ".concat((s-u).toFixed(2),"ms, sending response")),r.info("CONTENT","Extracted ".concat((null===(i=d.content)||void 0===i?void 0:i.length)||0," characters of content, ").concat((null===(c=d.headings)||void 0===c?void 0:c.length)||0," headings")),a({success:!0,data:d})}catch(t){r.error("CONTENT","Error getting page content:",t),a({success:!1,error:t.message})}return!0}if(e.action===n)return r.info("CONTENT","Received PING from ".concat(o.tab?"tab "+o.tab.id:"extension")),a({success:!0,message:"PONG",timestamp:Date.now()}),!0})),r.info("CONTENT","Chat content script loaded")})(); \ No newline at end of file diff --git a/files/ai_side_panel/sidepanel.js b/files/ai_side_panel/sidepanel.js index e5bf3d183..6e8811e7f 100644 --- a/files/ai_side_panel/sidepanel.js +++ b/files/ai_side_panel/sidepanel.js @@ -1,2 +1,2 @@ /*! For license information please see sidepanel.js.LICENSE.txt */ -(()=>{var e={56:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},72:e=>{"use strict";var t=[];function n(e){for(var n=-1,r=0;r{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},119:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var r=n(601),o=n.n(r),i=n(314),a=n.n(i)()(o());a.push([e.id,'/* ChatGPT-like UI Styling */\n\n/* Root Elements */\nhtml, body, #root {\n margin: 0 !important;\n padding: 0 !important;\n width: 100% !important;\n height: 100% !important;\n background-color: #1e1e1e !important;\n color: #e8eaed !important;\n overflow: hidden !important;\n border: none !important;\n outline: none !important;\n}\n\n/* Chrome Extension Specific */\n:host, :root {\n background-color: #1e1e1e !important;\n color: #e8eaed !important;\n --bg-color: #1e1e1e !important;\n}\n\n/* This ensures any Chrome-injected containers also get dark backgrounds */\ndiv[jsslot], .side-panel-container, .panel-content, div[role="dialog"], \ndiv[role="complementary"], div[role="application"], div[class*="panel"],\ndiv[class*="side"], div[class*="extension"] {\n background-color: #1e1e1e !important;\n border: none !important;\n outline: none !important;\n box-shadow: none !important;\n margin: 0 !important;\n padding: 0 !important;\n}\n\n/* App Container */\n.app-container {\n display: flex;\n flex-direction: column;\n height: 100vh;\n width: 100%;\n background-color: #1e1e1e;\n overflow: hidden;\n font-family: \'Google Sans\', \'Roboto\', -apple-system, BlinkMacSystemFont, \'Segoe UI\', sans-serif;\n border: none !important;\n outline: none !important;\n margin: 0 !important;\n padding: 0 !important;\n}\n\n/* Side Panel Header */\n.sidepanel-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px;\n border-bottom: 1px solid #3c4043;\n background-color: #1e1e1e;\n position: sticky;\n top: 0;\n left: 0;\n right: 0;\n width: 100%;\n z-index: 1000;\n box-sizing: border-box;\n}\n\n.header-controls {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-left: auto;\n}\n\n.header-button {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n background-color: transparent;\n border-radius: 4px;\n cursor: pointer;\n color: #e8eaed;\n padding: 0;\n margin-top: 4px;\n margin-bottom: 4px;\n}\n\n.header-button:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n\n.header-button:active {\n background-color: rgba(255, 255, 255, 0.2);\n}\n\n.sidepanel-header .model-selector-container {\n margin-right: auto;\n position: relative;\n z-index: 100;\n}\n\n.sidepanel-header .model-selector-button {\n display: flex;\n align-items: center;\n gap: 6px;\n background-color: transparent;\n border: none;\n border-radius: 4px;\n padding: 4px 8px;\n color: #e8eaed;\n font-size: 12px;\n cursor: pointer;\n transition: all 0.2s ease;\n}\n\n.sidepanel-header .model-selector-button:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n\n.sidepanel-header .model-name {\n font-weight: 400;\n}\n\n.sidepanel-header .dropdown-arrow {\n font-size: 8px;\n margin-left: 2px;\n opacity: 0.7;\n}\n\n/* Chat Container */\n.chat-container {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n max-width: 800px;\n margin: 0 auto;\n background-color: rgba(32, 33, 36, 0.9);\n padding-top: 50px;\n}\n\n/* Debug Card */\n.debug-card {\n margin: 10px;\n margin-top: 60px;\n padding: 8px;\n background-color: rgba(0, 0, 0, 0.3);\n border: 1px solid #444;\n border-radius: 6px;\n font-size: 12px;\n color: #aaa;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n}\n\n.debug-header {\n font-weight: bold;\n padding-bottom: 4px;\n margin-bottom: 4px;\n border-bottom: 1px solid #444;\n color: #ff9800;\n}\n\n.debug-content p {\n margin: 4px 0;\n font-family: monospace;\n word-break: break-all;\n}\n\n/* Messages List */\n.messages-list {\n display: flex;\n flex-direction: column;\n flex: 1;\n overflow-y: auto;\n padding: 1rem;\n gap: 1rem;\n scrollbar-width: thin;\n scrollbar-color: #5f6368 transparent;\n}\n\n.messages-list::-webkit-scrollbar {\n width: 6px;\n}\n\n.messages-list::-webkit-scrollbar-track {\n background: transparent;\n}\n\n.messages-list::-webkit-scrollbar-thumb {\n background-color: #5f6368;\n border-radius: 10px;\n}\n\n/* Message */\n.message {\n display: flex;\n margin-bottom: 1rem;\n max-width: 85%;\n}\n\n.user-message {\n align-self: flex-end;\n}\n\n.assistant-message {\n align-self: flex-start;\n}\n\n.message-content {\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n\n.message-bubble {\n padding: 0.75rem 1rem;\n border-radius: 18px;\n position: relative;\n word-wrap: break-word;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);\n line-height: 1.4;\n}\n\n.user-message .message-bubble {\n background-color: #2374e1;\n color: #ffffff;\n border-bottom-right-radius: 4px;\n}\n\n.assistant-message .message-bubble {\n background-color: #3c4043;\n color: #e8eaed;\n border-bottom-left-radius: 4px;\n}\n\n.message-tabs-sources {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin-bottom: 0.5rem;\n}\n\n.tab-source-pill {\n display: flex;\n align-items: center;\n padding: 2px 8px;\n background-color: #3c4043;\n border-radius: 12px;\n font-size: 0.75rem;\n color: #e8eaed;\n}\n\n.message-bubble p {\n margin: 0.5rem 0;\n}\n\n.message-bubble p:first-child {\n margin-top: 0;\n}\n\n.message-bubble p:last-child {\n margin-bottom: 0;\n}\n\n.message-bubble ul, \n.message-bubble ol {\n margin: 0.5rem 0;\n padding-left: 1.5rem;\n}\n\n.message-bubble code {\n background-color: rgba(0, 0, 0, 0.05);\n padding: 0.1rem 0.3rem;\n border-radius: 3px;\n font-size: 0.9em;\n font-family: \'SFMono-Regular\', Consolas, \'Liberation Mono\', Menlo, monospace;\n}\n\n.user-message .message-bubble code {\n background-color: rgba(255, 255, 255, 0.2);\n}\n\n.message-bubble pre {\n background-color: rgba(0, 0, 0, 0.05);\n padding: 0.75rem;\n border-radius: 6px;\n overflow-x: auto;\n margin: 0.75rem 0;\n}\n\n.user-message .message-bubble pre {\n background-color: rgba(255, 255, 255, 0.1);\n}\n\n.message-bubble pre code {\n background: none;\n padding: 0;\n border-radius: 0;\n}\n\n/* Chat Input */\n.chat-input {\n display: flex;\n flex-direction: column;\n padding: 1rem;\n background-color: #282828;\n position: relative;\n}\n\n/* Input Row */\n.input-row {\n display: flex;\n width: 100%;\n align-items: center;\n position: relative;\n max-width: 600px;\n margin: 0 auto;\n}\n\n.input-field {\n flex: 1;\n padding: 1rem 3rem 1rem 1.25rem;\n height: 56px;\n border-radius: 28px;\n border: 1px solid #5f6368;\n outline: none;\n font-size: 1rem;\n font-family: inherit;\n background-color: #282828;\n color: #e8eaed;\n transition: border-color 0.2s ease;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);\n}\n\n.input-field:focus {\n border-color: #5f6368;\n}\n\n.input-field::-moz-placeholder {\n color: #9aa0a6;\n}\n\n.input-field::placeholder {\n color: #9aa0a6;\n}\n\n.send-button {\n position: absolute;\n right: 8px;\n width: 40px;\n height: 40px;\n border: none;\n border-radius: 50%;\n background-color: #3c4043;\n color: #e8eaed;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n transform: translateY(0);\n transition: transform 0.1s ease, background-color 0.2s ease;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);\n}\n\n.send-button:hover {\n background-color: #444;\n transform: translateY(-1px);\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);\n}\n\n.send-button:active {\n transform: translateY(1px);\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\n}\n\n.send-button svg {\n width: 20px;\n height: 20px;\n transform: rotate(0deg);\n}\n\n.send-button:disabled {\n background-color: #5f6368;\n cursor: not-allowed;\n}\n\n/* Typing Indicator */\n.typing-indicator {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0.5rem 1rem;\n min-width: 60px;\n min-height: 35px;\n}\n\n.typing-indicator span {\n display: inline-block;\n width: 8px;\n height: 8px;\n margin: 0 2px;\n background-color: #5f6368;\n border-radius: 50%;\n opacity: 0.6;\n animation: typing 1.4s infinite both;\n}\n\n.typing-indicator span:nth-child(2) {\n animation-delay: 0.2s;\n}\n\n.typing-indicator span:nth-child(3) {\n animation-delay: 0.4s;\n}\n\n@keyframes typing {\n 0% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-5px);\n }\n 100% {\n transform: translateY(0);\n }\n}\n\n/* Loading Indicator */\n.loading-indicator {\n width: 100%;\n display: flex;\n justify-content: flex-start;\n align-items: flex-start;\n padding: 0;\n}\n\n.loading-indicator .message {\n margin: 0;\n max-width: 85%;\n}\n\n.loading-indicator .message-bubble {\n background-color: #3c4043;\n color: #e8eaed;\n border-bottom-left-radius: 4px;\n margin-right: auto;\n text-align: left;\n}\n\n/* Tab Selector Loading */\n.tab-selector-content .loading-indicator, .no-tabs-message {\n text-align: center;\n padding: 2rem;\n color: #9aa0a6;\n justify-content: center;\n}\n\n/* Welcome Screen */\n.welcome-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100%;\n text-align: center;\n padding: 2rem;\n background-color: #282828;\n}\n\n.welcome-message {\n max-width: 600px;\n margin: 0 auto;\n}\n\n.welcome-message h1 {\n font-size: 2rem;\n margin-bottom: 1rem;\n color: #1a73e8;\n}\n\n.welcome-message p {\n font-size: 1.1rem;\n color: #9aa0a6;\n margin-bottom: 2rem;\n}\n\n.start-button {\n padding: 0.75rem 2rem;\n border: none;\n border-radius: 2rem;\n background-color: #1a73e8;\n color: white;\n font-size: 1.1rem;\n font-weight: 500;\n cursor: pointer;\n transition: background-color 0.2s ease;\n}\n\n.start-button:hover {\n background-color: #1557b0;\n}\n\n/* Tab Selector Styles */\n.tab-selector-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1000;\n}\n\n.tab-selector-modal {\n background-color: #282828;\n border-radius: 8px;\n width: 90%;\n max-width: 600px;\n max-height: 80vh;\n display: flex;\n flex-direction: column;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n}\n\n.tab-selector-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 1rem;\n border-bottom: 1px solid #5f6368;\n}\n\n.tab-selector-header h3 {\n margin: 0;\n font-size: 1.2rem;\n color: #e8eaed;\n}\n\n.close-button {\n background: none;\n border: none;\n font-size: 1.5rem;\n cursor: pointer;\n color: #9aa0a6;\n}\n\n.tab-selector-content {\n flex: 1;\n overflow-y: auto;\n padding: 1rem;\n max-height: 50vh;\n}\n\n.tabs-list {\n list-style: none;\n padding: 0;\n margin: 0;\n}\n\n.tab-item {\n display: flex;\n align-items: center;\n padding: 0.75rem;\n border-radius: 4px;\n cursor: pointer;\n transition: background-color 0.2s;\n margin-bottom: 0.5rem;\n border: 1px solid #5f6368;\n}\n\n.tab-item:hover {\n background-color: #3c4043;\n}\n\n.tab-item.selected {\n background-color: #3c4043;\n border-color: #1a73e8;\n}\n\n.tab-icon {\n width: 16px;\n height: 16px;\n margin-right: 10px;\n flex-shrink: 0;\n}\n\n.tab-icon img {\n width: 100%;\n height: 100%;\n -o-object-fit: contain;\n object-fit: contain;\n}\n\n.default-icon {\n width: 100%;\n height: 100%;\n background-color: #5f6368;\n border-radius: 50%;\n}\n\n.tab-info {\n flex: 1;\n overflow: hidden;\n}\n\n.tab-title {\n font-weight: 500;\n margin-bottom: 3px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n color: #e8eaed;\n}\n\n.tab-url {\n font-size: 0.8rem;\n color: #9aa0a6;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.tab-checkbox {\n margin-left: 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.tab-checkbox input[type="checkbox"] {\n width: 16px;\n height: 16px;\n cursor: pointer;\n accent-color: #8ab4f8;\n}\n\n.tab-selector-footer {\n display: flex;\n justify-content: flex-end;\n padding: 1rem;\n border-top: 1px solid #5f6368;\n gap: 10px;\n}\n\n.cancel-button, .confirm-button {\n padding: 0.5rem 1rem;\n border-radius: 4px;\n cursor: pointer;\n font-weight: 500;\n}\n\n.cancel-button {\n background: none;\n border: 1px solid #5f6368;\n color: #9aa0a6;\n}\n\n.confirm-button {\n background-color: #1a73e8;\n border: none;\n color: white;\n}\n\n.confirm-button:disabled {\n background-color: #5f6368;\n cursor: not-allowed;\n}\n\n/* Tab Trigger Indicator */\n.tab-trigger-indicator {\n width: 100%;\n padding: 0.5rem 1rem;\n background-color: #3c4043;\n color: #1a73e8;\n border-radius: 0.5rem;\n margin-bottom: 0.5rem;\n font-size: 0.9rem;\n display: flex;\n align-items: center;\n border-left: 3px solid #1a73e8;\n}\n\n/* Tab Dropdown Styles */\n.tab-dropdown {\n position: absolute;\n left: 0;\n width: 100%;\n background-color: #282828;\n border-radius: 12px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);\n z-index: 100;\n max-height: 300px;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n border: 1px solid #5f6368;\n}\n\n.tab-dropdown-above {\n bottom: 100%;\n margin-bottom: 5px;\n}\n\n/* We\'re not using this anymore, but keeping it commented for reference */\n/* .tab-dropdown-below {\n top: 100%;\n margin-top: 5px;\n} */\n\n.tab-dropdown-header {\n padding: 10px 15px;\n background-color: #3c4043;\n border-bottom: 1px solid #5f6368;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.tab-dropdown-title {\n color: #e8eaed;\n font-weight: 500;\n font-size: 0.9rem;\n}\n\n.tab-dropdown-close-btn {\n background: none;\n border: none;\n color: #9aa0a6;\n font-size: 1.5rem;\n line-height: 1;\n cursor: pointer;\n padding: 0;\n width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.tab-dropdown-close-btn:hover {\n color: #e8eaed;\n}\n\n.tab-dropdown-content {\n overflow-y: auto;\n max-height: 250px;\n}\n\n.tabs-dropdown-list {\n list-style: none;\n padding: 0;\n margin: 0;\n}\n\n.tab-dropdown-item {\n display: flex;\n align-items: center;\n padding: 10px 15px;\n cursor: pointer;\n transition: background-color 0.2s;\n border-bottom: 1px solid #5f6368;\n}\n\n.tab-dropdown-item:hover {\n background-color: #3c4043;\n}\n\n.tab-dropdown-item.active {\n background-color: #444;\n}\n\n.tab-dropdown-item.selected {\n background-color: #3c4043;\n}\n\n.tab-dropdown-item.active.selected {\n background-color: #4a4a4c;\n}\n\n.tab-dropdown-item .tab-icon {\n width: 16px;\n height: 16px;\n margin-right: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.tab-dropdown-item .tab-icon img {\n width: 100%;\n height: 100%;\n -o-object-fit: contain;\n object-fit: contain;\n}\n\n.tab-dropdown-item .default-icon {\n width: 16px;\n height: 16px;\n background-color: #5f6368;\n border-radius: 50%;\n}\n\n.tab-dropdown-item .tab-info {\n flex: 1;\n}\n\n.tab-dropdown-item .tab-title {\n color: #e8eaed;\n font-size: 0.9rem;\n margin-bottom: 2px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.tab-dropdown-item .tab-url {\n color: #9aa0a6;\n font-size: 0.75rem;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.tab-dropdown-help, .tab-dropdown-footer, .tab-checkbox {\n display: none;\n}\n\n.tab-dropdown-footer {\n display: flex;\n justify-content: flex-end;\n padding: 10px 15px;\n border-top: 1px solid #5f6368;\n gap: 10px;\n background-color: #3c4043;\n}\n\n.cancel-button, .confirm-button {\n padding: 6px 12px;\n border-radius: 4px;\n cursor: pointer;\n font-weight: 500;\n font-size: 0.9rem;\n}\n\n.cancel-button {\n background: none;\n border: 1px solid #5f6368;\n color: #9aa0a6;\n}\n\n.confirm-button {\n background-color: #8ab4f8;\n border: none;\n color: #202124;\n}\n\n.confirm-button:disabled {\n background-color: #5f6368;\n color: #888;\n cursor: not-allowed;\n}\n\n/* Debug Panel Styles */\n.debug-panel {\n background-color: #282828;\n color: #e0e0e0;\n border-radius: 8px;\n padding: 12px;\n margin-bottom: 16px;\n font-family: monospace;\n max-height: 300px;\n overflow: auto;\n}\n\n.debug-panel h3 {\n margin-top: 0;\n margin-bottom: 8px;\n color: #61dafb;\n font-size: 16px;\n border-bottom: 1px solid #5f6368;\n padding-bottom: 4px;\n}\n\n.debug-logs {\n font-size: 12px;\n line-height: 1.4;\n}\n\n.debug-log-entry {\n padding: 4px 0;\n border-bottom: 1px dotted #5f6368;\n white-space: pre-wrap;\n word-break: break-word;\n}\n\n.debug-log-entry:last-child {\n border-bottom: none;\n}\n\n/* Tab Source Indicators in Messages */\n.message-tabs-sources {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin-bottom: 8px;\n}\n\n.tab-source-pill {\n display: flex;\n align-items: center;\n padding: 3px 8px;\n background-color: #3c4043;\n border: 1px solid #5f6368;\n border-radius: 12px;\n font-size: 0.75rem;\n color: #e8eaed;\n max-width: 150px;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n.tab-source-icon {\n width: 12px;\n height: 12px;\n margin-right: 4px;\n -o-object-fit: contain;\n object-fit: contain;\n}\n\n/* Selected Tabs in Input Area */\n.selected-tabs-container {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-bottom: 10px;\n padding: 8px;\n background-color: #282828;\n border-radius: 8px;\n max-width: 600px;\n margin-left: 0;\n margin-right: auto;\n justify-content: flex-start;\n}\n\n.selected-tab-pill {\n display: flex;\n align-items: center;\n padding: 4px 12px;\n background-color: #3c4043;\n border-radius: 16px;\n font-size: 0.8rem;\n color: #e8eaed;\n margin-bottom: 4px;\n}\n\n.tab-icon-small {\n width: 14px;\n height: 14px;\n margin-right: 6px;\n -o-object-fit: contain;\n object-fit: contain;\n}\n\n.selected-tab-title {\n max-width: 120px;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n.remove-tab-btn {\n background: none;\n border: none;\n color: #9aa0a6;\n font-size: 1rem;\n cursor: pointer;\n padding: 0 0 0 6px;\n margin-left: 4px;\n line-height: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.remove-tab-btn:hover {\n color: #e8eaed;\n}\n\n/* Tab Card Styles */\n.tab-card {\n margin: 10px 0;\n max-width: 100%;\n border-radius: 24px;\n border: 1px solid #5f6368;\n overflow: hidden;\n background-color: #282828;\n box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.03);\n transition: all 0.2s ease;\n}\n\n.tab-card:hover {\n transform: translateY(-2px);\n box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n}\n\n.tab-card.highlighted {\n background-color: #282828;\n border-color: #5f6368;\n}\n\n.tab-card-content {\n display: flex;\n align-items: center;\n padding: 16px;\n gap: 12px;\n}\n\n.tab-favicon-container {\n width: 32px;\n height: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 8px;\n background-color: #282828;\n padding: 4px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);\n flex-shrink: 0;\n}\n\n.tab-favicon {\n width: 20px;\n height: 20px;\n -o-object-fit: contain;\n object-fit: contain;\n}\n\n.tab-info {\n flex: 1;\n overflow: hidden;\n}\n\n.tab-title {\n color: #e8eaed;\n font-size: 14px;\n font-weight: 500;\n margin-bottom: 4px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.tab-url {\n color: #9aa0a6;\n font-size: 12px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.tab-action {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n}\n\n.tab-current-indicator {\n padding: 4px 8px;\n font-size: 12px;\n font-weight: 500;\n border-radius: 12px;\n background-color: #1a73e8;\n color: #e8eaed;\n}\n\n/* Dark mode styles */\n.dark .tab-card {\n background-color: #282828;\n border-color: #5f6368;\n box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.2);\n}\n\n.dark .tab-card:hover {\n box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.25);\n}\n\n.dark .tab-card.highlighted {\n background-color: #282828;\n}\n\n/* Model Selector Styles */\n.top-nav {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 4px 8px;\n background-color: #1e1e1e;\n border-bottom: 1px solid #3c4043;\n position: sticky;\n top: 0;\n z-index: 100;\n}\n\n.model-selector-container {\n position: relative;\n z-index: 100;\n}\n\n.model-selector-button {\n display: flex;\n align-items: center;\n gap: 6px;\n background-color: transparent;\n border: none;\n border-radius: 4px;\n padding: 3px 6px;\n color: #e8eaed;\n font-size: 12px;\n cursor: pointer;\n transition: all 0.2s ease;\n}\n\n.model-selector-button:hover {\n background-color: #3c4043;\n}\n\n.model-name {\n font-weight: 400;\n}\n\n.dropdown-arrow {\n font-size: 8px;\n margin-left: 2px;\n opacity: 0.7;\n}\n\n.model-dropdown {\n position: absolute;\n top: 100%;\n left: 0;\n width: 180px;\n background-color: #2d2d2d;\n border: 1px solid #5f6368;\n border-radius: 4px;\n margin-top: 4px;\n box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);\n overflow: hidden;\n}\n\n.model-list {\n list-style: none;\n padding: 0;\n margin: 0;\n max-height: 300px;\n overflow-y: auto;\n}\n\n.model-option {\n padding: 8px 12px;\n cursor: pointer;\n border-bottom: 1px solid #3c4043;\n transition: background-color 0.2s ease;\n}\n\n.model-option:last-child {\n border-bottom: none;\n}\n\n.model-option:hover {\n background-color: #3c4043;\n}\n\n.model-option.selected {\n background-color: rgba(138, 180, 248, 0.1);\n border-left: 2px solid #8ab4f8;\n}\n\n.model-option-name {\n color: #e8eaed;\n font-weight: 400;\n font-size: 12px;\n}\n\n.model-option-web {\n color: #8ab4f8;\n font-size: 11px;\n margin-top: 2px;\n display: flex;\n align-items: center;\n}\n\n.model-option-web::before {\n content: "🔍";\n margin-right: 4px;\n font-size: 9px;\n}\n',""]);const l=a},133:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n=null;if(!e||"string"!=typeof e)return n;var r=(0,o.default)(e),i="function"==typeof t;return r.forEach((function(e){if("declaration"===e.type){var r=e.property,o=e.value;i?t(r,o,e):o&&((n=n||{})[r]=o)}})),n};var o=r(n(788))},159:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},221:(e,t,n)=>{"use strict";var r=n(540);function o(e){var t="https://react.dev/errors/"+e;if(1{"use strict";var r=n(982),o=n(540),i=n(961);function a(e){var t="https://react.dev/errors/"+e;if(1F||(e.current=M[F],M[F]=null,F--)}function U(e,t){F++,M[F]=e.current,e.current=t}var B=j(null),H=j(null),q=j(null),V=j(null);function W(e,t){switch(U(q,t),U(H,e),U(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?of(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)e=af(t=of(t),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}$(B),U(B,e)}function Q(){$(B),$(H),$(q)}function X(e){null!==e.memoizedState&&U(V,e);var t=B.current,n=af(t,e.type);t!==n&&(U(H,e),U(B,n))}function K(e){H.current===e&&($(B),$(H)),V.current===e&&($(V),Kf._currentValue=z)}var Y=Object.prototype.hasOwnProperty,G=r.unstable_scheduleCallback,J=r.unstable_cancelCallback,Z=r.unstable_shouldYield,ee=r.unstable_requestPaint,te=r.unstable_now,ne=r.unstable_getCurrentPriorityLevel,re=r.unstable_ImmediatePriority,oe=r.unstable_UserBlockingPriority,ie=r.unstable_NormalPriority,ae=r.unstable_LowPriority,le=r.unstable_IdlePriority,se=r.log,ue=r.unstable_setDisableYieldValue,ce=null,fe=null;function de(e){if("function"==typeof se&&ue(e),fe&&"function"==typeof fe.setStrictMode)try{fe.setStrictMode(ce,e)}catch(e){}}var pe=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(he(e)/me|0)|0},he=Math.log,me=Math.LN2;var ge=256,ye=4194304;function be(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194048&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ve(e,t,n){var r=e.pendingLanes;if(0===r)return 0;var o=0,i=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var l=134217727&r;return 0!==l?0!==(r=l&~i)?o=be(r):0!==(a&=l)?o=be(a):n||0!==(n=l&~e)&&(o=be(n)):0!==(l=r&~i)?o=be(l):0!==a?o=be(a):n||0!==(n=r&~e)&&(o=be(n)),0===o?0:0!==t&&t!==o&&!(t&i)&&((i=o&-o)>=(n=t&-t)||32===i&&4194048&n)?t:o}function we(e,t){return!(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function xe(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function ke(){var e=ge;return!(4194048&(ge<<=1))&&(ge=256),e}function Se(){var e=ye;return!(62914560&(ye<<=1))&&(ye=4194304),e}function Ee(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function _e(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ce(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-pe(t);e.entangledLanes|=t,e.entanglements[r]=1073741824|e.entanglements[r]|4194090&n}function Te(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-pe(n),o=1<)":-1--o||s[r]!==u[o]){var c="\n"+s[r].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}}while(1<=r&&0<=o);break}}}finally{it=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ot(n):""}function lt(e){switch(e.tag){case 26:case 27:case 5:return ot(e.type);case 16:return ot("Lazy");case 13:return ot("Suspense");case 19:return ot("SuspenseList");case 0:case 15:return at(e.type,!1);case 11:return at(e.type.render,!1);case 1:return at(e.type,!0);case 31:return ot("Activity");default:return""}}function st(e){try{var t="";do{t+=lt(e),e=e.return}while(e);return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}function ut(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function ct(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function ft(e){e._valueTracker||(e._valueTracker=function(e){var t=ct(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(e){r=""+e,i.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function dt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ct(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function pt(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}var ht=/[\n"\\]/g;function mt(e){return e.replace(ht,(function(e){return"\\"+e.charCodeAt(0).toString(16)+" "}))}function gt(e,t,n,r,o,i,a,l){e.name="",null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a?e.type=a:e.removeAttribute("type"),null!=t?"number"===a?(0===t&&""===e.value||e.value!=t)&&(e.value=""+ut(t)):e.value!==""+ut(t)&&(e.value=""+ut(t)):"submit"!==a&&"reset"!==a||e.removeAttribute("value"),null!=t?bt(e,a,ut(t)):null!=n?bt(e,a,ut(n)):null!=r&&e.removeAttribute("value"),null==o&&null!=i&&(e.defaultChecked=!!i),null!=o&&(e.checked=o&&"function"!=typeof o&&"symbol"!=typeof o),null!=l&&"function"!=typeof l&&"symbol"!=typeof l&&"boolean"!=typeof l?e.name=""+ut(l):e.removeAttribute("name")}function yt(e,t,n,r,o,i,a,l){if(null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i&&(e.type=i),null!=t||null!=n){if(("submit"===i||"reset"===i)&&null==t)return;n=null!=n?""+ut(n):"",t=null!=t?""+ut(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}r="function"!=typeof(r=null!=r?r:o)&&"symbol"!=typeof r&&!!r,e.checked=l?e.checked:!!r,e.defaultChecked=!!r,null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a&&(e.name=a)}function bt(e,t,n){"number"===t&&pt(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function vt(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o=Sn),Cn=String.fromCharCode(32),Tn=!1;function Pn(e,t){switch(e){case"keyup":return-1!==xn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function An(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Ln=!1;var In={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function On(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!In[e.type]:"textarea"===t}function Nn(e,t,n,r){Ot?Nt?Nt.push(r):Nt=[r]:Ot=r,0<(t=qc(t,"onChange")).length&&(n=new Zt("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Rn=null,Dn=null;function zn(e){zc(e,0)}function Mn(e){if(dt(He(e)))return e}function Fn(e,t){if("change"===e)return t}var jn=!1;if(Ft){var $n;if(Ft){var Un="oninput"in document;if(!Un){var Bn=document.createElement("div");Bn.setAttribute("oninput","return;"),Un="function"==typeof Bn.oninput}$n=Un}else $n=!1;jn=$n&&(!document.documentMode||9=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Gn(r)}}function Zn(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?Zn(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function er(e){for(var t=pt((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=pt((e=t.contentWindow).document)}return t}function tr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var nr=Ft&&"documentMode"in document&&11>=document.documentMode,rr=null,or=null,ir=null,ar=!1;function lr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;ar||null==rr||rr!==pt(r)||("selectionStart"in(r=rr)&&tr(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},ir&&Yn(ir,r)||(ir=r,0<(r=qc(or,"onSelect")).length&&(t=new Zt("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=rr)))}function sr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ur={animationend:sr("Animation","AnimationEnd"),animationiteration:sr("Animation","AnimationIteration"),animationstart:sr("Animation","AnimationStart"),transitionrun:sr("Transition","TransitionRun"),transitionstart:sr("Transition","TransitionStart"),transitioncancel:sr("Transition","TransitionCancel"),transitionend:sr("Transition","TransitionEnd")},cr={},fr={};function dr(e){if(cr[e])return cr[e];if(!ur[e])return e;var t,n=ur[e];for(t in n)if(n.hasOwnProperty(t)&&t in fr)return cr[e]=n[t];return e}Ft&&(fr=document.createElement("div").style,"AnimationEvent"in window||(delete ur.animationend.animation,delete ur.animationiteration.animation,delete ur.animationstart.animation),"TransitionEvent"in window||delete ur.transitionend.transition);var pr=dr("animationend"),hr=dr("animationiteration"),mr=dr("animationstart"),gr=dr("transitionrun"),yr=dr("transitionstart"),br=dr("transitioncancel"),vr=dr("transitionend"),wr=new Map,xr="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function kr(e,t){wr.set(e,t),Xe(t,[e])}xr.push("scrollEnd");var Sr=new WeakMap;function Er(e,t){if("object"==typeof e&&null!==e){var n=Sr.get(e);return void 0!==n?n:(t={value:e,source:t,stack:st(t)},Sr.set(e,t),t)}return{value:e,source:t,stack:st(t)}}var _r=[],Cr=0,Tr=0;function Pr(){for(var e=Cr,t=Tr=Cr=0;t>=a,o-=a,Gr=1<<32-pe(t)+o|n<i?i:8;var a,l,s,u=R.T,c={};R.T=c,Ua(e,!1,t,n);try{var f=o(),d=R.S;if(null!==d&&d(c,f),null!==f&&"object"==typeof f&&"function"==typeof f.then)$a(e,t,(a=r,l=[],s={status:"pending",value:null,reason:null,then:function(e){l.push(e)}},f.then((function(){s.status="fulfilled",s.value=a;for(var e=0;eh?(m=f,f=null):m=f.sibling;var g=p(o,f,l[h],s);if(null===g){null===f&&(f=m);break}e&&f&&null===g.alternate&&t(o,f),a=i(g,a,h),null===c?u=g:c.sibling=g,c=g,f=m}if(h===l.length)return n(o,f),io&&Zr(o,h),u;if(null===f){for(;hm?(g=h,h=null):g=h.sibling;var v=p(o,h,b.value,u);if(null===v){null===h&&(h=g);break}e&&h&&null===v.alternate&&t(o,h),l=i(v,l,m),null===f?c=v:f.sibling=v,f=v,h=g}if(b.done)return n(o,h),io&&Zr(o,m),c;if(null===h){for(;!b.done;m++,b=s.next())null!==(b=d(o,b.value,u))&&(l=i(b,l,m),null===f?c=b:f.sibling=b,f=b);return io&&Zr(o,m),c}for(h=r(h);!b.done;m++,b=s.next())null!==(b=y(h,o,m,b.value,u))&&(e&&null!==b.alternate&&h.delete(null===b.key?m:b.key),l=i(b,l,m),null===f?c=b:f.sibling=b,f=b);return e&&h.forEach((function(e){return t(o,e)})),io&&Zr(o,m),c}(s,u,c=v.call(c),f)}if("function"==typeof c.then)return b(s,u,Ga(c),f);if(c.$$typeof===x)return b(s,u,Po(s,c),f);Za(s,c)}return"string"==typeof c&&""!==c||"number"==typeof c||"bigint"==typeof c?(c=""+c,null!==u&&6===u.tag?(n(s,u.sibling),(f=o(u,c)).return=s,s=f):(n(s,u),(f=Br(c,s.mode,f)).return=s,s=f),l(s)):n(s,u)}return function(e,t,n,r){try{Ya=0;var o=b(e,t,n,r);return Ka=null,o}catch(t){if(t===Wo||t===Xo)throw t;var i=zr(29,t,null,e.mode);return i.lanes=r,i.return=e,i}}}var nl=tl(!0),rl=tl(!1),ol=j(null),il=null;function al(e){var t=e.alternate;U(cl,1&cl.current),U(ol,e),null===il&&(null===t||null!==hi.current||null!==t.memoizedState)&&(il=e)}function ll(e){if(22===e.tag){if(U(cl,cl.current),U(ol,e),null===il){var t=e.alternate;null!==t&&null!==t.memoizedState&&(il=e)}}else sl()}function sl(){U(cl,cl.current),U(ol,ol.current)}function ul(e){$(ol),il===e&&(il=null),$(cl)}var cl=j(0);function fl(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||yf(n)))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function dl(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:d({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var pl={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ru(),o=ii(r);o.payload=t,null!=n&&(o.callback=n),null!==(t=ai(e,o,r))&&(zu(t,e,r),li(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ru(),o=ii(r);o.tag=1,o.payload=t,null!=n&&(o.callback=n),null!==(t=ai(e,o,r))&&(zu(t,e,r),li(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ru(),r=ii(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=ai(e,r,n))&&(zu(t,e,n),li(t,e,n))}};function hl(e,t,n,r,o,i,a){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,i,a):!t.prototype||!t.prototype.isPureReactComponent||(!Yn(n,r)||!Yn(o,i))}function ml(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&pl.enqueueReplaceState(t,t.state,null)}function gl(e,t){var n=t;if("ref"in t)for(var r in n={},t)"ref"!==r&&(n[r]=t[r]);if(e=e.defaultProps)for(var o in n===t&&(n=d({},n)),e)void 0===n[o]&&(n[o]=e[o]);return n}var yl="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e)};function bl(e){yl(e)}function vl(e){}function wl(e){yl(e)}function xl(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(e){setTimeout((function(){throw e}))}}function kl(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(e){setTimeout((function(){throw e}))}}function Sl(e,t,n){return(n=ii(n)).tag=3,n.payload={element:null},n.callback=function(){xl(e,t)},n}function El(e){return(e=ii(e)).tag=3,e}function _l(e,t,n,r){var o=n.type.getDerivedStateFromError;if("function"==typeof o){var i=r.value;e.payload=function(){return o(i)},e.callback=function(){kl(t,n,r)}}var a=n.stateNode;null!==a&&"function"==typeof a.componentDidCatch&&(e.callback=function(){kl(t,n,r),"function"!=typeof o&&(null===Eu?Eu=new Set([this]):Eu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:null!==e?e:""})})}var Cl=Error(a(461)),Tl=!1;function Pl(e,t,n,r){t.child=null===e?rl(t,null,n,r):nl(t,e.child,n,r)}function Al(e,t,n,r,o){n=n.render;var i=t.ref;if("ref"in r){var a={};for(var l in r)"ref"!==l&&(a[l]=r[l])}else a=r;return Co(t),r=Oi(e,t,n,a,i,o),l=zi(),null===e||Tl?(io&&l&&to(t),t.flags|=1,Pl(e,t,r,o),t.child):(Mi(e,t,o),Kl(e,t,o))}function Ll(e,t,n,r,o){if(null===e){var i=n.type;return"function"!=typeof i||Mr(i)||void 0!==i.defaultProps||null!==n.compare?((e=$r(n.type,null,r,t,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=i,Il(e,t,i,r,o))}if(i=e.child,!Yl(e,o)){var a=i.memoizedProps;if((n=null!==(n=n.compare)?n:Yn)(a,r)&&e.ref===t.ref)return Kl(e,t,o)}return t.flags|=1,(e=Fr(i,r)).ref=t.ref,e.return=t,t.child=e}function Il(e,t,n,r,o){if(null!==e){var i=e.memoizedProps;if(Yn(i,r)&&e.ref===t.ref){if(Tl=!1,t.pendingProps=r=i,!Yl(e,o))return t.lanes=e.lanes,Kl(e,t,o);131072&e.flags&&(Tl=!0)}}return Dl(e,t,n,r,o)}function Ol(e,t,n){var r=t.pendingProps,o=r.children,i=null!==e?e.memoizedState:null;if("hidden"===r.mode){if(128&t.flags){if(r=null!==i?i.baseLanes|n:n,null!==e){for(o=t.child=e.child,i=0;null!==o;)i=i|o.lanes|o.childLanes,o=o.sibling;t.childLanes=i&~r}else t.childLanes=0,t.child=null;return Nl(e,t,r,n)}if(!(536870912&n))return t.lanes=t.childLanes=536870912,Nl(e,t,null!==i?i.baseLanes|n:n,n);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&qo(0,null!==i?i.cachePool:null),null!==i?gi(t,i):yi(),ll(t)}else null!==i?(qo(0,i.cachePool),gi(t,i),sl(),t.memoizedState=null):(null!==e&&qo(0,null),yi(),sl());return Pl(e,t,o,n),t.child}function Nl(e,t,n,r){var o=Ho();return o=null===o?null:{parent:No._currentValue,pool:o},t.memoizedState={baseLanes:n,cachePool:o},null!==e&&qo(0,null),yi(),ll(t),null!==e&&Eo(e,t,r,!0),null}function Rl(e,t){var n=t.ref;if(null===n)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof n&&"object"!=typeof n)throw Error(a(284));null!==e&&e.ref===n||(t.flags|=4194816)}}function Dl(e,t,n,r,o){return Co(t),n=Oi(e,t,n,r,void 0,o),r=zi(),null===e||Tl?(io&&r&&to(t),t.flags|=1,Pl(e,t,n,o),t.child):(Mi(e,t,o),Kl(e,t,o))}function zl(e,t,n,r,o,i){return Co(t),t.updateQueue=null,n=Ri(t,r,n,o),Ni(e),r=zi(),null===e||Tl?(io&&r&&to(t),t.flags|=1,Pl(e,t,n,i),t.child):(Mi(e,t,i),Kl(e,t,i))}function Ml(e,t,n,r,o){if(Co(t),null===t.stateNode){var i=Rr,a=n.contextType;"object"==typeof a&&null!==a&&(i=To(a)),i=new n(r,i),t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,i.updater=pl,t.stateNode=i,i._reactInternals=t,(i=t.stateNode).props=r,i.state=t.memoizedState,i.refs={},ri(t),a=n.contextType,i.context="object"==typeof a&&null!==a?To(a):Rr,i.state=t.memoizedState,"function"==typeof(a=n.getDerivedStateFromProps)&&(dl(t,n,a,r),i.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(a=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),a!==i.state&&pl.enqueueReplaceState(i,i.state,null),fi(t,r,i,o),ci(),i.state=t.memoizedState),"function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!0}else if(null===e){i=t.stateNode;var l=t.memoizedProps,s=gl(n,l);i.props=s;var u=i.context,c=n.contextType;a=Rr,"object"==typeof c&&null!==c&&(a=To(c));var f=n.getDerivedStateFromProps;c="function"==typeof f||"function"==typeof i.getSnapshotBeforeUpdate,l=t.pendingProps!==l,c||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l||u!==a)&&ml(t,i,r,a),ni=!1;var d=t.memoizedState;i.state=d,fi(t,r,i,o),ci(),u=t.memoizedState,l||d!==u||ni?("function"==typeof f&&(dl(t,n,f,r),u=t.memoizedState),(s=ni||hl(t,n,s,r,d,u,a))?(c||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4194308)):("function"==typeof i.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),i.props=r,i.state=u,i.context=a,r=s):("function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,oi(e,t),c=gl(n,a=t.memoizedProps),i.props=c,f=t.pendingProps,d=i.context,u=n.contextType,s=Rr,"object"==typeof u&&null!==u&&(s=To(u)),(u="function"==typeof(l=n.getDerivedStateFromProps)||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(a!==f||d!==s)&&ml(t,i,r,s),ni=!1,d=t.memoizedState,i.state=d,fi(t,r,i,o),ci();var p=t.memoizedState;a!==f||d!==p||ni||null!==e&&null!==e.dependencies&&_o(e.dependencies)?("function"==typeof l&&(dl(t,n,l,r),p=t.memoizedState),(c=ni||hl(t,n,c,r,d,p,s)||null!==e&&null!==e.dependencies&&_o(e.dependencies))?(u||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,p,s),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,p,s)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof i.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),i.props=r,i.state=p,i.context=s,r=c):("function"!=typeof i.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,Rl(e,t),r=!!(128&t.flags),i||r?(i=t.stateNode,n=r&&"function"!=typeof n.getDerivedStateFromError?null:i.render(),t.flags|=1,null!==e&&r?(t.child=nl(t,e.child,null,o),t.child=nl(t,null,n,o)):Pl(e,t,n,o),t.memoizedState=i.state,e=t.child):e=Kl(e,t,o),e}function Fl(e,t,n,r){return ho(),t.flags|=256,Pl(e,t,n,r),t.child}var jl={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $l(e){return{baseLanes:e,cachePool:Vo()}}function Ul(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=gu),e}function Bl(e,t,n){var r,o=t.pendingProps,i=!1,l=!!(128&t.flags);if((r=l)||(r=(null===e||null!==e.memoizedState)&&!!(2&cl.current)),r&&(i=!0,t.flags&=-129),r=!!(32&t.flags),t.flags&=-33,null===e){if(io){if(i?al(t):sl(),io){var s,u=oo;if(s=u){e:{for(s=u,u=lo;8!==s.nodeType;){if(!u){u=null;break e}if(null===(s=bf(s.nextSibling))){u=null;break e}}u=s}null!==u?(t.memoizedState={dehydrated:u,treeContext:null!==Yr?{id:Gr,overflow:Jr}:null,retryLane:536870912,hydrationErrors:null},(s=zr(18,null,null,0)).stateNode=u,s.return=t,t.child=s,ro=t,oo=null,s=!0):s=!1}s||uo(t)}if(null!==(u=t.memoizedState)&&null!==(u=u.dehydrated))return yf(u)?t.lanes=32:t.lanes=536870912,null;ul(t)}return u=o.children,o=o.fallback,i?(sl(),u=ql({mode:"hidden",children:u},i=t.mode),o=Ur(o,i,n,null),u.return=t,o.return=t,u.sibling=o,t.child=u,(i=t.child).memoizedState=$l(n),i.childLanes=Ul(e,r,n),t.memoizedState=jl,o):(al(t),Hl(t,u))}if(null!==(s=e.memoizedState)&&null!==(u=s.dehydrated)){if(l)256&t.flags?(al(t),t.flags&=-257,t=Vl(e,t,n)):null!==t.memoizedState?(sl(),t.child=e.child,t.flags|=128,t=null):(sl(),i=o.fallback,u=t.mode,o=ql({mode:"visible",children:o.children},u),(i=Ur(i,u,n,null)).flags|=2,o.return=t,i.return=t,o.sibling=i,t.child=o,nl(t,e.child,null,n),(o=t.child).memoizedState=$l(n),o.childLanes=Ul(e,r,n),t.memoizedState=jl,t=i);else if(al(t),yf(u)){if(r=u.nextSibling&&u.nextSibling.dataset)var c=r.dgst;r=c,(o=Error(a(419))).stack="",o.digest=r,go({value:o,source:null,stack:null}),t=Vl(e,t,n)}else if(Tl||Eo(e,t,n,!1),r=!!(n&e.childLanes),Tl||r){if(null!==(r=ru)&&(0!==(o=(o=42&(o=n&-n)?1:Pe(o))&(r.suspendedLanes|n)?0:o)&&o!==s.retryLane))throw s.retryLane=o,Ir(e,o),zu(r,e,o),Cl;"$?"===u.data||Qu(),t=Vl(e,t,n)}else"$?"===u.data?(t.flags|=192,t.child=e.child,t=null):(e=s.treeContext,oo=bf(u.nextSibling),ro=t,io=!0,ao=null,lo=!1,null!==e&&(Xr[Kr++]=Gr,Xr[Kr++]=Jr,Xr[Kr++]=Yr,Gr=e.id,Jr=e.overflow,Yr=t),(t=Hl(t,o.children)).flags|=4096);return t}return i?(sl(),i=o.fallback,u=t.mode,c=(s=e.child).sibling,(o=Fr(s,{mode:"hidden",children:o.children})).subtreeFlags=65011712&s.subtreeFlags,null!==c?i=Fr(c,i):(i=Ur(i,u,n,null)).flags|=2,i.return=t,o.return=t,o.sibling=i,t.child=o,o=i,i=t.child,null===(u=e.child.memoizedState)?u=$l(n):(null!==(s=u.cachePool)?(c=No._currentValue,s=s.parent!==c?{parent:c,pool:c}:s):s=Vo(),u={baseLanes:u.baseLanes|n,cachePool:s}),i.memoizedState=u,i.childLanes=Ul(e,r,n),t.memoizedState=jl,o):(al(t),e=(n=e.child).sibling,(n=Fr(n,{mode:"visible",children:o.children})).return=t,n.sibling=null,null!==e&&(null===(r=t.deletions)?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n)}function Hl(e,t){return(t=ql({mode:"visible",children:t},e.mode)).return=e,e.child=t}function ql(e,t){return(e=zr(22,e,null,t)).lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function Vl(e,t,n){return nl(t,e.child,null,n),(e=Hl(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Wl(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),ko(e.return,t,n)}function Ql(e,t,n,r,o){var i=e.memoizedState;null===i?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function Xl(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Pl(e,t,r.children,n),2&(r=cl.current))r=1&r|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Wl(e,n,t);else if(19===e.tag)Wl(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}switch(U(cl,r),o){case"forwards":for(n=t.child,o=null;null!==n;)null!==(e=n.alternate)&&null===fl(e)&&(o=n),n=n.sibling;null===(n=o)?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Ql(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;null!==o;){if(null!==(e=o.alternate)&&null===fl(e)){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Ql(t,!0,n,null,i);break;case"together":Ql(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Kl(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),pu|=t.lanes,!(n&t.childLanes)){if(null===e)return null;if(Eo(e,t,n,!1),!(n&t.childLanes))return null}if(null!==e&&t.child!==e.child)throw Error(a(153));if(null!==t.child){for(n=Fr(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Fr(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Yl(e,t){return!!(e.lanes&t)||!(null===(e=e.dependencies)||!_o(e))}function Gl(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)Tl=!0;else{if(!(Yl(e,n)||128&t.flags))return Tl=!1,function(e,t,n){switch(t.tag){case 3:W(t,t.stateNode.containerInfo),wo(0,No,e.memoizedState.cache),ho();break;case 27:case 5:X(t);break;case 4:W(t,t.stateNode.containerInfo);break;case 10:wo(0,t.type,t.memoizedProps.value);break;case 13:var r=t.memoizedState;if(null!==r)return null!==r.dehydrated?(al(t),t.flags|=128,null):n&t.child.childLanes?Bl(e,t,n):(al(t),null!==(e=Kl(e,t,n))?e.sibling:null);al(t);break;case 19:var o=!!(128&e.flags);if((r=!!(n&t.childLanes))||(Eo(e,t,n,!1),r=!!(n&t.childLanes)),o){if(r)return Xl(e,t,n);t.flags|=128}if(null!==(o=t.memoizedState)&&(o.rendering=null,o.tail=null,o.lastEffect=null),U(cl,cl.current),r)break;return null;case 22:case 23:return t.lanes=0,Ol(e,t,n);case 24:wo(0,No,e.memoizedState.cache)}return Kl(e,t,n)}(e,t,n);Tl=!!(131072&e.flags)}else Tl=!1,io&&1048576&t.flags&&eo(t,Qr,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var r=t.elementType,o=r._init;if(r=o(r._payload),t.type=r,"function"!=typeof r){if(null!=r){if((o=r.$$typeof)===k){t.tag=11,t=Al(null,t,r,e,n);break e}if(o===_){t.tag=14,t=Ll(null,t,r,e,n);break e}}throw t=O(r)||r,Error(a(306,t,""))}Mr(r)?(e=gl(r,e),t.tag=1,t=Ml(null,t,r,e,n)):(t.tag=0,t=Dl(null,t,r,e,n))}return t;case 0:return Dl(e,t,t.type,t.pendingProps,n);case 1:return Ml(e,t,r=t.type,o=gl(r,t.pendingProps),n);case 3:e:{if(W(t,t.stateNode.containerInfo),null===e)throw Error(a(387));r=t.pendingProps;var i=t.memoizedState;o=i.element,oi(e,t),fi(t,r,null,n);var l=t.memoizedState;if(r=l.cache,wo(0,No,r),r!==i.cache&&So(t,[No],n,!0),ci(),r=l.element,i.isDehydrated){if(i={element:r,isDehydrated:!1,cache:l.cache},t.updateQueue.baseState=i,t.memoizedState=i,256&t.flags){t=Fl(e,t,r,n);break e}if(r!==o){go(o=Er(Error(a(424)),t)),t=Fl(e,t,r,n);break e}if(9===(e=t.stateNode.containerInfo).nodeType)e=e.body;else e="HTML"===e.nodeName?e.ownerDocument.body:e;for(oo=bf(e.firstChild),ro=t,io=!0,ao=null,lo=!0,n=rl(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(ho(),r===o){t=Kl(e,t,n);break e}Pl(e,t,r,n)}t=t.child}return t;case 26:return Rl(e,t),null===e?(n=Af(t.type,null,t.pendingProps,null))?t.memoizedState=n:io||(n=t.type,e=t.pendingProps,(r=rf(q.current).createElement(n))[Oe]=t,r[Ne]=e,ef(r,n,e),Ve(r),t.stateNode=r):t.memoizedState=Af(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return X(t),null===e&&io&&(r=t.stateNode=xf(t.type,t.pendingProps,q.current),ro=t,lo=!0,o=oo,hf(t.type)?(vf=o,oo=bf(r.firstChild)):oo=o),Pl(e,t,t.pendingProps.children,n),Rl(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&io&&((o=r=oo)&&(null!==(r=function(e,t,n,r){for(;1===e.nodeType;){var o=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&("INPUT"!==e.nodeName||"hidden"!==e.type))break}else if(r){if(!e[je])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if("stylesheet"===(i=e.getAttribute("rel"))&&e.hasAttribute("data-precedence"))break;if(i!==o.rel||e.getAttribute("href")!==(null==o.href||""===o.href?null:o.href)||e.getAttribute("crossorigin")!==(null==o.crossOrigin?null:o.crossOrigin)||e.getAttribute("title")!==(null==o.title?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(((i=e.getAttribute("src"))!==(null==o.src?null:o.src)||e.getAttribute("type")!==(null==o.type?null:o.type)||e.getAttribute("crossorigin")!==(null==o.crossOrigin?null:o.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else{if("input"!==t||"hidden"!==e.type)return e;var i=null==o.name?null:""+o.name;if("hidden"===o.type&&e.getAttribute("name")===i)return e}if(null===(e=bf(e.nextSibling)))break}return null}(r,t.type,t.pendingProps,lo))?(t.stateNode=r,ro=t,oo=bf(r.firstChild),lo=!1,o=!0):o=!1),o||uo(t)),X(t),o=t.type,i=t.pendingProps,l=null!==e?e.memoizedProps:null,r=i.children,lf(o,i)?r=null:null!==l&&lf(o,l)&&(t.flags|=32),null!==t.memoizedState&&(o=Oi(e,t,Di,null,null,n),Kf._currentValue=o),Rl(e,t),Pl(e,t,r,n),t.child;case 6:return null===e&&io&&((e=n=oo)&&(null!==(n=function(e,t,n){if(""===t)return null;for(;3!==e.nodeType;){if((1!==e.nodeType||"INPUT"!==e.nodeName||"hidden"!==e.type)&&!n)return null;if(null===(e=bf(e.nextSibling)))return null}return e}(n,t.pendingProps,lo))?(t.stateNode=n,ro=t,oo=null,e=!0):e=!1),e||uo(t)),null;case 13:return Bl(e,t,n);case 4:return W(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=nl(t,null,r,n):Pl(e,t,r,n),t.child;case 11:return Al(e,t,t.type,t.pendingProps,n);case 7:return Pl(e,t,t.pendingProps,n),t.child;case 8:case 12:return Pl(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,wo(0,t.type,r.value),Pl(e,t,r.children,n),t.child;case 9:return o=t.type._context,r=t.pendingProps.children,Co(t),r=r(o=To(o)),t.flags|=1,Pl(e,t,r,n),t.child;case 14:return Ll(e,t,t.type,t.pendingProps,n);case 15:return Il(e,t,t.type,t.pendingProps,n);case 19:return Xl(e,t,n);case 31:return r=t.pendingProps,n=t.mode,r={mode:r.mode,children:r.children},null===e?((n=ql(r,n)).ref=t.ref,t.child=n,n.return=t,t=n):((n=Fr(e.child,r)).ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return Ol(e,t,n);case 24:return Co(t),r=To(No),null===e?(null===(o=Ho())&&(o=ru,i=Ro(),o.pooledCache=i,i.refCount++,null!==i&&(o.pooledCacheLanes|=n),o=i),t.memoizedState={parent:r,cache:o},ri(t),wo(0,No,o)):(!!(e.lanes&n)&&(oi(e,t),fi(t,null,null,n),ci()),o=e.memoizedState,i=t.memoizedState,o.parent!==r?(o={parent:r,cache:r},t.memoizedState=o,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=o),wo(0,No,r)):(r=i.cache,wo(0,No,r),r!==o.cache&&So(t,[No],n,!0))),Pl(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function Jl(e){e.flags|=4}function Zl(e,t){if("stylesheet"!==t.type||4&t.state.loading)e.flags&=-16777217;else if(e.flags|=16777216,!Bf(t)){if(null!==(t=ol.current)&&((4194048&iu)===iu?null!==il:(62914560&iu)!==iu&&!(536870912&iu)||t!==il))throw Zo=Ko,Qo;e.flags|=8192}}function es(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?Se():536870912,e.lanes|=t,yu|=t)}function ts(e,t){if(!io)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ns(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;null!==o;)n|=o.lanes|o.childLanes,r|=65011712&o.subtreeFlags,r|=65011712&o.flags,o.return=e,o=o.sibling;else for(o=e.child;null!==o;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function rs(e,t,n){var r=t.pendingProps;switch(no(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return ns(t),null;case 3:return n=t.stateNode,r=null,null!==e&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),xo(No),Q(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(po(t)?Jl(t):null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,mo())),ns(t),null;case 26:return n=t.memoizedState,null===e?(Jl(t),null!==n?(ns(t),Zl(t,n)):(ns(t),t.flags&=-16777217)):n?n!==e.memoizedState?(Jl(t),ns(t),Zl(t,n)):(ns(t),t.flags&=-16777217):(e.memoizedProps!==r&&Jl(t),ns(t),t.flags&=-16777217),null;case 27:K(t),n=q.current;var o=t.type;if(null!==e&&null!=t.stateNode)e.memoizedProps!==r&&Jl(t);else{if(!r){if(null===t.stateNode)throw Error(a(166));return ns(t),null}e=B.current,po(t)?co(t):(e=xf(o,r,n),t.stateNode=e,Jl(t))}return ns(t),null;case 5:if(K(t),n=t.type,null!==e&&null!=t.stateNode)e.memoizedProps!==r&&Jl(t);else{if(!r){if(null===t.stateNode)throw Error(a(166));return ns(t),null}if(e=B.current,po(t))co(t);else{switch(o=rf(q.current),e){case 1:e=o.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:e=o.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":e=o.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":e=o.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":(e=o.createElement("div")).innerHTML="