@wellesley/user 1.0.717 → 1.0.718

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.
Files changed (2) hide show
  1. package/index.mjs +2 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{api as Ta,usePostApiV1UploadsMutation as B8,useGetApiV1SearchQuery as X8,useGetApiV1InstanceTimezonesQuery as G8,useGetApiV1AddressesSuggestQuery as H8,usePutApiV1UsersByUserIdMutation as Z8}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.702";import*as yd from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import oy,{forwardRef as lc,createElement as Zu,useRef as Nn,useState as Dt,useEffect as jt,useCallback as md,useLayoutEffect as K8,useMemo as Zk,isValidElement as Y8,cloneElement as J8}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{toast as Br}from"https://cdn.jsdelivr.net/npm/@wellesley/system-toast@1.0.46";import{getErrorMsg as oo}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.553";import{createAction as l6,createSlice as xd,createSelector as ef}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{get as E2,set as k0,appendErrors as Q8,useForm as K2,useFieldArray as Gh,FormProvider as $8}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as Y2,rootReducer as J2}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.701";import{useDispatch as fo,useSelector as ft}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{fillTopic as u6,wsSlice as Q2}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.684";import{getAcceptList as f6,useImageSelection as d6,UploadMediaModal as p6,UploadTag as Kk,selectUploadFile as e5}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.587";import{cn as ut,DropdownMenu as Tg,DropdownMenuTrigger as Pg,DropdownMenuContent as Lg,DropdownMenuItem as hg,Button as en,Avatar as t5,AvatarImage as r5,TooltipWrapper as h6,Dialog as n5,DialogContent as a5,Switch as y6,Tooltip as Yk,TooltipTrigger as Jk,TooltipContent as Qk,Textarea as s5,getTextareaClassName as i5,FormLabel as zy,useFormField as g6,FormField as o5,FormItem as c5,FormControl as sg,Input as w0,FormMessage as l5,Form as $2,ButtonLoader as Ku,Popover as u5,PopoverTrigger as f5,PopoverContent as d5,Calendar as b0,Checkbox as p5}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.664";import{useLogout as m6,authSlice as h5}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.758";import{useAppsNavigate as _6,getRoute as $k,AppsLink as yg}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.630";import{EmojiPicker as y5,EmojiStyle as g5}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.553";var Ci=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ad(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ew,Qh={exports:{}},m5=Qh.exports;
