1import _ from"./module-DSzMJQoL.js";import{r as l,R as f}from"./chunk-62JRHF6Z-Bk-m5fT2.js";var P;function V(e){P=e}function b(){return P}var g=l.createContext({get client(){return b()},bootstrap:void 0});function O(e,o,r){if(r===void 0&&(r=new WeakMap),e===o)return!0;if(typeof e!="object"||e===null||typeof o!="object"||o===null)return!1;if(r.has(e)&&r.get(e)===o)return!0;r.set(e,o);var n=Object.keys(e),t=Object.keys(o);if(n.length!==t.length)return!1;for(var a=0,i=n;a<i.length;a++){var u=i[a];if(!t.includes(u)||!O(e[u],o[u],r))return!1}return!0}function B(e){var o,r,n=e.children,t=e.client,a=e.apiKey,i=e.options,u=l.useRef(null),s=l.useMemo(function(){if(t)return a&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),i&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),t;var c=b();return a||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),c},[t,a,JSON.stringify(i)]);return l.useEffect(function(){if(!(t||!a)){var c=b(),v=u.current;v?(a!==v.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),i&&!O(i,v.options)&&c.set_config(i),u.current={apiKey:a,options:i??{}}):(c.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),c.init(a,i),u.current={apiKey:a,options:i??{}})}},[t,a,JSON.stringify(i)]),f.createElement(g.Provider,{value:{client:s,bootstrap:(o=i?.bootstrap)!==null&&o!==void 0?o:(r=t?.config)===null||r===void 0?void 0:r.bootstrap}},n)}var F=function(e){return typeof e=="function"},k=function(e){return e===void 0},x=function(e){return e===null};function M(e){var o,r,n=l.useContext(g),t=n.client,a=n.bootstrap,i=l.useState(function(){return t.isFeatureEnabled(e)}),u=i[0],s=i[1];l.useEffect(function(){return t.onFeatureFlags(function(){s(t.isFeatureEnabled(e))})},[t,e]);var c=(o=a?.featureFlags)===null||o===void 0?void 0:o[e];return!(!((r=t?.featureFlags)===null||r===void 0)&&r.hasLoadedFlags)&&a?.featureFlags?k(c)?void 0:!!c:u}function S(e){var o,r=l.useContext(g),n=r.client,t=r.bootstrap,a=l.useState(function(){var s;return(s=n.getFeatureFlagResult(e,{send_event:!1}))===null||s===void 0?void 0:s.payload}),i=a[0],u=a[1];return l.useEffect(function(){return n.onFeatureFlags(function(){var s;u((s=n.getFeatureFlagResult(e,{send_event:!1}))===null||s===void 0?void 0:s.payload)})},[n,e]),!(!((o=n?.featureFlags)===null||o===void 0)&&o.hasLoadedFlags)&&t?.featureFlagPayloads?t.featureFlagPayloads[e]:i}function z(e){var o,r,n=l.useContext(g),t=n.client,a=n.bootstrap,i=l.useState(function(){return t.getFeatureFlagResult(e)}),u=i[0],s=i[1];if(l.useEffect(function(){return t.onFeatureFlags(function(){s(t.getFeatureFlagResult(e))})},[t,e]),!(!((o=t?.featureFlags)===null||o===void 0)&&o.hasLoadedFlags)&&a?.featureFlags){var c=a.featureFlags[e];return k(c)?void 0:{key:e,enabled:typeof c=="string"?!0:!!c,variant:typeof c=="string"?c:void 0,payload:(r=a.featureFlagPayloads)===null||r===void 0?void 0:r[e]}}return u}function Y(){var e,o=l.useContext(g),r=o.client,n=o.bootstrap,t=l.useState(function(){return r.featureFlags.getFlags()}),a=t[0],i=t[1];return l.useEffect(function(){return r.onFeatureFlags(function(u){i(u)})},[r]),!(!((e=r?.featureFlags)===null||e===void 0)&&e.hasLoadedFlags)&&n?.featureFlags?Object.keys(n.featureFlags):a}function R(e){var o,r=l.useContext(g),n=r.client,t=r.bootstrap,a=l.useState(function(){return n.getFeatureFlag(e)}),i=a[0],u=a[1];return l.useEffect(function(){return n.onFeatureFlags(function(){u(n.getFeatureFlag(e))})},[n,e]),!(!((o=n?.featureFlags)===null||o===void 0)&&o.hasLoadedFlags)&&t?.featureFlags?t.featureFlags[e]:i}var E=function(){var e=l.useContext(g).client;return e}
1,w=function(e,o){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])},w(e,o)};function H(e,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");w(e,o);function r(){this.constructor=e}e.prototype=o===null?Object.create(o):(r.prototype=o.prototype,new r)}var p=function(){return p=Object.assign||function(o){for(var r,n=1,t=arguments.length;n<t;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(o[a]=r[a])}return o},p.apply(this,arguments)};function m(e,o){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,n=Object.getOwnPropertySymbols(e);t<n.length;t++)o.indexOf(n[t])<0&&Object.prototype.propertyIsEnumerable.call(e,n[t])&&(r[n[t]]=e[n[t]]);return r}function I(e){var o=e.children,r=e.onIntersect,n=e.onClick,t=e.trackView,a=e.options,i=m(e,["children","onIntersect","onClick","trackView","options"]),u=l.useRef(null),s=l.useMemo(function(){return p({threshold:.1},a)},[a?.threshold,a?.root,a?.rootMargin]);return l.useEffect(function(){if(!(x(u.current)||!t)){var c=new IntersectionObserver(function(v){var d=v[0];return r(d)},s);return c.observe(u.current),function(){return c.disconnect()}}},[s,t,r]),f.createElement("div",p({ref:u},i,{onClick:n}),o)}function A(e){var o=e.children,r=e.trackInteraction,n=e.trackView,t=e.options,a=e.onInteract,i=e.onView,u=m(e,["children","trackInteraction","trackView","options","onInteract","onView"]),s=l.useRef(!1),c=l.useRef(!1),v=l.useCallback(function(){!s.current&&r&&a&&(a(),s.current=!0)},[r,a]),d=function(y){!c.current&&y.isIntersecting&&i&&(i(),c.current=!0)},h=l.Children.map(o,function(y){return f.createElement(I,p({onClick:v,onIntersect:d,trackView:n,options:t},u),y)});return f.createElement(f.Fragment,null,h)}function G(e){var o=e.flag,r=e.match,n=e.children,t=e.fallback,a=e.visibilityObserverOptions,i=e.trackInteraction,u=e.trackView,s=m(e,["flag","match","children","fallback","visibilityObserverOptions","trackInteraction","trackView"]),c=S(o),v=R(o),d=E(),h=i??!0,y=u??!0;if(!k(v)&&(k(r)||v===r)){var C=F(n)?n(c):n;return f.createElement(A,p({flag:o,options:a,trackInteraction:h,trackView:y,onInteract:function(){return K({flag:o,posthog:d,flagVariant:v})},onView:function(){return T({flag:o,posthog:d,flagVariant:v})}},s),C)}return f.createElement(f.Fragment,null,t)}function K(e){var o,r=e.flag,n=e.posthog,t=e.flagVariant,a={feature_flag:r,$set:(o={},o["$feature_interaction/".concat(r)]=t??!0,o)};typeof t=="string"&&(a.feature_flag_variant=t),n.capture("$feature_interaction",a)}function T(e){var o,r=e.flag,n=e.posthog,t=e.flagVariant,a={feature_flag:r,$set:(o={},o["$feature_view/".concat(r)]=t??!0,o)};typeof t=="string"&&(a.feature_flag_variant=t),n.capture("$feature_view",a)}function L(e){var o=e.child,r=e.index,n=e.name,t=e.properties,a=e.observerOptions,i=l.useRef(!1),u=E(),s=l.useCallback(function(c){c.isIntersecting&&!i.current&&(u.capture("$element_viewed",p({element_name:n,child_index:r},t)),i.current=!0)},[u,n,r,t]);return f.createElement(I,{onIntersect:s,trackView:!0,options:a},o)}function J(e){var o=e.name,r=e.properties,n=e.observerOptions,t=e.trackAllChildren,a=e.children,i=m(e,["name","properties","observerOptions","trackAllChildren","children"]),u=l.useRef(!1),s=E(),c=l.useCallback(function(d){d.isIntersecting&&!u.current&&(s.capture("$element_viewed",p({element_name:o},r)),u.current=!0)},[s,o,r]);if(t){var v=l.Children.map(a,function(d,h){return f.createElement(L,{key:h,child:d,index:h,name:o,properties:r,observerOptions:n})});return f.createElement("div",p({},i),v)}return f.createElement(I,p({onIntersect:c,trackView:!0,options:n},i),a)}var j={componentStack:null,exceptionEvent:null,error:null},$={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."},U=(function(e){H(o,e);function o(r){var n=e.call(this,r)||this;return n.state=j,n}return o.prototype.componentDidCatch=function(r,n){var t=this.props.additionalProperties,a;F(t)?a=t(r):typeof t=="object"&&(a=t);var i=this.context.client,u=i.captureException(r,a),s=n.componentStack;this.setState({error:r,componentStack:s??null,exceptionEvent:u})},o.prototype.render=function(){var r=this.props,n=r.children,t=r.fallback,a=this.state;if(a.componentStack==null)return F(n)?n():n;var i=F(t)?f.createElement(t,{error:a.error,componentStack:a.componentStack,exceptionEvent:a.exceptionEvent}):t;return f.isValidElement(i)?i:(console.warn($.INVALID_FALLBACK),f.createElement(f.Fragment,null))},o.contextType=g,o})(f.Component),W=function(e,o){return function(r,n){var t=e.captureException(r);o&&o(t,r,n)}};V(_);export{J as PostHogCaptureOnViewed,g as PostHogContext,U as PostHogErrorBoundary,G as PostHogFeature,B as PostHogProvider,K as captureFeatureInteraction,T as captureFeatureView,W as setupReactErrorHandler,Y as useActiveFeatureFlags,M as useFeatureFlagEnabled,S as useFeatureFlagPayload,z as useFeatureFlagResult,R as useFeatureFlagVariantKey,E as usePostHog};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.