@heycatch/sdk 0.7.0-dev.433 → 0.7.0-dev.714

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 H=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var Le=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Ue=(e,t)=>{for(var r in t)H(e,r,{get:t[r],enumerable:!0})},He=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Le(t))!De.call(e,i)&&i!==r&&H(e,i,{get:()=>t[i],enumerable:!(n=Fe(t,i))||n.enumerable});return e};var Ke=e=>He(H({},"__esModule",{value:!0}),e);var ht={};Ue(ht,{HeyCatchProvider:()=>Oe,SDK_VERSION:()=>v,STAGE:()=>x,analytics:()=>dt});module.exports=Ke(ht);var re="project",Be="[a-z0-9]",gt=new RegExp(`^${Be}$`);var Pe=require("posthog-react-native");var ne;function f(e,t,r){function n(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let a=o.prototype,p=Object.keys(a);for(let m=0;m<p.length;m++){let l=p[m];l in s||(s[l]=a[l].bind(s))}}let i=r?.Parent??Object;class c extends i{}Object.defineProperty(c,"name",{value:e});function o(s){var u;let a=r?.Parent?new c:this;n(a,s),(u=a._zod).deferred??(u.deferred=[]);for(let p of a._zod.deferred)p();return a}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var _=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(ne=globalThis).__zod_globalConfig??(ne.__zod_globalConfig={});var K=globalThis.__zod_globalConfig;function z(e){return e&&Object.assign(K,e),K}function ie(e,t){return typeof t=="bigint"?t.toString():t}function se(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}var oe=Symbol("evaluating");function $(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==oe)return n===void 0&&(n=oe,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}var V="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function M(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ce(e){if(M(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(M(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function W(e){return ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function G(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function y(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 ue(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var vt={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 E(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 ae(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 J(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function I(e){return typeof e=="string"?e:e?.message}function b(e,t,r){let n=e.message?e.message:I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(r.customError?.(e))??I(r.localeError?.(e))??"Invalid input",{inst:i,continue:c,input:o,...s}=e;return s.path??(s.path=[]),s.message=n,t?.reportInput&&(s.input=o),s}var pe=(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,ie,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},le=f("$ZodError",pe),C=f("$ZodError",pe,{Parent:Error});var We=e=>(t,r,n,i)=>{let c=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},c);if(o instanceof Promise)throw new _;if(o.issues.length){let s=new(i?.Err??e)(o.issues.map(u=>b(u,c,z())));throw V(s,i?.callee),s}return o.value},R=We(C),Ge=e=>async(t,r,n,i)=>{let c=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},c);if(o instanceof Promise&&(o=await o),o.issues.length){let s=new(i?.Err??e)(o.issues.map(u=>b(u,c,z())));throw V(s,i?.callee),s}return o.value},N=Ge(C),Je=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},c=t._zod.run({value:r,issues:[]},i);if(c instanceof Promise)throw new _;return c.issues.length?{success:!1,error:new(e??le)(c.issues.map(o=>b(o,i,z())))}:{success:!0,data:c.value}},S=Je(C),Ye=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},c=t._zod.run({value:r,issues:[]},i);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(o=>b(o,i,z())))}:{success:!0,data:c.value}},T=Ye(C);var qe="(?:(?:\\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])))",Xe=new RegExp(`^${qe}$`);var fe=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Y=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Qe=f("$ZodCheckStringFormat",(e,t)=>{var r,n;Y.init(e,t),e._zod.onattach.push(i=>{let c=i._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),de=f("$ZodCheckRegex",(e,t)=>{Qe.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 he={major:4,minor:4,patch:3};var w=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=he;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let c of i._zod.onattach)c(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(o,s,u)=>{let a=E(o),p;for(let m of s){if(m._zod.def.when){if(ae(o)||!m._zod.def.when(o))continue}else if(a)continue;let l=o.issues.length,d=m._zod.check(o);if(d instanceof Promise&&u?.async===!1)throw new _;if(p||d instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await d,o.issues.length!==l&&(a||(a=E(o,l)))});else{if(o.issues.length===l)continue;a||(a=E(o,l))}}return p?p.then(()=>o):o},c=(o,s,u)=>{if(E(o))return o.aborted=!0,o;let a=i(s,n,u);if(a instanceof Promise){if(u.async===!1)throw new _;return a.then(p=>e._zod.parse(p,u))}return e._zod.parse(a,u)};e._zod.run=(o,s)=>{if(s.skipChecks)return e._zod.parse(o,s);if(s.direction==="backward"){let a=e._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return a instanceof Promise?a.then(p=>c(p,o,s)):c(a,o,s)}let u=e._zod.parse(o,s);if(u instanceof Promise){if(s.async===!1)throw new _;return u.then(a=>i(a,n,s))}return i(u,n,s)}}$(e,"~standard",()=>({validate:i=>{try{let c=S(e,i);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return T(e,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),xe=f("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??fe(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}});function _e(e,t,r){e.issues.length&&t.issues.push(...J(r,e.issues)),t.value[r]=e.value}var ve=f("$ZodArray",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let c=[];for(let o=0;o<i.length;o++){let s=i[o],u=t.element._zod.run({value:s,issues:[]},n);u instanceof Promise?c.push(u.then(a=>_e(a,r,o))):_e(u,r,o)}return c.length?Promise.all(c).then(()=>r):r}});function O(e,t,r,n,i,c){let o=r in n;if(e.issues.length){if(i&&c&&!o)return;t.issues.push(...J(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?o&&(t.value[r]=void 0):t.value[r]=e.value}function rt(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=ue(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function nt(e,t,r,n,i,c){let o=[],s=i.keySet,u=i.catchall._zod,a=u.def.type,p=u.optin==="optional",m=u.optout==="optional";for(let l in t){if(l==="__proto__"||s.has(l))continue;if(a==="never"){o.push(l);continue}let d=u.run({value:t[l],issues:[]},n);d instanceof Promise?e.push(d.then(g=>O(g,r,l,t,p,m))):O(d,r,l,t,p,m)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:c}),e.length?Promise.all(e).then(()=>r):r}var ze=f("$ZodObject",(e,t)=>{if(w.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...s};return Object.defineProperty(t,"shape",{value:u}),u}})}let n=se(()=>rt(t));$(e._zod,"propValues",()=>{let s=t.shape,u={};for(let a in s){let p=s[a]._zod;if(p.values){u[a]??(u[a]=new Set);for(let m of p.values)u[a].add(m)}}return u});let i=M,c=t.catchall,o;e._zod.parse=(s,u)=>{o??(o=n.value);let a=s.value;if(!i(a))return s.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),s;s.value={};let p=[],m=o.shape;for(let l of o.keys){let d=m[l],g=d._zod.optin==="optional",te=d._zod.optout==="optional",U=d._zod.run({value:a[l],issues:[]},u);U instanceof Promise?p.push(U.then(je=>O(je,s,l,a,g,te))):O(U,s,l,a,g,te)}return c?nt(p,a,s,u,n.value,e):p.length?Promise.all(p).then(()=>s):s}});var $e=f("$ZodDefault",(e,t)=>{w.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 i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(c=>ge(c,t)):ge(i,t)}});function ge(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function ye(e,t){return new e({type:"string",...y(t)})}function q(e,t){return new de({check:"string_format",format:"regex",...y(t),pattern:e})}var j=f("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");w.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>R(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>S(e,r,n),e.parseAsync=async(r,n)=>N(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>T(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)=>G(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),it=f("ZodMiniString",(e,t)=>{xe.init(e,t),j.init(e,t)});function Z(e){return ye(it,e)}var st=f("ZodMiniArray",(e,t)=>{ve.init(e,t),j.init(e,t)});function be(e,t){return new st({type:"array",element:e,...y(t)})}var ct=f("ZodMiniObject",(e,t)=>{ze.init(e,t),j.init(e,t),$(e,"shape",()=>t.shape)});function X(e,t){let r={type:"object",shape:e??{},...y(t)};return new ct(r)}var ut=f("ZodMiniDefault",(e,t)=>{$e.init(e,t),j.init(e,t)});function k(e,t){return new ut({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():W(t)}})}var F="https://in.dev.heycatch.ai",x="dev",v="0.7.0-dev.433",we="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function Ze(e=x){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${v}). 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 P="unknown",ke=X({projectKey:Z({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:k(be(Z()),[]),install:k(X({framework:k(Z(),P),frameworkVersion:k(Z(),P),agent:k(Z(),P)}),{framework:P,frameworkVersion:P,agent:P})});var Q=null;function h(){return Q}var ee=null;function Ee(){ee?.()}function Ae(e){if(Q!==null)return;let t=ke.safeParse(e);if(!t.success){let o=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${o}`);return}let r=new Pe.PostHog(we,{host:F,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0}),{install:n}=t.data,i={heycatch_framework:n.framework,heycatch_framework_version:n.frameworkVersion,heycatch_agent:n.agent};ee=()=>{r.register({heycatch_sdk_version:v,heycatch_sdk_stage:x,heycatch_project_key:t.data.projectKey,...i}),r.group(re,t.data.projectKey,{key:t.data.projectKey,sdk_version:v,sdk_stage:x,framework:n.framework,framework_version:n.frameworkVersion,agent:n.agent,api_host:F})},ee(),Q=r,console.info(`[HeyCatch] SDK v${v} (${x}) initialized \u2192 ${F}`);let c=Ze();c!==null&&console.warn(c)}function Ce(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 Se(){let e=h();e!==null&&(e.reset(),Ee())}function L(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 Te(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 Ie(e,t){let r=h();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}var Re=require("posthog-react-native"),Ne=require("react");var D=require("react/jsx-runtime");function lt(){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 Me=lt();function ft(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[n,i]of Object.entries(t)){if(typeof i=="string"||typeof i=="number"||typeof i=="boolean"){r[n]=i;continue}Array.isArray(i)&&(r[n]=i.filter(c=>typeof c=="string").join(","))}return r}function mt({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,n=r(),i=JSON.stringify(t());return(0,Ne.useEffect)(()=>{L(n,ft(i))},[n,i]),null}function Oe({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,D.jsxs)(Re.PostHogProvider,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[Me===null?null:(0,D.jsx)(mt,{router:Me}),e]})}var dt={init:Ae,resetIdentity:Se,setIdentity:Ce,setPersonProperties:Ie,trackEvent:Te,trackScreen:L};0&&(module.exports={HeyCatchProvider,SDK_VERSION,STAGE,analytics});
1
+ "use strict";var H=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var Le=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Ue=(e,t)=>{for(var r in t)H(e,r,{get:t[r],enumerable:!0})},He=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Le(t))!De.call(e,i)&&i!==r&&H(e,i,{get:()=>t[i],enumerable:!(n=Fe(t,i))||n.enumerable});return e};var Ke=e=>He(H({},"__esModule",{value:!0}),e);var ht={};Ue(ht,{HeyCatchProvider:()=>Oe,SDK_VERSION:()=>v,STAGE:()=>x,analytics:()=>dt});module.exports=Ke(ht);var re="project",Be="[a-z0-9]",gt=new RegExp(`^${Be}$`);var Pe=require("posthog-react-native");var ne;function f(e,t,r){function n(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let a=o.prototype,p=Object.keys(a);for(let m=0;m<p.length;m++){let l=p[m];l in s||(s[l]=a[l].bind(s))}}let i=r?.Parent??Object;class c extends i{}Object.defineProperty(c,"name",{value:e});function o(s){var u;let a=r?.Parent?new c:this;n(a,s),(u=a._zod).deferred??(u.deferred=[]);for(let p of a._zod.deferred)p();return a}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var _=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(ne=globalThis).__zod_globalConfig??(ne.__zod_globalConfig={});var K=globalThis.__zod_globalConfig;function z(e){return e&&Object.assign(K,e),K}function ie(e,t){return typeof t=="bigint"?t.toString():t}function se(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}var oe=Symbol("evaluating");function $(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==oe)return n===void 0&&(n=oe,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}var V="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function M(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ce(e){if(M(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(M(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function W(e){return ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function G(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function y(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 ue(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var vt={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 E(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 ae(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 J(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function I(e){return typeof e=="string"?e:e?.message}function b(e,t,r){let n=e.message?e.message:I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(r.customError?.(e))??I(r.localeError?.(e))??"Invalid input",{inst:i,continue:c,input:o,...s}=e;return s.path??(s.path=[]),s.message=n,t?.reportInput&&(s.input=o),s}var pe=(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,ie,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},le=f("$ZodError",pe),C=f("$ZodError",pe,{Parent:Error});var We=e=>(t,r,n,i)=>{let c=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},c);if(o instanceof Promise)throw new _;if(o.issues.length){let s=new(i?.Err??e)(o.issues.map(u=>b(u,c,z())));throw V(s,i?.callee),s}return o.value},R=We(C),Ge=e=>async(t,r,n,i)=>{let c=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},c);if(o instanceof Promise&&(o=await o),o.issues.length){let s=new(i?.Err??e)(o.issues.map(u=>b(u,c,z())));throw V(s,i?.callee),s}return o.value},N=Ge(C),Je=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},c=t._zod.run({value:r,issues:[]},i);if(c instanceof Promise)throw new _;return c.issues.length?{success:!1,error:new(e??le)(c.issues.map(o=>b(o,i,z())))}:{success:!0,data:c.value}},S=Je(C),Ye=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},c=t._zod.run({value:r,issues:[]},i);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(o=>b(o,i,z())))}:{success:!0,data:c.value}},T=Ye(C);var qe="(?:(?:\\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])))",Xe=new RegExp(`^${qe}$`);var fe=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Y=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Qe=f("$ZodCheckStringFormat",(e,t)=>{var r,n;Y.init(e,t),e._zod.onattach.push(i=>{let c=i._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),de=f("$ZodCheckRegex",(e,t)=>{Qe.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 he={major:4,minor:4,patch:3};var w=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=he;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let c of i._zod.onattach)c(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(o,s,u)=>{let a=E(o),p;for(let m of s){if(m._zod.def.when){if(ae(o)||!m._zod.def.when(o))continue}else if(a)continue;let l=o.issues.length,d=m._zod.check(o);if(d instanceof Promise&&u?.async===!1)throw new _;if(p||d instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await d,o.issues.length!==l&&(a||(a=E(o,l)))});else{if(o.issues.length===l)continue;a||(a=E(o,l))}}return p?p.then(()=>o):o},c=(o,s,u)=>{if(E(o))return o.aborted=!0,o;let a=i(s,n,u);if(a instanceof Promise){if(u.async===!1)throw new _;return a.then(p=>e._zod.parse(p,u))}return e._zod.parse(a,u)};e._zod.run=(o,s)=>{if(s.skipChecks)return e._zod.parse(o,s);if(s.direction==="backward"){let a=e._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return a instanceof Promise?a.then(p=>c(p,o,s)):c(a,o,s)}let u=e._zod.parse(o,s);if(u instanceof Promise){if(s.async===!1)throw new _;return u.then(a=>i(a,n,s))}return i(u,n,s)}}$(e,"~standard",()=>({validate:i=>{try{let c=S(e,i);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return T(e,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),xe=f("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??fe(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}});function _e(e,t,r){e.issues.length&&t.issues.push(...J(r,e.issues)),t.value[r]=e.value}var ve=f("$ZodArray",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let c=[];for(let o=0;o<i.length;o++){let s=i[o],u=t.element._zod.run({value:s,issues:[]},n);u instanceof Promise?c.push(u.then(a=>_e(a,r,o))):_e(u,r,o)}return c.length?Promise.all(c).then(()=>r):r}});function O(e,t,r,n,i,c){let o=r in n;if(e.issues.length){if(i&&c&&!o)return;t.issues.push(...J(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?o&&(t.value[r]=void 0):t.value[r]=e.value}function rt(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=ue(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function nt(e,t,r,n,i,c){let o=[],s=i.keySet,u=i.catchall._zod,a=u.def.type,p=u.optin==="optional",m=u.optout==="optional";for(let l in t){if(l==="__proto__"||s.has(l))continue;if(a==="never"){o.push(l);continue}let d=u.run({value:t[l],issues:[]},n);d instanceof Promise?e.push(d.then(g=>O(g,r,l,t,p,m))):O(d,r,l,t,p,m)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:c}),e.length?Promise.all(e).then(()=>r):r}var ze=f("$ZodObject",(e,t)=>{if(w.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...s};return Object.defineProperty(t,"shape",{value:u}),u}})}let n=se(()=>rt(t));$(e._zod,"propValues",()=>{let s=t.shape,u={};for(let a in s){let p=s[a]._zod;if(p.values){u[a]??(u[a]=new Set);for(let m of p.values)u[a].add(m)}}return u});let i=M,c=t.catchall,o;e._zod.parse=(s,u)=>{o??(o=n.value);let a=s.value;if(!i(a))return s.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),s;s.value={};let p=[],m=o.shape;for(let l of o.keys){let d=m[l],g=d._zod.optin==="optional",te=d._zod.optout==="optional",U=d._zod.run({value:a[l],issues:[]},u);U instanceof Promise?p.push(U.then(je=>O(je,s,l,a,g,te))):O(U,s,l,a,g,te)}return c?nt(p,a,s,u,n.value,e):p.length?Promise.all(p).then(()=>s):s}});var $e=f("$ZodDefault",(e,t)=>{w.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 i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(c=>ge(c,t)):ge(i,t)}});function ge(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function ye(e,t){return new e({type:"string",...y(t)})}function q(e,t){return new de({check:"string_format",format:"regex",...y(t),pattern:e})}var j=f("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");w.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>R(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>S(e,r,n),e.parseAsync=async(r,n)=>N(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>T(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)=>G(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),it=f("ZodMiniString",(e,t)=>{xe.init(e,t),j.init(e,t)});function Z(e){return ye(it,e)}var st=f("ZodMiniArray",(e,t)=>{ve.init(e,t),j.init(e,t)});function be(e,t){return new st({type:"array",element:e,...y(t)})}var ct=f("ZodMiniObject",(e,t)=>{ze.init(e,t),j.init(e,t),$(e,"shape",()=>t.shape)});function X(e,t){let r={type:"object",shape:e??{},...y(t)};return new ct(r)}var ut=f("ZodMiniDefault",(e,t)=>{$e.init(e,t),j.init(e,t)});function k(e,t){return new ut({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():W(t)}})}var F="https://in.dev.heycatch.ai",x="dev",v="0.7.0-dev.714",we="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function Ze(e=x){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${v}). 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 P="unknown",ke=X({projectKey:Z({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:k(be(Z()),[]),install:k(X({framework:k(Z(),P),frameworkVersion:k(Z(),P),agent:k(Z(),P)}),{framework:P,frameworkVersion:P,agent:P})});var Q=null;function h(){return Q}var ee=null;function Ee(){ee?.()}function Ae(e){if(Q!==null)return;let t=ke.safeParse(e);if(!t.success){let o=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${o}`);return}let r=new Pe.PostHog(we,{host:F,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0}),{install:n}=t.data,i={heycatch_framework:n.framework,heycatch_framework_version:n.frameworkVersion,heycatch_agent:n.agent};ee=()=>{r.register({heycatch_sdk_version:v,heycatch_sdk_stage:x,heycatch_project_key:t.data.projectKey,...i}),r.group(re,t.data.projectKey,{key:t.data.projectKey,sdk_version:v,sdk_stage:x,framework:n.framework,framework_version:n.frameworkVersion,agent:n.agent,api_host:F})},ee(),Q=r,console.info(`[HeyCatch] SDK v${v} (${x}) initialized \u2192 ${F}`);let c=Ze();c!==null&&console.warn(c)}function Ce(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 Se(){let e=h();e!==null&&(e.reset(),Ee())}function L(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 Te(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 Ie(e,t){let r=h();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}var Re=require("posthog-react-native"),Ne=require("react");var D=require("react/jsx-runtime");function lt(){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 Me=lt();function ft(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[n,i]of Object.entries(t)){if(typeof i=="string"||typeof i=="number"||typeof i=="boolean"){r[n]=i;continue}Array.isArray(i)&&(r[n]=i.filter(c=>typeof c=="string").join(","))}return r}function mt({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,n=r(),i=JSON.stringify(t());return(0,Ne.useEffect)(()=>{L(n,ft(i))},[n,i]),null}function Oe({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,D.jsxs)(Re.PostHogProvider,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[Me===null?null:(0,D.jsx)(mt,{router:Me}),e]})}var dt={init:Ae,resetIdentity:Se,setIdentity:Ce,setPersonProperties:Ie,trackEvent:Te,trackScreen:L};0&&(module.exports={HeyCatchProvider,SDK_VERSION,STAGE,analytics});
2
2
  //# sourceMappingURL=react-native.cjs.map
@@ -1,2 +1,2 @@
1
- var U=(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 te="project",Me="[a-z0-9]",pt=new RegExp(`^${Me}$`);import{PostHog as et}from"posthog-react-native";var re;function f(e,t,r){function n(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let a=o.prototype,p=Object.keys(a);for(let m=0;m<p.length;m++){let l=p[m];l in s||(s[l]=a[l].bind(s))}}let i=r?.Parent??Object;class c extends i{}Object.defineProperty(c,"name",{value:e});function o(s){var u;let a=r?.Parent?new c:this;n(a,s),(u=a._zod).deferred??(u.deferred=[]);for(let p of a._zod.deferred)p();return a}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var _=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(re=globalThis).__zod_globalConfig??(re.__zod_globalConfig={});var H=globalThis.__zod_globalConfig;function x(e){return e&&Object.assign(H,e),H}function oe(e,t){return typeof t=="bigint"?t.toString():t}function ie(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}var ne=Symbol("evaluating");function v(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ne)return n===void 0&&(n=ne,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}var B="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function M(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function se(e){if(M(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(M(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function V(e){return se(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function W(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function z(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 ce(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ft={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 E(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 ue(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 G(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function I(e){return typeof e=="string"?e:e?.message}function $(e,t,r){let n=e.message?e.message:I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(r.customError?.(e))??I(r.localeError?.(e))??"Invalid input",{inst:i,continue:c,input:o,...s}=e;return s.path??(s.path=[]),s.message=n,t?.reportInput&&(s.input=o),s}var ae=(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,oe,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},pe=f("$ZodError",ae),C=f("$ZodError",ae,{Parent:Error});var Ne=e=>(t,r,n,i)=>{let c=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},c);if(o instanceof Promise)throw new _;if(o.issues.length){let s=new(i?.Err??e)(o.issues.map(u=>$(u,c,x())));throw B(s,i?.callee),s}return o.value},R=Ne(C),Oe=e=>async(t,r,n,i)=>{let c=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},c);if(o instanceof Promise&&(o=await o),o.issues.length){let s=new(i?.Err??e)(o.issues.map(u=>$(u,c,x())));throw B(s,i?.callee),s}return o.value},N=Oe(C),je=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},c=t._zod.run({value:r,issues:[]},i);if(c instanceof Promise)throw new _;return c.issues.length?{success:!1,error:new(e??pe)(c.issues.map(o=>$(o,i,x())))}:{success:!0,data:c.value}},S=je(C),Fe=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},c=t._zod.run({value:r,issues:[]},i);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(o=>$(o,i,x())))}:{success:!0,data:c.value}},T=Fe(C);var Le="(?:(?:\\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])))",De=new RegExp(`^${Le}$`);var le=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var J=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Ue=f("$ZodCheckStringFormat",(e,t)=>{var r,n;J.init(e,t),e._zod.onattach.push(i=>{let c=i._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),me=f("$ZodCheckRegex",(e,t)=>{Ue.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 de={major:4,minor:4,patch:3};var y=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=de;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let c of i._zod.onattach)c(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(o,s,u)=>{let a=E(o),p;for(let m of s){if(m._zod.def.when){if(ue(o)||!m._zod.def.when(o))continue}else if(a)continue;let l=o.issues.length,d=m._zod.check(o);if(d instanceof Promise&&u?.async===!1)throw new _;if(p||d instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await d,o.issues.length!==l&&(a||(a=E(o,l)))});else{if(o.issues.length===l)continue;a||(a=E(o,l))}}return p?p.then(()=>o):o},c=(o,s,u)=>{if(E(o))return o.aborted=!0,o;let a=i(s,n,u);if(a instanceof Promise){if(u.async===!1)throw new _;return a.then(p=>e._zod.parse(p,u))}return e._zod.parse(a,u)};e._zod.run=(o,s)=>{if(s.skipChecks)return e._zod.parse(o,s);if(s.direction==="backward"){let a=e._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return a instanceof Promise?a.then(p=>c(p,o,s)):c(a,o,s)}let u=e._zod.parse(o,s);if(u instanceof Promise){if(s.async===!1)throw new _;return u.then(a=>i(a,n,s))}return i(u,n,s)}}v(e,"~standard",()=>({validate:i=>{try{let c=S(e,i);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return T(e,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),ge=f("$ZodString",(e,t)=>{y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??le(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}});function he(e,t,r){e.issues.length&&t.issues.push(...G(r,e.issues)),t.value[r]=e.value}var xe=f("$ZodArray",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let c=[];for(let o=0;o<i.length;o++){let s=i[o],u=t.element._zod.run({value:s,issues:[]},n);u instanceof Promise?c.push(u.then(a=>he(a,r,o))):he(u,r,o)}return c.length?Promise.all(c).then(()=>r):r}});function O(e,t,r,n,i,c){let o=r in n;if(e.issues.length){if(i&&c&&!o)return;t.issues.push(...G(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?o&&(t.value[r]=void 0):t.value[r]=e.value}function Be(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=ce(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ve(e,t,r,n,i,c){let o=[],s=i.keySet,u=i.catchall._zod,a=u.def.type,p=u.optin==="optional",m=u.optout==="optional";for(let l in t){if(l==="__proto__"||s.has(l))continue;if(a==="never"){o.push(l);continue}let d=u.run({value:t[l],issues:[]},n);d instanceof Promise?e.push(d.then(g=>O(g,r,l,t,p,m))):O(d,r,l,t,p,m)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:c}),e.length?Promise.all(e).then(()=>r):r}var ve=f("$ZodObject",(e,t)=>{if(y.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...s};return Object.defineProperty(t,"shape",{value:u}),u}})}let n=ie(()=>Be(t));v(e._zod,"propValues",()=>{let s=t.shape,u={};for(let a in s){let p=s[a]._zod;if(p.values){u[a]??(u[a]=new Set);for(let m of p.values)u[a].add(m)}}return u});let i=M,c=t.catchall,o;e._zod.parse=(s,u)=>{o??(o=n.value);let a=s.value;if(!i(a))return s.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),s;s.value={};let p=[],m=o.shape;for(let l of o.keys){let d=m[l],g=d._zod.optin==="optional",ee=d._zod.optout==="optional",D=d._zod.run({value:a[l],issues:[]},u);D instanceof Promise?p.push(D.then(Ie=>O(Ie,s,l,a,g,ee))):O(D,s,l,a,g,ee)}return c?Ve(p,a,s,u,n.value,e):p.length?Promise.all(p).then(()=>s):s}});var ze=f("$ZodDefault",(e,t)=>{y.init(e,t),e._zod.optin="optional",v(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 i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(c=>_e(c,t)):_e(i,t)}});function _e(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function $e(e,t){return new e({type:"string",...z(t)})}function Y(e,t){return new me({check:"string_format",format:"regex",...z(t),pattern:e})}var j=f("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");y.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>R(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>S(e,r,n),e.parseAsync=async(r,n)=>N(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>T(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)=>W(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),Ge=f("ZodMiniString",(e,t)=>{ge.init(e,t),j.init(e,t)});function b(e){return $e(Ge,e)}var Je=f("ZodMiniArray",(e,t)=>{xe.init(e,t),j.init(e,t)});function ye(e,t){return new Je({type:"array",element:e,...z(t)})}var Ye=f("ZodMiniObject",(e,t)=>{ve.init(e,t),j.init(e,t),v(e,"shape",()=>t.shape)});function q(e,t){let r={type:"object",shape:e??{},...z(t)};return new Ye(r)}var qe=f("ZodMiniDefault",(e,t)=>{ze.init(e,t),j.init(e,t)});function w(e,t){return new qe({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():V(t)}})}var F="https://in.dev.heycatch.ai",k="dev",P="0.7.0-dev.433",be="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function we(e=k){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${P}). 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 Z="unknown",Ze=q({projectKey:b({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(Y(/^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:w(ye(b()),[]),install:w(q({framework:w(b(),Z),frameworkVersion:w(b(),Z),agent:w(b(),Z)}),{framework:Z,frameworkVersion:Z,agent:Z})});var X=null;function h(){return X}var Q=null;function ke(){Q?.()}function Pe(e){if(X!==null)return;let t=Ze.safeParse(e);if(!t.success){let o=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${o}`);return}let r=new et(be,{host:F,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0}),{install:n}=t.data,i={heycatch_framework:n.framework,heycatch_framework_version:n.frameworkVersion,heycatch_agent:n.agent};Q=()=>{r.register({heycatch_sdk_version:P,heycatch_sdk_stage:k,heycatch_project_key:t.data.projectKey,...i}),r.group(te,t.data.projectKey,{key:t.data.projectKey,sdk_version:P,sdk_stage:k,framework:n.framework,framework_version:n.frameworkVersion,agent:n.agent,api_host:F})},Q(),X=r,console.info(`[HeyCatch] SDK v${P} (${k}) initialized \u2192 ${F}`);let c=we();c!==null&&console.warn(c)}function Ee(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 Ae(){let e=h();e!==null&&(e.reset(),ke())}function L(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 Ce(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 Se(e,t){let r=h();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}import{PostHogProvider as tt}from"posthog-react-native";import{useEffect as rt}from"react";import{jsx as ct,jsxs as ut}from"react/jsx-runtime";function nt(){try{if(typeof U!="function")return null;let e=U("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 Te=nt();function ot(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[n,i]of Object.entries(t)){if(typeof i=="string"||typeof i=="number"||typeof i=="boolean"){r[n]=i;continue}Array.isArray(i)&&(r[n]=i.filter(c=>typeof c=="string").join(","))}return r}function it({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,n=r(),i=JSON.stringify(t());return rt(()=>{L(n,ot(i))},[n,i]),null}function st({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):ut(tt,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[Te===null?null:ct(it,{router:Te}),e]})}var Li={init:Pe,resetIdentity:Ae,setIdentity:Ee,setPersonProperties:Se,trackEvent:Ce,trackScreen:L};export{st as HeyCatchProvider,P as SDK_VERSION,k as STAGE,Li as analytics};
1
+ var U=(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 te="project",Me="[a-z0-9]",pt=new RegExp(`^${Me}$`);import{PostHog as et}from"posthog-react-native";var re;function f(e,t,r){function n(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let a=o.prototype,p=Object.keys(a);for(let m=0;m<p.length;m++){let l=p[m];l in s||(s[l]=a[l].bind(s))}}let i=r?.Parent??Object;class c extends i{}Object.defineProperty(c,"name",{value:e});function o(s){var u;let a=r?.Parent?new c:this;n(a,s),(u=a._zod).deferred??(u.deferred=[]);for(let p of a._zod.deferred)p();return a}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var _=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(re=globalThis).__zod_globalConfig??(re.__zod_globalConfig={});var H=globalThis.__zod_globalConfig;function x(e){return e&&Object.assign(H,e),H}function oe(e,t){return typeof t=="bigint"?t.toString():t}function ie(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}var ne=Symbol("evaluating");function v(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ne)return n===void 0&&(n=ne,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}var B="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function M(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function se(e){if(M(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(M(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function V(e){return se(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function W(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function z(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 ce(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ft={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 E(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 ue(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 G(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function I(e){return typeof e=="string"?e:e?.message}function $(e,t,r){let n=e.message?e.message:I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(r.customError?.(e))??I(r.localeError?.(e))??"Invalid input",{inst:i,continue:c,input:o,...s}=e;return s.path??(s.path=[]),s.message=n,t?.reportInput&&(s.input=o),s}var ae=(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,oe,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},pe=f("$ZodError",ae),C=f("$ZodError",ae,{Parent:Error});var Ne=e=>(t,r,n,i)=>{let c=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},c);if(o instanceof Promise)throw new _;if(o.issues.length){let s=new(i?.Err??e)(o.issues.map(u=>$(u,c,x())));throw B(s,i?.callee),s}return o.value},R=Ne(C),Oe=e=>async(t,r,n,i)=>{let c=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},c);if(o instanceof Promise&&(o=await o),o.issues.length){let s=new(i?.Err??e)(o.issues.map(u=>$(u,c,x())));throw B(s,i?.callee),s}return o.value},N=Oe(C),je=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},c=t._zod.run({value:r,issues:[]},i);if(c instanceof Promise)throw new _;return c.issues.length?{success:!1,error:new(e??pe)(c.issues.map(o=>$(o,i,x())))}:{success:!0,data:c.value}},S=je(C),Fe=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},c=t._zod.run({value:r,issues:[]},i);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(o=>$(o,i,x())))}:{success:!0,data:c.value}},T=Fe(C);var Le="(?:(?:\\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])))",De=new RegExp(`^${Le}$`);var le=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var J=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Ue=f("$ZodCheckStringFormat",(e,t)=>{var r,n;J.init(e,t),e._zod.onattach.push(i=>{let c=i._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),me=f("$ZodCheckRegex",(e,t)=>{Ue.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 de={major:4,minor:4,patch:3};var y=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=de;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let c of i._zod.onattach)c(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(o,s,u)=>{let a=E(o),p;for(let m of s){if(m._zod.def.when){if(ue(o)||!m._zod.def.when(o))continue}else if(a)continue;let l=o.issues.length,d=m._zod.check(o);if(d instanceof Promise&&u?.async===!1)throw new _;if(p||d instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await d,o.issues.length!==l&&(a||(a=E(o,l)))});else{if(o.issues.length===l)continue;a||(a=E(o,l))}}return p?p.then(()=>o):o},c=(o,s,u)=>{if(E(o))return o.aborted=!0,o;let a=i(s,n,u);if(a instanceof Promise){if(u.async===!1)throw new _;return a.then(p=>e._zod.parse(p,u))}return e._zod.parse(a,u)};e._zod.run=(o,s)=>{if(s.skipChecks)return e._zod.parse(o,s);if(s.direction==="backward"){let a=e._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return a instanceof Promise?a.then(p=>c(p,o,s)):c(a,o,s)}let u=e._zod.parse(o,s);if(u instanceof Promise){if(s.async===!1)throw new _;return u.then(a=>i(a,n,s))}return i(u,n,s)}}v(e,"~standard",()=>({validate:i=>{try{let c=S(e,i);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return T(e,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),ge=f("$ZodString",(e,t)=>{y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??le(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}});function he(e,t,r){e.issues.length&&t.issues.push(...G(r,e.issues)),t.value[r]=e.value}var xe=f("$ZodArray",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let c=[];for(let o=0;o<i.length;o++){let s=i[o],u=t.element._zod.run({value:s,issues:[]},n);u instanceof Promise?c.push(u.then(a=>he(a,r,o))):he(u,r,o)}return c.length?Promise.all(c).then(()=>r):r}});function O(e,t,r,n,i,c){let o=r in n;if(e.issues.length){if(i&&c&&!o)return;t.issues.push(...G(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?o&&(t.value[r]=void 0):t.value[r]=e.value}function Be(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=ce(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ve(e,t,r,n,i,c){let o=[],s=i.keySet,u=i.catchall._zod,a=u.def.type,p=u.optin==="optional",m=u.optout==="optional";for(let l in t){if(l==="__proto__"||s.has(l))continue;if(a==="never"){o.push(l);continue}let d=u.run({value:t[l],issues:[]},n);d instanceof Promise?e.push(d.then(g=>O(g,r,l,t,p,m))):O(d,r,l,t,p,m)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:c}),e.length?Promise.all(e).then(()=>r):r}var ve=f("$ZodObject",(e,t)=>{if(y.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...s};return Object.defineProperty(t,"shape",{value:u}),u}})}let n=ie(()=>Be(t));v(e._zod,"propValues",()=>{let s=t.shape,u={};for(let a in s){let p=s[a]._zod;if(p.values){u[a]??(u[a]=new Set);for(let m of p.values)u[a].add(m)}}return u});let i=M,c=t.catchall,o;e._zod.parse=(s,u)=>{o??(o=n.value);let a=s.value;if(!i(a))return s.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),s;s.value={};let p=[],m=o.shape;for(let l of o.keys){let d=m[l],g=d._zod.optin==="optional",ee=d._zod.optout==="optional",D=d._zod.run({value:a[l],issues:[]},u);D instanceof Promise?p.push(D.then(Ie=>O(Ie,s,l,a,g,ee))):O(D,s,l,a,g,ee)}return c?Ve(p,a,s,u,n.value,e):p.length?Promise.all(p).then(()=>s):s}});var ze=f("$ZodDefault",(e,t)=>{y.init(e,t),e._zod.optin="optional",v(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 i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(c=>_e(c,t)):_e(i,t)}});function _e(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function $e(e,t){return new e({type:"string",...z(t)})}function Y(e,t){return new me({check:"string_format",format:"regex",...z(t),pattern:e})}var j=f("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");y.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>R(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>S(e,r,n),e.parseAsync=async(r,n)=>N(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>T(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)=>W(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),Ge=f("ZodMiniString",(e,t)=>{ge.init(e,t),j.init(e,t)});function b(e){return $e(Ge,e)}var Je=f("ZodMiniArray",(e,t)=>{xe.init(e,t),j.init(e,t)});function ye(e,t){return new Je({type:"array",element:e,...z(t)})}var Ye=f("ZodMiniObject",(e,t)=>{ve.init(e,t),j.init(e,t),v(e,"shape",()=>t.shape)});function q(e,t){let r={type:"object",shape:e??{},...z(t)};return new Ye(r)}var qe=f("ZodMiniDefault",(e,t)=>{ze.init(e,t),j.init(e,t)});function w(e,t){return new qe({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():V(t)}})}var F="https://in.dev.heycatch.ai",k="dev",P="0.7.0-dev.714",be="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function we(e=k){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${P}). 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 Z="unknown",Ze=q({projectKey:b({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(Y(/^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:w(ye(b()),[]),install:w(q({framework:w(b(),Z),frameworkVersion:w(b(),Z),agent:w(b(),Z)}),{framework:Z,frameworkVersion:Z,agent:Z})});var X=null;function h(){return X}var Q=null;function ke(){Q?.()}function Pe(e){if(X!==null)return;let t=Ze.safeParse(e);if(!t.success){let o=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${o}`);return}let r=new et(be,{host:F,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0}),{install:n}=t.data,i={heycatch_framework:n.framework,heycatch_framework_version:n.frameworkVersion,heycatch_agent:n.agent};Q=()=>{r.register({heycatch_sdk_version:P,heycatch_sdk_stage:k,heycatch_project_key:t.data.projectKey,...i}),r.group(te,t.data.projectKey,{key:t.data.projectKey,sdk_version:P,sdk_stage:k,framework:n.framework,framework_version:n.frameworkVersion,agent:n.agent,api_host:F})},Q(),X=r,console.info(`[HeyCatch] SDK v${P} (${k}) initialized \u2192 ${F}`);let c=we();c!==null&&console.warn(c)}function Ee(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 Ae(){let e=h();e!==null&&(e.reset(),ke())}function L(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 Ce(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 Se(e,t){let r=h();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}import{PostHogProvider as tt}from"posthog-react-native";import{useEffect as rt}from"react";import{jsx as ct,jsxs as ut}from"react/jsx-runtime";function nt(){try{if(typeof U!="function")return null;let e=U("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 Te=nt();function ot(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[n,i]of Object.entries(t)){if(typeof i=="string"||typeof i=="number"||typeof i=="boolean"){r[n]=i;continue}Array.isArray(i)&&(r[n]=i.filter(c=>typeof c=="string").join(","))}return r}function it({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,n=r(),i=JSON.stringify(t());return rt(()=>{L(n,ot(i))},[n,i]),null}function st({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):ut(tt,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[Te===null?null:ct(it,{router:Te}),e]})}var Li={init:Pe,resetIdentity:Ae,setIdentity:Ee,setPersonProperties:Se,trackEvent:Ce,trackScreen:L};export{st as HeyCatchProvider,P as SDK_VERSION,k as STAGE,Li as analytics};
2
2
  //# sourceMappingURL=react-native.js.map