@wellesley/uploads 1.0.577 → 1.0.579

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 dv,usePostApiV1UploadsMutation as gv,useDeleteApiV1UploadsByIdMutation as vv,usePostApiV1UploadsByIdMetaMutation as Av,useGetApiV1UploadsByIdQuery as mv}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.692";import Re,{forwardRef as n0,createElement as e0,useRef as tr,useState as lt,useEffect as _i,PureComponent as yv,createRef as l0,useCallback as qs,useLayoutEffect as wv,useMemo as f0}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{toast as hu}from"https://cdn.jsdelivr.net/npm/@wellesley/system-toast@1.0.36";import{useSelector as Nr,useDispatch as xv}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{createAction as F0,createSelector as Ti,createSlice as B0}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{useIsMobile as bv,cn as qo,Dialog as Sv,DialogContent as _v,ButtonLoader as h0,Button as jg,TooltipWrapper as j0}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.654";import{rootReducer as Tv}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.691";var p0,bi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},js={exports:{}},Lv=js.exports;
1
+ import{api as dv,usePostApiV1UploadsMutation as gv,useDeleteApiV1UploadsByIdMutation as vv,usePostApiV1UploadsByIdMetaMutation as Av,useGetApiV1UploadsByIdQuery as mv}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.694";import Re,{forwardRef as n0,createElement as e0,useRef as tr,useState as lt,useEffect as _i,PureComponent as yv,createRef as l0,useCallback as qs,useLayoutEffect as wv,useMemo as f0}from"https://cdn.jsdelivr.net/npm/react@18.2.0/+esm";import{toast as hu}from"https://cdn.jsdelivr.net/npm/@wellesley/system-toast@1.0.38";import{useSelector as Nr,useDispatch as xv}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{createAction as F0,createSelector as Ti,createSlice as B0}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{useIsMobile as bv,cn as qo,Dialog as Sv,DialogContent as _v,ButtonLoader as h0,Button as jg,TooltipWrapper as j0}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.656";import{rootReducer as Tv}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.693";var p0,bi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},js={exports:{}},Lv=js.exports;
2
2
  /**
3
3
  * @license
4
4
  * Lodash <https://lodash.com/>
@@ -39,7 +39,7 @@ import{api as dv,usePostApiV1UploadsMutation as gv,useDeleteApiV1UploadsByIdMuta
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
- */var Ys=(t=>(t.done="done",t.inprogress="inprogress",t))(Ys||{}),q0=(t=>(t.post="$post",t.album="$album",t.avatar="$avatar",t.header="$header",t.emoji="$emoji",t))(q0||{});const vf=t=>{const n=t.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return n?n[1]:void 0},$v=t=>t.replace(/\.[^.]*$/,""),Y0=()=>"object"!=typeof window,eA=()=>!Y0()&&/iPhone|iPod|iPad/gi.test(window.navigator.userAgent),Ks="8.48.0",Dr=globalThis;function r0(t,n,e){const r=Dr,i=r.__SENTRY__=r.__SENTRY__||{},o=i[Ks]=i[Ks]||{};return o[t]||(o[t]=n())}const K0=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,tA="Sentry Logger ",w0=["debug","info","warn","error","log","assert","trace"],x0={};function nA(t){if(!("console"in Dr))return t();const n=Dr.console,e={},r=Object.keys(x0);r.forEach((t=>{const r=x0[t];e[t]=n[t],n[t]=r}));try{return t()}finally{r.forEach((t=>{n[t]=e[t]}))}}function rA(){let t=!1;const n={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return K0?w0.forEach((e=>{n[e]=(...n)=>{t&&nA((()=>{Dr.console[e](`${tA}[${e}]:`,...n)}))}})):w0.forEach((t=>{n[t]=()=>{}})),n}const pf=r0("logger",rA);function i0(){return u0(Dr),Dr}function u0(t){const n=t.__SENTRY__=t.__SENTRY__||{};return n.version=n.version||Ks,n[Ks]=n[Ks]||{}}const iA=Object.prototype.toString;function uA(t,n){return iA.call(t)===`[object ${n}]`}function oA(t){return uA(t,"Object")}function aA(t){return!(!t||!t.then||"function"!=typeof t.then)}function sA(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch{K0&&pf.log(`Failed to add non-enumerable property "${n}" to object`,t)}}const G0=1e3;function Z0(){return Date.now()/G0}function cA(){const{performance:t}=Dr;if(!t||!t.now)return Z0;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/G0}const lA=cA();function Ho(){const t=Dr,n=t.crypto||t.msCrypto;let e=()=>16*Math.random();try{if(n&&n.randomUUID)return n.randomUUID().replace(/-/g,"");n&&n.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return n.getRandomValues(t),t[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(t=>(t^(15&e())>>t/4).toString(16)))}function fA(t,n={}){if(n.user&&(!t.ipAddress&&n.user.ip_address&&(t.ipAddress=n.user.ip_address),!t.did&&!n.did&&(t.did=n.user.id||n.user.email||n.user.username)),t.timestamp=n.timestamp||lA(),n.abnormal_mechanism&&(t.abnormal_mechanism=n.abnormal_mechanism),n.ignoreDuration&&(t.ignoreDuration=n.ignoreDuration),n.sid&&(t.sid=32===n.sid.length?n.sid:Ho()),void 0!==n.init&&(t.init=n.init),!t.did&&n.did&&(t.did=`${n.did}`),"number"==typeof n.started&&(t.started=n.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof n.duration)t.duration=n.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}n.release&&(t.release=n.release),n.environment&&(t.environment=n.environment),!t.ipAddress&&n.ipAddress&&(t.ipAddress=n.ipAddress),!t.userAgent&&n.userAgent&&(t.userAgent=n.userAgent),"number"==typeof n.errors&&(t.errors=n.errors),n.status&&(t.status=n.status)}function b0(){return Ho()}function S0(){return Ho().substring(16)}function J0(t,n,e=2){if(!n||"object"!=typeof n||e<=0)return n;if(t&&n&&0===Object.keys(n).length)return t;const r={...t};for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=J0(r[t],n[t],e-1));return r}(()=>{const{performance:t}=Dr;if(!t||!t.now)return;const n=36e5,e=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+e-r):n,o=i<n,u=t.timing&&t.timing.navigationStart,a="number"==typeof u?Math.abs(u+e-r):n;(o||a<n)&&(i<=a&&t.timeOrigin)})();const t0="_sentrySpan";function _0(t,n){n?sA(t,t0,n):delete t[t0]}function T0(t){return t[t0]}const hA=100;class o0{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:b0(),spanId:S0()}}clone(){const t=new o0;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,_0(t,T0(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&fA(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this._tags={...this._tags,[t]:n},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return null===n?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const n="function"==typeof t?t(this):t,[e,r]=n instanceof Gs?[n.getScopeData(),n.getRequestSession()]:oA(n)?[t,t.requestSession]:[],{tags:i,extra:o,user:u,contexts:a,level:s,fingerprint:c=[],propagationContext:l}=e||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...o},this._contexts={...this._contexts,...a},u&&Object.keys(u).length&&(this._user=u),s&&(this._level=s),c.length&&(this._fingerprint=c),l&&(this._propagationContext=l),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,_0(this,void 0),this._attachments=[],this.setPropagationContext({traceId:b0()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:hA;if(e<=0)return this;const r={timestamp:Z0(),...t},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>e?i.slice(-e):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),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:T0(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=J0(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext={spanId:S0(),...t},this}getPropagationContext(){return this._propagationContext}captureException(t,n){const e=n&&n.event_id?n.event_id:Ho();if(!this._client)return pf.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e&&e.event_id?e.event_id:Ho();if(!this._client)return pf.warn("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:i,...e,event_id:r},this),r}captureEvent(t,n){const e=n&&n.event_id?n.event_id:Ho();return this._client?(this._client.captureEvent(t,{...n,event_id:e},this),e):(pf.warn("No client configured on scope - will not capture event!"),e)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((t=>{t(this)})),this._notifyingListeners=!1)}}const Gs=o0;function pA(){return r0("defaultCurrentScope",(()=>new Gs))}function dA(){return r0("defaultIsolationScope",(()=>new Gs))}class gA{constructor(t,n){let e,r;e=t||new Gs,r=n||new Gs,this._stack=[{scope:e}],this._isolationScope=r}withScope(t){const n=this._pushScope();let e;try{e=t(n)}catch(t){throw this._popScope(),t}return aA(e)?e.then((t=>(this._popScope(),t)),(t=>{throw this._popScope(),t})):(this._popScope(),e)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function Yo(){const t=u0(i0());return t.stack=t.stack||new gA(pA(),dA())}function vA(t){return Yo().withScope(t)}function AA(t,n){const e=Yo();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function L0(t){return Yo().withScope((()=>t(Yo().getIsolationScope())))}function mA(){return{withIsolationScope:L0,withScope:vA,withSetScope:AA,withSetIsolationScope:(t,n)=>L0(n),getCurrentScope:()=>Yo().getScope(),getIsolationScope:()=>Yo().getIsolationScope()}}function V0(t){const n=u0(t);return n.acs?n.acs:mA()}function Q0(){return V0(i0()).getCurrentScope()}function yA(){return V0(i0()).getIsolationScope()}function wA(t,n){return Q0().captureException(t,void 0)}function xA(t,n){const e={captureContext:n};return Q0().captureMessage(t,void 0,e)}function bA(t,n){yA().setExtra(t,n)}const SA=(...t)=>{let n="";for(const e of t){if(e instanceof Error){const t=e;return bA("exceptionMessage",n),void wA(t)}if("object"!=typeof e)n+=e;else try{n+=" "+JSON.stringify(e)}catch{n+=" "+e}}xA(n)},_A="wlsy",$0=()=>{try{return window.localStorage}catch(t){console.warn("Error getting window.localStorage storage",t)}},TA=()=>{const t=new Set,n=$0();if(!n)return[];for(let e=0;e<(null==n?void 0:n.length);e+=1){const r=null==n?void 0:n.key(e);"string"==typeof r&&t.add(r)}return Array.from(t)},LA=t=>{const n=`${_A}`,e=t=>`${n}:${t}`,r=()=>TA().filter((t=>t.startsWith(`${n}:`))),i=t=>t.slice(n.length+1),o=$0(),u=t=>{try{return null==o?void 0:o.getItem(e(t))}catch{return null}},a=(t,n)=>{try{null==o||o.setItem(e(t),String(n))}catch{return}};return{getItem:u,setItem:a,removeItem:t=>{try{null==o||o.removeItem(e(t))}catch{return}},clear:()=>{try{r().forEach((t=>null==o?void 0:o.removeItem(t)))}catch{return}},keys:()=>r().map(i),has:t=>null!==u(t),getJSON:t=>{const n=u(t);if(null==n)return null;try{return JSON.parse(n)}catch{return null}},setJSON:(t,n)=>{try{a(t,JSON.stringify(n))}catch{return}}}},I0=["debug","info","warn","error"],IA=(t,n)=>{const e=I0.indexOf(t);return I0.indexOf(n)>=e},ff=(t,n,e,...r)=>{IA(n,t)&&console.log(`[${t}] ${e}`,...r)},CA=()=>LA().getItem("logger_lvl"),EA=(t=(Y0()?"info":CA()||"warn"))=>{let n=t;return{debug:(t,...e)=>ff("debug",n,t,...e),info:(t,...e)=>ff("info",n,t,...e),warn:(t,...e)=>ff("warn",n,t,...e),error:(t,...e)=>(SA(t,...e),ff("error",n,t,...e)),setLevel:t=>{n=t},getLevel:()=>n}},Af=EA(),ev=({src:t,name:n=""})=>new Promise(((e,r)=>{const i=document.createElement("video");i.src=t;const o=()=>{const{duration:t,videoHeight:o,videoWidth:u,src:a}=i,s=$v(n);(!t||!o||!u||!a)&&r(),e({src:a,name:s,width:u,height:o,duration:Math.floor(t)})},u=()=>{Af.warn("Failed to load video"),e(null)};return eA()&&i.load(),i.addEventListener("error",u),i.addEventListener("loadeddata",o),()=>{i.removeEventListener("error",u),i.removeEventListener("loadeddata",o)}})),a0=t=>new Promise(((n,e)=>{const r=new Image,i=URL.createObjectURL(t);r.onload=()=>{n({width:r.naturalWidth,height:r.naturalHeight}),URL.revokeObjectURL(i)},r.onerror=()=>{Af.warn("Failed to load image"),e(null),URL.revokeObjectURL(i)},r.src=i})),C0=t=>{if(!t)return;const n="number"==typeof t?t:parseInt(t,10);if(isNaN(n))throw new Error("Can not get number from income argument");const e=n/1048576;return`${Math.floor(e)} MB`},RA=t=>{if("object"!=typeof t||null===t)return!1;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n||null===Object.getPrototypeOf(t)},OA=t=>RA(t)&&"type"in t&&"string"==typeof t.type,le=t=>{const n=n=>({type:t,payload:n});return n.toString=()=>`${t}`,n.type=t,n.match=n=>OA(n)&&n.type===t,n};le("remoteReady"),le("askLogin"),le("reselectUser"),le("requestLogout"),le("setConfirmLeavePage"),le("requestChangePath"),le("wsSubscribe"),le("wsUnSubscribe"),le("hostStoreConnect"),le("remoteLogin"),le("remoteLogout"),le("wsOnMessage"),le("setRouterPath"),le("setDeviceType"),le("setUserError"),le("setUserIsError"),le("setUserPending"),le("setUserSuccess"),le("setUserData"),le("updateAccountData"),le("updateUser"),le("addNotification"),le("markNotification"),le("setNotificationsError"),le("setNotificationsList"),le("setNotificationsPending"),le("setNotificationsTotalCount"),le("setNotificationsUnreadCount"),le("resetNotificationsState"),le("undoNotification"),le("setInstanceInfo"),le("setInstanceInfoPending"),le("setInstanceInfoError");const PA=le("setPlatformSettings");le("setProfileSettings"),le("setGroupData"),le("setGroupLoading"),F0("requestMicroFrontendFetch"),F0("sendMicroFrontendFetchResponse");const MA={sms:"wellesley.admin.sms",auth:"wellesley.admin.auth",openai:"wellesley.admin.openai",uploads:"wellesley.admin.uploads",captcha:"wellesley.admin.captcha",language:"wellesley.admin.language",mediacache:"wellesley.admin.mediacache",translation:"wellesley.admin.translation",link_service:"wellesley.admin.link_service"},df={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"},Wr=t=>(null==t?void 0:t.map((t=>t.value||t)))||[],XA={data:null,isPending:!1},{posts:Vg,uploadsPolicyDoc:E0,uploadsPolicyAudio:Qg,uploadsPolicyImage:hf,uploadsPolicyVideo:Bs,registration:NA,captcha:WA,instanceAdmin:DA,branding:UA,translation:zA,access:kA}=df,{captcha:FA,language:BA,translation:jA,openai:HA,link_service:qA}=MA,Go=t=>t.data,YA=Ti(Go,(t=>{var n,e,r;return{max_characters:(null==(n=null==t?void 0:t[Vg])?void 0:n.max_characters)||0,max_media_attachments:(null==(e=null==t?void 0:t[Vg])?void 0:e.max_media_attachments)||0,max_pins:(null==(r=null==t?void 0:t[Vg])?void 0:r.max_pins)||0}})),s0=Ti(Go,(t=>{var n,e,r;return{...null==t?void 0:t[hf],maxSize:(null==(n=null==t?void 0:t[hf])?void 0:n.maxSize)||0,maxMatrix:(null==(e=null==t?void 0:t[hf])?void 0:e.maxMatrix)||0,maxResolution:(null==(r=null==t?void 0:t[hf])?void 0:r.maxResolution)||0}})),KA=Ti(s0,(t=>Wr(t.extensions))),tv=Ti(Go,(t=>{var n,e,r,i;return{...null==t?void 0:t[Bs],maxSize:(null==(n=null==t?void 0:t[Bs])?void 0:n.maxSize)||0,maxMatrix:(null==(e=null==t?void 0:t[Bs])?void 0:e.maxMatrix)||0,maxDuration:(null==(r=null==t?void 0:t[Bs])?void 0:r.maxDuration)||0,maxResolution:(null==(i=null==t?void 0:t[Bs])?void 0:i.maxResolution)||0}})),nv=Ti(Go,(t=>{var n,e;return{...null==t?void 0:t[Qg],maxSize:null==(n=null==t?void 0:t[Qg])?void 0:n.maxSize,keepOriginal:(null==(e=null==t?void 0:t[Qg])?void 0:e.keepOriginal)||0}})),rv=Ti(Go,(t=>{var n;return{...null==t?void 0:t[E0],maxSize:(null==(n=null==t?void 0:t[E0])?void 0:n.maxSize)||0}})),iv=Ti([s0,tv,nv,rv],((t,n,e,r)=>({IMAGE:Wr(null==t?void 0:t.extensions),VIDEO:Wr(null==n?void 0:n.extensions),AUDIO:Wr(null==e?void 0:e.extensions),DOCUMENT:Wr(null==r?void 0:r.extensions)}))),GA=Ti(iv,(t=>Object.keys(t).reduce(((n,e)=>[...n,...t[e]||[]]),[]))),Si=B0({name:"platformSettings",initialState:XA,reducers:{setError:(t,n)=>{t.error=n.payload},setPending:(t,n)=>{t.isPending=n.payload}},extraReducers:t=>{t.addCase(PA,((t,{payload:n})=>{t.data={...t.data,...n}}))},selectors:{selectSettings:Go,selectPostConfig:YA,selectDocPolicy:rv,selectImagePolicy:s0,selectVideoPolicy:tv,selectAudioPolicy:nv,selectImageExtensions:KA,selectSupportedExtensions:iv,selectFullExtensionsList:GA,selectRegistration:t=>{var n;return null==(n=t.data)?void 0:n[NA]},selectLanguageDetection:t=>{var n;return null==(n=t.data)?void 0:n[BA]},selectLanguageTranslation:t=>{var n;return null==(n=t.data)?void 0:n[jA]},selectOpenai:t=>{var n;return null==(n=t.data)?void 0:n[HA]},selectCaptcha:t=>{var n;return null==(n=t.data)?void 0:n[WA]},selectAdminCaptcha:t=>{var n;return null==(n=t.data)?void 0:n[FA]},selectPlatformTranslation:t=>{var n;return null==(n=t.data)?void 0:n[zA]},selectAccess:t=>{var n;return null==(n=t.data)?void 0:n[kA]},selectBranding:t=>{var n;return null==(n=t.data)?void 0:n[UA]},selectLinkService:t=>{var n;return null==(n=t.data)?void 0:n[qA]},selectInstanceAdmin:t=>{var n;return null==(n=t.data)?void 0:n[DA]},selectLegal:t=>{var n;return null==(n=t.data)?void 0:n[df.legal]},selectDomainBlocks:t=>{var n;return null==(n=t.data)?void 0:n[df.domainBlocks]},selectContacts:t=>{var n;return null==(n=t.data)?void 0:n[df.contacts]}}}),ZA=async({media:t,docPolicy:n,imgPolicy:e,videoPolicy:r,audioPolicy:i})=>{if(!e||!r)return"Media policy is not defined";const o={IMAGE:Wr(e.extensions),VIDEO:Wr(r.extensions),AUDIO:Wr(i.extensions),DOCUMENT:Wr(n.extensions)},u=vf(t.file.name)||"",a=Object.keys(o).find((t=>{var n;return null==(n=o[t])?void 0:n.includes(u)}));if(!a)return`Extension ${u} is not supported`;const s="VIDEO"===a;if("IMAGE"===a){const n=await a0(t.file),r=t.file.size>e.maxSize,i=n&&Math.max(n.width,n.height)>e.maxResolution,o=n&&n.width*n.height>e.maxMatrix;switch(!0){case r:return`Image is too big. Max size is ${C0(e.maxSize)}`;case i:return`Image resolution is too high. Max resolution is ${e.maxResolution} pixels`;case o: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 ${e.maxMatrix} pixels`}}if(s){const n=await ev({src:t.objectUrl}),e=n&&n.duration>r.maxDuration,i=n&&Math.max(n.width,n.height)>r.maxResolution,o=t.file.size>r.maxSize,u=n&&n.width*n.height>r.maxMatrix;switch(!0){case e:return`Video is too long. Max duration is ${r.maxDuration} seconds`;case o:return`Video is too big. Max size is ${C0(r.maxSize)}`;case i:return`Video resolution is too high. Max resolution is ${r.maxResolution} pixels`;case u: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 ${r.maxMatrix} pixels`}}},uv=()=>{const[t]=gv(),n=new AbortController,e=n.signal,r=Nr(Si.selectors.selectImagePolicy),i=Nr(Si.selectors.selectVideoPolicy),o=Nr(Si.selectors.selectDocPolicy),u=Nr(Si.selectors.selectAudioPolicy);return[async({media:n,tag:a,onError:s,onUpload:c,onProgress:l})=>{var f;const h=vf(n.file.name),p=await ZA({imgPolicy:r,docPolicy:o,videoPolicy:i,audioPolicy:u,media:n});if(p)return hu.error(p),void(null==s||s());try{const r=await t({createUpload:{extension:h,tags:[a],meta:{name:n.file.name}}});if("error"in r)throw new Error(r.error);const i=null==(f=r.data)?void 0:f.uri;return await new Promise(((t,r)=>{const o=new XMLHttpRequest;o.open("PUT",i),e&&e.addEventListener("abort",(()=>{try{o.abort()}catch(t){Af.warn("Cancel upload failed",t)}})),o.upload.onprogress=t=>{if(!t.lengthComputable)return;const n=Math.round(t.loaded/t.total*100);null==l||l(t.loaded,t.total,n)},o.onerror=()=>r(new Error("Upload failed")),o.onload=()=>{o.status>=200&&o.status<300?t():r(new Error(o.statusText))},o.send(n.file)})),null==c||c(),r.data.upload.uploadId}catch(t){null==s||s(t),hu.error(`Could not upload file. ${String(t)}`)}},()=>n.abort("Upload canceled")]};var R0,Hs={exports:{}},JA=Hs.exports;
42
+ */var Ys=(t=>(t.done="done",t.inprogress="inprogress",t))(Ys||{}),q0=(t=>(t.post="$post",t.album="$album",t.avatar="$avatar",t.header="$header",t.emoji="$emoji",t))(q0||{});const vf=t=>{const n=t.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return n?n[1]:void 0},$v=t=>t.replace(/\.[^.]*$/,""),Y0=()=>"object"!=typeof window,eA=()=>!Y0()&&/iPhone|iPod|iPad/gi.test(window.navigator.userAgent),Ks="8.48.0",Dr=globalThis;function r0(t,n,e){const r=Dr,i=r.__SENTRY__=r.__SENTRY__||{},o=i[Ks]=i[Ks]||{};return o[t]||(o[t]=n())}const K0=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,tA="Sentry Logger ",w0=["debug","info","warn","error","log","assert","trace"],x0={};function nA(t){if(!("console"in Dr))return t();const n=Dr.console,e={},r=Object.keys(x0);r.forEach((t=>{const r=x0[t];e[t]=n[t],n[t]=r}));try{return t()}finally{r.forEach((t=>{n[t]=e[t]}))}}function rA(){let t=!1;const n={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return K0?w0.forEach((e=>{n[e]=(...n)=>{t&&nA((()=>{Dr.console[e](`${tA}[${e}]:`,...n)}))}})):w0.forEach((t=>{n[t]=()=>{}})),n}const pf=r0("logger",rA);function i0(){return u0(Dr),Dr}function u0(t){const n=t.__SENTRY__=t.__SENTRY__||{};return n.version=n.version||Ks,n[Ks]=n[Ks]||{}}const iA=Object.prototype.toString;function uA(t,n){return iA.call(t)===`[object ${n}]`}function oA(t){return uA(t,"Object")}function aA(t){return!(!t||!t.then||"function"!=typeof t.then)}function sA(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch{K0&&pf.log(`Failed to add non-enumerable property "${n}" to object`,t)}}const G0=1e3;function Z0(){return Date.now()/G0}function cA(){const{performance:t}=Dr;if(!t||!t.now)return Z0;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/G0}const lA=cA();function Ho(){const t=Dr,n=t.crypto||t.msCrypto;let e=()=>16*Math.random();try{if(n&&n.randomUUID)return n.randomUUID().replace(/-/g,"");n&&n.getRandomValues&&(e=()=>{const t=new Uint8Array(1);return n.getRandomValues(t),t[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,(t=>(t^(15&e())>>t/4).toString(16)))}function fA(t,n={}){if(n.user&&(!t.ipAddress&&n.user.ip_address&&(t.ipAddress=n.user.ip_address),!t.did&&!n.did&&(t.did=n.user.id||n.user.email||n.user.username)),t.timestamp=n.timestamp||lA(),n.abnormal_mechanism&&(t.abnormal_mechanism=n.abnormal_mechanism),n.ignoreDuration&&(t.ignoreDuration=n.ignoreDuration),n.sid&&(t.sid=32===n.sid.length?n.sid:Ho()),void 0!==n.init&&(t.init=n.init),!t.did&&n.did&&(t.did=`${n.did}`),"number"==typeof n.started&&(t.started=n.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof n.duration)t.duration=n.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}n.release&&(t.release=n.release),n.environment&&(t.environment=n.environment),!t.ipAddress&&n.ipAddress&&(t.ipAddress=n.ipAddress),!t.userAgent&&n.userAgent&&(t.userAgent=n.userAgent),"number"==typeof n.errors&&(t.errors=n.errors),n.status&&(t.status=n.status)}function b0(){return Ho()}function S0(){return Ho().substring(16)}function J0(t,n,e=2){if(!n||"object"!=typeof n||e<=0)return n;if(t&&n&&0===Object.keys(n).length)return t;const r={...t};for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=J0(r[t],n[t],e-1));return r}(()=>{const{performance:t}=Dr;if(!t||!t.now)return;const n=36e5,e=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+e-r):n,o=i<n,u=t.timing&&t.timing.navigationStart,a="number"==typeof u?Math.abs(u+e-r):n;(o||a<n)&&(i<=a&&t.timeOrigin)})();const t0="_sentrySpan";function _0(t,n){n?sA(t,t0,n):delete t[t0]}function T0(t){return t[t0]}const hA=100;class o0{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:b0(),spanId:S0()}}clone(){const t=new o0;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,_0(t,T0(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&fA(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,n){return this._tags={...this._tags,[t]:n},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,n){return this._extra={...this._extra,[t]:n},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,n){return null===n?delete this._contexts[t]:this._contexts[t]=n,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const n="function"==typeof t?t(this):t,[e,r]=n instanceof Gs?[n.getScopeData(),n.getRequestSession()]:oA(n)?[t,t.requestSession]:[],{tags:i,extra:o,user:u,contexts:a,level:s,fingerprint:c=[],propagationContext:l}=e||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...o},this._contexts={...this._contexts,...a},u&&Object.keys(u).length&&(this._user=u),s&&(this._level=s),c.length&&(this._fingerprint=c),l&&(this._propagationContext=l),r&&(this._requestSession=r),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,_0(this,void 0),this._attachments=[],this.setPropagationContext({traceId:b0()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){const e="number"==typeof n?n:hA;if(e<=0)return this;const r={timestamp:Z0(),...t},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>e?i.slice(-e):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),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:T0(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=J0(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext={spanId:S0(),...t},this}getPropagationContext(){return this._propagationContext}captureException(t,n){const e=n&&n.event_id?n.event_id:Ho();if(!this._client)return pf.warn("No client configured on scope - will not capture exception!"),e;const r=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:r,...n,event_id:e},this),e}captureMessage(t,n,e){const r=e&&e.event_id?e.event_id:Ho();if(!this._client)return pf.warn("No client configured on scope - will not capture message!"),r;const i=new Error(t);return this._client.captureMessage(t,n,{originalException:t,syntheticException:i,...e,event_id:r},this),r}captureEvent(t,n){const e=n&&n.event_id?n.event_id:Ho();return this._client?(this._client.captureEvent(t,{...n,event_id:e},this),e):(pf.warn("No client configured on scope - will not capture event!"),e)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((t=>{t(this)})),this._notifyingListeners=!1)}}const Gs=o0;function pA(){return r0("defaultCurrentScope",(()=>new Gs))}function dA(){return r0("defaultIsolationScope",(()=>new Gs))}class gA{constructor(t,n){let e,r;e=t||new Gs,r=n||new Gs,this._stack=[{scope:e}],this._isolationScope=r}withScope(t){const n=this._pushScope();let e;try{e=t(n)}catch(t){throw this._popScope(),t}return aA(e)?e.then((t=>(this._popScope(),t)),(t=>{throw this._popScope(),t})):(this._popScope(),e)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return!(this._stack.length<=1)&&!!this._stack.pop()}}function Yo(){const t=u0(i0());return t.stack=t.stack||new gA(pA(),dA())}function vA(t){return Yo().withScope(t)}function AA(t,n){const e=Yo();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function L0(t){return Yo().withScope((()=>t(Yo().getIsolationScope())))}function mA(){return{withIsolationScope:L0,withScope:vA,withSetScope:AA,withSetIsolationScope:(t,n)=>L0(n),getCurrentScope:()=>Yo().getScope(),getIsolationScope:()=>Yo().getIsolationScope()}}function V0(t){const n=u0(t);return n.acs?n.acs:mA()}function Q0(){return V0(i0()).getCurrentScope()}function yA(){return V0(i0()).getIsolationScope()}function wA(t,n){return Q0().captureException(t,void 0)}function xA(t,n){const e={captureContext:n};return Q0().captureMessage(t,void 0,e)}function bA(t,n){yA().setExtra(t,n)}const SA=(...t)=>{let n="";for(const e of t){if(e instanceof Error){const t=e;return bA("exceptionMessage",n),void wA(t)}if("object"!=typeof e)n+=e;else try{n+=" "+JSON.stringify(e)}catch{n+=" "+e}}xA(n)},_A="wlsy",$0=()=>{try{return window.localStorage}catch(t){console.warn("Error getting window.localStorage storage",t)}},TA=()=>{const t=new Set,n=$0();if(!n)return[];for(let e=0;e<(null==n?void 0:n.length);e+=1){const r=null==n?void 0:n.key(e);"string"==typeof r&&t.add(r)}return Array.from(t)},LA=t=>{const n=`${_A}`,e=t=>`${n}:${t}`,r=()=>TA().filter((t=>t.startsWith(`${n}:`))),i=t=>t.slice(n.length+1),o=$0(),u=t=>{try{return null==o?void 0:o.getItem(e(t))}catch{return null}},a=(t,n)=>{try{null==o||o.setItem(e(t),String(n))}catch{return}};return{getItem:u,setItem:a,removeItem:t=>{try{null==o||o.removeItem(e(t))}catch{return}},clear:()=>{try{r().forEach((t=>null==o?void 0:o.removeItem(t)))}catch{return}},keys:()=>r().map(i),has:t=>null!==u(t),getJSON:t=>{const n=u(t);if(null==n)return null;try{return JSON.parse(n)}catch{return null}},setJSON:(t,n)=>{try{a(t,JSON.stringify(n))}catch{return}}}},I0=["debug","info","warn","error"],IA=(t,n)=>{const e=I0.indexOf(t);return I0.indexOf(n)>=e},ff=(t,n,e,...r)=>{IA(n,t)&&console.log(`[${t}] ${e}`,...r)},CA=()=>LA().getItem("logger_lvl"),EA=(t=(Y0()?"info":CA()||"warn"))=>{let n=t;return{debug:(t,...e)=>ff("debug",n,t,...e),info:(t,...e)=>ff("info",n,t,...e),warn:(t,...e)=>ff("warn",n,t,...e),error:(t,...e)=>(SA(t,...e),ff("error",n,t,...e)),setLevel:t=>{n=t},getLevel:()=>n}},Af=EA(),ev=({src:t,name:n=""})=>new Promise(((e,r)=>{const i=document.createElement("video");i.src=t;const o=()=>{const{duration:t,videoHeight:o,videoWidth:u,src:a}=i,s=$v(n);(!t||!o||!u||!a)&&r(),e({src:a,name:s,width:u,height:o,duration:Math.floor(t)})},u=()=>{Af.warn("Failed to load video"),e(null)};return eA()&&i.load(),i.addEventListener("error",u),i.addEventListener("loadeddata",o),()=>{i.removeEventListener("error",u),i.removeEventListener("loadeddata",o)}})),a0=t=>new Promise(((n,e)=>{const r=new Image,i=URL.createObjectURL(t);r.onload=()=>{n({width:r.naturalWidth,height:r.naturalHeight}),URL.revokeObjectURL(i)},r.onerror=()=>{Af.warn("Failed to load image"),e(null),URL.revokeObjectURL(i)},r.src=i})),C0=t=>{if(!t)return;const n="number"==typeof t?t:parseInt(t,10);if(isNaN(n))throw new Error("Can not get number from income argument");const e=n/1048576;return`${Math.floor(e)} MB`},RA=t=>{if("object"!=typeof t||null===t)return!1;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n||null===Object.getPrototypeOf(t)},OA=t=>RA(t)&&"type"in t&&"string"==typeof t.type,le=t=>{const n=n=>({type:t,payload:n});return n.toString=()=>`${t}`,n.type=t,n.match=n=>OA(n)&&n.type===t,n};le("remoteReady"),le("askLogin"),le("reselectUser"),le("requestLogout"),le("setConfirmLeavePage"),le("requestChangePath"),le("wsSubscribe"),le("wsUnSubscribe"),le("hostStoreConnect"),le("remoteLogin"),le("remoteLogout"),le("wsOnMessage"),le("setRouterPath"),le("setDeviceType"),le("setDeviceWidth"),le("setUserError"),le("setUserIsError"),le("setUserPending"),le("setUserSuccess"),le("setUserData"),le("updateAccountData"),le("updateUser"),le("addNotification"),le("markNotification"),le("setNotificationsError"),le("setNotificationsList"),le("setNotificationsPending"),le("setNotificationsTotalCount"),le("setNotificationsUnreadCount"),le("resetNotificationsState"),le("undoNotification"),le("setInstanceInfo"),le("setInstanceInfoPending"),le("setInstanceInfoError");const PA=le("setPlatformSettings");le("setProfileSettings"),le("setGroupData"),le("setGroupLoading"),F0("requestMicroFrontendFetch"),F0("sendMicroFrontendFetchResponse");const MA={sms:"wellesley.admin.sms",auth:"wellesley.admin.auth",openai:"wellesley.admin.openai",uploads:"wellesley.admin.uploads",captcha:"wellesley.admin.captcha",language:"wellesley.admin.language",mediacache:"wellesley.admin.mediacache",translation:"wellesley.admin.translation",link_service:"wellesley.admin.link_service"},df={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"},Wr=t=>(null==t?void 0:t.map((t=>t.value||t)))||[],XA={data:null,isPending:!1},{posts:Vg,uploadsPolicyDoc:E0,uploadsPolicyAudio:Qg,uploadsPolicyImage:hf,uploadsPolicyVideo:Bs,registration:NA,captcha:WA,instanceAdmin:DA,branding:UA,translation:zA,access:kA}=df,{captcha:FA,language:BA,translation:jA,openai:HA,link_service:qA}=MA,Go=t=>t.data,YA=Ti(Go,(t=>{var n,e,r;return{max_characters:(null==(n=null==t?void 0:t[Vg])?void 0:n.max_characters)||0,max_media_attachments:(null==(e=null==t?void 0:t[Vg])?void 0:e.max_media_attachments)||0,max_pins:(null==(r=null==t?void 0:t[Vg])?void 0:r.max_pins)||0}})),s0=Ti(Go,(t=>{var n,e,r;return{...null==t?void 0:t[hf],maxSize:(null==(n=null==t?void 0:t[hf])?void 0:n.maxSize)||0,maxMatrix:(null==(e=null==t?void 0:t[hf])?void 0:e.maxMatrix)||0,maxResolution:(null==(r=null==t?void 0:t[hf])?void 0:r.maxResolution)||0}})),KA=Ti(s0,(t=>Wr(t.extensions))),tv=Ti(Go,(t=>{var n,e,r,i;return{...null==t?void 0:t[Bs],maxSize:(null==(n=null==t?void 0:t[Bs])?void 0:n.maxSize)||0,maxMatrix:(null==(e=null==t?void 0:t[Bs])?void 0:e.maxMatrix)||0,maxDuration:(null==(r=null==t?void 0:t[Bs])?void 0:r.maxDuration)||0,maxResolution:(null==(i=null==t?void 0:t[Bs])?void 0:i.maxResolution)||0}})),nv=Ti(Go,(t=>{var n,e;return{...null==t?void 0:t[Qg],maxSize:null==(n=null==t?void 0:t[Qg])?void 0:n.maxSize,keepOriginal:(null==(e=null==t?void 0:t[Qg])?void 0:e.keepOriginal)||0}})),rv=Ti(Go,(t=>{var n;return{...null==t?void 0:t[E0],maxSize:(null==(n=null==t?void 0:t[E0])?void 0:n.maxSize)||0}})),iv=Ti([s0,tv,nv,rv],((t,n,e,r)=>({IMAGE:Wr(null==t?void 0:t.extensions),VIDEO:Wr(null==n?void 0:n.extensions),AUDIO:Wr(null==e?void 0:e.extensions),DOCUMENT:Wr(null==r?void 0:r.extensions)}))),GA=Ti(iv,(t=>Object.keys(t).reduce(((n,e)=>[...n,...t[e]||[]]),[]))),Si=B0({name:"platformSettings",initialState:XA,reducers:{setError:(t,n)=>{t.error=n.payload},setPending:(t,n)=>{t.isPending=n.payload}},extraReducers:t=>{t.addCase(PA,((t,{payload:n})=>{t.data={...t.data,...n}}))},selectors:{selectSettings:Go,selectPostConfig:YA,selectDocPolicy:rv,selectImagePolicy:s0,selectVideoPolicy:tv,selectAudioPolicy:nv,selectImageExtensions:KA,selectSupportedExtensions:iv,selectFullExtensionsList:GA,selectRegistration:t=>{var n;return null==(n=t.data)?void 0:n[NA]},selectLanguageDetection:t=>{var n;return null==(n=t.data)?void 0:n[BA]},selectLanguageTranslation:t=>{var n;return null==(n=t.data)?void 0:n[jA]},selectOpenai:t=>{var n;return null==(n=t.data)?void 0:n[HA]},selectCaptcha:t=>{var n;return null==(n=t.data)?void 0:n[WA]},selectAdminCaptcha:t=>{var n;return null==(n=t.data)?void 0:n[FA]},selectPlatformTranslation:t=>{var n;return null==(n=t.data)?void 0:n[zA]},selectAccess:t=>{var n;return null==(n=t.data)?void 0:n[kA]},selectBranding:t=>{var n;return null==(n=t.data)?void 0:n[UA]},selectLinkService:t=>{var n;return null==(n=t.data)?void 0:n[qA]},selectInstanceAdmin:t=>{var n;return null==(n=t.data)?void 0:n[DA]},selectLegal:t=>{var n;return null==(n=t.data)?void 0:n[df.legal]},selectDomainBlocks:t=>{var n;return null==(n=t.data)?void 0:n[df.domainBlocks]},selectContacts:t=>{var n;return null==(n=t.data)?void 0:n[df.contacts]}}}),ZA=async({media:t,docPolicy:n,imgPolicy:e,videoPolicy:r,audioPolicy:i})=>{if(!e||!r)return"Media policy is not defined";const o={IMAGE:Wr(e.extensions),VIDEO:Wr(r.extensions),AUDIO:Wr(i.extensions),DOCUMENT:Wr(n.extensions)},u=vf(t.file.name)||"",a=Object.keys(o).find((t=>{var n;return null==(n=o[t])?void 0:n.includes(u)}));if(!a)return`Extension ${u} is not supported`;const s="VIDEO"===a;if("IMAGE"===a){const n=await a0(t.file),r=t.file.size>e.maxSize,i=n&&Math.max(n.width,n.height)>e.maxResolution,o=n&&n.width*n.height>e.maxMatrix;switch(!0){case r:return`Image is too big. Max size is ${C0(e.maxSize)}`;case i:return`Image resolution is too high. Max resolution is ${e.maxResolution} pixels`;case o: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 ${e.maxMatrix} pixels`}}if(s){const n=await ev({src:t.objectUrl}),e=n&&n.duration>r.maxDuration,i=n&&Math.max(n.width,n.height)>r.maxResolution,o=t.file.size>r.maxSize,u=n&&n.width*n.height>r.maxMatrix;switch(!0){case e:return`Video is too long. Max duration is ${r.maxDuration} seconds`;case o:return`Video is too big. Max size is ${C0(r.maxSize)}`;case i:return`Video resolution is too high. Max resolution is ${r.maxResolution} pixels`;case u: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 ${r.maxMatrix} pixels`}}},uv=()=>{const[t]=gv(),n=new AbortController,e=n.signal,r=Nr(Si.selectors.selectImagePolicy),i=Nr(Si.selectors.selectVideoPolicy),o=Nr(Si.selectors.selectDocPolicy),u=Nr(Si.selectors.selectAudioPolicy);return[async({media:n,tag:a,onError:s,onUpload:c,onProgress:l})=>{var f;const h=vf(n.file.name),p=await ZA({imgPolicy:r,docPolicy:o,videoPolicy:i,audioPolicy:u,media:n});if(p)return hu.error(p),void(null==s||s());try{const r=await t({createUpload:{extension:h,tags:[a],meta:{name:n.file.name}}});if("error"in r)throw new Error(r.error);const i=null==(f=r.data)?void 0:f.uri;return await new Promise(((t,r)=>{const o=new XMLHttpRequest;o.open("PUT",i),e&&e.addEventListener("abort",(()=>{try{o.abort()}catch(t){Af.warn("Cancel upload failed",t)}})),o.upload.onprogress=t=>{if(!t.lengthComputable)return;const n=Math.round(t.loaded/t.total*100);null==l||l(t.loaded,t.total,n)},o.onerror=()=>r(new Error("Upload failed")),o.onload=()=>{o.status>=200&&o.status<300?t():r(new Error(o.statusText))},o.send(n.file)})),null==c||c(),r.data.upload.uploadId}catch(t){null==s||s(t),hu.error(`Could not upload file. ${String(t)}`)}},()=>n.abort("Upload canceled")]};var R0,Hs={exports:{}},JA=Hs.exports;
43
43
  /**
44
44
  * @license
45
45
  * Lodash <https://lodash.com/>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@wellesley/uploads",
3
3
  "license": "UNLICENSED",
4
4
  "main": "index.mjs",
5
- "version": "1.0.577",
5
+ "version": "1.0.579",
6
6
  "module": "index.ts",
7
7
  "files": [
8
8
  "*",