mediacms/static/js/profile-playlists.js
2025-10-16 15:45:06 +03:00

1 line
8.8 KiB
JavaScript

!function(){"use strict";var e,t={463:function(e,t,n){n.d(t,{c:function(){return o}});var i=n(4571),r=n.n(i);function o(e,t){let n=r()(e,{});return""!==n.origin&&"null"!==n.origin&&n.origin||(n=r()(t+"/"+e.replace(/^\//g,""),{})),n.toString()}},1838:function(e,t,n){n.r(t),n.d(t,{BrowserEvents:function(){return i.GT},PositiveInteger:function(){return m.e},PositiveIntegerOrZero:function(){return m.R},addClassname:function(){return i.zc},cancelAnimationFrame:function(){return i.uU},csrfToken:function(){return c.G},deleteRequest:function(){return h.Fb},error:function(){return f.z},exportStore:function(){return o.A},formatInnerLink:function(){return a.c},formatManagementTableDate:function(){return s.n},formatViewsNumber:function(){return u.A},getRequest:function(){return h.iq},greaterCommonDivision:function(){return d.p7},hasClassname:function(){return i.CX},imageExtension:function(){return l.t},isGt:function(){return d.en},isInteger:function(){return d.Fq},isNumber:function(){return d.Et},isPositive:function(){return d.ep},isPositiveInteger:function(){return d.q6},isPositiveIntegerOrZero:function(){return d.tR},isPositiveNumber:function(){return d.F5},isZero:function(){return d.be},logErrorAndReturnError:function(){return r.m},logWarningAndReturnError:function(){return r.g},postRequest:function(){return h.MB},publishedOnDate:function(){return p.A},putRequest:function(){return h.zi},quickSort:function(){return g.g},removeClassname:function(){return i.qk},replaceString:function(){return v.u},requestAnimationFrame:function(){return i.xi},supportsSvgAsImg:function(){return i.kN},translateString:function(){return y.g},warn:function(){return f.R}});var i=n(1134),r=n(6403),o=n(977),a=n(463),s=n(8482),u=n(4632),c=n(5393),l=n(1554),f=n(8004),d=n(8354),m=n(1702),p=n(7673),g=n(1453),h=n(9659),y=n(4036),v=n(4470)},6089:function(e,t,n){n.d(t,{$:function(){return s}});var i=n(9471),r=n(6371);let o=[];function a(e){const[t,n]=(0,i.useState)(!1),[r,o]=(0,i.useState)(!0);let a=null,s=null;return(0,i.useEffect)((()=>(a=setTimeout((function(){s=setTimeout((function(){o(!1),s=null}),1e3),a=null,n(!0),e.onHide(e.id)}),5e3),()=>{a&&clearTimeout(a),s&&clearTimeout(s)})),[]),r?i.createElement("div",{className:"notification-item"+(t?" hidden":"")},i.createElement("div",null,i.createElement("span",null,e.children||"No message"))):null}function s(){const[e,t]=(0,i.useState)(o.length);function n(){t(r.default.get("notifications-size")+o.length)}function s(e){const t=[];o.map((n=>{n[0]!==e&&t.push(n)})),o=t}return(0,i.useEffect)((()=>(n(),r.default.on("added_notification",n),()=>r.default.removeListener("added_notification",n))),[]),e?i.createElement("div",{className:"notifications"},i.createElement("div",null,function(){const e=r.default.get("notifications");return[...o.map((e=>i.createElement(a,{key:e[0],id:e[0],onHide:s},e[1]))),...e.map((e=>(o.push(e),i.createElement(a,{key:e[0],id:e[0],onHide:s},e[1]))))]}())," "):null}},6371:function(e,t,n){n.r(t);var i=n(9032),r=n.n(i),o=n(7154),a=n(1838),s=n(3997);function u(){let e=new Uint32Array(3);return window.crypto.getRandomValues(e),(performance.now().toString(36)+Array.from(e).map((e=>e.toString(36))).join("")).replace(/./g,""+Math.random()+Intl.DateTimeFormat().resolvedOptions().timeZone+Date.now())}let c,l=null,f=null;class d extends(r()){constructor(e){super(),f=(0,s.$)(window.MediaCMS),c=new o.BrowserCache(f.site.id,86400),l={mediaAutoPlay:c.get("media-auto-play")},l.mediaAutoPlay=null===l.mediaAutoPlay||l.mediaAutoPlay,this.browserEvents=(0,a.BrowserEvents)(),this.browserEvents.doc(this.onDocumentVisibilityChange.bind(this)),this.browserEvents.win(this.onWindowResize.bind(this),this.onWindowScroll.bind(this)),this.notifications=function(e){let t=[];function n(e){"string"==typeof e&&t.push([u(),e])}return e.map(n),{size:function(){return t.length},push:n,clear:function(){t=[]},messages:function(){return[...t]}}}(void 0!==window.MediaCMS&&void 0!==window.MediaCMS.notifications?window.MediaCMS.notifications:[])}onDocumentVisibilityChange(){this.emit("document_visibility_change")}onWindowScroll(){this.emit("window_scroll")}onWindowResize(){this.emit("window_resize")}initPage(e){l.currentPage=e}get(e){let t;switch(e){case"browser-cache":t=c;break;case"media-auto-play":t=l.mediaAutoPlay;break;case"config-contents":t=f.contents;break;case"config-enabled":t=f.enabled;break;case"config-media-item":t=f.media.item;break;case"config-options":t=f.options;break;case"config-site":t=f.site;break;case"api-playlists":n=e.split("-")[1],t=f.api[n]||null;break;case"notifications-size":t=this.notifications.size();break;case"notifications":t=this.notifications.messages(),this.notifications.clear();break;case"current-page":t=l.currentPage}var n;return t}actions_handler(e){switch(e.type){case"INIT_PAGE":this.initPage(e.page),this.emit("page_init");break;case"TOGGLE_AUTO_PLAY":l.mediaAutoPlay=!l.mediaAutoPlay,c.set("media-auto-play",l.mediaAutoPlay),this.emit("switched_media_auto_play");break;case"ADD_NOTIFICATION":this.notifications.push(e.notification),this.emit("added_notification")}}}t.default=(0,a.exportStore)(new d,"actions_handler")},6568:function(e,t,n){n.d(t,{x:function(){return a}});var i=n(9471),r=n(8713),o=n.n(r);function a(e){let t="spinner-loader";switch(e.size){case"tiny":case"x-small":case"small":case"large":case"x-large":t+=" "+e.size}return i.createElement("div",{className:t},i.createElement("svg",{className:"circular",viewBox:"25 25 50 50"},i.createElement("circle",{className:"path",cx:"50",cy:"50",r:"20",fill:"none",strokeWidth:"1.5",strokeMiterlimit:"10"})))}a.propTypes={size:o().oneOf(["tiny","x-small","small","medium","large","x-large"])},a.defaultProps={size:"medium"}},7256:function(e,t,n){n.d(t,{P:function(){return s}});var i=n(9471),r=n(8713),o=n.n(r),a=n(2828);function s(e){return e.options.map((t=>i.createElement("div",{key:t.id,className:t.id===e.selected?"active":""},i.createElement("button",{onClick:e.onSelect,filter:e.id,value:t.id},i.createElement("span",null,t.title),t.id===e.selected?i.createElement(a.Z,{type:"close"}):null))))}s.propTypes={id:o().string.isRequired,selected:o().string.isRequired,onSelect:o().func.isRequired}},9222:function(e,t,n){var i=n(2985),r=n(9471),o=n(8790),a=n(7460),s=n(2855),u=n(1177),c=n(239),l=n(7731),f=n(7545);class d extends f.R{constructor(e){super(e,"author-playlists"),this.state={loadedAuthor:!1,loadedPlaylists:!1,playlistsCount:-1},this.getPlaylistsCountFunc=this.getPlaylistsCountFunc.bind(this)}getPlaylistsCountFunc(e){this.setState({loadedPlaylists:!0,playlistsCount:e})}pageContent(){return[this.state.author?r.createElement(u.A,{key:"ProfilePagesHeader",author:this.state.author,type:"playlists"}):null,this.state.author?r.createElement(c.A,{key:"ProfilePagesContent"},r.createElement(o.ApiUrlConsumer,null,(e=>r.createElement(s.MediaListWrapper,{title:-1<this.state.playlistsCount?"Created playlists":void 0,className:"profile-playlists-content items-list-ver"},r.createElement(l.LazyLoadItemListAsync,{requestUrl:e.user.playlists+this.state.author.username,itemsCountCallback:this.getPlaylistsCountFunc,hideViews:!a.PageStore.get("config-media-item").displayViews,hideAuthor:!a.PageStore.get("config-media-item").displayAuthor,hideDate:!a.PageStore.get("config-media-item").displayPublishDate}))))):null]}}(0,i.C)("page-profile-playlists",d)}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var o=n[e]={exports:{}};return t[e].call(o.exports,o,o.exports,i),o.exports}i.m=t,e=[],i.O=function(t,n,r,o){if(!n){var a=1/0;for(l=0;l<e.length;l++){n=e[l][0],r=e[l][1],o=e[l][2];for(var s=!0,u=0;u<n.length;u++)(!1&o||a>=o)&&Object.keys(i.O).every((function(e){return i.O[e](n[u])}))?n.splice(u--,1):(s=!1,o<a&&(a=o));if(s){e.splice(l--,1);var c=r();void 0!==c&&(t=c)}}return t}o=o||0;for(var l=e.length;l>0&&e[l-1][2]>o;l--)e[l]=e[l-1];e[l]=[n,r,o]},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.j=956,function(){var e={956:0};i.O.j=function(t){return 0===e[t]};var t=function(t,n){var r,o,a=n[0],s=n[1],u=n[2],c=0;if(a.some((function(t){return 0!==e[t]}))){for(r in s)i.o(s,r)&&(i.m[r]=s[r]);if(u)var l=u(i)}for(t&&t(n);c<a.length;c++)o=a[c],i.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return i.O(l)},n=self.webpackChunkmediacms_frontend=self.webpackChunkmediacms_frontend||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}();var r=i.O(void 0,[276],(function(){return i(9222)}));r=i.O(r)}();