vendor: 12,530 bytes, line 1
1function c(n,e,i){let t=document.createElement(e);return n&&(t.className=n),i&&i.appendChild(t),t}function C(n,e,i){let t=`translate3d(${n}px,${e||0}px,0)`;return i!==void 0&&(t+=` scale3d(${i},${i},1)`),t}function y(n,e,i){n.style.width=typeof e=="number"?`${e}px`:e,n.style.height=typeof i=="number"?`${i}px`:i}var p={IDLE:"idle",LOADING:"loading",LOADED:"loaded",ERROR:"error"};function E(n){return"button"in n&&n.button===1||n.ctrlKey||n.metaKey||n.altKey||n.shiftKey}function u(n,e,i=document){let t=[];if(n instanceof Element)t=[n];else if(n instanceof NodeList||Array.isArray(n))t=Array.from(n);else{let s=typeof n=="string"?n:e;s&&(t=Array.from(i.querySelectorAll(s)))}return t}function L(n){return typeof n=="function"&&n.prototype&&n.prototype.goTo}function M(){return!!(navigator.vendor&&navigator.vendor.match(/apple/i))}var w=class{constructor(e,i){this.type=e,this.defaultPrevented=!1,i&&Object.assign(this,i)}preventDefault(){this.defaultPrevented=!0}},_=class{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(e,i,t=100){var s,o,l;this._filters[e]||(this._filters[e]=[]),(s=this._filters[e])===null||s===void 0||s.push({fn:i,priority:t}),(o=this._filters[e])===null||o===void 0||o.sort((r,a)=>r.priority-a.priority),(l=this.pswp)===null||l===void 0||l.addFilter(e,i,t)}removeFilter(e,i){this._filters[e]&&(this._filters[e]=this._filters[e].filter(t=>t.fn!==i)),this.pswp&&this.pswp.removeFilter(e,i)}applyFilters(e,...i){var t;return(t=this._filters[e])===null||t===void 0||t.forEach(s=>{i[0]=s.fn.apply(this,i)}),i[0]}on(e,i){var t,s;this._listeners[e]||(this._listeners[e]=[]),(t=this._listeners[e])===null||t===void 0||t.push(i),(s=this.pswp)===null||s===void 0||s.on(e,i)}off(e,i){var t;this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter(s=>i!==s)),(t=this.pswp)===null||t===void 0||t.off(e,i)}dispatch(e,i){var t;if(this.pswp)return this.pswp.dispatch(e,i);let s=new w(e,i);return(t=this._listeners[e])===null||t===void 0||t.forEach(o=>{o.call(this,s)}),s}},v=class{constructor(e,i){if(this.element=c("pswp__img pswp__img--placeholder",e?"img":"div",i),e){let t=this.element;t.decoding="async",t.alt="",t.src=e,t.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(e,i){this.element&&(this.element.tagName==="IMG"?(y(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=C(0,0,e/250)):y(this.element,e,i))}destroy(){var e;(e=this.element)!==null&&e!==void 0&&e.parentNode&&this.element.remove(),this.element=null}},b=class{constructor(e,i,t){this.instance=i,this.data=e,this.index=t,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=p.IDLE,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout(()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)},1e3)}load(e,i){if(this.slide&&this.usePlaceholder())if(this.placeholder){let t=this.placeholder.element;t&&!t.parentElement&&this.slide.container.prepend(t)}else{let t=this.instance.applyFilters("placeholderSrc",this.data.msrc&&this.slide.isFirstSlide?this.data.msrc:!1,this);this.placeholder=new v(t,this.slide.container)}this.element&&!i||this.instance.dispatch("contentLoad",{content:this,isLazy:e}).defaultPrevented||(this.isImageContent()?(this.element=c("pswp__img","img"),this.displayedImageWidth&&this.loadImage(e)):(this.element=c("pswp__content","div"),this.element.innerHTML=this.data.html||""),i&&this.slide&&this.slide.updateContentSize(!0))}loadImage(e){var i,t;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:e}).defaultPrevented)return;let s=this.element;this.updateSrcsetSizes(),this.data.srcset&&(s.srcset=this.data.srcset),s.src=(i=this.data.src)!==null&&i!==void 0?i:"",s.alt=(t=this.data.alt)!==null&&t!==void 0?t:"",this.state=p.LOADING,s.complete?this.onLoaded():(s.onload=()=>{this.onLoaded()},s.onerror=()=>{this.onError()})}setSlide(e){this.slide=e,this.hasSlide=!0,this.instance=e.pswp}onLoaded(){this.state=p.LOADED,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),(this.state===p.LOADED||this.state===p.ERROR)&&this.removePlaceholder())}onError(){this.state=p.ERROR,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===p.LOADING,this)}isError(){return this.state===p.ERROR}isImageContent(){return this.type==="image"}setDisplayedSize(e,i){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(e,i),!this.instance.dispatch("contentResize",{content:this,width:e,height:i}).defaultPrevented&&(y(this.element,e,i),this.isImageContent()&&!this.isError()))){let t=!this.displayedImageWidth&&e;this.displayedImageWidth=e,this.displayedImageHeight=i,t?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:e,height:i,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==p.ERROR,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;let e=this.element,i=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!e.dataset.largestUsedSize||i>parseInt(e.dataset.largestUsedSize,10))&&(e.sizes=i+"px",e.dataset.largestUsedSize=String(i))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,!this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented&&(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var e,i;let t=c("pswp__error-msg","div");t.innerText=(e=(i=this.instance.options)===null||i===void 0?void 0:i.errorMsg)!==null&&e!==void 0?e:"",t=this.instance.applyFilters("contentErrorElement",t,this),this.element=c("pswp__content pswp__error-msg-container","div"),this.element.appendChild(t),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===p.ERROR){this.displayError();return}if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;let e="decode"in this.element;this.isImageContent()?e&&this.slide&&(!this.slide.isActive||M())?(this.isDecoding=!0,this.element.decode().catch(()=>{}).finally(()=>{this.isDecoding=!1,this.appendImage()})):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){this.instance.dispatch("contentActivate",{content:this}).defaultPrevented||!this.slide||(this.isImageContent()&&this.isDecoding&&!M()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,!this.instance.dispatch("contentRemove",{content:this}).defaultPrevented&&(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),(this.state===p.LOADED||this.state===p.ERROR)&&this.removePlaceholder()))}};function z(n,e){if(n.getViewportSizeFn){let i=n.getViewportSizeFn(n,e);if(i)return i}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function m(n,e,i,t,s){let o=0;if(e.paddingFn)o=e.paddingFn(i,t,s)[n];else if(e.padding)o=e.padding[n];else{let l="padding"+n[0].toUpperCase()+n.slice(1);e[l]&&(o=e[l])}return Number(o)||0}function V(n,e,i,t){return{x:e.x-m("left",n,e,i,t)-m("right",n,e,i,t),y:e.y-m("top",n,e,i,t)-m("bottom",n,e,i,t)}}var x=4e3,I=class{constructor(e,i,t,s){this.pswp=s,this.options=e,this.itemData=i,this.index=t,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(e,i,t){let s={x:e,y:i};this.elementSize=s,this.panAreaSize=t;let o=t.x/s.x,l=t.y/s.y;this.fit=Math.min(1,o<l?o:l),this.fill=Math.min(1,o>l?o:l),this.vFill=Math.min(1,l),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(e){let i=e+"ZoomLevel",t=this.options[i];if(t)return typeof t=="function"?t(this):t==="fill"?this.fill:t==="fit"?this.fit:Number(t)}_getSecondary(){let e=this._parseZoomLevelOption("secondary");return e||(e=Math.min(1,this.fit*3),this.elementSize&&e*this.elementSize.x>x&&(e=x/this.elementSize.x),e)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,this.fit*4)}};function T(n,e,i){let t=e.createContentFromData(n,i),s,{options:o}=e;if(o){s=new I(o,n,-1);let l;e.pswp?l=e.pswp.viewportSize:l=z(o,e);let r=V(o,l,n,i);s.update(t.width,t.height,r)}return t.lazyLoad(),s&&t.setDisplayedSize(Math.ceil(t.width*s.initial),Math.ceil(t.height*s.initial)),t}function A(n,e){let i=e.getItemData(n);if(!e.dispatch("lazyLoadSlide",{index:n,itemData:i}).defaultPrevented)return T(i,e,n)}var S=class extends _{getNumItems(){var e;let i=0,t=(e=this.options)===null||e===void 0?void 0:e.dataSource;t&&"length"in t?i=t.length:t&&"gallery"in t&&(t.items||(t.items=this._getGalleryDOMElements(t.gallery)),t.items&&(i=t.items.length));let s=this.dispatch("numItems",{dataSource:t,numItems:i});return this.applyFilters("numItems",s.numItems,t)}createContentFromData(e,i){return new b(e,this,i)}getItemData(e){var i;let t=(i=this.options)===null||i===void 0?void 0:i.dataSource,s={};Array.isArray(t)?s=t[e]:t&&"gallery"in t&&(t.items||(t.items=this._getGalleryDOMElements(t.gallery)),s=t.items[e]);let o=s;o instanceof Element&&(o=this._domElementToItemData(o));let l=this.dispatch("itemData",{itemData:o||{},index:e});return this.applyFilters("itemData",l.itemData,e)}_getGalleryDOMElements(e){var i,t;return(i=this.options)!==null&&i!==void 0&&i.children||(t=this.options)!==null&&t!==void 0&&t.childSelector?u(this.options.children,this.options.childSelector,e)||[]:[e]}_domElementToItemData(e){let i={element:e},t=e.tagName==="A"?e:e.querySelector("a");if(t){i.src=t.dataset.pswpSrc||t.href,t.dataset.pswpSrcset&&(i.srcset=t.dataset.pswpSrcset),i.width=t.dataset.pswpWidth?parseInt(t.dataset.pswpWidth,10):0,i.height=t.dataset.pswpHeight?parseInt(t.dataset.pswpHeight,10):0,i.w=i.width,i.h=i.height,t.dataset.pswpType&&(i.type=t.dataset.pswpType);let o=e.querySelector("img");if(o){var s;i.msrc=o.currentSrc||o.src,i.alt=(s=o.getAttribute("alt"))!==null&&s!==void 0?s:""}(t.dataset.pswpCropped||t.dataset.cropped)&&(i.thumbCropped=!0)}return this.applyFilters("domItemData",i,e,t)}lazyLoadData(e,i){return T(e,this,i)}},f=class extends S{constructor(e){super(),this.options=e||{},this._uid=0,this.shouldOpen=!1,this._preloadedContent=void 0,this.onThumbnailsClick=this.onThumbnailsClick.bind(this)}init(){u(this.options.gallery,this.options.gallerySelector).forEach(e
1=>{e.addEventListener("click",this.onThumbnailsClick,!1)})}onThumbnailsClick(e){if(E(e)||window.pswp)return;let i={x:e.clientX,y:e.clientY};!i.x&&!i.y&&(i=null);let t=this.getClickedIndex(e);t=this.applyFilters("clickedIndex",t,e,this);let s={gallery:e.currentTarget};t>=0&&(e.preventDefault(),this.loadAndOpen(t,s,i))}getClickedIndex(e){if(this.options.getClickedIndexFn)return this.options.getClickedIndexFn.call(this,e);let i=e.target,s=u(this.options.children,this.options.childSelector,e.currentTarget).findIndex(o=>o===i||o.contains(i));return s!==-1?s:this.options.children||this.options.childSelector?-1:0}loadAndOpen(e,i,t){if(window.pswp||!this.options)return!1;if(!i&&this.options.gallery&&this.options.children){let s=u(this.options.gallery);s[0]&&(i={gallery:s[0]})}return this.options.index=e,this.options.initialPointerPos=t,this.shouldOpen=!0,this.preload(e,i),!0}preload(e,i){let{options:t}=this;i&&(t.dataSource=i);let s=[],o=typeof t.pswpModule;if(L(t.pswpModule))s.push(Promise.resolve(t.pswpModule));else{if(o==="string")throw new Error("pswpModule as string is no longer supported");if(o==="function")s.push(t.pswpModule());else throw new Error("pswpModule is not valid")}typeof t.openPromise=="function"&&s.push(t.openPromise()),t.preloadFirstSlide!==!1&&e>=0&&(this._preloadedContent=A(e,this));let l=++this._uid;Promise.all(s).then(r=>{if(this.shouldOpen){let a=r[0];this._openPhotoswipe(a,l)}})}_openPhotoswipe(e,i){if(i!==this._uid&&this.shouldOpen||(this.shouldOpen=!1,window.pswp))return;let t=typeof e=="object"?new e.default(this.options):new e(this.options);this.pswp=t,window.pswp=t,Object.keys(this._listeners).forEach(s=>{var o;(o=this._listeners[s])===null||o===void 0||o.forEach(l=>{t.on(s,l)})}),Object.keys(this._filters).forEach(s=>{var o;(o=this._filters[s])===null||o===void 0||o.forEach(l=>{t.addFilter(s,l.fn,l.priority)})}),this._preloadedContent&&(t.contentLoader.addToCache(this._preloadedContent),this._preloadedContent=void 0),t.on("destroy",()=>{this.pswp=void 0,delete window.pswp}),t.init()}destroy(){var e;(e=this.pswp)===null||e===void 0||e.destroy(),this.shouldOpen=!1,this._listeners={},u(this.options.gallery,this.options.gallerySelector).forEach(i=>{i.removeEventListener("click",this.onThumbnailsClick,!1)})}};var g=class n{constructor(){this.lightbox=null,this.isLoading=!1,this.loadedImages=0,this.currentGalleryId=null,this.config={gallerySelector:".mtv_gallery",loadButtonSelector:".mtv_load_new_gallery",galleryContainerSelector:".intro_images",restImagesInputId:"mtv_rest_images",loadMoreLimitInputId:"mtv_load_more_limit",scrollDuration:1e3,defaultLoadMoreLimit:6},this.init()}init(){this.initPhotoSwipe(),this.bindEvents()}initPhotoSwipe(){document.querySelectorAll(this.config.gallerySelector).length!==0&&(this.lightbox=new f({gallery:this.config.gallerySelector,children:"a.mtv-img-wrapper",pswpModule:()=>import("../../chunks/photoswipe.esm-JIDV7BRI.js")}),this.lightbox.init())}bindEvents(){document.addEventListener("click",e=>{if(e.target.closest(this.config.loadButtonSelector)){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();let i=e.target.closest(this.config.loadButtonSelector);if(this.isLoading||i.disabled){console.log("MTV Gallery: Click ignored - already loading or button disabled");return}this.handleLoadMore(i)}})}async handleLoadMore(e){if(console.log("MTV Gallery: handleLoadMore called",{isLoading:this.isLoading,button:e,buttonExists:!!e}),this.isLoading||!e){console.log("MTV Gallery: Exiting early - isLoading:",this.isLoading,"button:",!!e);return}let i=e.closest(".mtv_gallery_container");if(!i){console.error("MTV Gallery: Could not find gallery container");return}let t=i.querySelector(".mtv_gallery");if(!t||!t.id){console.error("MTV Gallery: Could not find gallery element or ID");return}this.currentGalleryId=t.id,console.log("MTV Gallery: Current gallery ID set to:",this.currentGalleryId),this.isLoading=!0,console.log("MTV Gallery: Setting loading state to true"),this.setLoadingState(e,!0);let s=null;try{console.log("MTV Gallery: Fetching gallery images...");let l=await this.fetchGalleryImages();s=l,l&&l.length>
10?(console.log("MTV Gallery: Rendering",l.length,"images"),this.renderGalleryImages(l)):(console.log("MTV Gallery: No images to load, hiding button"),this.removeLoadMoreButtons())}catch(l){console.error("MTV Gallery Error:",l),console.log("MTV Gallery: Error details:",{message:l.message,stack:l.stack}),this.showError(mtv_gallery_data.error_message||"Failed to load gallery images. Please try again."),this.isLoading=!1,this.setLoadingState(e,!1);return}console.log("MTV Gallery: Resetting loading state to false"),this.isLoading=!1,this.setLoadingState(e,!1);let o=document.getElementById(this.currentGalleryId);if(o){let l=o.querySelector(this.config.galleryContainerSelector);if(l){let r=new CustomEvent("mtvGalleryLoadComplete",{detail:{imagesLoaded:s?s.length:0,totalImages:l.children.length}});l.dispatchEvent(r),console.log("MTV Gallery: Triggered mtvGalleryLoadComplete event")}}}async fetchGalleryImages(){console.log("MTV Gallery: fetchGalleryImages started");let e=this.currentGalleryId?`${this.config.restImagesInputId}_${this.currentGalleryId}`:this.config.restImagesInputId,i=document.getElementById(e);if(console.log("MTV Gallery: Looking for input with ID:",e),console.log("MTV Gallery: restImagesInput element:",i),console.log("MTV Gallery: restImagesInput value:",i?i.value:"null"),!i||!i.value)throw console.log("MTV Gallery: No images specified - input missing or empty"),new Error("No images specified");if(!mtv_gallery_data||!mtv_gallery_data.api_url)throw console.log("MTV Gallery: API configuration missing:",mtv_gallery_data),new Error("Gallery API configuration missing");let t;try{console.log("MTV Gallery: Parsing JSON batches from:",i.value),t=JSON.parse(i.value),console.log("MTV Gallery: Parsed image batches:",t)}catch(a){throw console.log("MTV Gallery: JSON parse error:",a),new Error("Invalid image batches format")}if(!Array.isArray(t)||t.length===0)return console.log("MTV Gallery: No batches left - hiding button"),this.removeLoadMoreButtons(),[];let s=t[0];if(console.log("MTV Gallery: First batch to load:",s),!Array.isArray(s)||s.length===0)return console.log("MTV Gallery: Empty batch found, removing and retrying"),t.shift(),i.value=JSON.stringify(t),this.fetchGalleryImages();let o=`${mtv_gallery_data.api_url}?images=${encodeURIComponent(s.join(","))}`;console.log("MTV Gallery: Making API request to:",o),console.log("MTV Gallery: Images to load:",s);let l=await fetch(o,{method:"GET",headers:{"Content-Type":"application/json"}});if(console.log("MTV Gallery: API response status:",l.status),console.log("MTV Gallery: API response ok:",l.ok),!l.ok)throw console.log("MTV Gallery: HTTP error - status:",l.status),new Error(`HTTP error! status: ${l.status}`);let r=await l.json();if(console.log("MTV Gallery: API response data:",r),r&&r.gallery&&r.gallery.length>0){console.log("MTV Gallery: Successful load - removing first batch"),t.shift();let a=JSON.stringify(t);console.log("MTV Gallery: Updated batches:",a),i.value=a,t.length===0?(console.log("MTV Gallery: All batches loaded - hiding button"),this.removeLoadMoreButtons()):console.log("MTV Gallery: Remaining batches:",t.length)}else console.log("MTV Gallery: No gallery data in response or empty gallery");return console.log("MTV Gallery: Returning gallery data:",r.gallery||[]),r.gallery||[]}renderGalleryImages(e){console.log("MTV Gallery: renderGalleryImages called with",e.length,"images");let i=document.getElementById(this.currentGalleryId);if(!i){console.error("MTV Gallery: Could not find gallery element with ID:",this.currentGalleryId);return}let t=i.querySelector(this.config.galleryContainerSelector);if(console.log("MTV Gallery: Gallery container found:",!!t),console.log("MTV Gallery: Gallery container selector:",this.config.galleryContainerSelector),!t){console.warn("MTV Gallery: Gallery container not found");return}let s=this.getGalleryItemTemplate(t);if(console.log("MTV Gallery: Template item found:",!!s),!s){console.warn("MTV Gallery: No gallery item template found");return}let o=this.extractColumnClasses(t);console.log("MTV Gallery: Column classes extracted:",o);
1let l=document.createDocumentFragment();console.log("MTV Gallery: Creating gallery items...");let r=null;e.forEach((a,d)=>{console.log(`MTV Gallery: Creating item ${d+1}:`,a);let h=this.createGalleryItemFromTemplate(s,a);d===0&&(r=h),l.appendChild(h)}),console.log("MTV Gallery: Fragment created with",l.children.length,"items"),this.removeColumnClasses(t),console.log("MTV Gallery: Column classes temporarily removed"),console.log("MTV Gallery: Appending items to gallery container"),t.appendChild(l),console.log("MTV Gallery: Items appended. Container now has",t.children.length,"items"),this.firstNewItem=r,this.reapplyColumnLayout(t,o),this.lightbox&&(this.lightbox.destroy(),this.initPhotoSwipe())}getGalleryItemTemplate(e){let i=e.querySelector(".mtv_gallery_item");return i?i.cloneNode(!0):null}createGalleryItemFromTemplate(e,i){let t=e.cloneNode(!0),s=t.querySelector(".item_wrapper");if(!s)return console.warn("item_wrapper not found in template"),t;let o=this.createItemWrapperContent(i);return s.innerHTML="",s.appendChild(o),t}createItemWrapperContent(e){let i=document.createElement("a");i.href=e.src,i.setAttribute("data-pswp-src",e.src),i.setAttribute("data-pswp-width",e.w),i.setAttribute("data-pswp-height",e.h),i.setAttribute("target","_blank"),i.className="mtv-img-wrapper",e.srcset&&i.setAttribute("data-pswp-srcset",e.srcset);let t=document.createElement("img");return t.src=e.src,t.className="photoswipe",t.loading="lazy",t.setAttribute("decoding","async"),e.srcset&&(t.srcset=e.srcset),e.alt&&(t.alt=e.alt),i.appendChild(t),i}removeLoadMoreButtons(){let e=document.getElementById(this.currentGalleryId);if(!e)return;let i=e.closest(".mtv_gallery_container");if(!i)return;let t=i.querySelector(this.config.loadButtonSelector);t&&t.remove()}scrollToGallery(e=null){let i;if(e&&e.offsetParent!==null?(i=e,console.log("MTV Gallery: Scrolling to specific element:",e)):(i=document.querySelector(this.config.galleryContainerSelector),console.log("MTV Gallery: Scrolling to gallery container")),!i){console.log("MTV Gallery: No scroll target found");return}let t=i.offsetTop-50,s=window.pageYOffset,o=t-s,l=this.config.scrollDuration,r=null;console.log("MTV Gallery: Scroll animation starting",{targetPosition:t,startPosition:s,distance:o});let a=d=>{r===null&&(r=d);let h=d-r,G=this.easeInOutQuad(h,s,o,l);window.scrollTo(0,G),h<l&&requestAnimationFrame(a)};requestAnimationFrame(a)}easeInOutQuad(e,i,t,s){return e/=s/2,e<1?t/2*e*e+i:(e--,-t/2*(e*(e-2)-1)+i)}setLoadingState(e,i){if(console.log("MTV Gallery: setLoadingState called",{button:!!e,isLoading:i,currentText:e?e.textContent:"no button"}),!e){console.log("MTV Gallery: No button provided to setLoadingState");return}if(i)console.log("MTV Gallery: Setting button to loading state"),e.disabled=!0,e.setAttribute("data-original-text",e.textContent),e.textContent=mtv_gallery_data.loading_text||"Loading...",e.classList.add("loading"),console.log("MTV Gallery: Button text changed to:",e.textContent);else{console.log("MTV Gallery: Removing loading state from button"),e.disabled=!1;let t=e.getAttribute("data-original-text");console.log("MTV Gallery: Original text was:",t),t&&(e.textContent=t,e.removeAttribute("data-original-text")),e.classList.remove("loading"),console.log("MTV Gallery: Button text restored to:",e.textContent)}}extractColumnClasses(e){return Array.from(e.classList).filter(t=>t.includes("columns-")||t.includes("gap-")||t.includes("column-gap"))}removeColumnClasses(e){this.extractColumnClasses(e).forEach(t=>{e.classList.remove(t)})}reapplyColumnLayout(e,i){e.offsetHeight,i.forEach(t=>{e.classList.add(t)}),requestAnimationFrame(()=>{e.offsetHeight})}showError(e){console.error("MTV Gallery:",e)}static init(){return new n}};function N(){return g.init()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>g.init()):g.init();export{N as initGallery}; 2/*! Bundled license information: 3 4photoswipe/dist/photoswipe-lightbox.esm.js: 5 (*! 6 * PhotoSwipe Lightbox 5.4.4 - https://photoswipe.com 7 * (c) 2024 Dmytro Semenov 8 *) 9*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.