!function(e){const a=function(){e(document).on("click",".dlp-preview-button",this.handleModalInit),e(document).on("click",".dlp-preview-modal-close, .dlp-preview-modal-overlay",this.handleCloseModal)};a.prototype.handleModalInit=function(o){const i=e(this).data("download-type"),t=e(this).data("view"),n=e(this).data("download-url"),p=e(this).data("title");let d;switch(t){case"table":d=`modal_${e(this).parents(".posts-data-table").first().attr("id")}`;break;case"grid":d=`modal_${e(this).parents(".dlp-grid-container").first().attr("id")}`;break;case"single":d=e(".dlp-preview-modal").attr("id")}e("#"+d).parent().is("body")||e("#"+d).appendTo("body"),MicroModal.show(d,{onShow:e=>a.loadContent(e,{title:p,type:i,url:n}),onClose:e=>a.destroyContent(e),openTrigger:"data-dlp-preview-open",closeTrigger:"data-dlp-preview-close"})},a.prototype.handleCloseModal=function(a){if(a.stopPropagation(),e(a.target).parents(".dlp-preview-modal-container").length>0)return;const o=e(this).data("dlp-preview-close").substring(1);MicroModal.close(o)},a.loadContent=function(o,i){const t=e(o).find(".dlp-preview-modal-content").first(),n=e(o).find(".dlp-preview-modal-footer").first(),p=a.getEmbedHtml(i),d=`<img class="dlp-preview-spinner" src="${dlp_preview_params.spinner_url}" />`;t.html(d+p),n.html(i.title);const s=t.children().last();s.is("img")||s.is("iframe")?s.on("load error",(function(){e(this).prev(".dlp-preview-spinner").remove()})):(s.is("audio")||s.is("video"))&&s.on("loadeddata error",(function(){e(this).prev(".dlp-preview-spinner").remove()})),e(document.body).addClass("dlp-preview-modal-open")},a.destroyContent=function(a){e(a).find(".dlp-preview-modal-content").first().html(""),e(document.body).removeClass("dlp-preview-modal-open")},a.getEmbedHtml=function(e){let a="";switch(e.type){case"application/pdf":case"application/x-pdf":a=`<iframe src="${e.url}" width="100%" height="100%">`;break;case"application/msword":case"application/vnd.ms-powerpoint":case"application/vnd.ms-write":case"application/vnd.ms-excel":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":case"application/vnd.ms-word.document.macroEnabled.12":case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":case"application/vnd.ms-word.template.macroEnabled.12":case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":case"application/vnd.ms-excel.sheet.macroEnabled.12":case"application/vnd.ms-excel.sheet.binary.macroEnabled.12":case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":case"application/vnd.ms-excel.template.macroEnabled.12":case"application/vnd.ms-excel.addin.macroEnabled.12":case"application/vnd.openxmlformats-officedocument.presentationml.presentation":case"application/vnd.ms-powerpoint.presentation.macroEnabled.12":case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":case"application/vnd.ms-powerpoint.slideshow.macroEnabled.12":case"application/vnd.openxmlformats-officedocument.presentationml.template":case"application/vnd.ms-powerpoint.template.macroEnabled.12":case"application/vnd.ms-powerpoint.addin.macroEnabled.12":case"application/vnd.openxmlformats-officedocument.presentationml.slide":case"application/vnd.ms-powerpoint.slide.macroEnabled.12":a=`<iframe src="https://view.officeapps.live.com/op/embed.aspx?src=${e.url}" width="100%" height="100%">`;break;case"image/jpeg":case"image/gif":case"image/png":case"image/webp":case"image/svg+xml":a=`<img class="dlp-preview-img" src="${e.url}" />`;break;case"video/mp4":case"video/ogg":a=`<video\n                    controls type="${e.type}"\n                    src="${e.url}">\n                    ${dlp_preview_params.video_error}\n                </video>`;break;case"audio/mp3":case"audio/mp4":case"audio/mpeg":case"audio/ogg":case"audio/aac":case"audio/aacp":case"audio/flac":case"audio/wav":case"audio/webm":a=`<audio\n                    controls\n                    src="${e.url}">\n                    ${dlp_preview_params.audio_error}\n                </audio>`}return a},new a}(jQuery,window);