@wellesley/notifications 1.0.696 → 1.0.698
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 Fy,useDeleteApiV1BlockByUserIdMutation as Dy,usePostApiV1UsersFollowByUsernameAcceptMutation as By,usePostApiV1UsersFollowByUsernameRejectMutation as Wy,useGetApiV1SearchQuery as $y}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.
|
|
1
|
+
import{api as Ks,usePostApiV1BlockByUserIdMutation as Fy,useDeleteApiV1BlockByUserIdMutation as Dy,usePostApiV1UsersFollowByUsernameAcceptMutation as By,usePostApiV1UsersFollowByUsernameRejectMutation as Wy,useGetApiV1SearchQuery as $y}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.799";import zy,{forwardRef as g_,createElement as U0,useState as $t,useRef as vi,useEffect as Or,useCallback as S0}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{toast as ut}from"https://cdn.jsdelivr.net/npm/@wellesley/system-toast@1.0.143";import{createAction as m_,createSelector as J0,createSlice as Wa}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{ToastContainer as Vy,toast as Zy}from"https://cdn.jsdelivr.net/npm/react-toastify@10.0.5/+esm";import{authSlice as to}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.855";import{useSelector as ft,useDispatch as pl}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{Dialog as Hy,DialogContent as qy,cn as Ue,Form as v_,FormField as __,FormItem as Gy,FormLabel as Qy,FormControl as Ky,Input as y_,Command as Yy,CommandList as Jy,CommandItem as Xy,FormMessage as e1,Button as Sn,ButtonLoader as j0,TooltipWrapper as F0,Avatar as t1,AvatarImage as r1,Skeleton as jd,DropdownMenu as x_,DropdownMenuTrigger as w_,DropdownMenuContent as b_,DropdownMenuItem as A_,useIsMobile as n1,Tabs as i1,TabsControls as s1,TabsContent as vv,HoverCard as o1,HoverCardTrigger as a1,HoverCardContent as u1}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.761";import{get as D0,set as C0,appendErrors as c1,useForm as X0,FormProvider as l1}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{useAppsNavigate as f1,ExternalLinks as d1,AppsLink as Pa}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.725";import{usePostApiV1UsersFollowByUsernameMutation as h1,usePostApiV1UsersFollowByUsernameUndoMutation as p1,canFollowBack as g1,isFollowPending as m1,canUnfollow as _v,useIsOwnProfile as ev,useRelationship as S_,useCurrentUser as C_,useGetUserByUserName as v1,useGetUserById as _1,usePostApiV1MuteByUserIdMutation as y1,useDeleteApiV1MuteByUserIdMutation as x1,isMuted as w1,usePutApiV1NotesMutation as b1,useDeleteApiV1NotesByUserIdMutation as A1,userSlice as tv,useGetApiV1UsersRemoteByUserNameFullFollowersQuery as S1,useGetApiV1UsersFollowersQuery as C1,useGetApiV1UsersByUserIdFollowersQuery as E1,isHiddenListError as Qc,UserAvatar as rv,useGetApiV1UsersFolloweesQuery as I1,useGetApiV1UsersByUserIdFollowingQuery as k1,usePostApiV1UsersFollowByUsernameRejectMutation as T1,canUnsubscribeFromMe as N1}from"https://cdn.jsdelivr.net/npm/@wellesley/user@1.0.814";import{getErrorMsg as Xr}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.648";import{getStore as R1,rootReducer as E_}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.798";import{selectSmallestPreview as yv}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.684";import{platformSettingsSlice as O1}from"https://cdn.jsdelivr.net/npm/@wellesley/settings@1.0.756";import{usePostApiV1EventsByEventIdAcceptMutation as L1,usePostApiV1EventsByEventIdRejectMutation as P1,usePostApiV1EventsByEventIdMaybeMutation as M1}from"https://cdn.jsdelivr.net/npm/@wellesley/events@1.0.551";import{wsSlice as U1}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.781";var xv,is=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Vc={exports:{}},j1=Vc.exports;
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Lodash <https://lodash.com/>
|
|
@@ -39,7 +39,7 @@ import{api as Ks,usePostApiV1BlockByUserIdMutation as Fy,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
|
-
*/ye("remoteReady");const bx=ye("askLogin");ye("reselectUser"),ye("requestLogout"),ye("setConfirmLeavePage"),ye("requestChangePath");const Ax=ye("wsSubscribe"),Sx=ye("wsUnSubscribe");ye("hostStoreConnect"),ye("remoteLogin"),ye("remoteLogout"),ye("wsOnMessage"),ye("setRouterPath"),ye("setDeviceType"),ye("setDeviceWidth");const N_=ye("setUserError"),R_=ye("setUserIsError"),B0=ye("setUserPending"),W0=ye("setUserSuccess"),O_=ye("setUserData"),Cx=ye("updateAccountData"),Ex=ye("updateUser"),L_=ye("addNotification"),P_=ye("markNotification"),M_=ye("setNotificationsError"),U_=ye("setNotificationsList"),$0=ye("setNotificationsPending"),j_=ye("setNotificationsTotalCount"),z0=ye("setNotificationsUnreadCount"),Ix=ye("acceptAllFollowRequests"),F_=ye("resetNotificationsState"),D_=ye("undoNotification");ye("setInstanceInfo"),ye("setInstanceInfoPending"),ye("setInstanceInfoError"),ye("setPlatformSettings"),ye("setProfileSettings"),ye("setGroupData"),ye("setGroupLoading"),m_("requestMicroFrontendFetch"),m_("sendMicroFrontendFetchResponse");const kx=Ks.enhanceEndpoints({endpoints:{getApiV1Notifications:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n,getState:r}){var i;t($0(!0));try{const e=await at(n),s=(null==(i=r().user.data)?void 0:i.selectedUserId)||"";e&&t(U_({userId:s,list:e.data}))}catch(e){t(M_(e))}finally{t($0(!1))}}},postApiV1NotificationsByIdMark:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await at(n),t(P_(e))}catch(e){ut.error(`Mark notification error, ${e}`)}}},postApiV1NotificationsMarkAll:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){await at(n),t(z0(0))}},getApiV1NotificationsCount:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{const r=await at(n),i=!e.status;r&&t(i?j_(r.data):z0(r.data))}catch(e){ut.error(`Error getting unread notifications count', ${e}`)}}}}}),{useGetApiV1NotificationsQuery:Tx,usePostApiV1NotificationsByIdMarkMutation:Nx,usePostApiV1NotificationsMarkAllMutation:bS,useGetApiV1NotificationsCountQuery:Rx}=kx,kv={data:{userId:"",list:[]},count:{},isPending:!1},Ox=e=>e,Lx=e=>e.error,Px=e=>e.isPending,Mx=e=>{var t;return null==(t=e.count)?void 0:t.total},Ux=e=>{var t;return null==(t=e.count)?void 0:t.unread},jx=e=>e.data.userId,nv=J0(Ox,(e=>e.data.list)),Fx=J0(nv,(e=>null==e?void 0:e.filter((e=>"UNREAD"===e.status)))),Dx=J0(nv,(e=>null==e?void 0:e.at(-1))),Jc=Wa({name:"notifications",initialState:kv,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($0,((e,t)=>{e.isPending=t.payload})).addCase(M_,((e,t)=>{e.error=t.payload})).addCase(U_,((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(L_,((e,t)=>{e.count.unread=(e.count.unread||0)+1,e.data.list&&(e.data.list=[t.payload,...e.data.list||[]])})).addCase(P_,((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(j_,((e,t)=>{e.count.total=t.payload})).addCase(z0,((e,t)=>{e.count.unread=t.payload})).addCase(F_,(()=>kv)).addCase(D_,((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)))||[]})).addCase(Ix,(e=>{e.data.list&&(e.data.list=e.data.list.map((e=>"FOLLOW_REQUEST"===e.type?{...e,followResponse:"Accepted"}:e)))}))},selectors:{selectError:Lx,selectIsPending:Px,selectTotalCount:Mx,selectUnreadCount:Ux,selectNotifications:nv,selectUnreadNotifications:Fx,selectLastNotification:Dx,selectNotificationsOwner:jx}}),AS=()=>S.jsx(Vy,{position:"top-right",theme:"dark",limit:5,autoClose:5e3,containerId:"custom",hideProgressBar:!0,className:"custom-notifications"}),SS=(e,t)=>Zy(e,{...t,containerId:"custom"});var Tv=function(e,t,n){if(e&&"reportValidity"in e){var r=D0(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},B_=function(e,t){var n=function(n){var r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Tv(r.ref,n,e):r.refs&&r.refs.forEach((function(t){return Tv(t,n,e)}))};for(var r in t.fields)n(r)},Bx=function(e,t){t.shouldUseNativeValidation&&B_(e,t);var n={};for(var r in e){var i=D0(t.fields,r),s=Object.assign(e[r]||{},{ref:i&&i.ref});if(Wx(t.names||Object.keys(e),r)){var a=Object.assign({},D0(n,r));C0(a,"root",s),C0(n,r,a)}else C0(n,r,s)}return n},Wx=function(e,t){return e.some((function(e){return e.startsWith(t+".")}))},$x=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]=c1(a,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n},W_=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&&B_({},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:Bx($x(e.errors,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)};throw e})))}catch(e){return Promise.reject(e)}}};const zx=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")}},Vx=e=>{const t=e.links.find((e=>"http://ostatus.org/schema/1.0/subscribe"===e.rel));return null==t?void 0:t.template},Zx=({template:e,user:t})=>null==e?void 0:e.replace("{uri}",t.uri),Hx=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},qx=({user:e})=>async({url:t})=>{const n=zx(t);try{const t=`${n}/.well-known/webfinger?resource=${n}`,r=await Hx({url:t,headers:{Accept:"application/json"}});if(!r)return;const i=Vx(r),s=Zx({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")}},Gx=(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?ss.capitalize(s):t}</mark>`);return r&&a?o:ss.capitalize(o)},Nv=e=>{e.preventDefault()},Qx=e=>e?{onOpenAutoFocus:Nv,onCloseAutoFocus:Nv}:{},gl=({open:e,modal:t,children:n,onCloseModal:r,className:i,skipModalAutofocus:s=!1,...a})=>e?S.jsx(Hy,{open:e,modal:t,onOpenChange:e=>{e||null==r||r()},children:S.jsx(qy,{className:Ue(i),closeSize:"small",closeVariant:"insideCard",onCloseModal:r,...a,...Qx(s),childrenClassName:Ue("overflow-auto",a.title?"max-h-[calc(90vh-65px)]":"max-h-[90vh]",a.childrenClassName),children:n})}):null;var Ae,V0;!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={})),(V0||(V0={})).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"]),ns=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"]),Kx=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Rr 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 Rr))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()}}Rr.create=e=>new Rr(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 $_=ja;function Yx(e){$_=e}function Bd(){return $_}const Wd=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}},Jx=[];function G(e,t){const n=Bd(),r=Wd({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 se;"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 se;"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 se=Object.freeze({status:"aborted"}),La=e=>({status:"dirty",value:e}),lr=e=>({status:"valid",value:e}),Z0=e=>"aborted"===e.status,H0=e=>"dirty"===e.status,Xc=e=>"valid"===e.status,el=e=>typeof Promise<"u"&&e instanceof Promise;function $d(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 z_(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 X,Zc,Hc;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(X||(X={}));class qn{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 Rv=(e,t)=>{if(Xc(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 Rr(e.common.issues);return this._error=t,this._error}}};function me(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 _e{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return ns(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ns(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:ns(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(el(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:ns(e)},i=this._parseSync({data:e,path:r.path,parent:r});return Rv(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:ns(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(el(r)?r:Promise.resolve(r));return Rv(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 En({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Hn.create(this,this._def)}nullable(){return cs.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Cn.create(this,this._def)}promise(){return Da.create(this,this._def)}or(e){return il.create([this,e],this._def)}and(e){return sl.create(this,e,this._def)}transform(e){return new En({...me(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ll({...me(this._def),innerType:this,defaultValue:t,typeName:ne.ZodDefault})}brand(){return new iv({typeName:ne.ZodBranded,type:this,...me(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new fl({...me(this._def),innerType:this,catchValue:t,typeName:ne.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ml.create(this,e)}readonly(){return dl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Xx=/^c[^\s-]{8,}$/i,ew=/^[0-9a-z]+$/,tw=/^[0-9A-HJKMNP-TV-Z]{26}$/,rw=/^[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,nw=/^[a-z0-9_-]{21}$/i,iw=/^[-+]?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)?)??$/,sw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ow="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let O0;const aw=/^(?:(?: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])$/,uw=/^(([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})))$/,cw=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,V_="((\\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])))",lw=new RegExp(`^${V_}$`);function Z_(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 fw(e){return new RegExp(`^${Z_(e)}$`)}function H_(e){let t=`${V_}T${Z_(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 dw(e,t){return!(("v4"!==t&&t||!aw.test(e))&&("v6"!==t&&t||!uw.test(e)))}class An extends _e{_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}),se}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)sw.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)O0||(O0=new RegExp(ow,"u")),O0.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)rw.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)nw.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)Xx.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)ew.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)tw.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?H_(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?lw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:"date",message:r.message}),t.dirty()):"time"===r.kind?fw(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?iw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"duration",code:W.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?dw(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?cw.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,...X.errToObj(n)})}_addCheck(e){return new An({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...X.errToObj(e)})}url(e){return this._addCheck({kind:"url",...X.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...X.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...X.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...X.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...X.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...X.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...X.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...X.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...X.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,...X.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,...X.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...X.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...X.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...X.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...X.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...X.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...X.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...X.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...X.errToObj(t)})}nonempty(e){return this.min(1,X.errToObj(e))}trim(){return new An({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new An({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new An({...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 hw(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)}An.create=e=>{var t;return new An({checks:[],typeName:ne.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...me(e)})};class os extends _e{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}),se}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!==hw(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,X.toString(t))}gt(e,t){return this.setLimit("min",e,!1,X.toString(t))}lte(e,t){return this.setLimit("max",e,!0,X.toString(t))}lt(e,t){return this.setLimit("max",e,!1,X.toString(t))}setLimit(e,t,n,r){return new os({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:X.toString(r)}]})}_addCheck(e){return new os({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:X.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:X.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:X.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:X.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:X.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:X.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:X.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:X.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:X.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)}}os.create=e=>new os({checks:[],typeName:ne.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...me(e)});class as extends _e{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}),se}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,X.toString(t))}gt(e,t){return this.setLimit("min",e,!1,X.toString(t))}lte(e,t){return this.setLimit("max",e,!0,X.toString(t))}lt(e,t){return this.setLimit("max",e,!1,X.toString(t))}setLimit(e,t,n,r){return new as({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:X.toString(r)}]})}_addCheck(e){return new as({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:X.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:X.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:X.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:X.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:X.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}}as.create=e=>{var t;return new as({checks:[],typeName:ne.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...me(e)})};class tl extends _e{_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}),se}return lr(e.data)}}tl.create=e=>new tl({typeName:ne.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...me(e)});class Xs extends _e{_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}),se}if(isNaN(e.data.getTime())){return G(this._getOrReturnCtx(e),{code:W.invalid_date}),se}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 Xs({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:X.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:X.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}}Xs.create=e=>new Xs({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ne.ZodDate,...me(e)});class zd extends _e{_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}),se}return lr(e.data)}}zd.create=e=>new zd({typeName:ne.ZodSymbol,...me(e)});class rl extends _e{_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}),se}return lr(e.data)}}rl.create=e=>new rl({typeName:ne.ZodUndefined,...me(e)});class nl extends _e{_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}),se}return lr(e.data)}}nl.create=e=>new nl({typeName:ne.ZodNull,...me(e)});class Fa extends _e{constructor(){super(...arguments),this._any=!0}_parse(e){return lr(e.data)}}Fa.create=e=>new Fa({typeName:ne.ZodAny,...me(e)});class Ys extends _e{constructor(){super(...arguments),this._unknown=!0}_parse(e){return lr(e.data)}}Ys.create=e=>new Ys({typeName:ne.ZodUnknown,...me(e)});class _i extends _e{_parse(e){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.never,received:t.parsedType}),se}}_i.create=e=>new _i({typeName:ne.ZodNever,...me(e)});class Vd extends _e{_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}),se}return lr(e.data)}}Vd.create=e=>new Vd({typeName:ne.ZodVoid,...me(e)});class Cn extends _e{_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}),se;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 qn(t,e,t.path,n))))).then((e=>Yt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>r.type._parseSync(new qn(t,e,t.path,n))));return Yt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new Cn({...this._def,minLength:{value:e,message:X.toString(t)}})}max(e,t){return new Cn({...this._def,maxLength:{value:e,message:X.toString(t)}})}length(e,t){return new Cn({...this._def,exactLength:{value:e,message:X.toString(t)}})}nonempty(e){return this.min(1,e)}}function Oa(e){if(e instanceof it){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Hn.create(Oa(r))}return new it({...e._def,shape:()=>t})}return e instanceof Cn?new Cn({...e._def,type:Oa(e.element)}):e instanceof Hn?Hn.create(Oa(e.unwrap())):e instanceof cs?cs.create(Oa(e.unwrap())):e instanceof Gn?Gn.create(e.items.map((e=>Oa(e)))):e}Cn.create=(e,t)=>new Cn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...me(t)});class it extends _e{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}),se}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof _i&&"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 qn(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof _i){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 qn(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 X.errToObj,new it({...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=X.errToObj(e).message)&&void 0!==a?a:o}:{message:o}}}:{}})}strip(){return new it({...this._def,unknownKeys:"strip"})}passthrough(){return new it({...this._def,unknownKeys:"passthrough"})}extend(e){return new it({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new it({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 it({...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 it({...this._def,shape:()=>t})}omit(e){const t={};return Ae.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new it({...this._def,shape:()=>t})}deepPartial(){return Oa(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 it({...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 Hn;)e=e._def.innerType;t[n]=e}})),new it({...this._def,shape:()=>t})}keyof(){return q_(Ae.objectKeys(this.shape))}}it.create=(e,t)=>new it({shape:()=>e,unknownKeys:"strip",catchall:_i.create(),typeName:ne.ZodObject,...me(t)}),it.strictCreate=(e,t)=>new it({shape:()=>e,unknownKeys:"strict",catchall:_i.create(),typeName:ne.ZodObject,...me(t)}),it.lazycreate=(e,t)=>new it({shape:e,unknownKeys:"strip",catchall:_i.create(),typeName:ne.ZodObject,...me(t)});class il extends _e{_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 Rr(e.ctx.common.issues)));return G(t,{code:W.invalid_union,unionErrors:n}),se}));{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 Rr(e)));return G(t,{code:W.invalid_union,unionErrors:i}),se}}get options(){return this._def.options}}il.create=(e,t)=>new il({options:e,typeName:ne.ZodUnion,...me(t)});const gi=e=>e instanceof al?gi(e.schema):e instanceof En?gi(e.innerType()):e instanceof ul?[e.value]:e instanceof us?e.options:e instanceof cl?Ae.objectValues(e.enum):e instanceof ll?gi(e._def.innerType):e instanceof rl?[void 0]:e instanceof nl?[null]:e instanceof Hn?[void 0,...gi(e.unwrap())]:e instanceof cs?[null,...gi(e.unwrap())]:e instanceof iv||e instanceof dl?gi(e.unwrap()):e instanceof fl?gi(e._def.innerType):[];class qd extends _e{_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}),se;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]}),se)}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=gi(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 qd({typeName:ne.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...me(n)})}}function q0(e,t){const n=ns(e),r=ns(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=q0(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=q0(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 sl extends _e{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Z0(e)||Z0(r))return se;const i=q0(e.value,r.value);return i.valid?((H0(e)||H0(r))&&t.dirty(),{status:t.value,value:i.data}):(G(n,{code:W.invalid_intersection_types}),se)};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}))}}sl.create=(e,t,n)=>new sl({left:e,right:t,typeName:ne.ZodIntersection,...me(n)});class Gn extends _e{_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}),se;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"}),se;!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 qn(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 Gn({...this._def,rest:e})}}Gn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Gn({items:e,typeName:ne.ZodTuple,rest:null,...me(t)})};class ol extends _e{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}),se;const r=[],i=this._def.keyType,s=this._def.valueType;for(const e in n.data)r.push({key:i._parse(new qn(n,e,n.path,e)),value:s._parse(new qn(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 ol(t instanceof _e?{keyType:e,valueType:t,typeName:ne.ZodRecord,...me(n)}:{keyType:An.create(),valueType:e,typeName:ne.ZodRecord,...me(t)})}}class Zd extends _e{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}),se;const r=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map((([e,t],s)=>({key:r._parse(new qn(n,e,n.path,[s,"key"])),value:i._parse(new qn(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 se;("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 se;("dirty"===r.status||"dirty"===i.status)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}Zd.create=(e,t,n)=>new Zd({valueType:t,keyType:e,typeName:ne.ZodMap,...me(n)});class eo extends _e{_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}),se;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 se;"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 qn(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>s(e))):s(a)}min(e,t){return new eo({...this._def,minSize:{value:e,message:X.toString(t)}})}max(e,t){return new eo({...this._def,maxSize:{value:e,message:X.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}eo.create=(e,t)=>new eo({valueType:e,minSize:null,maxSize:null,typeName:ne.ZodSet,...me(t)});class Ma extends _e{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}),se;function n(e,n){return Wd({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Bd(),ja].filter((e=>!!e)),issueData:{code:W.invalid_arguments,argumentsError:n}})}function r(e,n){return Wd({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Bd(),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 Da){const e=this;return lr((async function(...t){const a=new Rr([]),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 lr((function(...t){const a=e._def.args.safeParse(t,i);if(!a.success)throw new Rr([n(t,a.error)]);const o=Reflect.apply(s,this,a.data),u=e._def.returns.safeParse(o,i);if(!u.success)throw new Rr([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:Gn.create(e).rest(Ys.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||Gn.create([]).rest(Ys.create()),returns:t||Ys.create(),typeName:ne.ZodFunction,...me(n)})}}class al extends _e{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})}}al.create=(e,t)=>new al({getter:e,typeName:ne.ZodLazy,...me(t)});class ul extends _e{_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}),se}return{status:"valid",value:e.data}}get value(){return this._def.value}}function q_(e,t){return new us({values:e,typeName:ne.ZodEnum,...me(t)})}ul.create=(e,t)=>new ul({value:e,typeName:ne.ZodLiteral,...me(t)});class us extends _e{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}),se}if($d(this,Zc)||z_(this,Zc,new Set(this._def.values)),!$d(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}),se}return lr(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 us.create(e,{...this._def,...t})}exclude(e,t=this._def){return us.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Zc=new WeakMap,us.create=q_;class cl extends _e{constructor(){super(...arguments),Hc.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}),se}if($d(this,Hc)||z_(this,Hc,new Set(Ae.getValidEnumValues(this._def.values))),!$d(this,Hc).has(e.data)){const e=Ae.objectValues(t);return G(n,{received:n.data,code:W.invalid_enum_value,options:e}),se}return lr(e.data)}get enum(){return this._def.values}}Hc=new WeakMap,cl.create=(e,t)=>new cl({values:e,typeName:ne.ZodNativeEnum,...me(t)});class Da extends _e{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}),se;const n=t.parsedType===Q.promise?t.data:Promise.resolve(t.data);return lr(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Da.create=(e,t)=>new Da({type:e,typeName:ne.ZodPromise,...me(t)});class En extends _e{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 se;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?se:"dirty"===r.status||"dirty"===t.value?La(r.value):r}));{if("aborted"===t.value)return se;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?se:"dirty"===r.status||"dirty"===t.value?La(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?se:("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?se:("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(!Xc(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=>Xc(e)?Promise.resolve(r.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ae.assertNever(r)}}En.create=(e,t,n)=>new En({schema:e,typeName:ne.ZodEffects,effect:t,...me(n)}),En.createWithPreprocess=(e,t,n)=>new En({schema:t,effect:{type:"preprocess",transform:e},typeName:ne.ZodEffects,...me(n)});class Hn extends _e{_parse(e){return this._getType(e)===Q.undefined?lr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Hn.create=(e,t)=>new Hn({innerType:e,typeName:ne.ZodOptional,...me(t)});class cs extends _e{_parse(e){return this._getType(e)===Q.null?lr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}cs.create=(e,t)=>new cs({innerType:e,typeName:ne.ZodNullable,...me(t)});class ll extends _e{_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}}ll.create=(e,t)=>new ll({innerType:e,typeName:ne.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...me(t)});class fl extends _e{_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 el(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Rr(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Rr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}fl.create=(e,t)=>new fl({innerType:e,typeName:ne.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...me(t)});class Hd extends _e{_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}),se}return{status:"valid",value:e.data}}}Hd.create=e=>new Hd({typeName:ne.ZodNaN,...me(e)});const pw=Symbol("zod_brand");class iv extends _e{_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 ml extends _e{_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?se:"dirty"===e.status?(t.dirty(),La(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?se:"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 ml({in:e,out:t,typeName:ne.ZodPipeline})}}class dl extends _e{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Xc(e)&&(e.value=Object.freeze(e.value)),e);return el(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function G_(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()}dl.create=(e,t)=>new dl({innerType:e,typeName:ne.ZodReadonly,...me(t)});const gw={object:it.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 mw=(e,t={message:`Input not instance of ${e.name}`})=>G_((t=>t instanceof e),t),Q_=An.create,K_=os.create,vw=Hd.create,_w=as.create,Y_=tl.create,yw=Xs.create,xw=zd.create,ww=rl.create,bw=nl.create,Aw=Fa.create,Sw=Ys.create,Cw=_i.create,Ew=Vd.create,Iw=Cn.create,kw=it.create,Tw=it.strictCreate,Nw=il.create,Rw=qd.create,Ow=sl.create,Lw=Gn.create,Pw=ol.create,Mw=Zd.create,Uw=eo.create,jw=Ma.create,Fw=al.create,Dw=ul.create,Bw=us.create,Ww=cl.create,$w=Da.create,Ov=En.create,zw=Hn.create,Vw=cs.create,Zw=En.createWithPreprocess,Hw=ml.create,qw=()=>Q_().optional(),Gw=()=>K_().optional(),Qw=()=>Y_().optional(),Kw={string:e=>An.create({...e,coerce:!0}),number:e=>os.create({...e,coerce:!0}),boolean:e=>tl.create({...e,coerce:!0}),bigint:e=>as.create({...e,coerce:!0}),date:e=>Xs.create({...e,coerce:!0})},Yw=se;var Je=Object.freeze({__proto__:null,defaultErrorMap:ja,setErrorMap:Yx,getErrorMap:Bd,makeIssue:Wd,EMPTY_PATH:Jx,addIssueToContext:G,ParseStatus:Yt,INVALID:se,DIRTY:La,OK:lr,isAborted:Z0,isDirty:H0,isValid:Xc,isAsync:el,get util(){return Ae},get objectUtil(){return V0},ZodParsedType:Q,getParsedType:ns,ZodType:_e,datetimeRegex:H_,ZodString:An,ZodNumber:os,ZodBigInt:as,ZodBoolean:tl,ZodDate:Xs,ZodSymbol:zd,ZodUndefined:rl,ZodNull:nl,ZodAny:Fa,ZodUnknown:Ys,ZodNever:_i,ZodVoid:Vd,ZodArray:Cn,ZodObject:it,ZodUnion:il,ZodDiscriminatedUnion:qd,ZodIntersection:sl,ZodTuple:Gn,ZodRecord:ol,ZodMap:Zd,ZodSet:eo,ZodFunction:Ma,ZodLazy:al,ZodLiteral:ul,ZodEnum:us,ZodNativeEnum:cl,ZodPromise:Da,ZodEffects:En,ZodTransformer:En,ZodOptional:Hn,ZodNullable:cs,ZodDefault:ll,ZodCatch:fl,ZodNaN:Hd,BRAND:pw,ZodBranded:iv,ZodPipeline:ml,ZodReadonly:dl,custom:G_,Schema:_e,ZodSchema:_e,late:gw,get ZodFirstPartyTypeKind(){return ne},coerce:Kw,any:Aw,array:Iw,bigint:_w,boolean:Y_,date:yw,discriminatedUnion:Rw,effect:Ov,enum:Bw,function:jw,instanceof:mw,intersection:Ow,lazy:Fw,literal:Dw,map:Mw,nan:vw,nativeEnum:Ww,never:Cw,null:bw,nullable:Vw,number:K_,object:kw,oboolean:Qw,onumber:Gw,optional:zw,ostring:qw,pipeline:Hw,preprocess:Zw,promise:$w,record:Pw,set:Uw,strictObject:Tw,string:Q_,symbol:xw,transformer:Ov,tuple:Lw,undefined:ww,union:Nw,unknown:Sw,void:Ew,NEVER:Yw,ZodIssueCode:W,quotelessJson:Kx,ZodError:Rr});const Jw=Je.object({url:Je.string().min(1,"Field is required")}),Xw=({open:e,user:t,onCloseModal:n})=>{const r=qx({user:t}),i=f1(),[s,a]=$t(!0),o=X0({shouldFocusError:!1,mode:"onSubmit",resolver:W_(Jw),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(gl,{open:e,onCloseModal:n,title:`You're not following @${t.username}`,children:[S.jsx(v_,{...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(__,{control:o.control,name:"url",render:({field:e})=>S.jsxs(Gy,{className:"mt-0 flex-1",children:[S.jsx(Qy,{className:"mb-2 block text-base",children:"Enter your server name to follow this user"}),S.jsxs("div",{className:"relative",children:[S.jsx(Ky,{children:S.jsx(y_,{"data-testid":"input",placeholder:"Server name",...e,onChange:e=>c(e.target.value)})}),S.jsx(Yy,{"data-testid":"command",children:S.jsx(Jy,{"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(Xy,{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:Gx(e,o.getValues("url"))}})},e))))})})]}),S.jsx(e1,{className:"md:absolute"})]})}),S.jsx(Sn,{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(Sn,{"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"})]})]})},en=e=>`@${e.username}${e.local?"":`@${e.domain}`}`,J_=({user:e,onFollow:t,onUnfollow:n,unsubscribe:r})=>{const[i,s]=$t(!1),a=ft(to.selectors.selectIsAuthenticated),[o]=h1(),[u]=p1(),l=null==e?void 0:e.domain,c={user:e,username:en(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(Xw,{user:e,open:i,onCloseModal:()=>s(!1)}):null}},e2=({delay:e=0,defaultHover:t=!1,dependProps:n=[],leaveDelay:r=0}={})=>{const i=vi(null),[s,a]=$t(t),o=vi(null),u=vi(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 Or((()=>()=>{o.current&&clearTimeout(o.current),u.current&&clearTimeout(u.current)}),[]),Or((()=>{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]},t2=({open:e,title:t,children:n,leftButton:r,rightButton:i,onClose:s,titleTestId:a,...o})=>S.jsxs(gl,{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(j0,{size:"m",variant:"secondary",className:"flex-1",...r,title:void 0,children:r.title}),i&&S.jsx(j0,{size:"m",className:"flex-1",...i,title:void 0,children:i.title})]})]}),r2=e=>!(null==e||!e.blocked),X_=(e=!1)=>{const[t,n]=$t(e);return[t,S0((()=>n(!0)),[]),S0((()=>n(!1)),[]),S0((()=>n((e=>!e))),[]),n]},sv=({user:e,relationship:t})=>{const[n,{isLoading:r}]=Fy(),[i]=Dy(),[s,a,o]=X_(),u=r2(t);return[u,a,async()=>{try{await i({userId:e.id}).unwrap(),ut.success(`${e.username} is unblocked`)}catch(e){ut.error(`${Xr(e)}`)}},()=>S.jsx(t2,{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(),ut.success(`${e.username} is blocked`),o()}catch(e){ut.error(`${Xr(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]},ey=({size:e,user:t,follow:n,unfollow:r,disabled:i,relationship:s,isRelationshipPending:a,className:o,followButtonText:u,unfollowButtonText:l})=>{const[c,,d]=sv({user:t,relationship:s}),f=g1(s)?"Follow back":u||"Follow",p=l||"Unfollow",h=m1(s),v=_v(s),[m,g]=e2(),y=h&&!g||v;if(!a)return S.jsx(Sn,{ref:m,"data-testid":"followBtn",onClick:c?d:v||h?r:n,size:e,className:Ue("rounded-m px-xs w-[100%] min-w-[130px] md:max-w-[300px] lg:max-w-full",!_v&&"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})},Lv={data:null,isError:!1,isPending:!1,isSuccess:!1},Kc=Wa({name:"user",initialState:Lv,reducers:{reset:e=>{Object.assign(e,Lv)}},extraReducers:e=>{e.addCase(O_,((e,{payload:t})=>{e.data=t})).addCase(Cx,((e,{payload:t})=>{e.data&&Object.assign(e.data,t||{})})).addCase(W0,((e,{payload:t})=>{e.isSuccess=t})).addCase(B0,((e,{payload:t})=>{e.isPending=t})).addCase(R_,((e,{payload:t})=>{e.isError=t})).addCase(N_,((e,{payload:t})=>{e.error=t})).addCase(Ex,((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}}),Yc="8.48.0",yi=globalThis;function ov(e,t,n){const r=yi,i=r.__SENTRY__=r.__SENTRY__||{},s=i[Yc]=i[Yc]||{};return s[e]||(s[e]=t())}const ty=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,n2="Sentry Logger ",Pv=["debug","info","warn","error","log","assert","trace"],Mv={};function i2(e){if(!("console"in yi))return e();const t=yi.console,n={},r=Object.keys(Mv);r.forEach((e=>{const r=Mv[e];n[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{t[e]=n[e]}))}}function s2(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return ty?Pv.forEach((n=>{t[n]=(...t)=>{e&&i2((()=>{yi.console[n](`${n2}[${n}]:`,...t)}))}})):Pv.forEach((e=>{t[e]=()=>{}})),t}const Fd=ov("logger",s2);function av(){return uv(yi),yi}function uv(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Yc,t[Yc]=t[Yc]||{}}const o2=Object.prototype.toString;function a2(e,t){return o2.call(e)===`[object ${t}]`}function u2(e){return a2(e,"Object")}function c2(e){return!(!e||!e.then||"function"!=typeof e.then)}function l2(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{ty&&Fd.log(`Failed to add non-enumerable property "${t}" to object`,e)}}const ry=1e3;function ny(){return Date.now()/ry}function f2(){const{performance:e}=yi;if(!e||!e.now)return ny;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/ry}const d2=f2();function Ua(){const e=yi,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 h2(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||d2(),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 Uv(){return Ua()}function jv(){return Ua().substring(16)}function iy(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]=iy(r[e],t[e],n-1));return r}(()=>{const{performance:e}=yi;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 G0="_sentrySpan";function Fv(e,t){t?l2(e,G0,t):delete e[G0]}function Dv(e){return e[G0]}const p2=100;class cv{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:Uv(),spanId:jv()}}clone(){const e=new cv;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,Fv(e,Dv(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&&h2(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 hl?[t.getScopeData(),t.getRequestSession()]:u2(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,Fv(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Uv()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:p2;if(n<=0)return this;const r={timestamp:ny(),...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:Dv(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=iy(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:jv(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:Ua();if(!this._client)return Fd.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 Fd.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):(Fd.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 hl=cv;function g2(){return ov("defaultCurrentScope",(()=>new hl))}function m2(){return ov("defaultIsolationScope",(()=>new hl))}class v2{constructor(e,t){let n,r;n=e||new hl,r=t||new hl,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 c2(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 Ba(){const e=uv(av());return e.stack=e.stack||new v2(g2(),m2())}function _2(e){return Ba().withScope(e)}function y2(e,t){const n=Ba();return n.withScope((()=>(n.getStackTop().scope=e,t(e))))}function Bv(e){return Ba().withScope((()=>e(Ba().getIsolationScope())))}function x2(){return{withIsolationScope:Bv,withScope:_2,withSetScope:y2,withSetIsolationScope:(e,t)=>Bv(t),getCurrentScope:()=>Ba().getScope(),getIsolationScope:()=>Ba().getIsolationScope()}}function sy(e){const t=uv(e);return t.acs?t.acs:x2()}function oy(){return sy(av()).getCurrentScope()}function w2(){return sy(av()).getIsolationScope()}function b2(e,t){return oy().captureException(e,void 0)}function A2(e,t){const n={captureContext:t};return oy().captureMessage(e,void 0,n)}function S2(e,t){w2().setExtra(e,t)}const C2=(...e)=>{let t="";for(const n of e){if(n instanceof Error){const e=n;return S2("exceptionMessage",t),void b2(e)}if("object"!=typeof n)t+=n;else try{t+=" "+JSON.stringify(n)}catch{t+=" "+n}}A2(t)},Gd=()=>"object"!=typeof window,E2="wlsy",ay=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},I2=()=>{const e=new Set,t=ay();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)},uy=e=>{const t=`${E2}`,n=e=>`${t}:${e}`,r=()=>I2().filter((e=>e.startsWith(`${t}:`))),i=e=>e.slice(t.length+1),s=ay(),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}}}},Wv=["debug","info","warn","error"],k2=(e,t)=>{const n=Wv.indexOf(e);return Wv.indexOf(t)>=n},Rd=(e,t,n,...r)=>{k2(t,e)&&console.log(`[${e}] ${n}`,...r)},T2=()=>uy().getItem("logger_lvl"),N2=(e=(Gd()?"info":T2()||"warn"))=>{let t=e;return{debug:(e,...n)=>Rd("debug",t,e,...n),info:(e,...n)=>Rd("info",t,e,...n),warn:(e,...n)=>Rd("warn",t,e,...n),error:(e,...n)=>(C2(e,...n),Rd("error",t,e,...n)),setLevel:e=>{t=e},getLevel:()=>t}},Js=N2(),R2=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 Js.warn(`Could not serialize action type: ${e.type}`,t),{type:e.type,payload:`[Non-serializable payload for action: ${e.type}]`}}},O2=e=>{const t=window.parent??window;if(t)try{const n=R2(e);t.postMessage(n,"*")}catch(e){Js.error("Failed to process or send message:",e)}},cy=()=>dy()?location.hostname:location.hostname.replace(/\w\w\w\.|^/,"."),ly=e=>{const t=new Date;return t.setTime(t.getTime()+24*e*60*60*1e3),t.toUTCString()},fy=e=>Object.keys(e).reduce(((t,n)=>`${t}${n}${!0===e[n]?"":`=${e[n]}`};`),""),L2=(e,t)=>{const n=Gd()?"":document.cookie,r=`; ${t||n}`.split(`; ${e}=`);if(2===r.length)return(r.pop()||"").replace("=","").split(";").shift()},P2=(e,t)=>{Gd()||(document.cookie=fy({[e]:"",path:"/",domain:t||cy(),expires:"Thu, 01 Jan 1970 00:00:01 GMT"}))},M2=["localhost","127.0.0.1","dev.localtest.me","wellesleydev.localtest.me"],dy=()=>M2.includes(location.hostname),U2=(e,t="",n=10,r)=>{Gd()||(document.cookie=fy({[e]:t,path:"/",domain:r||cy(),expires:ly(n),...!dy()&&{SameSite:"None",Secure:!0}}))},lv={set:U2,remove:P2,get:L2,getExpireDate:ly},fv="auth_token",hy=()=>lv.get(fv)||void 0,j2=e=>lv.set(fv,e),F2=()=>lv.remove(fv),D2=()=>!!hy(),B2={getToken:hy,setToken:j2,removeToken:F2,hasToken:D2},$v={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!B2.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},py=Wa({name:"auth",initialState:$v,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...$v,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}}),W2=()=>{window.parent===window?R1().dispatch(py.actions.setAskLoginOpen(!0)):O2(bx())},vl=e=>{const t=ft(Kc.selectors.selectCurrentUser),n=ft(to.selectors.selectIsAuthenticated),r="SUSPENDED"===(null==t?void 0:t.state),i=r;return{isDisabled:i,guardedAction:(e=()=>{})=>()=>{n?n&&!r&&e():W2()},ActionTooltipWrapper:({children:e,triggerClassname:n})=>i?S.jsx(F0,{theme:"dark",tooltipText:`${en(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})}},gy=({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}=J_({user:e,onFollow:a,onUnfollow:o}),p=ev(e.id),{isDisabled:h,ActionTooltipWrapper:v}=vl();return p||s?null:S.jsxs("div",{"data-testid":"followControl",children:[f(),S.jsx(v,{triggerClassname:Ue("l"===t&&"w-full"),children:S.jsx(ey,{user:e,size:t,disabled:n,className:r,follow:()=>{c()},unfollow:()=>{d()},disabled:h,relationship:i,isRelationshipPending:!1,followButtonText:u,unfollowButtonText:l})})]})},dv=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}},$2=({isPopup:e,notification:t})=>{var n,r;const i=pl(),[s]=By(),[a]=Wy(),o=t.fromUser,{relationship:u,isLoading:l}=S_({userId:null==o?void 0:o.id}),{isFollow:c,isFollowRequest:d}=dv(t),f=!(!o||!c),p=!(!o||!d),h=o?en(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(gy,{size:"s",user:o,relationship:u,isRelationshipPending:l}),v?S.jsx("div",{className:Ue("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(Sn,{size:"s",variant:"secondary",className:"min-w-[100px] px-3",onClick:()=>{o&&(a({username:h,user:o}),i(Jc.actions.updateNotification({...t,followResponse:"Rejected"})))},children:"Reject"}),S.jsx(Sn,{size:"s",variant:"primary",className:Ue("min-w-[100px]",e&&"order-first"),onClick:()=>{o&&(s({username:h,user:o}),i(Jc.actions.updateNotification({...t,followResponse:"Accepted"})))},children:"Accept"})]}):null]})},z2=e=>{const{user:t,isLoading:n}=C_(),{data:r,isLoading:i,error:s}=v1(e),a="userId"in e,{data:o,isLoading:u}=_1({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]},my={forever:0,"6h":21600,"12h":43200,"24h":86400,"7 days":604800,"30 days":2592e3},V2=({selected:e,onSelect:t})=>Object.keys(my).map((n=>S.jsxs("span",{className:Ue("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))),vy=({user:e,relationship:t,onMute:n,onUnmute:r})=>{const[i,{isLoading:s}]=y1(),[a,{isLoading:o}]=x1(),[u,l]=$t("forever"),c=e?en(e):"",[d,f,p]=X_(),h=w1(t);return{isLoading:s||o,isMuted:h,mute:f,unmute:()=>{e&&(a({userId:e.id}),ut.success(`${c} is unmuted`),null==r||r())},renderMuteDialog:()=>e?S.jsxs(gl,{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(V2,{selected:u,onSelect:l})}),S.jsx(j0,{variant:"primary",onClick:()=>{(()=>{if(!e)return;const t=my[u];i({userId:e.id,...t&&{duration:t}}),ut.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 _y(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=_y(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Z2(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=_y(e))&&(r&&(r+=" "),r+=t);return r}const zv=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,Q0=Z2,H2=(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=zv(t)||zv(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)},q2=H2("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}}),G2=({name:e,imgUrl:t,size:n=40,className:r})=>{var i;return S.jsxs(t1,{className:Ue(q2({size:n}),r),"data-testid":`userAvatar-${n}`,children:[t&&S.jsx(r1,{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()})]})},Q2={data:null,isPending:!1,isSuccess:!1},br=Wa({name:"userNoHTML",initialState:Q2,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}}),yy="getApiV1UsersRelationships",K2=ss.memoize(((e,t)=>Ks.util.selectCachedArgsForQuery(e,yy).find((e=>e.targets.includes(t))))),hi=({state:e,userId:t,dispatch:n,relationsProps:r})=>{const i=K2(e,t);return i?n(Ks.util.updateQueryData(yy,i,(e=>{e[t]={...e[t],...r}}))):null},xy=3,wy=64,Vv=5,Zv=2,Y2=30,by=50,J2=1024,Ay=30,Hv={link:56,userName:30,pronouns:20,displayName:50,description:J2,fieldLabel:20,fieldContent:80,location:56,timezone:56},Qd={short:"Too short",long:"Too long"},X2=e=>e.replace(/\s+/g," ").trim(),hv=new RegExp("\\p{Extended_Pictographic}","u"),eb=/^[a-zA-Z0-9\s/.]*$/,tb=({showInlineError:e=!0})=>Je.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"),rb=Je.string().trim().min(1,"Display name is required").max(50).regex(/^[^@]*$/,"@ is not allowed").superRefine(((e,t)=>{const n=hv.test(e),r=/[a-zA-Z0-9]/.test(e);n&&!r&&t.addIssue({code:Je.ZodIssueCode.custom,message:"Emojis alone are not allowed. Please add text"})})),nb=Je.string().max(1024,Qd.long).optional(),Sy=({minLength:e,minErrorMessage:t,maxLength:n,regexErrorMessage:r})=>Je.string().trim().min(e,t).max(n,Qd.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,r);Sy({minLength:2,maxLength:30,regexErrorMessage:"Invalid characters. ex.: group_name_1"}),Sy({minLength:2,minErrorMessage:Qd.short,maxLength:30,regexErrorMessage:"Invalid characters. ex.: channel_name_1"}),Je.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 ib="Required: A-Z, a-z, 0-9, special character, min 3, max 64";Je.string().trim().superRefine(((e,t)=>{hv.test(e)&&t.addIssue({code:Je.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:Je.ZodIssueCode.custom,message:ib})})),Je.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=>!hv.test(e)),"Emojis are not allowed");const sb=e=>eb.test(e);Je.string().max(Hv.pronouns,`Maximum ${Hv.pronouns} characters`).refine((e=>sb(e)),'Special characters !@#$%^*()+={} []:;", are not allowed').transform(X2).optional(),Je.object({bio:nb,username:tb({showInlineError:!0}),displayName:rb}),Je.object({show:Je.boolean(),dateOnly:Je.boolean(),date:Je.date().optional().nullable()}),Je.object({show:Je.boolean(),dateOnly:Je.boolean(),date:Je.date().optional().nullable()});const qv=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}},ob="FollowersListHidden",ab="FollowingListHidden",jc=e=>{var t,n;const r=null==(n=null==(t=null==e?void 0:e.error)?void 0:t.data)?void 0:n.errorCode;return r===ob||r===ab},ub=Ks.enhanceEndpoints({endpoints:{deleteApiV1Users:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await at(n)&&await t(Ks.endpoints.getApiV1AccountsProfile.initiate({htmlContent:!1})).unwrap()}catch(e){ut.error(`${Xr(e)}`)}}},getApiV1AccountsProfile:{providesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){t(B0(!0));try{const e=await at(n);e&&t(O_(e.data)),t(W0(!0))}catch(e){t(W0(!1)),t(R_(!0)),t(N_(e))}finally{t(B0(!1))}}},putApiV1UsersByUserId:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,ut.success("User updated successfully")}catch(e){const t=e.error,{isError:n}=qv(t);!n&&ut.error(`${Xr(t)}`)}}},getApiV1Users:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){const r=!e.htmlContent;try{r&&t(br.actions.setPending(!0));const e=await at(n);r&&e&&(t(br.actions.setUser(e.data)),t(br.actions.setSuccess(!0)),t(br.actions.setPending(!1)))}catch(e){r&&(t(br.actions.setSuccess(!1)),t(br.actions.setError(e)),t(br.actions.setPending(!1))),ut.error(`${Xr(e)}`)}}},postApiV1Users:{invalidatesTags:["Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,ut.success("User created successfully")}catch(e){const t=e.error,{isError:n}=qv(t);!n&&ut.error(`${Xr(t)}`)}}},getApiV1UsersFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!jc(e)){const t=e;ut.error(`${Xr(t.error)}`)}}}},getApiV1UsersRemoteByUserNameFullFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!jc(e)){const t=e;ut.error(`${Xr(t.error)}`)}}}},getApiV1UsersByUserId:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){const r=!e.htmlContent;try{r&&t(br.actions.setPending(!0));const e=await at(n);r&&e&&(t(br.actions.setUser(e.data)),t(br.actions.setSuccess(!0)),t(br.actions.setPending(!1)))}catch(e){r&&(t(br.actions.setSuccess(!1)),t(br.actions.setError(e)),t(br.actions.setPending(!1))),ut.error(`${Xr(e)}`)}}},getApiV1UsersByUserIdFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!jc(e)){const t=e;ut.error(`${Xr(t.error)}`)}}}},getApiV1UsersFollowees:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!jc(e)){const t=e;ut.error(`${Xr(t.error)}`)}}}},getApiV1UsersByUserIdFollowing:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!jc(e)){const t=e;ut.error(`${Xr(t.error)}`)}}}},postApiV1UsersFollowByUsernameAccept:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n,getState:r}){const i=hi({dispatch:n,userId:e.user.id,state:r(),relationsProps:{followed:"ACCEPTED"}});await at(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=hi({dispatch:n,userId:e.user.id,state:r(),relationsProps:{followed:"REJECTED"}});await at(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 at(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=hi({dispatch:n,userId:e.user.id,state:r(),relationsProps:{following:null}});await at(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=hi({userId:e.userId,dispatch:r,state:n(),relationsProps:{blocked:!0}});await at(t,void 0,(()=>null==i?void 0:i.undo()))}},deleteApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=hi({userId:e.userId,dispatch:r,state:n(),relationsProps:{blocked:!1,muted:{state:!1}}});await at(t,void 0,(()=>null==i?void 0:i.undo()))}},postApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:n,dispatch:r}){const i=hi({userId:e,dispatch:r,state:n(),relationsProps:{muted:{state:!0}}});await at(t,void 0,(()=>null==i?void 0:i.undo()))}},deleteApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:n,dispatch:r}){const i=hi({userId:e,dispatch:r,state:n(),relationsProps:{muted:{state:!1}}});await at(t,void 0,(()=>null==i?void 0:i.undo()))}},getApiV1Mute:{async onQueryStarted(e,{queryFulfilled:t}){await at(t)}},getApiV1UsersRelationships:{providesTags:(e,t,{targets:n})=>n.map((e=>({type:"Relationship",id:e}))),async onQueryStarted(e,{queryFulfilled:t}){await at(t)}},postApiV1AdminUserChangeState:{invalidatesTags:["Secure"],async onQueryStarted(e,{queryFulfilled:t}){await at(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=hi({userId:i,dispatch:r,state:n(),relationsProps:{note:s}});await at(t,"Note has been updated",(()=>null==a?void 0:a.undo()))}},deleteApiV1NotesByUserId:{async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=hi({userId:e.userId,dispatch:r,state:n(),relationsProps:{note:""}});await at(t,"Note has been removed",(()=>null==i?void 0:i.undo()))}},postApiV1UsersFollowByUsernamePend:{async onQueryStarted(e,{queryFulfilled:t}){await at(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:CS,usePostApiV1UsersMutation:ES,useDeleteApiV1AccountsDeleteMutation:IS,useGetApiV1AccountsProfileQuery:kS,usePutApiV1UsersByUserIdMutation:TS,useGetApiV1UsersQuery:NS,useDeleteApiV1UsersMutation:RS,usePostApiV1MuteByUserIdMutation:OS,useDeleteApiV1MuteByUserIdMutation:LS,useGetApiV1MuteQuery:PS,usePostApiV1AdminUserChangeStateMutation:MS,useGetApiV1UsersRelationshipsQuery:cb,usePutApiV1NotesMutation:US,useDeleteApiV1NotesByUserIdMutation:jS,useLazyGetApiV1UsersRelationshipsQuery:lb,useLazyGetApiV1GeoQuery:FS,useLazyGetApiV1GroupsOwnedQuery:DS,useGetApiV1UsersFollowersQuery:BS,useGetApiV1UsersByUserIdQuery:WS,useLazyGetApiV1UsersRenameHistoryQuery:$S,useGetApiV1UsersByUserIdFollowersQuery:zS,useGetApiV1UsersByUserIdFollowingQuery:VS,useGetApiV1UsersFolloweesQuery:ZS,usePostApiV1UsersFollowByUsernameMutation:HS,usePostApiV1UsersFollowByUsernameUndoMutation:qS,usePostApiV1UsersFollowByUsernameRejectMutation:GS,usePostApiV1UsersFollowByUsernameAcceptMutation:QS,useGetApiV1UsersRemoteByUserNameFullFollowersQuery:KS}=ub,fb=()=>{const e=ft(Kc.selectors.selectCurrentUser),t=ft(py.selectors.selectIsAuthenticated);return{user:e,isLoading:ft(Kc.selectors.selectPending),isLogged:t,error:ft(Kc.selectors.selectError)}},Cy=({onChange:e})=>{const{user:t}=fb(),n=null==t?void 0:t.id,r=vi(n);Or((()=>{r.current?n!==r.current&&(e(),r.current=n):r.current=n}),[n,r.current])},Gv=["following","followed","blocked","muted","note","blocked_by"],Qv=({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}},db=({userId:e,skip:t})=>{const n=ft(Kc.selectors.selectCurrentUser),r=null==n?void 0:n.id,{canFetch:i,isSingleUser:s,safeTargets:a}=Qv({userId:e,currentUserId:r}),{data:o,isLoading:u}=cb({targets:a,filter:Gv},{skip:!i||t}),[l]=lb(),c=({userId:e})=>{const{canFetch:t,safeTargets:n}=Qv({userId:e,currentUserId:r});t&&l({targets:n,filter:Gv})};return Cy({onChange:()=>{c({userId:a})}}),{relationship:(s?null==o?void 0:o[e]:o)||{},isLoading:u,updateRelations:c}},hb=e=>e.replace(/(<)/g,"<").replace(/>/g,">"),Kv=(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,pb={list:[]},gb=Wa({name:"emojis",initialState:pb,reducers:{addEmoji:(e,t)=>{e.list.push(t.payload)},addList:(e,t)=>{e.list=t.payload}},selectors:{selectEmojis:e=>e.list}}).injectInto(E_);var Kd=(e=>(e.header="header",e.avatar="avatar",e))(Kd||{});const pv=({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""}},mb="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",vb="Enter",K0=52,_b=e=>{const[t,n]=$t((null==e?void 0:e.length)||0),r=vi(null),i=vi(null);return{inputRef:r,textareaRef:i,charCount:t,setCharCount:n,handleKeyDown:e=>{var t,n;e.key===vb&&(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=yb(t);setTimeout((()=>{if(t.style.height="52px",!i)return;const e=Math.max(t.scrollHeight,52);t.style.height=`${e}px`}),0)}}},yb=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}},Yv=52,qc=200,xb=10,wb=Je.object({note:Je.string().max(qc)}),bb=({userId:e,note:t="",className:n,resizable:r=!1})=>{const[i]=b1(),[s]=A1(),a=ft(to.selectors.selectIsAuthenticated),o=ft(tv.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=X0({resolver:W_(wb)}),{inputRef:f,textareaRef:p,charCount:h,setCharCount:v,handleTextareaChange:m,handleKeyDown:g}=_b(t);if(!u&&a)return S.jsx(v_,{...d,children:S.jsxs("form",{className:Ue("my-5",n),onKeyDown:g,children:[h>=190&&S.jsxs("div",{className:"mb-xxs text-right text-sm text-gray-400",children:[qc-h," characters left"]}),S.jsx(__,{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:qc,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:qc,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:mb,alt:"user note",className:"absolute bottom-0 right-0"})]})})]})})},Jv=({status:e,iconOnly:t=!1,clasName:n})=>{const r="muted"===e?S.jsx(k_,{size:16}):S.jsx(T_,{size:16}),i="muted"===e?"text-brown outline-brown":"text-red-dark outline-red-dark";return S.jsxs("div",{className:Ue(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&&ss.capitalize(e)]})},Ab=({children:e})=>S.jsx("span",{className:"line-clamp-2 block text-ellipsis whitespace-pre-wrap break-words text-left",children:e}),Ey=({user:e,status:t,skip:n=!1})=>{const r=ft(tv.selectors.selectCurrentUser),i=ft(to.selectors.selectIsAuthenticated),s=!n&&i,[a,o]=$t(!1),u=e&&!e.local&&e.domain?`@${e.username}@${e.domain}`:void 0,l=(null==e?void 0:e.id)||(null==r?void 0:r.id),c=!(t||!l||!s),d=!(!t||!i||c||!s||u),{data:f,isLoading:p,error:h}=S1({userNameFull:u},{skip:!u||a}),{data:v,isLoading:m,error:g}=C1({status:t},{skip:c||!d||a}),{data:y,isLoading:_,error:x}=E1({userId:l},{skip:d||!c||a}),b=(c?[...y||[],...f||[]]:null)||v,w=m||_||p;return Or((()=>{(Qc(g)||Qc(x)||Qc(h))&&o(!0)}),[g,x,h]),[b,w,a]},Zn={first:"first",second:"second"},Sb=({user:e,showEmpty:t=!0,className:n,renderModal:r,...i})=>{var s;const[a,o]=Ey({user:e}),[u,l]=$t({open:!1,tab:Zn.first}),{guardedAction:c,ActionTooltipWrapper:d}=vl(),f=(null==a?void 0:a.length)||(null==(s=e.stats)?void 0:s.followers)||0,p=1===f?"follower":"followers",h=(null==a?void 0:a.slice(0,3))||[];return o?S.jsx(jd,{className:"mx-auto mb-4 h-7 w-[200px]"}):0!==f||t?S.jsxs("div",{"data-testid":"user-followers",children:[u.open&&(null==r?void 0:r({user:e,tab:u.tab,isOpen:!0,onClose:()=>l((e=>({...e,open:!1}))),...i})),S.jsx(d,{children:S.jsxs("div",{onClick:c((()=>{l({tab:Zn.first,open:!0})})),className:Ue("mb-4 flex cursor-pointer items-center text-base font-medium text-gray-900",n),children:[h.length>0&&S.jsx("ul",{className:"mr-2 flex items-center",children:h.map(((e,t)=>S.jsx("li",{className:Ue("relative",t>0&&"-ml-2"),children:S.jsx("div",{className:"rounded-full bg-white p-0.5",children:S.jsx(rv,{size:24,name:e.displayName,imgUrl:pv({user:e,type:Kd.avatar})})})},e.id)))}),f," ",p]})})]}):null},Cb=({status:e,userId:t,skip:n=!1})=>{const r=ft(to.selectors.selectIsAuthenticated),i=!!e&&r,[s,a]=$t(!1),{data:o,isLoading:u,error:l}=I1({status:e},{skip:!i||n||s}),{data:c,isLoading:d,error:f}=k1({userId:t},{skip:i||!t||!r||n||s}),p=o||c,h=u||d;return Or((()=>{(Qc(l)||Qc(f))&&a(!0)}),[l,f]),{data:p,isLoading:h,isHidden:s}},Eb=({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(mx,{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(d1,{baseUrl:e,children:S.jsx("a",{href:e,children:S.jsxs(Sn,{variant:"secondary",className:"gap-xxs font-semibold",children:["See more followers ",S.jsx(hx,{})]})})})]}),Yd="staticState",Iy=uy(),Dd={path:"",baseUrl:"",search:""},Ib=e=>{if(!e)return Dd;try{return JSON.parse(decodeURIComponent(e))||Dd}catch(e){return Js.error("Error parsing static state",e),Dd}},ky=()=>new URLSearchParams(window.location.search).get(Yd),kb=({path:e,baseUrl:t,search:n}={})=>{const{pathname:r,origin:i,search:s}=window.location;return`${Yd}=${encodeURIComponent(JSON.stringify({path:e||r,baseUrl:t||i,search:n||s}))}`},Tb=()=>{const e=ky();return e&&Iy.setItem(Yd,e),Ty()},Ty=()=>{try{const e=Iy.getItem(Yd)||ky();return Ib(e)}catch(e){return Js.error("Error parsing static state",e),Dd}},Nb={create:kb,init:Tb,get:Ty},Rb=e=>{const{baseUrl:t}=Nb.get();return e.local?`${t}/@${e.username}`:`https://${e.domain}/@${e.username}`};var Xv,Gc={exports:{}},Ob=Gc.exports;
|
|
42
|
+
*/ye("remoteReady");const bx=ye("askLogin");ye("reselectUser"),ye("requestLogout"),ye("setConfirmLeavePage"),ye("requestChangePath");const Ax=ye("wsSubscribe"),Sx=ye("wsUnSubscribe");ye("hostStoreConnect"),ye("remoteLogin"),ye("remoteLogout"),ye("wsOnMessage"),ye("setRouterPath"),ye("setDeviceType"),ye("setDeviceWidth");const N_=ye("setUserError"),R_=ye("setUserIsError"),B0=ye("setUserPending"),W0=ye("setUserSuccess"),O_=ye("setUserData"),Cx=ye("updateAccountData"),Ex=ye("updateUser"),L_=ye("addNotification"),P_=ye("markNotification"),M_=ye("setNotificationsError"),U_=ye("setNotificationsList"),$0=ye("setNotificationsPending"),j_=ye("setNotificationsTotalCount"),z0=ye("setNotificationsUnreadCount"),Ix=ye("acceptAllFollowRequests"),F_=ye("resetNotificationsState"),D_=ye("undoNotification");ye("setInstanceInfo"),ye("setInstanceInfoPending"),ye("setInstanceInfoError"),ye("setPlatformSettings"),ye("setProfileSettings"),ye("setGroupData"),ye("setGroupLoading"),m_("requestMicroFrontendFetch"),m_("sendMicroFrontendFetchResponse");const kx=Ks.enhanceEndpoints({endpoints:{getApiV1Notifications:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n,getState:r}){var i;t($0(!0));try{const e=await at(n),s=(null==(i=r().user.data)?void 0:i.selectedUserId)||"";e&&t(U_({userId:s,list:e.data}))}catch(e){t(M_(e))}finally{t($0(!1))}}},postApiV1NotificationsByIdMark:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await at(n),t(P_(e))}catch(e){ut.error(`Mark notification error, ${e}`)}}},postApiV1NotificationsMarkAll:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){await at(n),t(z0(0))}},getApiV1NotificationsCount:{async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{const r=await at(n),i=!e.status;r&&t(i?j_(r.data):z0(r.data))}catch(e){ut.error(`Error getting unread notifications count', ${e}`)}}}}}),{useGetApiV1NotificationsQuery:Tx,usePostApiV1NotificationsByIdMarkMutation:Nx,usePostApiV1NotificationsMarkAllMutation:bS,useGetApiV1NotificationsCountQuery:Rx}=kx,kv={data:{userId:"",list:[]},count:{},isPending:!1},Ox=e=>e,Lx=e=>e.error,Px=e=>e.isPending,Mx=e=>{var t;return null==(t=e.count)?void 0:t.total},Ux=e=>{var t;return null==(t=e.count)?void 0:t.unread},jx=e=>e.data.userId,nv=J0(Ox,(e=>e.data.list)),Fx=J0(nv,(e=>null==e?void 0:e.filter((e=>"UNREAD"===e.status)))),Dx=J0(nv,(e=>null==e?void 0:e.at(-1))),Jc=Wa({name:"notifications",initialState:kv,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($0,((e,t)=>{e.isPending=t.payload})).addCase(M_,((e,t)=>{e.error=t.payload})).addCase(U_,((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(L_,((e,t)=>{e.count.unread=(e.count.unread||0)+1,e.data.list&&(e.data.list=[t.payload,...e.data.list||[]])})).addCase(P_,((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(j_,((e,t)=>{e.count.total=t.payload})).addCase(z0,((e,t)=>{e.count.unread=t.payload})).addCase(F_,(()=>kv)).addCase(D_,((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)))||[]})).addCase(Ix,(e=>{e.data.list&&(e.data.list=e.data.list.map((e=>"FOLLOW_REQUEST"===e.type?{...e,followResponse:"Accepted"}:e)))}))},selectors:{selectError:Lx,selectIsPending:Px,selectTotalCount:Mx,selectUnreadCount:Ux,selectNotifications:nv,selectUnreadNotifications:Fx,selectLastNotification:Dx,selectNotificationsOwner:jx}}),AS=()=>S.jsx(Vy,{position:"top-right",theme:"dark",limit:5,autoClose:5e3,containerId:"custom",hideProgressBar:!0,className:"custom-notifications"}),SS=(e,t)=>Zy(e,{...t,containerId:"custom"});var Tv=function(e,t,n){if(e&&"reportValidity"in e){var r=D0(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},B_=function(e,t){var n=function(n){var r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Tv(r.ref,n,e):r.refs&&r.refs.forEach((function(t){return Tv(t,n,e)}))};for(var r in t.fields)n(r)},Bx=function(e,t){t.shouldUseNativeValidation&&B_(e,t);var n={};for(var r in e){var i=D0(t.fields,r),s=Object.assign(e[r]||{},{ref:i&&i.ref});if(Wx(t.names||Object.keys(e),r)){var a=Object.assign({},D0(n,r));C0(a,"root",s),C0(n,r,a)}else C0(n,r,s)}return n},Wx=function(e,t){return e.some((function(e){return e.startsWith(t+".")}))},$x=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]=c1(a,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n},W_=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&&B_({},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:Bx($x(e.errors,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)};throw e})))}catch(e){return Promise.reject(e)}}};const zx=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")}},Vx=e=>{const t=e.links.find((e=>"http://ostatus.org/schema/1.0/subscribe"===e.rel));return null==t?void 0:t.template},Zx=({template:e,user:t})=>null==e?void 0:e.replace("{uri}",t.uri),Hx=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},qx=({user:e})=>async({url:t})=>{const n=zx(t);try{const t=`${n}/.well-known/webfinger?resource=${n}`,r=await Hx({url:t,headers:{Accept:"application/json"}});if(!r)return;const i=Vx(r),s=Zx({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")}},Gx=(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?ss.capitalize(s):t}</mark>`);return r&&a?o:ss.capitalize(o)},Nv=e=>{e.preventDefault()},Qx=e=>e?{onOpenAutoFocus:Nv,onCloseAutoFocus:Nv}:{},gl=({open:e,modal:t,children:n,onCloseModal:r,className:i,skipModalAutofocus:s=!1,...a})=>e?S.jsx(Hy,{open:e,modal:t,onOpenChange:e=>{e||null==r||r()},children:S.jsx(qy,{className:Ue(i),closeSize:"small",closeVariant:"insideCard",onCloseModal:r,...a,...Qx(s),childrenClassName:Ue("overflow-auto",a.title?"max-h-[calc(90vh-65px)]":"max-h-[90vh]",a.childrenClassName),children:n})}):null;var Ae,V0;!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={})),(V0||(V0={})).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"]),ns=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"]),Kx=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Rr 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 Rr))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()}}Rr.create=e=>new Rr(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 $_=ja;function Yx(e){$_=e}function Bd(){return $_}const Wd=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}},Jx=[];function G(e,t){const n=Bd(),r=Wd({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 se;"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 se;"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 se=Object.freeze({status:"aborted"}),La=e=>({status:"dirty",value:e}),lr=e=>({status:"valid",value:e}),Z0=e=>"aborted"===e.status,H0=e=>"dirty"===e.status,Xc=e=>"valid"===e.status,el=e=>typeof Promise<"u"&&e instanceof Promise;function $d(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 z_(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 X,Zc,Hc;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(X||(X={}));class qn{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 Rv=(e,t)=>{if(Xc(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 Rr(e.common.issues);return this._error=t,this._error}}};function me(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 _e{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return ns(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ns(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:ns(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(el(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:ns(e)},i=this._parseSync({data:e,path:r.path,parent:r});return Rv(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:ns(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(el(r)?r:Promise.resolve(r));return Rv(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 En({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Hn.create(this,this._def)}nullable(){return cs.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Cn.create(this,this._def)}promise(){return Da.create(this,this._def)}or(e){return il.create([this,e],this._def)}and(e){return sl.create(this,e,this._def)}transform(e){return new En({...me(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ll({...me(this._def),innerType:this,defaultValue:t,typeName:ne.ZodDefault})}brand(){return new iv({typeName:ne.ZodBranded,type:this,...me(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new fl({...me(this._def),innerType:this,catchValue:t,typeName:ne.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ml.create(this,e)}readonly(){return dl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Xx=/^c[^\s-]{8,}$/i,ew=/^[0-9a-z]+$/,tw=/^[0-9A-HJKMNP-TV-Z]{26}$/,rw=/^[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,nw=/^[a-z0-9_-]{21}$/i,iw=/^[-+]?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)?)??$/,sw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ow="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let O0;const aw=/^(?:(?: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])$/,uw=/^(([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})))$/,cw=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,V_="((\\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])))",lw=new RegExp(`^${V_}$`);function Z_(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 fw(e){return new RegExp(`^${Z_(e)}$`)}function H_(e){let t=`${V_}T${Z_(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 dw(e,t){return!(("v4"!==t&&t||!aw.test(e))&&("v6"!==t&&t||!uw.test(e)))}class An extends _e{_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}),se}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)sw.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)O0||(O0=new RegExp(ow,"u")),O0.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)rw.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)nw.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)Xx.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)ew.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)tw.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?H_(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?lw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{code:W.invalid_string,validation:"date",message:r.message}),t.dirty()):"time"===r.kind?fw(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?iw.test(e.data)||(n=this._getOrReturnCtx(e,n),G(n,{validation:"duration",code:W.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?dw(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?cw.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,...X.errToObj(n)})}_addCheck(e){return new An({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...X.errToObj(e)})}url(e){return this._addCheck({kind:"url",...X.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...X.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...X.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...X.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...X.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...X.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...X.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...X.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...X.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,...X.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,...X.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...X.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...X.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...X.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...X.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...X.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...X.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...X.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...X.errToObj(t)})}nonempty(e){return this.min(1,X.errToObj(e))}trim(){return new An({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new An({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new An({...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 hw(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)}An.create=e=>{var t;return new An({checks:[],typeName:ne.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...me(e)})};class os extends _e{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}),se}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!==hw(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,X.toString(t))}gt(e,t){return this.setLimit("min",e,!1,X.toString(t))}lte(e,t){return this.setLimit("max",e,!0,X.toString(t))}lt(e,t){return this.setLimit("max",e,!1,X.toString(t))}setLimit(e,t,n,r){return new os({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:X.toString(r)}]})}_addCheck(e){return new os({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:X.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:X.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:X.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:X.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:X.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:X.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:X.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:X.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:X.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)}}os.create=e=>new os({checks:[],typeName:ne.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...me(e)});class as extends _e{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}),se}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,X.toString(t))}gt(e,t){return this.setLimit("min",e,!1,X.toString(t))}lte(e,t){return this.setLimit("max",e,!0,X.toString(t))}lt(e,t){return this.setLimit("max",e,!1,X.toString(t))}setLimit(e,t,n,r){return new as({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:X.toString(r)}]})}_addCheck(e){return new as({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:X.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:X.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:X.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:X.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:X.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}}as.create=e=>{var t;return new as({checks:[],typeName:ne.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...me(e)})};class tl extends _e{_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}),se}return lr(e.data)}}tl.create=e=>new tl({typeName:ne.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...me(e)});class Xs extends _e{_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}),se}if(isNaN(e.data.getTime())){return G(this._getOrReturnCtx(e),{code:W.invalid_date}),se}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 Xs({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:X.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:X.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}}Xs.create=e=>new Xs({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ne.ZodDate,...me(e)});class zd extends _e{_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}),se}return lr(e.data)}}zd.create=e=>new zd({typeName:ne.ZodSymbol,...me(e)});class rl extends _e{_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}),se}return lr(e.data)}}rl.create=e=>new rl({typeName:ne.ZodUndefined,...me(e)});class nl extends _e{_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}),se}return lr(e.data)}}nl.create=e=>new nl({typeName:ne.ZodNull,...me(e)});class Fa extends _e{constructor(){super(...arguments),this._any=!0}_parse(e){return lr(e.data)}}Fa.create=e=>new Fa({typeName:ne.ZodAny,...me(e)});class Ys extends _e{constructor(){super(...arguments),this._unknown=!0}_parse(e){return lr(e.data)}}Ys.create=e=>new Ys({typeName:ne.ZodUnknown,...me(e)});class _i extends _e{_parse(e){const t=this._getOrReturnCtx(e);return G(t,{code:W.invalid_type,expected:Q.never,received:t.parsedType}),se}}_i.create=e=>new _i({typeName:ne.ZodNever,...me(e)});class Vd extends _e{_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}),se}return lr(e.data)}}Vd.create=e=>new Vd({typeName:ne.ZodVoid,...me(e)});class Cn extends _e{_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}),se;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 qn(t,e,t.path,n))))).then((e=>Yt.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>r.type._parseSync(new qn(t,e,t.path,n))));return Yt.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new Cn({...this._def,minLength:{value:e,message:X.toString(t)}})}max(e,t){return new Cn({...this._def,maxLength:{value:e,message:X.toString(t)}})}length(e,t){return new Cn({...this._def,exactLength:{value:e,message:X.toString(t)}})}nonempty(e){return this.min(1,e)}}function Oa(e){if(e instanceof it){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Hn.create(Oa(r))}return new it({...e._def,shape:()=>t})}return e instanceof Cn?new Cn({...e._def,type:Oa(e.element)}):e instanceof Hn?Hn.create(Oa(e.unwrap())):e instanceof cs?cs.create(Oa(e.unwrap())):e instanceof Gn?Gn.create(e.items.map((e=>Oa(e)))):e}Cn.create=(e,t)=>new Cn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...me(t)});class it extends _e{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}),se}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof _i&&"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 qn(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof _i){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 qn(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 X.errToObj,new it({...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=X.errToObj(e).message)&&void 0!==a?a:o}:{message:o}}}:{}})}strip(){return new it({...this._def,unknownKeys:"strip"})}passthrough(){return new it({...this._def,unknownKeys:"passthrough"})}extend(e){return new it({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new it({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 it({...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 it({...this._def,shape:()=>t})}omit(e){const t={};return Ae.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new it({...this._def,shape:()=>t})}deepPartial(){return Oa(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 it({...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 Hn;)e=e._def.innerType;t[n]=e}})),new it({...this._def,shape:()=>t})}keyof(){return q_(Ae.objectKeys(this.shape))}}it.create=(e,t)=>new it({shape:()=>e,unknownKeys:"strip",catchall:_i.create(),typeName:ne.ZodObject,...me(t)}),it.strictCreate=(e,t)=>new it({shape:()=>e,unknownKeys:"strict",catchall:_i.create(),typeName:ne.ZodObject,...me(t)}),it.lazycreate=(e,t)=>new it({shape:e,unknownKeys:"strip",catchall:_i.create(),typeName:ne.ZodObject,...me(t)});class il extends _e{_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 Rr(e.ctx.common.issues)));return G(t,{code:W.invalid_union,unionErrors:n}),se}));{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 Rr(e)));return G(t,{code:W.invalid_union,unionErrors:i}),se}}get options(){return this._def.options}}il.create=(e,t)=>new il({options:e,typeName:ne.ZodUnion,...me(t)});const gi=e=>e instanceof al?gi(e.schema):e instanceof En?gi(e.innerType()):e instanceof ul?[e.value]:e instanceof us?e.options:e instanceof cl?Ae.objectValues(e.enum):e instanceof ll?gi(e._def.innerType):e instanceof rl?[void 0]:e instanceof nl?[null]:e instanceof Hn?[void 0,...gi(e.unwrap())]:e instanceof cs?[null,...gi(e.unwrap())]:e instanceof iv||e instanceof dl?gi(e.unwrap()):e instanceof fl?gi(e._def.innerType):[];class qd extends _e{_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}),se;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]}),se)}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=gi(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 qd({typeName:ne.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...me(n)})}}function q0(e,t){const n=ns(e),r=ns(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=q0(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=q0(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 sl extends _e{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Z0(e)||Z0(r))return se;const i=q0(e.value,r.value);return i.valid?((H0(e)||H0(r))&&t.dirty(),{status:t.value,value:i.data}):(G(n,{code:W.invalid_intersection_types}),se)};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}))}}sl.create=(e,t,n)=>new sl({left:e,right:t,typeName:ne.ZodIntersection,...me(n)});class Gn extends _e{_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}),se;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"}),se;!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 qn(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 Gn({...this._def,rest:e})}}Gn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Gn({items:e,typeName:ne.ZodTuple,rest:null,...me(t)})};class ol extends _e{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}),se;const r=[],i=this._def.keyType,s=this._def.valueType;for(const e in n.data)r.push({key:i._parse(new qn(n,e,n.path,e)),value:s._parse(new qn(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 ol(t instanceof _e?{keyType:e,valueType:t,typeName:ne.ZodRecord,...me(n)}:{keyType:An.create(),valueType:e,typeName:ne.ZodRecord,...me(t)})}}class Zd extends _e{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}),se;const r=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map((([e,t],s)=>({key:r._parse(new qn(n,e,n.path,[s,"key"])),value:i._parse(new qn(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 se;("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 se;("dirty"===r.status||"dirty"===i.status)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}Zd.create=(e,t,n)=>new Zd({valueType:t,keyType:e,typeName:ne.ZodMap,...me(n)});class eo extends _e{_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}),se;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 se;"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 qn(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>s(e))):s(a)}min(e,t){return new eo({...this._def,minSize:{value:e,message:X.toString(t)}})}max(e,t){return new eo({...this._def,maxSize:{value:e,message:X.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}eo.create=(e,t)=>new eo({valueType:e,minSize:null,maxSize:null,typeName:ne.ZodSet,...me(t)});class Ma extends _e{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}),se;function n(e,n){return Wd({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Bd(),ja].filter((e=>!!e)),issueData:{code:W.invalid_arguments,argumentsError:n}})}function r(e,n){return Wd({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Bd(),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 Da){const e=this;return lr((async function(...t){const a=new Rr([]),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 lr((function(...t){const a=e._def.args.safeParse(t,i);if(!a.success)throw new Rr([n(t,a.error)]);const o=Reflect.apply(s,this,a.data),u=e._def.returns.safeParse(o,i);if(!u.success)throw new Rr([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:Gn.create(e).rest(Ys.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||Gn.create([]).rest(Ys.create()),returns:t||Ys.create(),typeName:ne.ZodFunction,...me(n)})}}class al extends _e{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})}}al.create=(e,t)=>new al({getter:e,typeName:ne.ZodLazy,...me(t)});class ul extends _e{_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}),se}return{status:"valid",value:e.data}}get value(){return this._def.value}}function q_(e,t){return new us({values:e,typeName:ne.ZodEnum,...me(t)})}ul.create=(e,t)=>new ul({value:e,typeName:ne.ZodLiteral,...me(t)});class us extends _e{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}),se}if($d(this,Zc)||z_(this,Zc,new Set(this._def.values)),!$d(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}),se}return lr(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 us.create(e,{...this._def,...t})}exclude(e,t=this._def){return us.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}Zc=new WeakMap,us.create=q_;class cl extends _e{constructor(){super(...arguments),Hc.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}),se}if($d(this,Hc)||z_(this,Hc,new Set(Ae.getValidEnumValues(this._def.values))),!$d(this,Hc).has(e.data)){const e=Ae.objectValues(t);return G(n,{received:n.data,code:W.invalid_enum_value,options:e}),se}return lr(e.data)}get enum(){return this._def.values}}Hc=new WeakMap,cl.create=(e,t)=>new cl({values:e,typeName:ne.ZodNativeEnum,...me(t)});class Da extends _e{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}),se;const n=t.parsedType===Q.promise?t.data:Promise.resolve(t.data);return lr(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Da.create=(e,t)=>new Da({type:e,typeName:ne.ZodPromise,...me(t)});class En extends _e{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 se;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?se:"dirty"===r.status||"dirty"===t.value?La(r.value):r}));{if("aborted"===t.value)return se;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?se:"dirty"===r.status||"dirty"===t.value?La(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?se:("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?se:("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(!Xc(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=>Xc(e)?Promise.resolve(r.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Ae.assertNever(r)}}En.create=(e,t,n)=>new En({schema:e,typeName:ne.ZodEffects,effect:t,...me(n)}),En.createWithPreprocess=(e,t,n)=>new En({schema:t,effect:{type:"preprocess",transform:e},typeName:ne.ZodEffects,...me(n)});class Hn extends _e{_parse(e){return this._getType(e)===Q.undefined?lr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Hn.create=(e,t)=>new Hn({innerType:e,typeName:ne.ZodOptional,...me(t)});class cs extends _e{_parse(e){return this._getType(e)===Q.null?lr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}cs.create=(e,t)=>new cs({innerType:e,typeName:ne.ZodNullable,...me(t)});class ll extends _e{_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}}ll.create=(e,t)=>new ll({innerType:e,typeName:ne.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...me(t)});class fl extends _e{_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 el(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Rr(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Rr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}fl.create=(e,t)=>new fl({innerType:e,typeName:ne.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...me(t)});class Hd extends _e{_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}),se}return{status:"valid",value:e.data}}}Hd.create=e=>new Hd({typeName:ne.ZodNaN,...me(e)});const pw=Symbol("zod_brand");class iv extends _e{_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 ml extends _e{_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?se:"dirty"===e.status?(t.dirty(),La(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?se:"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 ml({in:e,out:t,typeName:ne.ZodPipeline})}}class dl extends _e{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Xc(e)&&(e.value=Object.freeze(e.value)),e);return el(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function G_(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()}dl.create=(e,t)=>new dl({innerType:e,typeName:ne.ZodReadonly,...me(t)});const gw={object:it.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 mw=(e,t={message:`Input not instance of ${e.name}`})=>G_((t=>t instanceof e),t),Q_=An.create,K_=os.create,vw=Hd.create,_w=as.create,Y_=tl.create,yw=Xs.create,xw=zd.create,ww=rl.create,bw=nl.create,Aw=Fa.create,Sw=Ys.create,Cw=_i.create,Ew=Vd.create,Iw=Cn.create,kw=it.create,Tw=it.strictCreate,Nw=il.create,Rw=qd.create,Ow=sl.create,Lw=Gn.create,Pw=ol.create,Mw=Zd.create,Uw=eo.create,jw=Ma.create,Fw=al.create,Dw=ul.create,Bw=us.create,Ww=cl.create,$w=Da.create,Ov=En.create,zw=Hn.create,Vw=cs.create,Zw=En.createWithPreprocess,Hw=ml.create,qw=()=>Q_().optional(),Gw=()=>K_().optional(),Qw=()=>Y_().optional(),Kw={string:e=>An.create({...e,coerce:!0}),number:e=>os.create({...e,coerce:!0}),boolean:e=>tl.create({...e,coerce:!0}),bigint:e=>as.create({...e,coerce:!0}),date:e=>Xs.create({...e,coerce:!0})},Yw=se;var Je=Object.freeze({__proto__:null,defaultErrorMap:ja,setErrorMap:Yx,getErrorMap:Bd,makeIssue:Wd,EMPTY_PATH:Jx,addIssueToContext:G,ParseStatus:Yt,INVALID:se,DIRTY:La,OK:lr,isAborted:Z0,isDirty:H0,isValid:Xc,isAsync:el,get util(){return Ae},get objectUtil(){return V0},ZodParsedType:Q,getParsedType:ns,ZodType:_e,datetimeRegex:H_,ZodString:An,ZodNumber:os,ZodBigInt:as,ZodBoolean:tl,ZodDate:Xs,ZodSymbol:zd,ZodUndefined:rl,ZodNull:nl,ZodAny:Fa,ZodUnknown:Ys,ZodNever:_i,ZodVoid:Vd,ZodArray:Cn,ZodObject:it,ZodUnion:il,ZodDiscriminatedUnion:qd,ZodIntersection:sl,ZodTuple:Gn,ZodRecord:ol,ZodMap:Zd,ZodSet:eo,ZodFunction:Ma,ZodLazy:al,ZodLiteral:ul,ZodEnum:us,ZodNativeEnum:cl,ZodPromise:Da,ZodEffects:En,ZodTransformer:En,ZodOptional:Hn,ZodNullable:cs,ZodDefault:ll,ZodCatch:fl,ZodNaN:Hd,BRAND:pw,ZodBranded:iv,ZodPipeline:ml,ZodReadonly:dl,custom:G_,Schema:_e,ZodSchema:_e,late:gw,get ZodFirstPartyTypeKind(){return ne},coerce:Kw,any:Aw,array:Iw,bigint:_w,boolean:Y_,date:yw,discriminatedUnion:Rw,effect:Ov,enum:Bw,function:jw,instanceof:mw,intersection:Ow,lazy:Fw,literal:Dw,map:Mw,nan:vw,nativeEnum:Ww,never:Cw,null:bw,nullable:Vw,number:K_,object:kw,oboolean:Qw,onumber:Gw,optional:zw,ostring:qw,pipeline:Hw,preprocess:Zw,promise:$w,record:Pw,set:Uw,strictObject:Tw,string:Q_,symbol:xw,transformer:Ov,tuple:Lw,undefined:ww,union:Nw,unknown:Sw,void:Ew,NEVER:Yw,ZodIssueCode:W,quotelessJson:Kx,ZodError:Rr});const Jw=Je.object({url:Je.string().min(1,"Field is required")}),Xw=({open:e,user:t,onCloseModal:n})=>{const r=qx({user:t}),i=f1(),[s,a]=$t(!0),o=X0({shouldFocusError:!1,mode:"onSubmit",resolver:W_(Jw),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(gl,{open:e,onCloseModal:n,title:`You're not following @${t.username}`,children:[S.jsx(v_,{...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(__,{control:o.control,name:"url",render:({field:e})=>S.jsxs(Gy,{className:"mt-0 flex-1",children:[S.jsx(Qy,{className:"mb-2 block text-base",children:"Enter your server name to follow this user"}),S.jsxs("div",{className:"relative",children:[S.jsx(Ky,{children:S.jsx(y_,{"data-testid":"input",placeholder:"Server name",...e,onChange:e=>c(e.target.value)})}),S.jsx(Yy,{"data-testid":"command",children:S.jsx(Jy,{"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(Xy,{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:Gx(e,o.getValues("url"))}})},e))))})})]}),S.jsx(e1,{className:"md:absolute"})]})}),S.jsx(Sn,{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(Sn,{"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"})]})]})},en=e=>`@${e.username}${e.local?"":`@${e.domain}`}`,J_=({user:e,onFollow:t,onUnfollow:n,unsubscribe:r})=>{const[i,s]=$t(!1),a=ft(to.selectors.selectIsAuthenticated),[o]=h1(),[u]=p1(),l=null==e?void 0:e.domain,c={user:e,username:en(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(Xw,{user:e,open:i,onCloseModal:()=>s(!1)}):null}},e2=({delay:e=0,defaultHover:t=!1,dependProps:n=[],leaveDelay:r=0}={})=>{const i=vi(null),[s,a]=$t(t),o=vi(null),u=vi(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 Or((()=>()=>{o.current&&clearTimeout(o.current),u.current&&clearTimeout(u.current)}),[]),Or((()=>{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]},t2=({open:e,title:t,children:n,leftButton:r,rightButton:i,onClose:s,titleTestId:a,...o})=>S.jsxs(gl,{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(j0,{size:"m",variant:"secondary",className:"flex-1",...r,title:void 0,children:r.title}),i&&S.jsx(j0,{size:"m",className:"flex-1",...i,title:void 0,children:i.title})]})]}),r2=e=>!(null==e||!e.blocked),X_=(e=!1)=>{const[t,n]=$t(e);return[t,S0((()=>n(!0)),[]),S0((()=>n(!1)),[]),S0((()=>n((e=>!e))),[]),n]},sv=({user:e,relationship:t})=>{const[n,{isLoading:r}]=Fy(),[i]=Dy(),[s,a,o]=X_(),u=r2(t);return[u,a,async()=>{try{await i({userId:e.id}).unwrap(),ut.success(`${e.username} is unblocked`)}catch(e){ut.error(`${Xr(e)}`)}},()=>S.jsx(t2,{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(),ut.success(`${e.username} is blocked`),o()}catch(e){ut.error(`${Xr(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]},ey=({size:e,user:t,follow:n,unfollow:r,disabled:i,relationship:s,isRelationshipPending:a,className:o,followButtonText:u,unfollowButtonText:l})=>{const[c,,d]=sv({user:t,relationship:s}),f=g1(s)?"Follow back":u||"Follow",p=l||"Unfollow",h=m1(s),v=_v(s),[m,g]=e2(),y=h&&!g||v;if(!a)return S.jsx(Sn,{ref:m,"data-testid":"followBtn",onClick:c?d:v||h?r:n,size:e,className:Ue("rounded-m px-xs w-[100%] min-w-[130px] md:max-w-[300px] lg:max-w-full",!_v&&"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})},Lv={data:null,isError:!1,isPending:!1,isSuccess:!1},Kc=Wa({name:"user",initialState:Lv,reducers:{reset:e=>{Object.assign(e,Lv)}},extraReducers:e=>{e.addCase(O_,((e,{payload:t})=>{e.data=t})).addCase(Cx,((e,{payload:t})=>{e.data&&Object.assign(e.data,t||{})})).addCase(W0,((e,{payload:t})=>{e.isSuccess=t})).addCase(B0,((e,{payload:t})=>{e.isPending=t})).addCase(R_,((e,{payload:t})=>{e.isError=t})).addCase(N_,((e,{payload:t})=>{e.error=t})).addCase(Ex,((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}}),Yc="8.48.0",yi=globalThis;function ov(e,t,n){const r=yi,i=r.__SENTRY__=r.__SENTRY__||{},s=i[Yc]=i[Yc]||{};return s[e]||(s[e]=t())}const ty=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,n2="Sentry Logger ",Pv=["debug","info","warn","error","log","assert","trace"],Mv={};function i2(e){if(!("console"in yi))return e();const t=yi.console,n={},r=Object.keys(Mv);r.forEach((e=>{const r=Mv[e];n[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{t[e]=n[e]}))}}function s2(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return ty?Pv.forEach((n=>{t[n]=(...t)=>{e&&i2((()=>{yi.console[n](`${n2}[${n}]:`,...t)}))}})):Pv.forEach((e=>{t[e]=()=>{}})),t}const Fd=ov("logger",s2);function av(){return uv(yi),yi}function uv(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Yc,t[Yc]=t[Yc]||{}}const o2=Object.prototype.toString;function a2(e,t){return o2.call(e)===`[object ${t}]`}function u2(e){return a2(e,"Object")}function c2(e){return!(!e||!e.then||"function"!=typeof e.then)}function l2(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{ty&&Fd.log(`Failed to add non-enumerable property "${t}" to object`,e)}}const ry=1e3;function ny(){return Date.now()/ry}function f2(){const{performance:e}=yi;if(!e||!e.now)return ny;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/ry}const d2=f2();function Ua(){const e=yi,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 h2(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||d2(),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 Uv(){return Ua()}function jv(){return Ua().substring(16)}function iy(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]=iy(r[e],t[e],n-1));return r}(()=>{const{performance:e}=yi;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 G0="_sentrySpan";function Fv(e,t){t?l2(e,G0,t):delete e[G0]}function Dv(e){return e[G0]}const p2=100;class cv{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:Uv(),spanId:jv()}}clone(){const e=new cv;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,Fv(e,Dv(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&&h2(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 hl?[t.getScopeData(),t.getRequestSession()]:u2(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,Fv(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Uv()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:p2;if(n<=0)return this;const r={timestamp:ny(),...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:Dv(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=iy(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:jv(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:Ua();if(!this._client)return Fd.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 Fd.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):(Fd.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 hl=cv;function g2(){return ov("defaultCurrentScope",(()=>new hl))}function m2(){return ov("defaultIsolationScope",(()=>new hl))}class v2{constructor(e,t){let n,r;n=e||new hl,r=t||new hl,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 c2(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 Ba(){const e=uv(av());return e.stack=e.stack||new v2(g2(),m2())}function _2(e){return Ba().withScope(e)}function y2(e,t){const n=Ba();return n.withScope((()=>(n.getStackTop().scope=e,t(e))))}function Bv(e){return Ba().withScope((()=>e(Ba().getIsolationScope())))}function x2(){return{withIsolationScope:Bv,withScope:_2,withSetScope:y2,withSetIsolationScope:(e,t)=>Bv(t),getCurrentScope:()=>Ba().getScope(),getIsolationScope:()=>Ba().getIsolationScope()}}function sy(e){const t=uv(e);return t.acs?t.acs:x2()}function oy(){return sy(av()).getCurrentScope()}function w2(){return sy(av()).getIsolationScope()}function b2(e,t){return oy().captureException(e,void 0)}function A2(e,t){const n={captureContext:t};return oy().captureMessage(e,void 0,n)}function S2(e,t){w2().setExtra(e,t)}const C2=(...e)=>{let t="";for(const n of e){if(n instanceof Error){const e=n;return S2("exceptionMessage",t),void b2(e)}if("object"!=typeof n)t+=n;else try{t+=" "+JSON.stringify(n)}catch{t+=" "+n}}A2(t)},Gd=()=>"object"!=typeof window,E2="wlsy",ay=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},I2=()=>{const e=new Set,t=ay();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)},uy=e=>{const t=`${E2}`,n=e=>`${t}:${e}`,r=()=>I2().filter((e=>e.startsWith(`${t}:`))),i=e=>e.slice(t.length+1),s=ay(),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}}}},Wv=["debug","info","warn","error"],k2=(e,t)=>{const n=Wv.indexOf(e);return Wv.indexOf(t)>=n},Rd=(e,t,n,...r)=>{k2(t,e)&&console.log(`[${e}] ${n}`,...r)},T2=()=>uy().getItem("logger_lvl"),N2=(e=(Gd()?"info":T2()||"warn"))=>{let t=e;return{debug:(e,...n)=>Rd("debug",t,e,...n),info:(e,...n)=>Rd("info",t,e,...n),warn:(e,...n)=>Rd("warn",t,e,...n),error:(e,...n)=>(C2(e,...n),Rd("error",t,e,...n)),setLevel:e=>{t=e},getLevel:()=>t}},Js=N2(),R2=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 Js.warn(`Could not serialize action type: ${e.type}`,t),{type:e.type,payload:`[Non-serializable payload for action: ${e.type}]`}}},O2=e=>{const t=window.parent??window;if(t)try{const n=R2(e);t.postMessage(n,"*")}catch(e){Js.error("Failed to process or send message:",e)}},cy=()=>dy()?location.hostname:location.hostname.replace(/\w\w\w\.|^/,"."),ly=e=>{const t=new Date;return t.setTime(t.getTime()+24*e*60*60*1e3),t.toUTCString()},fy=e=>Object.keys(e).reduce(((t,n)=>`${t}${n}${!0===e[n]?"":`=${e[n]}`};`),""),L2=(e,t)=>{const n=Gd()?"":document.cookie,r=`; ${t||n}`.split(`; ${e}=`);if(2===r.length)return(r.pop()||"").replace("=","").split(";").shift()},P2=(e,t)=>{Gd()||(document.cookie=fy({[e]:"",path:"/",domain:t||cy(),expires:"Thu, 01 Jan 1970 00:00:01 GMT"}))},M2=["localhost","127.0.0.1","dev.localtest.me","wellesleydev.localtest.me"],dy=()=>M2.includes(location.hostname),U2=(e,t="",n=10,r)=>{Gd()||(document.cookie=fy({[e]:t,path:"/",domain:r||cy(),expires:ly(n),...!dy()&&{SameSite:"None",Secure:!0}}))},lv={set:U2,remove:P2,get:L2,getExpireDate:ly},fv="auth_token",hy=()=>lv.get(fv)||void 0,j2=e=>lv.set(fv,e),F2=()=>lv.remove(fv),D2=()=>!!hy(),B2={getToken:hy,setToken:j2,removeToken:F2,hasToken:D2},$v={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!B2.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},py=Wa({name:"auth",initialState:$v,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...$v,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}}),W2=()=>{window.parent===window?R1().dispatch(py.actions.setAskLoginOpen(!0)):O2(bx())},vl=e=>{const t=ft(Kc.selectors.selectCurrentUser),n=ft(to.selectors.selectIsAuthenticated),r="SUSPENDED"===(null==t?void 0:t.state),i=r;return{isDisabled:i,guardedAction:(e=()=>{})=>()=>{n?n&&!r&&e():W2()},ActionTooltipWrapper:({children:e,triggerClassname:n})=>i?S.jsx(F0,{theme:"dark",tooltipText:`${en(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})}},gy=({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}=J_({user:e,onFollow:a,onUnfollow:o}),p=ev(e.id),{isDisabled:h,ActionTooltipWrapper:v}=vl();return p||s?null:S.jsxs("div",{"data-testid":"followControl",children:[f(),S.jsx(v,{triggerClassname:Ue("l"===t&&"w-full"),children:S.jsx(ey,{user:e,size:t,disabled:n,className:r,follow:()=>{c()},unfollow:()=>{d()},disabled:h,relationship:i,isRelationshipPending:!1,followButtonText:u,unfollowButtonText:l})})]})},dv=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}},$2=({isPopup:e,notification:t})=>{var n,r;const i=pl(),[s]=By(),[a]=Wy(),o=t.fromUser,{relationship:u,isLoading:l}=S_({userId:null==o?void 0:o.id}),{isFollow:c,isFollowRequest:d}=dv(t),f=!(!o||!c),p=!(!o||!d),h=o?en(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(gy,{size:"s",user:o,relationship:u,isRelationshipPending:l}),v?S.jsx("div",{className:Ue("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(Sn,{size:"s",variant:"secondary",className:"min-w-[100px] px-3",onClick:()=>{o&&(a({username:h,user:o}),i(Jc.actions.updateNotification({...t,followResponse:"Rejected"})))},children:"Reject"}),S.jsx(Sn,{size:"s",variant:"primary",className:Ue("min-w-[100px]",e&&"order-first"),onClick:()=>{o&&(s({username:h,user:o}),i(Jc.actions.updateNotification({...t,followResponse:"Accepted"})))},children:"Accept"})]}):null]})},z2=e=>{const{user:t,isLoading:n}=C_(),{data:r,isLoading:i,error:s}=v1(e),a="userId"in e,{data:o,isLoading:u}=_1({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]},my={forever:0,"6h":21600,"12h":43200,"24h":86400,"7 days":604800,"30 days":2592e3},V2=({selected:e,onSelect:t})=>Object.keys(my).map((n=>S.jsxs("span",{className:Ue("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))),vy=({user:e,relationship:t,onMute:n,onUnmute:r})=>{const[i,{isLoading:s}]=y1(),[a,{isLoading:o}]=x1(),[u,l]=$t("forever"),c=e?en(e):"",[d,f,p]=X_(),h=w1(t);return{isLoading:s||o,isMuted:h,mute:f,unmute:()=>{e&&(a({userId:e.id}),ut.success(`${c} is unmuted`),null==r||r())},renderMuteDialog:()=>e?S.jsxs(gl,{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(V2,{selected:u,onSelect:l})}),S.jsx(j0,{variant:"primary",onClick:()=>{(()=>{if(!e)return;const t=my[u];i({userId:e.id,...t&&{duration:t}}),ut.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 _y(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=_y(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Z2(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=_y(e))&&(r&&(r+=" "),r+=t);return r}const zv=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,Q0=Z2,H2=(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=zv(t)||zv(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)},q2=H2("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",64:"size-[64px] text-base",96:"size-[96px] text-[32px]"}},defaultVariants:{size:40}}),G2=({name:e,imgUrl:t,size:n=40,className:r})=>{var i;return S.jsxs(t1,{className:Ue(q2({size:n}),r),"data-testid":`userAvatar-${n}`,children:[t&&S.jsx(r1,{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()})]})},Q2={data:null,isPending:!1,isSuccess:!1},br=Wa({name:"userNoHTML",initialState:Q2,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}}),yy="getApiV1UsersRelationships",K2=ss.memoize(((e,t)=>Ks.util.selectCachedArgsForQuery(e,yy).find((e=>e.targets.includes(t))))),hi=({state:e,userId:t,dispatch:n,relationsProps:r})=>{const i=K2(e,t);return i?n(Ks.util.updateQueryData(yy,i,(e=>{e[t]={...e[t],...r}}))):null},xy=3,wy=64,Vv=5,Zv=2,Y2=30,by=50,J2=1024,Ay=30,Hv={link:56,userName:30,pronouns:20,displayName:50,description:J2,fieldLabel:20,fieldContent:80,location:56,timezone:56},Qd={short:"Too short",long:"Too long"},X2=e=>e.replace(/\s+/g," ").trim(),hv=new RegExp("\\p{Extended_Pictographic}","u"),eb=/^[a-zA-Z0-9\s/.]*$/,tb=({showInlineError:e=!0})=>Je.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"),rb=Je.string().trim().min(1,"Display name is required").max(50).regex(/^[^@]*$/,"@ is not allowed").superRefine(((e,t)=>{const n=hv.test(e),r=/[a-zA-Z0-9]/.test(e);n&&!r&&t.addIssue({code:Je.ZodIssueCode.custom,message:"Emojis alone are not allowed. Please add text"})})),nb=Je.string().max(1024,Qd.long).optional(),Sy=({minLength:e,minErrorMessage:t,maxLength:n,regexErrorMessage:r})=>Je.string().trim().min(e,t).max(n,Qd.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,r);Sy({minLength:2,maxLength:30,regexErrorMessage:"Invalid characters. ex.: group_name_1"}),Sy({minLength:2,minErrorMessage:Qd.short,maxLength:30,regexErrorMessage:"Invalid characters. ex.: channel_name_1"}),Je.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 ib="Required: A-Z, a-z, 0-9, special character, min 3, max 64";Je.string().trim().superRefine(((e,t)=>{hv.test(e)&&t.addIssue({code:Je.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:Je.ZodIssueCode.custom,message:ib})})),Je.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=>!hv.test(e)),"Emojis are not allowed");const sb=e=>eb.test(e);Je.string().max(Hv.pronouns,`Maximum ${Hv.pronouns} characters`).refine((e=>sb(e)),'Special characters !@#$%^*()+={} []:;", are not allowed').transform(X2).optional(),Je.object({bio:nb,username:tb({showInlineError:!0}),displayName:rb}),Je.object({show:Je.boolean(),dateOnly:Je.boolean(),date:Je.date().optional().nullable()}),Je.object({show:Je.boolean(),dateOnly:Je.boolean(),date:Je.date().optional().nullable()});const qv=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}},ob="FollowersListHidden",ab="FollowingListHidden",jc=e=>{var t,n;const r=null==(n=null==(t=null==e?void 0:e.error)?void 0:t.data)?void 0:n.errorCode;return r===ob||r===ab},ub=Ks.enhanceEndpoints({endpoints:{deleteApiV1Users:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){try{await at(n)&&await t(Ks.endpoints.getApiV1AccountsProfile.initiate({htmlContent:!1})).unwrap()}catch(e){ut.error(`${Xr(e)}`)}}},getApiV1AccountsProfile:{providesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){t(B0(!0));try{const e=await at(n);e&&t(O_(e.data)),t(W0(!0))}catch(e){t(W0(!1)),t(R_(!0)),t(N_(e))}finally{t(B0(!1))}}},putApiV1UsersByUserId:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,ut.success("User updated successfully")}catch(e){const t=e.error,{isError:n}=qv(t);!n&&ut.error(`${Xr(t)}`)}}},getApiV1Users:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){const r=!e.htmlContent;try{r&&t(br.actions.setPending(!0));const e=await at(n);r&&e&&(t(br.actions.setUser(e.data)),t(br.actions.setSuccess(!0)),t(br.actions.setPending(!1)))}catch(e){r&&(t(br.actions.setSuccess(!1)),t(br.actions.setError(e)),t(br.actions.setPending(!1))),ut.error(`${Xr(e)}`)}}},postApiV1Users:{invalidatesTags:["Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,ut.success("User created successfully")}catch(e){const t=e.error,{isError:n}=qv(t);!n&&ut.error(`${Xr(t)}`)}}},getApiV1UsersFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!jc(e)){const t=e;ut.error(`${Xr(t.error)}`)}}}},getApiV1UsersRemoteByUserNameFullFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!jc(e)){const t=e;ut.error(`${Xr(t.error)}`)}}}},getApiV1UsersByUserId:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:n}){const r=!e.htmlContent;try{r&&t(br.actions.setPending(!0));const e=await at(n);r&&e&&(t(br.actions.setUser(e.data)),t(br.actions.setSuccess(!0)),t(br.actions.setPending(!1)))}catch(e){r&&(t(br.actions.setSuccess(!1)),t(br.actions.setError(e)),t(br.actions.setPending(!1))),ut.error(`${Xr(e)}`)}}},getApiV1UsersByUserIdFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!jc(e)){const t=e;ut.error(`${Xr(t.error)}`)}}}},getApiV1UsersFollowees:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!jc(e)){const t=e;ut.error(`${Xr(t.error)}`)}}}},getApiV1UsersByUserIdFollowing:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!jc(e)){const t=e;ut.error(`${Xr(t.error)}`)}}}},postApiV1UsersFollowByUsernameAccept:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:n,getState:r}){const i=hi({dispatch:n,userId:e.user.id,state:r(),relationsProps:{followed:"ACCEPTED"}});await at(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=hi({dispatch:n,userId:e.user.id,state:r(),relationsProps:{followed:"REJECTED"}});await at(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 at(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=hi({dispatch:n,userId:e.user.id,state:r(),relationsProps:{following:null}});await at(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=hi({userId:e.userId,dispatch:r,state:n(),relationsProps:{blocked:!0}});await at(t,void 0,(()=>null==i?void 0:i.undo()))}},deleteApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=hi({userId:e.userId,dispatch:r,state:n(),relationsProps:{blocked:!1,muted:{state:!1}}});await at(t,void 0,(()=>null==i?void 0:i.undo()))}},postApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:n,dispatch:r}){const i=hi({userId:e,dispatch:r,state:n(),relationsProps:{muted:{state:!0}}});await at(t,void 0,(()=>null==i?void 0:i.undo()))}},deleteApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:n,dispatch:r}){const i=hi({userId:e,dispatch:r,state:n(),relationsProps:{muted:{state:!1}}});await at(t,void 0,(()=>null==i?void 0:i.undo()))}},getApiV1Mute:{async onQueryStarted(e,{queryFulfilled:t}){await at(t)}},getApiV1UsersRelationships:{providesTags:(e,t,{targets:n})=>n.map((e=>({type:"Relationship",id:e}))),async onQueryStarted(e,{queryFulfilled:t}){await at(t)}},postApiV1AdminUserChangeState:{invalidatesTags:["Secure"],async onQueryStarted(e,{queryFulfilled:t}){await at(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=hi({userId:i,dispatch:r,state:n(),relationsProps:{note:s}});await at(t,"Note has been updated",(()=>null==a?void 0:a.undo()))}},deleteApiV1NotesByUserId:{async onQueryStarted(e,{queryFulfilled:t,getState:n,dispatch:r}){const i=hi({userId:e.userId,dispatch:r,state:n(),relationsProps:{note:""}});await at(t,"Note has been removed",(()=>null==i?void 0:i.undo()))}},postApiV1UsersFollowByUsernamePend:{async onQueryStarted(e,{queryFulfilled:t}){await at(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:CS,usePostApiV1UsersMutation:ES,useDeleteApiV1AccountsDeleteMutation:IS,useGetApiV1AccountsProfileQuery:kS,usePutApiV1UsersByUserIdMutation:TS,useGetApiV1UsersQuery:NS,useDeleteApiV1UsersMutation:RS,usePostApiV1MuteByUserIdMutation:OS,useDeleteApiV1MuteByUserIdMutation:LS,useGetApiV1MuteQuery:PS,usePostApiV1AdminUserChangeStateMutation:MS,useGetApiV1UsersRelationshipsQuery:cb,usePutApiV1NotesMutation:US,useDeleteApiV1NotesByUserIdMutation:jS,useLazyGetApiV1UsersRelationshipsQuery:lb,useLazyGetApiV1GeoQuery:FS,useLazyGetApiV1GroupsOwnedQuery:DS,useGetApiV1UsersFollowersQuery:BS,useGetApiV1UsersByUserIdQuery:WS,useLazyGetApiV1UsersRenameHistoryQuery:$S,useGetApiV1UsersByUserIdFollowersQuery:zS,useGetApiV1UsersByUserIdFollowingQuery:VS,useGetApiV1UsersFolloweesQuery:ZS,usePostApiV1UsersFollowByUsernameMutation:HS,usePostApiV1UsersFollowByUsernameUndoMutation:qS,usePostApiV1UsersFollowByUsernameRejectMutation:GS,usePostApiV1UsersFollowByUsernameAcceptMutation:QS,useGetApiV1UsersRemoteByUserNameFullFollowersQuery:KS}=ub,fb=()=>{const e=ft(Kc.selectors.selectCurrentUser),t=ft(py.selectors.selectIsAuthenticated);return{user:e,isLoading:ft(Kc.selectors.selectPending),isLogged:t,error:ft(Kc.selectors.selectError)}},Cy=({onChange:e})=>{const{user:t}=fb(),n=null==t?void 0:t.id,r=vi(n);Or((()=>{r.current?n!==r.current&&(e(),r.current=n):r.current=n}),[n,r.current])},Gv=["following","followed","blocked","muted","note","blocked_by"],Qv=({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}},db=({userId:e,skip:t})=>{const n=ft(Kc.selectors.selectCurrentUser),r=null==n?void 0:n.id,{canFetch:i,isSingleUser:s,safeTargets:a}=Qv({userId:e,currentUserId:r}),{data:o,isLoading:u}=cb({targets:a,filter:Gv},{skip:!i||t}),[l]=lb(),c=({userId:e})=>{const{canFetch:t,safeTargets:n}=Qv({userId:e,currentUserId:r});t&&l({targets:n,filter:Gv})};return Cy({onChange:()=>{c({userId:a})}}),{relationship:(s?null==o?void 0:o[e]:o)||{},isLoading:u,updateRelations:c}},hb=e=>e.replace(/(<)/g,"<").replace(/>/g,">"),Kv=(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,pb={list:[]},gb=Wa({name:"emojis",initialState:pb,reducers:{addEmoji:(e,t)=>{e.list.push(t.payload)},addList:(e,t)=>{e.list=t.payload}},selectors:{selectEmojis:e=>e.list}}).injectInto(E_);var Kd=(e=>(e.header="header",e.avatar="avatar",e))(Kd||{});const pv=({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""}},mb="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",vb="Enter",K0=52,_b=e=>{const[t,n]=$t((null==e?void 0:e.length)||0),r=vi(null),i=vi(null);return{inputRef:r,textareaRef:i,charCount:t,setCharCount:n,handleKeyDown:e=>{var t,n;e.key===vb&&(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=yb(t);setTimeout((()=>{if(t.style.height="52px",!i)return;const e=Math.max(t.scrollHeight,52);t.style.height=`${e}px`}),0)}}},yb=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}},Yv=52,qc=200,xb=10,wb=Je.object({note:Je.string().max(qc)}),bb=({userId:e,note:t="",className:n,resizable:r=!1})=>{const[i]=b1(),[s]=A1(),a=ft(to.selectors.selectIsAuthenticated),o=ft(tv.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=X0({resolver:W_(wb)}),{inputRef:f,textareaRef:p,charCount:h,setCharCount:v,handleTextareaChange:m,handleKeyDown:g}=_b(t);if(!u&&a)return S.jsx(v_,{...d,children:S.jsxs("form",{className:Ue("my-5",n),onKeyDown:g,children:[h>=190&&S.jsxs("div",{className:"mb-xxs text-right text-sm text-gray-400",children:[qc-h," characters left"]}),S.jsx(__,{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:qc,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:qc,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:mb,alt:"user note",className:"absolute bottom-0 right-0"})]})})]})})},Jv=({status:e,iconOnly:t=!1,clasName:n})=>{const r="muted"===e?S.jsx(k_,{size:16}):S.jsx(T_,{size:16}),i="muted"===e?"text-brown outline-brown":"text-red-dark outline-red-dark";return S.jsxs("div",{className:Ue(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&&ss.capitalize(e)]})},Ab=({children:e})=>S.jsx("span",{className:"line-clamp-2 block text-ellipsis whitespace-pre-wrap break-words text-left",children:e}),Ey=({user:e,status:t,skip:n=!1})=>{const r=ft(tv.selectors.selectCurrentUser),i=ft(to.selectors.selectIsAuthenticated),s=!n&&i,[a,o]=$t(!1),u=e&&!e.local&&e.domain?`@${e.username}@${e.domain}`:void 0,l=(null==e?void 0:e.id)||(null==r?void 0:r.id),c=!(t||!l||!s),d=!(!t||!i||c||!s||u),{data:f,isLoading:p,error:h}=S1({userNameFull:u},{skip:!u||a}),{data:v,isLoading:m,error:g}=C1({status:t},{skip:c||!d||a}),{data:y,isLoading:_,error:x}=E1({userId:l},{skip:d||!c||a}),b=(c?[...y||[],...f||[]]:null)||v,w=m||_||p;return Or((()=>{(Qc(g)||Qc(x)||Qc(h))&&o(!0)}),[g,x,h]),[b,w,a]},Zn={first:"first",second:"second"},Sb=({user:e,showEmpty:t=!0,className:n,renderModal:r,...i})=>{var s;const[a,o]=Ey({user:e}),[u,l]=$t({open:!1,tab:Zn.first}),{guardedAction:c,ActionTooltipWrapper:d}=vl(),f=(null==a?void 0:a.length)||(null==(s=e.stats)?void 0:s.followers)||0,p=1===f?"follower":"followers",h=(null==a?void 0:a.slice(0,3))||[];return o?S.jsx(jd,{className:"mx-auto mb-4 h-7 w-[200px]"}):0!==f||t?S.jsxs("div",{"data-testid":"user-followers",children:[u.open&&(null==r?void 0:r({user:e,tab:u.tab,isOpen:!0,onClose:()=>l((e=>({...e,open:!1}))),...i})),S.jsx(d,{children:S.jsxs("div",{onClick:c((()=>{l({tab:Zn.first,open:!0})})),className:Ue("mb-4 flex cursor-pointer items-center text-base font-medium text-gray-900",n),children:[h.length>0&&S.jsx("ul",{className:"mr-2 flex items-center",children:h.map(((e,t)=>S.jsx("li",{className:Ue("relative",t>0&&"-ml-2"),children:S.jsx("div",{className:"rounded-full bg-white p-0.5",children:S.jsx(rv,{size:24,name:e.displayName,imgUrl:pv({user:e,type:Kd.avatar})})})},e.id)))}),f," ",p]})})]}):null},Cb=({status:e,userId:t,skip:n=!1})=>{const r=ft(to.selectors.selectIsAuthenticated),i=!!e&&r,[s,a]=$t(!1),{data:o,isLoading:u,error:l}=I1({status:e},{skip:!i||n||s}),{data:c,isLoading:d,error:f}=k1({userId:t},{skip:i||!t||!r||n||s}),p=o||c,h=u||d;return Or((()=>{(Qc(l)||Qc(f))&&a(!0)}),[l,f]),{data:p,isLoading:h,isHidden:s}},Eb=({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(mx,{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(d1,{baseUrl:e,children:S.jsx("a",{href:e,children:S.jsxs(Sn,{variant:"secondary",className:"gap-xxs font-semibold",children:["See more followers ",S.jsx(hx,{})]})})})]}),Yd="staticState",Iy=uy(),Dd={path:"",baseUrl:"",search:""},Ib=e=>{if(!e)return Dd;try{return JSON.parse(decodeURIComponent(e))||Dd}catch(e){return Js.error("Error parsing static state",e),Dd}},ky=()=>new URLSearchParams(window.location.search).get(Yd),kb=({path:e,baseUrl:t,search:n}={})=>{const{pathname:r,origin:i,search:s}=window.location;return`${Yd}=${encodeURIComponent(JSON.stringify({path:e||r,baseUrl:t||i,search:n||s}))}`},Tb=()=>{const e=ky();return e&&Iy.setItem(Yd,e),Ty()},Ty=()=>{try{const e=Iy.getItem(Yd)||ky();return Ib(e)}catch(e){return Js.error("Error parsing static state",e),Dd}},Nb={create:kb,init:Tb,get:Ty},Rb=e=>{const{baseUrl:t}=Nb.get();return e.local?`${t}/@${e.username}`:`https://${e.domain}/@${e.username}`};var Xv,Gc={exports:{}},Ob=Gc.exports;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Lodash <https://lodash.com/>
|