@syntrologie/runtime-sdk 2.0.1-canary.0 → 2.0.1-canary.1
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/events/normalizers/posthog.js +4 -3
- package/dist/events/normalizers/posthog.js.map +1 -1
- package/dist/smart-canvas.esm.js +1 -1
- package/dist/smart-canvas.esm.js.map +2 -2
- package/dist/smart-canvas.js +3 -3
- package/dist/smart-canvas.js.map +2 -2
- package/dist/smart-canvas.min.js +1 -1
- package/dist/smart-canvas.min.js.map +2 -2
- package/package.json +1 -1
package/dist/smart-canvas.min.js
CHANGED
|
@@ -50,7 +50,7 @@ Error generating stack: `+o.message+`
|
|
|
50
50
|
s.textContent = '.${e} { ${n} }';
|
|
51
51
|
document.head.appendChild(s);
|
|
52
52
|
document.documentElement.className += ' ${e}';
|
|
53
|
-
})();`}var rb="https://cdn.syntrologie.com/editor-sdk/latest/editor-sdk.js",ib=["cdn.syntrologie.com","api.syntrologie.com","dev-api.syntrologie.com","localhost","127.0.0.1",".syntrologie.com"];function xI(t){F("Syntro Runtime","Validating editor URL:",t);try{if(t.startsWith("/"))return F("Syntro Runtime","\u2713 Relative URL allowed (same-origin):",t),!0;let e=new URL(t),n=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);if(F("Syntro Runtime","Parsed URL:",{hostname:e.hostname,protocol:e.protocol,isLocalhost:n}),e.protocol!=="https:"&&!n)return wt("Syntro Runtime","\u274C Editor URL must use HTTPS:",t),!1;let r=ib.some(i=>i.startsWith(".")?e.hostname.endsWith(i)||e.hostname===i.slice(1):e.hostname===i);return F("Syntro Runtime","Host allowlist check:",{hostname:e.hostname,allowedHosts:ib,isAllowed:r}),r?(F("Syntro Runtime","\u2713 Editor URL validated"),!0):(wt("Syntro Runtime","\u274C Editor URL host not in allowlist:",e.hostname),!1)}catch(e){return wt("Syntro Runtime","\u274C Invalid editor URL: "+t,e),!1}}var SI=()=>{if(F("Syntro Runtime","====== EDITOR LOAD CHECK ======"),typeof window>"u")return F("Syntro Runtime","Not in browser - skipping editor"),!1;let t=new URLSearchParams(window.location.search);F("Syntro Runtime","URL:",window.location.href),F("Syntro Runtime","Search params:",window.location.search);let e=t.has("syntro_editor")||t.has("syntro-editor"),n=t.has("editor_token");if(F("Syntro Runtime","Editor flags:",{hasEditorFlag:e,hasEditorToken:n,syntro_editor:t.get("syntro_editor"),"syntro-editor":t.get("syntro-editor"),editor_token:n?`${t.get("editor_token")?.slice(0,10)}...`:"none"}),e&&!n)return wt("Syntro Runtime","\u274C Editor activation requires editor_token parameter"),F("Syntro Runtime","================================"),!1;let r=e&&n;return F("Syntro Runtime","Should load editor:",r),F("Syntro Runtime","================================"),r},bI=()=>{if(F("Syntro Runtime","====== AUDIT MODE CHECK ======"),typeof window>"u")return F("Syntro Runtime","Not in browser - skipping audit"),!1;let t=new URLSearchParams(window.location.search),e=t.has("syntro_audit"),n=t.has("audit_token"),r=t.get("audit_session_id");return F("Syntro Runtime","Audit flags:",{hasAuditFlag:e,hasAuditToken:n,auditSessionId:r?`${r.slice(0,8)}...`:"none",audit_token:n?`${t.get("audit_token")?.slice(0,10)}...`:"none"}),e?n?(F("Syntro Runtime","\u2713 Audit mode active"),F("Syntro Runtime","================================"),!0):(wt("Syntro Runtime","\u274C Audit activation requires audit_token parameter"),F("Syntro Runtime","================================"),!1):(F("Syntro Runtime","No syntro_audit param - not in audit mode"),F("Syntro Runtime","================================"),!1)},ob=()=>SI()?"editor":bI()?"audit":null;function kI(){if(typeof window>"u")return null;let t=new URLSearchParams(window.location.search);return t.get("editor_token")||t.get("audit_token")}var sb=async t=>{if(F("Syntro Runtime","====== LOAD EDITOR SDK ======"),typeof window>"u"){F("Syntro Runtime","Not in browser - skipping editor SDK load");return}if(window.SyntroEditor){F("Syntro Runtime","Editor SDK already loaded (window.SyntroEditor exists)");return}let e=typeof t=="string"?{editorUrl:t}:t??{},n=new URLSearchParams(window.location.search),r=n.get("syntro_editor_sdk_url"),i=n.get("api_base"),o=i?`${i}/api/editor/sdk/editor-sdk.js`:null,s=r||o||e.editorUrl||rb,a=kI();if(!a){wt("Syntro Runtime","\u274C No token found in URL params. SDK requires editor_token or audit_token."),F("Syntro Runtime","================================");return}let l=`${s}?token=${encodeURIComponent(a)}`;if(F("Syntro Runtime","Editor URL:",l),F("Syntro Runtime","Options:",{hasIntegrity:!!e.integrity,isDefault:s===rb,hasApiBase:!!i,tokenPrefix:a.slice(0,10)+"..."}),!xI(s)){console.error("[Syntro Runtime] \u274C BLOCKED: Editor from untrusted URL:",s),F("Syntro Runtime","================================");return}return F("Syntro Runtime","\u2713 URL validated, injecting script tag..."),new Promise((c,u)=>{let f=document.createElement("script");f.src=l,f.async=!0,e.integrity&&(f.integrity=e.integrity,f.crossOrigin="anonymous",F("Syntro Runtime","SRI integrity check enabled")),f.onload=()=>{F("Syntro Runtime","\u2713 Editor SDK script loaded successfully"),F("Syntro Runtime","window.SyntroEditor:",!!window.SyntroEditor),F("Syntro Runtime","================================"),c()},f.onerror=h=>{console.error("[Syntro Runtime] \u274C Failed to load Editor SDK:",h),console.error("[Syntro Runtime] URL attempted:",l),console.error("[Syntro Runtime] Check: Is the URL accessible? CORS? Network? Token valid?"),F("Syntro Runtime","================================"),u(h)},document.head.appendChild(f),F("Syntro Runtime","Script tag appended to <head>")})};var Uu=async(t={})=>{if(typeof window>"u"||typeof document>"u")throw new Error("SmartCanvas can only be created in a browser-like environment");let e=null;if(t.antiFlicker){let d=typeof t.antiFlicker=="object"?t.antiFlicker:{};e=tb(d)}let n=null,r=null,i=null,o=!0,s=t.runtime;async function a(d){!s?.actions||d.length===0||(i?.isApplied()&&await i.revertAll(),i=await s.actions.applyBatch(d))}async function l(){i?.isApplied()&&(await i.revertAll(),i=null)}if(t.fetcher)try{r=t.fetcher;let d=await t.fetcher();n=d,d.actions&&d.actions.length>0&&s?.actions&&await a(d.actions)}catch(d){console.error("[SmartCanvas] Error fetching/applying initial config:",d)}e&&e();let c=ob();c&&(console.log(`[SmartCanvas] Loading editor SDK for ${c} mode`),sb(t.editorUrl).catch(console.error)),gm();let u=document.createElement("smart-canvas");if(t.tokens)for(let[d,p]of Object.entries(t.tokens))u.style.setProperty(d,p);let f=()=>{let d=t.target??document.body;d&&d.appendChild(u)};document.body?f():document.addEventListener("DOMContentLoaded",f,{once:!0});let h=t.integrations?.experiments,g=t.integrations?.telemetry,v=t.fetcher??Ni({configUri:t.configUri,experiments:h,featureKey:t.configUriFeatureKey,credentials:t.fetchCredentials});r||(r=v);let _={fetcher:v,pollIntervalMs:t.pollIntervalMs,experiments:h,telemetry:g,runtime:s,overlayFetcher:t.overlayFetcher,overlayConfigUri:t.overlayConfigUri,overlayConfigFeatureKey:t.overlayConfigFeatureKey,overlayFetchCredentials:t.overlayFetchCredentials,configUri:t.configUri,configUriFeatureKey:t.configUriFeatureKey,fetchCredentials:t.fetchCredentials,theme:t.theme};u.mountReactApp(_),t.defaultOpen&&u.open();let x={el:u,open:()=>u.open(),close:()=>u.close(),destroy:()=>{l(),u.remove()},setTokens:d=>{for(let[p,m]of Object.entries(d))u.style.setProperty(p,m)},getConfig:async()=>{if(r)try{let d=await r();return n=d,d}catch(d){console.error("[SmartCanvas] Error fetching config:",d)}return n??{tiles:[],actions:[],fetchedAt:""}},updateConfig:async d=>{n=d,o&&await a(d.actions)},setEnabled:async d=>{o=d,d?n&&await a(n.actions):await l()},registerComponent:(d,p)=>u.registerComponent(d,p),setOverrideFetcher:d=>{r=d,u.setOverrideFetcher(d)},registerTelemetryProperties:d=>{g?.register?.(d)},getSessionId:()=>g?.getSessionId?.(),startSessionRecording:()=>{g?.startSessionRecording?.()},runtime:s};return typeof window<"u"&&c&&(window.__smartCanvasHandle=x),x};typeof window<"u"&&(window.SmartCanvas={async create(t){return Uu(t)}});var S={};fv(S,{BRAND:()=>YI,DIRTY:()=>Li,EMPTY_PATH:()=>TI,INVALID:()=>U,NEVER:()=>LP,OK:()=>lt,ParseStatus:()=>tt,Schema:()=>J,ZodAny:()=>oi,ZodArray:()=>dr,ZodBigInt:()=>Fi,ZodBoolean:()=>$i,ZodBranded:()=>Ga,ZodCatch:()=>Gi,ZodDate:()=>Di,ZodDefault:()=>Ki,ZodDiscriminatedUnion:()=>Ku,ZodEffects:()=>Jt,ZodEnum:()=>Wi,ZodError:()=>Tt,ZodFirstPartyTypeKind:()=>q,ZodFunction:()=>Zu,ZodIntersection:()=>Hi,ZodIssueCode:()=>T,ZodLazy:()=>ji,ZodLiteral:()=>Ui,ZodMap:()=>ss,ZodNaN:()=>ls,ZodNativeEnum:()=>qi,ZodNever:()=>gn,ZodNull:()=>Vi,ZodNullable:()=>On,ZodNumber:()=>Mi,ZodObject:()=>Rt,ZodOptional:()=>Xt,ZodParsedType:()=>M,ZodPipeline:()=>Za,ZodPromise:()=>si,ZodReadonly:()=>Zi,ZodRecord:()=>Gu,ZodSchema:()=>J,ZodSet:()=>as,ZodString:()=>ii,ZodSymbol:()=>is,ZodTransformer:()=>Jt,ZodTuple:()=>Pn,ZodType:()=>J,ZodUndefined:()=>Bi,ZodUnion:()=>zi,ZodUnknown:()=>ur,ZodVoid:()=>os,addIssueToContext:()=>P,any:()=>oP,array:()=>cP,bigint:()=>eP,boolean:()=>vb,coerce:()=>NP,custom:()=>hb,date:()=>tP,datetimeRegex:()=>fb,defaultErrorMap:()=>lr,discriminatedUnion:()=>pP,effect:()=>EP,enum:()=>SP,function:()=>_P,getErrorMap:()=>ts,getParsedType:()=>In,instanceof:()=>QI,intersection:()=>hP,isAborted:()=>Wu,isAsync:()=>ns,isDirty:()=>qu,isValid:()=>ri,late:()=>XI,lazy:()=>wP,literal:()=>xP,makeIssue:()=>Ka,map:()=>vP,nan:()=>JI,nativeEnum:()=>bP,never:()=>aP,null:()=>iP,nullable:()=>AP,number:()=>mb,object:()=>uP,objectUtil:()=>mm,oboolean:()=>OP,onumber:()=>PP,optional:()=>CP,ostring:()=>IP,pipeline:()=>RP,preprocess:()=>TP,promise:()=>kP,quotelessJson:()=>EI,record:()=>mP,set:()=>yP,setErrorMap:()=>AI,strictObject:()=>dP,string:()=>gb,symbol:()=>nP,transformer:()=>EP,tuple:()=>gP,undefined:()=>rP,union:()=>fP,unknown:()=>sP,util:()=>re,void:()=>lP});var re;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(re||(re={}));var mm;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(mm||(mm={}));var M=re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),In=t=>{switch(typeof t){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(t)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(t)?M.array:t===null?M.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?M.promise:typeof Map<"u"&&t instanceof Map?M.map:typeof Set<"u"&&t instanceof Set?M.set:typeof Date<"u"&&t instanceof Date?M.date:M.object;default:return M.unknown}};var T=re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),EI=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Tt=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(o){return o.message},r={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];n[o]=n[o]||[],n[o].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};Tt.create=t=>new Tt(t);var CI=(t,e)=>{let n;switch(t.code){case T.invalid_type:t.received===M.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case T.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,re.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:n=`Unrecognized key(s) in object: ${re.joinValues(t.keys,", ")}`;break;case T.invalid_union:n="Invalid input";break;case T.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${re.joinValues(t.options)}`;break;case T.invalid_enum_value:n=`Invalid enum value. Expected ${re.joinValues(t.options)}, received '${t.received}'`;break;case T.invalid_arguments:n="Invalid function arguments";break;case T.invalid_return_type:n="Invalid function return type";break;case T.invalid_date:n="Invalid date";break;case T.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:re.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case T.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case T.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case T.custom:n="Invalid input";break;case T.invalid_intersection_types:n="Intersection results could not be merged";break;case T.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case T.not_finite:n="Number must be finite";break;default:n=e.defaultError,re.assertNever(t)}return{message:n}},lr=CI;var ab=lr;function AI(t){ab=t}function ts(){return ab}var Ka=t=>{let{data:e,path:n,errorMaps:r,issueData:i}=t,o=[...n,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",l=r.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}},TI=[];function P(t,e){let n=ts(),r=Ka({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===lr?void 0:lr].filter(i=>!!i)});t.common.issues.push(r)}var tt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let i of n){if(i.status==="aborted")return U;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let i of n){let o=await i.key,s=await i.value;r.push({key:o,value:s})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let i of n){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return U;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}},U=Object.freeze({status:"aborted"}),Li=t=>({status:"dirty",value:t}),lt=t=>({status:"valid",value:t}),Wu=t=>t.status==="aborted",qu=t=>t.status==="dirty",ri=t=>t.status==="valid",ns=t=>typeof Promise<"u"&&t instanceof Promise;var z;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(z||(z={}));var Qt=class{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},lb=(t,e)=>{if(ri(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new Tt(t.common.issues);return this._error=n,this._error}}};function Q(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}var J=class{get description(){return this._def.description}_getType(e){return In(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:In(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new tt,ctx:{common:e.parent.common,data:e.data,parsedType:In(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ns(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:In(e)},i=this._parseSync({data:e,path:r.path,parent:r});return lb(r,i)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:In(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return ri(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>ri(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:In(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(ns(i)?i:Promise.resolve(i));return lb(r,o)}refine(e,n){let r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:T.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Jt({schema:this,typeName:q.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Xt.create(this,this._def)}nullable(){return On.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return dr.create(this)}promise(){return si.create(this,this._def)}or(e){return zi.create([this,e],this._def)}and(e){return Hi.create(this,e,this._def)}transform(e){return new Jt({...Q(this._def),schema:this,typeName:q.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new Ki({...Q(this._def),innerType:this,defaultValue:n,typeName:q.ZodDefault})}brand(){return new Ga({typeName:q.ZodBranded,type:this,...Q(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new Gi({...Q(this._def),innerType:this,catchValue:n,typeName:q.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Za.create(this,e)}readonly(){return Zi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},RI=/^c[^\s-]{8,}$/i,II=/^[0-9a-z]+$/,PI=/^[0-9A-HJKMNP-TV-Z]{26}$/i,OI=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,NI=/^[a-z0-9_-]{21}$/i,LI=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,MI=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,FI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,$I="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",vm,DI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,BI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,VI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,zI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,HI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,jI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ub="((\\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])))",UI=new RegExp(`^${ub}$`);function db(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function WI(t){return new RegExp(`^${db(t)}$`)}function fb(t){let e=`${ub}T${db(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function qI(t,e){return!!((e==="v4"||!e)&&DI.test(t)||(e==="v6"||!e)&&VI.test(t))}function KI(t,e){if(!LI.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function GI(t,e){return!!((e==="v4"||!e)&&BI.test(t)||(e==="v6"||!e)&&zI.test(t))}var ii=class t extends J{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==M.string){let o=this._getOrReturnCtx(e);return P(o,{code:T.invalid_type,expected:M.string,received:o.parsedType}),U}let r=new tt,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),P(i,{code:T.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),P(i,{code:T.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?P(i,{code:T.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&P(i,{code:T.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")FI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"email",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")vm||(vm=new RegExp($I,"u")),vm.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"emoji",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")OI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"uuid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")NI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"nanoid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")RI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"cuid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")II.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"cuid2",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")PI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"ulid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),P(i,{validation:"url",code:T.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"regex",code:T.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),P(i,{code:T.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),P(i,{code:T.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),P(i,{code:T.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?fb(o).test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{code:T.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?UI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{code:T.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?WI(o).test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{code:T.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?MI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"duration",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?qI(e.data,o.version)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"ip",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?KI(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"jwt",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?GI(e.data,o.version)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"cidr",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?HI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"base64",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?jI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"base64url",code:T.invalid_string,message:o.message}),r.dirty()):re.assertNever(o);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:T.invalid_string,...z.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...z.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...z.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...z.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...z.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...z.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...z.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...z.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...z.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...z.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...z.errToObj(n)})}nonempty(e){return this.min(1,z.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};ii.create=t=>new ii({checks:[],typeName:q.ZodString,coerce:t?.coerce??!1,...Q(t)});function ZI(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}var Mi=class t extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==M.number){let o=this._getOrReturnCtx(e);return P(o,{code:T.invalid_type,expected:M.number,received:o.parsedType}),U}let r,i=new tt;for(let o of this._def.checks)o.kind==="int"?re.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{code:T.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),P(r,{code:T.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),P(r,{code:T.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?ZI(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),P(r,{code:T.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{code:T.not_finite,message:o.message}),i.dirty()):re.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,z.toString(n))}gt(e,n){return this.setLimit("min",e,!1,z.toString(n))}lte(e,n){return this.setLimit("max",e,!0,z.toString(n))}lt(e,n){return this.setLimit("max",e,!1,z.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:z.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:z.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:z.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:z.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&re.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};Mi.create=t=>new Mi({checks:[],typeName:q.ZodNumber,coerce:t?.coerce||!1,...Q(t)});var Fi=class t extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==M.bigint)return this._getInvalidInput(e);let r,i=new tt;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),P(r,{code:T.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),P(r,{code:T.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),P(r,{code:T.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):re.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return P(n,{code:T.invalid_type,expected:M.bigint,received:n.parsedType}),U}gte(e,n){return this.setLimit("min",e,!0,z.toString(n))}gt(e,n){return this.setLimit("min",e,!1,z.toString(n))}lte(e,n){return this.setLimit("max",e,!0,z.toString(n))}lt(e,n){return this.setLimit("max",e,!1,z.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:z.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:z.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:z.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Fi.create=t=>new Fi({checks:[],typeName:q.ZodBigInt,coerce:t?.coerce??!1,...Q(t)});var $i=class extends J{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==M.boolean){let r=this._getOrReturnCtx(e);return P(r,{code:T.invalid_type,expected:M.boolean,received:r.parsedType}),U}return lt(e.data)}};$i.create=t=>new $i({typeName:q.ZodBoolean,coerce:t?.coerce||!1,...Q(t)});var Di=class t extends J{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==M.date){let o=this._getOrReturnCtx(e);return P(o,{code:T.invalid_type,expected:M.date,received:o.parsedType}),U}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return P(o,{code:T.invalid_date}),U}let r=new tt,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),P(i,{code:T.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),P(i,{code:T.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):re.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:z.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:z.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Di.create=t=>new Di({checks:[],coerce:t?.coerce||!1,typeName:q.ZodDate,...Q(t)});var is=class extends J{_parse(e){if(this._getType(e)!==M.symbol){let r=this._getOrReturnCtx(e);return P(r,{code:T.invalid_type,expected:M.symbol,received:r.parsedType}),U}return lt(e.data)}};is.create=t=>new is({typeName:q.ZodSymbol,...Q(t)});var Bi=class extends J{_parse(e){if(this._getType(e)!==M.undefined){let r=this._getOrReturnCtx(e);return P(r,{code:T.invalid_type,expected:M.undefined,received:r.parsedType}),U}return lt(e.data)}};Bi.create=t=>new Bi({typeName:q.ZodUndefined,...Q(t)});var Vi=class extends J{_parse(e){if(this._getType(e)!==M.null){let r=this._getOrReturnCtx(e);return P(r,{code:T.invalid_type,expected:M.null,received:r.parsedType}),U}return lt(e.data)}};Vi.create=t=>new Vi({typeName:q.ZodNull,...Q(t)});var oi=class extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return lt(e.data)}};oi.create=t=>new oi({typeName:q.ZodAny,...Q(t)});var ur=class extends J{constructor(){super(...arguments),this._unknown=!0}_parse(e){return lt(e.data)}};ur.create=t=>new ur({typeName:q.ZodUnknown,...Q(t)});var gn=class extends J{_parse(e){let n=this._getOrReturnCtx(e);return P(n,{code:T.invalid_type,expected:M.never,received:n.parsedType}),U}};gn.create=t=>new gn({typeName:q.ZodNever,...Q(t)});var os=class extends J{_parse(e){if(this._getType(e)!==M.undefined){let r=this._getOrReturnCtx(e);return P(r,{code:T.invalid_type,expected:M.void,received:r.parsedType}),U}return lt(e.data)}};os.create=t=>new os({typeName:q.ZodVoid,...Q(t)});var dr=class t extends J{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==M.array)return P(n,{code:T.invalid_type,expected:M.array,received:n.parsedType}),U;if(i.exactLength!==null){let s=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(s||a)&&(P(n,{code:s?T.too_big:T.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(P(n,{code:T.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(P(n,{code:T.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>i.type._parseAsync(new Qt(n,s,n.path,a)))).then(s=>tt.mergeArray(r,s));let o=[...n.data].map((s,a)=>i.type._parseSync(new Qt(n,s,n.path,a)));return tt.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:z.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:z.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:z.toString(n)}})}nonempty(e){return this.min(1,e)}};dr.create=(t,e)=>new dr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:q.ZodArray,...Q(e)});function rs(t){if(t instanceof Rt){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Xt.create(rs(r))}return new Rt({...t._def,shape:()=>e})}else return t instanceof dr?new dr({...t._def,type:rs(t.element)}):t instanceof Xt?Xt.create(rs(t.unwrap())):t instanceof On?On.create(rs(t.unwrap())):t instanceof Pn?Pn.create(t.items.map(e=>rs(e))):t}var Rt=class t extends J{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=re.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==M.object){let c=this._getOrReturnCtx(e);return P(c,{code:T.invalid_type,expected:M.object,received:c.parsedType}),U}let{status:r,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof gn&&this._def.unknownKeys==="strip"))for(let c in i.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let u=o[c],f=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Qt(i,f,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof gn){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(P(i,{code:T.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let f=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Qt(i,f,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let f=await u.key,h=await u.value;c.push({key:f,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>tt.mergeObjectSync(r,c)):tt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return z.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:z.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:q.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of re.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of re.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return rs(this)}partial(e){let n={};for(let r of re.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of re.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Xt;)o=o._def.innerType;n[r]=o}return new t({...this._def,shape:()=>n})}keyof(){return pb(re.objectKeys(this.shape))}};Rt.create=(t,e)=>new Rt({shape:()=>t,unknownKeys:"strip",catchall:gn.create(),typeName:q.ZodObject,...Q(e)});Rt.strictCreate=(t,e)=>new Rt({shape:()=>t,unknownKeys:"strict",catchall:gn.create(),typeName:q.ZodObject,...Q(e)});Rt.lazycreate=(t,e)=>new Rt({shape:t,unknownKeys:"strip",catchall:gn.create(),typeName:q.ZodObject,...Q(e)});var zi=class extends J{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new Tt(a.ctx.common.issues));return P(n,{code:T.invalid_union,unionErrors:s}),U}if(n.common.async)return Promise.all(r.map(async o=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let l of r){let c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(l=>new Tt(l));return P(n,{code:T.invalid_union,unionErrors:a}),U}}get options(){return this._def.options}};zi.create=(t,e)=>new zi({options:t,typeName:q.ZodUnion,...Q(e)});var cr=t=>t instanceof ji?cr(t.schema):t instanceof Jt?cr(t.innerType()):t instanceof Ui?[t.value]:t instanceof Wi?t.options:t instanceof qi?re.objectValues(t.enum):t instanceof Ki?cr(t._def.innerType):t instanceof Bi?[void 0]:t instanceof Vi?[null]:t instanceof Xt?[void 0,...cr(t.unwrap())]:t instanceof On?[null,...cr(t.unwrap())]:t instanceof Ga||t instanceof Zi?cr(t.unwrap()):t instanceof Gi?cr(t._def.innerType):[],Ku=class t extends J{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==M.object)return P(n,{code:T.invalid_type,expected:M.object,received:n.parsedType}),U;let r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(P(n,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),U)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let i=new Map;for(let o of n){let s=cr(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:q.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...Q(r)})}};function ym(t,e){let n=In(t),r=In(e);if(t===e)return{valid:!0,data:t};if(n===M.object&&r===M.object){let i=re.objectKeys(e),o=re.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let l=ym(t[a],e[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===M.array&&r===M.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],l=ym(s,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===M.date&&r===M.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Hi=class extends J{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=(o,s)=>{if(Wu(o)||Wu(s))return U;let a=ym(o.value,s.value);return a.valid?((qu(o)||qu(s))&&n.dirty(),{status:n.value,value:a.data}):(P(r,{code:T.invalid_intersection_types}),U)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Hi.create=(t,e,n)=>new Hi({left:t,right:e,typeName:q.ZodIntersection,...Q(n)});var Pn=class t extends J{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==M.array)return P(r,{code:T.invalid_type,expected:M.array,received:r.parsedType}),U;if(r.data.length<this._def.items.length)return P(r,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),U;!this._def.rest&&r.data.length>this._def.items.length&&(P(r,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...r.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Qt(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>tt.mergeArray(n,s)):tt.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Pn.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pn({items:t,typeName:q.ZodTuple,rest:null,...Q(e)})};var Gu=class t extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==M.object)return P(r,{code:T.invalid_type,expected:M.object,received:r.parsedType}),U;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in r.data)i.push({key:o._parse(new Qt(r,a,r.path,a)),value:s._parse(new Qt(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?tt.mergeObjectAsync(n,i):tt.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof J?new t({keyType:e,valueType:n,typeName:q.ZodRecord,...Q(r)}):new t({keyType:ii.create(),valueType:e,typeName:q.ZodRecord,...Q(n)})}},ss=class extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==M.map)return P(r,{code:T.invalid_type,expected:M.map,received:r.parsedType}),U;let i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new Qt(r,a,r.path,[c,"key"])),value:o._parse(new Qt(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return U;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return U;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}};ss.create=(t,e,n)=>new ss({valueType:e,keyType:t,typeName:q.ZodMap,...Q(n)});var as=class t extends J{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==M.set)return P(r,{code:T.invalid_type,expected:M.set,received:r.parsedType}),U;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(P(r,{code:T.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(P(r,{code:T.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let o=this._def.valueType;function s(l){let c=new Set;for(let u of l){if(u.status==="aborted")return U;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}let a=[...r.data.values()].map((l,c)=>o._parse(new Qt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:z.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:z.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};as.create=(t,e)=>new as({valueType:t,minSize:null,maxSize:null,typeName:q.ZodSet,...Q(e)});var Zu=class t extends J{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==M.function)return P(n,{code:T.invalid_type,expected:M.function,received:n.parsedType}),U;function r(a,l){return Ka({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ts(),lr].filter(c=>!!c),issueData:{code:T.invalid_arguments,argumentsError:l}})}function i(a,l){return Ka({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ts(),lr].filter(c=>!!c),issueData:{code:T.invalid_return_type,returnTypeError:l}})}let o={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof si){let a=this;return lt(async function(...l){let c=new Tt([]),u=await a._def.args.parseAsync(l,o).catch(g=>{throw c.addIssue(r(l,g)),c}),f=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(f,o).catch(g=>{throw c.addIssue(i(f,g)),c})})}else{let a=this;return lt(function(...l){let c=a._def.args.safeParse(l,o);if(!c.success)throw new Tt([r(l,c.error)]);let u=Reflect.apply(s,this,c.data),f=a._def.returns.safeParse(u,o);if(!f.success)throw new Tt([i(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Pn.create(e).rest(ur.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||Pn.create([]).rest(ur.create()),returns:n||ur.create(),typeName:q.ZodFunction,...Q(r)})}},ji=class extends J{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ji.create=(t,e)=>new ji({getter:t,typeName:q.ZodLazy,...Q(e)});var Ui=class extends J{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return P(n,{received:n.data,code:T.invalid_literal,expected:this._def.value}),U}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ui.create=(t,e)=>new Ui({value:t,typeName:q.ZodLiteral,...Q(e)});function pb(t,e){return new Wi({values:t,typeName:q.ZodEnum,...Q(e)})}var Wi=class t extends J{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return P(n,{expected:re.joinValues(r),received:n.parsedType,code:T.invalid_type}),U}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return P(n,{received:n.data,code:T.invalid_enum_value,options:r}),U}return lt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Wi.create=pb;var qi=class extends J{_parse(e){let n=re.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==M.string&&r.parsedType!==M.number){let i=re.objectValues(n);return P(r,{expected:re.joinValues(i),received:r.parsedType,code:T.invalid_type}),U}if(this._cache||(this._cache=new Set(re.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=re.objectValues(n);return P(r,{received:r.data,code:T.invalid_enum_value,options:i}),U}return lt(e.data)}get enum(){return this._def.values}};qi.create=(t,e)=>new qi({values:t,typeName:q.ZodNativeEnum,...Q(e)});var si=class extends J{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==M.promise&&n.common.async===!1)return P(n,{code:T.invalid_type,expected:M.promise,received:n.parsedType}),U;let r=n.parsedType===M.promise?n.data:Promise.resolve(n.data);return lt(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}};si.create=(t,e)=>new si({type:t,typeName:q.ZodPromise,...Q(e)});var Jt=class extends J{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{P(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return U;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?U:l.status==="dirty"?Li(l.value):n.value==="dirty"?Li(l.value):l});{if(n.value==="aborted")return U;let a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?U:a.status==="dirty"?Li(a.value):n.value==="dirty"?Li(a.value):a}}if(i.type==="refinement"){let s=a=>{let l=i.refinement(a,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?U:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?U:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ri(s))return U;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>ri(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:n.value,value:a})):U);re.assertNever(i)}};Jt.create=(t,e,n)=>new Jt({schema:t,typeName:q.ZodEffects,effect:e,...Q(n)});Jt.createWithPreprocess=(t,e,n)=>new Jt({schema:e,effect:{type:"preprocess",transform:t},typeName:q.ZodEffects,...Q(n)});var Xt=class extends J{_parse(e){return this._getType(e)===M.undefined?lt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Xt.create=(t,e)=>new Xt({innerType:t,typeName:q.ZodOptional,...Q(e)});var On=class extends J{_parse(e){return this._getType(e)===M.null?lt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};On.create=(t,e)=>new On({innerType:t,typeName:q.ZodNullable,...Q(e)});var Ki=class extends J{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===M.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Ki.create=(t,e)=>new Ki({innerType:t,typeName:q.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});var Gi=class extends J{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ns(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Tt(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Tt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Gi.create=(t,e)=>new Gi({innerType:t,typeName:q.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});var ls=class extends J{_parse(e){if(this._getType(e)!==M.nan){let r=this._getOrReturnCtx(e);return P(r,{code:T.invalid_type,expected:M.nan,received:r.parsedType}),U}return{status:"valid",value:e.data}}};ls.create=t=>new ls({typeName:q.ZodNaN,...Q(t)});var YI=Symbol("zod_brand"),Ga=class extends J{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Za=class t extends J{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?U:o.status==="dirty"?(n.dirty(),Li(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?U:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:q.ZodPipeline})}},Zi=class extends J{_parse(e){let n=this._def.innerType._parse(e),r=i=>(ri(i)&&(i.value=Object.freeze(i.value)),i);return ns(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};Zi.create=(t,e)=>new Zi({innerType:t,typeName:q.ZodReadonly,...Q(e)});function cb(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function hb(t,e={},n){return t?oi.create().superRefine((r,i)=>{let o=t(r);if(o instanceof Promise)return o.then(s=>{if(!s){let a=cb(e,r),l=a.fatal??n??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!o){let s=cb(e,r),a=s.fatal??n??!0;i.addIssue({code:"custom",...s,fatal:a})}}):oi.create()}var XI={object:Rt.lazycreate},q;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(q||(q={}));var QI=(t,e={message:`Input not instance of ${t.name}`})=>hb(n=>n instanceof t,e),gb=ii.create,mb=Mi.create,JI=ls.create,eP=Fi.create,vb=$i.create,tP=Di.create,nP=is.create,rP=Bi.create,iP=Vi.create,oP=oi.create,sP=ur.create,aP=gn.create,lP=os.create,cP=dr.create,uP=Rt.create,dP=Rt.strictCreate,fP=zi.create,pP=Ku.create,hP=Hi.create,gP=Pn.create,mP=Gu.create,vP=ss.create,yP=as.create,_P=Zu.create,wP=ji.create,xP=Ui.create,SP=Wi.create,bP=qi.create,kP=si.create,EP=Jt.create,CP=Xt.create,AP=On.create,TP=Jt.createWithPreprocess,RP=Za.create,IP=()=>gb().optional(),PP=()=>mb().optional(),OP=()=>vb().optional(),NP={string:(t=>ii.create({...t,coerce:!0})),number:(t=>Mi.create({...t,coerce:!0})),boolean:(t=>$i.create({...t,coerce:!0})),bigint:(t=>Fi.create({...t,coerce:!0})),date:(t=>Di.create({...t,coerce:!0}))};var LP=U;var _m=S.union([S.object({type:S.literal("data"),key:S.string(),value:S.string().optional()}),S.object({type:S.literal("css"),value:S.string()}),S.object({type:S.literal("aria"),role:S.string().optional(),label:S.string().optional()}),S.object({type:S.literal("shadow-css"),value:S.string()}),S.object({type:S.literal("ref"),el:S.any()})]),yb=S.object({kind:S.literal("tooltip"),id:S.string(),anchor:_m,content:S.object({title:S.string().optional(),body:S.string()}),placement:S.enum(["top","bottom","left","right","auto"]).optional(),offsetPx:S.number().optional(),blocking:S.boolean().optional(),trigger:S.enum(["immediate","hover","click"]).optional(),dismiss:S.object({onEsc:S.boolean().optional(),closeButton:S.boolean().optional(),timeoutMs:S.number().optional()}).optional()}),_b=S.object({kind:S.literal("highlight"),id:S.string(),anchor:_m,copy:S.string().optional(),ring:S.object({paddingPx:S.number().optional(),radiusPx:S.number().optional()}).optional(),scrim:S.object({opacity:S.number().optional()}).optional(),ringColor:S.string().optional(),blocking:S.boolean().optional(),dismiss:S.object({onClickOutside:S.boolean().optional(),onEsc:S.boolean().optional(),timeoutMs:S.number().optional()}).optional()}),Yu=S.object({id:S.string(),version:S.number(),routes:S.array(S.string()).optional(),steps:S.array(S.union([yb,_b]))});function MP(t){return Yu.parse(t)}var FP=({configUri:t,experiments:e,featureKey:n="smart-canvas-overlay-uri",credentials:r="include"}={})=>async()=>{let i=zu({configUri:t,experiments:e,featureKey:n});if(!i)throw new Error("SmartCanvas overlays: recipe URI missing (env + feature unset).");let o=await fetch(i,{credentials:r});if(!o.ok)throw new Error(`SmartCanvas overlays: failed to fetch recipe (${o.status})`);let s=await o.json();return Yu.parse(s)};var wb="syntro_session_metrics",Ya=class{constructor(e={}){j(this,"metrics",new Map);j(this,"experiments");j(this,"attributePrefix");j(this,"onMetricChange");this.experiments=e.experiments,this.attributePrefix=e.attributePrefix??"session_",this.onMetricChange=e.onMetricChange,this.loadFromStorage()}increment(e,n=1){let i=(this.metrics.get(e)??0)+n;return this.metrics.set(e,i),this.saveToStorage(),this.updateExperimentAttributes(e,i),this.onMetricChange?.(e,i),i}set(e,n){this.metrics.set(e,n),this.saveToStorage(),this.updateExperimentAttributes(e,n),this.onMetricChange?.(e,n)}get(e){return this.metrics.get(e)??0}meetsThreshold(e,n){return this.get(e)>=n}getAll(){return Object.fromEntries(this.metrics)}reset(e){this.metrics.delete(e),this.saveToStorage(),this.updateExperimentAttributes(e,0),this.onMetricChange?.(e,0)}resetAll(){let e=Array.from(this.metrics.keys());this.metrics.clear(),this.saveToStorage();let n={};for(let r of e)n[`${this.attributePrefix}${r}`]=0,this.onMetricChange?.(r,0);this.experiments?.setAttributes?.(n)}setExperiments(e){this.experiments=e,this.syncAllToExperiments()}updateExperimentAttributes(e,n){if(!this.experiments?.setAttributes)return;let r=`${this.attributePrefix}${e}`;this.experiments.setAttributes({[r]:n})}syncAllToExperiments(){if(!this.experiments?.setAttributes)return;let e={};for(let[n,r]of this.metrics)e[`${this.attributePrefix}${n}`]=r;this.experiments.setAttributes(e)}loadFromStorage(){if(!(typeof window>"u"||typeof sessionStorage>"u"))try{let e=sessionStorage.getItem(wb);if(e){let n=JSON.parse(e);for(let[r,i]of Object.entries(n))this.metrics.set(r,i.count)}}catch(e){console.warn("[SessionMetricTracker] Failed to load from sessionStorage:",e)}}saveToStorage(){if(!(typeof window>"u"||typeof sessionStorage>"u"))try{let e={};for(let[n,r]of this.metrics)e[n]={count:r,lastUpdated:Date.now()};sessionStorage.setItem(wb,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function Xu(t={}){return new Ya(t)}var xb=S.object({url:S.string(),routeId:S.string().optional(),title:S.string().optional(),locale:S.string().optional()}),Sb=S.object({url:S.string(),ts:S.number()}),bb=S.object({sessionId:S.string(),startTs:S.number(),pageHistory:S.array(Sb).optional()}),kb=S.object({width:S.number(),height:S.number()}),Eb=S.object({x:S.number(),y:S.number(),w:S.number(),h:S.number()}),Cb=S.object({anchorId:S.string(),present:S.boolean(),visible:S.boolean().optional(),boundingBox:Eb.optional()}),Ab=S.record(S.union([S.number(),S.string(),S.boolean(),S.undefined()])),Tb=S.object({page:xb,session:bb,viewport:kb,anchors:S.array(Cb).optional(),augmented:Ab.optional()});function $P(t){return Tb.safeParse(t)}function DP(){let t=Date.now();return{page:{url:typeof window<"u"?window.location.href:"",title:typeof document<"u"?document.title:void 0},session:{sessionId:"",startTs:t,pageHistory:[]},viewport:{width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0}}}function wm(t,e){if(!e)return;let n;try{n=new URL(t).pathname}catch{n=t}if(e.exclude){for(let r of e.exclude)if(Rb(n,r))return}if(e.include){for(let r of e.include)if(Rb(n,r))return r;return}return n}function Rb(t,e){let n=t.replace(/\/$/,"")||"/",r=e.replace(/\/$/,"")||"/";if(n===r)return!0;let i=r.replace(/:[^/]+/g,"[^/]+").replace(/\*/g,".*");return new RegExp(`^${i}$`).test(n)}var Xa=class{constructor(e={}){j(this,"context");j(this,"previousContext");j(this,"listeners",new Set);j(this,"telemetry");j(this,"routes");j(this,"cleanupFns",[]);if(this.telemetry=e.telemetry,this.routes=e.routes,this.context=DP(),this.previousContext={...this.context},e.telemetry?.getSessionId){let n=e.telemetry.getSessionId();n&&(this.context.session.sessionId=n)}e.initialPageHistory&&(this.context.session.pageHistory=e.initialPageHistory),this.context.page.routeId=wm(this.context.page.url,this.routes),this.addPageToHistory(this.context.page.url),typeof window<"u"&&this.setupBrowserListeners()}get(){return{...this.context}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setRoutes(e){this.routes=e;let n=wm(this.context.page.url,this.routes);n!==this.context.page.routeId&&this.updateContext({page:{...this.context.page,routeId:n}})}setAnchors(e){this.updateContext({anchors:e})}setSessionId(e){e!==this.context.session.sessionId&&this.updateContext({session:{...this.context.session,sessionId:e}})}destroy(){for(let e of this.cleanupFns)e();this.cleanupFns=[],this.listeners.clear()}setupBrowserListeners(){let e,n=()=>{clearTimeout(e),e=setTimeout(()=>{this.updateViewport()},100)};window.addEventListener("resize",n),this.cleanupFns.push(()=>window.removeEventListener("resize",n));let r=()=>{this.updatePage()};window.addEventListener("popstate",r),this.cleanupFns.push(()=>window.removeEventListener("popstate",r));let i=history.pushState.bind(history),o=history.replaceState.bind(history);history.pushState=(...s)=>{i(...s),this.updatePage()},history.replaceState=(...s)=>{o(...s),this.updatePage()},this.cleanupFns.push(()=>{history.pushState=i,history.replaceState=o})}updateViewport(){let e={width:window.innerWidth,height:window.innerHeight};(e.width!==this.context.viewport.width||e.height!==this.context.viewport.height)&&this.updateContext({viewport:e})}updatePage(){let e=window.location.href,n=document.title,r=wm(e,this.routes),i={url:e,title:n,routeId:r};(i.url!==this.context.page.url||i.title!==this.context.page.title||i.routeId!==this.context.page.routeId)&&(i.url!==this.context.page.url&&this.addPageToHistory(i.url),this.updateContext({page:i}))}addPageToHistory(e){let n={url:e,ts:Date.now()},r=[...this.context.session.pageHistory||[],n];r.length>50&&r.shift(),this.context.session.pageHistory=r}updateContext(e){this.previousContext={...this.context},this.context={...this.context,...e},this.notifyListeners()}notifyListeners(){for(let e of this.listeners)try{e(this.context,this.previousContext)}catch(n){console.error("[ContextManager] Listener error:",n)}}};function Qu(t={}){return new Xa(t)}var xm=S.enum(["posthog","canvas","derived"]),Ib=S.object({ts:S.number(),name:S.string(),source:xm,props:S.record(S.unknown()).optional(),schemaVersion:S.string()}),Pb=S.object({names:S.array(S.string()).optional(),patterns:S.array(S.string()).optional(),sources:S.array(xm).optional()});function BP(t){return Ib.safeParse(t)}function VP(t){return Pb.safeParse(t)}function Sm(t,e){return e?!(e.names&&e.names.length>0&&!e.names.includes(t.name)||e.patterns&&e.patterns.length>0&&!e.patterns.some(r=>{try{return new RegExp(r).test(t.name)}catch{return!1}})||e.sources&&e.sources.length>0&&!e.sources.includes(t.source)):!0}var Qa=class{constructor(e={}){j(this,"subscriptions",new Set);j(this,"history",[]);j(this,"maxHistorySize");this.maxHistorySize=e.maxHistorySize??100}subscribe(e,n){let r,i;typeof e=="function"?(r=void 0,i=e):(r=e,i=n);let o={filter:r,callback:i};return this.subscriptions.add(o),()=>{this.subscriptions.delete(o)}}publish(e,n,r="canvas"){let i={ts:Date.now(),name:e,source:r,props:n,schemaVersion:vi};this.publishEvent(i)}publishEvent(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift();for(let n of this.subscriptions)if(Sm(e,n.filter))try{n.callback(e)}catch(r){console.error("[EventBus] Subscriber error:",r)}}getRecent(e,n){let r=this.history;return e&&(r=r.filter(i=>Sm(i,e))),n&&n>0&&(r=r.slice(-n)),r}hasRecentEvent(e,n,r){let i=Date.now()-n;return this.history.some(o=>o.name===e&&o.ts>=i&&(r===void 0||o.source===r))}countRecentEvents(e,n){let r=this.history.filter(i=>Sm(i,e));if(n!==void 0){let i=Date.now()-n;r=r.filter(o=>o.ts>=i)}return r.length}clearHistory(){this.history=[]}getSubscriberCount(){return this.subscriptions.size}};function cs(t={}){return new Qa(t)}var Ob={$autocapture:"ui.click",$click:be.UI_CLICK,$scroll:be.UI_SCROLL,$input:be.UI_INPUT,$change:be.UI_CHANGE,$submit:be.UI_SUBMIT,$pageview:be.NAV_PAGE_VIEW,$pageleave:be.NAV_PAGE_LEAVE,$session_start:"session.start",$identify:"user.identify"};function zP(t){let e=t.event;if(Ob[e])return Ob[e];if(e==="$autocapture"){let n=t.properties?.$tag_name,r=t.properties?.$event_type;return r==="submit"?be.UI_SUBMIT:r==="change"?be.UI_CHANGE:n==="input"||n==="textarea"?be.UI_INPUT:be.UI_CLICK}return typeof e!="string"?"posthog.unknown":e.startsWith("$")?e.replace("$","posthog."):`posthog.${e}`}function HP(t){let e={},n=t.properties||{};return n.$tag_name&&(e.tagName=n.$tag_name),n.$el_text&&(e.elementText=n.$el_text),n.$elements&&(e.elements=n.$elements),n.$current_url&&(e.url=n.$current_url),n.$pathname&&(e.pathname=n.$pathname),n.$host&&(e.host=n.$host),n.$viewport_width&&(e.viewportWidth=n.$viewport_width),n.$viewport_height&&(e.viewportHeight=n.$viewport_height),n.$session_id&&(e.sessionId=n.$session_id),n.$scroll_depth&&(e.scrollDepth=n.$scroll_depth),n.$scroll_percentage&&(e.scrollPercentage=n.$scroll_percentage),e.originalEvent=t.event,e}function bm(t){let e;return typeof t.timestamp=="number"?e=t.timestamp:typeof t.timestamp=="string"?e=new Date(t.timestamp).getTime():e=Date.now(),{ts:e,name:zP(t),source:"posthog",props:HP(t),schemaVersion:vi}}function km(t){let e=t.event;return!(typeof e!="string"||["$feature_flag_called","$feature_flags","$groups","$groupidentify","$set","$set_once","$unset","$create_alias","$capture_metrics","$performance_event","$web_vitals","$exception","$dead_click","$heatmap"].includes(e))}function Ju(t){return(e,n)=>{if(typeof e!="string")return;let r={event:e,properties:n,timestamp:Date.now()};if(km(r)){let i=bm(r);t(i)}}}var Nb=S.object({value:S.unknown(),expiresAt:S.number().optional()}),Lb=S.object({count:S.number(),resetAt:S.number().optional()});function jP(t){return Nb.safeParse(t)}function UP(t){return Lb.safeParse(t)}var Ja="dismissed:";function Mb(t,e){return{mark(n,r=!1){let i=Ja+n;(r?e:t).set(i,!0)},isDismissed(n){let r=Ja+n;return t.has(r)||e.has(r)},clear(n){let r=Ja+n;t.remove(r),e.remove(r)},clearAll(){for(let n of t.keys())n.startsWith(Ja)&&t.remove(n);for(let n of e.keys())n.startsWith(Ja)&&e.remove(n)}}}var Em="cooldown:";function Fb(t){return{set(e,n){let r=Em+e,i=Date.now()+n;t.set(r,i)},isActive(e){return this.remaining(e)>0},remaining(e){let n=Em+e,r=t.get(n);if(r===void 0)return 0;let i=r-Date.now();return i<=0?(t.remove(n),0):i},clear(e){let n=Em+e;t.remove(n)}}}var Cm="freq:";function $b(t){function e(n){let r=Cm+n,i=t.get(r);if(i){if(i.resetAt&&Date.now()>=i.resetAt){t.remove(r);return}return i}}return{increment(n,r){let i=Cm+n,o=e(n),s=(o?.count??0)+1,a={count:s,resetAt:o?.resetAt??(r?Date.now()+r:void 0)};return t.set(i,a),s},count(n){return e(n)?.count??0},reset(n){let r=Cm+n;t.remove(r)},hasReachedLimit(n,r){return this.count(n)>=r}}}var WP="syntro";function Am(t,e){let n=`${e}:`;return{get(r){if(t)try{let i=t.getItem(n+r);if(!i)return;let o=JSON.parse(i);if(o.expiresAt&&Date.now()>=o.expiresAt){t.removeItem(n+r);return}return o.value}catch{return}},set(r,i,o){if(t)try{let s={value:i,expiresAt:o?Date.now()+o:void 0};t.setItem(n+r,JSON.stringify(s))}catch(s){console.warn("[StateStore] Failed to save:",s)}},remove(r){t&&t.removeItem(n+r)},has(r){return t?this.get(r)!==void 0:!1},keys(){if(!t)return[];let r=[];for(let i=0;i<t.length;i++){let o=t.key(i);o?.startsWith(n)&&r.push(o.slice(n.length))}return r},clear(){if(!t)return;let r=this.keys();for(let i of r)t.removeItem(n+i)}}}function Tm(t){let e=new Map,n=`${t}:`;return{get(r){let i=e.get(n+r);if(i){if(i.expiresAt&&Date.now()>=i.expiresAt){e.delete(n+r);return}return i.value}},set(r,i,o){e.set(n+r,{value:i,expiresAt:o?Date.now()+o:void 0})},remove(r){e.delete(n+r)},has(r){return this.get(r)!==void 0},keys(){let r=[];for(let i of e.keys())i.startsWith(n)&&r.push(i.slice(n.length));return r},clear(){for(let r of e.keys())r.startsWith(n)&&e.delete(r)}}}var el=class{constructor(e={}){j(this,"session");j(this,"user");j(this,"dismissals");j(this,"cooldowns");j(this,"frequency");j(this,"namespace");j(this,"namespacedStorages",new Map);this.namespace=e.namespace??WP,typeof window<"u"?(this.session=Am(typeof sessionStorage<"u"?sessionStorage:void 0,this.namespace),this.user=Am(typeof localStorage<"u"?localStorage:void 0,this.namespace)):(this.session=Tm(this.namespace),this.user=Tm(this.namespace)),this.dismissals=Mb(this.session,this.user),this.cooldowns=Fb(this.user),this.frequency=$b(this.session)}ns(e){let n=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(n)){let r=typeof window<"u"&&typeof sessionStorage<"u"?Am(sessionStorage,n):Tm(n);this.namespacedStorages.set(n,r)}return this.namespacedStorages.get(n)}};function ed(t={}){return new el(t)}var Db=S.object({type:S.literal("page_url"),url:S.string()}),Bb=S.object({type:S.literal("route"),routeId:S.string()}),Vb=S.object({type:S.literal("anchor_visible"),anchorId:S.string(),state:S.enum(["visible","present","absent"])}),zb=S.object({type:S.literal("event_occurred"),eventName:S.string(),withinMs:S.number().optional()}),Hb=S.object({type:S.literal("state_equals"),key:S.string(),value:S.unknown()}),jb=S.object({type:S.literal("viewport"),minWidth:S.number().optional(),maxWidth:S.number().optional(),minHeight:S.number().optional(),maxHeight:S.number().optional()}),Ub=S.object({type:S.literal("session_metric"),key:S.string(),operator:S.enum(["gte","lte","eq","gt","lt"]),threshold:S.number()}),Wb=S.object({type:S.literal("dismissed"),key:S.string(),inverted:S.boolean().optional()}),qb=S.object({type:S.literal("cooldown_active"),key:S.string(),inverted:S.boolean().optional()}),Kb=S.object({type:S.literal("frequency_limit"),key:S.string(),limit:S.number(),inverted:S.boolean().optional()}),Rm=S.discriminatedUnion("type",[Db,Bb,Vb,zb,Hb,jb,Ub,Wb,qb,Kb]),Gb=S.object({conditions:S.array(Rm),value:S.unknown()}),Zb=S.object({type:S.literal("rules"),rules:S.array(Gb),default:S.unknown()}),Yb=S.object({type:S.literal("score"),field:S.string(),threshold:S.number(),above:S.unknown(),below:S.unknown()}),Xb=S.object({type:S.literal("model"),modelId:S.string(),inputs:S.array(S.string()),outputMapping:S.record(S.unknown()),default:S.unknown()}),Qb=S.object({type:S.literal("external"),endpoint:S.string(),method:S.enum(["GET","POST"]).optional(),default:S.unknown(),timeoutMs:S.number().optional()}),Im=S.discriminatedUnion("type",[Zb,Yb,Xb,Qb]),Jb=S.object({include:S.array(S.string()).optional(),exclude:S.array(S.string()).optional()}),ek=S.object({routes:Jb.optional(),strategy:Im.optional()});function qP(t){return Rm.safeParse(t)}function KP(t){return Im.safeParse(t)}function GP(t){return ek.safeParse(t)}function Pm(t,e){let{context:n,state:r,events:i}=e;switch(t.type){case"page_url":{let{url:o}=t,s=n.page.url,a=o.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*");return new RegExp(`^${a}$`).test(s)}case"route":return n.page.routeId===t.routeId;case"anchor_visible":{let o=n.anchors?.find(s=>s.anchorId===t.anchorId);switch(t.state){case"visible":return o?.visible===!0;case"present":return o?.present===!0;case"absent":return!o?.present;default:return!1}}case"event_occurred":{if(!i)return!1;let o=t.withinMs??6e4;return i.hasRecentEvent(t.eventName,o)}case"state_equals":return!1;case"viewport":{let{width:o,height:s}=n.viewport;return!(t.minWidth!==void 0&&o<t.minWidth||t.maxWidth!==void 0&&o>t.maxWidth||t.minHeight!==void 0&&s<t.minHeight||t.maxHeight!==void 0&&s>t.maxHeight)}case"session_metric":{if(!r)return!1;let o=r.getSessionMetric(t.key),{operator:s,threshold:a}=t;switch(s){case"gte":return o>=a;case"lte":return o<=a;case"eq":return o===a;case"gt":return o>a;case"lt":return o<a;default:return!1}}case"dismissed":{if(!r)return t.inverted??!1;let o=r.isDismissed(t.key);return t.inverted?!o:o}case"cooldown_active":{if(!r)return t.inverted??!1;let o=r.isCooldownActive(t.key);return t.inverted?!o:o}case"frequency_limit":{if(!r)return t.inverted??!1;let s=r.getFrequencyCount(t.key)>=t.limit;return t.inverted?!s:s}default:return console.warn("[RuleStrategy] Unknown condition type:",t.type),!1}}function Om(t,e){let n=[];for(let r of t.conditions){let i=Pm(r,e);if(n.push({condition:r,result:i}),!i)return{matched:!1,conditionResults:n}}return{matched:!0,conditionResults:n}}function tl(t,e){for(let n=0;n<t.rules.length;n++){let r=t.rules[n],{matched:i,conditionResults:o}=Om(r,e);if(i)return{value:r.value,isFallback:!1,matchInfo:{strategyType:"rules",matchedRuleIndex:n,evaluatedConditions:o}}}return{value:t.default,isFallback:!0,matchInfo:{strategyType:"rules"}}}function nl(t,e){let{context:n}=e,r=n.augmented?.[t.field];return r===void 0||typeof r!="number"?{value:t.below,isFallback:!0,matchInfo:{strategyType:"score"}}:{value:r>=t.threshold?t.above:t.below,isFallback:!1,matchInfo:{strategyType:"score"}}}function tk(t,e){let{state:n,events:r,sessionMetrics:i}=e;return{context:t,state:n?{isDismissed:o=>n.dismissals.isDismissed(o),isCooldownActive:o=>n.cooldowns.isActive(o),getFrequencyCount:o=>n.frequency.count(o),getSessionMetric:o=>i?.get(o)??0}:void 0,events:r?{hasRecentEvent:(o,s)=>r.hasRecentEvent(o,s)}:void 0}}async function Nm(t,e,n={}){let r=tk(e,n);switch(t.type){case"rules":return tl(t,r);case"score":return nl(t,r);case"model":return{value:t.default,isFallback:!0,matchInfo:{strategyType:"model"}};case"external":return{value:t.default,isFallback:!0,matchInfo:{strategyType:"external"}};default:return console.warn("[DecisionEngine] Unknown strategy type:",t.type),{value:void 0,isFallback:!0,matchInfo:{strategyType:t.type}}}}function Lm(t,e,n={}){let r=tk(e,n);switch(t.type){case"rules":return tl(t,r);case"score":return nl(t,r);case"model":case"external":return{value:t.default,isFallback:!0,matchInfo:{strategyType:t.type}};default:return{value:void 0,isFallback:!0,matchInfo:{strategyType:t.type}}}}function td(t){return{evaluate:(e,n)=>Nm(e,n,t),evaluateSync:(e,n)=>Lm(e,n,t)}}var ZP=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button"]);function Mm(t){if(typeof window.Sanitizer=="function")try{let a=new window.Sanitizer({}).sanitizeToFragment(t),l=document.createElement("div");return l.append(a),l.innerHTML}catch{}let n=document.createElement("template");n.innerHTML=t;let r=n.content,i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,null),o=[];for(;i.nextNode();){let s=i.currentNode,a=s.tagName.toLowerCase();if(!ZP.has(a)){o.push(s);continue}for(let l of Array.from(s.attributes)){let c=l.name.toLowerCase(),u=l.value.trim().toLowerCase(),f=c.startsWith("on"),h=(c==="href"||c==="src")&&u.startsWith("javascript:");(f||h)&&s.removeAttribute(l.name)}}for(let s of o){for(;s.firstChild;)s.parentNode?.insertBefore(s.firstChild,s);s.remove()}return n.innerHTML}var nk=async(t,e)=>{let n=e.resolveAnchor(t.anchorId);if(!n)throw new Error(`Anchor not found: ${t.anchorId}`);let r=Mm(t.html),i=document.createElement("div");i.setAttribute("data-syntro-action-id",e.generateId()),i.innerHTML=r;let o=null;switch(t.position){case"before":n.insertAdjacentElement("beforebegin",i);break;case"after":n.insertAdjacentElement("afterend",i);break;case"prepend":n.insertBefore(i,n.firstChild);break;case"append":n.appendChild(i);break;case"replace":o=n.innerHTML,n.replaceWith(i);break}return e.publishEvent("action.applied",{id:e.generateId(),kind:"content:insertHtml",anchorId:t.anchorId,position:t.position}),{cleanup:()=>{if(t.position==="replace"&&o!==null){let s=document.createElement(n.tagName);s.innerHTML=o,Array.from(n.attributes).forEach(a=>{s.setAttribute(a.name,a.value)}),i.replaceWith(s)}else i.remove()},updateFn:s=>{"html"in s&&typeof s.html=="string"&&(i.innerHTML=Mm(s.html))}}},rk=async(t,e)=>{let n=e.resolveAnchor(t.anchorId);if(!n)throw new Error(`Anchor not found: ${t.anchorId}`);let r=n.textContent??"";return n.textContent=t.text,e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setText",anchorId:t.anchorId}),{cleanup:()=>{n.textContent=r},updateFn:i=>{"text"in i&&typeof i.text=="string"&&(n.textContent=i.text)}}},ik=async(t,e)=>{let n=e.resolveAnchor(t.anchorId);if(!n)throw new Error(`Anchor not found: ${t.anchorId}`);if(["onclick","onerror","onload","onmouseover","onfocus","onblur"].includes(t.attr.toLowerCase())||t.attr.startsWith("on"))throw new Error(`Dangerous attribute not allowed: ${t.attr}`);let i=n.getAttribute(t.attr),o=n.hasAttribute(t.attr);return n.setAttribute(t.attr,t.value),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setAttr",anchorId:t.anchorId,attr:t.attr}),{cleanup:()=>{o&&i!==null?n.setAttribute(t.attr,i):n.removeAttribute(t.attr)},updateFn:s=>{"value"in s&&typeof s.value=="string"&&n.setAttribute(t.attr,s.value)}}},ok=async(t,e)=>{let n=e.resolveAnchor(t.anchorId);if(!n)throw new Error(`Anchor not found: ${t.anchorId}`);let r=n.classList.contains(t.className);return n.classList.add(t.className),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:addClass",anchorId:t.anchorId,className:t.className}),{cleanup:()=>{r||n.classList.remove(t.className)}}},sk=async(t,e)=>{let n=e.resolveAnchor(t.anchorId);if(!n)throw new Error(`Anchor not found: ${t.anchorId}`);let r=n.classList.contains(t.className);return n.classList.remove(t.className),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:removeClass",anchorId:t.anchorId,className:t.className}),{cleanup:()=>{r&&n.classList.add(t.className)}}},ak=async(t,e)=>{let n=e.resolveAnchor(t.anchorId);if(!n)throw new Error(`Anchor not found: ${t.anchorId}`);let r=new Map;for(let i of Object.keys(t.styles)){let o=n.style.getPropertyValue(i);r.set(i,o)}for(let[i,o]of Object.entries(t.styles))n.style.setProperty(i,o);return e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setStyle",anchorId:t.anchorId,styles:Object.keys(t.styles)}),{cleanup:()=>{for(let[i,o]of r)o?n.style.setProperty(i,o):n.style.removeProperty(i)},updateFn:i=>{if("styles"in i&&typeof i.styles=="object"&&i.styles)for(let[o,s]of Object.entries(i.styles))n.style.setProperty(o,s)}}},Fm=[{kind:"content:insertHtml",executor:nk},{kind:"content:setText",executor:rk},{kind:"content:setAttr",executor:ik},{kind:"content:addClass",executor:ok},{kind:"content:removeClass",executor:sk},{kind:"content:setStyle",executor:ak}],lk={id:"adaptive-content",version:"1.0.0",name:"Content",description:"DOM manipulation for text, attributes, and styles",executors:Fm};var ck=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function uk(t,e,n){let r=n?.paddingPx??12,i=n?.radiusPx??12,o=Math.min(Math.max(n?.scrimOpacity??.55,0),1),s=n?.ringColor??"var(--syntro-ring, #5b8cff)",a=n?.blocking??!1,l=n?.onClickOutside??!0,c=n?.onEsc??!0,u=getComputedStyle(document.documentElement),f=u.getPropertyValue("--syntro-spotlight-backdrop").trim(),h=u.getPropertyValue("--syntro-ring").trim(),g=document.createElement("div");g.className="syntro-spotlight-scrim";let v=a||l;Object.assign(g.style,{position:"fixed",inset:"0",zIndex:"2147483646",pointerEvents:v?"auto":"none",background:f||`rgba(2, 6, 23, ${o})`,transition:"opacity 220ms ease",opacity:"0"}),e.appendChild(g),requestAnimationFrame(()=>g.style.opacity="1");let _=document.createElement("div");_.className="syntro-spotlight-ring",Object.assign(_.style,{position:"fixed",pointerEvents:"none",borderRadius:`${i}px`,border:`2px solid ${s||h||"#5b8cff"}`,boxShadow:"0 0 0 4px rgba(255,255,255,0.35)",zIndex:"2147483647",transition:"all 220ms cubic-bezier(0.16,1,0.3,1)"}),e.appendChild(_);let x=[];if(!ck)for(let I=0;I<4;I++){let A=document.createElement("div");A.style.position="fixed",A.style.background="inherit",x.push(A),g.appendChild(A)}let d=I=>{g.style.clipPath=I,g.style.webkitClipPath=I},p=()=>{let I=t.getBoundingClientRect(),A=Math.max(0,I.left-r),H=Math.max(0,I.top-r),K=Math.min(window.innerWidth,I.width+r*2),Y=Math.min(window.innerHeight,I.height+r*2);if(Object.assign(_.style,{left:`${A}px`,top:`${H}px`,width:`${K}px`,height:`${Y}px`}),ck){let W=window.innerWidth,le=window.innerHeight,B=Math.min(i,K/2,Y/2),X=`M 0 0 L ${W} 0 L ${W} ${le} L 0 ${le} Z`,V=`M ${A+B} ${H} A ${B} ${B} 0 0 0 ${A} ${H+B} L ${A} ${H+Y-B} A ${B} ${B} 0 0 0 ${A+B} ${H+Y} L ${A+K-B} ${H+Y} A ${B} ${B} 0 0 0 ${A+K} ${H+Y-B} L ${A+K} ${H+B} A ${B} ${B} 0 0 0 ${A+K-B} ${H} L ${A+B} ${H} Z`;d(`path('${X} ${V}')`)}else{let[W,le,B,X]=x;Object.assign(W.style,{left:"0px",top:"0px",width:"100vw",height:`${H}px`}),Object.assign(B.style,{left:"0px",top:`${H+Y}px`,width:"100vw",height:`${Math.max(0,window.innerHeight-(H+Y))}px`}),Object.assign(X.style,{left:"0px",top:`${H}px`,width:`${A}px`,height:`${Y}px`}),Object.assign(le.style,{left:`${A+K}px`,top:`${H}px`,width:`${Math.max(0,window.innerWidth-(A+K))}px`,height:`${Y}px`})}},m=new ResizeObserver(()=>requestAnimationFrame(p));m.observe(t);let y=()=>requestAnimationFrame(p),w=()=>requestAnimationFrame(p);window.addEventListener("scroll",y,!0),window.addEventListener("resize",w);let b=I=>{I.key==="Escape"&&c&&E.destroy()};c&&window.addEventListener("keydown",b);let k=I=>{a?(I.preventDefault(),I.stopPropagation()):l&&E.destroy()};g.addEventListener("click",k);let E={destroy(){m.disconnect(),window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",w),c&&window.removeEventListener("keydown",b),g.removeEventListener("click",k),g.style.opacity="0",setTimeout(()=>{g.remove(),_.remove()},220)}};return p(),E}var pk=["top","right","bottom","left"];var en=Math.min,ct=Math.max,Nn=Math.round,Ln=Math.floor,Pe=t=>({x:t,y:t}),YP={left:"right",right:"left",bottom:"top",top:"bottom"},XP={start:"end",end:"start"};function rd(t,e,n){return ct(t,en(e,n))}function Yi(t,e){return typeof t=="function"?t(e):t}function ai(t){return t.split("-")[0]}function us(t){return t.split("-")[1]}function $m(t){return t==="x"?"y":"x"}function id(t){return t==="y"?"height":"width"}var QP=new Set(["top","bottom"]);function fr(t){return QP.has(ai(t))?"y":"x"}function od(t){return $m(fr(t))}function hk(t,e,n){n===void 0&&(n=!1);let r=us(t),i=od(t),o=id(i),s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=rl(s)),[s,rl(s)]}function gk(t){let e=rl(t);return[nd(t),e,nd(e)]}function nd(t){return t.replace(/start|end/g,e=>XP[e])}var dk=["left","right"],fk=["right","left"],JP=["top","bottom"],e2=["bottom","top"];function t2(t,e,n){switch(t){case"top":case"bottom":return n?e?fk:dk:e?dk:fk;case"left":case"right":return e?JP:e2;default:return[]}}function mk(t,e,n,r){let i=us(t),o=t2(ai(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(nd)))),o}function rl(t){return t.replace(/left|right|bottom|top/g,e=>YP[e])}function n2(t){return{top:0,right:0,bottom:0,left:0,...t}}function Dm(t){return typeof t!="number"?n2(t):{top:t,right:t,bottom:t,left:t}}function Mn(t){let{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function vk(t,e,n){let{reference:r,floating:i}=t,o=fr(e),s=od(e),a=id(s),l=ai(e),c=o==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2,g;switch(l){case"top":g={x:u,y:r.y-i.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-i.width,y:f};break;default:g={x:r.x,y:r.y}}switch(us(e)){case"start":g[s]-=h*(n&&c?-1:1);break;case"end":g[s]+=h*(n&&c?-1:1);break}return g}var sd=async(t,e,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e)),c=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=vk(c,r,l),h=r,g={},v=0;for(let _=0;_<a.length;_++){let{name:x,fn:d}=a[_],{x:p,y:m,data:y,reset:w}=await d({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:g,rects:c,platform:s,elements:{reference:t,floating:e}});u=p??u,f=m??f,g={...g,[x]:{...g[x],...y}},w&&v<=50&&(v++,typeof w=="object"&&(w.placement&&(h=w.placement),w.rects&&(c=w.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):w.rects),{x:u,y:f}=vk(c,h,l)),_=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:g}};async function ds(t,e){var n;e===void 0&&(e={});let{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:g=0}=Yi(e,t),v=Dm(g),x=a[h?f==="floating"?"reference":"floating":f],d=Mn(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(x)))==null||n?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),p=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,m=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),y=await(o.isElement==null?void 0:o.isElement(m))?await(o.getScale==null?void 0:o.getScale(m))||{x:1,y:1}:{x:1,y:1},w=Mn(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:p,offsetParent:m,strategy:l}):p);return{top:(d.top-w.top+v.top)/y.y,bottom:(w.bottom-d.bottom+v.bottom)/y.y,left:(d.left-w.left+v.left)/y.x,right:(w.right-d.right+v.right)/y.x}}var Bm=t=>({name:"arrow",options:t,async fn(e){let{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=Yi(t,e)||{};if(c==null)return{};let f=Dm(u),h={x:n,y:r},g=od(i),v=id(g),_=await s.getDimensions(c),x=g==="y",d=x?"top":"left",p=x?"bottom":"right",m=x?"clientHeight":"clientWidth",y=o.reference[v]+o.reference[g]-h[g]-o.floating[v],w=h[g]-o.reference[g],b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c)),k=b?b[m]:0;(!k||!await(s.isElement==null?void 0:s.isElement(b)))&&(k=a.floating[m]||o.floating[v]);let E=y/2-w/2,I=k/2-_[v]/2-1,A=en(f[d],I),H=en(f[p],I),K=A,Y=k-_[v]-H,W=k/2-_[v]/2+E,le=rd(K,W,Y),B=!l.arrow&&us(i)!=null&&W!==le&&o.reference[v]/2-(W<K?A:H)-_[v]/2<0,X=B?W<K?W-K:W-Y:0;return{[g]:h[g]+X,data:{[g]:le,centerOffset:W-le-X,...B&&{alignmentOffset:X}},reset:B}}});var ad=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;let{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:_=!0,...x}=Yi(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let d=ai(i),p=fr(a),m=ai(a)===a,y=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(m||!_?[rl(a)]:gk(a)),b=v!=="none";!h&&b&&w.push(...mk(a,_,v,y));let k=[a,...w],E=await ds(e,x),I=[],A=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&I.push(E[d]),f){let W=hk(i,s,y);I.push(E[W[0]],E[W[1]])}if(A=[...A,{placement:i,overflows:I}],!I.every(W=>W<=0)){var H,K;let W=(((H=o.flip)==null?void 0:H.index)||0)+1,le=k[W];if(le&&(!(f==="alignment"?p!==fr(le):!1)||A.every(V=>fr(V.placement)===p?V.overflows[0]>0:!0)))return{data:{index:W,overflows:A},reset:{placement:le}};let B=(K=A.filter(X=>X.overflows[0]<=0).sort((X,V)=>X.overflows[1]-V.overflows[1])[0])==null?void 0:K.placement;if(!B)switch(g){case"bestFit":{var Y;let X=(Y=A.filter(V=>{if(b){let Z=fr(V.placement);return Z===p||Z==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(Z=>Z>0).reduce((Z,vt)=>Z+vt,0)]).sort((V,Z)=>V[1]-Z[1])[0])==null?void 0:Y[0];X&&(B=X);break}case"initialPlacement":B=a;break}if(i!==B)return{reset:{placement:B}}}return{}}}};function yk(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function _k(t){return pk.some(e=>t[e]>=0)}var Vm=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:n}=e,{strategy:r="referenceHidden",...i}=Yi(t,e);switch(r){case"referenceHidden":{let o=await ds(e,{...i,elementContext:"reference"}),s=yk(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:_k(s)}}}case"escaped":{let o=await ds(e,{...i,altBoundary:!0}),s=yk(o,n.floating);return{data:{escapedOffsets:s,escaped:_k(s)}}}default:return{}}}}};var r2=new Set(["left","top"]);async function i2(t,e){let{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=ai(n),a=us(n),l=fr(n)==="y",c=r2.has(s)?-1:1,u=o&&l?-1:1,f=Yi(e,t),{mainAxis:h,crossAxis:g,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*u,y:h*c}:{x:h*c,y:g*u}}var ld=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;let{x:i,y:o,placement:s,middlewareData:a}=e,l=await i2(e,t);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},cd=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:d,y:p}=x;return{x:d,y:p}}},...l}=Yi(t,e),c={x:n,y:r},u=await ds(e,l),f=fr(ai(i)),h=$m(f),g=c[h],v=c[f];if(o){let x=h==="y"?"top":"left",d=h==="y"?"bottom":"right",p=g+u[x],m=g-u[d];g=rd(p,g,m)}if(s){let x=f==="y"?"top":"left",d=f==="y"?"bottom":"right",p=v+u[x],m=v-u[d];v=rd(p,v,m)}let _=a.fn({...e,[h]:g,[f]:v});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[h]:o,[f]:s}}}}}};function ud(){return typeof window<"u"}function mn(t){return xk(t)?(t.nodeName||"").toLowerCase():"#document"}function Oe(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function $e(t){var e;return(e=(xk(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function xk(t){return ud()?t instanceof Node||t instanceof Oe(t).Node:!1}function Ne(t){return ud()?t instanceof Element||t instanceof Oe(t).Element:!1}function Ve(t){return ud()?t instanceof HTMLElement||t instanceof Oe(t).HTMLElement:!1}function wk(t){return!ud()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Oe(t).ShadowRoot}var o2=new Set(["inline","contents"]);function $n(t){let{overflow:e,overflowX:n,overflowY:r,display:i}=Le(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!o2.has(i)}var s2=new Set(["table","td","th"]);function dd(t){return s2.has(mn(t))}var a2=[":popover-open",":modal"];function pr(t){return a2.some(e=>{try{return t.matches(e)}catch{return!1}})}var l2=["transform","translate","scale","rotate","perspective"],c2=["transform","translate","scale","rotate","perspective","filter"],u2=["paint","layout","strict","content"];function Xi(t){let e=Qi(),n=Ne(t)?Le(t):t;return l2.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||c2.some(r=>(n.willChange||"").includes(r))||u2.some(r=>(n.contain||"").includes(r))}function fd(t){let e=mt(t);for(;Ve(e)&&!tn(e);){if(Xi(e))return e;if(pr(e))return null;e=mt(e)}return null}function Qi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var d2=new Set(["html","body","#document"]);function tn(t){return d2.has(mn(t))}function Le(t){return Oe(t).getComputedStyle(t)}function Dn(t){return Ne(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function mt(t){if(mn(t)==="html")return t;let e=t.assignedSlot||t.parentNode||wk(t)&&t.host||$e(t);return wk(e)?e.host:e}function Sk(t){let e=mt(t);return tn(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ve(e)&&$n(e)?e:Sk(e)}function Fn(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);let i=Sk(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Oe(i);if(o){let a=Ji(s);return e.concat(s,s.visualViewport||[],$n(i)?i:[],a&&n?Fn(a):[])}return e.concat(i,Fn(i,[],n))}function Ji(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Ck(t){let e=Le(t),n=parseFloat(e.width)||0,r=parseFloat(e.height)||0,i=Ve(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,a=Nn(n)!==o||Nn(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Hm(t){return Ne(t)?t:t.contextElement}function fs(t){let e=Hm(t);if(!Ve(e))return Pe(1);let n=e.getBoundingClientRect(),{width:r,height:i,$:o}=Ck(e),s=(o?Nn(n.width):n.width)/r,a=(o?Nn(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var m2=Pe(0);function Ak(t){let e=Oe(t);return!Qi()||!e.visualViewport?m2:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function v2(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Oe(t)?!1:e}function eo(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);let i=t.getBoundingClientRect(),o=Hm(t),s=Pe(1);e&&(r?Ne(r)&&(s=fs(r)):s=fs(t));let a=v2(o,n,r)?Ak(o):Pe(0),l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,f=i.height/s.y;if(o){let h=Oe(o),g=r&&Ne(r)?Oe(r):r,v=h,_=Ji(v);for(;_&&r&&g!==v;){let x=fs(_),d=_.getBoundingClientRect(),p=Le(_),m=d.left+(_.clientLeft+parseFloat(p.paddingLeft))*x.x,y=d.top+(_.clientTop+parseFloat(p.paddingTop))*x.y;l*=x.x,c*=x.y,u*=x.x,f*=x.y,l+=m,c+=y,v=Oe(_),_=Ji(v)}}return Mn({width:u,height:f,x:l,y:c})}function pd(t,e){let n=Dn(t).scrollLeft;return e?e.left+n:eo($e(t)).left+n}function Tk(t,e){let n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-pd(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function y2(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t,o=i==="fixed",s=$e(r),a=e?pr(e.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Pe(1),u=Pe(0),f=Ve(r);if((f||!f&&!o)&&((mn(r)!=="body"||$n(s))&&(l=Dn(r)),Ve(r))){let g=eo(r);c=fs(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}let h=s&&!f&&!o?Tk(s,l):Pe(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function _2(t){return Array.from(t.getClientRects())}function w2(t){let e=$e(t),n=Dn(t),r=t.ownerDocument.body,i=ct(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=ct(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),s=-n.scrollLeft+pd(t),a=-n.scrollTop;return Le(r).direction==="rtl"&&(s+=ct(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}var bk=25;function x2(t,e){let n=Oe(t),r=$e(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;let u=Qi();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}let c=pd(r);if(c<=0){let u=r.ownerDocument,f=u.body,h=getComputedStyle(f),g=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,v=Math.abs(r.clientWidth-f.clientWidth-g);v<=bk&&(o-=v)}else c<=bk&&(o+=c);return{width:o,height:s,x:a,y:l}}var S2=new Set(["absolute","fixed"]);function b2(t,e){let n=eo(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=Ve(t)?fs(t):Pe(1),s=t.clientWidth*o.x,a=t.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:s,height:a,x:l,y:c}}function kk(t,e,n){let r;if(e==="viewport")r=x2(t,n);else if(e==="document")r=w2($e(t));else if(Ne(e))r=b2(e,n);else{let i=Ak(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Mn(r)}function Rk(t,e){let n=mt(t);return n===e||!Ne(n)||tn(n)?!1:Le(n).position==="fixed"||Rk(n,e)}function k2(t,e){let n=e.get(t);if(n)return n;let r=Fn(t,[],!1).filter(a=>Ne(a)&&mn(a)!=="body"),i=null,o=Le(t).position==="fixed",s=o?mt(t):t;for(;Ne(s)&&!tn(s);){let a=Le(s),l=Xi(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&S2.has(i.position)||$n(s)&&!l&&Rk(t,s))?r=r.filter(u=>u!==s):i=a,s=mt(s)}return e.set(t,r),r}function E2(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t,s=[...n==="clippingAncestors"?pr(e)?[]:k2(e,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{let f=kk(e,u,i);return c.top=ct(f.top,c.top),c.right=en(f.right,c.right),c.bottom=en(f.bottom,c.bottom),c.left=ct(f.left,c.left),c},kk(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function C2(t){let{width:e,height:n}=Ck(t);return{width:e,height:n}}function A2(t,e,n){let r=Ve(e),i=$e(e),o=n==="fixed",s=eo(t,!0,o,e),a={scrollLeft:0,scrollTop:0},l=Pe(0);function c(){l.x=pd(i)}if(r||!r&&!o)if((mn(e)!=="body"||$n(i))&&(a=Dn(e)),r){let g=eo(e,!0,o,e);l.x=g.x+e.clientLeft,l.y=g.y+e.clientTop}else i&&c();o&&!r&&i&&c();let u=i&&!r&&!o?Tk(i,a):Pe(0),f=s.left+a.scrollLeft-l.x-u.x,h=s.top+a.scrollTop-l.y-u.y;return{x:f,y:h,width:s.width,height:s.height}}function zm(t){return Le(t).position==="static"}function Ek(t,e){if(!Ve(t)||Le(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return $e(t)===n&&(n=n.ownerDocument.body),n}function Ik(t,e){let n=Oe(t);if(pr(t))return n;if(!Ve(t)){let i=mt(t);for(;i&&!tn(i);){if(Ne(i)&&!zm(i))return i;i=mt(i)}return n}let r=Ek(t,e);for(;r&&dd(r)&&zm(r);)r=Ek(r,e);return r&&tn(r)&&zm(r)&&!Xi(r)?n:r||fd(t)||n}var T2=async function(t){let e=this.getOffsetParent||Ik,n=this.getDimensions,r=await n(t.floating);return{reference:A2(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function R2(t){return Le(t).direction==="rtl"}var I2={convertOffsetParentRelativeRectToViewportRelativeRect:y2,getDocumentElement:$e,getClippingRect:E2,getOffsetParent:Ik,getElementRects:T2,getClientRects:_2,getDimensions:C2,getScale:fs,isElement:Ne,isRTL:R2};function Pk(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function P2(t,e){let n=null,r,i=$e(t);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();let c=t.getBoundingClientRect(),{left:u,top:f,width:h,height:g}=c;if(a||e(),!h||!g)return;let v=Ln(f),_=Ln(i.clientWidth-(u+h)),x=Ln(i.clientHeight-(f+g)),d=Ln(u),m={rootMargin:-v+"px "+-_+"px "+-x+"px "+-d+"px",threshold:ct(0,en(1,l))||1},y=!0;function w(b){let k=b[0].intersectionRatio;if(k!==l){if(!y)return s();k?s(!1,k):r=setTimeout(()=>{s(!1,1e-7)},1e3)}k===1&&!Pk(c,t.getBoundingClientRect())&&s(),y=!1}try{n=new IntersectionObserver(w,{...m,root:i.ownerDocument})}catch{n=new IntersectionObserver(w,m)}n.observe(t)}return s(!0),o}function Ok(t,e,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Hm(t),u=i||o?[...c?Fn(c):[],...Fn(e)]:[];u.forEach(d=>{i&&d.addEventListener("scroll",n,{passive:!0}),o&&d.addEventListener("resize",n)});let f=c&&a?P2(c,n):null,h=-1,g=null;s&&(g=new ResizeObserver(d=>{let[p]=d;p&&p.target===c&&g&&(g.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var m;(m=g)==null||m.observe(e)})),n()}),c&&!l&&g.observe(c),g.observe(e));let v,_=l?eo(t):null;l&&x();function x(){let d=eo(t);_&&!Pk(_,d)&&n(),_=d,v=requestAnimationFrame(x)}return n(),()=>{var d;u.forEach(p=>{i&&p.removeEventListener("scroll",n),o&&p.removeEventListener("resize",n)}),f?.(),(d=g)==null||d.disconnect(),g=null,l&&cancelAnimationFrame(v)}}var Nk=ld;var Lk=cd,Mk=ad;var Fk=Vm,$k=Bm;var Dk=(t,e,n)=>{let r=new Map,i={platform:I2,...n},o={...i.platform,_c:r};return sd(t,e,{...i,platform:o})};var O2=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button"]);function Vt(t){if(typeof window.Sanitizer=="function")try{let a=new window.Sanitizer({}).sanitizeToFragment(t),l=document.createElement("div");return l.append(a),l.innerHTML}catch{}let n=document.createElement("template");n.innerHTML=t;let r=n.content,i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,null),o=[];for(;i.nextNode();){let s=i.currentNode,a=s.tagName.toLowerCase();if(!O2.has(a)){o.push(s);continue}for(let l of Array.from(s.attributes)){let c=l.name.toLowerCase(),u=l.value.trim().toLowerCase(),f=c.startsWith("on"),h=(c==="href"||c==="src")&&u.startsWith("javascript:");(f||h)&&s.removeAttribute(l.name)}}for(let s of o){for(;s.firstChild;)s.parentNode?.insertBefore(s.firstChild,s);s.remove()}return n.innerHTML}function N2(t){let e=t.getBoundingClientRect(),n=window.innerWidth,r=window.innerHeight;if(!(e.width>n*.8||e.height>r*.8))return t;let o=Math.max(e.left,0),s=Math.max(e.top,0),a=Math.min(e.right,n),l=Math.min(e.bottom,r),c=(o+a)/2,u=(s+l)/2;return{getBoundingClientRect(){return{width:0,height:0,x:c,y:u,top:u,left:c,right:c,bottom:u}}}}function Bk(t,e,n){let r=t.getBoundingClientRect();r.width>window.innerWidth*.8||r.height>window.innerHeight*.8||t.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});let o=document.createElement("div");o.className="syntro-tooltip",o.setAttribute("role","tooltip"),o.innerHTML=Vt(n.html);let s=o.querySelectorAll("[data-syntro-action]"),a=d=>{let m=d.currentTarget.getAttribute("data-syntro-action");m&&n.onAction&&n.onAction(m)};s.forEach(d=>d.addEventListener("click",a));let l=document.createElement("div");l.className="syntro-tooltip-arrow",o.appendChild(l),e.appendChild(o);let c=[Nk(n.offsetPx??8),Mk(),Lk({padding:8}),Fk(),$k({element:l})],u=n.placement&&n.placement!=="auto"?n.placement:"top",f=Ok(t,o,async()=>{let d=N2(t),p=await Dk(d,o,{placement:u,middleware:c}),{x:m,y,strategy:w,middlewareData:b,placement:k}=p;if(Object.assign(o.style,{left:`${m}px`,top:`${y}px`,position:w}),b.arrow){let{x:E,y:I}=b.arrow,A=k.split("-")[0],H={top:"bottom",right:"left",bottom:"top",left:"right"};Object.assign(l.style,{left:E!=null?`${E}px`:"",top:I!=null?`${I}px`:"",right:"",bottom:"",[H[A]]:"-4px"});let K={top:"0deg",right:"90deg",bottom:"180deg",left:"270deg"};l.style.transform=`rotate(${K[A]||"0deg"})`}}),h=d=>{d.key==="Escape"&&x.destroy()};window.addEventListener("keydown",h);let g=[];if(n.blocking){Array.from(document.body.children).forEach(p=>{p!==e&&p.getAttribute("inert")===null&&(p.setAttribute("inert",""),g.push(p.id||p.tagName))});let d=Array.from(o.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));if(d.length>0){let p=d[0],m=d[d.length-1],y=w=>{w.key==="Tab"&&(w.shiftKey?document.activeElement===p&&(m.focus(),w.preventDefault()):document.activeElement===m&&(p.focus(),w.preventDefault()))};o.addEventListener("keydown",y),requestAnimationFrame(()=>p.focus())}}let _=(()=>{if(n.trigger==="hover"){let d=()=>{o.style.visibility="visible",o.style.opacity="1"},p=()=>{o.style.visibility="hidden",o.style.opacity="0"};return o.style.visibility="hidden",o.style.opacity="0",o.style.transition="opacity 200ms ease, visibility 200ms",t.addEventListener("mouseenter",d),t.addEventListener("mouseleave",p),t.addEventListener("focus",d),t.addEventListener("blur",p),()=>{t.removeEventListener("mouseenter",d),t.removeEventListener("mouseleave",p),t.removeEventListener("focus",d),t.removeEventListener("blur",p)}}if(n.trigger==="click"){let d=()=>{o.style.visibility==="visible"?x.destroy():(o.style.visibility="visible",o.style.opacity="1")};return o.style.visibility="hidden",o.style.opacity="0",o.style.transition="opacity 200ms ease, visibility 200ms",t.addEventListener("click",d),()=>t.removeEventListener("click",d)}return o.style.opacity="0",o.style.transition="opacity 200ms ease",requestAnimationFrame(()=>{o.style.opacity="1"}),()=>{}})(),x={el:o,destroy(){f(),_(),window.removeEventListener("keydown",h),s.forEach(d=>d.removeEventListener("click",a)),n.blocking&&Array.from(document.body.children).forEach(d=>{d!==e&&d.removeAttribute("inert")}),o.style.opacity="0",setTimeout(()=>o.remove(),200)}};return x}var jm=async(t,e)=>{let{content:n,size:r="md",blocking:i=!1,scrim:o,dismiss:s,ctaButtons:a}=t,l=document.createElement("div");l.className="syntro-modal-scrim",l.style.cssText=`
|
|
53
|
+
})();`}var rb="https://cdn.syntrologie.com/editor-sdk/latest/editor-sdk.js",ib=["cdn.syntrologie.com","api.syntrologie.com","dev-api.syntrologie.com","localhost","127.0.0.1",".syntrologie.com"];function xI(t){F("Syntro Runtime","Validating editor URL:",t);try{if(t.startsWith("/"))return F("Syntro Runtime","\u2713 Relative URL allowed (same-origin):",t),!0;let e=new URL(t),n=/^(localhost|127\.0\.0\.1)$/.test(e.hostname);if(F("Syntro Runtime","Parsed URL:",{hostname:e.hostname,protocol:e.protocol,isLocalhost:n}),e.protocol!=="https:"&&!n)return wt("Syntro Runtime","\u274C Editor URL must use HTTPS:",t),!1;let r=ib.some(i=>i.startsWith(".")?e.hostname.endsWith(i)||e.hostname===i.slice(1):e.hostname===i);return F("Syntro Runtime","Host allowlist check:",{hostname:e.hostname,allowedHosts:ib,isAllowed:r}),r?(F("Syntro Runtime","\u2713 Editor URL validated"),!0):(wt("Syntro Runtime","\u274C Editor URL host not in allowlist:",e.hostname),!1)}catch(e){return wt("Syntro Runtime","\u274C Invalid editor URL: "+t,e),!1}}var SI=()=>{if(F("Syntro Runtime","====== EDITOR LOAD CHECK ======"),typeof window>"u")return F("Syntro Runtime","Not in browser - skipping editor"),!1;let t=new URLSearchParams(window.location.search);F("Syntro Runtime","URL:",window.location.href),F("Syntro Runtime","Search params:",window.location.search);let e=t.has("syntro_editor")||t.has("syntro-editor"),n=t.has("editor_token");if(F("Syntro Runtime","Editor flags:",{hasEditorFlag:e,hasEditorToken:n,syntro_editor:t.get("syntro_editor"),"syntro-editor":t.get("syntro-editor"),editor_token:n?`${t.get("editor_token")?.slice(0,10)}...`:"none"}),e&&!n)return wt("Syntro Runtime","\u274C Editor activation requires editor_token parameter"),F("Syntro Runtime","================================"),!1;let r=e&&n;return F("Syntro Runtime","Should load editor:",r),F("Syntro Runtime","================================"),r},bI=()=>{if(F("Syntro Runtime","====== AUDIT MODE CHECK ======"),typeof window>"u")return F("Syntro Runtime","Not in browser - skipping audit"),!1;let t=new URLSearchParams(window.location.search),e=t.has("syntro_audit"),n=t.has("audit_token"),r=t.get("audit_session_id");return F("Syntro Runtime","Audit flags:",{hasAuditFlag:e,hasAuditToken:n,auditSessionId:r?`${r.slice(0,8)}...`:"none",audit_token:n?`${t.get("audit_token")?.slice(0,10)}...`:"none"}),e?n?(F("Syntro Runtime","\u2713 Audit mode active"),F("Syntro Runtime","================================"),!0):(wt("Syntro Runtime","\u274C Audit activation requires audit_token parameter"),F("Syntro Runtime","================================"),!1):(F("Syntro Runtime","No syntro_audit param - not in audit mode"),F("Syntro Runtime","================================"),!1)},ob=()=>SI()?"editor":bI()?"audit":null;function kI(){if(typeof window>"u")return null;let t=new URLSearchParams(window.location.search);return t.get("editor_token")||t.get("audit_token")}var sb=async t=>{if(F("Syntro Runtime","====== LOAD EDITOR SDK ======"),typeof window>"u"){F("Syntro Runtime","Not in browser - skipping editor SDK load");return}if(window.SyntroEditor){F("Syntro Runtime","Editor SDK already loaded (window.SyntroEditor exists)");return}let e=typeof t=="string"?{editorUrl:t}:t??{},n=new URLSearchParams(window.location.search),r=n.get("syntro_editor_sdk_url"),i=n.get("api_base"),o=i?`${i}/api/editor/sdk/editor-sdk.js`:null,s=r||o||e.editorUrl||rb,a=kI();if(!a){wt("Syntro Runtime","\u274C No token found in URL params. SDK requires editor_token or audit_token."),F("Syntro Runtime","================================");return}let l=`${s}?token=${encodeURIComponent(a)}`;if(F("Syntro Runtime","Editor URL:",l),F("Syntro Runtime","Options:",{hasIntegrity:!!e.integrity,isDefault:s===rb,hasApiBase:!!i,tokenPrefix:a.slice(0,10)+"..."}),!xI(s)){console.error("[Syntro Runtime] \u274C BLOCKED: Editor from untrusted URL:",s),F("Syntro Runtime","================================");return}return F("Syntro Runtime","\u2713 URL validated, injecting script tag..."),new Promise((c,u)=>{let f=document.createElement("script");f.src=l,f.async=!0,e.integrity&&(f.integrity=e.integrity,f.crossOrigin="anonymous",F("Syntro Runtime","SRI integrity check enabled")),f.onload=()=>{F("Syntro Runtime","\u2713 Editor SDK script loaded successfully"),F("Syntro Runtime","window.SyntroEditor:",!!window.SyntroEditor),F("Syntro Runtime","================================"),c()},f.onerror=h=>{console.error("[Syntro Runtime] \u274C Failed to load Editor SDK:",h),console.error("[Syntro Runtime] URL attempted:",l),console.error("[Syntro Runtime] Check: Is the URL accessible? CORS? Network? Token valid?"),F("Syntro Runtime","================================"),u(h)},document.head.appendChild(f),F("Syntro Runtime","Script tag appended to <head>")})};var Uu=async(t={})=>{if(typeof window>"u"||typeof document>"u")throw new Error("SmartCanvas can only be created in a browser-like environment");let e=null;if(t.antiFlicker){let d=typeof t.antiFlicker=="object"?t.antiFlicker:{};e=tb(d)}let n=null,r=null,i=null,o=!0,s=t.runtime;async function a(d){!s?.actions||d.length===0||(i?.isApplied()&&await i.revertAll(),i=await s.actions.applyBatch(d))}async function l(){i?.isApplied()&&(await i.revertAll(),i=null)}if(t.fetcher)try{r=t.fetcher;let d=await t.fetcher();n=d,d.actions&&d.actions.length>0&&s?.actions&&await a(d.actions)}catch(d){console.error("[SmartCanvas] Error fetching/applying initial config:",d)}e&&e();let c=ob();c&&(console.log(`[SmartCanvas] Loading editor SDK for ${c} mode`),sb(t.editorUrl).catch(console.error)),gm();let u=document.createElement("smart-canvas");if(t.tokens)for(let[d,p]of Object.entries(t.tokens))u.style.setProperty(d,p);let f=()=>{let d=t.target??document.body;d&&d.appendChild(u)};document.body?f():document.addEventListener("DOMContentLoaded",f,{once:!0});let h=t.integrations?.experiments,g=t.integrations?.telemetry,v=t.fetcher??Ni({configUri:t.configUri,experiments:h,featureKey:t.configUriFeatureKey,credentials:t.fetchCredentials});r||(r=v);let _={fetcher:v,pollIntervalMs:t.pollIntervalMs,experiments:h,telemetry:g,runtime:s,overlayFetcher:t.overlayFetcher,overlayConfigUri:t.overlayConfigUri,overlayConfigFeatureKey:t.overlayConfigFeatureKey,overlayFetchCredentials:t.overlayFetchCredentials,configUri:t.configUri,configUriFeatureKey:t.configUriFeatureKey,fetchCredentials:t.fetchCredentials,theme:t.theme};u.mountReactApp(_),t.defaultOpen&&u.open();let x={el:u,open:()=>u.open(),close:()=>u.close(),destroy:()=>{l(),u.remove()},setTokens:d=>{for(let[p,m]of Object.entries(d))u.style.setProperty(p,m)},getConfig:async()=>{if(r)try{let d=await r();return n=d,d}catch(d){console.error("[SmartCanvas] Error fetching config:",d)}return n??{tiles:[],actions:[],fetchedAt:""}},updateConfig:async d=>{n=d,o&&await a(d.actions)},setEnabled:async d=>{o=d,d?n&&await a(n.actions):await l()},registerComponent:(d,p)=>u.registerComponent(d,p),setOverrideFetcher:d=>{r=d,u.setOverrideFetcher(d)},registerTelemetryProperties:d=>{g?.register?.(d)},getSessionId:()=>g?.getSessionId?.(),startSessionRecording:()=>{g?.startSessionRecording?.()},runtime:s};return typeof window<"u"&&c&&(window.__smartCanvasHandle=x),x};typeof window<"u"&&(window.SmartCanvas={async create(t){return Uu(t)}});var S={};fv(S,{BRAND:()=>YI,DIRTY:()=>Li,EMPTY_PATH:()=>TI,INVALID:()=>U,NEVER:()=>LP,OK:()=>lt,ParseStatus:()=>tt,Schema:()=>J,ZodAny:()=>oi,ZodArray:()=>dr,ZodBigInt:()=>Fi,ZodBoolean:()=>$i,ZodBranded:()=>Ga,ZodCatch:()=>Gi,ZodDate:()=>Di,ZodDefault:()=>Ki,ZodDiscriminatedUnion:()=>Ku,ZodEffects:()=>Jt,ZodEnum:()=>Wi,ZodError:()=>Tt,ZodFirstPartyTypeKind:()=>q,ZodFunction:()=>Zu,ZodIntersection:()=>Hi,ZodIssueCode:()=>T,ZodLazy:()=>ji,ZodLiteral:()=>Ui,ZodMap:()=>ss,ZodNaN:()=>ls,ZodNativeEnum:()=>qi,ZodNever:()=>gn,ZodNull:()=>Vi,ZodNullable:()=>On,ZodNumber:()=>Mi,ZodObject:()=>Rt,ZodOptional:()=>Xt,ZodParsedType:()=>M,ZodPipeline:()=>Za,ZodPromise:()=>si,ZodReadonly:()=>Zi,ZodRecord:()=>Gu,ZodSchema:()=>J,ZodSet:()=>as,ZodString:()=>ii,ZodSymbol:()=>is,ZodTransformer:()=>Jt,ZodTuple:()=>Pn,ZodType:()=>J,ZodUndefined:()=>Bi,ZodUnion:()=>zi,ZodUnknown:()=>ur,ZodVoid:()=>os,addIssueToContext:()=>P,any:()=>oP,array:()=>cP,bigint:()=>eP,boolean:()=>vb,coerce:()=>NP,custom:()=>hb,date:()=>tP,datetimeRegex:()=>fb,defaultErrorMap:()=>lr,discriminatedUnion:()=>pP,effect:()=>EP,enum:()=>SP,function:()=>_P,getErrorMap:()=>ts,getParsedType:()=>In,instanceof:()=>QI,intersection:()=>hP,isAborted:()=>Wu,isAsync:()=>ns,isDirty:()=>qu,isValid:()=>ri,late:()=>XI,lazy:()=>wP,literal:()=>xP,makeIssue:()=>Ka,map:()=>vP,nan:()=>JI,nativeEnum:()=>bP,never:()=>aP,null:()=>iP,nullable:()=>AP,number:()=>mb,object:()=>uP,objectUtil:()=>mm,oboolean:()=>OP,onumber:()=>PP,optional:()=>CP,ostring:()=>IP,pipeline:()=>RP,preprocess:()=>TP,promise:()=>kP,quotelessJson:()=>EI,record:()=>mP,set:()=>yP,setErrorMap:()=>AI,strictObject:()=>dP,string:()=>gb,symbol:()=>nP,transformer:()=>EP,tuple:()=>gP,undefined:()=>rP,union:()=>fP,unknown:()=>sP,util:()=>re,void:()=>lP});var re;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(re||(re={}));var mm;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(mm||(mm={}));var M=re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),In=t=>{switch(typeof t){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(t)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(t)?M.array:t===null?M.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?M.promise:typeof Map<"u"&&t instanceof Map?M.map:typeof Set<"u"&&t instanceof Set?M.set:typeof Date<"u"&&t instanceof Date?M.date:M.object;default:return M.unknown}};var T=re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),EI=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Tt=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(o){return o.message},r={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){let c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];n[o]=n[o]||[],n[o].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};Tt.create=t=>new Tt(t);var CI=(t,e)=>{let n;switch(t.code){case T.invalid_type:t.received===M.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case T.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,re.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:n=`Unrecognized key(s) in object: ${re.joinValues(t.keys,", ")}`;break;case T.invalid_union:n="Invalid input";break;case T.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${re.joinValues(t.options)}`;break;case T.invalid_enum_value:n=`Invalid enum value. Expected ${re.joinValues(t.options)}, received '${t.received}'`;break;case T.invalid_arguments:n="Invalid function arguments";break;case T.invalid_return_type:n="Invalid function return type";break;case T.invalid_date:n="Invalid date";break;case T.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:re.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case T.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case T.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case T.custom:n="Invalid input";break;case T.invalid_intersection_types:n="Intersection results could not be merged";break;case T.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case T.not_finite:n="Number must be finite";break;default:n=e.defaultError,re.assertNever(t)}return{message:n}},lr=CI;var ab=lr;function AI(t){ab=t}function ts(){return ab}var Ka=t=>{let{data:e,path:n,errorMaps:r,issueData:i}=t,o=[...n,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",l=r.filter(c=>!!c).slice().reverse();for(let c of l)a=c(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}},TI=[];function P(t,e){let n=ts(),r=Ka({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===lr?void 0:lr].filter(i=>!!i)});t.common.issues.push(r)}var tt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let i of n){if(i.status==="aborted")return U;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let i of n){let o=await i.key,s=await i.value;r.push({key:o,value:s})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let i of n){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return U;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}},U=Object.freeze({status:"aborted"}),Li=t=>({status:"dirty",value:t}),lt=t=>({status:"valid",value:t}),Wu=t=>t.status==="aborted",qu=t=>t.status==="dirty",ri=t=>t.status==="valid",ns=t=>typeof Promise<"u"&&t instanceof Promise;var z;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(z||(z={}));var Qt=class{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},lb=(t,e)=>{if(ri(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new Tt(t.common.issues);return this._error=n,this._error}}};function Q(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}var J=class{get description(){return this._def.description}_getType(e){return In(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:In(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new tt,ctx:{common:e.parent.common,data:e.data,parsedType:In(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ns(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:In(e)},i=this._parseSync({data:e,path:r.path,parent:r});return lb(r,i)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:In(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return ri(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>ri(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:In(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(ns(i)?i:Promise.resolve(i));return lb(r,o)}refine(e,n){let r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:T.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Jt({schema:this,typeName:q.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Xt.create(this,this._def)}nullable(){return On.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return dr.create(this)}promise(){return si.create(this,this._def)}or(e){return zi.create([this,e],this._def)}and(e){return Hi.create(this,e,this._def)}transform(e){return new Jt({...Q(this._def),schema:this,typeName:q.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new Ki({...Q(this._def),innerType:this,defaultValue:n,typeName:q.ZodDefault})}brand(){return new Ga({typeName:q.ZodBranded,type:this,...Q(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new Gi({...Q(this._def),innerType:this,catchValue:n,typeName:q.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Za.create(this,e)}readonly(){return Zi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},RI=/^c[^\s-]{8,}$/i,II=/^[0-9a-z]+$/,PI=/^[0-9A-HJKMNP-TV-Z]{26}$/i,OI=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,NI=/^[a-z0-9_-]{21}$/i,LI=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,MI=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,FI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,$I="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",vm,DI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,BI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,VI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,zI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,HI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,jI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ub="((\\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])))",UI=new RegExp(`^${ub}$`);function db(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function WI(t){return new RegExp(`^${db(t)}$`)}function fb(t){let e=`${ub}T${db(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function qI(t,e){return!!((e==="v4"||!e)&&DI.test(t)||(e==="v6"||!e)&&VI.test(t))}function KI(t,e){if(!LI.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function GI(t,e){return!!((e==="v4"||!e)&&BI.test(t)||(e==="v6"||!e)&&zI.test(t))}var ii=class t extends J{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==M.string){let o=this._getOrReturnCtx(e);return P(o,{code:T.invalid_type,expected:M.string,received:o.parsedType}),U}let r=new tt,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),P(i,{code:T.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),P(i,{code:T.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?P(i,{code:T.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&P(i,{code:T.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")FI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"email",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="emoji")vm||(vm=new RegExp($I,"u")),vm.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"emoji",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")OI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"uuid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="nanoid")NI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"nanoid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")RI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"cuid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid2")II.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"cuid2",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="ulid")PI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"ulid",code:T.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),P(i,{validation:"url",code:T.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"regex",code:T.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),P(i,{code:T.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),P(i,{code:T.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),P(i,{code:T.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?fb(o).test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{code:T.invalid_string,validation:"datetime",message:o.message}),r.dirty()):o.kind==="date"?UI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{code:T.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?WI(o).test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{code:T.invalid_string,validation:"time",message:o.message}),r.dirty()):o.kind==="duration"?MI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"duration",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?qI(e.data,o.version)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"ip",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="jwt"?KI(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"jwt",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="cidr"?GI(e.data,o.version)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"cidr",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64"?HI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"base64",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?jI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"base64url",code:T.invalid_string,message:o.message}),r.dirty()):re.assertNever(o);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:T.invalid_string,...z.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...z.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...z.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...z.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...z.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...z.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...z.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...z.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...z.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...z.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...z.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...z.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...z.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...z.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...z.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...z.errToObj(n)})}nonempty(e){return this.min(1,z.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};ii.create=t=>new ii({checks:[],typeName:q.ZodString,coerce:t?.coerce??!1,...Q(t)});function ZI(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}var Mi=class t extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==M.number){let o=this._getOrReturnCtx(e);return P(o,{code:T.invalid_type,expected:M.number,received:o.parsedType}),U}let r,i=new tt;for(let o of this._def.checks)o.kind==="int"?re.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{code:T.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),P(r,{code:T.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),P(r,{code:T.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?ZI(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),P(r,{code:T.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),P(r,{code:T.not_finite,message:o.message}),i.dirty()):re.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,z.toString(n))}gt(e,n){return this.setLimit("min",e,!1,z.toString(n))}lte(e,n){return this.setLimit("max",e,!0,z.toString(n))}lt(e,n){return this.setLimit("max",e,!1,z.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:z.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:z.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:z.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:z.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&re.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};Mi.create=t=>new Mi({checks:[],typeName:q.ZodNumber,coerce:t?.coerce||!1,...Q(t)});var Fi=class t extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==M.bigint)return this._getInvalidInput(e);let r,i=new tt;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),P(r,{code:T.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),P(r,{code:T.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),P(r,{code:T.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):re.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return P(n,{code:T.invalid_type,expected:M.bigint,received:n.parsedType}),U}gte(e,n){return this.setLimit("min",e,!0,z.toString(n))}gt(e,n){return this.setLimit("min",e,!1,z.toString(n))}lte(e,n){return this.setLimit("max",e,!0,z.toString(n))}lt(e,n){return this.setLimit("max",e,!1,z.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:z.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:z.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:z.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Fi.create=t=>new Fi({checks:[],typeName:q.ZodBigInt,coerce:t?.coerce??!1,...Q(t)});var $i=class extends J{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==M.boolean){let r=this._getOrReturnCtx(e);return P(r,{code:T.invalid_type,expected:M.boolean,received:r.parsedType}),U}return lt(e.data)}};$i.create=t=>new $i({typeName:q.ZodBoolean,coerce:t?.coerce||!1,...Q(t)});var Di=class t extends J{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==M.date){let o=this._getOrReturnCtx(e);return P(o,{code:T.invalid_type,expected:M.date,received:o.parsedType}),U}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return P(o,{code:T.invalid_date}),U}let r=new tt,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),P(i,{code:T.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),P(i,{code:T.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):re.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:z.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:z.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Di.create=t=>new Di({checks:[],coerce:t?.coerce||!1,typeName:q.ZodDate,...Q(t)});var is=class extends J{_parse(e){if(this._getType(e)!==M.symbol){let r=this._getOrReturnCtx(e);return P(r,{code:T.invalid_type,expected:M.symbol,received:r.parsedType}),U}return lt(e.data)}};is.create=t=>new is({typeName:q.ZodSymbol,...Q(t)});var Bi=class extends J{_parse(e){if(this._getType(e)!==M.undefined){let r=this._getOrReturnCtx(e);return P(r,{code:T.invalid_type,expected:M.undefined,received:r.parsedType}),U}return lt(e.data)}};Bi.create=t=>new Bi({typeName:q.ZodUndefined,...Q(t)});var Vi=class extends J{_parse(e){if(this._getType(e)!==M.null){let r=this._getOrReturnCtx(e);return P(r,{code:T.invalid_type,expected:M.null,received:r.parsedType}),U}return lt(e.data)}};Vi.create=t=>new Vi({typeName:q.ZodNull,...Q(t)});var oi=class extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return lt(e.data)}};oi.create=t=>new oi({typeName:q.ZodAny,...Q(t)});var ur=class extends J{constructor(){super(...arguments),this._unknown=!0}_parse(e){return lt(e.data)}};ur.create=t=>new ur({typeName:q.ZodUnknown,...Q(t)});var gn=class extends J{_parse(e){let n=this._getOrReturnCtx(e);return P(n,{code:T.invalid_type,expected:M.never,received:n.parsedType}),U}};gn.create=t=>new gn({typeName:q.ZodNever,...Q(t)});var os=class extends J{_parse(e){if(this._getType(e)!==M.undefined){let r=this._getOrReturnCtx(e);return P(r,{code:T.invalid_type,expected:M.void,received:r.parsedType}),U}return lt(e.data)}};os.create=t=>new os({typeName:q.ZodVoid,...Q(t)});var dr=class t extends J{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==M.array)return P(n,{code:T.invalid_type,expected:M.array,received:n.parsedType}),U;if(i.exactLength!==null){let s=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(s||a)&&(P(n,{code:s?T.too_big:T.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(P(n,{code:T.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(P(n,{code:T.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>i.type._parseAsync(new Qt(n,s,n.path,a)))).then(s=>tt.mergeArray(r,s));let o=[...n.data].map((s,a)=>i.type._parseSync(new Qt(n,s,n.path,a)));return tt.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:z.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:z.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:z.toString(n)}})}nonempty(e){return this.min(1,e)}};dr.create=(t,e)=>new dr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:q.ZodArray,...Q(e)});function rs(t){if(t instanceof Rt){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Xt.create(rs(r))}return new Rt({...t._def,shape:()=>e})}else return t instanceof dr?new dr({...t._def,type:rs(t.element)}):t instanceof Xt?Xt.create(rs(t.unwrap())):t instanceof On?On.create(rs(t.unwrap())):t instanceof Pn?Pn.create(t.items.map(e=>rs(e))):t}var Rt=class t extends J{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=re.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==M.object){let c=this._getOrReturnCtx(e);return P(c,{code:T.invalid_type,expected:M.object,received:c.parsedType}),U}let{status:r,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof gn&&this._def.unknownKeys==="strip"))for(let c in i.data)s.includes(c)||a.push(c);let l=[];for(let c of s){let u=o[c],f=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Qt(i,f,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof gn){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(P(i,{code:T.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let f=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Qt(i,f,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let f=await u.key,h=await u.value;c.push({key:f,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>tt.mergeObjectSync(r,c)):tt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return z.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:z.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:q.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of re.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of re.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return rs(this)}partial(e){let n={};for(let r of re.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of re.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Xt;)o=o._def.innerType;n[r]=o}return new t({...this._def,shape:()=>n})}keyof(){return pb(re.objectKeys(this.shape))}};Rt.create=(t,e)=>new Rt({shape:()=>t,unknownKeys:"strip",catchall:gn.create(),typeName:q.ZodObject,...Q(e)});Rt.strictCreate=(t,e)=>new Rt({shape:()=>t,unknownKeys:"strict",catchall:gn.create(),typeName:q.ZodObject,...Q(e)});Rt.lazycreate=(t,e)=>new Rt({shape:t,unknownKeys:"strip",catchall:gn.create(),typeName:q.ZodObject,...Q(e)});var zi=class extends J{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new Tt(a.ctx.common.issues));return P(n,{code:T.invalid_union,unionErrors:s}),U}if(n.common.async)return Promise.all(r.map(async o=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let l of r){let c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(l=>new Tt(l));return P(n,{code:T.invalid_union,unionErrors:a}),U}}get options(){return this._def.options}};zi.create=(t,e)=>new zi({options:t,typeName:q.ZodUnion,...Q(e)});var cr=t=>t instanceof ji?cr(t.schema):t instanceof Jt?cr(t.innerType()):t instanceof Ui?[t.value]:t instanceof Wi?t.options:t instanceof qi?re.objectValues(t.enum):t instanceof Ki?cr(t._def.innerType):t instanceof Bi?[void 0]:t instanceof Vi?[null]:t instanceof Xt?[void 0,...cr(t.unwrap())]:t instanceof On?[null,...cr(t.unwrap())]:t instanceof Ga||t instanceof Zi?cr(t.unwrap()):t instanceof Gi?cr(t._def.innerType):[],Ku=class t extends J{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==M.object)return P(n,{code:T.invalid_type,expected:M.object,received:n.parsedType}),U;let r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(P(n,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),U)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let i=new Map;for(let o of n){let s=cr(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:q.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...Q(r)})}};function ym(t,e){let n=In(t),r=In(e);if(t===e)return{valid:!0,data:t};if(n===M.object&&r===M.object){let i=re.objectKeys(e),o=re.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let l=ym(t[a],e[a]);if(!l.valid)return{valid:!1};s[a]=l.data}return{valid:!0,data:s}}else if(n===M.array&&r===M.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],l=ym(s,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===M.date&&r===M.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Hi=class extends J{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=(o,s)=>{if(Wu(o)||Wu(s))return U;let a=ym(o.value,s.value);return a.valid?((qu(o)||qu(s))&&n.dirty(),{status:n.value,value:a.data}):(P(r,{code:T.invalid_intersection_types}),U)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Hi.create=(t,e,n)=>new Hi({left:t,right:e,typeName:q.ZodIntersection,...Q(n)});var Pn=class t extends J{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==M.array)return P(r,{code:T.invalid_type,expected:M.array,received:r.parsedType}),U;if(r.data.length<this._def.items.length)return P(r,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),U;!this._def.rest&&r.data.length>this._def.items.length&&(P(r,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...r.data].map((s,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new Qt(r,s,r.path,a)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>tt.mergeArray(n,s)):tt.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Pn.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pn({items:t,typeName:q.ZodTuple,rest:null,...Q(e)})};var Gu=class t extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==M.object)return P(r,{code:T.invalid_type,expected:M.object,received:r.parsedType}),U;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in r.data)i.push({key:o._parse(new Qt(r,a,r.path,a)),value:s._parse(new Qt(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?tt.mergeObjectAsync(n,i):tt.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof J?new t({keyType:e,valueType:n,typeName:q.ZodRecord,...Q(r)}):new t({keyType:ii.create(),valueType:e,typeName:q.ZodRecord,...Q(n)})}},ss=class extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==M.map)return P(r,{code:T.invalid_type,expected:M.map,received:r.parsedType}),U;let i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new Qt(r,a,r.path,[c,"key"])),value:o._parse(new Qt(r,l,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of s){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return U;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let l of s){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return U;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}};ss.create=(t,e,n)=>new ss({valueType:e,keyType:t,typeName:q.ZodMap,...Q(n)});var as=class t extends J{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==M.set)return P(r,{code:T.invalid_type,expected:M.set,received:r.parsedType}),U;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(P(r,{code:T.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(P(r,{code:T.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let o=this._def.valueType;function s(l){let c=new Set;for(let u of l){if(u.status==="aborted")return U;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}let a=[...r.data.values()].map((l,c)=>o._parse(new Qt(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>s(l)):s(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:z.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:z.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};as.create=(t,e)=>new as({valueType:t,minSize:null,maxSize:null,typeName:q.ZodSet,...Q(e)});var Zu=class t extends J{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==M.function)return P(n,{code:T.invalid_type,expected:M.function,received:n.parsedType}),U;function r(a,l){return Ka({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ts(),lr].filter(c=>!!c),issueData:{code:T.invalid_arguments,argumentsError:l}})}function i(a,l){return Ka({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ts(),lr].filter(c=>!!c),issueData:{code:T.invalid_return_type,returnTypeError:l}})}let o={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof si){let a=this;return lt(async function(...l){let c=new Tt([]),u=await a._def.args.parseAsync(l,o).catch(g=>{throw c.addIssue(r(l,g)),c}),f=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(f,o).catch(g=>{throw c.addIssue(i(f,g)),c})})}else{let a=this;return lt(function(...l){let c=a._def.args.safeParse(l,o);if(!c.success)throw new Tt([r(l,c.error)]);let u=Reflect.apply(s,this,c.data),f=a._def.returns.safeParse(u,o);if(!f.success)throw new Tt([i(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Pn.create(e).rest(ur.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||Pn.create([]).rest(ur.create()),returns:n||ur.create(),typeName:q.ZodFunction,...Q(r)})}},ji=class extends J{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ji.create=(t,e)=>new ji({getter:t,typeName:q.ZodLazy,...Q(e)});var Ui=class extends J{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return P(n,{received:n.data,code:T.invalid_literal,expected:this._def.value}),U}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ui.create=(t,e)=>new Ui({value:t,typeName:q.ZodLiteral,...Q(e)});function pb(t,e){return new Wi({values:t,typeName:q.ZodEnum,...Q(e)})}var Wi=class t extends J{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return P(n,{expected:re.joinValues(r),received:n.parsedType,code:T.invalid_type}),U}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return P(n,{received:n.data,code:T.invalid_enum_value,options:r}),U}return lt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Wi.create=pb;var qi=class extends J{_parse(e){let n=re.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==M.string&&r.parsedType!==M.number){let i=re.objectValues(n);return P(r,{expected:re.joinValues(i),received:r.parsedType,code:T.invalid_type}),U}if(this._cache||(this._cache=new Set(re.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=re.objectValues(n);return P(r,{received:r.data,code:T.invalid_enum_value,options:i}),U}return lt(e.data)}get enum(){return this._def.values}};qi.create=(t,e)=>new qi({values:t,typeName:q.ZodNativeEnum,...Q(e)});var si=class extends J{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==M.promise&&n.common.async===!1)return P(n,{code:T.invalid_type,expected:M.promise,received:n.parsedType}),U;let r=n.parsedType===M.promise?n.data:Promise.resolve(n.data);return lt(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}};si.create=(t,e)=>new si({type:t,typeName:q.ZodPromise,...Q(e)});var Jt=class extends J{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{P(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return U;let l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?U:l.status==="dirty"?Li(l.value):n.value==="dirty"?Li(l.value):l});{if(n.value==="aborted")return U;let a=this._def.schema._parseSync({data:s,path:r.path,parent:r});return a.status==="aborted"?U:a.status==="dirty"?Li(a.value):n.value==="dirty"?Li(a.value):a}}if(i.type==="refinement"){let s=a=>{let l=i.refinement(a,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?U:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?U:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ri(s))return U;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>ri(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:n.value,value:a})):U);re.assertNever(i)}};Jt.create=(t,e,n)=>new Jt({schema:t,typeName:q.ZodEffects,effect:e,...Q(n)});Jt.createWithPreprocess=(t,e,n)=>new Jt({schema:e,effect:{type:"preprocess",transform:t},typeName:q.ZodEffects,...Q(n)});var Xt=class extends J{_parse(e){return this._getType(e)===M.undefined?lt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Xt.create=(t,e)=>new Xt({innerType:t,typeName:q.ZodOptional,...Q(e)});var On=class extends J{_parse(e){return this._getType(e)===M.null?lt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};On.create=(t,e)=>new On({innerType:t,typeName:q.ZodNullable,...Q(e)});var Ki=class extends J{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===M.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Ki.create=(t,e)=>new Ki({innerType:t,typeName:q.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});var Gi=class extends J{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ns(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Tt(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Tt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Gi.create=(t,e)=>new Gi({innerType:t,typeName:q.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});var ls=class extends J{_parse(e){if(this._getType(e)!==M.nan){let r=this._getOrReturnCtx(e);return P(r,{code:T.invalid_type,expected:M.nan,received:r.parsedType}),U}return{status:"valid",value:e.data}}};ls.create=t=>new ls({typeName:q.ZodNaN,...Q(t)});var YI=Symbol("zod_brand"),Ga=class extends J{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Za=class t extends J{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?U:o.status==="dirty"?(n.dirty(),Li(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?U:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:q.ZodPipeline})}},Zi=class extends J{_parse(e){let n=this._def.innerType._parse(e),r=i=>(ri(i)&&(i.value=Object.freeze(i.value)),i);return ns(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};Zi.create=(t,e)=>new Zi({innerType:t,typeName:q.ZodReadonly,...Q(e)});function cb(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function hb(t,e={},n){return t?oi.create().superRefine((r,i)=>{let o=t(r);if(o instanceof Promise)return o.then(s=>{if(!s){let a=cb(e,r),l=a.fatal??n??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!o){let s=cb(e,r),a=s.fatal??n??!0;i.addIssue({code:"custom",...s,fatal:a})}}):oi.create()}var XI={object:Rt.lazycreate},q;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(q||(q={}));var QI=(t,e={message:`Input not instance of ${t.name}`})=>hb(n=>n instanceof t,e),gb=ii.create,mb=Mi.create,JI=ls.create,eP=Fi.create,vb=$i.create,tP=Di.create,nP=is.create,rP=Bi.create,iP=Vi.create,oP=oi.create,sP=ur.create,aP=gn.create,lP=os.create,cP=dr.create,uP=Rt.create,dP=Rt.strictCreate,fP=zi.create,pP=Ku.create,hP=Hi.create,gP=Pn.create,mP=Gu.create,vP=ss.create,yP=as.create,_P=Zu.create,wP=ji.create,xP=Ui.create,SP=Wi.create,bP=qi.create,kP=si.create,EP=Jt.create,CP=Xt.create,AP=On.create,TP=Jt.createWithPreprocess,RP=Za.create,IP=()=>gb().optional(),PP=()=>mb().optional(),OP=()=>vb().optional(),NP={string:(t=>ii.create({...t,coerce:!0})),number:(t=>Mi.create({...t,coerce:!0})),boolean:(t=>$i.create({...t,coerce:!0})),bigint:(t=>Fi.create({...t,coerce:!0})),date:(t=>Di.create({...t,coerce:!0}))};var LP=U;var _m=S.union([S.object({type:S.literal("data"),key:S.string(),value:S.string().optional()}),S.object({type:S.literal("css"),value:S.string()}),S.object({type:S.literal("aria"),role:S.string().optional(),label:S.string().optional()}),S.object({type:S.literal("shadow-css"),value:S.string()}),S.object({type:S.literal("ref"),el:S.any()})]),yb=S.object({kind:S.literal("tooltip"),id:S.string(),anchor:_m,content:S.object({title:S.string().optional(),body:S.string()}),placement:S.enum(["top","bottom","left","right","auto"]).optional(),offsetPx:S.number().optional(),blocking:S.boolean().optional(),trigger:S.enum(["immediate","hover","click"]).optional(),dismiss:S.object({onEsc:S.boolean().optional(),closeButton:S.boolean().optional(),timeoutMs:S.number().optional()}).optional()}),_b=S.object({kind:S.literal("highlight"),id:S.string(),anchor:_m,copy:S.string().optional(),ring:S.object({paddingPx:S.number().optional(),radiusPx:S.number().optional()}).optional(),scrim:S.object({opacity:S.number().optional()}).optional(),ringColor:S.string().optional(),blocking:S.boolean().optional(),dismiss:S.object({onClickOutside:S.boolean().optional(),onEsc:S.boolean().optional(),timeoutMs:S.number().optional()}).optional()}),Yu=S.object({id:S.string(),version:S.number(),routes:S.array(S.string()).optional(),steps:S.array(S.union([yb,_b]))});function MP(t){return Yu.parse(t)}var FP=({configUri:t,experiments:e,featureKey:n="smart-canvas-overlay-uri",credentials:r="include"}={})=>async()=>{let i=zu({configUri:t,experiments:e,featureKey:n});if(!i)throw new Error("SmartCanvas overlays: recipe URI missing (env + feature unset).");let o=await fetch(i,{credentials:r});if(!o.ok)throw new Error(`SmartCanvas overlays: failed to fetch recipe (${o.status})`);let s=await o.json();return Yu.parse(s)};var wb="syntro_session_metrics",Ya=class{constructor(e={}){j(this,"metrics",new Map);j(this,"experiments");j(this,"attributePrefix");j(this,"onMetricChange");this.experiments=e.experiments,this.attributePrefix=e.attributePrefix??"session_",this.onMetricChange=e.onMetricChange,this.loadFromStorage()}increment(e,n=1){let i=(this.metrics.get(e)??0)+n;return this.metrics.set(e,i),this.saveToStorage(),this.updateExperimentAttributes(e,i),this.onMetricChange?.(e,i),i}set(e,n){this.metrics.set(e,n),this.saveToStorage(),this.updateExperimentAttributes(e,n),this.onMetricChange?.(e,n)}get(e){return this.metrics.get(e)??0}meetsThreshold(e,n){return this.get(e)>=n}getAll(){return Object.fromEntries(this.metrics)}reset(e){this.metrics.delete(e),this.saveToStorage(),this.updateExperimentAttributes(e,0),this.onMetricChange?.(e,0)}resetAll(){let e=Array.from(this.metrics.keys());this.metrics.clear(),this.saveToStorage();let n={};for(let r of e)n[`${this.attributePrefix}${r}`]=0,this.onMetricChange?.(r,0);this.experiments?.setAttributes?.(n)}setExperiments(e){this.experiments=e,this.syncAllToExperiments()}updateExperimentAttributes(e,n){if(!this.experiments?.setAttributes)return;let r=`${this.attributePrefix}${e}`;this.experiments.setAttributes({[r]:n})}syncAllToExperiments(){if(!this.experiments?.setAttributes)return;let e={};for(let[n,r]of this.metrics)e[`${this.attributePrefix}${n}`]=r;this.experiments.setAttributes(e)}loadFromStorage(){if(!(typeof window>"u"||typeof sessionStorage>"u"))try{let e=sessionStorage.getItem(wb);if(e){let n=JSON.parse(e);for(let[r,i]of Object.entries(n))this.metrics.set(r,i.count)}}catch(e){console.warn("[SessionMetricTracker] Failed to load from sessionStorage:",e)}}saveToStorage(){if(!(typeof window>"u"||typeof sessionStorage>"u"))try{let e={};for(let[n,r]of this.metrics)e[n]={count:r,lastUpdated:Date.now()};sessionStorage.setItem(wb,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function Xu(t={}){return new Ya(t)}var xb=S.object({url:S.string(),routeId:S.string().optional(),title:S.string().optional(),locale:S.string().optional()}),Sb=S.object({url:S.string(),ts:S.number()}),bb=S.object({sessionId:S.string(),startTs:S.number(),pageHistory:S.array(Sb).optional()}),kb=S.object({width:S.number(),height:S.number()}),Eb=S.object({x:S.number(),y:S.number(),w:S.number(),h:S.number()}),Cb=S.object({anchorId:S.string(),present:S.boolean(),visible:S.boolean().optional(),boundingBox:Eb.optional()}),Ab=S.record(S.union([S.number(),S.string(),S.boolean(),S.undefined()])),Tb=S.object({page:xb,session:bb,viewport:kb,anchors:S.array(Cb).optional(),augmented:Ab.optional()});function $P(t){return Tb.safeParse(t)}function DP(){let t=Date.now();return{page:{url:typeof window<"u"?window.location.href:"",title:typeof document<"u"?document.title:void 0},session:{sessionId:"",startTs:t,pageHistory:[]},viewport:{width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0}}}function wm(t,e){if(!e)return;let n;try{n=new URL(t).pathname}catch{n=t}if(e.exclude){for(let r of e.exclude)if(Rb(n,r))return}if(e.include){for(let r of e.include)if(Rb(n,r))return r;return}return n}function Rb(t,e){let n=t.replace(/\/$/,"")||"/",r=e.replace(/\/$/,"")||"/";if(n===r)return!0;let i=r.replace(/:[^/]+/g,"[^/]+").replace(/\*/g,".*");return new RegExp(`^${i}$`).test(n)}var Xa=class{constructor(e={}){j(this,"context");j(this,"previousContext");j(this,"listeners",new Set);j(this,"telemetry");j(this,"routes");j(this,"cleanupFns",[]);if(this.telemetry=e.telemetry,this.routes=e.routes,this.context=DP(),this.previousContext={...this.context},e.telemetry?.getSessionId){let n=e.telemetry.getSessionId();n&&(this.context.session.sessionId=n)}e.initialPageHistory&&(this.context.session.pageHistory=e.initialPageHistory),this.context.page.routeId=wm(this.context.page.url,this.routes),this.addPageToHistory(this.context.page.url),typeof window<"u"&&this.setupBrowserListeners()}get(){return{...this.context}}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setRoutes(e){this.routes=e;let n=wm(this.context.page.url,this.routes);n!==this.context.page.routeId&&this.updateContext({page:{...this.context.page,routeId:n}})}setAnchors(e){this.updateContext({anchors:e})}setSessionId(e){e!==this.context.session.sessionId&&this.updateContext({session:{...this.context.session,sessionId:e}})}destroy(){for(let e of this.cleanupFns)e();this.cleanupFns=[],this.listeners.clear()}setupBrowserListeners(){let e,n=()=>{clearTimeout(e),e=setTimeout(()=>{this.updateViewport()},100)};window.addEventListener("resize",n),this.cleanupFns.push(()=>window.removeEventListener("resize",n));let r=()=>{this.updatePage()};window.addEventListener("popstate",r),this.cleanupFns.push(()=>window.removeEventListener("popstate",r));let i=history.pushState.bind(history),o=history.replaceState.bind(history);history.pushState=(...s)=>{i(...s),this.updatePage()},history.replaceState=(...s)=>{o(...s),this.updatePage()},this.cleanupFns.push(()=>{history.pushState=i,history.replaceState=o})}updateViewport(){let e={width:window.innerWidth,height:window.innerHeight};(e.width!==this.context.viewport.width||e.height!==this.context.viewport.height)&&this.updateContext({viewport:e})}updatePage(){let e=window.location.href,n=document.title,r=wm(e,this.routes),i={url:e,title:n,routeId:r};(i.url!==this.context.page.url||i.title!==this.context.page.title||i.routeId!==this.context.page.routeId)&&(i.url!==this.context.page.url&&this.addPageToHistory(i.url),this.updateContext({page:i}))}addPageToHistory(e){let n={url:e,ts:Date.now()},r=[...this.context.session.pageHistory||[],n];r.length>50&&r.shift(),this.context.session.pageHistory=r}updateContext(e){this.previousContext={...this.context},this.context={...this.context,...e},this.notifyListeners()}notifyListeners(){for(let e of this.listeners)try{e(this.context,this.previousContext)}catch(n){console.error("[ContextManager] Listener error:",n)}}};function Qu(t={}){return new Xa(t)}var xm=S.enum(["posthog","canvas","derived"]),Ib=S.object({ts:S.number(),name:S.string(),source:xm,props:S.record(S.unknown()).optional(),schemaVersion:S.string()}),Pb=S.object({names:S.array(S.string()).optional(),patterns:S.array(S.string()).optional(),sources:S.array(xm).optional()});function BP(t){return Ib.safeParse(t)}function VP(t){return Pb.safeParse(t)}function Sm(t,e){return e?!(e.names&&e.names.length>0&&!e.names.includes(t.name)||e.patterns&&e.patterns.length>0&&!e.patterns.some(r=>{try{return new RegExp(r).test(t.name)}catch{return!1}})||e.sources&&e.sources.length>0&&!e.sources.includes(t.source)):!0}var Qa=class{constructor(e={}){j(this,"subscriptions",new Set);j(this,"history",[]);j(this,"maxHistorySize");this.maxHistorySize=e.maxHistorySize??100}subscribe(e,n){let r,i;typeof e=="function"?(r=void 0,i=e):(r=e,i=n);let o={filter:r,callback:i};return this.subscriptions.add(o),()=>{this.subscriptions.delete(o)}}publish(e,n,r="canvas"){let i={ts:Date.now(),name:e,source:r,props:n,schemaVersion:vi};this.publishEvent(i)}publishEvent(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift();for(let n of this.subscriptions)if(Sm(e,n.filter))try{n.callback(e)}catch(r){console.error("[EventBus] Subscriber error:",r)}}getRecent(e,n){let r=this.history;return e&&(r=r.filter(i=>Sm(i,e))),n&&n>0&&(r=r.slice(-n)),r}hasRecentEvent(e,n,r){let i=Date.now()-n;return this.history.some(o=>o.name===e&&o.ts>=i&&(r===void 0||o.source===r))}countRecentEvents(e,n){let r=this.history.filter(i=>Sm(i,e));if(n!==void 0){let i=Date.now()-n;r=r.filter(o=>o.ts>=i)}return r.length}clearHistory(){this.history=[]}getSubscriberCount(){return this.subscriptions.size}};function cs(t={}){return new Qa(t)}var Ob={$autocapture:"ui.click",$click:be.UI_CLICK,$scroll:be.UI_SCROLL,$input:be.UI_INPUT,$change:be.UI_CHANGE,$submit:be.UI_SUBMIT,$pageview:be.NAV_PAGE_VIEW,$pageleave:be.NAV_PAGE_LEAVE,$session_start:"session.start",$identify:"user.identify"};function zP(t){let e=t.event;if(typeof e!="string")return"posthog.unknown";if(Ob[e])return Ob[e];if(e==="$autocapture"){let n=t.properties?.$tag_name,r=t.properties?.$event_type;return r==="submit"?be.UI_SUBMIT:r==="change"?be.UI_CHANGE:n==="input"||n==="textarea"?be.UI_INPUT:be.UI_CLICK}return e.startsWith("$")?e.replace("$","posthog."):`posthog.${e}`}function HP(t){let e={},n=t.properties||{};return n.$tag_name&&(e.tagName=n.$tag_name),n.$el_text&&(e.elementText=n.$el_text),n.$elements&&(e.elements=n.$elements),n.$current_url&&(e.url=n.$current_url),n.$pathname&&(e.pathname=n.$pathname),n.$host&&(e.host=n.$host),n.$viewport_width&&(e.viewportWidth=n.$viewport_width),n.$viewport_height&&(e.viewportHeight=n.$viewport_height),n.$session_id&&(e.sessionId=n.$session_id),n.$scroll_depth&&(e.scrollDepth=n.$scroll_depth),n.$scroll_percentage&&(e.scrollPercentage=n.$scroll_percentage),e.originalEvent=t.event,e}function bm(t){let e;return typeof t.timestamp=="number"?e=t.timestamp:typeof t.timestamp=="string"?e=new Date(t.timestamp).getTime():e=Date.now(),{ts:e,name:zP(t),source:"posthog",props:HP(t),schemaVersion:vi}}function km(t){let e=t.event;return!(typeof e!="string"||["$feature_flag_called","$feature_flags","$groups","$groupidentify","$set","$set_once","$unset","$create_alias","$capture_metrics","$performance_event","$web_vitals","$exception","$dead_click","$heatmap"].includes(e))}function Ju(t){return(e,n)=>{if(typeof e!="string")return;let r={event:e,properties:n,timestamp:Date.now()};if(km(r)){let i=bm(r);t(i)}}}var Nb=S.object({value:S.unknown(),expiresAt:S.number().optional()}),Lb=S.object({count:S.number(),resetAt:S.number().optional()});function jP(t){return Nb.safeParse(t)}function UP(t){return Lb.safeParse(t)}var Ja="dismissed:";function Mb(t,e){return{mark(n,r=!1){let i=Ja+n;(r?e:t).set(i,!0)},isDismissed(n){let r=Ja+n;return t.has(r)||e.has(r)},clear(n){let r=Ja+n;t.remove(r),e.remove(r)},clearAll(){for(let n of t.keys())n.startsWith(Ja)&&t.remove(n);for(let n of e.keys())n.startsWith(Ja)&&e.remove(n)}}}var Em="cooldown:";function Fb(t){return{set(e,n){let r=Em+e,i=Date.now()+n;t.set(r,i)},isActive(e){return this.remaining(e)>0},remaining(e){let n=Em+e,r=t.get(n);if(r===void 0)return 0;let i=r-Date.now();return i<=0?(t.remove(n),0):i},clear(e){let n=Em+e;t.remove(n)}}}var Cm="freq:";function $b(t){function e(n){let r=Cm+n,i=t.get(r);if(i){if(i.resetAt&&Date.now()>=i.resetAt){t.remove(r);return}return i}}return{increment(n,r){let i=Cm+n,o=e(n),s=(o?.count??0)+1,a={count:s,resetAt:o?.resetAt??(r?Date.now()+r:void 0)};return t.set(i,a),s},count(n){return e(n)?.count??0},reset(n){let r=Cm+n;t.remove(r)},hasReachedLimit(n,r){return this.count(n)>=r}}}var WP="syntro";function Am(t,e){let n=`${e}:`;return{get(r){if(t)try{let i=t.getItem(n+r);if(!i)return;let o=JSON.parse(i);if(o.expiresAt&&Date.now()>=o.expiresAt){t.removeItem(n+r);return}return o.value}catch{return}},set(r,i,o){if(t)try{let s={value:i,expiresAt:o?Date.now()+o:void 0};t.setItem(n+r,JSON.stringify(s))}catch(s){console.warn("[StateStore] Failed to save:",s)}},remove(r){t&&t.removeItem(n+r)},has(r){return t?this.get(r)!==void 0:!1},keys(){if(!t)return[];let r=[];for(let i=0;i<t.length;i++){let o=t.key(i);o?.startsWith(n)&&r.push(o.slice(n.length))}return r},clear(){if(!t)return;let r=this.keys();for(let i of r)t.removeItem(n+i)}}}function Tm(t){let e=new Map,n=`${t}:`;return{get(r){let i=e.get(n+r);if(i){if(i.expiresAt&&Date.now()>=i.expiresAt){e.delete(n+r);return}return i.value}},set(r,i,o){e.set(n+r,{value:i,expiresAt:o?Date.now()+o:void 0})},remove(r){e.delete(n+r)},has(r){return this.get(r)!==void 0},keys(){let r=[];for(let i of e.keys())i.startsWith(n)&&r.push(i.slice(n.length));return r},clear(){for(let r of e.keys())r.startsWith(n)&&e.delete(r)}}}var el=class{constructor(e={}){j(this,"session");j(this,"user");j(this,"dismissals");j(this,"cooldowns");j(this,"frequency");j(this,"namespace");j(this,"namespacedStorages",new Map);this.namespace=e.namespace??WP,typeof window<"u"?(this.session=Am(typeof sessionStorage<"u"?sessionStorage:void 0,this.namespace),this.user=Am(typeof localStorage<"u"?localStorage:void 0,this.namespace)):(this.session=Tm(this.namespace),this.user=Tm(this.namespace)),this.dismissals=Mb(this.session,this.user),this.cooldowns=Fb(this.user),this.frequency=$b(this.session)}ns(e){let n=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(n)){let r=typeof window<"u"&&typeof sessionStorage<"u"?Am(sessionStorage,n):Tm(n);this.namespacedStorages.set(n,r)}return this.namespacedStorages.get(n)}};function ed(t={}){return new el(t)}var Db=S.object({type:S.literal("page_url"),url:S.string()}),Bb=S.object({type:S.literal("route"),routeId:S.string()}),Vb=S.object({type:S.literal("anchor_visible"),anchorId:S.string(),state:S.enum(["visible","present","absent"])}),zb=S.object({type:S.literal("event_occurred"),eventName:S.string(),withinMs:S.number().optional()}),Hb=S.object({type:S.literal("state_equals"),key:S.string(),value:S.unknown()}),jb=S.object({type:S.literal("viewport"),minWidth:S.number().optional(),maxWidth:S.number().optional(),minHeight:S.number().optional(),maxHeight:S.number().optional()}),Ub=S.object({type:S.literal("session_metric"),key:S.string(),operator:S.enum(["gte","lte","eq","gt","lt"]),threshold:S.number()}),Wb=S.object({type:S.literal("dismissed"),key:S.string(),inverted:S.boolean().optional()}),qb=S.object({type:S.literal("cooldown_active"),key:S.string(),inverted:S.boolean().optional()}),Kb=S.object({type:S.literal("frequency_limit"),key:S.string(),limit:S.number(),inverted:S.boolean().optional()}),Rm=S.discriminatedUnion("type",[Db,Bb,Vb,zb,Hb,jb,Ub,Wb,qb,Kb]),Gb=S.object({conditions:S.array(Rm),value:S.unknown()}),Zb=S.object({type:S.literal("rules"),rules:S.array(Gb),default:S.unknown()}),Yb=S.object({type:S.literal("score"),field:S.string(),threshold:S.number(),above:S.unknown(),below:S.unknown()}),Xb=S.object({type:S.literal("model"),modelId:S.string(),inputs:S.array(S.string()),outputMapping:S.record(S.unknown()),default:S.unknown()}),Qb=S.object({type:S.literal("external"),endpoint:S.string(),method:S.enum(["GET","POST"]).optional(),default:S.unknown(),timeoutMs:S.number().optional()}),Im=S.discriminatedUnion("type",[Zb,Yb,Xb,Qb]),Jb=S.object({include:S.array(S.string()).optional(),exclude:S.array(S.string()).optional()}),ek=S.object({routes:Jb.optional(),strategy:Im.optional()});function qP(t){return Rm.safeParse(t)}function KP(t){return Im.safeParse(t)}function GP(t){return ek.safeParse(t)}function Pm(t,e){let{context:n,state:r,events:i}=e;switch(t.type){case"page_url":{let{url:o}=t,s=n.page.url,a=o.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,".*").replace(/\*/g,"[^/]*");return new RegExp(`^${a}$`).test(s)}case"route":return n.page.routeId===t.routeId;case"anchor_visible":{let o=n.anchors?.find(s=>s.anchorId===t.anchorId);switch(t.state){case"visible":return o?.visible===!0;case"present":return o?.present===!0;case"absent":return!o?.present;default:return!1}}case"event_occurred":{if(!i)return!1;let o=t.withinMs??6e4;return i.hasRecentEvent(t.eventName,o)}case"state_equals":return!1;case"viewport":{let{width:o,height:s}=n.viewport;return!(t.minWidth!==void 0&&o<t.minWidth||t.maxWidth!==void 0&&o>t.maxWidth||t.minHeight!==void 0&&s<t.minHeight||t.maxHeight!==void 0&&s>t.maxHeight)}case"session_metric":{if(!r)return!1;let o=r.getSessionMetric(t.key),{operator:s,threshold:a}=t;switch(s){case"gte":return o>=a;case"lte":return o<=a;case"eq":return o===a;case"gt":return o>a;case"lt":return o<a;default:return!1}}case"dismissed":{if(!r)return t.inverted??!1;let o=r.isDismissed(t.key);return t.inverted?!o:o}case"cooldown_active":{if(!r)return t.inverted??!1;let o=r.isCooldownActive(t.key);return t.inverted?!o:o}case"frequency_limit":{if(!r)return t.inverted??!1;let s=r.getFrequencyCount(t.key)>=t.limit;return t.inverted?!s:s}default:return console.warn("[RuleStrategy] Unknown condition type:",t.type),!1}}function Om(t,e){let n=[];for(let r of t.conditions){let i=Pm(r,e);if(n.push({condition:r,result:i}),!i)return{matched:!1,conditionResults:n}}return{matched:!0,conditionResults:n}}function tl(t,e){for(let n=0;n<t.rules.length;n++){let r=t.rules[n],{matched:i,conditionResults:o}=Om(r,e);if(i)return{value:r.value,isFallback:!1,matchInfo:{strategyType:"rules",matchedRuleIndex:n,evaluatedConditions:o}}}return{value:t.default,isFallback:!0,matchInfo:{strategyType:"rules"}}}function nl(t,e){let{context:n}=e,r=n.augmented?.[t.field];return r===void 0||typeof r!="number"?{value:t.below,isFallback:!0,matchInfo:{strategyType:"score"}}:{value:r>=t.threshold?t.above:t.below,isFallback:!1,matchInfo:{strategyType:"score"}}}function tk(t,e){let{state:n,events:r,sessionMetrics:i}=e;return{context:t,state:n?{isDismissed:o=>n.dismissals.isDismissed(o),isCooldownActive:o=>n.cooldowns.isActive(o),getFrequencyCount:o=>n.frequency.count(o),getSessionMetric:o=>i?.get(o)??0}:void 0,events:r?{hasRecentEvent:(o,s)=>r.hasRecentEvent(o,s)}:void 0}}async function Nm(t,e,n={}){let r=tk(e,n);switch(t.type){case"rules":return tl(t,r);case"score":return nl(t,r);case"model":return{value:t.default,isFallback:!0,matchInfo:{strategyType:"model"}};case"external":return{value:t.default,isFallback:!0,matchInfo:{strategyType:"external"}};default:return console.warn("[DecisionEngine] Unknown strategy type:",t.type),{value:void 0,isFallback:!0,matchInfo:{strategyType:t.type}}}}function Lm(t,e,n={}){let r=tk(e,n);switch(t.type){case"rules":return tl(t,r);case"score":return nl(t,r);case"model":case"external":return{value:t.default,isFallback:!0,matchInfo:{strategyType:t.type}};default:return{value:void 0,isFallback:!0,matchInfo:{strategyType:t.type}}}}function td(t){return{evaluate:(e,n)=>Nm(e,n,t),evaluateSync:(e,n)=>Lm(e,n,t)}}var ZP=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button"]);function Mm(t){if(typeof window.Sanitizer=="function")try{let a=new window.Sanitizer({}).sanitizeToFragment(t),l=document.createElement("div");return l.append(a),l.innerHTML}catch{}let n=document.createElement("template");n.innerHTML=t;let r=n.content,i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,null),o=[];for(;i.nextNode();){let s=i.currentNode,a=s.tagName.toLowerCase();if(!ZP.has(a)){o.push(s);continue}for(let l of Array.from(s.attributes)){let c=l.name.toLowerCase(),u=l.value.trim().toLowerCase(),f=c.startsWith("on"),h=(c==="href"||c==="src")&&u.startsWith("javascript:");(f||h)&&s.removeAttribute(l.name)}}for(let s of o){for(;s.firstChild;)s.parentNode?.insertBefore(s.firstChild,s);s.remove()}return n.innerHTML}var nk=async(t,e)=>{let n=e.resolveAnchor(t.anchorId);if(!n)throw new Error(`Anchor not found: ${t.anchorId}`);let r=Mm(t.html),i=document.createElement("div");i.setAttribute("data-syntro-action-id",e.generateId()),i.innerHTML=r;let o=null;switch(t.position){case"before":n.insertAdjacentElement("beforebegin",i);break;case"after":n.insertAdjacentElement("afterend",i);break;case"prepend":n.insertBefore(i,n.firstChild);break;case"append":n.appendChild(i);break;case"replace":o=n.innerHTML,n.replaceWith(i);break}return e.publishEvent("action.applied",{id:e.generateId(),kind:"content:insertHtml",anchorId:t.anchorId,position:t.position}),{cleanup:()=>{if(t.position==="replace"&&o!==null){let s=document.createElement(n.tagName);s.innerHTML=o,Array.from(n.attributes).forEach(a=>{s.setAttribute(a.name,a.value)}),i.replaceWith(s)}else i.remove()},updateFn:s=>{"html"in s&&typeof s.html=="string"&&(i.innerHTML=Mm(s.html))}}},rk=async(t,e)=>{let n=e.resolveAnchor(t.anchorId);if(!n)throw new Error(`Anchor not found: ${t.anchorId}`);let r=n.textContent??"";return n.textContent=t.text,e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setText",anchorId:t.anchorId}),{cleanup:()=>{n.textContent=r},updateFn:i=>{"text"in i&&typeof i.text=="string"&&(n.textContent=i.text)}}},ik=async(t,e)=>{let n=e.resolveAnchor(t.anchorId);if(!n)throw new Error(`Anchor not found: ${t.anchorId}`);if(["onclick","onerror","onload","onmouseover","onfocus","onblur"].includes(t.attr.toLowerCase())||t.attr.startsWith("on"))throw new Error(`Dangerous attribute not allowed: ${t.attr}`);let i=n.getAttribute(t.attr),o=n.hasAttribute(t.attr);return n.setAttribute(t.attr,t.value),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setAttr",anchorId:t.anchorId,attr:t.attr}),{cleanup:()=>{o&&i!==null?n.setAttribute(t.attr,i):n.removeAttribute(t.attr)},updateFn:s=>{"value"in s&&typeof s.value=="string"&&n.setAttribute(t.attr,s.value)}}},ok=async(t,e)=>{let n=e.resolveAnchor(t.anchorId);if(!n)throw new Error(`Anchor not found: ${t.anchorId}`);let r=n.classList.contains(t.className);return n.classList.add(t.className),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:addClass",anchorId:t.anchorId,className:t.className}),{cleanup:()=>{r||n.classList.remove(t.className)}}},sk=async(t,e)=>{let n=e.resolveAnchor(t.anchorId);if(!n)throw new Error(`Anchor not found: ${t.anchorId}`);let r=n.classList.contains(t.className);return n.classList.remove(t.className),e.publishEvent("action.applied",{id:e.generateId(),kind:"content:removeClass",anchorId:t.anchorId,className:t.className}),{cleanup:()=>{r&&n.classList.add(t.className)}}},ak=async(t,e)=>{let n=e.resolveAnchor(t.anchorId);if(!n)throw new Error(`Anchor not found: ${t.anchorId}`);let r=new Map;for(let i of Object.keys(t.styles)){let o=n.style.getPropertyValue(i);r.set(i,o)}for(let[i,o]of Object.entries(t.styles))n.style.setProperty(i,o);return e.publishEvent("action.applied",{id:e.generateId(),kind:"content:setStyle",anchorId:t.anchorId,styles:Object.keys(t.styles)}),{cleanup:()=>{for(let[i,o]of r)o?n.style.setProperty(i,o):n.style.removeProperty(i)},updateFn:i=>{if("styles"in i&&typeof i.styles=="object"&&i.styles)for(let[o,s]of Object.entries(i.styles))n.style.setProperty(o,s)}}},Fm=[{kind:"content:insertHtml",executor:nk},{kind:"content:setText",executor:rk},{kind:"content:setAttr",executor:ik},{kind:"content:addClass",executor:ok},{kind:"content:removeClass",executor:sk},{kind:"content:setStyle",executor:ak}],lk={id:"adaptive-content",version:"1.0.0",name:"Content",description:"DOM manipulation for text, attributes, and styles",executors:Fm};var ck=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function uk(t,e,n){let r=n?.paddingPx??12,i=n?.radiusPx??12,o=Math.min(Math.max(n?.scrimOpacity??.55,0),1),s=n?.ringColor??"var(--syntro-ring, #5b8cff)",a=n?.blocking??!1,l=n?.onClickOutside??!0,c=n?.onEsc??!0,u=getComputedStyle(document.documentElement),f=u.getPropertyValue("--syntro-spotlight-backdrop").trim(),h=u.getPropertyValue("--syntro-ring").trim(),g=document.createElement("div");g.className="syntro-spotlight-scrim";let v=a||l;Object.assign(g.style,{position:"fixed",inset:"0",zIndex:"2147483646",pointerEvents:v?"auto":"none",background:f||`rgba(2, 6, 23, ${o})`,transition:"opacity 220ms ease",opacity:"0"}),e.appendChild(g),requestAnimationFrame(()=>g.style.opacity="1");let _=document.createElement("div");_.className="syntro-spotlight-ring",Object.assign(_.style,{position:"fixed",pointerEvents:"none",borderRadius:`${i}px`,border:`2px solid ${s||h||"#5b8cff"}`,boxShadow:"0 0 0 4px rgba(255,255,255,0.35)",zIndex:"2147483647",transition:"all 220ms cubic-bezier(0.16,1,0.3,1)"}),e.appendChild(_);let x=[];if(!ck)for(let I=0;I<4;I++){let A=document.createElement("div");A.style.position="fixed",A.style.background="inherit",x.push(A),g.appendChild(A)}let d=I=>{g.style.clipPath=I,g.style.webkitClipPath=I},p=()=>{let I=t.getBoundingClientRect(),A=Math.max(0,I.left-r),H=Math.max(0,I.top-r),K=Math.min(window.innerWidth,I.width+r*2),Y=Math.min(window.innerHeight,I.height+r*2);if(Object.assign(_.style,{left:`${A}px`,top:`${H}px`,width:`${K}px`,height:`${Y}px`}),ck){let W=window.innerWidth,le=window.innerHeight,B=Math.min(i,K/2,Y/2),X=`M 0 0 L ${W} 0 L ${W} ${le} L 0 ${le} Z`,V=`M ${A+B} ${H} A ${B} ${B} 0 0 0 ${A} ${H+B} L ${A} ${H+Y-B} A ${B} ${B} 0 0 0 ${A+B} ${H+Y} L ${A+K-B} ${H+Y} A ${B} ${B} 0 0 0 ${A+K} ${H+Y-B} L ${A+K} ${H+B} A ${B} ${B} 0 0 0 ${A+K-B} ${H} L ${A+B} ${H} Z`;d(`path('${X} ${V}')`)}else{let[W,le,B,X]=x;Object.assign(W.style,{left:"0px",top:"0px",width:"100vw",height:`${H}px`}),Object.assign(B.style,{left:"0px",top:`${H+Y}px`,width:"100vw",height:`${Math.max(0,window.innerHeight-(H+Y))}px`}),Object.assign(X.style,{left:"0px",top:`${H}px`,width:`${A}px`,height:`${Y}px`}),Object.assign(le.style,{left:`${A+K}px`,top:`${H}px`,width:`${Math.max(0,window.innerWidth-(A+K))}px`,height:`${Y}px`})}},m=new ResizeObserver(()=>requestAnimationFrame(p));m.observe(t);let y=()=>requestAnimationFrame(p),w=()=>requestAnimationFrame(p);window.addEventListener("scroll",y,!0),window.addEventListener("resize",w);let b=I=>{I.key==="Escape"&&c&&E.destroy()};c&&window.addEventListener("keydown",b);let k=I=>{a?(I.preventDefault(),I.stopPropagation()):l&&E.destroy()};g.addEventListener("click",k);let E={destroy(){m.disconnect(),window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",w),c&&window.removeEventListener("keydown",b),g.removeEventListener("click",k),g.style.opacity="0",setTimeout(()=>{g.remove(),_.remove()},220)}};return p(),E}var pk=["top","right","bottom","left"];var en=Math.min,ct=Math.max,Nn=Math.round,Ln=Math.floor,Pe=t=>({x:t,y:t}),YP={left:"right",right:"left",bottom:"top",top:"bottom"},XP={start:"end",end:"start"};function rd(t,e,n){return ct(t,en(e,n))}function Yi(t,e){return typeof t=="function"?t(e):t}function ai(t){return t.split("-")[0]}function us(t){return t.split("-")[1]}function $m(t){return t==="x"?"y":"x"}function id(t){return t==="y"?"height":"width"}var QP=new Set(["top","bottom"]);function fr(t){return QP.has(ai(t))?"y":"x"}function od(t){return $m(fr(t))}function hk(t,e,n){n===void 0&&(n=!1);let r=us(t),i=od(t),o=id(i),s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=rl(s)),[s,rl(s)]}function gk(t){let e=rl(t);return[nd(t),e,nd(e)]}function nd(t){return t.replace(/start|end/g,e=>XP[e])}var dk=["left","right"],fk=["right","left"],JP=["top","bottom"],e2=["bottom","top"];function t2(t,e,n){switch(t){case"top":case"bottom":return n?e?fk:dk:e?dk:fk;case"left":case"right":return e?JP:e2;default:return[]}}function mk(t,e,n,r){let i=us(t),o=t2(ai(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(nd)))),o}function rl(t){return t.replace(/left|right|bottom|top/g,e=>YP[e])}function n2(t){return{top:0,right:0,bottom:0,left:0,...t}}function Dm(t){return typeof t!="number"?n2(t):{top:t,right:t,bottom:t,left:t}}function Mn(t){let{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function vk(t,e,n){let{reference:r,floating:i}=t,o=fr(e),s=od(e),a=id(s),l=ai(e),c=o==="y",u=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2,g;switch(l){case"top":g={x:u,y:r.y-i.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-i.width,y:f};break;default:g={x:r.x,y:r.y}}switch(us(e)){case"start":g[s]-=h*(n&&c?-1:1);break;case"end":g[s]+=h*(n&&c?-1:1);break}return g}var sd=async(t,e,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e)),c=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=vk(c,r,l),h=r,g={},v=0;for(let _=0;_<a.length;_++){let{name:x,fn:d}=a[_],{x:p,y:m,data:y,reset:w}=await d({x:u,y:f,initialPlacement:r,placement:h,strategy:i,middlewareData:g,rects:c,platform:s,elements:{reference:t,floating:e}});u=p??u,f=m??f,g={...g,[x]:{...g[x],...y}},w&&v<=50&&(v++,typeof w=="object"&&(w.placement&&(h=w.placement),w.rects&&(c=w.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):w.rects),{x:u,y:f}=vk(c,h,l)),_=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:g}};async function ds(t,e){var n;e===void 0&&(e={});let{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:g=0}=Yi(e,t),v=Dm(g),x=a[h?f==="floating"?"reference":"floating":f],d=Mn(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(x)))==null||n?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),p=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,m=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),y=await(o.isElement==null?void 0:o.isElement(m))?await(o.getScale==null?void 0:o.getScale(m))||{x:1,y:1}:{x:1,y:1},w=Mn(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:p,offsetParent:m,strategy:l}):p);return{top:(d.top-w.top+v.top)/y.y,bottom:(w.bottom-d.bottom+v.bottom)/y.y,left:(d.left-w.left+v.left)/y.x,right:(w.right-d.right+v.right)/y.x}}var Bm=t=>({name:"arrow",options:t,async fn(e){let{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=Yi(t,e)||{};if(c==null)return{};let f=Dm(u),h={x:n,y:r},g=od(i),v=id(g),_=await s.getDimensions(c),x=g==="y",d=x?"top":"left",p=x?"bottom":"right",m=x?"clientHeight":"clientWidth",y=o.reference[v]+o.reference[g]-h[g]-o.floating[v],w=h[g]-o.reference[g],b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c)),k=b?b[m]:0;(!k||!await(s.isElement==null?void 0:s.isElement(b)))&&(k=a.floating[m]||o.floating[v]);let E=y/2-w/2,I=k/2-_[v]/2-1,A=en(f[d],I),H=en(f[p],I),K=A,Y=k-_[v]-H,W=k/2-_[v]/2+E,le=rd(K,W,Y),B=!l.arrow&&us(i)!=null&&W!==le&&o.reference[v]/2-(W<K?A:H)-_[v]/2<0,X=B?W<K?W-K:W-Y:0;return{[g]:h[g]+X,data:{[g]:le,centerOffset:W-le-X,...B&&{alignmentOffset:X}},reset:B}}});var ad=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;let{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:_=!0,...x}=Yi(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let d=ai(i),p=fr(a),m=ai(a)===a,y=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(m||!_?[rl(a)]:gk(a)),b=v!=="none";!h&&b&&w.push(...mk(a,_,v,y));let k=[a,...w],E=await ds(e,x),I=[],A=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&I.push(E[d]),f){let W=hk(i,s,y);I.push(E[W[0]],E[W[1]])}if(A=[...A,{placement:i,overflows:I}],!I.every(W=>W<=0)){var H,K;let W=(((H=o.flip)==null?void 0:H.index)||0)+1,le=k[W];if(le&&(!(f==="alignment"?p!==fr(le):!1)||A.every(V=>fr(V.placement)===p?V.overflows[0]>0:!0)))return{data:{index:W,overflows:A},reset:{placement:le}};let B=(K=A.filter(X=>X.overflows[0]<=0).sort((X,V)=>X.overflows[1]-V.overflows[1])[0])==null?void 0:K.placement;if(!B)switch(g){case"bestFit":{var Y;let X=(Y=A.filter(V=>{if(b){let Z=fr(V.placement);return Z===p||Z==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(Z=>Z>0).reduce((Z,vt)=>Z+vt,0)]).sort((V,Z)=>V[1]-Z[1])[0])==null?void 0:Y[0];X&&(B=X);break}case"initialPlacement":B=a;break}if(i!==B)return{reset:{placement:B}}}return{}}}};function yk(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function _k(t){return pk.some(e=>t[e]>=0)}var Vm=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:n}=e,{strategy:r="referenceHidden",...i}=Yi(t,e);switch(r){case"referenceHidden":{let o=await ds(e,{...i,elementContext:"reference"}),s=yk(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:_k(s)}}}case"escaped":{let o=await ds(e,{...i,altBoundary:!0}),s=yk(o,n.floating);return{data:{escapedOffsets:s,escaped:_k(s)}}}default:return{}}}}};var r2=new Set(["left","top"]);async function i2(t,e){let{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=ai(n),a=us(n),l=fr(n)==="y",c=r2.has(s)?-1:1,u=o&&l?-1:1,f=Yi(e,t),{mainAxis:h,crossAxis:g,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*u,y:h*c}:{x:h*c,y:g*u}}var ld=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;let{x:i,y:o,placement:s,middlewareData:a}=e,l=await i2(e,t);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},cd=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:d,y:p}=x;return{x:d,y:p}}},...l}=Yi(t,e),c={x:n,y:r},u=await ds(e,l),f=fr(ai(i)),h=$m(f),g=c[h],v=c[f];if(o){let x=h==="y"?"top":"left",d=h==="y"?"bottom":"right",p=g+u[x],m=g-u[d];g=rd(p,g,m)}if(s){let x=f==="y"?"top":"left",d=f==="y"?"bottom":"right",p=v+u[x],m=v-u[d];v=rd(p,v,m)}let _=a.fn({...e,[h]:g,[f]:v});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[h]:o,[f]:s}}}}}};function ud(){return typeof window<"u"}function mn(t){return xk(t)?(t.nodeName||"").toLowerCase():"#document"}function Oe(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function $e(t){var e;return(e=(xk(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function xk(t){return ud()?t instanceof Node||t instanceof Oe(t).Node:!1}function Ne(t){return ud()?t instanceof Element||t instanceof Oe(t).Element:!1}function Ve(t){return ud()?t instanceof HTMLElement||t instanceof Oe(t).HTMLElement:!1}function wk(t){return!ud()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Oe(t).ShadowRoot}var o2=new Set(["inline","contents"]);function $n(t){let{overflow:e,overflowX:n,overflowY:r,display:i}=Le(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!o2.has(i)}var s2=new Set(["table","td","th"]);function dd(t){return s2.has(mn(t))}var a2=[":popover-open",":modal"];function pr(t){return a2.some(e=>{try{return t.matches(e)}catch{return!1}})}var l2=["transform","translate","scale","rotate","perspective"],c2=["transform","translate","scale","rotate","perspective","filter"],u2=["paint","layout","strict","content"];function Xi(t){let e=Qi(),n=Ne(t)?Le(t):t;return l2.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||c2.some(r=>(n.willChange||"").includes(r))||u2.some(r=>(n.contain||"").includes(r))}function fd(t){let e=mt(t);for(;Ve(e)&&!tn(e);){if(Xi(e))return e;if(pr(e))return null;e=mt(e)}return null}function Qi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var d2=new Set(["html","body","#document"]);function tn(t){return d2.has(mn(t))}function Le(t){return Oe(t).getComputedStyle(t)}function Dn(t){return Ne(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function mt(t){if(mn(t)==="html")return t;let e=t.assignedSlot||t.parentNode||wk(t)&&t.host||$e(t);return wk(e)?e.host:e}function Sk(t){let e=mt(t);return tn(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ve(e)&&$n(e)?e:Sk(e)}function Fn(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);let i=Sk(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Oe(i);if(o){let a=Ji(s);return e.concat(s,s.visualViewport||[],$n(i)?i:[],a&&n?Fn(a):[])}return e.concat(i,Fn(i,[],n))}function Ji(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Ck(t){let e=Le(t),n=parseFloat(e.width)||0,r=parseFloat(e.height)||0,i=Ve(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,a=Nn(n)!==o||Nn(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Hm(t){return Ne(t)?t:t.contextElement}function fs(t){let e=Hm(t);if(!Ve(e))return Pe(1);let n=e.getBoundingClientRect(),{width:r,height:i,$:o}=Ck(e),s=(o?Nn(n.width):n.width)/r,a=(o?Nn(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var m2=Pe(0);function Ak(t){let e=Oe(t);return!Qi()||!e.visualViewport?m2:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function v2(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Oe(t)?!1:e}function eo(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);let i=t.getBoundingClientRect(),o=Hm(t),s=Pe(1);e&&(r?Ne(r)&&(s=fs(r)):s=fs(t));let a=v2(o,n,r)?Ak(o):Pe(0),l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,u=i.width/s.x,f=i.height/s.y;if(o){let h=Oe(o),g=r&&Ne(r)?Oe(r):r,v=h,_=Ji(v);for(;_&&r&&g!==v;){let x=fs(_),d=_.getBoundingClientRect(),p=Le(_),m=d.left+(_.clientLeft+parseFloat(p.paddingLeft))*x.x,y=d.top+(_.clientTop+parseFloat(p.paddingTop))*x.y;l*=x.x,c*=x.y,u*=x.x,f*=x.y,l+=m,c+=y,v=Oe(_),_=Ji(v)}}return Mn({width:u,height:f,x:l,y:c})}function pd(t,e){let n=Dn(t).scrollLeft;return e?e.left+n:eo($e(t)).left+n}function Tk(t,e){let n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-pd(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function y2(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t,o=i==="fixed",s=$e(r),a=e?pr(e.floating):!1;if(r===s||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=Pe(1),u=Pe(0),f=Ve(r);if((f||!f&&!o)&&((mn(r)!=="body"||$n(s))&&(l=Dn(r)),Ve(r))){let g=eo(r);c=fs(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}let h=s&&!f&&!o?Tk(s,l):Pe(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function _2(t){return Array.from(t.getClientRects())}function w2(t){let e=$e(t),n=Dn(t),r=t.ownerDocument.body,i=ct(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=ct(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight),s=-n.scrollLeft+pd(t),a=-n.scrollTop;return Le(r).direction==="rtl"&&(s+=ct(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}var bk=25;function x2(t,e){let n=Oe(t),r=$e(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;let u=Qi();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}let c=pd(r);if(c<=0){let u=r.ownerDocument,f=u.body,h=getComputedStyle(f),g=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,v=Math.abs(r.clientWidth-f.clientWidth-g);v<=bk&&(o-=v)}else c<=bk&&(o+=c);return{width:o,height:s,x:a,y:l}}var S2=new Set(["absolute","fixed"]);function b2(t,e){let n=eo(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=Ve(t)?fs(t):Pe(1),s=t.clientWidth*o.x,a=t.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:s,height:a,x:l,y:c}}function kk(t,e,n){let r;if(e==="viewport")r=x2(t,n);else if(e==="document")r=w2($e(t));else if(Ne(e))r=b2(e,n);else{let i=Ak(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Mn(r)}function Rk(t,e){let n=mt(t);return n===e||!Ne(n)||tn(n)?!1:Le(n).position==="fixed"||Rk(n,e)}function k2(t,e){let n=e.get(t);if(n)return n;let r=Fn(t,[],!1).filter(a=>Ne(a)&&mn(a)!=="body"),i=null,o=Le(t).position==="fixed",s=o?mt(t):t;for(;Ne(s)&&!tn(s);){let a=Le(s),l=Xi(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&S2.has(i.position)||$n(s)&&!l&&Rk(t,s))?r=r.filter(u=>u!==s):i=a,s=mt(s)}return e.set(t,r),r}function E2(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t,s=[...n==="clippingAncestors"?pr(e)?[]:k2(e,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{let f=kk(e,u,i);return c.top=ct(f.top,c.top),c.right=en(f.right,c.right),c.bottom=en(f.bottom,c.bottom),c.left=ct(f.left,c.left),c},kk(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function C2(t){let{width:e,height:n}=Ck(t);return{width:e,height:n}}function A2(t,e,n){let r=Ve(e),i=$e(e),o=n==="fixed",s=eo(t,!0,o,e),a={scrollLeft:0,scrollTop:0},l=Pe(0);function c(){l.x=pd(i)}if(r||!r&&!o)if((mn(e)!=="body"||$n(i))&&(a=Dn(e)),r){let g=eo(e,!0,o,e);l.x=g.x+e.clientLeft,l.y=g.y+e.clientTop}else i&&c();o&&!r&&i&&c();let u=i&&!r&&!o?Tk(i,a):Pe(0),f=s.left+a.scrollLeft-l.x-u.x,h=s.top+a.scrollTop-l.y-u.y;return{x:f,y:h,width:s.width,height:s.height}}function zm(t){return Le(t).position==="static"}function Ek(t,e){if(!Ve(t)||Le(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return $e(t)===n&&(n=n.ownerDocument.body),n}function Ik(t,e){let n=Oe(t);if(pr(t))return n;if(!Ve(t)){let i=mt(t);for(;i&&!tn(i);){if(Ne(i)&&!zm(i))return i;i=mt(i)}return n}let r=Ek(t,e);for(;r&&dd(r)&&zm(r);)r=Ek(r,e);return r&&tn(r)&&zm(r)&&!Xi(r)?n:r||fd(t)||n}var T2=async function(t){let e=this.getOffsetParent||Ik,n=this.getDimensions,r=await n(t.floating);return{reference:A2(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function R2(t){return Le(t).direction==="rtl"}var I2={convertOffsetParentRelativeRectToViewportRelativeRect:y2,getDocumentElement:$e,getClippingRect:E2,getOffsetParent:Ik,getElementRects:T2,getClientRects:_2,getDimensions:C2,getScale:fs,isElement:Ne,isRTL:R2};function Pk(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function P2(t,e){let n=null,r,i=$e(t);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();let c=t.getBoundingClientRect(),{left:u,top:f,width:h,height:g}=c;if(a||e(),!h||!g)return;let v=Ln(f),_=Ln(i.clientWidth-(u+h)),x=Ln(i.clientHeight-(f+g)),d=Ln(u),m={rootMargin:-v+"px "+-_+"px "+-x+"px "+-d+"px",threshold:ct(0,en(1,l))||1},y=!0;function w(b){let k=b[0].intersectionRatio;if(k!==l){if(!y)return s();k?s(!1,k):r=setTimeout(()=>{s(!1,1e-7)},1e3)}k===1&&!Pk(c,t.getBoundingClientRect())&&s(),y=!1}try{n=new IntersectionObserver(w,{...m,root:i.ownerDocument})}catch{n=new IntersectionObserver(w,m)}n.observe(t)}return s(!0),o}function Ok(t,e,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Hm(t),u=i||o?[...c?Fn(c):[],...Fn(e)]:[];u.forEach(d=>{i&&d.addEventListener("scroll",n,{passive:!0}),o&&d.addEventListener("resize",n)});let f=c&&a?P2(c,n):null,h=-1,g=null;s&&(g=new ResizeObserver(d=>{let[p]=d;p&&p.target===c&&g&&(g.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var m;(m=g)==null||m.observe(e)})),n()}),c&&!l&&g.observe(c),g.observe(e));let v,_=l?eo(t):null;l&&x();function x(){let d=eo(t);_&&!Pk(_,d)&&n(),_=d,v=requestAnimationFrame(x)}return n(),()=>{var d;u.forEach(p=>{i&&p.removeEventListener("scroll",n),o&&p.removeEventListener("resize",n)}),f?.(),(d=g)==null||d.disconnect(),g=null,l&&cancelAnimationFrame(v)}}var Nk=ld;var Lk=cd,Mk=ad;var Fk=Vm,$k=Bm;var Dk=(t,e,n)=>{let r=new Map,i={platform:I2,...n},o={...i.platform,_c:r};return sd(t,e,{...i,platform:o})};var O2=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button"]);function Vt(t){if(typeof window.Sanitizer=="function")try{let a=new window.Sanitizer({}).sanitizeToFragment(t),l=document.createElement("div");return l.append(a),l.innerHTML}catch{}let n=document.createElement("template");n.innerHTML=t;let r=n.content,i=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,null),o=[];for(;i.nextNode();){let s=i.currentNode,a=s.tagName.toLowerCase();if(!O2.has(a)){o.push(s);continue}for(let l of Array.from(s.attributes)){let c=l.name.toLowerCase(),u=l.value.trim().toLowerCase(),f=c.startsWith("on"),h=(c==="href"||c==="src")&&u.startsWith("javascript:");(f||h)&&s.removeAttribute(l.name)}}for(let s of o){for(;s.firstChild;)s.parentNode?.insertBefore(s.firstChild,s);s.remove()}return n.innerHTML}function N2(t){let e=t.getBoundingClientRect(),n=window.innerWidth,r=window.innerHeight;if(!(e.width>n*.8||e.height>r*.8))return t;let o=Math.max(e.left,0),s=Math.max(e.top,0),a=Math.min(e.right,n),l=Math.min(e.bottom,r),c=(o+a)/2,u=(s+l)/2;return{getBoundingClientRect(){return{width:0,height:0,x:c,y:u,top:u,left:c,right:c,bottom:u}}}}function Bk(t,e,n){let r=t.getBoundingClientRect();r.width>window.innerWidth*.8||r.height>window.innerHeight*.8||t.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});let o=document.createElement("div");o.className="syntro-tooltip",o.setAttribute("role","tooltip"),o.innerHTML=Vt(n.html);let s=o.querySelectorAll("[data-syntro-action]"),a=d=>{let m=d.currentTarget.getAttribute("data-syntro-action");m&&n.onAction&&n.onAction(m)};s.forEach(d=>d.addEventListener("click",a));let l=document.createElement("div");l.className="syntro-tooltip-arrow",o.appendChild(l),e.appendChild(o);let c=[Nk(n.offsetPx??8),Mk(),Lk({padding:8}),Fk(),$k({element:l})],u=n.placement&&n.placement!=="auto"?n.placement:"top",f=Ok(t,o,async()=>{let d=N2(t),p=await Dk(d,o,{placement:u,middleware:c}),{x:m,y,strategy:w,middlewareData:b,placement:k}=p;if(Object.assign(o.style,{left:`${m}px`,top:`${y}px`,position:w}),b.arrow){let{x:E,y:I}=b.arrow,A=k.split("-")[0],H={top:"bottom",right:"left",bottom:"top",left:"right"};Object.assign(l.style,{left:E!=null?`${E}px`:"",top:I!=null?`${I}px`:"",right:"",bottom:"",[H[A]]:"-4px"});let K={top:"0deg",right:"90deg",bottom:"180deg",left:"270deg"};l.style.transform=`rotate(${K[A]||"0deg"})`}}),h=d=>{d.key==="Escape"&&x.destroy()};window.addEventListener("keydown",h);let g=[];if(n.blocking){Array.from(document.body.children).forEach(p=>{p!==e&&p.getAttribute("inert")===null&&(p.setAttribute("inert",""),g.push(p.id||p.tagName))});let d=Array.from(o.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'));if(d.length>0){let p=d[0],m=d[d.length-1],y=w=>{w.key==="Tab"&&(w.shiftKey?document.activeElement===p&&(m.focus(),w.preventDefault()):document.activeElement===m&&(p.focus(),w.preventDefault()))};o.addEventListener("keydown",y),requestAnimationFrame(()=>p.focus())}}let _=(()=>{if(n.trigger==="hover"){let d=()=>{o.style.visibility="visible",o.style.opacity="1"},p=()=>{o.style.visibility="hidden",o.style.opacity="0"};return o.style.visibility="hidden",o.style.opacity="0",o.style.transition="opacity 200ms ease, visibility 200ms",t.addEventListener("mouseenter",d),t.addEventListener("mouseleave",p),t.addEventListener("focus",d),t.addEventListener("blur",p),()=>{t.removeEventListener("mouseenter",d),t.removeEventListener("mouseleave",p),t.removeEventListener("focus",d),t.removeEventListener("blur",p)}}if(n.trigger==="click"){let d=()=>{o.style.visibility==="visible"?x.destroy():(o.style.visibility="visible",o.style.opacity="1")};return o.style.visibility="hidden",o.style.opacity="0",o.style.transition="opacity 200ms ease, visibility 200ms",t.addEventListener("click",d),()=>t.removeEventListener("click",d)}return o.style.opacity="0",o.style.transition="opacity 200ms ease",requestAnimationFrame(()=>{o.style.opacity="1"}),()=>{}})(),x={el:o,destroy(){f(),_(),window.removeEventListener("keydown",h),s.forEach(d=>d.removeEventListener("click",a)),n.blocking&&Array.from(document.body.children).forEach(d=>{d!==e&&d.removeAttribute("inert")}),o.style.opacity="0",setTimeout(()=>o.remove(),200)}};return x}var jm=async(t,e)=>{let{content:n,size:r="md",blocking:i=!1,scrim:o,dismiss:s,ctaButtons:a}=t,l=document.createElement("div");l.className="syntro-modal-scrim",l.style.cssText=`
|
|
54
54
|
position: fixed;
|
|
55
55
|
inset: 0;
|
|
56
56
|
background: rgba(0, 0, 0, ${o?.opacity??.6});
|