@wellesley/user 1.0.842 → 1.0.843

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.mjs +2 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{api as qs,usePostApiV1UploadsMutation as X5,useGetApiV1SearchQuery as B5,useGetApiV1TagsSearchQuery as H5,useGetApiV1InstanceTimezonesQuery as Z5,fetchInterceptor as G5,isSuccessResponse as K5,QueryTags as eb,useGetApiV1AddressesSuggestQuery as Y5,usePutApiV1UsersByUserIdMutation as J5}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.827";import*as Ed from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import ea,{forwardRef as Nc,createElement as oh,useRef as zt,useState as bt,useEffect as Ke,useCallback as Dr,useLayoutEffect as Az,useMemo as mr,createContext as Jg,memo as Q5,useReducer as $5,useContext as Id,isValidElement as e7,cloneElement as t7}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{toast as Zt}from"https://cdn.jsdelivr.net/npm/@wellesley/system-toast@1.0.171";import{getErrorMsg as Us}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.676";import{createAction as zz,createSlice as Ud,createSelector as Wl}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{get as zw,set as o1,appendErrors as r7,useForm as Sz,useFieldArray as ug,FormProvider as n7}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as Cz,rootReducer as Tz}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.826";import{useDispatch as Do,useSelector as ft}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{fillTopic as jz,wsSlice as Gw}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.809";import{getAcceptList as Pz,useImageSelection as Rz,UploadMediaModal as Ez,UploadTag as tb,selectUploadFile as Kw}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.712";import{cn as ot,DropdownMenu as dm,DropdownMenuTrigger as pm,DropdownMenuContent as hm,DropdownMenuItem as Ky,Button as nn,Avatar as a7,AvatarImage as s7,TooltipWrapper as gm,Switch as Lz,Tooltip as rb,TooltipTrigger as nb,TooltipContent as ab,Textarea as i7,getTextareaClassName as o7,FormLabel as Qg,useFormField as Nz,FormField as c7,FormItem as l7,FormControl as Oy,Input as c1,FormMessage as u7,Dialog as f7,DialogContent as d7,Form as Yw,Popover as p7,PopoverTrigger as h7,PopoverContent as g7,Calendar as l1,ButtonLoader as yf,Checkbox as y7}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.789";import{AppsLink as jg,getRoute as Sw,useAppsNavigate as Iz}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.753";import{useLogout as Mz,authSlice as Oz}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.883";import{EmojiPicker as m7,EmojiStyle as _7}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.676";var Qi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sb,mg={exports:{}},v7=mg.exports;
1
+ import{api as qs,usePostApiV1UploadsMutation as X5,useGetApiV1SearchQuery as B5,useGetApiV1TagsSearchQuery as H5,useGetApiV1InstanceTimezonesQuery as Z5,fetchInterceptor as G5,isSuccessResponse as K5,QueryTags as eb,useGetApiV1AddressesSuggestQuery as Y5,usePutApiV1UsersByUserIdMutation as J5}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.828";import*as Ed from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import ea,{forwardRef as Nc,createElement as oh,useRef as zt,useState as bt,useEffect as Ke,useCallback as Dr,useLayoutEffect as Az,useMemo as mr,createContext as Jg,memo as Q5,useReducer as $5,useContext as Id,isValidElement as e7,cloneElement as t7}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{toast as Zt}from"https://cdn.jsdelivr.net/npm/@wellesley/system-toast@1.0.172";import{getErrorMsg as Us}from"https://cdn.jsdelivr.net/npm/@wellesley/error-kit@1.0.677";import{createAction as zz,createSlice as Ud,createSelector as Wl}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{get as zw,set as o1,appendErrors as r7,useForm as Sz,useFieldArray as ug,FormProvider as n7}from"https://cdn.jsdelivr.net/npm/react-hook-form@7.51.0/+esm";import{getStore as Cz,rootReducer as Tz}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.827";import{useDispatch as Do,useSelector as ft}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{fillTopic as jz,wsSlice as Gw}from"https://cdn.jsdelivr.net/npm/@wellesley/ws@1.0.810";import{getAcceptList as Pz,useImageSelection as Rz,UploadMediaModal as Ez,UploadTag as tb,selectUploadFile as Kw}from"https://cdn.jsdelivr.net/npm/@wellesley/uploads@1.0.713";import{cn as ot,DropdownMenu as dm,DropdownMenuTrigger as pm,DropdownMenuContent as hm,DropdownMenuItem as Ky,Button as nn,Avatar as a7,AvatarImage as s7,TooltipWrapper as gm,Switch as Lz,Tooltip as rb,TooltipTrigger as nb,TooltipContent as ab,Textarea as i7,getTextareaClassName as o7,FormLabel as Qg,useFormField as Nz,FormField as c7,FormItem as l7,FormControl as Oy,Input as c1,FormMessage as u7,Dialog as f7,DialogContent as d7,Form as Yw,Popover as p7,PopoverTrigger as h7,PopoverContent as g7,Calendar as l1,ButtonLoader as yf,Checkbox as y7}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.790";import{AppsLink as jg,getRoute as Sw,useAppsNavigate as Iz}from"https://cdn.jsdelivr.net/npm/@wellesley/router@1.0.754";import{useLogout as Mz,authSlice as Oz}from"https://cdn.jsdelivr.net/npm/@wellesley/auth@1.0.884";import{EmojiPicker as m7,EmojiStyle as _7}from"https://cdn.jsdelivr.net/npm/@wellesley/emoji-picker@1.0.677";var Qi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sb,mg={exports:{}},v7=mg.exports;
2
2
  /**
3
3
  * @license
4
4
  * Lodash <https://lodash.com/>
@@ -39,7 +39,7 @@ import{api as qs,usePostApiV1UploadsMutation as X5,useGetApiV1SearchQuery as B5,
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
- */yt("remoteReady");const r9=yt("askLogin"),n9=yt("reselectUser");yt("requestLogout");const a9=yt("setConfirmLeavePage");yt("requestChangePath");const Vz=yt("wsSubscribe"),Xz=yt("wsUnSubscribe");yt("hostStoreConnect"),yt("remoteLogin"),yt("remoteLogout"),yt("wsOnMessage"),yt("setRouterPath"),yt("setDeviceType"),yt("setDeviceWidth");const Bz=yt("setUserError"),Hz=yt("setUserIsError"),Cw=yt("setUserPending"),Tw=yt("setUserSuccess"),Zz=yt("setUserData"),Gz=yt("updateAccountData"),s9=yt("updateUser");yt("addNotification"),yt("markNotification"),yt("setNotificationsError"),yt("setNotificationsList"),yt("setNotificationsPending"),yt("setNotificationsTotalCount"),yt("setNotificationsUnreadCount"),yt("acceptAllFollowRequests"),yt("resetNotificationsState"),yt("undoNotification"),yt("setInstanceInfo"),yt("setInstanceInfoPending"),yt("setInstanceInfoError");const jw=yt("setPlatformSettings"),Xy=yt("setProfileSettings");yt("setGroupData"),yt("setGroupLoading"),yt("requestLocalStorageGet"),yt("requestLocalStorageSet"),yt("requestLocalStorageRemove"),yt("requestLocalStorageClear"),yt("requestLocalStorageKeys"),yt("requestLocalStorageHas"),yt("sendLocalStorageResponse"),yt("sendLocalStorageChanged");const Ag="8.48.0",Dl=globalThis;function Qw(e,t,r){const n=Dl,a=n.__SENTRY__=n.__SENTRY__||{},i=a[Ag]=a[Ag]||{};return i[e]||(i[e]=t())}const Kz=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,i9="Sentry Logger ",db=["debug","info","warn","error","log","assert","trace"],pb={};function o9(e){if(!("console"in Dl))return e();const t=Dl.console,r={},n=Object.keys(pb);n.forEach((e=>{const n=pb[e];r[e]=t[e],t[e]=n}));try{return e()}finally{n.forEach((e=>{t[e]=r[e]}))}}function c9(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return Kz?db.forEach((r=>{t[r]=(...t)=>{e&&o9((()=>{Dl.console[r](`${i9}[${r}]:`,...t)}))}})):db.forEach((e=>{t[e]=()=>{}})),t}const By=Qw("logger",c9);function $w(){return ek(Dl),Dl}function ek(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Ag,t[Ag]=t[Ag]||{}}const l9=Object.prototype.toString;function u9(e,t){return l9.call(e)===`[object ${t}]`}function f9(e){return u9(e,"Object")}function d9(e){return!(!e||!e.then||"function"!=typeof e.then)}function p9(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{Kz&&By.log(`Failed to add non-enumerable property "${t}" to object`,e)}}const Yz=1e3;function Jz(){return Date.now()/Yz}function h9(){const{performance:e}=Dl;if(!e||!e.now)return Jz;const t=Date.now()-e.now(),r=null==e.timeOrigin?t:e.timeOrigin;return()=>(r+e.now())/Yz}const g9=h9();function ah(){const e=Dl,t=e.crypto||e.msCrypto;let r=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(r=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(e=>(e^(15&r())>>e/4).toString(16)))}function y9(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||g9(),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:ah()),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 hb(){return ah()}function gb(){return ah().substring(16)}function Qz(e,t,r=2){if(!t||"object"!=typeof t||r<=0)return t;if(e&&t&&0===Object.keys(t).length)return e;const n={...e};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=Qz(n[e],t[e],r-1));return n}(()=>{const{performance:e}=Dl;if(!e||!e.now)return;const t=36e5,r=e.now(),n=Date.now(),a=e.timeOrigin?Math.abs(e.timeOrigin+r-n):t,i=a<t,o=e.timing&&e.timing.navigationStart,s="number"==typeof o?Math.abs(o+r-n):t;(i||s<t)&&(a<=s&&e.timeOrigin)})();const Pw="_sentrySpan";function yb(e,t){t?p9(e,Pw,t):delete e[Pw]}function mb(e){return e[Pw]}const m9=100;class tk{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:hb(),spanId:gb()}}clone(){const e=new tk;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,yb(e,mb(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&&y9(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,[r,n]=t instanceof Pg?[t.getScopeData(),t.getRequestSession()]:f9(t)?[e,e.requestSession]:[],{tags:a,extra:i,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u}=r||{};return this._tags={...this._tags,...a},this._extra={...this._extra,...i},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),n&&(this._requestSession=n),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,yb(this,void 0),this._attachments=[],this.setPropagationContext({traceId:hb()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const r="number"==typeof t?t:m9;if(r<=0)return this;const n={timestamp:Jz(),...e},a=this._breadcrumbs;return a.push(n),this._breadcrumbs=a.length>r?a.slice(-r):a,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:mb(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Qz(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:gb(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){const r=t&&t.event_id?t.event_id:ah();if(!this._client)return By.warn("No client configured on scope - will not capture exception!"),r;const n=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:n,...t,event_id:r},this),r}captureMessage(e,t,r){const n=r&&r.event_id?r.event_id:ah();if(!this._client)return By.warn("No client configured on scope - will not capture message!"),n;const a=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:a,...r,event_id:n},this),n}captureEvent(e,t){const r=t&&t.event_id?t.event_id:ah();return this._client?(this._client.captureEvent(e,{...t,event_id:r},this),r):(By.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}const Pg=tk;function _9(){return Qw("defaultCurrentScope",(()=>new Pg))}function v9(){return Qw("defaultIsolationScope",(()=>new Pg))}class w9{constructor(e,t){let r,n;r=e||new Pg,n=t||new Pg,this._stack=[{scope:r}],this._isolationScope=n}withScope(e){const t=this._pushScope();let r;try{r=e(t)}catch(e){throw this._popScope(),e}return d9(r)?r.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function ch(){const e=ek($w());return e.stack=e.stack||new w9(_9(),v9())}function k9(e){return ch().withScope(e)}function b9(e,t){const r=ch();return r.withScope((()=>(r.getStackTop().scope=e,t(e))))}function _b(e){return ch().withScope((()=>e(ch().getIsolationScope())))}function x9(){return{withIsolationScope:_b,withScope:k9,withSetScope:b9,withSetIsolationScope:(e,t)=>_b(t),getCurrentScope:()=>ch().getScope(),getIsolationScope:()=>ch().getIsolationScope()}}function $z(e){const t=ek(e);return t.acs?t.acs:x9()}function e8(){return $z($w()).getCurrentScope()}function A9(){return $z($w()).getIsolationScope()}function z9(e,t){return e8().captureException(e,void 0)}function S9(e,t){const r={captureContext:t};return e8().captureMessage(e,void 0,r)}function C9(e,t){A9().setExtra(e,t)}const T9=(...e)=>{let t="";for(const r of e){if(r instanceof Error){const e=r;return C9("exceptionMessage",t),void z9(e)}if("object"!=typeof r)t+=r;else try{t+=" "+JSON.stringify(r)}catch{t+=" "+r}}S9(t)},$g=()=>"object"!=typeof window,j9="wlsy",t8=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},P9=()=>{const e=new Set,t=t8();if(!t)return[];for(let r=0;r<(null==t?void 0:t.length);r+=1){const n=null==t?void 0:t.key(r);"string"==typeof n&&e.add(n)}return Array.from(e)},r8=e=>{const t=`${j9}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,n=()=>P9().filter((e=>e.startsWith(`${t}:`))),a=e=>e.slice(t.length+1),i=t8(),o=e=>{try{return null==i?void 0:i.getItem(r(e))}catch{return null}},s=(e,t)=>{try{null==i||i.setItem(r(e),String(t))}catch{return}};return{getItem:o,setItem:s,removeItem:e=>{try{null==i||i.removeItem(r(e))}catch{return}},clear:()=>{try{n().forEach((e=>null==i?void 0:i.removeItem(e)))}catch{return}},keys:()=>n().map(a),has:e=>null!==o(e),getJSON:e=>{const t=o(e);if(null==t)return null;try{return JSON.parse(t)}catch{return null}},setJSON:(e,t)=>{try{s(e,JSON.stringify(t))}catch{return}}}},vb=["debug","info","warn","error"],R9=(e,t)=>{const r=vb.indexOf(e);return vb.indexOf(t)>=r},Dy=(e,t,r,...n)=>{R9(t,e)&&console.log(`[${e}] ${r}`,...n)},E9=()=>r8().getItem("logger_lvl"),L9=(e=($g()?"info":E9()||"warn"))=>{let t=e;return{debug:(e,...r)=>Dy("debug",t,e,...r),info:(e,...r)=>Dy("info",t,e,...r),warn:(e,...r)=>Dy("warn",t,e,...r),error:(e,...r)=>(T9(e,...r),Dy("error",t,e,...r)),setLevel:e=>{t=e},getLevel:()=>t}},hs=L9(),N9=e=>{try{const{type:t,payload:r}=e,n={type:t};return void 0!==r&&(n.payload=JSON.parse(JSON.stringify(r))),n}catch(t){return hs.warn(`Could not serialize action type: ${e.type}`,t),{type:e.type,payload:`[Non-serializable payload for action: ${e.type}]`}}};zz("requestMicroFrontendFetch"),zz("sendMicroFrontendFetchResponse");const I9={data:null,isPending:!1,isSuccess:!1},ha=Ud({name:"userNoHTML",initialState:I9,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}}),n8="getApiV1UsersRelationships",M9=jc.memoize(((e,t)=>qs.util.selectCachedArgsForQuery(e,n8).find((e=>e.targets.includes(t))))),Nl=({state:e,userId:t,dispatch:r,relationsProps:n})=>{const a=M9(e,t);return a?r(qs.util.updateQueryData(n8,a,(e=>{e[t]={...e[t],...n}}))):null};var wb=function(e,t,r){if(e&&"reportValidity"in e){var n=zw(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},a8=function(e,t){var r=function(r){var n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?wb(n.ref,r,e):n.refs&&n.refs.forEach((function(t){return wb(t,r,e)}))};for(var n in t.fields)r(n)},O9=function(e,t){t.shouldUseNativeValidation&&a8(e,t);var r={};for(var n in e){var a=zw(t.fields,n),i=Object.assign(e[n]||{},{ref:a&&a.ref});if(D9(t.names||Object.keys(e),n)){var o=Object.assign({},zw(r,n));o1(o,"root",i),o1(r,n,o)}else o1(r,n,i)}return r},D9=function(e,t){return e.some((function(e){return e.startsWith(t+".")}))},U9=function(e,t){for(var r={};e.length;){var n=e[0],a=n.code,i=n.message,o=n.path.join(".");if(!r[o])if("unionErrors"in n){var s=n.unionErrors[0].errors[0];r[o]={message:s.message,type:s.code}}else r[o]={message:i,type:a};if("unionErrors"in n&&n.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var c=r[o].types,l=c&&c[n.code];r[o]=r7(o,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r},Rw=function(e,t,r){return void 0===r&&(r={}),function(n,a,i){try{return Promise.resolve(function(a,o){try{var s=Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then((function(e){return i.shouldUseNativeValidation&&a8({},i),{errors:{},values:r.raw?n:e}}))}catch(e){return o(e)}return s&&s.then?s.then(void 0,o):s}(0,(function(e){if(null!=e.errors)return{values:{},errors:O9(U9(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};throw e})))}catch(e){return Promise.reject(e)}}};const rk=({schema:e,defaultValues:t,mode:r="onChange",reValidateMode:n="onChange",showRequiredErrors:a=!0})=>Sz({mode:r,reValidateMode:n,resolver:a?Rw(e):async(t,r,n)=>{const a=await Rw(e)(t,r,n);if(!a.errors||0===Object.keys(a.errors).length)return a;const i={};return Object.keys(a.errors).forEach((e=>{const r=a.errors[e],n=t[e],o="password"===e,s=null==n||""===n,c="invalid_type"===(null==r?void 0:r.type)||"too_small"===(null==r?void 0:r.type)||o&&"custom"===(null==r?void 0:r.type);s&&c||(i[e]=r)})),{values:a.values,errors:i}},defaultValues:t});var Ft,Ew;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of r)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ft||(Ft={})),(Ew||(Ew={})).mergeShapes=(e,t)=>({...e,...t});const Ve=Ft.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gf=e=>{switch(typeof e){case"undefined":return Ve.undefined;case"string":return Ve.string;case"number":return isNaN(e)?Ve.nan:Ve.number;case"boolean":return Ve.boolean;case"function":return Ve.function;case"bigint":return Ve.bigint;case"symbol":return Ve.symbol;case"object":return Array.isArray(e)?Ve.array:null===e?Ve.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Ve.promise:typeof Map<"u"&&e instanceof Map?Ve.map:typeof Set<"u"&&e instanceof Set?Ve.set:typeof Date<"u"&&e instanceof Date?Ve.date:Ve.object;default:return Ve.unknown}},Te=Ft.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"]),q9=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class gi extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(n);else if("invalid_return_type"===a.code)n(a.returnTypeError);else if("invalid_arguments"===a.code)n(a.argumentsError);else if(0===a.path.length)r._errors.push(t(a));else{let e=r,n=0;for(;n<a.path.length;){const r=a.path[n];n===a.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(a))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof gi))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ft.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}gi.create=e=>new gi(e);const lh=(e,t)=>{let r;switch(e.code){case Te.invalid_type:r=e.received===Ve.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Te.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ft.jsonStringifyReplacer)}`;break;case Te.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ft.joinValues(e.keys,", ")}`;break;case Te.invalid_union:r="Invalid input";break;case Te.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ft.joinValues(e.options)}`;break;case Te.invalid_enum_value:r=`Invalid enum value. Expected ${Ft.joinValues(e.options)}, received '${e.received}'`;break;case Te.invalid_arguments:r="Invalid function arguments";break;case Te.invalid_return_type:r="Invalid function return type";break;case Te.invalid_date:r="Invalid date";break;case Te.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Ft.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Te.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Te.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Te.custom:r="Invalid input";break;case Te.invalid_intersection_types:r="Intersection results could not be merged";break;case Te.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Te.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ft.assertNever(e)}return{message:r}};let s8=lh;function W9(e){s8=e}function Yy(){return s8}const Jy=e=>{const{data:t,path:r,errorMaps:n,issueData:a}=e,i=[...r,...a.path||[]],o={...a,path:i};if(void 0!==a.message)return{...a,path:i,message:a.message};let s="";const c=n.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...a,path:i,message:s}},F9=[];function De(e,t){const r=Yy(),n=Jy({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===lh?void 0:lh].filter((e=>!!e))});e.common.issues.push(n)}class Qa{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return ht;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return Qa.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:a}=n;if("aborted"===t.status||"aborted"===a.status)return ht;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"!==t.value&&(typeof a.value<"u"||n.alwaysSet)&&(r[t.value]=a.value)}return{status:e.value,value:r}}}const ht=Object.freeze({status:"aborted"}),rh=e=>({status:"dirty",value:e}),gs=e=>({status:"valid",value:e}),Lw=e=>"aborted"===e.status,Nw=e=>"dirty"===e.status,Rg=e=>"valid"===e.status,Eg=e=>typeof Promise<"u"&&e instanceof Promise;function Qy(e,t,r,n){if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function i8(e,t,r,n,a){if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var et,_g,vg;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(et||(et={}));class Rc{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}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 kb=(e,t)=>{if(Rg(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 gi(e.common.issues);return this._error=t,this._error}}};function xt(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:a}:{errorMap:(t,a)=>{var i,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:s??a.defaultError}:typeof a.data>"u"?{message:null!==(i=s??n)&&void 0!==i?i:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(o=s??r)&&void 0!==o?o:a.defaultError}},description:a}}class At{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 gf(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:gf(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Qa,ctx:{common:e.parent.common,data:e.data,parsedType:gf(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Eg(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gf(e)},a=this._parseSync({data:e,path:n.path,parent:n});return kb(n,a)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gf(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(Eg(n)?n:Promise.resolve(n));return kb(r,a)}refine(e,t){const r=e=>"string"==typeof t||typeof t>"u"?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const a=e(t),i=()=>n.addIssue({code:Te.custom,...r(t)});return typeof Promise<"u"&&a instanceof Promise?a.then((e=>!!e||(i(),!1))):!!a||(i(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new Mo({schema:this,typeName:ut.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Pc.create(this,this._def)}nullable(){return wf.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Io.create(this,this._def)}promise(){return fh.create(this,this._def)}or(e){return Mg.create([this,e],this._def)}and(e){return Og.create(this,e,this._def)}transform(e){return new Mo({...xt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Fg({...xt(this._def),innerType:this,defaultValue:t,typeName:ut.ZodDefault})}brand(){return new nk({typeName:ut.ZodBranded,type:this,...xt(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Vg({...xt(this._def),innerType:this,catchValue:t,typeName:ut.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ey.create(this,e)}readonly(){return Xg.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const V9=/^c[^\s-]{8,}$/i,X9=/^[0-9a-z]+$/,B9=/^[0-9A-HJKMNP-TV-Z]{26}$/,H9=/^[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,Z9=/^[a-z0-9_-]{21}$/i,G9=/^[-+]?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)?)??$/,K9=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Y9="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let y1;const J9=/^(?:(?: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])$/,Q9=/^(([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})))$/,$9=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,o8="((\\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])))",eS=new RegExp(`^${o8}$`);function c8(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 tS(e){return new RegExp(`^${c8(e)}$`)}function l8(e){let t=`${o8}T${c8(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function rS(e,t){return!(("v4"!==t&&t||!J9.test(e))&&("v6"!==t&&t||!Q9.test(e)))}class No extends At{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ve.string){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.string,received:t.parsedType}),ht}const t=new Qa;let r;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const a=e.data.length>n.value,i=e.data.length<n.value;(a||i)&&(r=this._getOrReturnCtx(e,r),a?De(r,{code:Te.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&De(r,{code:Te.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)K9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"email",code:Te.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)y1||(y1=new RegExp(Y9,"u")),y1.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"emoji",code:Te.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)H9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"uuid",code:Te.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)Z9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"nanoid",code:Te.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)V9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"cuid",code:Te.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)X9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"cuid2",code:Te.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)B9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"ulid",code:Te.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),De(r,{validation:"url",code:Te.invalid_string,message:n.message}),t.dirty()}else"regex"===n.kind?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"regex",code:Te.invalid_string,message:n.message}),t.dirty())):"trim"===n.kind?e.data=e.data.trim():"includes"===n.kind?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):"toLowerCase"===n.kind?e.data=e.data.toLowerCase():"toUpperCase"===n.kind?e.data=e.data.toUpperCase():"startsWith"===n.kind?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):"endsWith"===n.kind?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):"datetime"===n.kind?l8(n).test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:"datetime",message:n.message}),t.dirty()):"date"===n.kind?eS.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:"date",message:n.message}),t.dirty()):"time"===n.kind?tS(n).test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:"time",message:n.message}),t.dirty()):"duration"===n.kind?G9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"duration",code:Te.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?rS(e.data,n.version)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"ip",code:Te.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?$9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"base64",code:Te.invalid_string,message:n.message}),t.dirty()):Ft.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:Te.invalid_string,...et.errToObj(r)})}_addCheck(e){return new No({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...et.errToObj(e)})}url(e){return this._addCheck({kind:"url",...et.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...et.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...et.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...et.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...et.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...et.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...et.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...et.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...et.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(null==e?void 0:e.precision)>"u"?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...et.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,...et.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...et.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...et.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...et.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...et.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...et.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...et.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...et.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...et.errToObj(t)})}nonempty(e){return this.min(1,et.errToObj(e))}trim(){return new No({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new No({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new No({...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 nS(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}No.create=e=>{var t;return new No({checks:[],typeName:ut.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...xt(e)})};class mf extends At{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)!==Ve.number){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.number,received:t.parsedType}),ht}let t;const r=new Qa;for(const n of this._def.checks)"int"===n.kind?Ft.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),De(t,{code:Te.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==nS(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),De(t,{code:Te.not_finite,message:n.message}),r.dirty()):Ft.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,et.toString(t))}gt(e,t){return this.setLimit("min",e,!1,et.toString(t))}lte(e,t){return this.setLimit("max",e,!0,et.toString(t))}lt(e,t){return this.setLimit("max",e,!1,et.toString(t))}setLimit(e,t,r,n){return new mf({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:et.toString(n)}]})}_addCheck(e){return new mf({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:et.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:et.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:et.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:et.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:et.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:et.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:et.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:et.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:et.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&&Ft.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}mf.create=e=>new mf({checks:[],typeName:ut.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...xt(e)});class _f extends At{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)!==Ve.bigint){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.bigint,received:t.parsedType}),ht}let t;const r=new Qa;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Ft.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,et.toString(t))}gt(e,t){return this.setLimit("min",e,!1,et.toString(t))}lte(e,t){return this.setLimit("max",e,!0,et.toString(t))}lt(e,t){return this.setLimit("max",e,!1,et.toString(t))}setLimit(e,t,r,n){return new _f({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:et.toString(n)}]})}_addCheck(e){return new _f({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:et.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:et.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:et.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:et.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:et.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}}_f.create=e=>{var t;return new _f({checks:[],typeName:ut.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...xt(e)})};class Lg extends At{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ve.boolean){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.boolean,received:t.parsedType}),ht}return gs(e.data)}}Lg.create=e=>new Lg({typeName:ut.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...xt(e)});class Md extends At{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ve.date){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.date,received:t.parsedType}),ht}if(isNaN(e.data.getTime())){return De(this._getOrReturnCtx(e),{code:Te.invalid_date}),ht}const t=new Qa;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):Ft.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Md({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:et.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:et.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}}Md.create=e=>new Md({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ut.ZodDate,...xt(e)});class $y extends At{_parse(e){if(this._getType(e)!==Ve.symbol){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.symbol,received:t.parsedType}),ht}return gs(e.data)}}$y.create=e=>new $y({typeName:ut.ZodSymbol,...xt(e)});class Ng extends At{_parse(e){if(this._getType(e)!==Ve.undefined){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.undefined,received:t.parsedType}),ht}return gs(e.data)}}Ng.create=e=>new Ng({typeName:ut.ZodUndefined,...xt(e)});class Ig extends At{_parse(e){if(this._getType(e)!==Ve.null){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.null,received:t.parsedType}),ht}return gs(e.data)}}Ig.create=e=>new Ig({typeName:ut.ZodNull,...xt(e)});class uh extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return gs(e.data)}}uh.create=e=>new uh({typeName:ut.ZodAny,...xt(e)});class Ld extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gs(e.data)}}Ld.create=e=>new Ld({typeName:ut.ZodUnknown,...xt(e)});class Ul extends At{_parse(e){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.never,received:t.parsedType}),ht}}Ul.create=e=>new Ul({typeName:ut.ZodNever,...xt(e)});class em extends At{_parse(e){if(this._getType(e)!==Ve.undefined){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.void,received:t.parsedType}),ht}return gs(e.data)}}em.create=e=>new em({typeName:ut.ZodVoid,...xt(e)});class Io extends At{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==Ve.array)return De(t,{code:Te.invalid_type,expected:Ve.array,received:t.parsedType}),ht;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,a=t.data.length<n.exactLength.value;(e||a)&&(De(t,{code:e?Te.too_big:Te.too_small,minimum:a?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(De(t,{code:Te.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(De(t,{code:Te.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new Rc(t,e,t.path,r))))).then((e=>Qa.mergeArray(r,e)));const a=[...t.data].map(((e,r)=>n.type._parseSync(new Rc(t,e,t.path,r))));return Qa.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new Io({...this._def,minLength:{value:e,message:et.toString(t)}})}max(e,t){return new Io({...this._def,maxLength:{value:e,message:et.toString(t)}})}length(e,t){return new Io({...this._def,exactLength:{value:e,message:et.toString(t)}})}nonempty(e){return this.min(1,e)}}function th(e){if(e instanceof Br){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Pc.create(th(n))}return new Br({...e._def,shape:()=>t})}return e instanceof Io?new Io({...e._def,type:th(e.element)}):e instanceof Pc?Pc.create(th(e.unwrap())):e instanceof wf?wf.create(th(e.unwrap())):e instanceof Ec?Ec.create(e.items.map((e=>th(e)))):e}Io.create=(e,t)=>new Io({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...xt(t)});class Br extends At{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=Ft.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Ve.object){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.object,received:t.parsedType}),ht}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof Ul&&"strip"===this._def.unknownKeys))for(const e in r.data)a.includes(e)||i.push(e);const o=[];for(const e of a){const t=n[e],a=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new Rc(r,a,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Ul){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(De(r,{code:Te.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const n=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new Rc(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>Qa.mergeObjectSync(t,e))):Qa.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return et.errToObj,new Br({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,a,i,o;const s=null!==(i=null===(a=(n=this._def).errorMap)||void 0===a?void 0:a.call(n,t,r).message)&&void 0!==i?i:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=et.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new Br({...this._def,unknownKeys:"strip"})}passthrough(){return new Br({...this._def,unknownKeys:"passthrough"})}extend(e){return new Br({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Br({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ut.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Br({...this._def,catchall:e})}pick(e){const t={};return Ft.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new Br({...this._def,shape:()=>t})}omit(e){const t={};return Ft.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new Br({...this._def,shape:()=>t})}deepPartial(){return th(this)}partial(e){const t={};return Ft.objectKeys(this.shape).forEach((r=>{const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()})),new Br({...this._def,shape:()=>t})}required(e){const t={};return Ft.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof Pc;)e=e._def.innerType;t[r]=e}})),new Br({...this._def,shape:()=>t})}keyof(){return u8(Ft.objectKeys(this.shape))}}Br.create=(e,t)=>new Br({shape:()=>e,unknownKeys:"strip",catchall:Ul.create(),typeName:ut.ZodObject,...xt(t)}),Br.strictCreate=(e,t)=>new Br({shape:()=>e,unknownKeys:"strict",catchall:Ul.create(),typeName:ut.ZodObject,...xt(t)}),Br.lazycreate=(e,t)=>new Br({shape:e,unknownKeys:"strip",catchall:Ul.create(),typeName:ut.ZodObject,...xt(t)});class Mg extends At{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new gi(e.ctx.common.issues)));return De(t,{code:Te.invalid_union,unionErrors:r}),ht}));{let e;const n=[];for(const a of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=a._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"===i.status&&!e&&(e={result:i,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=n.map((e=>new gi(e)));return De(t,{code:Te.invalid_union,unionErrors:a}),ht}}get options(){return this._def.options}}Mg.create=(e,t)=>new Mg({options:e,typeName:ut.ZodUnion,...xt(t)});const Il=e=>e instanceof Ug?Il(e.schema):e instanceof Mo?Il(e.innerType()):e instanceof qg?[e.value]:e instanceof vf?e.options:e instanceof Wg?Ft.objectValues(e.enum):e instanceof Fg?Il(e._def.innerType):e instanceof Ng?[void 0]:e instanceof Ig?[null]:e instanceof Pc?[void 0,...Il(e.unwrap())]:e instanceof wf?[null,...Il(e.unwrap())]:e instanceof nk||e instanceof Xg?Il(e.unwrap()):e instanceof Vg?Il(e._def.innerType):[];class ym extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ve.object)return De(t,{code:Te.invalid_type,expected:Ve.object,received:t.parsedType}),ht;const r=this.discriminator,n=t.data[r],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(De(t,{code:Te.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const r of t){const t=Il(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of t){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,r)}}return new ym({typeName:ut.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...xt(r)})}}function Iw(e,t){const r=gf(e),n=gf(t);if(e===t)return{valid:!0,data:e};if(r===Ve.object&&n===Ve.object){const r=Ft.objectKeys(t),n=Ft.objectKeys(e).filter((e=>-1!==r.indexOf(e))),a={...e,...t};for(const r of n){const n=Iw(e[r],t[r]);if(!n.valid)return{valid:!1};a[r]=n.data}return{valid:!0,data:a}}if(r===Ve.array&&n===Ve.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const a=Iw(e[n],t[n]);if(!a.valid)return{valid:!1};r.push(a.data)}return{valid:!0,data:r}}return r===Ve.date&&n===Ve.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Og extends At{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(Lw(e)||Lw(n))return ht;const a=Iw(e.value,n.value);return a.valid?((Nw(e)||Nw(n))&&t.dirty(),{status:t.value,value:a.data}):(De(r,{code:Te.invalid_intersection_types}),ht)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Og.create=(e,t,r)=>new Og({left:e,right:t,typeName:ut.ZodIntersection,...xt(r)});class Ec extends At{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ve.array)return De(r,{code:Te.invalid_type,expected:Ve.array,received:r.parsedType}),ht;if(r.data.length<this._def.items.length)return De(r,{code:Te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ht;!this._def.rest&&r.data.length>this._def.items.length&&(De(r,{code:Te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new Rc(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>Qa.mergeArray(t,e))):Qa.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Ec({...this._def,rest:e})}}Ec.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ec({items:e,typeName:ut.ZodTuple,rest:null,...xt(t)})};class Dg extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ve.object)return De(r,{code:Te.invalid_type,expected:Ve.object,received:r.parsedType}),ht;const n=[],a=this._def.keyType,i=this._def.valueType;for(const e in r.data)n.push({key:a._parse(new Rc(r,e,r.path,e)),value:i._parse(new Rc(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?Qa.mergeObjectAsync(t,n):Qa.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new Dg(t instanceof At?{keyType:e,valueType:t,typeName:ut.ZodRecord,...xt(r)}:{keyType:No.create(),valueType:e,typeName:ut.ZodRecord,...xt(t)})}}class tm extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ve.map)return De(r,{code:Te.invalid_type,expected:Ve.map,received:r.parsedType}),ht;const n=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map((([e,t],i)=>({key:n._parse(new Rc(r,e,r.path,[i,"key"])),value:a._parse(new Rc(r,t,r.path,[i,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of i){const n=await r.key,a=await r.value;if("aborted"===n.status||"aborted"===a.status)return ht;("dirty"===n.status||"dirty"===a.status)&&t.dirty(),e.set(n.value,a.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of i){const n=r.key,a=r.value;if("aborted"===n.status||"aborted"===a.status)return ht;("dirty"===n.status||"dirty"===a.status)&&t.dirty(),e.set(n.value,a.value)}return{status:t.value,value:e}}}}tm.create=(e,t,r)=>new tm({valueType:t,keyType:e,typeName:ut.ZodMap,...xt(r)});class Od extends At{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ve.set)return De(r,{code:Te.invalid_type,expected:Ve.set,received:r.parsedType}),ht;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(De(r,{code:Te.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(De(r,{code:Te.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(e){const r=new Set;for(const n of e){if("aborted"===n.status)return ht;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const o=[...r.data.values()].map(((e,t)=>a._parse(new Rc(r,e,r.path,t))));return r.common.async?Promise.all(o).then((e=>i(e))):i(o)}min(e,t){return new Od({...this._def,minSize:{value:e,message:et.toString(t)}})}max(e,t){return new Od({...this._def,maxSize:{value:e,message:et.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Od.create=(e,t)=>new Od({valueType:e,minSize:null,maxSize:null,typeName:ut.ZodSet,...xt(t)});class sh extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ve.function)return De(t,{code:Te.invalid_type,expected:Ve.function,received:t.parsedType}),ht;function r(e,r){return Jy({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Yy(),lh].filter((e=>!!e)),issueData:{code:Te.invalid_arguments,argumentsError:r}})}function n(e,r){return Jy({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Yy(),lh].filter((e=>!!e)),issueData:{code:Te.invalid_return_type,returnTypeError:r}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof fh){const e=this;return gs((async function(...t){const o=new gi([]),s=await e._def.args.parseAsync(t,a).catch((e=>{throw o.addIssue(r(t,e)),o})),c=await Reflect.apply(i,this,s);return await e._def.returns._def.type.parseAsync(c,a).catch((e=>{throw o.addIssue(n(c,e)),o}))}))}{const e=this;return gs((function(...t){const o=e._def.args.safeParse(t,a);if(!o.success)throw new gi([r(t,o.error)]);const s=Reflect.apply(i,this,o.data),c=e._def.returns.safeParse(s,a);if(!c.success)throw new gi([n(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new sh({...this._def,args:Ec.create(e).rest(Ld.create())})}returns(e){return new sh({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new sh({args:e||Ec.create([]).rest(Ld.create()),returns:t||Ld.create(),typeName:ut.ZodFunction,...xt(r)})}}class Ug extends At{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})}}Ug.create=(e,t)=>new Ug({getter:e,typeName:ut.ZodLazy,...xt(t)});class qg extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return De(t,{received:t.data,code:Te.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:e.data}}get value(){return this._def.value}}function u8(e,t){return new vf({values:e,typeName:ut.ZodEnum,...xt(t)})}qg.create=(e,t)=>new qg({value:e,typeName:ut.ZodLiteral,...xt(t)});class vf extends At{constructor(){super(...arguments),_g.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return De(t,{expected:Ft.joinValues(r),received:t.parsedType,code:Te.invalid_type}),ht}if(Qy(this,_g)||i8(this,_g,new Set(this._def.values)),!Qy(this,_g).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return De(t,{received:t.data,code:Te.invalid_enum_value,options:r}),ht}return gs(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 vf.create(e,{...this._def,...t})}exclude(e,t=this._def){return vf.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}_g=new WeakMap,vf.create=u8;class Wg extends At{constructor(){super(...arguments),vg.set(this,void 0)}_parse(e){const t=Ft.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ve.string&&r.parsedType!==Ve.number){const e=Ft.objectValues(t);return De(r,{expected:Ft.joinValues(e),received:r.parsedType,code:Te.invalid_type}),ht}if(Qy(this,vg)||i8(this,vg,new Set(Ft.getValidEnumValues(this._def.values))),!Qy(this,vg).has(e.data)){const e=Ft.objectValues(t);return De(r,{received:r.data,code:Te.invalid_enum_value,options:e}),ht}return gs(e.data)}get enum(){return this._def.values}}vg=new WeakMap,Wg.create=(e,t)=>new Wg({values:e,typeName:ut.ZodNativeEnum,...xt(t)});class fh extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ve.promise&&!1===t.common.async)return De(t,{code:Te.invalid_type,expected:Ve.promise,received:t.parsedType}),ht;const r=t.parsedType===Ve.promise?t.data:Promise.resolve(t.data);return gs(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}fh.create=(e,t)=>new fh({type:e,typeName:ut.ZodPromise,...xt(t)});class Mo extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:e=>{De(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===n.type){const e=n.transform(r.data,a);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return ht;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?ht:"dirty"===n.status||"dirty"===t.value?rh(n.value):n}));{if("aborted"===t.value)return ht;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?ht:"dirty"===n.status||"dirty"===t.value?rh(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,a);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?ht:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?ht:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Rg(e))return e;const i=n.transform(e.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>Rg(e)?Promise.resolve(n.transform(e.value,a)).then((e=>({status:t.value,value:e}))):e))}Ft.assertNever(n)}}Mo.create=(e,t,r)=>new Mo({schema:e,typeName:ut.ZodEffects,effect:t,...xt(r)}),Mo.createWithPreprocess=(e,t,r)=>new Mo({schema:t,effect:{type:"preprocess",transform:e},typeName:ut.ZodEffects,...xt(r)});class Pc extends At{_parse(e){return this._getType(e)===Ve.undefined?gs(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pc.create=(e,t)=>new Pc({innerType:e,typeName:ut.ZodOptional,...xt(t)});class wf extends At{_parse(e){return this._getType(e)===Ve.null?gs(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}wf.create=(e,t)=>new wf({innerType:e,typeName:ut.ZodNullable,...xt(t)});class Fg extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===Ve.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Fg.create=(e,t)=>new Fg({innerType:e,typeName:ut.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...xt(t)});class Vg extends At{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Eg(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new gi(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new gi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Vg.create=(e,t)=>new Vg({innerType:e,typeName:ut.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...xt(t)});class rm extends At{_parse(e){if(this._getType(e)!==Ve.nan){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.nan,received:t.parsedType}),ht}return{status:"valid",value:e.data}}}rm.create=e=>new rm({typeName:ut.ZodNaN,...xt(e)});const aS=Symbol("zod_brand");class nk extends At{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ey extends At{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?ht:"dirty"===e.status?(t.dirty(),rh(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?ht:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ey({in:e,out:t,typeName:ut.ZodPipeline})}}class Xg extends At{_parse(e){const t=this._def.innerType._parse(e),r=e=>(Rg(e)&&(e.value=Object.freeze(e.value)),e);return Eg(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}function f8(e,t={},r){return e?uh.create().superRefine(((n,a)=>{var i,o;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,s=null===(o=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===o||o,c="string"==typeof e?{message:e}:e;a.addIssue({code:"custom",...c,fatal:s})}})):uh.create()}Xg.create=(e,t)=>new Xg({innerType:e,typeName:ut.ZodReadonly,...xt(t)});const sS={object:Br.lazycreate};var ut;!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"}(ut||(ut={}));const iS=(e,t={message:`Input not instance of ${e.name}`})=>f8((t=>t instanceof e),t),d8=No.create,p8=mf.create,oS=rm.create,cS=_f.create,h8=Lg.create,lS=Md.create,uS=$y.create,fS=Ng.create,dS=Ig.create,pS=uh.create,hS=Ld.create,gS=Ul.create,yS=em.create,mS=Io.create,_S=Br.create,vS=Br.strictCreate,wS=Mg.create,kS=ym.create,bS=Og.create,xS=Ec.create,AS=Dg.create,zS=tm.create,SS=Od.create,CS=sh.create,TS=Ug.create,jS=qg.create,PS=vf.create,RS=Wg.create,ES=fh.create,bb=Mo.create,LS=Pc.create,NS=wf.create,IS=Mo.createWithPreprocess,MS=ey.create,OS=()=>d8().optional(),DS=()=>p8().optional(),US=()=>h8().optional(),qS={string:e=>No.create({...e,coerce:!0}),number:e=>mf.create({...e,coerce:!0}),boolean:e=>Lg.create({...e,coerce:!0}),bigint:e=>_f.create({...e,coerce:!0}),date:e=>Md.create({...e,coerce:!0})},WS=ht;var Oe=Object.freeze({__proto__:null,defaultErrorMap:lh,setErrorMap:W9,getErrorMap:Yy,makeIssue:Jy,EMPTY_PATH:F9,addIssueToContext:De,ParseStatus:Qa,INVALID:ht,DIRTY:rh,OK:gs,isAborted:Lw,isDirty:Nw,isValid:Rg,isAsync:Eg,get util(){return Ft},get objectUtil(){return Ew},ZodParsedType:Ve,getParsedType:gf,ZodType:At,datetimeRegex:l8,ZodString:No,ZodNumber:mf,ZodBigInt:_f,ZodBoolean:Lg,ZodDate:Md,ZodSymbol:$y,ZodUndefined:Ng,ZodNull:Ig,ZodAny:uh,ZodUnknown:Ld,ZodNever:Ul,ZodVoid:em,ZodArray:Io,ZodObject:Br,ZodUnion:Mg,ZodDiscriminatedUnion:ym,ZodIntersection:Og,ZodTuple:Ec,ZodRecord:Dg,ZodMap:tm,ZodSet:Od,ZodFunction:sh,ZodLazy:Ug,ZodLiteral:qg,ZodEnum:vf,ZodNativeEnum:Wg,ZodPromise:fh,ZodEffects:Mo,ZodTransformer:Mo,ZodOptional:Pc,ZodNullable:wf,ZodDefault:Fg,ZodCatch:Vg,ZodNaN:rm,BRAND:aS,ZodBranded:nk,ZodPipeline:ey,ZodReadonly:Xg,custom:f8,Schema:At,ZodSchema:At,late:sS,get ZodFirstPartyTypeKind(){return ut},coerce:qS,any:pS,array:mS,bigint:cS,boolean:h8,date:lS,discriminatedUnion:kS,effect:bb,enum:PS,function:CS,instanceof:iS,intersection:bS,lazy:TS,literal:jS,map:zS,nan:oS,nativeEnum:RS,never:gS,null:dS,nullable:NS,number:p8,object:_S,oboolean:US,onumber:DS,optional:LS,ostring:OS,pipeline:MS,preprocess:IS,promise:ES,record:AS,set:SS,strictObject:vS,string:d8,symbol:uS,transformer:bb,tuple:xS,undefined:fS,union:wS,unknown:hS,void:yS,NEVER:WS,ZodIssueCode:Te,quotelessJson:q9,ZodError:gi}),FS={USER:"teamcity",npm_config_user_agent:"npm/10.9.3 node/v22.18.0 linux x64 workspaces/true",SENTRY_AUTH_TOKEN:"1d93ff28a44e4c3aaaaff854277cd8583c1de670bd8744bc895670dfd9300840",npm_node_execpath:"/home/teamcity/.nvm/versions/node/v22.18.0/bin/node",npm_config_noproxy:"",HOME:"/home/teamcity",npm_package_json:"/mnt/agent/work/70fcd8585843667f/packages/user/package.json",npm_config_userconfig:"/home/teamcity/.npmrc",npm_config_local_prefix:"/mnt/agent/work/70fcd8585843667f",COLOR:"1",npm_config_progress:"",TEMP:"/mnt/agent/temp/buildTmp",npm_config_prefix:"/home/teamcity/.nvm/versions/node/v22.18.0",npm_config_npm_version:"10.9.3",npm_config_cache:"/home/teamcity/.npm",npm_config_ignore_scripts:"true",npm_config_node_gyp:"/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",PATH:"/mnt/agent/work/70fcd8585843667f/packages/user/node_modules/.bin:/mnt/agent/work/70fcd8585843667f/packages/node_modules/.bin:/mnt/agent/work/70fcd8585843667f/node_modules/.bin:/mnt/agent/work/node_modules/.bin:/mnt/agent/node_modules/.bin:/mnt/node_modules/.bin:/node_modules/.bin:/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/mnt/agent/work/70fcd8585843667f/node_modules/.bin:/mnt/agent/work/node_modules/.bin:/mnt/agent/node_modules/.bin:/mnt/node_modules/.bin:/node_modules/.bin:/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/teamcity/.cargo/bin:/home/teamcity/.rvm/gems/ruby-3.3.9/bin:/home/teamcity/.rvm/gems/ruby-3.3.9@global/bin:/home/teamcity/.rvm/rubies/ruby-3.3.9/bin:/home/teamcity/.rvm/bin:/home/teamcity/.local/bin:/usr/lib/jvm/java-21-amazon-corretto/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/snap/bin:/usr/share/dotnet:/usr/share/dotnet/tools:/home/teamcity/google-cloud-sdk/bin:/home/teamcity/go/bin:/usr/bin/mvn:/home/teamcity/.nvm/versions/node/v22.18.0/bin",TURBO_HASH:"9d116f4db94d4188",NODE:"/home/teamcity/.nvm/versions/node/v22.18.0/bin/node",npm_package_name:"@wellesley/user",npm_config_color:"always",DOMAIN_ENV:"test",LANG:"en_US.UTF-8",TURBO_TEAM:"wellesley",TMP:"/mnt/agent/temp/buildTmp",TURBO_API:"https://turborepo-remote-cache-fo3np.ondigitalocean.app",npm_lifecycle_script:"vite build",SHELL:"/bin/bash",npm_package_version:"1.0.842",npm_lifecycle_event:"build",TURBO_CACHE:"remote:rw",SENTRY_MAPS_UPLOAD:"true",npm_config_globalconfig:"/home/teamcity/.nvm/versions/node/v22.18.0/etc/npmrc",npm_config_init_module:"/home/teamcity/.npm-init.js",PWD:"/mnt/agent/work/70fcd8585843667f/packages/user",npm_execpath:"/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/bin/npm-cli.js",npm_config_global_prefix:"/home/teamcity/.nvm/versions/node/v22.18.0",npm_command:"run-script",TURBO_TOKEN:"wellesley-turbo-token",USE_PACKAGES_FROM_NPM:"true",INIT_CWD:"/mnt/agent/work/70fcd8585843667f/packages/user",EDITOR:"vi",NODE_ENV:"production",BUILD_NUMBER:"3750",APP_NAME:"@wellesley/user"};const g8=e=>FS.DOMAIN_ENV===e,VS=g8("prod"),y8=VS?8:3,m8=64,xb=5,Mw=2,_8=30,ak=50,v8=1024,w8=30,$i={link:56,userName:30,pronouns:20,displayName:50,description:v8,fieldLabel:20,fieldContent:80,location:200,timezone:56},Nd={short:"Too short",long:"Too long"},XS=(e,t=100)=>{let r;return function(...n){clearTimeout(r),r=setTimeout((()=>e.apply(this,n)),t)}},BS=(e,t)=>{const r=XS(((t,r,n)=>{e(...n).then(t).catch(r)}),t);return(...e)=>new Promise(((t,n)=>{r(t,n,e)}))},zg=e=>e.replace(/\s+/g," ").trim(),sk=new RegExp("\\p{Extended_Pictographic}","u"),HS=/^[a-zA-Z0-9\s/.]*$/,k8=({showInlineError:e=!0})=>Oe.string().trim().min(1,e?"Username is required":"").min(2,e?"Must be at least 2 characters long":"").max(30,Nd.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,"Only latin letters, digits, _ and . allowed"),ZS=BS((async e=>{try{const{taken:t}=await Cz().dispatch(qs.endpoints.getApiV1NamesCheck.initiate({name:e,nameScope:"USER"})).unwrap();return{exists:t??!1,message:"Username already in use. Please, try another one"}}catch{return{exists:!1,message:""}}}),500),b8=Oe.string().trim().min(1,"Display name is required").max(50).regex(/^[^@]*$/,"@ is not allowed").superRefine(((e,t)=>{const r=sk.test(e),n=/[a-zA-Z0-9]/.test(e);r&&!n&&t.addIssue({code:Oe.ZodIssueCode.custom,message:"Emojis alone are not allowed. Please add text"})})),GS=Oe.string().max(1024,Nd.long).optional(),x8=({minLength:e,minErrorMessage:t,maxLength:r,regexErrorMessage:n})=>Oe.string().trim().min(e,t).max(r,Nd.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,n);x8({minLength:2,maxLength:30,regexErrorMessage:"Invalid characters. ex.: group_name_1"}),x8({minLength:2,minErrorMessage:Nd.short,maxLength:30,regexErrorMessage:"Invalid characters. ex.: channel_name_1"});const KS=/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,YS=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{1,}$/;Oe.string().trim().min(1,"").superRefine(((e,t)=>{e.includes("@")?YS.test(e)||t.addIssue({code:Oe.ZodIssueCode.custom,message:"Invalid email"}):KS.test(e)||t.addIssue({code:Oe.ZodIssueCode.custom,message:"Invalid characters"})}));const JS=`Required: A-Z, a-z, 0-9, special character, min ${y8}, max 64`;Oe.string().trim().superRefine(((e,t)=>{sk.test(e)&&t.addIssue({code:Oe.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>=y8&&e.length<=64||t.addIssue({code:Oe.ZodIssueCode.custom,message:JS})})),Oe.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=>!sk.test(e)),"Emojis are not allowed");const QS=e=>HS.test(e),$S=Oe.string().max($i.pronouns,`Maximum ${$i.pronouns} characters`).refine((e=>QS(e)),'Special characters !@#$%^*()+={} []:;", are not allowed').transform(zg).optional(),eC=/[!@#$%^&*()]/,tC=/^[0-9\s]+$/,rC=Oe.string().max($i.location).superRefine(((e,t)=>{if(e){if(eC.test(e))return void t.addIssue({code:Oe.ZodIssueCode.custom,message:"Special characters !@#$%^&*() are not allowed"});tC.test(e)&&t.addIssue({code:Oe.ZodIssueCode.custom,message:"Numbers alone aren't allowed. Please enter a valid location"})}})).optional(),nC=({form:e,originalUsername:t})=>{const r=zt(t??"").current,n=e=>e.getValues("userName"),[a,i]=bt(!1),[o,s]=bt(n(e));return{isUserNameChecked:a,handleUserNameChange:()=>{i(!1)},handleUserNameBlur:async()=>{const t=n(e).trim();if(t===o||t===r)return;const{exists:a,message:c}=await ZS(t);a&&e.setError("userName",{message:c}),s(t),i(!0)}}},aC=Oe.object({bio:GS,username:k8({showInlineError:!0}),displayName:b8}),sC=Oe.object({show:Oe.boolean(),dateOnly:Oe.boolean(),date:Oe.date().optional().nullable()}),iC=(e=!0)=>{const t=k8({showInlineError:e});return Oe.object({avatarId:Oe.string().nullable(),headerId:Oe.string().nullable(),channel:Oe.boolean().optional(),actorType:Oe.enum(["Application","Group","Organization","Person","Service"]).optional(),userName:t,displayName:b8,Pronouns:$S,summary:Oe.string().max($i.description,Nd.long).optional(),customFields:Oe.array(Oe.object({label:Oe.string().max($i.fieldLabel,Nd.long).optional(),content:Oe.string().max($i.fieldContent,Nd.long).optional()})),location:Oe.object({geo:Oe.object({latitude:Oe.number().optional(),longitude:Oe.number().optional(),accuracy:Oe.number().optional().nullable()}).optional().nullable(),show:Oe.boolean().optional(),name:rC,autoUpdate:Oe.boolean().optional()}),timezone:Oe.object({show:Oe.boolean(),ianaTimezone:Oe.string().optional(),autoUpdate:Oe.boolean()}),birthday:sC,canSubmit:Oe.boolean(),botProfile:Oe.object({role:Oe.string().optional(),triggers:Oe.array(Oe.object({id:Oe.string(),label:Oe.string()})).optional(),personality_traits:Oe.array(Oe.object({id:Oe.string(),label:Oe.string()})).optional(),tone:Oe.string().optional(),style:Oe.array(Oe.object({id:Oe.string(),label:Oe.string()})).optional(),behaviors:Oe.array(Oe.object({id:Oe.string(),label:Oe.string()})).optional(),prompt:Oe.string().optional()}).optional()})};Oe.object({show:Oe.boolean(),dateOnly:Oe.boolean(),date:Oe.date().optional().nullable()});const Bg=e=>{var t;const r=e,n=409===(null==r?void 0:r.status);return{message:"UserNameIsReserved"===(null==(t=null==r?void 0:r.data)?void 0:t.errorCode)?"Restricted words detected. Please, try alternatives":"Username already in use. Please, try another one",isError:n}},A8="FollowersListHidden",z8="FollowingListHidden",Ode=e=>{var t;const r=null==(t=null==e?void 0:e.data)?void 0:t.errorCode;return r===A8||r===z8},dg=e=>{var t,r;const n=null==(r=null==(t=null==e?void 0:e.error)?void 0:t.data)?void 0:r.errorCode;return n===A8||n===z8},S8=qs.enhanceEndpoints({endpoints:{deleteApiV1Users:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){try{await yn(r)&&await t(qs.endpoints.getApiV1AccountsProfile.initiate({htmlContent:!1})).unwrap()}catch(e){Zt.error(`${Us(e)}`)}}},getApiV1AccountsProfile:{providesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){t(Cw(!0));try{const e=await yn(r);e&&t(Zz(e.data)),t(Tw(!0))}catch(e){t(Tw(!1)),t(Hz(!0)),t(Bz(e))}finally{t(Cw(!1))}}},putApiV1UsersByUserId:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,Zt.success("User updated successfully")}catch(e){const t=e.error,{isError:r}=Bg(t);!r&&Zt.error(`${Us(t)}`)}}},getApiV1Users:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){const n=!e.htmlContent;try{n&&t(ha.actions.setPending(!0));const e=await yn(r);n&&e&&(t(ha.actions.setUser(e.data)),t(ha.actions.setSuccess(!0)),t(ha.actions.setPending(!1)))}catch(e){n&&(t(ha.actions.setSuccess(!1)),t(ha.actions.setError(e)),t(ha.actions.setPending(!1))),Zt.error(`${Us(e)}`)}}},postApiV1Users:{invalidatesTags:["Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,Zt.success("User created successfully")}catch(e){const t=e.error,{isError:r}=Bg(t);!r&&Zt.error(`${Us(t)}`)}}},getApiV1UsersFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!dg(e)){const t=e;Zt.error(`${Us(t.error)}`)}}}},getApiV1UsersRemoteByUserNameFullFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!dg(e)){const t=e;Zt.error(`${Us(t.error)}`)}}}},getApiV1UsersByUserId:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){const n=!e.htmlContent;try{n&&t(ha.actions.setPending(!0));const e=await yn(r);n&&e&&(t(ha.actions.setUser(e.data)),t(ha.actions.setSuccess(!0)),t(ha.actions.setPending(!1)))}catch(e){n&&(t(ha.actions.setSuccess(!1)),t(ha.actions.setError(e)),t(ha.actions.setPending(!1))),Zt.error(`${Us(e)}`)}}},getApiV1UsersByUserIdFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!dg(e)){const t=e;Zt.error(`${Us(t.error)}`)}}}},getApiV1UsersFollowees:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!dg(e)){const t=e;Zt.error(`${Us(t.error)}`)}}}},getApiV1UsersByUserIdFollowing:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!dg(e)){const t=e;Zt.error(`${Us(t.error)}`)}}}},postApiV1UsersFollowByUsernameAccept:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:n}){const a=Nl({dispatch:r,userId:e.user.id,state:n(),relationsProps:{followed:"ACCEPTED"}});await yn(t,`Accepted follow request from ${e.username}`,(()=>null==a?void 0:a.undo()))}},postApiV1UsersFollowByUsernameReject:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:n}){const a=Nl({dispatch:r,userId:e.user.id,state:n(),relationsProps:{followed:"REJECTED"}});await yn(t,`Rejected follow request from ${e.username}`,(()=>null==a?void 0:a.undo()))}},postApiV1UsersFollowByUsername:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r}){await yn(t,`Follow request sent to ${e.username}`)&&r(qs.util.invalidateTags([{type:"Relationship",id:e.user.id}]))}},postApiV1UsersFollowByUsernameUndo:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:n}){const a=Nl({dispatch:r,userId:e.user.id,state:n(),relationsProps:{following:null}});await yn(t,`You unfollowed ${e.username}`,(()=>null==a?void 0:a.undo()))}},getApiV1Block:{providesTags:["Follow"]},postApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const a=Nl({userId:e.userId,dispatch:n,state:r(),relationsProps:{blocked:!0}});await yn(t,void 0,(()=>null==a?void 0:a.undo()))}},deleteApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const a=Nl({userId:e.userId,dispatch:n,state:r(),relationsProps:{blocked:!1,muted:{state:!1}}});await yn(t,void 0,(()=>null==a?void 0:a.undo()))}},postApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:r,dispatch:n}){const a=Nl({userId:e,dispatch:n,state:r(),relationsProps:{muted:{state:!0}}});await yn(t,void 0,(()=>null==a?void 0:a.undo()))}},deleteApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:r,dispatch:n}){const a=Nl({userId:e,dispatch:n,state:r(),relationsProps:{muted:{state:!1}}});await yn(t,void 0,(()=>null==a?void 0:a.undo()))}},getApiV1Mute:{async onQueryStarted(e,{queryFulfilled:t}){await yn(t)}},getApiV1UsersRelationships:{providesTags:(e,t,{targets:r})=>r.map((e=>({type:"Relationship",id:e}))),async onQueryStarted(e,{queryFulfilled:t}){await yn(t)}},postApiV1AdminUserChangeState:{invalidatesTags:["Secure"],async onQueryStarted(e,{queryFulfilled:t}){await yn(t,`User ${e.changeUserState.userId} state changed to ${e.changeUserState.newState}`)}},putApiV1Notes:{async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const{userId:a,text:i}=e.noteUpdate,o=Nl({userId:a,dispatch:n,state:r(),relationsProps:{note:i}});await yn(t,"Note has been updated",(()=>null==o?void 0:o.undo()))}},deleteApiV1NotesByUserId:{async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const a=Nl({userId:e.userId,dispatch:n,state:r(),relationsProps:{note:""}});await yn(t,"Note has been removed",(()=>null==a?void 0:a.undo()))}},postApiV1UsersFollowByUsernamePend:{async onQueryStarted(e,{queryFulfilled:t}){await yn(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:Dde,usePostApiV1UsersMutation:oC,useDeleteApiV1AccountsDeleteMutation:cC,useGetApiV1AccountsProfileQuery:Ude,usePutApiV1UsersByUserIdMutation:ik,useGetApiV1UsersQuery:lC,useDeleteApiV1UsersMutation:C8,usePostApiV1MuteByUserIdMutation:qde,useDeleteApiV1MuteByUserIdMutation:Wde,useGetApiV1MuteQuery:Fde,usePostApiV1AdminUserChangeStateMutation:Vde,useGetApiV1UsersRelationshipsQuery:uC,usePutApiV1NotesMutation:Xde,useDeleteApiV1NotesByUserIdMutation:Bde,useLazyGetApiV1UsersRelationshipsQuery:fC,useLazyGetApiV1GeoQuery:dC,useLazyGetApiV1GroupsOwnedQuery:pC,useGetApiV1UsersFollowersQuery:Hde,useGetApiV1UsersByUserIdQuery:hC,useLazyGetApiV1UsersRenameHistoryQuery:Zde,useGetApiV1UsersByUserIdFollowersQuery:Gde,useGetApiV1UsersByUserIdFollowingQuery:Kde,useGetApiV1UsersFolloweesQuery:Yde,usePostApiV1UsersFollowByUsernameMutation:Jde,usePostApiV1UsersFollowByUsernameUndoMutation:Qde,usePostApiV1UsersFollowByUsernameRejectMutation:$de,usePostApiV1UsersFollowByUsernameAcceptMutation:epe,useGetApiV1UsersRemoteByUserNameFullFollowersQuery:tpe}=S8,T8=()=>{const[e]=ik();return({userId:t,htmlContent:r,data:n})=>{e({userId:t,userUpdate:n,...r&&{htmlContent:r}})}},Ab={data:null,isError:!1,isPending:!1,isSuccess:!1},Hr=Ud({name:"user",initialState:Ab,reducers:{reset:e=>{Object.assign(e,Ab)}},extraReducers:e=>{e.addCase(Zz,((e,{payload:t})=>{e.data=t})).addCase(Gz,((e,{payload:t})=>{e.data&&Object.assign(e.data,t||{})})).addCase(Tw,((e,{payload:t})=>{e.isSuccess=t})).addCase(Cw,((e,{payload:t})=>{e.isPending=t})).addCase(Hz,((e,{payload:t})=>{e.isError=t})).addCase(Bz,((e,{payload:t})=>{e.error=t})).addCase(s9,((e,{payload:t})=>{var r;null!=(r=e.data)&&r.users&&(e.data.users=e.data.users.map((e=>t.id===e.id?t:e)))}))},selectors:{selectIsError:e=>e.isError,selectError:e=>e.error,selectPending:e=>e.isPending,selectData:e=>e.data,selectAccount:e=>{var t;return null==(t=e.data)?void 0:t.account},selectAccountId:e=>{var t;return null==(t=e.data)?void 0:t.account.id},selectUsers:e=>{var t;return null==(t=e.data)?void 0:t.users},selectUserById:(e,t)=>{var r;return null==(r=e.data)?void 0:r.users.find((({id:e})=>e===t))},selectCurrentUser:e=>{var t;return null==(t=e.data)?void 0:t.users.find((({id:t})=>{var r;return t===(null==(r=e.data)?void 0:r.selectedUserId)}))},selectSelectedUserId:e=>{var t;return null==(t=e.data)?void 0:t.selectedUserId},selectSuccess:e=>e.isSuccess}}),gC=e=>e.filter((e=>e.id&&e.username&&e.displayName)),rpe=()=>{const e=Do(),t=ft(Hr.selectors.selectAccount),r=jz("account#$account_id",{account_id:(null==t?void 0:t.id)||""}),n=ft((e=>Gw.selectors.selectLastUpdateFor(e,r)));Ke((()=>{if(null!=t&&t.id)return e(Vz({id:r,topics:[r]})),()=>{e(Xz(r))}}),[null==t?void 0:t.id]),Ke((()=>{null!=n&&n.data&&e(Gz({...n.data,users:gC(n.data.users)}))}),[null==n?void 0:n.data])},dh=()=>{const e=ft(Hr.selectors.selectSelectedUserId),t=Do();return{changeUser:Dr((r=>{e!==r&&t(n9({userId:r}))}),[e,t]),selectedUserId:e}},yC=(e="")=>e.startsWith("@")?null==e?void 0:e.replace("@",""):e,mC=({username:e,canFetch:t=!0,htmlContent:r=!0})=>{const n=yC(e),{data:a,error:i,isLoading:o}=lC({username:n,full:!0,htmlContent:r},{skip:!n||!t});return{data:a,error:i,isLoading:o}},_C=e=>{const t=ft(ha.selectors.selectUser),{isLoading:r}=mC({username:e,canFetch:!!e,htmlContent:!1});return[t,r]},j8=()=>E8()?location.hostname:location.hostname.replace(/\w\w\w\.|^/,"."),P8=e=>{const t=new Date;return t.setTime(t.getTime()+24*e*60*60*1e3),t.toUTCString()},R8=e=>Object.keys(e).reduce(((t,r)=>`${t}${r}${!0===e[r]?"":`=${e[r]}`};`),""),vC=(e,t)=>{const r=$g()?"":document.cookie,n=`; ${t||r}`.split(`; ${e}=`);if(2===n.length)return(n.pop()||"").replace("=","").split(";").shift()},wC=(e,t)=>{$g()||(document.cookie=R8({[e]:"",path:"/",domain:t||j8(),expires:"Thu, 01 Jan 1970 00:00:01 GMT"}))},kC=["localhost","127.0.0.1","dev.localtest.me","wellesleydev.localtest.me"],E8=()=>kC.includes(location.hostname),bC=(e,t="",r=10,n)=>{$g()||(document.cookie=R8({[e]:t,path:"/",domain:n||j8(),expires:P8(r),...!E8()&&{SameSite:"None",Secure:!0}}))},ok={set:bC,remove:wC,get:vC,getExpireDate:P8},ck="auth_token",L8=()=>ok.get(ck)||void 0,xC=e=>ok.set(ck,e),AC=()=>ok.remove(ck),zC=()=>!!L8(),SC={getToken:L8,setToken:xC,removeToken:AC,hasToken:zC},zb={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!SC.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},lk=Ud({name:"auth",initialState:zb,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...zb,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}}),npe=()=>{const e=ft(lk.selectors.selectIsAuthenticated),t=ft(Hr.selectors.selectPending);return{user:ft(Hr.selectors.selectCurrentUser),isLogged:e,isLoading:t}},CC=()=>{const e=ft(Hr.selectors.selectCurrentUser),t=ft(lk.selectors.selectIsAuthenticated);return{user:e,isLoading:ft(Hr.selectors.selectPending),isLogged:t,error:ft(Hr.selectors.selectError)}},ape=({userId:e="",canFetch:t=!0,htmlContent:r=!0})=>{const{data:n,error:a,isLoading:i,isFetching:o}=hC({userId:e,full:!0,htmlContent:r},{skip:!e||!t});return{data:n,error:a,isLoading:i,isFetching:o}},TC=({onChange:e})=>{const{user:t}=CC(),r=null==t?void 0:t.id,n=zt(r);Ke((()=>{n.current?r!==n.current&&(e(),n.current=r):n.current=r}),[r,n.current])},Sb=["following","followed","blocked","muted","note","blocked_by"],Cb=({userId:e,currentUserId:t})=>{const r="string"==typeof e,n=r?[e]:(null==e?void 0:e.filter((e=>e!==t)))||[],a=e===t;return{isSingleUser:r,canFetch:!(!n.length||a||!t),safeTargets:n}},jC=({userId:e,skip:t})=>{const r=ft(Hr.selectors.selectCurrentUser),n=null==r?void 0:r.id,{canFetch:a,isSingleUser:i,safeTargets:o}=Cb({userId:e,currentUserId:n}),{data:s,isLoading:c}=uC({targets:o,filter:Sb},{skip:!a||t}),[l]=fC(),u=({userId:e})=>{const{canFetch:t,safeTargets:r}=Cb({userId:e,currentUserId:n});t&&l({targets:r,filter:Sb})};return TC({onChange:()=>{u({userId:o})}}),{relationship:(i?null==s?void 0:s[e]:s)||{},isLoading:c,updateRelations:u}},ty=e=>`@${e.username}${e.local?"":`@${e.domain}`}`,N8=({id:e,user:t})=>{const r=Do(),n=jz("user#$username",{username:t?ty(t).slice(1):""}),a=`${e}-${null==t?void 0:t.username}`;return Ke((()=>{if(null!=t&&t.username)return r(Vz({id:a,topics:[n]})),()=>{r(Xz(a))}}),[null==t?void 0:t.username]),{subscriptionName:n}},spe=({user:e,onUpdate:t})=>{const{updateRelations:r}=jC({}),{subscriptionName:n}=N8({id:"outside-user-update",user:e}),a=ft((e=>Gw.selectors.selectLastUpdateFor(e,n)));Ke((()=>{const e=null==a?void 0:a.data;e&&(r({userId:e.id}),t(e))}),[null==a?void 0:a.data])},ipe=({onUpdate:e})=>{const t=ft(Hr.selectors.selectCurrentUser),{subscriptionName:r}=N8({id:"current-user-update",user:t}),n=ft((e=>Gw.selectors.selectLastUpdateFor(e,r)));Ke((()=>{const t=null==n?void 0:n.data;t&&e(t)}),[null==n?void 0:n.data])},I8=e=>{const t=e.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return t?t[1]:void 0},PC=e=>e.replace(/\.[^.]*$/,""),RC=()=>!$g()&&/iPhone|iPod|iPad/gi.test(window.navigator.userAgent),EC=({src:e,name:t=""})=>new Promise(((r,n)=>{const a=document.createElement("video");a.src=e;const i=()=>{const{duration:e,videoHeight:i,videoWidth:o,src:s}=a,c=PC(t);(!e||!i||!o||!s)&&n(),r({src:s,name:c,width:o,height:i,duration:Math.floor(e)})},o=()=>{hs.warn("Failed to load video"),r(null)};return RC()&&a.load(),a.addEventListener("error",o),a.addEventListener("loadeddata",i),()=>{a.removeEventListener("error",o),a.removeEventListener("loadeddata",i)}})),LC=e=>new Promise(((t,r)=>{const n=new Image,a=URL.createObjectURL(e);n.onload=()=>{t({width:n.naturalWidth,height:n.naturalHeight}),URL.revokeObjectURL(a)},n.onerror=()=>{hs.warn("Failed to load image"),r(null),URL.revokeObjectURL(a)},n.src=a})),Tb=e=>{if(!e)return;const t="number"==typeof e?e:parseInt(e,10);if(isNaN(t))throw new Error("Can not get number from income argument");const r=t/1048576;return`${Math.floor(r)} MB`},NC={openaiConfigModel:"wellesley.openai.config.model",openaiConfigApiKey:"wellesley.openai.config.apiKey",uploadsProvider:"wellesley.uploads.provider",uploadsS3:"wellesley.uploads.s3",uploadsPolicyImageExtensions:"wellesley.uploads.policy.image.extensions",uploadsPolicyImageKeepOriginal:"wellesley.uploads.policy.image.keepOriginal",uploadsPolicyImageResolutions:"wellesley.uploads.policy.image.resolutions",uploadsPolicyImageMaxResolution:"wellesley.uploads.policy.image.maxResolution",uploadsPolicyImageMaxMatrix:"wellesley.uploads.policy.image.maxMatrix",uploadsPolicyImageMaxSize:"wellesley.uploads.policy.image.maxSize",uploadsPolicyVideoExtensions:"wellesley.uploads.policy.video.extensions",uploadsPolicyVideoResolutions:"wellesley.uploads.policy.video.resolutions",uploadsPolicyVideoKeepOriginal:"wellesley.uploads.policy.video.keepOriginal",uploadsPolicyVideoMaxResolution:"wellesley.uploads.policy.video.maxResolution",uploadsPolicyVideoMaxMatrix:"wellesley.uploads.policy.video.maxMatrix",uploadsPolicyVideoMaxSize:"wellesley.uploads.policy.video.maxSize",uploadsPolicyVideoMaxDuration:"wellesley.uploads.policy.video.maxDuration",uploadsPolicyVideoStreamingThreshold:"wellesley.uploads.policy.video.streamingThreshold",uploadsPolicyAudioExtensions:"wellesley.uploads.policy.audio.extensions",uploadsPolicyAudioKeepOriginal:"wellesley.uploads.policy.audio.keepOriginal",uploadsPolicyAudioMaxSize:"wellesley.uploads.policy.audio.maxSize",uploadsPolicyDocExtensions:"wellesley.uploads.policy.doc.extensions",uploadsPolicyDocMaxSize:"wellesley.uploads.policy.doc.maxSize",mediacacheEnabled:"wellesley.mediacache.enabled",mediacacheMaxTotalSize:"wellesley.mediacache.maxTotalSize",mediacacheMaxFileSize:"wellesley.mediacache.maxFileSize",mediacacheLimitPerRun:"wellesley.mediacache.limitPerRun",mediacacheSingleRun:"wellesley.mediacache.singleRun",mediacacheCheckInterval:"wellesley.mediacache.checkInterval",postsMaxMediaAttachments:"wellesley.posts.max_media_attachments",postsMaxCharacters:"wellesley.posts.max_characters",postsMaxPins:"wellesley.posts.max_pins",registrationMode:"wellesley.registration.mode",registrationInvitesEnabled:"wellesley.registration.invitesEnabled",registrationReasonToJoin:"wellesley.registration.reasonToJoin",registrationShowCaptcha:"wellesley.registration.showCaptcha",registrationNotAvailableMessage:"wellesley.registration.notAvailableMessage",captchaVerifyUrl:"wellesley.captcha.verifyUrl",captchaSecretKey:"wellesley.captcha.secretKey",captchaSiteKey:"wellesley.captcha.siteKey",confirmationCodeCodeExpirationMinutes:"wellesley.confirmationCode.codeExpirationMinutes",confirmationCodeCounterExpirationMinutes:"wellesley.confirmationCode.counterExpirationMinutes",confirmationCodeLimitStoreAttempts:"wellesley.confirmationCode.limitStoreAttempts",confirmationCodeLimitCheckAttempts:"wellesley.confirmationCode.limitCheckAttempts",translation:"wellesley.translation"},rn={followAutoAccept:"user.follow.autoAccept",notificationsPrefsEmailMuteEnabled:"user.notifications.prefs.email.mute.enabled",notificationsPrefsEmailMuteExpiresAt:"user.notifications.prefs.email.mute.expiresAt",notificationsPrefsEmailFollow:"user.notifications.prefs.email.follow",notificationsPrefsEmailFollowRequest:"user.notifications.prefs.email.followRequest",notificationsPrefsEmailLike:"user.notifications.prefs.email.like",notificationsPrefsEmailComment:"user.notifications.prefs.email.comment",notificationsPrefsEmailMention:"user.notifications.prefs.email.mention",notificationsPrefsEmailGroupInvite:"user.notifications.prefs.email.groupInvite",notificationsPrefsEmailRepost:"user.notifications.prefs.email.repost",notificationsPrefsEmailListPostCreate:"user.notifications.prefs.email.listPostCreate",notificationsPrefsEmailPostUpdate:"user.notifications.prefs.email.postUpdate",notificationsPrefsEmailPollVote:"user.notifications.prefs.email.pollVote",notificationsPrefsEmailEventInvite:"user.notifications.prefs.email.eventInvite",notificationsPrefsEmailEventCancel:"user.notifications.prefs.email.eventCancel",notificationsPrefsEmailEventJoin:"user.notifications.prefs.email.eventJoin",notificationsPrefsEmailEventUpdate:"user.notifications.prefs.email.eventUpdate",notificationsPrefsPushMuteEnabled:"user.notifications.prefs.push.mute.enabled",notificationsPrefsPushMuteExpiresAt:"user.notifications.prefs.push.mute.expiresAt",notificationsPrefsPushFollow:"user.notifications.prefs.push.follow",notificationsPrefsPushFollowRequest:"user.notifications.prefs.push.followRequest",notificationsPrefsPushLike:"user.notifications.prefs.push.like",notificationsPrefsPushComment:"user.notifications.prefs.push.comment",notificationsPrefsPushMention:"user.notifications.prefs.push.mention",notificationsPrefsPushGroupInvite:"user.notifications.prefs.push.groupInvite",notificationsPrefsPushRepost:"user.notifications.prefs.push.repost",notificationsPrefsPushListPostCreate:"user.notifications.prefs.push.listPostCreate",notificationsPrefsPushPostUpdate:"user.notifications.prefs.push.postUpdate",notificationsPrefsPushPollVote:"user.notifications.prefs.push.pollVote",notificationsPrefsPushEventInvite:"user.notifications.prefs.push.eventInvite",notificationsPrefsPushEventCancel:"user.notifications.prefs.push.eventCancel",notificationsPrefsPushEventJoin:"user.notifications.prefs.push.eventJoin",notificationsPrefsPushEventUpdate:"user.notifications.prefs.push.eventUpdate",notificationsPrefsSubscribeOnComment:"user.notifications.prefs.subscribeOnComment",notificationsPrefsSyncAcrossProfiles:"user.notifications.prefs.syncAcrossProfiles",notificationsShowPopup:"user.notifications.prefs.showPopup",notificationsPolicyBlockNonFollowers:"user.notifications.policy.blockNonFollowers",notificationsPolicyBlockNonFollowing:"user.notifications.policy.blockNonFollowing",notificationsPolicyBlockNonFollowingMessages:"user.notifications.policy.blockNonFollowingMessages",notificationsPolicyBlockNewAccounts:"user.notifications.policy.blockNewAccounts",privacyShowPublicPosts:"user.privacy.showPublicPosts",privacyShowProfilePage:"user.privacy.showProfilePage",privacyShowFollowers:"user.privacy.showFollowers",translation:"user.translation"},IC={sms:"wellesley.admin.sms",openai:"wellesley.admin.openai",uploads:"wellesley.admin.uploads",captcha:"wellesley.admin.captcha",language:"wellesley.admin.language",mediacache:"wellesley.admin.mediacache",translation:"wellesley.admin.translation",link_service:"wellesley.admin.link_service"},Ow={posts:"wellesley.posts",translation:"wellesley.translation",registration:"wellesley.registration",confirmationCode:"wellesley.confirmationCode",uploadsPolicyDoc:"wellesley.uploads.policy.doc",uploadsPolicyAudio:"wellesley.uploads.policy.audio",uploadsPolicyImage:"wellesley.uploads.policy.image",uploadsPolicyVideo:"wellesley.uploads.policy.video",captcha:"wellesley.captcha",access:"wellesley.access",branding:"wellesley.branding",instanceAdmin:"wellesley.instance.admin",legal:"wellesley.instance.legal",domainBlocks:"wellesley.instance.domainBlocks",contacts:"wellesley.instance.contacts"},Ml=e=>(null==e?void 0:e.map((e=>e.value||e)))||[],MC={data:null,isPending:!1},{posts:m1,uploadsPolicyDoc:jb,uploadsPolicyAudio:_1,uploadsPolicyImage:Uy,uploadsPolicyVideo:pg,registration:M8,captcha:OC,instanceAdmin:DC,branding:UC,translation:qC,domainBlocks:WC,access:FC}=Ow,{captcha:VC,language:XC,translation:BC,openai:HC,link_service:ZC}=IC,Wd=e=>e.data,GC=Wl(Wd,(e=>{var t,r,n;return{max_characters:(null==(t=null==e?void 0:e[m1])?void 0:t.max_characters)||0,max_media_attachments:(null==(r=null==e?void 0:e[m1])?void 0:r.max_media_attachments)||0,max_pins:(null==(n=null==e?void 0:e[m1])?void 0:n.max_pins)||0}})),uk=Wl(Wd,(e=>{var t,r,n;return{...null==e?void 0:e[Uy],maxSize:(null==(t=null==e?void 0:e[Uy])?void 0:t.maxSize)||0,maxMatrix:(null==(r=null==e?void 0:e[Uy])?void 0:r.maxMatrix)||0,maxResolution:(null==(n=null==e?void 0:e[Uy])?void 0:n.maxResolution)||0}})),KC=Wl(uk,(e=>Ml(e.extensions))),O8=Wl(Wd,(e=>{var t,r,n,a;return{...null==e?void 0:e[pg],maxSize:(null==(t=null==e?void 0:e[pg])?void 0:t.maxSize)||0,maxMatrix:(null==(r=null==e?void 0:e[pg])?void 0:r.maxMatrix)||0,maxDuration:(null==(n=null==e?void 0:e[pg])?void 0:n.maxDuration)||0,maxResolution:(null==(a=null==e?void 0:e[pg])?void 0:a.maxResolution)||0}})),D8=Wl(Wd,(e=>{var t,r;return{...null==e?void 0:e[_1],maxSize:null==(t=null==e?void 0:e[_1])?void 0:t.maxSize,keepOriginal:(null==(r=null==e?void 0:e[_1])?void 0:r.keepOriginal)||0}})),U8=Wl(Wd,(e=>{var t;return{...null==e?void 0:e[jb],maxSize:(null==(t=null==e?void 0:e[jb])?void 0:t.maxSize)||0}})),q8=Wl([uk,O8,D8,U8],((e,t,r,n)=>({IMAGE:Ml(null==e?void 0:e.extensions),VIDEO:Ml(null==t?void 0:t.extensions),AUDIO:Ml(null==r?void 0:r.extensions),DOCUMENT:Ml(null==n?void 0:n.extensions)}))),YC=Wl(q8,(e=>Object.keys(e).reduce(((t,r)=>[...t,...e[r]||[]]),[]))),JC=Wl(Wd,(e=>{var t;return null==(t=null==e?void 0:e[M8])?void 0:t.invites})),Ol=Ud({name:"platformSettings",initialState:MC,reducers:{setError:(e,t)=>{e.error=t.payload},setPending:(e,t)=>{e.isPending=t.payload}},extraReducers:e=>{e.addCase(jw,((e,{payload:t})=>{e.data={...e.data,...t}}))},selectors:{selectSettings:Wd,selectPostConfig:GC,selectDocPolicy:U8,selectImagePolicy:uk,selectVideoPolicy:O8,selectAudioPolicy:D8,selectInvitesEnabled:JC,selectImageExtensions:KC,selectSupportedExtensions:q8,selectFullExtensionsList:YC,selectRegistration:e=>{var t;return null==(t=e.data)?void 0:t[M8]},selectLanguageDetection:e=>{var t;return null==(t=e.data)?void 0:t[XC]},selectLanguageTranslation:e=>{var t;return null==(t=e.data)?void 0:t[BC]},selectOpenai:e=>{var t;return null==(t=e.data)?void 0:t[HC]},selectCaptcha:e=>{var t;return null==(t=e.data)?void 0:t[OC]},selectAdminCaptcha:e=>{var t;return null==(t=e.data)?void 0:t[VC]},selectPlatformTranslation:e=>{var t;return null==(t=e.data)?void 0:t[qC]},selectAccess:e=>{var t;return null==(t=e.data)?void 0:t[FC]},selectBranding:e=>{var t;return null==(t=e.data)?void 0:t[UC]},selectLinkService:e=>{var t;return null==(t=e.data)?void 0:t[ZC]},selectInstanceAdmin:e=>{var t;return null==(t=e.data)?void 0:t[DC]},selectLegal:e=>{var t;return null==(t=e.data)?void 0:t[Ow.legal]},selectDomainBlocks:e=>{var t;return null==(t=e.data)?void 0:t[WC]},selectContacts:e=>{var t;return null==(t=e.data)?void 0:t[Ow.contacts]}}}),QC=async({media:e,docPolicy:t,imgPolicy:r,videoPolicy:n,audioPolicy:a})=>{if(!r||!n)return"Media policy is not defined";const i={IMAGE:Ml(r.extensions),VIDEO:Ml(n.extensions),AUDIO:Ml(a.extensions),DOCUMENT:Ml(t.extensions)},o=I8(e.file.name)||"",s=Object.keys(i).find((e=>{var t;return null==(t=i[e])?void 0:t.includes(o)}));if(!s)return`Extension ${o} is not supported`;const c="VIDEO"===s;if("IMAGE"===s){const t=await LC(e.file),n=e.file.size>r.maxSize,a=t&&Math.max(t.width,t.height)>r.maxResolution,i=t&&t.width*t.height>r.maxMatrix;switch(!0){case n:return`Image is too big. Max size is ${Tb(r.maxSize)}`;case a:return`Image resolution is too high. Max resolution is ${r.maxResolution} pixels`;case i:return`The uploaded image exceeds the maximum size allowed. Please choose an image with smaller dimensions or reduce the resolution and try again. Max resolution is ${r.maxMatrix} pixels`}}if(c){const t=await EC({src:e.objectUrl}),r=t&&t.duration>n.maxDuration,a=t&&Math.max(t.width,t.height)>n.maxResolution,i=e.file.size>n.maxSize,o=t&&t.width*t.height>n.maxMatrix;switch(!0){case r:return`Video is too long. Max duration is ${n.maxDuration} seconds`;case i:return`Video is too big. Max size is ${Tb(n.maxSize)}`;case a:return`Video resolution is too high. Max resolution is ${n.maxResolution} pixels`;case o:return`The uploaded video exceeds the maximum size allowed. Please choose a video with smaller dimensions or reduce the resolution and try again. Max resolution is ${n.maxMatrix} pixels`}}},$C=()=>{const[e]=X5(),t=new AbortController,r=t.signal,n=ft(Ol.selectors.selectImagePolicy),a=ft(Ol.selectors.selectVideoPolicy),i=ft(Ol.selectors.selectDocPolicy),o=ft(Ol.selectors.selectAudioPolicy);return[async({media:t,tag:s,onError:c,onUpload:l,onProgress:u})=>{var d;const f=I8(t.file.name),p=await QC({imgPolicy:n,docPolicy:i,videoPolicy:a,audioPolicy:o,media:t});if(p)return Zt.error(p),void(null==c||c());try{const n=await e({createUpload:{extension:f,tags:[s],meta:{name:t.file.name}}});if("error"in n)throw new Error(n.error);const a=null==(d=n.data)?void 0:d.uri;return await new Promise(((e,n)=>{const i=new XMLHttpRequest;i.open("PUT",a),r&&r.addEventListener("abort",(()=>{try{i.abort()}catch(e){hs.warn("Cancel upload failed",e)}})),i.upload.onprogress=e=>{if(!e.lengthComputable)return;const t=Math.round(e.loaded/e.total*100);null==u||u(e.loaded,e.total,t)},i.onerror=()=>n(new Error("Upload failed")),i.onload=()=>{i.status>=200&&i.status<300?e():n(new Error(i.statusText))},i.send(t.file)})),null==l||l(),n.data.upload.uploadId}catch(e){null==c||c(e),Zt.error(`Could not upload file. ${String(e)}`)}},()=>t.abort("Upload canceled")]};var Yi=(e=>(e.header="header",e.avatar="avatar",e))(Yi||{});const Hg=({user:e,type:t})=>{var r,n,a,i;if(!e)return"";try{return("avatar"===t?null==(n=null==(r=e.avatar)?void 0:r.files[0])?void 0:n.uri:null==(i=null==(a=e.header)?void 0:a.files[0])?void 0:i.uri)||""}catch{return""}};var Pb,wg={exports:{}},eT=wg.exports;
42
+ */yt("remoteReady");const r9=yt("askLogin"),n9=yt("reselectUser");yt("requestLogout");const a9=yt("setConfirmLeavePage");yt("requestChangePath");const Vz=yt("wsSubscribe"),Xz=yt("wsUnSubscribe");yt("hostStoreConnect"),yt("remoteLogin"),yt("remoteLogout"),yt("wsOnMessage"),yt("setRouterPath"),yt("setDeviceType"),yt("setDeviceWidth");const Bz=yt("setUserError"),Hz=yt("setUserIsError"),Cw=yt("setUserPending"),Tw=yt("setUserSuccess"),Zz=yt("setUserData"),Gz=yt("updateAccountData"),s9=yt("updateUser");yt("addNotification"),yt("markNotification"),yt("setNotificationsError"),yt("setNotificationsList"),yt("setNotificationsPending"),yt("setNotificationsTotalCount"),yt("setNotificationsUnreadCount"),yt("acceptAllFollowRequests"),yt("resetNotificationsState"),yt("undoNotification"),yt("setInstanceInfo"),yt("setInstanceInfoPending"),yt("setInstanceInfoError");const jw=yt("setPlatformSettings"),Xy=yt("setProfileSettings");yt("setGroupData"),yt("setGroupLoading"),yt("requestLocalStorageGet"),yt("requestLocalStorageSet"),yt("requestLocalStorageRemove"),yt("requestLocalStorageClear"),yt("requestLocalStorageKeys"),yt("requestLocalStorageHas"),yt("sendLocalStorageResponse"),yt("sendLocalStorageChanged");const Ag="8.48.0",Dl=globalThis;function Qw(e,t,r){const n=Dl,a=n.__SENTRY__=n.__SENTRY__||{},i=a[Ag]=a[Ag]||{};return i[e]||(i[e]=t())}const Kz=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,i9="Sentry Logger ",db=["debug","info","warn","error","log","assert","trace"],pb={};function o9(e){if(!("console"in Dl))return e();const t=Dl.console,r={},n=Object.keys(pb);n.forEach((e=>{const n=pb[e];r[e]=t[e],t[e]=n}));try{return e()}finally{n.forEach((e=>{t[e]=r[e]}))}}function c9(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return Kz?db.forEach((r=>{t[r]=(...t)=>{e&&o9((()=>{Dl.console[r](`${i9}[${r}]:`,...t)}))}})):db.forEach((e=>{t[e]=()=>{}})),t}const By=Qw("logger",c9);function $w(){return ek(Dl),Dl}function ek(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||Ag,t[Ag]=t[Ag]||{}}const l9=Object.prototype.toString;function u9(e,t){return l9.call(e)===`[object ${t}]`}function f9(e){return u9(e,"Object")}function d9(e){return!(!e||!e.then||"function"!=typeof e.then)}function p9(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{Kz&&By.log(`Failed to add non-enumerable property "${t}" to object`,e)}}const Yz=1e3;function Jz(){return Date.now()/Yz}function h9(){const{performance:e}=Dl;if(!e||!e.now)return Jz;const t=Date.now()-e.now(),r=null==e.timeOrigin?t:e.timeOrigin;return()=>(r+e.now())/Yz}const g9=h9();function ah(){const e=Dl,t=e.crypto||e.msCrypto;let r=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(r=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(e=>(e^(15&r())>>e/4).toString(16)))}function y9(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||g9(),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:ah()),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 hb(){return ah()}function gb(){return ah().substring(16)}function Qz(e,t,r=2){if(!t||"object"!=typeof t||r<=0)return t;if(e&&t&&0===Object.keys(t).length)return e;const n={...e};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=Qz(n[e],t[e],r-1));return n}(()=>{const{performance:e}=Dl;if(!e||!e.now)return;const t=36e5,r=e.now(),n=Date.now(),a=e.timeOrigin?Math.abs(e.timeOrigin+r-n):t,i=a<t,o=e.timing&&e.timing.navigationStart,s="number"==typeof o?Math.abs(o+r-n):t;(i||s<t)&&(a<=s&&e.timeOrigin)})();const Pw="_sentrySpan";function yb(e,t){t?p9(e,Pw,t):delete e[Pw]}function mb(e){return e[Pw]}const m9=100;class tk{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:hb(),spanId:gb()}}clone(){const e=new tk;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,yb(e,mb(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&&y9(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,[r,n]=t instanceof Pg?[t.getScopeData(),t.getRequestSession()]:f9(t)?[e,e.requestSession]:[],{tags:a,extra:i,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u}=r||{};return this._tags={...this._tags,...a},this._extra={...this._extra,...i},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),n&&(this._requestSession=n),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,yb(this,void 0),this._attachments=[],this.setPropagationContext({traceId:hb()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const r="number"==typeof t?t:m9;if(r<=0)return this;const n={timestamp:Jz(),...e},a=this._breadcrumbs;return a.push(n),this._breadcrumbs=a.length>r?a.slice(-r):a,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:mb(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Qz(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext={spanId:gb(),...e},this}getPropagationContext(){return this._propagationContext}captureException(e,t){const r=t&&t.event_id?t.event_id:ah();if(!this._client)return By.warn("No client configured on scope - will not capture exception!"),r;const n=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:n,...t,event_id:r},this),r}captureMessage(e,t,r){const n=r&&r.event_id?r.event_id:ah();if(!this._client)return By.warn("No client configured on scope - will not capture message!"),n;const a=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:a,...r,event_id:n},this),n}captureEvent(e,t){const r=t&&t.event_id?t.event_id:ah();return this._client?(this._client.captureEvent(e,{...t,event_id:r},this),r):(By.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}const Pg=tk;function _9(){return Qw("defaultCurrentScope",(()=>new Pg))}function v9(){return Qw("defaultIsolationScope",(()=>new Pg))}class w9{constructor(e,t){let r,n;r=e||new Pg,n=t||new Pg,this._stack=[{scope:r}],this._isolationScope=n}withScope(e){const t=this._pushScope();let r;try{r=e(t)}catch(e){throw this._popScope(),e}return d9(r)?r.then((e=>(this._popScope(),e)),(e=>{throw this._popScope(),e})):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function ch(){const e=ek($w());return e.stack=e.stack||new w9(_9(),v9())}function k9(e){return ch().withScope(e)}function b9(e,t){const r=ch();return r.withScope((()=>(r.getStackTop().scope=e,t(e))))}function _b(e){return ch().withScope((()=>e(ch().getIsolationScope())))}function x9(){return{withIsolationScope:_b,withScope:k9,withSetScope:b9,withSetIsolationScope:(e,t)=>_b(t),getCurrentScope:()=>ch().getScope(),getIsolationScope:()=>ch().getIsolationScope()}}function $z(e){const t=ek(e);return t.acs?t.acs:x9()}function e8(){return $z($w()).getCurrentScope()}function A9(){return $z($w()).getIsolationScope()}function z9(e,t){return e8().captureException(e,void 0)}function S9(e,t){const r={captureContext:t};return e8().captureMessage(e,void 0,r)}function C9(e,t){A9().setExtra(e,t)}const T9=(...e)=>{let t="";for(const r of e){if(r instanceof Error){const e=r;return C9("exceptionMessage",t),void z9(e)}if("object"!=typeof r)t+=r;else try{t+=" "+JSON.stringify(r)}catch{t+=" "+r}}S9(t)},$g=()=>"object"!=typeof window,j9="wlsy",t8=()=>{try{return window.localStorage}catch(e){console.warn("Error getting window.localStorage storage",e)}},P9=()=>{const e=new Set,t=t8();if(!t)return[];for(let r=0;r<(null==t?void 0:t.length);r+=1){const n=null==t?void 0:t.key(r);"string"==typeof n&&e.add(n)}return Array.from(e)},r8=e=>{const t=`${j9}${e?`:${e}`:""}`,r=e=>`${t}:${e}`,n=()=>P9().filter((e=>e.startsWith(`${t}:`))),a=e=>e.slice(t.length+1),i=t8(),o=e=>{try{return null==i?void 0:i.getItem(r(e))}catch{return null}},s=(e,t)=>{try{null==i||i.setItem(r(e),String(t))}catch{return}};return{getItem:o,setItem:s,removeItem:e=>{try{null==i||i.removeItem(r(e))}catch{return}},clear:()=>{try{n().forEach((e=>null==i?void 0:i.removeItem(e)))}catch{return}},keys:()=>n().map(a),has:e=>null!==o(e),getJSON:e=>{const t=o(e);if(null==t)return null;try{return JSON.parse(t)}catch{return null}},setJSON:(e,t)=>{try{s(e,JSON.stringify(t))}catch{return}}}},vb=["debug","info","warn","error"],R9=(e,t)=>{const r=vb.indexOf(e);return vb.indexOf(t)>=r},Dy=(e,t,r,...n)=>{R9(t,e)&&console.log(`[${e}] ${r}`,...n)},E9=()=>r8().getItem("logger_lvl"),L9=(e=($g()?"info":E9()||"warn"))=>{let t=e;return{debug:(e,...r)=>Dy("debug",t,e,...r),info:(e,...r)=>Dy("info",t,e,...r),warn:(e,...r)=>Dy("warn",t,e,...r),error:(e,...r)=>(T9(e,...r),Dy("error",t,e,...r)),setLevel:e=>{t=e},getLevel:()=>t}},hs=L9(),N9=e=>{try{const{type:t,payload:r}=e,n={type:t};return void 0!==r&&(n.payload=JSON.parse(JSON.stringify(r))),n}catch(t){return hs.warn(`Could not serialize action type: ${e.type}`,t),{type:e.type,payload:`[Non-serializable payload for action: ${e.type}]`}}};zz("requestMicroFrontendFetch"),zz("sendMicroFrontendFetchResponse");const I9={data:null,isPending:!1,isSuccess:!1},ha=Ud({name:"userNoHTML",initialState:I9,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}}),n8="getApiV1UsersRelationships",M9=jc.memoize(((e,t)=>qs.util.selectCachedArgsForQuery(e,n8).find((e=>e.targets.includes(t))))),Nl=({state:e,userId:t,dispatch:r,relationsProps:n})=>{const a=M9(e,t);return a?r(qs.util.updateQueryData(n8,a,(e=>{e[t]={...e[t],...n}}))):null};var wb=function(e,t,r){if(e&&"reportValidity"in e){var n=zw(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},a8=function(e,t){var r=function(r){var n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?wb(n.ref,r,e):n.refs&&n.refs.forEach((function(t){return wb(t,r,e)}))};for(var n in t.fields)r(n)},O9=function(e,t){t.shouldUseNativeValidation&&a8(e,t);var r={};for(var n in e){var a=zw(t.fields,n),i=Object.assign(e[n]||{},{ref:a&&a.ref});if(D9(t.names||Object.keys(e),n)){var o=Object.assign({},zw(r,n));o1(o,"root",i),o1(r,n,o)}else o1(r,n,i)}return r},D9=function(e,t){return e.some((function(e){return e.startsWith(t+".")}))},U9=function(e,t){for(var r={};e.length;){var n=e[0],a=n.code,i=n.message,o=n.path.join(".");if(!r[o])if("unionErrors"in n){var s=n.unionErrors[0].errors[0];r[o]={message:s.message,type:s.code}}else r[o]={message:i,type:a};if("unionErrors"in n&&n.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var c=r[o].types,l=c&&c[n.code];r[o]=r7(o,t,r,a,l?[].concat(l,n.message):n.message)}e.shift()}return r},Rw=function(e,t,r){return void 0===r&&(r={}),function(n,a,i){try{return Promise.resolve(function(a,o){try{var s=Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](n,t)).then((function(e){return i.shouldUseNativeValidation&&a8({},i),{errors:{},values:r.raw?n:e}}))}catch(e){return o(e)}return s&&s.then?s.then(void 0,o):s}(0,(function(e){if(null!=e.errors)return{values:{},errors:O9(U9(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};throw e})))}catch(e){return Promise.reject(e)}}};const rk=({schema:e,defaultValues:t,mode:r="onChange",reValidateMode:n="onChange",showRequiredErrors:a=!0})=>Sz({mode:r,reValidateMode:n,resolver:a?Rw(e):async(t,r,n)=>{const a=await Rw(e)(t,r,n);if(!a.errors||0===Object.keys(a.errors).length)return a;const i={};return Object.keys(a.errors).forEach((e=>{const r=a.errors[e],n=t[e],o="password"===e,s=null==n||""===n,c="invalid_type"===(null==r?void 0:r.type)||"too_small"===(null==r?void 0:r.type)||o&&"custom"===(null==r?void 0:r.type);s&&c||(i[e]=r)})),{values:a.values,errors:i}},defaultValues:t});var Ft,Ew;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of r)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Ft||(Ft={})),(Ew||(Ew={})).mergeShapes=(e,t)=>({...e,...t});const Ve=Ft.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gf=e=>{switch(typeof e){case"undefined":return Ve.undefined;case"string":return Ve.string;case"number":return isNaN(e)?Ve.nan:Ve.number;case"boolean":return Ve.boolean;case"function":return Ve.function;case"bigint":return Ve.bigint;case"symbol":return Ve.symbol;case"object":return Array.isArray(e)?Ve.array:null===e?Ve.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Ve.promise:typeof Map<"u"&&e instanceof Map?Ve.map:typeof Set<"u"&&e instanceof Set?Ve.set:typeof Date<"u"&&e instanceof Date?Ve.date:Ve.object;default:return Ve.unknown}},Te=Ft.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"]),q9=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class gi extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(n);else if("invalid_return_type"===a.code)n(a.returnTypeError);else if("invalid_arguments"===a.code)n(a.argumentsError);else if(0===a.path.length)r._errors.push(t(a));else{let e=r,n=0;for(;n<a.path.length;){const r=a.path[n];n===a.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(a))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof gi))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ft.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}gi.create=e=>new gi(e);const lh=(e,t)=>{let r;switch(e.code){case Te.invalid_type:r=e.received===Ve.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Te.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Ft.jsonStringifyReplacer)}`;break;case Te.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ft.joinValues(e.keys,", ")}`;break;case Te.invalid_union:r="Invalid input";break;case Te.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ft.joinValues(e.options)}`;break;case Te.invalid_enum_value:r=`Invalid enum value. Expected ${Ft.joinValues(e.options)}, received '${e.received}'`;break;case Te.invalid_arguments:r="Invalid function arguments";break;case Te.invalid_return_type:r="Invalid function return type";break;case Te.invalid_date:r="Invalid date";break;case Te.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Ft.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Te.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Te.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Te.custom:r="Invalid input";break;case Te.invalid_intersection_types:r="Intersection results could not be merged";break;case Te.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Te.not_finite:r="Number must be finite";break;default:r=t.defaultError,Ft.assertNever(e)}return{message:r}};let s8=lh;function W9(e){s8=e}function Yy(){return s8}const Jy=e=>{const{data:t,path:r,errorMaps:n,issueData:a}=e,i=[...r,...a.path||[]],o={...a,path:i};if(void 0!==a.message)return{...a,path:i,message:a.message};let s="";const c=n.filter((e=>!!e)).slice().reverse();for(const e of c)s=e(o,{data:t,defaultError:s}).message;return{...a,path:i,message:s}},F9=[];function De(e,t){const r=Yy(),n=Jy({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===lh?void 0:lh].filter((e=>!!e))});e.common.issues.push(n)}class Qa{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return ht;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return Qa.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:a}=n;if("aborted"===t.status||"aborted"===a.status)return ht;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"!==t.value&&(typeof a.value<"u"||n.alwaysSet)&&(r[t.value]=a.value)}return{status:e.value,value:r}}}const ht=Object.freeze({status:"aborted"}),rh=e=>({status:"dirty",value:e}),gs=e=>({status:"valid",value:e}),Lw=e=>"aborted"===e.status,Nw=e=>"dirty"===e.status,Rg=e=>"valid"===e.status,Eg=e=>typeof Promise<"u"&&e instanceof Promise;function Qy(e,t,r,n){if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function i8(e,t,r,n,a){if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var et,_g,vg;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(et||(et={}));class Rc{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}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 kb=(e,t)=>{if(Rg(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 gi(e.common.issues);return this._error=t,this._error}}};function xt(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:a}:{errorMap:(t,a)=>{var i,o;const{message:s}=e;return"invalid_enum_value"===t.code?{message:s??a.defaultError}:typeof a.data>"u"?{message:null!==(i=s??n)&&void 0!==i?i:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(o=s??r)&&void 0!==o?o:a.defaultError}},description:a}}class At{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 gf(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:gf(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Qa,ctx:{common:e.parent.common,data:e.data,parsedType:gf(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Eg(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gf(e)},a=this._parseSync({data:e,path:n.path,parent:n});return kb(n,a)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:gf(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(Eg(n)?n:Promise.resolve(n));return kb(r,a)}refine(e,t){const r=e=>"string"==typeof t||typeof t>"u"?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const a=e(t),i=()=>n.addIssue({code:Te.custom,...r(t)});return typeof Promise<"u"&&a instanceof Promise?a.then((e=>!!e||(i(),!1))):!!a||(i(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new Mo({schema:this,typeName:ut.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Pc.create(this,this._def)}nullable(){return wf.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Io.create(this,this._def)}promise(){return fh.create(this,this._def)}or(e){return Mg.create([this,e],this._def)}and(e){return Og.create(this,e,this._def)}transform(e){return new Mo({...xt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Fg({...xt(this._def),innerType:this,defaultValue:t,typeName:ut.ZodDefault})}brand(){return new nk({typeName:ut.ZodBranded,type:this,...xt(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Vg({...xt(this._def),innerType:this,catchValue:t,typeName:ut.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ey.create(this,e)}readonly(){return Xg.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const V9=/^c[^\s-]{8,}$/i,X9=/^[0-9a-z]+$/,B9=/^[0-9A-HJKMNP-TV-Z]{26}$/,H9=/^[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,Z9=/^[a-z0-9_-]{21}$/i,G9=/^[-+]?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)?)??$/,K9=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Y9="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let y1;const J9=/^(?:(?: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])$/,Q9=/^(([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})))$/,$9=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,o8="((\\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])))",eS=new RegExp(`^${o8}$`);function c8(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 tS(e){return new RegExp(`^${c8(e)}$`)}function l8(e){let t=`${o8}T${c8(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function rS(e,t){return!(("v4"!==t&&t||!J9.test(e))&&("v6"!==t&&t||!Q9.test(e)))}class No extends At{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ve.string){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.string,received:t.parsedType}),ht}const t=new Qa;let r;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const a=e.data.length>n.value,i=e.data.length<n.value;(a||i)&&(r=this._getOrReturnCtx(e,r),a?De(r,{code:Te.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&De(r,{code:Te.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)K9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"email",code:Te.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)y1||(y1=new RegExp(Y9,"u")),y1.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"emoji",code:Te.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)H9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"uuid",code:Te.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)Z9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"nanoid",code:Te.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)V9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"cuid",code:Te.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)X9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"cuid2",code:Te.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)B9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"ulid",code:Te.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),De(r,{validation:"url",code:Te.invalid_string,message:n.message}),t.dirty()}else"regex"===n.kind?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"regex",code:Te.invalid_string,message:n.message}),t.dirty())):"trim"===n.kind?e.data=e.data.trim():"includes"===n.kind?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):"toLowerCase"===n.kind?e.data=e.data.toLowerCase():"toUpperCase"===n.kind?e.data=e.data.toUpperCase():"startsWith"===n.kind?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):"endsWith"===n.kind?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):"datetime"===n.kind?l8(n).test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:"datetime",message:n.message}),t.dirty()):"date"===n.kind?eS.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:"date",message:n.message}),t.dirty()):"time"===n.kind?tS(n).test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{code:Te.invalid_string,validation:"time",message:n.message}),t.dirty()):"duration"===n.kind?G9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"duration",code:Te.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?rS(e.data,n.version)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"ip",code:Te.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?$9.test(e.data)||(r=this._getOrReturnCtx(e,r),De(r,{validation:"base64",code:Te.invalid_string,message:n.message}),t.dirty()):Ft.assertNever(n);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:Te.invalid_string,...et.errToObj(r)})}_addCheck(e){return new No({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...et.errToObj(e)})}url(e){return this._addCheck({kind:"url",...et.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...et.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...et.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...et.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...et.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...et.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...et.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...et.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...et.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(null==e?void 0:e.precision)>"u"?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...et.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,...et.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...et.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...et.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...et.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...et.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...et.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...et.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...et.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...et.errToObj(t)})}nonempty(e){return this.min(1,et.errToObj(e))}trim(){return new No({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new No({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new No({...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 nS(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}No.create=e=>{var t;return new No({checks:[],typeName:ut.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...xt(e)})};class mf extends At{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)!==Ve.number){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.number,received:t.parsedType}),ht}let t;const r=new Qa;for(const n of this._def.checks)"int"===n.kind?Ft.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),De(t,{code:Te.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):"multipleOf"===n.kind?0!==nS(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),De(t,{code:Te.not_finite,message:n.message}),r.dirty()):Ft.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,et.toString(t))}gt(e,t){return this.setLimit("min",e,!1,et.toString(t))}lte(e,t){return this.setLimit("max",e,!0,et.toString(t))}lt(e,t){return this.setLimit("max",e,!1,et.toString(t))}setLimit(e,t,r,n){return new mf({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:et.toString(n)}]})}_addCheck(e){return new mf({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:et.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:et.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:et.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:et.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:et.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:et.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:et.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:et.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:et.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&&Ft.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}mf.create=e=>new mf({checks:[],typeName:ut.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...xt(e)});class _f extends At{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)!==Ve.bigint){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.bigint,received:t.parsedType}),ht}let t;const r=new Qa;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),De(t,{code:Te.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):Ft.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,et.toString(t))}gt(e,t){return this.setLimit("min",e,!1,et.toString(t))}lte(e,t){return this.setLimit("max",e,!0,et.toString(t))}lt(e,t){return this.setLimit("max",e,!1,et.toString(t))}setLimit(e,t,r,n){return new _f({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:et.toString(n)}]})}_addCheck(e){return new _f({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:et.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:et.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:et.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:et.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:et.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}}_f.create=e=>{var t;return new _f({checks:[],typeName:ut.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...xt(e)})};class Lg extends At{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ve.boolean){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.boolean,received:t.parsedType}),ht}return gs(e.data)}}Lg.create=e=>new Lg({typeName:ut.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...xt(e)});class Md extends At{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ve.date){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.date,received:t.parsedType}),ht}if(isNaN(e.data.getTime())){return De(this._getOrReturnCtx(e),{code:Te.invalid_date}),ht}const t=new Qa;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),De(r,{code:Te.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):Ft.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Md({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:et.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:et.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}}Md.create=e=>new Md({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ut.ZodDate,...xt(e)});class $y extends At{_parse(e){if(this._getType(e)!==Ve.symbol){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.symbol,received:t.parsedType}),ht}return gs(e.data)}}$y.create=e=>new $y({typeName:ut.ZodSymbol,...xt(e)});class Ng extends At{_parse(e){if(this._getType(e)!==Ve.undefined){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.undefined,received:t.parsedType}),ht}return gs(e.data)}}Ng.create=e=>new Ng({typeName:ut.ZodUndefined,...xt(e)});class Ig extends At{_parse(e){if(this._getType(e)!==Ve.null){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.null,received:t.parsedType}),ht}return gs(e.data)}}Ig.create=e=>new Ig({typeName:ut.ZodNull,...xt(e)});class uh extends At{constructor(){super(...arguments),this._any=!0}_parse(e){return gs(e.data)}}uh.create=e=>new uh({typeName:ut.ZodAny,...xt(e)});class Ld extends At{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gs(e.data)}}Ld.create=e=>new Ld({typeName:ut.ZodUnknown,...xt(e)});class Ul extends At{_parse(e){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.never,received:t.parsedType}),ht}}Ul.create=e=>new Ul({typeName:ut.ZodNever,...xt(e)});class em extends At{_parse(e){if(this._getType(e)!==Ve.undefined){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.void,received:t.parsedType}),ht}return gs(e.data)}}em.create=e=>new em({typeName:ut.ZodVoid,...xt(e)});class Io extends At{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==Ve.array)return De(t,{code:Te.invalid_type,expected:Ve.array,received:t.parsedType}),ht;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,a=t.data.length<n.exactLength.value;(e||a)&&(De(t,{code:e?Te.too_big:Te.too_small,minimum:a?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(De(t,{code:Te.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(De(t,{code:Te.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new Rc(t,e,t.path,r))))).then((e=>Qa.mergeArray(r,e)));const a=[...t.data].map(((e,r)=>n.type._parseSync(new Rc(t,e,t.path,r))));return Qa.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new Io({...this._def,minLength:{value:e,message:et.toString(t)}})}max(e,t){return new Io({...this._def,maxLength:{value:e,message:et.toString(t)}})}length(e,t){return new Io({...this._def,exactLength:{value:e,message:et.toString(t)}})}nonempty(e){return this.min(1,e)}}function th(e){if(e instanceof Br){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Pc.create(th(n))}return new Br({...e._def,shape:()=>t})}return e instanceof Io?new Io({...e._def,type:th(e.element)}):e instanceof Pc?Pc.create(th(e.unwrap())):e instanceof wf?wf.create(th(e.unwrap())):e instanceof Ec?Ec.create(e.items.map((e=>th(e)))):e}Io.create=(e,t)=>new Io({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...xt(t)});class Br extends At{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=Ft.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Ve.object){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.object,received:t.parsedType}),ht}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof Ul&&"strip"===this._def.unknownKeys))for(const e in r.data)a.includes(e)||i.push(e);const o=[];for(const e of a){const t=n[e],a=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new Rc(r,a,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Ul){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(De(r,{code:Te.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const n=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new Rc(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>Qa.mergeObjectSync(t,e))):Qa.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return et.errToObj,new Br({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,a,i,o;const s=null!==(i=null===(a=(n=this._def).errorMap)||void 0===a?void 0:a.call(n,t,r).message)&&void 0!==i?i:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=et.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new Br({...this._def,unknownKeys:"strip"})}passthrough(){return new Br({...this._def,unknownKeys:"passthrough"})}extend(e){return new Br({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Br({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ut.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Br({...this._def,catchall:e})}pick(e){const t={};return Ft.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new Br({...this._def,shape:()=>t})}omit(e){const t={};return Ft.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new Br({...this._def,shape:()=>t})}deepPartial(){return th(this)}partial(e){const t={};return Ft.objectKeys(this.shape).forEach((r=>{const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()})),new Br({...this._def,shape:()=>t})}required(e){const t={};return Ft.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof Pc;)e=e._def.innerType;t[r]=e}})),new Br({...this._def,shape:()=>t})}keyof(){return u8(Ft.objectKeys(this.shape))}}Br.create=(e,t)=>new Br({shape:()=>e,unknownKeys:"strip",catchall:Ul.create(),typeName:ut.ZodObject,...xt(t)}),Br.strictCreate=(e,t)=>new Br({shape:()=>e,unknownKeys:"strict",catchall:Ul.create(),typeName:ut.ZodObject,...xt(t)}),Br.lazycreate=(e,t)=>new Br({shape:e,unknownKeys:"strip",catchall:Ul.create(),typeName:ut.ZodObject,...xt(t)});class Mg extends At{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new gi(e.ctx.common.issues)));return De(t,{code:Te.invalid_union,unionErrors:r}),ht}));{let e;const n=[];for(const a of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=a._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"===i.status&&!e&&(e={result:i,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=n.map((e=>new gi(e)));return De(t,{code:Te.invalid_union,unionErrors:a}),ht}}get options(){return this._def.options}}Mg.create=(e,t)=>new Mg({options:e,typeName:ut.ZodUnion,...xt(t)});const Il=e=>e instanceof Ug?Il(e.schema):e instanceof Mo?Il(e.innerType()):e instanceof qg?[e.value]:e instanceof vf?e.options:e instanceof Wg?Ft.objectValues(e.enum):e instanceof Fg?Il(e._def.innerType):e instanceof Ng?[void 0]:e instanceof Ig?[null]:e instanceof Pc?[void 0,...Il(e.unwrap())]:e instanceof wf?[null,...Il(e.unwrap())]:e instanceof nk||e instanceof Xg?Il(e.unwrap()):e instanceof Vg?Il(e._def.innerType):[];class ym extends At{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ve.object)return De(t,{code:Te.invalid_type,expected:Ve.object,received:t.parsedType}),ht;const r=this.discriminator,n=t.data[r],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(De(t,{code:Te.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const r of t){const t=Il(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of t){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,r)}}return new ym({typeName:ut.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...xt(r)})}}function Iw(e,t){const r=gf(e),n=gf(t);if(e===t)return{valid:!0,data:e};if(r===Ve.object&&n===Ve.object){const r=Ft.objectKeys(t),n=Ft.objectKeys(e).filter((e=>-1!==r.indexOf(e))),a={...e,...t};for(const r of n){const n=Iw(e[r],t[r]);if(!n.valid)return{valid:!1};a[r]=n.data}return{valid:!0,data:a}}if(r===Ve.array&&n===Ve.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const a=Iw(e[n],t[n]);if(!a.valid)return{valid:!1};r.push(a.data)}return{valid:!0,data:r}}return r===Ve.date&&n===Ve.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Og extends At{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(Lw(e)||Lw(n))return ht;const a=Iw(e.value,n.value);return a.valid?((Nw(e)||Nw(n))&&t.dirty(),{status:t.value,value:a.data}):(De(r,{code:Te.invalid_intersection_types}),ht)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Og.create=(e,t,r)=>new Og({left:e,right:t,typeName:ut.ZodIntersection,...xt(r)});class Ec extends At{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ve.array)return De(r,{code:Te.invalid_type,expected:Ve.array,received:r.parsedType}),ht;if(r.data.length<this._def.items.length)return De(r,{code:Te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ht;!this._def.rest&&r.data.length>this._def.items.length&&(De(r,{code:Te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new Rc(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>Qa.mergeArray(t,e))):Qa.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Ec({...this._def,rest:e})}}Ec.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ec({items:e,typeName:ut.ZodTuple,rest:null,...xt(t)})};class Dg extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ve.object)return De(r,{code:Te.invalid_type,expected:Ve.object,received:r.parsedType}),ht;const n=[],a=this._def.keyType,i=this._def.valueType;for(const e in r.data)n.push({key:a._parse(new Rc(r,e,r.path,e)),value:i._parse(new Rc(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?Qa.mergeObjectAsync(t,n):Qa.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new Dg(t instanceof At?{keyType:e,valueType:t,typeName:ut.ZodRecord,...xt(r)}:{keyType:No.create(),valueType:e,typeName:ut.ZodRecord,...xt(t)})}}class tm extends At{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ve.map)return De(r,{code:Te.invalid_type,expected:Ve.map,received:r.parsedType}),ht;const n=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map((([e,t],i)=>({key:n._parse(new Rc(r,e,r.path,[i,"key"])),value:a._parse(new Rc(r,t,r.path,[i,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of i){const n=await r.key,a=await r.value;if("aborted"===n.status||"aborted"===a.status)return ht;("dirty"===n.status||"dirty"===a.status)&&t.dirty(),e.set(n.value,a.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of i){const n=r.key,a=r.value;if("aborted"===n.status||"aborted"===a.status)return ht;("dirty"===n.status||"dirty"===a.status)&&t.dirty(),e.set(n.value,a.value)}return{status:t.value,value:e}}}}tm.create=(e,t,r)=>new tm({valueType:t,keyType:e,typeName:ut.ZodMap,...xt(r)});class Od extends At{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ve.set)return De(r,{code:Te.invalid_type,expected:Ve.set,received:r.parsedType}),ht;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(De(r,{code:Te.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(De(r,{code:Te.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(e){const r=new Set;for(const n of e){if("aborted"===n.status)return ht;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const o=[...r.data.values()].map(((e,t)=>a._parse(new Rc(r,e,r.path,t))));return r.common.async?Promise.all(o).then((e=>i(e))):i(o)}min(e,t){return new Od({...this._def,minSize:{value:e,message:et.toString(t)}})}max(e,t){return new Od({...this._def,maxSize:{value:e,message:et.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Od.create=(e,t)=>new Od({valueType:e,minSize:null,maxSize:null,typeName:ut.ZodSet,...xt(t)});class sh extends At{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ve.function)return De(t,{code:Te.invalid_type,expected:Ve.function,received:t.parsedType}),ht;function r(e,r){return Jy({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Yy(),lh].filter((e=>!!e)),issueData:{code:Te.invalid_arguments,argumentsError:r}})}function n(e,r){return Jy({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Yy(),lh].filter((e=>!!e)),issueData:{code:Te.invalid_return_type,returnTypeError:r}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof fh){const e=this;return gs((async function(...t){const o=new gi([]),s=await e._def.args.parseAsync(t,a).catch((e=>{throw o.addIssue(r(t,e)),o})),c=await Reflect.apply(i,this,s);return await e._def.returns._def.type.parseAsync(c,a).catch((e=>{throw o.addIssue(n(c,e)),o}))}))}{const e=this;return gs((function(...t){const o=e._def.args.safeParse(t,a);if(!o.success)throw new gi([r(t,o.error)]);const s=Reflect.apply(i,this,o.data),c=e._def.returns.safeParse(s,a);if(!c.success)throw new gi([n(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new sh({...this._def,args:Ec.create(e).rest(Ld.create())})}returns(e){return new sh({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new sh({args:e||Ec.create([]).rest(Ld.create()),returns:t||Ld.create(),typeName:ut.ZodFunction,...xt(r)})}}class Ug extends At{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})}}Ug.create=(e,t)=>new Ug({getter:e,typeName:ut.ZodLazy,...xt(t)});class qg extends At{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return De(t,{received:t.data,code:Te.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:e.data}}get value(){return this._def.value}}function u8(e,t){return new vf({values:e,typeName:ut.ZodEnum,...xt(t)})}qg.create=(e,t)=>new qg({value:e,typeName:ut.ZodLiteral,...xt(t)});class vf extends At{constructor(){super(...arguments),_g.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return De(t,{expected:Ft.joinValues(r),received:t.parsedType,code:Te.invalid_type}),ht}if(Qy(this,_g)||i8(this,_g,new Set(this._def.values)),!Qy(this,_g).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return De(t,{received:t.data,code:Te.invalid_enum_value,options:r}),ht}return gs(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 vf.create(e,{...this._def,...t})}exclude(e,t=this._def){return vf.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}_g=new WeakMap,vf.create=u8;class Wg extends At{constructor(){super(...arguments),vg.set(this,void 0)}_parse(e){const t=Ft.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ve.string&&r.parsedType!==Ve.number){const e=Ft.objectValues(t);return De(r,{expected:Ft.joinValues(e),received:r.parsedType,code:Te.invalid_type}),ht}if(Qy(this,vg)||i8(this,vg,new Set(Ft.getValidEnumValues(this._def.values))),!Qy(this,vg).has(e.data)){const e=Ft.objectValues(t);return De(r,{received:r.data,code:Te.invalid_enum_value,options:e}),ht}return gs(e.data)}get enum(){return this._def.values}}vg=new WeakMap,Wg.create=(e,t)=>new Wg({values:e,typeName:ut.ZodNativeEnum,...xt(t)});class fh extends At{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ve.promise&&!1===t.common.async)return De(t,{code:Te.invalid_type,expected:Ve.promise,received:t.parsedType}),ht;const r=t.parsedType===Ve.promise?t.data:Promise.resolve(t.data);return gs(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}fh.create=(e,t)=>new fh({type:e,typeName:ut.ZodPromise,...xt(t)});class Mo extends At{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:e=>{De(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===n.type){const e=n.transform(r.data,a);if(r.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return ht;const n=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===n.status?ht:"dirty"===n.status||"dirty"===t.value?rh(n.value):n}));{if("aborted"===t.value)return ht;const n=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===n.status?ht:"dirty"===n.status||"dirty"===t.value?rh(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,a);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const n=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===n.status?ht:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((r=>"aborted"===r.status?ht:("dirty"===r.status&&t.dirty(),e(r.value).then((()=>({status:t.value,value:r.value}))))))}if("transform"===n.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Rg(e))return e;const i=n.transform(e.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>Rg(e)?Promise.resolve(n.transform(e.value,a)).then((e=>({status:t.value,value:e}))):e))}Ft.assertNever(n)}}Mo.create=(e,t,r)=>new Mo({schema:e,typeName:ut.ZodEffects,effect:t,...xt(r)}),Mo.createWithPreprocess=(e,t,r)=>new Mo({schema:t,effect:{type:"preprocess",transform:e},typeName:ut.ZodEffects,...xt(r)});class Pc extends At{_parse(e){return this._getType(e)===Ve.undefined?gs(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pc.create=(e,t)=>new Pc({innerType:e,typeName:ut.ZodOptional,...xt(t)});class wf extends At{_parse(e){return this._getType(e)===Ve.null?gs(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}wf.create=(e,t)=>new wf({innerType:e,typeName:ut.ZodNullable,...xt(t)});class Fg extends At{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===Ve.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Fg.create=(e,t)=>new Fg({innerType:e,typeName:ut.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...xt(t)});class Vg extends At{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Eg(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new gi(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new gi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Vg.create=(e,t)=>new Vg({innerType:e,typeName:ut.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...xt(t)});class rm extends At{_parse(e){if(this._getType(e)!==Ve.nan){const t=this._getOrReturnCtx(e);return De(t,{code:Te.invalid_type,expected:Ve.nan,received:t.parsedType}),ht}return{status:"valid",value:e.data}}}rm.create=e=>new rm({typeName:ut.ZodNaN,...xt(e)});const aS=Symbol("zod_brand");class nk extends At{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ey extends At{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?ht:"dirty"===e.status?(t.dirty(),rh(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?ht:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ey({in:e,out:t,typeName:ut.ZodPipeline})}}class Xg extends At{_parse(e){const t=this._def.innerType._parse(e),r=e=>(Rg(e)&&(e.value=Object.freeze(e.value)),e);return Eg(t)?t.then((e=>r(e))):r(t)}unwrap(){return this._def.innerType}}function f8(e,t={},r){return e?uh.create().superRefine(((n,a)=>{var i,o;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,s=null===(o=null!==(i=e.fatal)&&void 0!==i?i:r)||void 0===o||o,c="string"==typeof e?{message:e}:e;a.addIssue({code:"custom",...c,fatal:s})}})):uh.create()}Xg.create=(e,t)=>new Xg({innerType:e,typeName:ut.ZodReadonly,...xt(t)});const sS={object:Br.lazycreate};var ut;!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"}(ut||(ut={}));const iS=(e,t={message:`Input not instance of ${e.name}`})=>f8((t=>t instanceof e),t),d8=No.create,p8=mf.create,oS=rm.create,cS=_f.create,h8=Lg.create,lS=Md.create,uS=$y.create,fS=Ng.create,dS=Ig.create,pS=uh.create,hS=Ld.create,gS=Ul.create,yS=em.create,mS=Io.create,_S=Br.create,vS=Br.strictCreate,wS=Mg.create,kS=ym.create,bS=Og.create,xS=Ec.create,AS=Dg.create,zS=tm.create,SS=Od.create,CS=sh.create,TS=Ug.create,jS=qg.create,PS=vf.create,RS=Wg.create,ES=fh.create,bb=Mo.create,LS=Pc.create,NS=wf.create,IS=Mo.createWithPreprocess,MS=ey.create,OS=()=>d8().optional(),DS=()=>p8().optional(),US=()=>h8().optional(),qS={string:e=>No.create({...e,coerce:!0}),number:e=>mf.create({...e,coerce:!0}),boolean:e=>Lg.create({...e,coerce:!0}),bigint:e=>_f.create({...e,coerce:!0}),date:e=>Md.create({...e,coerce:!0})},WS=ht;var Oe=Object.freeze({__proto__:null,defaultErrorMap:lh,setErrorMap:W9,getErrorMap:Yy,makeIssue:Jy,EMPTY_PATH:F9,addIssueToContext:De,ParseStatus:Qa,INVALID:ht,DIRTY:rh,OK:gs,isAborted:Lw,isDirty:Nw,isValid:Rg,isAsync:Eg,get util(){return Ft},get objectUtil(){return Ew},ZodParsedType:Ve,getParsedType:gf,ZodType:At,datetimeRegex:l8,ZodString:No,ZodNumber:mf,ZodBigInt:_f,ZodBoolean:Lg,ZodDate:Md,ZodSymbol:$y,ZodUndefined:Ng,ZodNull:Ig,ZodAny:uh,ZodUnknown:Ld,ZodNever:Ul,ZodVoid:em,ZodArray:Io,ZodObject:Br,ZodUnion:Mg,ZodDiscriminatedUnion:ym,ZodIntersection:Og,ZodTuple:Ec,ZodRecord:Dg,ZodMap:tm,ZodSet:Od,ZodFunction:sh,ZodLazy:Ug,ZodLiteral:qg,ZodEnum:vf,ZodNativeEnum:Wg,ZodPromise:fh,ZodEffects:Mo,ZodTransformer:Mo,ZodOptional:Pc,ZodNullable:wf,ZodDefault:Fg,ZodCatch:Vg,ZodNaN:rm,BRAND:aS,ZodBranded:nk,ZodPipeline:ey,ZodReadonly:Xg,custom:f8,Schema:At,ZodSchema:At,late:sS,get ZodFirstPartyTypeKind(){return ut},coerce:qS,any:pS,array:mS,bigint:cS,boolean:h8,date:lS,discriminatedUnion:kS,effect:bb,enum:PS,function:CS,instanceof:iS,intersection:bS,lazy:TS,literal:jS,map:zS,nan:oS,nativeEnum:RS,never:gS,null:dS,nullable:NS,number:p8,object:_S,oboolean:US,onumber:DS,optional:LS,ostring:OS,pipeline:MS,preprocess:IS,promise:ES,record:AS,set:SS,strictObject:vS,string:d8,symbol:uS,transformer:bb,tuple:xS,undefined:fS,union:wS,unknown:hS,void:yS,NEVER:WS,ZodIssueCode:Te,quotelessJson:q9,ZodError:gi}),FS={USER:"teamcity",npm_config_user_agent:"npm/10.9.3 node/v22.18.0 linux x64 workspaces/true",SENTRY_AUTH_TOKEN:"1d93ff28a44e4c3aaaaff854277cd8583c1de670bd8744bc895670dfd9300840",npm_node_execpath:"/home/teamcity/.nvm/versions/node/v22.18.0/bin/node",npm_config_noproxy:"",HOME:"/home/teamcity",npm_package_json:"/mnt/agent/work/70fcd8585843667f/packages/user/package.json",npm_config_userconfig:"/home/teamcity/.npmrc",npm_config_local_prefix:"/mnt/agent/work/70fcd8585843667f",COLOR:"1",npm_config_progress:"",TEMP:"/mnt/agent/temp/buildTmp",npm_config_prefix:"/home/teamcity/.nvm/versions/node/v22.18.0",npm_config_npm_version:"10.9.3",npm_config_cache:"/home/teamcity/.npm",npm_config_ignore_scripts:"true",npm_config_node_gyp:"/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",PATH:"/mnt/agent/work/70fcd8585843667f/packages/user/node_modules/.bin:/mnt/agent/work/70fcd8585843667f/packages/node_modules/.bin:/mnt/agent/work/70fcd8585843667f/node_modules/.bin:/mnt/agent/work/node_modules/.bin:/mnt/agent/node_modules/.bin:/mnt/node_modules/.bin:/node_modules/.bin:/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/mnt/agent/work/70fcd8585843667f/node_modules/.bin:/mnt/agent/work/node_modules/.bin:/mnt/agent/node_modules/.bin:/mnt/node_modules/.bin:/node_modules/.bin:/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/teamcity/.cargo/bin:/home/teamcity/.rvm/gems/ruby-3.3.9/bin:/home/teamcity/.rvm/gems/ruby-3.3.9@global/bin:/home/teamcity/.rvm/rubies/ruby-3.3.9/bin:/home/teamcity/.rvm/bin:/home/teamcity/.local/bin:/usr/lib/jvm/java-21-amazon-corretto/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/snap/bin:/usr/share/dotnet:/usr/share/dotnet/tools:/home/teamcity/google-cloud-sdk/bin:/home/teamcity/go/bin:/usr/bin/mvn:/home/teamcity/.nvm/versions/node/v22.18.0/bin",TURBO_HASH:"a753a9acd652cb8c",NODE:"/home/teamcity/.nvm/versions/node/v22.18.0/bin/node",npm_package_name:"@wellesley/user",npm_config_color:"always",DOMAIN_ENV:"test",LANG:"en_US.UTF-8",TURBO_TEAM:"wellesley",TMP:"/mnt/agent/temp/buildTmp",TURBO_API:"https://turborepo-remote-cache-fo3np.ondigitalocean.app",npm_lifecycle_script:"vite build",SHELL:"/bin/bash",npm_package_version:"1.0.843",npm_lifecycle_event:"build",TURBO_CACHE:"remote:rw",SENTRY_MAPS_UPLOAD:"true",npm_config_globalconfig:"/home/teamcity/.nvm/versions/node/v22.18.0/etc/npmrc",npm_config_init_module:"/home/teamcity/.npm-init.js",PWD:"/mnt/agent/work/70fcd8585843667f/packages/user",npm_execpath:"/home/teamcity/.nvm/versions/node/v22.18.0/lib/node_modules/npm/bin/npm-cli.js",npm_config_global_prefix:"/home/teamcity/.nvm/versions/node/v22.18.0",npm_command:"run-script",TURBO_TOKEN:"wellesley-turbo-token",USE_PACKAGES_FROM_NPM:"true",INIT_CWD:"/mnt/agent/work/70fcd8585843667f/packages/user",EDITOR:"vi",NODE_ENV:"production",BUILD_NUMBER:"3751",APP_NAME:"@wellesley/user"};const g8=e=>FS.DOMAIN_ENV===e,VS=g8("prod"),y8=VS?8:3,m8=64,xb=5,Mw=2,_8=30,ak=50,v8=1024,w8=30,$i={link:56,userName:30,pronouns:20,displayName:50,description:v8,fieldLabel:20,fieldContent:80,location:200,timezone:56},Nd={short:"Too short",long:"Too long"},XS=(e,t=100)=>{let r;return function(...n){clearTimeout(r),r=setTimeout((()=>e.apply(this,n)),t)}},BS=(e,t)=>{const r=XS(((t,r,n)=>{e(...n).then(t).catch(r)}),t);return(...e)=>new Promise(((t,n)=>{r(t,n,e)}))},zg=e=>e.replace(/\s+/g," ").trim(),sk=new RegExp("\\p{Extended_Pictographic}","u"),HS=/^[a-zA-Z0-9\s/.]*$/,k8=({showInlineError:e=!0})=>Oe.string().trim().min(1,e?"Username is required":"").min(2,e?"Must be at least 2 characters long":"").max(30,Nd.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,"Only latin letters, digits, _ and . allowed"),ZS=BS((async e=>{try{const{taken:t}=await Cz().dispatch(qs.endpoints.getApiV1NamesCheck.initiate({name:e,nameScope:"USER"})).unwrap();return{exists:t??!1,message:"Username already in use. Please, try another one"}}catch{return{exists:!1,message:""}}}),500),b8=Oe.string().trim().min(1,"Display name is required").max(50).regex(/^[^@]*$/,"@ is not allowed").superRefine(((e,t)=>{const r=sk.test(e),n=/[a-zA-Z0-9]/.test(e);r&&!n&&t.addIssue({code:Oe.ZodIssueCode.custom,message:"Emojis alone are not allowed. Please add text"})})),GS=Oe.string().max(1024,Nd.long).optional(),x8=({minLength:e,minErrorMessage:t,maxLength:r,regexErrorMessage:n})=>Oe.string().trim().min(e,t).max(r,Nd.long).regex(/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,n);x8({minLength:2,maxLength:30,regexErrorMessage:"Invalid characters. ex.: group_name_1"}),x8({minLength:2,minErrorMessage:Nd.short,maxLength:30,regexErrorMessage:"Invalid characters. ex.: channel_name_1"});const KS=/^[0-9a-zA-Z_]+[0-9a-zA-Z_.]*$/,YS=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{1,}$/;Oe.string().trim().min(1,"").superRefine(((e,t)=>{e.includes("@")?YS.test(e)||t.addIssue({code:Oe.ZodIssueCode.custom,message:"Invalid email"}):KS.test(e)||t.addIssue({code:Oe.ZodIssueCode.custom,message:"Invalid characters"})}));const JS=`Required: A-Z, a-z, 0-9, special character, min ${y8}, max 64`;Oe.string().trim().superRefine(((e,t)=>{sk.test(e)&&t.addIssue({code:Oe.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>=y8&&e.length<=64||t.addIssue({code:Oe.ZodIssueCode.custom,message:JS})})),Oe.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=>!sk.test(e)),"Emojis are not allowed");const QS=e=>HS.test(e),$S=Oe.string().max($i.pronouns,`Maximum ${$i.pronouns} characters`).refine((e=>QS(e)),'Special characters !@#$%^*()+={} []:;", are not allowed').transform(zg).optional(),eC=/[!@#$%^&*()]/,tC=/^[0-9\s]+$/,rC=Oe.string().max($i.location).superRefine(((e,t)=>{if(e){if(eC.test(e))return void t.addIssue({code:Oe.ZodIssueCode.custom,message:"Special characters !@#$%^&*() are not allowed"});tC.test(e)&&t.addIssue({code:Oe.ZodIssueCode.custom,message:"Numbers alone aren't allowed. Please enter a valid location"})}})).optional(),nC=({form:e,originalUsername:t})=>{const r=zt(t??"").current,n=e=>e.getValues("userName"),[a,i]=bt(!1),[o,s]=bt(n(e));return{isUserNameChecked:a,handleUserNameChange:()=>{i(!1)},handleUserNameBlur:async()=>{const t=n(e).trim();if(t===o||t===r)return;const{exists:a,message:c}=await ZS(t);a&&e.setError("userName",{message:c}),s(t),i(!0)}}},aC=Oe.object({bio:GS,username:k8({showInlineError:!0}),displayName:b8}),sC=Oe.object({show:Oe.boolean(),dateOnly:Oe.boolean(),date:Oe.date().optional().nullable()}),iC=(e=!0)=>{const t=k8({showInlineError:e});return Oe.object({avatarId:Oe.string().nullable(),headerId:Oe.string().nullable(),channel:Oe.boolean().optional(),actorType:Oe.enum(["Application","Group","Organization","Person","Service"]).optional(),userName:t,displayName:b8,Pronouns:$S,summary:Oe.string().max($i.description,Nd.long).optional(),customFields:Oe.array(Oe.object({label:Oe.string().max($i.fieldLabel,Nd.long).optional(),content:Oe.string().max($i.fieldContent,Nd.long).optional()})),location:Oe.object({geo:Oe.object({latitude:Oe.number().optional(),longitude:Oe.number().optional(),accuracy:Oe.number().optional().nullable()}).optional().nullable(),show:Oe.boolean().optional(),name:rC,autoUpdate:Oe.boolean().optional()}),timezone:Oe.object({show:Oe.boolean(),ianaTimezone:Oe.string().optional(),autoUpdate:Oe.boolean()}),birthday:sC,canSubmit:Oe.boolean(),botProfile:Oe.object({role:Oe.string().optional(),triggers:Oe.array(Oe.object({id:Oe.string(),label:Oe.string()})).optional(),personality_traits:Oe.array(Oe.object({id:Oe.string(),label:Oe.string()})).optional(),tone:Oe.string().optional(),style:Oe.array(Oe.object({id:Oe.string(),label:Oe.string()})).optional(),behaviors:Oe.array(Oe.object({id:Oe.string(),label:Oe.string()})).optional(),prompt:Oe.string().optional()}).optional()})};Oe.object({show:Oe.boolean(),dateOnly:Oe.boolean(),date:Oe.date().optional().nullable()});const Bg=e=>{var t;const r=e,n=409===(null==r?void 0:r.status);return{message:"UserNameIsReserved"===(null==(t=null==r?void 0:r.data)?void 0:t.errorCode)?"Restricted words detected. Please, try alternatives":"Username already in use. Please, try another one",isError:n}},A8="FollowersListHidden",z8="FollowingListHidden",Ode=e=>{var t;const r=null==(t=null==e?void 0:e.data)?void 0:t.errorCode;return r===A8||r===z8},dg=e=>{var t,r;const n=null==(r=null==(t=null==e?void 0:e.error)?void 0:t.data)?void 0:r.errorCode;return n===A8||n===z8},S8=qs.enhanceEndpoints({endpoints:{deleteApiV1Users:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){try{await yn(r)&&await t(qs.endpoints.getApiV1AccountsProfile.initiate({htmlContent:!1})).unwrap()}catch(e){Zt.error(`${Us(e)}`)}}},getApiV1AccountsProfile:{providesTags:["Secure","Account"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){t(Cw(!0));try{const e=await yn(r);e&&t(Zz(e.data)),t(Tw(!0))}catch(e){t(Tw(!1)),t(Hz(!0)),t(Bz(e))}finally{t(Cw(!1))}}},putApiV1UsersByUserId:{invalidatesTags:["Secure","Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,Zt.success("User updated successfully")}catch(e){const t=e.error,{isError:r}=Bg(t);!r&&Zt.error(`${Us(t)}`)}}},getApiV1Users:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){const n=!e.htmlContent;try{n&&t(ha.actions.setPending(!0));const e=await yn(r);n&&e&&(t(ha.actions.setUser(e.data)),t(ha.actions.setSuccess(!0)),t(ha.actions.setPending(!1)))}catch(e){n&&(t(ha.actions.setSuccess(!1)),t(ha.actions.setError(e)),t(ha.actions.setPending(!1))),Zt.error(`${Us(e)}`)}}},postApiV1Users:{invalidatesTags:["Account"],async onQueryStarted(e,{queryFulfilled:t}){try{await t,Zt.success("User created successfully")}catch(e){const t=e.error,{isError:r}=Bg(t);!r&&Zt.error(`${Us(t)}`)}}},getApiV1UsersFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!dg(e)){const t=e;Zt.error(`${Us(t.error)}`)}}}},getApiV1UsersRemoteByUserNameFullFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!dg(e)){const t=e;Zt.error(`${Us(t.error)}`)}}}},getApiV1UsersByUserId:{providesTags:["Secure","UserNoHtml"],async onQueryStarted(e,{dispatch:t,queryFulfilled:r}){const n=!e.htmlContent;try{n&&t(ha.actions.setPending(!0));const e=await yn(r);n&&e&&(t(ha.actions.setUser(e.data)),t(ha.actions.setSuccess(!0)),t(ha.actions.setPending(!1)))}catch(e){n&&(t(ha.actions.setSuccess(!1)),t(ha.actions.setError(e)),t(ha.actions.setPending(!1))),Zt.error(`${Us(e)}`)}}},getApiV1UsersByUserIdFollowers:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!dg(e)){const t=e;Zt.error(`${Us(t.error)}`)}}}},getApiV1UsersFollowees:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!dg(e)){const t=e;Zt.error(`${Us(t.error)}`)}}}},getApiV1UsersByUserIdFollowing:{providesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t}){try{await t}catch(e){if(!dg(e)){const t=e;Zt.error(`${Us(t.error)}`)}}}},postApiV1UsersFollowByUsernameAccept:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:n}){const a=Nl({dispatch:r,userId:e.user.id,state:n(),relationsProps:{followed:"ACCEPTED"}});await yn(t,`Accepted follow request from ${e.username}`,(()=>null==a?void 0:a.undo()))}},postApiV1UsersFollowByUsernameReject:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:n}){const a=Nl({dispatch:r,userId:e.user.id,state:n(),relationsProps:{followed:"REJECTED"}});await yn(t,`Rejected follow request from ${e.username}`,(()=>null==a?void 0:a.undo()))}},postApiV1UsersFollowByUsername:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r}){await yn(t,`Follow request sent to ${e.username}`)&&r(qs.util.invalidateTags([{type:"Relationship",id:e.user.id}]))}},postApiV1UsersFollowByUsernameUndo:{invalidatesTags:["Follow","Secure"],async onQueryStarted(e,{queryFulfilled:t,dispatch:r,getState:n}){const a=Nl({dispatch:r,userId:e.user.id,state:n(),relationsProps:{following:null}});await yn(t,`You unfollowed ${e.username}`,(()=>null==a?void 0:a.undo()))}},getApiV1Block:{providesTags:["Follow"]},postApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const a=Nl({userId:e.userId,dispatch:n,state:r(),relationsProps:{blocked:!0}});await yn(t,void 0,(()=>null==a?void 0:a.undo()))}},deleteApiV1BlockByUserId:{invalidatesTags:["Follow"],async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const a=Nl({userId:e.userId,dispatch:n,state:r(),relationsProps:{blocked:!1,muted:{state:!1}}});await yn(t,void 0,(()=>null==a?void 0:a.undo()))}},postApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:r,dispatch:n}){const a=Nl({userId:e,dispatch:n,state:r(),relationsProps:{muted:{state:!0}}});await yn(t,void 0,(()=>null==a?void 0:a.undo()))}},deleteApiV1MuteByUserId:{async onQueryStarted({userId:e},{queryFulfilled:t,getState:r,dispatch:n}){const a=Nl({userId:e,dispatch:n,state:r(),relationsProps:{muted:{state:!1}}});await yn(t,void 0,(()=>null==a?void 0:a.undo()))}},getApiV1Mute:{async onQueryStarted(e,{queryFulfilled:t}){await yn(t)}},getApiV1UsersRelationships:{providesTags:(e,t,{targets:r})=>r.map((e=>({type:"Relationship",id:e}))),async onQueryStarted(e,{queryFulfilled:t}){await yn(t)}},postApiV1AdminUserChangeState:{invalidatesTags:["Secure"],async onQueryStarted(e,{queryFulfilled:t}){await yn(t,`User ${e.changeUserState.userId} state changed to ${e.changeUserState.newState}`)}},putApiV1Notes:{async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const{userId:a,text:i}=e.noteUpdate,o=Nl({userId:a,dispatch:n,state:r(),relationsProps:{note:i}});await yn(t,"Note has been updated",(()=>null==o?void 0:o.undo()))}},deleteApiV1NotesByUserId:{async onQueryStarted(e,{queryFulfilled:t,getState:r,dispatch:n}){const a=Nl({userId:e.userId,dispatch:n,state:r(),relationsProps:{note:""}});await yn(t,"Note has been removed",(()=>null==a?void 0:a.undo()))}},postApiV1UsersFollowByUsernamePend:{async onQueryStarted(e,{queryFulfilled:t}){await yn(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:Dde,usePostApiV1UsersMutation:oC,useDeleteApiV1AccountsDeleteMutation:cC,useGetApiV1AccountsProfileQuery:Ude,usePutApiV1UsersByUserIdMutation:ik,useGetApiV1UsersQuery:lC,useDeleteApiV1UsersMutation:C8,usePostApiV1MuteByUserIdMutation:qde,useDeleteApiV1MuteByUserIdMutation:Wde,useGetApiV1MuteQuery:Fde,usePostApiV1AdminUserChangeStateMutation:Vde,useGetApiV1UsersRelationshipsQuery:uC,usePutApiV1NotesMutation:Xde,useDeleteApiV1NotesByUserIdMutation:Bde,useLazyGetApiV1UsersRelationshipsQuery:fC,useLazyGetApiV1GeoQuery:dC,useLazyGetApiV1GroupsOwnedQuery:pC,useGetApiV1UsersFollowersQuery:Hde,useGetApiV1UsersByUserIdQuery:hC,useLazyGetApiV1UsersRenameHistoryQuery:Zde,useGetApiV1UsersByUserIdFollowersQuery:Gde,useGetApiV1UsersByUserIdFollowingQuery:Kde,useGetApiV1UsersFolloweesQuery:Yde,usePostApiV1UsersFollowByUsernameMutation:Jde,usePostApiV1UsersFollowByUsernameUndoMutation:Qde,usePostApiV1UsersFollowByUsernameRejectMutation:$de,usePostApiV1UsersFollowByUsernameAcceptMutation:epe,useGetApiV1UsersRemoteByUserNameFullFollowersQuery:tpe}=S8,T8=()=>{const[e]=ik();return({userId:t,htmlContent:r,data:n})=>{e({userId:t,userUpdate:n,...r&&{htmlContent:r}})}},Ab={data:null,isError:!1,isPending:!1,isSuccess:!1},Hr=Ud({name:"user",initialState:Ab,reducers:{reset:e=>{Object.assign(e,Ab)}},extraReducers:e=>{e.addCase(Zz,((e,{payload:t})=>{e.data=t})).addCase(Gz,((e,{payload:t})=>{e.data&&Object.assign(e.data,t||{})})).addCase(Tw,((e,{payload:t})=>{e.isSuccess=t})).addCase(Cw,((e,{payload:t})=>{e.isPending=t})).addCase(Hz,((e,{payload:t})=>{e.isError=t})).addCase(Bz,((e,{payload:t})=>{e.error=t})).addCase(s9,((e,{payload:t})=>{var r;null!=(r=e.data)&&r.users&&(e.data.users=e.data.users.map((e=>t.id===e.id?t:e)))}))},selectors:{selectIsError:e=>e.isError,selectError:e=>e.error,selectPending:e=>e.isPending,selectData:e=>e.data,selectAccount:e=>{var t;return null==(t=e.data)?void 0:t.account},selectAccountId:e=>{var t;return null==(t=e.data)?void 0:t.account.id},selectUsers:e=>{var t;return null==(t=e.data)?void 0:t.users},selectUserById:(e,t)=>{var r;return null==(r=e.data)?void 0:r.users.find((({id:e})=>e===t))},selectCurrentUser:e=>{var t;return null==(t=e.data)?void 0:t.users.find((({id:t})=>{var r;return t===(null==(r=e.data)?void 0:r.selectedUserId)}))},selectSelectedUserId:e=>{var t;return null==(t=e.data)?void 0:t.selectedUserId},selectSuccess:e=>e.isSuccess}}),gC=e=>e.filter((e=>e.id&&e.username&&e.displayName)),rpe=()=>{const e=Do(),t=ft(Hr.selectors.selectAccount),r=jz("account#$account_id",{account_id:(null==t?void 0:t.id)||""}),n=ft((e=>Gw.selectors.selectLastUpdateFor(e,r)));Ke((()=>{if(null!=t&&t.id)return e(Vz({id:r,topics:[r]})),()=>{e(Xz(r))}}),[null==t?void 0:t.id]),Ke((()=>{null!=n&&n.data&&e(Gz({...n.data,users:gC(n.data.users)}))}),[null==n?void 0:n.data])},dh=()=>{const e=ft(Hr.selectors.selectSelectedUserId),t=Do();return{changeUser:Dr((r=>{e!==r&&t(n9({userId:r}))}),[e,t]),selectedUserId:e}},yC=(e="")=>e.startsWith("@")?null==e?void 0:e.replace("@",""):e,mC=({username:e,canFetch:t=!0,htmlContent:r=!0})=>{const n=yC(e),{data:a,error:i,isLoading:o}=lC({username:n,full:!0,htmlContent:r},{skip:!n||!t});return{data:a,error:i,isLoading:o}},_C=e=>{const t=ft(ha.selectors.selectUser),{isLoading:r}=mC({username:e,canFetch:!!e,htmlContent:!1});return[t,r]},j8=()=>E8()?location.hostname:location.hostname.replace(/\w\w\w\.|^/,"."),P8=e=>{const t=new Date;return t.setTime(t.getTime()+24*e*60*60*1e3),t.toUTCString()},R8=e=>Object.keys(e).reduce(((t,r)=>`${t}${r}${!0===e[r]?"":`=${e[r]}`};`),""),vC=(e,t)=>{const r=$g()?"":document.cookie,n=`; ${t||r}`.split(`; ${e}=`);if(2===n.length)return(n.pop()||"").replace("=","").split(";").shift()},wC=(e,t)=>{$g()||(document.cookie=R8({[e]:"",path:"/",domain:t||j8(),expires:"Thu, 01 Jan 1970 00:00:01 GMT"}))},kC=["localhost","127.0.0.1","dev.localtest.me","wellesleydev.localtest.me"],E8=()=>kC.includes(location.hostname),bC=(e,t="",r=10,n)=>{$g()||(document.cookie=R8({[e]:t,path:"/",domain:n||j8(),expires:P8(r),...!E8()&&{SameSite:"None",Secure:!0}}))},ok={set:bC,remove:wC,get:vC,getExpireDate:P8},ck="auth_token",L8=()=>ok.get(ck)||void 0,xC=e=>ok.set(ck,e),AC=()=>ok.remove(ck),zC=()=>!!L8(),SC={getToken:L8,setToken:xC,removeToken:AC,hasToken:zC},zb={forgotPasswordStep:"request",forgotPasswordFields:null,signupStep:"rules",signupFields:null,token:null,newEmail:null,isPending:!!SC.getToken(),isAuthenticated:!1,isAskLoginOpen:!1},lk=Ud({name:"auth",initialState:zb,reducers:{setAskLoginOpen:(e,t)=>{e.isAskLoginOpen=t.payload},login:(e,t)=>{e.isAuthenticated=!0,e.token=t.payload||null,e.isPending=!1},logout:()=>({...zb,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}}),npe=()=>{const e=ft(lk.selectors.selectIsAuthenticated),t=ft(Hr.selectors.selectPending);return{user:ft(Hr.selectors.selectCurrentUser),isLogged:e,isLoading:t}},CC=()=>{const e=ft(Hr.selectors.selectCurrentUser),t=ft(lk.selectors.selectIsAuthenticated);return{user:e,isLoading:ft(Hr.selectors.selectPending),isLogged:t,error:ft(Hr.selectors.selectError)}},ape=({userId:e="",canFetch:t=!0,htmlContent:r=!0})=>{const{data:n,error:a,isLoading:i,isFetching:o}=hC({userId:e,full:!0,htmlContent:r},{skip:!e||!t});return{data:n,error:a,isLoading:i,isFetching:o}},TC=({onChange:e})=>{const{user:t}=CC(),r=null==t?void 0:t.id,n=zt(r);Ke((()=>{n.current?r!==n.current&&(e(),n.current=r):n.current=r}),[r,n.current])},Sb=["following","followed","blocked","muted","note","blocked_by"],Cb=({userId:e,currentUserId:t})=>{const r="string"==typeof e,n=r?[e]:(null==e?void 0:e.filter((e=>e!==t)))||[],a=e===t;return{isSingleUser:r,canFetch:!(!n.length||a||!t),safeTargets:n}},jC=({userId:e,skip:t})=>{const r=ft(Hr.selectors.selectCurrentUser),n=null==r?void 0:r.id,{canFetch:a,isSingleUser:i,safeTargets:o}=Cb({userId:e,currentUserId:n}),{data:s,isLoading:c}=uC({targets:o,filter:Sb},{skip:!a||t}),[l]=fC(),u=({userId:e})=>{const{canFetch:t,safeTargets:r}=Cb({userId:e,currentUserId:n});t&&l({targets:r,filter:Sb})};return TC({onChange:()=>{u({userId:o})}}),{relationship:(i?null==s?void 0:s[e]:s)||{},isLoading:c,updateRelations:u}},ty=e=>`@${e.username}${e.local?"":`@${e.domain}`}`,N8=({id:e,user:t})=>{const r=Do(),n=jz("user#$username",{username:t?ty(t).slice(1):""}),a=`${e}-${null==t?void 0:t.username}`;return Ke((()=>{if(null!=t&&t.username)return r(Vz({id:a,topics:[n]})),()=>{r(Xz(a))}}),[null==t?void 0:t.username]),{subscriptionName:n}},spe=({user:e,onUpdate:t})=>{const{updateRelations:r}=jC({}),{subscriptionName:n}=N8({id:"outside-user-update",user:e}),a=ft((e=>Gw.selectors.selectLastUpdateFor(e,n)));Ke((()=>{const e=null==a?void 0:a.data;e&&(r({userId:e.id}),t(e))}),[null==a?void 0:a.data])},ipe=({onUpdate:e})=>{const t=ft(Hr.selectors.selectCurrentUser),{subscriptionName:r}=N8({id:"current-user-update",user:t}),n=ft((e=>Gw.selectors.selectLastUpdateFor(e,r)));Ke((()=>{const t=null==n?void 0:n.data;t&&e(t)}),[null==n?void 0:n.data])},I8=e=>{const t=e.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return t?t[1]:void 0},PC=e=>e.replace(/\.[^.]*$/,""),RC=()=>!$g()&&/iPhone|iPod|iPad/gi.test(window.navigator.userAgent),EC=({src:e,name:t=""})=>new Promise(((r,n)=>{const a=document.createElement("video");a.src=e;const i=()=>{const{duration:e,videoHeight:i,videoWidth:o,src:s}=a,c=PC(t);(!e||!i||!o||!s)&&n(),r({src:s,name:c,width:o,height:i,duration:Math.floor(e)})},o=()=>{hs.warn("Failed to load video"),r(null)};return RC()&&a.load(),a.addEventListener("error",o),a.addEventListener("loadeddata",i),()=>{a.removeEventListener("error",o),a.removeEventListener("loadeddata",i)}})),LC=e=>new Promise(((t,r)=>{const n=new Image,a=URL.createObjectURL(e);n.onload=()=>{t({width:n.naturalWidth,height:n.naturalHeight}),URL.revokeObjectURL(a)},n.onerror=()=>{hs.warn("Failed to load image"),r(null),URL.revokeObjectURL(a)},n.src=a})),Tb=e=>{if(!e)return;const t="number"==typeof e?e:parseInt(e,10);if(isNaN(t))throw new Error("Can not get number from income argument");const r=t/1048576;return`${Math.floor(r)} MB`},NC={openaiConfigModel:"wellesley.openai.config.model",openaiConfigApiKey:"wellesley.openai.config.apiKey",uploadsProvider:"wellesley.uploads.provider",uploadsS3:"wellesley.uploads.s3",uploadsPolicyImageExtensions:"wellesley.uploads.policy.image.extensions",uploadsPolicyImageKeepOriginal:"wellesley.uploads.policy.image.keepOriginal",uploadsPolicyImageResolutions:"wellesley.uploads.policy.image.resolutions",uploadsPolicyImageMaxResolution:"wellesley.uploads.policy.image.maxResolution",uploadsPolicyImageMaxMatrix:"wellesley.uploads.policy.image.maxMatrix",uploadsPolicyImageMaxSize:"wellesley.uploads.policy.image.maxSize",uploadsPolicyVideoExtensions:"wellesley.uploads.policy.video.extensions",uploadsPolicyVideoResolutions:"wellesley.uploads.policy.video.resolutions",uploadsPolicyVideoKeepOriginal:"wellesley.uploads.policy.video.keepOriginal",uploadsPolicyVideoMaxResolution:"wellesley.uploads.policy.video.maxResolution",uploadsPolicyVideoMaxMatrix:"wellesley.uploads.policy.video.maxMatrix",uploadsPolicyVideoMaxSize:"wellesley.uploads.policy.video.maxSize",uploadsPolicyVideoMaxDuration:"wellesley.uploads.policy.video.maxDuration",uploadsPolicyVideoStreamingThreshold:"wellesley.uploads.policy.video.streamingThreshold",uploadsPolicyAudioExtensions:"wellesley.uploads.policy.audio.extensions",uploadsPolicyAudioKeepOriginal:"wellesley.uploads.policy.audio.keepOriginal",uploadsPolicyAudioMaxSize:"wellesley.uploads.policy.audio.maxSize",uploadsPolicyDocExtensions:"wellesley.uploads.policy.doc.extensions",uploadsPolicyDocMaxSize:"wellesley.uploads.policy.doc.maxSize",mediacacheEnabled:"wellesley.mediacache.enabled",mediacacheMaxTotalSize:"wellesley.mediacache.maxTotalSize",mediacacheMaxFileSize:"wellesley.mediacache.maxFileSize",mediacacheLimitPerRun:"wellesley.mediacache.limitPerRun",mediacacheSingleRun:"wellesley.mediacache.singleRun",mediacacheCheckInterval:"wellesley.mediacache.checkInterval",postsMaxMediaAttachments:"wellesley.posts.max_media_attachments",postsMaxCharacters:"wellesley.posts.max_characters",postsMaxPins:"wellesley.posts.max_pins",registrationMode:"wellesley.registration.mode",registrationInvitesEnabled:"wellesley.registration.invitesEnabled",registrationReasonToJoin:"wellesley.registration.reasonToJoin",registrationShowCaptcha:"wellesley.registration.showCaptcha",registrationNotAvailableMessage:"wellesley.registration.notAvailableMessage",captchaVerifyUrl:"wellesley.captcha.verifyUrl",captchaSecretKey:"wellesley.captcha.secretKey",captchaSiteKey:"wellesley.captcha.siteKey",confirmationCodeCodeExpirationMinutes:"wellesley.confirmationCode.codeExpirationMinutes",confirmationCodeCounterExpirationMinutes:"wellesley.confirmationCode.counterExpirationMinutes",confirmationCodeLimitStoreAttempts:"wellesley.confirmationCode.limitStoreAttempts",confirmationCodeLimitCheckAttempts:"wellesley.confirmationCode.limitCheckAttempts",translation:"wellesley.translation"},rn={followAutoAccept:"user.follow.autoAccept",notificationsPrefsEmailMuteEnabled:"user.notifications.prefs.email.mute.enabled",notificationsPrefsEmailMuteExpiresAt:"user.notifications.prefs.email.mute.expiresAt",notificationsPrefsEmailFollow:"user.notifications.prefs.email.follow",notificationsPrefsEmailFollowRequest:"user.notifications.prefs.email.followRequest",notificationsPrefsEmailLike:"user.notifications.prefs.email.like",notificationsPrefsEmailComment:"user.notifications.prefs.email.comment",notificationsPrefsEmailMention:"user.notifications.prefs.email.mention",notificationsPrefsEmailGroupInvite:"user.notifications.prefs.email.groupInvite",notificationsPrefsEmailRepost:"user.notifications.prefs.email.repost",notificationsPrefsEmailListPostCreate:"user.notifications.prefs.email.listPostCreate",notificationsPrefsEmailPostUpdate:"user.notifications.prefs.email.postUpdate",notificationsPrefsEmailPollVote:"user.notifications.prefs.email.pollVote",notificationsPrefsEmailEventInvite:"user.notifications.prefs.email.eventInvite",notificationsPrefsEmailEventCancel:"user.notifications.prefs.email.eventCancel",notificationsPrefsEmailEventJoin:"user.notifications.prefs.email.eventJoin",notificationsPrefsEmailEventUpdate:"user.notifications.prefs.email.eventUpdate",notificationsPrefsPushMuteEnabled:"user.notifications.prefs.push.mute.enabled",notificationsPrefsPushMuteExpiresAt:"user.notifications.prefs.push.mute.expiresAt",notificationsPrefsPushFollow:"user.notifications.prefs.push.follow",notificationsPrefsPushFollowRequest:"user.notifications.prefs.push.followRequest",notificationsPrefsPushLike:"user.notifications.prefs.push.like",notificationsPrefsPushComment:"user.notifications.prefs.push.comment",notificationsPrefsPushMention:"user.notifications.prefs.push.mention",notificationsPrefsPushGroupInvite:"user.notifications.prefs.push.groupInvite",notificationsPrefsPushRepost:"user.notifications.prefs.push.repost",notificationsPrefsPushListPostCreate:"user.notifications.prefs.push.listPostCreate",notificationsPrefsPushPostUpdate:"user.notifications.prefs.push.postUpdate",notificationsPrefsPushPollVote:"user.notifications.prefs.push.pollVote",notificationsPrefsPushEventInvite:"user.notifications.prefs.push.eventInvite",notificationsPrefsPushEventCancel:"user.notifications.prefs.push.eventCancel",notificationsPrefsPushEventJoin:"user.notifications.prefs.push.eventJoin",notificationsPrefsPushEventUpdate:"user.notifications.prefs.push.eventUpdate",notificationsPrefsSubscribeOnComment:"user.notifications.prefs.subscribeOnComment",notificationsPrefsSyncAcrossProfiles:"user.notifications.prefs.syncAcrossProfiles",notificationsShowPopup:"user.notifications.prefs.showPopup",notificationsPolicyBlockNonFollowers:"user.notifications.policy.blockNonFollowers",notificationsPolicyBlockNonFollowing:"user.notifications.policy.blockNonFollowing",notificationsPolicyBlockNonFollowingMessages:"user.notifications.policy.blockNonFollowingMessages",notificationsPolicyBlockNewAccounts:"user.notifications.policy.blockNewAccounts",privacyShowPublicPosts:"user.privacy.showPublicPosts",privacyShowProfilePage:"user.privacy.showProfilePage",privacyShowFollowers:"user.privacy.showFollowers",translation:"user.translation"},IC={sms:"wellesley.admin.sms",openai:"wellesley.admin.openai",uploads:"wellesley.admin.uploads",captcha:"wellesley.admin.captcha",language:"wellesley.admin.language",mediacache:"wellesley.admin.mediacache",translation:"wellesley.admin.translation",link_service:"wellesley.admin.link_service"},Ow={posts:"wellesley.posts",translation:"wellesley.translation",registration:"wellesley.registration",confirmationCode:"wellesley.confirmationCode",uploadsPolicyDoc:"wellesley.uploads.policy.doc",uploadsPolicyAudio:"wellesley.uploads.policy.audio",uploadsPolicyImage:"wellesley.uploads.policy.image",uploadsPolicyVideo:"wellesley.uploads.policy.video",captcha:"wellesley.captcha",access:"wellesley.access",branding:"wellesley.branding",instanceAdmin:"wellesley.instance.admin",legal:"wellesley.instance.legal",domainBlocks:"wellesley.instance.domainBlocks",contacts:"wellesley.instance.contacts"},Ml=e=>(null==e?void 0:e.map((e=>e.value||e)))||[],MC={data:null,isPending:!1},{posts:m1,uploadsPolicyDoc:jb,uploadsPolicyAudio:_1,uploadsPolicyImage:Uy,uploadsPolicyVideo:pg,registration:M8,captcha:OC,instanceAdmin:DC,branding:UC,translation:qC,domainBlocks:WC,access:FC}=Ow,{captcha:VC,language:XC,translation:BC,openai:HC,link_service:ZC}=IC,Wd=e=>e.data,GC=Wl(Wd,(e=>{var t,r,n;return{max_characters:(null==(t=null==e?void 0:e[m1])?void 0:t.max_characters)||0,max_media_attachments:(null==(r=null==e?void 0:e[m1])?void 0:r.max_media_attachments)||0,max_pins:(null==(n=null==e?void 0:e[m1])?void 0:n.max_pins)||0}})),uk=Wl(Wd,(e=>{var t,r,n;return{...null==e?void 0:e[Uy],maxSize:(null==(t=null==e?void 0:e[Uy])?void 0:t.maxSize)||0,maxMatrix:(null==(r=null==e?void 0:e[Uy])?void 0:r.maxMatrix)||0,maxResolution:(null==(n=null==e?void 0:e[Uy])?void 0:n.maxResolution)||0}})),KC=Wl(uk,(e=>Ml(e.extensions))),O8=Wl(Wd,(e=>{var t,r,n,a;return{...null==e?void 0:e[pg],maxSize:(null==(t=null==e?void 0:e[pg])?void 0:t.maxSize)||0,maxMatrix:(null==(r=null==e?void 0:e[pg])?void 0:r.maxMatrix)||0,maxDuration:(null==(n=null==e?void 0:e[pg])?void 0:n.maxDuration)||0,maxResolution:(null==(a=null==e?void 0:e[pg])?void 0:a.maxResolution)||0}})),D8=Wl(Wd,(e=>{var t,r;return{...null==e?void 0:e[_1],maxSize:null==(t=null==e?void 0:e[_1])?void 0:t.maxSize,keepOriginal:(null==(r=null==e?void 0:e[_1])?void 0:r.keepOriginal)||0}})),U8=Wl(Wd,(e=>{var t;return{...null==e?void 0:e[jb],maxSize:(null==(t=null==e?void 0:e[jb])?void 0:t.maxSize)||0}})),q8=Wl([uk,O8,D8,U8],((e,t,r,n)=>({IMAGE:Ml(null==e?void 0:e.extensions),VIDEO:Ml(null==t?void 0:t.extensions),AUDIO:Ml(null==r?void 0:r.extensions),DOCUMENT:Ml(null==n?void 0:n.extensions)}))),YC=Wl(q8,(e=>Object.keys(e).reduce(((t,r)=>[...t,...e[r]||[]]),[]))),JC=Wl(Wd,(e=>{var t;return null==(t=null==e?void 0:e[M8])?void 0:t.invites})),Ol=Ud({name:"platformSettings",initialState:MC,reducers:{setError:(e,t)=>{e.error=t.payload},setPending:(e,t)=>{e.isPending=t.payload}},extraReducers:e=>{e.addCase(jw,((e,{payload:t})=>{e.data={...e.data,...t}}))},selectors:{selectSettings:Wd,selectPostConfig:GC,selectDocPolicy:U8,selectImagePolicy:uk,selectVideoPolicy:O8,selectAudioPolicy:D8,selectInvitesEnabled:JC,selectImageExtensions:KC,selectSupportedExtensions:q8,selectFullExtensionsList:YC,selectRegistration:e=>{var t;return null==(t=e.data)?void 0:t[M8]},selectLanguageDetection:e=>{var t;return null==(t=e.data)?void 0:t[XC]},selectLanguageTranslation:e=>{var t;return null==(t=e.data)?void 0:t[BC]},selectOpenai:e=>{var t;return null==(t=e.data)?void 0:t[HC]},selectCaptcha:e=>{var t;return null==(t=e.data)?void 0:t[OC]},selectAdminCaptcha:e=>{var t;return null==(t=e.data)?void 0:t[VC]},selectPlatformTranslation:e=>{var t;return null==(t=e.data)?void 0:t[qC]},selectAccess:e=>{var t;return null==(t=e.data)?void 0:t[FC]},selectBranding:e=>{var t;return null==(t=e.data)?void 0:t[UC]},selectLinkService:e=>{var t;return null==(t=e.data)?void 0:t[ZC]},selectInstanceAdmin:e=>{var t;return null==(t=e.data)?void 0:t[DC]},selectLegal:e=>{var t;return null==(t=e.data)?void 0:t[Ow.legal]},selectDomainBlocks:e=>{var t;return null==(t=e.data)?void 0:t[WC]},selectContacts:e=>{var t;return null==(t=e.data)?void 0:t[Ow.contacts]}}}),QC=async({media:e,docPolicy:t,imgPolicy:r,videoPolicy:n,audioPolicy:a})=>{if(!r||!n)return"Media policy is not defined";const i={IMAGE:Ml(r.extensions),VIDEO:Ml(n.extensions),AUDIO:Ml(a.extensions),DOCUMENT:Ml(t.extensions)},o=I8(e.file.name)||"",s=Object.keys(i).find((e=>{var t;return null==(t=i[e])?void 0:t.includes(o)}));if(!s)return`Extension ${o} is not supported`;const c="VIDEO"===s;if("IMAGE"===s){const t=await LC(e.file),n=e.file.size>r.maxSize,a=t&&Math.max(t.width,t.height)>r.maxResolution,i=t&&t.width*t.height>r.maxMatrix;switch(!0){case n:return`Image is too big. Max size is ${Tb(r.maxSize)}`;case a:return`Image resolution is too high. Max resolution is ${r.maxResolution} pixels`;case i:return`The uploaded image exceeds the maximum size allowed. Please choose an image with smaller dimensions or reduce the resolution and try again. Max resolution is ${r.maxMatrix} pixels`}}if(c){const t=await EC({src:e.objectUrl}),r=t&&t.duration>n.maxDuration,a=t&&Math.max(t.width,t.height)>n.maxResolution,i=e.file.size>n.maxSize,o=t&&t.width*t.height>n.maxMatrix;switch(!0){case r:return`Video is too long. Max duration is ${n.maxDuration} seconds`;case i:return`Video is too big. Max size is ${Tb(n.maxSize)}`;case a:return`Video resolution is too high. Max resolution is ${n.maxResolution} pixels`;case o:return`The uploaded video exceeds the maximum size allowed. Please choose a video with smaller dimensions or reduce the resolution and try again. Max resolution is ${n.maxMatrix} pixels`}}},$C=()=>{const[e]=X5(),t=new AbortController,r=t.signal,n=ft(Ol.selectors.selectImagePolicy),a=ft(Ol.selectors.selectVideoPolicy),i=ft(Ol.selectors.selectDocPolicy),o=ft(Ol.selectors.selectAudioPolicy);return[async({media:t,tag:s,onError:c,onUpload:l,onProgress:u})=>{var d;const f=I8(t.file.name),p=await QC({imgPolicy:n,docPolicy:i,videoPolicy:a,audioPolicy:o,media:t});if(p)return Zt.error(p),void(null==c||c());try{const n=await e({createUpload:{extension:f,tags:[s],meta:{name:t.file.name}}});if("error"in n)throw new Error(n.error);const a=null==(d=n.data)?void 0:d.uri;return await new Promise(((e,n)=>{const i=new XMLHttpRequest;i.open("PUT",a),r&&r.addEventListener("abort",(()=>{try{i.abort()}catch(e){hs.warn("Cancel upload failed",e)}})),i.upload.onprogress=e=>{if(!e.lengthComputable)return;const t=Math.round(e.loaded/e.total*100);null==u||u(e.loaded,e.total,t)},i.onerror=()=>n(new Error("Upload failed")),i.onload=()=>{i.status>=200&&i.status<300?e():n(new Error(i.statusText))},i.send(t.file)})),null==l||l(),n.data.upload.uploadId}catch(e){null==c||c(e),Zt.error(`Could not upload file. ${String(e)}`)}},()=>t.abort("Upload canceled")]};var Yi=(e=>(e.header="header",e.avatar="avatar",e))(Yi||{});const Hg=({user:e,type:t})=>{var r,n,a,i;if(!e)return"";try{return("avatar"===t?null==(n=null==(r=e.avatar)?void 0:r.files[0])?void 0:n.uri:null==(i=null==(a=e.header)?void 0:a.files[0])?void 0:i.uri)||""}catch{return""}};var Pb,wg={exports:{}},eT=wg.exports;
43
43
  /**
44
44
  * @license
45
45
  * Lodash <https://lodash.com/>
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "!.*",
8
8
  "!*.map"
9
9
  ],
10
- "version": "1.0.842",
10
+ "version": "1.0.843",
11
11
  "module": "index.ts",
12
12
  "scripts": {
13
13
  "build": "vite build",