userpath-js 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var B1=Object.defineProperty;var V1=($,_)=>{for(var Q in _)B1($,Q,{get:_[Q],enumerable:!0,configurable:!0,set:(H)=>_[Q]=()=>H})};var O0={name:"userpath-js",version:"1.0.2",private:!1,main:"dist/index.js",types:"dist/types/sdk/src/index.d.ts",scripts:{dev:"bun build src/index.ts --outdir ./dist --watch",types:"tsc",test:"vitest run","test:watch":"vitest","test:ui":"vitest --ui","test:coverage":"vitest --coverage",build:"bun run build.client && bun run build.pixel && bun run build.server && bun run build.browser","build.prod":"bun run build.client.prod && bun run build.pixel.prod && bun run build.server.prod && bun run build.browser.prod","build.client":"bun run types && bun build src/index.ts --outdir ./dist --no-cache","build.client.prod":"bun run types && bun build src/index.ts --outdir ./dist --minify","build.pixel":"bun build src/pixel.ts --outdir ./dist","build.pixel.prod":"bun build src/pixel.ts --outdir ./dist --minify","build.server":"bun run types && bun build src/server/index.ts --outdir ./dist/server","build.server.prod":"bun run types && bun build src/server/index.ts --outdir ./dist/server --minify","build.browser":"bun run types && bun build src/browser/index.ts --outdir ./dist/browser","build.browser.prod":"bun run types && bun build src/browser/index.ts --outdir ./dist/browser --minify",release:"bun run build.prod && npm publish"},dependencies:{"iconv-lite":"^0.6.3"},exports:{".":{types:"./dist/types/src/index.d.ts",default:"./dist/index.js"},"./server":{types:"./dist/types/src/server/index.d.ts",default:"./dist/server/index.js"},"./browser":{types:"./dist/types/src/browser/index.d.ts",default:"./dist/browser/index.js"}},files:["dist/index.js","dist/types","dist/server","dist/browser"]};var y=()=>typeof window==="undefined"||typeof document==="undefined"||typeof IntersectionObserver==="undefined"||window.document===void 0||window.location===void 0||window.navigator===void 0||window.history===void 0;function U$($){let Q=new URL($).hostname,H=Q.split(".");return`.${H.length>2?H.slice(-2).join("."):Q}`}function J0($,_){return Object.fromEntries(Object.entries($).filter(([Q])=>!_.includes(Q)))}function L(){return y()?{location:{href:"",pathname:"",host:""},addEventListener:($,_,Q)=>{return()=>{}},removeEventListener:($,_,Q)=>{return()=>{}},clearInterval:()=>{},setInterval:()=>{return 0},scrollTo:()=>{},scrollBy:()=>{},setTimeout:()=>{return 0},clearTimeout:()=>{},innerHeight:0,pageYOffset:0,documentElement:{scrollHeight:0,offsetHeight:0,clientHeight:0,scrollTop:0},screen:{width:0,height:0}}:window}function Z(){return y()?{hidden:!1,location:{href:""},referrer:"",title:"",querySelector:()=>null,closest:()=>null,clearTimeout:()=>{},setTimeout:()=>{return 0},innerHeight:0,pageYOffset:0,documentElement:{scrollHeight:0,offsetHeight:0,clientHeight:0,scrollTop:0}}:document}var K0=y()?{cookie:""}:window.document;function C$($,_,Q={}){let{days:H=7,path:Y="/",domain:q,secure:B,sameSite:V="strict"}=Q,J=H?new Date(Date.now()+H*86400000).toUTCString():"",N=`${encodeURIComponent($)}=${encodeURIComponent(_)}`;if(J)N+=`; expires=${J}`;if(Y)N+=`; path=${Y}`;if(q)N+=`; domain=${q}`;if(B)N+="; secure";if(V)N+=`; samesite=${V}`;K0.cookie=N}function j0($){let _=encodeURIComponent($)+"=",Q=K0.cookie.split(";");for(let H=0;H<Q.length;H++){let Y=Q[H];while(Y.charAt(0)===" ")Y=Y.substring(1,Y.length);if(Y.indexOf(_)===0)return decodeURIComponent(Y.substring(_.length,Y.length))}return null}var R={appId:"",apiKey:"",serverUrl:"https://api.userpath.co",version:1,flushIntervalMs:5000,secure:!0,autoTrack:{errors:!0,clicks:!0,scrolling:!0,forms:!0,videos:!0,pageVisibility:!0,pageInactivity:!0,performance:!0}};class d${serverUrl;appId;version;secure;constructor($){this.secure=typeof $.secure==="boolean"?$.secure:R.secure,this.serverUrl=$.serverUrl||R.serverUrl,this.appId=$.appId,this.version=$.version||R.version,C$("_up.app",this.appId,{days:365,sameSite:"lax",secure:this.secure,domain:U$(this.serverUrl)})}buildUrl($){return`${this.serverUrl}/v${this.version}/${$}`}}var X={};V1(X,{void:()=>o1,util:()=>E,unknown:()=>i1,union:()=>t1,undefined:()=>p1,tuple:()=>XX,transformer:()=>JX,symbol:()=>l1,string:()=>F0,strictObject:()=>a1,setErrorMap:()=>j1,set:()=>YX,record:()=>_X,quotelessJson:()=>J1,promise:()=>OX,preprocess:()=>LX,pipeline:()=>DX,ostring:()=>NX,optional:()=>KX,onumber:()=>GX,oboolean:()=>AX,objectUtil:()=>c$,object:()=>s1,number:()=>v0,nullable:()=>jX,null:()=>d1,never:()=>n1,nativeEnum:()=>VX,nan:()=>g1,map:()=>QX,makeIssue:()=>F$,literal:()=>qX,lazy:()=>WX,late:()=>h1,isValid:()=>o,isDirty:()=>R$,isAsync:()=>W$,isAborted:()=>b$,intersection:()=>$X,instanceof:()=>x1,getParsedType:()=>l,getErrorMap:()=>H$,function:()=>HX,enum:()=>BX,effect:()=>JX,discriminatedUnion:()=>e1,defaultErrorMap:()=>c,datetimeRegex:()=>w0,date:()=>u1,custom:()=>k0,coerce:()=>wX,boolean:()=>E0,bigint:()=>m1,array:()=>r1,any:()=>c1,addIssueToContext:()=>j,ZodVoid:()=>E$,ZodUnknown:()=>r,ZodUnion:()=>K$,ZodUndefined:()=>O$,ZodType:()=>k,ZodTuple:()=>d,ZodTransformer:()=>u,ZodSymbol:()=>v$,ZodString:()=>h,ZodSet:()=>_$,ZodSchema:()=>k,ZodRecord:()=>P$,ZodReadonly:()=>w$,ZodPromise:()=>Q$,ZodPipeline:()=>f$,ZodParsedType:()=>K,ZodOptional:()=>g,ZodObject:()=>S,ZodNumber:()=>s,ZodNullable:()=>n,ZodNull:()=>J$,ZodNever:()=>p,ZodNativeEnum:()=>N$,ZodNaN:()=>I$,ZodMap:()=>S$,ZodLiteral:()=>D$,ZodLazy:()=>L$,ZodIssueCode:()=>O,ZodIntersection:()=>j$,ZodFunction:()=>B$,ZodFirstPartyTypeKind:()=>A,ZodError:()=>z,ZodEnum:()=>t,ZodEffects:()=>u,ZodDiscriminatedUnion:()=>z$,ZodDefault:()=>G$,ZodDate:()=>$$,ZodCatch:()=>A$,ZodBranded:()=>y$,ZodBoolean:()=>V$,ZodBigInt:()=>a,ZodArray:()=>x,ZodAny:()=>X$,Schema:()=>k,ParseStatus:()=>U,OK:()=>b,NEVER:()=>MX,INVALID:()=>G,EMPTY_PATH:()=>L1,DIRTY:()=>e,BRAND:()=>T1});var E;(function($){$.assertEqual=(Y)=>{};function _(Y){}$.assertIs=_;function Q(Y){throw new Error}$.assertNever=Q,$.arrayToEnum=(Y)=>{let q={};for(let B of Y)q[B]=B;return q},$.getValidEnumValues=(Y)=>{let q=$.objectKeys(Y).filter((V)=>typeof Y[Y[V]]!=="number"),B={};for(let V of q)B[V]=Y[V];return $.objectValues(B)},$.objectValues=(Y)=>{return $.objectKeys(Y).map(function(q){return Y[q]})},$.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let q=[];for(let B in Y)if(Object.prototype.hasOwnProperty.call(Y,B))q.push(B);return q},$.find=(Y,q)=>{for(let B of Y)if(q(B))return B;return},$.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function H(Y,q=" | "){return Y.map((B)=>typeof B==="string"?`'${B}'`:B).join(q)}$.joinValues=H,$.jsonStringifyReplacer=(Y,q)=>{if(typeof q==="bigint")return q.toString();return q}})(E||(E={}));var c$;(function($){$.mergeShapes=(_,Q)=>{return{..._,...Q}}})(c$||(c$={}));var K=E.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),l=($)=>{switch(typeof $){case"undefined":return K.undefined;case"string":return K.string;case"number":return Number.isNaN($)?K.nan:K.number;case"boolean":return K.boolean;case"function":return K.function;case"bigint":return K.bigint;case"symbol":return K.symbol;case"object":if(Array.isArray($))return K.array;if($===null)return K.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return K.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return K.map;if(typeof Set!=="undefined"&&$ instanceof Set)return K.set;if(typeof Date!=="undefined"&&$ instanceof Date)return K.date;return K.object;default:return K.unknown}};var O=E.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"]),J1=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class z extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};let _=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,_);else this.__proto__=_;this.name="ZodError",this.issues=$}format($){let _=$||function(Y){return Y.message},Q={_errors:[]},H=(Y)=>{for(let q of Y.issues)if(q.code==="invalid_union")q.unionErrors.map(H);else if(q.code==="invalid_return_type")H(q.returnTypeError);else if(q.code==="invalid_arguments")H(q.argumentsError);else if(q.path.length===0)Q._errors.push(_(q));else{let B=Q,V=0;while(V<q.path.length){let J=q.path[V];if(V!==q.path.length-1)B[J]=B[J]||{_errors:[]};else B[J]=B[J]||{_errors:[]},B[J]._errors.push(_(q));B=B[J],V++}}};return H(this),Q}static assert($){if(!($ instanceof z))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,E.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(_)=>_.message){let _={},Q=[];for(let H of this.issues)if(H.path.length>0)_[H.path[0]]=_[H.path[0]]||[],_[H.path[0]].push($(H));else Q.push($(H));return{formErrors:Q,fieldErrors:_}}get formErrors(){return this.flatten()}}z.create=($)=>{return new z($)};var K1=($,_)=>{let Q;switch($.code){case O.invalid_type:if($.received===K.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case O.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,E.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:Q=`Unrecognized key(s) in object: ${E.joinValues($.keys,", ")}`;break;case O.invalid_union:Q="Invalid input";break;case O.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${E.joinValues($.options)}`;break;case O.invalid_enum_value:Q=`Invalid enum value. Expected ${E.joinValues($.options)}, received '${$.received}'`;break;case O.invalid_arguments:Q="Invalid function arguments";break;case O.invalid_return_type:Q="Invalid function return type";break;case O.invalid_date:Q="Invalid date";break;case O.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(Q=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)Q=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)Q=`Invalid input: must end with "${$.validation.endsWith}"`;else E.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case O.too_small:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else Q="Invalid input";break;case O.too_big:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")Q=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else Q="Invalid input";break;case O.custom:Q="Invalid input";break;case O.invalid_intersection_types:Q="Intersection results could not be merged";break;case O.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case O.not_finite:Q="Number must be finite";break;default:Q=_.defaultError,E.assertNever($)}return{message:Q}},c=K1;var L0=c;function j1($){L0=$}function H$(){return L0}var F$=($)=>{let{data:_,path:Q,errorMaps:H,issueData:Y}=$,q=[...Q,...Y.path||[]],B={...Y,path:q};if(Y.message!==void 0)return{...Y,path:q,message:Y.message};let V="",J=H.filter((N)=>!!N).slice().reverse();for(let N of J)V=N(B,{data:_,defaultError:V}).message;return{...Y,path:q,message:V}},L1=[];function j($,_){let Q=H$(),H=F$({issueData:_,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===c?void 0:c].filter((Y)=>!!Y)});$.common.issues.push(H)}class U{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,_){let Q=[];for(let H of _){if(H.status==="aborted")return G;if(H.status==="dirty")$.dirty();Q.push(H.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,_){let Q=[];for(let H of _){let Y=await H.key,q=await H.value;Q.push({key:Y,value:q})}return U.mergeObjectSync($,Q)}static mergeObjectSync($,_){let Q={};for(let H of _){let{key:Y,value:q}=H;if(Y.status==="aborted")return G;if(q.status==="aborted")return G;if(Y.status==="dirty")$.dirty();if(q.status==="dirty")$.dirty();if(Y.value!=="__proto__"&&(typeof q.value!=="undefined"||H.alwaysSet))Q[Y.value]=q.value}return{status:$.value,value:Q}}}var G=Object.freeze({status:"aborted"}),e=($)=>({status:"dirty",value:$}),b=($)=>({status:"valid",value:$}),b$=($)=>$.status==="aborted",R$=($)=>$.status==="dirty",o=($)=>$.status==="valid",W$=($)=>typeof Promise!=="undefined"&&$ instanceof Promise;var D;(function($){$.errToObj=(_)=>typeof _==="string"?{message:_}:_||{},$.toString=(_)=>typeof _==="string"?_:_?.message})(D||(D={}));class m{constructor($,_,Q,H){this._cachedPath=[],this.parent=$,this.data=_,this._path=Q,this._key=H}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var D0=($,_)=>{if(o(_))return{success:!0,data:_.value};else{if(!$.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Q=new z($.common.issues);return this._error=Q,this._error}}}};function M($){if(!$)return{};let{errorMap:_,invalid_type_error:Q,required_error:H,description:Y}=$;if(_&&(Q||H))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(_)return{errorMap:_,description:Y};return{errorMap:(B,V)=>{let{message:J}=$;if(B.code==="invalid_enum_value")return{message:J??V.defaultError};if(typeof V.data==="undefined")return{message:J??H??V.defaultError};if(B.code!=="invalid_type")return{message:V.defaultError};return{message:J??Q??V.defaultError}},description:Y}}class k{get description(){return this._def.description}_getType($){return l($.data)}_getOrReturnCtx($,_){return _||{common:$.parent.common,data:$.data,parsedType:l($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new U,ctx:{common:$.parent.common,data:$.data,parsedType:l($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let _=this._parse($);if(W$(_))throw new Error("Synchronous parse encountered promise.");return _}_parseAsync($){let _=this._parse($);return Promise.resolve(_)}parse($,_){let Q=this.safeParse($,_);if(Q.success)return Q.data;throw Q.error}safeParse($,_){let Q={common:{issues:[],async:_?.async??!1,contextualErrorMap:_?.errorMap},path:_?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:l($)},H=this._parseSync({data:$,path:Q.path,parent:Q});return D0(Q,H)}"~validate"($){let _={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:l($)};if(!this["~standard"].async)try{let Q=this._parseSync({data:$,path:[],parent:_});return o(Q)?{value:Q.value}:{issues:_.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;_.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:_}).then((Q)=>o(Q)?{value:Q.value}:{issues:_.common.issues})}async parseAsync($,_){let Q=await this.safeParseAsync($,_);if(Q.success)return Q.data;throw Q.error}async safeParseAsync($,_){let Q={common:{issues:[],contextualErrorMap:_?.errorMap,async:!0},path:_?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:l($)},H=this._parse({data:$,path:Q.path,parent:Q}),Y=await(W$(H)?H:Promise.resolve(H));return D0(Q,Y)}refine($,_){let Q=(H)=>{if(typeof _==="string"||typeof _==="undefined")return{message:_};else if(typeof _==="function")return _(H);else return _};return this._refinement((H,Y)=>{let q=$(H),B=()=>Y.addIssue({code:O.custom,...Q(H)});if(typeof Promise!=="undefined"&&q instanceof Promise)return q.then((V)=>{if(!V)return B(),!1;else return!0});if(!q)return B(),!1;else return!0})}refinement($,_){return this._refinement((Q,H)=>{if(!$(Q))return H.addIssue(typeof _==="function"?_(Q,H):_),!1;else return!0})}_refinement($){return new u({schema:this,typeName:A.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,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:(_)=>this["~validate"](_)}}optional(){return g.create(this,this._def)}nullable(){return n.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return x.create(this)}promise(){return Q$.create(this,this._def)}or($){return K$.create([this,$],this._def)}and($){return j$.create(this,$,this._def)}transform($){return new u({...M(this._def),schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:$}})}default($){let _=typeof $==="function"?$:()=>$;return new G$({...M(this._def),innerType:this,defaultValue:_,typeName:A.ZodDefault})}brand(){return new y$({typeName:A.ZodBranded,type:this,...M(this._def)})}catch($){let _=typeof $==="function"?$:()=>$;return new A$({...M(this._def),innerType:this,catchValue:_,typeName:A.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return f$.create(this,$)}readonly(){return w$.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var D1=/^c[^\s-]{8,}$/i,N1=/^[0-9a-z]+$/,G1=/^[0-9A-HJKMNP-TV-Z]{26}$/i,A1=/^[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,w1=/^[a-z0-9_-]{21}$/i,M1=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,k1=/^[-+]?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)?)??$/,F1=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,v1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",i$,E1=/^(?:(?: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])$/,P1=/^(?:(?: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])$/,S1=/^(([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]))$/,I1=/^(([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])$/,f1=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Z1=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,G0="((\\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])))",U1=new RegExp(`^${G0}$`);function A0($){let _="[0-5]\\d";if($.precision)_=`${_}\\.\\d{${$.precision}}`;else if($.precision==null)_=`${_}(\\.\\d+)?`;let Q=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${_})${Q}`}function C1($){return new RegExp(`^${A0($)}$`)}function w0($){let _=`${G0}T${A0($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return _=`${_}(${Q.join("|")})`,new RegExp(`^${_}$`)}function b1($,_){if((_==="v4"||!_)&&E1.test($))return!0;if((_==="v6"||!_)&&S1.test($))return!0;return!1}function R1($,_){if(!M1.test($))return!1;try{let[Q]=$.split("."),H=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),Y=JSON.parse(atob(H));if(typeof Y!=="object"||Y===null)return!1;if("typ"in Y&&Y?.typ!=="JWT")return!1;if(!Y.alg)return!1;if(_&&Y.alg!==_)return!1;return!0}catch{return!1}}function z1($,_){if((_==="v4"||!_)&&P1.test($))return!0;if((_==="v6"||!_)&&I1.test($))return!0;return!1}class h extends k{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==K.string){let Y=this._getOrReturnCtx($);return j(Y,{code:O.invalid_type,expected:K.string,received:Y.parsedType}),G}let Q=new U,H=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if($.data.length<Y.value)H=this._getOrReturnCtx($,H),j(H,{code:O.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="max"){if($.data.length>Y.value)H=this._getOrReturnCtx($,H),j(H,{code:O.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="length"){let q=$.data.length>Y.value,B=$.data.length<Y.value;if(q||B){if(H=this._getOrReturnCtx($,H),q)j(H,{code:O.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(B)j(H,{code:O.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});Q.dirty()}}else if(Y.kind==="email"){if(!F1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"email",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="emoji"){if(!i$)i$=new RegExp(v1,"u");if(!i$.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"emoji",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="uuid"){if(!A1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"uuid",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="nanoid"){if(!w1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"nanoid",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid"){if(!D1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"cuid",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid2"){if(!N1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"cuid2",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ulid"){if(!G1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"ulid",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="url")try{new URL($.data)}catch{H=this._getOrReturnCtx($,H),j(H,{validation:"url",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"regex",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="trim")$.data=$.data.trim();else if(Y.kind==="includes"){if(!$.data.includes(Y.value,Y.position))H=this._getOrReturnCtx($,H),j(H,{code:O.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),Q.dirty()}else if(Y.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(Y.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(Y.kind==="startsWith"){if(!$.data.startsWith(Y.value))H=this._getOrReturnCtx($,H),j(H,{code:O.invalid_string,validation:{startsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="endsWith"){if(!$.data.endsWith(Y.value))H=this._getOrReturnCtx($,H),j(H,{code:O.invalid_string,validation:{endsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="datetime"){if(!w0(Y).test($.data))H=this._getOrReturnCtx($,H),j(H,{code:O.invalid_string,validation:"datetime",message:Y.message}),Q.dirty()}else if(Y.kind==="date"){if(!U1.test($.data))H=this._getOrReturnCtx($,H),j(H,{code:O.invalid_string,validation:"date",message:Y.message}),Q.dirty()}else if(Y.kind==="time"){if(!C1(Y).test($.data))H=this._getOrReturnCtx($,H),j(H,{code:O.invalid_string,validation:"time",message:Y.message}),Q.dirty()}else if(Y.kind==="duration"){if(!k1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"duration",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ip"){if(!b1($.data,Y.version))H=this._getOrReturnCtx($,H),j(H,{validation:"ip",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="jwt"){if(!R1($.data,Y.alg))H=this._getOrReturnCtx($,H),j(H,{validation:"jwt",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cidr"){if(!z1($.data,Y.version))H=this._getOrReturnCtx($,H),j(H,{validation:"cidr",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64"){if(!f1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"base64",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64url"){if(!Z1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"base64url",code:O.invalid_string,message:Y.message}),Q.dirty()}else E.assertNever(Y);return{status:Q.value,value:$.data}}_regex($,_,Q){return this.refinement((H)=>$.test(H),{validation:_,code:O.invalid_string,...D.errToObj(Q)})}_addCheck($){return new h({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...D.errToObj($)})}url($){return this._addCheck({kind:"url",...D.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...D.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...D.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...D.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...D.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...D.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...D.errToObj($)})}base64($){return this._addCheck({kind:"base64",...D.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...D.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...D.errToObj($)})}ip($){return this._addCheck({kind:"ip",...D.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...D.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision==="undefined"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...D.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision==="undefined"?null:$?.precision,...D.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...D.errToObj($)})}regex($,_){return this._addCheck({kind:"regex",regex:$,...D.errToObj(_)})}includes($,_){return this._addCheck({kind:"includes",value:$,position:_?.position,...D.errToObj(_?.message)})}startsWith($,_){return this._addCheck({kind:"startsWith",value:$,...D.errToObj(_)})}endsWith($,_){return this._addCheck({kind:"endsWith",value:$,...D.errToObj(_)})}min($,_){return this._addCheck({kind:"min",value:$,...D.errToObj(_)})}max($,_){return this._addCheck({kind:"max",value:$,...D.errToObj(_)})}length($,_){return this._addCheck({kind:"length",value:$,...D.errToObj(_)})}nonempty($){return this.min(1,D.errToObj($))}trim(){return new h({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new h({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new h({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let _ of this._def.checks)if(_.kind==="min"){if($===null||_.value>$)$=_.value}return $}get maxLength(){let $=null;for(let _ of this._def.checks)if(_.kind==="max"){if($===null||_.value<$)$=_.value}return $}}h.create=($)=>{return new h({checks:[],typeName:A.ZodString,coerce:$?.coerce??!1,...M($)})};function y1($,_){let Q=($.toString().split(".")[1]||"").length,H=(_.toString().split(".")[1]||"").length,Y=Q>H?Q:H,q=Number.parseInt($.toFixed(Y).replace(".","")),B=Number.parseInt(_.toFixed(Y).replace(".",""));return q%B/10**Y}class s extends k{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==K.number){let Y=this._getOrReturnCtx($);return j(Y,{code:O.invalid_type,expected:K.number,received:Y.parsedType}),G}let Q=void 0,H=new U;for(let Y of this._def.checks)if(Y.kind==="int"){if(!E.isInteger($.data))Q=this._getOrReturnCtx($,Q),j(Q,{code:O.invalid_type,expected:"integer",received:"float",message:Y.message}),H.dirty()}else if(Y.kind==="min"){if(Y.inclusive?$.data<Y.value:$.data<=Y.value)Q=this._getOrReturnCtx($,Q),j(Q,{code:O.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),H.dirty()}else if(Y.kind==="max"){if(Y.inclusive?$.data>Y.value:$.data>=Y.value)Q=this._getOrReturnCtx($,Q),j(Q,{code:O.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),H.dirty()}else if(Y.kind==="multipleOf"){if(y1($.data,Y.value)!==0)Q=this._getOrReturnCtx($,Q),j(Q,{code:O.not_multiple_of,multipleOf:Y.value,message:Y.message}),H.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),j(Q,{code:O.not_finite,message:Y.message}),H.dirty()}else E.assertNever(Y);return{status:H.value,value:$.data}}gte($,_){return this.setLimit("min",$,!0,D.toString(_))}gt($,_){return this.setLimit("min",$,!1,D.toString(_))}lte($,_){return this.setLimit("max",$,!0,D.toString(_))}lt($,_){return this.setLimit("max",$,!1,D.toString(_))}setLimit($,_,Q,H){return new s({...this._def,checks:[...this._def.checks,{kind:$,value:_,inclusive:Q,message:D.toString(H)}]})}_addCheck($){return new s({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:D.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:D.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:D.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:D.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:D.toString($)})}multipleOf($,_){return this._addCheck({kind:"multipleOf",value:$,message:D.toString(_)})}finite($){return this._addCheck({kind:"finite",message:D.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:D.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:D.toString($)})}get minValue(){let $=null;for(let _ of this._def.checks)if(_.kind==="min"){if($===null||_.value>$)$=_.value}return $}get maxValue(){let $=null;for(let _ of this._def.checks)if(_.kind==="max"){if($===null||_.value<$)$=_.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&E.isInteger($.value))}get isFinite(){let $=null,_=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(_===null||Q.value>_)_=Q.value}else if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return Number.isFinite(_)&&Number.isFinite($)}}s.create=($)=>{return new s({checks:[],typeName:A.ZodNumber,coerce:$?.coerce||!1,...M($)})};class a extends k{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==K.bigint)return this._getInvalidInput($);let Q=void 0,H=new U;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?$.data<Y.value:$.data<=Y.value)Q=this._getOrReturnCtx($,Q),j(Q,{code:O.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),H.dirty()}else if(Y.kind==="max"){if(Y.inclusive?$.data>Y.value:$.data>=Y.value)Q=this._getOrReturnCtx($,Q),j(Q,{code:O.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),H.dirty()}else if(Y.kind==="multipleOf"){if($.data%Y.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),j(Q,{code:O.not_multiple_of,multipleOf:Y.value,message:Y.message}),H.dirty()}else E.assertNever(Y);return{status:H.value,value:$.data}}_getInvalidInput($){let _=this._getOrReturnCtx($);return j(_,{code:O.invalid_type,expected:K.bigint,received:_.parsedType}),G}gte($,_){return this.setLimit("min",$,!0,D.toString(_))}gt($,_){return this.setLimit("min",$,!1,D.toString(_))}lte($,_){return this.setLimit("max",$,!0,D.toString(_))}lt($,_){return this.setLimit("max",$,!1,D.toString(_))}setLimit($,_,Q,H){return new a({...this._def,checks:[...this._def.checks,{kind:$,value:_,inclusive:Q,message:D.toString(H)}]})}_addCheck($){return new a({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:D.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:D.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:D.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:D.toString($)})}multipleOf($,_){return this._addCheck({kind:"multipleOf",value:$,message:D.toString(_)})}get minValue(){let $=null;for(let _ of this._def.checks)if(_.kind==="min"){if($===null||_.value>$)$=_.value}return $}get maxValue(){let $=null;for(let _ of this._def.checks)if(_.kind==="max"){if($===null||_.value<$)$=_.value}return $}}a.create=($)=>{return new a({checks:[],typeName:A.ZodBigInt,coerce:$?.coerce??!1,...M($)})};class V$ extends k{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==K.boolean){let Q=this._getOrReturnCtx($);return j(Q,{code:O.invalid_type,expected:K.boolean,received:Q.parsedType}),G}return b($.data)}}V$.create=($)=>{return new V$({typeName:A.ZodBoolean,coerce:$?.coerce||!1,...M($)})};class $$ extends k{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==K.date){let Y=this._getOrReturnCtx($);return j(Y,{code:O.invalid_type,expected:K.date,received:Y.parsedType}),G}if(Number.isNaN($.data.getTime())){let Y=this._getOrReturnCtx($);return j(Y,{code:O.invalid_date}),G}let Q=new U,H=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if($.data.getTime()<Y.value)H=this._getOrReturnCtx($,H),j(H,{code:O.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),Q.dirty()}else if(Y.kind==="max"){if($.data.getTime()>Y.value)H=this._getOrReturnCtx($,H),j(H,{code:O.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),Q.dirty()}else E.assertNever(Y);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new $$({...this._def,checks:[...this._def.checks,$]})}min($,_){return this._addCheck({kind:"min",value:$.getTime(),message:D.toString(_)})}max($,_){return this._addCheck({kind:"max",value:$.getTime(),message:D.toString(_)})}get minDate(){let $=null;for(let _ of this._def.checks)if(_.kind==="min"){if($===null||_.value>$)$=_.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let _ of this._def.checks)if(_.kind==="max"){if($===null||_.value<$)$=_.value}return $!=null?new Date($):null}}$$.create=($)=>{return new $$({checks:[],coerce:$?.coerce||!1,typeName:A.ZodDate,...M($)})};class v$ extends k{_parse($){if(this._getType($)!==K.symbol){let Q=this._getOrReturnCtx($);return j(Q,{code:O.invalid_type,expected:K.symbol,received:Q.parsedType}),G}return b($.data)}}v$.create=($)=>{return new v$({typeName:A.ZodSymbol,...M($)})};class O$ extends k{_parse($){if(this._getType($)!==K.undefined){let Q=this._getOrReturnCtx($);return j(Q,{code:O.invalid_type,expected:K.undefined,received:Q.parsedType}),G}return b($.data)}}O$.create=($)=>{return new O$({typeName:A.ZodUndefined,...M($)})};class J$ extends k{_parse($){if(this._getType($)!==K.null){let Q=this._getOrReturnCtx($);return j(Q,{code:O.invalid_type,expected:K.null,received:Q.parsedType}),G}return b($.data)}}J$.create=($)=>{return new J$({typeName:A.ZodNull,...M($)})};class X$ extends k{constructor(){super(...arguments);this._any=!0}_parse($){return b($.data)}}X$.create=($)=>{return new X$({typeName:A.ZodAny,...M($)})};class r extends k{constructor(){super(...arguments);this._unknown=!0}_parse($){return b($.data)}}r.create=($)=>{return new r({typeName:A.ZodUnknown,...M($)})};class p extends k{_parse($){let _=this._getOrReturnCtx($);return j(_,{code:O.invalid_type,expected:K.never,received:_.parsedType}),G}}p.create=($)=>{return new p({typeName:A.ZodNever,...M($)})};class E$ extends k{_parse($){if(this._getType($)!==K.undefined){let Q=this._getOrReturnCtx($);return j(Q,{code:O.invalid_type,expected:K.void,received:Q.parsedType}),G}return b($.data)}}E$.create=($)=>{return new E$({typeName:A.ZodVoid,...M($)})};class x extends k{_parse($){let{ctx:_,status:Q}=this._processInputParams($),H=this._def;if(_.parsedType!==K.array)return j(_,{code:O.invalid_type,expected:K.array,received:_.parsedType}),G;if(H.exactLength!==null){let q=_.data.length>H.exactLength.value,B=_.data.length<H.exactLength.value;if(q||B)j(_,{code:q?O.too_big:O.too_small,minimum:B?H.exactLength.value:void 0,maximum:q?H.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:H.exactLength.message}),Q.dirty()}if(H.minLength!==null){if(_.data.length<H.minLength.value)j(_,{code:O.too_small,minimum:H.minLength.value,type:"array",inclusive:!0,exact:!1,message:H.minLength.message}),Q.dirty()}if(H.maxLength!==null){if(_.data.length>H.maxLength.value)j(_,{code:O.too_big,maximum:H.maxLength.value,type:"array",inclusive:!0,exact:!1,message:H.maxLength.message}),Q.dirty()}if(_.common.async)return Promise.all([..._.data].map((q,B)=>{return H.type._parseAsync(new m(_,q,_.path,B))})).then((q)=>{return U.mergeArray(Q,q)});let Y=[..._.data].map((q,B)=>{return H.type._parseSync(new m(_,q,_.path,B))});return U.mergeArray(Q,Y)}get element(){return this._def.type}min($,_){return new x({...this._def,minLength:{value:$,message:D.toString(_)}})}max($,_){return new x({...this._def,maxLength:{value:$,message:D.toString(_)}})}length($,_){return new x({...this._def,exactLength:{value:$,message:D.toString(_)}})}nonempty($){return this.min(1,$)}}x.create=($,_)=>{return new x({type:$,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...M(_)})};function q$($){if($ instanceof S){let _={};for(let Q in $.shape){let H=$.shape[Q];_[Q]=g.create(q$(H))}return new S({...$._def,shape:()=>_})}else if($ instanceof x)return new x({...$._def,type:q$($.element)});else if($ instanceof g)return g.create(q$($.unwrap()));else if($ instanceof n)return n.create(q$($.unwrap()));else if($ instanceof d)return d.create($.items.map((_)=>q$(_)));else return $}class S extends k{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),_=E.objectKeys($);return this._cached={shape:$,keys:_},this._cached}_parse($){if(this._getType($)!==K.object){let J=this._getOrReturnCtx($);return j(J,{code:O.invalid_type,expected:K.object,received:J.parsedType}),G}let{status:Q,ctx:H}=this._processInputParams($),{shape:Y,keys:q}=this._getCached(),B=[];if(!(this._def.catchall instanceof p&&this._def.unknownKeys==="strip")){for(let J in H.data)if(!q.includes(J))B.push(J)}let V=[];for(let J of q){let N=Y[J],I=H.data[J];V.push({key:{status:"valid",value:J},value:N._parse(new m(H,I,H.path,J)),alwaysSet:J in H.data})}if(this._def.catchall instanceof p){let J=this._def.unknownKeys;if(J==="passthrough")for(let N of B)V.push({key:{status:"valid",value:N},value:{status:"valid",value:H.data[N]}});else if(J==="strict"){if(B.length>0)j(H,{code:O.unrecognized_keys,keys:B}),Q.dirty()}else if(J==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let J=this._def.catchall;for(let N of B){let I=H.data[N];V.push({key:{status:"valid",value:N},value:J._parse(new m(H,I,H.path,N)),alwaysSet:N in H.data})}}if(H.common.async)return Promise.resolve().then(async()=>{let J=[];for(let N of V){let I=await N.key,k$=await N.value;J.push({key:I,value:k$,alwaysSet:N.alwaysSet})}return J}).then((J)=>{return U.mergeObjectSync(Q,J)});else return U.mergeObjectSync(Q,V)}get shape(){return this._def.shape()}strict($){return D.errToObj,new S({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(_,Q)=>{let H=this._def.errorMap?.(_,Q).message??Q.defaultError;if(_.code==="unrecognized_keys")return{message:D.errToObj($).message??H};return{message:H}}}:{}})}strip(){return new S({...this._def,unknownKeys:"strip"})}passthrough(){return new S({...this._def,unknownKeys:"passthrough"})}extend($){return new S({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new S({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:A.ZodObject})}setKey($,_){return this.augment({[$]:_})}catchall($){return new S({...this._def,catchall:$})}pick($){let _={};for(let Q of E.objectKeys($))if($[Q]&&this.shape[Q])_[Q]=this.shape[Q];return new S({...this._def,shape:()=>_})}omit($){let _={};for(let Q of E.objectKeys(this.shape))if(!$[Q])_[Q]=this.shape[Q];return new S({...this._def,shape:()=>_})}deepPartial(){return q$(this)}partial($){let _={};for(let Q of E.objectKeys(this.shape)){let H=this.shape[Q];if($&&!$[Q])_[Q]=H;else _[Q]=H.optional()}return new S({...this._def,shape:()=>_})}required($){let _={};for(let Q of E.objectKeys(this.shape))if($&&!$[Q])_[Q]=this.shape[Q];else{let Y=this.shape[Q];while(Y instanceof g)Y=Y._def.innerType;_[Q]=Y}return new S({...this._def,shape:()=>_})}keyof(){return M0(E.objectKeys(this.shape))}}S.create=($,_)=>{return new S({shape:()=>$,unknownKeys:"strip",catchall:p.create(),typeName:A.ZodObject,...M(_)})};S.strictCreate=($,_)=>{return new S({shape:()=>$,unknownKeys:"strict",catchall:p.create(),typeName:A.ZodObject,...M(_)})};S.lazycreate=($,_)=>{return new S({shape:$,unknownKeys:"strip",catchall:p.create(),typeName:A.ZodObject,...M(_)})};class K$ extends k{_parse($){let{ctx:_}=this._processInputParams($),Q=this._def.options;function H(Y){for(let B of Y)if(B.result.status==="valid")return B.result;for(let B of Y)if(B.result.status==="dirty")return _.common.issues.push(...B.ctx.common.issues),B.result;let q=Y.map((B)=>new z(B.ctx.common.issues));return j(_,{code:O.invalid_union,unionErrors:q}),G}if(_.common.async)return Promise.all(Q.map(async(Y)=>{let q={..._,common:{..._.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:_.data,path:_.path,parent:q}),ctx:q}})).then(H);else{let Y=void 0,q=[];for(let V of Q){let J={..._,common:{..._.common,issues:[]},parent:null},N=V._parseSync({data:_.data,path:_.path,parent:J});if(N.status==="valid")return N;else if(N.status==="dirty"&&!Y)Y={result:N,ctx:J};if(J.common.issues.length)q.push(J.common.issues)}if(Y)return _.common.issues.push(...Y.ctx.common.issues),Y.result;let B=q.map((V)=>new z(V));return j(_,{code:O.invalid_union,unionErrors:B}),G}}get options(){return this._def.options}}K$.create=($,_)=>{return new K$({options:$,typeName:A.ZodUnion,...M(_)})};var i=($)=>{if($ instanceof L$)return i($.schema);else if($ instanceof u)return i($.innerType());else if($ instanceof D$)return[$.value];else if($ instanceof t)return $.options;else if($ instanceof N$)return E.objectValues($.enum);else if($ instanceof G$)return i($._def.innerType);else if($ instanceof O$)return[void 0];else if($ instanceof J$)return[null];else if($ instanceof g)return[void 0,...i($.unwrap())];else if($ instanceof n)return[null,...i($.unwrap())];else if($ instanceof y$)return i($.unwrap());else if($ instanceof w$)return i($.unwrap());else if($ instanceof A$)return i($._def.innerType);else return[]};class z$ extends k{_parse($){let{ctx:_}=this._processInputParams($);if(_.parsedType!==K.object)return j(_,{code:O.invalid_type,expected:K.object,received:_.parsedType}),G;let Q=this.discriminator,H=_.data[Q],Y=this.optionsMap.get(H);if(!Y)return j(_,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),G;if(_.common.async)return Y._parseAsync({data:_.data,path:_.path,parent:_});else return Y._parseSync({data:_.data,path:_.path,parent:_})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,_,Q){let H=new Map;for(let Y of _){let q=i(Y.shape[$]);if(!q.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let B of q){if(H.has(B))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(B)}`);H.set(B,Y)}}return new z$({typeName:A.ZodDiscriminatedUnion,discriminator:$,options:_,optionsMap:H,...M(Q)})}}function n$($,_){let Q=l($),H=l(_);if($===_)return{valid:!0,data:$};else if(Q===K.object&&H===K.object){let Y=E.objectKeys(_),q=E.objectKeys($).filter((V)=>Y.indexOf(V)!==-1),B={...$,..._};for(let V of q){let J=n$($[V],_[V]);if(!J.valid)return{valid:!1};B[V]=J.data}return{valid:!0,data:B}}else if(Q===K.array&&H===K.array){if($.length!==_.length)return{valid:!1};let Y=[];for(let q=0;q<$.length;q++){let B=$[q],V=_[q],J=n$(B,V);if(!J.valid)return{valid:!1};Y.push(J.data)}return{valid:!0,data:Y}}else if(Q===K.date&&H===K.date&&+$===+_)return{valid:!0,data:$};else return{valid:!1}}class j$ extends k{_parse($){let{status:_,ctx:Q}=this._processInputParams($),H=(Y,q)=>{if(b$(Y)||b$(q))return G;let B=n$(Y.value,q.value);if(!B.valid)return j(Q,{code:O.invalid_intersection_types}),G;if(R$(Y)||R$(q))_.dirty();return{status:_.value,value:B.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([Y,q])=>H(Y,q));else return H(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}j$.create=($,_,Q)=>{return new j$({left:$,right:_,typeName:A.ZodIntersection,...M(Q)})};class d extends k{_parse($){let{status:_,ctx:Q}=this._processInputParams($);if(Q.parsedType!==K.array)return j(Q,{code:O.invalid_type,expected:K.array,received:Q.parsedType}),G;if(Q.data.length<this._def.items.length)return j(Q,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),G;if(!this._def.rest&&Q.data.length>this._def.items.length)j(Q,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_.dirty();let Y=[...Q.data].map((q,B)=>{let V=this._def.items[B]||this._def.rest;if(!V)return null;return V._parse(new m(Q,q,Q.path,B))}).filter((q)=>!!q);if(Q.common.async)return Promise.all(Y).then((q)=>{return U.mergeArray(_,q)});else return U.mergeArray(_,Y)}get items(){return this._def.items}rest($){return new d({...this._def,rest:$})}}d.create=($,_)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new d({items:$,typeName:A.ZodTuple,rest:null,...M(_)})};class P$ extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:_,ctx:Q}=this._processInputParams($);if(Q.parsedType!==K.object)return j(Q,{code:O.invalid_type,expected:K.object,received:Q.parsedType}),G;let H=[],Y=this._def.keyType,q=this._def.valueType;for(let B in Q.data)H.push({key:Y._parse(new m(Q,B,Q.path,B)),value:q._parse(new m(Q,Q.data[B],Q.path,B)),alwaysSet:B in Q.data});if(Q.common.async)return U.mergeObjectAsync(_,H);else return U.mergeObjectSync(_,H)}get element(){return this._def.valueType}static create($,_,Q){if(_ instanceof k)return new P$({keyType:$,valueType:_,typeName:A.ZodRecord,...M(Q)});return new P$({keyType:h.create(),valueType:$,typeName:A.ZodRecord,...M(_)})}}class S$ extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:_,ctx:Q}=this._processInputParams($);if(Q.parsedType!==K.map)return j(Q,{code:O.invalid_type,expected:K.map,received:Q.parsedType}),G;let H=this._def.keyType,Y=this._def.valueType,q=[...Q.data.entries()].map(([B,V],J)=>{return{key:H._parse(new m(Q,B,Q.path,[J,"key"])),value:Y._parse(new m(Q,V,Q.path,[J,"value"]))}});if(Q.common.async){let B=new Map;return Promise.resolve().then(async()=>{for(let V of q){let J=await V.key,N=await V.value;if(J.status==="aborted"||N.status==="aborted")return G;if(J.status==="dirty"||N.status==="dirty")_.dirty();B.set(J.value,N.value)}return{status:_.value,value:B}})}else{let B=new Map;for(let V of q){let{key:J,value:N}=V;if(J.status==="aborted"||N.status==="aborted")return G;if(J.status==="dirty"||N.status==="dirty")_.dirty();B.set(J.value,N.value)}return{status:_.value,value:B}}}}S$.create=($,_,Q)=>{return new S$({valueType:_,keyType:$,typeName:A.ZodMap,...M(Q)})};class _$ extends k{_parse($){let{status:_,ctx:Q}=this._processInputParams($);if(Q.parsedType!==K.set)return j(Q,{code:O.invalid_type,expected:K.set,received:Q.parsedType}),G;let H=this._def;if(H.minSize!==null){if(Q.data.size<H.minSize.value)j(Q,{code:O.too_small,minimum:H.minSize.value,type:"set",inclusive:!0,exact:!1,message:H.minSize.message}),_.dirty()}if(H.maxSize!==null){if(Q.data.size>H.maxSize.value)j(Q,{code:O.too_big,maximum:H.maxSize.value,type:"set",inclusive:!0,exact:!1,message:H.maxSize.message}),_.dirty()}let Y=this._def.valueType;function q(V){let J=new Set;for(let N of V){if(N.status==="aborted")return G;if(N.status==="dirty")_.dirty();J.add(N.value)}return{status:_.value,value:J}}let B=[...Q.data.values()].map((V,J)=>Y._parse(new m(Q,V,Q.path,J)));if(Q.common.async)return Promise.all(B).then((V)=>q(V));else return q(B)}min($,_){return new _$({...this._def,minSize:{value:$,message:D.toString(_)}})}max($,_){return new _$({...this._def,maxSize:{value:$,message:D.toString(_)}})}size($,_){return this.min($,_).max($,_)}nonempty($){return this.min(1,$)}}_$.create=($,_)=>{return new _$({valueType:$,minSize:null,maxSize:null,typeName:A.ZodSet,...M(_)})};class B$ extends k{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:_}=this._processInputParams($);if(_.parsedType!==K.function)return j(_,{code:O.invalid_type,expected:K.function,received:_.parsedType}),G;function Q(B,V){return F$({data:B,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,H$(),c].filter((J)=>!!J),issueData:{code:O.invalid_arguments,argumentsError:V}})}function H(B,V){return F$({data:B,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,H$(),c].filter((J)=>!!J),issueData:{code:O.invalid_return_type,returnTypeError:V}})}let Y={errorMap:_.common.contextualErrorMap},q=_.data;if(this._def.returns instanceof Q$){let B=this;return b(async function(...V){let J=new z([]),N=await B._def.args.parseAsync(V,Y).catch((p$)=>{throw J.addIssue(Q(V,p$)),J}),I=await Reflect.apply(q,this,N);return await B._def.returns._def.type.parseAsync(I,Y).catch((p$)=>{throw J.addIssue(H(I,p$)),J})})}else{let B=this;return b(function(...V){let J=B._def.args.safeParse(V,Y);if(!J.success)throw new z([Q(V,J.error)]);let N=Reflect.apply(q,this,J.data),I=B._def.returns.safeParse(N,Y);if(!I.success)throw new z([H(N,I.error)]);return I.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new B$({...this._def,args:d.create($).rest(r.create())})}returns($){return new B$({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,_,Q){return new B$({args:$?$:d.create([]).rest(r.create()),returns:_||r.create(),typeName:A.ZodFunction,...M(Q)})}}class L$ extends k{get schema(){return this._def.getter()}_parse($){let{ctx:_}=this._processInputParams($);return this._def.getter()._parse({data:_.data,path:_.path,parent:_})}}L$.create=($,_)=>{return new L$({getter:$,typeName:A.ZodLazy,...M(_)})};class D$ extends k{_parse($){if($.data!==this._def.value){let _=this._getOrReturnCtx($);return j(_,{received:_.data,code:O.invalid_literal,expected:this._def.value}),G}return{status:"valid",value:$.data}}get value(){return this._def.value}}D$.create=($,_)=>{return new D$({value:$,typeName:A.ZodLiteral,...M(_)})};function M0($,_){return new t({values:$,typeName:A.ZodEnum,...M(_)})}class t extends k{_parse($){if(typeof $.data!=="string"){let _=this._getOrReturnCtx($),Q=this._def.values;return j(_,{expected:E.joinValues(Q),received:_.parsedType,code:O.invalid_type}),G}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let _=this._getOrReturnCtx($),Q=this._def.values;return j(_,{received:_.data,code:O.invalid_enum_value,options:Q}),G}return b($.data)}get options(){return this._def.values}get enum(){let $={};for(let _ of this._def.values)$[_]=_;return $}get Values(){let $={};for(let _ of this._def.values)$[_]=_;return $}get Enum(){let $={};for(let _ of this._def.values)$[_]=_;return $}extract($,_=this._def){return t.create($,{...this._def,..._})}exclude($,_=this._def){return t.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,..._})}}t.create=M0;class N$ extends k{_parse($){let _=E.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==K.string&&Q.parsedType!==K.number){let H=E.objectValues(_);return j(Q,{expected:E.joinValues(H),received:Q.parsedType,code:O.invalid_type}),G}if(!this._cache)this._cache=new Set(E.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let H=E.objectValues(_);return j(Q,{received:Q.data,code:O.invalid_enum_value,options:H}),G}return b($.data)}get enum(){return this._def.values}}N$.create=($,_)=>{return new N$({values:$,typeName:A.ZodNativeEnum,...M(_)})};class Q$ extends k{unwrap(){return this._def.type}_parse($){let{ctx:_}=this._processInputParams($);if(_.parsedType!==K.promise&&_.common.async===!1)return j(_,{code:O.invalid_type,expected:K.promise,received:_.parsedType}),G;let Q=_.parsedType===K.promise?_.data:Promise.resolve(_.data);return b(Q.then((H)=>{return this._def.type.parseAsync(H,{path:_.path,errorMap:_.common.contextualErrorMap})}))}}Q$.create=($,_)=>{return new Q$({type:$,typeName:A.ZodPromise,...M(_)})};class u extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:_,ctx:Q}=this._processInputParams($),H=this._def.effect||null,Y={addIssue:(q)=>{if(j(Q,q),q.fatal)_.abort();else _.dirty()},get path(){return Q.path}};if(Y.addIssue=Y.addIssue.bind(Y),H.type==="preprocess"){let q=H.transform(Q.data,Y);if(Q.common.async)return Promise.resolve(q).then(async(B)=>{if(_.value==="aborted")return G;let V=await this._def.schema._parseAsync({data:B,path:Q.path,parent:Q});if(V.status==="aborted")return G;if(V.status==="dirty")return e(V.value);if(_.value==="dirty")return e(V.value);return V});else{if(_.value==="aborted")return G;let B=this._def.schema._parseSync({data:q,path:Q.path,parent:Q});if(B.status==="aborted")return G;if(B.status==="dirty")return e(B.value);if(_.value==="dirty")return e(B.value);return B}}if(H.type==="refinement"){let q=(B)=>{let V=H.refinement(B,Y);if(Q.common.async)return Promise.resolve(V);if(V instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return B};if(Q.common.async===!1){let B=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(B.status==="aborted")return G;if(B.status==="dirty")_.dirty();return q(B.value),{status:_.value,value:B.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((B)=>{if(B.status==="aborted")return G;if(B.status==="dirty")_.dirty();return q(B.value).then(()=>{return{status:_.value,value:B.value}})})}if(H.type==="transform")if(Q.common.async===!1){let q=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!o(q))return G;let B=H.transform(q.value,Y);if(B instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:_.value,value:B}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((q)=>{if(!o(q))return G;return Promise.resolve(H.transform(q.value,Y)).then((B)=>({status:_.value,value:B}))});E.assertNever(H)}}u.create=($,_,Q)=>{return new u({schema:$,typeName:A.ZodEffects,effect:_,...M(Q)})};u.createWithPreprocess=($,_,Q)=>{return new u({schema:_,effect:{type:"preprocess",transform:$},typeName:A.ZodEffects,...M(Q)})};class g extends k{_parse($){if(this._getType($)===K.undefined)return b(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}g.create=($,_)=>{return new g({innerType:$,typeName:A.ZodOptional,...M(_)})};class n extends k{_parse($){if(this._getType($)===K.null)return b(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}n.create=($,_)=>{return new n({innerType:$,typeName:A.ZodNullable,...M(_)})};class G$ extends k{_parse($){let{ctx:_}=this._processInputParams($),Q=_.data;if(_.parsedType===K.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:_.path,parent:_})}removeDefault(){return this._def.innerType}}G$.create=($,_)=>{return new G$({innerType:$,typeName:A.ZodDefault,defaultValue:typeof _.default==="function"?_.default:()=>_.default,...M(_)})};class A$ extends k{_parse($){let{ctx:_}=this._processInputParams($),Q={..._,common:{..._.common,issues:[]}},H=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(W$(H))return H.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new z(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:H.status==="valid"?H.value:this._def.catchValue({get error(){return new z(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}A$.create=($,_)=>{return new A$({innerType:$,typeName:A.ZodCatch,catchValue:typeof _.catch==="function"?_.catch:()=>_.catch,...M(_)})};class I$ extends k{_parse($){if(this._getType($)!==K.nan){let Q=this._getOrReturnCtx($);return j(Q,{code:O.invalid_type,expected:K.nan,received:Q.parsedType}),G}return{status:"valid",value:$.data}}}I$.create=($)=>{return new I$({typeName:A.ZodNaN,...M($)})};var T1=Symbol("zod_brand");class y$ extends k{_parse($){let{ctx:_}=this._processInputParams($),Q=_.data;return this._def.type._parse({data:Q,path:_.path,parent:_})}unwrap(){return this._def.type}}class f$ extends k{_parse($){let{status:_,ctx:Q}=this._processInputParams($);if(Q.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(Y.status==="aborted")return G;if(Y.status==="dirty")return _.dirty(),e(Y.value);else return this._def.out._parseAsync({data:Y.value,path:Q.path,parent:Q})})();else{let H=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(H.status==="aborted")return G;if(H.status==="dirty")return _.dirty(),{status:"dirty",value:H.value};else return this._def.out._parseSync({data:H.value,path:Q.path,parent:Q})}}static create($,_){return new f$({in:$,out:_,typeName:A.ZodPipeline})}}class w$ extends k{_parse($){let _=this._def.innerType._parse($),Q=(H)=>{if(o(H))H.value=Object.freeze(H.value);return H};return W$(_)?_.then((H)=>Q(H)):Q(_)}unwrap(){return this._def.innerType}}w$.create=($,_)=>{return new w$({innerType:$,typeName:A.ZodReadonly,...M(_)})};function N0($,_){let Q=typeof $==="function"?$(_):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function k0($,_={},Q){if($)return X$.create().superRefine((H,Y)=>{let q=$(H);if(q instanceof Promise)return q.then((B)=>{if(!B){let V=N0(_,H),J=V.fatal??Q??!0;Y.addIssue({code:"custom",...V,fatal:J})}});if(!q){let B=N0(_,H),V=B.fatal??Q??!0;Y.addIssue({code:"custom",...B,fatal:V})}return});return X$.create()}var h1={object:S.lazycreate},A;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(A||(A={}));var x1=($,_={message:`Input not instance of ${$.name}`})=>k0((Q)=>Q instanceof $,_),F0=h.create,v0=s.create,g1=I$.create,m1=a.create,E0=V$.create,u1=$$.create,l1=v$.create,p1=O$.create,d1=J$.create,c1=X$.create,i1=r.create,n1=p.create,o1=E$.create,r1=x.create,s1=S.create,a1=S.strictCreate,t1=K$.create,e1=z$.create,$X=j$.create,XX=d.create,_X=P$.create,QX=S$.create,YX=_$.create,HX=B$.create,WX=L$.create,qX=D$.create,BX=t.create,VX=N$.create,OX=Q$.create,JX=u.create,KX=g.create,jX=n.create,LX=u.createWithPreprocess,DX=f$.create,NX=()=>F0().optional(),GX=()=>v0().optional(),AX=()=>E0().optional(),wX={string:($)=>h.create({...$,coerce:!0}),number:($)=>s.create({...$,coerce:!0}),boolean:($)=>V$.create({...$,coerce:!0}),bigint:($)=>a.create({...$,coerce:!0}),date:($)=>$$.create({...$,coerce:!0})};var MX=G;var P0=X;var v=P0;var kX=["page_view","page_visibility","page_exit","page_load","core_web_vitals","form_submit","input_fill","input_select","input_radio","input_checkbox","input_range","click","scroll","video_play","video_pause","video_complete","user_active","user_inactive","purchase","error"],FX=X.enum(kX),T$=X.string().or(FX),vX=["api","ga","stripe"],EX=X.enum(vX),S0=X.object({event_id:X.string().uuid().optional(),event_name:T$,org_id:X.string(),app_id:X.string(),session_id:X.string().uuid(),user_id:X.string().optional(),server_key:X.string().optional().nullable(),data_source:EX.default("api"),properties:X.record(X.string(),X.any()),url:X.string().url().optional(),referrer:X.string().optional(),title:X.string().optional(),price:X.number().optional(),amount:X.number().optional(),currency:X.string().optional(),user_agent:X.string(),device_type:X.string(),browser:X.string(),os:X.string(),screen_width:X.number().int().optional(),screen_height:X.number().int().optional(),language:X.string().optional(),timestamp:X.string(),city:X.string().optional(),continent:X.string().optional(),country:X.string().optional(),latitude:X.number().optional(),longitude:X.number().optional(),postal_code:X.string().optional(),region:X.string().optional(),region_code:X.string().optional(),timezone:X.string().optional(),ip:X.string().optional(),error_message:X.string().optional(),error_details:X.string().optional(),error_source:X.string().optional(),error_filename:X.string().optional(),error_lineno:X.number().int().optional(),error_colno:X.number().int().optional()}),PX=X.object({name:T$,amount:X.number().optional(),currency:X.string().optional(),price:X.number().optional(),properties:X.record(X.any()).optional(),url:X.string().url().optional(),referrer:X.string().optional(),title:X.string().optional(),stack:X.string().optional(),source:X.string().optional(),lineno:X.number().int().optional(),colno:X.number().int().optional(),filename:X.string().optional(),message:X.string().optional(),additional:X.record(X.any()).optional(),context:X.record(X.any()).optional(),timestamp:X.string()}),I0=X.object({userAgent:X.string(),screenWidth:X.number().int().optional(),screenHeight:X.number().int().optional(),language:X.string().optional(),timezone:X.string().optional(),events:X.array(PX),location:X.object({city:X.string().optional(),continent:X.string().optional(),country:X.string().optional(),latitude:X.union([X.number(),X.string()]).optional(),longitude:X.union([X.number(),X.string()]).optional(),postalCode:X.string().optional(),region:X.string().optional(),regionCode:X.string().optional(),timezone:X.string().optional(),ip:X.string().optional()}).nullable().optional()});var o$=X.object({_id:X.string(),orgId:X.string(),userId:X.string(),role:X.enum(["owner","admin","member","viewer"]),createdAt:X.date()}),h$=X.array(o$);var r$=X.object({_id:X.string(),name:X.string(),slug:X.string(),onboarded:X.record(X.string(),X.boolean()),createdAt:X.date()}),x$=X.array(r$);var s$=X.object({id:X.string(),name:X.string(),email:X.string().email(),image:X.string().url(),emailVerified:X.boolean(),createdAt:X.date(),updatedAt:X.date(),role:X.enum(["user","admin"]).default("user"),city:X.string().optional(),country:X.string().optional(),regionCode:X.string().optional(),zip:X.string().optional(),userAgent:X.string().optional(),ip:X.string().optional(),fbClickId:X.string().optional(),fbBrowserId:X.string().optional(),stripeCustomerId:X.string().optional(),sid:X.string().optional()}),g8=X.object({createdAt:X.date(),expiresAt:X.date(),id:X.string(),ipAddress:X.string(),token:X.string(),updatedAt:X.date(),userAgent:X.string(),userId:X.string()}),f0=X.array(s$);var Z0=X.object({organizations:x$,members:h$});var SX=X.object({input:X.number().positive().describe("Cost per million input tokens"),output:X.number().positive().describe("Cost per million output tokens")}),IX=X.enum(["anthropic","openai"]),fX=X.enum(["basic","standard","complex"]),ZX=X.object({order:X.number().int().positive().describe("Model priority order"),provider:IX,name:X.string().min(1).describe("Model name identifier"),complexity:fX,cost:SX,description:X.string().optional().describe("Model description"),tools:X.array(X.string()).optional().describe("Model tools")}),i8=X.array(ZX);var UX=X.object({id:X.string(),_id:X.string(),name:X.string(),start:X.string().optional(),prefix:X.string().optional(),enabled:X.boolean().default(!0),createdAt:X.string(),updatedAt:X.string(),expiresAt:X.string().nullable(),lastRequest:X.string().nullable(),lastRefillAt:X.string().nullable(),key:X.string().optional(),userId:X.string(),metadata:X.record(X.any()),permissions:X.record(X.array(X.string())),rateLimitEnabled:X.boolean(),rateLimitMax:X.number(),rateLimitTimeWindow:X.number(),refillAmount:X.number().nullable(),refillInterval:X.number().nullable(),remaining:X.number().nullable(),requestCount:X.number()}),r8=X.object({name:X.string()}),s8=X.object({keyId:X.string(),name:X.string().optional(),enabled:X.boolean().optional()}),a8=X.object({keyId:X.string()}),t8=UX.pick({id:!0,name:!0,key:!0,start:!0,prefix:!0,enabled:!0,createdAt:!0,updatedAt:!0});var a$=X.object({_id:X.string(),name:X.string().min(1,"Name is required"),url:X.string().url("Please provide a valid URL"),orgId:X.string(),createdAt:X.date(),updatedAt:X.date(),currencyCode:X.string().length(3).optional(),conversionPrice:X.number().positive().optional(),lastImportSummary:X.string().optional()}),X_=a$.omit({_id:!0,createdAt:!0,updatedAt:!0}),__=X.object({orgId:X.string(),name:X.string().min(1,"Name is required"),url:X.string().url("Please provide a valid URL"),currencyCode:X.string().length(3).optional(),conversionPrice:X.number().positive().optional()}),Q_=a$.omit({_id:!0,orgId:!0,createdAt:!0,updatedAt:!0}),Y_=a$.omit({_id:!0,orgId:!0,createdAt:!0,updatedAt:!0}),H_=X.object({hasActiveIntegrations:X.boolean(),hasEvents:X.boolean(),integrations:X.object({googleAnalytics:X.boolean(),stripe:X.boolean()}),totalEvents:X.number()});var CX=X.object({provider:X.enum(["openai","anthropic"]),name:X.string(),type:X.enum(["fast","smart"]),inputTokens:X.number(),outputTokens:X.number(),totalTokens:X.number(),totalDuration:X.number(),thinkingDuration:X.number(),inputCost:X.number(),outputCost:X.number(),totalCost:X.number()}),t$=X.object({_id:X.string(),chatId:X.string(),orgId:X.string(),appId:X.string(),userId:X.string(),content:X.string(),role:X.enum(["user","assistant"]),model:CX.optional(),replyToMessageId:X.string().optional(),createdAt:X.date(),updatedAt:X.date()}),B_=t$.omit({_id:!0,orgId:!0,appId:!0,userId:!0,createdAt:!0,updatedAt:!0}).extend({modelName:X.string().optional(),segmentId:X.string().optional()}),V_=t$.pick({content:!0,role:!0,chatId:!0,orgId:!0,appId:!0,userId:!0,model:!0,replyToMessageId:!0}),O_=t$.extend({type:X.enum(["text","image","error"])});var j_=X.object({_id:X.string(),orgId:X.string(),appId:X.string(),chatId:X.string(),userId:X.string(),messageId:X.string(),vote:X.enum(["up","down"]),reason:X.string().optional(),createdAt:X.date(),updatedAt:X.date()});var bX=X.object({name:X.string(),type:X.string(),defaultType:X.string().optional(),defaultExpression:X.string().optional(),comment:X.string().optional()}),RX=X.object({name:X.string(),database:X.string(),engine:X.string(),columns:X.array(bX)}),N_=X.array(RX);var w_=v.object({activeUsers:v.number(),pageViews:v.number(),revenue:v.number(),sessions:v.number(),totalEvents:v.number()}),M_=v.object({revenue:v.number().default(0),pageViews:v.number().default(0),totalEvents:v.number().default(0),activeUsers:v.number().default(0),conversions:v.number().optional(),conversionRate:v.number().optional(),sessions:v.number().optional(),eventsImported:v.number().optional(),avgSessionDuration:v.number().optional(),bounceRate:v.number().optional(),newUsers:v.number().optional(),returningUsers:v.number().optional(),topTrafficSource:v.string().optional(),avgOrderValue:v.number().optional(),topConvertingPage:v.string().optional()}),k_=v.object({period:v.enum(["today","last_7_days","last_30_days","last_3_months"]).default("last_30_days"),timezone:v.string().default("UTC")}),F_=v.object({appId:v.string(),name:v.string(),domain:v.string(),visitors:v.number(),pageviews:v.number(),revenue:v.number(),conversionRate:v.number(),bounceRate:v.number(),visitorData:v.array(v.object({visitors:v.number()}))});var zX=X.object({integrationId:X.string(),orgId:X.string(),appId:X.string(),displayName:X.string(),jobType:X.literal("coordinator"),totalPages:X.number().optional(),pageSize:X.number().default(1000),dateRange:X.object({startDate:X.string(),endDate:X.string()}).optional()}),yX=X.object({integrationId:X.string(),orgId:X.string(),appId:X.string(),displayName:X.string(),jobType:X.literal("ingestion"),page:X.number(),pageSize:X.number(),totalPages:X.number(),coordinatorJobId:X.string(),dateRange:X.object({startDate:X.string(),endDate:X.string()}),offset:X.number(),limit:X.number()}),TX=X.object({propertyId:X.string(),displayName:X.string(),name:X.string(),parent:X.string(),websiteUrl:X.string().optional(),timeZone:X.string().optional(),createTime:X.string().optional(),updateTime:X.string().optional()}),hX=X.object({accountId:X.string(),displayName:X.string(),name:X.string(),createTime:X.string().optional(),updateTime:X.string().optional(),regionCode:X.string().optional()}),C0=X.object({_id:X.string(),appId:X.string(),orgId:X.string(),propertyId:X.string(),accountId:X.string(),displayName:X.string(),timeZone:X.string().optional().default("America/New_York"),importPurchaseEvents:X.boolean().default(!1),conversionPrice:X.number().positive().optional(),conversionCurrency:X.string().length(3).optional(),useSmartPurchaseDetection:X.boolean().optional(),isActive:X.boolean().default(!0),lastImportStartDate:X.string().optional(),lastImportEndDate:X.string().optional(),isImporting:X.boolean().default(!1),createdAt:X.date(),updatedAt:X.date()}),P_=X.object({appName:X.string().min(1,"App name is required"),appUrl:X.string().min(1,"App URL is required"),propertyId:X.string().min(1,"Property ID is required"),accountId:X.string().min(1,"Account ID is required"),displayName:X.string().min(1,"Display name is required"),timeZone:X.string().min(1,"Time zone is required").optional(),importPurchaseEvents:X.boolean().default(!1),conversionPrice:X.number().positive().optional(),conversionCurrency:X.string().length(3).optional(),useSmartPurchaseDetection:X.boolean().optional()}),S_=C0.omit({_id:!0,createdAt:!0,updatedAt:!0}).partial({lastImportStartDate:!0,lastImportEndDate:!0,isImporting:!0}),I_=C0.omit({_id:!0,appId:!0,orgId:!0,createdAt:!0,updatedAt:!0}).partial(),xX=TX.extend({account:hX}),f_=X.object({properties:X.array(xX),accountId:X.string()}),Z_=X.object({sessionId:X.string(),userId:X.string(),orgId:X.string(),propertyId:X.string(),appId:X.string().optional(),status:X.enum(["pending","in_progress","completed","failed"]),error:X.string().optional(),summary:X.object({activeUsers:X.number(),pageViews:X.number(),sessions:X.number(),eventsImported:X.number(),revenue:X.number(),conversions:X.number(),avgSessionDuration:X.number(),bounceRate:X.number(),newUsers:X.number(),returningUsers:X.number(),topTrafficSource:X.string(),conversionRate:X.number(),avgOrderValue:X.number(),topConvertingPage:X.string()}).optional(),createdAt:X.date(),updatedAt:X.date()}),gX=X.enum(["coordinator","ingestion"]),b0=X.enum(["waiting","active","completed","failed","delayed","paused"]),U_=X.discriminatedUnion("jobType",[zX,yX]),mX=X.object({jobId:X.string(),integrationId:X.string(),jobType:gX,status:b0,progress:X.object({current:X.number(),total:X.number(),percentage:X.number()}),data:X.object({eventsImported:X.number(),page:X.number().optional(),totalPages:X.number().optional(),coordinatorJobId:X.string().optional(),startTime:X.date().optional(),endTime:X.date().optional(),error:X.string().optional()}),createdAt:X.date(),updatedAt:X.date()}),C_=X.object({integrationId:X.string(),status:X.enum(["not_started","in_progress","completed","failed","partial"]),progress:X.object({totalJobs:X.number(),completedJobs:X.number(),failedJobs:X.number(),pendingJobs:X.number(),percentage:X.number()}),coordinator:X.object({jobId:X.string(),status:b0,progress:X.object({current:X.number(),total:X.number(),percentage:X.number()}),phase:X.enum(["creating_jobs","monitoring_ingestion","completed","waiting","active","failed","delayed","paused"]),createdAt:X.date(),updatedAt:X.date()}).nullable(),summary:X.object({totalEventsImported:X.number(),startTime:X.date().optional(),estimatedEndTime:X.date().optional(),lastUpdated:X.date()}),jobs:X.array(mX)}),b_=X.object({gaEventName:X.string(),userpathEventName:X.string(),description:X.string(),requiresEcommerce:X.boolean().default(!1),propertyMappings:X.record(X.string()).optional()}),R_=X.object({activeUsers:X.number(),pageViews:X.number(),sessions:X.number(),bounceRate:X.number(),usersByCountry:X.array(X.object({country:X.string(),users:X.number()})),topPages:X.array(X.object({page:X.string(),views:X.number()})),trafficSources:X.array(X.object({source:X.string(),users:X.number()})),deviceTypes:X.array(X.object({device:X.string(),users:X.number()})),dailyMetrics:X.array(X.object({date:X.string(),users:X.number(),sessions:X.number()})),conversions:X.array(X.object({event:X.string(),count:X.number()}))});var pX;((U0)=>{let $;((uX)=>{let Q;((I)=>{I.MATCH_TYPE_UNSPECIFIED="MATCH_TYPE_UNSPECIFIED";I.EXACT="EXACT";I.BEGINS_WITH="BEGINS_WITH";I.ENDS_WITH="ENDS_WITH";I.CONTAINS="CONTAINS";I.FULL_REGEXP="FULL_REGEXP";I.PARTIAL_REGEXP="PARTIAL_REGEXP"})(Q=uX.MatchType||={})})($=U0.StringFilter||={});let _;((lX)=>{let Q;((N)=>{N.OPERATION_UNSPECIFIED="OPERATION_UNSPECIFIED";N.EQUAL="EQUAL";N.LESS_THAN="LESS_THAN";N.LESS_THAN_OR_EQUAL="LESS_THAN_OR_EQUAL";N.GREATER_THAN="GREATER_THAN";N.GREATER_THAN_OR_EQUAL="GREATER_THAN_OR_EQUAL"})(Q=lX.Operation||={})})(_=U0.NumericFilter||={})})(pX||={});var iX;((cX)=>{let $;((dX)=>{let _;((B)=>{B.ORDER_TYPE_UNSPECIFIED="ORDER_TYPE_UNSPECIFIED";B.ALPHANUMERIC="ALPHANUMERIC";B.CASE_INSENSITIVE_ALPHANUMERIC="CASE_INSENSITIVE_ALPHANUMERIC";B.NUMERIC="NUMERIC"})(_=dX.OrderType||={})})($=cX.DimensionOrderBy||={})})(iX||={});var oX;((nX)=>{let $;((q)=>{q.GRANULARITY_UNSPECIFIED="GRANULARITY_UNSPECIFIED";q.DAILY="DAILY";q.WEEKLY="WEEKLY";q.MONTHLY="MONTHLY"})($=nX.Granularity||={})})(oX||={});var T_=X.object({goalId:X.string(),goalName:X.string(),eventNames:X.array(X.string()),period:X.string(),metrics:X.object({totalConversions:X.number(),uniqueSessions:X.number(),uniqueUsers:X.number(),conversionRate:X.number(),totalRevenue:X.number(),averageOrderValue:X.number(),revenuePerVisitor:X.number()}),timeSeries:X.array(X.object({date:X.string(),conversions:X.number(),sessions:X.number(),conversionRate:X.number(),revenue:X.number()})),topEvents:X.array(X.object({eventName:X.string(),conversions:X.number(),conversionRate:X.number(),revenue:X.number()})),trend:X.object({change:X.number(),direction:X.enum(["up","down","stable"])})}),h_=X.object({goalId:X.string(),goalName:X.string(),period:X.string(),funnelSteps:X.array(X.object({step:X.string(),stepNumber:X.number(),sessions:X.number(),conversionRate:X.number(),dropOffRate:X.number()})),totalSessions:X.number(),totalConversions:X.number(),overallConversionRate:X.number()}),x_=X.object({goalId:X.string(),goalName:X.string(),period:X.string(),totalRevenue:X.number(),totalConversions:X.number(),averageOrderValue:X.number(),revenuePerVisitor:X.number(),revenueByEvent:X.array(X.object({eventName:X.string(),revenue:X.number(),conversions:X.number(),averageOrderValue:X.number(),percentage:X.number()})),revenueTimeSeries:X.array(X.object({date:X.string(),revenue:X.number(),conversions:X.number(),averageOrderValue:X.number()}))}),g_=X.object({period:X.string(),totalGoals:X.number(),goals:X.array(X.object({goalId:X.string(),goalName:X.string(),eventNames:X.array(X.string()),conversions:X.number(),conversionRate:X.number(),revenue:X.number(),averageOrderValue:X.number(),revenuePerVisitor:X.number(),trend:X.object({change:X.number(),direction:X.enum(["up","down","stable"])})})),aggregated:X.object({totalConversions:X.number(),totalRevenue:X.number(),avgConversionRate:X.number(),avgRevenuePerVisitor:X.number()})}),m_=X.object({period:X.string(),totalGoals:X.number(),goalsNeedingAttention:X.array(X.object({goalId:X.string(),goalName:X.string(),eventNames:X.array(X.string()),issueType:X.enum(["no_conversions","low_conversion_rate","low_activity","no_data"]),issueDescription:X.string(),metrics:X.object({conversions:X.number(),conversionRate:X.number(),sessions:X.number(),revenue:X.number()}),recommendations:X.array(X.string()),severity:X.enum(["critical","warning","info"])})),trafficAnalysis:X.object({totalSessions:X.number(),sessionsWithGoalEvents:X.number(),goalEventCoverage:X.number(),commonIssues:X.array(X.object({issue:X.string(),description:X.string(),affectedGoals:X.number(),recommendation:X.string()}))}),implementationHealth:X.object({eventTrackingStatus:X.array(X.object({eventName:X.string(),isActive:X.boolean(),lastSeen:X.string().optional(),frequency:X.number()})),dataQualityIssues:X.array(X.object({issue:X.string(),description:X.string(),severity:X.enum(["critical","warning","info"]),affectedGoals:X.array(X.string())}))})});var rX=($)=>{if(!$||$.trim()==="")throw new Error("Regex pattern cannot be empty");let _=[/\(\?\#.*?\)/,/\(\?\{.*?\}\)/,/\(\?\<.*?\>.*?\)/,/\\[kKgG]/,/\(\?\<=/,/\(\?\<!/];for(let H of _)if(H.test($))throw new Error("Regex pattern contains features not supported by RE2 (ClickHouse)");if($.length>500)throw new Error("Regex pattern is too long (max 500 characters)");if(($.match(/[*+?{]/g)||[]).length>20)throw new Error("Regex pattern has too many quantifiers (potential performance issue)");try{return new RegExp($),!0}catch(H){throw new Error(`Invalid regex pattern: ${H instanceof Error?H.message:"Unknown error"}`)}},sX=($,_)=>{if(["gt","gte","lt","lte"].includes(_)){if(!$.includes(":"))throw new Error(`Properties field with '${_}' operator requires 'key:value' format`);let[Q,H]=$.split(":",2);if(!Q||!H)throw new Error("Property key:value format requires both key and value parts");if(isNaN(parseFloat(H)))throw new Error(`Property value '${H}' must be numeric for '${_}' operator`)}if(_==="equals"&&$.includes(":")){let[Q,H]=$.split(":",2);if(!Q||H===void 0)throw new Error("Property key:value format requires both key and value parts")}return!0},Y$=($)=>{return $.replace(/['"]/g,"").replace(/[;]/g,"").replace(/--/g,"").trim()},aX=X.object({key:X.string().min(1,"Property key cannot be empty"),operator:X.enum(["equals","gt","gte","lt","lte"]),value:X.string().min(1,"Property value cannot be empty")}),R0=X.object({field:X.enum(["url","properties","country","device_type","browser"]),operator:X.enum(["equals","contains","starts_with","ends_with","regex","gt","gte","lt","lte","in","not_in","multi_property"]),value:X.union([X.string().min(1,"Condition value cannot be empty").transform(Y$),X.number(),X.array(X.string().min(1,"Array items cannot be empty")).min(1,"Array cannot be empty for in/not_in operators").max(100,"Array cannot have more than 100 items (performance limit)"),X.array(aX).min(1,"Multi-property rules cannot be empty").max(10,"Cannot have more than 10 property rules (performance limit)")]),eventIndex:X.number().int().min(0,"Event index must be non-negative").optional()}).superRefine(($,_)=>{if($.operator==="regex"&&typeof $.value==="string")try{rX($.value)}catch(Q){_.addIssue({code:X.ZodIssueCode.custom,message:Q instanceof Error?Q.message:"Invalid regex pattern",path:["value"]})}if($.field==="properties"&&typeof $.value==="string"&&["gt","gte","lt","lte","equals"].includes($.operator))try{sX($.value,$.operator)}catch(Q){_.addIssue({code:X.ZodIssueCode.custom,message:Q instanceof Error?Q.message:"Invalid property format",path:["value"]})}if(["in","not_in"].includes($.operator)&&!Array.isArray($.value))_.addIssue({code:X.ZodIssueCode.custom,message:"Value for in/not_in operators must be an array",path:["value"]});if($.operator==="multi_property"&&!Array.isArray($.value))_.addIssue({code:X.ZodIssueCode.custom,message:"Value for multi_property operator must be an array of PropertyRule objects",path:["value"]})}),z0=X.object({timeWindow:X.enum(["1_hour","24_hours","7_days","30_days"]).default("24_hours"),allowRepeatedSteps:X.boolean().default(!1),maxStepInterval:X.number().int("Max step interval must be an integer").min(1,"Max step interval must be at least 1 second").max(604800,"Max step interval cannot exceed 7 days (604800 seconds)").default(3600)}),tX=X.object({_id:X.string(),name:X.string().min(1,"Goal name is required").max(100,"Goal name cannot exceed 100 characters").transform(Y$),description:X.string().max(500,"Description cannot exceed 500 characters").transform(Y$).optional(),orgId:X.string().min(1,"Organization ID is required"),appId:X.string().min(1,"App ID is required"),eventNames:X.array(X.string().min(1,"Event name cannot be empty").max(50,"Event name cannot exceed 50 characters").transform(Y$)).min(1,"At least one event name is required").max(10,"Cannot have more than 10 events in a funnel (performance limit)"),createdAt:X.date(),updatedAt:X.date()}),p_=tX.extend({conditions:X.array(R0).max(20,"Cannot have more than 20 conditions (performance limit)").optional(),funnelSettings:z0.optional()}).superRefine(($,_)=>{if($.funnelSettings&&$.eventNames.length<=1)_.addIssue({code:X.ZodIssueCode.custom,message:"Funnel settings can only be applied to multi-step goals (2+ events)",path:["funnelSettings"]});if($.conditions)for(let Q=0;Q<$.conditions.length;Q++){let H=$.conditions[Q];if(H.eventIndex!==void 0&&(H.eventIndex<0||H.eventIndex>=$.eventNames.length))_.addIssue({code:X.ZodIssueCode.custom,message:`Event index ${H.eventIndex} is out of bounds. Must be between 0 and ${$.eventNames.length-1}`,path:["conditions",Q,"eventIndex"]})}}),g$=X.object({_id:X.string(),name:X.string().min(1,"Goal name is required").max(100,"Goal name cannot exceed 100 characters").transform(Y$),description:X.string().max(500,"Description cannot exceed 500 characters").transform(Y$).optional(),orgId:X.string().min(1,"Organization ID is required"),appId:X.string().min(1,"App ID is required"),eventNames:X.array(X.string().min(1,"Event name cannot be empty").max(50,"Event name cannot exceed 50 characters").transform(Y$)).min(1,"At least one event name is required").max(10,"Cannot have more than 10 events in a funnel (performance limit)"),createdAt:X.date(),updatedAt:X.date()}),e$=g$.extend({conditions:X.array(R0).max(20,"Cannot have more than 20 conditions (performance limit)").optional(),funnelSettings:z0.optional()}),d_=g$.omit({_id:!0,createdAt:!0,updatedAt:!0}),c_=e$.omit({_id:!0,createdAt:!0,updatedAt:!0}),i_=g$.omit({_id:!0,orgId:!0,createdAt:!0,updatedAt:!0}),n_=e$.omit({_id:!0,orgId:!0,createdAt:!0,updatedAt:!0}),o_=g$.omit({_id:!0,orgId:!0,appId:!0,createdAt:!0,updatedAt:!0}).partial(),r_=e$.omit({_id:!0,orgId:!0,appId:!0,createdAt:!0,updatedAt:!0}).partial();var y0=X.enum(["page_view","page_visibility","page_exit","form_submit","input_fill","input_select","input_radio","input_checkbox","input_range","click","scroll","video_play","video_pause","video_complete","user_active","user_inactive","purchase","error","identity","default"]),eX=X.object({event_name:T$,event_icon:y0.default("default"),description:X.string(),details:X.string().optional(),timestamp:X.string(),url:X.string(),referrer:X.string(),properties:X.string().optional(),timeSinceLastEvent:X.string().nullable().optional(),country:X.string().optional(),city:X.string().optional()}),$6=X.object({journeyId:X.string().uuid(),userId:X.string().uuid(),userEmail:X.string().email().optional(),userName:X.string().optional(),firstTouch:X.string(),lastTouch:X.string(),daysToConversion:X.number().int(),conversionRevenue:X.number(),isConverted:X.boolean(),referrerPath:X.string(),urlPath:X.string(),events:X.array(eX),totalDuration:X.string().optional(),lastSeen:X.string().optional()}),X6=X.object({index:X.number().int(),event_icon:y0.default("default"),description:X.string(),details:X.string().optional(),timestamp:X.string().nullable(),timeSinceLastEvent:X.string().nullable().optional(),url:X.string().optional()}),e_=X.object({success:X.boolean(),error:X.string().optional(),journey:$6.optional(),simplifiedJourney:X.array(X6).optional()});var _6=X.object({name:X.literal("clickhouse-run-query"),arguments:X.object({query:X.string().describe("SQL query to execute")})}).describe("Execute a SQL query on ClickHouse"),Q6=X.object({name:X.literal("clickhouse-list-tables"),arguments:X.object({database:X.string().optional()})}).describe("List all tables in ClickHouse"),Y6=X.object({name:X.literal("clickhouse-describe-table"),arguments:X.object({table_name:X.string(),database:X.string().optional()})}).describe("Get schema information for a table"),H6=X.object({name:X.literal("clickhouse-list-databases"),arguments:X.object({})}).describe("List all databases in ClickHouse"),W6=X.object({name:X.literal("clickhouse-describe-database"),arguments:X.object({database_name:X.string()})}).describe("Get schema information for a database"),q6=X.object({name:X.literal("clickhouse-list-columns"),arguments:X.object({table_name:X.string(),database:X.string().optional()})}).describe("List all columns in a table"),B6=X.object({name:X.literal("plot-chart"),arguments:X.object({chartType:X.enum(["bar","line","pie","scatter","area"]).describe("Type of chart to plot"),data:X.string().describe("JSON string containing the chart data in the needed format for Recharts to render the chart."),title:X.string().optional().describe("Chart title"),xAxis:X.string().optional().describe("X-axis field name (for applicable chart types)"),yAxis:X.string().optional().describe("Y-axis field name (for applicable chart types)"),options:X.string().optional().describe("Additional chart options as JSON string")})}).describe("Generate interactive React charts using the npm library recharts 2.x"),V6=X.object({name:X.literal("get-sitemap"),arguments:X.object({appId:X.string().describe("The app ID to get the sitemap for")})}).describe("Get the sitemap and useful stats for a given app. Returned data includes: url, visitCount, lastVisitAt, title and uniqueVisitors."),O6=X.object({name:X.literal("mongodb-find"),arguments:X.object({collection:X.string().describe("Collection name to query"),filter:X.string().optional().describe("MongoDB filter as JSON string (default: {})"),options:X.string().optional().describe("MongoDB find options as JSON string"),database:X.string().optional().describe("Database name (defaults to current database)")})}).describe("Execute a find query on MongoDB"),J6=X.object({name:X.literal("mongodb-aggregate"),arguments:X.object({collection:X.string().describe("Collection name to query"),pipeline:X.string().describe("MongoDB aggregation pipeline as JSON string"),database:X.string().optional().describe("Database name (defaults to current database)")})}).describe("Execute an aggregation pipeline on MongoDB"),K6=X.object({name:X.literal("mongodb-list-collections"),arguments:X.object({database:X.string().optional().describe("Database name (defaults to current database)")})}).describe("List all collections in MongoDB database"),j6=X.object({name:X.literal("mongodb-list-databases"),arguments:X.object({})}).describe("List all databases in MongoDB"),L6=X.object({name:X.literal("mongodb-describe-collection"),arguments:X.object({collection:X.string().describe("Collection name to describe"),database:X.string().optional().describe("Database name (defaults to current database)")})}).describe("Get schema information for a MongoDB collection"),D6=X.object({name:X.literal("mongodb-count"),arguments:X.object({collection:X.string().describe("Collection name to count"),filter:X.string().optional().describe("MongoDB filter as JSON string (default: {})"),database:X.string().optional().describe("Database name (defaults to current database)")})}).describe("Count documents in a MongoDB collection"),N6=X.object({name:X.literal("mongodb-insert"),arguments:X.object({operation:X.enum(["insert","update","upsert"]).describe("Type of operation: insert, update, or upsert"),document:X.string().describe("Document to insert or update as JSON string"),filter:X.string().optional().describe("Filter for update/upsert operations as JSON string"),database:X.string().optional().describe("Database name (defaults to current database)")})}).describe("Insert or update documents in the goals collection (restricted access)"),G6=X.object({name:X.literal("mongodb-update"),arguments:X.object({operation:X.enum(["update"]),document:X.string(),filter:X.string().optional(),database:X.string().optional()})}),_Q=X.discriminatedUnion("name",[_6,Q6,Y6,H6,W6,q6,B6,V6,O6,J6,K6,j6,L6,D6,N6,G6]);var A6=["LCP","FID","CLS"],w6=["good","needs-improvement","poor"];var T0=X.object({metric:X.enum(A6),value:X.number().positive().describe("Metric value in appropriate units (ms for LCP/FID, score for CLS)"),rating:X.enum(w6).describe("Performance rating based on Google Web Vitals thresholds")}),h0=X.object({page_load_time:X.number().nonnegative().describe("Total page load time (loadEventEnd - navigationStart)"),dom_content_loaded_time:X.number().nonnegative().describe("Time when DOMContentLoaded event fired"),time_to_first_byte:X.number().nonnegative().describe("Time to First Byte (TTFB) - server response time"),dom_interactive_time:X.number().nonnegative().describe("Time when DOM becomes interactive"),connect_time:X.number().nonnegative().describe("Time spent establishing connection to server"),dns_lookup_time:X.number().nonnegative().describe("Time spent in DNS resolution"),navigation_type:X.number().int().min(0).max(255).describe("Type of navigation (0=navigate, 1=reload, 2=back_forward, 255=reserved)"),redirect_count:X.number().int().nonnegative().describe("Number of redirects that occurred before reaching the page")}),HQ=X.union([T0,h0]);var M6=X.object({name:X.literal("core_web_vitals"),properties:T0,timestamp:X.string().datetime()}),k6=X.object({name:X.literal("page_load"),properties:h0,timestamp:X.string().datetime()}),WQ=X.union([M6,k6]);var T=X.object({direction:X.enum(["up","down","neutral"]),percentage:X.number().min(0)}),F6=X.object({metric:X.enum(["LCP","FID","CLS"]),value:X.number(),rating:X.enum(["good","needs-improvement","poor"]),date:X.string(),url:X.string().optional()}),v6=X.object({page_load_time:X.number(),dom_content_loaded_time:X.number(),time_to_first_byte:X.number(),dom_interactive_time:X.number(),connect_time:X.number(),dns_lookup_time:X.number(),navigation_type:X.number(),redirect_count:X.number(),date:X.string(),url:X.string().optional()}),E6=X.object({avgLCP:T,avgFID:T,avgCLS:T,goodLCPPercent:T,goodFIDPercent:T,goodCLSPercent:T,totalMeasurements:T}),qQ=X.object({avgLCP:X.number(),avgFID:X.number(),avgCLS:X.number(),avgPageLoadTime:X.number(),avgTTFB:X.number(),goodLCPPercent:X.number(),goodFIDPercent:X.number(),goodCLSPercent:X.number(),totalMeasurements:X.number(),trends:E6,previousPeriod:X.object({avgLCP:X.number(),avgFID:X.number(),avgCLS:X.number(),avgPageLoadTime:X.number(),avgTTFB:X.number(),goodLCPPercent:X.number(),goodFIDPercent:X.number(),goodCLSPercent:X.number(),totalMeasurements:X.number()})}),P6=X.object({coreWebVitals:X.array(F6),pageLoads:X.array(v6)}),S6=X.object({url:X.string(),pageTitle:X.string().optional(),avgLCP:X.number(),avgFID:X.number(),avgCLS:X.number(),goodLCPPercent:X.number(),goodFIDPercent:X.number(),goodCLSPercent:X.number(),avgPageLoadTime:X.number(),avgTTFB:X.number(),measurements:X.number(),visitors:X.number(),trends:X.object({avgLCP:T,avgFID:T,avgCLS:T,avgPageLoadTime:T,avgTTFB:T,visitors:T})}),BQ=X.object({pages:X.array(S6),totalPages:X.number()}),I6=X.object({affectedPages:X.number().optional(),avgValue:X.number().optional(),threshold:X.number().optional(),poorCount:X.number().optional(),pages:X.array(X.object({url:X.string(),value:X.number().optional(),loadTime:X.number().optional()})).optional(),errorCount:X.number().optional(),errorTypes:X.number().optional(),topErrors:X.array(X.string()).optional(),browser:X.string().optional(),issueCount:X.number().optional(),metrics:X.array(X.object({metric:X.string(),value:X.number()})).optional(),totalMeasurements:X.number().optional(),avgLoadTime:X.number().optional(),avgLCP:X.number().optional(),avgFID:X.number().optional(),avgCLS:X.number().optional()}),f6=X.object({id:X.string(),title:X.string(),description:X.string(),impact:X.enum(["high","medium","low"]),category:X.enum(["lcp","fid","cls","general"]),priority:X.number(),evidence:I6}),Z6=X.object({totalMeasurements:X.number(),problemPages:X.number(),errorPatterns:X.number(),slowPages:X.number(),avgLCP:X.number(),avgFID:X.number(),avgCLS:X.number()}),VQ=X.object({recommendations:X.array(f6),analysis:Z6}),OQ=X.object({url:X.string(),metrics:X.object({avgLCP:X.number(),avgFID:X.number(),avgCLS:X.number(),goodLCPPercent:X.number(),goodFIDPercent:X.number(),goodCLSPercent:X.number(),avgPageLoadTime:X.number(),avgTTFB:X.number(),visitors:X.number(),measurements:X.number(),totalMeasurements:X.number()}),trends:P6});var U6=X.enum(["pathname"]),C6=X.enum(["equals","contains","startsWith","endsWith"]),$0=X.object({field:U6,operator:C6,value:X.union([X.string(),X.array(X.string()),X.number()])}),jQ=X.object({_id:X.string(),name:X.string().min(1,"Name is required"),description:X.string().optional(),conditions:X.array($0),appId:X.string(),orgId:X.string(),createdAt:X.date(),updatedAt:X.date()}),LQ=X.object({name:X.string().min(1,"Name is required"),description:X.string().optional(),conditions:X.array($0).min(1,"At least one condition is required")}),DQ=X.object({name:X.string().min(1,"Name is required").optional(),description:X.string().optional(),conditions:X.array($0).min(1,"At least one condition is required").optional()}),NQ=X.object({isValid:X.boolean(),errors:X.array(X.string())}),GQ=X.object({count:X.number(),preview:X.array(X.any())});var MQ=X.object({id:X.string(),object:X.literal("payment_intent"),amount:X.number(),currency:X.string(),status:X.enum(["succeeded","processing","requires_payment_method","requires_confirmation","requires_action","requires_capture","canceled"]),created:X.number(),customer:X.string().nullable(),description:X.string().nullable(),metadata:X.record(X.string()).default({}),receipt_email:X.string().nullable(),payment_method_types:X.array(X.string()),shipping:X.object({address:X.object({city:X.string().nullable(),country:X.string().nullable(),line1:X.string().nullable(),line2:X.string().nullable(),postal_code:X.string().nullable(),state:X.string().nullable()}).nullable(),name:X.string().nullable(),phone:X.string().nullable()}).nullable(),latest_charge:X.string().nullable()}),kQ=X.object({id:X.string(),billing_details:X.object({address:X.object({city:X.string().nullable(),country:X.string().nullable(),line1:X.string().nullable(),line2:X.string().nullable(),postal_code:X.string().nullable(),state:X.string().nullable()}).nullable(),email:X.string().nullable(),name:X.string().nullable(),phone:X.string().nullable()}),payment_method_details:X.object({card:X.object({brand:X.string().nullable(),country:X.string().nullable(),funding:X.string().nullable(),last4:X.string().nullable()}).nullable()}).nullable()}),FQ=X.object({id:X.string(),email:X.string().nullable(),name:X.string().nullable(),phone:X.string().nullable(),address:X.object({city:X.string().nullable(),country:X.string().nullable(),line1:X.string().nullable(),line2:X.string().nullable(),postal_code:X.string().nullable(),state:X.string().nullable()}).nullable(),metadata:X.record(X.string()).default({})}),vQ=X.object({_id:X.string(),appId:X.string(),orgId:X.string(),stripeAccountId:X.string(),accountId:X.string(),displayName:X.string().optional(),scope:X.enum(["read_only","read_write"]).default("read_write"),isActive:X.boolean(),isImporting:X.boolean(),lastImportStartDate:X.date().optional(),lastImportEndDate:X.date().optional(),createdAt:X.date(),updatedAt:X.date()}),EQ=X.object({appId:X.string(),orgId:X.string(),stripeAccountId:X.string(),accountId:X.string(),displayName:X.string().optional(),scope:X.enum(["read_only","read_write"]).default("read_write"),isActive:X.boolean().default(!0),isImporting:X.boolean().default(!1),lastImportStartDate:X.date().optional(),lastImportEndDate:X.date().optional()}),PQ=X.object({displayName:X.string().optional(),isActive:X.boolean().optional(),isImporting:X.boolean().optional(),lastImportStartDate:X.date().optional(),lastImportEndDate:X.date().optional()}).partial(),SQ=X.object({appName:X.string().min(1,"App name is required"),appUrl:X.string().min(1,"App URL is required"),stripeAccountId:X.string().min(1,"Stripe user ID is required"),displayName:X.string().optional(),scope:X.enum(["read_only","read_write"]).default("read_write"),livemode:X.boolean().default(!1),lookbackMonths:X.number().min(1).max(24).default(6),includeFailedPayments:X.boolean().default(!1)}),IQ=X.object({code:X.string().min(1,"Authorization code is required"),state:X.string().min(1,"State parameter is required")}),fQ=X.object({device_type:X.enum(["desktop","mobile","tablet"]),browser:X.string(),os:X.string(),screen_width:X.number(),screen_height:X.number()}),ZQ=X.object({country:X.string(),city:X.string().optional(),region:X.string().optional(),timezone:X.string(),language:X.string()}),UQ=X.object({lookback_months:X.number().default(6),include_failed_payments:X.boolean().default(!1),include_refunds:X.boolean().default(!0),batch_size:X.number().default(100),enrich_with_existing_data:X.boolean().default(!0)});var b6=X.enum(["waiting","active","completed","failed","delayed","paused"]),CQ=X.object({integrationId:X.string(),orgId:X.string(),appId:X.string(),stripeAccountId:X.string(),displayName:X.string(),lookbackMonths:X.number().default(6)}),bQ=X.object({jobId:X.string(),integrationId:X.string(),status:b6,progress:X.object({current:X.number(),total:X.number(),percentage:X.number()}),data:X.object({eventsImported:X.number(),paymentsProcessed:X.number().optional(),customersProcessed:X.number().optional(),revenue:X.number().optional(),startTime:X.date().optional(),endTime:X.date().optional(),error:X.string().optional()}),createdAt:X.date(),updatedAt:X.date()}),RQ=X.object({integrationId:X.string(),status:X.enum(["not_started","in_progress","completed","failed"]),progress:X.object({percentage:X.number(),paymentsImported:X.number(),customersImported:X.number(),revenue:X.number()}),summary:X.object({totalEventsImported:X.number(),startTime:X.date().optional(),endTime:X.date().optional(),lastUpdated:X.date()})});var x0=["free","basic","pro","enterprise","userpath"],R6=["monthly","yearly"],z6=["active","canceled","past_due","incomplete","paused"];var y6=X.object({sites:X.number(),ai:X.number(),events:X.number(),seats:X.number()}),TQ=X.object({_id:X.string(),order:X.number(),orgId:X.string().optional(),name:X.union([X.enum(x0),X.string()]),type:X.enum(["public","private"]),displayName:X.string(),description:X.string(),monthlyPrice:X.number(),monthlyPriceId:X.string(),yearlyPrice:X.number(),yearlyPriceId:X.string(),limits:y6,features:X.array(X.string()),popular:X.boolean().default(!1),archived:X.boolean().default(!1)}),T6=X.object({reason:X.string().optional(),comment:X.string().optional(),feedback:X.string().optional(),cancelledAt:X.date().optional()}).optional(),hQ=X.object({id:X.string().optional(),_id:X.string().optional(),plan:X.union([X.enum(x0),X.string()]),referenceId:X.string(),stripeCustomerId:X.string().optional(),stripeSubscriptionId:X.string().optional(),interval:X.enum(R6).optional(),status:X.enum(z6),periodStart:X.date().optional(),periodEnd:X.date().optional(),cancelAtPeriodEnd:X.boolean().optional(),seats:X.number().optional(),trialStart:X.date().optional(),trialEnd:X.date().optional(),cancelDetails:T6,coupon:X.string().optional()}),xQ=X.object({usage:X.object({sites:X.number(),ai:X.number(),events:X.number(),seats:X.number()}),limits:X.object({sites:X.number(),ai:X.number(),events:X.number(),seats:X.number()})});var h6=["owner","admin","member","viewer"],x6=X.enum(h6),uQ=X.object({id:X.string(),name:X.string(),role:x6,email:X.string().email(),status:X.enum(["active","pending","inactive"]),image:X.string().optional()});var g6=X.object({_id:X.string().optional(),name:X.string(),email:X.string().email(),createdAt:X.union([X.date(),X.string()]).optional(),updatedAt:X.union([X.date(),X.string()]).optional()}),dQ=g6.omit({_id:!0,createdAt:!0,updatedAt:!0});/*!
1
+ var q1=Object.defineProperty;var B1=($,_)=>{for(var Q in _)q1($,Q,{get:_[Q],enumerable:!0,configurable:!0,set:(H)=>_[Q]=()=>H})};var O0={name:"userpath-js",version:"1.0.3",private:!1,main:"dist/index.js",types:"dist/types/sdk/src/index.d.ts",scripts:{dev:"bun build src/index.ts --outdir ./dist --watch",types:"tsc",test:"vitest run","test:watch":"vitest","test:ui":"vitest --ui","test:coverage":"vitest --coverage",build:"bun run build.client && bun run build.pixel && bun run build.server && bun run build.browser","build.prod":"bun run build.client.prod && bun run build.pixel.prod && bun run build.server.prod && bun run build.browser.prod","build.client":"bun run types && bun build src/index.ts --outdir ./dist --no-cache","build.client.prod":"bun run types && bun build src/index.ts --outdir ./dist --minify","build.pixel":"bun build src/pixel.ts --outdir ./dist","build.pixel.prod":"bun build src/pixel.ts --outdir ./dist --minify","build.server":"bun run types && bun build src/server/index.ts --outdir ./dist/server","build.server.prod":"bun run types && bun build src/server/index.ts --outdir ./dist/server --minify","build.browser":"bun run types && bun build src/browser/index.ts --outdir ./dist/browser","build.browser.prod":"bun run types && bun build src/browser/index.ts --outdir ./dist/browser --minify",release:"bun run build.prod && npm publish"},dependencies:{"iconv-lite":"^0.6.3"},exports:{".":{types:"./dist/types/src/index.d.ts",default:"./dist/index.js"},"./server":{types:"./dist/types/src/server/index.d.ts",default:"./dist/server/index.js"},"./browser":{types:"./dist/types/src/browser/index.d.ts",default:"./dist/browser/index.js"}},files:["dist/index.js","dist/types","dist/server","dist/browser"]};var y=()=>typeof window==="undefined"||typeof document==="undefined"||typeof IntersectionObserver==="undefined"||window.document===void 0||window.location===void 0||window.navigator===void 0||window.history===void 0;function U$($){let Q=new URL($).hostname,H=Q.split(".");return`.${H.length>2?H.slice(-2).join("."):Q}`}function J0($,_){return Object.fromEntries(Object.entries($).filter(([Q])=>!_.includes(Q)))}function L(){return y()?{location:{href:"",pathname:"",host:""},addEventListener:($,_,Q)=>{return()=>{}},removeEventListener:($,_,Q)=>{return()=>{}},clearInterval:()=>{},setInterval:()=>{return 0},scrollTo:()=>{},scrollBy:()=>{},setTimeout:()=>{return 0},clearTimeout:()=>{},innerHeight:0,pageYOffset:0,documentElement:{scrollHeight:0,offsetHeight:0,clientHeight:0,scrollTop:0},screen:{width:0,height:0}}:window}function Z(){return y()?{hidden:!1,location:{href:""},referrer:"",title:"",querySelector:()=>null,closest:()=>null,clearTimeout:()=>{},setTimeout:()=>{return 0},innerHeight:0,pageYOffset:0,documentElement:{scrollHeight:0,offsetHeight:0,clientHeight:0,scrollTop:0}}:document}var K0=y()?{cookie:""}:window.document;function C$($,_,Q={}){let{days:H=7,path:Y="/",domain:q,secure:B,sameSite:V="strict"}=Q,J=H?new Date(Date.now()+H*86400000).toUTCString():"",N=`${encodeURIComponent($)}=${encodeURIComponent(_)}`;if(J)N+=`; expires=${J}`;if(Y)N+=`; path=${Y}`;if(q)N+=`; domain=${q}`;if(B)N+="; secure";if(V)N+=`; samesite=${V}`;K0.cookie=N}function j0($){let _=encodeURIComponent($)+"=",Q=K0.cookie.split(";");for(let H=0;H<Q.length;H++){let Y=Q[H];while(Y.charAt(0)===" ")Y=Y.substring(1,Y.length);if(Y.indexOf(_)===0)return decodeURIComponent(Y.substring(_.length,Y.length))}return null}var R={appId:"",apiKey:"",serverUrl:"https://api.userpath.co",version:1,flushIntervalMs:5000,secure:!0,autoTrack:{errors:!0,clicks:!0,scrolling:!0,forms:!0,videos:!0,pageVisibility:!0,pageInactivity:!0,performance:!0}};class d${serverUrl;appId;version;secure;constructor($){this.secure=typeof $.secure==="boolean"?$.secure:R.secure,this.serverUrl=$.serverUrl||R.serverUrl,this.appId=$.appId,this.version=$.version||R.version,C$("_up.app",this.appId,{days:365,sameSite:"lax",secure:this.secure,domain:U$(this.serverUrl)})}buildUrl($){return`${this.serverUrl}/v${this.version}/${$}`}}var X={};B1(X,{void:()=>n1,util:()=>P,unknown:()=>c1,union:()=>a1,undefined:()=>l1,tuple:()=>$X,transformer:()=>OX,symbol:()=>u1,string:()=>F0,strictObject:()=>s1,setErrorMap:()=>K1,set:()=>QX,record:()=>XX,quotelessJson:()=>O1,promise:()=>VX,preprocess:()=>jX,pipeline:()=>LX,ostring:()=>DX,optional:()=>JX,onumber:()=>NX,oboolean:()=>GX,objectUtil:()=>c$,object:()=>r1,number:()=>v0,nullable:()=>KX,null:()=>p1,never:()=>i1,nativeEnum:()=>BX,nan:()=>x1,map:()=>_X,makeIssue:()=>F$,literal:()=>WX,lazy:()=>HX,late:()=>T1,isValid:()=>o,isDirty:()=>R$,isAsync:()=>W$,isAborted:()=>b$,intersection:()=>e1,instanceof:()=>h1,getParsedType:()=>l,getErrorMap:()=>H$,function:()=>YX,enum:()=>qX,effect:()=>OX,discriminatedUnion:()=>t1,defaultErrorMap:()=>c,datetimeRegex:()=>w0,date:()=>m1,custom:()=>k0,coerce:()=>AX,boolean:()=>P0,bigint:()=>g1,array:()=>o1,any:()=>d1,addIssueToContext:()=>j,ZodVoid:()=>P$,ZodUnknown:()=>r,ZodUnion:()=>K$,ZodUndefined:()=>O$,ZodType:()=>k,ZodTuple:()=>d,ZodTransformer:()=>u,ZodSymbol:()=>v$,ZodString:()=>h,ZodSet:()=>_$,ZodSchema:()=>k,ZodRecord:()=>E$,ZodReadonly:()=>w$,ZodPromise:()=>Q$,ZodPipeline:()=>f$,ZodParsedType:()=>K,ZodOptional:()=>g,ZodObject:()=>S,ZodNumber:()=>s,ZodNullable:()=>n,ZodNull:()=>J$,ZodNever:()=>p,ZodNativeEnum:()=>N$,ZodNaN:()=>I$,ZodMap:()=>S$,ZodLiteral:()=>D$,ZodLazy:()=>L$,ZodIssueCode:()=>O,ZodIntersection:()=>j$,ZodFunction:()=>B$,ZodFirstPartyTypeKind:()=>A,ZodError:()=>z,ZodEnum:()=>t,ZodEffects:()=>u,ZodDiscriminatedUnion:()=>z$,ZodDefault:()=>G$,ZodDate:()=>$$,ZodCatch:()=>A$,ZodBranded:()=>y$,ZodBoolean:()=>V$,ZodBigInt:()=>a,ZodArray:()=>x,ZodAny:()=>X$,Schema:()=>k,ParseStatus:()=>U,OK:()=>b,NEVER:()=>wX,INVALID:()=>G,EMPTY_PATH:()=>j1,DIRTY:()=>e,BRAND:()=>y1});var P;(function($){$.assertEqual=(Y)=>{};function _(Y){}$.assertIs=_;function Q(Y){throw new Error}$.assertNever=Q,$.arrayToEnum=(Y)=>{let q={};for(let B of Y)q[B]=B;return q},$.getValidEnumValues=(Y)=>{let q=$.objectKeys(Y).filter((V)=>typeof Y[Y[V]]!=="number"),B={};for(let V of q)B[V]=Y[V];return $.objectValues(B)},$.objectValues=(Y)=>{return $.objectKeys(Y).map(function(q){return Y[q]})},$.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let q=[];for(let B in Y)if(Object.prototype.hasOwnProperty.call(Y,B))q.push(B);return q},$.find=(Y,q)=>{for(let B of Y)if(q(B))return B;return},$.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function H(Y,q=" | "){return Y.map((B)=>typeof B==="string"?`'${B}'`:B).join(q)}$.joinValues=H,$.jsonStringifyReplacer=(Y,q)=>{if(typeof q==="bigint")return q.toString();return q}})(P||(P={}));var c$;(function($){$.mergeShapes=(_,Q)=>{return{..._,...Q}}})(c$||(c$={}));var K=P.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),l=($)=>{switch(typeof $){case"undefined":return K.undefined;case"string":return K.string;case"number":return Number.isNaN($)?K.nan:K.number;case"boolean":return K.boolean;case"function":return K.function;case"bigint":return K.bigint;case"symbol":return K.symbol;case"object":if(Array.isArray($))return K.array;if($===null)return K.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return K.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return K.map;if(typeof Set!=="undefined"&&$ instanceof Set)return K.set;if(typeof Date!=="undefined"&&$ instanceof Date)return K.date;return K.object;default:return K.unknown}};var O=P.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"]),O1=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class z extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};let _=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,_);else this.__proto__=_;this.name="ZodError",this.issues=$}format($){let _=$||function(Y){return Y.message},Q={_errors:[]},H=(Y)=>{for(let q of Y.issues)if(q.code==="invalid_union")q.unionErrors.map(H);else if(q.code==="invalid_return_type")H(q.returnTypeError);else if(q.code==="invalid_arguments")H(q.argumentsError);else if(q.path.length===0)Q._errors.push(_(q));else{let B=Q,V=0;while(V<q.path.length){let J=q.path[V];if(V!==q.path.length-1)B[J]=B[J]||{_errors:[]};else B[J]=B[J]||{_errors:[]},B[J]._errors.push(_(q));B=B[J],V++}}};return H(this),Q}static assert($){if(!($ instanceof z))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,P.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(_)=>_.message){let _={},Q=[];for(let H of this.issues)if(H.path.length>0){let Y=H.path[0];_[Y]=_[Y]||[],_[Y].push($(H))}else Q.push($(H));return{formErrors:Q,fieldErrors:_}}get formErrors(){return this.flatten()}}z.create=($)=>{return new z($)};var J1=($,_)=>{let Q;switch($.code){case O.invalid_type:if($.received===K.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case O.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,P.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:Q=`Unrecognized key(s) in object: ${P.joinValues($.keys,", ")}`;break;case O.invalid_union:Q="Invalid input";break;case O.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${P.joinValues($.options)}`;break;case O.invalid_enum_value:Q=`Invalid enum value. Expected ${P.joinValues($.options)}, received '${$.received}'`;break;case O.invalid_arguments:Q="Invalid function arguments";break;case O.invalid_return_type:Q="Invalid function return type";break;case O.invalid_date:Q="Invalid date";break;case O.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(Q=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)Q=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)Q=`Invalid input: must end with "${$.validation.endsWith}"`;else P.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case O.too_small:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="bigint")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else Q="Invalid input";break;case O.too_big:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")Q=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else Q="Invalid input";break;case O.custom:Q="Invalid input";break;case O.invalid_intersection_types:Q="Intersection results could not be merged";break;case O.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case O.not_finite:Q="Number must be finite";break;default:Q=_.defaultError,P.assertNever($)}return{message:Q}},c=J1;var L0=c;function K1($){L0=$}function H$(){return L0}var F$=($)=>{let{data:_,path:Q,errorMaps:H,issueData:Y}=$,q=[...Q,...Y.path||[]],B={...Y,path:q};if(Y.message!==void 0)return{...Y,path:q,message:Y.message};let V="",J=H.filter((N)=>!!N).slice().reverse();for(let N of J)V=N(B,{data:_,defaultError:V}).message;return{...Y,path:q,message:V}},j1=[];function j($,_){let Q=H$(),H=F$({issueData:_,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===c?void 0:c].filter((Y)=>!!Y)});$.common.issues.push(H)}class U{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,_){let Q=[];for(let H of _){if(H.status==="aborted")return G;if(H.status==="dirty")$.dirty();Q.push(H.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,_){let Q=[];for(let H of _){let Y=await H.key,q=await H.value;Q.push({key:Y,value:q})}return U.mergeObjectSync($,Q)}static mergeObjectSync($,_){let Q={};for(let H of _){let{key:Y,value:q}=H;if(Y.status==="aborted")return G;if(q.status==="aborted")return G;if(Y.status==="dirty")$.dirty();if(q.status==="dirty")$.dirty();if(Y.value!=="__proto__"&&(typeof q.value!=="undefined"||H.alwaysSet))Q[Y.value]=q.value}return{status:$.value,value:Q}}}var G=Object.freeze({status:"aborted"}),e=($)=>({status:"dirty",value:$}),b=($)=>({status:"valid",value:$}),b$=($)=>$.status==="aborted",R$=($)=>$.status==="dirty",o=($)=>$.status==="valid",W$=($)=>typeof Promise!=="undefined"&&$ instanceof Promise;var D;(function($){$.errToObj=(_)=>typeof _==="string"?{message:_}:_||{},$.toString=(_)=>typeof _==="string"?_:_?.message})(D||(D={}));class m{constructor($,_,Q,H){this._cachedPath=[],this.parent=$,this.data=_,this._path=Q,this._key=H}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var D0=($,_)=>{if(o(_))return{success:!0,data:_.value};else{if(!$.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Q=new z($.common.issues);return this._error=Q,this._error}}}};function M($){if(!$)return{};let{errorMap:_,invalid_type_error:Q,required_error:H,description:Y}=$;if(_&&(Q||H))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(_)return{errorMap:_,description:Y};return{errorMap:(B,V)=>{let{message:J}=$;if(B.code==="invalid_enum_value")return{message:J??V.defaultError};if(typeof V.data==="undefined")return{message:J??H??V.defaultError};if(B.code!=="invalid_type")return{message:V.defaultError};return{message:J??Q??V.defaultError}},description:Y}}class k{get description(){return this._def.description}_getType($){return l($.data)}_getOrReturnCtx($,_){return _||{common:$.parent.common,data:$.data,parsedType:l($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new U,ctx:{common:$.parent.common,data:$.data,parsedType:l($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let _=this._parse($);if(W$(_))throw new Error("Synchronous parse encountered promise.");return _}_parseAsync($){let _=this._parse($);return Promise.resolve(_)}parse($,_){let Q=this.safeParse($,_);if(Q.success)return Q.data;throw Q.error}safeParse($,_){let Q={common:{issues:[],async:_?.async??!1,contextualErrorMap:_?.errorMap},path:_?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:l($)},H=this._parseSync({data:$,path:Q.path,parent:Q});return D0(Q,H)}"~validate"($){let _={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:l($)};if(!this["~standard"].async)try{let Q=this._parseSync({data:$,path:[],parent:_});return o(Q)?{value:Q.value}:{issues:_.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;_.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:_}).then((Q)=>o(Q)?{value:Q.value}:{issues:_.common.issues})}async parseAsync($,_){let Q=await this.safeParseAsync($,_);if(Q.success)return Q.data;throw Q.error}async safeParseAsync($,_){let Q={common:{issues:[],contextualErrorMap:_?.errorMap,async:!0},path:_?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:l($)},H=this._parse({data:$,path:Q.path,parent:Q}),Y=await(W$(H)?H:Promise.resolve(H));return D0(Q,Y)}refine($,_){let Q=(H)=>{if(typeof _==="string"||typeof _==="undefined")return{message:_};else if(typeof _==="function")return _(H);else return _};return this._refinement((H,Y)=>{let q=$(H),B=()=>Y.addIssue({code:O.custom,...Q(H)});if(typeof Promise!=="undefined"&&q instanceof Promise)return q.then((V)=>{if(!V)return B(),!1;else return!0});if(!q)return B(),!1;else return!0})}refinement($,_){return this._refinement((Q,H)=>{if(!$(Q))return H.addIssue(typeof _==="function"?_(Q,H):_),!1;else return!0})}_refinement($){return new u({schema:this,typeName:A.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,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:(_)=>this["~validate"](_)}}optional(){return g.create(this,this._def)}nullable(){return n.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return x.create(this)}promise(){return Q$.create(this,this._def)}or($){return K$.create([this,$],this._def)}and($){return j$.create(this,$,this._def)}transform($){return new u({...M(this._def),schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:$}})}default($){let _=typeof $==="function"?$:()=>$;return new G$({...M(this._def),innerType:this,defaultValue:_,typeName:A.ZodDefault})}brand(){return new y$({typeName:A.ZodBranded,type:this,...M(this._def)})}catch($){let _=typeof $==="function"?$:()=>$;return new A$({...M(this._def),innerType:this,catchValue:_,typeName:A.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return f$.create(this,$)}readonly(){return w$.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var L1=/^c[^\s-]{8,}$/i,D1=/^[0-9a-z]+$/,N1=/^[0-9A-HJKMNP-TV-Z]{26}$/i,G1=/^[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,A1=/^[a-z0-9_-]{21}$/i,w1=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,M1=/^[-+]?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)?)??$/,k1=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,F1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",i$,v1=/^(?:(?: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])$/,P1=/^(?:(?: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])$/,E1=/^(([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]))$/,S1=/^(([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])$/,I1=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,f1=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,G0="((\\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])))",Z1=new RegExp(`^${G0}$`);function A0($){let _="[0-5]\\d";if($.precision)_=`${_}\\.\\d{${$.precision}}`;else if($.precision==null)_=`${_}(\\.\\d+)?`;let Q=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${_})${Q}`}function U1($){return new RegExp(`^${A0($)}$`)}function w0($){let _=`${G0}T${A0($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return _=`${_}(${Q.join("|")})`,new RegExp(`^${_}$`)}function C1($,_){if((_==="v4"||!_)&&v1.test($))return!0;if((_==="v6"||!_)&&E1.test($))return!0;return!1}function b1($,_){if(!w1.test($))return!1;try{let[Q]=$.split(".");if(!Q)return!1;let H=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),Y=JSON.parse(atob(H));if(typeof Y!=="object"||Y===null)return!1;if("typ"in Y&&Y?.typ!=="JWT")return!1;if(!Y.alg)return!1;if(_&&Y.alg!==_)return!1;return!0}catch{return!1}}function R1($,_){if((_==="v4"||!_)&&P1.test($))return!0;if((_==="v6"||!_)&&S1.test($))return!0;return!1}class h extends k{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==K.string){let Y=this._getOrReturnCtx($);return j(Y,{code:O.invalid_type,expected:K.string,received:Y.parsedType}),G}let Q=new U,H=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if($.data.length<Y.value)H=this._getOrReturnCtx($,H),j(H,{code:O.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="max"){if($.data.length>Y.value)H=this._getOrReturnCtx($,H),j(H,{code:O.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="length"){let q=$.data.length>Y.value,B=$.data.length<Y.value;if(q||B){if(H=this._getOrReturnCtx($,H),q)j(H,{code:O.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(B)j(H,{code:O.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});Q.dirty()}}else if(Y.kind==="email"){if(!k1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"email",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="emoji"){if(!i$)i$=new RegExp(F1,"u");if(!i$.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"emoji",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="uuid"){if(!G1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"uuid",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="nanoid"){if(!A1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"nanoid",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid"){if(!L1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"cuid",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid2"){if(!D1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"cuid2",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ulid"){if(!N1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"ulid",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="url")try{new URL($.data)}catch{H=this._getOrReturnCtx($,H),j(H,{validation:"url",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"regex",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="trim")$.data=$.data.trim();else if(Y.kind==="includes"){if(!$.data.includes(Y.value,Y.position))H=this._getOrReturnCtx($,H),j(H,{code:O.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),Q.dirty()}else if(Y.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(Y.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(Y.kind==="startsWith"){if(!$.data.startsWith(Y.value))H=this._getOrReturnCtx($,H),j(H,{code:O.invalid_string,validation:{startsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="endsWith"){if(!$.data.endsWith(Y.value))H=this._getOrReturnCtx($,H),j(H,{code:O.invalid_string,validation:{endsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="datetime"){if(!w0(Y).test($.data))H=this._getOrReturnCtx($,H),j(H,{code:O.invalid_string,validation:"datetime",message:Y.message}),Q.dirty()}else if(Y.kind==="date"){if(!Z1.test($.data))H=this._getOrReturnCtx($,H),j(H,{code:O.invalid_string,validation:"date",message:Y.message}),Q.dirty()}else if(Y.kind==="time"){if(!U1(Y).test($.data))H=this._getOrReturnCtx($,H),j(H,{code:O.invalid_string,validation:"time",message:Y.message}),Q.dirty()}else if(Y.kind==="duration"){if(!M1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"duration",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ip"){if(!C1($.data,Y.version))H=this._getOrReturnCtx($,H),j(H,{validation:"ip",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="jwt"){if(!b1($.data,Y.alg))H=this._getOrReturnCtx($,H),j(H,{validation:"jwt",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cidr"){if(!R1($.data,Y.version))H=this._getOrReturnCtx($,H),j(H,{validation:"cidr",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64"){if(!I1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"base64",code:O.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64url"){if(!f1.test($.data))H=this._getOrReturnCtx($,H),j(H,{validation:"base64url",code:O.invalid_string,message:Y.message}),Q.dirty()}else P.assertNever(Y);return{status:Q.value,value:$.data}}_regex($,_,Q){return this.refinement((H)=>$.test(H),{validation:_,code:O.invalid_string,...D.errToObj(Q)})}_addCheck($){return new h({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...D.errToObj($)})}url($){return this._addCheck({kind:"url",...D.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...D.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...D.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...D.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...D.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...D.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...D.errToObj($)})}base64($){return this._addCheck({kind:"base64",...D.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...D.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...D.errToObj($)})}ip($){return this._addCheck({kind:"ip",...D.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...D.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision==="undefined"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...D.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision==="undefined"?null:$?.precision,...D.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...D.errToObj($)})}regex($,_){return this._addCheck({kind:"regex",regex:$,...D.errToObj(_)})}includes($,_){return this._addCheck({kind:"includes",value:$,position:_?.position,...D.errToObj(_?.message)})}startsWith($,_){return this._addCheck({kind:"startsWith",value:$,...D.errToObj(_)})}endsWith($,_){return this._addCheck({kind:"endsWith",value:$,...D.errToObj(_)})}min($,_){return this._addCheck({kind:"min",value:$,...D.errToObj(_)})}max($,_){return this._addCheck({kind:"max",value:$,...D.errToObj(_)})}length($,_){return this._addCheck({kind:"length",value:$,...D.errToObj(_)})}nonempty($){return this.min(1,D.errToObj($))}trim(){return new h({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new h({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new h({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let _ of this._def.checks)if(_.kind==="min"){if($===null||_.value>$)$=_.value}return $}get maxLength(){let $=null;for(let _ of this._def.checks)if(_.kind==="max"){if($===null||_.value<$)$=_.value}return $}}h.create=($)=>{return new h({checks:[],typeName:A.ZodString,coerce:$?.coerce??!1,...M($)})};function z1($,_){let Q=($.toString().split(".")[1]||"").length,H=(_.toString().split(".")[1]||"").length,Y=Q>H?Q:H,q=Number.parseInt($.toFixed(Y).replace(".","")),B=Number.parseInt(_.toFixed(Y).replace(".",""));return q%B/10**Y}class s extends k{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==K.number){let Y=this._getOrReturnCtx($);return j(Y,{code:O.invalid_type,expected:K.number,received:Y.parsedType}),G}let Q=void 0,H=new U;for(let Y of this._def.checks)if(Y.kind==="int"){if(!P.isInteger($.data))Q=this._getOrReturnCtx($,Q),j(Q,{code:O.invalid_type,expected:"integer",received:"float",message:Y.message}),H.dirty()}else if(Y.kind==="min"){if(Y.inclusive?$.data<Y.value:$.data<=Y.value)Q=this._getOrReturnCtx($,Q),j(Q,{code:O.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),H.dirty()}else if(Y.kind==="max"){if(Y.inclusive?$.data>Y.value:$.data>=Y.value)Q=this._getOrReturnCtx($,Q),j(Q,{code:O.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),H.dirty()}else if(Y.kind==="multipleOf"){if(z1($.data,Y.value)!==0)Q=this._getOrReturnCtx($,Q),j(Q,{code:O.not_multiple_of,multipleOf:Y.value,message:Y.message}),H.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),j(Q,{code:O.not_finite,message:Y.message}),H.dirty()}else P.assertNever(Y);return{status:H.value,value:$.data}}gte($,_){return this.setLimit("min",$,!0,D.toString(_))}gt($,_){return this.setLimit("min",$,!1,D.toString(_))}lte($,_){return this.setLimit("max",$,!0,D.toString(_))}lt($,_){return this.setLimit("max",$,!1,D.toString(_))}setLimit($,_,Q,H){return new s({...this._def,checks:[...this._def.checks,{kind:$,value:_,inclusive:Q,message:D.toString(H)}]})}_addCheck($){return new s({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:D.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:D.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:D.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:D.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:D.toString($)})}multipleOf($,_){return this._addCheck({kind:"multipleOf",value:$,message:D.toString(_)})}finite($){return this._addCheck({kind:"finite",message:D.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:D.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:D.toString($)})}get minValue(){let $=null;for(let _ of this._def.checks)if(_.kind==="min"){if($===null||_.value>$)$=_.value}return $}get maxValue(){let $=null;for(let _ of this._def.checks)if(_.kind==="max"){if($===null||_.value<$)$=_.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&P.isInteger($.value))}get isFinite(){let $=null,_=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(_===null||Q.value>_)_=Q.value}else if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return Number.isFinite(_)&&Number.isFinite($)}}s.create=($)=>{return new s({checks:[],typeName:A.ZodNumber,coerce:$?.coerce||!1,...M($)})};class a extends k{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==K.bigint)return this._getInvalidInput($);let Q=void 0,H=new U;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?$.data<Y.value:$.data<=Y.value)Q=this._getOrReturnCtx($,Q),j(Q,{code:O.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),H.dirty()}else if(Y.kind==="max"){if(Y.inclusive?$.data>Y.value:$.data>=Y.value)Q=this._getOrReturnCtx($,Q),j(Q,{code:O.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),H.dirty()}else if(Y.kind==="multipleOf"){if($.data%Y.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),j(Q,{code:O.not_multiple_of,multipleOf:Y.value,message:Y.message}),H.dirty()}else P.assertNever(Y);return{status:H.value,value:$.data}}_getInvalidInput($){let _=this._getOrReturnCtx($);return j(_,{code:O.invalid_type,expected:K.bigint,received:_.parsedType}),G}gte($,_){return this.setLimit("min",$,!0,D.toString(_))}gt($,_){return this.setLimit("min",$,!1,D.toString(_))}lte($,_){return this.setLimit("max",$,!0,D.toString(_))}lt($,_){return this.setLimit("max",$,!1,D.toString(_))}setLimit($,_,Q,H){return new a({...this._def,checks:[...this._def.checks,{kind:$,value:_,inclusive:Q,message:D.toString(H)}]})}_addCheck($){return new a({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:D.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:D.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:D.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:D.toString($)})}multipleOf($,_){return this._addCheck({kind:"multipleOf",value:$,message:D.toString(_)})}get minValue(){let $=null;for(let _ of this._def.checks)if(_.kind==="min"){if($===null||_.value>$)$=_.value}return $}get maxValue(){let $=null;for(let _ of this._def.checks)if(_.kind==="max"){if($===null||_.value<$)$=_.value}return $}}a.create=($)=>{return new a({checks:[],typeName:A.ZodBigInt,coerce:$?.coerce??!1,...M($)})};class V$ extends k{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==K.boolean){let Q=this._getOrReturnCtx($);return j(Q,{code:O.invalid_type,expected:K.boolean,received:Q.parsedType}),G}return b($.data)}}V$.create=($)=>{return new V$({typeName:A.ZodBoolean,coerce:$?.coerce||!1,...M($)})};class $$ extends k{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==K.date){let Y=this._getOrReturnCtx($);return j(Y,{code:O.invalid_type,expected:K.date,received:Y.parsedType}),G}if(Number.isNaN($.data.getTime())){let Y=this._getOrReturnCtx($);return j(Y,{code:O.invalid_date}),G}let Q=new U,H=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if($.data.getTime()<Y.value)H=this._getOrReturnCtx($,H),j(H,{code:O.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),Q.dirty()}else if(Y.kind==="max"){if($.data.getTime()>Y.value)H=this._getOrReturnCtx($,H),j(H,{code:O.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),Q.dirty()}else P.assertNever(Y);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new $$({...this._def,checks:[...this._def.checks,$]})}min($,_){return this._addCheck({kind:"min",value:$.getTime(),message:D.toString(_)})}max($,_){return this._addCheck({kind:"max",value:$.getTime(),message:D.toString(_)})}get minDate(){let $=null;for(let _ of this._def.checks)if(_.kind==="min"){if($===null||_.value>$)$=_.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let _ of this._def.checks)if(_.kind==="max"){if($===null||_.value<$)$=_.value}return $!=null?new Date($):null}}$$.create=($)=>{return new $$({checks:[],coerce:$?.coerce||!1,typeName:A.ZodDate,...M($)})};class v$ extends k{_parse($){if(this._getType($)!==K.symbol){let Q=this._getOrReturnCtx($);return j(Q,{code:O.invalid_type,expected:K.symbol,received:Q.parsedType}),G}return b($.data)}}v$.create=($)=>{return new v$({typeName:A.ZodSymbol,...M($)})};class O$ extends k{_parse($){if(this._getType($)!==K.undefined){let Q=this._getOrReturnCtx($);return j(Q,{code:O.invalid_type,expected:K.undefined,received:Q.parsedType}),G}return b($.data)}}O$.create=($)=>{return new O$({typeName:A.ZodUndefined,...M($)})};class J$ extends k{_parse($){if(this._getType($)!==K.null){let Q=this._getOrReturnCtx($);return j(Q,{code:O.invalid_type,expected:K.null,received:Q.parsedType}),G}return b($.data)}}J$.create=($)=>{return new J$({typeName:A.ZodNull,...M($)})};class X$ extends k{constructor(){super(...arguments);this._any=!0}_parse($){return b($.data)}}X$.create=($)=>{return new X$({typeName:A.ZodAny,...M($)})};class r extends k{constructor(){super(...arguments);this._unknown=!0}_parse($){return b($.data)}}r.create=($)=>{return new r({typeName:A.ZodUnknown,...M($)})};class p extends k{_parse($){let _=this._getOrReturnCtx($);return j(_,{code:O.invalid_type,expected:K.never,received:_.parsedType}),G}}p.create=($)=>{return new p({typeName:A.ZodNever,...M($)})};class P$ extends k{_parse($){if(this._getType($)!==K.undefined){let Q=this._getOrReturnCtx($);return j(Q,{code:O.invalid_type,expected:K.void,received:Q.parsedType}),G}return b($.data)}}P$.create=($)=>{return new P$({typeName:A.ZodVoid,...M($)})};class x extends k{_parse($){let{ctx:_,status:Q}=this._processInputParams($),H=this._def;if(_.parsedType!==K.array)return j(_,{code:O.invalid_type,expected:K.array,received:_.parsedType}),G;if(H.exactLength!==null){let q=_.data.length>H.exactLength.value,B=_.data.length<H.exactLength.value;if(q||B)j(_,{code:q?O.too_big:O.too_small,minimum:B?H.exactLength.value:void 0,maximum:q?H.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:H.exactLength.message}),Q.dirty()}if(H.minLength!==null){if(_.data.length<H.minLength.value)j(_,{code:O.too_small,minimum:H.minLength.value,type:"array",inclusive:!0,exact:!1,message:H.minLength.message}),Q.dirty()}if(H.maxLength!==null){if(_.data.length>H.maxLength.value)j(_,{code:O.too_big,maximum:H.maxLength.value,type:"array",inclusive:!0,exact:!1,message:H.maxLength.message}),Q.dirty()}if(_.common.async)return Promise.all([..._.data].map((q,B)=>{return H.type._parseAsync(new m(_,q,_.path,B))})).then((q)=>{return U.mergeArray(Q,q)});let Y=[..._.data].map((q,B)=>{return H.type._parseSync(new m(_,q,_.path,B))});return U.mergeArray(Q,Y)}get element(){return this._def.type}min($,_){return new x({...this._def,minLength:{value:$,message:D.toString(_)}})}max($,_){return new x({...this._def,maxLength:{value:$,message:D.toString(_)}})}length($,_){return new x({...this._def,exactLength:{value:$,message:D.toString(_)}})}nonempty($){return this.min(1,$)}}x.create=($,_)=>{return new x({type:$,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...M(_)})};function q$($){if($ instanceof S){let _={};for(let Q in $.shape){let H=$.shape[Q];_[Q]=g.create(q$(H))}return new S({...$._def,shape:()=>_})}else if($ instanceof x)return new x({...$._def,type:q$($.element)});else if($ instanceof g)return g.create(q$($.unwrap()));else if($ instanceof n)return n.create(q$($.unwrap()));else if($ instanceof d)return d.create($.items.map((_)=>q$(_)));else return $}class S extends k{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),_=P.objectKeys($);return this._cached={shape:$,keys:_},this._cached}_parse($){if(this._getType($)!==K.object){let J=this._getOrReturnCtx($);return j(J,{code:O.invalid_type,expected:K.object,received:J.parsedType}),G}let{status:Q,ctx:H}=this._processInputParams($),{shape:Y,keys:q}=this._getCached(),B=[];if(!(this._def.catchall instanceof p&&this._def.unknownKeys==="strip")){for(let J in H.data)if(!q.includes(J))B.push(J)}let V=[];for(let J of q){let N=Y[J],I=H.data[J];V.push({key:{status:"valid",value:J},value:N._parse(new m(H,I,H.path,J)),alwaysSet:J in H.data})}if(this._def.catchall instanceof p){let J=this._def.unknownKeys;if(J==="passthrough")for(let N of B)V.push({key:{status:"valid",value:N},value:{status:"valid",value:H.data[N]}});else if(J==="strict"){if(B.length>0)j(H,{code:O.unrecognized_keys,keys:B}),Q.dirty()}else if(J==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let J=this._def.catchall;for(let N of B){let I=H.data[N];V.push({key:{status:"valid",value:N},value:J._parse(new m(H,I,H.path,N)),alwaysSet:N in H.data})}}if(H.common.async)return Promise.resolve().then(async()=>{let J=[];for(let N of V){let I=await N.key,k$=await N.value;J.push({key:I,value:k$,alwaysSet:N.alwaysSet})}return J}).then((J)=>{return U.mergeObjectSync(Q,J)});else return U.mergeObjectSync(Q,V)}get shape(){return this._def.shape()}strict($){return D.errToObj,new S({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(_,Q)=>{let H=this._def.errorMap?.(_,Q).message??Q.defaultError;if(_.code==="unrecognized_keys")return{message:D.errToObj($).message??H};return{message:H}}}:{}})}strip(){return new S({...this._def,unknownKeys:"strip"})}passthrough(){return new S({...this._def,unknownKeys:"passthrough"})}extend($){return new S({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new S({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:A.ZodObject})}setKey($,_){return this.augment({[$]:_})}catchall($){return new S({...this._def,catchall:$})}pick($){let _={};for(let Q of P.objectKeys($))if($[Q]&&this.shape[Q])_[Q]=this.shape[Q];return new S({...this._def,shape:()=>_})}omit($){let _={};for(let Q of P.objectKeys(this.shape))if(!$[Q])_[Q]=this.shape[Q];return new S({...this._def,shape:()=>_})}deepPartial(){return q$(this)}partial($){let _={};for(let Q of P.objectKeys(this.shape)){let H=this.shape[Q];if($&&!$[Q])_[Q]=H;else _[Q]=H.optional()}return new S({...this._def,shape:()=>_})}required($){let _={};for(let Q of P.objectKeys(this.shape))if($&&!$[Q])_[Q]=this.shape[Q];else{let Y=this.shape[Q];while(Y instanceof g)Y=Y._def.innerType;_[Q]=Y}return new S({...this._def,shape:()=>_})}keyof(){return M0(P.objectKeys(this.shape))}}S.create=($,_)=>{return new S({shape:()=>$,unknownKeys:"strip",catchall:p.create(),typeName:A.ZodObject,...M(_)})};S.strictCreate=($,_)=>{return new S({shape:()=>$,unknownKeys:"strict",catchall:p.create(),typeName:A.ZodObject,...M(_)})};S.lazycreate=($,_)=>{return new S({shape:$,unknownKeys:"strip",catchall:p.create(),typeName:A.ZodObject,...M(_)})};class K$ extends k{_parse($){let{ctx:_}=this._processInputParams($),Q=this._def.options;function H(Y){for(let B of Y)if(B.result.status==="valid")return B.result;for(let B of Y)if(B.result.status==="dirty")return _.common.issues.push(...B.ctx.common.issues),B.result;let q=Y.map((B)=>new z(B.ctx.common.issues));return j(_,{code:O.invalid_union,unionErrors:q}),G}if(_.common.async)return Promise.all(Q.map(async(Y)=>{let q={..._,common:{..._.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:_.data,path:_.path,parent:q}),ctx:q}})).then(H);else{let Y=void 0,q=[];for(let V of Q){let J={..._,common:{..._.common,issues:[]},parent:null},N=V._parseSync({data:_.data,path:_.path,parent:J});if(N.status==="valid")return N;else if(N.status==="dirty"&&!Y)Y={result:N,ctx:J};if(J.common.issues.length)q.push(J.common.issues)}if(Y)return _.common.issues.push(...Y.ctx.common.issues),Y.result;let B=q.map((V)=>new z(V));return j(_,{code:O.invalid_union,unionErrors:B}),G}}get options(){return this._def.options}}K$.create=($,_)=>{return new K$({options:$,typeName:A.ZodUnion,...M(_)})};var i=($)=>{if($ instanceof L$)return i($.schema);else if($ instanceof u)return i($.innerType());else if($ instanceof D$)return[$.value];else if($ instanceof t)return $.options;else if($ instanceof N$)return P.objectValues($.enum);else if($ instanceof G$)return i($._def.innerType);else if($ instanceof O$)return[void 0];else if($ instanceof J$)return[null];else if($ instanceof g)return[void 0,...i($.unwrap())];else if($ instanceof n)return[null,...i($.unwrap())];else if($ instanceof y$)return i($.unwrap());else if($ instanceof w$)return i($.unwrap());else if($ instanceof A$)return i($._def.innerType);else return[]};class z$ extends k{_parse($){let{ctx:_}=this._processInputParams($);if(_.parsedType!==K.object)return j(_,{code:O.invalid_type,expected:K.object,received:_.parsedType}),G;let Q=this.discriminator,H=_.data[Q],Y=this.optionsMap.get(H);if(!Y)return j(_,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),G;if(_.common.async)return Y._parseAsync({data:_.data,path:_.path,parent:_});else return Y._parseSync({data:_.data,path:_.path,parent:_})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,_,Q){let H=new Map;for(let Y of _){let q=i(Y.shape[$]);if(!q.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let B of q){if(H.has(B))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(B)}`);H.set(B,Y)}}return new z$({typeName:A.ZodDiscriminatedUnion,discriminator:$,options:_,optionsMap:H,...M(Q)})}}function n$($,_){let Q=l($),H=l(_);if($===_)return{valid:!0,data:$};else if(Q===K.object&&H===K.object){let Y=P.objectKeys(_),q=P.objectKeys($).filter((V)=>Y.indexOf(V)!==-1),B={...$,..._};for(let V of q){let J=n$($[V],_[V]);if(!J.valid)return{valid:!1};B[V]=J.data}return{valid:!0,data:B}}else if(Q===K.array&&H===K.array){if($.length!==_.length)return{valid:!1};let Y=[];for(let q=0;q<$.length;q++){let B=$[q],V=_[q],J=n$(B,V);if(!J.valid)return{valid:!1};Y.push(J.data)}return{valid:!0,data:Y}}else if(Q===K.date&&H===K.date&&+$===+_)return{valid:!0,data:$};else return{valid:!1}}class j$ extends k{_parse($){let{status:_,ctx:Q}=this._processInputParams($),H=(Y,q)=>{if(b$(Y)||b$(q))return G;let B=n$(Y.value,q.value);if(!B.valid)return j(Q,{code:O.invalid_intersection_types}),G;if(R$(Y)||R$(q))_.dirty();return{status:_.value,value:B.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([Y,q])=>H(Y,q));else return H(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}j$.create=($,_,Q)=>{return new j$({left:$,right:_,typeName:A.ZodIntersection,...M(Q)})};class d extends k{_parse($){let{status:_,ctx:Q}=this._processInputParams($);if(Q.parsedType!==K.array)return j(Q,{code:O.invalid_type,expected:K.array,received:Q.parsedType}),G;if(Q.data.length<this._def.items.length)return j(Q,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),G;if(!this._def.rest&&Q.data.length>this._def.items.length)j(Q,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_.dirty();let Y=[...Q.data].map((q,B)=>{let V=this._def.items[B]||this._def.rest;if(!V)return null;return V._parse(new m(Q,q,Q.path,B))}).filter((q)=>!!q);if(Q.common.async)return Promise.all(Y).then((q)=>{return U.mergeArray(_,q)});else return U.mergeArray(_,Y)}get items(){return this._def.items}rest($){return new d({...this._def,rest:$})}}d.create=($,_)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new d({items:$,typeName:A.ZodTuple,rest:null,...M(_)})};class E$ extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:_,ctx:Q}=this._processInputParams($);if(Q.parsedType!==K.object)return j(Q,{code:O.invalid_type,expected:K.object,received:Q.parsedType}),G;let H=[],Y=this._def.keyType,q=this._def.valueType;for(let B in Q.data)H.push({key:Y._parse(new m(Q,B,Q.path,B)),value:q._parse(new m(Q,Q.data[B],Q.path,B)),alwaysSet:B in Q.data});if(Q.common.async)return U.mergeObjectAsync(_,H);else return U.mergeObjectSync(_,H)}get element(){return this._def.valueType}static create($,_,Q){if(_ instanceof k)return new E$({keyType:$,valueType:_,typeName:A.ZodRecord,...M(Q)});return new E$({keyType:h.create(),valueType:$,typeName:A.ZodRecord,...M(_)})}}class S$ extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:_,ctx:Q}=this._processInputParams($);if(Q.parsedType!==K.map)return j(Q,{code:O.invalid_type,expected:K.map,received:Q.parsedType}),G;let H=this._def.keyType,Y=this._def.valueType,q=[...Q.data.entries()].map(([B,V],J)=>{return{key:H._parse(new m(Q,B,Q.path,[J,"key"])),value:Y._parse(new m(Q,V,Q.path,[J,"value"]))}});if(Q.common.async){let B=new Map;return Promise.resolve().then(async()=>{for(let V of q){let J=await V.key,N=await V.value;if(J.status==="aborted"||N.status==="aborted")return G;if(J.status==="dirty"||N.status==="dirty")_.dirty();B.set(J.value,N.value)}return{status:_.value,value:B}})}else{let B=new Map;for(let V of q){let{key:J,value:N}=V;if(J.status==="aborted"||N.status==="aborted")return G;if(J.status==="dirty"||N.status==="dirty")_.dirty();B.set(J.value,N.value)}return{status:_.value,value:B}}}}S$.create=($,_,Q)=>{return new S$({valueType:_,keyType:$,typeName:A.ZodMap,...M(Q)})};class _$ extends k{_parse($){let{status:_,ctx:Q}=this._processInputParams($);if(Q.parsedType!==K.set)return j(Q,{code:O.invalid_type,expected:K.set,received:Q.parsedType}),G;let H=this._def;if(H.minSize!==null){if(Q.data.size<H.minSize.value)j(Q,{code:O.too_small,minimum:H.minSize.value,type:"set",inclusive:!0,exact:!1,message:H.minSize.message}),_.dirty()}if(H.maxSize!==null){if(Q.data.size>H.maxSize.value)j(Q,{code:O.too_big,maximum:H.maxSize.value,type:"set",inclusive:!0,exact:!1,message:H.maxSize.message}),_.dirty()}let Y=this._def.valueType;function q(V){let J=new Set;for(let N of V){if(N.status==="aborted")return G;if(N.status==="dirty")_.dirty();J.add(N.value)}return{status:_.value,value:J}}let B=[...Q.data.values()].map((V,J)=>Y._parse(new m(Q,V,Q.path,J)));if(Q.common.async)return Promise.all(B).then((V)=>q(V));else return q(B)}min($,_){return new _$({...this._def,minSize:{value:$,message:D.toString(_)}})}max($,_){return new _$({...this._def,maxSize:{value:$,message:D.toString(_)}})}size($,_){return this.min($,_).max($,_)}nonempty($){return this.min(1,$)}}_$.create=($,_)=>{return new _$({valueType:$,minSize:null,maxSize:null,typeName:A.ZodSet,...M(_)})};class B$ extends k{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:_}=this._processInputParams($);if(_.parsedType!==K.function)return j(_,{code:O.invalid_type,expected:K.function,received:_.parsedType}),G;function Q(B,V){return F$({data:B,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,H$(),c].filter((J)=>!!J),issueData:{code:O.invalid_arguments,argumentsError:V}})}function H(B,V){return F$({data:B,path:_.path,errorMaps:[_.common.contextualErrorMap,_.schemaErrorMap,H$(),c].filter((J)=>!!J),issueData:{code:O.invalid_return_type,returnTypeError:V}})}let Y={errorMap:_.common.contextualErrorMap},q=_.data;if(this._def.returns instanceof Q$){let B=this;return b(async function(...V){let J=new z([]),N=await B._def.args.parseAsync(V,Y).catch((p$)=>{throw J.addIssue(Q(V,p$)),J}),I=await Reflect.apply(q,this,N);return await B._def.returns._def.type.parseAsync(I,Y).catch((p$)=>{throw J.addIssue(H(I,p$)),J})})}else{let B=this;return b(function(...V){let J=B._def.args.safeParse(V,Y);if(!J.success)throw new z([Q(V,J.error)]);let N=Reflect.apply(q,this,J.data),I=B._def.returns.safeParse(N,Y);if(!I.success)throw new z([H(N,I.error)]);return I.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new B$({...this._def,args:d.create($).rest(r.create())})}returns($){return new B$({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,_,Q){return new B$({args:$?$:d.create([]).rest(r.create()),returns:_||r.create(),typeName:A.ZodFunction,...M(Q)})}}class L$ extends k{get schema(){return this._def.getter()}_parse($){let{ctx:_}=this._processInputParams($);return this._def.getter()._parse({data:_.data,path:_.path,parent:_})}}L$.create=($,_)=>{return new L$({getter:$,typeName:A.ZodLazy,...M(_)})};class D$ extends k{_parse($){if($.data!==this._def.value){let _=this._getOrReturnCtx($);return j(_,{received:_.data,code:O.invalid_literal,expected:this._def.value}),G}return{status:"valid",value:$.data}}get value(){return this._def.value}}D$.create=($,_)=>{return new D$({value:$,typeName:A.ZodLiteral,...M(_)})};function M0($,_){return new t({values:$,typeName:A.ZodEnum,...M(_)})}class t extends k{_parse($){if(typeof $.data!=="string"){let _=this._getOrReturnCtx($),Q=this._def.values;return j(_,{expected:P.joinValues(Q),received:_.parsedType,code:O.invalid_type}),G}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let _=this._getOrReturnCtx($),Q=this._def.values;return j(_,{received:_.data,code:O.invalid_enum_value,options:Q}),G}return b($.data)}get options(){return this._def.values}get enum(){let $={};for(let _ of this._def.values)$[_]=_;return $}get Values(){let $={};for(let _ of this._def.values)$[_]=_;return $}get Enum(){let $={};for(let _ of this._def.values)$[_]=_;return $}extract($,_=this._def){return t.create($,{...this._def,..._})}exclude($,_=this._def){return t.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,..._})}}t.create=M0;class N$ extends k{_parse($){let _=P.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==K.string&&Q.parsedType!==K.number){let H=P.objectValues(_);return j(Q,{expected:P.joinValues(H),received:Q.parsedType,code:O.invalid_type}),G}if(!this._cache)this._cache=new Set(P.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let H=P.objectValues(_);return j(Q,{received:Q.data,code:O.invalid_enum_value,options:H}),G}return b($.data)}get enum(){return this._def.values}}N$.create=($,_)=>{return new N$({values:$,typeName:A.ZodNativeEnum,...M(_)})};class Q$ extends k{unwrap(){return this._def.type}_parse($){let{ctx:_}=this._processInputParams($);if(_.parsedType!==K.promise&&_.common.async===!1)return j(_,{code:O.invalid_type,expected:K.promise,received:_.parsedType}),G;let Q=_.parsedType===K.promise?_.data:Promise.resolve(_.data);return b(Q.then((H)=>{return this._def.type.parseAsync(H,{path:_.path,errorMap:_.common.contextualErrorMap})}))}}Q$.create=($,_)=>{return new Q$({type:$,typeName:A.ZodPromise,...M(_)})};class u extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:_,ctx:Q}=this._processInputParams($),H=this._def.effect||null,Y={addIssue:(q)=>{if(j(Q,q),q.fatal)_.abort();else _.dirty()},get path(){return Q.path}};if(Y.addIssue=Y.addIssue.bind(Y),H.type==="preprocess"){let q=H.transform(Q.data,Y);if(Q.common.async)return Promise.resolve(q).then(async(B)=>{if(_.value==="aborted")return G;let V=await this._def.schema._parseAsync({data:B,path:Q.path,parent:Q});if(V.status==="aborted")return G;if(V.status==="dirty")return e(V.value);if(_.value==="dirty")return e(V.value);return V});else{if(_.value==="aborted")return G;let B=this._def.schema._parseSync({data:q,path:Q.path,parent:Q});if(B.status==="aborted")return G;if(B.status==="dirty")return e(B.value);if(_.value==="dirty")return e(B.value);return B}}if(H.type==="refinement"){let q=(B)=>{let V=H.refinement(B,Y);if(Q.common.async)return Promise.resolve(V);if(V instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return B};if(Q.common.async===!1){let B=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(B.status==="aborted")return G;if(B.status==="dirty")_.dirty();return q(B.value),{status:_.value,value:B.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((B)=>{if(B.status==="aborted")return G;if(B.status==="dirty")_.dirty();return q(B.value).then(()=>{return{status:_.value,value:B.value}})})}if(H.type==="transform")if(Q.common.async===!1){let q=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!o(q))return G;let B=H.transform(q.value,Y);if(B instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:_.value,value:B}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((q)=>{if(!o(q))return G;return Promise.resolve(H.transform(q.value,Y)).then((B)=>({status:_.value,value:B}))});P.assertNever(H)}}u.create=($,_,Q)=>{return new u({schema:$,typeName:A.ZodEffects,effect:_,...M(Q)})};u.createWithPreprocess=($,_,Q)=>{return new u({schema:_,effect:{type:"preprocess",transform:$},typeName:A.ZodEffects,...M(Q)})};class g extends k{_parse($){if(this._getType($)===K.undefined)return b(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}g.create=($,_)=>{return new g({innerType:$,typeName:A.ZodOptional,...M(_)})};class n extends k{_parse($){if(this._getType($)===K.null)return b(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}n.create=($,_)=>{return new n({innerType:$,typeName:A.ZodNullable,...M(_)})};class G$ extends k{_parse($){let{ctx:_}=this._processInputParams($),Q=_.data;if(_.parsedType===K.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:_.path,parent:_})}removeDefault(){return this._def.innerType}}G$.create=($,_)=>{return new G$({innerType:$,typeName:A.ZodDefault,defaultValue:typeof _.default==="function"?_.default:()=>_.default,...M(_)})};class A$ extends k{_parse($){let{ctx:_}=this._processInputParams($),Q={..._,common:{..._.common,issues:[]}},H=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(W$(H))return H.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new z(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:H.status==="valid"?H.value:this._def.catchValue({get error(){return new z(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}A$.create=($,_)=>{return new A$({innerType:$,typeName:A.ZodCatch,catchValue:typeof _.catch==="function"?_.catch:()=>_.catch,...M(_)})};class I$ extends k{_parse($){if(this._getType($)!==K.nan){let Q=this._getOrReturnCtx($);return j(Q,{code:O.invalid_type,expected:K.nan,received:Q.parsedType}),G}return{status:"valid",value:$.data}}}I$.create=($)=>{return new I$({typeName:A.ZodNaN,...M($)})};var y1=Symbol("zod_brand");class y$ extends k{_parse($){let{ctx:_}=this._processInputParams($),Q=_.data;return this._def.type._parse({data:Q,path:_.path,parent:_})}unwrap(){return this._def.type}}class f$ extends k{_parse($){let{status:_,ctx:Q}=this._processInputParams($);if(Q.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(Y.status==="aborted")return G;if(Y.status==="dirty")return _.dirty(),e(Y.value);else return this._def.out._parseAsync({data:Y.value,path:Q.path,parent:Q})})();else{let H=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(H.status==="aborted")return G;if(H.status==="dirty")return _.dirty(),{status:"dirty",value:H.value};else return this._def.out._parseSync({data:H.value,path:Q.path,parent:Q})}}static create($,_){return new f$({in:$,out:_,typeName:A.ZodPipeline})}}class w$ extends k{_parse($){let _=this._def.innerType._parse($),Q=(H)=>{if(o(H))H.value=Object.freeze(H.value);return H};return W$(_)?_.then((H)=>Q(H)):Q(_)}unwrap(){return this._def.innerType}}w$.create=($,_)=>{return new w$({innerType:$,typeName:A.ZodReadonly,...M(_)})};function N0($,_){let Q=typeof $==="function"?$(_):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function k0($,_={},Q){if($)return X$.create().superRefine((H,Y)=>{let q=$(H);if(q instanceof Promise)return q.then((B)=>{if(!B){let V=N0(_,H),J=V.fatal??Q??!0;Y.addIssue({code:"custom",...V,fatal:J})}});if(!q){let B=N0(_,H),V=B.fatal??Q??!0;Y.addIssue({code:"custom",...B,fatal:V})}return});return X$.create()}var T1={object:S.lazycreate},A;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(A||(A={}));var h1=($,_={message:`Input not instance of ${$.name}`})=>k0((Q)=>Q instanceof $,_),F0=h.create,v0=s.create,x1=I$.create,g1=a.create,P0=V$.create,m1=$$.create,u1=v$.create,l1=O$.create,p1=J$.create,d1=X$.create,c1=r.create,i1=p.create,n1=P$.create,o1=x.create,r1=S.create,s1=S.strictCreate,a1=K$.create,t1=z$.create,e1=j$.create,$X=d.create,XX=E$.create,_X=S$.create,QX=_$.create,YX=B$.create,HX=L$.create,WX=D$.create,qX=t.create,BX=N$.create,VX=Q$.create,OX=u.create,JX=g.create,KX=n.create,jX=u.createWithPreprocess,LX=f$.create,DX=()=>F0().optional(),NX=()=>v0().optional(),GX=()=>P0().optional(),AX={string:($)=>h.create({...$,coerce:!0}),number:($)=>s.create({...$,coerce:!0}),boolean:($)=>V$.create({...$,coerce:!0}),bigint:($)=>a.create({...$,coerce:!0}),date:($)=>$$.create({...$,coerce:!0})};var wX=G;var v=X;var MX=["page_view","page_visibility","page_exit","page_load","core_web_vitals","form_submit","input_fill","input_select","input_radio","input_checkbox","input_range","click","scroll","video_play","video_pause","video_complete","user_active","user_inactive","purchase","error"],kX=X.enum(MX),T$=X.string().or(kX),FX=["api","ga","stripe"],vX=X.enum(FX),E0=X.object({event_id:X.string().uuid().optional(),event_name:T$,org_id:X.string(),app_id:X.string(),session_id:X.string().uuid(),user_id:X.string().optional(),server_key:X.string().optional().nullable(),data_source:vX.default("api"),properties:X.record(X.string(),X.any()),url:X.string().url().optional(),referrer:X.string().optional(),title:X.string().optional(),price:X.number().optional(),amount:X.number().optional(),currency:X.string().optional(),user_agent:X.string(),device_type:X.string(),browser:X.string(),os:X.string(),screen_width:X.number().int().optional(),screen_height:X.number().int().optional(),language:X.string().optional(),timestamp:X.string(),city:X.string().optional(),continent:X.string().optional(),country:X.string().optional(),latitude:X.number().optional(),longitude:X.number().optional(),postal_code:X.string().optional(),region:X.string().optional(),region_code:X.string().optional(),timezone:X.string().optional(),ip:X.string().optional(),error_message:X.string().optional(),error_details:X.string().optional(),error_source:X.string().optional(),error_filename:X.string().optional(),error_lineno:X.number().int().optional(),error_colno:X.number().int().optional()}),PX=X.object({name:T$,amount:X.number().optional(),currency:X.string().optional(),price:X.number().optional(),properties:X.record(X.any()).optional(),url:X.string().url().optional(),referrer:X.string().optional(),title:X.string().optional(),stack:X.string().optional(),source:X.string().optional(),lineno:X.number().int().optional(),colno:X.number().int().optional(),filename:X.string().optional(),message:X.string().optional(),additional:X.record(X.any()).optional(),context:X.record(X.any()).optional(),timestamp:X.string()}),S0=X.object({userAgent:X.string(),screenWidth:X.number().int().optional(),screenHeight:X.number().int().optional(),language:X.string().optional(),timezone:X.string().optional(),events:X.array(PX),location:X.object({city:X.string().optional(),continent:X.string().optional(),country:X.string().optional(),latitude:X.union([X.number(),X.string()]).optional(),longitude:X.union([X.number(),X.string()]).optional(),postalCode:X.string().optional(),region:X.string().optional(),regionCode:X.string().optional(),timezone:X.string().optional(),ip:X.string().optional()}).nullable().optional()});var o$=X.object({_id:X.string(),orgId:X.string(),userId:X.string(),role:X.enum(["owner","admin","member","viewer"]),createdAt:X.date()}),h$=X.array(o$);var r$=X.object({_id:X.string(),name:X.string(),slug:X.string(),onboarded:X.record(X.string(),X.boolean()),createdAt:X.date()}),x$=X.array(r$);var s$=X.object({id:X.string(),name:X.string(),email:X.string().email(),image:X.string().url(),emailVerified:X.boolean(),createdAt:X.date(),updatedAt:X.date(),role:X.enum(["user","admin"]).default("user"),city:X.string().optional(),country:X.string().optional(),regionCode:X.string().optional(),zip:X.string().optional(),userAgent:X.string().optional(),ip:X.string().optional(),fbClickId:X.string().optional(),fbBrowserId:X.string().optional(),stripeCustomerId:X.string().optional(),sid:X.string().optional()}),y8=X.object({createdAt:X.date(),expiresAt:X.date(),id:X.string(),ipAddress:X.string(),token:X.string(),updatedAt:X.date(),userAgent:X.string(),userId:X.string()}),I0=X.array(s$);var f0=X.object({organizations:x$,members:h$});var EX=X.object({input:X.number().positive().describe("Cost per million input tokens"),output:X.number().positive().describe("Cost per million output tokens")}),SX=X.enum(["anthropic","openai","xai"]),IX=X.enum(["basic","standard","complex"]),fX=X.object({order:X.number().int().positive().describe("Model priority order"),provider:SX,name:X.string().min(1).describe("Model name identifier"),complexity:IX,cost:EX,description:X.string().optional().describe("Model description"),tools:X.array(X.string()).optional().describe("Model tools")}),l8=X.array(fX);var ZX=X.object({id:X.string(),_id:X.string(),name:X.string(),start:X.string().optional(),prefix:X.string().optional(),enabled:X.boolean().default(!0),createdAt:X.string(),updatedAt:X.string(),expiresAt:X.string().nullable(),lastRequest:X.string().nullable(),lastRefillAt:X.string().nullable(),key:X.string().optional(),userId:X.string(),metadata:X.record(X.any()),permissions:X.record(X.array(X.string())),rateLimitEnabled:X.boolean(),rateLimitMax:X.number(),rateLimitTimeWindow:X.number(),refillAmount:X.number().nullable(),refillInterval:X.number().nullable(),remaining:X.number().nullable(),requestCount:X.number()}),c8=X.object({name:X.string()}),i8=X.object({keyId:X.string(),name:X.string().optional(),enabled:X.boolean().optional()}),n8=X.object({keyId:X.string()}),o8=ZX.pick({id:!0,name:!0,key:!0,start:!0,prefix:!0,enabled:!0,createdAt:!0,updatedAt:!0});var a$=X.object({_id:X.string(),name:X.string().min(1,"Name is required"),url:X.string().url("Please provide a valid URL"),orgId:X.string(),createdAt:X.date(),updatedAt:X.date(),currencyCode:X.string().length(3).optional(),conversionPrice:X.number().positive().optional(),lastImportSummary:X.string().optional()}),a8=a$.omit({_id:!0,createdAt:!0,updatedAt:!0}),t8=X.object({orgId:X.string(),name:X.string().min(1,"Name is required"),url:X.string().url("Please provide a valid URL"),currencyCode:X.string().length(3).optional(),conversionPrice:X.number().positive().optional()}),e8=a$.omit({_id:!0,orgId:!0,createdAt:!0,updatedAt:!0}),$_=a$.omit({_id:!0,orgId:!0,createdAt:!0,updatedAt:!0}),X_=X.object({hasActiveIntegrations:X.boolean(),hasEvents:X.boolean(),integrations:X.object({googleAnalytics:X.boolean(),stripe:X.boolean()}),totalEvents:X.number()});var UX=X.object({provider:X.enum(["openai","anthropic","xai"]),name:X.string(),type:X.enum(["fast","smart"]),inputTokens:X.number(),outputTokens:X.number(),totalTokens:X.number(),totalDuration:X.number(),thinkingDuration:X.number(),inputCost:X.number(),outputCost:X.number(),totalCost:X.number()}),t$=X.object({_id:X.string(),chatId:X.string(),orgId:X.string(),appId:X.string(),userId:X.string(),content:X.string(),role:X.enum(["user","assistant"]),model:UX.optional(),replyToMessageId:X.string().optional(),createdAt:X.date(),updatedAt:X.date()}),Y_=t$.omit({_id:!0,orgId:!0,appId:!0,userId:!0,createdAt:!0,updatedAt:!0}).extend({modelName:X.string().optional(),segmentId:X.string().optional()}),H_=t$.pick({content:!0,role:!0,chatId:!0,orgId:!0,appId:!0,userId:!0,model:!0,replyToMessageId:!0}),W_=t$.extend({type:X.enum(["text","image","error"])});var V_=X.object({_id:X.string(),orgId:X.string(),appId:X.string(),chatId:X.string(),userId:X.string(),messageId:X.string(),vote:X.enum(["up","down"]),reason:X.string().optional(),createdAt:X.date(),updatedAt:X.date()});var CX=X.object({name:X.string(),type:X.string(),defaultType:X.string().optional(),defaultExpression:X.string().optional(),comment:X.string().optional()}),bX=X.object({name:X.string(),database:X.string(),engine:X.string(),columns:X.array(CX)}),K_=X.array(bX);var D_=v.object({activeUsers:v.number(),pageViews:v.number(),revenue:v.number(),sessions:v.number(),totalEvents:v.number()}),N_=v.object({revenue:v.number().default(0),pageViews:v.number().default(0),totalEvents:v.number().default(0),activeUsers:v.number().default(0),conversions:v.number().optional(),conversionRate:v.number().optional(),sessions:v.number().optional(),eventsImported:v.number().optional(),avgSessionDuration:v.number().optional(),bounceRate:v.number().optional(),newUsers:v.number().optional(),returningUsers:v.number().optional(),topTrafficSource:v.string().optional(),avgOrderValue:v.number().optional(),topConvertingPage:v.string().optional()}),G_=v.object({period:v.enum(["today","last_7_days","last_30_days","last_3_months"]).default("last_30_days"),timezone:v.string().default("UTC")}),A_=v.object({appId:v.string(),name:v.string(),domain:v.string(),visitors:v.number(),pageviews:v.number(),revenue:v.number(),conversionRate:v.number(),bounceRate:v.number(),visitorData:v.array(v.object({visitors:v.number()}))});var RX=X.object({integrationId:X.string(),orgId:X.string(),appId:X.string(),displayName:X.string(),jobType:X.literal("coordinator"),totalPages:X.number().optional(),pageSize:X.number().default(1000),dateRange:X.object({startDate:X.string(),endDate:X.string()}).optional()}),zX=X.object({integrationId:X.string(),orgId:X.string(),appId:X.string(),displayName:X.string(),jobType:X.literal("ingestion"),page:X.number(),pageSize:X.number(),totalPages:X.number(),coordinatorJobId:X.string(),dateRange:X.object({startDate:X.string(),endDate:X.string()}),offset:X.number(),limit:X.number()}),yX=X.object({propertyId:X.string(),displayName:X.string(),name:X.string(),parent:X.string(),websiteUrl:X.string().optional(),timeZone:X.string().optional(),createTime:X.string().optional(),updateTime:X.string().optional()}),TX=X.object({accountId:X.string(),displayName:X.string(),name:X.string(),createTime:X.string().optional(),updateTime:X.string().optional(),regionCode:X.string().optional()}),U0=X.object({_id:X.string(),appId:X.string(),orgId:X.string(),propertyId:X.string(),accountId:X.string(),displayName:X.string(),timeZone:X.string().optional().default("America/New_York"),importPurchaseEvents:X.boolean().default(!1),conversionPrice:X.number().positive().optional(),conversionCurrency:X.string().length(3).optional(),useSmartPurchaseDetection:X.boolean().optional(),isActive:X.boolean().default(!0),lastImportStartDate:X.string().optional(),lastImportEndDate:X.string().optional(),isImporting:X.boolean().default(!1),createdAt:X.date(),updatedAt:X.date()}),k_=X.object({appName:X.string().min(1,"App name is required"),appUrl:X.string().min(1,"App URL is required"),propertyId:X.string().min(1,"Property ID is required"),accountId:X.string().min(1,"Account ID is required"),displayName:X.string().min(1,"Display name is required"),timeZone:X.string().min(1,"Time zone is required").optional(),importPurchaseEvents:X.boolean().default(!1),conversionPrice:X.number().positive().optional(),conversionCurrency:X.string().length(3).optional(),useSmartPurchaseDetection:X.boolean().optional()}),F_=U0.omit({_id:!0,createdAt:!0,updatedAt:!0}).partial({lastImportStartDate:!0,lastImportEndDate:!0,isImporting:!0}),v_=U0.omit({_id:!0,appId:!0,orgId:!0,createdAt:!0,updatedAt:!0}).partial(),hX=yX.extend({account:TX}),P_=X.object({properties:X.array(hX),accountId:X.string()}),E_=X.object({sessionId:X.string(),userId:X.string(),orgId:X.string(),propertyId:X.string(),appId:X.string().optional(),status:X.enum(["pending","in_progress","completed","failed"]),error:X.string().optional(),summary:X.object({activeUsers:X.number(),pageViews:X.number(),sessions:X.number(),eventsImported:X.number(),revenue:X.number(),conversions:X.number(),avgSessionDuration:X.number(),bounceRate:X.number(),newUsers:X.number(),returningUsers:X.number(),topTrafficSource:X.string(),conversionRate:X.number(),avgOrderValue:X.number(),topConvertingPage:X.string()}).optional(),createdAt:X.date(),updatedAt:X.date()}),xX=X.enum(["coordinator","ingestion"]),C0=X.enum(["waiting","active","completed","failed","delayed","paused"]),S_=X.discriminatedUnion("jobType",[RX,zX]),gX=X.object({jobId:X.string(),integrationId:X.string(),jobType:xX,status:C0,progress:X.object({current:X.number(),total:X.number(),percentage:X.number()}),data:X.object({eventsImported:X.number(),page:X.number().optional(),totalPages:X.number().optional(),coordinatorJobId:X.string().optional(),startTime:X.date().optional(),endTime:X.date().optional(),error:X.string().optional()}),createdAt:X.date(),updatedAt:X.date()}),I_=X.object({integrationId:X.string(),status:X.enum(["not_started","in_progress","completed","failed","partial"]),progress:X.object({totalJobs:X.number(),completedJobs:X.number(),failedJobs:X.number(),pendingJobs:X.number(),percentage:X.number()}),coordinator:X.object({jobId:X.string(),status:C0,progress:X.object({current:X.number(),total:X.number(),percentage:X.number()}),phase:X.enum(["creating_jobs","monitoring_ingestion","completed","waiting","active","failed","delayed","paused"]),createdAt:X.date(),updatedAt:X.date()}).nullable(),summary:X.object({totalEventsImported:X.number(),startTime:X.date().optional(),estimatedEndTime:X.date().optional(),lastUpdated:X.date()}),jobs:X.array(gX)}),f_=X.object({gaEventName:X.string(),userpathEventName:X.string(),description:X.string(),requiresEcommerce:X.boolean().default(!1),propertyMappings:X.record(X.string()).optional()}),Z_=X.object({activeUsers:X.number(),pageViews:X.number(),sessions:X.number(),bounceRate:X.number(),usersByCountry:X.array(X.object({country:X.string(),users:X.number()})),topPages:X.array(X.object({page:X.string(),views:X.number()})),trafficSources:X.array(X.object({source:X.string(),users:X.number()})),deviceTypes:X.array(X.object({device:X.string(),users:X.number()})),dailyMetrics:X.array(X.object({date:X.string(),users:X.number(),sessions:X.number()})),conversions:X.array(X.object({event:X.string(),count:X.number()}))});var lX;((Z0)=>{let $;((mX)=>{let Q;((I)=>{I.MATCH_TYPE_UNSPECIFIED="MATCH_TYPE_UNSPECIFIED";I.EXACT="EXACT";I.BEGINS_WITH="BEGINS_WITH";I.ENDS_WITH="ENDS_WITH";I.CONTAINS="CONTAINS";I.FULL_REGEXP="FULL_REGEXP";I.PARTIAL_REGEXP="PARTIAL_REGEXP"})(Q=mX.MatchType||={})})($=Z0.StringFilter||={});let _;((uX)=>{let Q;((N)=>{N.OPERATION_UNSPECIFIED="OPERATION_UNSPECIFIED";N.EQUAL="EQUAL";N.LESS_THAN="LESS_THAN";N.LESS_THAN_OR_EQUAL="LESS_THAN_OR_EQUAL";N.GREATER_THAN="GREATER_THAN";N.GREATER_THAN_OR_EQUAL="GREATER_THAN_OR_EQUAL"})(Q=uX.Operation||={})})(_=Z0.NumericFilter||={})})(lX||={});var cX;((dX)=>{let $;((pX)=>{let _;((B)=>{B.ORDER_TYPE_UNSPECIFIED="ORDER_TYPE_UNSPECIFIED";B.ALPHANUMERIC="ALPHANUMERIC";B.CASE_INSENSITIVE_ALPHANUMERIC="CASE_INSENSITIVE_ALPHANUMERIC";B.NUMERIC="NUMERIC"})(_=pX.OrderType||={})})($=dX.DimensionOrderBy||={})})(cX||={});var nX;((iX)=>{let $;((q)=>{q.GRANULARITY_UNSPECIFIED="GRANULARITY_UNSPECIFIED";q.DAILY="DAILY";q.WEEKLY="WEEKLY";q.MONTHLY="MONTHLY"})($=iX.Granularity||={})})(nX||={});var b_=X.object({goalId:X.string(),goalName:X.string(),eventNames:X.array(X.string()),period:X.string(),metrics:X.object({totalConversions:X.number(),uniqueSessions:X.number(),uniqueUsers:X.number(),conversionRate:X.number(),totalRevenue:X.number(),averageOrderValue:X.number(),revenuePerVisitor:X.number()}),timeSeries:X.array(X.object({date:X.string(),conversions:X.number(),sessions:X.number(),conversionRate:X.number(),revenue:X.number()})),topEvents:X.array(X.object({eventName:X.string(),conversions:X.number(),conversionRate:X.number(),revenue:X.number()})),trend:X.object({change:X.number(),direction:X.enum(["up","down","stable"])})}),R_=X.object({goalId:X.string(),goalName:X.string(),period:X.string(),funnelSteps:X.array(X.object({step:X.string(),stepNumber:X.number(),sessions:X.number(),conversionRate:X.number(),dropOffRate:X.number()})),totalSessions:X.number(),totalConversions:X.number(),overallConversionRate:X.number()}),z_=X.object({goalId:X.string(),goalName:X.string(),period:X.string(),totalRevenue:X.number(),totalConversions:X.number(),averageOrderValue:X.number(),revenuePerVisitor:X.number(),revenueByEvent:X.array(X.object({eventName:X.string(),revenue:X.number(),conversions:X.number(),averageOrderValue:X.number(),percentage:X.number()})),revenueTimeSeries:X.array(X.object({date:X.string(),revenue:X.number(),conversions:X.number(),averageOrderValue:X.number()}))}),y_=X.object({period:X.string(),totalGoals:X.number(),goals:X.array(X.object({goalId:X.string(),goalName:X.string(),eventNames:X.array(X.string()),conversions:X.number(),conversionRate:X.number(),revenue:X.number(),averageOrderValue:X.number(),revenuePerVisitor:X.number(),trend:X.object({change:X.number(),direction:X.enum(["up","down","stable"])})})),aggregated:X.object({totalConversions:X.number(),totalRevenue:X.number(),avgConversionRate:X.number(),avgRevenuePerVisitor:X.number()})}),T_=X.object({period:X.string(),totalGoals:X.number(),goalsNeedingAttention:X.array(X.object({goalId:X.string(),goalName:X.string(),eventNames:X.array(X.string()),issueType:X.enum(["no_conversions","low_conversion_rate","low_activity","no_data"]),issueDescription:X.string(),metrics:X.object({conversions:X.number(),conversionRate:X.number(),sessions:X.number(),revenue:X.number()}),recommendations:X.array(X.string()),severity:X.enum(["critical","warning","info"])})),trafficAnalysis:X.object({totalSessions:X.number(),sessionsWithGoalEvents:X.number(),goalEventCoverage:X.number(),commonIssues:X.array(X.object({issue:X.string(),description:X.string(),affectedGoals:X.number(),recommendation:X.string()}))}),implementationHealth:X.object({eventTrackingStatus:X.array(X.object({eventName:X.string(),isActive:X.boolean(),lastSeen:X.string().optional(),frequency:X.number()})),dataQualityIssues:X.array(X.object({issue:X.string(),description:X.string(),severity:X.enum(["critical","warning","info"]),affectedGoals:X.array(X.string())}))})});var oX=($)=>{if(!$||$.trim()==="")throw new Error("Regex pattern cannot be empty");let _=[/\(\?\#.*?\)/,/\(\?\{.*?\}\)/,/\(\?\<.*?\>.*?\)/,/\\[kKgG]/,/\(\?\<=/,/\(\?\<!/];for(let H of _)if(H.test($))throw new Error("Regex pattern contains features not supported by RE2 (ClickHouse)");if($.length>500)throw new Error("Regex pattern is too long (max 500 characters)");if(($.match(/[*+?{]/g)||[]).length>20)throw new Error("Regex pattern has too many quantifiers (potential performance issue)");try{return new RegExp($),!0}catch(H){throw new Error(`Invalid regex pattern: ${H instanceof Error?H.message:"Unknown error"}`)}},rX=($,_)=>{if(["gt","gte","lt","lte"].includes(_)){if(!$.includes(":"))throw new Error(`Properties field with '${_}' operator requires 'key:value' format`);let[Q,H]=$.split(":",2);if(!Q||!H)throw new Error("Property key:value format requires both key and value parts");if(isNaN(parseFloat(H)))throw new Error(`Property value '${H}' must be numeric for '${_}' operator`)}if(_==="equals"&&$.includes(":")){let[Q,H]=$.split(":",2);if(!Q||H===void 0)throw new Error("Property key:value format requires both key and value parts")}return!0},Y$=($)=>{return $.replace(/['"]/g,"").replace(/[;]/g,"").replace(/--/g,"").trim()},sX=X.object({key:X.string().min(1,"Property key cannot be empty"),operator:X.enum(["equals","gt","gte","lt","lte"]),value:X.string().min(1,"Property value cannot be empty")}),b0=X.object({field:X.enum(["url","properties","country","device_type","browser"]),operator:X.enum(["equals","contains","starts_with","ends_with","regex","gt","gte","lt","lte","in","not_in","multi_property"]),value:X.union([X.string().min(1,"Condition value cannot be empty").transform(Y$),X.number(),X.array(X.string().min(1,"Array items cannot be empty")).min(1,"Array cannot be empty for in/not_in operators").max(100,"Array cannot have more than 100 items (performance limit)"),X.array(sX).min(1,"Multi-property rules cannot be empty").max(10,"Cannot have more than 10 property rules (performance limit)")]),eventIndex:X.number().int().min(0,"Event index must be non-negative").optional()}).superRefine(($,_)=>{if($.operator==="regex"&&typeof $.value==="string")try{oX($.value)}catch(Q){_.addIssue({code:X.ZodIssueCode.custom,message:Q instanceof Error?Q.message:"Invalid regex pattern",path:["value"]})}if($.field==="properties"&&typeof $.value==="string"&&["gt","gte","lt","lte","equals"].includes($.operator))try{rX($.value,$.operator)}catch(Q){_.addIssue({code:X.ZodIssueCode.custom,message:Q instanceof Error?Q.message:"Invalid property format",path:["value"]})}if(["in","not_in"].includes($.operator)&&!Array.isArray($.value))_.addIssue({code:X.ZodIssueCode.custom,message:"Value for in/not_in operators must be an array",path:["value"]});if($.operator==="multi_property"&&!Array.isArray($.value))_.addIssue({code:X.ZodIssueCode.custom,message:"Value for multi_property operator must be an array of PropertyRule objects",path:["value"]})}),R0=X.object({timeWindow:X.enum(["1_hour","24_hours","7_days","30_days"]).default("24_hours"),allowRepeatedSteps:X.boolean().default(!1),maxStepInterval:X.number().int("Max step interval must be an integer").min(1,"Max step interval must be at least 1 second").max(604800,"Max step interval cannot exceed 7 days (604800 seconds)").default(3600)}),aX=X.object({_id:X.string(),name:X.string().min(1,"Goal name is required").max(100,"Goal name cannot exceed 100 characters").transform(Y$),description:X.string().max(500,"Description cannot exceed 500 characters").transform(Y$).optional(),orgId:X.string().min(1,"Organization ID is required"),appId:X.string().min(1,"App ID is required"),eventNames:X.array(X.string().min(1,"Event name cannot be empty").max(50,"Event name cannot exceed 50 characters").transform(Y$)).min(1,"At least one event name is required").max(10,"Cannot have more than 10 events in a funnel (performance limit)"),createdAt:X.date(),updatedAt:X.date()}),g_=aX.extend({conditions:X.array(b0).max(20,"Cannot have more than 20 conditions (performance limit)").optional(),funnelSettings:R0.optional()}).superRefine(($,_)=>{if($.funnelSettings&&$.eventNames.length<=1)_.addIssue({code:X.ZodIssueCode.custom,message:"Funnel settings can only be applied to multi-step goals (2+ events)",path:["funnelSettings"]});if($.conditions)for(let Q=0;Q<$.conditions.length;Q++){let H=$.conditions[Q];if(H.eventIndex!==void 0&&(H.eventIndex<0||H.eventIndex>=$.eventNames.length))_.addIssue({code:X.ZodIssueCode.custom,message:`Event index ${H.eventIndex} is out of bounds. Must be between 0 and ${$.eventNames.length-1}`,path:["conditions",Q,"eventIndex"]})}}),g$=X.object({_id:X.string(),name:X.string().min(1,"Goal name is required").max(100,"Goal name cannot exceed 100 characters").transform(Y$),description:X.string().max(500,"Description cannot exceed 500 characters").transform(Y$).optional(),orgId:X.string().min(1,"Organization ID is required"),appId:X.string().min(1,"App ID is required"),eventNames:X.array(X.string().min(1,"Event name cannot be empty").max(50,"Event name cannot exceed 50 characters").transform(Y$)).min(1,"At least one event name is required").max(10,"Cannot have more than 10 events in a funnel (performance limit)"),createdAt:X.date(),updatedAt:X.date()}),e$=g$.extend({conditions:X.array(b0).max(20,"Cannot have more than 20 conditions (performance limit)").optional(),funnelSettings:R0.optional()}),m_=g$.omit({_id:!0,createdAt:!0,updatedAt:!0}),u_=e$.omit({_id:!0,createdAt:!0,updatedAt:!0}),l_=g$.omit({_id:!0,orgId:!0,createdAt:!0,updatedAt:!0}),p_=e$.omit({_id:!0,orgId:!0,createdAt:!0,updatedAt:!0}),d_=g$.omit({_id:!0,orgId:!0,appId:!0,createdAt:!0,updatedAt:!0}).partial(),c_=e$.omit({_id:!0,orgId:!0,appId:!0,createdAt:!0,updatedAt:!0}).partial();var z0=X.enum(["page_view","page_visibility","page_exit","form_submit","input_fill","input_select","input_radio","input_checkbox","input_range","click","scroll","video_play","video_pause","video_complete","user_active","user_inactive","purchase","error","identity","default"]),tX=X.object({event_name:T$,event_icon:z0.default("default"),description:X.string(),details:X.string().optional(),timestamp:X.string(),url:X.string(),referrer:X.string(),properties:X.string().optional(),timeSinceLastEvent:X.string().nullable().optional(),country:X.string().optional(),city:X.string().optional()}),eX=X.object({journeyId:X.string().uuid(),userId:X.string().uuid(),userEmail:X.string().email().optional(),userName:X.string().optional(),firstTouch:X.string(),lastTouch:X.string(),daysToConversion:X.number().int(),conversionRevenue:X.number(),isConverted:X.boolean(),referrerPath:X.string(),urlPath:X.string(),events:X.array(tX),totalDuration:X.string().optional(),lastSeen:X.string().optional()}),$6=X.object({index:X.number().int(),event_icon:z0.default("default"),description:X.string(),details:X.string().optional(),timestamp:X.string().nullable(),timeSinceLastEvent:X.string().nullable().optional(),url:X.string().optional()}),r_=X.object({success:X.boolean(),error:X.string().optional(),journey:eX.optional(),simplifiedJourney:X.array($6).optional()});var X6=X.object({name:X.literal("clickhouse-run-query"),arguments:X.object({query:X.string().describe("SQL query to execute")})}).describe("Execute a SQL query on ClickHouse"),_6=X.object({name:X.literal("clickhouse-list-tables"),arguments:X.object({database:X.string().optional()})}).describe("List all tables in ClickHouse"),Q6=X.object({name:X.literal("clickhouse-describe-table"),arguments:X.object({table_name:X.string(),database:X.string().optional()})}).describe("Get schema information for a table"),Y6=X.object({name:X.literal("clickhouse-list-databases"),arguments:X.object({})}).describe("List all databases in ClickHouse"),H6=X.object({name:X.literal("clickhouse-describe-database"),arguments:X.object({database_name:X.string()})}).describe("Get schema information for a database"),W6=X.object({name:X.literal("clickhouse-list-columns"),arguments:X.object({table_name:X.string(),database:X.string().optional()})}).describe("List all columns in a table"),q6=X.object({name:X.literal("plot-chart"),arguments:X.object({chartType:X.enum(["bar","line","pie","scatter","area"]).describe("Type of chart to plot"),data:X.string().describe("JSON string containing the chart data in the needed format for Recharts to render the chart."),title:X.string().optional().describe("Chart title"),xAxis:X.string().optional().describe("X-axis field name (for applicable chart types)"),yAxis:X.string().optional().describe("Y-axis field name (for applicable chart types)"),options:X.string().optional().describe("Additional chart options as JSON string")})}).describe("Generate interactive React charts using the npm library recharts 2.x"),B6=X.object({name:X.literal("get-sitemap"),arguments:X.object({appId:X.string().describe("The app ID to get the sitemap for")})}).describe("Get the sitemap and useful stats for a given app. Returned data includes: url, visitCount, lastVisitAt, title and uniqueVisitors."),V6=X.object({name:X.literal("mongodb-find"),arguments:X.object({collection:X.string().describe("Collection name to query"),filter:X.string().optional().describe("MongoDB filter as JSON string (default: {})"),options:X.string().optional().describe("MongoDB find options as JSON string"),database:X.string().optional().describe("Database name (defaults to current database)")})}).describe("Execute a find query on MongoDB"),O6=X.object({name:X.literal("mongodb-aggregate"),arguments:X.object({collection:X.string().describe("Collection name to query"),pipeline:X.string().describe("MongoDB aggregation pipeline as JSON string"),database:X.string().optional().describe("Database name (defaults to current database)")})}).describe("Execute an aggregation pipeline on MongoDB"),J6=X.object({name:X.literal("mongodb-list-collections"),arguments:X.object({database:X.string().optional().describe("Database name (defaults to current database)")})}).describe("List all collections in MongoDB database"),K6=X.object({name:X.literal("mongodb-list-databases"),arguments:X.object({})}).describe("List all databases in MongoDB"),j6=X.object({name:X.literal("mongodb-describe-collection"),arguments:X.object({collection:X.string().describe("Collection name to describe"),database:X.string().optional().describe("Database name (defaults to current database)")})}).describe("Get schema information for a MongoDB collection"),L6=X.object({name:X.literal("mongodb-count"),arguments:X.object({collection:X.string().describe("Collection name to count"),filter:X.string().optional().describe("MongoDB filter as JSON string (default: {})"),database:X.string().optional().describe("Database name (defaults to current database)")})}).describe("Count documents in a MongoDB collection"),D6=X.object({name:X.literal("mongodb-insert"),arguments:X.object({operation:X.enum(["insert","update","upsert"]).describe("Type of operation: insert, update, or upsert"),document:X.string().describe("Document to insert or update as JSON string"),filter:X.string().optional().describe("Filter for update/upsert operations as JSON string"),database:X.string().optional().describe("Database name (defaults to current database)")})}).describe("Insert or update documents in the goals collection (restricted access)"),N6=X.object({name:X.literal("mongodb-update"),arguments:X.object({operation:X.enum(["update"]),document:X.string(),filter:X.string().optional(),database:X.string().optional()})}),t_=X.discriminatedUnion("name",[X6,_6,Q6,Y6,H6,W6,q6,B6,V6,O6,J6,K6,j6,L6,D6,N6]);var G6=["LCP","FID","CLS"],A6=["good","needs-improvement","poor"];var y0=X.object({metric:X.enum(G6),value:X.number().positive().describe("Metric value in appropriate units (ms for LCP/FID, score for CLS)"),rating:X.enum(A6).describe("Performance rating based on Google Web Vitals thresholds")}),T0=X.object({page_load_time:X.number().nonnegative().describe("Total page load time (loadEventEnd - navigationStart)"),dom_content_loaded_time:X.number().nonnegative().describe("Time when DOMContentLoaded event fired"),time_to_first_byte:X.number().nonnegative().describe("Time to First Byte (TTFB) - server response time"),dom_interactive_time:X.number().nonnegative().describe("Time when DOM becomes interactive"),connect_time:X.number().nonnegative().describe("Time spent establishing connection to server"),dns_lookup_time:X.number().nonnegative().describe("Time spent in DNS resolution"),navigation_type:X.number().int().min(0).max(255).describe("Type of navigation (0=navigate, 1=reload, 2=back_forward, 255=reserved)"),redirect_count:X.number().int().nonnegative().describe("Number of redirects that occurred before reaching the page")}),XQ=X.union([y0,T0]);var w6=X.object({name:X.literal("core_web_vitals"),properties:y0,timestamp:X.string().datetime()}),M6=X.object({name:X.literal("page_load"),properties:T0,timestamp:X.string().datetime()}),_Q=X.union([w6,M6]);var T=X.object({direction:X.enum(["up","down","neutral"]),percentage:X.number().min(0)}),k6=X.object({metric:X.enum(["LCP","FID","CLS"]),value:X.number(),rating:X.enum(["good","needs-improvement","poor"]),date:X.string(),url:X.string().optional()}),F6=X.object({page_load_time:X.number(),dom_content_loaded_time:X.number(),time_to_first_byte:X.number(),dom_interactive_time:X.number(),connect_time:X.number(),dns_lookup_time:X.number(),navigation_type:X.number(),redirect_count:X.number(),date:X.string(),url:X.string().optional()}),v6=X.object({avgLCP:T,avgFID:T,avgCLS:T,goodLCPPercent:T,goodFIDPercent:T,goodCLSPercent:T,totalMeasurements:T}),QQ=X.object({avgLCP:X.number(),avgFID:X.number(),avgCLS:X.number(),avgPageLoadTime:X.number(),avgTTFB:X.number(),goodLCPPercent:X.number(),goodFIDPercent:X.number(),goodCLSPercent:X.number(),totalMeasurements:X.number(),trends:v6,previousPeriod:X.object({avgLCP:X.number(),avgFID:X.number(),avgCLS:X.number(),avgPageLoadTime:X.number(),avgTTFB:X.number(),goodLCPPercent:X.number(),goodFIDPercent:X.number(),goodCLSPercent:X.number(),totalMeasurements:X.number()})}),P6=X.object({coreWebVitals:X.array(k6),pageLoads:X.array(F6)}),E6=X.object({url:X.string(),pageTitle:X.string().optional(),avgLCP:X.number(),avgFID:X.number(),avgCLS:X.number(),goodLCPPercent:X.number(),goodFIDPercent:X.number(),goodCLSPercent:X.number(),avgPageLoadTime:X.number(),avgTTFB:X.number(),measurements:X.number(),visitors:X.number(),trends:X.object({avgLCP:T,avgFID:T,avgCLS:T,avgPageLoadTime:T,avgTTFB:T,visitors:T})}),YQ=X.object({pages:X.array(E6),totalPages:X.number()}),S6=X.object({affectedPages:X.number().optional(),avgValue:X.number().optional(),threshold:X.number().optional(),poorCount:X.number().optional(),pages:X.array(X.object({url:X.string(),value:X.number().optional(),loadTime:X.number().optional()})).optional(),errorCount:X.number().optional(),errorTypes:X.number().optional(),topErrors:X.array(X.string()).optional(),browser:X.string().optional(),issueCount:X.number().optional(),metrics:X.array(X.object({metric:X.string(),value:X.number()})).optional(),totalMeasurements:X.number().optional(),avgLoadTime:X.number().optional(),avgLCP:X.number().optional(),avgFID:X.number().optional(),avgCLS:X.number().optional()}),I6=X.object({id:X.string(),title:X.string(),description:X.string(),impact:X.enum(["high","medium","low"]),category:X.enum(["lcp","fid","cls","general"]),priority:X.number(),evidence:S6}),f6=X.object({totalMeasurements:X.number(),problemPages:X.number(),errorPatterns:X.number(),slowPages:X.number(),avgLCP:X.number(),avgFID:X.number(),avgCLS:X.number()}),HQ=X.object({recommendations:X.array(I6),analysis:f6}),WQ=X.object({url:X.string(),metrics:X.object({avgLCP:X.number(),avgFID:X.number(),avgCLS:X.number(),goodLCPPercent:X.number(),goodFIDPercent:X.number(),goodCLSPercent:X.number(),avgPageLoadTime:X.number(),avgTTFB:X.number(),visitors:X.number(),measurements:X.number(),totalMeasurements:X.number()}),trends:P6});var Z6=X.enum(["pathname"]),U6=X.enum(["equals","contains","startsWith","endsWith"]),$0=X.object({field:Z6,operator:U6,value:X.union([X.string(),X.array(X.string()),X.number()])}),VQ=X.object({_id:X.string(),name:X.string().min(1,"Name is required"),description:X.string().optional(),conditions:X.array($0),appId:X.string(),orgId:X.string(),createdAt:X.date(),updatedAt:X.date()}),OQ=X.object({name:X.string().min(1,"Name is required"),description:X.string().optional(),conditions:X.array($0).min(1,"At least one condition is required")}),JQ=X.object({name:X.string().min(1,"Name is required").optional(),description:X.string().optional(),conditions:X.array($0).min(1,"At least one condition is required").optional()}),KQ=X.object({isValid:X.boolean(),errors:X.array(X.string())}),jQ=X.object({count:X.number(),preview:X.array(X.any())});var NQ=X.object({id:X.string(),object:X.literal("payment_intent"),amount:X.number(),currency:X.string(),status:X.enum(["succeeded","processing","requires_payment_method","requires_confirmation","requires_action","requires_capture","canceled"]),created:X.number(),customer:X.string().nullable(),description:X.string().nullable(),metadata:X.record(X.string()).default({}),receipt_email:X.string().nullable(),payment_method_types:X.array(X.string()),shipping:X.object({address:X.object({city:X.string().nullable(),country:X.string().nullable(),line1:X.string().nullable(),line2:X.string().nullable(),postal_code:X.string().nullable(),state:X.string().nullable()}).nullable(),name:X.string().nullable(),phone:X.string().nullable()}).nullable(),latest_charge:X.string().nullable()}),GQ=X.object({id:X.string(),billing_details:X.object({address:X.object({city:X.string().nullable(),country:X.string().nullable(),line1:X.string().nullable(),line2:X.string().nullable(),postal_code:X.string().nullable(),state:X.string().nullable()}).nullable(),email:X.string().nullable(),name:X.string().nullable(),phone:X.string().nullable()}),payment_method_details:X.object({card:X.object({brand:X.string().nullable(),country:X.string().nullable(),funding:X.string().nullable(),last4:X.string().nullable()}).nullable()}).nullable()}),AQ=X.object({id:X.string(),email:X.string().nullable(),name:X.string().nullable(),phone:X.string().nullable(),address:X.object({city:X.string().nullable(),country:X.string().nullable(),line1:X.string().nullable(),line2:X.string().nullable(),postal_code:X.string().nullable(),state:X.string().nullable()}).nullable(),metadata:X.record(X.string()).default({})}),wQ=X.object({_id:X.string(),appId:X.string(),orgId:X.string(),stripeAccountId:X.string(),accountId:X.string(),displayName:X.string().optional(),scope:X.enum(["read_only","read_write"]).default("read_write"),isActive:X.boolean(),isImporting:X.boolean(),lastImportStartDate:X.date().optional(),lastImportEndDate:X.date().optional(),createdAt:X.date(),updatedAt:X.date()}),MQ=X.object({appId:X.string(),orgId:X.string(),stripeAccountId:X.string(),accountId:X.string(),displayName:X.string().optional(),scope:X.enum(["read_only","read_write"]).default("read_write"),isActive:X.boolean().default(!0),isImporting:X.boolean().default(!1),lastImportStartDate:X.date().optional(),lastImportEndDate:X.date().optional()}),kQ=X.object({displayName:X.string().optional(),isActive:X.boolean().optional(),isImporting:X.boolean().optional(),lastImportStartDate:X.date().optional(),lastImportEndDate:X.date().optional()}).partial(),FQ=X.object({appName:X.string().min(1,"App name is required"),appUrl:X.string().min(1,"App URL is required"),stripeAccountId:X.string().min(1,"Stripe user ID is required"),displayName:X.string().optional(),scope:X.enum(["read_only","read_write"]).default("read_write"),livemode:X.boolean().default(!1),lookbackMonths:X.number().min(1).max(24).default(6),includeFailedPayments:X.boolean().default(!1)}),vQ=X.object({code:X.string().min(1,"Authorization code is required"),state:X.string().min(1,"State parameter is required")}),PQ=X.object({device_type:X.enum(["desktop","mobile","tablet"]),browser:X.string(),os:X.string(),screen_width:X.number(),screen_height:X.number()}),EQ=X.object({country:X.string(),city:X.string().optional(),region:X.string().optional(),timezone:X.string(),language:X.string()}),SQ=X.object({lookback_months:X.number().default(6),include_failed_payments:X.boolean().default(!1),include_refunds:X.boolean().default(!0),batch_size:X.number().default(100),enrich_with_existing_data:X.boolean().default(!0)});var C6=X.enum(["waiting","active","completed","failed","delayed","paused"]),IQ=X.object({integrationId:X.string(),orgId:X.string(),appId:X.string(),stripeAccountId:X.string(),displayName:X.string(),lookbackMonths:X.number().default(6)}),fQ=X.object({jobId:X.string(),integrationId:X.string(),status:C6,progress:X.object({current:X.number(),total:X.number(),percentage:X.number()}),data:X.object({eventsImported:X.number(),paymentsProcessed:X.number().optional(),customersProcessed:X.number().optional(),revenue:X.number().optional(),startTime:X.date().optional(),endTime:X.date().optional(),error:X.string().optional()}),createdAt:X.date(),updatedAt:X.date()}),ZQ=X.object({integrationId:X.string(),status:X.enum(["not_started","in_progress","completed","failed"]),progress:X.object({percentage:X.number(),paymentsImported:X.number(),customersImported:X.number(),revenue:X.number()}),summary:X.object({totalEventsImported:X.number(),startTime:X.date().optional(),endTime:X.date().optional(),lastUpdated:X.date()})});var h0=["free","basic","pro","enterprise","userpath"],b6=["monthly","yearly"],R6=["active","canceled","past_due","incomplete","paused"];var z6=X.object({sites:X.number(),ai:X.number(),events:X.number(),seats:X.number()}),bQ=X.object({_id:X.string(),order:X.number(),orgId:X.string().optional(),name:X.union([X.enum(h0),X.string()]),type:X.enum(["public","private"]),displayName:X.string(),description:X.string(),monthlyPrice:X.number(),monthlyPriceId:X.string(),yearlyPrice:X.number(),yearlyPriceId:X.string(),limits:z6,features:X.array(X.string()),popular:X.boolean().default(!1),archived:X.boolean().default(!1)}),y6=X.object({reason:X.string().optional(),comment:X.string().optional(),feedback:X.string().optional(),cancelledAt:X.date().optional()}).optional(),RQ=X.object({id:X.string().optional(),_id:X.string().optional(),plan:X.union([X.enum(h0),X.string()]),referenceId:X.string(),stripeCustomerId:X.string().optional(),stripeSubscriptionId:X.string().optional(),interval:X.enum(b6).optional(),status:X.enum(R6),periodStart:X.date().optional(),periodEnd:X.date().optional(),cancelAtPeriodEnd:X.boolean().optional(),seats:X.number().optional(),trialStart:X.date().optional(),trialEnd:X.date().optional(),cancelDetails:y6,coupon:X.string().optional()}),zQ=X.object({usage:X.object({sites:X.number(),ai:X.number(),events:X.number(),seats:X.number()}),limits:X.object({sites:X.number(),ai:X.number(),events:X.number(),seats:X.number()})});var T6=["owner","admin","member","viewer"],h6=X.enum(T6),hQ=X.object({id:X.string(),name:X.string(),role:h6,email:X.string().email(),status:X.enum(["active","pending","inactive"]),image:X.string().optional()});var x6=X.object({_id:X.string().optional(),name:X.string(),email:X.string().email(),createdAt:X.union([X.date(),X.string()]).optional(),updatedAt:X.union([X.date(),X.string()]).optional()}),mQ=x6.omit({_id:!0,createdAt:!0,updatedAt:!0});/*!
2
2
  * re2js
3
3
  * RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching
4
4
  *
@@ -11,4 +11,4 @@ var B1=Object.defineProperty;var V1=($,_)=>{for(var Q in _)B1($,Q,{get:_[Q],enum
11
11
  `,10],["\v",11],["\f",12],["\r",13],[" ",32],['"',34],["$",36],["&",38],["(",40],[")",41],["*",42],["+",43],["-",45],[".",46],["0",48],["1",49],["2",50],["3",51],["4",52],["5",53],["6",54],["7",55],["8",56],["9",57],[":",58],["<",60],[">",62],["?",63],["A",65],["B",66],["C",67],["F",70],["P",80],["Q",81],["U",85],["Z",90],["[",91],["\\",92],["]",93],["^",94],["_",95],["a",97],["b",98],["f",102],["i",105],["m",109],["n",110],["r",114],["s",115],["t",116],["v",118],["x",120],["z",122],["{",123],["|",124],["}",125]]))();static toUpperCase($){let _=String.fromCodePoint($).toUpperCase();if(_.length>1)return $;let Q=String.fromCodePoint(_.codePointAt(0)).toLowerCase();if(Q.length>1||Q.codePointAt(0)!==$)return $;return _.codePointAt(0)}static toLowerCase($){let _=String.fromCodePoint($).toLowerCase();if(_.length>1)return $;let Q=String.fromCodePoint(_.codePointAt(0)).toUpperCase();if(Q.length>1||Q.codePointAt(0)!==$)return $;return _.codePointAt(0)}}class W{static CASE_ORBIT=(()=>new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7305,7306],[7306,7305],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[612,42955],[42955,612],[42956,42957],[42957,42956],[42970,42971],[42971,42970],[411,42972],[42972,411],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67000],[67000,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[68944,68976],[68976,68944],[68945,68977],[68977,68945],[68946,68978],[68978,68946],[68947,68979],[68979,68947],[68948,68980],[68980,68948],[68949,68981],[68981,68949],[68950,68982],[68982,68950],[68951,68983],[68983,68951],[68952,68984],[68984,68952],[68953,68985],[68985,68953],[68954,68986],[68986,68954],[68955,68987],[68987,68955],[68956,68988],[68988,68956],[68957,68989],[68989,68957],[68958,68990],[68990,68958],[68959,68991],[68991,68959],[68960,68992],[68992,68960],[68961,68993],[68993,68961],[68962,68994],[68994,68962],[68963,68995],[68995,68963],[68964,68996],[68996,68964],[68965,68997],[68997,68965],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[93771,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]))();static C=[[0,31,1],[127,159,1],[173,888,715],[889,896,7],[897,899,1],[907,909,2],[930,1328,398],[1367,1368,1],[1419,1420,1],[1424,1480,56],[1481,1487,1],[1515,1518,1],[1525,1541,1],[1564,1757,193],[1806,1807,1],[1867,1868,1],[1970,1983,1],[2043,2044,1],[2094,2095,1],[2111,2140,29],[2141,2143,2],[2155,2159,1],[2191,2198,1],[2274,2436,162],[2445,2446,1],[2449,2450,1],[2473,2481,8],[2483,2485,1],[2490,2491,1],[2501,2502,1],[2505,2506,1],[2511,2518,1],[2520,2523,1],[2526,2532,6],[2533,2559,26],[2560,2564,4],[2571,2574,1],[2577,2578,1],[2601,2609,8],[2612,2618,3],[2619,2621,2],[2627,2630,1],[2633,2634,1],[2638,2640,1],[2642,2648,1],[2653,2655,2],[2656,2661,1],[2679,2688,1],[2692,2702,10],[2706,2729,23],[2737,2740,3],[2746,2747,1],[2758,2766,4],[2767,2769,2],[2770,2783,1],[2788,2789,1],[2802,2808,1],[2816,2820,4],[2829,2830,1],[2833,2834,1],[2857,2865,8],[2868,2874,6],[2875,2885,10],[2886,2889,3],[2890,2894,4],[2895,2900,1],[2904,2907,1],[2910,2916,6],[2917,2936,19],[2937,2945,1],[2948,2955,7],[2956,2957,1],[2961,2966,5],[2967,2968,1],[2971,2973,2],[2976,2978,1],[2981,2983,1],[2987,2989,1],[3002,3005,1],[3011,3013,1],[3017,3022,5],[3023,3025,2],[3026,3030,1],[3032,3045,1],[3067,3071,1],[3085,3089,4],[3113,3130,17],[3131,3141,10],[3145,3150,5],[3151,3156,1],[3159,3163,4],[3164,3166,2],[3167,3172,5],[3173,3184,11],[3185,3190,1],[3213,3217,4],[3241,3252,11],[3258,3259,1],[3269,3273,4],[3278,3284,1],[3287,3292,1],[3295,3300,5],[3301,3312,11],[3316,3327,1],[3341,3345,4],[3397,3401,4],[3408,3411,1],[3428,3429,1],[3456,3460,4],[3479,3481,1],[3506,3516,10],[3518,3519,1],[3527,3529,1],[3531,3534,1],[3541,3543,2],[3552,3557,1],[3568,3569,1],[3573,3584,1],[3643,3646,1],[3676,3712,1],[3715,3717,2],[3723,3748,25],[3750,3774,24],[3775,3781,6],[3783,3791,8],[3802,3803,1],[3808,3839,1],[3912,3949,37],[3950,3952,1],[3992,4029,37],[4045,4059,14],[4060,4095,1],[4294,4296,2],[4297,4300,1],[4302,4303,1],[4681,4686,5],[4687,4695,8],[4697,4702,5],[4703,4745,42],[4750,4751,1],[4785,4790,5],[4791,4799,8],[4801,4806,5],[4807,4823,16],[4881,4886,5],[4887,4955,68],[4956,4989,33],[4990,4991,1],[5018,5023,1],[5110,5111,1],[5118,5119,1],[5789,5791,1],[5881,5887,1],[5910,5918,1],[5943,5951,1],[5972,5983,1],[5997,6001,4],[6004,6015,1],[6110,6111,1],[6122,6127,1],[6138,6143,1],[6158,6170,12],[6171,6175,1],[6265,6271,1],[6315,6319,1],[6390,6399,1],[6431,6444,13],[6445,6447,1],[6460,6463,1],[6465,6467,1],[6510,6511,1],[6517,6527,1],[6572,6575,1],[6602,6607,1],[6619,6621,1],[6684,6685,1],[6751,6781,30],[6782,6794,12],[6795,6799,1],[6810,6815,1],[6830,6831,1],[6863,6911,1],[6989,7156,167],[7157,7163,1],[7224,7226,1],[7242,7244,1],[7307,7311,1],[7355,7356,1],[7368,7375,1],[7419,7423,1],[7958,7959,1],[7966,7967,1],[8006,8007,1],[8014,8015,1],[8024,8030,2],[8062,8063,1],[8117,8133,16],[8148,8149,1],[8156,8176,20],[8177,8181,4],[8191,8203,12],[8204,8207,1],[8234,8238,1],[8288,8303,1],[8306,8307,1],[8335,8349,14],[8350,8351,1],[8385,8399,1],[8433,8447,1],[8588,8591,1],[9258,9279,1],[9291,9311,1],[11124,11125,1],[11158,11508,350],[11509,11512,1],[11558,11560,2],[11561,11564,1],[11566,11567,1],[11624,11630,1],[11633,11646,1],[11671,11679,1],[11687,11743,8],[11870,11903,1],[11930,12020,90],[12021,12031,1],[12246,12271,1],[12352,12439,87],[12440,12544,104],[12545,12548,1],[12592,12687,95],[12774,12782,1],[12831,42125,29294],[42126,42127,1],[42183,42191,1],[42540,42559,1],[42744,42751,1],[42958,42959,1],[42962,42964,2],[42973,42993,1],[43053,43055,1],[43066,43071,1],[43128,43135,1],[43206,43213,1],[43226,43231,1],[43348,43358,1],[43389,43391,1],[43470,43482,12],[43483,43485,1],[43519,43575,56],[43576,43583,1],[43598,43599,1],[43610,43611,1],[43715,43738,1],[43767,43776,1],[43783,43784,1],[43791,43792,1],[43799,43807,1],[43815,43823,8],[43884,43887,1],[44014,44015,1],[44026,44031,1],[55204,55215,1],[55239,55242,1],[55292,63743,1],[64110,64111,1],[64218,64255,1],[64263,64274,1],[64280,64284,1],[64311,64317,6],[64319,64325,3],[64451,64466,1],[64912,64913,1],[64968,64974,1],[64976,65007,1],[65050,65055,1],[65107,65127,20],[65132,65135,1],[65141,65277,136],[65278,65280,1],[65471,65473,1],[65480,65481,1],[65488,65489,1],[65496,65497,1],[65501,65503,1],[65511,65519,8],[65520,65531,1],[65534,65535,1],[65548,65575,27],[65595,65598,3],[65614,65615,1],[65630,65663,1],[65787,65791,1],[65795,65798,1],[65844,65846,1],[65935,65949,14],[65950,65951,1],[65953,65999,1],[66046,66175,1],[66205,66207,1],[66257,66271,1],[66300,66303,1],[66340,66348,1],[66379,66383,1],[66427,66431,1],[66462,66500,38],[66501,66503,1],[66518,66559,1],[66718,66719,1],[66730,66735,1],[66772,66775,1],[66812,66815,1],[66856,66863,1],[66916,66926,1],[66939,66955,16],[66963,66966,3],[66978,66994,16],[67002,67005,3],[67006,67007,1],[67060,67071,1],[67383,67391,1],[67414,67423,1],[67432,67455,1],[67462,67505,43],[67515,67583,1],[67590,67591,1],[67593,67638,45],[67641,67643,1],[67645,67646,1],[67670,67743,73],[67744,67750,1],[67760,67807,1],[67827,67830,3],[67831,67834,1],[67868,67870,1],[67898,67902,1],[67904,67967,1],[68024,68027,1],[68048,68049,1],[68100,68103,3],[68104,68107,1],[68116,68120,4],[68150,68151,1],[68155,68158,1],[68169,68175,1],[68185,68191,1],[68256,68287,1],[68327,68330,1],[68343,68351,1],[68406,68408,1],[68438,68439,1],[68467,68471,1],[68498,68504,1],[68509,68520,1],[68528,68607,1],[68681,68735,1],[68787,68799,1],[68851,68857,1],[68904,68911,1],[68922,68927,1],[68966,68968,1],[68998,69005,1],[69008,69215,1],[69247,69290,43],[69294,69295,1],[69298,69313,1],[69317,69371,1],[69416,69423,1],[69466,69487,1],[69514,69551,1],[69580,69599,1],[69623,69631,1],[69710,69713,1],[69750,69758,1],[69821,69827,6],[69828,69839,1],[69865,69871,1],[69882,69887,1],[69941,69960,19],[69961,69967,1],[70007,70015,1],[70112,70133,21],[70134,70143,1],[70162,70210,48],[70211,70271,1],[70279,70281,2],[70286,70302,16],[70314,70319,1],[70379,70383,1],[70394,70399,1],[70404,70413,9],[70414,70417,3],[70418,70441,23],[70449,70452,3],[70458,70469,11],[70470,70473,3],[70474,70478,4],[70479,70481,2],[70482,70486,1],[70488,70492,1],[70500,70501,1],[70509,70511,1],[70517,70527,1],[70538,70540,2],[70541,70543,2],[70582,70593,11],[70595,70596,1],[70598,70603,5],[70614,70617,3],[70618,70624,1],[70627,70655,1],[70748,70754,6],[70755,70783,1],[70856,70863,1],[70874,71039,1],[71094,71095,1],[71134,71167,1],[71237,71247,1],[71258,71263,1],[71277,71295,1],[71354,71359,1],[71370,71375,1],[71396,71423,1],[71451,71452,1],[71468,71471,1],[71495,71679,1],[71740,71839,1],[71923,71934,1],[71943,71944,1],[71946,71947,1],[71956,71959,3],[71990,71993,3],[71994,72007,13],[72008,72015,1],[72026,72095,1],[72104,72105,1],[72152,72153,1],[72165,72191,1],[72264,72271,1],[72355,72367,1],[72441,72447,1],[72458,72639,1],[72674,72687,1],[72698,72703,1],[72713,72759,46],[72774,72783,1],[72813,72815,1],[72848,72849,1],[72872,72887,15],[72888,72959,1],[72967,72970,3],[73015,73017,1],[73019,73022,3],[73032,73039,1],[73050,73055,1],[73062,73065,3],[73103,73106,3],[73113,73119,1],[73130,73439,1],[73465,73471,1],[73489,73531,42],[73532,73533,1],[73563,73647,1],[73649,73663,1],[73714,73726,1],[74650,74751,1],[74863,74869,6],[74870,74879,1],[75076,77711,1],[77811,77823,1],[78896,78911,1],[78934,78943,1],[82939,82943,1],[83527,90367,1],[90426,92159,1],[92729,92735,1],[92767,92778,11],[92779,92781,1],[92863,92874,11],[92875,92879,1],[92910,92911,1],[92918,92927,1],[92998,93007,1],[93018,93026,8],[93048,93052,1],[93072,93503,1],[93562,93759,1],[93851,93951,1],[94027,94030,1],[94088,94094,1],[94112,94175,1],[94181,94191,1],[94194,94207,1],[100344,100351,1],[101590,101630,1],[101641,110575,1],[110580,110588,8],[110591,110883,292],[110884,110897,1],[110899,110927,1],[110931,110932,1],[110934,110947,1],[110952,110959,1],[111356,113663,1],[113771,113775,1],[113789,113791,1],[113801,113807,1],[113818,113819,1],[113824,117759,1],[118010,118015,1],[118452,118527,1],[118574,118575,1],[118599,118607,1],[118724,118783,1],[119030,119039,1],[119079,119080,1],[119155,119162,1],[119275,119295,1],[119366,119487,1],[119508,119519,1],[119540,119551,1],[119639,119647,1],[119673,119807,1],[119893,119965,72],[119968,119969,1],[119971,119972,1],[119975,119976,1],[119981,119994,13],[119996,120004,8],[120070,120075,5],[120076,120085,9],[120093,120122,29],[120127,120133,6],[120135,120137,1],[120145,120486,341],[120487,120780,293],[120781,121484,703],[121485,121498,1],[121504,121520,16],[121521,122623,1],[122655,122660,1],[122667,122879,1],[122887,122905,18],[122906,122914,8],[122917,122923,6],[122924,122927,1],[122990,123022,1],[123024,123135,1],[123181,123183,1],[123198,123199,1],[123210,123213,1],[123216,123535,1],[123567,123583,1],[123642,123646,1],[123648,124111,1],[124154,124367,1],[124411,124414,1],[124416,124895,1],[124903,124908,5],[124911,124927,16],[125125,125126,1],[125143,125183,1],[125260,125263,1],[125274,125277,1],[125280,126064,1],[126133,126208,1],[126270,126463,1],[126468,126496,28],[126499,126501,2],[126502,126504,2],[126515,126520,5],[126522,126524,2],[126525,126529,1],[126531,126534,1],[126536,126540,2],[126544,126547,3],[126549,126550,1],[126552,126560,2],[126563,126565,2],[126566,126571,5],[126579,126589,5],[126591,126602,11],[126620,126624,1],[126628,126634,6],[126652,126703,1],[126706,126975,1],[127020,127023,1],[127124,127135,1],[127151,127152,1],[127168,127184,16],[127222,127231,1],[127406,127461,1],[127491,127503,1],[127548,127551,1],[127561,127567,1],[127570,127583,1],[127590,127743,1],[128728,128731,1],[128749,128751,1],[128765,128767,1],[128887,128890,1],[128986,128991,1],[129004,129007,1],[129009,129023,1],[129036,129039,1],[129096,129103,1],[129114,129119,1],[129160,129167,1],[129198,129199,1],[129212,129215,1],[129218,129279,1],[129620,129631,1],[129646,129647,1],[129661,129663,1],[129674,129678,1],[129735,129741,1],[129757,129758,1],[129770,129775,1],[129785,129791,1],[129939,130042,103],[130043,131071,1],[173792,173823,1],[177978,177983,1],[178206,178207,1],[183970,183983,1],[191457,191471,1],[192094,194559,1],[195102,196607,1],[201547,201551,1],[205744,917759,1],[918000,1114111,1]];static Cc=[[0,31,1],[127,159,1]];static Cf=[[173,1536,1363],[1537,1541,1],[1564,1757,193],[1807,2192,385],[2193,2274,81],[6158,8203,2045],[8204,8207,1],[8234,8238,1],[8288,8292,1],[8294,8303,1],[65279,65529,250],[65530,65531,1],[69821,69837,16],[78896,78911,1],[113824,113827,1],[119155,119162,1],[917505,917536,31],[917537,917631,1]];static Co=[[57344,63743,1],[983040,1048573,1],[1048576,1114109,1]];static Cs=[[55296,57343,1]];static L=[[65,90,1],[97,122,1],[170,181,11],[186,192,6],[193,214,1],[216,246,1],[248,705,1],[710,721,1],[736,740,1],[748,750,2],[880,884,1],[886,887,1],[890,893,1],[895,902,7],[904,906,1],[908,910,2],[911,929,1],[931,1013,1],[1015,1153,1],[1162,1327,1],[1329,1366,1],[1369,1376,7],[1377,1416,1],[1488,1514,1],[1519,1522,1],[1568,1610,1],[1646,1647,1],[1649,1747,1],[1749,1765,16],[1766,1774,8],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2036,2037,1],[2042,2048,6],[2049,2069,1],[2074,2084,10],[2088,2112,24],[2113,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2249,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2417,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3654,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3782,3804,22],[3805,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4256,18],[4257,4293,1],[4295,4301,6],[4304,4346,1],[4348,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5024,5109,1],[5112,5117,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6000,1],[6016,6067,1],[6103,6108,5],[6176,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6823,6917,94],[6918,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7293,1],[7296,7306,1],[7312,7354,1],[7357,7359,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,7424,6],[7425,7615,1],[7680,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8124,1],[8126,8130,4],[8131,8132,1],[8134,8140,1],[8144,8147,1],[8150,8155,1],[8160,8172,1],[8178,8180,1],[8182,8188,1],[8305,8319,14],[8336,8348,1],[8450,8455,5],[8458,8467,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8495,8505,1],[8508,8511,1],[8517,8521,1],[8526,8579,53],[8580,11264,2684],[11265,11492,1],[11499,11502,1],[11506,11507,1],[11520,11557,1],[11559,11565,6],[11568,11623,1],[11631,11648,17],[11649,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[11823,12293,470],[12294,12337,43],[12338,12341,1],[12347,12348,1],[12353,12438,1],[12445,12447,1],[12449,12538,1],[12540,12543,1],[12549,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,42124,1],[42192,42237,1],[42240,42508,1],[42512,42527,1],[42538,42539,1],[42560,42606,1],[42623,42653,1],[42656,42725,1],[42775,42783,1],[42786,42888,1],[42891,42957,1],[42960,42961,1],[42963,42965,2],[42966,42972,1],[42994,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43471,43488,17],[43489,43492,1],[43494,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43741,1],[43744,43754,1],[43762,43764,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43824,43866,1],[43868,43881,1],[43888,44002,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[63744,64109,1],[64112,64217,1],[64256,64262,1],[64275,64279,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65313,65338,1],[65345,65370,1],[65382,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66560,66717,1],[66736,66771,1],[66776,66811,1],[66816,66855,1],[66864,66915,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[67008,67059,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68736,68786,1],[68800,68850,1],[68864,68899,1],[68938,68965,1],[68975,68997,1],[69248,69289,1],[69296,69297,1],[69314,69316,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70528,70537,1],[70539,70542,3],[70544,70581,1],[70583,70609,26],[70611,70656,45],[70657,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71840,71903,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72640,72672,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[78944,82938,1],[82944,83526,1],[90368,90397,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[92992,92995,1],[93027,93047,1],[93053,93071,1],[93504,93548,1],[93760,93823,1],[93952,94026,1],[94032,94099,67],[94100,94111,1],[94176,94177,1],[94179,94208,29],[94209,100343,1],[100352,101589,1],[101631,101640,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120512,1],[120514,120538,1],[120540,120570,1],[120572,120596,1],[120598,120628,1],[120630,120654,1],[120656,120686,1],[120688,120712,1],[120714,120744,1],[120746,120770,1],[120772,120779,1],[122624,122654,1],[122661,122666,1],[122928,122989,1],[123136,123180,1],[123191,123197,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124139,1],[124368,124397,1],[124400,124896,496],[124897,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[125184,125251,1],[125259,126464,1205],[126465,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static foldL=[[837,837,1]];static Ll=[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,311,2],[312,328,2],[329,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[397,402,5],[405,409,4],[410,411,1],[414,417,3],[419,421,2],[424,426,2],[427,429,2],[432,436,4],[438,441,3],[442,445,3],[446,447,1],[454,460,3],[462,476,2],[477,495,2],[496,499,3],[501,505,4],[507,563,2],[564,569,1],[572,575,3],[576,578,2],[583,591,2],[592,659,1],[661,687,1],[881,883,2],[887,891,4],[892,893,1],[912,940,28],[941,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1020,1072,52],[1073,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1376,1416,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7306,7424,118],[7425,7467,1],[7531,7543,1],[7545,7578,1],[7681,7829,2],[7830,7837,1],[7839,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8000,8005,1],[8016,8023,1],[8032,8039,1],[8048,8061,1],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8112,8116,1],[8118,8119,1],[8126,8130,4],[8131,8132,1],[8134,8135,1],[8144,8147,1],[8150,8151,1],[8160,8167,1],[8178,8180,1],[8182,8183,1],[8458,8462,4],[8463,8467,4],[8495,8505,5],[8508,8509,1],[8518,8521,1],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11377,11379,2],[11380,11382,2],[11383,11387,1],[11393,11491,2],[11492,11500,8],[11502,11507,5],[11520,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42800,42801,1],[42803,42865,2],[42866,42872,1],[42874,42876,2],[42879,42887,2],[42892,42894,2],[42897,42899,2],[42900,42901,1],[42903,42921,2],[42927,42933,6],[42935,42947,2],[42952,42954,2],[42957,42961,4],[42963,42971,2],[42998,43002,4],[43824,43866,1],[43872,43880,1],[43888,43967,1],[64256,64262,1],[64275,64279,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[68976,68997,1],[71872,71903,1],[93792,93823,1],[119834,119859,1],[119886,119892,1],[119894,119911,1],[119938,119963,1],[119990,119993,1],[119995,119997,2],[119998,120003,1],[120005,120015,1],[120042,120067,1],[120094,120119,1],[120146,120171,1],[120198,120223,1],[120250,120275,1],[120302,120327,1],[120354,120379,1],[120406,120431,1],[120458,120485,1],[120514,120538,1],[120540,120545,1],[120572,120596,1],[120598,120603,1],[120630,120654,1],[120656,120661,1],[120688,120712,1],[120714,120719,1],[120746,120770,1],[120772,120777,1],[120779,122624,1845],[122625,122633,1],[122635,122654,1],[122661,122666,1],[125218,125251,1]];static foldLl=[[65,90,1],[192,214,1],[216,222,1],[256,302,2],[306,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,453,1],[455,456,1],[458,459,1],[461,475,2],[478,494,2],[497,498,1],[500,502,2],[503,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[837,880,43],[882,886,4],[895,902,7],[904,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,984,9],[986,1006,2],[1012,1015,3],[1017,1018,1],[1021,1071,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7305,7312,7],[7313,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8072,8079,1],[8088,8095,1],[8104,8111,1],[8120,8124,1],[8136,8140,1],[8152,8155,1],[8168,8172,1],[8184,8188,1],[8486,8490,4],[8491,8498,7],[8579,11264,2685],[11265,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42955,2],[42956,42960,4],[42966,42972,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[68944,68965,1],[71840,71871,1],[93760,93791,1],[125184,125217,1]];static Lm=[[688,705,1],[710,721,1],[736,740,1],[748,750,2],[884,890,6],[1369,1600,231],[1765,1766,1],[2036,2037,1],[2042,2074,32],[2084,2088,4],[2249,2417,168],[3654,3782,128],[4348,6103,1755],[6211,6823,612],[7288,7293,1],[7468,7530,1],[7544,7579,35],[7580,7615,1],[8305,8319,14],[8336,8348,1],[11388,11389,1],[11631,11823,192],[12293,12337,44],[12338,12341,1],[12347,12445,98],[12446,12540,94],[12541,12542,1],[40981,42232,1251],[42233,42237,1],[42508,42623,115],[42652,42653,1],[42775,42783,1],[42864,42888,24],[42994,42996,1],[43000,43001,1],[43471,43494,23],[43632,43741,109],[43763,43764,1],[43868,43871,1],[43881,65392,21511],[65438,65439,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[68942,68975,33],[92992,92995,1],[93504,93506,1],[93547,93548,1],[94099,94111,1],[94176,94177,1],[94179,110576,16397],[110577,110579,1],[110581,110587,1],[110589,110590,1],[122928,122989,1],[123191,123197,1],[124139,125259,1120]];static Lo=[[170,186,16],[443,448,5],[449,451,1],[660,1488,828],[1489,1514,1],[1519,1522,1],[1568,1599,1],[1601,1610,1],[1646,1647,1],[1649,1747,1],[1749,1774,25],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2048,2069,1],[2112,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2248,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2418,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3653,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3804,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4352,114],[4353,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6000,1],[6016,6067,1],[6108,6176,68],[6177,6210,1],[6212,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6917,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7287,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,8501,1083],[8502,8504,1],[11568,11623,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[12294,12348,54],[12353,12438,1],[12447,12449,2],[12450,12538,1],[12543,12549,6],[12550,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,40980,1],[40982,42124,1],[42192,42231,1],[42240,42507,1],[42512,42527,1],[42538,42539,1],[42606,42656,50],[42657,42725,1],[42895,42999,104],[43003,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43488,43492,1],[43495,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43631,1],[43633,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43740,1],[43744,43754,1],[43762,43777,15],[43778,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43968,44002,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[63744,64109,1],[64112,64217,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65382,65391,1],[65393,65437,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66640,66717,1],[66816,66855,1],[66864,66915,1],[67008,67059,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68864,68899,1],[68938,68941,1],[68943,69248,305],[69249,69289,1],[69296,69297,1],[69314,69316,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70528,70537,1],[70539,70542,3],[70544,70581,1],[70583,70609,26],[70611,70656,45],[70657,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72640,72672,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[78944,82938,1],[82944,83526,1],[90368,90397,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[93027,93047,1],[93053,93071,1],[93507,93546,1],[93952,94026,1],[94032,94208,176],[94209,100343,1],[100352,101589,1],[101631,101640,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[122634,123136,502],[123137,123180,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124138,1],[124368,124397,1],[124400,124896,496],[124897,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static Lt=[[453,459,3],[498,8072,7574],[8073,8079,1],[8088,8095,1],[8104,8111,1],[8124,8140,16],[8188,8188,1]];static foldLt=[[452,454,2],[455,457,2],[458,460,2],[497,499,2],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8115,8131,16],[8179,8179,1]];static Lu=[[65,90,1],[192,214,1],[216,222,1],[256,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,461,3],[463,475,2],[478,494,2],[497,500,3],[502,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[880,882,2],[886,895,9],[902,904,2],[905,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,978,3],[979,980,1],[984,1006,2],[1012,1015,3],[1017,1018,1],[1021,1071,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7305,7312,7],[7313,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8120,8123,1],[8136,8139,1],[8152,8155,1],[8168,8172,1],[8184,8187,1],[8450,8455,5],[8459,8461,1],[8464,8466,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8496,8499,1],[8510,8511,1],[8517,8579,62],[11264,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42955,2],[42956,42960,4],[42966,42972,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[68944,68965,1],[71840,71871,1],[93760,93791,1],[119808,119833,1],[119860,119885,1],[119912,119937,1],[119964,119966,2],[119967,119973,3],[119974,119977,3],[119978,119980,1],[119982,119989,1],[120016,120041,1],[120068,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120120,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120172,120197,1],[120224,120249,1],[120276,120301,1],[120328,120353,1],[120380,120405,1],[120432,120457,1],[120488,120512,1],[120546,120570,1],[120604,120628,1],[120662,120686,1],[120720,120744,1],[120778,125184,4406],[125185,125217,1]];static Upper=this.Lu;static foldLu=[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,303,2],[307,311,2],[314,328,2],[331,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[402,405,3],[409,411,1],[414,417,3],[419,421,2],[424,429,5],[432,436,4],[438,441,3],[445,447,2],[453,454,1],[456,457,1],[459,460,1],[462,476,2],[477,495,2],[498,499,1],[501,505,4],[507,543,2],[547,563,2],[572,575,3],[576,578,2],[583,591,2],[592,596,1],[598,599,1],[601,603,2],[604,608,4],[609,611,2],[612,614,1],[616,620,1],[623,625,2],[626,629,3],[637,640,3],[642,643,1],[647,652,1],[658,669,11],[670,837,167],[881,883,2],[887,891,4],[892,893,1],[940,943,1],[945,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1072,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1377,1414,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7306,7545,239],[7549,7566,17],[7681,7829,2],[7835,7841,6],[7843,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8000,8005,1],[8017,8023,2],[8032,8039,1],[8048,8061,1],[8112,8113,1],[8126,8144,18],[8145,8160,15],[8161,8165,4],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11379,11382,3],[11393,11491,2],[11500,11502,2],[11507,11520,13],[11521,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42803,42863,2],[42874,42876,2],[42879,42887,2],[42892,42897,5],[42899,42900,1],[42903,42921,2],[42933,42947,2],[42952,42954,2],[42957,42961,4],[42967,42971,2],[42998,43859,861],[43888,43967,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[68976,68997,1],[71872,71903,1],[93792,93823,1],[125218,125251,1]];static M=[[768,879,1],[1155,1161,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,1],[2089,2093,1],[2137,2139,1],[2199,2207,1],[2250,2273,1],[2275,2307,1],[2362,2364,1],[2366,2383,1],[2385,2391,1],[2402,2403,1],[2433,2435,1],[2492,2494,2],[2495,2500,1],[2503,2504,1],[2507,2509,1],[2519,2530,11],[2531,2558,27],[2561,2563,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2672,31],[2673,2677,4],[2689,2691,1],[2748,2750,2],[2751,2757,1],[2759,2761,1],[2763,2765,1],[2786,2787,1],[2810,2815,1],[2817,2819,1],[2876,2878,2],[2879,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2914,2915,1],[2946,3006,60],[3007,3010,1],[3014,3016,1],[3018,3021,1],[3031,3072,41],[3073,3076,1],[3132,3134,2],[3135,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3203,1],[3260,3262,2],[3263,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3298,3299,1],[3315,3328,13],[3329,3331,1],[3387,3388,1],[3390,3396,1],[3398,3400,1],[3402,3405,1],[3415,3426,11],[3427,3457,30],[3458,3459,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3570,3571,1],[3633,3636,3],[3637,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3902,3903,1],[3953,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4139,101],[4140,4158,1],[4182,4185,1],[4190,4192,1],[4194,4196,1],[4199,4205,1],[4209,4212,1],[4226,4237,1],[4239,4250,11],[4251,4253,1],[4957,4959,1],[5906,5909,1],[5938,5940,1],[5970,5971,1],[6002,6003,1],[6068,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6443,1],[6448,6459,1],[6679,6683,1],[6741,6750,1],[6752,6780,1],[6783,6832,49],[6833,6862,1],[6912,6916,1],[6964,6980,1],[7019,7027,1],[7040,7042,1],[7073,7085,1],[7142,7155,1],[7204,7223,1],[7376,7378,1],[7380,7400,1],[7405,7412,7],[7415,7417,1],[7616,7679,1],[8400,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12335,1],[12441,12442,1],[42607,42610,1],[42612,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43043,24],[43044,43047,1],[43052,43136,84],[43137,43188,51],[43189,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43347,1],[43392,43395,1],[43443,43456,1],[43493,43561,68],[43562,43574,1],[43587,43596,9],[43597,43643,46],[43644,43645,1],[43696,43698,2],[43699,43700,1],[43703,43704,1],[43710,43711,1],[43713,43755,42],[43756,43759,1],[43765,43766,1],[44003,44010,1],[44012,44013,1],[64286,65024,738],[65025,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[68969,68973,1],[69291,69292,1],[69372,69375,1],[69446,69456,1],[69506,69509,1],[69632,69634,1],[69688,69702,1],[69744,69747,3],[69748,69759,11],[69760,69762,1],[69808,69818,1],[69826,69888,62],[69889,69890,1],[69927,69940,1],[69957,69958,1],[70003,70016,13],[70017,70018,1],[70067,70080,1],[70089,70092,1],[70094,70095,1],[70188,70199,1],[70206,70209,3],[70367,70378,1],[70400,70403,1],[70459,70460,1],[70462,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70502,3],[70503,70508,1],[70512,70516,1],[70584,70592,1],[70594,70597,3],[70599,70602,1],[70604,70608,1],[70610,70625,15],[70626,70709,83],[70710,70726,1],[70750,70832,82],[70833,70851,1],[71087,71093,1],[71096,71104,1],[71132,71133,1],[71216,71232,1],[71339,71351,1],[71453,71467,1],[71724,71738,1],[71984,71989,1],[71991,71992,1],[71995,71998,1],[72000,72002,2],[72003,72145,142],[72146,72151,1],[72154,72160,1],[72164,72193,29],[72194,72202,1],[72243,72249,1],[72251,72254,1],[72263,72273,10],[72274,72283,1],[72330,72345,1],[72751,72758,1],[72760,72767,1],[72850,72871,1],[72873,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73098,67],[73099,73102,1],[73104,73105,1],[73107,73111,1],[73459,73462,1],[73472,73473,1],[73475,73524,49],[73525,73530,1],[73534,73538,1],[73562,78912,5350],[78919,78933,1],[90398,90415,1],[92912,92916,1],[92976,92982,1],[94031,94033,2],[94034,94087,1],[94095,94098,1],[94180,94192,12],[94193,113821,19628],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119141,119145,1],[119149,119154,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[124398,124399,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]];static foldM=[[921,953,32],[8126,8126,1]];static Mc=[[2307,2363,56],[2366,2368,1],[2377,2380,1],[2382,2383,1],[2434,2435,1],[2494,2496,1],[2503,2504,1],[2507,2508,1],[2519,2563,44],[2622,2624,1],[2691,2750,59],[2751,2752,1],[2761,2763,2],[2764,2818,54],[2819,2878,59],[2880,2887,7],[2888,2891,3],[2892,2903,11],[3006,3007,1],[3009,3010,1],[3014,3016,1],[3018,3020,1],[3031,3073,42],[3074,3075,1],[3137,3140,1],[3202,3203,1],[3262,3264,2],[3265,3268,1],[3271,3272,1],[3274,3275,1],[3285,3286,1],[3315,3330,15],[3331,3390,59],[3391,3392,1],[3398,3400,1],[3402,3404,1],[3415,3458,43],[3459,3535,76],[3536,3537,1],[3544,3551,1],[3570,3571,1],[3902,3903,1],[3967,4139,172],[4140,4145,5],[4152,4155,3],[4156,4182,26],[4183,4194,11],[4195,4196,1],[4199,4205,1],[4227,4228,1],[4231,4236,1],[4239,4250,11],[4251,4252,1],[5909,5940,31],[6070,6078,8],[6079,6085,1],[6087,6088,1],[6435,6438,1],[6441,6443,1],[6448,6449,1],[6451,6456,1],[6681,6682,1],[6741,6743,2],[6753,6755,2],[6756,6765,9],[6766,6770,1],[6916,6965,49],[6971,6973,2],[6974,6977,1],[6979,6980,1],[7042,7073,31],[7078,7079,1],[7082,7143,61],[7146,7148,1],[7150,7154,4],[7155,7204,49],[7205,7211,1],[7220,7221,1],[7393,7415,22],[12334,12335,1],[43043,43044,1],[43047,43136,89],[43137,43188,51],[43189,43203,1],[43346,43347,1],[43395,43444,49],[43445,43450,5],[43451,43454,3],[43455,43456,1],[43567,43568,1],[43571,43572,1],[43597,43643,46],[43645,43755,110],[43758,43759,1],[43765,44003,238],[44004,44006,2],[44007,44009,2],[44010,44012,2],[69632,69634,2],[69762,69808,46],[69809,69810,1],[69815,69816,1],[69932,69957,25],[69958,70018,60],[70067,70069,1],[70079,70080,1],[70094,70188,94],[70189,70190,1],[70194,70195,1],[70197,70368,171],[70369,70370,1],[70402,70403,1],[70462,70463,1],[70465,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70584,85],[70585,70586,1],[70594,70597,3],[70599,70602,1],[70604,70605,1],[70607,70709,102],[70710,70711,1],[70720,70721,1],[70725,70832,107],[70833,70834,1],[70841,70843,2],[70844,70846,1],[70849,71087,238],[71088,71089,1],[71096,71099,1],[71102,71216,114],[71217,71218,1],[71227,71228,1],[71230,71340,110],[71342,71343,1],[71350,71454,104],[71456,71457,1],[71462,71724,262],[71725,71726,1],[71736,71984,248],[71985,71989,1],[71991,71992,1],[71997,72000,3],[72002,72145,143],[72146,72147,1],[72156,72159,1],[72164,72249,85],[72279,72280,1],[72343,72751,408],[72766,72873,107],[72881,72884,3],[73098,73102,1],[73107,73108,1],[73110,73461,351],[73462,73475,13],[73524,73525,1],[73534,73535,1],[73537,90410,16873],[90411,90412,1],[94033,94087,1],[94192,94193,1],[119141,119142,1],[119149,119154,1]];static Me=[[1160,1161,1],[6846,8413,1567],[8414,8416,1],[8418,8420,1],[42608,42610,1]];static Mn=[[768,879,1],[1155,1159,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,1],[2089,2093,1],[2137,2139,1],[2199,2207,1],[2250,2273,1],[2275,2306,1],[2362,2364,2],[2369,2376,1],[2381,2385,4],[2386,2391,1],[2402,2403,1],[2433,2492,59],[2497,2500,1],[2509,2530,21],[2531,2558,27],[2561,2562,1],[2620,2625,5],[2626,2631,5],[2632,2635,3],[2636,2637,1],[2641,2672,31],[2673,2677,4],[2689,2690,1],[2748,2753,5],[2754,2757,1],[2759,2760,1],[2765,2786,21],[2787,2810,23],[2811,2815,1],[2817,2876,59],[2879,2881,2],[2882,2884,1],[2893,2901,8],[2902,2914,12],[2915,2946,31],[3008,3021,13],[3072,3076,4],[3132,3134,2],[3135,3136,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3260,59],[3263,3270,7],[3276,3277,1],[3298,3299,1],[3328,3329,1],[3387,3388,1],[3393,3396,1],[3405,3426,21],[3427,3457,30],[3530,3538,8],[3539,3540,1],[3542,3633,91],[3636,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3953,3966,1],[3968,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4141,103],[4142,4144,1],[4146,4151,1],[4153,4154,1],[4157,4158,1],[4184,4185,1],[4190,4192,1],[4209,4212,1],[4226,4229,3],[4230,4237,7],[4253,4957,704],[4958,4959,1],[5906,5908,1],[5938,5939,1],[5970,5971,1],[6002,6003,1],[6068,6069,1],[6071,6077,1],[6086,6089,3],[6090,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6434,1],[6439,6440,1],[6450,6457,7],[6458,6459,1],[6679,6680,1],[6683,6742,59],[6744,6750,1],[6752,6754,2],[6757,6764,1],[6771,6780,1],[6783,6832,49],[6833,6845,1],[6847,6862,1],[6912,6915,1],[6964,6966,2],[6967,6970,1],[6972,6978,6],[7019,7027,1],[7040,7041,1],[7074,7077,1],[7080,7081,1],[7083,7085,1],[7142,7144,2],[7145,7149,4],[7151,7153,1],[7212,7219,1],[7222,7223,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8400,8412,1],[8417,8421,4],[8422,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12333,1],[12441,12442,1],[42607,42612,5],[42613,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43045,26],[43046,43052,6],[43204,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43345,1],[43392,43394,1],[43443,43446,3],[43447,43449,1],[43452,43453,1],[43493,43561,68],[43562,43566,1],[43569,43570,1],[43573,43574,1],[43587,43596,9],[43644,43696,52],[43698,43700,1],[43703,43704,1],[43710,43711,1],[43713,43756,43],[43757,43766,9],[44005,44008,3],[44013,64286,20273],[65024,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[68969,68973,1],[69291,69292,1],[69372,69375,1],[69446,69456,1],[69506,69509,1],[69633,69688,55],[69689,69702,1],[69744,69747,3],[69748,69759,11],[69760,69761,1],[69811,69814,1],[69817,69818,1],[69826,69888,62],[69889,69890,1],[69927,69931,1],[69933,69940,1],[70003,70016,13],[70017,70070,53],[70071,70078,1],[70089,70092,1],[70095,70191,96],[70192,70193,1],[70196,70198,2],[70199,70206,7],[70209,70367,158],[70371,70378,1],[70400,70401,1],[70459,70460,1],[70464,70502,38],[70503,70508,1],[70512,70516,1],[70587,70592,1],[70606,70610,2],[70625,70626,1],[70712,70719,1],[70722,70724,1],[70726,70750,24],[70835,70840,1],[70842,70847,5],[70848,70850,2],[70851,71090,239],[71091,71093,1],[71100,71101,1],[71103,71104,1],[71132,71133,1],[71219,71226,1],[71229,71231,2],[71232,71339,107],[71341,71344,3],[71345,71349,1],[71351,71453,102],[71455,71458,3],[71459,71461,1],[71463,71467,1],[71727,71735,1],[71737,71738,1],[71995,71996,1],[71998,72003,5],[72148,72151,1],[72154,72155,1],[72160,72193,33],[72194,72202,1],[72243,72248,1],[72251,72254,1],[72263,72273,10],[72274,72278,1],[72281,72283,1],[72330,72342,1],[72344,72345,1],[72752,72758,1],[72760,72765,1],[72767,72850,83],[72851,72871,1],[72874,72880,1],[72882,72883,1],[72885,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73104,73],[73105,73109,4],[73111,73459,348],[73460,73472,12],[73473,73526,53],[73527,73530,1],[73536,73538,2],[73562,78912,5350],[78919,78933,1],[90398,90409,1],[90413,90415,1],[92912,92916,1],[92976,92982,1],[94031,94095,64],[94096,94098,1],[94180,113821,19641],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[124398,124399,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]];static foldMn=[[921,953,32],[8126,8126,1]];static N=[[48,57,1],[178,179,1],[185,188,3],[189,190,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2548,2553,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[2930,2935,1],[3046,3058,1],[3174,3183,1],[3192,3198,1],[3302,3311,1],[3416,3422,1],[3430,3448,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3891,1],[4160,4169,1],[4240,4249,1],[4969,4988,1],[5870,5872,1],[6112,6121,1],[6128,6137,1],[6160,6169,1],[6470,6479,1],[6608,6618,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[8304,8308,4],[8309,8313,1],[8320,8329,1],[8528,8578,1],[8581,8585,1],[9312,9371,1],[9450,9471,1],[10102,10131,1],[11517,12295,778],[12321,12329,1],[12344,12346,1],[12690,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[42528,42537,1],[42726,42735,1],[43056,43061,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[65799,65843,1],[65856,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[66369,66378,9],[66513,66517,1],[66720,66729,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[68912,68921,1],[68928,68937,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70113,70132,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71376,71395,1],[71472,71483,1],[71904,71922,1],[72016,72025,1],[72688,72697,1],[72784,72812,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[73664,73684,1],[74752,74862,1],[90416,90425,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[93019,93025,1],[93552,93561,1],[93824,93846,1],[118000,118009,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[124401,124410,1],[125127,125135,1],[125264,125273,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1],[130032,130041,1]];static Nd=[[48,57,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[3046,3055,1],[3174,3183,1],[3302,3311,1],[3430,3439,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3881,1],[4160,4169,1],[4240,4249,1],[6112,6121,1],[6160,6169,1],[6470,6479,1],[6608,6617,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[42528,42537,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[66720,66729,1],[68912,68921,1],[68928,68937,1],[69734,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71376,71395,1],[71472,71481,1],[71904,71913,1],[72016,72025,1],[72688,72697,1],[72784,72793,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[90416,90425,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[93552,93561,1],[118000,118009,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[124401,124410,1],[125264,125273,1],[130032,130041,1]];static Nl=[[5870,5872,1],[8544,8578,1],[8581,8584,1],[12295,12321,26],[12322,12329,1],[12344,12346,1],[42726,42735,1],[65856,65908,1],[66369,66378,9],[66513,66517,1],[74752,74862,1]];static No=[[178,179,1],[185,188,3],[189,190,1],[2548,2553,1],[2930,2935,1],[3056,3058,1],[3192,3198,1],[3416,3422,1],[3440,3448,1],[3882,3891,1],[4969,4988,1],[6128,6137,1],[6618,8304,1686],[8308,8313,1],[8320,8329,1],[8528,8543,1],[8585,9312,727],[9313,9371,1],[9450,9471,1],[10102,10131,1],[11517,12690,1173],[12691,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[43056,43061,1],[65799,65843,1],[65909,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69733,1],[70113,70132,1],[71482,71483,1],[71914,71922,1],[72794,72812,1],[73664,73684,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[125127,125135,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1]];static P=[[33,35,1],[37,42,1],[44,47,1],[58,59,1],[63,64,1],[91,93,1],[95,123,28],[125,161,36],[167,171,4],[182,183,1],[187,191,4],[894,903,9],[1370,1375,1],[1417,1418,1],[1470,1472,2],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,368],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3898,38],[3899,3901,1],[3973,4048,75],[4049,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5120,5742,622],[5787,5788,1],[5867,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[6990,6991,1],[7002,7008,1],[7037,7039,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8208,829],[8209,8231,1],[8240,8259,1],[8261,8273,1],[8275,8286,1],[8317,8318,1],[8333,8334,1],[8968,8971,1],[9001,9002,1],[10088,10101,1],[10181,10182,1],[10214,10223,1],[10627,10648,1],[10712,10715,1],[10748,10749,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11822,1],[11824,11855,1],[11858,11869,1],[12289,12291,1],[12296,12305,1],[12308,12319,1],[12336,12349,13],[12448,12539,91],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,64830,20819],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65121,1],[65123,65128,5],[65130,65131,1],[65281,65283,1],[65285,65290,1],[65292,65295,1],[65306,65307,1],[65311,65312,1],[65339,65341,1],[65343,65371,28],[65373,65375,2],[65376,65381,1],[65792,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[68974,69293,319],[69461,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70612,299],[70613,70615,2],[70616,70731,115],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72673,72769,96],[72770,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93549,553],[93550,93551,1],[93847,93850,1],[94178,113823,19645],[121479,121483,1],[124415,125278,863],[125279,125279,1]];static Pc=[[95,8255,8160],[8256,8276,20],[65075,65076,1],[65101,65103,1],[65343,65343,1]];static Pd=[[45,1418,1373],[1470,5120,3650],[6150,8208,2058],[8209,8213,1],[11799,11802,3],[11834,11835,1],[11840,11869,29],[12316,12336,20],[12448,65073,52625],[65074,65112,38],[65123,65293,170],[68974,69293,319]];static Pe=[[41,93,52],[125,3899,3774],[3901,5788,1887],[8262,8318,56],[8334,8969,635],[8971,9002,31],[10089,10101,2],[10182,10215,33],[10217,10223,2],[10628,10648,2],[10713,10715,2],[10749,11811,1062],[11813,11817,2],[11862,11868,2],[12297,12305,2],[12309,12315,2],[12318,12319,1],[64830,65048,218],[65078,65092,2],[65096,65114,18],[65116,65118,2],[65289,65341,52],[65373,65379,3]];static Pf=[[187,8217,8030],[8221,8250,29],[11779,11781,2],[11786,11789,3],[11805,11809,4]];static Pi=[[171,8216,8045],[8219,8220,1],[8223,8249,26],[11778,11780,2],[11785,11788,3],[11804,11808,4]];static Po=[[33,35,1],[37,39,1],[42,46,2],[47,58,11],[59,63,4],[64,92,28],[161,167,6],[182,183,1],[191,894,703],[903,1370,467],[1371,1375,1],[1417,1472,55],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,368],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3973,113],[4048,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5742,5867,125],[5868,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6149,1],[6151,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[6990,6991,1],[7002,7008,1],[7037,7039,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8214,835],[8215,8224,9],[8225,8231,1],[8240,8248,1],[8251,8254,1],[8257,8259,1],[8263,8273,1],[8275,8277,2],[8278,8286,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11782,5],[11783,11784,1],[11787,11790,3],[11791,11798,1],[11800,11801,1],[11803,11806,3],[11807,11818,11],[11819,11822,1],[11824,11833,1],[11836,11839,1],[11841,11843,2],[11844,11855,1],[11858,11860,1],[12289,12291,1],[12349,12539,190],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,65040,21029],[65041,65046,1],[65049,65072,23],[65093,65094,1],[65097,65100,1],[65104,65106,1],[65108,65111,1],[65119,65121,1],[65128,65130,2],[65131,65281,150],[65282,65283,1],[65285,65287,1],[65290,65294,2],[65295,65306,11],[65307,65311,4],[65312,65340,28],[65377,65380,3],[65381,65792,411],[65793,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69461,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70612,299],[70613,70615,2],[70616,70731,115],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72673,72769,96],[72770,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93549,553],[93550,93551,1],[93847,93850,1],[94178,113823,19645],[121479,121483,1],[124415,125278,863],[125279,125279,1]];static Ps=[[40,91,51],[123,3898,3775],[3900,5787,1887],[8218,8222,4],[8261,8317,56],[8333,8968,635],[8970,9001,31],[10088,10100,2],[10181,10214,33],[10216,10222,2],[10627,10647,2],[10712,10714,2],[10748,11810,1062],[11812,11816,2],[11842,11861,19],[11863,11867,2],[12296,12304,2],[12308,12314,2],[12317,64831,52514],[65047,65077,30],[65079,65091,2],[65095,65113,18],[65115,65117,2],[65288,65339,51],[65371,65375,4],[65378,65378,1]];static S=[[36,43,7],[60,62,1],[94,96,2],[124,126,2],[162,166,1],[168,169,1],[172,174,2],[175,177,1],[180,184,4],[215,247,32],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,1014,113],[1154,1421,267],[1422,1423,1],[1542,1544,1],[1547,1550,3],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2046,2047,1],[2184,2546,362],[2547,2554,7],[2555,2801,246],[2928,3059,131],[3060,3066,1],[3199,3407,208],[3449,3647,198],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6107,366],[6464,6622,158],[6623,6655,1],[7009,7018,1],[7028,7036,1],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8352,8384,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8472,1],[8478,8483,1],[8485,8489,2],[8494,8506,12],[8507,8512,5],[8513,8516,1],[8522,8525,1],[8527,8586,59],[8587,8592,5],[8593,8967,1],[8972,9000,1],[9003,9257,1],[9280,9290,1],[9372,9449,1],[9472,10087,1],[10132,10180,1],[10183,10213,1],[10224,10626,1],[10649,10711,1],[10716,10747,1],[10750,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12443,12444,1],[12688,12689,1],[12694,12703,1],[12736,12773,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,1],[12992,13311,1],[19904,19967,1],[42128,42182,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43048,43051,1],[43062,43065,1],[43639,43641,1],[43867,43882,15],[43883,64297,20414],[64434,64450,1],[64832,64847,1],[64975,65020,45],[65021,65023,1],[65122,65124,2],[65125,65126,1],[65129,65284,155],[65291,65308,17],[65309,65310,1],[65342,65344,2],[65372,65374,2],[65504,65510,1],[65512,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66000,48],[66001,66044,1],[67703,67704,1],[68296,69006,710],[69007,71487,2480],[73685,73713,1],[92988,92991,1],[92997,113820,20823],[117760,117999,1],[118016,118451,1],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,123647,432],[126124,126128,4],[126254,126704,450],[126705,126976,271],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129211,1],[129216,129217,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129673,1],[129679,129734,1],[129742,129756,1],[129759,129769,1],[129776,129784,1],[129792,129938,1],[129940,130031,1]];static Sc=[[36,162,126],[163,165,1],[1423,1547,124],[2046,2047,1],[2546,2547,1],[2555,2801,246],[3065,3647,582],[6107,8352,2245],[8353,8384,1],[43064,65020,21956],[65129,65284,155],[65504,65505,1],[65509,65510,1],[73693,73696,1],[123647,126128,2481]];static Sk=[[94,96,2],[168,175,7],[180,184,4],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,2184,1283],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[12443,12444,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43867,43882,15],[43883,64434,20551],[64435,64450,1],[65342,65344,2],[65507,127995,62488],[127996,127999,1]];static Sm=[[43,60,17],[61,62,1],[124,126,2],[172,177,5],[215,247,32],[1014,1542,528],[1543,1544,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8472,8512,40],[8513,8516,1],[8523,8592,69],[8593,8596,1],[8602,8603,1],[8608,8614,3],[8622,8654,32],[8655,8658,3],[8660,8692,32],[8693,8959,1],[8992,8993,1],[9084,9115,31],[9116,9139,1],[9180,9185,1],[9655,9665,10],[9720,9727,1],[9839,10176,337],[10177,10180,1],[10183,10213,1],[10224,10239,1],[10496,10626,1],[10649,10711,1],[10716,10747,1],[10750,11007,1],[11056,11076,1],[11079,11084,1],[64297,65122,825],[65124,65126,1],[65291,65308,17],[65309,65310,1],[65372,65374,2],[65506,65513,7],[65514,65516,1],[69006,69007,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[126704,126705,1]];static So=[[166,169,3],[174,176,2],[1154,1421,267],[1422,1550,128],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2554,2928,374],[3059,3064,1],[3066,3199,133],[3407,3449,42],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6464,723],[6622,6655,1],[7009,7018,1],[7028,7036,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8478,7],[8479,8483,1],[8485,8489,2],[8494,8506,12],[8507,8522,15],[8524,8525,1],[8527,8586,59],[8587,8597,10],[8598,8601,1],[8604,8607,1],[8609,8610,1],[8612,8613,1],[8615,8621,1],[8623,8653,1],[8656,8657,1],[8659,8661,2],[8662,8691,1],[8960,8967,1],[8972,8991,1],[8994,9000,1],[9003,9083,1],[9085,9114,1],[9140,9179,1],[9186,9257,1],[9280,9290,1],[9372,9449,1],[9472,9654,1],[9656,9664,1],[9666,9719,1],[9728,9838,1],[9840,10087,1],[10132,10175,1],[10240,10495,1],[11008,11055,1],[11077,11078,1],[11085,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12688,12689,1],[12694,12703,1],[12736,12773,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,1],[12992,13311,1],[19904,19967,1],[42128,42182,1],[43048,43051,1],[43062,43063,1],[43065,43639,574],[43640,43641,1],[64832,64847,1],[64975,65021,46],[65022,65023,1],[65508,65512,4],[65517,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66000,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73692,1],[73697,73713,1],[92988,92991,1],[92997,113820,20823],[117760,117999,1],[118016,118451,1],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,126124,2909],[126254,126976,722],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,127994,1],[128000,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129211,1],[129216,129217,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129673,1],[129679,129734,1],[129742,129756,1],[129759,129769,1],[129776,129784,1],[129792,129938,1],[129940,130031,1]];static Z=[[32,160,128],[5760,8192,2432],[8193,8202,1],[8232,8233,1],[8239,8287,48],[12288,12288,1]];static Zl=[[8232,8232,1]];static Zp=[[8233,8233,1]];static Zs=[[32,160,128],[5760,8192,2432],[8193,8202,1],[8239,8287,48],[12288,12288,1]];static Adlam=[[125184,125259,1],[125264,125273,1],[125278,125279,1]];static Ahom=[[71424,71450,1],[71453,71467,1],[71472,71494,1]];static Anatolian_Hieroglyphs=[[82944,83526,1]];static Arabic=[[1536,1540,1],[1542,1547,1],[1549,1562,1],[1564,1566,1],[1568,1599,1],[1601,1610,1],[1622,1647,1],[1649,1756,1],[1758,1791,1],[1872,1919,1],[2160,2190,1],[2192,2193,1],[2199,2273,1],[2275,2303,1],[64336,64450,1],[64467,64829,1],[64832,64911,1],[64914,64967,1],[64975,65008,33],[65009,65023,1],[65136,65140,1],[65142,65276,1],[69216,69246,1],[69314,69316,1],[69372,69375,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[126704,126705,1]];static Armenian=[[1329,1366,1],[1369,1418,1],[1421,1423,1],[64275,64279,1]];static Avestan=[[68352,68405,1],[68409,68415,1]];static Balinese=[[6912,6988,1],[6990,7039,1]];static Bamum=[[42656,42743,1],[92160,92728,1]];static Bassa_Vah=[[92880,92909,1],[92912,92917,1]];static Batak=[[7104,7155,1],[7164,7167,1]];static Bengali=[[2432,2435,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2492,2500,1],[2503,2504,1],[2507,2510,1],[2519,2524,5],[2525,2527,2],[2528,2531,1],[2534,2558,1]];static Bhaiksuki=[[72704,72712,1],[72714,72758,1],[72760,72773,1],[72784,72812,1]];static Bopomofo=[[746,747,1],[12549,12591,1],[12704,12735,1]];static Brahmi=[[69632,69709,1],[69714,69749,1],[69759,69759,1]];static Braille=[[10240,10495,1]];static Buginese=[[6656,6683,1],[6686,6687,1]];static Buhid=[[5952,5971,1]];static Canadian_Aboriginal=[[5120,5759,1],[6320,6389,1],[72368,72383,1]];static Carian=[[66208,66256,1]];static Caucasian_Albanian=[[66864,66915,1],[66927,66927,1]];static Chakma=[[69888,69940,1],[69942,69959,1]];static Cham=[[43520,43574,1],[43584,43597,1],[43600,43609,1],[43612,43615,1]];static Cherokee=[[5024,5109,1],[5112,5117,1],[43888,43967,1]];static Chorasmian=[[69552,69579,1]];static Common=[[0,64,1],[91,96,1],[123,169,1],[171,185,1],[187,191,1],[215,247,32],[697,735,1],[741,745,1],[748,767,1],[884,894,10],[901,903,2],[1541,1548,7],[1563,1567,4],[1600,1757,157],[2274,2404,130],[2405,3647,1242],[4053,4056,1],[4347,5867,1520],[5868,5869,1],[5941,5942,1],[6146,6147,1],[6149,7379,1230],[7393,7401,8],[7402,7404,1],[7406,7411,1],[7413,7415,1],[7418,8192,774],[8193,8203,1],[8206,8292,1],[8294,8304,1],[8308,8318,1],[8320,8334,1],[8352,8384,1],[8448,8485,1],[8487,8489,1],[8492,8497,1],[8499,8525,1],[8527,8543,1],[8585,8587,1],[8592,9257,1],[9280,9290,1],[9312,10239,1],[10496,11123,1],[11126,11157,1],[11159,11263,1],[11776,11869,1],[12272,12292,1],[12294,12296,2],[12297,12320,1],[12336,12343,1],[12348,12351,1],[12443,12444,1],[12448,12539,91],[12540,12688,148],[12689,12703,1],[12736,12773,1],[12783,12832,49],[12833,12895,1],[12927,13007,1],[13055,13144,89],[13145,13311,1],[19904,19967,1],[42752,42785,1],[42888,42890,1],[43056,43065,1],[43310,43471,161],[43867,43882,15],[43883,64830,20947],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65126,1],[65128,65131,1],[65279,65281,2],[65282,65312,1],[65339,65344,1],[65371,65381,1],[65392,65438,46],[65439,65504,65],[65505,65510,1],[65512,65518,1],[65529,65533,1],[65792,65794,1],[65799,65843,1],[65847,65855,1],[65936,65948,1],[66000,66044,1],[66273,66299,1],[113824,113827,1],[117760,118009,1],[118016,118451,1],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119142,1],[119146,119162,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119488,119507,1],[119520,119539,1],[119552,119638,1],[119648,119672,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120779,1],[120782,120831,1],[126065,126132,1],[126209,126269,1],[126976,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127232,127405,1],[127462,127487,1],[127489,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129211,1],[129216,129217,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129673,1],[129679,129734,1],[129742,129756,1],[129759,129769,1],[129776,129784,1],[129792,129938,1],[129940,130041,1],[917505,917536,31],[917537,917631,1]];static foldCommon=[[924,956,32]];static Coptic=[[994,1007,1],[11392,11507,1],[11513,11519,1]];static Cuneiform=[[73728,74649,1],[74752,74862,1],[74864,74868,1],[74880,75075,1]];static Cypriot=[[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3]];static Cypro_Minoan=[[77712,77810,1]];static Cyrillic=[[1024,1156,1],[1159,1327,1],[7296,7306,1],[7467,7544,77],[11744,11775,1],[42560,42655,1],[65070,65071,1],[122928,122989,1],[123023,123023,1]];static Deseret=[[66560,66639,1]];static Devanagari=[[2304,2384,1],[2389,2403,1],[2406,2431,1],[43232,43263,1],[72448,72457,1]];static Dives_Akuru=[[71936,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71989,1],[71991,71992,1],[71995,72006,1],[72016,72025,1]];static Dogra=[[71680,71739,1]];static Duployan=[[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[113820,113823,1]];static Egyptian_Hieroglyphs=[[77824,78933,1],[78944,82938,1]];static Elbasan=[[66816,66855,1]];static Elymaic=[[69600,69622,1]];static Ethiopic=[[4608,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4957,4988,1],[4992,5017,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1]];static Garay=[[68928,68965,1],[68969,68997,1],[69006,69007,1]];static Georgian=[[4256,4293,1],[4295,4301,6],[4304,4346,1],[4348,4351,1],[7312,7354,1],[7357,7359,1],[11520,11557,1],[11559,11565,6]];static Glagolitic=[[11264,11359,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1]];static Gothic=[[66352,66378,1]];static Grantha=[[70400,70403,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70460,70468,1],[70471,70472,1],[70475,70477,1],[70480,70487,7],[70493,70499,1],[70502,70508,1],[70512,70516,1]];static Greek=[[880,883,1],[885,887,1],[890,893,1],[895,900,5],[902,904,2],[905,906,1],[908,910,2],[911,929,1],[931,993,1],[1008,1023,1],[7462,7466,1],[7517,7521,1],[7526,7530,1],[7615,7936,321],[7937,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8132,1],[8134,8147,1],[8150,8155,1],[8157,8175,1],[8178,8180,1],[8182,8190,1],[8486,43877,35391],[65856,65934,1],[65952,119296,53344],[119297,119365,1]];static foldGreek=[[181,837,656]];static Gujarati=[[2689,2691,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2748,2757,1],[2759,2761,1],[2763,2765,1],[2768,2784,16],[2785,2787,1],[2790,2801,1],[2809,2815,1]];static Gunjala_Gondi=[[73056,73061,1],[73063,73064,1],[73066,73102,1],[73104,73105,1],[73107,73112,1],[73120,73129,1]];static Gurmukhi=[[2561,2563,1],[2565,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2649,8],[2650,2652,1],[2654,2662,8],[2663,2678,1]];static Gurung_Khema=[[90368,90425,1]];static Han=[[11904,11929,1],[11931,12019,1],[12032,12245,1],[12293,12295,2],[12321,12329,1],[12344,12347,1],[13312,19903,1],[19968,40959,1],[63744,64109,1],[64112,64217,1],[94178,94179,1],[94192,94193,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static Hangul=[[4352,4607,1],[12334,12335,1],[12593,12686,1],[12800,12830,1],[12896,12926,1],[43360,43388,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1]];static Hanifi_Rohingya=[[68864,68903,1],[68912,68921,1]];static Hanunoo=[[5920,5940,1]];static Hatran=[[67808,67826,1],[67828,67829,1],[67835,67839,1]];static Hebrew=[[1425,1479,1],[1488,1514,1],[1519,1524,1],[64285,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64335,1]];static Hiragana=[[12353,12438,1],[12445,12447,1],[110593,110879,1],[110898,110928,30],[110929,110930,1],[127488,127488,1]];static Imperial_Aramaic=[[67648,67669,1],[67671,67679,1]];static Inherited=[[768,879,1],[1157,1158,1],[1611,1621,1],[1648,2385,737],[2386,2388,1],[6832,6862,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8204,8205,1],[8400,8432,1],[12330,12333,1],[12441,12442,1],[65024,65039,1],[65056,65069,1],[66045,66272,227],[70459,118528,48069],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[917760,917999,1]];static foldInherited=[[921,953,32],[8126,8126,1]];static Inscriptional_Pahlavi=[[68448,68466,1],[68472,68479,1]];static Inscriptional_Parthian=[[68416,68437,1],[68440,68447,1]];static Javanese=[[43392,43469,1],[43472,43481,1],[43486,43487,1]];static Kaithi=[[69760,69826,1],[69837,69837,1]];static Kannada=[[3200,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3260,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3293,3294,1],[3296,3299,1],[3302,3311,1],[3313,3315,1]];static Katakana=[[12449,12538,1],[12541,12543,1],[12784,12799,1],[13008,13054,1],[13056,13143,1],[65382,65391,1],[65393,65437,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110880,288],[110881,110882,1],[110933,110948,15],[110949,110951,1]];static Kawi=[[73472,73488,1],[73490,73530,1],[73534,73562,1]];static Kayah_Li=[[43264,43309,1],[43311,43311,1]];static Kharoshthi=[[68096,68099,1],[68101,68102,1],[68108,68115,1],[68117,68119,1],[68121,68149,1],[68152,68154,1],[68159,68168,1],[68176,68184,1]];static Khitan_Small_Script=[[94180,101120,6940],[101121,101589,1],[101631,101631,1]];static Khmer=[[6016,6109,1],[6112,6121,1],[6128,6137,1],[6624,6655,1]];static Khojki=[[70144,70161,1],[70163,70209,1]];static Khudawadi=[[70320,70378,1],[70384,70393,1]];static Kirat_Rai=[[93504,93561,1]];static Lao=[[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3773,1],[3776,3780,1],[3782,3784,2],[3785,3790,1],[3792,3801,1],[3804,3807,1]];static Latin=[[65,90,1],[97,122,1],[170,186,16],[192,214,1],[216,246,1],[248,696,1],[736,740,1],[7424,7461,1],[7468,7516,1],[7522,7525,1],[7531,7543,1],[7545,7614,1],[7680,7935,1],[8305,8319,14],[8336,8348,1],[8490,8491,1],[8498,8526,28],[8544,8584,1],[11360,11391,1],[42786,42887,1],[42891,42957,1],[42960,42961,1],[42963,42965,2],[42966,42972,1],[42994,43007,1],[43824,43866,1],[43868,43876,1],[43878,43881,1],[64256,64262,1],[65313,65338,1],[65345,65370,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[122624,122654,1],[122661,122666,1]];static Lepcha=[[7168,7223,1],[7227,7241,1],[7245,7247,1]];static Limbu=[[6400,6430,1],[6432,6443,1],[6448,6459,1],[6464,6468,4],[6469,6479,1]];static Linear_A=[[67072,67382,1],[67392,67413,1],[67424,67431,1]];static Linear_B=[[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1]];static Lisu=[[42192,42239,1],[73648,73648,1]];static Lycian=[[66176,66204,1]];static Lydian=[[67872,67897,1],[67903,67903,1]];static Mahajani=[[69968,70006,1]];static Makasar=[[73440,73464,1]];static Malayalam=[[3328,3340,1],[3342,3344,1],[3346,3396,1],[3398,3400,1],[3402,3407,1],[3412,3427,1],[3430,3455,1]];static Mandaic=[[2112,2139,1],[2142,2142,1]];static Manichaean=[[68288,68326,1],[68331,68342,1]];static Marchen=[[72816,72847,1],[72850,72871,1],[72873,72886,1]];static Masaram_Gondi=[[72960,72966,1],[72968,72969,1],[72971,73014,1],[73018,73020,2],[73021,73023,2],[73024,73031,1],[73040,73049,1]];static Medefaidrin=[[93760,93850,1]];static Meetei_Mayek=[[43744,43766,1],[43968,44013,1],[44016,44025,1]];static Mende_Kikakui=[[124928,125124,1],[125127,125142,1]];static Meroitic_Cursive=[[68000,68023,1],[68028,68047,1],[68050,68095,1]];static Meroitic_Hieroglyphs=[[67968,67999,1]];static Miao=[[93952,94026,1],[94031,94087,1],[94095,94111,1]];static Modi=[[71168,71236,1],[71248,71257,1]];static Mongolian=[[6144,6145,1],[6148,6150,2],[6151,6169,1],[6176,6264,1],[6272,6314,1],[71264,71276,1]];static Mro=[[92736,92766,1],[92768,92777,1],[92782,92783,1]];static Multani=[[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70313,1]];static Myanmar=[[4096,4255,1],[43488,43518,1],[43616,43647,1],[71376,71395,1]];static Nabataean=[[67712,67742,1],[67751,67759,1]];static Nag_Mundari=[[124112,124153,1]];static Nandinagari=[[72096,72103,1],[72106,72151,1],[72154,72164,1]];static New_Tai_Lue=[[6528,6571,1],[6576,6601,1],[6608,6618,1],[6622,6623,1]];static Newa=[[70656,70747,1],[70749,70753,1]];static Nko=[[1984,2042,1],[2045,2047,1]];static Nushu=[[94177,110960,16783],[110961,111355,1]];static Nyiakeng_Puachue_Hmong=[[123136,123180,1],[123184,123197,1],[123200,123209,1],[123214,123215,1]];static Ogham=[[5760,5788,1]];static Ol_Chiki=[[7248,7295,1]];static Ol_Onal=[[124368,124410,1],[124415,124415,1]];static Old_Hungarian=[[68736,68786,1],[68800,68850,1],[68858,68863,1]];static Old_Italic=[[66304,66339,1],[66349,66351,1]];static Old_North_Arabian=[[68224,68255,1]];static Old_Permic=[[66384,66426,1]];static Old_Persian=[[66464,66499,1],[66504,66517,1]];static Old_Sogdian=[[69376,69415,1]];static Old_South_Arabian=[[68192,68223,1]];static Old_Turkic=[[68608,68680,1]];static Old_Uyghur=[[69488,69513,1]];static Oriya=[[2817,2819,1],[2821,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2876,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2908,2909,1],[2911,2915,1],[2918,2935,1]];static Osage=[[66736,66771,1],[66776,66811,1]];static Osmanya=[[66688,66717,1],[66720,66729,1]];static Pahawh_Hmong=[[92928,92997,1],[93008,93017,1],[93019,93025,1],[93027,93047,1],[93053,93071,1]];static Palmyrene=[[67680,67711,1]];static Pau_Cin_Hau=[[72384,72440,1]];static Phags_Pa=[[43072,43127,1]];static Phoenician=[[67840,67867,1],[67871,67871,1]];static Psalter_Pahlavi=[[68480,68497,1],[68505,68508,1],[68521,68527,1]];static Rejang=[[43312,43347,1],[43359,43359,1]];static Runic=[[5792,5866,1],[5870,5880,1]];static Samaritan=[[2048,2093,1],[2096,2110,1]];static Saurashtra=[[43136,43205,1],[43214,43225,1]];static Sharada=[[70016,70111,1]];static Shavian=[[66640,66687,1]];static Siddham=[[71040,71093,1],[71096,71133,1]];static SignWriting=[[120832,121483,1],[121499,121503,1],[121505,121519,1]];static Sinhala=[[3457,3459,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3558,3567,1],[3570,3572,1],[70113,70132,1]];static Sogdian=[[69424,69465,1]];static Sora_Sompeng=[[69840,69864,1],[69872,69881,1]];static Soyombo=[[72272,72354,1]];static Sundanese=[[7040,7103,1],[7360,7367,1]];static Sunuwar=[[72640,72673,1],[72688,72697,1]];static Syloti_Nagri=[[43008,43052,1]];static Syriac=[[1792,1805,1],[1807,1866,1],[1869,1871,1],[2144,2154,1]];static Tagalog=[[5888,5909,1],[5919,5919,1]];static Tagbanwa=[[5984,5996,1],[5998,6000,1],[6002,6003,1]];static Tai_Le=[[6480,6509,1],[6512,6516,1]];static Tai_Tham=[[6688,6750,1],[6752,6780,1],[6783,6793,1],[6800,6809,1],[6816,6829,1]];static Tai_Viet=[[43648,43714,1],[43739,43743,1]];static Takri=[[71296,71353,1],[71360,71369,1]];static Tamil=[[2946,2947,1],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3006,3010,1],[3014,3016,1],[3018,3021,1],[3024,3031,7],[3046,3066,1],[73664,73713,1],[73727,73727,1]];static Tangsa=[[92784,92862,1],[92864,92873,1]];static Tangut=[[94176,94208,32],[94209,100343,1],[100352,101119,1],[101632,101640,1]];static Telugu=[[3072,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3132,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3160,3162,1],[3165,3168,3],[3169,3171,1],[3174,3183,1],[3191,3199,1]];static Thaana=[[1920,1969,1]];static Thai=[[3585,3642,1],[3648,3675,1]];static Tibetan=[[3840,3911,1],[3913,3948,1],[3953,3991,1],[3993,4028,1],[4030,4044,1],[4046,4052,1],[4057,4058,1]];static Tifinagh=[[11568,11623,1],[11631,11632,1],[11647,11647,1]];static Tirhuta=[[70784,70855,1],[70864,70873,1]];static Todhri=[[67008,67059,1]];static Toto=[[123536,123566,1]];static Tulu_Tigalari=[[70528,70537,1],[70539,70542,3],[70544,70581,1],[70583,70592,1],[70594,70597,3],[70599,70602,1],[70604,70613,1],[70615,70616,1],[70625,70626,1]];static Ugaritic=[[66432,66461,1],[66463,66463,1]];static Vai=[[42240,42539,1]];static Vithkuqi=[[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1]];static Wancho=[[123584,123641,1],[123647,123647,1]];static Warang_Citi=[[71840,71922,1],[71935,71935,1]];static Yezidi=[[69248,69289,1],[69291,69293,1],[69296,69297,1]];static Yi=[[40960,42124,1],[42128,42182,1]];static Zanabazar_Square=[[72192,72263,1]];static CATEGORIES=(()=>new Map([["C",W.C],["Cc",W.Cc],["Cf",W.Cf],["Co",W.Co],["Cs",W.Cs],["L",W.L],["Ll",W.Ll],["Lm",W.Lm],["Lo",W.Lo],["Lt",W.Lt],["Lu",W.Lu],["M",W.M],["Mc",W.Mc],["Me",W.Me],["Mn",W.Mn],["N",W.N],["Nd",W.Nd],["Nl",W.Nl],["No",W.No],["P",W.P],["Pc",W.Pc],["Pd",W.Pd],["Pe",W.Pe],["Pf",W.Pf],["Pi",W.Pi],["Po",W.Po],["Ps",W.Ps],["S",W.S],["Sc",W.Sc],["Sk",W.Sk],["Sm",W.Sm],["So",W.So],["Z",W.Z],["Zl",W.Zl],["Zp",W.Zp],["Zs",W.Zs]]))();static SCRIPTS=(()=>new Map([["Adlam",W.Adlam],["Ahom",W.Ahom],["Anatolian_Hieroglyphs",W.Anatolian_Hieroglyphs],["Arabic",W.Arabic],["Armenian",W.Armenian],["Avestan",W.Avestan],["Balinese",W.Balinese],["Bamum",W.Bamum],["Bassa_Vah",W.Bassa_Vah],["Batak",W.Batak],["Bengali",W.Bengali],["Bhaiksuki",W.Bhaiksuki],["Bopomofo",W.Bopomofo],["Brahmi",W.Brahmi],["Braille",W.Braille],["Buginese",W.Buginese],["Buhid",W.Buhid],["Canadian_Aboriginal",W.Canadian_Aboriginal],["Carian",W.Carian],["Caucasian_Albanian",W.Caucasian_Albanian],["Chakma",W.Chakma],["Cham",W.Cham],["Cherokee",W.Cherokee],["Chorasmian",W.Chorasmian],["Common",W.Common],["Coptic",W.Coptic],["Cuneiform",W.Cuneiform],["Cypriot",W.Cypriot],["Cypro_Minoan",W.Cypro_Minoan],["Cyrillic",W.Cyrillic],["Deseret",W.Deseret],["Devanagari",W.Devanagari],["Dives_Akuru",W.Dives_Akuru],["Dogra",W.Dogra],["Duployan",W.Duployan],["Egyptian_Hieroglyphs",W.Egyptian_Hieroglyphs],["Elbasan",W.Elbasan],["Elymaic",W.Elymaic],["Ethiopic",W.Ethiopic],["Garay",W.Garay],["Georgian",W.Georgian],["Glagolitic",W.Glagolitic],["Gothic",W.Gothic],["Grantha",W.Grantha],["Greek",W.Greek],["Gujarati",W.Gujarati],["Gunjala_Gondi",W.Gunjala_Gondi],["Gurmukhi",W.Gurmukhi],["Gurung_Khema",W.Gurung_Khema],["Han",W.Han],["Hangul",W.Hangul],["Hanifi_Rohingya",W.Hanifi_Rohingya],["Hanunoo",W.Hanunoo],["Hatran",W.Hatran],["Hebrew",W.Hebrew],["Hiragana",W.Hiragana],["Imperial_Aramaic",W.Imperial_Aramaic],["Inherited",W.Inherited],["Inscriptional_Pahlavi",W.Inscriptional_Pahlavi],["Inscriptional_Parthian",W.Inscriptional_Parthian],["Javanese",W.Javanese],["Kaithi",W.Kaithi],["Kannada",W.Kannada],["Katakana",W.Katakana],["Kawi",W.Kawi],["Kayah_Li",W.Kayah_Li],["Kharoshthi",W.Kharoshthi],["Khitan_Small_Script",W.Khitan_Small_Script],["Khmer",W.Khmer],["Khojki",W.Khojki],["Khudawadi",W.Khudawadi],["Kirat_Rai",W.Kirat_Rai],["Lao",W.Lao],["Latin",W.Latin],["Lepcha",W.Lepcha],["Limbu",W.Limbu],["Linear_A",W.Linear_A],["Linear_B",W.Linear_B],["Lisu",W.Lisu],["Lycian",W.Lycian],["Lydian",W.Lydian],["Mahajani",W.Mahajani],["Makasar",W.Makasar],["Malayalam",W.Malayalam],["Mandaic",W.Mandaic],["Manichaean",W.Manichaean],["Marchen",W.Marchen],["Masaram_Gondi",W.Masaram_Gondi],["Medefaidrin",W.Medefaidrin],["Meetei_Mayek",W.Meetei_Mayek],["Mende_Kikakui",W.Mende_Kikakui],["Meroitic_Cursive",W.Meroitic_Cursive],["Meroitic_Hieroglyphs",W.Meroitic_Hieroglyphs],["Miao",W.Miao],["Modi",W.Modi],["Mongolian",W.Mongolian],["Mro",W.Mro],["Multani",W.Multani],["Myanmar",W.Myanmar],["Nabataean",W.Nabataean],["Nag_Mundari",W.Nag_Mundari],["Nandinagari",W.Nandinagari],["New_Tai_Lue",W.New_Tai_Lue],["Newa",W.Newa],["Nko",W.Nko],["Nushu",W.Nushu],["Nyiakeng_Puachue_Hmong",W.Nyiakeng_Puachue_Hmong],["Ogham",W.Ogham],["Ol_Chiki",W.Ol_Chiki],["Ol_Onal",W.Ol_Onal],["Old_Hungarian",W.Old_Hungarian],["Old_Italic",W.Old_Italic],["Old_North_Arabian",W.Old_North_Arabian],["Old_Permic",W.Old_Permic],["Old_Persian",W.Old_Persian],["Old_Sogdian",W.Old_Sogdian],["Old_South_Arabian",W.Old_South_Arabian],["Old_Turkic",W.Old_Turkic],["Old_Uyghur",W.Old_Uyghur],["Oriya",W.Oriya],["Osage",W.Osage],["Osmanya",W.Osmanya],["Pahawh_Hmong",W.Pahawh_Hmong],["Palmyrene",W.Palmyrene],["Pau_Cin_Hau",W.Pau_Cin_Hau],["Phags_Pa",W.Phags_Pa],["Phoenician",W.Phoenician],["Psalter_Pahlavi",W.Psalter_Pahlavi],["Rejang",W.Rejang],["Runic",W.Runic],["Samaritan",W.Samaritan],["Saurashtra",W.Saurashtra],["Sharada",W.Sharada],["Shavian",W.Shavian],["Siddham",W.Siddham],["SignWriting",W.SignWriting],["Sinhala",W.Sinhala],["Sogdian",W.Sogdian],["Sora_Sompeng",W.Sora_Sompeng],["Soyombo",W.Soyombo],["Sundanese",W.Sundanese],["Sunuwar",W.Sunuwar],["Syloti_Nagri",W.Syloti_Nagri],["Syriac",W.Syriac],["Tagalog",W.Tagalog],["Tagbanwa",W.Tagbanwa],["Tai_Le",W.Tai_Le],["Tai_Tham",W.Tai_Tham],["Tai_Viet",W.Tai_Viet],["Takri",W.Takri],["Tamil",W.Tamil],["Tangsa",W.Tangsa],["Tangut",W.Tangut],["Telugu",W.Telugu],["Thaana",W.Thaana],["Thai",W.Thai],["Tibetan",W.Tibetan],["Tifinagh",W.Tifinagh],["Tirhuta",W.Tirhuta],["Todhri",W.Todhri],["Toto",W.Toto],["Tulu_Tigalari",W.Tulu_Tigalari],["Ugaritic",W.Ugaritic],["Vai",W.Vai],["Vithkuqi",W.Vithkuqi],["Wancho",W.Wancho],["Warang_Citi",W.Warang_Citi],["Yezidi",W.Yezidi],["Yi",W.Yi],["Zanabazar_Square",W.Zanabazar_Square]]))();static FOLD_CATEGORIES=(()=>new Map([["L",W.foldL],["Ll",W.foldLl],["Lt",W.foldLt],["Lu",W.foldLu],["M",W.foldM],["Mn",W.foldMn]]))();static FOLD_SCRIPT=(()=>new Map([["Common",W.foldCommon],["Greek",W.foldGreek],["Inherited",W.foldInherited]]))()}class m${static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32($,_){let Q=0,H=$.length;while(Q<H){let Y=Q+Math.floor((H-Q)/2),q=$[Y];if(q[0]<=_&&_<=q[1])return(_-q[0])%q[2]===0;if(_<q[0])H=Y;else Q=Y+1}return!1}static is($,_){if(_<=this.MAX_LATIN1){for(let Q of $){if(_>Q[1])continue;if(_<Q[0])return!1;return(_-Q[0])%Q[2]===0}return!1}return $.length>0&&_>=$[0][0]&&this.is32($,_)}static isUpper($){if($<=this.MAX_LATIN1){let _=String.fromCodePoint($);return _.toUpperCase()===_&&_.toLowerCase()!==_}return this.is(W.Upper,$)}static isPrint($){if($<=this.MAX_LATIN1)return $>=32&&$<127||$>=161&&$!==173;return this.is(W.L,$)||this.is(W.M,$)||this.is(W.N,$)||this.is(W.P,$)||this.is(W.S,$)}static simpleFold($){if(W.CASE_ORBIT.has($))return W.CASE_ORBIT.get($);let _=F.toLowerCase($);if(_!==$)return _;return F.toUpperCase($)}static equalsIgnoreCase($,_){if($<0||_<0||$===_)return!0;if($<=this.MAX_ASCII&&_<=this.MAX_ASCII){if(F.CODES.get("A")<=$&&$<=F.CODES.get("Z"))$|=32;if(F.CODES.get("A")<=_&&_<=F.CODES.get("Z"))_|=32;return $===_}for(let Q=this.simpleFold($);Q!==$;Q=this.simpleFold(Q))if(Q===_)return!0;return!1}}class M${static METACHARACTERS="\\.+*?()|[]{}^$";static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=(()=>-1)();static emptyInts(){return[]}static isalnum($){return F.CODES.get("0")<=$&&$<=F.CODES.get("9")||F.CODES.get("a")<=$&&$<=F.CODES.get("z")||F.CODES.get("A")<=$&&$<=F.CODES.get("Z")}static unhex($){if(F.CODES.get("0")<=$&&$<=F.CODES.get("9"))return $-F.CODES.get("0");if(F.CODES.get("a")<=$&&$<=F.CODES.get("f"))return $-F.CODES.get("a")+10;if(F.CODES.get("A")<=$&&$<=F.CODES.get("F"))return $-F.CODES.get("A")+10;return-1}static escapeRune($){let _="";if(m$.isPrint($)){if(this.METACHARACTERS.indexOf(String.fromCodePoint($))>=0)_+="\\";_+=String.fromCodePoint($)}else switch($){case F.CODES.get('"'):_+="\\\"";break;case F.CODES.get("\\"):_+="\\\\";break;case F.CODES.get("\t"):_+="\\t";break;case F.CODES.get(`
12
12
  `):_+="\\n";break;case F.CODES.get("\r"):_+="\\r";break;case F.CODES.get("\b"):_+="\\b";break;case F.CODES.get("\f"):_+="\\f";break;default:{let Q=$.toString(16);if($<256){if(_+="\\x",Q.length===1)_+="0";_+=Q}else _+=`\\x{${Q}}`;break}}return _}static stringToRunes($){return String($).split("").map((_)=>_.codePointAt(0))}static runeToString($){return String.fromCodePoint($)}static isWordRune($){return F.CODES.get("a")<=$&&$<=F.CODES.get("z")||F.CODES.get("A")<=$&&$<=F.CODES.get("Z")||F.CODES.get("0")<=$&&$<=F.CODES.get("9")||$===F.CODES.get("_")}static emptyOpContext($,_){let Q=0;if($<0)Q|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE;if($===F.CODES.get(`
13
13
  `))Q|=this.EMPTY_BEGIN_LINE;if(_<0)Q|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE;if(_===F.CODES.get(`
14
- `))Q|=this.EMPTY_END_LINE;if(this.isWordRune($)!==this.isWordRune(_))Q|=this.EMPTY_WORD_BOUNDARY;else Q|=this.EMPTY_NO_WORD_BOUNDARY;return Q}static quoteMeta($){return $.split("").map((_)=>{if(this.METACHARACTERS.indexOf(_)>=0)return`\\${_}`;return _}).join("")}static charCount($){return $>m$.MAX_BMP?2:1}static stringToUtf8ByteArray($){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode($));else{let _=[],Q=0;for(let H=0;H<$.length;H++){let Y=$.charCodeAt(H);if(Y<128)_[Q++]=Y;else if(Y<2048)_[Q++]=Y>>6|192,_[Q++]=Y&63|128;else if((Y&64512)===55296&&H+1<$.length&&($.charCodeAt(H+1)&64512)===56320)Y=65536+((Y&1023)<<10)+($.charCodeAt(++H)&1023),_[Q++]=Y>>18|240,_[Q++]=Y>>12&63|128,_[Q++]=Y>>6&63|128,_[Q++]=Y&63|128;else _[Q++]=Y>>12|224,_[Q++]=Y>>6&63|128,_[Q++]=Y&63|128}return _}}static utf8ByteArrayToString($){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array($));else{let _=[],Q=0,H=0;while(Q<$.length){let Y=$[Q++];if(Y<128)_[H++]=String.fromCharCode(Y);else if(Y>191&&Y<224){let q=$[Q++];_[H++]=String.fromCharCode((Y&31)<<6|q&63)}else if(Y>239&&Y<365){let q=$[Q++],B=$[Q++],V=$[Q++],J=((Y&7)<<18|(q&63)<<12|(B&63)<<6|V&63)-65536;_[H++]=String.fromCharCode(55296+(J>>10)),_[H++]=String.fromCharCode(56320+(J&1023))}else{let q=$[Q++],B=$[Q++];_[H++]=String.fromCharCode((Y&15)<<12|(q&63)<<6|B&63)}}return _.join("")}}}var _1=($=[],_=0)=>{let Q={};for(let H=0;H<$.length;H++){let Y=$[H],q=_+H;Q[Y]=q,Q[q]=Y}return Object.freeze(Q)};class X0{static Encoding=(()=>_1(["UTF_16","UTF_8"]))();getEncoding(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===X0.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===X0.Encoding.UTF_16}}class w{static Op=(()=>_1(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","LEFT_PAREN","VERTICAL_BAR"]))();static isPseudoOp($){return $>=w.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen($){if($===F.CODES.get("-"))return"\\";return""}static fromRegexp($){let _=new w($.op);return _.flags=$.flags,_.subs=$.subs,_.runes=$.runes,_.cap=$.cap,_.min=$.min,_.max=$.max,_.name=$.name,_.namedGroups=$.namedGroups,_}constructor($){this.op=$,this.flags=0,this.subs=w.emptySubs(),this.runes=[],this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=w.emptySubs(),this.runes=[],this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let $="";switch(this.op){case w.Op.NO_MATCH:$+="[^\\x00-\\x{10FFFF}]";break;case w.Op.EMPTY_MATCH:$+="(?:)";break;case w.Op.STAR:case w.Op.PLUS:case w.Op.QUEST:case w.Op.REPEAT:{let _=this.subs[0];if(_.op>w.Op.CAPTURE||_.op===w.Op.LITERAL&&_.runes.length>1)$+=`(?:${_.appendTo()})`;else $+=_.appendTo();switch(this.op){case w.Op.STAR:$+="*";break;case w.Op.PLUS:$+="+";break;case w.Op.QUEST:$+="?";break;case w.Op.REPEAT:if($+=`{${this.min}`,this.min!==this.max){if($+=",",this.max>=0)$+=this.max}$+="}";break}if((this.flags&C.NON_GREEDY)!==0)$+="?";break}case w.Op.CONCAT:{for(let _ of this.subs)if(_.op===w.Op.ALTERNATE)$+=`(?:${_.appendTo()})`;else $+=_.appendTo();break}case w.Op.ALTERNATE:{let _="";for(let Q of this.subs)$+=_,_="|",$+=Q.appendTo();break}case w.Op.LITERAL:if((this.flags&C.FOLD_CASE)!==0)$+="(?i:";for(let _ of this.runes)$+=M$.escapeRune(_);if((this.flags&C.FOLD_CASE)!==0)$+=")";break;case w.Op.ANY_CHAR_NOT_NL:$+="(?-s:.)";break;case w.Op.ANY_CHAR:$+="(?s:.)";break;case w.Op.CAPTURE:if(this.name===null||this.name.length===0)$+="(";else $+=`(?P<${this.name}>`;if(this.subs[0].op!==w.Op.EMPTY_MATCH)$+=this.subs[0].appendTo();$+=")";break;case w.Op.BEGIN_TEXT:$+="\\A";break;case w.Op.END_TEXT:if((this.flags&C.WAS_DOLLAR)!==0)$+="(?-m:$)";else $+="\\z";break;case w.Op.BEGIN_LINE:$+="^";break;case w.Op.END_LINE:$+="$";break;case w.Op.WORD_BOUNDARY:$+="\\b";break;case w.Op.NO_WORD_BOUNDARY:$+="\\B";break;case w.Op.CHAR_CLASS:if(this.runes.length%2!==0){$+="[invalid char class]";break}if($+="[",this.runes.length===0)$+="^\\x00-\\x{10FFFF}";else if(this.runes[0]===0&&this.runes[this.runes.length-1]===m$.MAX_RUNE){$+="^";for(let _=1;_<this.runes.length-1;_+=2){let Q=this.runes[_]+1,H=this.runes[_+1]-1;if($+=w.quoteIfHyphen(Q),$+=M$.escapeRune(Q),Q!==H)$+="-",$+=w.quoteIfHyphen(H),$+=M$.escapeRune(H)}}else for(let _=0;_<this.runes.length;_+=2){let Q=this.runes[_],H=this.runes[_+1];if($+=w.quoteIfHyphen(Q),$+=M$.escapeRune(Q),Q!==H)$+="-",$+=w.quoteIfHyphen(H),$+=M$.escapeRune(H)}$+="]";break;default:$+=this.op;break}return $}maxCap(){let $=0;if(this.op===w.Op.CAPTURE)$=this.cap;if(this.subs!==null)for(let _ of this.subs){let Q=_.maxCap();if($<Q)$=Q}return $}equals($){if(!($!==null&&$ instanceof w))return!1;if(this.op!==$.op)return!1;switch(this.op){case w.Op.END_TEXT:{if((this.flags&C.WAS_DOLLAR)!==($.flags&C.WAS_DOLLAR))return!1;break}case w.Op.LITERAL:case w.Op.CHAR_CLASS:{if(this.runes===null&&$.runes===null)break;if(this.runes===null||$.runes===null)return!1;if(this.runes.length!==$.runes.length)return!1;for(let _=0;_<this.runes.length;_++)if(this.runes[_]!==$.runes[_])return!1;break}case w.Op.ALTERNATE:case w.Op.CONCAT:{if(this.subs.length!==$.subs.length)return!1;for(let _=0;_<this.subs.length;++_)if(!this.subs[_].equals($.subs[_]))return!1;break}case w.Op.STAR:case w.Op.PLUS:case w.Op.QUEST:{if((this.flags&C.NON_GREEDY)!==($.flags&C.NON_GREEDY)||!this.subs[0].equals($.subs[0]))return!1;break}case w.Op.REPEAT:{if((this.flags&C.NON_GREEDY)!==($.flags&C.NON_GREEDY)||this.min!==$.min||this.max!==$.max||!this.subs[0].equals($.subs[0]))return!1;break}case w.Op.CAPTURE:{if(this.cap!==$.cap||(this.name===null?$.name!==null:this.name!==$.name)||!this.subs[0].equals($.subs[0]))return!1;break}}return!0}}class P{constructor($,_){this.sign=$,this.cls=_}}var g0=[48,57],m0=[9,10,12,13,32,32],u0=[48,57,65,90,95,95,97,122],G9=new Map([["\\d",new P(1,g0)],["\\D",new P(-1,g0)],["\\s",new P(1,m0)],["\\S",new P(-1,m0)],["\\w",new P(1,u0)],["\\W",new P(-1,u0)]]),l0=[48,57,65,90,97,122],p0=[65,90,97,122],d0=[0,127],c0=[9,9,32,32],i0=[0,31,127,127],n0=[48,57],o0=[33,126],r0=[97,122],s0=[32,126],a0=[33,47,58,64,91,96,123,126],t0=[9,13,32,32],e0=[65,90],$1=[48,57,65,90,95,95,97,122],X1=[48,57,65,70,97,102],A9=new Map([["[:alnum:]",new P(1,l0)],["[:^alnum:]",new P(-1,l0)],["[:alpha:]",new P(1,p0)],["[:^alpha:]",new P(-1,p0)],["[:ascii:]",new P(1,d0)],["[:^ascii:]",new P(-1,d0)],["[:blank:]",new P(1,c0)],["[:^blank:]",new P(-1,c0)],["[:cntrl:]",new P(1,i0)],["[:^cntrl:]",new P(-1,i0)],["[:digit:]",new P(1,n0)],["[:^digit:]",new P(-1,n0)],["[:graph:]",new P(1,o0)],["[:^graph:]",new P(-1,o0)],["[:lower:]",new P(1,r0)],["[:^lower:]",new P(-1,r0)],["[:print:]",new P(1,s0)],["[:^print:]",new P(-1,s0)],["[:punct:]",new P(1,a0)],["[:^punct:]",new P(-1,a0)],["[:space:]",new P(1,t0)],["[:^space:]",new P(-1,t0)],["[:upper:]",new P(1,e0)],["[:^upper:]",new P(-1,e0)],["[:word:]",new P(1,$1)],["[:^word:]",new P(-1,$1)],["[:xdigit:]",new P(1,X1)],["[:^xdigit:]",new P(-1,X1)]]);class _0 extends Error{constructor($,_){super($);this.name="BetterAuthError",this.message=$,this.cause=_,this.stack=""}}function m6($){return{authorize(_,Q="AND"){let H=!1;for(let[Y,q]of Object.entries(_)){let B=$[Y];if(!B)return{success:!1,error:`You are not allowed to access resource: ${Y}`};if(Array.isArray(q))H=q.every((V)=>B.includes(V));else if(typeof q==="object"){let V=q;if(V.connector==="OR")H=V.actions.some((J)=>B.includes(J));else H=V.actions.every((J)=>B.includes(J))}else throw new _0("Invalid access control request");if(H&&Q==="OR")return{success:H};if(!H&&Q==="AND")return{success:!1,error:`unauthorized to access resource "${Y}"`}}if(H)return{success:H};return{success:!1,error:"Not authorized"}},statements:$}}function u$($){return{newRole(_){return m6(_)},statements:$}}var Q0={organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"]},Y0=u$(Q0),Q1=Y0.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"]}),Y1=Y0.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"]}),H1=Y0.newRole({organization:[],member:[],invitation:[],team:[]});var u6={...Q0,project:["create","read","update","delete"]},l$=u$(u6),b9=l$.newRole({project:["create","read","update","delete"],...Y1.statements}),R9=l$.newRole({project:["create","read","update","delete"],...Q1.statements}),z9=l$.newRole({project:["create","read","update"],...H1.statements}),y9=l$.newRole({project:["read"]});function l6($){switch($.toLowerCase()){case"google":return"https://www.google.com";case"bing":return"https://www.bing.com";case"yahoo":return"https://www.yahoo.com";case"facebook":return"https://www.facebook.com";case"twitter":case"x":return"https://twitter.com";case"instagram":return"https://www.instagram.com";case"linkedin":return"https://www.linkedin.com";case"youtube":return"https://www.youtube.com";case"pinterest":return"https://www.pinterest.com";case"reddit":return"https://www.reddit.com";case"tiktok":return"https://www.tiktok.com";case"snapchat":return"https://www.snapchat.com";default:return null}}function W1($){if(!$||$.trim()==="")return null;let _=$.trim();if(_==="/"||_==="direct")return null;try{return new URL(_),_}catch(Q){if(_.includes(".")){if(_.startsWith("http"))return _;else if(_.match(/^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(\/.*)?$/))return`https://${_}`}let H=l6(_);if(H)return H;return _}}var p6;((f)=>(f.User=s$,f.Users=f0,f.Organization=r$,f.Organizations=x$,f.Member=o$,f.Members=h$,f.Event=S0,f.Events=I0,f.Workspace=Z0))(p6||={});var H0=y()?{getItem:()=>null,setItem:()=>{},removeItem:()=>{}}:window.localStorage;class W0{namespace;constructor({namespace:$}){this.namespace=$}getItem($){let _=H0.getItem(`${this.namespace}.${$}`)||"";try{return JSON.parse(_)}catch(Q){return null}}setItem($,_){H0.setItem(`${this.namespace}.${$}`,JSON.stringify(_))}removeItem($){H0.removeItem(`${this.namespace}.${$}`)}}var q0=new W0({namespace:"userpath"});var q1="referrer";function d6(){if(y())return{};let $={},_=L().location,Q="";if("search"in _)Q=_.search;else if("href"in _&&_.href)Q=new URL(_.href).search;if(Q){let H=new URLSearchParams(Q);for(let[Y,q]of H.entries())$[Y]=q}return $}function Z$(){let $=Z().referrer,_=d6(),Q=_.utm_source||_.source||_.ref||_.utm_medium||_.utm_campaign||_.utm_content,H=q0.getItem(q1),Y="";if($&&$.trim()!=="")Y=$;else if(Q){let q=W1(Q);if(q)Y=q}if(!Y&&H)Y=H;if(Y&&Y!==H){let q=L().location.host,B=new URL(Y).host;if(q!==B)q0.setItem(q1,Y)}return Y}class B0{#_;#$;#X;#Y;#H;#W;#q;#Q;#B;#O;#V;#E;#P;#S;#I;#J;#f;#L;#M;#K;#k;#D;#F;#N;#Z;#j;#G;#U;#z=60000;#A;#w=!1;#C;#b;#R=[];#v;constructor($,_=R){this.#_=$,this.#v=_,this.#$=new Set,this.#X=0,this.#J=null,this.#f=L().location.href,this.#L=new Map,this.#M=new WeakMap,this.#K=new WeakMap,this.#k=Date.now(),this.#D=0,this.#F=this.#k,this.#N=Z().hidden,this.#Z=Date.now(),this.#j=null,this.#G=!1,this.#A=null,this.#Y=this.handleClick.bind(this),this.#H=this.handleScroll.bind(this),this.#W=this.handleScroll.bind(this),this.#q=this.handleInputFocus.bind(this),this.#Q=this.handleInputBlur.bind(this),this.#B=this.handleFormChange.bind(this),this.#O=this.handleFormSubmit.bind(this),this.#V=this.handleVideoPlay.bind(this),this.#E=this.handleVideoPause.bind(this),this.#P=this.handleVideoEnd.bind(this),this.#S=this.handleVisibilityChange.bind(this),this.#I=this.handleBeforeUnload.bind(this),this.#U=this.handleUserActivity.bind(this),this.#C=this.handleError.bind(this),this.#b=this.handleRejection.bind(this);let Q=this.#v.autoTrack??R.autoTrack;if(typeof Q==="boolean"){if(Q)this.setupClickTracking(),this.setupScrollTracking(),this.setupFormTracking(),this.setupVideoTracking(),this.setupPageTimeTracking(),this.setupInactivityTracking(),this.setupPerformanceTracking()}else{if(Q.clicks!==!1)this.setupClickTracking();if(Q.scrolling!==!1)this.setupScrollTracking();if(Q.forms!==!1)this.setupFormTracking();if(Q.videos!==!1)this.setupVideoTracking();if(Q.pageVisibility!==!1)this.setupPageTimeTracking();if(Q.pageInactivity!==!1)this.setupInactivityTracking();if(Q.performance!==!1)this.setupPerformanceTracking()}}destroy(){if(L().removeEventListener("click",this.#Y),L().removeEventListener("scroll",this.#H),L().removeEventListener("resize",this.#W),L().removeEventListener("focus",this.#q,!0),L().removeEventListener("blur",this.#Q,!0),L().removeEventListener("change",this.#B,!0),L().removeEventListener("submit",this.#O,!0),L().removeEventListener("play",this.#V,!0),L().removeEventListener("pause",this.#E,!0),L().removeEventListener("ended",this.#P,!0),L().removeEventListener("visibilitychange",this.#S),L().removeEventListener("beforeunload",this.#I),this.#J)L().clearTimeout(this.#J);if(["mousemove","mousedown","keydown","touchstart","scroll"].forEach(($)=>{L().removeEventListener($,this.#U,!0)}),this.#j)L().clearTimeout(this.#j);this.uninstallErrorHandler(),this.#R.forEach(($)=>{try{$.disconnect()}catch(_){}}),this.#R=[]}setupClickTracking(){L().addEventListener("click",this.#Y)}handleClick($){let _=$.target;if(!_)return;let Q=this.extractClickLabel(_);if(!Q)return;this.trackCustomEvent("click",{label:Q,element:_.tagName.toLowerCase(),id:_.id||void 0})}handleScroll(){let $=L().location.href;if($!==this.#f)this.#f=$,this.#X=0,this.#$.clear();if(this.#J)L().clearTimeout(this.#J);this.#J=L().setTimeout(()=>{let _=this.calculateScrollDepth();if(_>this.#X)this.#X=_,this.checkAndTrackScrollDepth(_)},100)}setupScrollTracking(){L().addEventListener("scroll",this.#H),L().addEventListener("resize",this.#W)}calculateScrollDepth(){let $=L().innerHeight,_=Math.max(Z().documentElement.scrollHeight,Z().documentElement.offsetHeight,Z().documentElement.clientHeight),Q=L().pageYOffset||Z().documentElement.scrollTop;return Math.round((Q+$)/_*100)}checkAndTrackScrollDepth($){let _=L().location.href;if($>50&&!this.#$.has(_))this.#$.add(_),this.trackCustomEvent("scroll")}extractClickLabel($){let _=$.getAttribute("aria-label");if(_)return`${_}`;if($ instanceof HTMLButtonElement||$ instanceof HTMLAnchorElement){let H=$.textContent?.trim();if(H)return`${H}`}if($ instanceof HTMLInputElement){if($.type==="submit"&&$.value)return`${$.value}`;if($.type==="checkbox"){let H=this.findInputLabel($),Y=$.checked?"Checked":"Unchecked";return H?`${Y} ${H}`:null}}let Q=$.closest("label");if(Q){let H=Q.textContent?.trim();if(H)return`${H}`}return null}findInputLabel($){let _=$.getAttribute("aria-label");if(_)return _;if($.id){let H=Z().querySelector(`label[for="${$.id}"]`);if(H&&H.textContent)return H.textContent.trim()}let Q=$.closest("label");if(Q&&Q.textContent)return Q.textContent.trim().replace($.value,"").trim();return null}trackPageView(){let $={name:"page_view",url:L().location.href,referrer:Z$(),title:Z().title,timestamp:new Date().toISOString()};return this.#_.track($)}trackCustomEvent($,_={},Q={immediate:!1}){let{referrer:H}=_||{},Y={name:$,url:L().location.href||_.url,referrer:H||Z$(),title:Z().title,properties:J0(_,["url"]),timestamp:new Date().toISOString()};if(Q.immediate)return this.#_.publish([Y]);else return this.#_.track(Y)}trackPurchase($){let{referrer:_}=$.properties||{},Q={name:"purchase",url:$.url||L().location.href,referrer:_||Z$(),title:Z().title,price:$.price,currency:$.currency,amount:$.amount,properties:{...$.properties},timestamp:new Date().toISOString()};return this.#_.track(Q)}setupFormTracking(){L().addEventListener("focus",this.#q,!0),L().addEventListener("blur",this.#Q,!0),L().addEventListener("change",this.#B,!0),L().addEventListener("submit",this.#O,!0)}handleInputFocus($){let _=$.target;if(!_||!(_ instanceof HTMLInputElement||_ instanceof HTMLTextAreaElement||_ instanceof HTMLSelectElement))return;if(_ instanceof HTMLInputElement&&_.type==="password")return;this.#M.set(_,this.getElementValue(_));let Q=_.closest("form");if(Q&&!this.#L.has(Q))this.#L.set(Q,Date.now())}getElementValue($){if($ instanceof HTMLSelectElement)return $.value;if($ instanceof HTMLInputElement||$ instanceof HTMLTextAreaElement)return $.value;return""}handleInputBlur($){let _=$.target;if(!_||!(_ instanceof HTMLInputElement||_ instanceof HTMLTextAreaElement||_ instanceof HTMLSelectElement))return;if(_ instanceof HTMLInputElement&&_.type==="password")return;let Q=this.#M.get(_)||"",H=this.getElementValue(_);if(H!==Q&&H.trim()!==""){let Y=_ instanceof HTMLSelectElement?"select":_.type,q=this.findFormElementLabel(_)||this.getInputIdentifier(_);if(!q)return;this.trackCustomEvent("input_fill",{input_type:Y,label:q,form_name:this.getFormName(_)})}this.#M.delete(_)}getFormName($){let _=$.closest("form");if(!_)return;return _.getAttribute("name")||_.getAttribute("id")||_.getAttribute("aria-label")||void 0}getInputIdentifier($){return $.getAttribute("name")||$.getAttribute("id")||$.getAttribute("placeholder")||null}findFormElementLabel($){let _=$.getAttribute("aria-label");if(_)return _;if($.id){let H=Z().querySelector(`label[for="${$.id}"]`);if(H&&H.textContent)return H.textContent.trim()}let Q=$.closest("label");if(Q&&Q.textContent){let H=Q.textContent.trim(),Y=$ instanceof HTMLSelectElement?$.selectedOptions[0]?.text:$.value;return Y?H.replace(Y,"").trim():H}return null}handleFormChange($){let _=$.target;if(!_||!(_ instanceof HTMLSelectElement||_ instanceof HTMLInputElement))return;if(_ instanceof HTMLSelectElement)this.trackSelectChange(_);else if(_ instanceof HTMLInputElement){if(_.type==="radio")this.trackRadioChange(_);else if(_.type==="checkbox")this.trackCheckboxChange(_);else if(_.type==="range")this.trackRangeChange(_)}}trackSelectChange($){let _=this.findFormElementLabel($)||this.getInputIdentifier($);if(!_)return;let Q=$.selectedOptions[0];this.trackCustomEvent("input_select",{input_type:"select",label:_,option_label:Q?.text||"",form_name:this.getFormName($)})}trackRadioChange($){let _=this.findFormElementLabel($)||this.getInputIdentifier($);if(!_)return;let Q=$.name||_;this.trackCustomEvent("input_radio",{input_type:"radio",group:Q,label:_,form_name:this.getFormName($)})}trackCheckboxChange($){let _=this.findFormElementLabel($)||this.getInputIdentifier($);if(!_)return;this.trackCustomEvent("input_checkbox",{input_type:"checkbox",label:_,checked:$.checked,form_name:this.getFormName($)})}trackRangeChange($){let _=this.findFormElementLabel($)||this.getInputIdentifier($);if(!_)return;this.trackCustomEvent("input_range",{input_type:"range",label:_,form_name:this.getFormName($)})}handleFormSubmit($){let _=$.target;if(!_||!(_ instanceof HTMLFormElement))return;let Q=this.#L.get(_)||Date.now(),H=Date.now()-Q,Y=this.getFormName(_)||"unknown";this.trackCustomEvent("form_submit",{form_name:Y,time_to_complete:H}),this.#L.delete(_)}setupVideoTracking(){L().addEventListener("play",this.#V,!0),L().addEventListener("pause",this.#E,!0),L().addEventListener("ended",this.#P,!0)}getVideoMetadata($){let _={duration:Math.round($.duration),current_time:Math.round($.currentTime),src:$.currentSrc||$.src||void 0,title:$.title||void 0,video_id:$.id||void 0};for(let Y of $.attributes)if(Y.name.startsWith("data-")){let q=Y.name.replace("data-","").replace(/-/g,"_");_[q]=Y.value}if($.getAttribute("aria-label"))_.aria_label=$.getAttribute("aria-label");if($.getAttribute("aria-describedby"))_.aria_describedby=$.getAttribute("aria-describedby");let Q=$.parentElement;if(Q){if(Q.id)_.parent_id=Q.id;for(let B of Q.attributes)if(B.name.startsWith("data-")&&B.value){let V=`parent_${B.name.replace("data-","").replace(/-/g,"_")}`;_[V]=B.value}let Y=Q,q=0;while(Y&&q<3){if(Y.tagName==="SECTION"||Y.tagName==="ARTICLE"){if(Y.id)_.section_id=Y.id;if(Y.className)_.section_class=Y.className.trim();break}Y=Y.parentElement,q++}}let H=this.getNearbyVideoDescription($);if(H)_.nearby_text=H;if(_.src){let Y=new URL(_.src,window.location.href);_.video_domain=Y.hostname;let B=Y.pathname.split("/").pop();if(B&&B.includes("."))_.video_filename=B;if(Y.hostname.includes("youtube"))_.video_platform="youtube";else if(Y.hostname.includes("vimeo"))_.video_platform="vimeo";else if(Y.hostname.includes("wistia"))_.video_platform="wistia"}return Object.keys(_).forEach((Y)=>{if(_[Y]===void 0||_[Y]===null||_[Y]==="")delete _[Y]}),_}getNearbyVideoDescription($){let _=["h1, h2, h3, h4, h5, h6",'[role="heading"]',".video-title, .title","figcaption","caption"],Q=$.parentElement,H=0;while(Q&&H<2){for(let Y of _){let q=Q.querySelector(Y);if(q){let B=q.textContent?.trim();if(B&&B.length>0&&B.length<200)return B}}Q=Q.parentElement,H++}return}handleVideoPlay($){let _=$.target;if(!_||!(_ instanceof HTMLVideoElement))return;this.#K.set(_,Date.now()),this.trackCustomEvent("video_play",this.getVideoMetadata(_))}handleVideoPause($){let _=$.target;if(!_||!(_ instanceof HTMLVideoElement))return;let Q=this.#K.get(_),H=this.getVideoMetadata(_);if(Q)H.watch_time=Math.round((Date.now()-Q)/1000),this.#K.delete(_);this.trackCustomEvent("video_pause",H)}handleVideoEnd($){let _=$.target;if(!_||!(_ instanceof HTMLVideoElement))return;let Q=this.#K.get(_),H=this.getVideoMetadata(_);if(Q)H.watch_time=Math.round((Date.now()-Q)/1000),this.#K.delete(_);this.trackCustomEvent("video_complete",H)}setupPageTimeTracking(){L().addEventListener("visibilitychange",this.#S),L().addEventListener("beforeunload",this.#I)}handleVisibilityChange(){let $=this.#v.autoTrack??R.autoTrack;if(!(typeof $==="boolean"?$:$.pageVisibility!==!1))return;let Q=Date.now(),H=this.#N;if(this.#N=!Z().hidden,H)this.#D+=Q-this.#F;this.#F=Q,this.trackCustomEvent("page_visibility",{visible:this.#N,total_time:Math.round((Q-this.#k)/1000),visible_time:Math.round(this.#D/1000)})}handleBeforeUnload(){let $=this.#v.autoTrack??R.autoTrack;if(!(typeof $==="boolean"?$:$.pageVisibility!==!1))return;let Q=Date.now();if(this.#N)this.#D+=Q-this.#F;this.trackCustomEvent("page_exit",{total_time:Math.round((Q-this.#k)/1000),visible_time:Math.round(this.#D/1000)},{immediate:!0})}setupInactivityTracking(){["mousemove","mousedown","keydown","touchstart","scroll"].forEach(($)=>{L().addEventListener($,this.#U,!0)}),this.checkInactivity()}handleUserActivity(){if(this.#Z=Date.now(),this.#G&&this.#A)this.#G=!1,this.trackCustomEvent("user_active",{inactive_duration:Math.round((Date.now()-this.#A)/1000),url:L().location.href,title:Z().title}),this.#A=null;this.checkInactivity()}checkInactivity(){if(this.#j)L().clearTimeout(this.#j);this.#j=L().setTimeout(()=>{let $=Date.now();if($-this.#Z>=this.#z&&!this.#G)this.#G=!0,this.#A=$,this.trackCustomEvent("user_inactive")},this.#z)}installErrorHandler(){if(this.#w||typeof window==="undefined")return;L().addEventListener("error",this.#C),L().addEventListener("unhandledrejection",this.#b),this.#w=!0}uninstallErrorHandler(){if(!this.#w||typeof window==="undefined")return;L().removeEventListener("error",this.#C),L().removeEventListener("unhandledrejection",this.#b),this.#w=!1}isErrorHandlerInstalled(){return this.#w}handleError($){if($ instanceof ErrorEvent)this.trackError(new Error($.message),{filename:$.filename,lineno:$.lineno,colno:$.colno,source:"getWindow().onerror"})}handleRejection($){let _=$.reason instanceof Error?$.reason:new Error(String($.reason||"Unhandled Promise rejection"));this.trackError(_,{source:"unhandledrejection"})}trackError($,_={},Q={immediate:!1}){let{filename:H,lineno:Y,colno:q,source:B,url:V,referrer:J,userAgent:N,...I}=_,k$={name:"error",message:$.message,stack:$.stack,source:B||"client",lineno:Y,colno:q,filename:H,properties:I,timestamp:new Date().toISOString(),url:V||L().location.href,referrer:J||Z$(),title:Z().title};if(Q.immediate)this.#_.publish([k$]);else this.#_.track(k$)}setupPerformanceTracking(){if(Z().readyState==="complete")this.trackPageLoadPerformance();else L().addEventListener("load",()=>{L().setTimeout(()=>{this.trackPageLoadPerformance()},100)});this.setupCoreWebVitals()}trackPageLoadPerformance(){if(typeof window==="undefined"||!window.performance?.timing)return;let $=window.performance.timing,_=window.performance.navigation,Q=$.loadEventEnd-$.navigationStart,H=$.domContentLoadedEventEnd-$.navigationStart,Y=$.responseStart-$.navigationStart,q=$.domInteractive-$.navigationStart,B=$.connectEnd-$.connectStart,V=$.domainLookupEnd-$.domainLookupStart;if(Q>0&&Q<60000)this.trackCustomEvent("page_load",{page_load_time:Q,dom_content_loaded_time:H,time_to_first_byte:Y,dom_interactive_time:q,connect_time:B,dns_lookup_time:V,navigation_type:_?_.type:void 0,redirect_count:_?_.redirectCount:void 0})}setupCoreWebVitals(){if(typeof window==="undefined"||!window.PerformanceObserver)return;try{this.observeWebVital("largest-contentful-paint",($)=>{let _=$[$.length-1];this.trackCustomEvent("core_web_vitals",{metric:"LCP",value:Math.round(_.startTime),rating:this.getCWVRating("LCP",_.startTime)})}),this.observeWebVital("first-input",($)=>{let _=$[0],Q=_.processingStart-_.startTime;this.trackCustomEvent("core_web_vitals",{metric:"FID",value:Math.round(Q),rating:this.getCWVRating("FID",Q)})}),this.observeWebVital("layout-shift",($)=>{let _=0;for(let Q of $)if(!Q.hadRecentInput)_+=Q.value;if(_>0)this.trackCustomEvent("core_web_vitals",{metric:"CLS",value:Math.round(_*1000)/1000,rating:this.getCWVRating("CLS",_)})})}catch($){}}observeWebVital($,_){try{if(typeof window==="undefined"||!window.PerformanceObserver)return;let Q=new window.PerformanceObserver((H)=>{_(H.getEntries())});Q.observe({type:$,buffered:!0}),this.#R.push(Q)}catch(Q){}}getCWVRating($,_){switch($){case"LCP":return _<=2500?"good":_<=4000?"needs-improvement":"poor";case"FID":return _<=100?"good":_<=300?"needs-improvement":"poor";case"CLS":return _<=0.1?"good":_<=0.25?"needs-improvement":"poor";default:return"unknown"}}}class V0{#_;#$=[];#X=null;#Y;#H;#W="";#q=null;#Q=null;#B=5000;#O=!0;#V;constructor($,_){this.#_=$,this.#V=_,this.#Y=_?.userId,this.#H=_?.appId||"",this.#O=typeof _?.secure==="boolean"?_.secure:R.secure,this.#B=_?.flushIntervalMs||R.flushIntervalMs||5000}init($){this.#X=$,this.setup()}destroy(){if(this.#q)L().clearInterval(this.#q);if(this.#Q)L().clearTimeout(this.#Q);if(this.#$.length>0)this.flush()}shouldEnableAutoFlush(){if(this.#V?.autoTrack===!1)return!1;return!0}setup(){if(typeof window==="undefined")return;if(this.getSessionId(),this.#W=L().location.href,this.#X.trackPageView(),this.setupHistoryChange(),this.shouldEnableAutoFlush())this.#q=L().setInterval(()=>this.flush(),this.#B)}setupHistoryChange(){if(!this.#X)return;let{pushState:$,replaceState:_}=history;history.pushState=(...Q)=>{$.apply(history,Q),this.trackPageViewIfUrlChanged()},history.replaceState=(...Q)=>{_.apply(history,Q),this.trackPageViewIfUrlChanged()},L().addEventListener("popstate",()=>{this.trackPageViewIfUrlChanged()})}trackPageViewIfUrlChanged(){let $=L().location.href;if($!==this.#W)this.#W=$,this.#X.trackPageView()}getUserId(){return this.#Y}setUserId($){this.#Y=$}getAppId(){return this.#H}getApiKey(){return this.#V?.apiKey||""}setAppId($){this.#H=$}async track($){if(y())return await new Promise((_)=>setTimeout(_,1000)),this.publish([$]);if(this.#$.push($),this.#$.length>=20)return this.flush(),Promise.resolve();if(this.shouldEnableAutoFlush()){if(!this.#Q)this.#Q=L().setTimeout(()=>{this.flush(),this.#Q=null},this.#B)}return Promise.resolve()}async identify($){this.setUserId($.id),await fetch(this.#_.buildUrl("identify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($),keepalive:!0,credentials:"include"})}deduplicateEvents($){let _=new Set;return $.filter((Q)=>{let H=`${Q.name}-${Q.timestamp}`;if(_.has(H))return!1;return _.add(H),!0})}flush(){if(this.#$.length===0)return;if(this.#Q)L().clearTimeout(this.#Q),this.#Q=null;let $=[...this.#$];this.#$=[];let _=this.deduplicateEvents($);this.publish(_).catch((Q)=>{this.#$=[..._,...this.#$].slice(0,100),console.error("Error sending analytics data:",Q)})}async publish($){let _={userAgent:navigator.userAgent,screenWidth:L().screen.width,screenHeight:L().screen.height,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,events:$.map((Y)=>{if(!Y.timestamp)Y.timestamp=new Date().toISOString();return{...Y,name:Y.name,properties:Y.properties||{},url:Y.url}})},Q={"Content-Type":"application/json"};if(y())Q.Cookie=`_up.app=${this.getAppId()};_up.sid=${this.getSessionId()}`,Q["X-Userpath-Key"]=this.getApiKey();let H=await fetch(this.#_.buildUrl("log"),{method:"POST",headers:Q,body:JSON.stringify(_),credentials:"include",keepalive:!0});try{let Y=await H.json();if(!H.ok)return Promise.reject(Y);return Y}catch(Y){return Promise.reject(Y)}}getSessionId(){let $=j0("_up.sid");if(!$)$=this.generateId(),this.setSessionId($);return $}setSessionId($){C$("_up.sid",$,{days:365,sameSite:"lax",secure:this.#O,domain:U$(this.#_.serverUrl)})}generateId(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function($){let _=Math.random()*16|0;return($==="x"?_:_&3|8).toString(16)})}}class c6{#_;#$;#X;#Y=R.version;constructor($){this.#_=new d$($),this.#$=new V0(this.#_,$),this.#X=new B0(this.#$,$),this.#Y=$.version||this.#Y,this.#$.init(this.#X),this.#$.setAppId($.appId);let _=(()=>{if($.autoTrack===void 0)return!0;if(typeof $.autoTrack==="boolean")return $.autoTrack;return $.autoTrack.errors!==!1})();if(!y()&&_)this.installErrorHandler();console.debug(`UserPath v${O0.version} initialized`)}getAppId(){return this.#$.getAppId()}setAppId($){this.#$.setAppId($)}installErrorHandler(){this.#X.installErrorHandler()}uninstallErrorHandler(){this.#X.uninstallErrorHandler()}trackError($,_={}){if(!this.#X.isErrorHandlerInstalled()&&_.source!=="manual")return;this.#X.trackError($,_)}setUserId($){this.#$.setUserId($)}getUserId(){return this.#$.getUserId()}async identify($){await this.#$.identify($)}track($,_){if(_.sid)this.#$.setSessionId(_.sid);if($==="page_view")return this.#X.trackPageView();else if($==="event"){let Q=_.properties||{};if(_.url)Q.url=_.url;return this.#X.trackCustomEvent(_.name,Q)}else if($==="purchase")return this.#X.trackPurchase({price:_.price,currency:_.currency,amount:_.amount,properties:_.properties,url:_.url})}}export{c6 as UserPath,R as DEFAULT_CONFIG};
14
+ `))Q|=this.EMPTY_END_LINE;if(this.isWordRune($)!==this.isWordRune(_))Q|=this.EMPTY_WORD_BOUNDARY;else Q|=this.EMPTY_NO_WORD_BOUNDARY;return Q}static quoteMeta($){return $.split("").map((_)=>{if(this.METACHARACTERS.indexOf(_)>=0)return`\\${_}`;return _}).join("")}static charCount($){return $>m$.MAX_BMP?2:1}static stringToUtf8ByteArray($){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode($));else{let _=[],Q=0;for(let H=0;H<$.length;H++){let Y=$.charCodeAt(H);if(Y<128)_[Q++]=Y;else if(Y<2048)_[Q++]=Y>>6|192,_[Q++]=Y&63|128;else if((Y&64512)===55296&&H+1<$.length&&($.charCodeAt(H+1)&64512)===56320)Y=65536+((Y&1023)<<10)+($.charCodeAt(++H)&1023),_[Q++]=Y>>18|240,_[Q++]=Y>>12&63|128,_[Q++]=Y>>6&63|128,_[Q++]=Y&63|128;else _[Q++]=Y>>12|224,_[Q++]=Y>>6&63|128,_[Q++]=Y&63|128}return _}}static utf8ByteArrayToString($){if(globalThis.TextDecoder)return new TextDecoder("utf-8").decode(new Uint8Array($));else{let _=[],Q=0,H=0;while(Q<$.length){let Y=$[Q++];if(Y<128)_[H++]=String.fromCharCode(Y);else if(Y>191&&Y<224){let q=$[Q++];_[H++]=String.fromCharCode((Y&31)<<6|q&63)}else if(Y>239&&Y<365){let q=$[Q++],B=$[Q++],V=$[Q++],J=((Y&7)<<18|(q&63)<<12|(B&63)<<6|V&63)-65536;_[H++]=String.fromCharCode(55296+(J>>10)),_[H++]=String.fromCharCode(56320+(J&1023))}else{let q=$[Q++],B=$[Q++];_[H++]=String.fromCharCode((Y&15)<<12|(q&63)<<6|B&63)}}return _.join("")}}}var X1=($=[],_=0)=>{let Q={};for(let H=0;H<$.length;H++){let Y=$[H],q=_+H;Q[Y]=q,Q[q]=Y}return Object.freeze(Q)};class X0{static Encoding=(()=>X1(["UTF_16","UTF_8"]))();getEncoding(){throw Error("not implemented")}isUTF8Encoding(){return this.getEncoding()===X0.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===X0.Encoding.UTF_16}}class w{static Op=(()=>X1(["NO_MATCH","EMPTY_MATCH","LITERAL","CHAR_CLASS","ANY_CHAR_NOT_NL","ANY_CHAR","BEGIN_LINE","END_LINE","BEGIN_TEXT","END_TEXT","WORD_BOUNDARY","NO_WORD_BOUNDARY","CAPTURE","STAR","PLUS","QUEST","REPEAT","CONCAT","ALTERNATE","LEFT_PAREN","VERTICAL_BAR"]))();static isPseudoOp($){return $>=w.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen($){if($===F.CODES.get("-"))return"\\";return""}static fromRegexp($){let _=new w($.op);return _.flags=$.flags,_.subs=$.subs,_.runes=$.runes,_.cap=$.cap,_.min=$.min,_.max=$.max,_.name=$.name,_.namedGroups=$.namedGroups,_}constructor($){this.op=$,this.flags=0,this.subs=w.emptySubs(),this.runes=[],this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=w.emptySubs(),this.runes=[],this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let $="";switch(this.op){case w.Op.NO_MATCH:$+="[^\\x00-\\x{10FFFF}]";break;case w.Op.EMPTY_MATCH:$+="(?:)";break;case w.Op.STAR:case w.Op.PLUS:case w.Op.QUEST:case w.Op.REPEAT:{let _=this.subs[0];if(_.op>w.Op.CAPTURE||_.op===w.Op.LITERAL&&_.runes.length>1)$+=`(?:${_.appendTo()})`;else $+=_.appendTo();switch(this.op){case w.Op.STAR:$+="*";break;case w.Op.PLUS:$+="+";break;case w.Op.QUEST:$+="?";break;case w.Op.REPEAT:if($+=`{${this.min}`,this.min!==this.max){if($+=",",this.max>=0)$+=this.max}$+="}";break}if((this.flags&C.NON_GREEDY)!==0)$+="?";break}case w.Op.CONCAT:{for(let _ of this.subs)if(_.op===w.Op.ALTERNATE)$+=`(?:${_.appendTo()})`;else $+=_.appendTo();break}case w.Op.ALTERNATE:{let _="";for(let Q of this.subs)$+=_,_="|",$+=Q.appendTo();break}case w.Op.LITERAL:if((this.flags&C.FOLD_CASE)!==0)$+="(?i:";for(let _ of this.runes)$+=M$.escapeRune(_);if((this.flags&C.FOLD_CASE)!==0)$+=")";break;case w.Op.ANY_CHAR_NOT_NL:$+="(?-s:.)";break;case w.Op.ANY_CHAR:$+="(?s:.)";break;case w.Op.CAPTURE:if(this.name===null||this.name.length===0)$+="(";else $+=`(?P<${this.name}>`;if(this.subs[0].op!==w.Op.EMPTY_MATCH)$+=this.subs[0].appendTo();$+=")";break;case w.Op.BEGIN_TEXT:$+="\\A";break;case w.Op.END_TEXT:if((this.flags&C.WAS_DOLLAR)!==0)$+="(?-m:$)";else $+="\\z";break;case w.Op.BEGIN_LINE:$+="^";break;case w.Op.END_LINE:$+="$";break;case w.Op.WORD_BOUNDARY:$+="\\b";break;case w.Op.NO_WORD_BOUNDARY:$+="\\B";break;case w.Op.CHAR_CLASS:if(this.runes.length%2!==0){$+="[invalid char class]";break}if($+="[",this.runes.length===0)$+="^\\x00-\\x{10FFFF}";else if(this.runes[0]===0&&this.runes[this.runes.length-1]===m$.MAX_RUNE){$+="^";for(let _=1;_<this.runes.length-1;_+=2){let Q=this.runes[_]+1,H=this.runes[_+1]-1;if($+=w.quoteIfHyphen(Q),$+=M$.escapeRune(Q),Q!==H)$+="-",$+=w.quoteIfHyphen(H),$+=M$.escapeRune(H)}}else for(let _=0;_<this.runes.length;_+=2){let Q=this.runes[_],H=this.runes[_+1];if($+=w.quoteIfHyphen(Q),$+=M$.escapeRune(Q),Q!==H)$+="-",$+=w.quoteIfHyphen(H),$+=M$.escapeRune(H)}$+="]";break;default:$+=this.op;break}return $}maxCap(){let $=0;if(this.op===w.Op.CAPTURE)$=this.cap;if(this.subs!==null)for(let _ of this.subs){let Q=_.maxCap();if($<Q)$=Q}return $}equals($){if(!($!==null&&$ instanceof w))return!1;if(this.op!==$.op)return!1;switch(this.op){case w.Op.END_TEXT:{if((this.flags&C.WAS_DOLLAR)!==($.flags&C.WAS_DOLLAR))return!1;break}case w.Op.LITERAL:case w.Op.CHAR_CLASS:{if(this.runes===null&&$.runes===null)break;if(this.runes===null||$.runes===null)return!1;if(this.runes.length!==$.runes.length)return!1;for(let _=0;_<this.runes.length;_++)if(this.runes[_]!==$.runes[_])return!1;break}case w.Op.ALTERNATE:case w.Op.CONCAT:{if(this.subs.length!==$.subs.length)return!1;for(let _=0;_<this.subs.length;++_)if(!this.subs[_].equals($.subs[_]))return!1;break}case w.Op.STAR:case w.Op.PLUS:case w.Op.QUEST:{if((this.flags&C.NON_GREEDY)!==($.flags&C.NON_GREEDY)||!this.subs[0].equals($.subs[0]))return!1;break}case w.Op.REPEAT:{if((this.flags&C.NON_GREEDY)!==($.flags&C.NON_GREEDY)||this.min!==$.min||this.max!==$.max||!this.subs[0].equals($.subs[0]))return!1;break}case w.Op.CAPTURE:{if(this.cap!==$.cap||(this.name===null?$.name!==null:this.name!==$.name)||!this.subs[0].equals($.subs[0]))return!1;break}}return!0}}class E{constructor($,_){this.sign=$,this.cls=_}}var x0=[48,57],g0=[9,10,12,13,32,32],m0=[48,57,65,90,95,95,97,122],j9=new Map([["\\d",new E(1,x0)],["\\D",new E(-1,x0)],["\\s",new E(1,g0)],["\\S",new E(-1,g0)],["\\w",new E(1,m0)],["\\W",new E(-1,m0)]]),u0=[48,57,65,90,97,122],l0=[65,90,97,122],p0=[0,127],d0=[9,9,32,32],c0=[0,31,127,127],i0=[48,57],n0=[33,126],o0=[97,122],r0=[32,126],s0=[33,47,58,64,91,96,123,126],a0=[9,13,32,32],t0=[65,90],e0=[48,57,65,90,95,95,97,122],$1=[48,57,65,70,97,102],L9=new Map([["[:alnum:]",new E(1,u0)],["[:^alnum:]",new E(-1,u0)],["[:alpha:]",new E(1,l0)],["[:^alpha:]",new E(-1,l0)],["[:ascii:]",new E(1,p0)],["[:^ascii:]",new E(-1,p0)],["[:blank:]",new E(1,d0)],["[:^blank:]",new E(-1,d0)],["[:cntrl:]",new E(1,c0)],["[:^cntrl:]",new E(-1,c0)],["[:digit:]",new E(1,i0)],["[:^digit:]",new E(-1,i0)],["[:graph:]",new E(1,n0)],["[:^graph:]",new E(-1,n0)],["[:lower:]",new E(1,o0)],["[:^lower:]",new E(-1,o0)],["[:print:]",new E(1,r0)],["[:^print:]",new E(-1,r0)],["[:punct:]",new E(1,s0)],["[:^punct:]",new E(-1,s0)],["[:space:]",new E(1,a0)],["[:^space:]",new E(-1,a0)],["[:upper:]",new E(1,t0)],["[:^upper:]",new E(-1,t0)],["[:word:]",new E(1,e0)],["[:^word:]",new E(-1,e0)],["[:xdigit:]",new E(1,$1)],["[:^xdigit:]",new E(-1,$1)]]);class _0 extends Error{constructor($,_){super($);this.name="BetterAuthError",this.message=$,this.cause=_,this.stack=""}}function g6($){return{authorize(_,Q="AND"){let H=!1;for(let[Y,q]of Object.entries(_)){let B=$[Y];if(!B)return{success:!1,error:`You are not allowed to access resource: ${Y}`};if(Array.isArray(q))H=q.every((V)=>B.includes(V));else if(typeof q==="object"){let V=q;if(V.connector==="OR")H=V.actions.some((J)=>B.includes(J));else H=V.actions.every((J)=>B.includes(J))}else throw new _0("Invalid access control request");if(H&&Q==="OR")return{success:H};if(!H&&Q==="AND")return{success:!1,error:`unauthorized to access resource "${Y}"`}}if(H)return{success:H};return{success:!1,error:"Not authorized"}},statements:$}}function u$($){return{newRole(_){return g6(_)},statements:$}}var Q0={organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"]},Y0=u$(Q0),_1=Y0.newRole({organization:["update"],invitation:["create","cancel"],member:["create","update","delete"],team:["create","update","delete"]}),Q1=Y0.newRole({organization:["update","delete"],member:["create","update","delete"],invitation:["create","cancel"],team:["create","update","delete"]}),Y1=Y0.newRole({organization:[],member:[],invitation:[],team:[]});var m6={...Q0,project:["create","read","update","delete"]},l$=u$(m6),f9=l$.newRole({project:["create","read","update","delete"],...Q1.statements}),Z9=l$.newRole({project:["create","read","update","delete"],..._1.statements}),U9=l$.newRole({project:["create","read","update"],...Y1.statements}),C9=l$.newRole({project:["read"]});function u6($){switch($.toLowerCase()){case"google":return"https://www.google.com";case"bing":return"https://www.bing.com";case"yahoo":return"https://www.yahoo.com";case"facebook":return"https://www.facebook.com";case"twitter":case"x":return"https://twitter.com";case"instagram":return"https://www.instagram.com";case"linkedin":return"https://www.linkedin.com";case"youtube":return"https://www.youtube.com";case"pinterest":return"https://www.pinterest.com";case"reddit":return"https://www.reddit.com";case"tiktok":return"https://www.tiktok.com";case"snapchat":return"https://www.snapchat.com";default:return null}}function H1($){if(!$||$.trim()==="")return null;let _=$.trim();if(_==="/"||_==="direct")return null;try{return new URL(_),_}catch(Q){if(_.includes(".")){if(_.startsWith("http"))return _;else if(_.match(/^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(\/.*)?$/))return`https://${_}`}let H=u6(_);if(H)return H;return _}}var l6;((f)=>(f.User=s$,f.Users=I0,f.Organization=r$,f.Organizations=x$,f.Member=o$,f.Members=h$,f.Event=E0,f.Events=S0,f.Workspace=f0))(l6||={});var H0=y()?{getItem:()=>null,setItem:()=>{},removeItem:()=>{}}:window.localStorage;class W0{namespace;constructor({namespace:$}){this.namespace=$}getItem($){let _=H0.getItem(`${this.namespace}.${$}`)||"";try{return JSON.parse(_)}catch(Q){return null}}setItem($,_){H0.setItem(`${this.namespace}.${$}`,JSON.stringify(_))}removeItem($){H0.removeItem(`${this.namespace}.${$}`)}}var q0=new W0({namespace:"userpath"});var W1="referrer";function p6(){if(y())return{};let $={},_=L().location,Q="";if("search"in _)Q=_.search;else if("href"in _&&_.href)Q=new URL(_.href).search;if(Q){let H=new URLSearchParams(Q);for(let[Y,q]of H.entries())$[Y]=q}return $}function Z$(){let $=Z().referrer?.split("?")[0],_=p6(),Q=_.utm_source||_.source||_.ref||_.utm_medium||_.utm_campaign||_.utm_content,H=q0.getItem(W1),Y="";if($&&$.trim()!=="")Y=$;else if(Q){let q=H1(Q);if(q)Y=q}if(!Y&&H)Y=H;if(Y&&Y!==H){let q=L().location.host,B=new URL(Y).host;if(q!==B)q0.setItem(W1,Y)}return Y}class B0{#_;#$;#X;#Y;#H;#W;#q;#Q;#B;#O;#V;#P;#E;#S;#I;#J;#f;#L;#M;#K;#k;#D;#F;#N;#Z;#j;#G;#U;#z=60000;#A;#w=!1;#C;#b;#R=[];#v;constructor($,_=R){this.#_=$,this.#v=_,this.#$=new Set,this.#X=0,this.#J=null,this.#f=L().location.href,this.#L=new Map,this.#M=new WeakMap,this.#K=new WeakMap,this.#k=Date.now(),this.#D=0,this.#F=this.#k,this.#N=Z().hidden,this.#Z=Date.now(),this.#j=null,this.#G=!1,this.#A=null,this.#Y=this.handleClick.bind(this),this.#H=this.handleScroll.bind(this),this.#W=this.handleScroll.bind(this),this.#q=this.handleInputFocus.bind(this),this.#Q=this.handleInputBlur.bind(this),this.#B=this.handleFormChange.bind(this),this.#O=this.handleFormSubmit.bind(this),this.#V=this.handleVideoPlay.bind(this),this.#P=this.handleVideoPause.bind(this),this.#E=this.handleVideoEnd.bind(this),this.#S=this.handleVisibilityChange.bind(this),this.#I=this.handleBeforeUnload.bind(this),this.#U=this.handleUserActivity.bind(this),this.#C=this.handleError.bind(this),this.#b=this.handleRejection.bind(this);let Q=this.#v.autoTrack??R.autoTrack;if(typeof Q==="boolean"){if(Q)this.setupClickTracking(),this.setupScrollTracking(),this.setupFormTracking(),this.setupVideoTracking(),this.setupPageTimeTracking(),this.setupInactivityTracking(),this.setupPerformanceTracking()}else{if(Q.clicks!==!1)this.setupClickTracking();if(Q.scrolling!==!1)this.setupScrollTracking();if(Q.forms!==!1)this.setupFormTracking();if(Q.videos!==!1)this.setupVideoTracking();if(Q.pageVisibility!==!1)this.setupPageTimeTracking();if(Q.pageInactivity!==!1)this.setupInactivityTracking();if(Q.performance!==!1)this.setupPerformanceTracking()}}destroy(){if(L().removeEventListener("click",this.#Y),L().removeEventListener("scroll",this.#H),L().removeEventListener("resize",this.#W),L().removeEventListener("focus",this.#q,!0),L().removeEventListener("blur",this.#Q,!0),L().removeEventListener("change",this.#B,!0),L().removeEventListener("submit",this.#O,!0),L().removeEventListener("play",this.#V,!0),L().removeEventListener("pause",this.#P,!0),L().removeEventListener("ended",this.#E,!0),L().removeEventListener("visibilitychange",this.#S),L().removeEventListener("beforeunload",this.#I),this.#J)L().clearTimeout(this.#J);if(["mousemove","mousedown","keydown","touchstart","scroll"].forEach(($)=>{L().removeEventListener($,this.#U,!0)}),this.#j)L().clearTimeout(this.#j);this.uninstallErrorHandler(),this.#R.forEach(($)=>{try{$.disconnect()}catch(_){}}),this.#R=[]}setupClickTracking(){L().addEventListener("click",this.#Y)}handleClick($){let _=$.target;if(!_)return;let Q=this.extractClickLabel(_);if(!Q)return;this.trackCustomEvent("click",{label:Q,element:_.tagName.toLowerCase(),id:_.id||void 0})}handleScroll(){let $=L().location.href;if($!==this.#f)this.#f=$,this.#X=0,this.#$.clear();if(this.#J)L().clearTimeout(this.#J);this.#J=L().setTimeout(()=>{let _=this.calculateScrollDepth();if(_>this.#X)this.#X=_,this.checkAndTrackScrollDepth(_)},100)}setupScrollTracking(){L().addEventListener("scroll",this.#H),L().addEventListener("resize",this.#W)}calculateScrollDepth(){let $=L().innerHeight,_=Math.max(Z().documentElement.scrollHeight,Z().documentElement.offsetHeight,Z().documentElement.clientHeight),Q=L().pageYOffset||Z().documentElement.scrollTop;return Math.round((Q+$)/_*100)}checkAndTrackScrollDepth($){let _=L().location.href;if($>50&&!this.#$.has(_))this.#$.add(_),this.trackCustomEvent("scroll")}extractClickLabel($){let _=$.getAttribute("aria-label");if(_)return`${_}`;if($ instanceof HTMLButtonElement||$ instanceof HTMLAnchorElement){let H=$.textContent?.trim();if(H)return`${H}`}if($ instanceof HTMLInputElement){if($.type==="submit"&&$.value)return`${$.value}`;if($.type==="checkbox"){let H=this.findInputLabel($),Y=$.checked?"Checked":"Unchecked";return H?`${Y} ${H}`:null}}let Q=$.closest("label");if(Q){let H=Q.textContent?.trim();if(H)return`${H}`}return null}findInputLabel($){let _=$.getAttribute("aria-label");if(_)return _;if($.id){let H=Z().querySelector(`label[for="${$.id}"]`);if(H&&H.textContent)return H.textContent.trim()}let Q=$.closest("label");if(Q&&Q.textContent)return Q.textContent.trim().replace($.value,"").trim();return null}trackPageView(){let $={name:"page_view",url:L().location.href,referrer:Z$(),title:Z().title,timestamp:new Date().toISOString()};return this.#_.track($)}trackCustomEvent($,_={},Q={immediate:!1}){let{referrer:H}=_||{},Y={name:$,url:L().location.href||_.url,referrer:H||Z$(),title:Z().title,properties:J0(_,["url"]),timestamp:new Date().toISOString()};if(Q.immediate)return this.#_.publish([Y]);else return this.#_.track(Y)}trackPurchase($){let{referrer:_}=$.properties||{},Q={name:"purchase",url:$.url||L().location.href,referrer:_||Z$(),title:Z().title,price:$.price,currency:$.currency,amount:$.amount,properties:{...$.properties},timestamp:new Date().toISOString()};return this.#_.track(Q)}setupFormTracking(){L().addEventListener("focus",this.#q,!0),L().addEventListener("blur",this.#Q,!0),L().addEventListener("change",this.#B,!0),L().addEventListener("submit",this.#O,!0)}handleInputFocus($){let _=$.target;if(!_||!(_ instanceof HTMLInputElement||_ instanceof HTMLTextAreaElement||_ instanceof HTMLSelectElement))return;if(_ instanceof HTMLInputElement&&_.type==="password")return;this.#M.set(_,this.getElementValue(_));let Q=_.closest("form");if(Q&&!this.#L.has(Q))this.#L.set(Q,Date.now())}getElementValue($){if($ instanceof HTMLSelectElement)return $.value;if($ instanceof HTMLInputElement||$ instanceof HTMLTextAreaElement)return $.value;return""}handleInputBlur($){let _=$.target;if(!_||!(_ instanceof HTMLInputElement||_ instanceof HTMLTextAreaElement||_ instanceof HTMLSelectElement))return;if(_ instanceof HTMLInputElement&&_.type==="password")return;let Q=this.#M.get(_)||"",H=this.getElementValue(_);if(H!==Q&&H.trim()!==""){let Y=_ instanceof HTMLSelectElement?"select":_.type,q=this.findFormElementLabel(_)||this.getInputIdentifier(_);if(!q)return;this.trackCustomEvent("input_fill",{input_type:Y,label:q,form_name:this.getFormName(_)})}this.#M.delete(_)}getFormName($){let _=$.closest("form");if(!_)return;return _.getAttribute("name")||_.getAttribute("id")||_.getAttribute("aria-label")||void 0}getInputIdentifier($){return $.getAttribute("name")||$.getAttribute("id")||$.getAttribute("placeholder")||null}findFormElementLabel($){let _=$.getAttribute("aria-label");if(_)return _;if($.id){let H=Z().querySelector(`label[for="${$.id}"]`);if(H&&H.textContent)return H.textContent.trim()}let Q=$.closest("label");if(Q&&Q.textContent){let H=Q.textContent.trim(),Y=$ instanceof HTMLSelectElement?$.selectedOptions[0]?.text:$.value;return Y?H.replace(Y,"").trim():H}return null}handleFormChange($){let _=$.target;if(!_||!(_ instanceof HTMLSelectElement||_ instanceof HTMLInputElement))return;if(_ instanceof HTMLSelectElement)this.trackSelectChange(_);else if(_ instanceof HTMLInputElement){if(_.type==="radio")this.trackRadioChange(_);else if(_.type==="checkbox")this.trackCheckboxChange(_);else if(_.type==="range")this.trackRangeChange(_)}}trackSelectChange($){let _=this.findFormElementLabel($)||this.getInputIdentifier($);if(!_)return;let Q=$.selectedOptions[0];this.trackCustomEvent("input_select",{input_type:"select",label:_,option_label:Q?.text||"",form_name:this.getFormName($)})}trackRadioChange($){let _=this.findFormElementLabel($)||this.getInputIdentifier($);if(!_)return;let Q=$.name||_;this.trackCustomEvent("input_radio",{input_type:"radio",group:Q,label:_,form_name:this.getFormName($)})}trackCheckboxChange($){let _=this.findFormElementLabel($)||this.getInputIdentifier($);if(!_)return;this.trackCustomEvent("input_checkbox",{input_type:"checkbox",label:_,checked:$.checked,form_name:this.getFormName($)})}trackRangeChange($){let _=this.findFormElementLabel($)||this.getInputIdentifier($);if(!_)return;this.trackCustomEvent("input_range",{input_type:"range",label:_,form_name:this.getFormName($)})}handleFormSubmit($){let _=$.target;if(!_||!(_ instanceof HTMLFormElement))return;let Q=this.#L.get(_)||Date.now(),H=Date.now()-Q,Y=this.getFormName(_)||"unknown";this.trackCustomEvent("form_submit",{form_name:Y,time_to_complete:H}),this.#L.delete(_)}setupVideoTracking(){L().addEventListener("play",this.#V,!0),L().addEventListener("pause",this.#P,!0),L().addEventListener("ended",this.#E,!0)}getVideoMetadata($){let _={duration:Math.round($.duration),current_time:Math.round($.currentTime),src:$.currentSrc||$.src||void 0,title:$.title||void 0,video_id:$.id||void 0};for(let Y of $.attributes)if(Y.name.startsWith("data-")){let q=Y.name.replace("data-","").replace(/-/g,"_");_[q]=Y.value}if($.getAttribute("aria-label"))_.aria_label=$.getAttribute("aria-label");if($.getAttribute("aria-describedby"))_.aria_describedby=$.getAttribute("aria-describedby");let Q=$.parentElement;if(Q){if(Q.id)_.parent_id=Q.id;for(let B of Q.attributes)if(B.name.startsWith("data-")&&B.value){let V=`parent_${B.name.replace("data-","").replace(/-/g,"_")}`;_[V]=B.value}let Y=Q,q=0;while(Y&&q<3){if(Y.tagName==="SECTION"||Y.tagName==="ARTICLE"){if(Y.id)_.section_id=Y.id;if(Y.className)_.section_class=Y.className.trim();break}Y=Y.parentElement,q++}}let H=this.getNearbyVideoDescription($);if(H)_.nearby_text=H;if(_.src){let Y=new URL(_.src,window.location.href);_.video_domain=Y.hostname;let B=Y.pathname.split("/").pop();if(B&&B.includes("."))_.video_filename=B;if(Y.hostname.includes("youtube"))_.video_platform="youtube";else if(Y.hostname.includes("vimeo"))_.video_platform="vimeo";else if(Y.hostname.includes("wistia"))_.video_platform="wistia"}return Object.keys(_).forEach((Y)=>{if(_[Y]===void 0||_[Y]===null||_[Y]==="")delete _[Y]}),_}getNearbyVideoDescription($){let _=["h1, h2, h3, h4, h5, h6",'[role="heading"]',".video-title, .title","figcaption","caption"],Q=$.parentElement,H=0;while(Q&&H<2){for(let Y of _){let q=Q.querySelector(Y);if(q){let B=q.textContent?.trim();if(B&&B.length>0&&B.length<200)return B}}Q=Q.parentElement,H++}return}handleVideoPlay($){let _=$.target;if(!_||!(_ instanceof HTMLVideoElement))return;this.#K.set(_,Date.now()),this.trackCustomEvent("video_play",this.getVideoMetadata(_))}handleVideoPause($){let _=$.target;if(!_||!(_ instanceof HTMLVideoElement))return;let Q=this.#K.get(_),H=this.getVideoMetadata(_);if(Q)H.watch_time=Math.round((Date.now()-Q)/1000),this.#K.delete(_);this.trackCustomEvent("video_pause",H)}handleVideoEnd($){let _=$.target;if(!_||!(_ instanceof HTMLVideoElement))return;let Q=this.#K.get(_),H=this.getVideoMetadata(_);if(Q)H.watch_time=Math.round((Date.now()-Q)/1000),this.#K.delete(_);this.trackCustomEvent("video_complete",H)}setupPageTimeTracking(){L().addEventListener("visibilitychange",this.#S),L().addEventListener("beforeunload",this.#I)}handleVisibilityChange(){let $=this.#v.autoTrack??R.autoTrack;if(!(typeof $==="boolean"?$:$.pageVisibility!==!1))return;let Q=Date.now(),H=this.#N;if(this.#N=!Z().hidden,H)this.#D+=Q-this.#F;this.#F=Q,this.trackCustomEvent("page_visibility",{visible:this.#N,total_time:Math.round((Q-this.#k)/1000),visible_time:Math.round(this.#D/1000)})}handleBeforeUnload(){let $=this.#v.autoTrack??R.autoTrack;if(!(typeof $==="boolean"?$:$.pageVisibility!==!1))return;let Q=Date.now();if(this.#N)this.#D+=Q-this.#F;this.trackCustomEvent("page_exit",{total_time:Math.round((Q-this.#k)/1000),visible_time:Math.round(this.#D/1000)},{immediate:!0})}setupInactivityTracking(){["mousemove","mousedown","keydown","touchstart","scroll"].forEach(($)=>{L().addEventListener($,this.#U,!0)}),this.checkInactivity()}handleUserActivity(){if(this.#Z=Date.now(),this.#G&&this.#A)this.#G=!1,this.trackCustomEvent("user_active",{inactive_duration:Math.round((Date.now()-this.#A)/1000),url:L().location.href,title:Z().title}),this.#A=null;this.checkInactivity()}checkInactivity(){if(this.#j)L().clearTimeout(this.#j);this.#j=L().setTimeout(()=>{let $=Date.now();if($-this.#Z>=this.#z&&!this.#G)this.#G=!0,this.#A=$,this.trackCustomEvent("user_inactive")},this.#z)}installErrorHandler(){if(this.#w||typeof window==="undefined")return;L().addEventListener("error",this.#C),L().addEventListener("unhandledrejection",this.#b),this.#w=!0}uninstallErrorHandler(){if(!this.#w||typeof window==="undefined")return;L().removeEventListener("error",this.#C),L().removeEventListener("unhandledrejection",this.#b),this.#w=!1}isErrorHandlerInstalled(){return this.#w}handleError($){if($ instanceof ErrorEvent)this.trackError(new Error($.message),{filename:$.filename,lineno:$.lineno,colno:$.colno,source:"getWindow().onerror"})}handleRejection($){let _=$.reason instanceof Error?$.reason:new Error(String($.reason||"Unhandled Promise rejection"));this.trackError(_,{source:"unhandledrejection"})}trackError($,_={},Q={immediate:!1}){let{filename:H,lineno:Y,colno:q,source:B,url:V,referrer:J,userAgent:N,...I}=_,k$={name:"error",message:$.message,stack:$.stack,source:B||"client",lineno:Y,colno:q,filename:H,properties:I,timestamp:new Date().toISOString(),url:V||L().location.href,referrer:J||Z$(),title:Z().title};if(Q.immediate)this.#_.publish([k$]);else this.#_.track(k$)}setupPerformanceTracking(){if(Z().readyState==="complete")this.trackPageLoadPerformance();else L().addEventListener("load",()=>{L().setTimeout(()=>{this.trackPageLoadPerformance()},100)});this.setupCoreWebVitals()}trackPageLoadPerformance(){if(typeof window==="undefined"||!window.performance?.timing)return;let $=window.performance.timing,_=window.performance.navigation,Q=$.loadEventEnd-$.navigationStart,H=$.domContentLoadedEventEnd-$.navigationStart,Y=$.responseStart-$.navigationStart,q=$.domInteractive-$.navigationStart,B=$.connectEnd-$.connectStart,V=$.domainLookupEnd-$.domainLookupStart;if(Q>0&&Q<60000)this.trackCustomEvent("page_load",{page_load_time:Q,dom_content_loaded_time:H,time_to_first_byte:Y,dom_interactive_time:q,connect_time:B,dns_lookup_time:V,navigation_type:_?_.type:void 0,redirect_count:_?_.redirectCount:void 0})}setupCoreWebVitals(){if(typeof window==="undefined"||!window.PerformanceObserver)return;try{this.observeWebVital("largest-contentful-paint",($)=>{let _=$[$.length-1];this.trackCustomEvent("core_web_vitals",{metric:"LCP",value:Math.round(_.startTime),rating:this.getCWVRating("LCP",_.startTime)})}),this.observeWebVital("first-input",($)=>{let _=$[0],Q=_.processingStart-_.startTime;this.trackCustomEvent("core_web_vitals",{metric:"FID",value:Math.round(Q),rating:this.getCWVRating("FID",Q)})}),this.observeWebVital("layout-shift",($)=>{let _=0;for(let Q of $)if(!Q.hadRecentInput)_+=Q.value;if(_>0)this.trackCustomEvent("core_web_vitals",{metric:"CLS",value:Math.round(_*1000)/1000,rating:this.getCWVRating("CLS",_)})})}catch($){}}observeWebVital($,_){try{if(typeof window==="undefined"||!window.PerformanceObserver)return;let Q=new window.PerformanceObserver((H)=>{_(H.getEntries())});Q.observe({type:$,buffered:!0}),this.#R.push(Q)}catch(Q){}}getCWVRating($,_){switch($){case"LCP":return _<=2500?"good":_<=4000?"needs-improvement":"poor";case"FID":return _<=100?"good":_<=300?"needs-improvement":"poor";case"CLS":return _<=0.1?"good":_<=0.25?"needs-improvement":"poor";default:return"unknown"}}}class V0{#_;#$=[];#X=null;#Y;#H;#W="";#q=null;#Q=null;#B=5000;#O=!0;#V;constructor($,_){this.#_=$,this.#V=_,this.#Y=_?.userId,this.#H=_?.appId||"",this.#O=typeof _?.secure==="boolean"?_.secure:R.secure,this.#B=_?.flushIntervalMs||R.flushIntervalMs||5000}init($){this.#X=$,this.setup()}destroy(){if(this.#q)L().clearInterval(this.#q);if(this.#Q)L().clearTimeout(this.#Q);if(this.#$.length>0)this.flush()}shouldEnableAutoFlush(){if(this.#V?.autoTrack===!1)return!1;return!0}setup(){if(typeof window==="undefined")return;if(this.getSessionId(),this.#W=L().location.href,this.#X.trackPageView(),this.setupHistoryChange(),this.shouldEnableAutoFlush())this.#q=L().setInterval(()=>this.flush(),this.#B)}setupHistoryChange(){if(!this.#X)return;let{pushState:$,replaceState:_}=history;history.pushState=(...Q)=>{$.apply(history,Q),this.trackPageViewIfUrlChanged()},history.replaceState=(...Q)=>{_.apply(history,Q),this.trackPageViewIfUrlChanged()},L().addEventListener("popstate",()=>{this.trackPageViewIfUrlChanged()})}trackPageViewIfUrlChanged(){let $=L().location.href;if($!==this.#W)this.#W=$,this.#X.trackPageView()}getUserId(){return this.#Y}setUserId($){this.#Y=$}getAppId(){return this.#H}getApiKey(){return this.#V?.apiKey||""}setAppId($){this.#H=$}async track($){if(y())return await new Promise((_)=>setTimeout(_,1000)),this.publish([$]);if(this.#$.push($),this.#$.length>=20)return this.flush(),Promise.resolve();if(this.shouldEnableAutoFlush()){if(!this.#Q)this.#Q=L().setTimeout(()=>{this.flush(),this.#Q=null},this.#B)}return Promise.resolve()}async identify($){this.setUserId($.id),await fetch(this.#_.buildUrl("identify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($),keepalive:!0,credentials:"include"})}deduplicateEvents($){let _=new Set;return $.filter((Q)=>{let H=`${Q.name}-${Q.timestamp}`;if(_.has(H))return!1;return _.add(H),!0})}flush(){if(this.#$.length===0)return;if(this.#Q)L().clearTimeout(this.#Q),this.#Q=null;let $=[...this.#$];this.#$=[];let _=this.deduplicateEvents($);this.publish(_).catch((Q)=>{this.#$=[..._,...this.#$].slice(0,100),console.error("Error sending analytics data:",Q)})}async publish($){let _={userAgent:navigator.userAgent,screenWidth:L().screen.width,screenHeight:L().screen.height,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,events:$.map((Y)=>{if(!Y.timestamp)Y.timestamp=new Date().toISOString();return{...Y,name:Y.name,properties:Y.properties||{},url:Y.url}})},Q={"Content-Type":"application/json"};if(y())Q.Cookie=`_up.app=${this.getAppId()};_up.sid=${this.getSessionId()}`,Q["X-Userpath-Key"]=this.getApiKey();let H=await fetch(this.#_.buildUrl("log"),{method:"POST",headers:Q,body:JSON.stringify(_),credentials:"include",keepalive:!0});try{let Y=await H.json();if(!H.ok)return Promise.reject(Y);return Y}catch(Y){return Promise.reject(Y)}}getSessionId(){let $=j0("_up.sid");if(!$)$=this.generateId(),this.setSessionId($);return $}setSessionId($){C$("_up.sid",$,{days:365,sameSite:"lax",secure:this.#O,domain:U$(this.#_.serverUrl)})}generateId(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function($){let _=Math.random()*16|0;return($==="x"?_:_&3|8).toString(16)})}}class d6{#_;#$;#X;#Y=R.version;constructor($){this.#_=new d$($),this.#$=new V0(this.#_,$),this.#X=new B0(this.#$,$),this.#Y=$.version||this.#Y,this.#$.init(this.#X),this.#$.setAppId($.appId);let _=(()=>{if($.autoTrack===void 0)return!0;if(typeof $.autoTrack==="boolean")return $.autoTrack;return $.autoTrack.errors!==!1})();if(!y()&&_)this.installErrorHandler();console.debug(`UserPath v${O0.version} initialized`)}getAppId(){return this.#$.getAppId()}setAppId($){this.#$.setAppId($)}installErrorHandler(){this.#X.installErrorHandler()}uninstallErrorHandler(){this.#X.uninstallErrorHandler()}trackError($,_={}){if(!this.#X.isErrorHandlerInstalled()&&_.source!=="manual")return;this.#X.trackError($,_)}setUserId($){this.#$.setUserId($)}getUserId(){return this.#$.getUserId()}async identify($){await this.#$.identify($)}track($,_){if(_.sid)this.#$.setSessionId(_.sid);if($==="page_view")return this.#X.trackPageView();else if($==="event"){let Q=_.properties||{};if(_.url)Q.url=_.url;return this.#X.trackCustomEvent(_.name,Q)}else if($==="purchase")return this.#X.trackPurchase({price:_.price,currency:_.currency,amount:_.amount,properties:_.properties,url:_.url})}}export{d6 as UserPath,R as DEFAULT_CONFIG};