@wellesley/uploads 1.0.565 → 1.0.567
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +2 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{api as pv,usePostApiV1UploadsMutation as dv,useDeleteApiV1UploadsByIdMutation as gv,usePostApiV1UploadsByIdMetaMutation as vv,useGetApiV1UploadsByIdQuery as Av}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.
|
|
1
|
+
import{api as pv,usePostApiV1UploadsMutation as dv,useDeleteApiV1UploadsByIdMutation as gv,usePostApiV1UploadsByIdMetaMutation as vv,useGetApiV1UploadsByIdQuery as Av}from"https://cdn.jsdelivr.net/npm/@wellesley/openapi@1.0.682";import Re,{forwardRef as n0,createElement as e0,useRef as tr,useState as ft,useEffect as _i,PureComponent as mv,createRef as f0,useCallback as qs,useLayoutEffect as yv,useMemo as l0}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.26";import{useSelector as Nr,useDispatch as wv}from"https://cdn.jsdelivr.net/npm/react-redux@9.1.0/+esm";import{createAction as k0,createSelector as Ti,createSlice as F0}from"https://cdn.jsdelivr.net/npm/@reduxjs/toolkit@2.2.1/+esm";import{useIsMobile as xv,cn as qo,Dialog as bv,DialogContent as Sv,ButtonLoader as h0,Button as jg,TooltipWrapper as B0}from"https://cdn.jsdelivr.net/npm/@wellesley/ui@1.0.644";import{rootReducer as _v}from"https://cdn.jsdelivr.net/npm/@wellesley/store@1.0.681";var p0,bi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},js={exports:{}},Tv=js.exports;
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Lodash <https://lodash.com/>
|
|
@@ -39,7 +39,7 @@ import{api as pv,usePostApiV1UploadsMutation as dv,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||{}),H0=(t=>(t.post="$post",t.album="$album",t.avatar="$avatar",t.header="$header",t.emoji="$emoji",t))(H0||{});const vl=t=>{const n=t.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return n?n[1]:void 0},Qv=t=>t.replace(/\.[^.]*$/,""),q0=()=>"object"!=typeof window,$v=()=>!q0()&&/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 Y0=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,eA="Sentry Logger ",w0=["debug","info","warn","error","log","assert","trace"],x0={};function tA(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 nA(){let t=!1;const n={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return Y0?w0.forEach((e=>{n[e]=(...n)=>{t&&tA((()=>{Dr.console[e](`${eA}[${e}]:`,...n)}))}})):w0.forEach((t=>{n[t]=()=>{}})),n}const pl=r0("logger",nA);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 rA=Object.prototype.toString;function iA(t,n){return rA.call(t)===`[object ${n}]`}function uA(t){return iA(t,"Object")}function oA(t){return!(!t||!t.then||"function"!=typeof t.then)}function aA(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch{Y0&&pl.log(`Failed to add non-enumerable property "${n}" to object`,t)}}const K0=1e3;function G0(){return Date.now()/K0}function sA(){const{performance:t}=Dr;if(!t||!t.now)return G0;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/K0}const cA=sA();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||cA(),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 Z0(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]=Z0(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?aA(t,t0,n):delete t[t0]}function T0(t){return t[t0]}const lA=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()]:uA(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:lA;if(e<=0)return this;const r={timestamp:G0(),...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=Z0(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 pl.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 pl.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):(pl.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 hA(){return r0("defaultCurrentScope",(()=>new Gs))}function pA(){return r0("defaultIsolationScope",(()=>new Gs))}class dA{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 oA(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 dA(hA(),pA())}function gA(t){return Yo().withScope(t)}function vA(t,n){const e=Yo();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function L0(t){return Yo().withScope((()=>t(Yo().getIsolationScope())))}function AA(){return{withIsolationScope:L0,withScope:gA,withSetScope:vA,withSetIsolationScope:(t,n)=>L0(n),getCurrentScope:()=>Yo().getScope(),getIsolationScope:()=>Yo().getIsolationScope()}}function J0(t){const n=u0(t);return n.acs?n.acs:AA()}function V0(){return J0(i0()).getCurrentScope()}function mA(){return J0(i0()).getIsolationScope()}function yA(t,n){return V0().captureException(t,void 0)}function wA(t,n){const e={captureContext:n};return V0().captureMessage(t,void 0,e)}function xA(t,n){mA().setExtra(t,n)}const bA=(...t)=>{let n="";for(const e of t){if(e instanceof Error){const t=e;return xA("exceptionMessage",n),void yA(t)}if("object"!=typeof e)n+=e;else try{n+=" "+JSON.stringify(e)}catch{n+=" "+e}}wA(n)},SA="wlsy",Q0=()=>{try{return window.localStorage}catch(t){console.warn("Error getting window.localStorage storage",t)}},_A=()=>{const t=new Set,n=Q0();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)},TA=t=>{const n=`${SA}`,e=t=>`${n}:${t}`,r=()=>_A().filter((t=>t.startsWith(`${n}:`))),i=t=>t.slice(n.length+1),o=Q0(),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"],LA=(t,n)=>{const e=I0.indexOf(t);return I0.indexOf(n)>=e},ll=(t,n,e,...r)=>{LA(n,t)&&console.log(`[${t}] ${e}`,...r)},IA=()=>TA().getItem("logger_lvl"),CA=(t=(q0()?"info":IA()||"warn"))=>{let n=t;return{debug:(t,...e)=>ll("debug",n,t,...e),info:(t,...e)=>ll("info",n,t,...e),warn:(t,...e)=>ll("warn",n,t,...e),error:(t,...e)=>(bA(t,...e),ll("error",n,t,...e)),setLevel:t=>{n=t},getLevel:()=>n}},Al=CA(),$0=({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=Qv(n);(!t||!o||!u||!a)&&r(),e({src:a,name:s,width:u,height:o,duration:Math.floor(t)})},u=()=>{Al.warn("Failed to load video"),e(null)};return $v()&&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=()=>{Al.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`},EA=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)},RA=t=>EA(t)&&"type"in t&&"string"==typeof t.type,fe=t=>{const n=n=>({type:t,payload:n});return n.toString=()=>`${t}`,n.type=t,n.match=n=>RA(n)&&n.type===t,n};fe("remoteReady"),fe("askLogin"),fe("reselectUser"),fe("requestLogout"),fe("setConfirmLeavePage"),fe("requestChangePath"),fe("wsSubscribe"),fe("wsUnSubscribe"),fe("hostStoreConnect"),fe("remoteLogin"),fe("remoteLogout"),fe("wsOnMessage"),fe("setRouterPath"),fe("setDeviceType"),fe("setUserError"),fe("setUserIsError"),fe("setUserPending"),fe("setUserSuccess"),fe("setUserData"),fe("updateAccountData"),fe("updateUser"),fe("addNotification"),fe("markNotification"),fe("setNotificationsError"),fe("setNotificationsList"),fe("setNotificationsPending"),fe("setNotificationsTotalCount"),fe("setNotificationsUnreadCount"),fe("resetNotificationsState"),fe("undoNotification"),fe("setInstanceInfo"),fe("setInstanceInfoPending"),fe("setInstanceInfoError");const OA=fe("setPlatformSettings");fe("setProfileSettings"),fe("setGroupData"),fe("setGroupLoading"),k0("requestMicroFrontendFetch"),k0("sendMicroFrontendFetchResponse");const PA={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"},dl={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||"")))||[],MA={data:null,isPending:!1},{posts:Vg,uploadsPolicyDoc:E0,uploadsPolicyAudio:Qg,uploadsPolicyImage:hl,uploadsPolicyVideo:Bs,registration:XA,captcha:NA,instanceAdmin:WA,branding:DA,translation:UA,access:zA}=dl,{captcha:kA,language:FA,translation:BA,openai:jA,link_service:HA}=PA,Go=t=>t.data,qA=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[hl],maxSize:(null==(n=null==t?void 0:t[hl])?void 0:n.maxSize)||0,maxMatrix:(null==(e=null==t?void 0:t[hl])?void 0:e.maxMatrix)||0,maxResolution:(null==(r=null==t?void 0:t[hl])?void 0:r.maxResolution)||0}})),YA=Ti(s0,(t=>Wr(t.extensions))),ev=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}})),tv=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}})),nv=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}})),rv=Ti([s0,ev,tv,nv],((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)}))),KA=Ti(rv,(t=>Object.keys(t).reduce(((n,e)=>[...n,...t[e]||[]]),[]))),Si=F0({name:"platformSettings",initialState:MA,reducers:{setError:(t,n)=>{t.error=n.payload},setPending:(t,n)=>{t.isPending=n.payload}},extraReducers:t=>{t.addCase(OA,((t,{payload:n})=>{t.data={...t.data,...n}}))},selectors:{selectSettings:Go,selectPostConfig:qA,selectDocPolicy:nv,selectImagePolicy:s0,selectVideoPolicy:ev,selectAudioPolicy:tv,selectImageExtensions:YA,selectSupportedExtensions:rv,selectFullExtensionsList:KA,selectRegistration:t=>{var n;return null==(n=t.data)?void 0:n[XA]},selectLanguageDetection:t=>{var n;return null==(n=t.data)?void 0:n[FA]},selectLanguageTranslation:t=>{var n;return null==(n=t.data)?void 0:n[BA]},selectOpenai:t=>{var n;return null==(n=t.data)?void 0:n[jA]},selectCaptcha:t=>{var n;return null==(n=t.data)?void 0:n[NA]},selectAdminCaptcha:t=>{var n;return null==(n=t.data)?void 0:n[kA]},selectPlatformTranslation:t=>{var n;return null==(n=t.data)?void 0:n[UA]},selectAccess:t=>{var n;return null==(n=t.data)?void 0:n[zA]},selectBranding:t=>{var n;return null==(n=t.data)?void 0:n[DA]},selectLinkService:t=>{var n;return null==(n=t.data)?void 0:n[HA]},selectInstanceAdmin:t=>{var n;return null==(n=t.data)?void 0:n[WA]},selectLegal:t=>{var n;return null==(n=t.data)?void 0:n[dl.legal]},selectDomainBlocks:t=>{var n;return null==(n=t.data)?void 0:n[dl.domainBlocks]},selectContacts:t=>{var n;return null==(n=t.data)?void 0:n[dl.contacts]}}}),GA=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=vl(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 $0({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`}}},iv=()=>{const[t]=dv(),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=vl(n.file.name),p=await GA({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){Al.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:{}},ZA=Hs.exports;
|
|
42
|
+
*/var Ys=(t=>(t.done="done",t.inprogress="inprogress",t))(Ys||{}),H0=(t=>(t.post="$post",t.album="$album",t.avatar="$avatar",t.header="$header",t.emoji="$emoji",t))(H0||{});const vl=t=>{const n=t.toLowerCase().match(/\.([a-zA-Z0-9]{2,4})(\?|$)+/);return n?n[1]:void 0},Qv=t=>t.replace(/\.[^.]*$/,""),q0=()=>"object"!=typeof window,$v=()=>!q0()&&/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 Y0=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,eA="Sentry Logger ",w0=["debug","info","warn","error","log","assert","trace"],x0={};function tA(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 nA(){let t=!1;const n={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return Y0?w0.forEach((e=>{n[e]=(...n)=>{t&&tA((()=>{Dr.console[e](`${eA}[${e}]:`,...n)}))}})):w0.forEach((t=>{n[t]=()=>{}})),n}const pl=r0("logger",nA);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 rA=Object.prototype.toString;function iA(t,n){return rA.call(t)===`[object ${n}]`}function uA(t){return iA(t,"Object")}function oA(t){return!(!t||!t.then||"function"!=typeof t.then)}function aA(t,n,e){try{Object.defineProperty(t,n,{value:e,writable:!0,configurable:!0})}catch{Y0&&pl.log(`Failed to add non-enumerable property "${n}" to object`,t)}}const K0=1e3;function G0(){return Date.now()/K0}function sA(){const{performance:t}=Dr;if(!t||!t.now)return G0;const n=Date.now()-t.now(),e=null==t.timeOrigin?n:t.timeOrigin;return()=>(e+t.now())/K0}const cA=sA();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||cA(),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 Z0(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]=Z0(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?aA(t,t0,n):delete t[t0]}function T0(t){return t[t0]}const lA=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()]:uA(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:lA;if(e<=0)return this;const r={timestamp:G0(),...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=Z0(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 pl.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 pl.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):(pl.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 hA(){return r0("defaultCurrentScope",(()=>new Gs))}function pA(){return r0("defaultIsolationScope",(()=>new Gs))}class dA{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 oA(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 dA(hA(),pA())}function gA(t){return Yo().withScope(t)}function vA(t,n){const e=Yo();return e.withScope((()=>(e.getStackTop().scope=t,n(t))))}function L0(t){return Yo().withScope((()=>t(Yo().getIsolationScope())))}function AA(){return{withIsolationScope:L0,withScope:gA,withSetScope:vA,withSetIsolationScope:(t,n)=>L0(n),getCurrentScope:()=>Yo().getScope(),getIsolationScope:()=>Yo().getIsolationScope()}}function J0(t){const n=u0(t);return n.acs?n.acs:AA()}function V0(){return J0(i0()).getCurrentScope()}function mA(){return J0(i0()).getIsolationScope()}function yA(t,n){return V0().captureException(t,void 0)}function wA(t,n){const e={captureContext:n};return V0().captureMessage(t,void 0,e)}function xA(t,n){mA().setExtra(t,n)}const bA=(...t)=>{let n="";for(const e of t){if(e instanceof Error){const t=e;return xA("exceptionMessage",n),void yA(t)}if("object"!=typeof e)n+=e;else try{n+=" "+JSON.stringify(e)}catch{n+=" "+e}}wA(n)},SA="wlsy",Q0=()=>{try{return window.localStorage}catch(t){console.warn("Error getting window.localStorage storage",t)}},_A=()=>{const t=new Set,n=Q0();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)},TA=t=>{const n=`${SA}`,e=t=>`${n}:${t}`,r=()=>_A().filter((t=>t.startsWith(`${n}:`))),i=t=>t.slice(n.length+1),o=Q0(),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"],LA=(t,n)=>{const e=I0.indexOf(t);return I0.indexOf(n)>=e},ll=(t,n,e,...r)=>{LA(n,t)&&console.log(`[${t}] ${e}`,...r)},IA=()=>TA().getItem("logger_lvl"),CA=(t=(q0()?"info":IA()||"warn"))=>{let n=t;return{debug:(t,...e)=>ll("debug",n,t,...e),info:(t,...e)=>ll("info",n,t,...e),warn:(t,...e)=>ll("warn",n,t,...e),error:(t,...e)=>(bA(t,...e),ll("error",n,t,...e)),setLevel:t=>{n=t},getLevel:()=>n}},Al=CA(),$0=({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=Qv(n);(!t||!o||!u||!a)&&r(),e({src:a,name:s,width:u,height:o,duration:Math.floor(t)})},u=()=>{Al.warn("Failed to load video"),e(null)};return $v()&&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=()=>{Al.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`},EA=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)},RA=t=>EA(t)&&"type"in t&&"string"==typeof t.type,fe=t=>{const n=n=>({type:t,payload:n});return n.toString=()=>`${t}`,n.type=t,n.match=n=>RA(n)&&n.type===t,n};fe("remoteReady"),fe("askLogin"),fe("reselectUser"),fe("requestLogout"),fe("setConfirmLeavePage"),fe("requestChangePath"),fe("wsSubscribe"),fe("wsUnSubscribe"),fe("hostStoreConnect"),fe("remoteLogin"),fe("remoteLogout"),fe("wsOnMessage"),fe("setRouterPath"),fe("setDeviceType"),fe("setUserError"),fe("setUserIsError"),fe("setUserPending"),fe("setUserSuccess"),fe("setUserData"),fe("updateAccountData"),fe("updateUser"),fe("addNotification"),fe("markNotification"),fe("setNotificationsError"),fe("setNotificationsList"),fe("setNotificationsPending"),fe("setNotificationsTotalCount"),fe("setNotificationsUnreadCount"),fe("resetNotificationsState"),fe("undoNotification"),fe("setInstanceInfo"),fe("setInstanceInfoPending"),fe("setInstanceInfoError");const OA=fe("setPlatformSettings");fe("setProfileSettings"),fe("setGroupData"),fe("setGroupLoading"),k0("requestMicroFrontendFetch"),k0("sendMicroFrontendFetchResponse");const PA={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"},dl={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)))||[],MA={data:null,isPending:!1},{posts:Vg,uploadsPolicyDoc:E0,uploadsPolicyAudio:Qg,uploadsPolicyImage:hl,uploadsPolicyVideo:Bs,registration:XA,captcha:NA,instanceAdmin:WA,branding:DA,translation:UA,access:zA}=dl,{captcha:kA,language:FA,translation:BA,openai:jA,link_service:HA}=PA,Go=t=>t.data,qA=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[hl],maxSize:(null==(n=null==t?void 0:t[hl])?void 0:n.maxSize)||0,maxMatrix:(null==(e=null==t?void 0:t[hl])?void 0:e.maxMatrix)||0,maxResolution:(null==(r=null==t?void 0:t[hl])?void 0:r.maxResolution)||0}})),YA=Ti(s0,(t=>Wr(t.extensions))),ev=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}})),tv=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}})),nv=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}})),rv=Ti([s0,ev,tv,nv],((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)}))),KA=Ti(rv,(t=>Object.keys(t).reduce(((n,e)=>[...n,...t[e]||[]]),[]))),Si=F0({name:"platformSettings",initialState:MA,reducers:{setError:(t,n)=>{t.error=n.payload},setPending:(t,n)=>{t.isPending=n.payload}},extraReducers:t=>{t.addCase(OA,((t,{payload:n})=>{t.data={...t.data,...n}}))},selectors:{selectSettings:Go,selectPostConfig:qA,selectDocPolicy:nv,selectImagePolicy:s0,selectVideoPolicy:ev,selectAudioPolicy:tv,selectImageExtensions:YA,selectSupportedExtensions:rv,selectFullExtensionsList:KA,selectRegistration:t=>{var n;return null==(n=t.data)?void 0:n[XA]},selectLanguageDetection:t=>{var n;return null==(n=t.data)?void 0:n[FA]},selectLanguageTranslation:t=>{var n;return null==(n=t.data)?void 0:n[BA]},selectOpenai:t=>{var n;return null==(n=t.data)?void 0:n[jA]},selectCaptcha:t=>{var n;return null==(n=t.data)?void 0:n[NA]},selectAdminCaptcha:t=>{var n;return null==(n=t.data)?void 0:n[kA]},selectPlatformTranslation:t=>{var n;return null==(n=t.data)?void 0:n[UA]},selectAccess:t=>{var n;return null==(n=t.data)?void 0:n[zA]},selectBranding:t=>{var n;return null==(n=t.data)?void 0:n[DA]},selectLinkService:t=>{var n;return null==(n=t.data)?void 0:n[HA]},selectInstanceAdmin:t=>{var n;return null==(n=t.data)?void 0:n[WA]},selectLegal:t=>{var n;return null==(n=t.data)?void 0:n[dl.legal]},selectDomainBlocks:t=>{var n;return null==(n=t.data)?void 0:n[dl.domainBlocks]},selectContacts:t=>{var n;return null==(n=t.data)?void 0:n[dl.contacts]}}}),GA=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=vl(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 $0({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`}}},iv=()=>{const[t]=dv(),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=vl(n.file.name),p=await GA({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){Al.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:{}},ZA=Hs.exports;
|
|
43
43
|
/**
|
|
44
44
|
* @license
|
|
45
45
|
* Lodash <https://lodash.com/>
|