@wellesley/notifications 1.0.631 → 1.0.633
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +2 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{api as Ks,usePostApiV1BlockByUserIdMutation as Py,useDeleteApiV1BlockByUserIdMutation as My,usePostApiV1UsersFollowByUsernameAcceptMutation as Uy,usePostApiV1UsersFollowByUsernameRejectMutation as jy,useGetApiV1UsersFolloweesQuery as Fy,useGetApiV1UsersByUserIdFollowingQuery as By,useGetApiV1SearchQuery as Dy}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.
|
|
1
|
+
import{api as Ks,usePostApiV1BlockByUserIdMutation as Py,useDeleteApiV1BlockByUserIdMutation as My,usePostApiV1UsersFollowByUsernameAcceptMutation as Uy,usePostApiV1UsersFollowByUsernameRejectMutation as jy,useGetApiV1UsersFolloweesQuery as Fy,useGetApiV1UsersByUserIdFollowingQuery as By,useGetApiV1SearchQuery as Dy}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.734";import Wy,{forwardRef as c_,createElement as L0,useState as lr,useRef as gi,useEffect as zn,useCallback as w0}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{toast as Vt}from"https://cdn.jsdelivr.net/npm/@wellesley/system-toast@1.0.78";import{createAction as l_,createSelector as Q0,createSlice as Wa}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{ToastContainer as $y,toast as zy}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{authSlice as ro}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.790";import{useSelector as lt,useDispatch as dl}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Dialog as Vy,DialogContent as Zy,cn as Fe,Form as f_,FormField as d_,FormItem as qy,FormLabel as Hy,FormControl as Gy,Input as h_,Command as Qy,CommandList as Ky,CommandItem as Yy,FormMessage as Jy,Button as wn,ButtonLoader as P0,TooltipWrapper as M0,Avatar as Xy,AvatarImage as e1,Skeleton as p_,DropdownMenu as g_,DropdownMenuTrigger as m_,DropdownMenuContent as v_,DropdownMenuItem as __,useIsMobile as t1,Tabs as r1,TabsControls as n1,TabsContent as hv,HoverCard as i1,HoverCardTrigger as s1,HoverCardContent as o1}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.696";import{get as U0,set as b0,appendErrors as a1,useForm as K0,FormProvider as u1}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{useAppsNavigate as c1,ExternalLinks as l1,AppsLink as Hc}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.660";import{usePostApiV1UsersFollowByUsernameMutation as f1,usePostApiV1UsersFollowByUsernameUndoMutation as d1,canFollowBack as h1,isFollowPending as p1,canUnfollow as pv,useIsOwnProfile as Y0,useRelationship as g1,useCurrentUser as y_,useGetUserByUserName as m1,useGetUserById as v1,usePostApiV1MuteByUserIdMutation as _1,useDeleteApiV1MuteByUserIdMutation as y1,isMuted as x1,usePutApiV1NotesMutation as w1,useDeleteApiV1NotesByUserIdMutation as b1,userSlice as J0,useGetApiV1UsersRemoteByUserNameFullFollowersQuery as A1,useGetApiV1UsersFollowersQuery as S1,useGetApiV1UsersByUserIdFollowersQuery as C1,UserAvatar as x_,usePostApiV1UsersFollowByUsernameRejectMutation as E1,canUnsubscribeFromMe as I1}from"https://cdn.jsdelivr.net/npm/@wellesley/user@1.0.749";import{getErrorMsg as Gs}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.583";import{getStore as k1,rootReducer as w_}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.733";import{selectSmallestPreview as gv}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.619";import{useProfileSettings as T1,platformSettingsSlice as N1}from"https://cdn.jsdelivr.net/npm/@wellesley/settings@1.0.691";import{usePostApiV1EventsByEventIdAcceptMutation as R1,usePostApiV1EventsByEventIdRejectMutation as O1,usePostApiV1EventsByEventIdMaybeMutation as L1}from"https://cdn.jsdelivr.net/npm/@wellesley/events@1.0.486";import{wsSlice as P1}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.716";var mv,ns=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},$c={exports:{}},M1=$c.exports;
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Lodash <https://lodash.com/>
|
|
@@ -39,7 +39,7 @@ import{api as Ks,usePostApiV1BlockByUserIdMutation as Py,useDeleteApiV1BlockByUs
|
|
|
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
|
-
*/_e("remoteReady");const Tx=_e("askLogin");_e("reselectUser"),_e("requestLogout"),_e("setConfirmLeavePage"),_e("requestChangePath");const Nx=_e("wsSubscribe"),Rx=_e("wsUnSubscribe");_e("hostStoreConnect"),_e("remoteLogin"),_e("remoteLogout"),_e("wsOnMessage"),_e("setRouterPath"),_e("setDeviceType"),_e("setDeviceWidth");const C_=_e("setUserError"),E_=_e("setUserIsError"),j0=_e("setUserPending"),F0=_e("setUserSuccess"),I_=_e("setUserData"),Ox=_e("updateAccountData"),Lx=_e("updateUser"),k_=_e("addNotification"),T_=_e("markNotification"),N_=_e("setNotificationsError"),R_=_e("setNotificationsList"),B0=_e("setNotificationsPending"),O_=_e("setNotificationsTotalCount"),D0=_e("setNotificationsUnreadCount"),L_=_e("resetNotificationsState"),P_=_e("undoNotification");_e("setInstanceInfo"),_e("setInstanceInfoPending"),_e("setInstanceInfoError"),_e("setPlatformSettings"),_e("setProfileSettings"),_e("setGroupData"),_e("setGroupLoading"),l_("requestMicroFrontendFetch"),l_("sendMicroFrontendFetchResponse");const Px=Ks.enhanceEndpoints({endpoints:{getApiV1Notifications:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n,getState:r}){var i;t(B0(!0));try{const e=await Ve(n),s=(null==(i=r().user.data)?void 0:i.selectedUserId)||"";e&&t(R_({userId:s,list:e.data}))}catch(e){t(N_(e))}finally{t(B0(!1))}}},postApiV1NotificationsByIdMark:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await Ve(n),t(T_(e))}catch(e){Vt.error(`Mark notification error, ${e}`)}}},postApiV1NotificationsMarkAll:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){await Ve(n),t(D0(0))}},getApiV1NotificationsCount:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{const r=await Ve(n),i=!e.status;r&&t(i?O_(r.data):D0(r.data))}catch(e){Vt.error(`Error getting unread notifications count', ${e}`)}}}}}),{useGetApiV1NotificationsQuery:Mx,usePostApiV1NotificationsByIdMarkMutation:Ux,usePostApiV1NotificationsMarkAllMutation:gS,useGetApiV1NotificationsCountQuery:jx}=Px,Cv={data:{userId:"",list:[]},count:{},isPending:!1},Fx=e=>e,Bx=e=>e.error,Dx=e=>e.isPending,Wx=e=>{var t;return null==(t=e.count)?void 0:t.total},$x=e=>{var t;return null==(t=e.count)?void 0:t.unread},zx=e=>e.data.userId,X0=Q0(Fx,(e=>e.data.list)),Vx=Q0(X0,(e=>null==e?void 0:e.filter((e=>"UNREAD"===e.status)))),Zx=Q0(X0,(e=>null==e?void 0:e.at(-1))),Kc=Wa({name:"notifications",initialState:Cv,reducers:{updateNotification:(e,t)=>{var n;if(!e.data.list)return;const r=t.payload;e.data.list=null==(n=e.data.list)?void 0:n.map((e=>e.id===r.id?{...e,...r}:e))},readAll:e=>{var t;e.data.list&&(e.data.list=null==(t=e.data.list)?void 0:t.map((e=>({...e,status:"READ"}))))}},extraReducers:e=>{e.addCase(B0,((e,t)=>{e.isPending=t.payload})).addCase(N_,((e,t)=>{e.error=t.payload})).addCase(R_,((e,t)=>{const n=t.payload.userId,r=t.payload.list;e.data={userId:n,list:[...e.data.list||[],...r.filter((t=>{var n;return!(null!=(n=e.data.list)&&n.some((e=>e.id===t.id)))}))]}})).addCase(k_,((e,t)=>{e.count.unread=(e.count.unread||0)+1,e.data.list&&(e.data.list=[t.payload,...e.data.list||[]])})).addCase(T_,((e,t)=>{e.data.list&&(e.data.list=e.data.list.map((e=>e.id===t.payload.id?{...e,status:t.payload.status}:e)))})).addCase(O_,((e,t)=>{e.count.total=t.payload})).addCase(D0,((e,t)=>{e.count.unread=t.payload})).addCase(L_,(()=>Cv)).addCase(P_,((e,t)=>{var n,r,i;const s=t.payload;"UNREAD"===(null==(r=null==(n=e.data.list)?void 0:n.find((e=>e.id===s)))?void 0:r.status)&&e.count.unread&&(e.count.unread-=1),e.data.list=(null==(i=e.data.list)?void 0:i.filter((e=>e.id!==s)))||[]}))},selectors:{selectError:Bx,selectIsPending:Dx,selectTotalCount:Wx,selectUnreadCount:$x,selectNotifications:X0,selectUnreadNotifications:Vx,selectLastNotification:Zx,selectNotificationsOwner:zx}}),mS=()=>S.jsx($y,{position:"top-right",theme:"dark",limit:5,autoClose:5e3,containerId:"custom",hideProgressBar:!0,className:"custom-notifications"}),vS=(e,t)=>zy(e,{...t,containerId:"custom"});var Ev=function(e,t,n){if(e&&"reportValidity"in e){var r=U0(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},M_=function(e,t){var n=function(n){var r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Ev(r.ref,n,e):r.refs&&r.refs.forEach((function(t){return Ev(t,n,e)}))};for(var r in t.fields)n(r)},qx=function(e,t){t.shouldUseNativeValidation&&M_(e,t);var n={};for(var r in e){var i=U0(t.fields,r),s=Object.assign(e[r]||{},{ref:i&&i.ref});if(Hx(t.names||Object.keys(e),r)){var a=Object.assign({},U0(n,r));b0(a,"root",s),b0(n,r,a)}else b0(n,r,s)}return n},Hx=function(e,t){return e.some((function(e){return e.startsWith(t+".")}))},Gx=function(e,t){for(var n={};e.length;){var r=e[0],i=r.code,s=r.message,a=r.path.join(".");if(!n[a])if("unionErrors"in r){var o=r.unionErrors[0].errors[0];n[a]={message:o.message,type:o.code}}else n[a]={message:s,type:i};if("unionErrors"in r&&r.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var u=n[a].types,l=u&&u[r.code];n[a]=a1(a,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n},U_=function(e,t,n){return void 0===n&&(n={}),function(r,i,s){try{return Promise.resolve(function(i,a){try{var o=Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](r,t)).then((function(e){return s.shouldUseNativeValidation&&M_({},s),{errors:{},values:n.raw?r:e}}))}catch(e){return a(e)}return o&&o.then?o.then(void 0,a):o}(0,(function(e){if(null!=e.errors)return{values:{},errors:qx(Gx(e.errors,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)};throw e})))}catch(e){return Promise.reject(e)}}};const Qx=e=>{try{return e.startsWith("https")||e.startsWith("http")?new URL(e).origin:new URL(`https://${e}`).origin}catch{throw new Error("Error getting domain from entered URL")}},Kx=e=>{const t=e.links.find((e=>"http://ostatus.org/schema/1.0/subscribe"===e.rel));return null==t?void 0:t.template},Yx=({template:e,user:t})=>null==e?void 0:e.replace("{uri}",t.uri),Jx=async({url:e,...t})=>{const n=await fetch(e,t);if(!n.ok)throw new Error(n.statusText);if("PUT"===t.method)return;const r=await n.json(),i=r;if(i.errorCode)throw new Error(i.message);return r},Xx=({user:e})=>async({url:t})=>{const n=Qx(t);try{const t=`${n}/.well-known/webfinger?resource=${n}`,r=await Jx({url:t,headers:{Accept:"application/json"}});if(!r)return;const i=Kx(r),s=Yx({template:i,user:e});if(!s)throw new Error("Error getting follow link");window.open(s,"_self")}catch{window.open(`${n}/authorize_interaction?uri=${e.uri}`,"_self")}},ew=(e,t)=>{const n=e.at(0),r=(null==n?void 0:n.toUpperCase())===n&&"@"!==n,i=e.toLowerCase(),s=(null==t?void 0:t.toLowerCase())||"";if(!s)return e;const a=i.startsWith(s),o=i.replace(s,`<mark>${a?Ys.capitalize(s):t}</mark>`);return r&&a?o:Ys.capitalize(o)},Iv=e=>{e.preventDefault()},tw=e=>e?{onOpenAutoFocus:Iv,onCloseAutoFocus:Iv}:{},hl=({open:e,modal:t,children:n,onCloseModal:r,className:i,skipModalAutofocus:s=!1,...a})=>e?S.jsx(Vy,{open:e,modal:t,onOpenChange:e=>{e||null==r||r()},children:S.jsx(Zy,{className:Fe(i),closeSize:"small",closeVariant:"insideCard",onCloseModal:r,...a,...tw(s),childrenClassName:Fe("overflow-auto",a.title?"max-h-[calc(90vh-65px)]":"max-h-[90vh]",a.childrenClassName),children:n})}):null;var Ae,W0;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},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 n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},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}(Ae||(Ae={})),(W0||(W0={})).mergeShapes=(e,t)=>({...e,...t});const Q=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rs=e=>{switch(typeof e){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return isNaN(e)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"symbol":return Q.symbol;case"object":return Array.isArray(e)?Q.array:null===e?Q.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Q.promise:typeof Map<"u"&&e instanceof Map?Q.map:typeof Set<"u"&&e instanceof Set?Q.set:typeof Date<"u"&&e instanceof Date?Q.date:Q.object;default:return Q.unknown}},W=Ae.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"]),rw=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Or 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},n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){const n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof Or))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ae.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Or.create=e=>new Or(e);const ja=(e,t)=>{let n;switch(e.code){case W.invalid_type:n=e.received===Q.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ae.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ae.joinValues(e.keys,", ")}`;break;case W.invalid_union:n="Invalid input";break;case W.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ae.joinValues(e.options)}`;break;case W.invalid_enum_value:n=`Invalid enum value. Expected ${Ae.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:n="Invalid function arguments";break;case W.invalid_return_type:n="Invalid function return type";break;case W.invalid_date:n="Invalid date";break;case W.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ae.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case W.too_small:n="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 W.too_big:n="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 W.custom:n="Invalid input";break;case W.invalid_intersection_types:n="Intersection results could not be merged";break;case W.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ae.assertNever(e)}return{message:n}};let j_=ja;function nw(e){j_=e}function jd(){return j_}const Fd=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],a={...i,path:s};if(void 0!==i.message)return{...i,path:s,message:i.message};let o="";const u=r.filter((e=>!!e)).slice().reverse();for(const e of u)o=e(a,{data:t,defaultError:o}).message;return{...i,path:s,message:o}},iw=[];function G(e,t){const n=jd(),r=Fd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ja?void 0:ja].filter((e=>!!e))});e.common.issues.push(r)}class Yt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return oe;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,r=await e.value;n.push({key:t,value:r})}return Yt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:i}=r;if("aborted"===t.status||"aborted"===i.status)return oe;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(typeof i.value<"u"||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}}const oe=Object.freeze({status:"aborted"}),Pa=e=>({status:"dirty",value:e}),fr=e=>({status:"valid",value:e}),$0=e=>"aborted"===e.status,z0=e=>"dirty"===e.status,Yc=e=>"valid"===e.status,Jc=e=>typeof Promise<"u"&&e instanceof Promise;function Bd(e,t,n,r){if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function F_(e,t,n,r,i){if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var J,zc,Vc;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(J||(J={}));class Vn{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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 kv=(e,t)=>{if(Yc(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 Or(e.common.issues);return this._error=t,this._error}}};function pe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{var s,a;const{message:o}=e;return"invalid_enum_value"===t.code?{message:o??i.defaultError}:typeof i.data>"u"?{message:null!==(s=o??r)&&void 0!==s?s:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(a=o??n)&&void 0!==a?a:i.defaultError}},description:i}}class ve{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 rs(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Yt,ctx:{common:e.parent.common,data:e.data,parsedType:rs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Jc(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rs(e)},i=this._parseSync({data:e,path:r.path,parent:r});return kv(r,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={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:rs(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(Jc(r)?r:Promise.resolve(r));return kv(n,i)}refine(e,t){const n=e=>"string"==typeof t||typeof t>"u"?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const i=e(t),s=()=>r.addIssue({code:W.custom,...n(t)});return typeof Promise<"u"&&i instanceof Promise?i.then((e=>!!e||(s(),!1))):!!i||(s(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new Sn({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return $n.create(this,this._def)}nullable(){return as.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bn.create(this,this._def)}promise(){return Ba.create(this,this._def)}or(e){return rl.create([this,e],this._def)}and(e){return nl.create(this,e,this._def)}transform(e){return new Sn({...pe(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ul({...pe(this._def),innerType:this,defaultValue:t,typeName:ne.ZodDefault})}brand(){return new ev({typeName:ne.ZodBranded,type:this,...pe(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new cl({...pe(this._def),innerType:this,catchValue:t,typeName:ne.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return pl.create(this,e)}readonly(){return ll.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const sw=/^c[^\s-]{8,}$/i,ow=/^[0-9a-z]+$/,aw=/^[0-9A-HJKMNP-TV-Z]{26}$/,uw=/^[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,cw=/^[a-z0-9_-]{21}$/i,lw=/^[-+]?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)?)??$/,fw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dw="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let T0;const hw=/^(?:(?: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])$/,pw=/^(([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})))$/,gw=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,B_="((\\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])))",mw=new RegExp(`^${B_}$`);function D_(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 vw(e){return new RegExp(`^${D_(e)}$`)}function W_(e){let t=`${B_}T${D_(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function _w(e,t){return!(("v4"!==t&&t||!hw.test(e))&&("v6"!==t&&t||!pw.test(e)))}class xn extends ve{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Q.string){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.string,received:t.parsedType}),oe}const t=new Yt;let n;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const i=e.data.length>r.value,s=e.data.length<r.value;(i||s)&&(n=this._getOrReturnCtx(e,n),i?G(n,{code:W.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&G(n,{code:W.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)fw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"email",code:W.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)T0||(T0=new RegExp(dw,"u")),T0.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"emoji",code:W.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)uw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"uuid",code:W.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)cw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"nanoid",code:W.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)sw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"cuid",code:W.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)ow.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"cuid2",code:W.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)aw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"ulid",code:W.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),G(n,{validation:"url",code:W.invalid_string,message:r.message}),t.dirty()}else"regex"===r.kind?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"regex",code:W.invalid_string,message:r.message}),t.dirty())):"trim"===r.kind?e.data=e.data.trim():"includes"===r.kind?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):"toLowerCase"===r.kind?e.data=e.data.toLowerCase():"toUpperCase"===r.kind?e.data=e.data.toUpperCase():"startsWith"===r.kind?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):"endsWith"===r.kind?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):"datetime"===r.kind?W_(r).test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:"datetime",message:r.message}),t.dirty()):"date"===r.kind?mw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:"date",message:r.message}),t.dirty()):"time"===r.kind?vw(r).test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:"time",message:r.message}),t.dirty()):"duration"===r.kind?lw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"duration",code:W.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?_w(e.data,r.version)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"ip",code:W.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?gw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"base64",code:W.invalid_string,message:r.message}),t.dirty()):Ae.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:W.invalid_string,...J.errToObj(n)})}_addCheck(e){return new xn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...J.errToObj(e)})}url(e){return this._addCheck({kind:"url",...J.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...J.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...J.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...J.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...J.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...J.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...J.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...J.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...J.errToObj(e)})}datetime(e){var t,n;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!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...J.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,...J.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...J.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...J.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...J.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...J.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...J.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...J.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...J.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...J.errToObj(t)})}nonempty(e){return this.min(1,J.errToObj(e))}trim(){return new xn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new xn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new xn({...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 yw(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}xn.create=e=>{var t;return new xn({checks:[],typeName:ne.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...pe(e)})};class is extends ve{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)!==Q.number){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.number,received:t.parsedType}),oe}let t;const n=new Yt;for(const r of this._def.checks)"int"===r.kind?Ae.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:W.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"multipleOf"===r.kind?0!==yw(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_finite,message:r.message}),n.dirty()):Ae.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,J.toString(t))}gt(e,t){return this.setLimit("min",e,!1,J.toString(t))}lte(e,t){return this.setLimit("max",e,!0,J.toString(t))}lt(e,t){return this.setLimit("max",e,!1,J.toString(t))}setLimit(e,t,n,r){return new is({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:J.toString(r)}]})}_addCheck(e){return new is({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:J.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:J.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.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&&Ae.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}is.create=e=>new is({checks:[],typeName:ne.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...pe(e)});class ss extends ve{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)!==Q.bigint){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.bigint,received:t.parsedType}),oe}let t;const n=new Yt;for(const r of this._def.checks)"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Ae.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,J.toString(t))}gt(e,t){return this.setLimit("min",e,!1,J.toString(t))}lte(e,t){return this.setLimit("max",e,!0,J.toString(t))}lt(e,t){return this.setLimit("max",e,!1,J.toString(t))}setLimit(e,t,n,r){return new ss({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:J.toString(r)}]})}_addCheck(e){return new ss({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:J.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}}ss.create=e=>{var t;return new ss({checks:[],typeName:ne.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...pe(e)})};class Xc extends ve{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Q.boolean){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.boolean,received:t.parsedType}),oe}return fr(e.data)}}Xc.create=e=>new Xc({typeName:ne.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...pe(e)});class eo extends ve{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Q.date){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.date,received:t.parsedType}),oe}if(isNaN(e.data.getTime())){return G(this._getOrReturnCtx(e),{code:W.invalid_date}),oe}const t=new Yt;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Ae.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new eo({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:J.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:J.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}}eo.create=e=>new eo({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ne.ZodDate,...pe(e)});class Dd extends ve{_parse(e){if(this._getType(e)!==Q.symbol){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.symbol,received:t.parsedType}),oe}return fr(e.data)}}Dd.create=e=>new Dd({typeName:ne.ZodSymbol,...pe(e)});class el extends ve{_parse(e){if(this._getType(e)!==Q.undefined){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.undefined,received:t.parsedType}),oe}return fr(e.data)}}el.create=e=>new el({typeName:ne.ZodUndefined,...pe(e)});class tl extends ve{_parse(e){if(this._getType(e)!==Q.null){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.null,received:t.parsedType}),oe}return fr(e.data)}}tl.create=e=>new tl({typeName:ne.ZodNull,...pe(e)});class Fa extends ve{constructor(){super(...arguments),this._any=!0}_parse(e){return fr(e.data)}}Fa.create=e=>new Fa({typeName:ne.ZodAny,...pe(e)});class Js extends ve{constructor(){super(...arguments),this._unknown=!0}_parse(e){return fr(e.data)}}Js.create=e=>new Js({typeName:ne.ZodUnknown,...pe(e)});class mi extends ve{_parse(e){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.never,received:t.parsedType}),oe}}mi.create=e=>new mi({typeName:ne.ZodNever,...pe(e)});class Wd extends ve{_parse(e){if(this._getType(e)!==Q.undefined){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.void,received:t.parsedType}),oe}return fr(e.data)}}Wd.create=e=>new Wd({typeName:ne.ZodVoid,...pe(e)});class bn extends ve{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Q.array)return G(t,{code:W.invalid_type,expected:Q.array,received:t.parsedType}),oe;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(G(t,{code:e?W.too_big:W.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(G(t,{code:W.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(G(t,{code:W.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new Vn(t,e,t.path,n))))).then((e=>Yt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>r.type._parseSync(new Vn(t,e,t.path,n))));return Yt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new bn({...this._def,minLength:{value:e,message:J.toString(t)}})}max(e,t){return new bn({...this._def,maxLength:{value:e,message:J.toString(t)}})}length(e,t){return new bn({...this._def,exactLength:{value:e,message:J.toString(t)}})}nonempty(e){return this.min(1,e)}}function La(e){if(e instanceof st){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=$n.create(La(r))}return new st({...e._def,shape:()=>t})}return e instanceof bn?new bn({...e._def,type:La(e.element)}):e instanceof $n?$n.create(La(e.unwrap())):e instanceof as?as.create(La(e.unwrap())):e instanceof Zn?Zn.create(e.items.map((e=>La(e)))):e}bn.create=(e,t)=>new bn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...pe(t)});class st extends ve{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=Ae.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Q.object){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.object,received:t.parsedType}),oe}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof mi&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||s.push(e);const a=[];for(const e of i){const t=r[e],i=n.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new Vn(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof mi){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)a.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&(G(n,{code:W.unrecognized_keys,keys:s}),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 s){const r=n.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new Vn(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e})).then((e=>Yt.mergeObjectSync(t,e))):Yt.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return J.errToObj,new st({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,i,s,a;const o=null!==(s=null===(i=(r=this._def).errorMap)||void 0===i?void 0:i.call(r,t,n).message)&&void 0!==s?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=J.errToObj(e).message)&&void 0!==a?a:o}:{message:o}}}:{}})}strip(){return new st({...this._def,unknownKeys:"strip"})}passthrough(){return new st({...this._def,unknownKeys:"passthrough"})}extend(e){return new st({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new st({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ne.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new st({...this._def,catchall:e})}pick(e){const t={};return Ae.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new st({...this._def,shape:()=>t})}omit(e){const t={};return Ae.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new st({...this._def,shape:()=>t})}deepPartial(){return La(this)}partial(e){const t={};return Ae.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()})),new st({...this._def,shape:()=>t})}required(e){const t={};return Ae.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof $n;)e=e._def.innerType;t[n]=e}})),new st({...this._def,shape:()=>t})}keyof(){return $_(Ae.objectKeys(this.shape))}}st.create=(e,t)=>new st({shape:()=>e,unknownKeys:"strip",catchall:mi.create(),typeName:ne.ZodObject,...pe(t)}),st.strictCreate=(e,t)=>new st({shape:()=>e,unknownKeys:"strict",catchall:mi.create(),typeName:ne.ZodObject,...pe(t)}),st.lazycreate=(e,t)=>new st({shape:e,unknownKeys:"strip",catchall:mi.create(),typeName:ne.ZodObject,...pe(t)});class rl extends ve{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new Or(e.ctx.common.issues)));return G(t,{code:W.invalid_union,unionErrors:n}),oe}));{let e;const r=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"===s.status&&!e&&(e={result:s,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=r.map((e=>new Or(e)));return G(t,{code:W.invalid_union,unionErrors:i}),oe}}get options(){return this._def.options}}rl.create=(e,t)=>new rl({options:e,typeName:ne.ZodUnion,...pe(t)});const hi=e=>e instanceof sl?hi(e.schema):e instanceof Sn?hi(e.innerType()):e instanceof ol?[e.value]:e instanceof os?e.options:e instanceof al?Ae.objectValues(e.enum):e instanceof ul?hi(e._def.innerType):e instanceof el?[void 0]:e instanceof tl?[null]:e instanceof $n?[void 0,...hi(e.unwrap())]:e instanceof as?[null,...hi(e.unwrap())]:e instanceof ev||e instanceof ll?hi(e.unwrap()):e instanceof cl?hi(e._def.innerType):[];class Vd extends ve{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.object)return G(t,{code:W.invalid_type,expected:Q.object,received:t.parsedType}),oe;const n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(G(t,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const n of t){const t=hi(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new Vd({typeName:ne.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...pe(n)})}}function V0(e,t){const n=rs(e),r=rs(t);if(e===t)return{valid:!0,data:e};if(n===Q.object&&r===Q.object){const n=Ae.objectKeys(t),r=Ae.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of r){const r=V0(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===Q.array&&r===Q.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const i=V0(e[r],t[r]);if(!i.valid)return{valid:!1};n.push(i.data)}return{valid:!0,data:n}}return n===Q.date&&r===Q.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class nl extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if($0(e)||$0(r))return oe;const i=V0(e.value,r.value);return i.valid?((z0(e)||z0(r))&&t.dirty(),{status:t.value,value:i.data}):(G(n,{code:W.invalid_intersection_types}),oe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}nl.create=(e,t,n)=>new nl({left:e,right:t,typeName:ne.ZodIntersection,...pe(n)});class Zn extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.array)return G(n,{code:W.invalid_type,expected:Q.array,received:n.parsedType}),oe;if(n.data.length<this._def.items.length)return G(n,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe;!this._def.rest&&n.data.length>this._def.items.length&&(G(n,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new Vn(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>Yt.mergeArray(t,e))):Yt.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Zn({...this._def,rest:e})}}Zn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zn({items:e,typeName:ne.ZodTuple,rest:null,...pe(t)})};class il extends ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.object)return G(n,{code:W.invalid_type,expected:Q.object,received:n.parsedType}),oe;const r=[],i=this._def.keyType,s=this._def.valueType;for(const e in n.data)r.push({key:i._parse(new Vn(n,e,n.path,e)),value:s._parse(new Vn(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Yt.mergeObjectAsync(t,r):Yt.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new il(t instanceof ve?{keyType:e,valueType:t,typeName:ne.ZodRecord,...pe(n)}:{keyType:xn.create(),valueType:e,typeName:ne.ZodRecord,...pe(t)})}}class $d extends ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.map)return G(n,{code:W.invalid_type,expected:Q.map,received:n.parsedType}),oe;const r=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map((([e,t],s)=>({key:r._parse(new Vn(n,e,n.path,[s,"key"])),value:i._parse(new Vn(n,t,n.path,[s,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of s){const r=await n.key,i=await n.value;if("aborted"===r.status||"aborted"===i.status)return oe;("dirty"===r.status||"dirty"===i.status)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of s){const r=n.key,i=n.value;if("aborted"===r.status||"aborted"===i.status)return oe;("dirty"===r.status||"dirty"===i.status)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}$d.create=(e,t,n)=>new $d({valueType:t,keyType:e,typeName:ne.ZodMap,...pe(n)});class to extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.set)return G(n,{code:W.invalid_type,expected:Q.set,received:n.parsedType}),oe;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(G(n,{code:W.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(G(n,{code:W.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function s(e){const n=new Set;for(const r of e){if("aborted"===r.status)return oe;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const a=[...n.data.values()].map(((e,t)=>i._parse(new Vn(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>s(e))):s(a)}min(e,t){return new to({...this._def,minSize:{value:e,message:J.toString(t)}})}max(e,t){return new to({...this._def,maxSize:{value:e,message:J.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}to.create=(e,t)=>new to({valueType:e,minSize:null,maxSize:null,typeName:ne.ZodSet,...pe(t)});class Ma extends ve{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.function)return G(t,{code:W.invalid_type,expected:Q.function,received:t.parsedType}),oe;function n(e,n){return Fd({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,jd(),ja].filter((e=>!!e)),issueData:{code:W.invalid_arguments,argumentsError:n}})}function r(e,n){return Fd({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,jd(),ja].filter((e=>!!e)),issueData:{code:W.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Ba){const e=this;return fr((async function(...t){const a=new Or([]),o=await e._def.args.parseAsync(t,i).catch((e=>{throw a.addIssue(n(t,e)),a})),u=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(u,i).catch((e=>{throw a.addIssue(r(u,e)),a}))}))}{const e=this;return fr((function(...t){const a=e._def.args.safeParse(t,i);if(!a.success)throw new Or([n(t,a.error)]);const o=Reflect.apply(s,this,a.data),u=e._def.returns.safeParse(o,i);if(!u.success)throw new Or([r(o,u.error)]);return u.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ma({...this._def,args:Zn.create(e).rest(Js.create())})}returns(e){return new Ma({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Ma({args:e||Zn.create([]).rest(Js.create()),returns:t||Js.create(),typeName:ne.ZodFunction,...pe(n)})}}class sl extends ve{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})}}sl.create=(e,t)=>new sl({getter:e,typeName:ne.ZodLazy,...pe(t)});class ol extends ve{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return G(t,{received:t.data,code:W.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:e.data}}get value(){return this._def.value}}function $_(e,t){return new os({values:e,typeName:ne.ZodEnum,...pe(t)})}ol.create=(e,t)=>new ol({value:e,typeName:ne.ZodLiteral,...pe(t)});class os extends ve{constructor(){super(...arguments),zc.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return G(t,{expected:Ae.joinValues(n),received:t.parsedType,code:W.invalid_type}),oe}if(Bd(this,zc)||F_(this,zc,new Set(this._def.values)),!Bd(this,zc).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return G(t,{received:t.data,code:W.invalid_enum_value,options:n}),oe}return fr(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 os.create(e,{...this._def,...t})}exclude(e,t=this._def){return os.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}zc=new WeakMap,os.create=$_;class al extends ve{constructor(){super(...arguments),Vc.set(this,void 0)}_parse(e){const t=Ae.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Q.string&&n.parsedType!==Q.number){const e=Ae.objectValues(t);return G(n,{expected:Ae.joinValues(e),received:n.parsedType,code:W.invalid_type}),oe}if(Bd(this,Vc)||F_(this,Vc,new Set(Ae.getValidEnumValues(this._def.values))),!Bd(this,Vc).has(e.data)){const e=Ae.objectValues(t);return G(n,{received:n.data,code:W.invalid_enum_value,options:e}),oe}return fr(e.data)}get enum(){return this._def.values}}Vc=new WeakMap,al.create=(e,t)=>new al({values:e,typeName:ne.ZodNativeEnum,...pe(t)});class Ba extends ve{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.promise&&!1===t.common.async)return G(t,{code:W.invalid_type,expected:Q.promise,received:t.parsedType}),oe;const n=t.parsedType===Q.promise?t.data:Promise.resolve(t.data);return fr(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Ba.create=(e,t)=>new Ba({type:e,typeName:ne.ZodPromise,...pe(t)});class Sn extends ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{G(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===r.type){const e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return oe;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?oe:"dirty"===r.status||"dirty"===t.value?Pa(r.value):r}));{if("aborted"===t.value)return oe;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?oe:"dirty"===r.status||"dirty"===t.value?Pa(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,i);if(n.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===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?oe:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?oe:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Yc(e))return e;const s=r.transform(e.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>Yc(e)?Promise.resolve(r.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ae.assertNever(r)}}Sn.create=(e,t,n)=>new Sn({schema:e,typeName:ne.ZodEffects,effect:t,...pe(n)}),Sn.createWithPreprocess=(e,t,n)=>new Sn({schema:t,effect:{type:"preprocess",transform:e},typeName:ne.ZodEffects,...pe(n)});class $n extends ve{_parse(e){return this._getType(e)===Q.undefined?fr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:ne.ZodOptional,...pe(t)});class as extends ve{_parse(e){return this._getType(e)===Q.null?fr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}as.create=(e,t)=>new as({innerType:e,typeName:ne.ZodNullable,...pe(t)});class ul extends ve{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ul.create=(e,t)=>new ul({innerType:e,typeName:ne.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...pe(t)});class cl extends ve{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Jc(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Or(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Or(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}cl.create=(e,t)=>new cl({innerType:e,typeName:ne.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...pe(t)});class zd extends ve{_parse(e){if(this._getType(e)!==Q.nan){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.nan,received:t.parsedType}),oe}return{status:"valid",value:e.data}}}zd.create=e=>new zd({typeName:ne.ZodNaN,...pe(e)});const xw=Symbol("zod_brand");class ev extends ve{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class pl extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?oe:"dirty"===e.status?(t.dirty(),Pa(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?oe:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new pl({in:e,out:t,typeName:ne.ZodPipeline})}}class ll extends ve{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Yc(e)&&(e.value=Object.freeze(e.value)),e);return Jc(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function z_(e,t={},n){return e?Fa.create().superRefine(((r,i)=>{var s,a;if(!e(r)){const e="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,o=null===(a=null!==(s=e.fatal)&&void 0!==s?s:n)||void 0===a||a,u="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...u,fatal:o})}})):Fa.create()}ll.create=(e,t)=>new ll({innerType:e,typeName:ne.ZodReadonly,...pe(t)});const ww={object:st.lazycreate};var ne;!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"}(ne||(ne={}));const bw=(e,t={message:`Input not instance of ${e.name}`})=>z_((t=>t instanceof e),t),V_=xn.create,Z_=is.create,Aw=zd.create,Sw=ss.create,q_=Xc.create,Cw=eo.create,Ew=Dd.create,Iw=el.create,kw=tl.create,Tw=Fa.create,Nw=Js.create,Rw=mi.create,Ow=Wd.create,Lw=bn.create,Pw=st.create,Mw=st.strictCreate,Uw=rl.create,jw=Vd.create,Fw=nl.create,Bw=Zn.create,Dw=il.create,Ww=$d.create,$w=to.create,zw=Ma.create,Vw=sl.create,Zw=ol.create,qw=os.create,Hw=al.create,Gw=Ba.create,Tv=Sn.create,Qw=$n.create,Kw=as.create,Yw=Sn.createWithPreprocess,Jw=pl.create,Xw=()=>V_().optional(),e2=()=>Z_().optional(),t2=()=>q_().optional(),r2={string:e=>xn.create({...e,coerce:!0}),number:e=>is.create({...e,coerce:!0}),boolean:e=>Xc.create({...e,coerce:!0}),bigint:e=>ss.create({...e,coerce:!0}),date:e=>eo.create({...e,coerce:!0})},n2=oe;var ot=Object.freeze({__proto__:null,defaultErrorMap:ja,setErrorMap:nw,getErrorMap:jd,makeIssue:Fd,EMPTY_PATH:iw,addIssueToContext:G,ParseStatus:Yt,INVALID:oe,DIRTY:Pa,OK:fr,isAborted:$0,isDirty:z0,isValid:Yc,isAsync:Jc,get util(){return Ae},get objectUtil(){return W0},ZodParsedType:Q,getParsedType:rs,ZodType:ve,datetimeRegex:W_,ZodString:xn,ZodNumber:is,ZodBigInt:ss,ZodBoolean:Xc,ZodDate:eo,ZodSymbol:Dd,ZodUndefined:el,ZodNull:tl,ZodAny:Fa,ZodUnknown:Js,ZodNever:mi,ZodVoid:Wd,ZodArray:bn,ZodObject:st,ZodUnion:rl,ZodDiscriminatedUnion:Vd,ZodIntersection:nl,ZodTuple:Zn,ZodRecord:il,ZodMap:$d,ZodSet:to,ZodFunction:Ma,ZodLazy:sl,ZodLiteral:ol,ZodEnum:os,ZodNativeEnum:al,ZodPromise:Ba,ZodEffects:Sn,ZodTransformer:Sn,ZodOptional:$n,ZodNullable:as,ZodDefault:ul,ZodCatch:cl,ZodNaN:zd,BRAND:xw,ZodBranded:ev,ZodPipeline:pl,ZodReadonly:ll,custom:z_,Schema:ve,ZodSchema:ve,late:ww,get ZodFirstPartyTypeKind(){return ne},coerce:r2,any:Tw,array:Lw,bigint:Sw,boolean:q_,date:Cw,discriminatedUnion:jw,effect:Tv,enum:qw,function:zw,instanceof:bw,intersection:Fw,lazy:Vw,literal:Zw,map:Ww,nan:Aw,nativeEnum:Hw,never:Rw,null:kw,nullable:Kw,number:Z_,object:Pw,oboolean:t2,onumber:e2,optional:Qw,ostring:Xw,pipeline:Jw,preprocess:Yw,promise:Gw,record:Dw,set:$w,strictObject:Mw,string:V_,symbol:Ew,transformer:Tv,tuple:Bw,undefined:Iw,union:Uw,unknown:Nw,void:Ow,NEVER:n2,ZodIssueCode:W,quotelessJson:rw,ZodError:Or});const i2=ot.object({url:ot.string().min(1,"Field is required")}),s2=({open:e,user:t,onCloseModal:n})=>{const r=Xx({user:t}),i=c1(),[s,a]=lr(!0),o=K0({shouldFocusError:!1,mode:"onSubmit",resolver:U_(i2),defaultValues:{url:""}}),[u,{data:l}]=Ks.endpoints.getApiV1InstanceDomains.useLazyQuery(),c=e=>{!s&&a(!0),o.setValue("url",e),(e=>{s&&u({limit:20,domain:e,software:"mastodon"})})(e)},d=s&&!!o.getValues("url");return S.jsxs(hl,{open:e,onCloseModal:n,title:`You're not following @${t.username}`,children:[S.jsx(f_,{...o,children:S.jsxs("form",{className:"flex flex-col gap-3 md:mb-4 md:flex-row md:items-end",autoFocus:!1,onSubmit:(...e)=>{o.handleSubmit(r)(...e)},children:[S.jsx(d_,{control:o.control,name:"url",render:({field:e})=>S.jsxs(qy,{className:"mt-0 flex-1",children:[S.jsx(Hy,{className:"mb-2 block text-base",children:"Enter your server name to follow this user"}),S.jsxs("div",{className:"relative",children:[S.jsx(Gy,{children:S.jsx(h_,{"data-testid":"input",placeholder:"Server name",...e,onChange:e=>c(e.target.value)})}),S.jsx(Qy,{"data-testid":"command",children:S.jsx(Ky,{"data-testid":"list",className:"bg-background absolute z-50 mt-1 w-full rounded-md shadow-md empty:hidden",children:d&&(null==l?void 0:l.map((e=>S.jsx(Yy,{className:"w-full max-w-[unset] [&>div]:overflow-hidden [&>div]:text-ellipsis",onSelect:e=>{a(!1),o.setValue("url",e)},children:S.jsx("div",{dangerouslySetInnerHTML:{__html:ew(e,o.getValues("url"))}})},e))))})})]}),S.jsx(Jy,{className:"md:absolute"})]})}),S.jsx(wn,{type:"submit",variant:"primary",children:"Take me home"})]})}),S.jsxs("div",{children:[S.jsx("span",{className:"text-base text-gray-500",children:"Do not have an account yet?"}),S.jsx(wn,{"data-testid":"join",variant:"tertiary",className:"text-blue_100 ml-1 text-base",onClick:()=>{null==n||n(),i("/signin",{props:{redirectUrl:window.location.href}})},children:"Join Wellsley"})]})]})},An=e=>`@${e.username}${e.domain?`@${e.domain}`:""}`,H_=({user:e,onFollow:t,onUnfollow:n,unsubscribe:r})=>{const[i,s]=lr(!1),a=lt(ro.selectors.selectIsAuthenticated),[o]=f1(),[u]=d1(),l=null==e?void 0:e.domain,c={user:e,username:An(e),...l&&{domain:l}};return{follow:async()=>{a?await o(c):s(!0),null==t||t()},unfollow:async()=>{await u({mutual:r,...c}),null==n||n()},renderGuestFollowModal:()=>i?S.jsx(s2,{user:e,open:i,onCloseModal:()=>s(!1)}):null}},o2=({delay:e=0,defaultHover:t=!1,dependProps:n=[],leaveDelay:r=0}={})=>{const i=gi(null),[s,a]=lr(t),o=gi(null),u=gi(null),l=()=>{o.current&&clearTimeout(o.current),o.current=setTimeout((()=>{a(!0)}),e),u.current&&clearTimeout(u.current)},c=()=>{u.current&&clearTimeout(u.current),u.current=setTimeout((()=>{a(!1)}),r),o.current&&clearTimeout(o.current)};return zn((()=>()=>{o.current&&clearTimeout(o.current),u.current&&clearTimeout(u.current)}),[]),zn((()=>{const e=i.current;if(e)return e.addEventListener("mouseenter",l),e.addEventListener("mouseleave",c),()=>{e.removeEventListener("mouseenter",l),e.removeEventListener("mouseleave",c)}}),[i.current,...n]),[i,s,a]},a2=({open:e,title:t,children:n,leftButton:r,rightButton:i,onClose:s,titleTestId:a,...o})=>S.jsxs(hl,{open:e,onCloseModal:s,showClose:!1,className:"gap-none max-w-[400px] rounded-lg",...o,children:[S.jsx("h3",{className:"p-none mb-xxs text-center text-lg font-semibold text-gray-700","data-testid":a,children:t}),n&&S.jsx("div",{className:"text-center text-base text-gray-500",children:n}),S.jsxs("div",{className:"mt-m max-md:gap-s md:gap-m flex justify-center",children:[S.jsx(P0,{size:"m",variant:"secondary",className:"flex-1",...r,title:void 0,children:r.title}),i&&S.jsx(P0,{size:"m",className:"flex-1",...i,title:void 0,children:i.title})]})]}),u2=e=>!(null==e||!e.blocked),G_=(e=!1)=>{const[t,n]=lr(e);return[t,w0((()=>n(!0)),[]),w0((()=>n(!1)),[]),w0((()=>n((e=>!e))),[]),n]},tv=({user:e,relationship:t})=>{const[n,{isLoading:r}]=Py(),[i]=My(),[s,a,o]=G_(),u=u2(t);return[u,a,async()=>{try{await i({userId:e.id}).unwrap(),Vt.success(`${e.username} is unblocked`)}catch(e){Vt.error(`${Gs(e)}`)}},()=>S.jsx(a2,{open:s,title:`Do you want to block ${e.username}?`,onClose:o,"data-testid":"block-dialog",leftButton:{title:"Cancel",isLoading:!1,variant:"secondary",onClick:o},rightButton:{title:"Block",variant:"red_primary",isLoading:r,onClick:()=>{(async()=>{try{await n({userId:e.id}).unwrap(),Vt.success(`${e.username} is blocked`),o()}catch(e){Vt.error(`${Gs(e)}`)}})()}},children:"Blocked users will not be able to follow you or see your content, and you will not see any content from them. They will also be aware that they have been blocked."}),s]},Q_=({size:e,user:t,follow:n,unfollow:r,disabled:i,relationship:s,isRelationshipPending:a,className:o,followButtonText:u,unfollowButtonText:l})=>{const[c,,d]=tv({user:t,relationship:s}),f=h1(s)?"Follow back":u||"Follow",p=l||"Unfollow",h=p1(s),v=pv(s),[m,g]=o2(),y=h&&!g||v;if(!a)return S.jsx(wn,{ref:m,"data-testid":"followBtn",onClick:c?d:v||h?r:n,size:e,className:Fe("rounded-m px-xs w-[100%] min-w-[130px] md:max-w-[300px] lg:max-w-full",!pv&&"bg-gray-700",o),variant:c?"secondary_danger":y?"secondary":"primary",disabled:i,children:c?"Unblock":h?g?"Cancel follow request":"Follow Pending":v?p:f})},Nv={data:null,isError:!1,isPending:!1,isSuccess:!1},Gc=Wa({name:"user",initialState:Nv,reducers:{reset:e=>{Object.assign(e,Nv)}},extraReducers:e=>{e.addCase(I_,((e,{payload:t})=>{e.data=t})).addCase(Ox,((e,{payload:t})=>{e.data&&Object.assign(e.data,t||{})})).addCase(F0,((e,{payload:t})=>{e.isSuccess=t})).addCase(j0,((e,{payload:t})=>{e.isPending=t})).addCase(E_,((e,{payload:t})=>{e.isError=t})).addCase(C_,((e,{payload:t})=>{e.error=t})).addCase(Lx,((e,{payload:t})=>{var n;null!=(n=e.data)&&n.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 n;return null==(n=e.data)?void 0:n.users.find((({id:e})=>e===t))},selectCurrentUser:e=>{var t;return null==(t=e.data)?void 0:t.users.find((({id:t})=>{var n;return t===(null==(n=e.data)?void 0:n.selectedUserId)}))},selectSelectedUserId:e=>{var t;return null==(t=e.data)?void 0:t.selectedUserId},selectSuccess:e=>e.isSuccess}}),Qc="8.48.0",vi=globalThis;function rv(e,t,n){const r=vi,i=r.__SENTRY__=r.__SENTRY__||{},s=i[Qc]=i[Qc]||{};return s[e]||(s[e]=t())}const K_=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,c2="Sentry Logger ",Rv=["debug","info","warn","error","log","assert","trace"],Ov={};function l2(e){if(!("console"in vi))return e();const t=vi.console,n={},r=Object.keys(Ov);r.forEach((e=>{const r=Ov[e];n[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{t[e]=n[e]}))}}function f2(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return K_?Rv.forEach((n=>{t[n]=(...t)=>{e&&l2((()=>{vi.console[n](`${c2}[${n}]:`,...t)}))}})):Rv.forEach((e=>{t[e]=()=>{}})),t}const Md=rv("logger",f2);function nv(){return iv(vi),vi}function iv(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Qc,t[Qc]=t[Qc]||{}}const d2=Object.prototype.toString;function h2(e,t){return d2.call(e)===`[object ${t}]`}function p2(e){return h2(e,"Object")}function g2(e){return!(!e||!e.then||"function"!=typeof e.then)}function m2(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{K_&&Md.log(`Failed to add non-enumerable property "${t}" to object`,e)}}const Y_=1e3;function J_(){return Date.now()/Y_}function v2(){const{performance:e}=vi;if(!e||!e.now)return J_;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/Y_}const _2=v2();function Ua(){const e=vi,t=e.crypto||e.msCrypto;let n=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(n=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(e=>(e^(15&n())>>e/4).toString(16)))}function y2(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||_2(),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:Ua()),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 Lv(){return Ua()}function Pv(){return Ua().substring(16)}function X_(e,t,n=2){if(!t||"object"!=typeof t||n<=0)return t;if(e&&t&&0===Object.keys(t).length)return e;const r={...e};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=X_(r[e],t[e],n-1));return r}(()=>{const{performance:e}=vi;if(!e||!e.now)return;const t=36e5,n=e.now(),r=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,s=i<t,a=e.timing&&e.timing.navigationStart,o="number"==typeof a?Math.abs(a+n-r):t;(s||o<t)&&(i<=o&&e.timeOrigin)})();const Z0="_sentrySpan";function Mv(e,t){t?m2(e,Z0,t):delete e[Z0]}function Uv(e){return e[Z0]}const x2=100;class sv{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:Lv(),spanId:Pv()}}clone(){const e=new sv;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,Mv(e,Uv(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&&y2(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,[n,r]=t instanceof fl?[t.getScopeData(),t.getRequestSession()]:p2(t)?[e,e.requestSession]:[],{tags:i,extra:s,user:a,contexts:o,level:u,fingerprint:l=[],propagationContext:c}=n||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...s},this._contexts={...this._contexts,...o},a&&Object.keys(a).length&&(this._user=a),u&&(this._level=u),l.length&&(this._fingerprint=l),c&&(this._propagationContext=c),r&&(this._requestSession=r),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,Mv(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Lv()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:x2;if(n<=0)return this;const r={timestamp:J_(),...e},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>n?i.slice(-n):i,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:Uv(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=X_(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:Pv(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:Ua();if(!this._client)return Md.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n&&n.event_id?n.event_id:Ua();if(!this._client)return Md.warn("No client configured on scope - will not capture message!"),r;const i=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:Ua();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(Md.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}const fl=sv;function w2(){return rv("defaultCurrentScope",(()=>new fl))}function b2(){return rv("defaultIsolationScope",(()=>new fl))}class A2{constructor(e,t){let n,r;n=e||new fl,r=t||new fl,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){const t=this._pushScope();let n;try{n=e(t)}catch(e){throw this._popScope(),e}return g2(n)?n.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),n)}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 Da(){const e=iv(nv());return e.stack=e.stack||new A2(w2(),b2())}function S2(e){return Da().withScope(e)}function C2(e,t){const n=Da();return n.withScope((()=>(n.getStackTop().scope=e,t(e))))}function jv(e){return Da().withScope((()=>e(Da().getIsolationScope())))}function E2(){return{withIsolationScope:jv,withScope:S2,withSetScope:C2,withSetIsolationScope:(e,t)=>jv(t),getCurrentScope:()=>Da().getScope(),getIsolationScope:()=>Da().getIsolationScope()}}function ey(e){const t=iv(e);return t.acs?t.acs:E2()}function ty(){return ey(nv()).getCurrentScope()}function I2(){return ey(nv()).getIsolationScope()}function k2(e,t){return ty().captureException(e,void 0)}function T2(e,t){const n={captureContext:t};return ty().captureMessage(e,void 0,n)}function N2(e,t){I2().setExtra(e,t)}const R2=(...e)=>{let t="";for(const n of e){if(n instanceof Error){const e=n;return N2("exceptionMessage",t),void k2(e)}if("object"!=typeof n)t+=n;else try{t+=" "+JSON.stringify(n)}catch{t+=" "+n}}T2(t)},Zd=()=>"object"!=typeof window,O2="wlsy",ry=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},L2=()=>{const e=new Set,t=ry();if(!t)return[];for(let n=0;n<(null==t?void 0:t.length);n+=1){const r=null==t?void 0:t.key(n);"string"==typeof r&&e.add(r)}return Array.from(e)},ny=e=>{const t=`${O2}`,n=e=>`${t}:${e}`,r=()=>L2().filter((e=>e.startsWith(`${t}:`))),i=e=>e.slice(t.length+1),s=ry(),a=e=>{try{return null==s?void 0:s.getItem(n(e))}catch{return null}},o=(e,t)=>{try{null==s||s.setItem(n(e),String(t))}catch{return}};return{getItem:a,setItem:o,removeItem:e=>{try{null==s||s.removeItem(n(e))}catch{return}},clear:()=>{try{r().forEach((e=>null==s?void 0:s.removeItem(e)))}catch{return}},keys:()=>r().map(i),has:e=>null!==a(e),getJSON:e=>{const t=a(e);if(null==t)return null;try{return JSON.parse(t)}catch{return null}},setJSON:(e,t)=>{try{o(e,JSON.stringify(t))}catch{return}}}},Fv=["debug","info","warn","error"],P2=(e,t)=>{const n=Fv.indexOf(e);return Fv.indexOf(t)>=n},Td=(e,t,n,...r)=>{P2(t,e)&&console.log(`[${e}] ${n}`,...r)},M2=()=>ny().getItem("logger_lvl"),U2=(e=(Zd()?"info":M2()||"warn"))=>{let t=e;return{debug:(e,...n)=>Td("debug",t,e,...n),info:(e,...n)=>Td("info",t,e,...n),warn:(e,...n)=>Td("warn",t,e,...n),error:(e,...n)=>(R2(e,...n),Td("error",t,e,...n)),setLevel:e=>{t=e},getLevel:()=>t}},Xs=U2(),j2=e=>{try{const{type:t,payload:n}=e,r={type:t};return void 0!==n&&(r.payload=JSON.parse(JSON.stringify(n))),r}catch(t){return Xs.warn(`Could not serialize action type: ${e.type}`,t),{type:e.type,payload:`[Non-serializable payload for action: ${e.type}]`}}},F2=e=>{const t=window.parent??window;if(t)try{const n=j2(e);t.postMessage(n,"*")}catch(e){Xs.error("Failed to process or send message:",e)}},iy=()=>ay()?location.hostname:location.hostname.replace(/\w\w\w\.|^/,"."),sy=e=>{const t=new Date;return t.setTime(t.getTime()+24*e*60*60*1e3),t.toUTCString()},oy=e=>Object.keys(e).reduce(((t,n)=>`${t}${n}${!0===e[n]?"":`=${e[n]}`};`),""),B2=(e,t)=>{const n=Zd()?"":document.cookie,r=`; ${t||n}`.split(`; ${e}=`);if(2===r.length)return(r.pop()||"").replace("=","").split(";").shift()},D2=(e,t)=>{Zd()||(document.cookie=oy({[e]:"",path:"/",domain:t||iy(),expires:"Thu, 01 Jan 1970 00:00:01 GMT"}))},W2=["localhost","127.0.0.1","dev.localtest.me","wellesleydev.localtest.me"],ay=()=>W2.includes(location.hostname),$2=(e,t="",n=10,r)=>{Zd()||(document.cookie=oy({[e]:t,path:"/",domain:r||iy(),expires:sy(n),...!ay()&&{SameSite:"None",Secure:!0}}))},ov={set:$2,remove:D2,get:B2,getExpireDate:sy},av="auth_token",uy=()=>ov.get(av)||void 0,z2=e=>ov.set(av,e),V2=()=>ov.remove(av),Z2=()=>!!uy(),q2={getToken:uy,setToken:z2,removeToken:V2,hasToken:Z2},Bv={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!q2.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},cy=Wa({name:"auth",initialState:Bv,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...Bv,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}}),H2=()=>{window.parent===window?k1().dispatch(cy.actions.setAskLoginOpen(!0)):F2(Tx())},gl=e=>{const t=lt(Gc.selectors.selectCurrentUser),n=lt(ro.selectors.selectIsAuthenticated),r="SUSPENDED"===(null==t?void 0:t.state),i=r;return{isDisabled:i,guardedAction:(e=()=>{})=>()=>{n?n&&!r&&e():H2()},ActionTooltipWrapper:({children:e,triggerClassname:n})=>i?S.jsx(M0,{theme:"dark",tooltipText:`${An(t)} is suspended`,size:"default",triggerClassname:n,children:S.jsx("div",{className:"!pointer-events-auto w-full",children:e})}):S.jsx(S.Fragment,{children:e})}},ly=({user:e,size:t="m",disabled:n,className:r,relationship:i,isRelationshipPending:s,onFollow:a,onUnfollow:o,followButtonText:u,unfollowButtonText:l})=>{const{follow:c,unfollow:d,renderGuestFollowModal:f}=H_({user:e,onFollow:a,onUnfollow:o}),p=Y0(e.id),{isDisabled:h,ActionTooltipWrapper:v}=gl();return p||s?null:S.jsxs("div",{"data-testid":"followControl",children:[f(),S.jsx(v,{triggerClassname:Fe("l"===t&&"w-full"),children:S.jsx(Q_,{user:e,size:t,disabled:n,className:r,follow:()=>{c()},unfollow:()=>{d()},disabled:h,relationship:i,isRelationshipPending:!1,followButtonText:u,unfollowButtonText:l})})]})},uv=e=>{var t;const n="REPOST"===e.type&&(null==(t=e.post)?void 0:t.text),r="COMMENT"===e.type,i="LIKE"===e.type,s="FOLLOW_REQUEST"===e.type,a="UNREAD"===e.status,o="FOLLOW"===e.type,u=o||s;return{isLike:i,isQuote:n,isReply:r,isUnread:a,isFollow:o,isEventRelated:"EVENT_INVITE"===e.type||"EVENT_JOIN"===e.type||"EVENT_CANCEL"===e.type||"EVENT_UPDATE"===e.type,isFollowRequest:s,isFollowingRelated:u}},G2=({isPopup:e,notification:t})=>{var n,r;const i=dl(),[s]=Uy(),[a]=jy(),o=t.fromUser,{relationship:u,isLoading:l}=g1({userId:null==o?void 0:o.id}),{isFollow:c,isFollowRequest:d}=uv(t),f=!(!o||!c),p=!(!o||!d),h=o?An(o):"",v=t.followResponse||(null==(r=null==(n=t.meta)?void 0:n.actionsTaken)?void 0:r[0].text);return S.jsxs(S.Fragment,{children:[f&&o&&S.jsx(ly,{size:"s",user:o,relationship:u,isRelationshipPending:l}),v?S.jsx("div",{className:Fe("text-s min-h-xl inline-flex min-w-[120px] items-center font-medium text-gray-500",!e&&"justify-end"),children:v.toUpperCase()}):p?S.jsxs("div",{className:"flex items-center gap-2","data-testid":"followControls",children:[S.jsx(wn,{size:"s",variant:"secondary",className:"min-w-[100px] px-3",onClick:()=>{o&&(a({username:h,user:o}),i(Kc.actions.updateNotification({...t,followResponse:"Rejected"})))},children:"Reject"}),S.jsx(wn,{size:"s",variant:"primary",className:Fe("min-w-[100px]",e&&"order-first"),onClick:()=>{o&&(s({username:h,user:o}),i(Kc.actions.updateNotification({...t,followResponse:"Accepted"})))},children:"Accept"})]}):null]})},Q2=e=>{const{user:t,isLoading:n}=y_(),{data:r,isLoading:i,error:s}=m1(e),a="userId"in e,{data:o,isLoading:u}=v1({userId:a?e.userId:"",htmlContent:e.htmlContent??!1,canFetch:!!a&&(e.canFetch??!0)});return[a&&o||r,"username"in e&&`@${null==t?void 0:t.username}`===e.username||a&&(null==t?void 0:t.id)===e.userId,n||i||a&&u,!!s]},fy={forever:0,"6h":21600,"12h":43200,"24h":86400,"7 days":604800,"30 days":2592e3},K2=({selected:e,onSelect:t})=>Object.keys(fy).map((n=>S.jsxs("span",{className:Fe("p-xxs gap-xxxs flex cursor-pointer rounded-full border border-gray-400 bg-transparent text-sm",{"border-gray-100 bg-gray-100":e===n}),onClick:()=>t(n),children:[e===n&&S.jsx(J1,{size:16}),"forever"===n?"Until I unmute":`For ${n}`]},n))),dy=({user:e,relationship:t,onMute:n,onUnmute:r})=>{const[i,{isLoading:s}]=_1(),[a,{isLoading:o}]=y1(),[u,l]=lr("forever"),c=e?An(e):"",[d,f,p]=G_(),h=x1(t);return{isLoading:s||o,isMuted:h,mute:f,unmute:()=>{e&&(a({userId:e.id}),Vt.success(`${c} is unmuted`),null==r||r())},renderMuteDialog:()=>e?S.jsxs(hl,{open:d,onCloseModal:p,title:`Do you want to mute ${e.username}?`,className:"p-none","data-testid":"mute-dialog",children:[S.jsx("span",{className:"text-sm text-gray-500",children:"Muted users can still follow you and see your content, but you will not see any content from them. They will not know that they have been muted."}),S.jsx("div",{className:"gap-xxxs mt-m flex",children:S.jsx(K2,{selected:u,onSelect:l})}),S.jsx(P0,{variant:"primary",onClick:()=>{(()=>{if(!e)return;const t=fy[u];i({userId:e.id,...t&&{duration:t}}),Vt.success(`${c} is muted`),p(),null==n||n()})()},isLoading:s,className:"mt-m ml-auto block","data-testid":"submitAction",children:"Mute"})]}):null,isMuteDialogOpened:d}};function hy(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=hy(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Y2(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=hy(e))&&(r&&(r+=" "),r+=t);return r}const Dv=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,q0=Y2,J2=(e,t)=>n=>{var r;if(null==(null==t?void 0:t.variants))return q0(e,null==n?void 0:n.class,null==n?void 0:n.className);const{variants:i,defaultVariants:s}=t,a=Object.keys(i).map((e=>{const t=null==n?void 0:n[e],r=null==s?void 0:s[e];if(null===t)return null;const a=Dv(t)||Dv(r);return i[e][a]})),o=n&&Object.entries(n).reduce(((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e}),{}),u=null==t||null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce(((e,t)=>{let{class:n,className:r,...i}=t;return Object.entries(i).every((e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...s,...o}[t]):{...s,...o}[t]===n}))?[...e,n,r]:e}),[]);return q0(e,a,u,null==n?void 0:n.class,null==n?void 0:n.className)},X2=J2("rounded-full",{variants:{size:{20:"size-5 text-[10px]",24:"size-6 text-[10px]",32:"size-8 text-sm",40:"size-10 text-base",48:"size-[48px] text-base",96:"size-[96px] text-[32px]"}},defaultVariants:{size:40}}),py=({name:e,imgUrl:t,size:n=40,className:r})=>{var i;return S.jsxs(Xy,{className:Fe(X2({size:n}),r),"data-testid":`userAvatar-${n}`,children:[t&&S.jsx(e1,{src:t,alt:"user-avatar"}),S.jsx("span",{className:"flex size-full items-center justify-center bg-gray-700 text-white",children:null==(i=null==e?void 0:e[0])?void 0:i.toUpperCase()})]})},eb={data:null,isPending:!1,isSuccess:!1},Ar=Wa({name:"userNoHTML",initialState:eb,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}}),gy="getApiV1UsersRelationships",tb=Ys.memoize(((e,t)=>Ks.util.selectCachedArgsForQuery(e,gy).find((e=>e.targets.includes(t))))),li=({state:e,userId:t,dispatch:n,relationsProps:r})=>{const i=tb(e,t);return i?n(Ks.util.updateQueryData(gy,i,(e=>{e[t]={...e[t],...r}}))):null},my=3,vy=64,Wv=5,$v=2,rb=30,nb=50,_y=30,qd={short:"Too short",long:"Too long"},cv=new RegExp("\\p{Extended_Pictographic}","u"),ib=({showInlineError:e=!0})=>ot.string().trim().min(1,e?"Username is required":"").min(2,e?"Must be at least 2 characters long":"").max(30,qd.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,"Only latin letters, digits, _ and . allowed"),sb=ot.string().trim().min(1,"Display name is required").max(50).regex(/^[^@]*$/,"@ is not allowed").superRefine(((e,t)=>{const n=cv.test(e),r=/[a-zA-Z0-9]/.test(e);n&&!r&&t.addIssue({code:ot.ZodIssueCode.custom,message:"Emojis alone are not allowed. Please add text"})})),ob=ot.string().max(1024,qd.long).optional(),yy=({minLength:e,minErrorMessage:t,maxLength:n,regexErrorMessage:r})=>ot.string().trim().min(e,t).max(n,qd.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,r);yy({minLength:2,maxLength:30,regexErrorMessage:"Invalid characters. ex.: group_name_1"}),yy({minLength:2,minErrorMessage:qd.short,maxLength:30,regexErrorMessage:"Invalid characters. ex.: channel_name_1"}),ot.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 ab="Required: A-Z, a-z, 0-9, special character, min 3, max 64";ot.string().trim().superRefine(((e,t)=>{cv.test(e)&&t.addIssue({code:ot.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>=3&&e.length<=64||t.addIssue({code:ot.ZodIssueCode.custom,message:ab})})),ot.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=>!cv.test(e)),"Emojis are not allowed"),ot.object({bio:ob,username:ib({showInlineError:!0}),displayName:sb}),ot.object({show:ot.boolean(),dateOnly:ot.boolean(),date:ot.date().optional().nullable()}),ot.object({show:ot.boolean(),dateOnly:ot.boolean(),date:ot.date().optional().nullable()});const zv=e=>{var t;const n=e,r=409===(null==n?void 0:n.status);return{message:"UserNameIsReserved"===(null==(t=null==n?void 0:n.data)?void 0:t.errorCode)?"Restricted words detected. Please, try alternatives":"Username already in use. Please, try another one",isError:r}},ub=Ks.enhanceEndpoints({endpoints:{deleteApiV1Users:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await Ve(n)&&await t(Ks.endpoints.getApiV1AccountsProfile.initiate({htmlContent:!1})).unwrap()}catch(e){Vt.error(`${Gs(e)}`)}}},getApiV1AccountsProfile:{providesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){t(j0(!0));try{const e=await Ve(n);e&&t(I_(e.data)),t(F0(!0))}catch(e){t(F0(!1)),t(E_(!0)),t(C_(e))}finally{t(j0(!1))}}},putApiV1UsersByUserId:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,Vt.success("User updated successfully")}catch(e){const t=e.error,{isError:n}=zv(t);!n&&Vt.error(`${Gs(t)}`)}}},getApiV1Users:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){const r=!e.htmlContent;try{r&&t(Ar.actions.setPending(!0));const e=await Ve(n);r&&e&&(t(Ar.actions.setUser(e.data)),t(Ar.actions.setSuccess(!0)),t(Ar.actions.setPending(!1)))}catch(e){r&&(t(Ar.actions.setSuccess(!1)),t(Ar.actions.setError(e)),t(Ar.actions.setPending(!1))),Vt.error(`${Gs(e)}`)}}},postApiV1Users:{invalidatesTags:["Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,Vt.success("User created successfully")}catch(e){const t=e.error,{isError:n}=zv(t);!n&&Vt.error(`${Gs(t)}`)}}},getApiV1UsersFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersRemoteByUserNameFullFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersByUserId:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){const r=!e.htmlContent;try{r&&t(Ar.actions.setPending(!0));const e=await Ve(n);r&&e&&(t(Ar.actions.setUser(e.data)),t(Ar.actions.setSuccess(!0)),t(Ar.actions.setPending(!1)))}catch(e){r&&(t(Ar.actions.setSuccess(!1)),t(Ar.actions.setError(e)),t(Ar.actions.setPending(!1))),Vt.error(`${Gs(e)}`)}}},getApiV1UsersByUserIdFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersFollowees:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersByUserIdFollowing:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},postApiV1UsersFollowByUsernameAccept:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n,getState:r}){const i=li({dispatch:n,userId:e.user.id,state:r(),relationsProps:{followed:"ACCEPTED"}});await Ve(t,`Accepted follow request from ${e.username}`,(()=>null==i?void 0:i.undo()))}},postApiV1UsersFollowByUsernameReject:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n,getState:r}){const i=li({dispatch:n,userId:e.user.id,state:r(),relationsProps:{followed:"REJECTED"}});await Ve(t,`Rejected follow request from ${e.username}`,(()=>null==i?void 0:i.undo()))}},postApiV1UsersFollowByUsername:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n}){await Ve(t,`Follow request sent to ${e.username}`)&&n(Ks.util.invalidateTags([{type:"Relationship",id:e.user.id}]))}},postApiV1UsersFollowByUsernameUndo:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n,getState:r}){const i=li({dispatch:n,userId:e.user.id,state:r(),relationsProps:{following:null}});await Ve(t,`You unfollowed ${e.username}`,(()=>null==i?void 0:i.undo()))}},getApiV1Block:{providesTags:["Follow"]},postApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=li({userId:e.userId,dispatch:r,state:n(),relationsProps:{blocked:!0}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},deleteApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=li({userId:e.userId,dispatch:r,state:n(),relationsProps:{blocked:!1,muted:{state:!1}}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},postApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:n,dispatch:r}){const i=li({userId:e,dispatch:r,state:n(),relationsProps:{muted:{state:!0}}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},deleteApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:n,dispatch:r}){const i=li({userId:e,dispatch:r,state:n(),relationsProps:{muted:{state:!1}}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},getApiV1Mute:{async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersRelationships:{providesTags:(e,t,{targets:n})=>n.map((e=>({type:"Relationship",id:e}))),async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},postApiV1AdminUserChangeState:{invalidatesTags:["Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t,`User ${e.changeUserState.userId} state changed to ${e.changeUserState.newState}`)}},putApiV1Notes:{async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const{userId:i,text:s}=e.noteUpdate,a=li({userId:i,dispatch:r,state:n(),relationsProps:{note:s}});await Ve(t,"Note has been updated",(()=>null==a?void 0:a.undo()))}},deleteApiV1NotesByUserId:{async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=li({userId:e.userId,dispatch:r,state:n(),relationsProps:{note:""}});await Ve(t,"Note has been removed",(()=>null==i?void 0:i.undo()))}},postApiV1UsersFollowByUsernamePend:{async onQueryStarted(e,{queryFulfilled:t}){await Ve(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:_S,usePostApiV1UsersMutation:yS,useDeleteApiV1AccountsDeleteMutation:xS,useGetApiV1AccountsProfileQuery:wS,usePutApiV1UsersByUserIdMutation:bS,useGetApiV1UsersQuery:AS,useDeleteApiV1UsersMutation:SS,usePostApiV1MuteByUserIdMutation:CS,useDeleteApiV1MuteByUserIdMutation:ES,useGetApiV1MuteQuery:IS,usePostApiV1AdminUserChangeStateMutation:kS,useGetApiV1UsersRelationshipsQuery:cb,usePutApiV1NotesMutation:TS,useDeleteApiV1NotesByUserIdMutation:NS,useLazyGetApiV1UsersRelationshipsQuery:lb,useLazyGetApiV1GeoQuery:RS,useGetApiV1UsersFollowersQuery:OS,useGetApiV1UsersByUserIdQuery:LS,useLazyGetApiV1GroupsAccountQuery:PS,useLazyGetApiV1UsersRenameHistoryQuery:MS,useGetApiV1UsersByUserIdFollowersQuery:US,usePostApiV1UsersFollowByUsernameMutation:jS,usePostApiV1UsersFollowByUsernameUndoMutation:FS,usePostApiV1UsersFollowByUsernameRejectMutation:BS,usePostApiV1UsersFollowByUsernameAcceptMutation:DS,useGetApiV1UsersRemoteByUserNameFullFollowersQuery:WS}=ub,fb=()=>{const e=lt(Gc.selectors.selectCurrentUser),t=lt(cy.selectors.selectIsAuthenticated);return{user:e,isLoading:lt(Gc.selectors.selectPending),isLogged:t,error:lt(Gc.selectors.selectError)}},xy=({onChange:e})=>{const{user:t}=fb(),n=null==t?void 0:t.id,r=gi(n);zn((()=>{r.current?n!==r.current&&(e(),r.current=n):r.current=n}),[n,r.current])},Vv=["following","followed","blocked","muted","note","blocked_by"],Zv=({userId:e,currentUserId:t})=>{const n="string"==typeof e,r=n?[e]:(null==e?void 0:e.filter((e=>e!==t)))||[],i=e===t;return{isSingleUser:n,canFetch:!(!r.length||i||!t),safeTargets:r}},wy=({userId:e,skip:t})=>{const n=lt(Gc.selectors.selectCurrentUser),r=null==n?void 0:n.id,{canFetch:i,isSingleUser:s,safeTargets:a}=Zv({userId:e,currentUserId:r}),{data:o,isLoading:u}=cb({targets:a,filter:Vv},{skip:!i||t}),[l]=lb(),c=({userId:e})=>{const{canFetch:t,safeTargets:n}=Zv({userId:e,currentUserId:r});t&&l({targets:n,filter:Vv})};return xy({onChange:()=>{c({userId:a})}}),{relationship:(s?null==o?void 0:o[e]:o)||{},isLoading:u,updateRelations:c}},db=e=>e.replace(/(<)/g,"<").replace(/>/g,">"),qv=(e,t)=>null!=t&&t.length?t.reduce(((e,t)=>e=e.replaceAll(new RegExp(`:${t.shortcode}:`,"g"),`<img class="custom-emoji" src="${t.staticUrl}" alt='emoji ${t.shortcode}'/>`)),e):e,hb={list:[]},pb=Wa({name:"emojis",initialState:hb,reducers:{addEmoji:(e,t)=>{e.list.push(t.payload)},addList:(e,t)=>{e.list=t.payload}},selectors:{selectEmojis:e=>e.list}}).injectInto(w_);var Hd=(e=>(e.header="header",e.avatar="avatar",e))(Hd||{});const lv=({user:e,type:t})=>{var n,r,i,s;if(!e)return"";try{return("avatar"===t?null==(r=null==(n=e.avatar)?void 0:n.files[0])?void 0:r.uri:null==(s=null==(i=e.header)?void 0:i.files[0])?void 0:s.uri)||""}catch{return""}},gb="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%209V0L0%2012H9C10.6569%2012%2012%2010.6569%2012%209Z'%20fill='white'/%3e%3cpath%20d='M0%203V12L12%200H3C1.34315%200%200%201.34315%200%203Z'%20fill='%23CBD5E1'/%3e%3c/svg%3e",mb="Enter",H0=52,vb=e=>{const[t,n]=lr((null==e?void 0:e.length)||0),r=gi(null),i=gi(null);return{inputRef:r,textareaRef:i,charCount:t,setCharCount:n,handleKeyDown:e=>{var t,n;e.key===mb&&(e.preventDefault(),null==(t=r.current)||t.blur(),null==(n=i.current)||n.blur())},handleTextareaChange:e=>{const t=e.target,r=t.value.length;n(r);const i=_b(t);setTimeout((()=>{if(t.style.height="52px",!i)return;const e=Math.max(t.scrollHeight,52);t.style.height=`${e}px`}),0)}}},_b=e=>{if(e instanceof HTMLTextAreaElement){const t=document.createElement("canvas").getContext("2d"),n=window.getComputedStyle(e);if(t){t.font=n.font||"16px sans-serif";const r=parseInt(n.paddingLeft||"0")||0,i=parseInt(n.paddingRight||"0")||0,s=e.clientWidth-r-i;return t.measureText(e.value).width>s}return e.scrollHeight>52}{const t=e.value.includes("\n"),n=e.scrollWidth>e.clientWidth;return t||n}},Hv=52,Zc=200,yb=10,xb=ot.object({note:ot.string().max(Zc)}),wb=({userId:e,note:t="",className:n,resizable:r=!1})=>{const[i]=w1(),[s]=b1(),a=lt(ro.selectors.selectIsAuthenticated),o=lt(J0.selectors.selectCurrentUser),u=(null==o?void 0:o.id)===e,l=e=>{const t=e.target.value;c(t)},c=async(t="")=>{t?await i({noteUpdate:{userId:e,text:t}}):await s({userId:e})},d=K0({resolver:U_(xb)}),{inputRef:f,textareaRef:p,charCount:h,setCharCount:v,handleTextareaChange:m,handleKeyDown:g}=vb(t);if(!u&&a)return S.jsx(f_,{...d,children:S.jsxs("form",{className:Fe("my-5",n),onKeyDown:g,children:[h>=190&&S.jsxs("div",{className:"mb-xxs text-right text-sm text-gray-400",children:[Zc-h," characters left"]}),S.jsx(d_,{control:d.control,name:"note",render:e=>S.jsxs("div",{className:"rounded-m relative flex items-center bg-gray-100 text-gray-700",children:[r?S.jsx("textarea",{...e,ref:p,maxLength:Zc,onBlur:l,onChange:m,defaultValue:t,placeholder:"Leave a note (visible only to you)",className:"scrollbar-hide p-s w-full resize-none border-0 bg-transparent text-base leading-5 outline-none [-ms-overflow-style:none] [scrollbar-width:none] focus:border-0 focus-visible:border-0 focus-visible:ring-0 focus-visible:ring-offset-0 disabled:opacity-[1] [&::-webkit-scrollbar]:hidden",style:{height:"52px"}}):S.jsx("input",{...e,ref:f,maxLength:Zc,onBlur:l,onChange:e=>{v(e.target.value.length)},defaultValue:t,placeholder:"Leave a note visible only to you",className:"p-s w-full border-0 bg-transparent focus-visible:outline-none disabled:opacity-[1]",style:{height:"52px"}}),S.jsx("img",{src:gb,alt:"user note",className:"absolute bottom-0 right-0"})]})})]})})},Gv=({status:e,iconOnly:t=!1,clasName:n})=>{const r="muted"===e?S.jsx(A_,{size:16}):S.jsx(S_,{size:16}),i="muted"===e?"text-brown outline-brown":"text-red-dark outline-red-dark";return S.jsxs("div",{className:Fe(i,"flex items-center gap-1 rounded-sm bg-white px-2 py-1 text-sm font-semibold outline",t&&"p-1",n),children:[r,!t&&Ys.capitalize(e)]})},bb=({children:e})=>S.jsx("span",{className:"line-clamp-2 block text-ellipsis whitespace-pre-wrap break-words text-left",children:e}),by=({user:e,status:t,skip:n=!1})=>{const r=lt(J0.selectors.selectCurrentUser),i=lt(ro.selectors.selectIsAuthenticated),s=!n&&i,a=null!=e&&e.domain?`@${e.username}@${e.domain}`:void 0,o=(null==e?void 0:e.id)||(null==r?void 0:r.id),u=!(t||!o||!s),l=!(!t||!i||u||!s||a),{data:c,isLoading:d}=A1({userNameFull:a},{skip:!a}),{data:f,isLoading:p}=S1({status:t},{skip:u||!l}),{data:h,isLoading:v}=C1({userId:o},{skip:l||!u});return[(u?[...h||[],...c||[]]:null)||f,p||v||d]},ts={followers:"followers",following:"following"},Ab=({user:e,showEmpty:t=!0,className:n,renderModal:r,...i})=>{const[s,a]=by({user:e}),[o,u]=lr({open:!1,tab:ts.followers}),{guardedAction:l,ActionTooltipWrapper:c}=gl(),d=(null==s?void 0:s.length)||0,f=1===d?"follower":"followers",p=(null==s?void 0:s.slice(0,3))||[];return a?S.jsx(p_,{className:"mx-auto mb-4 h-7 w-[200px]"}):0!==d||t?S.jsxs("div",{"data-testid":"user-followers",children:[o.open&&(null==r?void 0:r({user:e,tab:o.tab,isOpen:!0,onClose:()=>u((e=>({...e,open:!1}))),...i})),S.jsx(c,{children:S.jsxs("div",{onClick:l((()=>{u({tab:ts.followers,open:!0})})),className:Fe("mb-4 flex cursor-pointer items-center text-base font-medium text-gray-900",n),children:[p.length>0&&S.jsx("ul",{className:"mr-2 flex items-center",children:p.map(((e,t)=>S.jsx("li",{className:Fe("relative",t>0&&"-ml-2"),children:S.jsx("div",{className:"rounded-full bg-white p-0.5",children:S.jsx(x_,{size:24,name:e.displayName,imgUrl:lv({user:e,type:Hd.avatar})})})},e.id)))}),d," ",f]})})]}):null},Sb=({status:e,userId:t,skip:n=!1})=>{const r=lt(ro.selectors.selectIsAuthenticated),i=!!e&&r,{data:s,isLoading:a}=Fy({status:e},{skip:!i||n}),{data:o,isLoading:u}=By({userId:t},{skip:i||!t||!r||n});return{data:s||o,isLoading:a||u}},Cb=({userUrl:e})=>S.jsxs("div",{className:"flex w-full items-center justify-between",children:[S.jsxs("div",{className:"gap-xs flex items-center",children:[S.jsx("div",{className:"flex size-10 items-center justify-center rounded-full border border-gray-200",children:S.jsx(Ax,{size:20})}),S.jsxs("div",{className:"text-sm",children:[S.jsx("p",{className:"mb-xxxs font-semibold text-gray-900",children:"Some followers may not be visible"}),S.jsx("span",{className:"text-gray-400",children:"You can see more on the original server"})]})]}),S.jsx(l1,{baseUrl:e,children:S.jsx("a",{href:e,children:S.jsxs(wn,{variant:"secondary",className:"gap-xxs font-semibold",children:["See more followers ",S.jsx(yx,{})]})})})]}),Qv=({count:e=15,className:t,itemClassName:n})=>S.jsx("div",{"data-testid":"list-loader",className:Fe("gap-m ml-auto mr-auto flex max-w-[560px] flex-col",t),children:Array.from(Array(e).keys()).map(((e,t)=>S.jsx(p_,{className:Fe("rounded-m h-[50px] w-full",n)},t)))});var Kv,qc={exports:{}},Eb=qc.exports;
|
|
42
|
+
*/_e("remoteReady");const Tx=_e("askLogin");_e("reselectUser"),_e("requestLogout"),_e("setConfirmLeavePage"),_e("requestChangePath");const Nx=_e("wsSubscribe"),Rx=_e("wsUnSubscribe");_e("hostStoreConnect"),_e("remoteLogin"),_e("remoteLogout"),_e("wsOnMessage"),_e("setRouterPath"),_e("setDeviceType"),_e("setDeviceWidth");const C_=_e("setUserError"),E_=_e("setUserIsError"),j0=_e("setUserPending"),F0=_e("setUserSuccess"),I_=_e("setUserData"),Ox=_e("updateAccountData"),Lx=_e("updateUser"),k_=_e("addNotification"),T_=_e("markNotification"),N_=_e("setNotificationsError"),R_=_e("setNotificationsList"),B0=_e("setNotificationsPending"),O_=_e("setNotificationsTotalCount"),D0=_e("setNotificationsUnreadCount"),L_=_e("resetNotificationsState"),P_=_e("undoNotification");_e("setInstanceInfo"),_e("setInstanceInfoPending"),_e("setInstanceInfoError"),_e("setPlatformSettings"),_e("setProfileSettings"),_e("setGroupData"),_e("setGroupLoading"),l_("requestMicroFrontendFetch"),l_("sendMicroFrontendFetchResponse");const Px=Ks.enhanceEndpoints({endpoints:{getApiV1Notifications:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n,getState:r}){var i;t(B0(!0));try{const e=await Ve(n),s=(null==(i=r().user.data)?void 0:i.selectedUserId)||"";e&&t(R_({userId:s,list:e.data}))}catch(e){t(N_(e))}finally{t(B0(!1))}}},postApiV1NotificationsByIdMark:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await Ve(n),t(T_(e))}catch(e){Vt.error(`Mark notification error, ${e}`)}}},postApiV1NotificationsMarkAll:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){await Ve(n),t(D0(0))}},getApiV1NotificationsCount:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{const r=await Ve(n),i=!e.status;r&&t(i?O_(r.data):D0(r.data))}catch(e){Vt.error(`Error getting unread notifications count', ${e}`)}}}}}),{useGetApiV1NotificationsQuery:Mx,usePostApiV1NotificationsByIdMarkMutation:Ux,usePostApiV1NotificationsMarkAllMutation:gS,useGetApiV1NotificationsCountQuery:jx}=Px,Cv={data:{userId:"",list:[]},count:{},isPending:!1},Fx=e=>e,Bx=e=>e.error,Dx=e=>e.isPending,Wx=e=>{var t;return null==(t=e.count)?void 0:t.total},$x=e=>{var t;return null==(t=e.count)?void 0:t.unread},zx=e=>e.data.userId,X0=Q0(Fx,(e=>e.data.list)),Vx=Q0(X0,(e=>null==e?void 0:e.filter((e=>"UNREAD"===e.status)))),Zx=Q0(X0,(e=>null==e?void 0:e.at(-1))),Kc=Wa({name:"notifications",initialState:Cv,reducers:{updateNotification:(e,t)=>{var n;if(!e.data.list)return;const r=t.payload;e.data.list=null==(n=e.data.list)?void 0:n.map((e=>e.id===r.id?{...e,...r}:e))},readAll:e=>{var t;e.data.list&&(e.data.list=null==(t=e.data.list)?void 0:t.map((e=>({...e,status:"READ"}))))}},extraReducers:e=>{e.addCase(B0,((e,t)=>{e.isPending=t.payload})).addCase(N_,((e,t)=>{e.error=t.payload})).addCase(R_,((e,t)=>{const n=t.payload.userId,r=t.payload.list;e.data={userId:n,list:[...e.data.list||[],...r.filter((t=>{var n;return!(null!=(n=e.data.list)&&n.some((e=>e.id===t.id)))}))]}})).addCase(k_,((e,t)=>{e.count.unread=(e.count.unread||0)+1,e.data.list&&(e.data.list=[t.payload,...e.data.list||[]])})).addCase(T_,((e,t)=>{e.data.list&&(e.data.list=e.data.list.map((e=>e.id===t.payload.id?{...e,status:t.payload.status}:e)))})).addCase(O_,((e,t)=>{e.count.total=t.payload})).addCase(D0,((e,t)=>{e.count.unread=t.payload})).addCase(L_,(()=>Cv)).addCase(P_,((e,t)=>{var n,r,i;const s=t.payload;"UNREAD"===(null==(r=null==(n=e.data.list)?void 0:n.find((e=>e.id===s)))?void 0:r.status)&&e.count.unread&&(e.count.unread-=1),e.data.list=(null==(i=e.data.list)?void 0:i.filter((e=>e.id!==s)))||[]}))},selectors:{selectError:Bx,selectIsPending:Dx,selectTotalCount:Wx,selectUnreadCount:$x,selectNotifications:X0,selectUnreadNotifications:Vx,selectLastNotification:Zx,selectNotificationsOwner:zx}}),mS=()=>S.jsx($y,{position:"top-right",theme:"dark",limit:5,autoClose:5e3,containerId:"custom",hideProgressBar:!0,className:"custom-notifications"}),vS=(e,t)=>zy(e,{...t,containerId:"custom"});var Ev=function(e,t,n){if(e&&"reportValidity"in e){var r=U0(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},M_=function(e,t){var n=function(n){var r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Ev(r.ref,n,e):r.refs&&r.refs.forEach((function(t){return Ev(t,n,e)}))};for(var r in t.fields)n(r)},qx=function(e,t){t.shouldUseNativeValidation&&M_(e,t);var n={};for(var r in e){var i=U0(t.fields,r),s=Object.assign(e[r]||{},{ref:i&&i.ref});if(Hx(t.names||Object.keys(e),r)){var a=Object.assign({},U0(n,r));b0(a,"root",s),b0(n,r,a)}else b0(n,r,s)}return n},Hx=function(e,t){return e.some((function(e){return e.startsWith(t+".")}))},Gx=function(e,t){for(var n={};e.length;){var r=e[0],i=r.code,s=r.message,a=r.path.join(".");if(!n[a])if("unionErrors"in r){var o=r.unionErrors[0].errors[0];n[a]={message:o.message,type:o.code}}else n[a]={message:s,type:i};if("unionErrors"in r&&r.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var u=n[a].types,l=u&&u[r.code];n[a]=a1(a,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n},U_=function(e,t,n){return void 0===n&&(n={}),function(r,i,s){try{return Promise.resolve(function(i,a){try{var o=Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](r,t)).then((function(e){return s.shouldUseNativeValidation&&M_({},s),{errors:{},values:n.raw?r:e}}))}catch(e){return a(e)}return o&&o.then?o.then(void 0,a):o}(0,(function(e){if(null!=e.errors)return{values:{},errors:qx(Gx(e.errors,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)};throw e})))}catch(e){return Promise.reject(e)}}};const Qx=e=>{try{return e.startsWith("https")||e.startsWith("http")?new URL(e).origin:new URL(`https://${e}`).origin}catch{throw new Error("Error getting domain from entered URL")}},Kx=e=>{const t=e.links.find((e=>"http://ostatus.org/schema/1.0/subscribe"===e.rel));return null==t?void 0:t.template},Yx=({template:e,user:t})=>null==e?void 0:e.replace("{uri}",t.uri),Jx=async({url:e,...t})=>{const n=await fetch(e,t);if(!n.ok)throw new Error(n.statusText);if("PUT"===t.method)return;const r=await n.json(),i=r;if(i.errorCode)throw new Error(i.message);return r},Xx=({user:e})=>async({url:t})=>{const n=Qx(t);try{const t=`${n}/.well-known/webfinger?resource=${n}`,r=await Jx({url:t,headers:{Accept:"application/json"}});if(!r)return;const i=Kx(r),s=Yx({template:i,user:e});if(!s)throw new Error("Error getting follow link");window.open(s,"_self")}catch{window.open(`${n}/authorize_interaction?uri=${e.uri}`,"_self")}},ew=(e,t)=>{const n=e.at(0),r=(null==n?void 0:n.toUpperCase())===n&&"@"!==n,i=e.toLowerCase(),s=(null==t?void 0:t.toLowerCase())||"";if(!s)return e;const a=i.startsWith(s),o=i.replace(s,`<mark>${a?Ys.capitalize(s):t}</mark>`);return r&&a?o:Ys.capitalize(o)},Iv=e=>{e.preventDefault()},tw=e=>e?{onOpenAutoFocus:Iv,onCloseAutoFocus:Iv}:{},hl=({open:e,modal:t,children:n,onCloseModal:r,className:i,skipModalAutofocus:s=!1,...a})=>e?S.jsx(Vy,{open:e,modal:t,onOpenChange:e=>{e||null==r||r()},children:S.jsx(Zy,{className:Fe(i),closeSize:"small",closeVariant:"insideCard",onCloseModal:r,...a,...tw(s),childrenClassName:Fe("overflow-auto",a.title?"max-h-[calc(90vh-65px)]":"max-h-[90vh]",a.childrenClassName),children:n})}):null;var Ae,W0;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},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 n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},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}(Ae||(Ae={})),(W0||(W0={})).mergeShapes=(e,t)=>({...e,...t});const Q=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rs=e=>{switch(typeof e){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return isNaN(e)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"symbol":return Q.symbol;case"object":return Array.isArray(e)?Q.array:null===e?Q.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Q.promise:typeof Map<"u"&&e instanceof Map?Q.map:typeof Set<"u"&&e instanceof Set?Q.set:typeof Date<"u"&&e instanceof Date?Q.date:Q.object;default:return Q.unknown}},W=Ae.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"]),rw=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Or 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},n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){const n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof Or))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ae.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Or.create=e=>new Or(e);const ja=(e,t)=>{let n;switch(e.code){case W.invalid_type:n=e.received===Q.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ae.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ae.joinValues(e.keys,", ")}`;break;case W.invalid_union:n="Invalid input";break;case W.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ae.joinValues(e.options)}`;break;case W.invalid_enum_value:n=`Invalid enum value. Expected ${Ae.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:n="Invalid function arguments";break;case W.invalid_return_type:n="Invalid function return type";break;case W.invalid_date:n="Invalid date";break;case W.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ae.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case W.too_small:n="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 W.too_big:n="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 W.custom:n="Invalid input";break;case W.invalid_intersection_types:n="Intersection results could not be merged";break;case W.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ae.assertNever(e)}return{message:n}};let j_=ja;function nw(e){j_=e}function jd(){return j_}const Fd=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],a={...i,path:s};if(void 0!==i.message)return{...i,path:s,message:i.message};let o="";const u=r.filter((e=>!!e)).slice().reverse();for(const e of u)o=e(a,{data:t,defaultError:o}).message;return{...i,path:s,message:o}},iw=[];function G(e,t){const n=jd(),r=Fd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ja?void 0:ja].filter((e=>!!e))});e.common.issues.push(r)}class Yt{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return oe;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t){const t=await e.key,r=await e.value;n.push({key:t,value:r})}return Yt.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:i}=r;if("aborted"===t.status||"aborted"===i.status)return oe;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(typeof i.value<"u"||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}}const oe=Object.freeze({status:"aborted"}),Pa=e=>({status:"dirty",value:e}),fr=e=>({status:"valid",value:e}),$0=e=>"aborted"===e.status,z0=e=>"dirty"===e.status,Yc=e=>"valid"===e.status,Jc=e=>typeof Promise<"u"&&e instanceof Promise;function Bd(e,t,n,r){if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function F_(e,t,n,r,i){if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var J,zc,Vc;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(J||(J={}));class Vn{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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 kv=(e,t)=>{if(Yc(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 Or(e.common.issues);return this._error=t,this._error}}};function pe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{var s,a;const{message:o}=e;return"invalid_enum_value"===t.code?{message:o??i.defaultError}:typeof i.data>"u"?{message:null!==(s=o??r)&&void 0!==s?s:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(a=o??n)&&void 0!==a?a:i.defaultError}},description:i}}class ve{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 rs(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Yt,ctx:{common:e.parent.common,data:e.data,parsedType:rs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Jc(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rs(e)},i=this._parseSync({data:e,path:r.path,parent:r});return kv(r,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={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:rs(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(Jc(r)?r:Promise.resolve(r));return kv(n,i)}refine(e,t){const n=e=>"string"==typeof t||typeof t>"u"?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const i=e(t),s=()=>r.addIssue({code:W.custom,...n(t)});return typeof Promise<"u"&&i instanceof Promise?i.then((e=>!!e||(s(),!1))):!!i||(s(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new Sn({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return $n.create(this,this._def)}nullable(){return as.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bn.create(this,this._def)}promise(){return Ba.create(this,this._def)}or(e){return rl.create([this,e],this._def)}and(e){return nl.create(this,e,this._def)}transform(e){return new Sn({...pe(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ul({...pe(this._def),innerType:this,defaultValue:t,typeName:ne.ZodDefault})}brand(){return new ev({typeName:ne.ZodBranded,type:this,...pe(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new cl({...pe(this._def),innerType:this,catchValue:t,typeName:ne.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return pl.create(this,e)}readonly(){return ll.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const sw=/^c[^\s-]{8,}$/i,ow=/^[0-9a-z]+$/,aw=/^[0-9A-HJKMNP-TV-Z]{26}$/,uw=/^[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,cw=/^[a-z0-9_-]{21}$/i,lw=/^[-+]?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)?)??$/,fw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dw="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let T0;const hw=/^(?:(?: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])$/,pw=/^(([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})))$/,gw=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,B_="((\\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])))",mw=new RegExp(`^${B_}$`);function D_(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 vw(e){return new RegExp(`^${D_(e)}$`)}function W_(e){let t=`${B_}T${D_(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function _w(e,t){return!(("v4"!==t&&t||!hw.test(e))&&("v6"!==t&&t||!pw.test(e)))}class xn extends ve{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Q.string){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.string,received:t.parsedType}),oe}const t=new Yt;let n;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const i=e.data.length>r.value,s=e.data.length<r.value;(i||s)&&(n=this._getOrReturnCtx(e,n),i?G(n,{code:W.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&G(n,{code:W.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)fw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"email",code:W.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)T0||(T0=new RegExp(dw,"u")),T0.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"emoji",code:W.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)uw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"uuid",code:W.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)cw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"nanoid",code:W.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)sw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"cuid",code:W.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)ow.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"cuid2",code:W.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)aw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"ulid",code:W.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),G(n,{validation:"url",code:W.invalid_string,message:r.message}),t.dirty()}else"regex"===r.kind?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"regex",code:W.invalid_string,message:r.message}),t.dirty())):"trim"===r.kind?e.data=e.data.trim():"includes"===r.kind?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):"toLowerCase"===r.kind?e.data=e.data.toLowerCase():"toUpperCase"===r.kind?e.data=e.data.toUpperCase():"startsWith"===r.kind?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):"endsWith"===r.kind?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):"datetime"===r.kind?W_(r).test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:"datetime",message:r.message}),t.dirty()):"date"===r.kind?mw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:"date",message:r.message}),t.dirty()):"time"===r.kind?vw(r).test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:"time",message:r.message}),t.dirty()):"duration"===r.kind?lw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"duration",code:W.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?_w(e.data,r.version)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"ip",code:W.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?gw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"base64",code:W.invalid_string,message:r.message}),t.dirty()):Ae.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:W.invalid_string,...J.errToObj(n)})}_addCheck(e){return new xn({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...J.errToObj(e)})}url(e){return this._addCheck({kind:"url",...J.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...J.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...J.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...J.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...J.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...J.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...J.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...J.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...J.errToObj(e)})}datetime(e){var t,n;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!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...J.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,...J.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...J.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...J.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...J.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...J.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...J.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...J.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...J.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...J.errToObj(t)})}nonempty(e){return this.min(1,J.errToObj(e))}trim(){return new xn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new xn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new xn({...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 yw(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}xn.create=e=>{var t;return new xn({checks:[],typeName:ne.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...pe(e)})};class is extends ve{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)!==Q.number){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.number,received:t.parsedType}),oe}let t;const n=new Yt;for(const r of this._def.checks)"int"===r.kind?Ae.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:W.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"multipleOf"===r.kind?0!==yw(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_finite,message:r.message}),n.dirty()):Ae.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,J.toString(t))}gt(e,t){return this.setLimit("min",e,!1,J.toString(t))}lte(e,t){return this.setLimit("max",e,!0,J.toString(t))}lt(e,t){return this.setLimit("max",e,!1,J.toString(t))}setLimit(e,t,n,r){return new is({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:J.toString(r)}]})}_addCheck(e){return new is({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:J.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:J.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:J.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:J.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:J.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:J.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&&Ae.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}is.create=e=>new is({checks:[],typeName:ne.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...pe(e)});class ss extends ve{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)!==Q.bigint){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.bigint,received:t.parsedType}),oe}let t;const n=new Yt;for(const r of this._def.checks)"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),G(t,{code:W.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Ae.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,J.toString(t))}gt(e,t){return this.setLimit("min",e,!1,J.toString(t))}lte(e,t){return this.setLimit("max",e,!0,J.toString(t))}lt(e,t){return this.setLimit("max",e,!1,J.toString(t))}setLimit(e,t,n,r){return new ss({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:J.toString(r)}]})}_addCheck(e){return new ss({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:J.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:J.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:J.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:J.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:J.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}}ss.create=e=>{var t;return new ss({checks:[],typeName:ne.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...pe(e)})};class Xc extends ve{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Q.boolean){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.boolean,received:t.parsedType}),oe}return fr(e.data)}}Xc.create=e=>new Xc({typeName:ne.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...pe(e)});class eo extends ve{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Q.date){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.date,received:t.parsedType}),oe}if(isNaN(e.data.getTime())){return G(this._getOrReturnCtx(e),{code:W.invalid_date}),oe}const t=new Yt;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),G(n,{code:W.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Ae.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new eo({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:J.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:J.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}}eo.create=e=>new eo({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ne.ZodDate,...pe(e)});class Dd extends ve{_parse(e){if(this._getType(e)!==Q.symbol){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.symbol,received:t.parsedType}),oe}return fr(e.data)}}Dd.create=e=>new Dd({typeName:ne.ZodSymbol,...pe(e)});class el extends ve{_parse(e){if(this._getType(e)!==Q.undefined){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.undefined,received:t.parsedType}),oe}return fr(e.data)}}el.create=e=>new el({typeName:ne.ZodUndefined,...pe(e)});class tl extends ve{_parse(e){if(this._getType(e)!==Q.null){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.null,received:t.parsedType}),oe}return fr(e.data)}}tl.create=e=>new tl({typeName:ne.ZodNull,...pe(e)});class Fa extends ve{constructor(){super(...arguments),this._any=!0}_parse(e){return fr(e.data)}}Fa.create=e=>new Fa({typeName:ne.ZodAny,...pe(e)});class Js extends ve{constructor(){super(...arguments),this._unknown=!0}_parse(e){return fr(e.data)}}Js.create=e=>new Js({typeName:ne.ZodUnknown,...pe(e)});class mi extends ve{_parse(e){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.never,received:t.parsedType}),oe}}mi.create=e=>new mi({typeName:ne.ZodNever,...pe(e)});class Wd extends ve{_parse(e){if(this._getType(e)!==Q.undefined){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.void,received:t.parsedType}),oe}return fr(e.data)}}Wd.create=e=>new Wd({typeName:ne.ZodVoid,...pe(e)});class bn extends ve{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Q.array)return G(t,{code:W.invalid_type,expected:Q.array,received:t.parsedType}),oe;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(G(t,{code:e?W.too_big:W.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(G(t,{code:W.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(G(t,{code:W.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new Vn(t,e,t.path,n))))).then((e=>Yt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>r.type._parseSync(new Vn(t,e,t.path,n))));return Yt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new bn({...this._def,minLength:{value:e,message:J.toString(t)}})}max(e,t){return new bn({...this._def,maxLength:{value:e,message:J.toString(t)}})}length(e,t){return new bn({...this._def,exactLength:{value:e,message:J.toString(t)}})}nonempty(e){return this.min(1,e)}}function La(e){if(e instanceof st){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=$n.create(La(r))}return new st({...e._def,shape:()=>t})}return e instanceof bn?new bn({...e._def,type:La(e.element)}):e instanceof $n?$n.create(La(e.unwrap())):e instanceof as?as.create(La(e.unwrap())):e instanceof Zn?Zn.create(e.items.map((e=>La(e)))):e}bn.create=(e,t)=>new bn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...pe(t)});class st extends ve{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=Ae.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Q.object){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.object,received:t.parsedType}),oe}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof mi&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||s.push(e);const a=[];for(const e of i){const t=r[e],i=n.data[e];a.push({key:{status:"valid",value:e},value:t._parse(new Vn(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof mi){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)a.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&(G(n,{code:W.unrecognized_keys,keys:s}),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 s){const r=n.data[t];a.push({key:{status:"valid",value:t},value:e._parse(new Vn(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e})).then((e=>Yt.mergeObjectSync(t,e))):Yt.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return J.errToObj,new st({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,i,s,a;const o=null!==(s=null===(i=(r=this._def).errorMap)||void 0===i?void 0:i.call(r,t,n).message)&&void 0!==s?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=J.errToObj(e).message)&&void 0!==a?a:o}:{message:o}}}:{}})}strip(){return new st({...this._def,unknownKeys:"strip"})}passthrough(){return new st({...this._def,unknownKeys:"passthrough"})}extend(e){return new st({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new st({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ne.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new st({...this._def,catchall:e})}pick(e){const t={};return Ae.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new st({...this._def,shape:()=>t})}omit(e){const t={};return Ae.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new st({...this._def,shape:()=>t})}deepPartial(){return La(this)}partial(e){const t={};return Ae.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()})),new st({...this._def,shape:()=>t})}required(e){const t={};return Ae.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof $n;)e=e._def.innerType;t[n]=e}})),new st({...this._def,shape:()=>t})}keyof(){return $_(Ae.objectKeys(this.shape))}}st.create=(e,t)=>new st({shape:()=>e,unknownKeys:"strip",catchall:mi.create(),typeName:ne.ZodObject,...pe(t)}),st.strictCreate=(e,t)=>new st({shape:()=>e,unknownKeys:"strict",catchall:mi.create(),typeName:ne.ZodObject,...pe(t)}),st.lazycreate=(e,t)=>new st({shape:e,unknownKeys:"strip",catchall:mi.create(),typeName:ne.ZodObject,...pe(t)});class rl extends ve{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new Or(e.ctx.common.issues)));return G(t,{code:W.invalid_union,unionErrors:n}),oe}));{let e;const r=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"===s.status&&!e&&(e={result:s,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=r.map((e=>new Or(e)));return G(t,{code:W.invalid_union,unionErrors:i}),oe}}get options(){return this._def.options}}rl.create=(e,t)=>new rl({options:e,typeName:ne.ZodUnion,...pe(t)});const hi=e=>e instanceof sl?hi(e.schema):e instanceof Sn?hi(e.innerType()):e instanceof ol?[e.value]:e instanceof os?e.options:e instanceof al?Ae.objectValues(e.enum):e instanceof ul?hi(e._def.innerType):e instanceof el?[void 0]:e instanceof tl?[null]:e instanceof $n?[void 0,...hi(e.unwrap())]:e instanceof as?[null,...hi(e.unwrap())]:e instanceof ev||e instanceof ll?hi(e.unwrap()):e instanceof cl?hi(e._def.innerType):[];class Vd extends ve{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.object)return G(t,{code:W.invalid_type,expected:Q.object,received:t.parsedType}),oe;const n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(G(t,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const n of t){const t=hi(n.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new Vd({typeName:ne.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...pe(n)})}}function V0(e,t){const n=rs(e),r=rs(t);if(e===t)return{valid:!0,data:e};if(n===Q.object&&r===Q.object){const n=Ae.objectKeys(t),r=Ae.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of r){const r=V0(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===Q.array&&r===Q.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const i=V0(e[r],t[r]);if(!i.valid)return{valid:!1};n.push(i.data)}return{valid:!0,data:n}}return n===Q.date&&r===Q.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class nl extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if($0(e)||$0(r))return oe;const i=V0(e.value,r.value);return i.valid?((z0(e)||z0(r))&&t.dirty(),{status:t.value,value:i.data}):(G(n,{code:W.invalid_intersection_types}),oe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}nl.create=(e,t,n)=>new nl({left:e,right:t,typeName:ne.ZodIntersection,...pe(n)});class Zn extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.array)return G(n,{code:W.invalid_type,expected:Q.array,received:n.parsedType}),oe;if(n.data.length<this._def.items.length)return G(n,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe;!this._def.rest&&n.data.length>this._def.items.length&&(G(n,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new Vn(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>Yt.mergeArray(t,e))):Yt.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Zn({...this._def,rest:e})}}Zn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zn({items:e,typeName:ne.ZodTuple,rest:null,...pe(t)})};class il extends ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.object)return G(n,{code:W.invalid_type,expected:Q.object,received:n.parsedType}),oe;const r=[],i=this._def.keyType,s=this._def.valueType;for(const e in n.data)r.push({key:i._parse(new Vn(n,e,n.path,e)),value:s._parse(new Vn(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Yt.mergeObjectAsync(t,r):Yt.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new il(t instanceof ve?{keyType:e,valueType:t,typeName:ne.ZodRecord,...pe(n)}:{keyType:xn.create(),valueType:e,typeName:ne.ZodRecord,...pe(t)})}}class $d extends ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.map)return G(n,{code:W.invalid_type,expected:Q.map,received:n.parsedType}),oe;const r=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map((([e,t],s)=>({key:r._parse(new Vn(n,e,n.path,[s,"key"])),value:i._parse(new Vn(n,t,n.path,[s,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of s){const r=await n.key,i=await n.value;if("aborted"===r.status||"aborted"===i.status)return oe;("dirty"===r.status||"dirty"===i.status)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of s){const r=n.key,i=n.value;if("aborted"===r.status||"aborted"===i.status)return oe;("dirty"===r.status||"dirty"===i.status)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}$d.create=(e,t,n)=>new $d({valueType:t,keyType:e,typeName:ne.ZodMap,...pe(n)});class to extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.set)return G(n,{code:W.invalid_type,expected:Q.set,received:n.parsedType}),oe;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(G(n,{code:W.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(G(n,{code:W.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function s(e){const n=new Set;for(const r of e){if("aborted"===r.status)return oe;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const a=[...n.data.values()].map(((e,t)=>i._parse(new Vn(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>s(e))):s(a)}min(e,t){return new to({...this._def,minSize:{value:e,message:J.toString(t)}})}max(e,t){return new to({...this._def,maxSize:{value:e,message:J.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}to.create=(e,t)=>new to({valueType:e,minSize:null,maxSize:null,typeName:ne.ZodSet,...pe(t)});class Ma extends ve{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.function)return G(t,{code:W.invalid_type,expected:Q.function,received:t.parsedType}),oe;function n(e,n){return Fd({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,jd(),ja].filter((e=>!!e)),issueData:{code:W.invalid_arguments,argumentsError:n}})}function r(e,n){return Fd({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,jd(),ja].filter((e=>!!e)),issueData:{code:W.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Ba){const e=this;return fr((async function(...t){const a=new Or([]),o=await e._def.args.parseAsync(t,i).catch((e=>{throw a.addIssue(n(t,e)),a})),u=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(u,i).catch((e=>{throw a.addIssue(r(u,e)),a}))}))}{const e=this;return fr((function(...t){const a=e._def.args.safeParse(t,i);if(!a.success)throw new Or([n(t,a.error)]);const o=Reflect.apply(s,this,a.data),u=e._def.returns.safeParse(o,i);if(!u.success)throw new Or([r(o,u.error)]);return u.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ma({...this._def,args:Zn.create(e).rest(Js.create())})}returns(e){return new Ma({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Ma({args:e||Zn.create([]).rest(Js.create()),returns:t||Js.create(),typeName:ne.ZodFunction,...pe(n)})}}class sl extends ve{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})}}sl.create=(e,t)=>new sl({getter:e,typeName:ne.ZodLazy,...pe(t)});class ol extends ve{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return G(t,{received:t.data,code:W.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:e.data}}get value(){return this._def.value}}function $_(e,t){return new os({values:e,typeName:ne.ZodEnum,...pe(t)})}ol.create=(e,t)=>new ol({value:e,typeName:ne.ZodLiteral,...pe(t)});class os extends ve{constructor(){super(...arguments),zc.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return G(t,{expected:Ae.joinValues(n),received:t.parsedType,code:W.invalid_type}),oe}if(Bd(this,zc)||F_(this,zc,new Set(this._def.values)),!Bd(this,zc).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return G(t,{received:t.data,code:W.invalid_enum_value,options:n}),oe}return fr(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 os.create(e,{...this._def,...t})}exclude(e,t=this._def){return os.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}zc=new WeakMap,os.create=$_;class al extends ve{constructor(){super(...arguments),Vc.set(this,void 0)}_parse(e){const t=Ae.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Q.string&&n.parsedType!==Q.number){const e=Ae.objectValues(t);return G(n,{expected:Ae.joinValues(e),received:n.parsedType,code:W.invalid_type}),oe}if(Bd(this,Vc)||F_(this,Vc,new Set(Ae.getValidEnumValues(this._def.values))),!Bd(this,Vc).has(e.data)){const e=Ae.objectValues(t);return G(n,{received:n.data,code:W.invalid_enum_value,options:e}),oe}return fr(e.data)}get enum(){return this._def.values}}Vc=new WeakMap,al.create=(e,t)=>new al({values:e,typeName:ne.ZodNativeEnum,...pe(t)});class Ba extends ve{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.promise&&!1===t.common.async)return G(t,{code:W.invalid_type,expected:Q.promise,received:t.parsedType}),oe;const n=t.parsedType===Q.promise?t.data:Promise.resolve(t.data);return fr(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Ba.create=(e,t)=>new Ba({type:e,typeName:ne.ZodPromise,...pe(t)});class Sn extends ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{G(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===r.type){const e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return oe;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?oe:"dirty"===r.status||"dirty"===t.value?Pa(r.value):r}));{if("aborted"===t.value)return oe;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?oe:"dirty"===r.status||"dirty"===t.value?Pa(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,i);if(n.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===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?oe:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?oe:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Yc(e))return e;const s=r.transform(e.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>Yc(e)?Promise.resolve(r.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ae.assertNever(r)}}Sn.create=(e,t,n)=>new Sn({schema:e,typeName:ne.ZodEffects,effect:t,...pe(n)}),Sn.createWithPreprocess=(e,t,n)=>new Sn({schema:t,effect:{type:"preprocess",transform:e},typeName:ne.ZodEffects,...pe(n)});class $n extends ve{_parse(e){return this._getType(e)===Q.undefined?fr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}$n.create=(e,t)=>new $n({innerType:e,typeName:ne.ZodOptional,...pe(t)});class as extends ve{_parse(e){return this._getType(e)===Q.null?fr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}as.create=(e,t)=>new as({innerType:e,typeName:ne.ZodNullable,...pe(t)});class ul extends ve{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Q.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ul.create=(e,t)=>new ul({innerType:e,typeName:ne.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...pe(t)});class cl extends ve{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Jc(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Or(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Or(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}cl.create=(e,t)=>new cl({innerType:e,typeName:ne.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...pe(t)});class zd extends ve{_parse(e){if(this._getType(e)!==Q.nan){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.nan,received:t.parsedType}),oe}return{status:"valid",value:e.data}}}zd.create=e=>new zd({typeName:ne.ZodNaN,...pe(e)});const xw=Symbol("zod_brand");class ev extends ve{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class pl extends ve{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?oe:"dirty"===e.status?(t.dirty(),Pa(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?oe:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new pl({in:e,out:t,typeName:ne.ZodPipeline})}}class ll extends ve{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Yc(e)&&(e.value=Object.freeze(e.value)),e);return Jc(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function z_(e,t={},n){return e?Fa.create().superRefine(((r,i)=>{var s,a;if(!e(r)){const e="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,o=null===(a=null!==(s=e.fatal)&&void 0!==s?s:n)||void 0===a||a,u="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...u,fatal:o})}})):Fa.create()}ll.create=(e,t)=>new ll({innerType:e,typeName:ne.ZodReadonly,...pe(t)});const ww={object:st.lazycreate};var ne;!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"}(ne||(ne={}));const bw=(e,t={message:`Input not instance of ${e.name}`})=>z_((t=>t instanceof e),t),V_=xn.create,Z_=is.create,Aw=zd.create,Sw=ss.create,q_=Xc.create,Cw=eo.create,Ew=Dd.create,Iw=el.create,kw=tl.create,Tw=Fa.create,Nw=Js.create,Rw=mi.create,Ow=Wd.create,Lw=bn.create,Pw=st.create,Mw=st.strictCreate,Uw=rl.create,jw=Vd.create,Fw=nl.create,Bw=Zn.create,Dw=il.create,Ww=$d.create,$w=to.create,zw=Ma.create,Vw=sl.create,Zw=ol.create,qw=os.create,Hw=al.create,Gw=Ba.create,Tv=Sn.create,Qw=$n.create,Kw=as.create,Yw=Sn.createWithPreprocess,Jw=pl.create,Xw=()=>V_().optional(),e2=()=>Z_().optional(),t2=()=>q_().optional(),r2={string:e=>xn.create({...e,coerce:!0}),number:e=>is.create({...e,coerce:!0}),boolean:e=>Xc.create({...e,coerce:!0}),bigint:e=>ss.create({...e,coerce:!0}),date:e=>eo.create({...e,coerce:!0})},n2=oe;var ot=Object.freeze({__proto__:null,defaultErrorMap:ja,setErrorMap:nw,getErrorMap:jd,makeIssue:Fd,EMPTY_PATH:iw,addIssueToContext:G,ParseStatus:Yt,INVALID:oe,DIRTY:Pa,OK:fr,isAborted:$0,isDirty:z0,isValid:Yc,isAsync:Jc,get util(){return Ae},get objectUtil(){return W0},ZodParsedType:Q,getParsedType:rs,ZodType:ve,datetimeRegex:W_,ZodString:xn,ZodNumber:is,ZodBigInt:ss,ZodBoolean:Xc,ZodDate:eo,ZodSymbol:Dd,ZodUndefined:el,ZodNull:tl,ZodAny:Fa,ZodUnknown:Js,ZodNever:mi,ZodVoid:Wd,ZodArray:bn,ZodObject:st,ZodUnion:rl,ZodDiscriminatedUnion:Vd,ZodIntersection:nl,ZodTuple:Zn,ZodRecord:il,ZodMap:$d,ZodSet:to,ZodFunction:Ma,ZodLazy:sl,ZodLiteral:ol,ZodEnum:os,ZodNativeEnum:al,ZodPromise:Ba,ZodEffects:Sn,ZodTransformer:Sn,ZodOptional:$n,ZodNullable:as,ZodDefault:ul,ZodCatch:cl,ZodNaN:zd,BRAND:xw,ZodBranded:ev,ZodPipeline:pl,ZodReadonly:ll,custom:z_,Schema:ve,ZodSchema:ve,late:ww,get ZodFirstPartyTypeKind(){return ne},coerce:r2,any:Tw,array:Lw,bigint:Sw,boolean:q_,date:Cw,discriminatedUnion:jw,effect:Tv,enum:qw,function:zw,instanceof:bw,intersection:Fw,lazy:Vw,literal:Zw,map:Ww,nan:Aw,nativeEnum:Hw,never:Rw,null:kw,nullable:Kw,number:Z_,object:Pw,oboolean:t2,onumber:e2,optional:Qw,ostring:Xw,pipeline:Jw,preprocess:Yw,promise:Gw,record:Dw,set:$w,strictObject:Mw,string:V_,symbol:Ew,transformer:Tv,tuple:Bw,undefined:Iw,union:Uw,unknown:Nw,void:Ow,NEVER:n2,ZodIssueCode:W,quotelessJson:rw,ZodError:Or});const i2=ot.object({url:ot.string().min(1,"Field is required")}),s2=({open:e,user:t,onCloseModal:n})=>{const r=Xx({user:t}),i=c1(),[s,a]=lr(!0),o=K0({shouldFocusError:!1,mode:"onSubmit",resolver:U_(i2),defaultValues:{url:""}}),[u,{data:l}]=Ks.endpoints.getApiV1InstanceDomains.useLazyQuery(),c=e=>{!s&&a(!0),o.setValue("url",e),(e=>{s&&u({limit:20,domain:e,software:"mastodon"})})(e)},d=s&&!!o.getValues("url");return S.jsxs(hl,{open:e,onCloseModal:n,title:`You're not following @${t.username}`,children:[S.jsx(f_,{...o,children:S.jsxs("form",{className:"flex flex-col gap-3 md:mb-4 md:flex-row md:items-end",autoFocus:!1,onSubmit:(...e)=>{o.handleSubmit(r)(...e)},children:[S.jsx(d_,{control:o.control,name:"url",render:({field:e})=>S.jsxs(qy,{className:"mt-0 flex-1",children:[S.jsx(Hy,{className:"mb-2 block text-base",children:"Enter your server name to follow this user"}),S.jsxs("div",{className:"relative",children:[S.jsx(Gy,{children:S.jsx(h_,{"data-testid":"input",placeholder:"Server name",...e,onChange:e=>c(e.target.value)})}),S.jsx(Qy,{"data-testid":"command",children:S.jsx(Ky,{"data-testid":"list",className:"bg-background absolute z-50 mt-1 w-full rounded-md shadow-md empty:hidden",children:d&&(null==l?void 0:l.map((e=>S.jsx(Yy,{className:"w-full max-w-[unset] [&>div]:overflow-hidden [&>div]:text-ellipsis",onSelect:e=>{a(!1),o.setValue("url",e)},children:S.jsx("div",{dangerouslySetInnerHTML:{__html:ew(e,o.getValues("url"))}})},e))))})})]}),S.jsx(Jy,{className:"md:absolute"})]})}),S.jsx(wn,{type:"submit",variant:"primary",children:"Take me home"})]})}),S.jsxs("div",{children:[S.jsx("span",{className:"text-base text-gray-500",children:"Do not have an account yet?"}),S.jsx(wn,{"data-testid":"join",variant:"tertiary",className:"text-blue_100 ml-1 text-base",onClick:()=>{null==n||n(),i("/signin",{props:{redirectUrl:window.location.href}})},children:"Join Wellsley"})]})]})},An=e=>`@${e.username}${e.domain?`@${e.domain}`:""}`,H_=({user:e,onFollow:t,onUnfollow:n,unsubscribe:r})=>{const[i,s]=lr(!1),a=lt(ro.selectors.selectIsAuthenticated),[o]=f1(),[u]=d1(),l=null==e?void 0:e.domain,c={user:e,username:An(e),...l&&{domain:l}};return{follow:async()=>{a?await o(c):s(!0),null==t||t()},unfollow:async()=>{await u({mutual:r,...c}),null==n||n()},renderGuestFollowModal:()=>i?S.jsx(s2,{user:e,open:i,onCloseModal:()=>s(!1)}):null}},o2=({delay:e=0,defaultHover:t=!1,dependProps:n=[],leaveDelay:r=0}={})=>{const i=gi(null),[s,a]=lr(t),o=gi(null),u=gi(null),l=()=>{o.current&&clearTimeout(o.current),o.current=setTimeout((()=>{a(!0)}),e),u.current&&clearTimeout(u.current)},c=()=>{u.current&&clearTimeout(u.current),u.current=setTimeout((()=>{a(!1)}),r),o.current&&clearTimeout(o.current)};return zn((()=>()=>{o.current&&clearTimeout(o.current),u.current&&clearTimeout(u.current)}),[]),zn((()=>{const e=i.current;if(e)return e.addEventListener("mouseenter",l),e.addEventListener("mouseleave",c),()=>{e.removeEventListener("mouseenter",l),e.removeEventListener("mouseleave",c)}}),[i.current,...n]),[i,s,a]},a2=({open:e,title:t,children:n,leftButton:r,rightButton:i,onClose:s,titleTestId:a,...o})=>S.jsxs(hl,{open:e,onCloseModal:s,showClose:!1,className:"gap-none max-w-[400px] rounded-lg",...o,children:[S.jsx("h3",{className:"p-none mb-xxs text-center text-lg font-semibold text-gray-700","data-testid":a,children:t}),n&&S.jsx("div",{className:"text-center text-base text-gray-500",children:n}),S.jsxs("div",{className:"mt-m max-md:gap-s md:gap-m flex justify-center",children:[S.jsx(P0,{size:"m",variant:"secondary",className:"flex-1",...r,title:void 0,children:r.title}),i&&S.jsx(P0,{size:"m",className:"flex-1",...i,title:void 0,children:i.title})]})]}),u2=e=>!(null==e||!e.blocked),G_=(e=!1)=>{const[t,n]=lr(e);return[t,w0((()=>n(!0)),[]),w0((()=>n(!1)),[]),w0((()=>n((e=>!e))),[]),n]},tv=({user:e,relationship:t})=>{const[n,{isLoading:r}]=Py(),[i]=My(),[s,a,o]=G_(),u=u2(t);return[u,a,async()=>{try{await i({userId:e.id}).unwrap(),Vt.success(`${e.username} is unblocked`)}catch(e){Vt.error(`${Gs(e)}`)}},()=>S.jsx(a2,{open:s,title:`Do you want to block ${e.username}?`,onClose:o,"data-testid":"block-dialog",leftButton:{title:"Cancel",isLoading:!1,variant:"secondary",onClick:o},rightButton:{title:"Block",variant:"red_primary",isLoading:r,onClick:()=>{(async()=>{try{await n({userId:e.id}).unwrap(),Vt.success(`${e.username} is blocked`),o()}catch(e){Vt.error(`${Gs(e)}`)}})()}},children:"Blocked users will not be able to follow you or see your content, and you will not see any content from them. They will also be aware that they have been blocked."}),s]},Q_=({size:e,user:t,follow:n,unfollow:r,disabled:i,relationship:s,isRelationshipPending:a,className:o,followButtonText:u,unfollowButtonText:l})=>{const[c,,d]=tv({user:t,relationship:s}),f=h1(s)?"Follow back":u||"Follow",p=l||"Unfollow",h=p1(s),v=pv(s),[m,g]=o2(),y=h&&!g||v;if(!a)return S.jsx(wn,{ref:m,"data-testid":"followBtn",onClick:c?d:v||h?r:n,size:e,className:Fe("rounded-m px-xs w-[100%] min-w-[130px] md:max-w-[300px] lg:max-w-full",!pv&&"bg-gray-700",o),variant:c?"secondary_danger":y?"secondary":"primary",disabled:i,children:c?"Unblock":h?g?"Cancel follow request":"Follow Pending":v?p:f})},Nv={data:null,isError:!1,isPending:!1,isSuccess:!1},Gc=Wa({name:"user",initialState:Nv,reducers:{reset:e=>{Object.assign(e,Nv)}},extraReducers:e=>{e.addCase(I_,((e,{payload:t})=>{e.data=t})).addCase(Ox,((e,{payload:t})=>{e.data&&Object.assign(e.data,t||{})})).addCase(F0,((e,{payload:t})=>{e.isSuccess=t})).addCase(j0,((e,{payload:t})=>{e.isPending=t})).addCase(E_,((e,{payload:t})=>{e.isError=t})).addCase(C_,((e,{payload:t})=>{e.error=t})).addCase(Lx,((e,{payload:t})=>{var n;null!=(n=e.data)&&n.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 n;return null==(n=e.data)?void 0:n.users.find((({id:e})=>e===t))},selectCurrentUser:e=>{var t;return null==(t=e.data)?void 0:t.users.find((({id:t})=>{var n;return t===(null==(n=e.data)?void 0:n.selectedUserId)}))},selectSelectedUserId:e=>{var t;return null==(t=e.data)?void 0:t.selectedUserId},selectSuccess:e=>e.isSuccess}}),Qc="8.48.0",vi=globalThis;function rv(e,t,n){const r=vi,i=r.__SENTRY__=r.__SENTRY__||{},s=i[Qc]=i[Qc]||{};return s[e]||(s[e]=t())}const K_=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,c2="Sentry Logger ",Rv=["debug","info","warn","error","log","assert","trace"],Ov={};function l2(e){if(!("console"in vi))return e();const t=vi.console,n={},r=Object.keys(Ov);r.forEach((e=>{const r=Ov[e];n[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{t[e]=n[e]}))}}function f2(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return K_?Rv.forEach((n=>{t[n]=(...t)=>{e&&l2((()=>{vi.console[n](`${c2}[${n}]:`,...t)}))}})):Rv.forEach((e=>{t[e]=()=>{}})),t}const Md=rv("logger",f2);function nv(){return iv(vi),vi}function iv(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Qc,t[Qc]=t[Qc]||{}}const d2=Object.prototype.toString;function h2(e,t){return d2.call(e)===`[object ${t}]`}function p2(e){return h2(e,"Object")}function g2(e){return!(!e||!e.then||"function"!=typeof e.then)}function m2(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{K_&&Md.log(`Failed to add non-enumerable property "${t}" to object`,e)}}const Y_=1e3;function J_(){return Date.now()/Y_}function v2(){const{performance:e}=vi;if(!e||!e.now)return J_;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/Y_}const _2=v2();function Ua(){const e=vi,t=e.crypto||e.msCrypto;let n=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(n=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(e=>(e^(15&n())>>e/4).toString(16)))}function y2(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||_2(),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:Ua()),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 Lv(){return Ua()}function Pv(){return Ua().substring(16)}function X_(e,t,n=2){if(!t||"object"!=typeof t||n<=0)return t;if(e&&t&&0===Object.keys(t).length)return e;const r={...e};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=X_(r[e],t[e],n-1));return r}(()=>{const{performance:e}=vi;if(!e||!e.now)return;const t=36e5,n=e.now(),r=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,s=i<t,a=e.timing&&e.timing.navigationStart,o="number"==typeof a?Math.abs(a+n-r):t;(s||o<t)&&(i<=o&&e.timeOrigin)})();const Z0="_sentrySpan";function Mv(e,t){t?m2(e,Z0,t):delete e[Z0]}function Uv(e){return e[Z0]}const x2=100;class sv{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:Lv(),spanId:Pv()}}clone(){const e=new sv;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,Mv(e,Uv(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&&y2(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,[n,r]=t instanceof fl?[t.getScopeData(),t.getRequestSession()]:p2(t)?[e,e.requestSession]:[],{tags:i,extra:s,user:a,contexts:o,level:u,fingerprint:l=[],propagationContext:c}=n||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...s},this._contexts={...this._contexts,...o},a&&Object.keys(a).length&&(this._user=a),u&&(this._level=u),l.length&&(this._fingerprint=l),c&&(this._propagationContext=c),r&&(this._requestSession=r),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,Mv(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Lv()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:x2;if(n<=0)return this;const r={timestamp:J_(),...e},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>n?i.slice(-n):i,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:Uv(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=X_(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:Pv(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:Ua();if(!this._client)return Md.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n&&n.event_id?n.event_id:Ua();if(!this._client)return Md.warn("No client configured on scope - will not capture message!"),r;const i=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:Ua();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(Md.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}const fl=sv;function w2(){return rv("defaultCurrentScope",(()=>new fl))}function b2(){return rv("defaultIsolationScope",(()=>new fl))}class A2{constructor(e,t){let n,r;n=e||new fl,r=t||new fl,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){const t=this._pushScope();let n;try{n=e(t)}catch(e){throw this._popScope(),e}return g2(n)?n.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),n)}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 Da(){const e=iv(nv());return e.stack=e.stack||new A2(w2(),b2())}function S2(e){return Da().withScope(e)}function C2(e,t){const n=Da();return n.withScope((()=>(n.getStackTop().scope=e,t(e))))}function jv(e){return Da().withScope((()=>e(Da().getIsolationScope())))}function E2(){return{withIsolationScope:jv,withScope:S2,withSetScope:C2,withSetIsolationScope:(e,t)=>jv(t),getCurrentScope:()=>Da().getScope(),getIsolationScope:()=>Da().getIsolationScope()}}function ey(e){const t=iv(e);return t.acs?t.acs:E2()}function ty(){return ey(nv()).getCurrentScope()}function I2(){return ey(nv()).getIsolationScope()}function k2(e,t){return ty().captureException(e,void 0)}function T2(e,t){const n={captureContext:t};return ty().captureMessage(e,void 0,n)}function N2(e,t){I2().setExtra(e,t)}const R2=(...e)=>{let t="";for(const n of e){if(n instanceof Error){const e=n;return N2("exceptionMessage",t),void k2(e)}if("object"!=typeof n)t+=n;else try{t+=" "+JSON.stringify(n)}catch{t+=" "+n}}T2(t)},Zd=()=>"object"!=typeof window,O2="wlsy",ry=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},L2=()=>{const e=new Set,t=ry();if(!t)return[];for(let n=0;n<(null==t?void 0:t.length);n+=1){const r=null==t?void 0:t.key(n);"string"==typeof r&&e.add(r)}return Array.from(e)},ny=e=>{const t=`${O2}`,n=e=>`${t}:${e}`,r=()=>L2().filter((e=>e.startsWith(`${t}:`))),i=e=>e.slice(t.length+1),s=ry(),a=e=>{try{return null==s?void 0:s.getItem(n(e))}catch{return null}},o=(e,t)=>{try{null==s||s.setItem(n(e),String(t))}catch{return}};return{getItem:a,setItem:o,removeItem:e=>{try{null==s||s.removeItem(n(e))}catch{return}},clear:()=>{try{r().forEach((e=>null==s?void 0:s.removeItem(e)))}catch{return}},keys:()=>r().map(i),has:e=>null!==a(e),getJSON:e=>{const t=a(e);if(null==t)return null;try{return JSON.parse(t)}catch{return null}},setJSON:(e,t)=>{try{o(e,JSON.stringify(t))}catch{return}}}},Fv=["debug","info","warn","error"],P2=(e,t)=>{const n=Fv.indexOf(e);return Fv.indexOf(t)>=n},Td=(e,t,n,...r)=>{P2(t,e)&&console.log(`[${e}] ${n}`,...r)},M2=()=>ny().getItem("logger_lvl"),U2=(e=(Zd()?"info":M2()||"warn"))=>{let t=e;return{debug:(e,...n)=>Td("debug",t,e,...n),info:(e,...n)=>Td("info",t,e,...n),warn:(e,...n)=>Td("warn",t,e,...n),error:(e,...n)=>(R2(e,...n),Td("error",t,e,...n)),setLevel:e=>{t=e},getLevel:()=>t}},Xs=U2(),j2=e=>{try{const{type:t,payload:n}=e,r={type:t};return void 0!==n&&(r.payload=JSON.parse(JSON.stringify(n))),r}catch(t){return Xs.warn(`Could not serialize action type: ${e.type}`,t),{type:e.type,payload:`[Non-serializable payload for action: ${e.type}]`}}},F2=e=>{const t=window.parent??window;if(t)try{const n=j2(e);t.postMessage(n,"*")}catch(e){Xs.error("Failed to process or send message:",e)}},iy=()=>ay()?location.hostname:location.hostname.replace(/\w\w\w\.|^/,"."),sy=e=>{const t=new Date;return t.setTime(t.getTime()+24*e*60*60*1e3),t.toUTCString()},oy=e=>Object.keys(e).reduce(((t,n)=>`${t}${n}${!0===e[n]?"":`=${e[n]}`};`),""),B2=(e,t)=>{const n=Zd()?"":document.cookie,r=`; ${t||n}`.split(`; ${e}=`);if(2===r.length)return(r.pop()||"").replace("=","").split(";").shift()},D2=(e,t)=>{Zd()||(document.cookie=oy({[e]:"",path:"/",domain:t||iy(),expires:"Thu, 01 Jan 1970 00:00:01 GMT"}))},W2=["localhost","127.0.0.1","dev.localtest.me","wellesleydev.localtest.me"],ay=()=>W2.includes(location.hostname),$2=(e,t="",n=10,r)=>{Zd()||(document.cookie=oy({[e]:t,path:"/",domain:r||iy(),expires:sy(n),...!ay()&&{SameSite:"None",Secure:!0}}))},ov={set:$2,remove:D2,get:B2,getExpireDate:sy},av="auth_token",uy=()=>ov.get(av)||void 0,z2=e=>ov.set(av,e),V2=()=>ov.remove(av),Z2=()=>!!uy(),q2={getToken:uy,setToken:z2,removeToken:V2,hasToken:Z2},Bv={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!q2.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},cy=Wa({name:"auth",initialState:Bv,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...Bv,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}}),H2=()=>{window.parent===window?k1().dispatch(cy.actions.setAskLoginOpen(!0)):F2(Tx())},gl=e=>{const t=lt(Gc.selectors.selectCurrentUser),n=lt(ro.selectors.selectIsAuthenticated),r="SUSPENDED"===(null==t?void 0:t.state),i=r;return{isDisabled:i,guardedAction:(e=()=>{})=>()=>{n?n&&!r&&e():H2()},ActionTooltipWrapper:({children:e,triggerClassname:n})=>i?S.jsx(M0,{theme:"dark",tooltipText:`${An(t)} is suspended`,size:"default",triggerClassname:n,children:S.jsx("div",{className:"!pointer-events-auto w-full",children:e})}):S.jsx(S.Fragment,{children:e})}},ly=({user:e,size:t="m",disabled:n,className:r,relationship:i,isRelationshipPending:s,onFollow:a,onUnfollow:o,followButtonText:u,unfollowButtonText:l})=>{const{follow:c,unfollow:d,renderGuestFollowModal:f}=H_({user:e,onFollow:a,onUnfollow:o}),p=Y0(e.id),{isDisabled:h,ActionTooltipWrapper:v}=gl();return p||s?null:S.jsxs("div",{"data-testid":"followControl",children:[f(),S.jsx(v,{triggerClassname:Fe("l"===t&&"w-full"),children:S.jsx(Q_,{user:e,size:t,disabled:n,className:r,follow:()=>{c()},unfollow:()=>{d()},disabled:h,relationship:i,isRelationshipPending:!1,followButtonText:u,unfollowButtonText:l})})]})},uv=e=>{var t;const n="REPOST"===e.type&&(null==(t=e.post)?void 0:t.text),r="COMMENT"===e.type,i="LIKE"===e.type,s="FOLLOW_REQUEST"===e.type,a="UNREAD"===e.status,o="FOLLOW"===e.type,u=o||s;return{isLike:i,isQuote:n,isReply:r,isUnread:a,isFollow:o,isEventRelated:"EVENT_INVITE"===e.type||"EVENT_JOIN"===e.type||"EVENT_CANCEL"===e.type||"EVENT_UPDATE"===e.type,isFollowRequest:s,isFollowingRelated:u}},G2=({isPopup:e,notification:t})=>{var n,r;const i=dl(),[s]=Uy(),[a]=jy(),o=t.fromUser,{relationship:u,isLoading:l}=g1({userId:null==o?void 0:o.id}),{isFollow:c,isFollowRequest:d}=uv(t),f=!(!o||!c),p=!(!o||!d),h=o?An(o):"",v=t.followResponse||(null==(r=null==(n=t.meta)?void 0:n.actionsTaken)?void 0:r[0].text);return S.jsxs(S.Fragment,{children:[f&&o&&S.jsx(ly,{size:"s",user:o,relationship:u,isRelationshipPending:l}),v?S.jsx("div",{className:Fe("text-s min-h-xl inline-flex min-w-[120px] items-center font-medium text-gray-500",!e&&"justify-end"),children:v.toUpperCase()}):p?S.jsxs("div",{className:"flex items-center gap-2","data-testid":"followControls",children:[S.jsx(wn,{size:"s",variant:"secondary",className:"min-w-[100px] px-3",onClick:()=>{o&&(a({username:h,user:o}),i(Kc.actions.updateNotification({...t,followResponse:"Rejected"})))},children:"Reject"}),S.jsx(wn,{size:"s",variant:"primary",className:Fe("min-w-[100px]",e&&"order-first"),onClick:()=>{o&&(s({username:h,user:o}),i(Kc.actions.updateNotification({...t,followResponse:"Accepted"})))},children:"Accept"})]}):null]})},Q2=e=>{const{user:t,isLoading:n}=y_(),{data:r,isLoading:i,error:s}=m1(e),a="userId"in e,{data:o,isLoading:u}=v1({userId:a?e.userId:"",htmlContent:e.htmlContent??!1,canFetch:!!a&&(e.canFetch??!0)});return[a&&o||r,"username"in e&&`@${null==t?void 0:t.username}`===e.username||a&&(null==t?void 0:t.id)===e.userId,n||i||a&&u,!!s]},fy={forever:0,"6h":21600,"12h":43200,"24h":86400,"7 days":604800,"30 days":2592e3},K2=({selected:e,onSelect:t})=>Object.keys(fy).map((n=>S.jsxs("span",{className:Fe("p-xxs gap-xxxs flex cursor-pointer rounded-full border border-gray-400 bg-transparent text-sm",{"border-gray-100 bg-gray-100":e===n}),onClick:()=>t(n),children:[e===n&&S.jsx(J1,{size:16}),"forever"===n?"Until I unmute":`For ${n}`]},n))),dy=({user:e,relationship:t,onMute:n,onUnmute:r})=>{const[i,{isLoading:s}]=_1(),[a,{isLoading:o}]=y1(),[u,l]=lr("forever"),c=e?An(e):"",[d,f,p]=G_(),h=x1(t);return{isLoading:s||o,isMuted:h,mute:f,unmute:()=>{e&&(a({userId:e.id}),Vt.success(`${c} is unmuted`),null==r||r())},renderMuteDialog:()=>e?S.jsxs(hl,{open:d,onCloseModal:p,title:`Do you want to mute ${e.username}?`,className:"p-none","data-testid":"mute-dialog",children:[S.jsx("span",{className:"text-sm text-gray-500",children:"Muted users can still follow you and see your content, but you will not see any content from them. They will not know that they have been muted."}),S.jsx("div",{className:"gap-xxxs mt-m flex",children:S.jsx(K2,{selected:u,onSelect:l})}),S.jsx(P0,{variant:"primary",onClick:()=>{(()=>{if(!e)return;const t=fy[u];i({userId:e.id,...t&&{duration:t}}),Vt.success(`${c} is muted`),p(),null==n||n()})()},isLoading:s,className:"mt-m ml-auto block","data-testid":"submitAction",children:"Mute"})]}):null,isMuteDialogOpened:d}};function hy(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=hy(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Y2(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=hy(e))&&(r&&(r+=" "),r+=t);return r}const Dv=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,q0=Y2,J2=(e,t)=>n=>{var r;if(null==(null==t?void 0:t.variants))return q0(e,null==n?void 0:n.class,null==n?void 0:n.className);const{variants:i,defaultVariants:s}=t,a=Object.keys(i).map((e=>{const t=null==n?void 0:n[e],r=null==s?void 0:s[e];if(null===t)return null;const a=Dv(t)||Dv(r);return i[e][a]})),o=n&&Object.entries(n).reduce(((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e}),{}),u=null==t||null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce(((e,t)=>{let{class:n,className:r,...i}=t;return Object.entries(i).every((e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...s,...o}[t]):{...s,...o}[t]===n}))?[...e,n,r]:e}),[]);return q0(e,a,u,null==n?void 0:n.class,null==n?void 0:n.className)},X2=J2("rounded-full",{variants:{size:{20:"size-5 text-[10px]",24:"size-6 text-[10px]",32:"size-8 text-sm",40:"size-10 text-base",48:"size-[48px] text-base",96:"size-[96px] text-[32px]"}},defaultVariants:{size:40}}),py=({name:e,imgUrl:t,size:n=40,className:r})=>{var i;return S.jsxs(Xy,{className:Fe(X2({size:n}),r),"data-testid":`userAvatar-${n}`,children:[t&&S.jsx(e1,{src:t,alt:"user-avatar"}),S.jsx("span",{className:"flex size-full items-center justify-center bg-gray-700 text-white",children:null==(i=null==e?void 0:e[0])?void 0:i.toUpperCase()})]})},eb={data:null,isPending:!1,isSuccess:!1},Ar=Wa({name:"userNoHTML",initialState:eb,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}}),gy="getApiV1UsersRelationships",tb=Ys.memoize(((e,t)=>Ks.util.selectCachedArgsForQuery(e,gy).find((e=>e.targets.includes(t))))),li=({state:e,userId:t,dispatch:n,relationsProps:r})=>{const i=tb(e,t);return i?n(Ks.util.updateQueryData(gy,i,(e=>{e[t]={...e[t],...r}}))):null},my=3,vy=64,Wv=5,$v=2,rb=30,nb=50,_y=30,qd={short:"Too short",long:"Too long"},cv=new RegExp("\\p{Extended_Pictographic}","u"),ib=({showInlineError:e=!0})=>ot.string().trim().min(1,e?"Username is required":"").min(2,e?"Must be at least 2 characters long":"").max(30,qd.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,"Only latin letters, digits, _ and . allowed"),sb=ot.string().trim().min(1,"Display name is required").max(50).regex(/^[^@]*$/,"@ is not allowed").superRefine(((e,t)=>{const n=cv.test(e),r=/[a-zA-Z0-9]/.test(e);n&&!r&&t.addIssue({code:ot.ZodIssueCode.custom,message:"Emojis alone are not allowed. Please add text"})})),ob=ot.string().max(1024,qd.long).optional(),yy=({minLength:e,minErrorMessage:t,maxLength:n,regexErrorMessage:r})=>ot.string().trim().min(e,t).max(n,qd.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,r);yy({minLength:2,maxLength:30,regexErrorMessage:"Invalid characters. ex.: group_name_1"}),yy({minLength:2,minErrorMessage:qd.short,maxLength:30,regexErrorMessage:"Invalid characters. ex.: channel_name_1"}),ot.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 ab="Required: A-Z, a-z, 0-9, special character, min 3, max 64";ot.string().trim().superRefine(((e,t)=>{cv.test(e)&&t.addIssue({code:ot.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>=3&&e.length<=64||t.addIssue({code:ot.ZodIssueCode.custom,message:ab})})),ot.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=>!cv.test(e)),"Emojis are not allowed"),ot.object({bio:ob,username:ib({showInlineError:!0}),displayName:sb}),ot.object({show:ot.boolean(),dateOnly:ot.boolean(),date:ot.date().optional().nullable()}),ot.object({show:ot.boolean(),dateOnly:ot.boolean(),date:ot.date().optional().nullable()});const zv=e=>{var t;const n=e,r=409===(null==n?void 0:n.status);return{message:"UserNameIsReserved"===(null==(t=null==n?void 0:n.data)?void 0:t.errorCode)?"Restricted words detected. Please, try alternatives":"Username already in use. Please, try another one",isError:r}},ub=Ks.enhanceEndpoints({endpoints:{deleteApiV1Users:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await Ve(n)&&await t(Ks.endpoints.getApiV1AccountsProfile.initiate({htmlContent:!1})).unwrap()}catch(e){Vt.error(`${Gs(e)}`)}}},getApiV1AccountsProfile:{providesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){t(j0(!0));try{const e=await Ve(n);e&&t(I_(e.data)),t(F0(!0))}catch(e){t(F0(!1)),t(E_(!0)),t(C_(e))}finally{t(j0(!1))}}},putApiV1UsersByUserId:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,Vt.success("User updated successfully")}catch(e){const t=e.error,{isError:n}=zv(t);!n&&Vt.error(`${Gs(t)}`)}}},getApiV1Users:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){const r=!e.htmlContent;try{r&&t(Ar.actions.setPending(!0));const e=await Ve(n);r&&e&&(t(Ar.actions.setUser(e.data)),t(Ar.actions.setSuccess(!0)),t(Ar.actions.setPending(!1)))}catch(e){r&&(t(Ar.actions.setSuccess(!1)),t(Ar.actions.setError(e)),t(Ar.actions.setPending(!1))),Vt.error(`${Gs(e)}`)}}},postApiV1Users:{invalidatesTags:["Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,Vt.success("User created successfully")}catch(e){const t=e.error,{isError:n}=zv(t);!n&&Vt.error(`${Gs(t)}`)}}},getApiV1UsersFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersRemoteByUserNameFullFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersByUserId:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){const r=!e.htmlContent;try{r&&t(Ar.actions.setPending(!0));const e=await Ve(n);r&&e&&(t(Ar.actions.setUser(e.data)),t(Ar.actions.setSuccess(!0)),t(Ar.actions.setPending(!1)))}catch(e){r&&(t(Ar.actions.setSuccess(!1)),t(Ar.actions.setError(e)),t(Ar.actions.setPending(!1))),Vt.error(`${Gs(e)}`)}}},getApiV1UsersByUserIdFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersFollowees:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersByUserIdFollowing:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},postApiV1UsersFollowByUsernameAccept:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n,getState:r}){const i=li({dispatch:n,userId:e.user.id,state:r(),relationsProps:{followed:"ACCEPTED"}});await Ve(t,`Accepted follow request from ${e.username}`,(()=>null==i?void 0:i.undo()))}},postApiV1UsersFollowByUsernameReject:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n,getState:r}){const i=li({dispatch:n,userId:e.user.id,state:r(),relationsProps:{followed:"REJECTED"}});await Ve(t,`Rejected follow request from ${e.username}`,(()=>null==i?void 0:i.undo()))}},postApiV1UsersFollowByUsername:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n}){await Ve(t,`Follow request sent to ${e.username}`)&&n(Ks.util.invalidateTags([{type:"Relationship",id:e.user.id}]))}},postApiV1UsersFollowByUsernameUndo:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n,getState:r}){const i=li({dispatch:n,userId:e.user.id,state:r(),relationsProps:{following:null}});await Ve(t,`You unfollowed ${e.username}`,(()=>null==i?void 0:i.undo()))}},getApiV1Block:{providesTags:["Follow"]},postApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=li({userId:e.userId,dispatch:r,state:n(),relationsProps:{blocked:!0}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},deleteApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=li({userId:e.userId,dispatch:r,state:n(),relationsProps:{blocked:!1,muted:{state:!1}}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},postApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:n,dispatch:r}){const i=li({userId:e,dispatch:r,state:n(),relationsProps:{muted:{state:!0}}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},deleteApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:n,dispatch:r}){const i=li({userId:e,dispatch:r,state:n(),relationsProps:{muted:{state:!1}}});await Ve(t,void 0,(()=>null==i?void 0:i.undo()))}},getApiV1Mute:{async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},getApiV1UsersRelationships:{providesTags:(e,t,{targets:n})=>n.map((e=>({type:"Relationship",id:e}))),async onQueryStarted(e,{queryFulfilled:t}){await Ve(t)}},postApiV1AdminUserChangeState:{invalidatesTags:["Secure"],async onQueryStarted(e,{queryFulfilled:t}){await Ve(t,`User ${e.changeUserState.userId} state changed to ${e.changeUserState.newState}`)}},putApiV1Notes:{async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const{userId:i,text:s}=e.noteUpdate,a=li({userId:i,dispatch:r,state:n(),relationsProps:{note:s}});await Ve(t,"Note has been updated",(()=>null==a?void 0:a.undo()))}},deleteApiV1NotesByUserId:{async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=li({userId:e.userId,dispatch:r,state:n(),relationsProps:{note:""}});await Ve(t,"Note has been removed",(()=>null==i?void 0:i.undo()))}},postApiV1UsersFollowByUsernamePend:{async onQueryStarted(e,{queryFulfilled:t}){await Ve(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:_S,usePostApiV1UsersMutation:yS,useDeleteApiV1AccountsDeleteMutation:xS,useGetApiV1AccountsProfileQuery:wS,usePutApiV1UsersByUserIdMutation:bS,useGetApiV1UsersQuery:AS,useDeleteApiV1UsersMutation:SS,usePostApiV1MuteByUserIdMutation:CS,useDeleteApiV1MuteByUserIdMutation:ES,useGetApiV1MuteQuery:IS,usePostApiV1AdminUserChangeStateMutation:kS,useGetApiV1UsersRelationshipsQuery:cb,usePutApiV1NotesMutation:TS,useDeleteApiV1NotesByUserIdMutation:NS,useLazyGetApiV1UsersRelationshipsQuery:lb,useLazyGetApiV1GeoQuery:RS,useLazyGetApiV1GroupsOwnedQuery:OS,useGetApiV1UsersFollowersQuery:LS,useGetApiV1UsersByUserIdQuery:PS,useLazyGetApiV1UsersRenameHistoryQuery:MS,useGetApiV1UsersByUserIdFollowersQuery:US,usePostApiV1UsersFollowByUsernameMutation:jS,usePostApiV1UsersFollowByUsernameUndoMutation:FS,usePostApiV1UsersFollowByUsernameRejectMutation:BS,usePostApiV1UsersFollowByUsernameAcceptMutation:DS,useGetApiV1UsersRemoteByUserNameFullFollowersQuery:WS}=ub,fb=()=>{const e=lt(Gc.selectors.selectCurrentUser),t=lt(cy.selectors.selectIsAuthenticated);return{user:e,isLoading:lt(Gc.selectors.selectPending),isLogged:t,error:lt(Gc.selectors.selectError)}},xy=({onChange:e})=>{const{user:t}=fb(),n=null==t?void 0:t.id,r=gi(n);zn((()=>{r.current?n!==r.current&&(e(),r.current=n):r.current=n}),[n,r.current])},Vv=["following","followed","blocked","muted","note","blocked_by"],Zv=({userId:e,currentUserId:t})=>{const n="string"==typeof e,r=n?[e]:(null==e?void 0:e.filter((e=>e!==t)))||[],i=e===t;return{isSingleUser:n,canFetch:!(!r.length||i||!t),safeTargets:r}},wy=({userId:e,skip:t})=>{const n=lt(Gc.selectors.selectCurrentUser),r=null==n?void 0:n.id,{canFetch:i,isSingleUser:s,safeTargets:a}=Zv({userId:e,currentUserId:r}),{data:o,isLoading:u}=cb({targets:a,filter:Vv},{skip:!i||t}),[l]=lb(),c=({userId:e})=>{const{canFetch:t,safeTargets:n}=Zv({userId:e,currentUserId:r});t&&l({targets:n,filter:Vv})};return xy({onChange:()=>{c({userId:a})}}),{relationship:(s?null==o?void 0:o[e]:o)||{},isLoading:u,updateRelations:c}},db=e=>e.replace(/(<)/g,"<").replace(/>/g,">"),qv=(e,t)=>null!=t&&t.length?t.reduce(((e,t)=>e=e.replaceAll(new RegExp(`:${t.shortcode}:`,"g"),`<img class="custom-emoji" src="${t.staticUrl}" alt='emoji ${t.shortcode}'/>`)),e):e,hb={list:[]},pb=Wa({name:"emojis",initialState:hb,reducers:{addEmoji:(e,t)=>{e.list.push(t.payload)},addList:(e,t)=>{e.list=t.payload}},selectors:{selectEmojis:e=>e.list}}).injectInto(w_);var Hd=(e=>(e.header="header",e.avatar="avatar",e))(Hd||{});const lv=({user:e,type:t})=>{var n,r,i,s;if(!e)return"";try{return("avatar"===t?null==(r=null==(n=e.avatar)?void 0:n.files[0])?void 0:r.uri:null==(s=null==(i=e.header)?void 0:i.files[0])?void 0:s.uri)||""}catch{return""}},gb="data:image/svg+xml,%3csvg%20width='12'%20height='12'%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%209V0L0%2012H9C10.6569%2012%2012%2010.6569%2012%209Z'%20fill='white'/%3e%3cpath%20d='M0%203V12L12%200H3C1.34315%200%200%201.34315%200%203Z'%20fill='%23CBD5E1'/%3e%3c/svg%3e",mb="Enter",H0=52,vb=e=>{const[t,n]=lr((null==e?void 0:e.length)||0),r=gi(null),i=gi(null);return{inputRef:r,textareaRef:i,charCount:t,setCharCount:n,handleKeyDown:e=>{var t,n;e.key===mb&&(e.preventDefault(),null==(t=r.current)||t.blur(),null==(n=i.current)||n.blur())},handleTextareaChange:e=>{const t=e.target,r=t.value.length;n(r);const i=_b(t);setTimeout((()=>{if(t.style.height="52px",!i)return;const e=Math.max(t.scrollHeight,52);t.style.height=`${e}px`}),0)}}},_b=e=>{if(e instanceof HTMLTextAreaElement){const t=document.createElement("canvas").getContext("2d"),n=window.getComputedStyle(e);if(t){t.font=n.font||"16px sans-serif";const r=parseInt(n.paddingLeft||"0")||0,i=parseInt(n.paddingRight||"0")||0,s=e.clientWidth-r-i;return t.measureText(e.value).width>s}return e.scrollHeight>52}{const t=e.value.includes("\n"),n=e.scrollWidth>e.clientWidth;return t||n}},Hv=52,Zc=200,yb=10,xb=ot.object({note:ot.string().max(Zc)}),wb=({userId:e,note:t="",className:n,resizable:r=!1})=>{const[i]=w1(),[s]=b1(),a=lt(ro.selectors.selectIsAuthenticated),o=lt(J0.selectors.selectCurrentUser),u=(null==o?void 0:o.id)===e,l=e=>{const t=e.target.value;c(t)},c=async(t="")=>{t?await i({noteUpdate:{userId:e,text:t}}):await s({userId:e})},d=K0({resolver:U_(xb)}),{inputRef:f,textareaRef:p,charCount:h,setCharCount:v,handleTextareaChange:m,handleKeyDown:g}=vb(t);if(!u&&a)return S.jsx(f_,{...d,children:S.jsxs("form",{className:Fe("my-5",n),onKeyDown:g,children:[h>=190&&S.jsxs("div",{className:"mb-xxs text-right text-sm text-gray-400",children:[Zc-h," characters left"]}),S.jsx(d_,{control:d.control,name:"note",render:e=>S.jsxs("div",{className:"rounded-m relative flex items-center bg-gray-100 text-gray-700",children:[r?S.jsx("textarea",{...e,ref:p,maxLength:Zc,onBlur:l,onChange:m,defaultValue:t,placeholder:"Leave a note (visible only to you)",className:"scrollbar-hide p-s w-full resize-none border-0 bg-transparent text-base leading-5 outline-none [-ms-overflow-style:none] [scrollbar-width:none] focus:border-0 focus-visible:border-0 focus-visible:ring-0 focus-visible:ring-offset-0 disabled:opacity-[1] [&::-webkit-scrollbar]:hidden",style:{height:"52px"}}):S.jsx("input",{...e,ref:f,maxLength:Zc,onBlur:l,onChange:e=>{v(e.target.value.length)},defaultValue:t,placeholder:"Leave a note visible only to you",className:"p-s w-full border-0 bg-transparent focus-visible:outline-none disabled:opacity-[1]",style:{height:"52px"}}),S.jsx("img",{src:gb,alt:"user note",className:"absolute bottom-0 right-0"})]})})]})})},Gv=({status:e,iconOnly:t=!1,clasName:n})=>{const r="muted"===e?S.jsx(A_,{size:16}):S.jsx(S_,{size:16}),i="muted"===e?"text-brown outline-brown":"text-red-dark outline-red-dark";return S.jsxs("div",{className:Fe(i,"flex items-center gap-1 rounded-sm bg-white px-2 py-1 text-sm font-semibold outline",t&&"p-1",n),children:[r,!t&&Ys.capitalize(e)]})},bb=({children:e})=>S.jsx("span",{className:"line-clamp-2 block text-ellipsis whitespace-pre-wrap break-words text-left",children:e}),by=({user:e,status:t,skip:n=!1})=>{const r=lt(J0.selectors.selectCurrentUser),i=lt(ro.selectors.selectIsAuthenticated),s=!n&&i,a=null!=e&&e.domain?`@${e.username}@${e.domain}`:void 0,o=(null==e?void 0:e.id)||(null==r?void 0:r.id),u=!(t||!o||!s),l=!(!t||!i||u||!s||a),{data:c,isLoading:d}=A1({userNameFull:a},{skip:!a}),{data:f,isLoading:p}=S1({status:t},{skip:u||!l}),{data:h,isLoading:v}=C1({userId:o},{skip:l||!u});return[(u?[...h||[],...c||[]]:null)||f,p||v||d]},ts={followers:"followers",following:"following"},Ab=({user:e,showEmpty:t=!0,className:n,renderModal:r,...i})=>{const[s,a]=by({user:e}),[o,u]=lr({open:!1,tab:ts.followers}),{guardedAction:l,ActionTooltipWrapper:c}=gl(),d=(null==s?void 0:s.length)||0,f=1===d?"follower":"followers",p=(null==s?void 0:s.slice(0,3))||[];return a?S.jsx(p_,{className:"mx-auto mb-4 h-7 w-[200px]"}):0!==d||t?S.jsxs("div",{"data-testid":"user-followers",children:[o.open&&(null==r?void 0:r({user:e,tab:o.tab,isOpen:!0,onClose:()=>u((e=>({...e,open:!1}))),...i})),S.jsx(c,{children:S.jsxs("div",{onClick:l((()=>{u({tab:ts.followers,open:!0})})),className:Fe("mb-4 flex cursor-pointer items-center text-base font-medium text-gray-900",n),children:[p.length>0&&S.jsx("ul",{className:"mr-2 flex items-center",children:p.map(((e,t)=>S.jsx("li",{className:Fe("relative",t>0&&"-ml-2"),children:S.jsx("div",{className:"rounded-full bg-white p-0.5",children:S.jsx(x_,{size:24,name:e.displayName,imgUrl:lv({user:e,type:Hd.avatar})})})},e.id)))}),d," ",f]})})]}):null},Sb=({status:e,userId:t,skip:n=!1})=>{const r=lt(ro.selectors.selectIsAuthenticated),i=!!e&&r,{data:s,isLoading:a}=Fy({status:e},{skip:!i||n}),{data:o,isLoading:u}=By({userId:t},{skip:i||!t||!r||n});return{data:s||o,isLoading:a||u}},Cb=({userUrl:e})=>S.jsxs("div",{className:"flex w-full items-center justify-between",children:[S.jsxs("div",{className:"gap-xs flex items-center",children:[S.jsx("div",{className:"flex size-10 items-center justify-center rounded-full border border-gray-200",children:S.jsx(Ax,{size:20})}),S.jsxs("div",{className:"text-sm",children:[S.jsx("p",{className:"mb-xxxs font-semibold text-gray-900",children:"Some followers may not be visible"}),S.jsx("span",{className:"text-gray-400",children:"You can see more on the original server"})]})]}),S.jsx(l1,{baseUrl:e,children:S.jsx("a",{href:e,children:S.jsxs(wn,{variant:"secondary",className:"gap-xxs font-semibold",children:["See more followers ",S.jsx(yx,{})]})})})]}),Qv=({count:e=15,className:t,itemClassName:n})=>S.jsx("div",{"data-testid":"list-loader",className:Fe("gap-m ml-auto mr-auto flex max-w-[560px] flex-col",t),children:Array.from(Array(e).keys()).map(((e,t)=>S.jsx(p_,{className:Fe("rounded-m h-[50px] w-full",n)},t)))});var Kv,qc={exports:{}},Eb=qc.exports;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Lodash <https://lodash.com/>
|