@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.
@@ -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 NS="https://cdn.syntrologie.com/editor-sdk/latest/editor-sdk.js",LS=["cdn.syntrologie.com","api.syntrologie.com","dev-api.syntrologie.com","localhost","127.0.0.1",".syntrologie.com"];function $R(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=LS.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:LS,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 DR=()=>{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},BR=()=>{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)},MS=()=>DR()?"editor":BR()?"audit":null;function VR(){if(typeof window>"u")return null;let t=new URLSearchParams(window.location.search);return t.get("editor_token")||t.get("audit_token")}var FS=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||NS,a=VR();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===NS,hasApiBase:!!i,tokenPrefix:a.slice(0,10)+"..."}),!$R(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 Vg=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=OS(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=MS();c&&(console.log(`[SmartCanvas] Loading editor SDK for ${c} mode`),FS(t.editorUrl).catch(console.error)),TS();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??Qo({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 Vg(t)}});var S={};Wk(S,{BRAND:()=>fI,DIRTY:()=>Pi,EMPTY_PATH:()=>UR,INVALID:()=>U,NEVER:()=>YI,OK:()=>lt,ParseStatus:()=>tt,Schema:()=>J,ZodAny:()=>ii,ZodArray:()=>dr,ZodBigInt:()=>Ni,ZodBoolean:()=>Li,ZodBranded:()=>ja,ZodCatch:()=>Wi,ZodDate:()=>Mi,ZodDefault:()=>Ui,ZodDiscriminatedUnion:()=>Au,ZodEffects:()=>Jt,ZodEnum:()=>Hi,ZodError:()=>Tt,ZodFirstPartyTypeKind:()=>q,ZodFunction:()=>Ru,ZodIntersection:()=>Bi,ZodIssueCode:()=>T,ZodLazy:()=>Vi,ZodLiteral:()=>zi,ZodMap:()=>os,ZodNaN:()=>as,ZodNativeEnum:()=>ji,ZodNever:()=>hn,ZodNull:()=>$i,ZodNullable:()=>Pn,ZodNumber:()=>Oi,ZodObject:()=>Rt,ZodOptional:()=>Xt,ZodParsedType:()=>M,ZodPipeline:()=>Ua,ZodPromise:()=>oi,ZodReadonly:()=>qi,ZodRecord:()=>Tu,ZodSchema:()=>J,ZodSet:()=>ss,ZodString:()=>ri,ZodSymbol:()=>rs,ZodTransformer:()=>Jt,ZodTuple:()=>In,ZodType:()=>J,ZodUndefined:()=>Fi,ZodUnion:()=>Di,ZodUnknown:()=>ur,ZodVoid:()=>is,addIssueToContext:()=>P,any:()=>xI,array:()=>EI,bigint:()=>mI,boolean:()=>KS,coerce:()=>ZI,custom:()=>US,date:()=>vI,datetimeRegex:()=>HS,defaultErrorMap:()=>lr,discriminatedUnion:()=>RI,effect:()=>zI,enum:()=>DI,function:()=>MI,getErrorMap:()=>es,getParsedType:()=>Rn,instanceof:()=>hI,intersection:()=>II,isAborted:()=>Eu,isAsync:()=>ts,isDirty:()=>Cu,isValid:()=>ni,late:()=>pI,lazy:()=>FI,literal:()=>$I,makeIssue:()=>Ha,map:()=>NI,nan:()=>gI,nativeEnum:()=>BI,never:()=>bI,null:()=>wI,nullable:()=>jI,number:()=>qS,object:()=>CI,objectUtil:()=>zg,oboolean:()=>GI,onumber:()=>KI,optional:()=>HI,ostring:()=>qI,pipeline:()=>WI,preprocess:()=>UI,promise:()=>VI,quotelessJson:()=>zR,record:()=>OI,set:()=>LI,setErrorMap:()=>jR,strictObject:()=>AI,string:()=>WS,symbol:()=>yI,transformer:()=>zI,tuple:()=>PI,undefined:()=>_I,union:()=>TI,unknown:()=>SI,util:()=>re,void:()=>kI});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 zg;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(zg||(zg={}));var M=re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Rn=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"]),zR=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 HR=(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=HR;var $S=lr;function jR(t){$S=t}function es(){return $S}var Ha=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}},UR=[];function P(t,e){let n=es(),r=Ha({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"}),Pi=t=>({status:"dirty",value:t}),lt=t=>({status:"valid",value:t}),Eu=t=>t.status==="aborted",Cu=t=>t.status==="dirty",ni=t=>t.status==="valid",ts=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}},DS=(t,e)=>{if(ni(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 Rn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Rn(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:Rn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ts(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:Rn(e)},i=this._parseSync({data:e,path:r.path,parent:r});return DS(r,i)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rn(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return ni(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=>ni(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:Rn(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(ts(i)?i:Promise.resolve(i));return DS(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 Pn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return dr.create(this)}promise(){return oi.create(this,this._def)}or(e){return Di.create([this,e],this._def)}and(e){return Bi.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 Ui({...Q(this._def),innerType:this,defaultValue:n,typeName:q.ZodDefault})}brand(){return new ja({typeName:q.ZodBranded,type:this,...Q(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new Wi({...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 Ua.create(this,e)}readonly(){return qi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},WR=/^c[^\s-]{8,}$/i,qR=/^[0-9a-z]+$/,KR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,GR=/^[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,ZR=/^[a-z0-9_-]{21}$/i,YR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,XR=/^[-+]?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)?)??$/,QR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,JR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Hg,eI=/^(?:(?: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])$/,tI=/^(?:(?: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])$/,nI=/^(([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]))$/,rI=/^(([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])$/,iI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,oI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,VS="((\\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])))",sI=new RegExp(`^${VS}$`);function zS(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 aI(t){return new RegExp(`^${zS(t)}$`)}function HS(t){let e=`${VS}T${zS(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 lI(t,e){return!!((e==="v4"||!e)&&eI.test(t)||(e==="v6"||!e)&&nI.test(t))}function cI(t,e){if(!YR.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 uI(t,e){return!!((e==="v4"||!e)&&tI.test(t)||(e==="v6"||!e)&&rI.test(t))}var ri=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")QR.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")Hg||(Hg=new RegExp(JR,"u")),Hg.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")GR.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")ZR.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")WR.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")qR.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")KR.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"?HS(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"?sI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{code:T.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?aI(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"?XR.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"duration",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?lI(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"?cI(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"?uI(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"?iI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"base64",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?oI.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}};ri.create=t=>new ri({checks:[],typeName:q.ZodString,coerce:t?.coerce??!1,...Q(t)});function dI(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 Oi=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"?dI(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)}};Oi.create=t=>new Oi({checks:[],typeName:q.ZodNumber,coerce:t?.coerce||!1,...Q(t)});var Ni=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}};Ni.create=t=>new Ni({checks:[],typeName:q.ZodBigInt,coerce:t?.coerce??!1,...Q(t)});var Li=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)}};Li.create=t=>new Li({typeName:q.ZodBoolean,coerce:t?.coerce||!1,...Q(t)});var Mi=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}};Mi.create=t=>new Mi({checks:[],coerce:t?.coerce||!1,typeName:q.ZodDate,...Q(t)});var rs=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)}};rs.create=t=>new rs({typeName:q.ZodSymbol,...Q(t)});var Fi=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)}};Fi.create=t=>new Fi({typeName:q.ZodUndefined,...Q(t)});var $i=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)}};$i.create=t=>new $i({typeName:q.ZodNull,...Q(t)});var ii=class extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return lt(e.data)}};ii.create=t=>new ii({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 hn=class extends J{_parse(e){let n=this._getOrReturnCtx(e);return P(n,{code:T.invalid_type,expected:M.never,received:n.parsedType}),U}};hn.create=t=>new hn({typeName:q.ZodNever,...Q(t)});var is=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)}};is.create=t=>new is({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 ns(t){if(t instanceof Rt){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Xt.create(ns(r))}return new Rt({...t._def,shape:()=>e})}else return t instanceof dr?new dr({...t._def,type:ns(t.element)}):t instanceof Xt?Xt.create(ns(t.unwrap())):t instanceof Pn?Pn.create(ns(t.unwrap())):t instanceof In?In.create(t.items.map(e=>ns(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 hn&&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 hn){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 ns(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 jS(re.objectKeys(this.shape))}};Rt.create=(t,e)=>new Rt({shape:()=>t,unknownKeys:"strip",catchall:hn.create(),typeName:q.ZodObject,...Q(e)});Rt.strictCreate=(t,e)=>new Rt({shape:()=>t,unknownKeys:"strict",catchall:hn.create(),typeName:q.ZodObject,...Q(e)});Rt.lazycreate=(t,e)=>new Rt({shape:t,unknownKeys:"strip",catchall:hn.create(),typeName:q.ZodObject,...Q(e)});var Di=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}};Di.create=(t,e)=>new Di({options:t,typeName:q.ZodUnion,...Q(e)});var cr=t=>t instanceof Vi?cr(t.schema):t instanceof Jt?cr(t.innerType()):t instanceof zi?[t.value]:t instanceof Hi?t.options:t instanceof ji?re.objectValues(t.enum):t instanceof Ui?cr(t._def.innerType):t instanceof Fi?[void 0]:t instanceof $i?[null]:t instanceof Xt?[void 0,...cr(t.unwrap())]:t instanceof Pn?[null,...cr(t.unwrap())]:t instanceof ja||t instanceof qi?cr(t.unwrap()):t instanceof Wi?cr(t._def.innerType):[],Au=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 jg(t,e){let n=Rn(t),r=Rn(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=jg(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=jg(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 Bi=class extends J{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=(o,s)=>{if(Eu(o)||Eu(s))return U;let a=jg(o.value,s.value);return a.valid?((Cu(o)||Cu(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}))}};Bi.create=(t,e,n)=>new Bi({left:t,right:e,typeName:q.ZodIntersection,...Q(n)});var In=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})}};In.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new In({items:t,typeName:q.ZodTuple,rest:null,...Q(e)})};var Tu=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:ri.create(),valueType:e,typeName:q.ZodRecord,...Q(n)})}},os=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}}}};os.create=(t,e,n)=>new os({valueType:e,keyType:t,typeName:q.ZodMap,...Q(n)});var ss=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)}};ss.create=(t,e)=>new ss({valueType:t,minSize:null,maxSize:null,typeName:q.ZodSet,...Q(e)});var Ru=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 Ha({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,es(),lr].filter(c=>!!c),issueData:{code:T.invalid_arguments,argumentsError:l}})}function i(a,l){return Ha({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,es(),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 oi){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:In.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||In.create([]).rest(ur.create()),returns:n||ur.create(),typeName:q.ZodFunction,...Q(r)})}},Vi=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})}};Vi.create=(t,e)=>new Vi({getter:t,typeName:q.ZodLazy,...Q(e)});var zi=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}};zi.create=(t,e)=>new zi({value:t,typeName:q.ZodLiteral,...Q(e)});function jS(t,e){return new Hi({values:t,typeName:q.ZodEnum,...Q(e)})}var Hi=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})}};Hi.create=jS;var ji=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}};ji.create=(t,e)=>new ji({values:t,typeName:q.ZodNativeEnum,...Q(e)});var oi=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})))}};oi.create=(t,e)=>new oi({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"?Pi(l.value):n.value==="dirty"?Pi(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"?Pi(a.value):n.value==="dirty"?Pi(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(!ni(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=>ni(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 Pn=class extends J{_parse(e){return this._getType(e)===M.null?lt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Pn.create=(t,e)=>new Pn({innerType:t,typeName:q.ZodNullable,...Q(e)});var Ui=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}};Ui.create=(t,e)=>new Ui({innerType:t,typeName:q.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});var Wi=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 ts(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}};Wi.create=(t,e)=>new Wi({innerType:t,typeName:q.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});var as=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}}};as.create=t=>new as({typeName:q.ZodNaN,...Q(t)});var fI=Symbol("zod_brand"),ja=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}},Ua=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(),Pi(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})}},qi=class extends J{_parse(e){let n=this._def.innerType._parse(e),r=i=>(ni(i)&&(i.value=Object.freeze(i.value)),i);return ts(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};qi.create=(t,e)=>new qi({innerType:t,typeName:q.ZodReadonly,...Q(e)});function BS(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function US(t,e={},n){return t?ii.create().superRefine((r,i)=>{let o=t(r);if(o instanceof Promise)return o.then(s=>{if(!s){let a=BS(e,r),l=a.fatal??n??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!o){let s=BS(e,r),a=s.fatal??n??!0;i.addIssue({code:"custom",...s,fatal:a})}}):ii.create()}var pI={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 hI=(t,e={message:`Input not instance of ${t.name}`})=>US(n=>n instanceof t,e),WS=ri.create,qS=Oi.create,gI=as.create,mI=Ni.create,KS=Li.create,vI=Mi.create,yI=rs.create,_I=Fi.create,wI=$i.create,xI=ii.create,SI=ur.create,bI=hn.create,kI=is.create,EI=dr.create,CI=Rt.create,AI=Rt.strictCreate,TI=Di.create,RI=Au.create,II=Bi.create,PI=In.create,OI=Tu.create,NI=os.create,LI=ss.create,MI=Ru.create,FI=Vi.create,$I=zi.create,DI=Hi.create,BI=ji.create,VI=oi.create,zI=Jt.create,HI=Xt.create,jI=Pn.create,UI=Jt.createWithPreprocess,WI=Ua.create,qI=()=>WS().optional(),KI=()=>qS().optional(),GI=()=>KS().optional(),ZI={string:(t=>ri.create({...t,coerce:!0})),number:(t=>Oi.create({...t,coerce:!0})),boolean:(t=>Li.create({...t,coerce:!0})),bigint:(t=>Ni.create({...t,coerce:!0})),date:(t=>Mi.create({...t,coerce:!0}))};var YI=U;var GS=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()})]),XI=S.object({kind:S.literal("tooltip"),id:S.string(),anchor:GS,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()}),QI=S.object({kind:S.literal("highlight"),id:S.string(),anchor:GS,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()}),Ug=S.object({id:S.string(),version:S.number(),routes:S.array(S.string()).optional(),steps:S.array(S.union([XI,QI]))});function dM(t){return Ug.parse(t)}var gM=({configUri:t,experiments:e,featureKey:n="smart-canvas-overlay-uri",credentials:r="include"}={})=>async()=>{let i=$g({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 Ug.parse(s)};var ZS="syntro_session_metrics",Iu=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(ZS);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(ZS,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function Wg(t={}){return new Iu(t)}var JI=S.object({url:S.string(),routeId:S.string().optional(),title:S.string().optional(),locale:S.string().optional()}),eP=S.object({url:S.string(),ts:S.number()}),tP=S.object({sessionId:S.string(),startTs:S.number(),pageHistory:S.array(eP).optional()}),nP=S.object({width:S.number(),height:S.number()}),rP=S.object({x:S.number(),y:S.number(),w:S.number(),h:S.number()}),iP=S.object({anchorId:S.string(),present:S.boolean(),visible:S.boolean().optional(),boundingBox:rP.optional()}),oP=S.record(S.union([S.number(),S.string(),S.boolean(),S.undefined()])),sP=S.object({page:JI,session:tP,viewport:nP,anchors:S.array(iP).optional(),augmented:oP.optional()});function SM(t){return sP.safeParse(t)}function aP(){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 qg(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(YS(n,r))return}if(e.include){for(let r of e.include)if(YS(n,r))return r;return}return n}function YS(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 Pu=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=aP(),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=qg(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=qg(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=qg(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 Kg(t={}){return new Pu(t)}var XS=S.enum(["posthog","canvas","derived"]),lP=S.object({ts:S.number(),name:S.string(),source:XS,props:S.record(S.unknown()).optional(),schemaVersion:S.string()}),cP=S.object({names:S.array(S.string()).optional(),patterns:S.array(S.string()).optional(),sources:S.array(XS).optional()});function PM(t){return lP.safeParse(t)}function OM(t){return cP.safeParse(t)}function Gg(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 Ou=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:So};this.publishEvent(i)}publishEvent(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift();for(let n of this.subscriptions)if(Gg(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=>Gg(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=>Gg(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 Wa(t={}){return new Ou(t)}var QS={$autocapture:"ui.click",$click:Ce.UI_CLICK,$scroll:Ce.UI_SCROLL,$input:Ce.UI_INPUT,$change:Ce.UI_CHANGE,$submit:Ce.UI_SUBMIT,$pageview:Ce.NAV_PAGE_VIEW,$pageleave:Ce.NAV_PAGE_LEAVE,$session_start:"session.start",$identify:"user.identify"};function uP(t){let e=t.event;if(QS[e])return QS[e];if(e==="$autocapture"){let n=t.properties?.$tag_name,r=t.properties?.$event_type;return r==="submit"?Ce.UI_SUBMIT:r==="change"?Ce.UI_CHANGE:n==="input"||n==="textarea"?Ce.UI_INPUT:Ce.UI_CLICK}return typeof e!="string"?"posthog.unknown":e.startsWith("$")?e.replace("$","posthog."):`posthog.${e}`}function dP(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 JS(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:uP(t),source:"posthog",props:dP(t),schemaVersion:So}}function eb(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 Zg(t){return(e,n)=>{if(typeof e!="string")return;let r={event:e,properties:n,timestamp:Date.now()};if(eb(r)){let i=JS(r);t(i)}}}var fP=S.object({value:S.unknown(),expiresAt:S.number().optional()}),pP=S.object({count:S.number(),resetAt:S.number().optional()});function qM(t){return fP.safeParse(t)}function KM(t){return pP.safeParse(t)}var qa="dismissed:";function tb(t,e){return{mark(n,r=!1){let i=qa+n;(r?e:t).set(i,!0)},isDismissed(n){let r=qa+n;return t.has(r)||e.has(r)},clear(n){let r=qa+n;t.remove(r),e.remove(r)},clearAll(){for(let n of t.keys())n.startsWith(qa)&&t.remove(n);for(let n of e.keys())n.startsWith(qa)&&e.remove(n)}}}var Yg="cooldown:";function nb(t){return{set(e,n){let r=Yg+e,i=Date.now()+n;t.set(r,i)},isActive(e){return this.remaining(e)>0},remaining(e){let n=Yg+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=Yg+e;t.remove(n)}}}var Xg="freq:";function rb(t){function e(n){let r=Xg+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=Xg+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=Xg+n;t.remove(r)},hasReachedLimit(n,r){return this.count(n)>=r}}}var hP="syntro";function Qg(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 Jg(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 Nu=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??hP,typeof window<"u"?(this.session=Qg(typeof sessionStorage<"u"?sessionStorage:void 0,this.namespace),this.user=Qg(typeof localStorage<"u"?localStorage:void 0,this.namespace)):(this.session=Jg(this.namespace),this.user=Jg(this.namespace)),this.dismissals=tb(this.session,this.user),this.cooldowns=nb(this.user),this.frequency=rb(this.session)}ns(e){let n=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(n)){let r=typeof window<"u"&&typeof sessionStorage<"u"?Qg(sessionStorage,n):Jg(n);this.namespacedStorages.set(n,r)}return this.namespacedStorages.get(n)}};function em(t={}){return new Nu(t)}var gP=S.object({type:S.literal("page_url"),url:S.string()}),mP=S.object({type:S.literal("route"),routeId:S.string()}),vP=S.object({type:S.literal("anchor_visible"),anchorId:S.string(),state:S.enum(["visible","present","absent"])}),yP=S.object({type:S.literal("event_occurred"),eventName:S.string(),withinMs:S.number().optional()}),_P=S.object({type:S.literal("state_equals"),key:S.string(),value:S.unknown()}),wP=S.object({type:S.literal("viewport"),minWidth:S.number().optional(),maxWidth:S.number().optional(),minHeight:S.number().optional(),maxHeight:S.number().optional()}),xP=S.object({type:S.literal("session_metric"),key:S.string(),operator:S.enum(["gte","lte","eq","gt","lt"]),threshold:S.number()}),SP=S.object({type:S.literal("dismissed"),key:S.string(),inverted:S.boolean().optional()}),bP=S.object({type:S.literal("cooldown_active"),key:S.string(),inverted:S.boolean().optional()}),kP=S.object({type:S.literal("frequency_limit"),key:S.string(),limit:S.number(),inverted:S.boolean().optional()}),ib=S.discriminatedUnion("type",[gP,mP,vP,yP,_P,wP,xP,SP,bP,kP]),EP=S.object({conditions:S.array(ib),value:S.unknown()}),CP=S.object({type:S.literal("rules"),rules:S.array(EP),default:S.unknown()}),AP=S.object({type:S.literal("score"),field:S.string(),threshold:S.number(),above:S.unknown(),below:S.unknown()}),TP=S.object({type:S.literal("model"),modelId:S.string(),inputs:S.array(S.string()),outputMapping:S.record(S.unknown()),default:S.unknown()}),RP=S.object({type:S.literal("external"),endpoint:S.string(),method:S.enum(["GET","POST"]).optional(),default:S.unknown(),timeoutMs:S.number().optional()}),ob=S.discriminatedUnion("type",[CP,AP,TP,RP]),IP=S.object({include:S.array(S.string()).optional(),exclude:S.array(S.string()).optional()}),PP=S.object({routes:IP.optional(),strategy:ob.optional()});function lF(t){return ib.safeParse(t)}function cF(t){return ob.safeParse(t)}function uF(t){return PP.safeParse(t)}function sb(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 ab(t,e){let n=[];for(let r of t.conditions){let i=sb(r,e);if(n.push({condition:r,result:i}),!i)return{matched:!1,conditionResults:n}}return{matched:!0,conditionResults:n}}function Lu(t,e){for(let n=0;n<t.rules.length;n++){let r=t.rules[n],{matched:i,conditionResults:o}=ab(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 Mu(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 lb(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 cb(t,e,n={}){let r=lb(e,n);switch(t.type){case"rules":return Lu(t,r);case"score":return Mu(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 ub(t,e,n={}){let r=lb(e,n);switch(t.type){case"rules":return Lu(t,r);case"score":return Mu(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 tm(t){return{evaluate:(e,n)=>cb(e,n,t),evaluateSync:(e,n)=>ub(e,n,t)}}var OP=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button"]);function nm(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(!OP.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 db=async(t,e)=>{let n=e.resolveAnchor(t.anchorId);if(!n)throw new Error(`Anchor not found: ${t.anchorId}`);let r=nm(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=nm(s.html))}}},fb=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)}}},pb=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)}}},hb=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)}}},gb=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)}}},mb=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)}}},rm=[{kind:"content:insertHtml",executor:db},{kind:"content:setText",executor:fb},{kind:"content:setAttr",executor:pb},{kind:"content:addClass",executor:hb},{kind:"content:removeClass",executor:gb},{kind:"content:setStyle",executor:mb}],NP={id:"adaptive-content",version:"1.0.0",name:"Content",description:"DOM manipulation for text, attributes, and styles",executors:rm};var vb=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function yb(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(!vb)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`}),vb){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 xb=["top","right","bottom","left"];var en=Math.min,ct=Math.max,On=Math.round,Nn=Math.floor,Pe=t=>({x:t,y:t}),LP={left:"right",right:"left",bottom:"top",top:"bottom"},MP={start:"end",end:"start"};function $u(t,e,n){return ct(t,en(e,n))}function Ki(t,e){return typeof t=="function"?t(e):t}function si(t){return t.split("-")[0]}function ls(t){return t.split("-")[1]}function im(t){return t==="x"?"y":"x"}function Du(t){return t==="y"?"height":"width"}var FP=new Set(["top","bottom"]);function fr(t){return FP.has(si(t))?"y":"x"}function Bu(t){return im(fr(t))}function Sb(t,e,n){n===void 0&&(n=!1);let r=ls(t),i=Bu(t),o=Du(i),s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Ka(s)),[s,Ka(s)]}function bb(t){let e=Ka(t);return[Fu(t),e,Fu(e)]}function Fu(t){return t.replace(/start|end/g,e=>MP[e])}var _b=["left","right"],wb=["right","left"],$P=["top","bottom"],DP=["bottom","top"];function BP(t,e,n){switch(t){case"top":case"bottom":return n?e?wb:_b:e?_b:wb;case"left":case"right":return e?$P:DP;default:return[]}}function kb(t,e,n,r){let i=ls(t),o=BP(si(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(Fu)))),o}function Ka(t){return t.replace(/left|right|bottom|top/g,e=>LP[e])}function VP(t){return{top:0,right:0,bottom:0,left:0,...t}}function om(t){return typeof t!="number"?VP(t):{top:t,right:t,bottom:t,left:t}}function Ln(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 Eb(t,e,n){let{reference:r,floating:i}=t,o=fr(e),s=Bu(e),a=Du(s),l=si(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(ls(e)){case"start":g[s]-=h*(n&&c?-1:1);break;case"end":g[s]+=h*(n&&c?-1:1);break}return g}var Vu=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}=Eb(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}=Eb(c,h,l)),_=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:g}};async function cs(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}=Ki(e,t),v=om(g),x=a[h?f==="floating"?"reference":"floating":f],d=Ln(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=Ln(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 sm=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}=Ki(t,e)||{};if(c==null)return{};let f=om(u),h={x:n,y:r},g=Bu(i),v=Du(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=$u(K,W,Y),B=!l.arrow&&ls(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 zu=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}=Ki(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let d=si(i),p=fr(a),m=si(a)===a,y=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(m||!_?[Ka(a)]:bb(a)),b=v!=="none";!h&&b&&w.push(...kb(a,_,v,y));let k=[a,...w],E=await cs(e,x),I=[],A=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&I.push(E[d]),f){let W=Sb(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 Cb(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ab(t){return xb.some(e=>t[e]>=0)}var am=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:n}=e,{strategy:r="referenceHidden",...i}=Ki(t,e);switch(r){case"referenceHidden":{let o=await cs(e,{...i,elementContext:"reference"}),s=Cb(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Ab(s)}}}case"escaped":{let o=await cs(e,{...i,altBoundary:!0}),s=Cb(o,n.floating);return{data:{escapedOffsets:s,escaped:Ab(s)}}}default:return{}}}}};var zP=new Set(["left","top"]);async function HP(t,e){let{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=si(n),a=ls(n),l=fr(n)==="y",c=zP.has(s)?-1:1,u=o&&l?-1:1,f=Ki(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 Hu=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 HP(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}}}}},ju=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}=Ki(t,e),c={x:n,y:r},u=await cs(e,l),f=fr(si(i)),h=im(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=$u(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=$u(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 Uu(){return typeof window<"u"}function gn(t){return Rb(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=(Rb(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Rb(t){return Uu()?t instanceof Node||t instanceof Oe(t).Node:!1}function Ne(t){return Uu()?t instanceof Element||t instanceof Oe(t).Element:!1}function Ve(t){return Uu()?t instanceof HTMLElement||t instanceof Oe(t).HTMLElement:!1}function Tb(t){return!Uu()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Oe(t).ShadowRoot}var jP=new Set(["inline","contents"]);function Fn(t){let{overflow:e,overflowX:n,overflowY:r,display:i}=Le(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!jP.has(i)}var UP=new Set(["table","td","th"]);function Wu(t){return UP.has(gn(t))}var WP=[":popover-open",":modal"];function pr(t){return WP.some(e=>{try{return t.matches(e)}catch{return!1}})}var qP=["transform","translate","scale","rotate","perspective"],KP=["transform","translate","scale","rotate","perspective","filter"],GP=["paint","layout","strict","content"];function Gi(t){let e=Zi(),n=Ne(t)?Le(t):t;return qP.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)||KP.some(r=>(n.willChange||"").includes(r))||GP.some(r=>(n.contain||"").includes(r))}function qu(t){let e=mt(t);for(;Ve(e)&&!tn(e);){if(Gi(e))return e;if(pr(e))return null;e=mt(e)}return null}function Zi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var ZP=new Set(["html","body","#document"]);function tn(t){return ZP.has(gn(t))}function Le(t){return Oe(t).getComputedStyle(t)}function $n(t){return Ne(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function mt(t){if(gn(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Tb(t)&&t.host||$e(t);return Tb(e)?e.host:e}function Ib(t){let e=mt(t);return tn(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ve(e)&&Fn(e)?e:Ib(e)}function Mn(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);let i=Ib(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Oe(i);if(o){let a=Yi(s);return e.concat(s,s.visualViewport||[],Fn(i)?i:[],a&&n?Mn(a):[])}return e.concat(i,Mn(i,[],n))}function Yi(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Lb(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=On(n)!==o||On(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function cm(t){return Ne(t)?t:t.contextElement}function us(t){let e=cm(t);if(!Ve(e))return Pe(1);let n=e.getBoundingClientRect(),{width:r,height:i,$:o}=Lb(e),s=(o?On(n.width):n.width)/r,a=(o?On(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var e2=Pe(0);function Mb(t){let e=Oe(t);return!Zi()||!e.visualViewport?e2:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function t2(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Oe(t)?!1:e}function Xi(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);let i=t.getBoundingClientRect(),o=cm(t),s=Pe(1);e&&(r?Ne(r)&&(s=us(r)):s=us(t));let a=t2(o,n,r)?Mb(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,_=Yi(v);for(;_&&r&&g!==v;){let x=us(_),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(_),_=Yi(v)}}return Ln({width:u,height:f,x:l,y:c})}function Ku(t,e){let n=$n(t).scrollLeft;return e?e.left+n:Xi($e(t)).left+n}function Fb(t,e){let n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Ku(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function n2(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)&&((gn(r)!=="body"||Fn(s))&&(l=$n(r)),Ve(r))){let g=Xi(r);c=us(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}let h=s&&!f&&!o?Fb(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 r2(t){return Array.from(t.getClientRects())}function i2(t){let e=$e(t),n=$n(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+Ku(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 Pb=25;function o2(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=Zi();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}let c=Ku(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<=Pb&&(o-=v)}else c<=Pb&&(o+=c);return{width:o,height:s,x:a,y:l}}var s2=new Set(["absolute","fixed"]);function a2(t,e){let n=Xi(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=Ve(t)?us(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 Ob(t,e,n){let r;if(e==="viewport")r=o2(t,n);else if(e==="document")r=i2($e(t));else if(Ne(e))r=a2(e,n);else{let i=Mb(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Ln(r)}function $b(t,e){let n=mt(t);return n===e||!Ne(n)||tn(n)?!1:Le(n).position==="fixed"||$b(n,e)}function l2(t,e){let n=e.get(t);if(n)return n;let r=Mn(t,[],!1).filter(a=>Ne(a)&&gn(a)!=="body"),i=null,o=Le(t).position==="fixed",s=o?mt(t):t;for(;Ne(s)&&!tn(s);){let a=Le(s),l=Gi(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&s2.has(i.position)||Fn(s)&&!l&&$b(t,s))?r=r.filter(u=>u!==s):i=a,s=mt(s)}return e.set(t,r),r}function c2(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t,s=[...n==="clippingAncestors"?pr(e)?[]:l2(e,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{let f=Ob(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},Ob(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function u2(t){let{width:e,height:n}=Lb(t);return{width:e,height:n}}function d2(t,e,n){let r=Ve(e),i=$e(e),o=n==="fixed",s=Xi(t,!0,o,e),a={scrollLeft:0,scrollTop:0},l=Pe(0);function c(){l.x=Ku(i)}if(r||!r&&!o)if((gn(e)!=="body"||Fn(i))&&(a=$n(e)),r){let g=Xi(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?Fb(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 lm(t){return Le(t).position==="static"}function Nb(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 Db(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)&&!lm(i))return i;i=mt(i)}return n}let r=Nb(t,e);for(;r&&Wu(r)&&lm(r);)r=Nb(r,e);return r&&tn(r)&&lm(r)&&!Gi(r)?n:r||qu(t)||n}var f2=async function(t){let e=this.getOffsetParent||Db,n=this.getDimensions,r=await n(t.floating);return{reference:d2(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function p2(t){return Le(t).direction==="rtl"}var h2={convertOffsetParentRelativeRectToViewportRelativeRect:n2,getDocumentElement:$e,getClippingRect:c2,getOffsetParent:Db,getElementRects:f2,getClientRects:r2,getDimensions:u2,getScale:us,isElement:Ne,isRTL:p2};function Bb(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function g2(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=Nn(f),_=Nn(i.clientWidth-(u+h)),x=Nn(i.clientHeight-(f+g)),d=Nn(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&&!Bb(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 Vb(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=cm(t),u=i||o?[...c?Mn(c):[],...Mn(e)]:[];u.forEach(d=>{i&&d.addEventListener("scroll",n,{passive:!0}),o&&d.addEventListener("resize",n)});let f=c&&a?g2(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?Xi(t):null;l&&x();function x(){let d=Xi(t);_&&!Bb(_,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 zb=Hu;var Hb=ju,jb=zu;var Ub=am,Wb=sm;var qb=(t,e,n)=>{let r=new Map,i={platform:h2,...n},o={...i.platform,_c:r};return Vu(t,e,{...i,platform:o})};var m2=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(!m2.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 v2(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 Kb(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=[zb(n.offsetPx??8),jb(),Hb({padding:8}),Ub(),Wb({element:l})],u=n.placement&&n.placement!=="auto"?n.placement:"top",f=Vb(t,o,async()=>{let d=v2(t),p=await qb(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 um=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 NS="https://cdn.syntrologie.com/editor-sdk/latest/editor-sdk.js",LS=["cdn.syntrologie.com","api.syntrologie.com","dev-api.syntrologie.com","localhost","127.0.0.1",".syntrologie.com"];function $R(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=LS.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:LS,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 DR=()=>{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},BR=()=>{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)},MS=()=>DR()?"editor":BR()?"audit":null;function VR(){if(typeof window>"u")return null;let t=new URLSearchParams(window.location.search);return t.get("editor_token")||t.get("audit_token")}var FS=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||NS,a=VR();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===NS,hasApiBase:!!i,tokenPrefix:a.slice(0,10)+"..."}),!$R(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 Vg=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=OS(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=MS();c&&(console.log(`[SmartCanvas] Loading editor SDK for ${c} mode`),FS(t.editorUrl).catch(console.error)),TS();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??Qo({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 Vg(t)}});var S={};Wk(S,{BRAND:()=>fI,DIRTY:()=>Pi,EMPTY_PATH:()=>UR,INVALID:()=>U,NEVER:()=>YI,OK:()=>lt,ParseStatus:()=>tt,Schema:()=>J,ZodAny:()=>ii,ZodArray:()=>dr,ZodBigInt:()=>Ni,ZodBoolean:()=>Li,ZodBranded:()=>ja,ZodCatch:()=>Wi,ZodDate:()=>Mi,ZodDefault:()=>Ui,ZodDiscriminatedUnion:()=>Au,ZodEffects:()=>Jt,ZodEnum:()=>Hi,ZodError:()=>Tt,ZodFirstPartyTypeKind:()=>q,ZodFunction:()=>Ru,ZodIntersection:()=>Bi,ZodIssueCode:()=>T,ZodLazy:()=>Vi,ZodLiteral:()=>zi,ZodMap:()=>os,ZodNaN:()=>as,ZodNativeEnum:()=>ji,ZodNever:()=>hn,ZodNull:()=>$i,ZodNullable:()=>Pn,ZodNumber:()=>Oi,ZodObject:()=>Rt,ZodOptional:()=>Xt,ZodParsedType:()=>M,ZodPipeline:()=>Ua,ZodPromise:()=>oi,ZodReadonly:()=>qi,ZodRecord:()=>Tu,ZodSchema:()=>J,ZodSet:()=>ss,ZodString:()=>ri,ZodSymbol:()=>rs,ZodTransformer:()=>Jt,ZodTuple:()=>In,ZodType:()=>J,ZodUndefined:()=>Fi,ZodUnion:()=>Di,ZodUnknown:()=>ur,ZodVoid:()=>is,addIssueToContext:()=>P,any:()=>xI,array:()=>EI,bigint:()=>mI,boolean:()=>KS,coerce:()=>ZI,custom:()=>US,date:()=>vI,datetimeRegex:()=>HS,defaultErrorMap:()=>lr,discriminatedUnion:()=>RI,effect:()=>zI,enum:()=>DI,function:()=>MI,getErrorMap:()=>es,getParsedType:()=>Rn,instanceof:()=>hI,intersection:()=>II,isAborted:()=>Eu,isAsync:()=>ts,isDirty:()=>Cu,isValid:()=>ni,late:()=>pI,lazy:()=>FI,literal:()=>$I,makeIssue:()=>Ha,map:()=>NI,nan:()=>gI,nativeEnum:()=>BI,never:()=>bI,null:()=>wI,nullable:()=>jI,number:()=>qS,object:()=>CI,objectUtil:()=>zg,oboolean:()=>GI,onumber:()=>KI,optional:()=>HI,ostring:()=>qI,pipeline:()=>WI,preprocess:()=>UI,promise:()=>VI,quotelessJson:()=>zR,record:()=>OI,set:()=>LI,setErrorMap:()=>jR,strictObject:()=>AI,string:()=>WS,symbol:()=>yI,transformer:()=>zI,tuple:()=>PI,undefined:()=>_I,union:()=>TI,unknown:()=>SI,util:()=>re,void:()=>kI});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 zg;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(zg||(zg={}));var M=re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Rn=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"]),zR=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 HR=(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=HR;var $S=lr;function jR(t){$S=t}function es(){return $S}var Ha=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}},UR=[];function P(t,e){let n=es(),r=Ha({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"}),Pi=t=>({status:"dirty",value:t}),lt=t=>({status:"valid",value:t}),Eu=t=>t.status==="aborted",Cu=t=>t.status==="dirty",ni=t=>t.status==="valid",ts=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}},DS=(t,e)=>{if(ni(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 Rn(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Rn(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:Rn(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(ts(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:Rn(e)},i=this._parseSync({data:e,path:r.path,parent:r});return DS(r,i)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rn(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return ni(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=>ni(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:Rn(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(ts(i)?i:Promise.resolve(i));return DS(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 Pn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return dr.create(this)}promise(){return oi.create(this,this._def)}or(e){return Di.create([this,e],this._def)}and(e){return Bi.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 Ui({...Q(this._def),innerType:this,defaultValue:n,typeName:q.ZodDefault})}brand(){return new ja({typeName:q.ZodBranded,type:this,...Q(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new Wi({...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 Ua.create(this,e)}readonly(){return qi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},WR=/^c[^\s-]{8,}$/i,qR=/^[0-9a-z]+$/,KR=/^[0-9A-HJKMNP-TV-Z]{26}$/i,GR=/^[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,ZR=/^[a-z0-9_-]{21}$/i,YR=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,XR=/^[-+]?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)?)??$/,QR=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,JR="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Hg,eI=/^(?:(?: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])$/,tI=/^(?:(?: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])$/,nI=/^(([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]))$/,rI=/^(([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])$/,iI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,oI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,VS="((\\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])))",sI=new RegExp(`^${VS}$`);function zS(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 aI(t){return new RegExp(`^${zS(t)}$`)}function HS(t){let e=`${VS}T${zS(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 lI(t,e){return!!((e==="v4"||!e)&&eI.test(t)||(e==="v6"||!e)&&nI.test(t))}function cI(t,e){if(!YR.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 uI(t,e){return!!((e==="v4"||!e)&&tI.test(t)||(e==="v6"||!e)&&rI.test(t))}var ri=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")QR.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")Hg||(Hg=new RegExp(JR,"u")),Hg.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")GR.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")ZR.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")WR.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")qR.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")KR.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"?HS(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"?sI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{code:T.invalid_string,validation:"date",message:o.message}),r.dirty()):o.kind==="time"?aI(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"?XR.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"duration",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="ip"?lI(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"?cI(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"?uI(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"?iI.test(e.data)||(i=this._getOrReturnCtx(e,i),P(i,{validation:"base64",code:T.invalid_string,message:o.message}),r.dirty()):o.kind==="base64url"?oI.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}};ri.create=t=>new ri({checks:[],typeName:q.ZodString,coerce:t?.coerce??!1,...Q(t)});function dI(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 Oi=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"?dI(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)}};Oi.create=t=>new Oi({checks:[],typeName:q.ZodNumber,coerce:t?.coerce||!1,...Q(t)});var Ni=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}};Ni.create=t=>new Ni({checks:[],typeName:q.ZodBigInt,coerce:t?.coerce??!1,...Q(t)});var Li=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)}};Li.create=t=>new Li({typeName:q.ZodBoolean,coerce:t?.coerce||!1,...Q(t)});var Mi=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}};Mi.create=t=>new Mi({checks:[],coerce:t?.coerce||!1,typeName:q.ZodDate,...Q(t)});var rs=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)}};rs.create=t=>new rs({typeName:q.ZodSymbol,...Q(t)});var Fi=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)}};Fi.create=t=>new Fi({typeName:q.ZodUndefined,...Q(t)});var $i=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)}};$i.create=t=>new $i({typeName:q.ZodNull,...Q(t)});var ii=class extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return lt(e.data)}};ii.create=t=>new ii({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 hn=class extends J{_parse(e){let n=this._getOrReturnCtx(e);return P(n,{code:T.invalid_type,expected:M.never,received:n.parsedType}),U}};hn.create=t=>new hn({typeName:q.ZodNever,...Q(t)});var is=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)}};is.create=t=>new is({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 ns(t){if(t instanceof Rt){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Xt.create(ns(r))}return new Rt({...t._def,shape:()=>e})}else return t instanceof dr?new dr({...t._def,type:ns(t.element)}):t instanceof Xt?Xt.create(ns(t.unwrap())):t instanceof Pn?Pn.create(ns(t.unwrap())):t instanceof In?In.create(t.items.map(e=>ns(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 hn&&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 hn){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 ns(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 jS(re.objectKeys(this.shape))}};Rt.create=(t,e)=>new Rt({shape:()=>t,unknownKeys:"strip",catchall:hn.create(),typeName:q.ZodObject,...Q(e)});Rt.strictCreate=(t,e)=>new Rt({shape:()=>t,unknownKeys:"strict",catchall:hn.create(),typeName:q.ZodObject,...Q(e)});Rt.lazycreate=(t,e)=>new Rt({shape:t,unknownKeys:"strip",catchall:hn.create(),typeName:q.ZodObject,...Q(e)});var Di=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}};Di.create=(t,e)=>new Di({options:t,typeName:q.ZodUnion,...Q(e)});var cr=t=>t instanceof Vi?cr(t.schema):t instanceof Jt?cr(t.innerType()):t instanceof zi?[t.value]:t instanceof Hi?t.options:t instanceof ji?re.objectValues(t.enum):t instanceof Ui?cr(t._def.innerType):t instanceof Fi?[void 0]:t instanceof $i?[null]:t instanceof Xt?[void 0,...cr(t.unwrap())]:t instanceof Pn?[null,...cr(t.unwrap())]:t instanceof ja||t instanceof qi?cr(t.unwrap()):t instanceof Wi?cr(t._def.innerType):[],Au=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 jg(t,e){let n=Rn(t),r=Rn(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=jg(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=jg(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 Bi=class extends J{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=(o,s)=>{if(Eu(o)||Eu(s))return U;let a=jg(o.value,s.value);return a.valid?((Cu(o)||Cu(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}))}};Bi.create=(t,e,n)=>new Bi({left:t,right:e,typeName:q.ZodIntersection,...Q(n)});var In=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})}};In.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new In({items:t,typeName:q.ZodTuple,rest:null,...Q(e)})};var Tu=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:ri.create(),valueType:e,typeName:q.ZodRecord,...Q(n)})}},os=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}}}};os.create=(t,e,n)=>new os({valueType:e,keyType:t,typeName:q.ZodMap,...Q(n)});var ss=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)}};ss.create=(t,e)=>new ss({valueType:t,minSize:null,maxSize:null,typeName:q.ZodSet,...Q(e)});var Ru=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 Ha({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,es(),lr].filter(c=>!!c),issueData:{code:T.invalid_arguments,argumentsError:l}})}function i(a,l){return Ha({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,es(),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 oi){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:In.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||In.create([]).rest(ur.create()),returns:n||ur.create(),typeName:q.ZodFunction,...Q(r)})}},Vi=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})}};Vi.create=(t,e)=>new Vi({getter:t,typeName:q.ZodLazy,...Q(e)});var zi=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}};zi.create=(t,e)=>new zi({value:t,typeName:q.ZodLiteral,...Q(e)});function jS(t,e){return new Hi({values:t,typeName:q.ZodEnum,...Q(e)})}var Hi=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})}};Hi.create=jS;var ji=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}};ji.create=(t,e)=>new ji({values:t,typeName:q.ZodNativeEnum,...Q(e)});var oi=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})))}};oi.create=(t,e)=>new oi({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"?Pi(l.value):n.value==="dirty"?Pi(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"?Pi(a.value):n.value==="dirty"?Pi(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(!ni(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=>ni(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 Pn=class extends J{_parse(e){return this._getType(e)===M.null?lt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Pn.create=(t,e)=>new Pn({innerType:t,typeName:q.ZodNullable,...Q(e)});var Ui=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}};Ui.create=(t,e)=>new Ui({innerType:t,typeName:q.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});var Wi=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 ts(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}};Wi.create=(t,e)=>new Wi({innerType:t,typeName:q.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});var as=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}}};as.create=t=>new as({typeName:q.ZodNaN,...Q(t)});var fI=Symbol("zod_brand"),ja=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}},Ua=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(),Pi(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})}},qi=class extends J{_parse(e){let n=this._def.innerType._parse(e),r=i=>(ni(i)&&(i.value=Object.freeze(i.value)),i);return ts(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};qi.create=(t,e)=>new qi({innerType:t,typeName:q.ZodReadonly,...Q(e)});function BS(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function US(t,e={},n){return t?ii.create().superRefine((r,i)=>{let o=t(r);if(o instanceof Promise)return o.then(s=>{if(!s){let a=BS(e,r),l=a.fatal??n??!0;i.addIssue({code:"custom",...a,fatal:l})}});if(!o){let s=BS(e,r),a=s.fatal??n??!0;i.addIssue({code:"custom",...s,fatal:a})}}):ii.create()}var pI={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 hI=(t,e={message:`Input not instance of ${t.name}`})=>US(n=>n instanceof t,e),WS=ri.create,qS=Oi.create,gI=as.create,mI=Ni.create,KS=Li.create,vI=Mi.create,yI=rs.create,_I=Fi.create,wI=$i.create,xI=ii.create,SI=ur.create,bI=hn.create,kI=is.create,EI=dr.create,CI=Rt.create,AI=Rt.strictCreate,TI=Di.create,RI=Au.create,II=Bi.create,PI=In.create,OI=Tu.create,NI=os.create,LI=ss.create,MI=Ru.create,FI=Vi.create,$I=zi.create,DI=Hi.create,BI=ji.create,VI=oi.create,zI=Jt.create,HI=Xt.create,jI=Pn.create,UI=Jt.createWithPreprocess,WI=Ua.create,qI=()=>WS().optional(),KI=()=>qS().optional(),GI=()=>KS().optional(),ZI={string:(t=>ri.create({...t,coerce:!0})),number:(t=>Oi.create({...t,coerce:!0})),boolean:(t=>Li.create({...t,coerce:!0})),bigint:(t=>Ni.create({...t,coerce:!0})),date:(t=>Mi.create({...t,coerce:!0}))};var YI=U;var GS=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()})]),XI=S.object({kind:S.literal("tooltip"),id:S.string(),anchor:GS,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()}),QI=S.object({kind:S.literal("highlight"),id:S.string(),anchor:GS,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()}),Ug=S.object({id:S.string(),version:S.number(),routes:S.array(S.string()).optional(),steps:S.array(S.union([XI,QI]))});function dM(t){return Ug.parse(t)}var gM=({configUri:t,experiments:e,featureKey:n="smart-canvas-overlay-uri",credentials:r="include"}={})=>async()=>{let i=$g({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 Ug.parse(s)};var ZS="syntro_session_metrics",Iu=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(ZS);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(ZS,JSON.stringify(e))}catch(e){console.warn("[SessionMetricTracker] Failed to save to sessionStorage:",e)}}};function Wg(t={}){return new Iu(t)}var JI=S.object({url:S.string(),routeId:S.string().optional(),title:S.string().optional(),locale:S.string().optional()}),eP=S.object({url:S.string(),ts:S.number()}),tP=S.object({sessionId:S.string(),startTs:S.number(),pageHistory:S.array(eP).optional()}),nP=S.object({width:S.number(),height:S.number()}),rP=S.object({x:S.number(),y:S.number(),w:S.number(),h:S.number()}),iP=S.object({anchorId:S.string(),present:S.boolean(),visible:S.boolean().optional(),boundingBox:rP.optional()}),oP=S.record(S.union([S.number(),S.string(),S.boolean(),S.undefined()])),sP=S.object({page:JI,session:tP,viewport:nP,anchors:S.array(iP).optional(),augmented:oP.optional()});function SM(t){return sP.safeParse(t)}function aP(){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 qg(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(YS(n,r))return}if(e.include){for(let r of e.include)if(YS(n,r))return r;return}return n}function YS(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 Pu=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=aP(),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=qg(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=qg(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=qg(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 Kg(t={}){return new Pu(t)}var XS=S.enum(["posthog","canvas","derived"]),lP=S.object({ts:S.number(),name:S.string(),source:XS,props:S.record(S.unknown()).optional(),schemaVersion:S.string()}),cP=S.object({names:S.array(S.string()).optional(),patterns:S.array(S.string()).optional(),sources:S.array(XS).optional()});function PM(t){return lP.safeParse(t)}function OM(t){return cP.safeParse(t)}function Gg(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 Ou=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:So};this.publishEvent(i)}publishEvent(e){this.history.push(e),this.history.length>this.maxHistorySize&&this.history.shift();for(let n of this.subscriptions)if(Gg(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=>Gg(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=>Gg(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 Wa(t={}){return new Ou(t)}var QS={$autocapture:"ui.click",$click:Ce.UI_CLICK,$scroll:Ce.UI_SCROLL,$input:Ce.UI_INPUT,$change:Ce.UI_CHANGE,$submit:Ce.UI_SUBMIT,$pageview:Ce.NAV_PAGE_VIEW,$pageleave:Ce.NAV_PAGE_LEAVE,$session_start:"session.start",$identify:"user.identify"};function uP(t){let e=t.event;if(typeof e!="string")return"posthog.unknown";if(QS[e])return QS[e];if(e==="$autocapture"){let n=t.properties?.$tag_name,r=t.properties?.$event_type;return r==="submit"?Ce.UI_SUBMIT:r==="change"?Ce.UI_CHANGE:n==="input"||n==="textarea"?Ce.UI_INPUT:Ce.UI_CLICK}return e.startsWith("$")?e.replace("$","posthog."):`posthog.${e}`}function dP(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 JS(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:uP(t),source:"posthog",props:dP(t),schemaVersion:So}}function eb(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 Zg(t){return(e,n)=>{if(typeof e!="string")return;let r={event:e,properties:n,timestamp:Date.now()};if(eb(r)){let i=JS(r);t(i)}}}var fP=S.object({value:S.unknown(),expiresAt:S.number().optional()}),pP=S.object({count:S.number(),resetAt:S.number().optional()});function qM(t){return fP.safeParse(t)}function KM(t){return pP.safeParse(t)}var qa="dismissed:";function tb(t,e){return{mark(n,r=!1){let i=qa+n;(r?e:t).set(i,!0)},isDismissed(n){let r=qa+n;return t.has(r)||e.has(r)},clear(n){let r=qa+n;t.remove(r),e.remove(r)},clearAll(){for(let n of t.keys())n.startsWith(qa)&&t.remove(n);for(let n of e.keys())n.startsWith(qa)&&e.remove(n)}}}var Yg="cooldown:";function nb(t){return{set(e,n){let r=Yg+e,i=Date.now()+n;t.set(r,i)},isActive(e){return this.remaining(e)>0},remaining(e){let n=Yg+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=Yg+e;t.remove(n)}}}var Xg="freq:";function rb(t){function e(n){let r=Xg+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=Xg+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=Xg+n;t.remove(r)},hasReachedLimit(n,r){return this.count(n)>=r}}}var hP="syntro";function Qg(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 Jg(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 Nu=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??hP,typeof window<"u"?(this.session=Qg(typeof sessionStorage<"u"?sessionStorage:void 0,this.namespace),this.user=Qg(typeof localStorage<"u"?localStorage:void 0,this.namespace)):(this.session=Jg(this.namespace),this.user=Jg(this.namespace)),this.dismissals=tb(this.session,this.user),this.cooldowns=nb(this.user),this.frequency=rb(this.session)}ns(e){let n=`${this.namespace}:${e}`;if(!this.namespacedStorages.has(n)){let r=typeof window<"u"&&typeof sessionStorage<"u"?Qg(sessionStorage,n):Jg(n);this.namespacedStorages.set(n,r)}return this.namespacedStorages.get(n)}};function em(t={}){return new Nu(t)}var gP=S.object({type:S.literal("page_url"),url:S.string()}),mP=S.object({type:S.literal("route"),routeId:S.string()}),vP=S.object({type:S.literal("anchor_visible"),anchorId:S.string(),state:S.enum(["visible","present","absent"])}),yP=S.object({type:S.literal("event_occurred"),eventName:S.string(),withinMs:S.number().optional()}),_P=S.object({type:S.literal("state_equals"),key:S.string(),value:S.unknown()}),wP=S.object({type:S.literal("viewport"),minWidth:S.number().optional(),maxWidth:S.number().optional(),minHeight:S.number().optional(),maxHeight:S.number().optional()}),xP=S.object({type:S.literal("session_metric"),key:S.string(),operator:S.enum(["gte","lte","eq","gt","lt"]),threshold:S.number()}),SP=S.object({type:S.literal("dismissed"),key:S.string(),inverted:S.boolean().optional()}),bP=S.object({type:S.literal("cooldown_active"),key:S.string(),inverted:S.boolean().optional()}),kP=S.object({type:S.literal("frequency_limit"),key:S.string(),limit:S.number(),inverted:S.boolean().optional()}),ib=S.discriminatedUnion("type",[gP,mP,vP,yP,_P,wP,xP,SP,bP,kP]),EP=S.object({conditions:S.array(ib),value:S.unknown()}),CP=S.object({type:S.literal("rules"),rules:S.array(EP),default:S.unknown()}),AP=S.object({type:S.literal("score"),field:S.string(),threshold:S.number(),above:S.unknown(),below:S.unknown()}),TP=S.object({type:S.literal("model"),modelId:S.string(),inputs:S.array(S.string()),outputMapping:S.record(S.unknown()),default:S.unknown()}),RP=S.object({type:S.literal("external"),endpoint:S.string(),method:S.enum(["GET","POST"]).optional(),default:S.unknown(),timeoutMs:S.number().optional()}),ob=S.discriminatedUnion("type",[CP,AP,TP,RP]),IP=S.object({include:S.array(S.string()).optional(),exclude:S.array(S.string()).optional()}),PP=S.object({routes:IP.optional(),strategy:ob.optional()});function lF(t){return ib.safeParse(t)}function cF(t){return ob.safeParse(t)}function uF(t){return PP.safeParse(t)}function sb(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 ab(t,e){let n=[];for(let r of t.conditions){let i=sb(r,e);if(n.push({condition:r,result:i}),!i)return{matched:!1,conditionResults:n}}return{matched:!0,conditionResults:n}}function Lu(t,e){for(let n=0;n<t.rules.length;n++){let r=t.rules[n],{matched:i,conditionResults:o}=ab(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 Mu(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 lb(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 cb(t,e,n={}){let r=lb(e,n);switch(t.type){case"rules":return Lu(t,r);case"score":return Mu(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 ub(t,e,n={}){let r=lb(e,n);switch(t.type){case"rules":return Lu(t,r);case"score":return Mu(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 tm(t){return{evaluate:(e,n)=>cb(e,n,t),evaluateSync:(e,n)=>ub(e,n,t)}}var OP=new Set(["b","strong","i","em","u","span","div","p","br","ul","ol","li","code","pre","small","sup","sub","a","button"]);function nm(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(!OP.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 db=async(t,e)=>{let n=e.resolveAnchor(t.anchorId);if(!n)throw new Error(`Anchor not found: ${t.anchorId}`);let r=nm(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=nm(s.html))}}},fb=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)}}},pb=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)}}},hb=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)}}},gb=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)}}},mb=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)}}},rm=[{kind:"content:insertHtml",executor:db},{kind:"content:setText",executor:fb},{kind:"content:setAttr",executor:pb},{kind:"content:addClass",executor:hb},{kind:"content:removeClass",executor:gb},{kind:"content:setStyle",executor:mb}],NP={id:"adaptive-content",version:"1.0.0",name:"Content",description:"DOM manipulation for text, attributes, and styles",executors:rm};var vb=typeof CSS<"u"&&CSS.supports?.("clip-path","path('M0 0 H1 V1 Z')");function yb(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(!vb)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`}),vb){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 xb=["top","right","bottom","left"];var en=Math.min,ct=Math.max,On=Math.round,Nn=Math.floor,Pe=t=>({x:t,y:t}),LP={left:"right",right:"left",bottom:"top",top:"bottom"},MP={start:"end",end:"start"};function $u(t,e,n){return ct(t,en(e,n))}function Ki(t,e){return typeof t=="function"?t(e):t}function si(t){return t.split("-")[0]}function ls(t){return t.split("-")[1]}function im(t){return t==="x"?"y":"x"}function Du(t){return t==="y"?"height":"width"}var FP=new Set(["top","bottom"]);function fr(t){return FP.has(si(t))?"y":"x"}function Bu(t){return im(fr(t))}function Sb(t,e,n){n===void 0&&(n=!1);let r=ls(t),i=Bu(t),o=Du(i),s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Ka(s)),[s,Ka(s)]}function bb(t){let e=Ka(t);return[Fu(t),e,Fu(e)]}function Fu(t){return t.replace(/start|end/g,e=>MP[e])}var _b=["left","right"],wb=["right","left"],$P=["top","bottom"],DP=["bottom","top"];function BP(t,e,n){switch(t){case"top":case"bottom":return n?e?wb:_b:e?_b:wb;case"left":case"right":return e?$P:DP;default:return[]}}function kb(t,e,n,r){let i=ls(t),o=BP(si(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(Fu)))),o}function Ka(t){return t.replace(/left|right|bottom|top/g,e=>LP[e])}function VP(t){return{top:0,right:0,bottom:0,left:0,...t}}function om(t){return typeof t!="number"?VP(t):{top:t,right:t,bottom:t,left:t}}function Ln(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 Eb(t,e,n){let{reference:r,floating:i}=t,o=fr(e),s=Bu(e),a=Du(s),l=si(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(ls(e)){case"start":g[s]-=h*(n&&c?-1:1);break;case"end":g[s]+=h*(n&&c?-1:1);break}return g}var Vu=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}=Eb(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}=Eb(c,h,l)),_=-1)}return{x:u,y:f,placement:h,strategy:i,middlewareData:g}};async function cs(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}=Ki(e,t),v=om(g),x=a[h?f==="floating"?"reference":"floating":f],d=Ln(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=Ln(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 sm=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}=Ki(t,e)||{};if(c==null)return{};let f=om(u),h={x:n,y:r},g=Bu(i),v=Du(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=$u(K,W,Y),B=!l.arrow&&ls(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 zu=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}=Ki(t,e);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let d=si(i),p=fr(a),m=si(a)===a,y=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=h||(m||!_?[Ka(a)]:bb(a)),b=v!=="none";!h&&b&&w.push(...kb(a,_,v,y));let k=[a,...w],E=await cs(e,x),I=[],A=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&I.push(E[d]),f){let W=Sb(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 Cb(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ab(t){return xb.some(e=>t[e]>=0)}var am=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:n}=e,{strategy:r="referenceHidden",...i}=Ki(t,e);switch(r){case"referenceHidden":{let o=await cs(e,{...i,elementContext:"reference"}),s=Cb(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Ab(s)}}}case"escaped":{let o=await cs(e,{...i,altBoundary:!0}),s=Cb(o,n.floating);return{data:{escapedOffsets:s,escaped:Ab(s)}}}default:return{}}}}};var zP=new Set(["left","top"]);async function HP(t,e){let{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=si(n),a=ls(n),l=fr(n)==="y",c=zP.has(s)?-1:1,u=o&&l?-1:1,f=Ki(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 Hu=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 HP(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}}}}},ju=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}=Ki(t,e),c={x:n,y:r},u=await cs(e,l),f=fr(si(i)),h=im(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=$u(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=$u(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 Uu(){return typeof window<"u"}function gn(t){return Rb(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=(Rb(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Rb(t){return Uu()?t instanceof Node||t instanceof Oe(t).Node:!1}function Ne(t){return Uu()?t instanceof Element||t instanceof Oe(t).Element:!1}function Ve(t){return Uu()?t instanceof HTMLElement||t instanceof Oe(t).HTMLElement:!1}function Tb(t){return!Uu()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Oe(t).ShadowRoot}var jP=new Set(["inline","contents"]);function Fn(t){let{overflow:e,overflowX:n,overflowY:r,display:i}=Le(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!jP.has(i)}var UP=new Set(["table","td","th"]);function Wu(t){return UP.has(gn(t))}var WP=[":popover-open",":modal"];function pr(t){return WP.some(e=>{try{return t.matches(e)}catch{return!1}})}var qP=["transform","translate","scale","rotate","perspective"],KP=["transform","translate","scale","rotate","perspective","filter"],GP=["paint","layout","strict","content"];function Gi(t){let e=Zi(),n=Ne(t)?Le(t):t;return qP.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)||KP.some(r=>(n.willChange||"").includes(r))||GP.some(r=>(n.contain||"").includes(r))}function qu(t){let e=mt(t);for(;Ve(e)&&!tn(e);){if(Gi(e))return e;if(pr(e))return null;e=mt(e)}return null}function Zi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var ZP=new Set(["html","body","#document"]);function tn(t){return ZP.has(gn(t))}function Le(t){return Oe(t).getComputedStyle(t)}function $n(t){return Ne(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function mt(t){if(gn(t)==="html")return t;let e=t.assignedSlot||t.parentNode||Tb(t)&&t.host||$e(t);return Tb(e)?e.host:e}function Ib(t){let e=mt(t);return tn(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ve(e)&&Fn(e)?e:Ib(e)}function Mn(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);let i=Ib(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Oe(i);if(o){let a=Yi(s);return e.concat(s,s.visualViewport||[],Fn(i)?i:[],a&&n?Mn(a):[])}return e.concat(i,Mn(i,[],n))}function Yi(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Lb(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=On(n)!==o||On(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function cm(t){return Ne(t)?t:t.contextElement}function us(t){let e=cm(t);if(!Ve(e))return Pe(1);let n=e.getBoundingClientRect(),{width:r,height:i,$:o}=Lb(e),s=(o?On(n.width):n.width)/r,a=(o?On(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var e2=Pe(0);function Mb(t){let e=Oe(t);return!Zi()||!e.visualViewport?e2:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function t2(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Oe(t)?!1:e}function Xi(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);let i=t.getBoundingClientRect(),o=cm(t),s=Pe(1);e&&(r?Ne(r)&&(s=us(r)):s=us(t));let a=t2(o,n,r)?Mb(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,_=Yi(v);for(;_&&r&&g!==v;){let x=us(_),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(_),_=Yi(v)}}return Ln({width:u,height:f,x:l,y:c})}function Ku(t,e){let n=$n(t).scrollLeft;return e?e.left+n:Xi($e(t)).left+n}function Fb(t,e){let n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Ku(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function n2(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)&&((gn(r)!=="body"||Fn(s))&&(l=$n(r)),Ve(r))){let g=Xi(r);c=us(r),u.x=g.x+r.clientLeft,u.y=g.y+r.clientTop}let h=s&&!f&&!o?Fb(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 r2(t){return Array.from(t.getClientRects())}function i2(t){let e=$e(t),n=$n(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+Ku(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 Pb=25;function o2(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=Zi();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}let c=Ku(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<=Pb&&(o-=v)}else c<=Pb&&(o+=c);return{width:o,height:s,x:a,y:l}}var s2=new Set(["absolute","fixed"]);function a2(t,e){let n=Xi(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=Ve(t)?us(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 Ob(t,e,n){let r;if(e==="viewport")r=o2(t,n);else if(e==="document")r=i2($e(t));else if(Ne(e))r=a2(e,n);else{let i=Mb(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Ln(r)}function $b(t,e){let n=mt(t);return n===e||!Ne(n)||tn(n)?!1:Le(n).position==="fixed"||$b(n,e)}function l2(t,e){let n=e.get(t);if(n)return n;let r=Mn(t,[],!1).filter(a=>Ne(a)&&gn(a)!=="body"),i=null,o=Le(t).position==="fixed",s=o?mt(t):t;for(;Ne(s)&&!tn(s);){let a=Le(s),l=Gi(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&s2.has(i.position)||Fn(s)&&!l&&$b(t,s))?r=r.filter(u=>u!==s):i=a,s=mt(s)}return e.set(t,r),r}function c2(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t,s=[...n==="clippingAncestors"?pr(e)?[]:l2(e,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{let f=Ob(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},Ob(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function u2(t){let{width:e,height:n}=Lb(t);return{width:e,height:n}}function d2(t,e,n){let r=Ve(e),i=$e(e),o=n==="fixed",s=Xi(t,!0,o,e),a={scrollLeft:0,scrollTop:0},l=Pe(0);function c(){l.x=Ku(i)}if(r||!r&&!o)if((gn(e)!=="body"||Fn(i))&&(a=$n(e)),r){let g=Xi(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?Fb(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 lm(t){return Le(t).position==="static"}function Nb(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 Db(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)&&!lm(i))return i;i=mt(i)}return n}let r=Nb(t,e);for(;r&&Wu(r)&&lm(r);)r=Nb(r,e);return r&&tn(r)&&lm(r)&&!Gi(r)?n:r||qu(t)||n}var f2=async function(t){let e=this.getOffsetParent||Db,n=this.getDimensions,r=await n(t.floating);return{reference:d2(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function p2(t){return Le(t).direction==="rtl"}var h2={convertOffsetParentRelativeRectToViewportRelativeRect:n2,getDocumentElement:$e,getClippingRect:c2,getOffsetParent:Db,getElementRects:f2,getClientRects:r2,getDimensions:u2,getScale:us,isElement:Ne,isRTL:p2};function Bb(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function g2(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=Nn(f),_=Nn(i.clientWidth-(u+h)),x=Nn(i.clientHeight-(f+g)),d=Nn(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&&!Bb(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 Vb(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=cm(t),u=i||o?[...c?Mn(c):[],...Mn(e)]:[];u.forEach(d=>{i&&d.addEventListener("scroll",n,{passive:!0}),o&&d.addEventListener("resize",n)});let f=c&&a?g2(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?Xi(t):null;l&&x();function x(){let d=Xi(t);_&&!Bb(_,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 zb=Hu;var Hb=ju,jb=zu;var Ub=am,Wb=sm;var qb=(t,e,n)=>{let r=new Map,i={platform:h2,...n},o={...i.platform,_c:r};return Vu(t,e,{...i,platform:o})};var m2=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(!m2.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 v2(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 Kb(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=[zb(n.offsetPx??8),jb(),Hb({padding:8}),Ub(),Wb({element:l})],u=n.placement&&n.placement!=="auto"?n.placement:"top",f=Vb(t,o,async()=>{let d=v2(t),p=await qb(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 um=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});