1
+ import{api as Ta,usePostApiV1UploadsMutation as B8,useGetApiV1SearchQuery as X8,useGetApiV1InstanceTimezonesQuery as G8,useGetApiV1AddressesSuggestQuery as H8,usePutApiV1UsersByUserIdMutation as Z8}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.703";import*as yd from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import oy,{forwardRef as lc,createElement as Zu,useRef as Nn,useState as Dt,useEffect as jt,useCallback as md,useLayoutEffect as K8,useMemo as Zk,isValidElement as Y8,cloneElement as J8}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{toast as Br}from"https://cdn.jsdelivr.net/npm/@wellesley/system-toast@1.0.47";import{getErrorMsg as oo}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.554";import{createAction as l6,createSlice as xd,createSelector as ef}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{get as E2,set as k0,appendErrors as Q8,useForm as K2,useFieldArray as Gh,FormProvider as $8}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as Y2,rootReducer as J2}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.702";import{useDispatch as fo,useSelector as ft}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{fillTopic as u6,wsSlice as Q2}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.685";import{getAcceptList as f6,useImageSelection as d6,UploadMediaModal as p6,UploadTag as Kk,selectUploadFile as e5}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.588";import{cn as ut,DropdownMenu as Tg,DropdownMenuTrigger as Pg,DropdownMenuContent as Lg,DropdownMenuItem as hg,Button as en,Avatar as t5,AvatarImage as r5,TooltipWrapper as h6,Dialog as n5,DialogContent as a5,Switch as y6,Tooltip as Yk,TooltipTrigger as Jk,TooltipContent as Qk,Textarea as s5,getTextareaClassName as i5,FormLabel as zy,useFormField as g6,FormField as o5,FormItem as c5,FormControl as sg,Input as w0,FormMessage as l5,Form as $2,ButtonLoader as Ku,Popover as u5,PopoverTrigger as f5,PopoverContent as d5,Calendar as b0,Checkbox as p5}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.665";import{useLogout as m6,authSlice as h5}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.759";import{useAppsNavigate as _6,getRoute as $k,AppsLink as yg}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.631";import{EmojiPicker as y5,EmojiStyle as g5}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.554";var Ci=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ad(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ew,Qh={exports:{}},m5=Qh.exports;
2
2
  /**
3
3
  * @license
4
4
  * Lodash <https://lodash.com/>
@@ -39,7 +39,7 @@ import{api as Ta,usePostApiV1UploadsMutation as B8,useGetApiV1SearchQuery as X8,
39
39
  *
40
40
  * This source code is licensed under the ISC license.
41
41
  * See the LICENSE file in the root directory of this source tree.
42
- */bt("remoteReady");const $5=bt("askLogin"),e4=bt("reselectUser");bt("requestLogout");const t4=bt("setConfirmLeavePage");bt("requestChangePath");const w6=bt("wsSubscribe"),b6=bt("wsUnSubscribe");bt("hostStoreConnect"),bt("remoteLogin"),bt("remoteLogout"),bt("wsOnMessage"),bt("setRouterPath"),bt("setDeviceType"),bt("setDeviceWidth");const x6=bt("setUserError"),A6=bt("setUserIsError"),N2=bt("setUserPending"),I2=bt("setUserSuccess"),z6=bt("setUserData"),S6=bt("updateAccountData"),r4=bt("updateUser");bt("addNotification"),bt("markNotification"),bt("setNotificationsError"),bt("setNotificationsList"),bt("setNotificationsPending"),bt("setNotificationsTotalCount"),bt("setNotificationsUnreadCount"),bt("resetNotificationsState"),bt("undoNotification"),bt("setInstanceInfo"),bt("setInstanceInfoPending"),bt("setInstanceInfoError");const n4=bt("setPlatformSettings");bt("setProfileSettings");const C6=bt("setGroupData"),M2=bt("setGroupLoading");l6("requestMicroFrontendFetch"),l6("sendMicroFrontendFetchResponse");const a4={data:null,isPending:!1,isSuccess:!1},Kn=xd({name:"userNoHTML",initialState:a4,reducers:{setUser:(e,t)=>{e.data=t.payload},setPending:(e,t)=>{e.isPending=t.payload},setSuccess:(e,{payload:t})=>{e.isSuccess=t},setError:(e,{payload:t})=>{e.error=t}},selectors:{selectUser:e=>e.data,selectPending:e=>e.isPending,selectError:e=>e.error,selectSuccess:e=>e.isSuccess}}),j6="getApiV1UsersRelationships",s4=_d.memoize(((e,t)=>Ta.util.selectCachedArgsForQuery(e,j6).find((e=>e.targets.includes(t))))),ul=({state:e,userId:t,dispatch:r,relationsProps:a})=>{const n=s4(e,t);return n?r(Ta.util.updateQueryData(j6,n,(e=>{e[t]={...e[t],...a}}))):null};var ow=function(e,t,r){if(e&&"reportValidity"in e){var a=E2(r,t);e.setCustomValidity(a&&a.message||""),e.reportValidity()}},T6=function(e,t){var r=function(r){var a=t.fields[r];a&&a.ref&&"reportValidity"in a.ref?ow(a.ref,r,e):a.refs&&a.refs.forEach((function(t){return ow(t,r,e)}))};for(var a in t.fields)r(a)},i4=function(e,t){t.shouldUseNativeValidation&&T6(e,t);var r={};for(var a in e){var n=E2(t.fields,a),i=Object.assign(e[a]||{},{ref:n&&n.ref});if(o4(t.names||Object.keys(e),a)){var o=Object.assign({},E2(r,a));k0(o,"root",i),k0(r,a,o)}else k0(r,a,i)}return r},o4=function(e,t){return e.some((function(e){return e.startsWith(t+".")}))},c4=function(e,t){for(var r={};e.length;){var a=e[0],n=a.code,i=a.message,o=a.path.join(".");if(!r[o])if("unionErrors"in a){var s=a.unionErrors[0].errors[0];r[o]={message:s.message,type:s.code}}else r[o]={message:i,type:n};if("unionErrors"in a&&a.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var c=r[o].types,l=c&&c[a.code];r[o]=Q8(o,t,r,n,l?[].concat(l,a.message):a.message)}e.shift()}return r},gg=function(e,t,r){return void 0===r&&(r={}),function(a,n,i){try{return Promise.resolve(function(n,o){try{var s=Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](a,t)).then((function(e){return i.shouldUseNativeValidation&&T6({},i),{errors:{},values:r.raw?a:e}}))}catch(e){return o(e)}return s&&s.then?s.then(void 0,o):s}(0,(function(e){if(null!=e.errors)return{values:{},errors:i4(c4(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};throw e})))}catch(e){return Promise.reject(e)}}};const P6=({schema:e,defaultValues:t,mode:r="onChange",reValidateMode:a="onChange",showRequiredErrors:n=!0})=>K2({mode:r,reValidateMode:a,resolver:n?gg(e):async(t,r,a)=>{const n=await gg(e)(t,r,a);if(!n.errors||0===Object.keys(n.errors).length)return n;const i={};return Object.keys(n.errors).forEach((e=>{const r=n.errors[e],a=t[e],o="password"===e,s=null==a||""===a,c="invalid_type"===(null==r?void 0:r.type)||"too_small"===(null==r?void 0:r.type)||o&&"custom"===(null==r?void 0:r.type);s&&c||(i[e]=r)})),{values:n.values,errors:i}},defaultValues:t});var Nt,O2;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of r)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Nt||(Nt={})),(O2||(O2={})).mergeShapes=(e,t)=>({...e,...t});const De=Nt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Gu=e=>{switch(typeof e){case"undefined":return De.undefined;case"string":return De.string;case"number":return isNaN(e)?De.nan:De.number;case"boolean":return De.boolean;case"function":return De.function;case"bigint":return De.bigint;case"symbol":return De.symbol;case"object":return Array.isArray(e)?De.array:null===e?De.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?De.promise:typeof Map<"u"&&e instanceof Map?De.map:typeof Set<"u"&&e instanceof Set?De.set:typeof Date<"u"&&e instanceof Date?De.date:De.object;default:return De.unknown}},Se=Nt.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"]),l4=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Bs extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(a);else if("invalid_return_type"===n.code)a(n.returnTypeError);else if("invalid_arguments"===n.code)a(n.argumentsError);else if(0===n.path.length)r._errors.push(t(n));else{let e=r,a=0;for(;a<n.path.length;){const r=n.path[a];a===n.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(n))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof Bs))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Nt.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}Bs.create=e=>new Bs(e);const Hp=(e,t)=>{let r;switch(e.code){case Se.invalid_type:r=e.received===De.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Se.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Nt.jsonStringifyReplacer)}`;break;case Se.unrecognized_keys:r=`Unrecognized key(s) in object: ${Nt.joinValues(e.keys,", ")}`;break;case Se.invalid_union:r="Invalid input";break;case Se.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Nt.joinValues(e.options)}`;break;case Se.invalid_enum_value:r=`Invalid enum value. Expected ${Nt.joinValues(e.options)}, received '${e.received}'`;break;case Se.invalid_arguments:r="Invalid function arguments";break;case Se.invalid_return_type:r="Invalid function return type";break;case Se.invalid_date:r="Invalid date";break;case Se.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Nt.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Se.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Se.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Se.custom:r="Invalid input";break;case Se.invalid_intersection_types:r="Intersection results could not be merged";break;case Se.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Se.not_finite:r="Number must be finite";break;default:r=t.defaultError,Nt.assertNever(e)}return{message:r}};let L6=Hp;function u4(e){L6=e}function mg(){return L6}const _g=e=>{const{data:t,path:r,errorMaps:a,issueData:n}=e,i=[...r,...n.path||[]],o={...n,path:i};if(void 0!==n.message)return{...n,path:i,message:n.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...n,path:i,message:s}},f4=[];function Ie(e,t){const r=mg(),a=_g({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Hp?void 0:Hp].filter((e=>!!e))});e.common.issues.push(a)}class Pa{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const a of t){if("aborted"===a.status)return ct;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,a=await e.value;r.push({key:t,value:a})}return Pa.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const a of t){const{key:t,value:n}=a;if("aborted"===t.status||"aborted"===n.status)return ct;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"!==t.value&&(typeof n.value<"u"||a.alwaysSet)&&(r[t.value]=n.value)}return{status:e.value,value:r}}}const ct=Object.freeze({status:"aborted"}),Bp=e=>({status:"dirty",value:e}),Za=e=>({status:"valid",value:e}),U2=e=>"aborted"===e.status,D2=e=>"dirty"===e.status,cy=e=>"valid"===e.status,ly=e=>typeof Promise<"u"&&e instanceof Promise;function vg(e,t,r,a){if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function R6(e,t,r,a,n){if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var Je,$h,ey;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Je||(Je={}));class oc{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const cw=(e,t)=>{if(cy(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Bs(e.common.issues);return this._error=t,this._error}}};function _t(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:a,description:n}=e;if(t&&(r||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:n}:{errorMap:(t,n)=>{var i,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:s??n.defaultError}:typeof n.data>"u"?{message:null!==(i=s??a)&&void 0!==i?i:n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:null!==(o=s??r)&&void 0!==o?o:n.defaultError}},description:n}}class vt{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Gu(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Gu(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Pa,ctx:{common:e.parent.common,data:e.data,parsedType:Gu(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ly(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const a={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Gu(e)},n=this._parseSync({data:e,path:a.path,parent:a});return cw(a,n)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Gu(e)},a=this._parse({data:e,path:r.path,parent:r}),n=await(ly(a)?a:Promise.resolve(a));return cw(r,n)}refine(e,t){const r=e=>"string"==typeof t||typeof t>"u"?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const n=e(t),i=()=>a.addIssue({code:Se.custom,...r(t)});return typeof Promise<"u"&&n instanceof Promise?n.then((e=>!!e||(i(),!1))):!!n||(i(),!1)}))}refinement(e,t){return this._refinement(((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1)))}_refinement(e){return new uo({schema:this,typeName:it.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ic.create(this,this._def)}nullable(){return $u.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return lo.create(this,this._def)}promise(){return Kp.create(this,this._def)}or(e){return py.create([this,e],this._def)}and(e){return hy.create(this,e,this._def)}transform(e){return new uo({..._t(this._def),schema:this,typeName:it.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new vy({..._t(this._def),innerType:this,defaultValue:t,typeName:it.ZodDefault})}brand(){return new tk({typeName:it.ZodBranded,type:this,..._t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ky({..._t(this._def),innerType:this,catchValue:t,typeName:it.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Sy.create(this,e)}readonly(){return wy.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const d4=/^c[^\s-]{8,}$/i,p4=/^[0-9a-z]+$/,h4=/^[0-9A-HJKMNP-TV-Z]{26}$/,y4=/^[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,g4=/^[a-z0-9_-]{21}$/i,m4=/^[-+]?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)?)??$/,_4=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,v4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let T0;const k4=/^(?:(?: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])$/,w4=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,b4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,E6="((\\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])))",x4=new RegExp(`^${E6}$`);function N6(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function A4(e){return new RegExp(`^${N6(e)}$`)}function I6(e){let t=`${E6}T${N6(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function z4(e,t){return!(("v4"!==t&&t||!k4.test(e))&&("v6"!==t&&t||!w4.test(e)))}class co extends vt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==De.string){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.string,received:t.parsedType}),ct}const t=new Pa;let r;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const n=e.data.length>a.value,i=e.data.length<a.value;(n||i)&&(r=this._getOrReturnCtx(e,r),n?Ie(r,{code:Se.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&Ie(r,{code:Se.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)_4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"email",code:Se.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)T0||(T0=new RegExp(v4,"u")),T0.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"emoji",code:Se.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)y4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"uuid",code:Se.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)g4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"nanoid",code:Se.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)d4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"cuid",code:Se.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)p4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"cuid2",code:Se.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)h4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"ulid",code:Se.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Ie(r,{validation:"url",code:Se.invalid_string,message:a.message}),t.dirty()}else"regex"===a.kind?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"regex",code:Se.invalid_string,message:a.message}),t.dirty())):"trim"===a.kind?e.data=e.data.trim():"includes"===a.kind?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty()):"toLowerCase"===a.kind?e.data=e.data.toLowerCase():"toUpperCase"===a.kind?e.data=e.data.toUpperCase():"startsWith"===a.kind?e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?I6(a).test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?x4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?A4(a).test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?m4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"duration",code:Se.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?z4(e.data,a.version)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"ip",code:Se.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?b4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"base64",code:Se.invalid_string,message:a.message}),t.dirty()):Nt.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:Se.invalid_string,...Je.errToObj(r)})}_addCheck(e){return new co({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Je.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Je.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Je.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Je.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Je.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Je.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Je.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Je.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Je.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Je.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(null==e?void 0:e.precision)>"u"?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...Je.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(null==e?void 0:e.precision)>"u"?null:null==e?void 0:e.precision,...Je.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Je.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Je.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Je.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Je.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Je.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Je.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Je.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Je.errToObj(t)})}nonempty(e){return this.min(1,Je.errToObj(e))}trim(){return new co({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new co({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new co({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function S4(e,t){const r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,n=r>a?r:a;return parseInt(e.toFixed(n).replace(".",""))%parseInt(t.toFixed(n).replace(".",""))/Math.pow(10,n)}co.create=e=>{var t;return new co({checks:[],typeName:it.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,..._t(e)})};class Yu extends vt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==De.number){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.number,received:t.parsedType}),ct}let t;const r=new Pa;for(const a of this._def.checks)"int"===a.kind?Nt.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"multipleOf"===a.kind?0!==S4(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.not_finite,message:a.message}),r.dirty()):Nt.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Je.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Je.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Je.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Je.toString(t))}setLimit(e,t,r,a){return new Yu({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Je.toString(a)}]})}_addCheck(e){return new Yu({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Je.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Je.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Je.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Je.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Je.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Je.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Je.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Je.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Je.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&Nt.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Yu.create=e=>new Yu({checks:[],typeName:it.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,..._t(e)});class Ju extends vt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==De.bigint){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.bigint,received:t.parsedType}),ct}let t;const r=new Pa;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):Nt.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Je.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Je.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Je.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Je.toString(t))}setLimit(e,t,r,a){return new Ju({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Je.toString(a)}]})}_addCheck(e){return new Ju({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Je.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Je.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Je.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Je.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Je.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Ju.create=e=>{var t;return new Ju({checks:[],typeName:it.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,..._t(e)})};class uy extends vt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==De.boolean){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.boolean,received:t.parsedType}),ct}return Za(e.data)}}uy.create=e=>new uy({typeName:it.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,..._t(e)});class kd extends vt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==De.date){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.date,received:t.parsedType}),ct}if(isNaN(e.data.getTime())){return Ie(this._getOrReturnCtx(e),{code:Se.invalid_date}),ct}const t=new Pa;let r;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Nt.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new kd({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Je.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Je.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}kd.create=e=>new kd({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:it.ZodDate,..._t(e)});class kg extends vt{_parse(e){if(this._getType(e)!==De.symbol){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.symbol,received:t.parsedType}),ct}return Za(e.data)}}kg.create=e=>new kg({typeName:it.ZodSymbol,..._t(e)});class fy extends vt{_parse(e){if(this._getType(e)!==De.undefined){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.undefined,received:t.parsedType}),ct}return Za(e.data)}}fy.create=e=>new fy({typeName:it.ZodUndefined,..._t(e)});class dy extends vt{_parse(e){if(this._getType(e)!==De.null){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.null,received:t.parsedType}),ct}return Za(e.data)}}dy.create=e=>new dy({typeName:it.ZodNull,..._t(e)});class Zp extends vt{constructor(){super(...arguments),this._any=!0}_parse(e){return Za(e.data)}}Zp.create=e=>new Zp({typeName:it.ZodAny,..._t(e)});class vd extends vt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Za(e.data)}}vd.create=e=>new vd({typeName:it.ZodUnknown,..._t(e)});class pl extends vt{_parse(e){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.never,received:t.parsedType}),ct}}pl.create=e=>new pl({typeName:it.ZodNever,..._t(e)});class wg extends vt{_parse(e){if(this._getType(e)!==De.undefined){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.void,received:t.parsedType}),ct}return Za(e.data)}}wg.create=e=>new wg({typeName:it.ZodVoid,..._t(e)});class lo extends vt{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==De.array)return Ie(t,{code:Se.invalid_type,expected:De.array,received:t.parsedType}),ct;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,n=t.data.length<a.exactLength.value;(e||n)&&(Ie(t,{code:e?Se.too_big:Se.too_small,minimum:n?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(Ie(t,{code:Se.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(Ie(t,{code:Se.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>a.type._parseAsync(new oc(t,e,t.path,r))))).then((e=>Pa.mergeArray(r,e)));const n=[...t.data].map(((e,r)=>a.type._parseSync(new oc(t,e,t.path,r))));return Pa.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new lo({...this._def,minLength:{value:e,message:Je.toString(t)}})}max(e,t){return new lo({...this._def,maxLength:{value:e,message:Je.toString(t)}})}length(e,t){return new lo({...this._def,exactLength:{value:e,message:Je.toString(t)}})}nonempty(e){return this.min(1,e)}}function Vp(e){if(e instanceof Er){const t={};for(const r in e.shape){const a=e.shape[r];t[r]=ic.create(Vp(a))}return new Er({...e._def,shape:()=>t})}return e instanceof lo?new lo({...e._def,type:Vp(e.element)}):e instanceof ic?ic.create(Vp(e.unwrap())):e instanceof $u?$u.create(Vp(e.unwrap())):e instanceof cc?cc.create(e.items.map((e=>Vp(e)))):e}lo.create=(e,t)=>new lo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:it.ZodArray,..._t(t)});class Er extends vt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Nt.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==De.object){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.object,received:t.parsedType}),ct}const{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:n}=this._getCached(),i=[];if(!(this._def.catchall instanceof pl&&"strip"===this._def.unknownKeys))for(const e in r.data)n.includes(e)||i.push(e);const o=[];for(const e of n){const t=a[e],n=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new oc(r,n,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof pl){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(Ie(r,{code:Se.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const a=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new oc(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>Pa.mergeObjectSync(t,e))):Pa.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Je.errToObj,new Er({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var a,n,i,o;const s=null!==(i=null===(n=(a=this._def).errorMap)||void 0===n?void 0:n.call(a,t,r).message)&&void 0!==i?i:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Je.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new Er({...this._def,unknownKeys:"strip"})}passthrough(){return new Er({...this._def,unknownKeys:"passthrough"})}extend(e){return new Er({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Er({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:it.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Er({...this._def,catchall:e})}pick(e){const t={};return Nt.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new Er({...this._def,shape:()=>t})}omit(e){const t={};return Nt.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new Er({...this._def,shape:()=>t})}deepPartial(){return Vp(this)}partial(e){const t={};return Nt.objectKeys(this.shape).forEach((r=>{const a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()})),new Er({...this._def,shape:()=>t})}required(e){const t={};return Nt.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof ic;)e=e._def.innerType;t[r]=e}})),new Er({...this._def,shape:()=>t})}keyof(){return M6(Nt.objectKeys(this.shape))}}Er.create=(e,t)=>new Er({shape:()=>e,unknownKeys:"strip",catchall:pl.create(),typeName:it.ZodObject,..._t(t)}),Er.strictCreate=(e,t)=>new Er({shape:()=>e,unknownKeys:"strict",catchall:pl.create(),typeName:it.ZodObject,..._t(t)}),Er.lazycreate=(e,t)=>new Er({shape:e,unknownKeys:"strip",catchall:pl.create(),typeName:it.ZodObject,..._t(t)});class py extends vt{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new Bs(e.ctx.common.issues)));return Ie(t,{code:Se.invalid_union,unionErrors:r}),ct}));{let e;const a=[];for(const n of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=n._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"===i.status&&!e&&(e={result:i,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=a.map((e=>new Bs(e)));return Ie(t,{code:Se.invalid_union,unionErrors:n}),ct}}get options(){return this._def.options}}py.create=(e,t)=>new py({options:e,typeName:it.ZodUnion,..._t(t)});const fl=e=>e instanceof gy?fl(e.schema):e instanceof uo?fl(e.innerType()):e instanceof my?[e.value]:e instanceof Qu?e.options:e instanceof _y?Nt.objectValues(e.enum):e instanceof vy?fl(e._def.innerType):e instanceof fy?[void 0]:e instanceof dy?[null]:e instanceof ic?[void 0,...fl(e.unwrap())]:e instanceof $u?[null,...fl(e.unwrap())]:e instanceof tk||e instanceof wy?fl(e.unwrap()):e instanceof ky?fl(e._def.innerType):[];class Rg extends vt{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==De.object)return Ie(t,{code:Se.invalid_type,expected:De.object,received:t.parsedType}),ct;const r=this.discriminator,a=t.data[r],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(Ie(t,{code:Se.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ct)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const a=new Map;for(const r of t){const t=fl(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(a.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);a.set(n,r)}}return new Rg({typeName:it.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,..._t(r)})}}function q2(e,t){const r=Gu(e),a=Gu(t);if(e===t)return{valid:!0,data:e};if(r===De.object&&a===De.object){const r=Nt.objectKeys(t),a=Nt.objectKeys(e).filter((e=>-1!==r.indexOf(e))),n={...e,...t};for(const r of a){const a=q2(e[r],t[r]);if(!a.valid)return{valid:!1};n[r]=a.data}return{valid:!0,data:n}}if(r===De.array&&a===De.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let a=0;a<e.length;a++){const n=q2(e[a],t[a]);if(!n.valid)return{valid:!1};r.push(n.data)}return{valid:!0,data:r}}return r===De.date&&a===De.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class hy extends vt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if(U2(e)||U2(a))return ct;const n=q2(e.value,a.value);return n.valid?((D2(e)||D2(a))&&t.dirty(),{status:t.value,value:n.data}):(Ie(r,{code:Se.invalid_intersection_types}),ct)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}hy.create=(e,t,r)=>new hy({left:e,right:t,typeName:it.ZodIntersection,..._t(r)});class cc extends vt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==De.array)return Ie(r,{code:Se.invalid_type,expected:De.array,received:r.parsedType}),ct;if(r.data.length<this._def.items.length)return Ie(r,{code:Se.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ct;!this._def.rest&&r.data.length>this._def.items.length&&(Ie(r,{code:Se.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...r.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new oc(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(a).then((e=>Pa.mergeArray(t,e))):Pa.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new cc({...this._def,rest:e})}}cc.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new cc({items:e,typeName:it.ZodTuple,rest:null,..._t(t)})};class yy extends vt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==De.object)return Ie(r,{code:Se.invalid_type,expected:De.object,received:r.parsedType}),ct;const a=[],n=this._def.keyType,i=this._def.valueType;for(const e in r.data)a.push({key:n._parse(new oc(r,e,r.path,e)),value:i._parse(new oc(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?Pa.mergeObjectAsync(t,a):Pa.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new yy(t instanceof vt?{keyType:e,valueType:t,typeName:it.ZodRecord,..._t(r)}:{keyType:co.create(),valueType:e,typeName:it.ZodRecord,..._t(t)})}}class bg extends vt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==De.map)return Ie(r,{code:Se.invalid_type,expected:De.map,received:r.parsedType}),ct;const a=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map((([e,t],i)=>({key:a._parse(new oc(r,e,r.path,[i,"key"])),value:n._parse(new oc(r,t,r.path,[i,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of i){const a=await r.key,n=await r.value;if("aborted"===a.status||"aborted"===n.status)return ct;("dirty"===a.status||"dirty"===n.status)&&t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of i){const a=r.key,n=r.value;if("aborted"===a.status||"aborted"===n.status)return ct;("dirty"===a.status||"dirty"===n.status)&&t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}}}bg.create=(e,t,r)=>new bg({valueType:t,keyType:e,typeName:it.ZodMap,..._t(r)});class wd extends vt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==De.set)return Ie(r,{code:Se.invalid_type,expected:De.set,received:r.parsedType}),ct;const a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(Ie(r,{code:Se.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(Ie(r,{code:Se.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function i(e){const r=new Set;for(const a of e){if("aborted"===a.status)return ct;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}const o=[...r.data.values()].map(((e,t)=>n._parse(new oc(r,e,r.path,t))));return r.common.async?Promise.all(o).then((e=>i(e))):i(o)}min(e,t){return new wd({...this._def,minSize:{value:e,message:Je.toString(t)}})}max(e,t){return new wd({...this._def,maxSize:{value:e,message:Je.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}wd.create=(e,t)=>new wd({valueType:e,minSize:null,maxSize:null,typeName:it.ZodSet,..._t(t)});class Xp extends vt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==De.function)return Ie(t,{code:Se.invalid_type,expected:De.function,received:t.parsedType}),ct;function r(e,r){return _g({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mg(),Hp].filter((e=>!!e)),issueData:{code:Se.invalid_arguments,argumentsError:r}})}function a(e,r){return _g({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mg(),Hp].filter((e=>!!e)),issueData:{code:Se.invalid_return_type,returnTypeError:r}})}const n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Kp){const e=this;return Za((async function(...t){const o=new Bs([]),s=await e._def.args.parseAsync(t,n).catch((e=>{throw o.addIssue(r(t,e)),o})),c=await Reflect.apply(i,this,s);return await e._def.returns._def.type.parseAsync(c,n).catch((e=>{throw o.addIssue(a(c,e)),o}))}))}{const e=this;return Za((function(...t){const o=e._def.args.safeParse(t,n);if(!o.success)throw new Bs([r(t,o.error)]);const s=Reflect.apply(i,this,o.data),c=e._def.returns.safeParse(s,n);if(!c.success)throw new Bs([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Xp({...this._def,args:cc.create(e).rest(vd.create())})}returns(e){return new Xp({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Xp({args:e||cc.create([]).rest(vd.create()),returns:t||vd.create(),typeName:it.ZodFunction,..._t(r)})}}class gy extends vt{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}gy.create=(e,t)=>new gy({getter:e,typeName:it.ZodLazy,..._t(t)});class my extends vt{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ie(t,{received:t.data,code:Se.invalid_literal,expected:this._def.value}),ct}return{status:"valid",value:e.data}}get value(){return this._def.value}}function M6(e,t){return new Qu({values:e,typeName:it.ZodEnum,..._t(t)})}my.create=(e,t)=>new my({value:e,typeName:it.ZodLiteral,..._t(t)});class Qu extends vt{constructor(){super(...arguments),$h.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return Ie(t,{expected:Nt.joinValues(r),received:t.parsedType,code:Se.invalid_type}),ct}if(vg(this,$h)||R6(this,$h,new Set(this._def.values)),!vg(this,$h).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return Ie(t,{received:t.data,code:Se.invalid_enum_value,options:r}),ct}return Za(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Qu.create(e,{...this._def,...t})}exclude(e,t=this._def){return Qu.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}$h=new WeakMap,Qu.create=M6;class _y extends vt{constructor(){super(...arguments),ey.set(this,void 0)}_parse(e){const t=Nt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==De.string&&r.parsedType!==De.number){const e=Nt.objectValues(t);return Ie(r,{expected:Nt.joinValues(e),received:r.parsedType,code:Se.invalid_type}),ct}if(vg(this,ey)||R6(this,ey,new Set(Nt.getValidEnumValues(this._def.values))),!vg(this,ey).has(e.data)){const e=Nt.objectValues(t);return Ie(r,{received:r.data,code:Se.invalid_enum_value,options:e}),ct}return Za(e.data)}get enum(){return this._def.values}}ey=new WeakMap,_y.create=(e,t)=>new _y({values:e,typeName:it.ZodNativeEnum,..._t(t)});class Kp extends vt{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==De.promise&&!1===t.common.async)return Ie(t,{code:Se.invalid_type,expected:De.promise,received:t.parsedType}),ct;const r=t.parsedType===De.promise?t.data:Promise.resolve(t.data);return Za(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Kp.create=(e,t)=>new Kp({type:e,typeName:it.ZodPromise,..._t(t)});class uo extends vt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===it.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:e=>{Ie(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===a.type){const e=a.transform(r.data,n);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return ct;const a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?ct:"dirty"===a.status||"dirty"===t.value?Bp(a.value):a}));{if("aborted"===t.value)return ct;const a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?ct:"dirty"===a.status||"dirty"===t.value?Bp(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,n);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===a.status?ct:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?ct:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===a.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!cy(e))return e;const i=a.transform(e.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>cy(e)?Promise.resolve(a.transform(e.value,n)).then((e=>({status:t.value,value:e}))):e))}Nt.assertNever(a)}}uo.create=(e,t,r)=>new uo({schema:e,typeName:it.ZodEffects,effect:t,..._t(r)}),uo.createWithPreprocess=(e,t,r)=>new uo({schema:t,effect:{type:"preprocess",transform:e},typeName:it.ZodEffects,..._t(r)});class ic extends vt{_parse(e){return this._getType(e)===De.undefined?Za(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ic.create=(e,t)=>new ic({innerType:e,typeName:it.ZodOptional,..._t(t)});class $u extends vt{_parse(e){return this._getType(e)===De.null?Za(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}$u.create=(e,t)=>new $u({innerType:e,typeName:it.ZodNullable,..._t(t)});class vy extends vt{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===De.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}vy.create=(e,t)=>new vy({innerType:e,typeName:it.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,..._t(t)});class ky extends vt{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ly(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Bs(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new Bs(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ky.create=(e,t)=>new ky({innerType:e,typeName:it.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,..._t(t)});class xg extends vt{_parse(e){if(this._getType(e)!==De.nan){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.nan,received:t.parsedType}),ct}return{status:"valid",value:e.data}}}xg.create=e=>new xg({typeName:it.ZodNaN,..._t(e)});const C4=Symbol("zod_brand");class tk extends vt{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Sy extends vt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?ct:"dirty"===e.status?(t.dirty(),Bp(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?ct:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new Sy({in:e,out:t,typeName:it.ZodPipeline})}}class wy extends vt{_parse(e){const t=this._def.innerType._parse(e),r=e=>(cy(e)&&(e.value=Object.freeze(e.value)),e);return ly(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}function O6(e,t={},r){return e?Zp.create().superRefine(((a,n)=>{var i,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===o||o,c="string"==typeof e?{message:e}:e;n.addIssue({code:"custom",...c,fatal:s})}})):Zp.create()}wy.create=(e,t)=>new wy({innerType:e,typeName:it.ZodReadonly,..._t(t)});const j4={object:Er.lazycreate};var it;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(it||(it={}));const T4=(e,t={message:`Input not instance of ${e.name}`})=>O6((t=>t instanceof e),t),U6=co.create,D6=Yu.create,P4=xg.create,L4=Ju.create,q6=uy.create,R4=kd.create,E4=kg.create,N4=fy.create,I4=dy.create,M4=Zp.create,O4=vd.create,U4=pl.create,D4=wg.create,q4=lo.create,W4=Er.create,F4=Er.strictCreate,V4=py.create,B4=Rg.create,X4=hy.create,G4=cc.create,H4=yy.create,Z4=bg.create,K4=wd.create,Y4=Xp.create,J4=gy.create,Q4=my.create,$4=Qu.create,e9=_y.create,t9=Kp.create,lw=uo.create,r9=ic.create,n9=$u.create,a9=uo.createWithPreprocess,s9=Sy.create,i9=()=>U6().optional(),o9=()=>D6().optional(),c9=()=>q6().optional(),l9={string:e=>co.create({...e,coerce:!0}),number:e=>Yu.create({...e,coerce:!0}),boolean:e=>uy.create({...e,coerce:!0}),bigint:e=>Ju.create({...e,coerce:!0}),date:e=>kd.create({...e,coerce:!0})},u9=ct;var qe=Object.freeze({__proto__:null,defaultErrorMap:Hp,setErrorMap:u4,getErrorMap:mg,makeIssue:_g,EMPTY_PATH:f4,addIssueToContext:Ie,ParseStatus:Pa,INVALID:ct,DIRTY:Bp,OK:Za,isAborted:U2,isDirty:D2,isValid:cy,isAsync:ly,get util(){return Nt},get objectUtil(){return O2},ZodParsedType:De,getParsedType:Gu,ZodType:vt,datetimeRegex:I6,ZodString:co,ZodNumber:Yu,ZodBigInt:Ju,ZodBoolean:uy,ZodDate:kd,ZodSymbol:kg,ZodUndefined:fy,ZodNull:dy,ZodAny:Zp,ZodUnknown:vd,ZodNever:pl,ZodVoid:wg,ZodArray:lo,ZodObject:Er,ZodUnion:py,ZodDiscriminatedUnion:Rg,ZodIntersection:hy,ZodTuple:cc,ZodRecord:yy,ZodMap:bg,ZodSet:wd,ZodFunction:Xp,ZodLazy:gy,ZodLiteral:my,ZodEnum:Qu,ZodNativeEnum:_y,ZodPromise:Kp,ZodEffects:uo,ZodTransformer:uo,ZodOptional:ic,ZodNullable:$u,ZodDefault:vy,ZodCatch:ky,ZodNaN:xg,BRAND:C4,ZodBranded:tk,ZodPipeline:Sy,ZodReadonly:wy,custom:O6,Schema:vt,ZodSchema:vt,late:j4,get ZodFirstPartyTypeKind(){return it},coerce:l9,any:M4,array:q4,bigint:L4,boolean:q6,date:R4,discriminatedUnion:B4,effect:lw,enum:$4,function:Y4,instanceof:T4,intersection:X4,lazy:J4,literal:Q4,map:Z4,nan:P4,nativeEnum:e9,never:U4,null:I4,nullable:n9,number:D6,object:W4,oboolean:c9,onumber:o9,optional:r9,ostring:i9,pipeline:s9,preprocess:a9,promise:t9,record:H4,set:K4,strictObject:F4,string:U6,symbol:E4,transformer:lw,tuple:G4,undefined:N4,union:V4,unknown:O4,void:D4,NEVER:u9,ZodIssueCode:Se,quotelessJson:l4,ZodError:Bs}),f9={USER:"teamcity",npm_config_user_agent:"npm/10.9.3 node/v22.18.0 linux x64 workspaces/true",npm_node_execpath:"/home/teamcity/.nvm/versions/node/v22.18.0/bin/node",npm_config_noproxy:"",HOME:"/home/teamcity",npm_package_json:"/mnt/agent/work/70fcd8585843667f/packages/user/package.json",npm_config_userconfig:"/home/teamcity/.npmrc",npm_config_local_prefix:"/mnt/agent/work/70fcd8585843667f",COLOR:"1",npm_config_progress:"",TEMP:"/mnt/agent/temp/buildTmp",npm_config_prefix:"/home/teamcity/.nvm/versions/node/v22.18.0",npm_config_npm_version:"10.9.3",npm_config_cache:"/home/teamcity/.npm",npm_config_node_gyp:"/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",PATH:"/mnt/agent/work/70fcd8585843667f/packages/user/node_modules/.bin:/mnt/agent/work/70fcd8585843667f/packages/node_modules/.bin:/mnt/agent/work/70fcd8585843667f/node_modules/.bin:/mnt/agent/work/node_modules/.bin:/mnt/agent/node_modules/.bin:/mnt/node_modules/.bin:/node_modules/.bin:/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/mnt/agent/work/70fcd8585843667f/node_modules/.bin:/mnt/agent/work/node_modules/.bin:/mnt/agent/node_modules/.bin:/mnt/node_modules/.bin:/node_modules/.bin:/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/teamcity/.cargo/bin:/home/teamcity/.rvm/gems/ruby-3.3.9/bin:/home/teamcity/.rvm/gems/ruby-3.3.9@global/bin:/home/teamcity/.rvm/rubies/ruby-3.3.9/bin:/home/teamcity/.rvm/bin:/home/teamcity/.local/bin:/usr/lib/jvm/java-21-amazon-corretto/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/snap/bin:/usr/share/dotnet:/usr/share/dotnet/tools:/home/teamcity/google-cloud-sdk/bin:/home/teamcity/go/bin:/usr/bin/mvn:/home/teamcity/.nvm/versions/node/v22.18.0/bin",TURBO_HASH:"80c2ebf28d74f807",NODE:"/home/teamcity/.nvm/versions/node/v22.18.0/bin/node",npm_package_name:"@wellesley/user",npm_config_color:"always",DOMAIN_ENV:"test",LANG:"en_US.UTF-8",TURBO_TEAM:"wellesley",TMP:"/mnt/agent/temp/buildTmp",TURBO_API:"https://turborepo-remote-cache-fo3np.ondigitalocean.app",npm_lifecycle_script:"vite build",SHELL:"/bin/bash",npm_package_version:"1.0.717",npm_lifecycle_event:"build",TURBO_CACHE:"remote:rw",SENTRY_MAPS_UPLOAD:"true",npm_config_globalconfig:"/home/teamcity/.nvm/versions/node/v22.18.0/etc/npmrc",npm_config_init_module:"/home/teamcity/.npm-init.js",PWD:"/mnt/agent/work/70fcd8585843667f/packages/user",npm_execpath:"/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/bin/npm-cli.js",npm_config_global_prefix:"/home/teamcity/.nvm/versions/node/v22.18.0",npm_command:"run-script",TURBO_TOKEN:"wellesley-turbo-token",USE_PACKAGES_FROM_NPM:"true",INIT_CWD:"/mnt/agent/work/70fcd8585843667f/packages/user",EDITOR:"vi",NODE_ENV:"production",BUILD_NUMBER:"3548",APP_NAME:"@wellesley/user"};const W6=e=>f9.DOMAIN_ENV===e,d9=W6("prod"),F6=d9?8:3,V6=64,uw=5,W2=2,B6=30,rk=50,X6=1024,G6=30,sc={link:56,userName:30,pronouns:80,displayName:50,description:X6,fieldLabel:20,fieldContent:80,location:56,timezone:56},Hu={short:"Too short",long:"Too long"},p9=(e,t=100)=>{let r;return function(...a){clearTimeout(r),r=setTimeout((()=>e.apply(this,a)),t)}},h9=(e,t)=>{const r=p9(((t,r,a)=>{e(...a).then(t).catch(r)}),t);return(...e)=>new Promise(((t,a)=>{r(t,a,e)}))},nk=new RegExp("\\p{Extended_Pictographic}","u"),H6=({showInlineError:e=!0})=>qe.string().trim().min(1,e?"Username is required":"").min(2,e?"Must be at least 2 characters long":"").max(30,Hu.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,"Only latin letters, digits, _ and . allowed"),y9=h9((async e=>{try{const{exists:t}=await Y2().dispatch(Ta.endpoints.getApiV1UsersCheck.initiate({username:e})).unwrap();return{exists:t??!1,message:"Username already in use. Please, try another one"}}catch{return{exists:!1,message:""}}}),500),Z6=qe.string().trim().min(1,"Display name is required").max(50).regex(/^[^@]*$/,"@ is not allowed").superRefine(((e,t)=>{const r=nk.test(e),a=/[a-zA-Z0-9]/.test(e);r&&!a&&t.addIssue({code:qe.ZodIssueCode.custom,message:"Emojis alone are not allowed. Please add text"})})),g9=qe.string().max(1024,Hu.long).optional(),K6=({minLength:e,minErrorMessage:t,maxLength:r,regexErrorMessage:a})=>qe.string().trim().min(e,t).max(r,Hu.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,a);K6({minLength:2,maxLength:30,regexErrorMessage:"Invalid characters. ex.: group_name_1"}),K6({minLength:2,minErrorMessage:Hu.short,maxLength:30,regexErrorMessage:"Invalid characters. ex.: channel_name_1"}),qe.string().trim().min(1,"").regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$|^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{1,}$/,"Invalid characters");const m9=`Required: A-Z, a-z, 0-9, special character, min ${F6}, max 64`;qe.string().trim().superRefine(((e,t)=>{nk.test(e)&&t.addIssue({code:qe.ZodIssueCode.custom,message:"Emojis are not allowed"}),/[A-Z]/.test(e)&&/[a-z]/.test(e)&&/[0-9]/.test(e)&&/[^A-Za-z0-9]/.test(e)&&e.length>=F6&&e.length<=64||t.addIssue({code:qe.ZodIssueCode.custom,message:m9})})),qe.string().trim().min(5,"Must be at least 5 characters long").regex(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/i,"Email format is not valid").refine((e=>!nk.test(e)),"Emojis are not allowed");const _9=({form:e,originalUsername:t})=>{const r=Nn(t??"").current,a=e=>e.getValues("userName"),[n,i]=Dt(!1),[o,s]=Dt(a(e));return{isUserNameChecked:n,handleUserNameChange:()=>{i(!1)},handleUserNameBlur:async()=>{const t=a(e).trim();if(t===o||t===r)return;const{exists:n,message:c}=await y9(t);n&&e.setError("userName",{message:c}),s(t),i(!0)}}},v9=qe.object({bio:g9,username:H6({showInlineError:!0}),displayName:Z6}),k9=qe.object({show:qe.boolean(),dateOnly:qe.boolean(),date:qe.date().optional().nullable()}),w9=(e=!0)=>{const t=H6({showInlineError:e});return qe.object({avatarId:qe.string().nullable(),headerId:qe.string().nullable(),channel:qe.boolean().optional(),actorType:qe.enum(["Application","Group","Organization","Person","Service"]).optional(),userName:t,displayName:Z6,Pronouns:qe.string().max(sc.pronouns,Hu.long).optional(),summary:qe.string().max(sc.description,Hu.long).optional(),customFields:qe.array(qe.object({label:qe.string().max(sc.fieldLabel,Hu.long).optional(),content:qe.string().max(sc.fieldContent,Hu.long).optional()})),location:qe.object({geo:qe.object({latitude:qe.number().optional(),longitude:qe.number().optional(),accuracy:qe.number().optional().nullable()}).optional().nullable(),show:qe.boolean().optional(),name:qe.string().optional(),autoUpdate:qe.boolean().optional()}),timezone:qe.object({show:qe.boolean(),ianaTimezone:qe.string().optional(),autoUpdate:qe.boolean()}),birthday:k9,canSubmit:qe.boolean(),botProfile:qe.object({role:qe.string().optional(),triggers:qe.array(qe.object({id:qe.string(),label:qe.string()})).optional(),personality_traits:qe.array(qe.object({id:qe.string(),label:qe.string()})).optional(),tone:qe.string().optional(),style:qe.array(qe.object({id:qe.string(),label:qe.string()})).optional(),behaviors:qe.array(qe.object({id:qe.string(),label:qe.string()})).optional(),prompt:qe.string().optional()}).optional()})};qe.object({show:qe.boolean(),dateOnly:qe.boolean(),date:qe.date().optional().nullable()});const by=e=>{var t;const r=e,a=409===(null==r?void 0:r.status);return{message:"UserNameIsReserved"===(null==(t=null==r?void 0:r.data)?void 0:t.errorCode)?"Restricted words detected. Please, try alternatives":"Username already in use. Please, try another one",isError:a}},Y6=Ta.enhanceEndpoints({endpoints:{deleteApiV1Users:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){try{await Ge(r)&&await t(Ta.endpoints.getApiV1AccountsProfile.initiate({htmlContent:!1})).unwrap()}catch(e){Br.error(`${oo(e)}`)}}},getApiV1AccountsProfile:{providesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){t(N2(!0));try{const e=await Ge(r);e&&t(z6(e.data)),t(I2(!0))}catch(e){t(I2(!1)),t(A6(!0)),t(x6(e))}finally{t(N2(!1))}}},putApiV1UsersByUserId:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,Br.success("User updated successfully")}catch(e){const t=e.error,{isError:r}=by(t);!r&&Br.error(`${oo(t)}`)}}},getApiV1Users:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){const a=!e.htmlContent;try{a&&t(Kn.actions.setPending(!0));const e=await Ge(r);a&&e&&(t(Kn.actions.setUser(e.data)),t(Kn.actions.setSuccess(!0)),t(Kn.actions.setPending(!1)))}catch(e){a&&(t(Kn.actions.setSuccess(!1)),t(Kn.actions.setError(e)),t(Kn.actions.setPending(!1))),Br.error(`${oo(e)}`)}}},postApiV1Users:{invalidatesTags:["Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,Br.success("User created successfully")}catch(e){const t=e.error,{isError:r}=by(t);!r&&Br.error(`${oo(t)}`)}}},getApiV1UsersFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ge(t)}},getApiV1UsersRemoteByUserNameFullFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ge(t)}},getApiV1UsersByUserId:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){const a=!e.htmlContent;try{a&&t(Kn.actions.setPending(!0));const e=await Ge(r);a&&e&&(t(Kn.actions.setUser(e.data)),t(Kn.actions.setSuccess(!0)),t(Kn.actions.setPending(!1)))}catch(e){a&&(t(Kn.actions.setSuccess(!1)),t(Kn.actions.setError(e)),t(Kn.actions.setPending(!1))),Br.error(`${oo(e)}`)}}},getApiV1UsersByUserIdFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ge(t)}},getApiV1UsersFollowees:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ge(t)}},getApiV1UsersByUserIdFollowing:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ge(t)}},postApiV1UsersFollowByUsernameAccept:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:a}){const n=ul({dispatch:r,userId:e.user.id,state:a(),relationsProps:{followed:"ACCEPTED"}});await Ge(t,`Accepted follow request from ${e.username}`,(()=>null==n?void 0:n.undo()))}},postApiV1UsersFollowByUsernameReject:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:a}){const n=ul({dispatch:r,userId:e.user.id,state:a(),relationsProps:{followed:"REJECTED"}});await Ge(t,`Rejected follow request from ${e.username}`,(()=>null==n?void 0:n.undo()))}},postApiV1UsersFollowByUsername:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r}){await Ge(t,`Follow request sent to ${e.username}`)&&r(Ta.util.invalidateTags([{type:"Relationship",id:e.user.id}]))}},postApiV1UsersFollowByUsernameUndo:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:a}){const n=ul({dispatch:r,userId:e.user.id,state:a(),relationsProps:{following:null}});await Ge(t,`You unfollowed ${e.username}`,(()=>null==n?void 0:n.undo()))}},getApiV1Block:{providesTags:["Follow"]},postApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:a}){const n=ul({userId:e.userId,dispatch:a,state:r(),relationsProps:{blocked:!0}});await Ge(t,void 0,(()=>null==n?void 0:n.undo()))}},deleteApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:a}){const n=ul({userId:e.userId,dispatch:a,state:r(),relationsProps:{blocked:!1,muted:{state:!1}}});await Ge(t,void 0,(()=>null==n?void 0:n.undo()))}},postApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:r,dispatch:a}){const n=ul({userId:e,dispatch:a,state:r(),relationsProps:{muted:{state:!0}}});await Ge(t,void 0,(()=>null==n?void 0:n.undo()))}},deleteApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:r,dispatch:a}){const n=ul({userId:e,dispatch:a,state:r(),relationsProps:{muted:{state:!1}}});await Ge(t,void 0,(()=>null==n?void 0:n.undo()))}},getApiV1Mute:{async onQueryStarted(e,{queryFulfilled:t}){await Ge(t)}},getApiV1UsersRelationships:{providesTags:(e,t,{targets:r})=>r.map((e=>({type:"Relationship",id:e}))),async onQueryStarted(e,{queryFulfilled:t}){await Ge(t)}},postApiV1AdminUserChangeState:{invalidatesTags:["Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Ge(t,`User ${e.changeUserState.userId} state changed to ${e.changeUserState.newState}`)}},putApiV1Notes:{async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:a}){const{userId:n,text:i}=e.noteUpdate,o=ul({userId:n,dispatch:a,state:r(),relationsProps:{note:i}});await Ge(t,"Note has been updated",(()=>null==o?void 0:o.undo()))}},deleteApiV1NotesByUserId:{async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:a}){const n=ul({userId:e.userId,dispatch:a,state:r(),relationsProps:{note:""}});await Ge(t,"Note has been removed",(()=>null==n?void 0:n.undo()))}},postApiV1UsersFollowByUsernamePend:{async onQueryStarted(e,{queryFulfilled:t}){await Ge(t,`${e.username} has been removed from followers`)}}}}).injectEndpoints({endpoints:e=>({getInteractionUrl:e.query({query:e=>({url:e,headers:{Accept:"application/activity+json"}}),transformResponse:e=>"string"==typeof e?JSON.parse(e):e})})}),{useGetInteractionUrlQuery:Ice,usePostApiV1UsersMutation:b9,useDeleteApiV1AccountsDeleteMutation:x9,useGetApiV1AccountsProfileQuery:Mce,usePutApiV1UsersByUserIdMutation:ak,useGetApiV1UsersQuery:A9,useDeleteApiV1UsersMutation:J6,usePostApiV1MuteByUserIdMutation:Oce,useDeleteApiV1MuteByUserIdMutation:Uce,useGetApiV1MuteQuery:Dce,usePostApiV1AdminUserChangeStateMutation:qce,useGetApiV1UsersRelationshipsQuery:z9,usePutApiV1NotesMutation:Wce,useDeleteApiV1NotesByUserIdMutation:Fce,useLazyGetApiV1UsersRelationshipsQuery:S9,useLazyGetApiV1GeoQuery:C9,useGetApiV1UsersFollowersQuery:Vce,useGetApiV1UsersByUserIdQuery:j9,useLazyGetApiV1GroupsAccountQuery:T9,useLazyGetApiV1UsersRenameHistoryQuery:Bce,useGetApiV1UsersByUserIdFollowersQuery:Xce,usePostApiV1UsersFollowByUsernameMutation:Gce,usePostApiV1UsersFollowByUsernameUndoMutation:Hce,usePostApiV1UsersFollowByUsernameRejectMutation:Zce,usePostApiV1UsersFollowByUsernameAcceptMutation:Kce,useGetApiV1UsersRemoteByUserNameFullFollowersQuery:Yce}=Y6,Q6=()=>{const[e]=ak();return({userId:t,htmlContent:r,data:a})=>{e({userId:t,userUpdate:a,...r&&{htmlContent:r}})}},fw={data:null,isError:!1,isPending:!1,isSuccess:!1},Nr=xd({name:"user",initialState:fw,reducers:{reset:e=>{Object.assign(e,fw)}},extraReducers:e=>{e.addCase(z6,((e,{payload:t})=>{e.data=t})).addCase(S6,((e,{payload:t})=>{e.data&&Object.assign(e.data,t||{})})).addCase(I2,((e,{payload:t})=>{e.isSuccess=t})).addCase(N2,((e,{payload:t})=>{e.isPending=t})).addCase(A6,((e,{payload:t})=>{e.isError=t})).addCase(x6,((e,{payload:t})=>{e.error=t})).addCase(r4,((e,{payload:t})=>{var r;null!=(r=e.data)&&r.users&&(e.data.users=e.data.users.map((e=>t.id===e.id?t:e)))}))},selectors:{selectIsError:e=>e.isError,selectError:e=>e.error,selectPending:e=>e.isPending,selectData:e=>e.data,selectAccount:e=>{var t;return null==(t=e.data)?void 0:t.account},selectAccountId:e=>{var t;return null==(t=e.data)?void 0:t.account.id},selectUsers:e=>{var t;return null==(t=e.data)?void 0:t.users},selectUserById:(e,t)=>{var r;return null==(r=e.data)?void 0:r.users.find((({id:e})=>e===t))},selectCurrentUser:e=>{var t;return null==(t=e.data)?void 0:t.users.find((({id:t})=>{var r;return t===(null==(r=e.data)?void 0:r.selectedUserId)}))},selectSelectedUserId:e=>{var t;return null==(t=e.data)?void 0:t.selectedUserId},selectSuccess:e=>e.isSuccess}}),P9=e=>e.filter((e=>e.id&&e.username&&e.displayName)),Jce=()=>{const e=fo(),t=ft(Nr.selectors.selectAccount),r=u6("account#$account_id",{account_id:(null==t?void 0:t.id)||""}),a=ft((e=>Q2.selectors.selectLastUpdateFor(e,r)));jt((()=>{if(null!=t&&t.id)return e(w6({id:r,topics:[r]})),()=>{e(b6(r))}}),[null==t?void 0:t.id]),jt((()=>{null!=a&&a.data&&e(S6({...a.data,users:P9(a.data.users)}))}),[null==a?void 0:a.data])},Jp=()=>{const e=ft(Nr.selectors.selectSelectedUserId),t=fo();return{changeUser:md((r=>{e!==r&&t(e4({userId:r}))}),[e,t]),selectedUserId:e}},L9=(e="")=>e.startsWith("@")?null==e?void 0:e.replace("@",""):e,R9=({username:e,canFetch:t=!0,htmlContent:r=!0})=>{const a=L9(e),{data:n,error:i,isLoading:o}=A9({username:a,full:!0,htmlContent:r},{skip:!a||!t});return{data:n,error:i,isLoading:o}},E9=e=>{const t=ft(Kn.selectors.selectUser),{isLoading:r}=R9({username:e,canFetch:!!e,htmlContent:!1});return[t,r]},N9="wlsy",$6=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},I9=()=>{const e=new Set,t=$6();if(!t)return[];for(let r=0;r<(null==t?void 0:t.length);r+=1){const a=null==t?void 0:t.key(r);"string"==typeof a&&e.add(a)}return Array.from(e)},sk=e=>{const t=`${N9}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,a=()=>I9().filter((e=>e.startsWith(`${t}:`))),n=e=>e.slice(t.length+1),i=$6(),o=e=>{try{return null==i?void 0:i.getItem(r(e))}catch{return null}},s=(e,t)=>{try{null==i||i.setItem(r(e),String(t))}catch{return}};return{getItem:o,setItem:s,removeItem:e=>{try{null==i||i.removeItem(r(e))}catch{return}},clear:()=>{try{a().forEach((e=>null==i?void 0:i.removeItem(e)))}catch{return}},keys:()=>a().map(n),has:e=>null!==o(e),getJSON:e=>{const t=o(e);if(null==t)return null;try{return JSON.parse(t)}catch{return null}},setJSON:(e,t)=>{try{s(e,JSON.stringify(t))}catch{return}}}},ik="auth_token",ok=sk("user"),ez=()=>ok.getItem(ik)||void 0,M9=e=>ok.setItem(ik,e),O9=()=>ok.removeItem(ik),U9=()=>!!ez(),D9={getToken:ez,setToken:M9,removeToken:O9,hasToken:U9},dw={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!D9.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},ck=xd({name:"auth",initialState:dw,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...dw,isPending:!1}),setNewEmail:(e,t)=>{e.newEmail=t.payload},setForgotPasswordStep:(e,t)=>{e.forgotPasswordStep=t.payload},updateForgotPasswordFields:(e,t)=>{e.forgotPasswordFields={...e.forgotPasswordFields,...t.payload}},resetForgotPasswordFields:e=>{e.forgotPasswordFields=null},setSignupStep:(e,t)=>{e.signupStep=t.payload},updateSignupFields:(e,t)=>{e.signupFields={...e.signupFields,...t.payload}},resetSignupFields:e=>{e.signupFields=null},setPending:(e,t)=>{e.isPending=t.payload}},selectors:{selectAskLoginOpen:e=>e.isAskLoginOpen,selectToken:e=>e.token,selectNewEmail:e=>e.newEmail,selectForgotPasswordStep:e=>e.forgotPasswordStep,selectForgotPasswordFields:e=>e.forgotPasswordFields,selectSignupStep:e=>e.signupStep,selectSignupFields:e=>e.signupFields,selectPending:e=>e.isPending,selectIsAuthenticated:e=>e.isAuthenticated}}),Qce=()=>{const e=ft(ck.selectors.selectIsAuthenticated),t=ft(Nr.selectors.selectPending);return{user:ft(Nr.selectors.selectCurrentUser),isLogged:e,isLoading:t}},q9=()=>{const e=ft(Nr.selectors.selectCurrentUser),t=ft(ck.selectors.selectIsAuthenticated);return{user:e,isLoading:ft(Nr.selectors.selectPending),isLogged:t,error:ft(Nr.selectors.selectError)}},$ce=({userId:e="",canFetch:t=!0,htmlContent:r=!0})=>{const{data:a,error:n,isLoading:i,isFetching:o}=j9({userId:e,full:!0,htmlContent:r},{skip:!e||!t});return{data:a,error:n,isLoading:i,isFetching:o}},W9=({onChange:e})=>{const{user:t}=q9(),r=null==t?void 0:t.id,a=Nn(r);jt((()=>{a.current?r!==a.current&&(e(),a.current=r):a.current=r}),[r,a.current])},pw=["following","followed","blocked","muted","note","blocked_by"],hw=({userId:e,currentUserId:t})=>{const r="string"==typeof e,a=r?[e]:(null==e?void 0:e.filter((e=>e!==t)))||[],n=e===t;return{isSingleUser:r,canFetch:!(!a.length||n||!t),safeTargets:a}},F9=({userId:e,skip:t})=>{const r=ft(Nr.selectors.selectCurrentUser),a=null==r?void 0:r.id,{canFetch:n,isSingleUser:i,safeTargets:o}=hw({userId:e,currentUserId:a}),{data:s,isLoading:c}=z9({targets:o,filter:pw},{skip:!n||t}),[l]=S9(),u=({userId:e})=>{const{canFetch:t,safeTargets:r}=hw({userId:e,currentUserId:a});t&&l({targets:r,filter:pw})};return W9({onChange:()=>{u({userId:o})}}),{relationship:(i?null==s?void 0:s[e]:s)||{},isLoading:c,updateRelations:u}},Eg=e=>`@${e.username}${e.domain?`@${e.domain}`:""}`,tz=({id:e,user:t})=>{const r=fo(),a=u6("user#$username",{username:t?Eg(t).slice(1):""}),n=`${e}-${null==t?void 0:t.username}`;return jt((()=>{if(null!=t&&t.username)return r(w6({id:n,topics:[a]})),()=>{r(b6(n))}}),[null==t?void 0:t.username]),{subscriptionName:a}},ele=({user:e,onUpdate:t})=>{const{updateRelations:r}=F9({}),{subscriptionName:a}=tz({id:"outside-user-update",user:e}),n=ft((e=>Q2.selectors.selectLastUpdateFor(e,a)));jt((()=>{const e=null==n?void 0:n.data;e&&(r({userId:e.id}),t(e))}),[null==n?void 0:n.data])},tle=({onUpdate:e})=>{const t=ft(Nr.selectors.selectCurrentUser),{subscriptionName:r}=tz({id:"current-user-update",user:t}),a=ft((e=>Q2.selectors.selectLastUpdateFor(e,r)));jt((()=>{const t=null==a?void 0:a.data;t&&e(t)}),[null==a?void 0:a.data])},rz=e=>{const t=e.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return t?t[1]:void 0},V9=e=>e.replace(/\.[^.]*$/,""),nz=()=>"object"!=typeof window,B9=()=>!nz()&&/iPhone|iPod|iPad/gi.test(window.navigator.userAgent),iy="8.48.0",hl=globalThis;function lk(e,t,r){const a=hl,n=a.__SENTRY__=a.__SENTRY__||{},i=n[iy]=n[iy]||{};return i[e]||(i[e]=t())}const az=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,X9="Sentry Logger ",yw=["debug","info","warn","error","log","assert","trace"],gw={};function G9(e){if(!("console"in hl))return e();const t=hl.console,r={},a=Object.keys(gw);a.forEach((e=>{const a=gw[e];r[e]=t[e],t[e]=a}));try{return e()}finally{a.forEach((e=>{t[e]=r[e]}))}}function H9(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return az?yw.forEach((r=>{t[r]=(...t)=>{e&&G9((()=>{hl.console[r](`${X9}[${r}]:`,...t)}))}})):yw.forEach((e=>{t[e]=()=>{}})),t}const ug=lk("logger",H9);function uk(){return fk(hl),hl}function fk(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||iy,t[iy]=t[iy]||{}}const Z9=Object.prototype.toString;function K9(e,t){return Z9.call(e)===`[object ${t}]`}function Y9(e){return K9(e,"Object")}function J9(e){return!(!e||!e.then||"function"!=typeof e.then)}function Q9(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{az&&ug.log(`Failed to add non-enumerable property "${t}" to object`,e)}}const sz=1e3;function iz(){return Date.now()/sz}function $9(){const{performance:e}=hl;if(!e||!e.now)return iz;const t=Date.now()-e.now(),r=null==e.timeOrigin?t:e.timeOrigin;return()=>(r+e.now())/sz}const e7=$9();function Gp(){const e=hl,t=e.crypto||e.msCrypto;let r=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(r=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(e=>(e^(15&r())>>e/4).toString(16)))}function t7(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||e7(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Gp()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function mw(){return Gp()}function _w(){return Gp().substring(16)}function oz(e,t,r=2){if(!t||"object"!=typeof t||r<=0)return t;if(e&&t&&0===Object.keys(t).length)return e;const a={...e};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(a[e]=oz(a[e],t[e],r-1));return a}(()=>{const{performance:e}=hl;if(!e||!e.now)return;const t=36e5,r=e.now(),a=Date.now(),n=e.timeOrigin?Math.abs(e.timeOrigin+r-a):t,i=n<t,o=e.timing&&e.timing.navigationStart,s="number"==typeof o?Math.abs(o+r-a):t;(i||s<t)&&(n<=s&&e.timeOrigin)})();const F2="_sentrySpan";function vw(e,t){t?Q9(e,F2,t):delete e[F2]}function kw(e){return e[F2]}const r7=100;class dk{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:mw(),spanId:_w()}}clone(){const e=new dk;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,vw(e,kw(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&t7(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,[r,a]=t instanceof xy?[t.getScopeData(),t.getRequestSession()]:Y9(t)?[e,e.requestSession]:[],{tags:n,extra:i,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u}=r||{};return this._tags={...this._tags,...n},this._extra={...this._extra,...i},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),a&&(this._requestSession=a),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,vw(this,void 0),this._attachments=[],this.setPropagationContext({traceId:mw()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const r="number"==typeof t?t:r7;if(r<=0)return this;const a={timestamp:iz(),...e},n=this._breadcrumbs;return n.push(a),this._breadcrumbs=n.length>r?n.slice(-r):n,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:kw(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=oz(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:_w(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){const r=t&&t.event_id?t.event_id:Gp();if(!this._client)return ug.warn("No client configured on scope - will not capture exception!"),r;const a=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:a,...t,event_id:r},this),r}captureMessage(e,t,r){const a=r&&r.event_id?r.event_id:Gp();if(!this._client)return ug.warn("No client configured on scope - will not capture message!"),a;const n=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:n,...r,event_id:a},this),a}captureEvent(e,t){const r=t&&t.event_id?t.event_id:Gp();return this._client?(this._client.captureEvent(e,{...t,event_id:r},this),r):(ug.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}const xy=dk;function n7(){return lk("defaultCurrentScope",(()=>new xy))}function a7(){return lk("defaultIsolationScope",(()=>new xy))}class s7{constructor(e,t){let r,a;r=e||new xy,a=t||new xy,this._stack=[{scope:r}],this._isolationScope=a}withScope(e){const t=this._pushScope();let r;try{r=e(t)}catch(e){throw this._popScope(),e}return J9(r)?r.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function Yp(){const e=fk(uk());return e.stack=e.stack||new s7(n7(),a7())}function i7(e){return Yp().withScope(e)}function o7(e,t){const r=Yp();return r.withScope((()=>(r.getStackTop().scope=e,t(e))))}function ww(e){return Yp().withScope((()=>e(Yp().getIsolationScope())))}function c7(){return{withIsolationScope:ww,withScope:i7,withSetScope:o7,withSetIsolationScope:(e,t)=>ww(t),getCurrentScope:()=>Yp().getScope(),getIsolationScope:()=>Yp().getIsolationScope()}}function cz(e){const t=fk(e);return t.acs?t.acs:c7()}function lz(){return cz(uk()).getCurrentScope()}function l7(){return cz(uk()).getIsolationScope()}function u7(e,t){return lz().captureException(e,void 0)}function f7(e,t){const r={captureContext:t};return lz().captureMessage(e,void 0,r)}function d7(e,t){l7().setExtra(e,t)}const p7=(...e)=>{let t="";for(const r of e){if(r instanceof Error){const e=r;return d7("exceptionMessage",t),void u7(e)}if("object"!=typeof r)t+=r;else try{t+=" "+JSON.stringify(r)}catch{t+=" "+r}}f7(t)},bw=["debug","info","warn","error"],h7=(e,t)=>{const r=bw.indexOf(e);return bw.indexOf(t)>=r},ig=(e,t,r,...a)=>{h7(t,e)&&console.log(`[${e}] ${r}`,...a)},y7=()=>sk().getItem("logger_lvl"),g7=(e=(nz()?"info":y7()||"warn"))=>{let t=e;return{debug:(e,...r)=>ig("debug",t,e,...r),info:(e,...r)=>ig("info",t,e,...r),warn:(e,...r)=>ig("warn",t,e,...r),error:(e,...r)=>(p7(e,...r),ig("error",t,e,...r)),setLevel:e=>{t=e},getLevel:()=>t}},Xs=g7(),m7=({src:e,name:t=""})=>new Promise(((r,a)=>{const n=document.createElement("video");n.src=e;const i=()=>{const{duration:e,videoHeight:i,videoWidth:o,src:s}=n,c=V9(t);(!e||!i||!o||!s)&&a(),r({src:s,name:c,width:o,height:i,duration:Math.floor(e)})},o=()=>{Xs.warn("Failed to load video"),r(null)};return B9()&&n.load(),n.addEventListener("error",o),n.addEventListener("loadeddata",i),()=>{n.removeEventListener("error",o),n.removeEventListener("loadeddata",i)}})),_7=e=>new Promise(((t,r)=>{const a=new Image,n=URL.createObjectURL(e);a.onload=()=>{t({width:a.naturalWidth,height:a.naturalHeight}),URL.revokeObjectURL(n)},a.onerror=()=>{Xs.warn("Failed to load image"),r(null),URL.revokeObjectURL(n)},a.src=n})),xw=e=>{if(!e)return;const t="number"==typeof e?e:parseInt(e,10);if(isNaN(t))throw new Error("Can not get number from income argument");const r=t/1048576;return`${Math.floor(r)} MB`},v7={sms:"wellesley.admin.sms",auth:"wellesley.admin.auth",openai:"wellesley.admin.openai",uploads:"wellesley.admin.uploads",captcha:"wellesley.admin.captcha",language:"wellesley.admin.language",mediacache:"wellesley.admin.mediacache",translation:"wellesley.admin.translation",link_service:"wellesley.admin.link_service"},fg={posts:"wellesley.posts",translation:"wellesley.translation",registration:"wellesley.registration",confirmationCode:"wellesley.confirmationCode",uploadsPolicyDoc:"wellesley.uploads.policy.doc",uploadsPolicyAudio:"wellesley.uploads.policy.audio",uploadsPolicyImage:"wellesley.uploads.policy.image",uploadsPolicyVideo:"wellesley.uploads.policy.video",captcha:"wellesley.captcha",access:"wellesley.access",branding:"wellesley.branding",instanceAdmin:"wellesley.instance.admin",legal:"wellesley.instance.legal",domainBlocks:"wellesley.instance.domainBlocks",contacts:"wellesley.instance.contacts"},dl=e=>(null==e?void 0:e.map((e=>e.value||e)))||[],k7={data:null,isPending:!1},{posts:P0,uploadsPolicyDoc:Aw,uploadsPolicyAudio:L0,uploadsPolicyImage:og,uploadsPolicyVideo:Zh,registration:w7,captcha:b7,instanceAdmin:x7,branding:A7,translation:z7,access:S7}=fg,{captcha:C7,language:j7,translation:T7,openai:P7,link_service:L7}=v7,Qp=e=>e.data,R7=ef(Qp,(e=>{var t,r,a;return{max_characters:(null==(t=null==e?void 0:e[P0])?void 0:t.max_characters)||0,max_media_attachments:(null==(r=null==e?void 0:e[P0])?void 0:r.max_media_attachments)||0,max_pins:(null==(a=null==e?void 0:e[P0])?void 0:a.max_pins)||0}})),pk=ef(Qp,(e=>{var t,r,a;return{...null==e?void 0:e[og],maxSize:(null==(t=null==e?void 0:e[og])?void 0:t.maxSize)||0,maxMatrix:(null==(r=null==e?void 0:e[og])?void 0:r.maxMatrix)||0,maxResolution:(null==(a=null==e?void 0:e[og])?void 0:a.maxResolution)||0}})),E7=ef(pk,(e=>dl(e.extensions))),uz=ef(Qp,(e=>{var t,r,a,n;return{...null==e?void 0:e[Zh],maxSize:(null==(t=null==e?void 0:e[Zh])?void 0:t.maxSize)||0,maxMatrix:(null==(r=null==e?void 0:e[Zh])?void 0:r.maxMatrix)||0,maxDuration:(null==(a=null==e?void 0:e[Zh])?void 0:a.maxDuration)||0,maxResolution:(null==(n=null==e?void 0:e[Zh])?void 0:n.maxResolution)||0}})),fz=ef(Qp,(e=>{var t,r;return{...null==e?void 0:e[L0],maxSize:null==(t=null==e?void 0:e[L0])?void 0:t.maxSize,keepOriginal:(null==(r=null==e?void 0:e[L0])?void 0:r.keepOriginal)||0}})),dz=ef(Qp,(e=>{var t;return{...null==e?void 0:e[Aw],maxSize:(null==(t=null==e?void 0:e[Aw])?void 0:t.maxSize)||0}})),pz=ef([pk,uz,fz,dz],((e,t,r,a)=>({IMAGE:dl(null==e?void 0:e.extensions),VIDEO:dl(null==t?void 0:t.extensions),AUDIO:dl(null==r?void 0:r.extensions),DOCUMENT:dl(null==a?void 0:a.extensions)}))),N7=ef(pz,(e=>Object.keys(e).reduce(((t,r)=>[...t,...e[r]||[]]),[]))),ty=xd({name:"platformSettings",initialState:k7,reducers:{setError:(e,t)=>{e.error=t.payload},setPending:(e,t)=>{e.isPending=t.payload}},extraReducers:e=>{e.addCase(n4,((e,{payload:t})=>{e.data={...e.data,...t}}))},selectors:{selectSettings:Qp,selectPostConfig:R7,selectDocPolicy:dz,selectImagePolicy:pk,selectVideoPolicy:uz,selectAudioPolicy:fz,selectImageExtensions:E7,selectSupportedExtensions:pz,selectFullExtensionsList:N7,selectRegistration:e=>{var t;return null==(t=e.data)?void 0:t[w7]},selectLanguageDetection:e=>{var t;return null==(t=e.data)?void 0:t[j7]},selectLanguageTranslation:e=>{var t;return null==(t=e.data)?void 0:t[T7]},selectOpenai:e=>{var t;return null==(t=e.data)?void 0:t[P7]},selectCaptcha:e=>{var t;return null==(t=e.data)?void 0:t[b7]},selectAdminCaptcha:e=>{var t;return null==(t=e.data)?void 0:t[C7]},selectPlatformTranslation:e=>{var t;return null==(t=e.data)?void 0:t[z7]},selectAccess:e=>{var t;return null==(t=e.data)?void 0:t[S7]},selectBranding:e=>{var t;return null==(t=e.data)?void 0:t[A7]},selectLinkService:e=>{var t;return null==(t=e.data)?void 0:t[L7]},selectInstanceAdmin:e=>{var t;return null==(t=e.data)?void 0:t[x7]},selectLegal:e=>{var t;return null==(t=e.data)?void 0:t[fg.legal]},selectDomainBlocks:e=>{var t;return null==(t=e.data)?void 0:t[fg.domainBlocks]},selectContacts:e=>{var t;return null==(t=e.data)?void 0:t[fg.contacts]}}}),I7=async({media:e,docPolicy:t,imgPolicy:r,videoPolicy:a,audioPolicy:n})=>{if(!r||!a)return"Media policy is not defined";const i={IMAGE:dl(r.extensions),VIDEO:dl(a.extensions),AUDIO:dl(n.extensions),DOCUMENT:dl(t.extensions)},o=rz(e.file.name)||"",s=Object.keys(i).find((e=>{var t;return null==(t=i[e])?void 0:t.includes(o)}));if(!s)return`Extension ${o} is not supported`;const c="VIDEO"===s;if("IMAGE"===s){const t=await _7(e.file),a=e.file.size>r.maxSize,n=t&&Math.max(t.width,t.height)>r.maxResolution,i=t&&t.width*t.height>r.maxMatrix;switch(!0){case a:return`Image is too big. Max size is ${xw(r.maxSize)}`;case n:return`Image resolution is too high. Max resolution is ${r.maxResolution} pixels`;case i:return`The uploaded image exceeds the maximum size allowed. Please choose an image with smaller dimensions or reduce the resolution and try again. Max resolution is ${r.maxMatrix} pixels`}}if(c){const t=await m7({src:e.objectUrl}),r=t&&t.duration>a.maxDuration,n=t&&Math.max(t.width,t.height)>a.maxResolution,i=e.file.size>a.maxSize,o=t&&t.width*t.height>a.maxMatrix;switch(!0){case r:return`Video is too long. Max duration is ${a.maxDuration} seconds`;case i:return`Video is too big. Max size is ${xw(a.maxSize)}`;case n:return`Video resolution is too high. Max resolution is ${a.maxResolution} pixels`;case o:return`The uploaded video exceeds the maximum size allowed. Please choose a video with smaller dimensions or reduce the resolution and try again. Max resolution is ${a.maxMatrix} pixels`}}},M7=()=>{const[e]=B8(),t=new AbortController,r=t.signal,a=ft(ty.selectors.selectImagePolicy),n=ft(ty.selectors.selectVideoPolicy),i=ft(ty.selectors.selectDocPolicy),o=ft(ty.selectors.selectAudioPolicy);return[async({media:t,tag:s,onError:c,onUpload:l,onProgress:u})=>{var d;const f=rz(t.file.name),p=await I7({imgPolicy:a,docPolicy:i,videoPolicy:n,audioPolicy:o,media:t});if(p)return Br.error(p),void(null==c||c());try{const a=await e({createUpload:{extension:f,tags:[s],meta:{name:t.file.name}}});if("error"in a)throw new Error(a.error);const n=null==(d=a.data)?void 0:d.uri;return await new Promise(((e,a)=>{const i=new XMLHttpRequest;i.open("PUT",n),r&&r.addEventListener("abort",(()=>{try{i.abort()}catch(e){Xs.warn("Cancel upload failed",e)}})),i.upload.onprogress=e=>{if(!e.lengthComputable)return;const t=Math.round(e.loaded/e.total*100);null==u||u(e.loaded,e.total,t)},i.onerror=()=>a(new Error("Upload failed")),i.onload=()=>{i.status>=200&&i.status<300?e():a(new Error(i.statusText))},i.send(t.file)})),null==l||l(),a.data.upload.uploadId}catch(e){null==c||c(e),Br.error(`Could not upload file. ${String(e)}`)}},()=>t.abort("Upload canceled")]};var Si=(e=>(e.header="header",e.avatar="avatar",e))(Si||{});const Ay=({user:e,type:t})=>{var r,a,n,i;if(!e)return"";try{return("avatar"===t?null==(a=null==(r=e.avatar)?void 0:r.files[0])?void 0:a.uri:null==(i=null==(n=e.header)?void 0:n.files[0])?void 0:i.uri)||""}catch{return""}};var zw,ry={exports:{}},O7=ry.exports;
42
+ */bt("remoteReady");const $5=bt("askLogin"),e4=bt("reselectUser");bt("requestLogout");const t4=bt("setConfirmLeavePage");bt("requestChangePath");const w6=bt("wsSubscribe"),b6=bt("wsUnSubscribe");bt("hostStoreConnect"),bt("remoteLogin"),bt("remoteLogout"),bt("wsOnMessage"),bt("setRouterPath"),bt("setDeviceType"),bt("setDeviceWidth");const x6=bt("setUserError"),A6=bt("setUserIsError"),N2=bt("setUserPending"),I2=bt("setUserSuccess"),z6=bt("setUserData"),S6=bt("updateAccountData"),r4=bt("updateUser");bt("addNotification"),bt("markNotification"),bt("setNotificationsError"),bt("setNotificationsList"),bt("setNotificationsPending"),bt("setNotificationsTotalCount"),bt("setNotificationsUnreadCount"),bt("resetNotificationsState"),bt("undoNotification"),bt("setInstanceInfo"),bt("setInstanceInfoPending"),bt("setInstanceInfoError");const n4=bt("setPlatformSettings");bt("setProfileSettings");const C6=bt("setGroupData"),M2=bt("setGroupLoading");l6("requestMicroFrontendFetch"),l6("sendMicroFrontendFetchResponse");const a4={data:null,isPending:!1,isSuccess:!1},Kn=xd({name:"userNoHTML",initialState:a4,reducers:{setUser:(e,t)=>{e.data=t.payload},setPending:(e,t)=>{e.isPending=t.payload},setSuccess:(e,{payload:t})=>{e.isSuccess=t},setError:(e,{payload:t})=>{e.error=t}},selectors:{selectUser:e=>e.data,selectPending:e=>e.isPending,selectError:e=>e.error,selectSuccess:e=>e.isSuccess}}),j6="getApiV1UsersRelationships",s4=_d.memoize(((e,t)=>Ta.util.selectCachedArgsForQuery(e,j6).find((e=>e.targets.includes(t))))),ul=({state:e,userId:t,dispatch:r,relationsProps:a})=>{const n=s4(e,t);return n?r(Ta.util.updateQueryData(j6,n,(e=>{e[t]={...e[t],...a}}))):null};var ow=function(e,t,r){if(e&&"reportValidity"in e){var a=E2(r,t);e.setCustomValidity(a&&a.message||""),e.reportValidity()}},T6=function(e,t){var r=function(r){var a=t.fields[r];a&&a.ref&&"reportValidity"in a.ref?ow(a.ref,r,e):a.refs&&a.refs.forEach((function(t){return ow(t,r,e)}))};for(var a in t.fields)r(a)},i4=function(e,t){t.shouldUseNativeValidation&&T6(e,t);var r={};for(var a in e){var n=E2(t.fields,a),i=Object.assign(e[a]||{},{ref:n&&n.ref});if(o4(t.names||Object.keys(e),a)){var o=Object.assign({},E2(r,a));k0(o,"root",i),k0(r,a,o)}else k0(r,a,i)}return r},o4=function(e,t){return e.some((function(e){return e.startsWith(t+".")}))},c4=function(e,t){for(var r={};e.length;){var a=e[0],n=a.code,i=a.message,o=a.path.join(".");if(!r[o])if("unionErrors"in a){var s=a.unionErrors[0].errors[0];r[o]={message:s.message,type:s.code}}else r[o]={message:i,type:n};if("unionErrors"in a&&a.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var c=r[o].types,l=c&&c[a.code];r[o]=Q8(o,t,r,n,l?[].concat(l,a.message):a.message)}e.shift()}return r},gg=function(e,t,r){return void 0===r&&(r={}),function(a,n,i){try{return Promise.resolve(function(n,o){try{var s=Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](a,t)).then((function(e){return i.shouldUseNativeValidation&&T6({},i),{errors:{},values:r.raw?a:e}}))}catch(e){return o(e)}return s&&s.then?s.then(void 0,o):s}(0,(function(e){if(null!=e.errors)return{values:{},errors:i4(c4(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};throw e})))}catch(e){return Promise.reject(e)}}};const P6=({schema:e,defaultValues:t,mode:r="onChange",reValidateMode:a="onChange",showRequiredErrors:n=!0})=>K2({mode:r,reValidateMode:a,resolver:n?gg(e):async(t,r,a)=>{const n=await gg(e)(t,r,a);if(!n.errors||0===Object.keys(n.errors).length)return n;const i={};return Object.keys(n.errors).forEach((e=>{const r=n.errors[e],a=t[e],o="password"===e,s=null==a||""===a,c="invalid_type"===(null==r?void 0:r.type)||"too_small"===(null==r?void 0:r.type)||o&&"custom"===(null==r?void 0:r.type);s&&c||(i[e]=r)})),{values:n.values,errors:i}},defaultValues:t});var Nt,O2;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of r)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Nt||(Nt={})),(O2||(O2={})).mergeShapes=(e,t)=>({...e,...t});const De=Nt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Gu=e=>{switch(typeof e){case"undefined":return De.undefined;case"string":return De.string;case"number":return isNaN(e)?De.nan:De.number;case"boolean":return De.boolean;case"function":return De.function;case"bigint":return De.bigint;case"symbol":return De.symbol;case"object":return Array.isArray(e)?De.array:null===e?De.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?De.promise:typeof Map<"u"&&e instanceof Map?De.map:typeof Set<"u"&&e instanceof Set?De.set:typeof Date<"u"&&e instanceof Date?De.date:De.object;default:return De.unknown}},Se=Nt.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"]),l4=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Bs extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(a);else if("invalid_return_type"===n.code)a(n.returnTypeError);else if("invalid_arguments"===n.code)a(n.argumentsError);else if(0===n.path.length)r._errors.push(t(n));else{let e=r,a=0;for(;a<n.path.length;){const r=n.path[a];a===n.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(n))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof Bs))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Nt.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}Bs.create=e=>new Bs(e);const Hp=(e,t)=>{let r;switch(e.code){case Se.invalid_type:r=e.received===De.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Se.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Nt.jsonStringifyReplacer)}`;break;case Se.unrecognized_keys:r=`Unrecognized key(s) in object: ${Nt.joinValues(e.keys,", ")}`;break;case Se.invalid_union:r="Invalid input";break;case Se.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Nt.joinValues(e.options)}`;break;case Se.invalid_enum_value:r=`Invalid enum value. Expected ${Nt.joinValues(e.options)}, received '${e.received}'`;break;case Se.invalid_arguments:r="Invalid function arguments";break;case Se.invalid_return_type:r="Invalid function return type";break;case Se.invalid_date:r="Invalid date";break;case Se.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Nt.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Se.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Se.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Se.custom:r="Invalid input";break;case Se.invalid_intersection_types:r="Intersection results could not be merged";break;case Se.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Se.not_finite:r="Number must be finite";break;default:r=t.defaultError,Nt.assertNever(e)}return{message:r}};let L6=Hp;function u4(e){L6=e}function mg(){return L6}const _g=e=>{const{data:t,path:r,errorMaps:a,issueData:n}=e,i=[...r,...n.path||[]],o={...n,path:i};if(void 0!==n.message)return{...n,path:i,message:n.message};let s="";const c=a.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...n,path:i,message:s}},f4=[];function Ie(e,t){const r=mg(),a=_g({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Hp?void 0:Hp].filter((e=>!!e))});e.common.issues.push(a)}class Pa{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const a of t){if("aborted"===a.status)return ct;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,a=await e.value;r.push({key:t,value:a})}return Pa.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const a of t){const{key:t,value:n}=a;if("aborted"===t.status||"aborted"===n.status)return ct;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"!==t.value&&(typeof n.value<"u"||a.alwaysSet)&&(r[t.value]=n.value)}return{status:e.value,value:r}}}const ct=Object.freeze({status:"aborted"}),Bp=e=>({status:"dirty",value:e}),Za=e=>({status:"valid",value:e}),U2=e=>"aborted"===e.status,D2=e=>"dirty"===e.status,cy=e=>"valid"===e.status,ly=e=>typeof Promise<"u"&&e instanceof Promise;function vg(e,t,r,a){if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function R6(e,t,r,a,n){if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var Je,$h,ey;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Je||(Je={}));class oc{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const cw=(e,t)=>{if(cy(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Bs(e.common.issues);return this._error=t,this._error}}};function _t(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:a,description:n}=e;if(t&&(r||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:n}:{errorMap:(t,n)=>{var i,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:s??n.defaultError}:typeof n.data>"u"?{message:null!==(i=s??a)&&void 0!==i?i:n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:null!==(o=s??r)&&void 0!==o?o:n.defaultError}},description:n}}class vt{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Gu(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Gu(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Pa,ctx:{common:e.parent.common,data:e.data,parsedType:Gu(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ly(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const a={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Gu(e)},n=this._parseSync({data:e,path:a.path,parent:a});return cw(a,n)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Gu(e)},a=this._parse({data:e,path:r.path,parent:r}),n=await(ly(a)?a:Promise.resolve(a));return cw(r,n)}refine(e,t){const r=e=>"string"==typeof t||typeof t>"u"?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const n=e(t),i=()=>a.addIssue({code:Se.custom,...r(t)});return typeof Promise<"u"&&n instanceof Promise?n.then((e=>!!e||(i(),!1))):!!n||(i(),!1)}))}refinement(e,t){return this._refinement(((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1)))}_refinement(e){return new uo({schema:this,typeName:it.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ic.create(this,this._def)}nullable(){return $u.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return lo.create(this,this._def)}promise(){return Kp.create(this,this._def)}or(e){return py.create([this,e],this._def)}and(e){return hy.create(this,e,this._def)}transform(e){return new uo({..._t(this._def),schema:this,typeName:it.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new vy({..._t(this._def),innerType:this,defaultValue:t,typeName:it.ZodDefault})}brand(){return new tk({typeName:it.ZodBranded,type:this,..._t(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ky({..._t(this._def),innerType:this,catchValue:t,typeName:it.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Sy.create(this,e)}readonly(){return wy.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const d4=/^c[^\s-]{8,}$/i,p4=/^[0-9a-z]+$/,h4=/^[0-9A-HJKMNP-TV-Z]{26}$/,y4=/^[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,g4=/^[a-z0-9_-]{21}$/i,m4=/^[-+]?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)?)??$/,_4=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,v4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let T0;const k4=/^(?:(?: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])$/,w4=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,b4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,E6="((\\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])))",x4=new RegExp(`^${E6}$`);function N6(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function A4(e){return new RegExp(`^${N6(e)}$`)}function I6(e){let t=`${E6}T${N6(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function z4(e,t){return!(("v4"!==t&&t||!k4.test(e))&&("v6"!==t&&t||!w4.test(e)))}class co extends vt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==De.string){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.string,received:t.parsedType}),ct}const t=new Pa;let r;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const n=e.data.length>a.value,i=e.data.length<a.value;(n||i)&&(r=this._getOrReturnCtx(e,r),n?Ie(r,{code:Se.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&Ie(r,{code:Se.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)_4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"email",code:Se.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)T0||(T0=new RegExp(v4,"u")),T0.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"emoji",code:Se.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)y4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"uuid",code:Se.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)g4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"nanoid",code:Se.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)d4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"cuid",code:Se.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)p4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"cuid2",code:Se.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)h4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"ulid",code:Se.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Ie(r,{validation:"url",code:Se.invalid_string,message:a.message}),t.dirty()}else"regex"===a.kind?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"regex",code:Se.invalid_string,message:a.message}),t.dirty())):"trim"===a.kind?e.data=e.data.trim():"includes"===a.kind?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty()):"toLowerCase"===a.kind?e.data=e.data.toLowerCase():"toUpperCase"===a.kind?e.data=e.data.toUpperCase():"startsWith"===a.kind?e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?I6(a).test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?x4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?A4(a).test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?m4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"duration",code:Se.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?z4(e.data,a.version)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"ip",code:Se.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?b4.test(e.data)||(r=this._getOrReturnCtx(e,r),Ie(r,{validation:"base64",code:Se.invalid_string,message:a.message}),t.dirty()):Nt.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:Se.invalid_string,...Je.errToObj(r)})}_addCheck(e){return new co({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Je.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Je.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Je.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Je.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Je.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Je.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Je.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Je.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Je.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Je.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(null==e?void 0:e.precision)>"u"?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...Je.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(null==e?void 0:e.precision)>"u"?null:null==e?void 0:e.precision,...Je.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Je.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Je.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Je.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Je.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Je.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Je.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Je.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Je.errToObj(t)})}nonempty(e){return this.min(1,Je.errToObj(e))}trim(){return new co({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new co({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new co({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function S4(e,t){const r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,n=r>a?r:a;return parseInt(e.toFixed(n).replace(".",""))%parseInt(t.toFixed(n).replace(".",""))/Math.pow(10,n)}co.create=e=>{var t;return new co({checks:[],typeName:it.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,..._t(e)})};class Yu extends vt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==De.number){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.number,received:t.parsedType}),ct}let t;const r=new Pa;for(const a of this._def.checks)"int"===a.kind?Nt.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"multipleOf"===a.kind?0!==S4(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.not_finite,message:a.message}),r.dirty()):Nt.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Je.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Je.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Je.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Je.toString(t))}setLimit(e,t,r,a){return new Yu({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Je.toString(a)}]})}_addCheck(e){return new Yu({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Je.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Je.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Je.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Je.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Je.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Je.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Je.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Je.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Je.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&Nt.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Yu.create=e=>new Yu({checks:[],typeName:it.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,..._t(e)});class Ju extends vt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==De.bigint){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.bigint,received:t.parsedType}),ct}let t;const r=new Pa;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Ie(t,{code:Se.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):Nt.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Je.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Je.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Je.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Je.toString(t))}setLimit(e,t,r,a){return new Ju({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Je.toString(a)}]})}_addCheck(e){return new Ju({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Je.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Je.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Je.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Je.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Je.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Ju.create=e=>{var t;return new Ju({checks:[],typeName:it.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,..._t(e)})};class uy extends vt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==De.boolean){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.boolean,received:t.parsedType}),ct}return Za(e.data)}}uy.create=e=>new uy({typeName:it.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,..._t(e)});class kd extends vt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==De.date){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.date,received:t.parsedType}),ct}if(isNaN(e.data.getTime())){return Ie(this._getOrReturnCtx(e),{code:Se.invalid_date}),ct}const t=new Pa;let r;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),Ie(r,{code:Se.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Nt.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new kd({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Je.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Je.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}kd.create=e=>new kd({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:it.ZodDate,..._t(e)});class kg extends vt{_parse(e){if(this._getType(e)!==De.symbol){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.symbol,received:t.parsedType}),ct}return Za(e.data)}}kg.create=e=>new kg({typeName:it.ZodSymbol,..._t(e)});class fy extends vt{_parse(e){if(this._getType(e)!==De.undefined){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.undefined,received:t.parsedType}),ct}return Za(e.data)}}fy.create=e=>new fy({typeName:it.ZodUndefined,..._t(e)});class dy extends vt{_parse(e){if(this._getType(e)!==De.null){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.null,received:t.parsedType}),ct}return Za(e.data)}}dy.create=e=>new dy({typeName:it.ZodNull,..._t(e)});class Zp extends vt{constructor(){super(...arguments),this._any=!0}_parse(e){return Za(e.data)}}Zp.create=e=>new Zp({typeName:it.ZodAny,..._t(e)});class vd extends vt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Za(e.data)}}vd.create=e=>new vd({typeName:it.ZodUnknown,..._t(e)});class pl extends vt{_parse(e){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.never,received:t.parsedType}),ct}}pl.create=e=>new pl({typeName:it.ZodNever,..._t(e)});class wg extends vt{_parse(e){if(this._getType(e)!==De.undefined){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.void,received:t.parsedType}),ct}return Za(e.data)}}wg.create=e=>new wg({typeName:it.ZodVoid,..._t(e)});class lo extends vt{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==De.array)return Ie(t,{code:Se.invalid_type,expected:De.array,received:t.parsedType}),ct;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,n=t.data.length<a.exactLength.value;(e||n)&&(Ie(t,{code:e?Se.too_big:Se.too_small,minimum:n?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(Ie(t,{code:Se.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(Ie(t,{code:Se.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>a.type._parseAsync(new oc(t,e,t.path,r))))).then((e=>Pa.mergeArray(r,e)));const n=[...t.data].map(((e,r)=>a.type._parseSync(new oc(t,e,t.path,r))));return Pa.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new lo({...this._def,minLength:{value:e,message:Je.toString(t)}})}max(e,t){return new lo({...this._def,maxLength:{value:e,message:Je.toString(t)}})}length(e,t){return new lo({...this._def,exactLength:{value:e,message:Je.toString(t)}})}nonempty(e){return this.min(1,e)}}function Vp(e){if(e instanceof Er){const t={};for(const r in e.shape){const a=e.shape[r];t[r]=ic.create(Vp(a))}return new Er({...e._def,shape:()=>t})}return e instanceof lo?new lo({...e._def,type:Vp(e.element)}):e instanceof ic?ic.create(Vp(e.unwrap())):e instanceof $u?$u.create(Vp(e.unwrap())):e instanceof cc?cc.create(e.items.map((e=>Vp(e)))):e}lo.create=(e,t)=>new lo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:it.ZodArray,..._t(t)});class Er extends vt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Nt.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==De.object){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.object,received:t.parsedType}),ct}const{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:n}=this._getCached(),i=[];if(!(this._def.catchall instanceof pl&&"strip"===this._def.unknownKeys))for(const e in r.data)n.includes(e)||i.push(e);const o=[];for(const e of n){const t=a[e],n=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new oc(r,n,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof pl){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(Ie(r,{code:Se.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const a=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new oc(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>Pa.mergeObjectSync(t,e))):Pa.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Je.errToObj,new Er({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var a,n,i,o;const s=null!==(i=null===(n=(a=this._def).errorMap)||void 0===n?void 0:n.call(a,t,r).message)&&void 0!==i?i:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Je.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new Er({...this._def,unknownKeys:"strip"})}passthrough(){return new Er({...this._def,unknownKeys:"passthrough"})}extend(e){return new Er({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Er({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:it.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Er({...this._def,catchall:e})}pick(e){const t={};return Nt.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new Er({...this._def,shape:()=>t})}omit(e){const t={};return Nt.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new Er({...this._def,shape:()=>t})}deepPartial(){return Vp(this)}partial(e){const t={};return Nt.objectKeys(this.shape).forEach((r=>{const a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()})),new Er({...this._def,shape:()=>t})}required(e){const t={};return Nt.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof ic;)e=e._def.innerType;t[r]=e}})),new Er({...this._def,shape:()=>t})}keyof(){return M6(Nt.objectKeys(this.shape))}}Er.create=(e,t)=>new Er({shape:()=>e,unknownKeys:"strip",catchall:pl.create(),typeName:it.ZodObject,..._t(t)}),Er.strictCreate=(e,t)=>new Er({shape:()=>e,unknownKeys:"strict",catchall:pl.create(),typeName:it.ZodObject,..._t(t)}),Er.lazycreate=(e,t)=>new Er({shape:e,unknownKeys:"strip",catchall:pl.create(),typeName:it.ZodObject,..._t(t)});class py extends vt{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new Bs(e.ctx.common.issues)));return Ie(t,{code:Se.invalid_union,unionErrors:r}),ct}));{let e;const a=[];for(const n of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=n._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"===i.status&&!e&&(e={result:i,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=a.map((e=>new Bs(e)));return Ie(t,{code:Se.invalid_union,unionErrors:n}),ct}}get options(){return this._def.options}}py.create=(e,t)=>new py({options:e,typeName:it.ZodUnion,..._t(t)});const fl=e=>e instanceof gy?fl(e.schema):e instanceof uo?fl(e.innerType()):e instanceof my?[e.value]:e instanceof Qu?e.options:e instanceof _y?Nt.objectValues(e.enum):e instanceof vy?fl(e._def.innerType):e instanceof fy?[void 0]:e instanceof dy?[null]:e instanceof ic?[void 0,...fl(e.unwrap())]:e instanceof $u?[null,...fl(e.unwrap())]:e instanceof tk||e instanceof wy?fl(e.unwrap()):e instanceof ky?fl(e._def.innerType):[];class Rg extends vt{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==De.object)return Ie(t,{code:Se.invalid_type,expected:De.object,received:t.parsedType}),ct;const r=this.discriminator,a=t.data[r],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(Ie(t,{code:Se.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ct)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const a=new Map;for(const r of t){const t=fl(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(a.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);a.set(n,r)}}return new Rg({typeName:it.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,..._t(r)})}}function q2(e,t){const r=Gu(e),a=Gu(t);if(e===t)return{valid:!0,data:e};if(r===De.object&&a===De.object){const r=Nt.objectKeys(t),a=Nt.objectKeys(e).filter((e=>-1!==r.indexOf(e))),n={...e,...t};for(const r of a){const a=q2(e[r],t[r]);if(!a.valid)return{valid:!1};n[r]=a.data}return{valid:!0,data:n}}if(r===De.array&&a===De.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let a=0;a<e.length;a++){const n=q2(e[a],t[a]);if(!n.valid)return{valid:!1};r.push(n.data)}return{valid:!0,data:r}}return r===De.date&&a===De.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class hy extends vt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if(U2(e)||U2(a))return ct;const n=q2(e.value,a.value);return n.valid?((D2(e)||D2(a))&&t.dirty(),{status:t.value,value:n.data}):(Ie(r,{code:Se.invalid_intersection_types}),ct)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}hy.create=(e,t,r)=>new hy({left:e,right:t,typeName:it.ZodIntersection,..._t(r)});class cc extends vt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==De.array)return Ie(r,{code:Se.invalid_type,expected:De.array,received:r.parsedType}),ct;if(r.data.length<this._def.items.length)return Ie(r,{code:Se.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ct;!this._def.rest&&r.data.length>this._def.items.length&&(Ie(r,{code:Se.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...r.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new oc(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(a).then((e=>Pa.mergeArray(t,e))):Pa.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new cc({...this._def,rest:e})}}cc.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new cc({items:e,typeName:it.ZodTuple,rest:null,..._t(t)})};class yy extends vt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==De.object)return Ie(r,{code:Se.invalid_type,expected:De.object,received:r.parsedType}),ct;const a=[],n=this._def.keyType,i=this._def.valueType;for(const e in r.data)a.push({key:n._parse(new oc(r,e,r.path,e)),value:i._parse(new oc(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?Pa.mergeObjectAsync(t,a):Pa.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new yy(t instanceof vt?{keyType:e,valueType:t,typeName:it.ZodRecord,..._t(r)}:{keyType:co.create(),valueType:e,typeName:it.ZodRecord,..._t(t)})}}class bg extends vt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==De.map)return Ie(r,{code:Se.invalid_type,expected:De.map,received:r.parsedType}),ct;const a=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map((([e,t],i)=>({key:a._parse(new oc(r,e,r.path,[i,"key"])),value:n._parse(new oc(r,t,r.path,[i,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of i){const a=await r.key,n=await r.value;if("aborted"===a.status||"aborted"===n.status)return ct;("dirty"===a.status||"dirty"===n.status)&&t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of i){const a=r.key,n=r.value;if("aborted"===a.status||"aborted"===n.status)return ct;("dirty"===a.status||"dirty"===n.status)&&t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}}}bg.create=(e,t,r)=>new bg({valueType:t,keyType:e,typeName:it.ZodMap,..._t(r)});class wd extends vt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==De.set)return Ie(r,{code:Se.invalid_type,expected:De.set,received:r.parsedType}),ct;const a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(Ie(r,{code:Se.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(Ie(r,{code:Se.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function i(e){const r=new Set;for(const a of e){if("aborted"===a.status)return ct;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}const o=[...r.data.values()].map(((e,t)=>n._parse(new oc(r,e,r.path,t))));return r.common.async?Promise.all(o).then((e=>i(e))):i(o)}min(e,t){return new wd({...this._def,minSize:{value:e,message:Je.toString(t)}})}max(e,t){return new wd({...this._def,maxSize:{value:e,message:Je.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}wd.create=(e,t)=>new wd({valueType:e,minSize:null,maxSize:null,typeName:it.ZodSet,..._t(t)});class Xp extends vt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==De.function)return Ie(t,{code:Se.invalid_type,expected:De.function,received:t.parsedType}),ct;function r(e,r){return _g({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mg(),Hp].filter((e=>!!e)),issueData:{code:Se.invalid_arguments,argumentsError:r}})}function a(e,r){return _g({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mg(),Hp].filter((e=>!!e)),issueData:{code:Se.invalid_return_type,returnTypeError:r}})}const n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Kp){const e=this;return Za((async function(...t){const o=new Bs([]),s=await e._def.args.parseAsync(t,n).catch((e=>{throw o.addIssue(r(t,e)),o})),c=await Reflect.apply(i,this,s);return await e._def.returns._def.type.parseAsync(c,n).catch((e=>{throw o.addIssue(a(c,e)),o}))}))}{const e=this;return Za((function(...t){const o=e._def.args.safeParse(t,n);if(!o.success)throw new Bs([r(t,o.error)]);const s=Reflect.apply(i,this,o.data),c=e._def.returns.safeParse(s,n);if(!c.success)throw new Bs([a(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Xp({...this._def,args:cc.create(e).rest(vd.create())})}returns(e){return new Xp({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Xp({args:e||cc.create([]).rest(vd.create()),returns:t||vd.create(),typeName:it.ZodFunction,..._t(r)})}}class gy extends vt{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}gy.create=(e,t)=>new gy({getter:e,typeName:it.ZodLazy,..._t(t)});class my extends vt{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ie(t,{received:t.data,code:Se.invalid_literal,expected:this._def.value}),ct}return{status:"valid",value:e.data}}get value(){return this._def.value}}function M6(e,t){return new Qu({values:e,typeName:it.ZodEnum,..._t(t)})}my.create=(e,t)=>new my({value:e,typeName:it.ZodLiteral,..._t(t)});class Qu extends vt{constructor(){super(...arguments),$h.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return Ie(t,{expected:Nt.joinValues(r),received:t.parsedType,code:Se.invalid_type}),ct}if(vg(this,$h)||R6(this,$h,new Set(this._def.values)),!vg(this,$h).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return Ie(t,{received:t.data,code:Se.invalid_enum_value,options:r}),ct}return Za(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Qu.create(e,{...this._def,...t})}exclude(e,t=this._def){return Qu.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}$h=new WeakMap,Qu.create=M6;class _y extends vt{constructor(){super(...arguments),ey.set(this,void 0)}_parse(e){const t=Nt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==De.string&&r.parsedType!==De.number){const e=Nt.objectValues(t);return Ie(r,{expected:Nt.joinValues(e),received:r.parsedType,code:Se.invalid_type}),ct}if(vg(this,ey)||R6(this,ey,new Set(Nt.getValidEnumValues(this._def.values))),!vg(this,ey).has(e.data)){const e=Nt.objectValues(t);return Ie(r,{received:r.data,code:Se.invalid_enum_value,options:e}),ct}return Za(e.data)}get enum(){return this._def.values}}ey=new WeakMap,_y.create=(e,t)=>new _y({values:e,typeName:it.ZodNativeEnum,..._t(t)});class Kp extends vt{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==De.promise&&!1===t.common.async)return Ie(t,{code:Se.invalid_type,expected:De.promise,received:t.parsedType}),ct;const r=t.parsedType===De.promise?t.data:Promise.resolve(t.data);return Za(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Kp.create=(e,t)=>new Kp({type:e,typeName:it.ZodPromise,..._t(t)});class uo extends vt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===it.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:e=>{Ie(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===a.type){const e=a.transform(r.data,n);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return ct;const a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?ct:"dirty"===a.status||"dirty"===t.value?Bp(a.value):a}));{if("aborted"===t.value)return ct;const a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?ct:"dirty"===a.status||"dirty"===t.value?Bp(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,n);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===a.status?ct:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?ct:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===a.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!cy(e))return e;const i=a.transform(e.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>cy(e)?Promise.resolve(a.transform(e.value,n)).then((e=>({status:t.value,value:e}))):e))}Nt.assertNever(a)}}uo.create=(e,t,r)=>new uo({schema:e,typeName:it.ZodEffects,effect:t,..._t(r)}),uo.createWithPreprocess=(e,t,r)=>new uo({schema:t,effect:{type:"preprocess",transform:e},typeName:it.ZodEffects,..._t(r)});class ic extends vt{_parse(e){return this._getType(e)===De.undefined?Za(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ic.create=(e,t)=>new ic({innerType:e,typeName:it.ZodOptional,..._t(t)});class $u extends vt{_parse(e){return this._getType(e)===De.null?Za(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}$u.create=(e,t)=>new $u({innerType:e,typeName:it.ZodNullable,..._t(t)});class vy extends vt{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===De.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}vy.create=(e,t)=>new vy({innerType:e,typeName:it.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,..._t(t)});class ky extends vt{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ly(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Bs(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new Bs(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ky.create=(e,t)=>new ky({innerType:e,typeName:it.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,..._t(t)});class xg extends vt{_parse(e){if(this._getType(e)!==De.nan){const t=this._getOrReturnCtx(e);return Ie(t,{code:Se.invalid_type,expected:De.nan,received:t.parsedType}),ct}return{status:"valid",value:e.data}}}xg.create=e=>new xg({typeName:it.ZodNaN,..._t(e)});const C4=Symbol("zod_brand");class tk extends vt{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Sy extends vt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?ct:"dirty"===e.status?(t.dirty(),Bp(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?ct:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new Sy({in:e,out:t,typeName:it.ZodPipeline})}}class wy extends vt{_parse(e){const t=this._def.innerType._parse(e),r=e=>(cy(e)&&(e.value=Object.freeze(e.value)),e);return ly(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}function O6(e,t={},r){return e?Zp.create().superRefine(((a,n)=>{var i,o;if(!e(a)){const e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,s=null===(o=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===o||o,c="string"==typeof e?{message:e}:e;n.addIssue({code:"custom",...c,fatal:s})}})):Zp.create()}wy.create=(e,t)=>new wy({innerType:e,typeName:it.ZodReadonly,..._t(t)});const j4={object:Er.lazycreate};var it;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(it||(it={}));const T4=(e,t={message:`Input not instance of ${e.name}`})=>O6((t=>t instanceof e),t),U6=co.create,D6=Yu.create,P4=xg.create,L4=Ju.create,q6=uy.create,R4=kd.create,E4=kg.create,N4=fy.create,I4=dy.create,M4=Zp.create,O4=vd.create,U4=pl.create,D4=wg.create,q4=lo.create,W4=Er.create,F4=Er.strictCreate,V4=py.create,B4=Rg.create,X4=hy.create,G4=cc.create,H4=yy.create,Z4=bg.create,K4=wd.create,Y4=Xp.create,J4=gy.create,Q4=my.create,$4=Qu.create,e9=_y.create,t9=Kp.create,lw=uo.create,r9=ic.create,n9=$u.create,a9=uo.createWithPreprocess,s9=Sy.create,i9=()=>U6().optional(),o9=()=>D6().optional(),c9=()=>q6().optional(),l9={string:e=>co.create({...e,coerce:!0}),number:e=>Yu.create({...e,coerce:!0}),boolean:e=>uy.create({...e,coerce:!0}),bigint:e=>Ju.create({...e,coerce:!0}),date:e=>kd.create({...e,coerce:!0})},u9=ct;var qe=Object.freeze({__proto__:null,defaultErrorMap:Hp,setErrorMap:u4,getErrorMap:mg,makeIssue:_g,EMPTY_PATH:f4,addIssueToContext:Ie,ParseStatus:Pa,INVALID:ct,DIRTY:Bp,OK:Za,isAborted:U2,isDirty:D2,isValid:cy,isAsync:ly,get util(){return Nt},get objectUtil(){return O2},ZodParsedType:De,getParsedType:Gu,ZodType:vt,datetimeRegex:I6,ZodString:co,ZodNumber:Yu,ZodBigInt:Ju,ZodBoolean:uy,ZodDate:kd,ZodSymbol:kg,ZodUndefined:fy,ZodNull:dy,ZodAny:Zp,ZodUnknown:vd,ZodNever:pl,ZodVoid:wg,ZodArray:lo,ZodObject:Er,ZodUnion:py,ZodDiscriminatedUnion:Rg,ZodIntersection:hy,ZodTuple:cc,ZodRecord:yy,ZodMap:bg,ZodSet:wd,ZodFunction:Xp,ZodLazy:gy,ZodLiteral:my,ZodEnum:Qu,ZodNativeEnum:_y,ZodPromise:Kp,ZodEffects:uo,ZodTransformer:uo,ZodOptional:ic,ZodNullable:$u,ZodDefault:vy,ZodCatch:ky,ZodNaN:xg,BRAND:C4,ZodBranded:tk,ZodPipeline:Sy,ZodReadonly:wy,custom:O6,Schema:vt,ZodSchema:vt,late:j4,get ZodFirstPartyTypeKind(){return it},coerce:l9,any:M4,array:q4,bigint:L4,boolean:q6,date:R4,discriminatedUnion:B4,effect:lw,enum:$4,function:Y4,instanceof:T4,intersection:X4,lazy:J4,literal:Q4,map:Z4,nan:P4,nativeEnum:e9,never:U4,null:I4,nullable:n9,number:D6,object:W4,oboolean:c9,onumber:o9,optional:r9,ostring:i9,pipeline:s9,preprocess:a9,promise:t9,record:H4,set:K4,strictObject:F4,string:U6,symbol:E4,transformer:lw,tuple:G4,undefined:N4,union:V4,unknown:O4,void:D4,NEVER:u9,ZodIssueCode:Se,quotelessJson:l4,ZodError:Bs}),f9={USER:"teamcity",npm_config_user_agent:"npm/10.9.3 node/v22.18.0 linux x64 workspaces/true",npm_node_execpath:"/home/teamcity/.nvm/versions/node/v22.18.0/bin/node",npm_config_noproxy:"",HOME:"/home/teamcity",npm_package_json:"/mnt/agent/work/70fcd8585843667f/packages/user/package.json",npm_config_userconfig:"/home/teamcity/.npmrc",npm_config_local_prefix:"/mnt/agent/work/70fcd8585843667f",COLOR:"1",npm_config_progress:"",TEMP:"/mnt/agent/temp/buildTmp",npm_config_prefix:"/home/teamcity/.nvm/versions/node/v22.18.0",npm_config_npm_version:"10.9.3",npm_config_cache:"/home/teamcity/.npm",npm_config_node_gyp:"/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",PATH:"/mnt/agent/work/70fcd8585843667f/packages/user/node_modules/.bin:/mnt/agent/work/70fcd8585843667f/packages/node_modules/.bin:/mnt/agent/work/70fcd8585843667f/node_modules/.bin:/mnt/agent/work/node_modules/.bin:/mnt/agent/node_modules/.bin:/mnt/node_modules/.bin:/node_modules/.bin:/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/mnt/agent/work/70fcd8585843667f/node_modules/.bin:/mnt/agent/work/node_modules/.bin:/mnt/agent/node_modules/.bin:/mnt/node_modules/.bin:/node_modules/.bin:/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/teamcity/.cargo/bin:/home/teamcity/.rvm/gems/ruby-3.3.9/bin:/home/teamcity/.rvm/gems/ruby-3.3.9@global/bin:/home/teamcity/.rvm/rubies/ruby-3.3.9/bin:/home/teamcity/.rvm/bin:/home/teamcity/.local/bin:/usr/lib/jvm/java-21-amazon-corretto/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/snap/bin:/usr/share/dotnet:/usr/share/dotnet/tools:/home/teamcity/google-cloud-sdk/bin:/home/teamcity/go/bin:/usr/bin/mvn:/home/teamcity/.nvm/versions/node/v22.18.0/bin",TURBO_HASH:"9ad1f84bebc4da5f",NODE:"/home/teamcity/.nvm/versions/node/v22.18.0/bin/node",npm_package_name:"@wellesley/user",npm_config_color:"always",DOMAIN_ENV:"test",LANG:"en_US.UTF-8",TURBO_TEAM:"wellesley",TMP:"/mnt/agent/temp/buildTmp",TURBO_API:"https://turborepo-remote-cache-fo3np.ondigitalocean.app",npm_lifecycle_script:"vite build",SHELL:"/bin/bash",npm_package_version:"1.0.718",npm_lifecycle_event:"build",TURBO_CACHE:"remote:rw",SENTRY_MAPS_UPLOAD:"true",npm_config_globalconfig:"/home/teamcity/.nvm/versions/node/v22.18.0/etc/npmrc",npm_config_init_module:"/home/teamcity/.npm-init.js",PWD:"/mnt/agent/work/70fcd8585843667f/packages/user",npm_execpath:"/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/bin/npm-cli.js",npm_config_global_prefix:"/home/teamcity/.nvm/versions/node/v22.18.0",npm_command:"run-script",TURBO_TOKEN:"wellesley-turbo-token",USE_PACKAGES_FROM_NPM:"true",INIT_CWD:"/mnt/agent/work/70fcd8585843667f/packages/user",EDITOR:"vi",NODE_ENV:"production",BUILD_NUMBER:"3549",APP_NAME:"@wellesley/user"};const W6=e=>f9.DOMAIN_ENV===e,d9=W6("prod"),F6=d9?8:3,V6=64,uw=5,W2=2,B6=30,rk=50,X6=1024,G6=30,sc={link:56,userName:30,pronouns:80,displayName:50,description:X6,fieldLabel:20,fieldContent:80,location:56,timezone:56},Hu={short:"Too short",long:"Too long"},p9=(e,t=100)=>{let r;return function(...a){clearTimeout(r),r=setTimeout((()=>e.apply(this,a)),t)}},h9=(e,t)=>{const r=p9(((t,r,a)=>{e(...a).then(t).catch(r)}),t);return(...e)=>new Promise(((t,a)=>{r(t,a,e)}))},nk=new RegExp("\\p{Extended_Pictographic}","u"),H6=({showInlineError:e=!0})=>qe.string().trim().min(1,e?"Username is required":"").min(2,e?"Must be at least 2 characters long":"").max(30,Hu.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,"Only latin letters, digits, _ and . allowed"),y9=h9((async e=>{try{const{exists:t}=await Y2().dispatch(Ta.endpoints.getApiV1UsersCheck.initiate({username:e})).unwrap();return{exists:t??!1,message:"Username already in use. Please, try another one"}}catch{return{exists:!1,message:""}}}),500),Z6=qe.string().trim().min(1,"Display name is required").max(50).regex(/^[^@]*$/,"@ is not allowed").superRefine(((e,t)=>{const r=nk.test(e),a=/[a-zA-Z0-9]/.test(e);r&&!a&&t.addIssue({code:qe.ZodIssueCode.custom,message:"Emojis alone are not allowed. Please add text"})})),g9=qe.string().max(1024,Hu.long).optional(),K6=({minLength:e,minErrorMessage:t,maxLength:r,regexErrorMessage:a})=>qe.string().trim().min(e,t).max(r,Hu.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,a);K6({minLength:2,maxLength:30,regexErrorMessage:"Invalid characters. ex.: group_name_1"}),K6({minLength:2,minErrorMessage:Hu.short,maxLength:30,regexErrorMessage:"Invalid characters. ex.: channel_name_1"}),qe.string().trim().min(1,"").regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$|^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{1,}$/,"Invalid characters");const m9=`Required: A-Z, a-z, 0-9, special character, min ${F6}, max 64`;qe.string().trim().superRefine(((e,t)=>{nk.test(e)&&t.addIssue({code:qe.ZodIssueCode.custom,message:"Emojis are not allowed"}),/[A-Z]/.test(e)&&/[a-z]/.test(e)&&/[0-9]/.test(e)&&/[^A-Za-z0-9]/.test(e)&&e.length>=F6&&e.length<=64||t.addIssue({code:qe.ZodIssueCode.custom,message:m9})})),qe.string().trim().min(5,"Must be at least 5 characters long").regex(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/i,"Email format is not valid").refine((e=>!nk.test(e)),"Emojis are not allowed");const _9=({form:e,originalUsername:t})=>{const r=Nn(t??"").current,a=e=>e.getValues("userName"),[n,i]=Dt(!1),[o,s]=Dt(a(e));return{isUserNameChecked:n,handleUserNameChange:()=>{i(!1)},handleUserNameBlur:async()=>{const t=a(e).trim();if(t===o||t===r)return;const{exists:n,message:c}=await y9(t);n&&e.setError("userName",{message:c}),s(t),i(!0)}}},v9=qe.object({bio:g9,username:H6({showInlineError:!0}),displayName:Z6}),k9=qe.object({show:qe.boolean(),dateOnly:qe.boolean(),date:qe.date().optional().nullable()}),w9=(e=!0)=>{const t=H6({showInlineError:e});return qe.object({avatarId:qe.string().nullable(),headerId:qe.string().nullable(),channel:qe.boolean().optional(),actorType:qe.enum(["Application","Group","Organization","Person","Service"]).optional(),userName:t,displayName:Z6,Pronouns:qe.string().max(sc.pronouns,Hu.long).optional(),summary:qe.string().max(sc.description,Hu.long).optional(),customFields:qe.array(qe.object({label:qe.string().max(sc.fieldLabel,Hu.long).optional(),content:qe.string().max(sc.fieldContent,Hu.long).optional()})),location:qe.object({geo:qe.object({latitude:qe.number().optional(),longitude:qe.number().optional(),accuracy:qe.number().optional().nullable()}).optional().nullable(),show:qe.boolean().optional(),name:qe.string().optional(),autoUpdate:qe.boolean().optional()}),timezone:qe.object({show:qe.boolean(),ianaTimezone:qe.string().optional(),autoUpdate:qe.boolean()}),birthday:k9,canSubmit:qe.boolean(),botProfile:qe.object({role:qe.string().optional(),triggers:qe.array(qe.object({id:qe.string(),label:qe.string()})).optional(),personality_traits:qe.array(qe.object({id:qe.string(),label:qe.string()})).optional(),tone:qe.string().optional(),style:qe.array(qe.object({id:qe.string(),label:qe.string()})).optional(),behaviors:qe.array(qe.object({id:qe.string(),label:qe.string()})).optional(),prompt:qe.string().optional()}).optional()})};qe.object({show:qe.boolean(),dateOnly:qe.boolean(),date:qe.date().optional().nullable()});const by=e=>{var t;const r=e,a=409===(null==r?void 0:r.status);return{message:"UserNameIsReserved"===(null==(t=null==r?void 0:r.data)?void 0:t.errorCode)?"Restricted words detected. Please, try alternatives":"Username already in use. Please, try another one",isError:a}},Y6=Ta.enhanceEndpoints({endpoints:{deleteApiV1Users:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){try{await Ge(r)&&await t(Ta.endpoints.getApiV1AccountsProfile.initiate({htmlContent:!1})).unwrap()}catch(e){Br.error(`${oo(e)}`)}}},getApiV1AccountsProfile:{providesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){t(N2(!0));try{const e=await Ge(r);e&&t(z6(e.data)),t(I2(!0))}catch(e){t(I2(!1)),t(A6(!0)),t(x6(e))}finally{t(N2(!1))}}},putApiV1UsersByUserId:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,Br.success("User updated successfully")}catch(e){const t=e.error,{isError:r}=by(t);!r&&Br.error(`${oo(t)}`)}}},getApiV1Users:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){const a=!e.htmlContent;try{a&&t(Kn.actions.setPending(!0));const e=await Ge(r);a&&e&&(t(Kn.actions.setUser(e.data)),t(Kn.actions.setSuccess(!0)),t(Kn.actions.setPending(!1)))}catch(e){a&&(t(Kn.actions.setSuccess(!1)),t(Kn.actions.setError(e)),t(Kn.actions.setPending(!1))),Br.error(`${oo(e)}`)}}},postApiV1Users:{invalidatesTags:["Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,Br.success("User created successfully")}catch(e){const t=e.error,{isError:r}=by(t);!r&&Br.error(`${oo(t)}`)}}},getApiV1UsersFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ge(t)}},getApiV1UsersRemoteByUserNameFullFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ge(t)}},getApiV1UsersByUserId:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){const a=!e.htmlContent;try{a&&t(Kn.actions.setPending(!0));const e=await Ge(r);a&&e&&(t(Kn.actions.setUser(e.data)),t(Kn.actions.setSuccess(!0)),t(Kn.actions.setPending(!1)))}catch(e){a&&(t(Kn.actions.setSuccess(!1)),t(Kn.actions.setError(e)),t(Kn.actions.setPending(!1))),Br.error(`${oo(e)}`)}}},getApiV1UsersByUserIdFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ge(t)}},getApiV1UsersFollowees:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ge(t)}},getApiV1UsersByUserIdFollowing:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ge(t)}},postApiV1UsersFollowByUsernameAccept:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:a}){const n=ul({dispatch:r,userId:e.user.id,state:a(),relationsProps:{followed:"ACCEPTED"}});await Ge(t,`Accepted follow request from ${e.username}`,(()=>null==n?void 0:n.undo()))}},postApiV1UsersFollowByUsernameReject:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:a}){const n=ul({dispatch:r,userId:e.user.id,state:a(),relationsProps:{followed:"REJECTED"}});await Ge(t,`Rejected follow request from ${e.username}`,(()=>null==n?void 0:n.undo()))}},postApiV1UsersFollowByUsername:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r}){await Ge(t,`Follow request sent to ${e.username}`)&&r(Ta.util.invalidateTags([{type:"Relationship",id:e.user.id}]))}},postApiV1UsersFollowByUsernameUndo:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:a}){const n=ul({dispatch:r,userId:e.user.id,state:a(),relationsProps:{following:null}});await Ge(t,`You unfollowed ${e.username}`,(()=>null==n?void 0:n.undo()))}},getApiV1Block:{providesTags:["Follow"]},postApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:a}){const n=ul({userId:e.userId,dispatch:a,state:r(),relationsProps:{blocked:!0}});await Ge(t,void 0,(()=>null==n?void 0:n.undo()))}},deleteApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:a}){const n=ul({userId:e.userId,dispatch:a,state:r(),relationsProps:{blocked:!1,muted:{state:!1}}});await Ge(t,void 0,(()=>null==n?void 0:n.undo()))}},postApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:r,dispatch:a}){const n=ul({userId:e,dispatch:a,state:r(),relationsProps:{muted:{state:!0}}});await Ge(t,void 0,(()=>null==n?void 0:n.undo()))}},deleteApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:r,dispatch:a}){const n=ul({userId:e,dispatch:a,state:r(),relationsProps:{muted:{state:!1}}});await Ge(t,void 0,(()=>null==n?void 0:n.undo()))}},getApiV1Mute:{async onQueryStarted(e,{queryFulfilled:t}){await Ge(t)}},getApiV1UsersRelationships:{providesTags:(e,t,{targets:r})=>r.map((e=>({type:"Relationship",id:e}))),async onQueryStarted(e,{queryFulfilled:t}){await Ge(t)}},postApiV1AdminUserChangeState:{invalidatesTags:["Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Ge(t,`User ${e.changeUserState.userId} state changed to ${e.changeUserState.newState}`)}},putApiV1Notes:{async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:a}){const{userId:n,text:i}=e.noteUpdate,o=ul({userId:n,dispatch:a,state:r(),relationsProps:{note:i}});await Ge(t,"Note has been updated",(()=>null==o?void 0:o.undo()))}},deleteApiV1NotesByUserId:{async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:a}){const n=ul({userId:e.userId,dispatch:a,state:r(),relationsProps:{note:""}});await Ge(t,"Note has been removed",(()=>null==n?void 0:n.undo()))}},postApiV1UsersFollowByUsernamePend:{async onQueryStarted(e,{queryFulfilled:t}){await Ge(t,`${e.username} has been removed from followers`)}}}}).injectEndpoints({endpoints:e=>({getInteractionUrl:e.query({query:e=>({url:e,headers:{Accept:"application/activity+json"}}),transformResponse:e=>"string"==typeof e?JSON.parse(e):e})})}),{useGetInteractionUrlQuery:Ice,usePostApiV1UsersMutation:b9,useDeleteApiV1AccountsDeleteMutation:x9,useGetApiV1AccountsProfileQuery:Mce,usePutApiV1UsersByUserIdMutation:ak,useGetApiV1UsersQuery:A9,useDeleteApiV1UsersMutation:J6,usePostApiV1MuteByUserIdMutation:Oce,useDeleteApiV1MuteByUserIdMutation:Uce,useGetApiV1MuteQuery:Dce,usePostApiV1AdminUserChangeStateMutation:qce,useGetApiV1UsersRelationshipsQuery:z9,usePutApiV1NotesMutation:Wce,useDeleteApiV1NotesByUserIdMutation:Fce,useLazyGetApiV1UsersRelationshipsQuery:S9,useLazyGetApiV1GeoQuery:C9,useGetApiV1UsersFollowersQuery:Vce,useGetApiV1UsersByUserIdQuery:j9,useLazyGetApiV1GroupsAccountQuery:T9,useLazyGetApiV1UsersRenameHistoryQuery:Bce,useGetApiV1UsersByUserIdFollowersQuery:Xce,usePostApiV1UsersFollowByUsernameMutation:Gce,usePostApiV1UsersFollowByUsernameUndoMutation:Hce,usePostApiV1UsersFollowByUsernameRejectMutation:Zce,usePostApiV1UsersFollowByUsernameAcceptMutation:Kce,useGetApiV1UsersRemoteByUserNameFullFollowersQuery:Yce}=Y6,Q6=()=>{const[e]=ak();return({userId:t,htmlContent:r,data:a})=>{e({userId:t,userUpdate:a,...r&&{htmlContent:r}})}},fw={data:null,isError:!1,isPending:!1,isSuccess:!1},Nr=xd({name:"user",initialState:fw,reducers:{reset:e=>{Object.assign(e,fw)}},extraReducers:e=>{e.addCase(z6,((e,{payload:t})=>{e.data=t})).addCase(S6,((e,{payload:t})=>{e.data&&Object.assign(e.data,t||{})})).addCase(I2,((e,{payload:t})=>{e.isSuccess=t})).addCase(N2,((e,{payload:t})=>{e.isPending=t})).addCase(A6,((e,{payload:t})=>{e.isError=t})).addCase(x6,((e,{payload:t})=>{e.error=t})).addCase(r4,((e,{payload:t})=>{var r;null!=(r=e.data)&&r.users&&(e.data.users=e.data.users.map((e=>t.id===e.id?t:e)))}))},selectors:{selectIsError:e=>e.isError,selectError:e=>e.error,selectPending:e=>e.isPending,selectData:e=>e.data,selectAccount:e=>{var t;return null==(t=e.data)?void 0:t.account},selectAccountId:e=>{var t;return null==(t=e.data)?void 0:t.account.id},selectUsers:e=>{var t;return null==(t=e.data)?void 0:t.users},selectUserById:(e,t)=>{var r;return null==(r=e.data)?void 0:r.users.find((({id:e})=>e===t))},selectCurrentUser:e=>{var t;return null==(t=e.data)?void 0:t.users.find((({id:t})=>{var r;return t===(null==(r=e.data)?void 0:r.selectedUserId)}))},selectSelectedUserId:e=>{var t;return null==(t=e.data)?void 0:t.selectedUserId},selectSuccess:e=>e.isSuccess}}),P9=e=>e.filter((e=>e.id&&e.username&&e.displayName)),Jce=()=>{const e=fo(),t=ft(Nr.selectors.selectAccount),r=u6("account#$account_id",{account_id:(null==t?void 0:t.id)||""}),a=ft((e=>Q2.selectors.selectLastUpdateFor(e,r)));jt((()=>{if(null!=t&&t.id)return e(w6({id:r,topics:[r]})),()=>{e(b6(r))}}),[null==t?void 0:t.id]),jt((()=>{null!=a&&a.data&&e(S6({...a.data,users:P9(a.data.users)}))}),[null==a?void 0:a.data])},Jp=()=>{const e=ft(Nr.selectors.selectSelectedUserId),t=fo();return{changeUser:md((r=>{e!==r&&t(e4({userId:r}))}),[e,t]),selectedUserId:e}},L9=(e="")=>e.startsWith("@")?null==e?void 0:e.replace("@",""):e,R9=({username:e,canFetch:t=!0,htmlContent:r=!0})=>{const a=L9(e),{data:n,error:i,isLoading:o}=A9({username:a,full:!0,htmlContent:r},{skip:!a||!t});return{data:n,error:i,isLoading:o}},E9=e=>{const t=ft(Kn.selectors.selectUser),{isLoading:r}=R9({username:e,canFetch:!!e,htmlContent:!1});return[t,r]},N9="wlsy",$6=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},I9=()=>{const e=new Set,t=$6();if(!t)return[];for(let r=0;r<(null==t?void 0:t.length);r+=1){const a=null==t?void 0:t.key(r);"string"==typeof a&&e.add(a)}return Array.from(e)},sk=e=>{const t=`${N9}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,a=()=>I9().filter((e=>e.startsWith(`${t}:`))),n=e=>e.slice(t.length+1),i=$6(),o=e=>{try{return null==i?void 0:i.getItem(r(e))}catch{return null}},s=(e,t)=>{try{null==i||i.setItem(r(e),String(t))}catch{return}};return{getItem:o,setItem:s,removeItem:e=>{try{null==i||i.removeItem(r(e))}catch{return}},clear:()=>{try{a().forEach((e=>null==i?void 0:i.removeItem(e)))}catch{return}},keys:()=>a().map(n),has:e=>null!==o(e),getJSON:e=>{const t=o(e);if(null==t)return null;try{return JSON.parse(t)}catch{return null}},setJSON:(e,t)=>{try{s(e,JSON.stringify(t))}catch{return}}}},ik="auth_token",ok=sk("user"),ez=()=>ok.getItem(ik)||void 0,M9=e=>ok.setItem(ik,e),O9=()=>ok.removeItem(ik),U9=()=>!!ez(),D9={getToken:ez,setToken:M9,removeToken:O9,hasToken:U9},dw={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!D9.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},ck=xd({name:"auth",initialState:dw,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...dw,isPending:!1}),setNewEmail:(e,t)=>{e.newEmail=t.payload},setForgotPasswordStep:(e,t)=>{e.forgotPasswordStep=t.payload},updateForgotPasswordFields:(e,t)=>{e.forgotPasswordFields={...e.forgotPasswordFields,...t.payload}},resetForgotPasswordFields:e=>{e.forgotPasswordFields=null},setSignupStep:(e,t)=>{e.signupStep=t.payload},updateSignupFields:(e,t)=>{e.signupFields={...e.signupFields,...t.payload}},resetSignupFields:e=>{e.signupFields=null},setPending:(e,t)=>{e.isPending=t.payload}},selectors:{selectAskLoginOpen:e=>e.isAskLoginOpen,selectToken:e=>e.token,selectNewEmail:e=>e.newEmail,selectForgotPasswordStep:e=>e.forgotPasswordStep,selectForgotPasswordFields:e=>e.forgotPasswordFields,selectSignupStep:e=>e.signupStep,selectSignupFields:e=>e.signupFields,selectPending:e=>e.isPending,selectIsAuthenticated:e=>e.isAuthenticated}}),Qce=()=>{const e=ft(ck.selectors.selectIsAuthenticated),t=ft(Nr.selectors.selectPending);return{user:ft(Nr.selectors.selectCurrentUser),isLogged:e,isLoading:t}},q9=()=>{const e=ft(Nr.selectors.selectCurrentUser),t=ft(ck.selectors.selectIsAuthenticated);return{user:e,isLoading:ft(Nr.selectors.selectPending),isLogged:t,error:ft(Nr.selectors.selectError)}},$ce=({userId:e="",canFetch:t=!0,htmlContent:r=!0})=>{const{data:a,error:n,isLoading:i,isFetching:o}=j9({userId:e,full:!0,htmlContent:r},{skip:!e||!t});return{data:a,error:n,isLoading:i,isFetching:o}},W9=({onChange:e})=>{const{user:t}=q9(),r=null==t?void 0:t.id,a=Nn(r);jt((()=>{a.current?r!==a.current&&(e(),a.current=r):a.current=r}),[r,a.current])},pw=["following","followed","blocked","muted","note","blocked_by"],hw=({userId:e,currentUserId:t})=>{const r="string"==typeof e,a=r?[e]:(null==e?void 0:e.filter((e=>e!==t)))||[],n=e===t;return{isSingleUser:r,canFetch:!(!a.length||n||!t),safeTargets:a}},F9=({userId:e,skip:t})=>{const r=ft(Nr.selectors.selectCurrentUser),a=null==r?void 0:r.id,{canFetch:n,isSingleUser:i,safeTargets:o}=hw({userId:e,currentUserId:a}),{data:s,isLoading:c}=z9({targets:o,filter:pw},{skip:!n||t}),[l]=S9(),u=({userId:e})=>{const{canFetch:t,safeTargets:r}=hw({userId:e,currentUserId:a});t&&l({targets:r,filter:pw})};return W9({onChange:()=>{u({userId:o})}}),{relationship:(i?null==s?void 0:s[e]:s)||{},isLoading:c,updateRelations:u}},Eg=e=>`@${e.username}${e.domain?`@${e.domain}`:""}`,tz=({id:e,user:t})=>{const r=fo(),a=u6("user#$username",{username:t?Eg(t).slice(1):""}),n=`${e}-${null==t?void 0:t.username}`;return jt((()=>{if(null!=t&&t.username)return r(w6({id:n,topics:[a]})),()=>{r(b6(n))}}),[null==t?void 0:t.username]),{subscriptionName:a}},ele=({user:e,onUpdate:t})=>{const{updateRelations:r}=F9({}),{subscriptionName:a}=tz({id:"outside-user-update",user:e}),n=ft((e=>Q2.selectors.selectLastUpdateFor(e,a)));jt((()=>{const e=null==n?void 0:n.data;e&&(r({userId:e.id}),t(e))}),[null==n?void 0:n.data])},tle=({onUpdate:e})=>{const t=ft(Nr.selectors.selectCurrentUser),{subscriptionName:r}=tz({id:"current-user-update",user:t}),a=ft((e=>Q2.selectors.selectLastUpdateFor(e,r)));jt((()=>{const t=null==a?void 0:a.data;t&&e(t)}),[null==a?void 0:a.data])},rz=e=>{const t=e.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return t?t[1]:void 0},V9=e=>e.replace(/\.[^.]*$/,""),nz=()=>"object"!=typeof window,B9=()=>!nz()&&/iPhone|iPod|iPad/gi.test(window.navigator.userAgent),iy="8.48.0",hl=globalThis;function lk(e,t,r){const a=hl,n=a.__SENTRY__=a.__SENTRY__||{},i=n[iy]=n[iy]||{};return i[e]||(i[e]=t())}const az=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,X9="Sentry Logger ",yw=["debug","info","warn","error","log","assert","trace"],gw={};function G9(e){if(!("console"in hl))return e();const t=hl.console,r={},a=Object.keys(gw);a.forEach((e=>{const a=gw[e];r[e]=t[e],t[e]=a}));try{return e()}finally{a.forEach((e=>{t[e]=r[e]}))}}function H9(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return az?yw.forEach((r=>{t[r]=(...t)=>{e&&G9((()=>{hl.console[r](`${X9}[${r}]:`,...t)}))}})):yw.forEach((e=>{t[e]=()=>{}})),t}const ug=lk("logger",H9);function uk(){return fk(hl),hl}function fk(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||iy,t[iy]=t[iy]||{}}const Z9=Object.prototype.toString;function K9(e,t){return Z9.call(e)===`[object ${t}]`}function Y9(e){return K9(e,"Object")}function J9(e){return!(!e||!e.then||"function"!=typeof e.then)}function Q9(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{az&&ug.log(`Failed to add non-enumerable property "${t}" to object`,e)}}const sz=1e3;function iz(){return Date.now()/sz}function $9(){const{performance:e}=hl;if(!e||!e.now)return iz;const t=Date.now()-e.now(),r=null==e.timeOrigin?t:e.timeOrigin;return()=>(r+e.now())/sz}const e7=$9();function Gp(){const e=hl,t=e.crypto||e.msCrypto;let r=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(r=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(e=>(e^(15&r())>>e/4).toString(16)))}function t7(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||e7(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Gp()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function mw(){return Gp()}function _w(){return Gp().substring(16)}function oz(e,t,r=2){if(!t||"object"!=typeof t||r<=0)return t;if(e&&t&&0===Object.keys(t).length)return e;const a={...e};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(a[e]=oz(a[e],t[e],r-1));return a}(()=>{const{performance:e}=hl;if(!e||!e.now)return;const t=36e5,r=e.now(),a=Date.now(),n=e.timeOrigin?Math.abs(e.timeOrigin+r-a):t,i=n<t,o=e.timing&&e.timing.navigationStart,s="number"==typeof o?Math.abs(o+r-a):t;(i||s<t)&&(n<=s&&e.timeOrigin)})();const F2="_sentrySpan";function vw(e,t){t?Q9(e,F2,t):delete e[F2]}function kw(e){return e[F2]}const r7=100;class dk{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:mw(),spanId:_w()}}clone(){const e=new dk;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,vw(e,kw(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&t7(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,[r,a]=t instanceof xy?[t.getScopeData(),t.getRequestSession()]:Y9(t)?[e,e.requestSession]:[],{tags:n,extra:i,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u}=r||{};return this._tags={...this._tags,...n},this._extra={...this._extra,...i},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),a&&(this._requestSession=a),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,vw(this,void 0),this._attachments=[],this.setPropagationContext({traceId:mw()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const r="number"==typeof t?t:r7;if(r<=0)return this;const a={timestamp:iz(),...e},n=this._breadcrumbs;return n.push(a),this._breadcrumbs=n.length>r?n.slice(-r):n,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:kw(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=oz(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:_w(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){const r=t&&t.event_id?t.event_id:Gp();if(!this._client)return ug.warn("No client configured on scope - will not capture exception!"),r;const a=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:a,...t,event_id:r},this),r}captureMessage(e,t,r){const a=r&&r.event_id?r.event_id:Gp();if(!this._client)return ug.warn("No client configured on scope - will not capture message!"),a;const n=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:n,...r,event_id:a},this),a}captureEvent(e,t){const r=t&&t.event_id?t.event_id:Gp();return this._client?(this._client.captureEvent(e,{...t,event_id:r},this),r):(ug.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}const xy=dk;function n7(){return lk("defaultCurrentScope",(()=>new xy))}function a7(){return lk("defaultIsolationScope",(()=>new xy))}class s7{constructor(e,t){let r,a;r=e||new xy,a=t||new xy,this._stack=[{scope:r}],this._isolationScope=a}withScope(e){const t=this._pushScope();let r;try{r=e(t)}catch(e){throw this._popScope(),e}return J9(r)?r.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function Yp(){const e=fk(uk());return e.stack=e.stack||new s7(n7(),a7())}function i7(e){return Yp().withScope(e)}function o7(e,t){const r=Yp();return r.withScope((()=>(r.getStackTop().scope=e,t(e))))}function ww(e){return Yp().withScope((()=>e(Yp().getIsolationScope())))}function c7(){return{withIsolationScope:ww,withScope:i7,withSetScope:o7,withSetIsolationScope:(e,t)=>ww(t),getCurrentScope:()=>Yp().getScope(),getIsolationScope:()=>Yp().getIsolationScope()}}function cz(e){const t=fk(e);return t.acs?t.acs:c7()}function lz(){return cz(uk()).getCurrentScope()}function l7(){return cz(uk()).getIsolationScope()}function u7(e,t){return lz().captureException(e,void 0)}function f7(e,t){const r={captureContext:t};return lz().captureMessage(e,void 0,r)}function d7(e,t){l7().setExtra(e,t)}const p7=(...e)=>{let t="";for(const r of e){if(r instanceof Error){const e=r;return d7("exceptionMessage",t),void u7(e)}if("object"!=typeof r)t+=r;else try{t+=" "+JSON.stringify(r)}catch{t+=" "+r}}f7(t)},bw=["debug","info","warn","error"],h7=(e,t)=>{const r=bw.indexOf(e);return bw.indexOf(t)>=r},ig=(e,t,r,...a)=>{h7(t,e)&&console.log(`[${e}] ${r}`,...a)},y7=()=>sk().getItem("logger_lvl"),g7=(e=(nz()?"info":y7()||"warn"))=>{let t=e;return{debug:(e,...r)=>ig("debug",t,e,...r),info:(e,...r)=>ig("info",t,e,...r),warn:(e,...r)=>ig("warn",t,e,...r),error:(e,...r)=>(p7(e,...r),ig("error",t,e,...r)),setLevel:e=>{t=e},getLevel:()=>t}},Xs=g7(),m7=({src:e,name:t=""})=>new Promise(((r,a)=>{const n=document.createElement("video");n.src=e;const i=()=>{const{duration:e,videoHeight:i,videoWidth:o,src:s}=n,c=V9(t);(!e||!i||!o||!s)&&a(),r({src:s,name:c,width:o,height:i,duration:Math.floor(e)})},o=()=>{Xs.warn("Failed to load video"),r(null)};return B9()&&n.load(),n.addEventListener("error",o),n.addEventListener("loadeddata",i),()=>{n.removeEventListener("error",o),n.removeEventListener("loadeddata",i)}})),_7=e=>new Promise(((t,r)=>{const a=new Image,n=URL.createObjectURL(e);a.onload=()=>{t({width:a.naturalWidth,height:a.naturalHeight}),URL.revokeObjectURL(n)},a.onerror=()=>{Xs.warn("Failed to load image"),r(null),URL.revokeObjectURL(n)},a.src=n})),xw=e=>{if(!e)return;const t="number"==typeof e?e:parseInt(e,10);if(isNaN(t))throw new Error("Can not get number from income argument");const r=t/1048576;return`${Math.floor(r)} MB`},v7={sms:"wellesley.admin.sms",auth:"wellesley.admin.auth",openai:"wellesley.admin.openai",uploads:"wellesley.admin.uploads",captcha:"wellesley.admin.captcha",language:"wellesley.admin.language",mediacache:"wellesley.admin.mediacache",translation:"wellesley.admin.translation",link_service:"wellesley.admin.link_service"},fg={posts:"wellesley.posts",translation:"wellesley.translation",registration:"wellesley.registration",confirmationCode:"wellesley.confirmationCode",uploadsPolicyDoc:"wellesley.uploads.policy.doc",uploadsPolicyAudio:"wellesley.uploads.policy.audio",uploadsPolicyImage:"wellesley.uploads.policy.image",uploadsPolicyVideo:"wellesley.uploads.policy.video",captcha:"wellesley.captcha",access:"wellesley.access",branding:"wellesley.branding",instanceAdmin:"wellesley.instance.admin",legal:"wellesley.instance.legal",domainBlocks:"wellesley.instance.domainBlocks",contacts:"wellesley.instance.contacts"},dl=e=>(null==e?void 0:e.map((e=>e.value||e)))||[],k7={data:null,isPending:!1},{posts:P0,uploadsPolicyDoc:Aw,uploadsPolicyAudio:L0,uploadsPolicyImage:og,uploadsPolicyVideo:Zh,registration:w7,captcha:b7,instanceAdmin:x7,branding:A7,translation:z7,access:S7}=fg,{captcha:C7,language:j7,translation:T7,openai:P7,link_service:L7}=v7,Qp=e=>e.data,R7=ef(Qp,(e=>{var t,r,a;return{max_characters:(null==(t=null==e?void 0:e[P0])?void 0:t.max_characters)||0,max_media_attachments:(null==(r=null==e?void 0:e[P0])?void 0:r.max_media_attachments)||0,max_pins:(null==(a=null==e?void 0:e[P0])?void 0:a.max_pins)||0}})),pk=ef(Qp,(e=>{var t,r,a;return{...null==e?void 0:e[og],maxSize:(null==(t=null==e?void 0:e[og])?void 0:t.maxSize)||0,maxMatrix:(null==(r=null==e?void 0:e[og])?void 0:r.maxMatrix)||0,maxResolution:(null==(a=null==e?void 0:e[og])?void 0:a.maxResolution)||0}})),E7=ef(pk,(e=>dl(e.extensions))),uz=ef(Qp,(e=>{var t,r,a,n;return{...null==e?void 0:e[Zh],maxSize:(null==(t=null==e?void 0:e[Zh])?void 0:t.maxSize)||0,maxMatrix:(null==(r=null==e?void 0:e[Zh])?void 0:r.maxMatrix)||0,maxDuration:(null==(a=null==e?void 0:e[Zh])?void 0:a.maxDuration)||0,maxResolution:(null==(n=null==e?void 0:e[Zh])?void 0:n.maxResolution)||0}})),fz=ef(Qp,(e=>{var t,r;return{...null==e?void 0:e[L0],maxSize:null==(t=null==e?void 0:e[L0])?void 0:t.maxSize,keepOriginal:(null==(r=null==e?void 0:e[L0])?void 0:r.keepOriginal)||0}})),dz=ef(Qp,(e=>{var t;return{...null==e?void 0:e[Aw],maxSize:(null==(t=null==e?void 0:e[Aw])?void 0:t.maxSize)||0}})),pz=ef([pk,uz,fz,dz],((e,t,r,a)=>({IMAGE:dl(null==e?void 0:e.extensions),VIDEO:dl(null==t?void 0:t.extensions),AUDIO:dl(null==r?void 0:r.extensions),DOCUMENT:dl(null==a?void 0:a.extensions)}))),N7=ef(pz,(e=>Object.keys(e).reduce(((t,r)=>[...t,...e[r]||[]]),[]))),ty=xd({name:"platformSettings",initialState:k7,reducers:{setError:(e,t)=>{e.error=t.payload},setPending:(e,t)=>{e.isPending=t.payload}},extraReducers:e=>{e.addCase(n4,((e,{payload:t})=>{e.data={...e.data,...t}}))},selectors:{selectSettings:Qp,selectPostConfig:R7,selectDocPolicy:dz,selectImagePolicy:pk,selectVideoPolicy:uz,selectAudioPolicy:fz,selectImageExtensions:E7,selectSupportedExtensions:pz,selectFullExtensionsList:N7,selectRegistration:e=>{var t;return null==(t=e.data)?void 0:t[w7]},selectLanguageDetection:e=>{var t;return null==(t=e.data)?void 0:t[j7]},selectLanguageTranslation:e=>{var t;return null==(t=e.data)?void 0:t[T7]},selectOpenai:e=>{var t;return null==(t=e.data)?void 0:t[P7]},selectCaptcha:e=>{var t;return null==(t=e.data)?void 0:t[b7]},selectAdminCaptcha:e=>{var t;return null==(t=e.data)?void 0:t[C7]},selectPlatformTranslation:e=>{var t;return null==(t=e.data)?void 0:t[z7]},selectAccess:e=>{var t;return null==(t=e.data)?void 0:t[S7]},selectBranding:e=>{var t;return null==(t=e.data)?void 0:t[A7]},selectLinkService:e=>{var t;return null==(t=e.data)?void 0:t[L7]},selectInstanceAdmin:e=>{var t;return null==(t=e.data)?void 0:t[x7]},selectLegal:e=>{var t;return null==(t=e.data)?void 0:t[fg.legal]},selectDomainBlocks:e=>{var t;return null==(t=e.data)?void 0:t[fg.domainBlocks]},selectContacts:e=>{var t;return null==(t=e.data)?void 0:t[fg.contacts]}}}),I7=async({media:e,docPolicy:t,imgPolicy:r,videoPolicy:a,audioPolicy:n})=>{if(!r||!a)return"Media policy is not defined";const i={IMAGE:dl(r.extensions),VIDEO:dl(a.extensions),AUDIO:dl(n.extensions),DOCUMENT:dl(t.extensions)},o=rz(e.file.name)||"",s=Object.keys(i).find((e=>{var t;return null==(t=i[e])?void 0:t.includes(o)}));if(!s)return`Extension ${o} is not supported`;const c="VIDEO"===s;if("IMAGE"===s){const t=await _7(e.file),a=e.file.size>r.maxSize,n=t&&Math.max(t.width,t.height)>r.maxResolution,i=t&&t.width*t.height>r.maxMatrix;switch(!0){case a:return`Image is too big. Max size is ${xw(r.maxSize)}`;case n:return`Image resolution is too high. Max resolution is ${r.maxResolution} pixels`;case i:return`The uploaded image exceeds the maximum size allowed. Please choose an image with smaller dimensions or reduce the resolution and try again. Max resolution is ${r.maxMatrix} pixels`}}if(c){const t=await m7({src:e.objectUrl}),r=t&&t.duration>a.maxDuration,n=t&&Math.max(t.width,t.height)>a.maxResolution,i=e.file.size>a.maxSize,o=t&&t.width*t.height>a.maxMatrix;switch(!0){case r:return`Video is too long. Max duration is ${a.maxDuration} seconds`;case i:return`Video is too big. Max size is ${xw(a.maxSize)}`;case n:return`Video resolution is too high. Max resolution is ${a.maxResolution} pixels`;case o:return`The uploaded video exceeds the maximum size allowed. Please choose a video with smaller dimensions or reduce the resolution and try again. Max resolution is ${a.maxMatrix} pixels`}}},M7=()=>{const[e]=B8(),t=new AbortController,r=t.signal,a=ft(ty.selectors.selectImagePolicy),n=ft(ty.selectors.selectVideoPolicy),i=ft(ty.selectors.selectDocPolicy),o=ft(ty.selectors.selectAudioPolicy);return[async({media:t,tag:s,onError:c,onUpload:l,onProgress:u})=>{var d;const f=rz(t.file.name),p=await I7({imgPolicy:a,docPolicy:i,videoPolicy:n,audioPolicy:o,media:t});if(p)return Br.error(p),void(null==c||c());try{const a=await e({createUpload:{extension:f,tags:[s],meta:{name:t.file.name}}});if("error"in a)throw new Error(a.error);const n=null==(d=a.data)?void 0:d.uri;return await new Promise(((e,a)=>{const i=new XMLHttpRequest;i.open("PUT",n),r&&r.addEventListener("abort",(()=>{try{i.abort()}catch(e){Xs.warn("Cancel upload failed",e)}})),i.upload.onprogress=e=>{if(!e.lengthComputable)return;const t=Math.round(e.loaded/e.total*100);null==u||u(e.loaded,e.total,t)},i.onerror=()=>a(new Error("Upload failed")),i.onload=()=>{i.status>=200&&i.status<300?e():a(new Error(i.statusText))},i.send(t.file)})),null==l||l(),a.data.upload.uploadId}catch(e){null==c||c(e),Br.error(`Could not upload file. ${String(e)}`)}},()=>t.abort("Upload canceled")]};var Si=(e=>(e.header="header",e.avatar="avatar",e))(Si||{});const Ay=({user:e,type:t})=>{var r,a,n,i;if(!e)return"";try{return("avatar"===t?null==(a=null==(r=e.avatar)?void 0:r.files[0])?void 0:a.uri:null==(i=null==(n=e.header)?void 0:n.files[0])?void 0:i.uri)||""}catch{return""}};var zw,ry={exports:{}},O7=ry.exports;
43
43
  /**
44
44
  * @license
45
45
  * Lodash <https://lodash.com/>
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "!.*",
8
8
  "!*.map"
9
9
  ],
10
- "version": "1.0.717",
10
+ "version": "1.0.718",
11
11
  "module": "index.ts",
12
12
  "scripts": {
13
13
  "build": "vite build",