@heycatch/sdk 0.8.3-dev.2180 → 0.8.3-dev.2283
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/react-native.cjs +1 -1
- package/dist/react-native.d.cts +6 -0
- package/dist/server.cjs +2 -2
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +2 -2
- package/dist/{shared-C0-GQTbz.d.cts → shared-jAHOZrzL.d.cts} +6 -0
- package/dist/{shared-C0-GQTbz.d.ts → shared-jAHOZrzL.d.ts} +6 -0
- package/package.json +1 -1
package/dist/react-native.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var se=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var Ft=Object.getOwnPropertyNames;var Ht=Object.prototype.hasOwnProperty;var Ut=(e,t)=>{for(var r in t)se(e,r,{get:t[r],enumerable:!0})},Vt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ft(t))!Ht.call(e,o)&&o!==r&&se(e,o,{get:()=>t[o],enumerable:!(n=Dt(t,o))||n.enumerable});return e};var Bt=e=>Vt(se({},"__esModule",{value:!0}),e);var Br={};Ut(Br,{HeyCatchProvider:()=>Lt,SDK_VERSION:()=>T,STAGE:()=>C,analytics:()=>Vr});module.exports=Bt(Br);var Pe="project",Kt="[a-z0-9]",Gr=new RegExp(`^${Kt}$`);var Gt=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function ce(e){let t=Gt.exec(e);if(t===null)return!1;let[,r="",n=""]=t,o=Number(r),i=Number(n);return o>255||i>255?!1:o===0||o===10||o===127||o===100&&i>=64&&i<=127||o===169&&i===254||o===172&&i>=16&&i<=31||o===192&&i===168}var Wt=/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/;function Jt(e){if(e==="::1"||e==="::")return!0;if(e.startsWith("::ffff:")){let t=Wt.exec(e);if(t===null)return ce(e.slice(7));let[,r="",n=""]=t,o=Number.parseInt(r,16),i=Number.parseInt(n,16);return ce(`${Math.floor(o/256)}.${o%256}.${Math.floor(i/256)}.${i%256}`)}return/^f[cd][0-9a-f]{2}:/.test(e)||/^fe[89ab][0-9a-f]:/.test(e)}function Yt(e){return e.toLowerCase().replace(/^\[/,"").replace(/\]$/,"").replace(/\.+$/,"")}function Ee(e){let t=Yt(e);return t==="localhost"||t.endsWith(".localhost")||ce(t)||Jt(t)}var Pt=require("posthog-react-native");var Se;function p(e,t,r){function n(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);let a=s.prototype,l=Object.keys(a);for(let h=0;h<l.length;h++){let d=l[h];d in c||(c[d]=a[d].bind(c))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(c){var u;let a=r?.Parent?new i:this;n(a,c),(u=a._zod).deferred??(u.deferred=[]);for(let l of a._zod.deferred)l();return a}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}var k=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(Se=globalThis).__zod_globalConfig??(Se.__zod_globalConfig={});var ue=globalThis.__zod_globalConfig;function R(e){return e&&Object.assign(ue,e),ue}function Ce(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 Te(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")}}}function Re(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 P(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 pe="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function q(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Me(e){if(q(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(q(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function le(e){return Me(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Ne=new Set(["string","number","symbol"]);function Oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fe(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function b(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 je(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Jr={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 F(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 Le(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 de(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Y(e){return typeof e=="string"?e:e?.message}function M(e,t,r){let n=e.message?e.message:Y(e.inst?._zod.def?.error?.(e))??Y(t?.error?.(e))??Y(r.customError?.(e))??Y(r.localeError?.(e))??"Invalid input",{inst:o,continue:i,input:s,...c}=e;return c.path??(c.path=[]),c.message=n,t?.reportInput&&(c.input=s),c}function me(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}var De=(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,Te,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Fe=p("$ZodError",De),U=p("$ZodError",De,{Parent:Error});var Xt=e=>(t,r,n,o)=>{let i=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new k;if(s.issues.length){let c=new(o?.Err??e)(s.issues.map(u=>M(u,i,R())));throw pe(c,o?.callee),c}return s.value},X=Xt(U),Qt=e=>async(t,r,n,o)=>{let i=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let c=new(o?.Err??e)(s.issues.map(u=>M(u,i,R())));throw pe(c,o?.callee),c}return s.value},Q=Qt(U),er=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new k;return i.issues.length?{success:!1,error:new(e??Fe)(i.issues.map(s=>M(s,o,R())))}:{success:!0,data:i.value}},V=er(U),tr=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>M(s,o,R())))}:{success:!0,data:i.value}},B=tr(U);var rr="(?:(?:\\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])))",nr=new RegExp(`^${rr}$`);var He=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Ue=/^-?\d+(?:\.\d+)?$/,Ve=/^(?:true|false)$/i;var K=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;K.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.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=()=>{})}),Ge=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 Je={major:4,minor:4,patch:3};var $=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Je;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(s,c,u)=>{let a=F(s),l;for(let h of c){if(h._zod.def.when){if(Le(s)||!h._zod.def.when(s))continue}else if(a)continue;let d=s.issues.length,g=h._zod.check(s);if(g instanceof Promise&&u?.async===!1)throw new k;if(l||g instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await g,s.issues.length!==d&&(a||(a=F(s,d)))});else{if(s.issues.length===d)continue;a||(a=F(s,d))}}return l?l.then(()=>s):s},i=(s,c,u)=>{if(F(s))return s.aborted=!0,s;let a=o(c,n,u);if(a instanceof Promise){if(u.async===!1)throw new k;return a.then(l=>e._zod.parse(l,u))}return e._zod.parse(a,u)};e._zod.run=(s,c)=>{if(c.skipChecks)return e._zod.parse(s,c);if(c.direction==="backward"){let a=e._zod.parse({value:s.value,issues:[]},{...c,skipChecks:!0});return a instanceof Promise?a.then(l=>i(l,s,c)):i(a,s,c)}let u=e._zod.parse(s,c);if(u instanceof Promise){if(c.async===!1)throw new k;return u.then(a=>o(a,n,c))}return o(u,n,c)}}P(e,"~standard",()=>({validate:o=>{try{let i=V(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return B(e,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),et=p("$ZodString",(e,t)=>{$.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??He(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 tt=p("$ZodNumber",(e,t)=>{$.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ue,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 i=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,...i?{received:i}:{}}),r}});var rt=p("$ZodBoolean",(e,t)=>{$.init(e,t),e._zod.pattern=Ve,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 Ye(e,t,r){e.issues.length&&t.issues.push(...de(r,e.issues)),t.value[r]=e.value}var nt=p("$ZodArray",(e,t)=>{$.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 i=[];for(let s=0;s<o.length;s++){let c=o[s],u=t.element._zod.run({value:c,issues:[]},n);u instanceof Promise?i.push(u.then(a=>Ye(a,r,s))):Ye(u,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function ee(e,t,r,n,o,i){let s=r in n;if(e.issues.length){if(o&&i&&!s)return;t.issues.push(...de(r,e.issues))}if(!s&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?s&&(t.value[r]=void 0):t.value[r]=e.value}function or(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=je(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function ir(e,t,r,n,o,i){let s=[],c=o.keySet,u=o.catchall._zod,a=u.def.type,l=u.optin==="optional",h=u.optout==="optional";for(let d in t){if(d==="__proto__"||c.has(d))continue;if(a==="never"){s.push(d);continue}let g=u.run({value:t[d],issues:[]},n);g instanceof Promise?e.push(g.then(y=>ee(y,r,d,t,l,h))):ee(g,r,d,t,l,h)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var ot=p("$ZodObject",(e,t)=>{if($.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=Ie(()=>or(t));P(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 h of l.values)u[a].add(h)}}return u});let o=q,i=t.catchall,s;e._zod.parse=(c,u)=>{s??(s=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=[],h=s.shape;for(let d of s.keys){let g=h[d],y=g._zod.optin==="optional",W=g._zod.optout==="optional",j=g._zod.run({value:a[d],issues:[]},u);j instanceof Promise?l.push(j.then(m=>ee(m,c,d,a,y,W))):ee(j,c,d,a,y,W)}return i?ir(l,a,c,u,n.value,e):l.length?Promise.all(l).then(()=>c):c}});var it=p("$ZodEnum",(e,t)=>{$.init(e,t);let r=Ce(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Ne.has(typeof o)).map(o=>typeof o=="string"?Oe(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}});function qe(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var st=p("$ZodOptional",(e,t)=>{$.init(e,t),e._zod.optin="optional",e._zod.optout="optional",P(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),P(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Re(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=r.value,i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(s=>qe(s,o)):qe(i,o)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var ct=p("$ZodDefault",(e,t)=>{$.init(e,t),e._zod.optin="optional",P(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(i=>Xe(i,t)):Xe(o,t)}});function Xe(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ut=p("$ZodCustom",(e,t)=>{K.init(e,t),$.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(i=>Qe(i,r,n,e));Qe(o,r,n,e)}});function Qe(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(me(o))}}function at(e,t){return new e({type:"string",...b(t)})}function pt(e,t){return new e({type:"number",checks:[],...b(t)})}function lt(e,t){return new e({type:"boolean",...b(t)})}function he(e,t){return new Ge({check:"string_format",format:"regex",...b(t),pattern:e})}function ft(e,t,r){let n=b(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.");$.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>X(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>V(e,r,n),e.parseAsync=async(r,n)=>Q(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>B(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)=>fe(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),cr=p("ZodMiniString",(e,t)=>{et.init(e,t),Z.init(e,t)});function A(e){return at(cr,e)}var ur=p("ZodMiniNumber",(e,t)=>{tt.init(e,t),Z.init(e,t)});function _e(e){return pt(ur,e)}var ar=p("ZodMiniBoolean",(e,t)=>{rt.init(e,t),Z.init(e,t)});function E(e){return lt(ar,e)}var pr=p("ZodMiniArray",(e,t)=>{nt.init(e,t),Z.init(e,t)});function ge(e,t){return new pr({type:"array",element:e,...b(t)})}var lr=p("ZodMiniObject",(e,t)=>{ot.init(e,t),Z.init(e,t),P(e,"shape",()=>t.shape)});function xe(e,t){let r={type:"object",shape:e??{},...b(t)};return new lr(r)}var fr=p("ZodMiniEnum",(e,t)=>{it.init(e,t),Z.init(e,t),e.options=Object.values(t.entries)});function dt(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new fr({type:"enum",entries:r,...b(t)})}var dr=p("ZodMiniOptional",(e,t)=>{st.init(e,t),Z.init(e,t)});function x(e){return new dr({type:"optional",innerType:e})}var mr=p("ZodMiniDefault",(e,t)=>{ct.init(e,t),Z.init(e,t)});function N(e,t){return new mr({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():le(t)}})}var hr=p("ZodMiniCustom",(e,t)=>{ut.init(e,t),Z.init(e,t)});function ye(e,t){return ft(hr,e??(()=>!0),t)}var te="https://in.dev.heycatch.ai",C="dev",T="0.8.3-dev.2180",mt="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function ht(e=C){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${T}). 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 O="unknown",yr=["localStorage","cookie","memory","localStorage+cookie","sessionStorage"];var _t=xe({projectKey:A({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(he(/^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:N(ge(A()),[]),install:N(xe({framework:N(A(),O),frameworkVersion:N(A(),O),agent:N(A(),O)}),{framework:O,frameworkVersion:O,agent:O}),autocapture:x(E()),maskAllText:x(E()),maskAllElementAttributes:x(E()),propertyDenylist:x(ge(A())),sanitizeProperties:x(ye(e=>typeof e=="function")),beforeSend:x(ye(e=>typeof e=="function"||Array.isArray(e)&&e.every(t=>typeof t=="function"))),persistence:x(dt(yr)),disablePersistence:x(E()),cookieExpirationDays:x(_e()),optOutCapturingByDefault:x(E()),respectDnt:x(E()),requestBatching:x(E()),flushIntervalMs:x(_e())});var gt="[redacted]",vr=/(^|[#&?])(access_token|refresh_token|token_hash|token)=[^\s#&"'<>]+/gi,zr=/(^|[^\w-])eyJ[\w-]+\.[\w-]+\.[\w-]+/g;function xt(e){return e.replaceAll(vr,`$1$2=${gt}`).replaceAll(zr,`$1${gt}`)}var $r=new Set(["$anon_distinct_id","distinct_id"]),br=["$set","$set_once"];function ve(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ze(e){return typeof e=="string"?xt(e):Array.isArray(e)?wr(e):ve(e)?yt(e,()=>!0):e}function wr(e){let t=e.map(r=>ze(r));return t.some((r,n)=>r!==e[n])?t:e}function yt(e,t){let r=!1,n=[];for(let[o,i]of Object.entries(e)){let s=t(o)?ze(i):i;s!==i&&(r=!0),n.push([o,s])}return r?Object.fromEntries(n):e}function vt(e){if(!ve(e))return e;try{let t=!1,r={...e},{properties:n}=e;if(ve(n)){let o=yt(n,i=>!$r.has(i));o!==n&&(t=!0,r.properties=o)}for(let o of br){let i=e[o],s=ze(i);s!==i&&(t=!0,r[o]=s)}return t?r:e}catch{return e}}var kr=5e3,Zr=60,Pr=1e3,Er=60,Sr=new Set(["$set"]),$e="heycatch_volume_cap_reached",zt=3,Ar=6e4;function re({bucket:e,perMinute:t,now:r}){if(e===void 0)return t;let n=Math.max(0,r-e.at);return Math.min(t,e.tokens+n*t/Ar)}function Cr(e){return e===void 0||e.length===0?!1:Ee(Tr(e))}function Tr(e){if(e.startsWith("[")){let r=e.indexOf("]");return r===-1?e:e.slice(0,r+1)}let t=e.indexOf(":");return t!==-1&&t===e.lastIndexOf(":")?e.slice(0,t):e}function $t(e){let{$session_id:t,$host:r}=e.properties;return{sessionId:typeof t=="string"?t:"",host:typeof r=="string"?r:void 0}}var wt=4;function bt(e){if(e!==void 0)return typeof e=="object"&&e!==null&&"tokens"in e&&typeof e.tokens=="number"&&Number.isFinite(e.tokens)&&e.tokens>=0&&"at"in e&&typeof e.at=="number"&&Number.isFinite(e.at)?{tokens:e.tokens,at:e.at}:!1}function Ir(e){if(typeof e=="object"&&e!==null&&"sessionId"in e&&typeof e.sessionId=="string"&&"count"in e&&typeof e.count=="number"&&Number.isInteger(e.count)&&e.count>=0&&"markerAttempts"in e&&typeof e.markerAttempts=="number"&&Number.isInteger(e.markerAttempts)&&e.markerAttempts>=0){let t=bt("person"in e?e.person:void 0),r=bt("localhost"in e?e.localhost:void 0);if(t!==!1&&r!==!1)return{sessionId:e.sessionId,count:e.count,markerAttempts:e.markerAttempts,person:t,localhost:r}}return null}function Rr(e){if(e===null)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t.flatMap(r=>{let n=Ir(r);return n===null?[]:[n]}).slice(0,wt)}catch{}return[]}function kt({store:e,warn:t,emitMarker:r,cap:n=kr,personUpdateBudget:o=Zr,localhostFreeEvents:i=Pr,localhostRatePerMinute:s=Er,now:c=Date.now}){let u=[],a=!1,l=!1,h=!1,d=!1;function g(){if(e===void 0||a)return u;try{return Rr(e.read())}catch{return u}}function y(m){let w=g().filter(f=>f.sessionId!==m.sessionId);u=[m,...w].slice(0,wt);try{e?.write(JSON.stringify(u))}catch{a=!0}}function W(m){let w=g().find(_=>_.sessionId===m),f=u.find(_=>_.sessionId===m),z=[w,f].filter(_=>_!==void 0),J=c();function L(_,D){let S;for(let{[_]:I}of z)I!==void 0&&re({bucket:I,perMinute:D,now:J})<re({bucket:S,perMinute:D,now:J})&&(S=I);return S}return{sessionId:m,count:Math.max(0,...z.map(_=>_.count)),markerAttempts:Math.max(0,...z.map(_=>_.markerAttempts)),person:L("person",o),localhost:L("localhost",s)}}function j(m,w){let f=w,z=c(),{sessionId:J,host:L}=$t(m);f.person!==void 0&&f.person.at>z&&(f={...f,person:{...f.person,at:z}},y(f)),f.localhost!==void 0&&f.localhost.at>z&&(f={...f,localhost:{...f.localhost,at:z}},y(f));let _=Sr.has(m.event),D=_?re({bucket:f.person,perMinute:o,now:z}):0;if(_&&D<1)return h||(h=!0,t(`[HeyCatch] setPersonProperties is being called more than ${o} times a minute - call it when a property changes, not on every render. Dropping the extra updates for now; other events are unaffected.`)),null;let S=f.count>=i&&Cr(L),I=S?re({bucket:f.localhost,perMinute:s,now:z}):0;return S&&I<1?(d||(d=!0,t(`[HeyCatch] this local dev session (${L??"unknown host"}, session ${J||"unknown"}) sent ${i} events - throttling it to ${s} a minute so a dev loop cannot flood your analytics. Production traffic is unaffected.`)),null):(y({...f,count:f.count+1,..._?{person:{tokens:D-1,at:z}}:{},...S?{localhost:{tokens:I-1,at:z}}:{}}),m)}return m=>{if(m===null||m.event===$e)return m;let{sessionId:w}=$t(m),f=W(w);return f.count<n?j(m,f):(l||(l=!0,t(`[HeyCatch] this session sent ${n} events, the per-session cap - dropping the rest until a new session starts (session ${w||"unknown"}). A tracking call inside a render loop or an effect is the usual cause.`)),f.markerAttempts<zt&&(y({...f,markerAttempts:zt}),r({cap:n,sessionId:w})||y({...f,markerAttempts:f.markerAttempts+1})),null)}}function Zt(e){let t=kt({warn:r=>{console.warn(r)},emitMarker:({cap:r})=>{let n=e();return n?.capture($e,{heycatch_session_event_cap:r}),n!==null}});return r=>r===null||t({event:r.event,properties:r.properties??{}})===null?null:r}var ne=null;function v(){return ne}var be=null;function Et(){be?.()}function St(e){if(ne!==null)return;let t=_t.safeParse(e);if(!t.success){let s=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${s}`);return}let r=new Pt.PostHog(mt,{host:te,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0,...t.data.optOutCapturingByDefault===void 0?{}:{defaultOptIn:!t.data.optOutCapturingByDefault},before_send:[Zt(()=>ne),vt]}),{install:n}=t.data,o={heycatch_framework:n.framework,heycatch_framework_version:n.frameworkVersion,heycatch_agent:n.agent};be=()=>{r.register({heycatch_sdk_version:T,heycatch_sdk_stage:C,heycatch_project_key:t.data.projectKey,...o}),r.group(Pe,t.data.projectKey,{key:t.data.projectKey,sdk_version:T,sdk_stage:C,framework:n.framework,framework_version:n.frameworkVersion,agent:n.agent,api_host:te})},be(),ne=r,console.info(`[HeyCatch] SDK v${T} (${C}) initialized \u2192 ${te}`);let i=ht();i!==null&&console.warn(i)}function At(e){return t=>{console.error(`[HeyCatch] consent ${e} could not be saved - capture state may reset on the next app launch:`,t)}}function Ct(){v()?.optIn().catch(At("opt-in"))}function Tt(){v()?.optOut().catch(At("opt-out"))}var It=require("posthog-react-native");function Rt(e,t,r){let n=v();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.getPersistedProperty(It.PostHogPersistedProperty.PersonMode)==="identified"&&n.getDistinctId()!==e&&we(),n.identify(e,{...t?{$set:t}:{},...r?{$set_once:r}:{}})}}function we(){let e=v();e!==null&&(e.reset(),Et())}function oe(e,t){let r=v();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 Mt(e,t,r){let n=v();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 Nt(e,t){let r=v();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}var jt=require("posthog-react-native"),ie=require("react");function Mr(e){return typeof e=="object"&&e!==null&&"usePathname"in e&&typeof e.usePathname=="function"&&"useGlobalSearchParams"in e&&typeof e.useGlobalSearchParams=="function"}function Nr(){try{if(typeof require!="function")return null;let e=require("expo-router");return Mr(e)?e:null}catch{return null}}var ke=Nr();var Or=new Set(["code","jwt","otp","pin","pwd","sid","sig"]),jr=["credential","email","passcode","passwd","password","secret","session","signature","token"],Lr="#",Dr=/[^\s@,]+@[^\s@,]+\.[^\s@,]+/;function Fr(e){return e.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[\s_-]+/).filter(t=>t.length>0)}function Hr(e,t){if(e===Lr)return!0;let r=e.toLowerCase().replaceAll(/[_-]/g,"");return r.startsWith("auth")||r.includes("key")||jr.some(n=>r.includes(n))||Fr(e).some(n=>Or.has(n))?!0:typeof t=="string"&&Dr.test(t)}function Ot(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[n,o]of Object.entries(t)){let i;if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")i=o;else if(Array.isArray(o))i=o.filter(s=>typeof s=="string").join(",");else continue;Hr(n,i)||(r[n]=i)}return r}var G=require("react/jsx-runtime");function Ur({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,n=r(),o=JSON.stringify(t());return(0,ie.useEffect)(()=>{oe(n,Ot(o))},[n,o]),null}var Ze=class extends ie.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t){console.error("[HeyCatch] Automatic screen views are off: an Expo Router hook threw. Call analytics.trackScreen(name) from your navigation instead.",t)}render(){return this.state.failed?null:this.props.children}};function Lt({children:e,trackScreens:t=!0}){let r=v();return r===null?(console.error("[HeyCatch] HeyCatchProvider mounted before init() - call analytics.init({ projectKey }) at module scope of the root layout."),e):(0,G.jsxs)(jt.PostHogProvider,{autocapture:{captureScreens:!1,captureTouches:!0},client:r,children:[!t||ke===null?null:(0,G.jsx)(Ze,{children:(0,G.jsx)(Ur,{router:ke})}),e]})}var Vr={init:St,optInCapturing:Ct,optOutCapturing:Tt,resetIdentity:we,setIdentity:Rt,setPersonProperties:Nt,trackEvent:Mt,trackScreen:oe};0&&(module.exports={HeyCatchProvider,SDK_VERSION,STAGE,analytics});
|
|
1
|
+
"use strict";var ve=Object.defineProperty;var Tr=Object.getOwnPropertyDescriptor;var Rr=Object.getOwnPropertyNames;var Mr=Object.prototype.hasOwnProperty;var tt=(e,t)=>{for(var r in t)ve(e,r,{get:t[r],enumerable:!0})},Nr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Rr(t))!Mr.call(e,o)&&o!==r&&ve(e,o,{get:()=>t[o],enumerable:!(n=Tr(t,o))||n.enumerable});return e};var Dr=e=>Nr(ve({},"__esModule",{value:!0}),e);var Eo={};tt(Eo,{HeyCatchProvider:()=>Or,SDK_VERSION:()=>K,STAGE:()=>B,analytics:()=>Ao});module.exports=Dr(Eo);var rt="project",Lr="[a-z0-9]",Io=new RegExp(`^${Lr}$`);var jr=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function $e(e){let t=jr.exec(e);if(t===null)return!1;let[,r="",n=""]=t,o=Number(r),i=Number(n);return o>255||i>255?!1:o===0||o===10||o===127||o===100&&i>=64&&i<=127||o===169&&i===254||o===172&&i>=16&&i<=31||o===192&&i===168}var Fr=/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/;function Hr(e){if(e==="::1"||e==="::")return!0;if(e.startsWith("::ffff:")){let t=Fr.exec(e);if(t===null)return $e(e.slice(7));let[,r="",n=""]=t,o=Number.parseInt(r,16),i=Number.parseInt(n,16);return $e(`${Math.floor(o/256)}.${o%256}.${Math.floor(i/256)}.${i%256}`)}return/^f[cd][0-9a-f]{2}:/.test(e)||/^fe[89ab][0-9a-f]:/.test(e)}function Ur(e){return e.toLowerCase().replace(/^\[/,"").replace(/\]$/,"").replace(/\.+$/,"")}function nt(e){let t=Ur(e);return t==="localhost"||t.endsWith(".localhost")||$e(t)||Hr(t)}var vr=require("posthog-react-native");var T={};tt(T,{BIGINT_FORMAT_RANGES:()=>ln,CONSTANT_CATCH:()=>zt,Class:()=>ke,NUMBER_FORMAT_RANGES:()=>an,aborted:()=>O,allowsEval:()=>lt,assert:()=>Jr,assertEqual:()=>Br,assertIs:()=>Gr,assertNever:()=>Wr,assertNotEqual:()=>Kr,assignProp:()=>ee,attachSchema:()=>ne,base64ToUint8Array:()=>vt,base64urlToUint8Array:()=>gn,cached:()=>ue,captureStackTrace:()=>ae,cleanEnum:()=>_n,cleanRegex:()=>Pe,clone:()=>Z,cloneDef:()=>tn,codePointLength:()=>dn,constantCatch:()=>wt,createTransparentProxy:()=>un,defineLazy:()=>it,defineLazyInternal:()=>S,derived:()=>vn,esc:()=>ut,escapeRegex:()=>re,explicitlyAborted:()=>Ce,extend:()=>ht,finalizeIssue:()=>N,floatSafeRemainder:()=>qr,getElementAtPath:()=>rn,getEnumValues:()=>ce,getLengthableOrigin:()=>mn,getParsedType:()=>cn,getSizableOrigin:()=>pn,hexToUint8Array:()=>yn,hide:()=>Oe,installLazyProp:()=>Te,isObject:()=>Q,isPlainObject:()=>te,issue:()=>me,joinValues:()=>Xr,jsonStringifyReplacer:()=>Ze,members:()=>Ie,merge:()=>xt,mergeDefs:()=>C,normalizeParams:()=>P,nullish:()=>Yr,numKeys:()=>sn,objectClone:()=>Qr,omit:()=>mt,optionalKeys:()=>Ee,own:()=>E,parsedType:()=>hn,partial:()=>yt,pick:()=>dt,prefixIssues:()=>fe,primitiveTypes:()=>pt,promiseAllObject:()=>nn,propertyKeyTypes:()=>Ae,randomString:()=>on,rawShape:()=>Se,required:()=>bt,safeExtend:()=>gt,shallowClone:()=>le,sizeCaps:()=>de,slugify:()=>at,stringifyPrimitive:()=>ft,toZod:()=>Vr,uint8ArrayToBase64:()=>$t,uint8ArrayToBase64url:()=>xn,uint8ArrayToHex:()=>bn,unwrapMessage:()=>W});function Br(e){return e}function Kr(e){return e}function Vr(){return e=>e}function Gr(e){}function Wr(e){throw new Error("Unexpected value in exhaustive check")}function Jr(e){}function ce(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 Xr(e,t="|"){return e.map(r=>ft(r)).join(t)}function Ze(e,t){return typeof t=="bigint"?t.toString():t}var we=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function ue(e){return new we(e)}function Yr(e){return e==null}function Pe(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function qr(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var ot=Symbol("evaluating");function it(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ot)return n===void 0&&(n=ot,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Qr(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ee(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Se(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function I(e){return Se(e._zod.def)??e._zod.def.shape}function st(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ee(this,t,n),n},enumerable:!0,configurable:!0})}function ct(e,t,r){t in e?ee(e,t,r):e[t]=r}function j(e,t,r,n){let o=I(t);for(let i of r){let c=Object.getOwnPropertyDescriptor(o,i);c.enumerable&&(c.get?st(e,i,()=>{let s=t._zod.def.shape[i];return n?n(s,i):s}):ct(e,i,n?n(c.value,i):c.value))}}function en(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?st(e,r,()=>t[r]):ct(e,r,n.value))}}function C(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function tn(e){return C(e._zod.def)}function rn(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function nn(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function on(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function ut(e){return JSON.stringify(e)}function at(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ae="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Q(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var lt=ue(()=>{if(F.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function te(e){if(Q(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Q(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function le(e){return te(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function sn(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var cn=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Ae=new Set(["string","number","symbol"]),pt=new Set(["string","number","bigint","boolean","symbol","undefined"]);function re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Z(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function P(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 un(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function ft(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ee(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var an={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]},ln={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function dt(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return j(i,e,pe(e,t)),Z(e,C(r,{shape:i,checks:[]}))}function pe(e,t){let r=I(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function mt(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(pe(e,t)),c={};return j(c,e,Reflect.ownKeys(I(e)).filter(s=>!i.has(s))),Z(e,C(r,{shape:c,checks:[]}))}function ht(e,t){if(!te(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=I(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Z(e,C(e._zod.def,{shape:_t(e,t)}))}function _t(e,t){let r={};return j(r,e,Reflect.ownKeys(I(e))),en(r,t),r}function gt(e,t){if(!te(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Z(e,C(e._zod.def,{shape:_t(e,t)}))}function xt(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};j(r,e,Reflect.ownKeys(I(e))),j(r,t,Reflect.ownKeys(I(t)));let n=C(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Z(e,n)}function yt(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let s=r?new Set(pe(t,r)):void 0,u={};return j(u,t,Reflect.ownKeys(I(t)),e&&((a,l)=>s&&!s.has(l)?a:new e({type:"optional",innerType:a}))),Z(t,C(t._zod.def,{shape:u,checks:[]}))}function bt(e,t,r){let n=r?new Set(pe(t,r)):void 0,o={};return j(o,t,Reflect.ownKeys(I(t)),(i,c)=>n&&!n.has(c)?i:new e({type:"nonoptional",innerType:i})),Z(t,C(t._zod.def,{shape:o}))}function O(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 Ce(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 fe(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function W(e){return typeof e=="string"?e:e?.message}function de(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;o>=0&&t.push([o,r])}return t}function ne(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function N(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,c=e.message?e.message:W(e.inst?._zod.def?.error?.(e))??W(i?.(e))??W(t?.error?.(e))??W(r.customError?.(e))??W(r.localeError?.(e))??"Invalid input",s={};for(let u of Object.keys(e))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(s[u]=e[u]);return s.path??(s.path=[]),s.message=c,t?.reportInput&&(s.input=e.input),s}function pn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var fn=/[\uD800-\uDBFF]/;function dn(e){let t=e.length;if(!fn.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function mn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function hn(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function me(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function _n(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function vt(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function $t(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function gn(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return vt(t+r)}function xn(e){return $t(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function yn(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function bn(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var ke=class{constructor(...t){}};function Ie(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):$n(e,r,n.value)}}function E(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Oe(e,t,r){return E(e,t,r,!1)}function vn(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return E(this,r,n(this))},set(o){E(this,r,o)}})}return t}function $n(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:E(this,t,r.bind(this))},set(n){E(this,t,n)}})}function zn(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var ze,M=!1,wn={configurable:!0,get(){M=!0}};function S(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&ze!==e._zod){ze=void 0;return}ze=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,wn);let o=M;M=!1;try{let i=r(this);return M?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),M=M||o,i}catch(i){throw delete this[t],M=M||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Te(e,t,r,n){let o=zn(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var zt="~constantCatch";function wt(e){let t=()=>e;return t[zt]=!0,t}var kt;var Re={value:void 0,enumerable:!1},Zt="captureStackTrace"in Error?Error:null;function kn(e){let t=Zt;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Zt=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function d(e,t,r,n){let o={};function i(p){this.def=p,this.constr=f,this.traits=new Set}i.prototype=o;let c=r,s=c&&new WeakSet;function u(p,_){if(p._zod){if(p._zod.traits.has(e))return}else{Re.value=new i(_);try{Object.defineProperty(p,"_zod",Re)}finally{Re.value=void 0}}if(p._zod.traits.add(e),t(p,_),s){let x=Object.getPrototypeOf(p),z=p._zod.constr.prototype,g=x;for(;g&&g!==z;)g=Object.getPrototypeOf(g);let y=g??x;s.has(y)||(s.add(y),Ie(y,c))}let h=f.prototype;for(let x in h)Object.prototype.hasOwnProperty.call(h,x)&&(x in p||(p[x]=h[x].bind(p)))}let a=n?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function f(p){let _=n?.Parent?kn(l):this;u(_,p);let h=_._zod.deferred;if(h){for(let z of h)z();_._zod.deferred=void 0}let x=globalThis.__zod_globalConfig?.postProcessor;return x&&x(_),_}return Object.defineProperty(f,"init",{value:u}),Object.defineProperty(f,Symbol.hasInstance,{value:p=>n?.Parent&&p instanceof n.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}var R=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(kt=globalThis).__zod_globalConfig??(kt.__zod_globalConfig={});var F=globalThis.__zod_globalConfig;function H(e){return e&&Object.assign(F,e),F}function Zn(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Ze,2)),e.message}function Pn(e){this._zod.message=e}var Sn={get:Zn,set:Pn,enumerable:!0,configurable:!0},Ne={value:void 0,enumerable:!1},Pt=new WeakSet([Object.prototype,Error.prototype]),St=(e,t)=>{e.name="$ZodError",Ne.value=t,Object.defineProperty(e,"issues",Ne),Ne.value=void 0,Object.defineProperty(e,"message",Sn);let r=Object.getPrototypeOf(e);Pt.has(r)||(Pt.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},No=d("$ZodError",St),oe=d("$ZodError",St,void 0,{Parent:Error});var En=e=>{let t=(r,n,o,i)=>{let c=o?{...o,async:!1}:{async:!1},s=r._zod.run({value:n,issues:[]},c);if(s instanceof Promise)throw new R;if(s.issues.length){let u=new(i?.Err??e)(s.issues.map(a=>N(a,c,H())));throw ae(u,i?.callee??t),u}return s.value};return t},De=En(oe),Cn=e=>{let t=async(r,n,o,i)=>{let c=o?{...o,async:!0}:{async:!0},s=r._zod.run({value:n,issues:[]},c);if(s instanceof Promise&&(s=await s),s.issues.length){let u=new(i?.Err??e)(s.issues.map(a=>N(a,c,H())));throw ae(u,i?.callee??t),u}return s.value};return t},Le=Cn(oe),In=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new R;return i.issues.length?At(e,i.issues,o):{success:!0,data:i.value}},je=In(oe);function At(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>N(o,r,H()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var On=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?At(e,i.issues,o):{success:!0,data:i.value}},Fe=On(oe);var Et=/^[\s\S]{0,}$/;var Ct=/^-?\d+(?:\.\d+)?$/,It=/^(?:true|false)$/i;var ie=d("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Ot=d("$ZodCheckStringFormat",(e,t)=>{var r,n;ie.init(e,t),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=()=>{})}),Tt=d("$ZodCheckRegex",(e,t)=>{Ot.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 Mt={major:4,minor:6,patch:6};var w=d("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Mt;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let c of i._zod.onattach)c(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(s,u,a)=>{if(s.memo)return s;let l=O(s),f;for(let p of u){if(p._zod.def.when){if(Ce(s)||!p._zod.def.when(s))continue}else if(l)continue;let _=s.issues.length,h=p._zod.check(s);if(h instanceof Promise&&a?.async===!1)throw new R;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await h,s.issues.length!==_&&(ne(s.issues,_,e),l||(l=O(s,_)))});else{if(s.issues.length===_)continue;ne(s.issues,_,e),l||(l=O(s,_))}}return f?f.then(()=>s):s},c=(s,u,a)=>{if(O(s))return s.aborted=!0,s;let l=i(u,o,a);if(l instanceof Promise){if(a.async===!1)throw new R;return l.then(f=>e._zod.parse(f,a))}return e._zod.parse(l,a)};e._zod.run=(s,u)=>{if(u.skipChecks)return e._zod.parse(s,u);if(u.direction==="backward"){let l=e._zod.parse({value:s.value,issues:[]},{...u,skipChecks:!0});return l instanceof Promise?l.then(f=>c(f,s,u)):c(l,s,u)}let a=e._zod.parse(s,u);if(a instanceof Promise){if(u.async===!1)throw new R;return a.then(l=>i(l,o,u))}return i(a,o,u)}}},{get"~standard"(){return Oe(this,"~standard",Rn(this))},set"~standard"(e){E(this,"~standard",e)}}),Ht=(e,t)=>e.issues.length?{issues:e.issues.map(r=>N(r,t,H()))}:{value:e.value};async function Tn(e,t){let r={async:!0};return Ht(await e._zod.run({value:t,issues:[]},r),r)}function Rn(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Ht(n,r)}catch{}return Tn(e,t)},vendor:"zod",version:1}}var Ut=d("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=t.pattern??Et,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 Bt=d("$ZodNumber",(e,t)=>{w.init(e,t),e._zod.pattern=Ct,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 i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}});var Kt=d("$ZodBoolean",(e,t)=>{w.init(e,t),e._zod.pattern=It,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 Mn(e,t){let r=de(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,c)=>{let s=t(i.value);if(s>n&&!c?.skipChecks&&c?.direction!=="backward"){for(let[u,a]of de(e._zod.def.checks))if(s>u&&a._zod.def.when(i)){let l=i.issues.length;return a._zod.check(i),i.issues[l].continue=!1,ne(i.issues,l,e),i}}return o(i,c)}}var Nn=e=>Array.isArray(e)?e.length:-1;function Nt(e,t,r){e.issues.length&&t.issues.push(...fe(r,e.issues)),t.value[r]=e.value}var Vt=d("$ZodArray",(e,t)=>{w.init(e,t);let r=F.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let c=[],s=o?.abortEarly;for(let u=0;u<i.length;u++){let a=i[u],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)c.push(l.then(f=>Nt(f,n,u)));else if(Nt(l,n,u),s&&l.issues.length!==0&&O(l))break}return c.length?Promise.all(c).then(()=>n):n},Mn(e,Nn)});function he(e,t,r,n,o,i){let c=r in n,s=i==="optional";if(!(!c&&s&&o==="optional")){if(e.issues.length){if(o!==void 0&&s&&!c)return;t.issues.push(...fe(r,e.issues))}if(!c&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(c||o==="defaulted"&&!s)&&(t.value[r]=void 0):t.value[r]=e.value}}var Dn=[];function Ln(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Dn,o=n.length?[...t,...n]:t;for(let c of o)if(!e.shape?.[c]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(c)}": expected a Zod schema`);let i=Ee(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function jn(e,t,r,n,o,i,c){let s=[],u=o.keySet,a=o.catchall._zod,l=a.def.type,f=a.optin,p=a.optout,_=0;for(let h in t){if(c&&r.issues.length!==_){if(O(r,_))break;_=r.issues.length}if(u.has(h))continue;if(h==="__proto__"){l==="never"&&s.push(h);continue}if(l==="never"){s.push(h);continue}let x=a.run({value:t[h],issues:[]},n);x instanceof Promise?e.push(x.then(z=>he(z,r,h,t,f,p))):he(x,r,h,t,f,p)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var Gt=d("$ZodObject",(e,t)=>{w.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let a=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),a.raw=l,l};a.raw=n,Object.defineProperty(t,"shape",{get:a})}let o=ue(()=>Ln(t));S(e,"propValues",a=>{let l=a.def.shape,f={};for(let p in l){let _=l[p]._zod;if(_.values){Object.prototype.hasOwnProperty.call(f,p)||ee(f,p,new Set);for(let h of _.values)f[p].add(h);_.optin!==void 0&&f[p].add(void 0)}}return f});let i=Q,c=t.catchall,s,u=F.memoizer;u?.attach(e),e._zod.parse=(a,l)=>{s??(s=o.value);let f=a.value;if(!i(f))return a.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),a;a.value=u?u.alloc(e,a,{},l):{};let p=[],_=s.shape,h=l?.abortEarly,x=a.issues.length;for(let z of s.allKeys){if(h&&a.issues.length!==x){if(O(a,x))break;x=a.issues.length}if(z==="__proto__")continue;let g=_[z],y=g._zod.optin,m=g._zod.optout,b=g._zod.run({value:f[z],issues:[]},l);b instanceof Promise?p.push(b.then(V=>he(V,a,z,f,y,m))):he(b,a,z,f,y,m)}return c?jn(p,f,a,l,o.value,e,h===!0):p.length?Promise.all(p).then(()=>a):a}});var Wt=d("$ZodEnum",(e,t)=>{w.init(e,t);let r=ce(t.entries),n=new Set(r);e._zod.values=n,S(e,"pattern",o=>{let i=ce(o.def.entries).filter(c=>Ae.has(typeof c));return new RegExp(i.length?`^(${i.map(c=>re(c.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let c=o.value;return n.has(c)||o.issues.push({code:"invalid_value",values:r,input:c,inst:e}),o}}),Jt=d("$ZodLiteral",(e,t)=>{w.init(e,t);let r=new Set(t.values);e._zod.values=r,S(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?re(i):i?re(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});function Dt(e,t){return e.value=t.issues.length?void 0:t.value,e}var Xt=d("$ZodOptional",(e,t)=>{w.init(e,t),S(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",S(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),S(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Pe(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>Dt(r,i)):Dt(r,o)}return t.innerType._zod.run(r,n)}});var Yt=d("$ZodDefault",(e,t)=>{w.init(e,t),e._zod.optin="defaulted",S(e,"values",r=>r.def.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(i=>Lt(i,t)):Lt(o,t)}});function Lt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function jt(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>N(o,n,H()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var qt=d("$ZodCatch",(e,t)=>{w.init(e,t),S(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),S(e,"optout",r=>r.def.innerType._zod.optout),S(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>jt(r,i,t,n)):jt(r,o,t,n)}});var Qt=d("$ZodCustom",(e,t)=>{ie.init(e,t),w.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(i=>Ft(i,r,n,e));Ft(o,r,n,e)}});function Ft(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(me(o))}}function er(e){return e.checks&&(e.checks=[...e.checks]),e}function tr(e,t){return new e(er({type:"string",...P(t)}))}function rr(e,t){return new e(er({type:"number",checks:[],...P(t)}))}function nr(e,t){return new e({type:"boolean",...P(t)})}function Ue(e,t){return new Tt({check:"string_format",format:"regex",...P(t),pattern:e})}function or(e,t,r){let n=P(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}var A=d("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");w.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){E(this,"with",e)},parse(e,t){return De(this,e,t,{callee:this.parse})},parseAsync(e,t){return Le(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return je(this,e,t)},safeParseAsync(e,t){return Fe(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(e,t){return Z(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}}),Un=d("ZodMiniString",(e,t)=>{Ut.init(e,t),A.init(e,t)});function U(e){return tr(Un,e)}var Bn=d("ZodMiniNumber",(e,t)=>{Bt.init(e,t),A.init(e,t)});function Be(e){return rr(Bn,e)}var Kn=d("ZodMiniBoolean",(e,t)=>{Kt.init(e,t),A.init(e,t)});function D(e){return nr(Kn,e)}var Vn=d("ZodMiniArray",(e,t)=>{Vt.init(e,t),A.init(e,t)});function Ke(e,t){return new Vn({type:"array",element:e,...P(t)})}var Gn=d("ZodMiniObject",(e,t)=>{Gt.init(e,t),A.init(e,t),Te(e,"shape",r=>r._zod.def.shape,!1)});function Ve(e,t){let r={type:"object",shape:e??{},...P(t)};return new Gn(r)}var Wn=d("ZodMiniEnum",(e,t)=>{Wt.init(e,t),A.init(e,t),e.options=[...e._zod.values]});function ir(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Wn({type:"enum",entries:r,...P(t)})}var Jn=d("ZodMiniLiteral",(e,t)=>{Jt.init(e,t),A.init(e,t)});function sr(e,t){return new Jn({type:"literal",values:Array.isArray(e)?e:[e],...P(t)})}var Xn=d("ZodMiniOptional",(e,t)=>{Xt.init(e,t),A.init(e,t)});function $(e){return new Xn({type:"optional",innerType:e})}var Yn=d("ZodMiniDefault",(e,t)=>{Yt.init(e,t),A.init(e,t)});function J(e,t){return new Yn({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():le(t)}})}var qn=d("ZodMiniCatch",(e,t)=>{qt.init(e,t),A.init(e,t)});function cr(e,t){return new qn({type:"catch",innerType:e,catchValue:typeof t=="function"?t:T.constantCatch(t)})}var Qn=d("ZodMiniCustom",(e,t)=>{Qt.init(e,t),A.init(e,t)});function Ge(e,t){return or(Qn,e??(()=>!0),t)}var _e="https://in.dev.heycatch.ai",B="dev",K="0.8.3-dev.2283",ur="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function ar(e=B){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 X="unknown",no=["localStorage","cookie","memory","localStorage+cookie","sessionStorage"];var lr=Ve({projectKey:U({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(Ue(/^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:J(Ke(U()),[]),install:J(Ve({framework:J(U(),X),frameworkVersion:J(U(),X),agent:J(U(),X)}),{framework:X,frameworkVersion:X,agent:X}),autocapture:$(D()),maskAllText:$(D()),maskAllElementAttributes:$(D()),propertyDenylist:$(Ke(U())),sanitizeProperties:$(Ge(e=>typeof e=="function")),beforeSend:$(Ge(e=>typeof e=="function"||Array.isArray(e)&&e.every(t=>typeof t=="function"))),persistence:$(ir(no)),disablePersistence:$(D()),cookieExpirationDays:$(Be()),optOutCapturingByDefault:$(D()),respectDnt:$(D()),requestBatching:$(D()),flushIntervalMs:$(Be()),site:cr($(sr("landing")),e=>{let t=typeof e.value=="string"?JSON.stringify(e.value):`a ${typeof e.value}`;console.error(`[HeyCatch] config.site must be 'landing' or omitted - got ${t}. Ignoring it; this project is reported as untagged.`)})});var pr="[redacted]",oo=/(^|[#&?])(access_token|refresh_token|token_hash|token)=[^\s#&"'<>]+/gi,io=/(^|[^\w-])eyJ[\w-]+\.[\w-]+\.[\w-]+/g;function fr(e){return e.replaceAll(oo,`$1$2=${pr}`).replaceAll(io,`$1${pr}`)}var so=new Set(["$anon_distinct_id","distinct_id"]),co=["$set","$set_once"];function We(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Je(e){return typeof e=="string"?fr(e):Array.isArray(e)?uo(e):We(e)?dr(e,()=>!0):e}function uo(e){let t=e.map(r=>Je(r));return t.some((r,n)=>r!==e[n])?t:e}function dr(e,t){let r=!1,n=[];for(let[o,i]of Object.entries(e)){let c=t(o)?Je(i):i;c!==i&&(r=!0),n.push([o,c])}return r?Object.fromEntries(n):e}function mr(e){if(!We(e))return e;try{let t=!1,r={...e},{properties:n}=e;if(We(n)){let o=dr(n,i=>!so.has(i));o!==n&&(t=!0,r.properties=o)}for(let o of co){let i=e[o],c=Je(i);c!==i&&(t=!0,r[o]=c)}return t?r:e}catch{return e}}var ao=5e3,lo=60,po=1e3,fo=60,mo=new Set(["$set"]),Xe="heycatch_volume_cap_reached",hr=3,ho=6e4;function ge({bucket:e,perMinute:t,now:r}){if(e===void 0)return t;let n=Math.max(0,r-e.at);return Math.min(t,e.tokens+n*t/ho)}function _o(e){return e===void 0||e.length===0?!1:nt(go(e))}function go(e){if(e.startsWith("[")){let r=e.indexOf("]");return r===-1?e:e.slice(0,r+1)}let t=e.indexOf(":");return t!==-1&&t===e.lastIndexOf(":")?e.slice(0,t):e}function _r(e){let{$session_id:t,$host:r}=e.properties;return{sessionId:typeof t=="string"?t:"",host:typeof r=="string"?r:void 0}}var xr=4;function gr(e){if(e!==void 0)return typeof e=="object"&&e!==null&&"tokens"in e&&typeof e.tokens=="number"&&Number.isFinite(e.tokens)&&e.tokens>=0&&"at"in e&&typeof e.at=="number"&&Number.isFinite(e.at)?{tokens:e.tokens,at:e.at}:!1}function xo(e){if(typeof e=="object"&&e!==null&&"sessionId"in e&&typeof e.sessionId=="string"&&"count"in e&&typeof e.count=="number"&&Number.isInteger(e.count)&&e.count>=0&&"markerAttempts"in e&&typeof e.markerAttempts=="number"&&Number.isInteger(e.markerAttempts)&&e.markerAttempts>=0){let t=gr("person"in e?e.person:void 0),r=gr("localhost"in e?e.localhost:void 0);if(t!==!1&&r!==!1)return{sessionId:e.sessionId,count:e.count,markerAttempts:e.markerAttempts,person:t,localhost:r}}return null}function yo(e){if(e===null)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t.flatMap(r=>{let n=xo(r);return n===null?[]:[n]}).slice(0,xr)}catch{}return[]}function yr({store:e,warn:t,emitMarker:r,cap:n=ao,personUpdateBudget:o=lo,localhostFreeEvents:i=po,localhostRatePerMinute:c=fo,now:s=Date.now}){let u=[],a=!1,l=!1,f=!1,p=!1;function _(){if(e===void 0||a)return u;try{return yo(e.read())}catch{return u}}function h(g){let y=_().filter(m=>m.sessionId!==g.sessionId);u=[g,...y].slice(0,xr);try{e?.write(JSON.stringify(u))}catch{a=!0}}function x(g){let y=_().find(v=>v.sessionId===g),m=u.find(v=>v.sessionId===g),b=[y,m].filter(v=>v!==void 0),V=s();function Y(v,q){let L;for(let{[v]:G}of b)G!==void 0&&ge({bucket:G,perMinute:q,now:V})<ge({bucket:L,perMinute:q,now:V})&&(L=G);return L}return{sessionId:g,count:Math.max(0,...b.map(v=>v.count)),markerAttempts:Math.max(0,...b.map(v=>v.markerAttempts)),person:Y("person",o),localhost:Y("localhost",c)}}function z(g,y){let m=y,b=s(),{sessionId:V,host:Y}=_r(g);m.person!==void 0&&m.person.at>b&&(m={...m,person:{...m.person,at:b}},h(m)),m.localhost!==void 0&&m.localhost.at>b&&(m={...m,localhost:{...m.localhost,at:b}},h(m));let v=mo.has(g.event),q=v?ge({bucket:m.person,perMinute:o,now:b}):0;if(v&&q<1)return f||(f=!0,t(`[HeyCatch] setPersonProperties is being called more than ${o} times a minute - call it when a property changes, not on every render. Dropping the extra updates for now; other events are unaffected.`)),null;let L=m.count>=i&&_o(Y),G=L?ge({bucket:m.localhost,perMinute:c,now:b}):0;return L&&G<1?(p||(p=!0,t(`[HeyCatch] this local dev session (${Y??"unknown host"}, session ${V||"unknown"}) sent ${i} events - throttling it to ${c} a minute so a dev loop cannot flood your analytics. Production traffic is unaffected.`)),null):(h({...m,count:m.count+1,...v?{person:{tokens:q-1,at:b}}:{},...L?{localhost:{tokens:G-1,at:b}}:{}}),g)}return g=>{if(g===null||g.event===Xe)return g;let{sessionId:y}=_r(g),m=x(y);return m.count<n?z(g,m):(l||(l=!0,t(`[HeyCatch] this session sent ${n} events, the per-session cap - dropping the rest until a new session starts (session ${y||"unknown"}). A tracking call inside a render loop or an effect is the usual cause.`)),m.markerAttempts<hr&&(h({...m,markerAttempts:hr}),r({cap:n,sessionId:y})||h({...m,markerAttempts:m.markerAttempts+1})),null)}}function br(e){let t=yr({warn:r=>{console.warn(r)},emitMarker:({cap:r})=>{let n=e();return n?.capture(Xe,{heycatch_session_event_cap:r}),n!==null}});return r=>r===null||t({event:r.event,properties:r.properties??{}})===null?null:r}var xe=null;function k(){return xe}var Ye=null;function $r(){Ye?.()}function zr(e){if(xe!==null)return;let t=lr.safeParse(e);if(!t.success){let c=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${c}`);return}let r=new vr.PostHog(ur,{host:_e,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0,...t.data.optOutCapturingByDefault===void 0?{}:{defaultOptIn:!t.data.optOutCapturingByDefault},before_send:[br(()=>xe),mr]}),{install:n}=t.data,o={heycatch_framework:n.framework,heycatch_framework_version:n.frameworkVersion,heycatch_agent:n.agent};Ye=()=>{r.register({heycatch_sdk_version:K,heycatch_sdk_stage:B,heycatch_project_key:t.data.projectKey,...o}),r.group(rt,t.data.projectKey,{key:t.data.projectKey,sdk_version:K,sdk_stage:B,framework:n.framework,framework_version:n.frameworkVersion,agent:n.agent,api_host:_e})},Ye(),xe=r,console.info(`[HeyCatch] SDK v${K} (${B}) initialized \u2192 ${_e}`);let i=ar();i!==null&&console.warn(i)}function wr(e){return t=>{console.error(`[HeyCatch] consent ${e} could not be saved - capture state may reset on the next app launch:`,t)}}function kr(){k()?.optIn().catch(wr("opt-in"))}function Zr(){k()?.optOut().catch(wr("opt-out"))}var Pr=require("posthog-react-native");function Sr(e,t,r){let n=k();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.getPersistedProperty(Pr.PostHogPersistedProperty.PersonMode)==="identified"&&n.getDistinctId()!==e&&qe(),n.identify(e,{...t?{$set:t}:{},...r?{$set_once:r}:{}})}}function qe(){let e=k();e!==null&&(e.reset(),$r())}function ye(e,t){let r=k();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 Ar(e,t,r){let n=k();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 Er(e,t){let r=k();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}var Ir=require("posthog-react-native"),be=require("react");function bo(e){return typeof e=="object"&&e!==null&&"usePathname"in e&&typeof e.usePathname=="function"&&"useGlobalSearchParams"in e&&typeof e.useGlobalSearchParams=="function"}function vo(){try{if(typeof require!="function")return null;let e=require("expo-router");return bo(e)?e:null}catch{return null}}var Qe=vo();var $o=new Set(["code","jwt","otp","pin","pwd","sid","sig"]),zo=["credential","email","passcode","passwd","password","secret","session","signature","token"],wo="#",ko=/[^\s@,]+@[^\s@,]+\.[^\s@,]+/;function Zo(e){return e.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[\s_-]+/).filter(t=>t.length>0)}function Po(e,t){if(e===wo)return!0;let r=e.toLowerCase().replaceAll(/[_-]/g,"");return r.startsWith("auth")||r.includes("key")||zo.some(n=>r.includes(n))||Zo(e).some(n=>$o.has(n))?!0:typeof t=="string"&&ko.test(t)}function Cr(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[n,o]of Object.entries(t)){let i;if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")i=o;else if(Array.isArray(o))i=o.filter(c=>typeof c=="string").join(",");else continue;Po(n,i)||(r[n]=i)}return r}var se=require("react/jsx-runtime");function So({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,n=r(),o=JSON.stringify(t());return(0,be.useEffect)(()=>{ye(n,Cr(o))},[n,o]),null}var et=class extends be.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t){console.error("[HeyCatch] Automatic screen views are off: an Expo Router hook threw. Call analytics.trackScreen(name) from your navigation instead.",t)}render(){return this.state.failed?null:this.props.children}};function Or({children:e,trackScreens:t=!0}){let r=k();return r===null?(console.error("[HeyCatch] HeyCatchProvider mounted before init() - call analytics.init({ projectKey }) at module scope of the root layout."),e):(0,se.jsxs)(Ir.PostHogProvider,{autocapture:{captureScreens:!1,captureTouches:!0},client:r,children:[!t||Qe===null?null:(0,se.jsx)(et,{children:(0,se.jsx)(So,{router:Qe})}),e]})}var Ao={init:zr,optInCapturing:kr,optOutCapturing:Zr,resetIdentity:qe,setIdentity:Sr,setPersonProperties:Er,trackEvent:Ar,trackScreen:ye};0&&(module.exports={HeyCatchProvider,SDK_VERSION,STAGE,analytics});
|
|
2
2
|
//# sourceMappingURL=react-native.cjs.map
|
package/dist/react-native.d.cts
CHANGED
|
@@ -282,6 +282,12 @@ interface HeyCatchConfig {
|
|
|
282
282
|
* window. Browser only.
|
|
283
283
|
*/
|
|
284
284
|
flushIntervalMs?: number;
|
|
285
|
+
/**
|
|
286
|
+
* Set to `'landing'` when this project is your marketing site / landing
|
|
287
|
+
* page / waitlist, so its visits read apart from your app's. Leave it out
|
|
288
|
+
* when your site and app are one project. Browser only.
|
|
289
|
+
*/
|
|
290
|
+
site?: 'landing';
|
|
285
291
|
}
|
|
286
292
|
|
|
287
293
|
declare function init(config: HeyCatchConfig): void;
|