mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-06 07:28:53 -05:00
1 line
83 KiB
JavaScript
1 line
83 KiB
JavaScript
!function(){var e,t={463:function(e,t,a){"use strict";a.d(t,{c:function(){return l}});var i=a(4571),n=a.n(i);function l(e,t){let a=n()(e,{});return""!==a.origin&&"null"!==a.origin&&a.origin||(a=n()(t+"/"+e.replace(/^\//g,""),{})),a.toString()}},878:function(e,t,a){"use strict";a.d(t,{c:function(){return d}});var i=a(9471),n=a(8713),l=a.n(n),o=a(6387),r=a(5321),s=a(2828);function d(e){const{thumbnail:t}=(0,o.useUser)(),a={"aria-label":"Account profile photo that opens list of options and settings pages links",className:"thumbnail"};switch(e.isButton?void 0!==e.onClick&&(a.onClick=e.onClick):a.type="span",e.size){case"small":case"large":a.className+=" "+e.size+"-thumb"}return i.createElement(r.i,a,t?i.createElement("img",{src:t,alt:""}):i.createElement(s.Z,{type:"person"}))}d.propTypes={isButton:l().bool,size:l().oneOf(["small","medium","large"]),onClick:l().func},d.defaultProps={isButton:!1,size:"medium"}},1815:function(){},2787:function(){},3237:function(){},3818:function(e,t,a){"use strict";a.d(t,{_:function(){return o}});var i=a(9471),n=a(8713),l=a.n(n);function o(e){const t=(0,i.useRef)(null),a=(0,i.useRef)(null),[n,l]=(0,i.useState)(null),[o,r]=(0,i.useState)(null);return(0,i.useEffect)(()=>{l(function(e,t,a){if(void 0!==e){let i=null;return i=void 0!==t&&t>e?t:e,i=void 0!==a&&a<i?a:i,i}return void 0!==t?t:void 0!==a?a:void 0}(0+e.defaultValue,e.minValue,e.maxValue)),r(function(e,t){if(!t||!t.length)return null;let a=0;for(;a<t.length;){if(void 0!==t[a].key&&e===t[a].key)return t[a].key;a+=1}return t[0].key}(e.defaultUnit,e.units))}),i.createElement("div",{className:"num-value-unit"},void 0!==e.label?i.createElement("span",{className:"label"},e.label):null,i.createElement("input",{ref:t,className:"value-input",type:"number",value:null!==n?n:"",min:void 0!==e.minValue?e.minValue:null,max:void 0!==e.maxValue?e.maxValue:null,onChange:function(){l(t.current.value),void 0!==e.valueCallback&&e.valueCallback(t.current.value)}}),i.createElement("select",{ref:a,className:"value-unit",onChange:function(){r(a.current.value),void 0!==e.unitCallback&&e.unitCallback(a.current.value)},value:null!==o?o:""},function(){if(!e.units.length)return null;const t=[];let a=0;for(;a<e.units.length;)void 0!==e.units[a].key&&t.push(i.createElement("option",{key:e.units[a].key,value:e.units[a].key},void 0!==e.units[a].label?e.units[a].label:e.units[a].key)),a+=1;return t}()))}o.propTypes={label:l().string,units:l().array.isRequired,defaultUnit:l().string,defaultValue:l().number,minValue:l().number,maxValue:l().number,valueCallback:l().func,unitCallback:l().func}},6568:function(e,t,a){"use strict";a.d(t,{x:function(){return o}});var i=a(9471),n=a(8713),l=a.n(n);function o(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"})))}o.propTypes={size:l().oneOf(["tiny","x-small","small","medium","large","x-large"])},o.defaultProps={size:"medium"}},6671:function(){},7492:function(){},7640:function(){},7664:function(e,t,a){"use strict";a.d(t,{CircleIconButton:function(){return i.i},MaterialIcon:function(){return n.Z},NavigationContentApp:function(){return l.V},NavigationMenuList:function(){return o.S},Notifications:function(){return r.$},NumericInputWithUnit:function(){return s._},PopupMain:function(){return d.AP},PopupTop:function(){return d.cp},SpinnerLoader:function(){return c.x},UserThumbnail:function(){return m.c}});var i=a(5321),n=(a(7256),a(3135),a(2828)),l=a(5305),o=a(7201),r=a(6089),s=a(3818),d=a(2901),c=a(6568),m=a(878)},9427:function(e,t,a){"use strict";var i=a(2985),n=a(9471),l=a(8790),o=a(7460);function r(){return n.createElement("div",{className:"player-container viewer-attachment-container"},n.createElement("div",{className:"player-container-inner"},n.createElement("span",null,n.createElement("span",null,n.createElement("i",{className:"material-icons"},"insert_drive_file")))))}var s=a(7664),d=function({children:e,content:t,title:a,position:i="right",classNames:l=""}){const[o,r]=(0,n.useState)(!1),[s,d]=(0,n.useState)({height:0,width:0}),c=(0,n.useRef)(null);(0,n.useEffect)(()=>{c.current&&d({height:c.current.clientHeight||0,width:c.current.clientWidth||0})},[o]);const m={right:{left:"100%",marginLeft:"10px",top:"-50%"},left:{right:"100%",marginRight:"10px",top:"-50%"},top:{left:"50%",top:`-${s.height+10}px`,transform:"translateX(-50%)"},center:{top:"50%",left:"50%",translate:"x-[-50%]"},"bottom-left":{left:`-${s.width-20}px`,top:"100%",marginTop:"10px"}};return n.createElement("div",{onMouseEnter:()=>{r(!0)},onMouseLeave:()=>{r(!1)}},n.createElement("div",{ref:c,className:`tooltip-box ${o?"show":"hide"} ${l}`,style:m[i]},a&&n.createElement("div",{className:"tooltip-title"},a),n.createElement("div",{className:"tooltip-content"},t)),e)};function c(){const e=(0,n.useContext)(l.SiteContext);let t=E();t=t||o.MediaPageStore.get("media-data").thumbnail_url,t=t||"";const[a,i]=(0,n.useState)(t),[r,c]=(0,n.useState)([]),[m,u]=(0,n.useState)(!1),[p,g]=(0,n.useState)(0),[h,f]=(0,n.useState)(!0),v=n.useRef();function y(){i(E())}function E(){const t=o.MediaPageStore.get("media-data");let a=t.poster_url?.trim()||t.thumbnail_url?.trim()||o.MediaPageStore.get("media-original-url")?.trim()||"#";return e.url+"/"+a.replace(/^\//g,"")}(0,n.useEffect)(()=>{a&&(()=>{const e=o.MediaPageStore.get("media-data").slideshow_items;Array.isArray(e)&&c(e)})()},[a]),(0,n.useEffect)(()=>(o.MediaPageStore.on("loaded_image_data",y),()=>o.MediaPageStore.removeListener("loaded_image_data",y)),[]),(0,n.useEffect)(()=>{if(m)return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[m,r]);const b=e=>{"ArrowRight"===e.key&&P(),"ArrowLeft"===e.key&&w(),"Escape"===e.key&&S()},S=()=>u(!1),P=()=>{f(!0),g(e=>(e+1)%r.length)},w=()=>{f(!0),g(e=>(e-1+r.length)%r.length)},M=e=>{if(v.current){const t=10;"left"===e?v.current.scrollBy({left:-t,behavior:"smooth"}):"right"===e&&v.current.scrollBy({left:t,behavior:"smooth"})}};return a?n.createElement("div",{className:"viewer-image-container"},n.createElement(d,{content:"load full-image",position:"center"},n.createElement("img",{src:a,alt:o.MediaPageStore.get("media-data").title||null,onClick:()=>u(!0)})),m&&r&&n.createElement("div",{className:"modal-overlay",onClick:()=>u(!1)},n.createElement("div",{className:"slideshow-container",onClick:e=>e.stopPropagation()},!h&&n.createElement("button",{className:"arrow left",onClick:w,"aria-label":"Previous slide"},"‹"),n.createElement("div",{className:"slideshow-image"},h&&n.createElement(s.SpinnerLoader,{size:"large"}),n.createElement("img",{src:e.url+"/"+r[p]?.original_media_url,alt:`Slide ${p+1}`,onClick:()=>(t=>{const a=e.url+r[t]?.url;window.location.href=a})(p),onLoad:()=>f(!1),onError:()=>f(!1),style:{display:h?"none":"block"}}),!h&&n.createElement("div",{className:"slideshow-title"},r[p]?.title)),!h&&n.createElement("button",{className:"arrow right",onClick:P,"aria-label":"Next slide"},"›"),n.createElement("div",{className:"thumbnail-navigation"},r.length>5&&n.createElement("button",{className:"arrow left",onClick:()=>M("left"),"aria-label":"Scroll left"},"‹"),n.createElement("div",{className:"thumbnail-container "+(r.length<=5?"center-thumbnails":""),ref:v},r.map((t,a)=>n.createElement("img",{key:a,src:e.url+"/"+t.thumbnail_url,alt:`Thumbnail ${a+1}`,className:"thumbnail "+(p===a?"active":""),onClick:()=>(e=>{f(!0),g(e)})(a)}))),r.length>5&&n.createElement("button",{className:"arrow right",onClick:()=>M("right"),"aria-label":"Scroll right"},"›"))))):null}var m=a(7118),u=a(5928);function p({fileUrl:e}){const t=(0,u.defaultLayoutPlugin)();return n.createElement("div",{className:"pdf-container"},n.createElement(m.Worker,{workerUrl:"https://unpkg.com/pdfjs-dist@3.4.120/build/pdf.worker.min.js"},n.createElement(m.Viewer,{fileUrl:e,plugins:[t]})))}var g=a(8713),h=a.n(g),f=a(285),v=a(1838),y=a(7154),E=a(5697);const b=["hls","h265","vp9","h264","vp8","mp4","theora"];function S(e,t){let a=null,i=document.createElement("video");if(i.canPlayType)try{switch(e){case"hls":case"mp4":a=!0;break;case"h265":a="probably"===i.canPlayType('video/mp4; codecs="hvc1.1.L0.0"')||"probably"===i.canPlayType('video/mp4; codecs="hev1.1.L0.0"');break;case"h264":a="probably"===i.canPlayType('video/mp4; codecs="avc1.42E01E"')||"probably"===i.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');break;case"vp9":a="probably"===i.canPlayType('video/webm; codecs="vp9"');break;case"vp8":a="probably"===i.canPlayType('video/webm; codecs="vp8, vorbis"');break;case"theora":a="probably"===i.canPlayType('video/ogg; codecs="theora"')}if(t=(t instanceof Boolean||0===t||1==t)&&t){if("no"===i.canPlayType("video/nonsense")&&E.warn('BUGGY: Codec detection bug in Firefox 3.5.0 - 3.5.1 and Safari 4.0.0 - 4.0.4 that answer "no" to unknown codecs instead of an empty string'),"probably"===i.canPlayType("video/webm")&&E.warn('BUGGY: Codec detection bug that Firefox 27 and earlier always says "probably" when asked about WebM, even when the codecs string is not present'),"maybe"===i.canPlayType('video/mp4; codecs="avc1.42E01E"'))switch(i.canPlayType("video/mp4")){case"probably":E.warn('BUGGY: Codec detection bug in iOS 4.1 and earlier that switches "maybe" and "probably" around');break;case"maybe":E.warn('BUGGY: Codec detection bug in Android where no better answer than "maybe" is given')}"probably"===i.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')&&"probably"!==i.canPlayType('video/mp4; codecs="avc1.42E01E"')&&E.warn("BUGGY: Codec detection bug in Internet Explorer 9 that requires both audio and video codec on test")}}catch(e){E.warn(e)}return a}function P(e){let t=[],a={},i=document.createElement("video");return i.canPlayType&&(a.hls=!0,t.push("hls"),(i.canPlayType('video/mp4; codecs="hvc1.1.L0.0"')||"probably"===i.canPlayType('video/mp4; codecs="hev1.1.L0.0"'))&&(a.h265=!0,t.push("h265")),"probably"===i.canPlayType('video/mp4; codecs="avc1.42E01E"')&&(a.h264=!0,t.push("h264")),"probably"===i.canPlayType('video/webm; codecs="vp9"')&&(a.vp9=!0,t.push("vp9")),e&&("probably"===i.canPlayType('video/webm; codecs="vp8, vorbis"')&&(a.vp8=!0,t.push("vp8")),"probably"===i.canPlayType('video/ogg; codecs="theora"')&&(a.theora=!0,t.push("theora"))),"probably"===i.canPlayType('video/mp4; codecs="mp4v.20.8"')&&(a.mp4=!0,t.push("mp4"))),{order:t,support:a}}var w=a(5697);const M=({data:e,useRoundedCorners:t,isPlayList:a,playerVolume:i,playerSoundMuted:l,videoQuality:o,videoPlaybackSpeed:r,inTheaterMode:s,siteId:d,siteUrl:c,info:m,cornerLayers:u,sources:p,poster:g,previewSprite:h,subtitlesInfo:f,enableAutoplay:v,inEmbed:y,hasTheaterMode:E,hasNextLink:b,nextLink:S,hasPreviousLink:P,errorMessage:M,onClickNextCallback:_,onClickPreviousCallback:k,onStateUpdateCallback:C,onPlayerInitCallback:N})=>{const x=(0,n.useRef)(null),L=(0,n.useRef)(!1),V=(0,n.useRef)(null),I=(0,n.useRef)(y),A=e=>new URLSearchParams(window.location.search).get(e);(0,n.useEffect)(()=>{if(I.current=y,"undefined"!=typeof window){const n=A("t"),w=A("autoplay"),x=A("muted");window.MEDIA_DATA={data:e||{},useRoundedCorners:t,isPlayList:a,playerVolume:i||.5,playerSoundMuted:l||"1"===x,videoQuality:o||"auto",videoPlaybackSpeed:r||1,inTheaterMode:s||!1,siteId:d||"",siteUrl:c||"",info:m||{},cornerLayers:u||[],sources:p||[],poster:g||"",previewSprite:h||null,subtitlesInfo:f||[],enableAutoplay:v||"1"===w,inEmbed:y||!1,hasTheaterMode:E||!1,hasNextLink:b||!1,nextLink:S||null,hasPreviousLink:P||!1,errorMessage:M||"",urlTimestamp:n?parseInt(n,10):null,urlAutoplay:"1"===w,urlMuted:"1"===x,onClickNextCallback:_||null,onClickPreviousCallback:k||null,onStateUpdateCallback:C||null,onPlayerInitCallback:(e,t)=>{V.current=e,N&&N(e,t)}}}L.current||(T(),L.current=!0)},[e,c,y]),(0,n.useEffect)(()=>{if(y&&x.current){const e=setTimeout(()=>{const e=new CustomEvent("triggerVideoJSMount",{detail:{targetId:"video-js-root-embed"}});document.dispatchEvent(e),"undefined"!=typeof window&&window.triggerVideoJSMount&&window.triggerVideoJSMount()},100);return()=>clearTimeout(e)}},[y,x.current]),(0,n.useEffect)(()=>{const e=e=>{if(e.target.classList.contains("video-timestamp")){e.preventDefault();const t=parseInt(e.target.dataset.timestamp,10);let a=null;if(V.current&&V.current.player&&(a=V.current.player),!a&&"undefined"!=typeof window&&window.videojsPlayers){const e=I.current?"video-embed":"video-main";a=window.videojsPlayers[e]}if(!a&&"undefined"!=typeof window&&window.videojs){const e=document.querySelector(I.current?"#video-embed":"#video-main");e&&e.player&&(a=e.player)}if(a){t>=0&&t<a.duration()?a.currentTime(t):t>=0&&a.play();const e=document.querySelector(I.current?"#video-embed":"#video-main");e&&e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}else w.warn("VideoJS player not found for timestamp navigation")}};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}},[]);const T=()=>{const e=document.querySelector('link[href*="video-js.css"]'),t=document.querySelector('script[src*="video-js.js"]');if(!e){const e=document.createElement("link");e.rel="stylesheet",e.href=c+"/static/video_js/video-js.css",document.head.appendChild(e)}if(!t){const e=document.createElement("script");e.src=c+"/static/video_js/video-js.js",document.head.appendChild(e)}};return n.createElement("div",{className:"video-js-wrapper",ref:x},y?n.createElement("div",{id:"video-js-root-embed",className:"video-js-root-embed"}):n.createElement("div",{id:"video-js-root-main",className:"video-js-root-main"}))};M.defaultProps={data:{},siteUrl:""};var _=M,k=a(5697);class C extends n.PureComponent{constructor(e){if(super(e),this.state={displayPlayer:!1},this.videoSources=[],function(e){switch(e){case"running_X":o.MediaPageStore.set("media-load-error-type","encodingRunning"),o.MediaPageStore.set("media-load-error-message","Media encoding is currently running. Try again in few minutes.");break;case"pending_X":o.MediaPageStore.set("media-load-error-type","encodingPending"),o.MediaPageStore.set("media-load-error-message","Media encoding is pending");break;case"fail":o.MediaPageStore.set("media-load-error-type","encodingFailed"),o.MediaPageStore.set("media-load-error-message","Media encoding failed")}}(this.props.data.encoding_status),null!==o.MediaPageStore.get("media-load-error-type"))return void(this.state.displayPlayer=!0);if("string"==typeof this.props.data.poster_url?this.videoPoster=(0,v.formatInnerLink)(this.props.data.poster_url,this.props.siteUrl):"string"==typeof this.props.data.thumbnail_url&&(this.videoPoster=(0,v.formatInnerLink)(this.props.data.thumbnail_url,this.props.siteUrl)),this.videoInfo=function(e,t,a){const i={};let n,o,r;a=void 0===a?P():a;const s={hls:["m3u8"],h265:["mp4","webm"],h264:["mp4","webm"],vp9:["mp4","webm"],vp8:["mp4","webm"],theora:["ogg"],mp4:["mp4"]};for(n in t)t.hasOwnProperty(n)&&(o=null,"master_file"===n?o="Auto":(o=n.split("_playlist"),o=2===o.length?o[0]:null),null!==o&&(i[o]=void 0===i[o]?{format:[],url:[]}:i[o],i[o].format.push("hls"),i[o].url.push((0,v.formatInnerLink)(t[n],l.SiteContext._currentValue.url))));for(o in e)if(e.hasOwnProperty(o)&&Object.keys(e[o]).length&&(1080>=parseInt(o,10)||1080<window.screen.width&&1080<window.screen.height))for(n=0;n<b.length;)void 0!==e[o][b[n]]&&S(b[n],!1)&&e[o][b[n]]&&e[o][b[n]].url&&(100!==e[o][b[n]].progress&&E.warn("VIDEO DEBUG:","PROGRESS value is",e[o][b[n]].progress),"success"!==e[o][b[n]].status&&E.warn("VIDEO DEBUG:","STATUS value is",e[o][b[n]].status),r=e[o][b[n]].url.split("."),r.length&&0<=s[b[n]].indexOf(r[r.length-1])&&(i[o]=void 0===i[o]?{format:[],url:[]}:i[o],i[o].format.push(b[n]),i[o].url.push((0,v.formatInnerLink)(e[o][b[n]].url,l.SiteContext._currentValue.url)))),n+=1;return i}(this.props.data.encodings_info,this.props.data.hls_info),Object.keys(this.videoInfo).length){let e=o.VideoViewerStore.get("video-quality");(null===e||"Auto"===e&&void 0===this.videoInfo.Auto)&&(e=720);let t=function(e,t){let a,i=Object.keys(t);if(void 0!==t[e])return e;if(parseInt(e,10)>=parseInt(i[i.length-1],10))return i[i.length-1];if(parseInt(e,10)<=parseInt(i[0],10))return i[0];for(a=i.length-1;a>=0;){if(parseInt(e,10)>=parseInt(i[a],10))return i[a+1];a-=1}}(e,this.videoInfo);"Auto"===e&&void 0!==this.videoInfo.Auto&&this.videoSources.push({src:this.videoInfo.Auto.url[0]});const a=P();let i,n;for(n=0;n<this.videoInfo[t].format.length;){if("hls"===this.videoInfo[t].format[n]){this.videoSources.push({src:this.videoInfo[t].url[n]});break}n+=1}for(n in this.props.data.encodings_info[t])this.props.data.encodings_info[t].hasOwnProperty(n)&&a.support[n]&&(i=this.props.data.encodings_info[t][n].url,i&&(i=(0,v.formatInnerLink)(i,this.props.siteUrl),this.videoSources.push({src:i,encodings_status:this.props.data.encodings_info[t][n].status})))}else this.videoInfo=null;if(this.videoSources.length){if(!this.props.inEmbed&&1===this.videoSources.length&&"running"===this.videoSources[0].encodings_status)return o.MediaPageStore.set("media-load-error-type","encodingRunning"),void o.MediaPageStore.set("media-load-error-message","Media encoding is currently running. Try again in few minutes.")}else switch(o.MediaPageStore.get("media-load-error-type")){case"encodingRunning":case"encodingPending":case"encodingFailed":break;default:k.warn("VIDEO DEBUG:","Video files don't exist")}o.PageStore.on("switched_media_auto_play",this.onUpdateMediaAutoPlay.bind(this)),this.browserCache=new y.BrowserCache(l.SiteContext._currentValue.id,86400);const t=new y.MediaDurationInfo;t.update(this.props.data.duration),this.durationISO8601=t.ISO8601(),this.playerElem=null,this.playerInstance=null,this.onPlayerInit=this.onPlayerInit.bind(this),this.onClickNext=this.onClickNext.bind(this),this.onClickPrevious=this.onClickPrevious.bind(this),this.onStateUpdate=this.onStateUpdate.bind(this)}componentDidMount(){if(this.videoSources.length){this.upNextLoaderView=!this.props.inEmbed&&this.props.data.related_media.length?new y.UpNextLoaderView(this.props.data.related_media[0]):null;let e=null;if(this.props.inEmbed){let t=document.createElement("a"),a=document.createElement("a");e=document.createElement("div"),e.setAttribute("class","media-links-top-left"),t&&(t.setAttribute("class","title-link"),t.setAttribute("href",this.props.data.url),t.setAttribute("title",this.props.data.title),t.setAttribute("target","_blank"),t.innerHTML=this.props.data.title),a&&(a.setAttribute("class","user-thumb-link"),a.setAttribute("href",(0,v.formatInnerLink)(this.props.data.author_profile,this.props.siteUrl)),a.setAttribute("title",this.props.data.author_name),a.setAttribute("target","_blank"),a.setAttribute("style","background-image:url("+(0,v.formatInnerLink)(o.MediaPageStore.get("media-author-thumbnail-url"),this.props.siteUrl)+")")),e.appendChild(a),e.appendChild(t)}let t='<button class="share-video-btn"><i class="material-icons">share</i><span>Share</span></button>';t+='<div class="share-options-wrapper">\t\t\t\t\t\t\t\t\t<div class="share-options">\t\t\t\t\t\t\t\t\t\t<div class="share-options-inner">\t\t\t\t\t\t\t\t\t\t\t<div class="sh-option share-email">\t\t\t\t\t\t\t\t\t\t\t\t<a href="mailto:?body='+o.MediaPageStore.get("media-url")+'" title=""><span><i class="material-icons">email</i></span><span>Email1</span></a>\t\t\t\t\t\t\t\t\t\t\t</div></div>\t\t\t\t\t\t\t\t\t</div>\t\t\t\t\t\t\t\t</div>',this.cornerLayers={topLeft:e,topRight:this.upNextLoaderView?this.upNextLoaderView.html():null,bottomLeft:this.recommendedMedia?this.recommendedMedia.html():null,bottomRight:this.props.inEmbed?t:null},this.setState({displayPlayer:!0},function(){setTimeout(function(){const e=document.querySelector(".share-video-btn"),t=document.querySelector(".share-options-wrapper"),a=document.querySelector(".share-options-inner");e&&e.addEventListener("click",function(e){(0,v.addClassname)(document.querySelector(".video-js.vjs-mediacms"),"vjs-visible-share-options")}),t&&t.addEventListener("click",function(e){e.target!==a&&e.target!==t||(0,v.removeClassname)(document.querySelector(".video-js.vjs-mediacms"),"vjs-visible-share-options")})},1e3)})}}onClickNext(){let e;o.MediaPageStore.get("playlist-id")?(e=o.MediaPageStore.get("playlist-next-media-url"),null===e&&(e=this.props.data.related_media[0].url)):this.props.inEmbed||(e=this.props.data.related_media[0].url),window.location.href=e}onClickPrevious(){let e;o.MediaPageStore.get("playlist-id")?(e=o.MediaPageStore.get("playlist-previous-media-url"),null===e&&(e=this.props.data.related_media[0].url)):this.props.inEmbed||(e=this.props.data.related_media[0].url),window.location.href=e}onStateUpdate(e){o.VideoViewerStore.get("in-theater-mode")!==e.theaterMode&&f.VideoViewerActions.set_viewer_mode(e.theaterMode),o.VideoViewerStore.get("player-volume")!==e.volume&&f.VideoViewerActions.set_player_volume(e.volume),o.VideoViewerStore.get("player-sound-muted")!==e.soundMuted&&f.VideoViewerActions.set_player_sound_muted(e.soundMuted),o.VideoViewerStore.get("video-quality")!==e.quality&&f.VideoViewerActions.set_video_quality(e.quality),o.VideoViewerStore.get("video-playback-speed")!==e.playbackSpeed&&f.VideoViewerActions.set_video_playback_speed(e.playbackSpeed)}onPlayerInit(e,t){this.playerElem=t,this.playerInstance=e,this.upNextLoaderView&&(this.upNextLoaderView.setVideoJsPlayerElem(this.playerInstance.player.el_),this.onUpdateMediaAutoPlay()),this.props.inEmbed||this.playerElem.parentNode.focus()}onUpdateMediaAutoPlay(){this.upNextLoaderView&&(o.PageStore.get("media-auto-play")||this.upNextLoaderView.hideTimerView())}render(){let e=null,t=null;!this.props.inEmbed&&o.MediaPageStore.get("playlist-id")?(e=o.MediaPageStore.get("playlist-next-media-url"),t=o.MediaPageStore.get("playlist-previous-media-url")):e=this.props.data.related_media.length&&!this.props.inEmbed?this.props.data.related_media[0].url:null;const a=this.props.data.sprites_url?{url:this.props.siteUrl+"/"+this.props.data.sprites_url.replace(/^\//g,""),frame:{width:160,height:90,seconds:10}}:null;return n.createElement(n.Fragment,null,n.createElement("div",{key:(this.props.inEmbed?"embed-":"")+"player-container",className:"player-container"+(this.videoSources.length?"":" player-container-error"),style:this.props.containerStyles,ref:"playerContainer"},n.createElement("div",{className:"player-container-inner",ref:"playerContainerInner",style:this.props.containerStyles},null==o.MediaPageStore.get("media-load-error-type")?n.createElement("div",{className:"video-player",ref:"videoJSPlayerWrapper",key:"videoJSPlayerWrapper"},n.createElement(l.SiteConsumer,null,i=>(k.log("edw site",i),k.log("edw MediaPageStore.get('playlist-id')",o.MediaPageStore.get("playlist-id")?"yes":"no"),k.log("this.browserCache.get('playlist-id'),",this.browserCache.get("playlist-id"),this.browserCache.get("playlist-id")?"yes":"no"),n.createElement(_,{data:this.props.data,useRoundedCorners:i.useRoundedCorners,isPlayList:!!o.MediaPageStore.get("playlist-id"),playerVolume:this.browserCache.get("player-volume"),playerSoundMuted:this.browserCache.get("player-sound-muted"),videoQuality:this.browserCache.get("video-quality"),videoPlaybackSpeed:parseInt(this.browserCache.get("video-playback-speed"),10),inTheaterMode:this.browserCache.get("in-theater-mode"),siteId:i.id,siteUrl:i.url,info:this.videoInfo,cornerLayers:this.cornerLayers,sources:this.videoSources,poster:this.videoPoster,previewSprite:a,subtitlesInfo:this.props.data.subtitles_info,enableAutoplay:!this.props.inEmbed,inEmbed:this.props.inEmbed,hasTheaterMode:!this.props.inEmbed,hasNextLink:!!e,nextLink:e,hasPreviousLink:!!t,errorMessage:o.MediaPageStore.get("media-load-error-message"),onClickNextCallback:this.onClickNext,onClickPreviousCallback:this.onClickPrevious,onStateUpdateCallback:this.onStateUpdate,onPlayerInitCallback:this.onPlayerInit})))):null)))}}C.defaultProps={inEmbed:!0,siteUrl:h().string.isRequired},C.propTypes={inEmbed:h().bool};var N=a(5338),x=a(6619),L=a(4350);const V={single:(0,v.translateString)("comment"),uppercaseSingle:(0,v.translateString)("COMMENT"),ucfirstSingle:(0,v.translateString)("Comment"),ucfirstPlural:(0,v.translateString)("Comments"),submitCommentText:(0,v.translateString)("SUBMIT"),disabledCommentsMsg:(0,v.translateString)("Comments are disabled")};function I(e){const t=(0,n.useRef)(null),[a,i]=(0,n.useState)(""),[r,d]=(0,n.useState)(!1),[c,m]=(0,n.useState)(!1),[u,p]=(0,n.useState)(-1),[g,h]=(0,n.useState)(""),[y]=(0,n.useState)(l.MemberContext._currentValue.is.anonymous?l.LinksContext._currentValue.signin+"?next=/"+window.location.href.replace(l.SiteContext._currentValue.url,"").replace(/^\//g,""):null);function E(){m(!0)}function b(){m(!1)}function S(){const e=[...o.MediaPageStore.get("users")],t=[];e.forEach(e=>{t.push({id:e.username,display:e.name})}),h(t)}function P(){t.current.style.height="";const e=t.current.scrollHeight,a=0<u?u:parseFloat(window.getComputedStyle(t.current).lineHeight);i(""),d(!1),p(a),t.current.style.height=Math.max(20,u*Math.ceil(e/a))+"px"}function w(){d(!1)}return(0,n.useEffect)(()=>(o.MediaPageStore.on("comment_submit",P),o.MediaPageStore.on("comment_submit_fail",w),!0===MediaCMS.features.media.actions.comment_mention&&o.MediaPageStore.on("users_load",S),()=>{o.MediaPageStore.removeListener("comment_submit",P),o.MediaPageStore.removeListener("comment_submit_fail",w),!0===MediaCMS.features.media.actions.comment_mention&&o.MediaPageStore.removeListener("users_load",S)})),l.MemberContext._currentValue.is.anonymous?n.createElement("div",{className:"comments-form"},n.createElement("div",{className:"comments-form-inner"},n.createElement(s.UserThumbnail,null),n.createElement("div",{className:"form"},n.createElement("a",{href:y,rel:"noffolow",className:"form-textarea-wrap",title:(0,v.translateString)("Add a ")+V.single+"..."},n.createElement("span",{className:"form-textarea"},(0,v.translateString)("Add a ")+V.single+"...")),n.createElement("div",{className:"form-buttons"},n.createElement("a",{href:y,rel:"noffolow",className:"disabled"},V.submitCommentText))))):n.createElement("div",{className:"comments-form"},n.createElement("div",{className:"comments-form-inner"},n.createElement(s.UserThumbnail,null),n.createElement("div",{className:"form"},n.createElement("div",{className:"form-textarea-wrap"+(c?" focused":"")},MediaCMS.features.media.actions.comment_mention?n.createElement(x.G,{inputRef:t,className:"form-textarea",rows:"1",placeholder:"Add a "+V.single+"...",value:a,onChange:function(e,a,n,l){t.current.style.height="",i(a),d(!0);const o=t.current.scrollHeight,r=0<u?u:parseFloat(window.getComputedStyle(t.current).lineHeight);p(r),t.current.style.height=Math.max(20,u*Math.ceil(o/r))+"px"},onFocus:E,onBlur:b},n.createElement(x.P,{data:g,markup:"@(___id___)[___display___]"})):n.createElement("textarea",{ref:t,className:"form-textarea",rows:"1",placeholder:"Add a "+V.single+"...",value:a,onChange:function(e){t.current.style.height="";const a=t.current.scrollHeight,n=0<u?u:parseFloat(window.getComputedStyle(t.current).lineHeight);i(t.current.value),d(!0),p(n),t.current.style.height=Math.max(20,u*Math.ceil(a/n))+"px"},onFocus:E,onBlur:b})),n.createElement("div",{className:"form-buttons"},n.createElement("button",{className:""===a.trim()?"disabled":"",onClick:function(){if(!r)return;const e=a.trim();""!==e&&f.MediaPageActions.submitComment(e)}},V.submitCommentText)))))}I.propTypes={comment_type:h().oneOf(["new","reply"]),media_id:h().oneOfType([h().string,h().number]).isRequired,reply_comment_id:h().oneOfType([h().string,h().number])},I.defaultProps={comment_type:"new"};function A(e){const[t,a,i]=(0,N.usePopup)();return n.createElement("div",{className:"comment-actions"},l.MemberContext._currentValue.can.deleteComment?n.createElement("div",{className:"comment-action remove-comment"},n.createElement(i,{contentRef:t},n.createElement("button",null,(0,v.translateString)("DELETE")," ",V.uppercaseSingle)),n.createElement(a,{contentRef:t},n.createElement(s.PopupMain,null,n.createElement("div",{className:"popup-message"},n.createElement("span",{className:"popup-message-title"},V.ucfirstSingle," removal"),n.createElement("span",{className:"popup-message-main"},"You're willing to remove ",V.single," permanently?")),n.createElement("hr",null),n.createElement("span",{className:"popup-message-bottom"},n.createElement("button",{className:"button-link cancel-comment-removal",onClick:function(){t.current.toggle()}},"CANCEL"),n.createElement("button",{className:"button-link proceed-comment-removal",onClick:function(){t.current.toggle(),f.MediaPageActions.deleteComment(e.comment_id)}},"PROCEED"))))):null)}function T(e){const t=(0,n.useRef)(null),a=(0,n.useRef)(null),[i,o]=(0,n.useState)(!0),[r,s]=(0,n.useState)(!1);return(0,n.useEffect)(()=>()=>{},[]),n.createElement("div",{className:"comment"},n.createElement("div",{className:"comment-inner"},n.createElement("a",{className:"comment-author-thumb",href:e.author_link,title:e.author_name},n.createElement("img",{src:e.author_thumb,alt:e.author_name})),n.createElement("div",{className:"comment-content"},n.createElement("div",{className:"comment-meta"},n.createElement("div",{className:"comment-author"},n.createElement("a",{href:e.author_link,title:e.author_name},e.author_name)),n.createElement("div",{className:"comment-date"},(0,v.replaceString)((0,L.GP)(new Date(e.publish_date))))),n.createElement("div",{ref:t,className:"comment-text"+(i?" show-all":"")},n.createElement("div",{ref:a,className:"comment-text-inner",dangerouslySetInnerHTML:(d=e.text,{__html:d.replace(/\n/g,"<br />")})})),r?n.createElement("button",{className:"toggle-more",onClick:function(){o(!i)}},i?"Show less":"Read more"):null,l.MemberContext._currentValue.can.deleteComment?n.createElement(A,{comment_id:e.comment_id}):null)));var d}T.propTypes={comment_id:h().oneOfType([h().string,h().number]).isRequired,media_id:h().oneOfType([h().string,h().number]).isRequired,text:h().string,author_name:h().string,author_link:h().string,author_thumb:h().string,publish_date:h().oneOfType([h().string,h().number]),likes:h().number,dislikes:h().number},T.defaultProps={author_name:"",author_link:"#",publish_date:0,likes:0,dislikes:0};const R=({commentsLength:e})=>n.createElement(n.Fragment,null,!l.MemberContext._currentValue.can.readComment||o.MediaPageStore.get("media-data").enable_comments?null:n.createElement("span",{className:"disabled-comments-msg"},V.disabledCommentsMsg),l.MemberContext._currentValue.can.readComment&&(o.MediaPageStore.get("media-data").enable_comments||l.MemberContext._currentValue.can.editMedia)?n.createElement("h2",null,e?1<e?e+" "+V.ucfirstPlural:e+" "+V.ucfirstSingle:o.MediaPageStore.get("media-data").enable_comments?(0,v.translateString)("No")+" "+V.single+" "+(0,v.translateString)("yet"):""):null);function D(e){const[t,a]=(0,n.useState)(o.MediaPageStore.get("media-id")),[i,r]=(0,n.useState)(l.MemberContext._currentValue.can.readComment?o.MediaPageStore.get("media-comments"):[]),[s,d]=(0,n.useState)(!1);function c(){const e=[...o.MediaPageStore.get("media-comments")];e.forEach(e=>{e.text=function(e){const t=new RegExp("((\\d)?\\d:)?(\\d)?\\d:\\d\\d","g");return e.replace(t,function(e,t){let a=e.split(":"),i=0,n=1;for(;a.length>0;)i+=n*parseInt(a.pop(),10),n*=60;return`<a href="#" data-timestamp="${i}" class="video-timestamp">${e}</a>`})}(e.text)}),function(){var e=document.querySelector(".page-main"),t=e.querySelector(".no-comment");const a=o.PageStore.get("config-contents").uploader.postUploadMessage;if(""===a)t&&0===comm.length&&t.parentNode.removeChild(t);else if(0===comm.length&&"unlisted"===o.MediaPageStore.get("media-data").state){if(-1<l.LinksContext._currentValue.profile.media.indexOf(o.MediaPageStore.get("media-data").author_profile)&&!t){const t=document.createElement("div");t.setAttribute("role","alert"),t.setAttribute("class","alert info alert-dismissible no-comment"),t.innerHTML='<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>'+a,e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t),t.querySelector("button.close").addEventListener("click",function(e){return t.setAttribute("class","alert info alert-dismissible hiding"),setTimeout(function(){t.parentNode.removeChild(t)},400),e.preventDefault(),e.stopPropagation(),!1})}}else t&&0<comm.length&&t.parentNode.removeChild(t)}(),r([...e])}function m(e){c(),setTimeout(()=>f.PageActions.addNotification(V.ucfirstSingle+" added","commentSubmit"),100)}function u(){setTimeout(()=>f.PageActions.addNotification(V.ucfirstSingle+" submission failed","commentSubmitFail"),100)}function p(e){c(),setTimeout(()=>f.PageActions.addNotification(V.ucfirstSingle+" removed","commentDelete"),100)}function g(e){setTimeout(()=>f.PageActions.addNotification(V.ucfirstSingle+" removal failed","commentDeleteFail"),100)}return(0,n.useEffect)(()=>{d(i.length&&l.MemberContext._currentValue.can.readComment&&(o.MediaPageStore.get("media-data").enable_comments||l.MemberContext._currentValue.can.editMedia))},[i]),(0,n.useEffect)(()=>(o.MediaPageStore.on("comments_load",c),o.MediaPageStore.on("comment_submit",m),o.MediaPageStore.on("comment_submit_fail",u),o.MediaPageStore.on("comment_delete",p),o.MediaPageStore.on("comment_delete_fail",g),()=>{o.MediaPageStore.removeListener("comments_load",c),o.MediaPageStore.removeListener("comment_submit",m),o.MediaPageStore.removeListener("comment_submit_fail",u),o.MediaPageStore.removeListener("comment_delete",p),o.MediaPageStore.removeListener("comment_delete_fail",g)}),[]),n.createElement("div",{className:"comments-list"},n.createElement("div",{className:"comments-list-inner"},n.createElement(R,{commentsLength:i.length}),o.MediaPageStore.get("media-data").enable_comments?n.createElement(I,{media_id:t}):null,s?i.map(e=>n.createElement(T,{key:e.uid,comment_id:e.uid,media_id:t,text:e.text,author_name:e.author_name,author_link:e.author_profile,author_thumb:l.SiteContext._currentValue.url+"/"+e.author_thumbnail_url.replace(/^\//g,""),publish_date:e.add_date,likes:0,dislikes:0})):null))}var O=a(5697);function U(e){let t,a,i=[];if(e&&e.length)for(t=0,a=1<e.length?", ":"";t<e.length;)i[t]=n.createElement("div",{key:t},n.createElement("a",{href:e[t].url,title:e[t].title},e[t].title),t<e.length-1?a:""),t+=1;return i}function j(e){return n.createElement("div",{className:"media-author-banner"},n.createElement("div",null,n.createElement("a",{className:"author-banner-thumb",href:e.link||null,title:e.name},n.createElement("span",{style:{backgroundImage:"url("+e.thumb+")"}},n.createElement("img",{src:e.thumb,loading:"lazy",alt:e.name,title:e.name})))),n.createElement("div",null,n.createElement("span",null,n.createElement("a",{href:e.link,className:"author-banner-name",title:e.name},n.createElement("span",null,e.name))),o.PageStore.get("config-media-item").displayPublishDate&&e.published?n.createElement("span",{className:"author-banner-date"},(0,v.translateString)("Published on")," ",(0,v.replaceString)((0,v.publishedOnDate)(new Date(e.published)))):null))}function F(e){return n.createElement("div",{className:e.id.trim()?"media-content-"+e.id.trim():null},n.createElement("div",{className:"media-content-field"},n.createElement("div",{className:"media-content-field-label"},n.createElement("h4",null,e.title)),n.createElement("div",{className:"media-content-field-content"},e.value)))}function H(e){let t=e.link;return window.MediaCMS.site.devEnv&&(t="/edit-media.html"),n.createElement("a",{href:t,rel:"nofollow",title:(0,v.translateString)("Edit media"),className:"edit-media"},(0,v.translateString)("EDIT MEDIA"))}function q(e){const{userCan:t}=(0,N.useUser)(),a=e.description.trim(),i=!o.PageStore.get("config-enabled").taxonomies.tags||o.PageStore.get("config-enabled").taxonomies.tags.enabled?U(o.MediaPageStore.get("media-tags")):[],r=o.PageStore.get("config-options").pages.media.categoriesWithTitle?[]:!o.PageStore.get("config-enabled").taxonomies.categories||o.PageStore.get("config-enabled").taxonomies.categories.enabled?U(o.MediaPageStore.get("media-categories")):[];let d=o.MediaPageStore.get("media-summary");d=d?d.trim():"";const[c,m,u]=(0,N.usePopup)(),[p,g]=(0,n.useState)(""!==d),[h,y]=(0,n.useState)(""==d);function E(e){setTimeout(function(){f.PageActions.addNotification("Media removed. Redirecting...","mediaDelete"),setTimeout(function(){window.location.href=l.SiteContext._currentValue.url+"/"+o.MediaPageStore.get("media-data").author_profile.replace(/^\//g,"")},2e3)},100),void 0!==e&&O.info("Removed media '"+e+'"')}function b(e){setTimeout(function(){f.PageActions.addNotification("Media removal failed","mediaDeleteFail")},100),void 0!==e&&O.info('Media "'+e+'" removal failed')}(0,n.useEffect)(()=>(o.MediaPageStore.on("media_delete",E),o.MediaPageStore.on("media_delete_fail",b),()=>{o.MediaPageStore.removeListener("media_delete",E),o.MediaPageStore.removeListener("media_delete_fail",b)}),[]);const S=(0,v.formatInnerLink)(e.author.url,l.SiteContext._currentValue.url),P=(0,v.formatInnerLink)(e.author.thumb,l.SiteContext._currentValue.url);return n.createElement("div",{className:"media-info-content"},void 0===o.PageStore.get("config-media-item").displayAuthor||null===o.PageStore.get("config-media-item").displayAuthor||o.PageStore.get("config-media-item").displayAuthor?n.createElement(j,{link:S,thumb:P,name:e.author.name,published:e.published}):null,n.createElement("div",{className:"media-content-banner"},n.createElement("div",{className:"media-content-banner-inner"},p?n.createElement("div",{className:"media-content-summary"},d):null,p&&!h||!a?null:n.createElement("div",{className:"media-content-description",dangerouslySetInnerHTML:{__html:function(e){const t=new RegExp("((\\d)?\\d:)?(\\d)?\\d:\\d\\d","g");return e.replace(t,function(e,t){let a=e.split(":"),i=0,n=1;for(;a.length>0;)i+=n*parseInt(a.pop(),10),n*=60;return`<a href="#" data-timestamp="${i}" class="video-timestamp">${e}</a>`})}(a)}}),p?n.createElement("button",{className:"load-more",onClick:function(){y(!h)}},h?"SHOW LESS":"SHOW MORE"):null,i.length?n.createElement(F,{value:i,title:1<i.length?(0,v.translateString)("Tags"):(0,v.translateString)("Tag"),id:"tags"}):null,r.length?n.createElement(F,{value:r,title:1<r.length?(0,v.translateString)("Categories"):(0,v.translateString)("Category"),id:"categories"}):null,t.editMedia||t.deleteMedia?n.createElement("div",{className:"media-author-actions"},t.editMedia?n.createElement(H,{link:o.MediaPageStore.get("media-data").edit_url}):null,n.createElement(u,{contentRef:c},n.createElement("button",{className:"remove-media"},(0,v.translateString)("DELETE MEDIA"))),n.createElement(m,{contentRef:c},n.createElement(s.PopupMain,null,n.createElement("div",{className:"popup-message"},n.createElement("span",{className:"popup-message-title"},"Media removal"),n.createElement("span",{className:"popup-message-main"},"You're willing to remove media permanently?")),n.createElement("hr",null),n.createElement("span",{className:"popup-message-bottom"},n.createElement("button",{className:"button-link cancel-comment-removal",onClick:function(){c.current.toggle()}},"CANCEL"),n.createElement("button",{className:"button-link proceed-comment-removal",onClick:function(){f.MediaPageActions.removeMedia(),c.current.toggle()}},"PROCEED"))))):null)),n.createElement(D,null))}function B(){const[e,t]=(0,n.useState)(o.MediaPageStore.get("user-disliked-media")),[a,i]=(0,n.useState)((0,v.formatViewsNumber)(o.MediaPageStore.get("media-dislikes"),!1));function r(){t(o.MediaPageStore.get("user-disliked-media")),i((0,v.formatViewsNumber)(o.MediaPageStore.get("media-dislikes"),!1))}function d(){r(),f.PageActions.addNotification(l.TextsContext._currentValue.messages.addToDisliked,"mediaDislike")}function c(){r(),f.PageActions.addNotification(l.TextsContext._currentValue.messages.removeFromDisliked,"cancelMediaDislike")}function m(){f.PageActions.addNotification("Action failed","mediaDislikeRequestFail")}return(0,n.useEffect)(()=>(o.MediaPageStore.on("disliked_media",d),o.MediaPageStore.on("undisliked_media",c),o.MediaPageStore.on("disliked_media_failed_request",m),()=>{o.MediaPageStore.removeListener("disliked_media",d),o.MediaPageStore.removeListener("undisliked_media",c),o.MediaPageStore.removeListener("disliked_media_failed_request",m)}),[]),n.createElement("div",{className:"like"},n.createElement("button",{onClick:function(t){t.preventDefault(),t.stopPropagation(),f.MediaPageActions[e?"undislikeMedia":"dislikeMedia"]()}},n.createElement(s.CircleIconButton,{type:"span"},n.createElement(s.MaterialIcon,{type:"thumb_down"})),n.createElement("span",{className:"dislikes-counter"},a)))}function z(){const[e,t]=(0,n.useState)(o.MediaPageStore.get("user-liked-media")),[a,i]=(0,n.useState)((0,v.formatViewsNumber)(o.MediaPageStore.get("media-likes"),!1));function r(){t(o.MediaPageStore.get("user-liked-media")),i((0,v.formatViewsNumber)(o.MediaPageStore.get("media-likes"),!1))}function d(){r(),f.PageActions.addNotification(l.TextsContext._currentValue.addToLiked,"likedMedia")}function c(){r(),f.PageActions.addNotification(l.TextsContext._currentValue.removeFromLiked,"unlikedMedia")}function m(){f.PageActions.addNotification("Action failed","likedMediaRequestFail")}return(0,n.useEffect)(()=>(o.MediaPageStore.on("liked_media",d),o.MediaPageStore.on("unliked_media",c),o.MediaPageStore.on("liked_media_failed_request",m),()=>{o.MediaPageStore.removeListener("liked_media",d),o.MediaPageStore.removeListener("unliked_media",c),o.MediaPageStore.removeListener("liked_media_failed_request",m)}),[]),n.createElement("div",{className:"like"},n.createElement("button",{onClick:function(t){t.preventDefault(),t.stopPropagation(),f.MediaPageActions[e?"unlikeMedia":"likeMedia"]()}},n.createElement(s.CircleIconButton,{type:"span"},n.createElement(s.MaterialIcon,{type:"thumb_up"})),n.createElement("span",{className:"likes-counter"},a)))}function W(e){const t=(0,n.useRef)(null),a=(0,n.useRef)(null),[i,l]=(0,n.useState)(null);function r(){l(window.innerHeight-(104+t.current.offsetHeight))}return(0,n.useEffect)(()=>(r(),o.PageStore.on("window_resize",r),()=>{o.PageStore.removeListener("window_resize",r)}),[]),n.createElement("form",null,n.createElement("div",{className:"report-form",style:null!==i?{maxHeight:i+"px"}:null},n.createElement("div",{className:"form-title"},"Report media"),n.createElement("div",{className:"form-field"},n.createElement("span",{className:"label"},"URL"),n.createElement("input",{type:"text",readOnly:!0,value:e.mediaUrl})),n.createElement("div",{className:"form-field"},n.createElement("span",{className:"label"},"Description"),n.createElement("textarea",{ref:a,required:!0})),n.createElement("div",{className:"form-field form-help-text"},"Reported media is reviewed")),n.createElement("div",{ref:t,className:"form-actions-bottom"},n.createElement("button",{className:"cancel",onClick:function(t){t.preventDefault(),void 0!==e.cancelReportForm&&e.cancelReportForm()}},"CANCEL"),n.createElement("button",{onClick:function(t){const i=a.current.value.trim();""!==i&&(t.preventDefault(),void 0!==e.submitReportForm&&e.submitReportForm(i))}},"SUBMIT")))}function G(e,t){const a=l.SiteContext._currentValue,i=e.encodings_info,n={};let o,r;for(o in i)if(i.hasOwnProperty(o)&&Object.keys(i[o]).length)for(r in i[o])i[o].hasOwnProperty(r)&&"success"===i[o][r].status&&100===i[o][r].progress&&null!==i[o][r].url&&(n[i[o][r].title]={text:o+" - "+r.toUpperCase()+" ("+i[o][r].size+")",link:(0,v.formatInnerLink)(i[o][r].url,a.url),linkAttr:{target:"_blank",download:e.title+"_"+o+"_"+r.toUpperCase()}});return n.original_media_url={text:"Original file ("+e.size+")",link:(0,v.formatInnerLink)(e.original_media_url,a.url),linkAttr:{target:"_blank",download:e.title}},Object.values(n)}function Y(e,t,a,i,l,o,r){const d=t.url,c=t.media_type,m=t.state||"N/A",u=t.encoding_status||"N/A",p=t.reported_times,g=t.is_reviewed,h="video"===c,f=function(e,t,a,i,n){const l=[],o="video"===t.media_type,r=t.reported_times;return a&&e.downloadMedia&&(o?l.push({itemType:"open-subpage",text:"Download",icon:"arrow_downward",itemAttr:{className:"visible-only-in-small"},buttonAttr:{className:"change-page","data-page-id":"videoDownloadOptions"}}):i&&l.push({itemType:"link",link:i,text:"Download",icon:"arrow_downward",itemAttr:{className:"visible-only-in-small"},linkAttr:{target:"_blank",download:t.title}})),o&&e.editMedia&&l.push({itemType:"open-subpage",text:"Status info",icon:"info",buttonAttr:{className:"change-page","data-page-id":"mediaStatusInfo"}}),e.reportMedia&&(n?l.push({itemType:"div",text:"Reported",icon:"flag",divAttr:{className:"reported-label loggedin-media-reported"}}):l.push({itemType:"open-subpage",text:"Report",icon:"flag",buttonAttr:{className:"change-page"+(r?" loggedin-media-reported":""),"data-page-id":"loggedInReportMedia"}})),l}(e,t,a,i,l),v={};return f.length&&(v.main=n.createElement("div",{className:"main-options"},n.createElement(s.PopupMain,null,n.createElement(s.NavigationMenuList,{items:f})))),e.reportMedia&&(v.loggedInReportMedia=l?null:n.createElement("div",{className:"popup-fullscreen"},n.createElement(s.PopupMain,null,n.createElement("span",{className:"popup-fullscreen-overlay"}),n.createElement("div",null,n.createElement(W,{mediaUrl:d,submitReportForm:o,cancelReportForm:r}))))),e.editMedia&&(v.mediaStatusInfo=n.createElement("div",{className:"main-options"},n.createElement(s.PopupMain,null,n.createElement("ul",{className:"media-status-info"},n.createElement("li",null,"Media type: ",n.createElement("span",null,c)),n.createElement("li",null,"State: ",n.createElement("span",null,m)),n.createElement("li",null,"Review state: ",n.createElement("span",null,g?"Is reviewed":"Pending review")),h?n.createElement("li",null,"Encoding Status: ",n.createElement("span",null,u)):null,p?n.createElement("li",{className:"reports"},"Reports: ",n.createElement("span",null,p)):null)))),a&&e.downloadMedia&&h&&(v.videoDownloadOptions=n.createElement("div",{className:"video-download-options"},n.createElement(s.PopupMain,null,n.createElement(s.NavigationMenuList,{items:G(t)})))),v}W.propTypes={mediaUrl:h().string.isRequired,cancelReportForm:h().func,submitReportForm:h().func};const $="more-options active-options";function J(e){const{userCan:t}=(0,N.useUser)(),a=l.SiteContext._currentValue,i=(0,v.formatInnerLink)(o.MediaPageStore.get("media-original-url"),a.url),r=o.MediaPageStore.get("media-data"),d="video"===r.media_type,[c,m,u]=(0,N.usePopup)(),[p,g]=(0,n.useState)(!1),[h,y]=(0,n.useState)(!1),[E,b]=(0,n.useState)({}),[S,P]=(0,n.useState)("main"),[w,M]=(0,n.useState)($);function _(e){f.MediaPageActions.reportMedia(e)}function k(){c.current.toggle()}function C(){c.current.tryToHide(),setTimeout(function(){f.PageActions.addNotification("Media Reported","reportedMedia"),y(!0),o.MediaPageStore.removeListener("reported_media",C)},100)}return(0,n.useEffect)(()=>{h||(p?o.MediaPageStore.on("reported_media",C):o.MediaPageStore.removeListener("reported_media",C))},[p]),(0,n.useEffect)(()=>{g(Object.keys(E).length&&e.allowDownload&&t.downloadMedia)},[E]),(0,n.useEffect)(()=>{let a=$;e.allowDownload&&t.downloadMedia&&"videoDownloadOptions"===S&&(a+=" video-downloads"),1===Object.keys(E).length&&e.allowDownload&&t.downloadMedia&&(d||i)&&(a+=" visible-only-in-small"),M(a)},[S]),(0,n.useEffect)(()=>{b(Y(t,r,e.allowDownload,i,h,_,k))},[h]),(0,n.useEffect)(()=>(b(Y(t,r,e.allowDownload,i,h,_,k)),()=>{p&&!h&&o.MediaPageStore.removeListener("reported_media",C)}),[]),p?n.createElement("div",{className:w},n.createElement(u,{contentRef:c},n.createElement("span",null,n.createElement(s.CircleIconButton,{type:"button"},n.createElement(s.MaterialIcon,{type:"more_horiz"})))),n.createElement("div",{className:"nav-page-"+S},n.createElement(m,{contentRef:c,hideCallback:function(){P("main")}},n.createElement(s.NavigationContentApp,{pageChangeCallback:function(e){P(e)},initPage:S,focusFirstItemOnPageChange:!1,pages:E,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id"})))):null}J.propTypes={allowDownload:h().bool.isRequired},J.defaultProps={allowDownload:!1};var Z=a(3706);function Q(e){return e.renderDate?n.createElement("label",null,n.createElement("input",{type:"checkbox",checked:e.isChecked,onChange:function(t){t.persist(),e.isChecked?f.MediaPageActions.removeMediaFromPlaylist(e.playlistId,o.MediaPageStore.get("media-id")):f.MediaPageActions.addMediaToPlaylist(e.playlistId,o.MediaPageStore.get("media-id"))}}),n.createElement("span",null,e.title)):null}function X(e){const t=(0,n.useRef)(null),a=(0,n.useRef)(null),[i,l]=(0,n.useState)(new Date),[r,d]=(0,n.useState)(o.MediaPageStore.get("playlists")),[c,m]=(0,n.useState)(!1);function u(){E()}function p(){d(o.MediaPageStore.get("playlists")),l(new Date)}function g(){d(o.MediaPageStore.get("playlists")),l(new Date),setTimeout(function(){f.PageActions.addNotification("Media added to playlist","playlistMediaAdditionComplete")},100)}function h(){setTimeout(function(){f.PageActions.addNotification("Media's addition to playlist failed","playlistMediaAdditionFail")},100)}function v(){d(o.MediaPageStore.get("playlists")),l(new Date),setTimeout(function(){f.PageActions.addNotification("Media removed from playlist","playlistMediaRemovalComplete")},100)}function y(){setTimeout(function(){f.PageActions.addNotification("Media's removal from playlist failed","playlistMediaaRemovalFail")},100)}function E(){null!==a.current&&(a.current.style.maxHeight=window.innerHeight-74-(t.current.offsetHeight-a.current.offsetHeight)+"px")}function b(){m(!c),E()}return(0,n.useEffect)(()=>{E()}),(0,n.useEffect)(()=>(o.PageStore.on("window_resize",u),o.MediaPageStore.on("playlists_load",p),o.MediaPageStore.on("media_playlist_addition_completed",g),o.MediaPageStore.on("media_playlist_addition_failed",h),o.MediaPageStore.on("media_playlist_removal_completed",v),o.MediaPageStore.on("media_playlist_removal_failed",y),()=>{o.PageStore.removeListener("window_resize",u),o.MediaPageStore.removeListener("playlists_load",p),o.MediaPageStore.removeListener("media_playlist_addition_completed",g),o.MediaPageStore.removeListener("media_playlist_addition_failed",h),o.MediaPageStore.removeListener("media_playlist_removal_completed",v),o.MediaPageStore.removeListener("media_playlist_removal_failed",y)}),[]),n.createElement("div",{ref:t,className:"saveto-popup"},n.createElement("div",{className:"saveto-title"},"Save to...",n.createElement(s.CircleIconButton,{type:"button",onClick:function(){m(!1),void 0!==e.triggerPopupClose&&e.triggerPopupClose()}},n.createElement(s.MaterialIcon,{type:"close"}))),r.length?n.createElement("div",{ref:a,className:"saveto-select"},function(){const e=o.MediaPageStore.get("media-id");let t=[],a=0;for(;a<r.length;)t.push(n.createElement("div",{key:"playlist_"+r[a].playlist_id},n.createElement(Q,{renderDate:i,title:r[a].title,privacy:r[a].status,isChecked:-1<r[a].media_list.indexOf(e),playlistId:r[a].playlist_id}))),a+=1;return t}()):null,c?n.createElement("div",{className:"saveto-new-playlist"},n.createElement(Z.w,{onCancel:b,onPlaylistSave:function(e){f.MediaPageActions.addNewPlaylist(e),b()}})):n.createElement(s.CircleIconButton,{className:"saveto-create",type:"button",onClick:b},n.createElement(s.MaterialIcon,{type:"add"}),"Create a new playlist"))}function K(e){const[t,a,i]=(0,N.usePopup)(),[l,o]=(0,n.useState)("selectPlaylist");return n.createElement("div",{className:"save"},n.createElement(i,{contentRef:t},n.createElement("button",null,n.createElement(s.CircleIconButton,{type:"span"},n.createElement(s.MaterialIcon,{type:"playlist_add"})),n.createElement("span",null,(0,v.translateString)("SAVE")))),n.createElement(a,{contentRef:t},n.createElement(s.NavigationContentApp,{initPage:l,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id",pages:(r=function(){t.current.toggle()},{selectPlaylist:n.createElement("div",{className:"popup-fullscreen"},n.createElement(s.PopupMain,null,n.createElement("span",{className:"popup-fullscreen-overlay"}),n.createElement(X,{triggerPopupClose:r}))),createPlaylist:n.createElement("div",{className:"popup-fullscreen"},n.createElement(s.PopupMain,null,n.createElement("span",{className:"popup-fullscreen-overlay"})))}),focusFirstItemOnPageChange:!1,pageChangeCallback:o})));var r}function ee(e){const t=o.PageStore.get("config-options").embedded.video.dimensions,a=(0,n.useContext)(l.LinksContext),i=(0,n.useRef)(null),r=(0,n.useRef)(null),d=(0,n.useRef)(null),c=(0,n.useRef)(null),m=(0,n.useRef)(null),[u,p]=(0,n.useState)(window.innerHeight-144+56),[g,h]=(0,n.useState)(!1),[v,y]=(0,n.useState)("16:9"),[E,b]=(0,n.useState)(t.width),[S,P]=(0,n.useState)(t.widthUnit),[w,M]=(0,n.useState)(t.height),[_,k]=(0,n.useState)(t.heightUnit),[N,x]=(0,n.useState)(60),[L,V]=(0,n.useState)(60),[I,A]=(0,n.useState)([{key:"px",label:"px"},{key:"percent",label:"%"}]);function T(){p(window.innerHeight-144+56),x(d.current.offsetHeight),V(m.current.offsetHeight)}function R(){setTimeout(function(){f.PageActions.addNotification("Embed media code copied to clipboard","clipboardEmbedMediaCodeCopy")},100)}return(0,n.useEffect)(()=>{p(window.innerHeight-144+56),x(d.current.offsetHeight),V(m.current.offsetHeight)}),(0,n.useEffect)(()=>(o.PageStore.on("window_resize",T),o.MediaPageStore.on("copied_embed_media_code",R),()=>{o.PageStore.removeListener("window_resize",T),o.MediaPageStore.removeListener("copied_embed_media_code",R)}),[]),n.createElement("div",{className:"share-embed",style:{maxHeight:u+"px"}},n.createElement("div",{className:"share-embed-inner"},n.createElement("div",{className:"on-left"},n.createElement("div",{className:"media-embed-wrap"},n.createElement(l.SiteConsumer,null,e=>n.createElement(C,{data:o.MediaPageStore.get("media-data"),siteUrl:e.url,inEmbed:!0})))),n.createElement("div",{ref:r,className:"on-right"},n.createElement("div",{ref:d,className:"on-right-top"},n.createElement("div",{className:"on-right-top-inner"},n.createElement("span",{className:"ttl"},"Embed Video"),n.createElement(s.CircleIconButton,{type:"button",onClick:function(){void 0!==e.triggerPopupClose&&e.triggerPopupClose()}},n.createElement(s.MaterialIcon,{type:"close"})))),n.createElement("div",{ref:c,className:"on-right-middle",style:{top:N+"px",bottom:L+"px"}},n.createElement("textarea",{readOnly:!0,value:'<iframe width="'+("percent"===S?E+"%":E)+'" height="'+("percent"===_?w+"%":w)+'" src="'+a.embed+o.MediaPageStore.get("media-id")+'" frameborder="0" allowfullscreen></iframe>'}),n.createElement("div",{className:"iframe-config"},n.createElement("div",{className:"iframe-config-options-title"},"Embed options"),n.createElement("div",{className:"iframe-config-option"},n.createElement("div",{className:"option-content"},n.createElement("div",{className:"ratio-options"},n.createElement("div",{className:"options-group"},n.createElement("label",{style:{minHeight:"36px"}},n.createElement("input",{type:"checkbox",checked:g,onChange:function(){const e=!g,t=v.split(":"),a=t[0],i=t[1];h(e),P(e?"px":S),k(e?"px":_),M(e?parseInt(E*i/a,10):w),A(e?[{key:"px",label:"px"}]:[{key:"px",label:"px"},{key:"percent",label:"%"}])}}),"Keep aspect ratio")),g?n.createElement("div",{className:"options-group"},n.createElement("select",{ref:i,onChange:function(){const e=i.current.value,t=e.split(":"),a=t[0],n=t[1];y(e),M(g?parseInt(E*n/a,10):w)},value:v},n.createElement("optgroup",{label:"Horizontal orientation"},n.createElement("option",{value:"16:9"},"16:9"),n.createElement("option",{value:"4:3"},"4:3"),n.createElement("option",{value:"3:2"},"3:2")),n.createElement("optgroup",{label:"Vertical orientation"},n.createElement("option",{value:"9:16"},"9:16"),n.createElement("option",{value:"3:4"},"3:4"),n.createElement("option",{value:"2:3"},"2:3")))):null),n.createElement("br",null),n.createElement("div",{className:"options-group"},n.createElement(s.NumericInputWithUnit,{valueCallback:function(e){e=""===e?0:e;const t=v.split(":"),a=t[0],i=t[1];b(e),M(g?parseInt(e*i/a,10):w)},unitCallback:function(e){P(e)},label:"Width",defaultValue:parseInt(E,10),defaultUnit:S,minValue:1,maxValue:99999,units:I})),n.createElement("div",{className:"options-group"},n.createElement(s.NumericInputWithUnit,{valueCallback:function(e){e=""===e?0:e;const t=v.split(":"),a=t[0],i=t[1];M(e),b(g?parseInt(e*a/i,10):E)},unitCallback:function(e){k(e)},label:"Height",defaultValue:parseInt(w,10),defaultUnit:_,minValue:1,maxValue:99999,units:I})))))),n.createElement("div",{ref:m,className:"on-right-bottom"},n.createElement("button",{onClick:function(){f.MediaPageActions.copyEmbedMediaCode(c.current.querySelector("textarea"))}},"COPY")))))}Q.propTypes={playlistId:h().string,isChecked:h().bool,title:h().string},Q.defaultProps={isChecked:!1,title:""},X.propTypes={triggerPopupClose:h().func},ee.propTypes={triggerPopupClose:h().func};var te=a(5289);function ae({onClick:e}){return n.createElement("span",{className:"next-slide"},n.createElement(s.CircleIconButton,{buttonShadow:!0,onClick:e},n.createElement("i",{className:"material-icons"},"keyboard_arrow_right")))}function ie({onClick:e}){return n.createElement("span",{className:"previous-slide"},n.createElement(s.CircleIconButton,{buttonShadow:!0,onClick:e},n.createElement("i",{className:"material-icons"},"keyboard_arrow_left")))}function ne(){return{maxFormContentHeight:window.innerHeight-196,maxPopupWidth:518>window.innerWidth-80?window.innerWidth-80:null}}function le(e){const t=(0,n.useRef)(null),a=(0,n.useRef)(null),i=o.MediaPageStore.get("media-url"),[r,s]=(0,n.useState)(null),[d,c]=(0,n.useState)({prev:!1,next:!1}),[m,u]=(0,n.useState)(ne()),[p]=(0,n.useState)(function(){const e=function(){const e=l.ShareOptionsContext._currentValue,t=o.MediaPageStore.get("media-url"),a=(o.MediaPageStore.get("media-data").title,{});let i=0;for(;i<e.length;){switch(e[i]){case"embed":"video"===o.MediaPageStore.get("media-data").media_type&&(a[e[i]]={});break;case"email":a[e[i]]={title:"Email",shareUrl:"mailto:?body="+t}}i+=1}return a}(),t=[];for(let a in e)e.hasOwnProperty(a)&&("embed"===a?t.push(n.createElement("div",{key:"share-"+a,className:"sh-option share-"+a+"-opt"},n.createElement("button",{className:"sh-option change-page","data-page-id":"shareEmbed"},n.createElement("span",null,n.createElement("i",{className:"material-icons"},"code")),n.createElement("span",null,"Embed")))):"email"===a?t.push(n.createElement("div",{key:"share-email",className:"sh-option share-email"},n.createElement("a",{href:e[a].shareUrl,title:""},n.createElement("span",null,n.createElement("i",{className:"material-icons"},"email")),n.createElement("span",null,e[a].title)))):t.push(n.createElement("div",{key:"share-"+a,className:"sh-option share-"+a},n.createElement("a",{href:e[a].shareUrl,title:"",target:"_blank",rel:"noreferrer"},n.createElement("span",null),n.createElement("span",null,e[a].title)))));return t}()),[g,h]=(0,n.useState)(0),[v,y]=(0,n.useState)(0),[E,b]=(0,n.useState)(!1),[S,P]=(0,n.useState)(i);function w(){u(ne())}function M(){setTimeout(function(){f.PageActions.addNotification("Link copied to clipboard","clipboardLinkCopy")},100)}function _(){r.scrollToCurrentSlide(),c({prev:r.hasPreviousSlide(),next:r.hasNextSlide()})}return(0,n.useEffect)(()=>{s(new te.A(a.current,".sh-option"))},[p]),(0,n.useEffect)(()=>{r&&(r.updateDataStateOnResize(p.length,!0,!0),_())},[m,r]),(0,n.useEffect)(()=>{o.PageStore.on("window_resize",w),o.MediaPageStore.on("copied_media_link",M);const e=function(){const e=document.getElementsByTagName("video");return e[0]?.currentTime}();return h(e),y(function(e){let t=parseInt(e,10),a=Math.floor(t/3600),i=Math.floor((t-3600*a)/60),n=t-3600*a-60*i;return a<10&&(a="0"+a),i<10&&(i="0"+i),n<10&&(n="0"+n),a>=1?a+":"+i+":"+n:i+":"+n}(e)),()=>{o.PageStore.removeListener("window_resize",w),o.MediaPageStore.removeListener("copied_media_link",M),s(null)}},[]),n.createElement("div",{ref:t,style:null!==m.maxPopupWidth?{maxWidth:m.maxPopupWidth+"px"}:null},n.createElement("div",{className:"scrollable-content",style:null!==m.maxFormContentHeight?{maxHeight:m.maxFormContentHeight+"px"}:null},n.createElement("div",{className:"share-popup-title"},"Share media"),p.length?n.createElement("div",{className:"share-options"},d.prev?n.createElement(ie,{onClick:function(){r.previousSlide(),_()}}):null,n.createElement("div",{ref:a,className:"share-options-inner"},p),d.next?n.createElement(ae,{onClick:function(){r.nextSlide(),_()}}):null):null),n.createElement("div",{className:"copy-field"},n.createElement("div",null,n.createElement("input",{type:"text",readOnly:!0,value:S}),n.createElement("button",{onClick:function(){f.MediaPageActions.copyShareLink(t.current.querySelector(".copy-field input"))}},"COPY"))),n.createElement("div",{className:"start-at"},n.createElement("label",null,n.createElement("input",{type:"checkbox",name:"start-at-checkbox",id:"id-start-at-checkbox",checked:E,onChange:function(){b(!E),function(){const e=E?i:i+"&t="+Math.trunc(g);P(e)}()}}),"Start at ",v)))}function oe(){return{shareOptions:n.createElement("div",{className:"popup-fullscreen"},n.createElement(s.PopupMain,null,n.createElement("span",{className:"popup-fullscreen-overlay"}),n.createElement(le,null)))}}function re(e){const[t,a,i]=(0,N.usePopup)(),[l,o]=(0,n.useState)("shareOptions");return n.createElement("div",{className:"share"},n.createElement(i,{contentRef:t},n.createElement("button",null,n.createElement(s.CircleIconButton,{type:"span"},n.createElement(s.MaterialIcon,{type:"share"})),n.createElement("span",null,(0,v.translateString)("SHARE")))),n.createElement(a,{contentRef:t,hideCallback:function(){o("shareOptions")}},n.createElement(s.NavigationContentApp,{initPage:l,pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id",pages:e.isVideo?(r=function(){t.current.toggle()},{...oe(),shareEmbed:n.createElement("div",{className:"popup-fullscreen share-embed-popup"},n.createElement(s.PopupMain,null,n.createElement("span",{className:"popup-fullscreen-overlay"}),n.createElement(ee,{triggerPopupClose:r})))}):oe(),focusFirstItemOnPageChange:!1,pageChangeCallback:function(e){o(e)}})));var r}function se(e){return n.createElement("div",{className:"download hidden-only-in-small"},n.createElement("a",{href:e.link,target:"_blank",download:e.title,title:"Download",rel:"noreferrer"},n.createElement(s.CircleIconButton,{type:"span"},n.createElement(s.MaterialIcon,{type:"arrow_downward"})),n.createElement("span",null,"DOWNLOAD")))}function de(){const e=o.MediaPageStore.get("media-data"),t=(e.title,e.encodings_info),a={};let i,n;for(i in t)if(t.hasOwnProperty(i)&&Object.keys(t[i]).length)for(n in t[i])t[i].hasOwnProperty(n)&&"success"===t[i][n].status&&100===t[i][n].progress&&null!==t[i][n].url&&(a[t[i][n].title]={text:i+" - "+n.toUpperCase()+" ("+t[i][n].size+")",link:(0,v.formatInnerLink)(t[i][n].url,l.SiteContext._currentValue.url),linkAttr:{target:"_blank",download:e.title+"_"+i+"_"+n.toUpperCase()}});return a.original_media_url={text:"Original file ("+e.size+")",link:(0,v.formatInnerLink)(e.original_media_url,l.SiteContext._currentValue.url),linkAttr:{target:"_blank",download:e.title}},Object.values(a)}function ce(e){const[t,a,i]=(0,N.usePopup)(),[l,o]=(0,n.useState)("main");return n.createElement("div",{className:"video-downloads hidden-only-in-small"},n.createElement(i,{contentRef:t},n.createElement("button",null,n.createElement(s.CircleIconButton,{type:"span"},n.createElement(s.MaterialIcon,{type:"arrow_downward"})),n.createElement("span",null,(0,v.translateString)("DOWNLOAD")))),n.createElement("div",{className:"nav-page-"+l},n.createElement(a,{contentRef:t},n.createElement(s.NavigationContentApp,{pageChangeCallback:null,initPage:"main",focusFirstItemOnPageChange:!1,pages:{main:n.createElement("div",{className:"main-options"},n.createElement(s.PopupMain,null,n.createElement(s.NavigationMenuList,{items:de()})))},pageChangeSelector:".change-page",pageIdSelectorAttr:"data-page-id"}))))}se.propTypes={link:h().string.isRequired,title:h().string.isRequired};class me extends n.PureComponent{constructor(e){super(e),this.state={likedMedia:o.MediaPageStore.get("user-liked-media"),dislikedMedia:o.MediaPageStore.get("user-disliked-media")},this.downloadLink="video"!==o.MediaPageStore.get("media-type")?(0,v.formatInnerLink)(o.MediaPageStore.get("media-original-url"),l.SiteContext._currentValue.url):null,this.updateStateValues=this.updateStateValues.bind(this)}componentDidMount(){o.MediaPageStore.on("liked_media",this.updateStateValues),o.MediaPageStore.on("unliked_media",this.updateStateValues),o.MediaPageStore.on("disliked_media",this.updateStateValues),o.MediaPageStore.on("undisliked_media",this.updateStateValues);const e=document.querySelectorAll("[data-tooltip]");e.length&&e.forEach(e=>function(e){const t=document.body,a=document.createElement("span");function i(){const t=e.getBoundingClientRect();a.style.top=t.top-(0+a.offsetHeight)+"px",a.style.left=t.left+"px"}a.innerText=e.getAttribute("data-tooltip"),a.setAttribute("class","tooltip"),e.removeAttribute("data-tooltip"),e.addEventListener("mouseenter",function(){const n=e.getBoundingClientRect();t.appendChild(a),a.style.top=n.top-(0+a.offsetHeight)+"px",a.style.left=n.left+"px",document.addEventListener("scroll",i)}),e.addEventListener("mouseleave",function(){t.removeChild(a),a.style.top="",a.style.left="",document.removeEventListener("scroll",i)})}(e))}updateStateValues(){this.setState({likedMedia:o.MediaPageStore.get("user-liked-media"),dislikedMedia:o.MediaPageStore.get("user-disliked-media")})}mediaCategories(e){if(void 0===this.props.categories||null===this.props.categories||!this.props.categories.length)return null;let t=0,a=[];for(;t<this.props.categories.length;)a.push(n.createElement("span",{key:t},n.createElement("a",{href:(0,v.formatInnerLink)(this.props.categories[t].url,l.SiteContext._currentValue.url),title:this.props.categories[t].title},this.props.categories[t].title))),t+=1;return n.createElement("div",{className:"media-under-title-categories"+(e?" over-title":"")},a)}render(){const e=o.PageStore.get("config-options").pages.media.displayViews&&void 0!==this.props.views,t=o.MediaPageStore.get("media-data").state;let a="";switch(t){case"private":a="The site admins have to make its access public";break;case"unlisted":a="The site admins have to make it appear on listings"}return n.createElement("div",{className:"media-title-banner"},e&&o.PageStore.get("config-options").pages.media.categoriesWithTitle?this.mediaCategories(!0):null,void 0!==this.props.title?n.createElement("h1",null,this.props.title):null,"public"!==t?n.createElement("div",{className:"media-labels-area"},n.createElement("div",{className:"media-labels-area-inner"},n.createElement("span",{className:"media-label-state"},n.createElement("span",null,t)),n.createElement("span",{className:"helper-icon","data-tooltip":a},n.createElement("i",{className:"material-icons"},"help_outline")))):null,n.createElement("div",{className:"media-views-actions"+(this.state.likedMedia?" liked-media":"")+(this.state.dislikedMedia?" disliked-media":"")},!e&&o.PageStore.get("config-options").pages.media.categoriesWithTitle?this.mediaCategories():null,e?n.createElement("div",{className:"media-views"},(0,v.formatViewsNumber)(this.props.views,!0)," ",1>=this.props.views?"view":"views"):null,n.createElement("div",{className:"media-actions"},n.createElement("div",null,l.MemberContext._currentValue.can.likeMedia?n.createElement(z,null):null,l.MemberContext._currentValue.can.dislikeMedia?n.createElement(B,null):null,l.MemberContext._currentValue.can.shareMedia?n.createElement(re,{isVideo:!1}):null,!l.MemberContext._currentValue.is.anonymous&&l.MemberContext._currentValue.can.saveMedia&&-1<l.PlaylistsContext._currentValue.mediaTypes.indexOf(o.MediaPageStore.get("media-type"))?n.createElement(K,null):null,this.props.allowDownload&&l.MemberContext._currentValue.can.downloadMedia?this.downloadLink?n.createElement(se,{link:this.downloadLink,title:this.props.title}):n.createElement(ce,null):null,n.createElement(J,{allowDownload:this.props.allowDownload})))))}}me.propTypes={allowDownload:h().bool.isRequired},me.defaultProps={allowDownload:!1};class ue extends me{render(){const e=o.PageStore.get("config-options").pages.media.displayViews&&void 0!==this.props.views,t=o.MediaPageStore.get("media-data").state;let a="";switch(t){case"private":a="The site admins have to make its access public";break;case"unlisted":a="The site admins have to make it appear on listings"}return n.createElement("div",{className:"media-title-banner"},e&&o.PageStore.get("config-options").pages.media.categoriesWithTitle?this.mediaCategories(!0):null,void 0!==this.props.title?n.createElement("h1",null,this.props.title):null,"public"!==t?n.createElement("div",{className:"media-labels-area"},n.createElement("div",{className:"media-labels-area-inner"},n.createElement("span",{className:"media-label-state"},n.createElement("span",null,t)),n.createElement("span",{className:"helper-icon","data-tooltip":a},n.createElement("i",{className:"material-icons"},"help_outline")))):null,n.createElement("div",{className:"media-views-actions"+(this.state.likedMedia?" liked-media":"")+(this.state.dislikedMedia?" disliked-media":"")},!e&&o.PageStore.get("config-options").pages.media.categoriesWithTitle?this.mediaCategories():null,e?n.createElement("div",{className:"media-views"},(0,v.formatViewsNumber)(this.props.views,!0)," ",1>=this.props.views?(0,v.translateString)("view"):(0,v.translateString)("views")):null,n.createElement("div",{className:"media-actions"},n.createElement("div",null,l.MemberContext._currentValue.can.likeMedia?n.createElement(z,null):null,l.MemberContext._currentValue.can.dislikeMedia?n.createElement(B,null):null,l.MemberContext._currentValue.can.shareMedia?n.createElement(re,{isVideo:!0}):null,!l.MemberContext._currentValue.is.anonymous&&l.MemberContext._currentValue.can.saveMedia&&-1<l.PlaylistsContext._currentValue.mediaTypes.indexOf(o.MediaPageStore.get("media-type"))?n.createElement(K,null):null,this.props.allowDownload&&l.MemberContext._currentValue.can.downloadMedia?this.downloadLink?n.createElement(se,{link:this.downloadLink,title:this.props.title}):n.createElement(ce,null):null,n.createElement(J,{allowDownload:this.props.allowDownload})))))}}class pe extends n.PureComponent{constructor(e){super(e),this.state={videoLoaded:!1},this.onVideoLoad=this.onVideoLoad.bind(this),o.MediaPageStore.on("loaded_media_data",this.onVideoLoad)}onVideoLoad(){this.setState({videoLoaded:!0})}render(){let e,t,a,i,l,r,s=!1;return this.state.videoLoaded&&(s=o.MediaPageStore.get("media-data").allow_download,s=void 0===s||!!s,e=o.MediaPageStore.get("media-data").views,t=o.MediaPageStore.get("media-data").categories_info,a=o.MediaPageStore.get("media-data").title,i={name:o.MediaPageStore.get("media-data").author_name,url:o.MediaPageStore.get("media-data").author_profile,thumb:o.MediaPageStore.get("media-author-thumbnail-url")},l=o.MediaPageStore.get("media-data").add_date,r=o.MediaPageStore.get("media-data").description),this.state.videoLoaded?n.createElement("div",{className:"viewer-info"},n.createElement("div",{className:"viewer-info-inner"},n.createElement(me,{title:a,views:e,categories:t,allowDownload:s}),n.createElement(q,{author:i,published:l,description:r}))):null}}class ge extends pe{render(){let e,t,a,i,l,r,s=!1;return this.state.videoLoaded&&(s=o.MediaPageStore.get("media-data").allow_download,s=void 0===s||!!s,e=o.MediaPageStore.get("media-data").views,t=o.MediaPageStore.get("media-data").categories_info,a=o.MediaPageStore.get("media-data").title,i={name:o.MediaPageStore.get("media-data").author_name,url:o.MediaPageStore.get("media-data").author_profile,thumb:o.MediaPageStore.get("media-author-thumbnail-url")},l=o.MediaPageStore.get("media-data").add_date,r=o.MediaPageStore.get("media-data").description),this.state.videoLoaded?n.createElement("div",{className:"viewer-info"},n.createElement("div",{className:"viewer-info-inner"},n.createElement(ue,{title:a,views:e,categories:t,allowDownload:s}),n.createElement(q,{author:i,published:l,description:r}))):null}}class he extends n.PureComponent{render(){return n.createElement("div",{className:"viewer-container",key:"viewer-container-error"},n.createElement("div",{className:"player-container player-container-error"},n.createElement("div",{className:"player-container-inner"},n.createElement("div",{className:"error-container"},n.createElement("div",{className:"error-container-inner"},n.createElement("span",{className:"icon-wrap"},n.createElement("i",{className:"material-icons"},"error_outline")),n.createElement("span",{className:"msg-wrap"},o.MediaPageStore.get("media-load-error-message")))))))}}var fe=a(4737);function ve(){const e=o.MediaPageStore.get("media-data");return e&&e.related_media&&e.related_media.length?e.related_media[0]:null}function ye(e){const[t,a]=(0,n.useState)(ve()),[i,l]=(0,n.useState)(o.PageStore.get("media-auto-play"));function r(){l(o.PageStore.get("media-auto-play"))}function s(){a(ve())}return(0,n.useEffect)(()=>(o.MediaPageStore.on("loaded_media_data",s),o.PageStore.on("switched_media_auto_play",r),()=>{o.MediaPageStore.removeListener("loaded_media_data",s),o.PageStore.removeListener("switched_media_auto_play",r)}),[]),t?n.createElement("div",{className:"auto-play"},n.createElement("div",{className:"auto-play-header"},n.createElement("div",{className:"next-label"},(0,v.translateString)("Up next"))),n.createElement(fe.k,{className:"items-list-hor",items:[t],pageItems:1,maxItems:1,singleLinkContent:!0,horizontalItemsOrientation:!0,hideDate:!0,hideViews:!o.PageStore.get("config-media-item").displayViews,hideAuthor:!o.PageStore.get("config-media-item").displayAuthor})):null}function Ee(e){const[t,a]=(0,n.useState)(s()),[i,l]=(0,n.useState)(null);function r(){l(o.MediaPageStore.get("media-type")),a(s())}function s(){const e=o.MediaPageStore.get("media-data");return null!=e&&void 0!==e.related_media&&e.related_media.length?e.related_media:null}return(0,n.useEffect)(()=>(o.MediaPageStore.on("loaded_media_data",r),()=>o.MediaPageStore.removeListener("loaded_media_data",r)),[]),t&&t.length?n.createElement(fe.k,{className:"items-list-hor",items:!e.hideFirst||"video"!==i&&"audio"!==i?t:t.slice(1),pageItems:o.PageStore.get("config-options").pages.media.related.initialSize,singleLinkContent:!0,horizontalItemsOrientation:!0,hideDate:!0,hideViews:!o.PageStore.get("config-media-item").displayViews,hideAuthor:!o.PageStore.get("config-media-item").displayAuthor}):null}function be(e){return n.createElement(fe.k,{className:"items-list-hor",pageItems:9999,maxItems:9999,items:e.items,hideDate:!0,hideViews:!0,hidePlaylistOrderNumber:!1,horizontalItemsOrientation:!0,inPlaylistView:!0,singleLinkContent:!0,playlistActiveItem:e.playlistActiveItem})}Ee.propTypes={hideFirst:h().bool},Ee.defaultProps={hideFirst:!0},be.propTypes={items:h().array.isRequired,playlistActiveItem:v.PositiveIntegerOrZero},be.defaultProps={playlistActiveItem:1};class Se extends n.PureComponent{constructor(e){super(e),this.state={expanded:!0,loopRepeat:o.PlaylistViewStore.get("enabled-loop"),shuffle:o.PlaylistViewStore.get("enabled-shuffle"),savedPlaylist:o.PlaylistViewStore.get("saved-playlist-loop"),title:e.playlistData.title,link:e.playlistData.url,authorName:e.playlistData.user,authorLink:l.LinksContext._currentValue.home+"/user/"+e.playlistData.user,activeItem:e.activeItem,totalMedia:e.playlistData.media_count,items:e.playlistData.playlist_media},this.onHeaderClick=this.onHeaderClick.bind(this),this.onLoopClick=this.onLoopClick.bind(this),this.onShuffleClick=this.onShuffleClick.bind(this),this.onSaveClick=this.onSaveClick.bind(this),this.onLoopRepeatUpdate=this.onLoopRepeatUpdate.bind(this),this.onShuffleUpdate=this.onShuffleUpdate.bind(this),this.onPlaylistSaveUpdate=this.onPlaylistSaveUpdate.bind(this),o.PlaylistViewStore.on("loop-repeat-updated",this.onLoopRepeatUpdate),o.PlaylistViewStore.on("shuffle-updated",this.onShuffleUpdate),o.PlaylistViewStore.on("saved-updated",this.onPlaylistSaveUpdate)}onHeaderClick(e){this.setState({expanded:!this.state.expanded})}onLoopClick(){f.PlaylistViewActions.toggleLoop()}onShuffleClick(){f.PlaylistViewActions.toggleShuffle()}onSaveClick(){f.PlaylistViewActions.toggleSave()}onShuffleUpdate(){this.setState({shuffle:o.PlaylistViewStore.get("enabled-shuffle")},()=>{this.state.shuffle?f.PageActions.addNotification("Playlist shuffle is on","shuffle-on"):f.PageActions.addNotification("Playlist shuffle is off","shuffle-off")})}onLoopRepeatUpdate(){this.setState({loopRepeat:o.PlaylistViewStore.get("enabled-loop")},()=>{this.state.loopRepeat?f.PageActions.addNotification("Playlist loop is on","loop-on"):f.PageActions.addNotification("Playlist loop is off","loop-off")})}onPlaylistSaveUpdate(){this.setState({savedPlaylist:o.PlaylistViewStore.get("saved-playlist")},()=>{this.state.savedPlaylist?f.PageActions.addNotification("Added to playlists library","added-to-playlists-lib"):f.PageActions.addNotification("Removed from playlists library","removed-from-playlists-lib")})}render(){return n.createElement("div",{className:"playlist-view-wrap"},n.createElement("div",{className:"playlist-view"+(this.state.expanded?" playlist-expanded-view":"")},n.createElement("div",{className:"playlist-header"},n.createElement("div",{className:"playlist-title"},n.createElement("a",{href:this.state.link,title:this.state.title},this.state.title)),n.createElement("div",{className:"playlist-meta"},n.createElement("span",null,n.createElement("a",{href:this.state.authorLink,title:this.state.authorName},this.state.authorName))," - ",n.createElement("span",{className:"counter"},this.state.activeItem," / ",this.state.totalMedia)),n.createElement(s.CircleIconButton,{className:"toggle-playlist-view",onClick:this.onHeaderClick},this.state.expanded?n.createElement("i",{className:"material-icons"},"keyboard_arrow_up"):n.createElement("i",{className:"material-icons"},"keyboard_arrow_down"))),this.state.expanded?n.createElement("div",{className:"playlist-actions"},n.createElement(s.CircleIconButton,{className:this.state.loopRepeat?"active":"",onClick:this.onLoopClick,title:"Loop playlist"},n.createElement("i",{className:"material-icons"},"repeat"))):null,this.state.expanded&&this.state.items.length?n.createElement("div",{className:"playlist-media"},n.createElement(be,{items:this.state.items,playlistActiveItem:this.state.activeItem})):null))}}Se.propTypes={playlistData:h().object.isRequired,activeItem:v.PositiveIntegerOrZero},Se.defaultProps={};class Pe extends n.PureComponent{constructor(e){if(super(e),this.state={playlistData:e.playlistData,isPlaylistPage:!!e.playlistData,activeItem:0,mediaType:o.MediaPageStore.get("media-type"),chapters:o.MediaPageStore.get("media-data")?.chapters},e.playlistData){let t=0;for(;t<e.playlistData.playlist_media.length;){if(e.mediaId===e.playlistData.playlist_media[t].friendly_token){this.state.activeItem=t+1;break}t+=1}}this.onMediaLoad=this.onMediaLoad.bind(this)}componentDidMount(){o.MediaPageStore.on("loaded_media_data",this.onMediaLoad)}onMediaLoad(){this.setState({mediaType:o.MediaPageStore.get("media-type"),chapters:o.MediaPageStore.get("media-data")?.chapter_data||[]})}render(){return n.createElement("div",{className:"viewer-sidebar"},this.state.isPlaylistPage?n.createElement(Se,{activeItem:this.state.activeItem,playlistData:this.props.playlistData}):"video"===this.state.mediaType||"audio"===this.state.mediaType?n.createElement(ye,null):null,n.createElement(Ee,{hideFirst:!this.state.isPlaylistPage}))}}var we=a(9479);we.Y;class Me extends we.Y{constructor(e){super(e,"media"),this.state={wideLayout:1216<=window.innerWidth,mediaLoaded:!1,mediaLoadFailed:!1,isVideoMedia:!1,theaterMode:!1,pagePlaylistLoaded:!1,pagePlaylistData:o.MediaPageStore.get("playlist-data")},this.onWindowResize=this.onWindowResize.bind(this),this.onMediaLoad=this.onMediaLoad.bind(this),this.onMediaLoadError=this.onMediaLoadError.bind(this),this.onPagePlaylistLoad=this.onPagePlaylistLoad.bind(this),o.MediaPageStore.on("loaded_media_data",this.onMediaLoad),o.MediaPageStore.on("loaded_media_error",this.onMediaLoadError),o.MediaPageStore.on("loaded_page_playlist_data",this.onPagePlaylistLoad)}componentDidMount(){f.MediaPageActions.loadMediaData(),o.PageStore.on("window_resize",this.onWindowResize)}onWindowResize(){this.setState({wideLayout:1216<=window.innerWidth})}onPagePlaylistLoad(){this.setState({pagePlaylistLoaded:!0,pagePlaylistData:o.MediaPageStore.get("playlist-data")})}onMediaLoad(){const e="video"===o.MediaPageStore.get("media-type");e?(this.onViewerModeChange=this.onViewerModeChange.bind(this),o.VideoViewerStore.on("changed_viewer_mode",this.onViewerModeChange),this.setState({mediaLoaded:!0,isVideoMedia:e,theaterMode:o.VideoViewerStore.get("in-theater-mode")})):this.setState({mediaLoaded:!0,isVideoMedia:e})}onViewerModeChange(){this.setState({theaterMode:o.VideoViewerStore.get("in-theater-mode")})}onMediaLoadError(e){this.setState({mediaLoadFailed:!0})}pageContent(){const e="cf viewer-section"+(this.state.theaterMode?" theater-mode":" viewer-wide"),t="viewer-section-nested"+(this.state.theaterMode?" viewer-section":"");return this.state.mediaLoadFailed?n.createElement("div",{className:e},n.createElement(he,null)):n.createElement("div",{className:e},[n.createElement("div",{className:"viewer-container",key:"viewer-container"},this.state.mediaLoaded&&this.state.pagePlaylistLoaded?this.viewerContainerContent(o.MediaPageStore.get("media-data")):null),n.createElement("div",{key:"viewer-section-nested",className:t},!this.state.wideLayout||this.state.isVideoMedia&&this.state.theaterMode?[n.createElement(ge,{key:"viewer-info"}),this.state.pagePlaylistLoaded?n.createElement(Pe,{key:"viewer-sidebar",mediaId:o.MediaPageStore.get("media-id"),playlistData:o.MediaPageStore.get("playlist-data")}):null]:[this.state.pagePlaylistLoaded?n.createElement(Pe,{key:"viewer-sidebar",mediaId:o.MediaPageStore.get("media-id"),playlistData:o.MediaPageStore.get("playlist-data")}):null,n.createElement(ge,{key:"viewer-info"})])])}}if(window.MediaCMS.site.devEnv){const e=()=>{let e=null,t=null;const a=window.location.search.split("?")[1];return a&&a.split("&").forEach(a=>{0===a.indexOf("m=")?e=a.split("m=")[1]:0===a.indexOf("pl=")&&(t=a.split("pl=")[1])}),{mediaId:e,playlistId:t}},{mediaId:t,playlistId:a}=e();t&&(window.MediaCMS.mediaId=t),a&&(window.MediaCMS.playlistId=a)}(0,i.C)("page-media",class extends Me{viewerContainerContent(e){switch(o.MediaPageStore.get("media-type")){case"video":case"audio":return n.createElement(l.SiteConsumer,null,t=>n.createElement(C,{data:e,siteUrl:t.url,inEmbed:!1}));case"image":return n.createElement(c,null);case"pdf":const t=(0,v.formatInnerLink)(o.MediaPageStore.get("media-original-url"),l.SiteContext._currentValue.url);return n.createElement(p,{fileUrl:t})}return n.createElement(r,null)}})}},a={};function i(e){var n=a[e];if(void 0!==n)return n.exports;var l=a[e]={exports:{}};return t[e].call(l.exports,l,l.exports,i),l.exports}i.m=t,e=[],i.O=function(t,a,n,l){if(!a){var o=1/0;for(c=0;c<e.length;c++){a=e[c][0],n=e[c][1],l=e[c][2];for(var r=!0,s=0;s<a.length;s++)(!1&l||o>=l)&&Object.keys(i.O).every(function(e){return i.O[e](a[s])})?a.splice(s--,1):(r=!1,l<o&&(o=l));if(r){e.splice(c--,1);var d=n();void 0!==d&&(t=d)}}return t}l=l||0;for(var c=e.length;c>0&&e[c-1][2]>l;c--)e[c]=e[c-1];e[c]=[a,n,l]},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 a in t)i.o(t,a)&&!i.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},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=201,function(){var e={201:0};i.O.j=function(t){return 0===e[t]};var t=function(t,a){var n,l,o=a[0],r=a[1],s=a[2],d=0;if(o.some(function(t){return 0!==e[t]})){for(n in r)i.o(r,n)&&(i.m[n]=r[n]);if(s)var c=s(i)}for(t&&t(a);d<o.length;d++)l=o[d],i.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return i.O(c)},a=self.webpackChunkmediacms_frontend=self.webpackChunkmediacms_frontend||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))}();var n=i.O(void 0,[276],function(){return i(9427)});n=i.O(n)}(); |