@heycatch/sdk 0.7.1-dev.1123 → 0.7.1-dev.1456

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var V=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var dt=Object.prototype.hasOwnProperty;var ht=(e,t)=>{for(var r in t)V(e,r,{get:t[r],enumerable:!0})},_t=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of mt(t))!dt.call(e,o)&&o!==r&&V(e,o,{get:()=>t[o],enumerable:!(n=ft(t,o))||n.enumerable});return e};var gt=e=>_t(V({},"__esModule",{value:!0}),e);var Vt={};ht(Vt,{HeyCatchProvider:()=>pt,SDK_VERSION:()=>k,STAGE:()=>Z,analytics:()=>Kt});module.exports=gt(Vt);var ue="project",xt="[a-z0-9]",Gt=new RegExp(`^${xt}$`);var qe=require("posthog-react-native");var ae;function p(e,t,r){function n(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);let a=i.prototype,l=Object.keys(a);for(let m=0;m<l.length;m++){let f=l[m];f in c||(c[f]=a[f].bind(c))}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(c){var u;let a=r?.Parent?new s:this;n(a,c),(u=a._zod).deferred??(u.deferred=[]);for(let l of a._zod.deferred)l();return a}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var v=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(ae=globalThis).__zod_globalConfig??(ae.__zod_globalConfig={});var W=globalThis.__zod_globalConfig;function P(e){return e&&Object.assign(W,e),W}function le(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function fe(e,t){return typeof t=="bigint"?t.toString():t}function me(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function de(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}var pe=Symbol("evaluating");function $(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==pe)return n===void 0&&(n=pe,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}var Y="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function j(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function he(e){if(j(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(j(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function J(e){return he(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var _e=new Set(["string","number","symbol"]);function ge(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function q(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function x(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function xe(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Jt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function S(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ve(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function X(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function O(e){return typeof e=="string"?e:e?.message}function E(e,t,r){let n=e.message?e.message:O(e.inst?._zod.def?.error?.(e))??O(t?.error?.(e))??O(r.customError?.(e))??O(r.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...c}=e;return c.path??(c.path=[]),c.message=n,t?.reportInput&&(c.input=i),c}function Q(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}var ze=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,fe,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},$e=p("$ZodError",ze),T=p("$ZodError",ze,{Parent:Error});var zt=e=>(t,r,n,o)=>{let s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new v;if(i.issues.length){let c=new(o?.Err??e)(i.issues.map(u=>E(u,s,P())));throw Y(c,o?.callee),c}return i.value},L=zt(T),$t=e=>async(t,r,n,o)=>{let s=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let c=new(o?.Err??e)(i.issues.map(u=>E(u,s,P())));throw Y(c,o?.callee),c}return i.value},D=$t(T),yt=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new v;return s.issues.length?{success:!1,error:new(e??$e)(s.issues.map(i=>E(i,o,P())))}:{success:!0,data:s.value}},M=yt(T),bt=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>E(i,o,P())))}:{success:!0,data:s.value}},R=bt(T);var wt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Zt=new RegExp(`^${wt}$`);var ye=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var be=/^-?\d+(?:\.\d+)?$/,we=/^(?:true|false)$/i;var N=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var ke=p("$ZodCheckStringFormat",(e,t)=>{var r,n;N.init(e,t),e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Pe=p("$ZodCheckRegex",(e,t)=>{ke.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var Ce={major:4,minor:4,patch:3};var g=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ce;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,c,u)=>{let a=S(i),l;for(let m of c){if(m._zod.def.when){if(ve(i)||!m._zod.def.when(i))continue}else if(a)continue;let f=i.issues.length,_=m._zod.check(i);if(_ instanceof Promise&&u?.async===!1)throw new v;if(l||_ instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await _,i.issues.length!==f&&(a||(a=S(i,f)))});else{if(i.issues.length===f)continue;a||(a=S(i,f))}}return l?l.then(()=>i):i},s=(i,c,u)=>{if(S(i))return i.aborted=!0,i;let a=o(c,n,u);if(a instanceof Promise){if(u.async===!1)throw new v;return a.then(l=>e._zod.parse(l,u))}return e._zod.parse(a,u)};e._zod.run=(i,c)=>{if(c.skipChecks)return e._zod.parse(i,c);if(c.direction==="backward"){let a=e._zod.parse({value:i.value,issues:[]},{...c,skipChecks:!0});return a instanceof Promise?a.then(l=>s(l,i,c)):s(a,i,c)}let u=e._zod.parse(i,c);if(u instanceof Promise){if(c.async===!1)throw new v;return u.then(a=>o(a,n,c))}return o(u,n,c)}}$(e,"~standard",()=>({validate:o=>{try{let s=M(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return R(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Me=p("$ZodString",(e,t)=>{g.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ye(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}});var Re=p("$ZodNumber",(e,t)=>{g.init(e,t),e._zod.pattern=e._zod.bag.pattern??be,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}});var Ne=p("$ZodBoolean",(e,t)=>{g.init(e,t),e._zod.pattern=we,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});function Ae(e,t,r){e.issues.length&&t.issues.push(...X(r,e.issues)),t.value[r]=e.value}var Oe=p("$ZodArray",(e,t)=>{g.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let c=o[i],u=t.element._zod.run({value:c,issues:[]},n);u instanceof Promise?s.push(u.then(a=>Ae(a,r,i))):Ae(u,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function F(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...X(r,e.issues))}if(!i&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function kt(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=xe(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Pt(e,t,r,n,o,s){let i=[],c=o.keySet,u=o.catchall._zod,a=u.def.type,l=u.optin==="optional",m=u.optout==="optional";for(let f in t){if(f==="__proto__"||c.has(f))continue;if(a==="never"){i.push(f);continue}let _=u.run({value:t[f],issues:[]},n);_ instanceof Promise?e.push(_.then(b=>F(b,r,f,t,l,m))):F(_,r,f,t,l,m)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var je=p("$ZodObject",(e,t)=>{if(g.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...c};return Object.defineProperty(t,"shape",{value:u}),u}})}let n=me(()=>kt(t));$(e._zod,"propValues",()=>{let c=t.shape,u={};for(let a in c){let l=c[a]._zod;if(l.values){u[a]??(u[a]=new Set);for(let m of l.values)u[a].add(m)}}return u});let o=j,s=t.catchall,i;e._zod.parse=(c,u)=>{i??(i=n.value);let a=c.value;if(!o(a))return c.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),c;c.value={};let l=[],m=i.shape;for(let f of i.keys){let _=m[f],b=_._zod.optin==="optional",ce=_._zod.optout==="optional",K=_._zod.run({value:a[f],issues:[]},u);K instanceof Promise?l.push(K.then(lt=>F(lt,c,f,a,b,ce))):F(K,c,f,a,b,ce)}return s?Pt(l,a,c,u,n.value,e):l.length?Promise.all(l).then(()=>c):c}});var Le=p("$ZodEnum",(e,t)=>{g.init(e,t);let r=le(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>_e.has(typeof o)).map(o=>typeof o=="string"?ge(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}});function Se(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var De=p("$ZodOptional",(e,t)=>{g.init(e,t),e._zod.optin="optional",e._zod.optout="optional",$(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),$(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${de(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=r.value,s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>Se(i,o)):Se(s,o)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var Fe=p("$ZodDefault",(e,t)=>{g.init(e,t),e._zod.optin="optional",$(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Ie(s,t)):Ie(o,t)}});function Ie(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var He=p("$ZodCustom",(e,t)=>{N.init(e,t),g.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>Te(s,r,n,e));Te(o,r,n,e)}});function Te(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Q(o))}}function Ue(e,t){return new e({type:"string",...x(t)})}function Be(e,t){return new e({type:"number",checks:[],...x(t)})}function Ke(e,t){return new e({type:"boolean",...x(t)})}function ee(e,t){return new Pe({check:"string_format",format:"regex",...x(t),pattern:e})}function Ve(e,t,r){let n=x(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}var z=p("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");g.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>L(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>M(e,r,n),e.parseAsync=async(r,n)=>D(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>R(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>q(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),Ct=p("ZodMiniString",(e,t)=>{Me.init(e,t),z.init(e,t)});function w(e){return Ue(Ct,e)}var At=p("ZodMiniNumber",(e,t)=>{Re.init(e,t),z.init(e,t)});function te(e){return Be(At,e)}var St=p("ZodMiniBoolean",(e,t)=>{Ne.init(e,t),z.init(e,t)});function y(e){return Ke(St,e)}var It=p("ZodMiniArray",(e,t)=>{Oe.init(e,t),z.init(e,t)});function re(e,t){return new It({type:"array",element:e,...x(t)})}var Tt=p("ZodMiniObject",(e,t)=>{je.init(e,t),z.init(e,t),$(e,"shape",()=>t.shape)});function ne(e,t){let r={type:"object",shape:e??{},...x(t)};return new Tt(r)}var Mt=p("ZodMiniEnum",(e,t)=>{Le.init(e,t),z.init(e,t),e.options=Object.values(t.entries)});function We(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Mt({type:"enum",entries:r,...x(t)})}var Rt=p("ZodMiniOptional",(e,t)=>{De.init(e,t),z.init(e,t)});function d(e){return new Rt({type:"optional",innerType:e})}var Nt=p("ZodMiniDefault",(e,t)=>{Fe.init(e,t),z.init(e,t)});function C(e,t){return new Nt({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():J(t)}})}var Ot=p("ZodMiniCustom",(e,t)=>{He.init(e,t),z.init(e,t)});function oe(e,t){return Ve(Ot,e??(()=>!0),t)}var H="https://in.dev.heycatch.ai",Z="dev",k="0.7.1-dev.1123",Ge="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function Ye(e=Z){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${k}). Events are being sent to the HeyCatch development environment and will NEVER appear in your dashboard. Reinstall the latest stable version - resolve it with \`npm view @heycatch/sdk version\` - or re-run the install guide: https://heycatch.ai/agents.md`}var A="unknown",Ft=["localStorage","cookie","memory","localStorage+cookie","sessionStorage"];var Je=ne({projectKey:w({error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'}).check(ee(/^hck_pk_/,{error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'})),tracingHosts:C(re(w()),[]),install:C(ne({framework:C(w(),A),frameworkVersion:C(w(),A),agent:C(w(),A)}),{framework:A,frameworkVersion:A,agent:A}),autocapture:d(y()),maskAllText:d(y()),maskAllElementAttributes:d(y()),propertyDenylist:d(re(w())),sanitizeProperties:d(oe(e=>typeof e=="function")),beforeSend:d(oe(e=>typeof e=="function"||Array.isArray(e)&&e.every(t=>typeof t=="function"))),persistence:d(We(Ft)),disablePersistence:d(y()),cookieExpirationDays:d(te()),optOutCapturingByDefault:d(y()),respectDnt:d(y()),requestBatching:d(y()),flushIntervalMs:d(te())});var ie=null;function h(){return ie}var se=null;function Xe(){se?.()}function Qe(e){if(ie!==null)return;let t=Je.safeParse(e);if(!t.success){let i=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${i}`);return}let r=new qe.PostHog(Ge,{host:H,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0,...t.data.optOutCapturingByDefault===void 0?{}:{defaultOptIn:!t.data.optOutCapturingByDefault}}),{install:n}=t.data,o={heycatch_framework:n.framework,heycatch_framework_version:n.frameworkVersion,heycatch_agent:n.agent};se=()=>{r.register({heycatch_sdk_version:k,heycatch_sdk_stage:Z,heycatch_project_key:t.data.projectKey,...o}),r.group(ue,t.data.projectKey,{key:t.data.projectKey,sdk_version:k,sdk_stage:Z,framework:n.framework,framework_version:n.frameworkVersion,agent:n.agent,api_host:H})},se(),ie=r,console.info(`[HeyCatch] SDK v${k} (${Z}) initialized \u2192 ${H}`);let s=Ye();s!==null&&console.warn(s)}function et(e){return t=>{console.error(`[HeyCatch] consent ${e} could not be saved - capture state may reset on the next app launch:`,t)}}function tt(){h()?.optIn().catch(et("opt-in"))}function rt(){h()?.optOut().catch(et("opt-out"))}function nt(e,t,r){let n=h();if(n!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] setIdentity() requires a non-empty string user id. Pass a stable internal user id from your auth provider \u2014 not an email or session token.");return}n.identify(e,{...t?{$set:t}:{},...r?{$set_once:r}:{}})}}function ot(){let e=h();e!==null&&(e.reset(),Xe())}function U(e,t){let r=h();if(r!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackScreen() requires a non-empty screen name.");return}r.screen(e,t?t:void 0)}}function it(e,t,r){let n=h();if(n!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackEvent() requires a non-empty event name.");return}if(e.startsWith("$")){console.error(`[HeyCatch] trackEvent() event names cannot start with "$" (got "${e}") - that prefix is reserved for built-in events.`);return}n.capture(e,{...t,...r?.set?{$set:r.set}:{},...r?.setOnce?{$set_once:r.setOnce}:{},heycatch_custom_user_event:!0})}}function st(e,t){let r=h();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}var ut=require("posthog-react-native"),at=require("react");var B=require("react/jsx-runtime");function Ht(){try{if(typeof require!="function")return null;let e=require("expo-router");return typeof e=="object"&&e!==null&&"usePathname"in e&&typeof e.usePathname=="function"&&"useGlobalSearchParams"in e&&typeof e.useGlobalSearchParams=="function"?{usePathname:e.usePathname,useGlobalSearchParams:e.useGlobalSearchParams}:null}catch{return null}}var ct=Ht();function Ut(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[n,o]of Object.entries(t)){if(typeof o=="string"||typeof o=="number"||typeof o=="boolean"){r[n]=o;continue}Array.isArray(o)&&(r[n]=o.filter(s=>typeof s=="string").join(","))}return r}function Bt({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,n=r(),o=JSON.stringify(t());return(0,at.useEffect)(()=>{U(n,Ut(o))},[n,o]),null}function pt({children:e}){let t=h();return t===null?(console.error("[HeyCatch] HeyCatchProvider mounted before init() - call analytics.init({ projectKey }) at module scope of the root layout."),e):(0,B.jsxs)(ut.PostHogProvider,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[ct===null?null:(0,B.jsx)(Bt,{router:ct}),e]})}var Kt={init:Qe,optInCapturing:tt,optOutCapturing:rt,resetIdentity:ot,setIdentity:nt,setPersonProperties:st,trackEvent:it,trackScreen:U};0&&(module.exports={HeyCatchProvider,SDK_VERSION,STAGE,analytics});
1
+ "use strict";var V=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var dt=Object.prototype.hasOwnProperty;var ht=(e,t)=>{for(var r in t)V(e,r,{get:t[r],enumerable:!0})},_t=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of mt(t))!dt.call(e,o)&&o!==r&&V(e,o,{get:()=>t[o],enumerable:!(n=ft(t,o))||n.enumerable});return e};var gt=e=>_t(V({},"__esModule",{value:!0}),e);var Vt={};ht(Vt,{HeyCatchProvider:()=>pt,SDK_VERSION:()=>k,STAGE:()=>Z,analytics:()=>Kt});module.exports=gt(Vt);var ue="project",xt="[a-z0-9]",Gt=new RegExp(`^${xt}$`);var qe=require("posthog-react-native");var ae;function p(e,t,r){function n(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);let a=i.prototype,l=Object.keys(a);for(let m=0;m<l.length;m++){let f=l[m];f in c||(c[f]=a[f].bind(c))}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(c){var u;let a=r?.Parent?new s:this;n(a,c),(u=a._zod).deferred??(u.deferred=[]);for(let l of a._zod.deferred)l();return a}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var v=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(ae=globalThis).__zod_globalConfig??(ae.__zod_globalConfig={});var W=globalThis.__zod_globalConfig;function P(e){return e&&Object.assign(W,e),W}function le(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function fe(e,t){return typeof t=="bigint"?t.toString():t}function me(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function de(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}var pe=Symbol("evaluating");function $(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==pe)return n===void 0&&(n=pe,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}var Y="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function j(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function he(e){if(j(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(j(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function J(e){return he(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var _e=new Set(["string","number","symbol"]);function ge(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function q(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function x(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function xe(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Jt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function S(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ve(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function X(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function O(e){return typeof e=="string"?e:e?.message}function E(e,t,r){let n=e.message?e.message:O(e.inst?._zod.def?.error?.(e))??O(t?.error?.(e))??O(r.customError?.(e))??O(r.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...c}=e;return c.path??(c.path=[]),c.message=n,t?.reportInput&&(c.input=i),c}function Q(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}var ze=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,fe,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},$e=p("$ZodError",ze),T=p("$ZodError",ze,{Parent:Error});var zt=e=>(t,r,n,o)=>{let s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new v;if(i.issues.length){let c=new(o?.Err??e)(i.issues.map(u=>E(u,s,P())));throw Y(c,o?.callee),c}return i.value},L=zt(T),$t=e=>async(t,r,n,o)=>{let s=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let c=new(o?.Err??e)(i.issues.map(u=>E(u,s,P())));throw Y(c,o?.callee),c}return i.value},D=$t(T),yt=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new v;return s.issues.length?{success:!1,error:new(e??$e)(s.issues.map(i=>E(i,o,P())))}:{success:!0,data:s.value}},M=yt(T),bt=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>E(i,o,P())))}:{success:!0,data:s.value}},R=bt(T);var wt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Zt=new RegExp(`^${wt}$`);var ye=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var be=/^-?\d+(?:\.\d+)?$/,we=/^(?:true|false)$/i;var N=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var ke=p("$ZodCheckStringFormat",(e,t)=>{var r,n;N.init(e,t),e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Pe=p("$ZodCheckRegex",(e,t)=>{ke.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var Ce={major:4,minor:4,patch:3};var g=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ce;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,c,u)=>{let a=S(i),l;for(let m of c){if(m._zod.def.when){if(ve(i)||!m._zod.def.when(i))continue}else if(a)continue;let f=i.issues.length,_=m._zod.check(i);if(_ instanceof Promise&&u?.async===!1)throw new v;if(l||_ instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await _,i.issues.length!==f&&(a||(a=S(i,f)))});else{if(i.issues.length===f)continue;a||(a=S(i,f))}}return l?l.then(()=>i):i},s=(i,c,u)=>{if(S(i))return i.aborted=!0,i;let a=o(c,n,u);if(a instanceof Promise){if(u.async===!1)throw new v;return a.then(l=>e._zod.parse(l,u))}return e._zod.parse(a,u)};e._zod.run=(i,c)=>{if(c.skipChecks)return e._zod.parse(i,c);if(c.direction==="backward"){let a=e._zod.parse({value:i.value,issues:[]},{...c,skipChecks:!0});return a instanceof Promise?a.then(l=>s(l,i,c)):s(a,i,c)}let u=e._zod.parse(i,c);if(u instanceof Promise){if(c.async===!1)throw new v;return u.then(a=>o(a,n,c))}return o(u,n,c)}}$(e,"~standard",()=>({validate:o=>{try{let s=M(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return R(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Me=p("$ZodString",(e,t)=>{g.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ye(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}});var Re=p("$ZodNumber",(e,t)=>{g.init(e,t),e._zod.pattern=e._zod.bag.pattern??be,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}});var Ne=p("$ZodBoolean",(e,t)=>{g.init(e,t),e._zod.pattern=we,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});function Ae(e,t,r){e.issues.length&&t.issues.push(...X(r,e.issues)),t.value[r]=e.value}var Oe=p("$ZodArray",(e,t)=>{g.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let c=o[i],u=t.element._zod.run({value:c,issues:[]},n);u instanceof Promise?s.push(u.then(a=>Ae(a,r,i))):Ae(u,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function F(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...X(r,e.issues))}if(!i&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function kt(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=xe(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Pt(e,t,r,n,o,s){let i=[],c=o.keySet,u=o.catchall._zod,a=u.def.type,l=u.optin==="optional",m=u.optout==="optional";for(let f in t){if(f==="__proto__"||c.has(f))continue;if(a==="never"){i.push(f);continue}let _=u.run({value:t[f],issues:[]},n);_ instanceof Promise?e.push(_.then(b=>F(b,r,f,t,l,m))):F(_,r,f,t,l,m)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var je=p("$ZodObject",(e,t)=>{if(g.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...c};return Object.defineProperty(t,"shape",{value:u}),u}})}let n=me(()=>kt(t));$(e._zod,"propValues",()=>{let c=t.shape,u={};for(let a in c){let l=c[a]._zod;if(l.values){u[a]??(u[a]=new Set);for(let m of l.values)u[a].add(m)}}return u});let o=j,s=t.catchall,i;e._zod.parse=(c,u)=>{i??(i=n.value);let a=c.value;if(!o(a))return c.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),c;c.value={};let l=[],m=i.shape;for(let f of i.keys){let _=m[f],b=_._zod.optin==="optional",ce=_._zod.optout==="optional",K=_._zod.run({value:a[f],issues:[]},u);K instanceof Promise?l.push(K.then(lt=>F(lt,c,f,a,b,ce))):F(K,c,f,a,b,ce)}return s?Pt(l,a,c,u,n.value,e):l.length?Promise.all(l).then(()=>c):c}});var Le=p("$ZodEnum",(e,t)=>{g.init(e,t);let r=le(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>_e.has(typeof o)).map(o=>typeof o=="string"?ge(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}});function Se(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var De=p("$ZodOptional",(e,t)=>{g.init(e,t),e._zod.optin="optional",e._zod.optout="optional",$(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),$(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${de(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=r.value,s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>Se(i,o)):Se(s,o)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var Fe=p("$ZodDefault",(e,t)=>{g.init(e,t),e._zod.optin="optional",$(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Ie(s,t)):Ie(o,t)}});function Ie(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var He=p("$ZodCustom",(e,t)=>{N.init(e,t),g.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>Te(s,r,n,e));Te(o,r,n,e)}});function Te(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Q(o))}}function Ue(e,t){return new e({type:"string",...x(t)})}function Be(e,t){return new e({type:"number",checks:[],...x(t)})}function Ke(e,t){return new e({type:"boolean",...x(t)})}function ee(e,t){return new Pe({check:"string_format",format:"regex",...x(t),pattern:e})}function Ve(e,t,r){let n=x(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}var z=p("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");g.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>L(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>M(e,r,n),e.parseAsync=async(r,n)=>D(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>R(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>q(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),Ct=p("ZodMiniString",(e,t)=>{Me.init(e,t),z.init(e,t)});function w(e){return Ue(Ct,e)}var At=p("ZodMiniNumber",(e,t)=>{Re.init(e,t),z.init(e,t)});function te(e){return Be(At,e)}var St=p("ZodMiniBoolean",(e,t)=>{Ne.init(e,t),z.init(e,t)});function y(e){return Ke(St,e)}var It=p("ZodMiniArray",(e,t)=>{Oe.init(e,t),z.init(e,t)});function re(e,t){return new It({type:"array",element:e,...x(t)})}var Tt=p("ZodMiniObject",(e,t)=>{je.init(e,t),z.init(e,t),$(e,"shape",()=>t.shape)});function ne(e,t){let r={type:"object",shape:e??{},...x(t)};return new Tt(r)}var Mt=p("ZodMiniEnum",(e,t)=>{Le.init(e,t),z.init(e,t),e.options=Object.values(t.entries)});function We(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Mt({type:"enum",entries:r,...x(t)})}var Rt=p("ZodMiniOptional",(e,t)=>{De.init(e,t),z.init(e,t)});function d(e){return new Rt({type:"optional",innerType:e})}var Nt=p("ZodMiniDefault",(e,t)=>{Fe.init(e,t),z.init(e,t)});function C(e,t){return new Nt({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():J(t)}})}var Ot=p("ZodMiniCustom",(e,t)=>{He.init(e,t),z.init(e,t)});function oe(e,t){return Ve(Ot,e??(()=>!0),t)}var H="https://in.dev.heycatch.ai",Z="dev",k="0.7.1-dev.1456",Ge="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function Ye(e=Z){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${k}). Events are being sent to the HeyCatch development environment and will NEVER appear in your dashboard. Reinstall the latest stable version - resolve it with \`npm view @heycatch/sdk version\` - or re-run the install guide: https://heycatch.ai/agents.md`}var A="unknown",Ft=["localStorage","cookie","memory","localStorage+cookie","sessionStorage"];var Je=ne({projectKey:w({error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'}).check(ee(/^hck_pk_/,{error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'})),tracingHosts:C(re(w()),[]),install:C(ne({framework:C(w(),A),frameworkVersion:C(w(),A),agent:C(w(),A)}),{framework:A,frameworkVersion:A,agent:A}),autocapture:d(y()),maskAllText:d(y()),maskAllElementAttributes:d(y()),propertyDenylist:d(re(w())),sanitizeProperties:d(oe(e=>typeof e=="function")),beforeSend:d(oe(e=>typeof e=="function"||Array.isArray(e)&&e.every(t=>typeof t=="function"))),persistence:d(We(Ft)),disablePersistence:d(y()),cookieExpirationDays:d(te()),optOutCapturingByDefault:d(y()),respectDnt:d(y()),requestBatching:d(y()),flushIntervalMs:d(te())});var ie=null;function h(){return ie}var se=null;function Xe(){se?.()}function Qe(e){if(ie!==null)return;let t=Je.safeParse(e);if(!t.success){let i=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${i}`);return}let r=new qe.PostHog(Ge,{host:H,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0,...t.data.optOutCapturingByDefault===void 0?{}:{defaultOptIn:!t.data.optOutCapturingByDefault}}),{install:n}=t.data,o={heycatch_framework:n.framework,heycatch_framework_version:n.frameworkVersion,heycatch_agent:n.agent};se=()=>{r.register({heycatch_sdk_version:k,heycatch_sdk_stage:Z,heycatch_project_key:t.data.projectKey,...o}),r.group(ue,t.data.projectKey,{key:t.data.projectKey,sdk_version:k,sdk_stage:Z,framework:n.framework,framework_version:n.frameworkVersion,agent:n.agent,api_host:H})},se(),ie=r,console.info(`[HeyCatch] SDK v${k} (${Z}) initialized \u2192 ${H}`);let s=Ye();s!==null&&console.warn(s)}function et(e){return t=>{console.error(`[HeyCatch] consent ${e} could not be saved - capture state may reset on the next app launch:`,t)}}function tt(){h()?.optIn().catch(et("opt-in"))}function rt(){h()?.optOut().catch(et("opt-out"))}function nt(e,t,r){let n=h();if(n!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] setIdentity() requires a non-empty string user id. Pass a stable internal user id from your auth provider \u2014 not an email or session token.");return}n.identify(e,{...t?{$set:t}:{},...r?{$set_once:r}:{}})}}function ot(){let e=h();e!==null&&(e.reset(),Xe())}function U(e,t){let r=h();if(r!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackScreen() requires a non-empty screen name.");return}r.screen(e,t?t:void 0)}}function it(e,t,r){let n=h();if(n!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackEvent() requires a non-empty event name.");return}if(e.startsWith("$")){console.error(`[HeyCatch] trackEvent() event names cannot start with "$" (got "${e}") - that prefix is reserved for built-in events.`);return}n.capture(e,{...t,...r?.set?{$set:r.set}:{},...r?.setOnce?{$set_once:r.setOnce}:{},heycatch_custom_user_event:!0})}}function st(e,t){let r=h();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}var ut=require("posthog-react-native"),at=require("react");var B=require("react/jsx-runtime");function Ht(){try{if(typeof require!="function")return null;let e=require("expo-router");return typeof e=="object"&&e!==null&&"usePathname"in e&&typeof e.usePathname=="function"&&"useGlobalSearchParams"in e&&typeof e.useGlobalSearchParams=="function"?{usePathname:e.usePathname,useGlobalSearchParams:e.useGlobalSearchParams}:null}catch{return null}}var ct=Ht();function Ut(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[n,o]of Object.entries(t)){if(typeof o=="string"||typeof o=="number"||typeof o=="boolean"){r[n]=o;continue}Array.isArray(o)&&(r[n]=o.filter(s=>typeof s=="string").join(","))}return r}function Bt({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,n=r(),o=JSON.stringify(t());return(0,at.useEffect)(()=>{U(n,Ut(o))},[n,o]),null}function pt({children:e}){let t=h();return t===null?(console.error("[HeyCatch] HeyCatchProvider mounted before init() - call analytics.init({ projectKey }) at module scope of the root layout."),e):(0,B.jsxs)(ut.PostHogProvider,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[ct===null?null:(0,B.jsx)(Bt,{router:ct}),e]})}var Kt={init:Qe,optInCapturing:tt,optOutCapturing:rt,resetIdentity:ot,setIdentity:nt,setPersonProperties:st,trackEvent:it,trackScreen:U};0&&(module.exports={HeyCatchProvider,SDK_VERSION,STAGE,analytics});
2
2
  //# sourceMappingURL=react-native.cjs.map
@@ -1,2 +1,2 @@
1
- var K=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ce="project",ct="[a-z0-9]",Ft=new RegExp(`^${ct}$`);import{PostHog as St}from"posthog-react-native";var ue;function p(e,t,r){function n(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);let a=i.prototype,l=Object.keys(a);for(let m=0;m<l.length;m++){let f=l[m];f in c||(c[f]=a[f].bind(c))}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(c){var u;let a=r?.Parent?new s:this;n(a,c),(u=a._zod).deferred??(u.deferred=[]);for(let l of a._zod.deferred)l();return a}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var v=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(ue=globalThis).__zod_globalConfig??(ue.__zod_globalConfig={});var V=globalThis.__zod_globalConfig;function Z(e){return e&&Object.assign(V,e),V}function pe(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function le(e,t){return typeof t=="bigint"?t.toString():t}function fe(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function me(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}var ae=Symbol("evaluating");function $(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ae)return n===void 0&&(n=ae,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}var G="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function j(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function de(e){if(j(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(j(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Y(e){return de(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var he=new Set(["string","number","symbol"]);function _e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function x(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ge(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ut={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function S(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function xe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function q(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function O(e){return typeof e=="string"?e:e?.message}function k(e,t,r){let n=e.message?e.message:O(e.inst?._zod.def?.error?.(e))??O(t?.error?.(e))??O(r.customError?.(e))??O(r.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...c}=e;return c.path??(c.path=[]),c.message=n,t?.reportInput&&(c.input=i),c}function X(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}var ve=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,le,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ze=p("$ZodError",ve),T=p("$ZodError",ve,{Parent:Error});var at=e=>(t,r,n,o)=>{let s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new v;if(i.issues.length){let c=new(o?.Err??e)(i.issues.map(u=>k(u,s,Z())));throw G(c,o?.callee),c}return i.value},L=at(T),pt=e=>async(t,r,n,o)=>{let s=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let c=new(o?.Err??e)(i.issues.map(u=>k(u,s,Z())));throw G(c,o?.callee),c}return i.value},D=pt(T),lt=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new v;return s.issues.length?{success:!1,error:new(e??ze)(s.issues.map(i=>k(i,o,Z())))}:{success:!0,data:s.value}},M=lt(T),ft=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>k(i,o,Z())))}:{success:!0,data:s.value}},R=ft(T);var mt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",dt=new RegExp(`^${mt}$`);var $e=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var ye=/^-?\d+(?:\.\d+)?$/,be=/^(?:true|false)$/i;var N=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Ze=p("$ZodCheckStringFormat",(e,t)=>{var r,n;N.init(e,t),e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ke=p("$ZodCheckRegex",(e,t)=>{Ze.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var Ee={major:4,minor:4,patch:3};var g=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ee;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,c,u)=>{let a=S(i),l;for(let m of c){if(m._zod.def.when){if(xe(i)||!m._zod.def.when(i))continue}else if(a)continue;let f=i.issues.length,_=m._zod.check(i);if(_ instanceof Promise&&u?.async===!1)throw new v;if(l||_ instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await _,i.issues.length!==f&&(a||(a=S(i,f)))});else{if(i.issues.length===f)continue;a||(a=S(i,f))}}return l?l.then(()=>i):i},s=(i,c,u)=>{if(S(i))return i.aborted=!0,i;let a=o(c,n,u);if(a instanceof Promise){if(u.async===!1)throw new v;return a.then(l=>e._zod.parse(l,u))}return e._zod.parse(a,u)};e._zod.run=(i,c)=>{if(c.skipChecks)return e._zod.parse(i,c);if(c.direction==="backward"){let a=e._zod.parse({value:i.value,issues:[]},{...c,skipChecks:!0});return a instanceof Promise?a.then(l=>s(l,i,c)):s(a,i,c)}let u=e._zod.parse(i,c);if(u instanceof Promise){if(c.async===!1)throw new v;return u.then(a=>o(a,n,c))}return o(u,n,c)}}$(e,"~standard",()=>({validate:o=>{try{let s=M(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return R(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Te=p("$ZodString",(e,t)=>{g.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??$e(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}});var Me=p("$ZodNumber",(e,t)=>{g.init(e,t),e._zod.pattern=e._zod.bag.pattern??ye,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}});var Re=p("$ZodBoolean",(e,t)=>{g.init(e,t),e._zod.pattern=be,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});function Ce(e,t,r){e.issues.length&&t.issues.push(...q(r,e.issues)),t.value[r]=e.value}var Ne=p("$ZodArray",(e,t)=>{g.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let c=o[i],u=t.element._zod.run({value:c,issues:[]},n);u instanceof Promise?s.push(u.then(a=>Ce(a,r,i))):Ce(u,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function F(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...q(r,e.issues))}if(!i&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function ht(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=ge(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function _t(e,t,r,n,o,s){let i=[],c=o.keySet,u=o.catchall._zod,a=u.def.type,l=u.optin==="optional",m=u.optout==="optional";for(let f in t){if(f==="__proto__"||c.has(f))continue;if(a==="never"){i.push(f);continue}let _=u.run({value:t[f],issues:[]},n);_ instanceof Promise?e.push(_.then(b=>F(b,r,f,t,l,m))):F(_,r,f,t,l,m)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var Oe=p("$ZodObject",(e,t)=>{if(g.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...c};return Object.defineProperty(t,"shape",{value:u}),u}})}let n=fe(()=>ht(t));$(e._zod,"propValues",()=>{let c=t.shape,u={};for(let a in c){let l=c[a]._zod;if(l.values){u[a]??(u[a]=new Set);for(let m of l.values)u[a].add(m)}}return u});let o=j,s=t.catchall,i;e._zod.parse=(c,u)=>{i??(i=n.value);let a=c.value;if(!o(a))return c.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),c;c.value={};let l=[],m=i.shape;for(let f of i.keys){let _=m[f],b=_._zod.optin==="optional",se=_._zod.optout==="optional",B=_._zod.run({value:a[f],issues:[]},u);B instanceof Promise?l.push(B.then(st=>F(st,c,f,a,b,se))):F(B,c,f,a,b,se)}return s?_t(l,a,c,u,n.value,e):l.length?Promise.all(l).then(()=>c):c}});var je=p("$ZodEnum",(e,t)=>{g.init(e,t);let r=pe(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>he.has(typeof o)).map(o=>typeof o=="string"?_e(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}});function Ae(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Le=p("$ZodOptional",(e,t)=>{g.init(e,t),e._zod.optin="optional",e._zod.optout="optional",$(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),$(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${me(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=r.value,s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>Ae(i,o)):Ae(s,o)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var De=p("$ZodDefault",(e,t)=>{g.init(e,t),e._zod.optin="optional",$(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Se(s,t)):Se(o,t)}});function Se(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Fe=p("$ZodCustom",(e,t)=>{N.init(e,t),g.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>Ie(s,r,n,e));Ie(o,r,n,e)}});function Ie(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(X(o))}}function He(e,t){return new e({type:"string",...x(t)})}function Ue(e,t){return new e({type:"number",checks:[],...x(t)})}function Be(e,t){return new e({type:"boolean",...x(t)})}function Q(e,t){return new ke({check:"string_format",format:"regex",...x(t),pattern:e})}function Ke(e,t,r){let n=x(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}var z=p("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");g.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>L(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>M(e,r,n),e.parseAsync=async(r,n)=>D(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>R(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>J(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),xt=p("ZodMiniString",(e,t)=>{Te.init(e,t),z.init(e,t)});function w(e){return He(xt,e)}var vt=p("ZodMiniNumber",(e,t)=>{Me.init(e,t),z.init(e,t)});function ee(e){return Ue(vt,e)}var zt=p("ZodMiniBoolean",(e,t)=>{Re.init(e,t),z.init(e,t)});function y(e){return Be(zt,e)}var $t=p("ZodMiniArray",(e,t)=>{Ne.init(e,t),z.init(e,t)});function te(e,t){return new $t({type:"array",element:e,...x(t)})}var yt=p("ZodMiniObject",(e,t)=>{Oe.init(e,t),z.init(e,t),$(e,"shape",()=>t.shape)});function re(e,t){let r={type:"object",shape:e??{},...x(t)};return new yt(r)}var bt=p("ZodMiniEnum",(e,t)=>{je.init(e,t),z.init(e,t),e.options=Object.values(t.entries)});function Ve(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new bt({type:"enum",entries:r,...x(t)})}var wt=p("ZodMiniOptional",(e,t)=>{Le.init(e,t),z.init(e,t)});function d(e){return new wt({type:"optional",innerType:e})}var Zt=p("ZodMiniDefault",(e,t)=>{De.init(e,t),z.init(e,t)});function P(e,t){return new Zt({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Y(t)}})}var kt=p("ZodMiniCustom",(e,t)=>{Fe.init(e,t),z.init(e,t)});function ne(e,t){return Ke(kt,e??(()=>!0),t)}var H="https://in.dev.heycatch.ai",C="dev",A="0.7.1-dev.1123",We="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function Ge(e=C){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${A}). Events are being sent to the HeyCatch development environment and will NEVER appear in your dashboard. Reinstall the latest stable version - resolve it with \`npm view @heycatch/sdk version\` - or re-run the install guide: https://heycatch.ai/agents.md`}var E="unknown",At=["localStorage","cookie","memory","localStorage+cookie","sessionStorage"];var Ye=re({projectKey:w({error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'}).check(Q(/^hck_pk_/,{error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'})),tracingHosts:P(te(w()),[]),install:P(re({framework:P(w(),E),frameworkVersion:P(w(),E),agent:P(w(),E)}),{framework:E,frameworkVersion:E,agent:E}),autocapture:d(y()),maskAllText:d(y()),maskAllElementAttributes:d(y()),propertyDenylist:d(te(w())),sanitizeProperties:d(ne(e=>typeof e=="function")),beforeSend:d(ne(e=>typeof e=="function"||Array.isArray(e)&&e.every(t=>typeof t=="function"))),persistence:d(Ve(At)),disablePersistence:d(y()),cookieExpirationDays:d(ee()),optOutCapturingByDefault:d(y()),respectDnt:d(y()),requestBatching:d(y()),flushIntervalMs:d(ee())});var oe=null;function h(){return oe}var ie=null;function Je(){ie?.()}function qe(e){if(oe!==null)return;let t=Ye.safeParse(e);if(!t.success){let i=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${i}`);return}let r=new St(We,{host:H,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0,...t.data.optOutCapturingByDefault===void 0?{}:{defaultOptIn:!t.data.optOutCapturingByDefault}}),{install:n}=t.data,o={heycatch_framework:n.framework,heycatch_framework_version:n.frameworkVersion,heycatch_agent:n.agent};ie=()=>{r.register({heycatch_sdk_version:A,heycatch_sdk_stage:C,heycatch_project_key:t.data.projectKey,...o}),r.group(ce,t.data.projectKey,{key:t.data.projectKey,sdk_version:A,sdk_stage:C,framework:n.framework,framework_version:n.frameworkVersion,agent:n.agent,api_host:H})},ie(),oe=r,console.info(`[HeyCatch] SDK v${A} (${C}) initialized \u2192 ${H}`);let s=Ge();s!==null&&console.warn(s)}function Xe(e){return t=>{console.error(`[HeyCatch] consent ${e} could not be saved - capture state may reset on the next app launch:`,t)}}function Qe(){h()?.optIn().catch(Xe("opt-in"))}function et(){h()?.optOut().catch(Xe("opt-out"))}function tt(e,t,r){let n=h();if(n!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] setIdentity() requires a non-empty string user id. Pass a stable internal user id from your auth provider \u2014 not an email or session token.");return}n.identify(e,{...t?{$set:t}:{},...r?{$set_once:r}:{}})}}function rt(){let e=h();e!==null&&(e.reset(),Je())}function U(e,t){let r=h();if(r!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackScreen() requires a non-empty screen name.");return}r.screen(e,t?t:void 0)}}function nt(e,t,r){let n=h();if(n!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackEvent() requires a non-empty event name.");return}if(e.startsWith("$")){console.error(`[HeyCatch] trackEvent() event names cannot start with "$" (got "${e}") - that prefix is reserved for built-in events.`);return}n.capture(e,{...t,...r?.set?{$set:r.set}:{},...r?.setOnce?{$set_once:r.setOnce}:{},heycatch_custom_user_event:!0})}}function ot(e,t){let r=h();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}import{PostHogProvider as It}from"posthog-react-native";import{useEffect as Tt}from"react";import{jsx as jt,jsxs as Lt}from"react/jsx-runtime";function Mt(){try{if(typeof K!="function")return null;let e=K("expo-router");return typeof e=="object"&&e!==null&&"usePathname"in e&&typeof e.usePathname=="function"&&"useGlobalSearchParams"in e&&typeof e.useGlobalSearchParams=="function"?{usePathname:e.usePathname,useGlobalSearchParams:e.useGlobalSearchParams}:null}catch{return null}}var it=Mt();function Rt(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[n,o]of Object.entries(t)){if(typeof o=="string"||typeof o=="number"||typeof o=="boolean"){r[n]=o;continue}Array.isArray(o)&&(r[n]=o.filter(s=>typeof s=="string").join(","))}return r}function Nt({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,n=r(),o=JSON.stringify(t());return Tt(()=>{U(n,Rt(o))},[n,o]),null}function Ot({children:e}){let t=h();return t===null?(console.error("[HeyCatch] HeyCatchProvider mounted before init() - call analytics.init({ projectKey }) at module scope of the root layout."),e):Lt(It,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[it===null?null:jt(Nt,{router:it}),e]})}var ps={init:qe,optInCapturing:Qe,optOutCapturing:et,resetIdentity:rt,setIdentity:tt,setPersonProperties:ot,trackEvent:nt,trackScreen:U};export{Ot as HeyCatchProvider,A as SDK_VERSION,C as STAGE,ps as analytics};
1
+ var K=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ce="project",ct="[a-z0-9]",Ft=new RegExp(`^${ct}$`);import{PostHog as St}from"posthog-react-native";var ue;function p(e,t,r){function n(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);let a=i.prototype,l=Object.keys(a);for(let m=0;m<l.length;m++){let f=l[m];f in c||(c[f]=a[f].bind(c))}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(c){var u;let a=r?.Parent?new s:this;n(a,c),(u=a._zod).deferred??(u.deferred=[]);for(let l of a._zod.deferred)l();return a}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var v=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(ue=globalThis).__zod_globalConfig??(ue.__zod_globalConfig={});var V=globalThis.__zod_globalConfig;function Z(e){return e&&Object.assign(V,e),V}function pe(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function le(e,t){return typeof t=="bigint"?t.toString():t}function fe(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function me(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}var ae=Symbol("evaluating");function $(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ae)return n===void 0&&(n=ae,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}var G="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function j(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function de(e){if(j(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(j(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Y(e){return de(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var he=new Set(["string","number","symbol"]);function _e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function x(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ge(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ut={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function S(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function xe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function q(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function O(e){return typeof e=="string"?e:e?.message}function k(e,t,r){let n=e.message?e.message:O(e.inst?._zod.def?.error?.(e))??O(t?.error?.(e))??O(r.customError?.(e))??O(r.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...c}=e;return c.path??(c.path=[]),c.message=n,t?.reportInput&&(c.input=i),c}function X(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}var ve=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,le,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ze=p("$ZodError",ve),T=p("$ZodError",ve,{Parent:Error});var at=e=>(t,r,n,o)=>{let s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new v;if(i.issues.length){let c=new(o?.Err??e)(i.issues.map(u=>k(u,s,Z())));throw G(c,o?.callee),c}return i.value},L=at(T),pt=e=>async(t,r,n,o)=>{let s=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let c=new(o?.Err??e)(i.issues.map(u=>k(u,s,Z())));throw G(c,o?.callee),c}return i.value},D=pt(T),lt=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new v;return s.issues.length?{success:!1,error:new(e??ze)(s.issues.map(i=>k(i,o,Z())))}:{success:!0,data:s.value}},M=lt(T),ft=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>k(i,o,Z())))}:{success:!0,data:s.value}},R=ft(T);var mt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",dt=new RegExp(`^${mt}$`);var $e=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var ye=/^-?\d+(?:\.\d+)?$/,be=/^(?:true|false)$/i;var N=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Ze=p("$ZodCheckStringFormat",(e,t)=>{var r,n;N.init(e,t),e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ke=p("$ZodCheckRegex",(e,t)=>{Ze.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var Ee={major:4,minor:4,patch:3};var g=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ee;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,c,u)=>{let a=S(i),l;for(let m of c){if(m._zod.def.when){if(xe(i)||!m._zod.def.when(i))continue}else if(a)continue;let f=i.issues.length,_=m._zod.check(i);if(_ instanceof Promise&&u?.async===!1)throw new v;if(l||_ instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await _,i.issues.length!==f&&(a||(a=S(i,f)))});else{if(i.issues.length===f)continue;a||(a=S(i,f))}}return l?l.then(()=>i):i},s=(i,c,u)=>{if(S(i))return i.aborted=!0,i;let a=o(c,n,u);if(a instanceof Promise){if(u.async===!1)throw new v;return a.then(l=>e._zod.parse(l,u))}return e._zod.parse(a,u)};e._zod.run=(i,c)=>{if(c.skipChecks)return e._zod.parse(i,c);if(c.direction==="backward"){let a=e._zod.parse({value:i.value,issues:[]},{...c,skipChecks:!0});return a instanceof Promise?a.then(l=>s(l,i,c)):s(a,i,c)}let u=e._zod.parse(i,c);if(u instanceof Promise){if(c.async===!1)throw new v;return u.then(a=>o(a,n,c))}return o(u,n,c)}}$(e,"~standard",()=>({validate:o=>{try{let s=M(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return R(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Te=p("$ZodString",(e,t)=>{g.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??$e(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}});var Me=p("$ZodNumber",(e,t)=>{g.init(e,t),e._zod.pattern=e._zod.bag.pattern??ye,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}});var Re=p("$ZodBoolean",(e,t)=>{g.init(e,t),e._zod.pattern=be,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});function Ce(e,t,r){e.issues.length&&t.issues.push(...q(r,e.issues)),t.value[r]=e.value}var Ne=p("$ZodArray",(e,t)=>{g.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let c=o[i],u=t.element._zod.run({value:c,issues:[]},n);u instanceof Promise?s.push(u.then(a=>Ce(a,r,i))):Ce(u,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function F(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...q(r,e.issues))}if(!i&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function ht(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=ge(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function _t(e,t,r,n,o,s){let i=[],c=o.keySet,u=o.catchall._zod,a=u.def.type,l=u.optin==="optional",m=u.optout==="optional";for(let f in t){if(f==="__proto__"||c.has(f))continue;if(a==="never"){i.push(f);continue}let _=u.run({value:t[f],issues:[]},n);_ instanceof Promise?e.push(_.then(b=>F(b,r,f,t,l,m))):F(_,r,f,t,l,m)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var Oe=p("$ZodObject",(e,t)=>{if(g.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...c};return Object.defineProperty(t,"shape",{value:u}),u}})}let n=fe(()=>ht(t));$(e._zod,"propValues",()=>{let c=t.shape,u={};for(let a in c){let l=c[a]._zod;if(l.values){u[a]??(u[a]=new Set);for(let m of l.values)u[a].add(m)}}return u});let o=j,s=t.catchall,i;e._zod.parse=(c,u)=>{i??(i=n.value);let a=c.value;if(!o(a))return c.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),c;c.value={};let l=[],m=i.shape;for(let f of i.keys){let _=m[f],b=_._zod.optin==="optional",se=_._zod.optout==="optional",B=_._zod.run({value:a[f],issues:[]},u);B instanceof Promise?l.push(B.then(st=>F(st,c,f,a,b,se))):F(B,c,f,a,b,se)}return s?_t(l,a,c,u,n.value,e):l.length?Promise.all(l).then(()=>c):c}});var je=p("$ZodEnum",(e,t)=>{g.init(e,t);let r=pe(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>he.has(typeof o)).map(o=>typeof o=="string"?_e(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}});function Ae(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Le=p("$ZodOptional",(e,t)=>{g.init(e,t),e._zod.optin="optional",e._zod.optout="optional",$(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),$(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${me(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=r.value,s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>Ae(i,o)):Ae(s,o)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var De=p("$ZodDefault",(e,t)=>{g.init(e,t),e._zod.optin="optional",$(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Se(s,t)):Se(o,t)}});function Se(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Fe=p("$ZodCustom",(e,t)=>{N.init(e,t),g.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>Ie(s,r,n,e));Ie(o,r,n,e)}});function Ie(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(X(o))}}function He(e,t){return new e({type:"string",...x(t)})}function Ue(e,t){return new e({type:"number",checks:[],...x(t)})}function Be(e,t){return new e({type:"boolean",...x(t)})}function Q(e,t){return new ke({check:"string_format",format:"regex",...x(t),pattern:e})}function Ke(e,t,r){let n=x(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}var z=p("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");g.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>L(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>M(e,r,n),e.parseAsync=async(r,n)=>D(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>R(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>J(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),xt=p("ZodMiniString",(e,t)=>{Te.init(e,t),z.init(e,t)});function w(e){return He(xt,e)}var vt=p("ZodMiniNumber",(e,t)=>{Me.init(e,t),z.init(e,t)});function ee(e){return Ue(vt,e)}var zt=p("ZodMiniBoolean",(e,t)=>{Re.init(e,t),z.init(e,t)});function y(e){return Be(zt,e)}var $t=p("ZodMiniArray",(e,t)=>{Ne.init(e,t),z.init(e,t)});function te(e,t){return new $t({type:"array",element:e,...x(t)})}var yt=p("ZodMiniObject",(e,t)=>{Oe.init(e,t),z.init(e,t),$(e,"shape",()=>t.shape)});function re(e,t){let r={type:"object",shape:e??{},...x(t)};return new yt(r)}var bt=p("ZodMiniEnum",(e,t)=>{je.init(e,t),z.init(e,t),e.options=Object.values(t.entries)});function Ve(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new bt({type:"enum",entries:r,...x(t)})}var wt=p("ZodMiniOptional",(e,t)=>{Le.init(e,t),z.init(e,t)});function d(e){return new wt({type:"optional",innerType:e})}var Zt=p("ZodMiniDefault",(e,t)=>{De.init(e,t),z.init(e,t)});function P(e,t){return new Zt({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Y(t)}})}var kt=p("ZodMiniCustom",(e,t)=>{Fe.init(e,t),z.init(e,t)});function ne(e,t){return Ke(kt,e??(()=>!0),t)}var H="https://in.dev.heycatch.ai",C="dev",A="0.7.1-dev.1456",We="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function Ge(e=C){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${A}). Events are being sent to the HeyCatch development environment and will NEVER appear in your dashboard. Reinstall the latest stable version - resolve it with \`npm view @heycatch/sdk version\` - or re-run the install guide: https://heycatch.ai/agents.md`}var E="unknown",At=["localStorage","cookie","memory","localStorage+cookie","sessionStorage"];var Ye=re({projectKey:w({error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'}).check(Q(/^hck_pk_/,{error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'})),tracingHosts:P(te(w()),[]),install:P(re({framework:P(w(),E),frameworkVersion:P(w(),E),agent:P(w(),E)}),{framework:E,frameworkVersion:E,agent:E}),autocapture:d(y()),maskAllText:d(y()),maskAllElementAttributes:d(y()),propertyDenylist:d(te(w())),sanitizeProperties:d(ne(e=>typeof e=="function")),beforeSend:d(ne(e=>typeof e=="function"||Array.isArray(e)&&e.every(t=>typeof t=="function"))),persistence:d(Ve(At)),disablePersistence:d(y()),cookieExpirationDays:d(ee()),optOutCapturingByDefault:d(y()),respectDnt:d(y()),requestBatching:d(y()),flushIntervalMs:d(ee())});var oe=null;function h(){return oe}var ie=null;function Je(){ie?.()}function qe(e){if(oe!==null)return;let t=Ye.safeParse(e);if(!t.success){let i=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${i}`);return}let r=new St(We,{host:H,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0,...t.data.optOutCapturingByDefault===void 0?{}:{defaultOptIn:!t.data.optOutCapturingByDefault}}),{install:n}=t.data,o={heycatch_framework:n.framework,heycatch_framework_version:n.frameworkVersion,heycatch_agent:n.agent};ie=()=>{r.register({heycatch_sdk_version:A,heycatch_sdk_stage:C,heycatch_project_key:t.data.projectKey,...o}),r.group(ce,t.data.projectKey,{key:t.data.projectKey,sdk_version:A,sdk_stage:C,framework:n.framework,framework_version:n.frameworkVersion,agent:n.agent,api_host:H})},ie(),oe=r,console.info(`[HeyCatch] SDK v${A} (${C}) initialized \u2192 ${H}`);let s=Ge();s!==null&&console.warn(s)}function Xe(e){return t=>{console.error(`[HeyCatch] consent ${e} could not be saved - capture state may reset on the next app launch:`,t)}}function Qe(){h()?.optIn().catch(Xe("opt-in"))}function et(){h()?.optOut().catch(Xe("opt-out"))}function tt(e,t,r){let n=h();if(n!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] setIdentity() requires a non-empty string user id. Pass a stable internal user id from your auth provider \u2014 not an email or session token.");return}n.identify(e,{...t?{$set:t}:{},...r?{$set_once:r}:{}})}}function rt(){let e=h();e!==null&&(e.reset(),Je())}function U(e,t){let r=h();if(r!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackScreen() requires a non-empty screen name.");return}r.screen(e,t?t:void 0)}}function nt(e,t,r){let n=h();if(n!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackEvent() requires a non-empty event name.");return}if(e.startsWith("$")){console.error(`[HeyCatch] trackEvent() event names cannot start with "$" (got "${e}") - that prefix is reserved for built-in events.`);return}n.capture(e,{...t,...r?.set?{$set:r.set}:{},...r?.setOnce?{$set_once:r.setOnce}:{},heycatch_custom_user_event:!0})}}function ot(e,t){let r=h();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}import{PostHogProvider as It}from"posthog-react-native";import{useEffect as Tt}from"react";import{jsx as jt,jsxs as Lt}from"react/jsx-runtime";function Mt(){try{if(typeof K!="function")return null;let e=K("expo-router");return typeof e=="object"&&e!==null&&"usePathname"in e&&typeof e.usePathname=="function"&&"useGlobalSearchParams"in e&&typeof e.useGlobalSearchParams=="function"?{usePathname:e.usePathname,useGlobalSearchParams:e.useGlobalSearchParams}:null}catch{return null}}var it=Mt();function Rt(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[n,o]of Object.entries(t)){if(typeof o=="string"||typeof o=="number"||typeof o=="boolean"){r[n]=o;continue}Array.isArray(o)&&(r[n]=o.filter(s=>typeof s=="string").join(","))}return r}function Nt({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,n=r(),o=JSON.stringify(t());return Tt(()=>{U(n,Rt(o))},[n,o]),null}function Ot({children:e}){let t=h();return t===null?(console.error("[HeyCatch] HeyCatchProvider mounted before init() - call analytics.init({ projectKey }) at module scope of the root layout."),e):Lt(It,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[it===null?null:jt(Nt,{router:it}),e]})}var ps={init:qe,optInCapturing:Qe,optOutCapturing:et,resetIdentity:rt,setIdentity:tt,setPersonProperties:ot,trackEvent:nt,trackScreen:U};export{Ot as HeyCatchProvider,A as SDK_VERSION,C as STAGE,ps as analytics};
2
2
  //# sourceMappingURL=react-native.js.map