uikit
Version:
UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.
3 lines (2 loc) • 21.9 kB
JavaScript
/*! UIkit 3.6.19 | https://www.getuikit.com | (c) 2014 - 2021 YOOtheme | MIT License */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("uikit-util")):"function"==typeof define&&define.amd?define("uikitlightbox",["uikit-util"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).UIkitLightbox=e(t.UIkit.util)}(this,function(p){"use strict";var t={slide:{show:function(t){return[{transform:i(-100*t)},{transform:i()}]},percent:function(t){return t=t,Math.abs(p.css(t,"transform").split(",")[4]/t.offsetWidth)||0},translate:function(t,e){return[{transform:i(-100*e*t)},{transform:i(100*e*(1-t))}]}}};function i(t,e){return void 0===t&&(t=0),void 0===e&&(e="%"),t+=t?e:"",p.isIE?"translateX("+t+")":"translate3d("+t+", 0, 0)"}function e(t){return"scale3d("+t+", "+t+", 1)"}var n=p.assign({},t,{fade:{show:function(){return[{opacity:0},{opacity:1}]},percent:function(t){return 1-p.css(t,"opacity")},translate:function(t){return[{opacity:1-t},{opacity:t}]}},scale:{show:function(){return[{opacity:0,transform:e(.8)},{opacity:1,transform:e(1)}]},percent:function(t){return 1-p.css(t,"opacity")},translate:function(t){return[{opacity:1-t,transform:e(1-.2*t)},{opacity:t,transform:e(.8+.2*t)}]}}}),s={props:{container:Boolean},data:{container:!0},computed:{container:function(t){t=t.container;return!0===t&&this.$container||t&&p.$(t)}}},o={props:{cls:Boolean,animation:"list",duration:Number,origin:String,transition:String},data:{cls:!1,animation:[!1],duration:200,origin:!1,transition:"linear",clsEnter:"uk-togglabe-enter",clsLeave:"uk-togglabe-leave",initProps:{overflow:"",height:"",paddingTop:"",paddingBottom:"",marginTop:"",marginBottom:""},hideProps:{overflow:"hidden",height:0,paddingTop:0,paddingBottom:0,marginTop:0,marginBottom:0}},computed:{hasAnimation:function(t){return!!t.animation[0]},hasTransition:function(t){t=t.animation;return this.hasAnimation&&!0===t[0]}},methods:{toggleElement:function(e,d,g){var f=this;return new p.Promise(function(t){return p.Promise.all(p.toNodes(e).map(function(t){var e=p.isBoolean(d)?d:!f.isToggled(t);if(!p.trigger(t,"before"+(e?"show":"hide"),[f]))return p.Promise.reject();var o,r,a,h,l,u,c,i=(p.isFunction(g)?g:!1!==g&&f.hasAnimation?f.hasTransition?(r=(s=f).isToggled,a=s.duration,h=s.initProps,l=s.hideProps,u=s.transition,c=s._toggle,function(t,e){var i=p.Transition.inProgress(t),n=t.hasChildNodes?p.toFloat(p.css(t.firstElementChild,"marginTop"))+p.toFloat(p.css(t.lastElementChild,"marginBottom")):0,s=p.isVisible(t)?p.height(t)+(i?0:n):0;p.Transition.cancel(t),r(t)||c(t,!0),p.height(t,""),p.fastdom.flush();n=p.height(t)+(i?0:n);return p.height(t,s),(e?p.Transition.start(t,p.assign({},h,{overflow:"hidden",height:n}),Math.round(a*(1-s/n)),u):p.Transition.start(t,l,Math.round(a*(s/n)),u).then(function(){return c(t,!1)})).then(function(){return p.css(t,h)})}):(o=f,function(t,e){p.Animation.cancel(t);var i=o.animation,n=o.duration,s=o._toggle;return e?(s(t,!0),p.Animation.in(t,i[0],n,o.origin)):p.Animation.out(t,i[1]||i[0],n,o.origin).then(function(){return s(t,!1)})}):f._toggle)(t,e),n=e?f.clsEnter:f.clsLeave;p.addClass(t,n),p.trigger(t,e?"show":"hide",[f]);var s=function(){p.removeClass(t,n),p.trigger(t,e?"shown":"hidden",[f]),f.$update(t)};return i?i.then(s,function(){return p.removeClass(t,n),p.Promise.reject()}):s()})).then(t,p.noop)})},isToggled:function(t){return void 0===t&&(t=this.$el),!!p.hasClass(t,this.clsEnter)||!p.hasClass(t,this.clsLeave)&&(this.cls?p.hasClass(t,this.cls.split(" ")[0]):!p.hasAttr(t,"hidden"))},_toggle:function(t,e){var i;t&&(e=Boolean(e),this.cls?(i=p.includes(this.cls," ")||e!==p.hasClass(t,this.cls))&&p.toggleClass(t,this.cls,p.includes(this.cls," ")?void 0:e):(i=e===t.hidden)&&(t.hidden=!e),p.$$("[autofocus]",t).some(function(t){return p.isVisible(t)?t.focus()||!0:t.blur()}),i&&(p.trigger(t,"toggled",[e,this]),this.$update(t)))}}};var r=[];function a(t){var r=t.transitionElement,a=t._toggle;return function(s,o){return new p.Promise(function(i,n){return p.once(s,"show hide",function(){s._reject&&s._reject(),s._reject=n,a(s,o);var t=p.once(r,"transitionstart",function(){p.once(r,"transitionend transitioncancel",i,{self:!0}),clearTimeout(e)},{self:!0}),e=setTimeout(function(){t(),i()},p.toMs(p.css(r,"transitionDuration")))})}).then(function(){return delete s._reject})}}function u(t,e,i){p.trigger(t,p.createEvent(e,!1,!1,i))}var h={mixins:[s,{mixins:[{connected:function(){p.hasClass(this.$el,this.$name)||p.addClass(this.$el,this.$name)}},s,o],props:{selPanel:String,selClose:String,escClose:Boolean,bgClose:Boolean,stack:Boolean},data:{cls:"uk-open",escClose:!0,bgClose:!0,overlay:!0,stack:!1},computed:{panel:function(t,e){t=t.selPanel;return p.$(t,e)},transitionElement:function(){return this.panel},bgClose:function(t){return t.bgClose&&this.panel}},beforeDisconnect:function(){this.isToggled()&&this.toggleElement(this.$el,!1,!1)},events:[{name:"click",delegate:function(){return this.selClose},handler:function(t){t.preventDefault(),this.hide()}},{name:"toggle",self:!0,handler:function(t){t.defaultPrevented||(t.preventDefault(),this.isToggled()===p.includes(r,this)&&this.toggle())}},{name:"beforeshow",self:!0,handler:function(t){if(p.includes(r,this))return!1;!this.stack&&r.length?(p.Promise.all(r.map(function(t){return t.hide()})).then(this.show),t.preventDefault()):r.push(this)}},{name:"show",self:!0,handler:function(){var s=this,t=document.documentElement;p.width(window)>t.clientWidth&&this.overlay&&p.css(document.body,"overflowY","scroll"),this.stack&&p.css(this.$el,"zIndex",p.toFloat(p.css(this.$el,"zIndex"))+r.length),p.addClass(t,this.clsPage),this.bgClose&&p.once(this.$el,"hide",p.on(document,p.pointerDown,function(t){var n=t.target;p.last(r)!==s||s.overlay&&!p.within(n,s.$el)||p.within(n,s.panel)||p.once(document,p.pointerUp+" "+p.pointerCancel+" scroll",function(t){var e=t.defaultPrevented,i=t.type,t=t.target;e||i!==p.pointerUp||n!==t||s.hide()},!0)}),{self:!0}),this.escClose&&p.once(this.$el,"hide",p.on(document,"keydown",function(t){27===t.keyCode&&p.last(r)===s&&s.hide()}),{self:!0})}},{name:"hidden",self:!0,handler:function(){var e=this;p.includes(r,this)&&r.splice(r.indexOf(this),1),r.length||p.css(document.body,"overflowY",""),p.css(this.$el,"zIndex",""),r.some(function(t){return t.clsPage===e.clsPage})||p.removeClass(document.documentElement,this.clsPage)}}],methods:{toggle:function(){return this.isToggled()?this.hide():this.show()},show:function(){var e=this;return this.container&&p.parent(this.$el)!==this.container?(p.append(this.container,this.$el),new p.Promise(function(t){return requestAnimationFrame(function(){return e.show().then(t)})})):this.toggleElement(this.$el,!0,a(this))},hide:function(){return this.toggleElement(this.$el,!1,a(this))}}},o,{mixins:[{mixins:[{props:{autoplay:Boolean,autoplayInterval:Number,pauseOnHover:Boolean},data:{autoplay:!1,autoplayInterval:7e3,pauseOnHover:!0},connected:function(){this.autoplay&&this.startAutoplay()},disconnected:function(){this.stopAutoplay()},update:function(){p.attr(this.slides,"tabindex","-1")},events:[{name:"visibilitychange",el:function(){return document},filter:function(){return this.autoplay},handler:function(){document.hidden?this.stopAutoplay():this.startAutoplay()}}],methods:{startAutoplay:function(){var t=this;this.stopAutoplay(),this.interval=setInterval(function(){return(!t.draggable||!p.$(":focus",t.$el))&&(!t.pauseOnHover||!p.matches(t.$el,":hover"))&&!t.stack.length&&t.show("next")},this.autoplayInterval)},stopAutoplay:function(){this.interval&&clearInterval(this.interval)}}},{props:{draggable:Boolean},data:{draggable:!0,threshold:10},created:function(){var n=this;["start","move","end"].forEach(function(t){var i=n[t];n[t]=function(t){var e=p.getEventPos(t).x*(p.isRtl?-1:1);n.prevPos=e!==n.pos?n.pos:n.prevPos,n.pos=e,i(t)}})},events:[{name:p.pointerDown,delegate:function(){return this.selSlides},handler:function(t){var e;!this.draggable||!p.isTouch(t)&&(!(e=t.target).children.length&&e.childNodes.length)||p.closest(t.target,p.selInput)||0<t.button||this.length<2||this.start(t)}},{name:"dragstart",handler:function(t){t.preventDefault()}}],methods:{start:function(){this.drag=this.pos,this._transitioner?(this.percent=this._transitioner.percent(),this.drag+=this._transitioner.getDistance()*this.percent*this.dir,this._transitioner.cancel(),this._transitioner.translate(this.percent),this.dragging=!0,this.stack=[]):this.prevIndex=this.index,p.on(document,p.pointerMove,this.move,{passive:!1}),p.on(document,p.pointerUp+" "+p.pointerCancel+" input",this.end,!0),p.css(this.list,"userSelect","none")},move:function(t){var e=this,i=this.pos-this.drag;if(!(0==i||this.prevPos===this.pos||!this.dragging&&Math.abs(i)<this.threshold)){p.css(this.list,"pointerEvents","none"),t.cancelable&&t.preventDefault(),this.dragging=!0,this.dir=i<0?1:-1;for(var n=this.slides,s=this.prevIndex,o=Math.abs(i),r=this.getIndex(s+this.dir,s),a=this._getDistance(s,r)||n[s].offsetWidth;r!==s&&a<o;)this.drag-=a*this.dir,s=r,o-=a,r=this.getIndex(s+this.dir,s),a=this._getDistance(s,r)||n[s].offsetWidth;this.percent=o/a;var h,l=n[s],t=n[r],i=this.index!==r,u=s===r;[this.index,this.prevIndex].filter(function(t){return!p.includes([r,s],t)}).forEach(function(t){p.trigger(n[t],"itemhidden",[e]),u&&(h=!0,e.prevIndex=s)}),(this.index===s&&this.prevIndex!==s||h)&&p.trigger(n[this.index],"itemshown",[this]),i&&(this.prevIndex=s,this.index=r,u||p.trigger(l,"beforeitemhide",[this]),p.trigger(t,"beforeitemshow",[this])),this._transitioner=this._translate(Math.abs(this.percent),l,!u&&t),i&&(u||p.trigger(l,"itemhide",[this]),p.trigger(t,"itemshow",[this]))}},end:function(){var t;p.off(document,p.pointerMove,this.move,{passive:!1}),p.off(document,p.pointerUp+" "+p.pointerCancel+" input",this.end,!0),this.dragging&&(this.dragging=null,this.index===this.prevIndex?(this.percent=1-this.percent,this.dir*=-1,this._show(!1,this.index,!0),this._transitioner=null):(t=(p.isRtl?this.dir*(p.isRtl?1:-1):this.dir)<0==this.prevPos>this.pos,this.index=t?this.index:this.prevIndex,t&&(this.percent=1-this.percent),this.show(0<this.dir&&!t||this.dir<0&&t?"next":"previous",!0))),p.css(this.list,{userSelect:"",pointerEvents:""}),this.drag=this.percent=null}}},{data:{selNav:!1},computed:{nav:function(t,e){t=t.selNav;return p.$(t,e)},selNavItem:function(t){t=t.attrItem;return"["+t+"],[data-"+t+"]"},navItems:function(t,e){return p.$$(this.selNavItem,e)}},update:{write:function(){var i=this;this.nav&&this.length!==this.nav.children.length&&p.html(this.nav,this.slides.map(function(t,e){return"<li "+i.attrItem+'="'+e+'"><a href></a></li>'}).join("")),this.navItems.concat(this.nav).forEach(function(t){return t&&(t.hidden=!i.maxIndex)}),this.updateNav()},events:["resize"]},events:[{name:"click",delegate:function(){return this.selNavItem},handler:function(t){t.preventDefault(),this.show(p.data(t.current,this.attrItem))}},{name:"itemshow",handler:"updateNav"}],methods:{updateNav:function(){var i=this,n=this.getValidIndex();this.navItems.forEach(function(t){var e=p.data(t,i.attrItem);p.toggleClass(t,i.clsActive,p.toNumber(e)===n),p.toggleClass(t,"uk-invisible",i.finite&&("previous"===e&&0===n||"next"===e&&n>=i.maxIndex))})}}}],props:{clsActivated:Boolean,easing:String,index:Number,finite:Boolean,velocity:Number,selSlides:String},data:function(){return{easing:"ease",finite:!1,velocity:1,index:0,prevIndex:-1,stack:[],percent:0,clsActive:"uk-active",clsActivated:!1,Transitioner:!1,transitionOptions:{}}},connected:function(){this.prevIndex=-1,this.index=this.getValidIndex(this.$props.index),this.stack=[]},disconnected:function(){p.removeClass(this.slides,this.clsActive)},computed:{duration:function(t,e){t=t.velocity;return e.offsetWidth/t*.5+300},list:function(t,e){t=t.selList;return p.$(t,e)},maxIndex:function(){return this.length-1},selSlides:function(t){return t.selList+" "+(t.selSlides||"> *")},slides:{get:function(){return p.$$(this.selSlides,this.$el)},watch:function(){this.$reset()}},length:function(){return this.slides.length}},events:{itemshown:function(){this.$update(this.list)}},methods:{show:function(t,e){var i=this;if(void 0===e&&(e=!1),!this.dragging&&this.length){var n=this.stack,s=e?0:n.length,o=function(){n.splice(s,1),n.length&&i.show(n.shift(),!0)};if(n[e?"unshift":"push"](t),!e&&1<n.length)2===n.length&&this._transitioner.forward(Math.min(this.duration,200));else{var r,a=this.getIndex(this.index),h=p.hasClass(this.slides,this.clsActive)&&this.slides[a],l=this.getIndex(t,this.index),u=this.slides[l];if(h!==u){if(this.dir=(r=a,"next"!==(t=t)&&("previous"===t||t<r)?-1:1),this.prevIndex=a,this.index=l,h&&!p.trigger(h,"beforeitemhide",[this])||!p.trigger(u,"beforeitemshow",[this,h]))return this.index=this.prevIndex,void o();e=this._show(h,u,e).then(function(){return h&&p.trigger(h,"itemhidden",[i]),p.trigger(u,"itemshown",[i]),new p.Promise(function(t){p.fastdom.write(function(){n.shift(),n.length?i.show(n.shift(),!0):i._transitioner=null,t()})})});return h&&p.trigger(h,"itemhide",[this]),p.trigger(u,"itemshow",[this]),e}o()}}},getIndex:function(t,e){return void 0===t&&(t=this.index),void 0===e&&(e=this.index),p.clamp(p.getIndex(t,this.slides,e,this.finite),0,this.maxIndex)},getValidIndex:function(t,e){return void 0===t&&(t=this.index),void 0===e&&(e=this.prevIndex),this.getIndex(t,e)},_show:function(t,e,i){if(this._transitioner=this._getTransitioner(t,e,this.dir,p.assign({easing:i?e.offsetWidth<600?"cubic-bezier(0.25, 0.46, 0.45, 0.94)":"cubic-bezier(0.165, 0.84, 0.44, 1)":this.easing},this.transitionOptions)),!i&&!t)return this._translate(1),p.Promise.resolve();t=this.stack.length;return this._transitioner[1<t?"forward":"show"](1<t?Math.min(this.duration,75+75/(t-1)):this.duration,this.percent)},_getDistance:function(t,e){return this._getTransitioner(t,t!==e&&e).getDistance()},_translate:function(t,e,i){void 0===e&&(e=this.prevIndex),void 0===i&&(i=this.index);i=this._getTransitioner(e!==i&&e,i);return i.translate(t),i},_getTransitioner:function(t,e,i,n){return void 0===t&&(t=this.prevIndex),void 0===e&&(e=this.index),void 0===i&&(i=this.dir||1),void 0===n&&(n=this.transitionOptions),new this.Transitioner(p.isNumber(t)?this.slides[t]:t,p.isNumber(e)?this.slides[e]:e,i*(p.isRtl?-1:1),n)}}}],props:{animation:String},data:{animation:"slide",clsActivated:"uk-transition-active",Animations:t,Transitioner:function(s,o,r,t){var e=t.animation,a=t.easing,i=e.percent,n=e.translate,h=(e=void 0===(e=e.show)?p.noop:e)(r),l=new p.Deferred;return{dir:r,show:function(t,e,i){var n=this;void 0===e&&(e=0);i=i?"linear":a;return t-=Math.round(t*p.clamp(e,-1,1)),this.translate(e),u(o,"itemin",{percent:e,duration:t,timing:i,dir:r}),u(s,"itemout",{percent:1-e,duration:t,timing:i,dir:r}),p.Promise.all([p.Transition.start(o,h[1],t,i),p.Transition.start(s,h[0],t,i)]).then(function(){n.reset(),l.resolve()},p.noop),l.promise},cancel:function(){p.Transition.cancel([o,s])},reset:function(){for(var t in h[0])p.css([o,s],t,"")},forward:function(t,e){return void 0===e&&(e=this.percent()),p.Transition.cancel([o,s]),this.show(t,e,!0)},translate:function(t){this.reset();var e=n(t,r);p.css(o,e[1]),p.css(s,e[0]),u(o,"itemtranslatein",{percent:t,dir:r}),u(s,"itemtranslateout",{percent:1-t,dir:r})},percent:function(){return i(s||o,o,r)},getDistance:function(){return s&&s.offsetWidth}}}},computed:{animation:function(t){var e=t.animation,t=t.Animations;return p.assign(t[e]||t.slide,{name:e})},transitionOptions:function(){return{animation:this.animation}}},events:{"itemshow itemhide itemshown itemhidden":function(t){t=t.target;this.$update(t)},beforeitemshow:function(t){t=t.target;p.addClass(t,this.clsActive)},itemshown:function(t){t=t.target;p.addClass(t,this.clsActivated)},itemhidden:function(t){t=t.target;p.removeClass(t,this.clsActive,this.clsActivated)}}}],functional:!0,props:{delayControls:Number,preload:Number,videoAutoplay:Boolean,template:String},data:function(){return{preload:1,videoAutoplay:!1,delayControls:3e3,items:[],cls:"uk-open",clsPage:"uk-lightbox-page",selList:".uk-lightbox-items",attrItem:"uk-lightbox-item",selClose:".uk-close-large",selCaption:".uk-lightbox-caption",pauseOnHover:!1,velocity:2,Animations:n,template:'<div class="uk-lightbox uk-overflow-hidden"> <ul class="uk-lightbox-items"></ul> <div class="uk-lightbox-toolbar uk-position-top uk-text-right uk-transition-slide-top uk-transition-opaque"> <button class="uk-lightbox-toolbar-icon uk-close-large" type="button" uk-close></button> </div> <a class="uk-lightbox-button uk-position-center-left uk-position-medium uk-transition-fade" href uk-slidenav-previous uk-lightbox-item="previous"></a> <a class="uk-lightbox-button uk-position-center-right uk-position-medium uk-transition-fade" href uk-slidenav-next uk-lightbox-item="next"></a> <div class="uk-lightbox-toolbar uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque"></div> </div>'}},created:function(){var t=p.$(this.template),e=p.$(this.selList,t);this.items.forEach(function(){return p.append(e,"<li>")}),this.$mount(p.append(this.container,t))},computed:{caption:function(t,e){t=t.selCaption;return p.$(t,e)}},events:[{name:p.pointerMove+" "+p.pointerDown+" keydown",handler:"showControls"},{name:"click",self:!0,delegate:function(){return this.selSlides},handler:function(t){t.defaultPrevented||this.hide()}},{name:"shown",self:!0,handler:function(){this.showControls()}},{name:"hide",self:!0,handler:function(){this.hideControls(),p.removeClass(this.slides,this.clsActive),p.Transition.stop(this.slides)}},{name:"hidden",self:!0,handler:function(){this.$destroy(!0)}},{name:"keyup",el:function(){return document},handler:function(t){if(this.isToggled(this.$el)&&this.draggable)switch(t.keyCode){case 37:this.show("previous");break;case 39:this.show("next")}}},{name:"beforeitemshow",handler:function(t){this.isToggled()||(this.draggable=!1,t.preventDefault(),this.toggleElement(this.$el,!0,!1),this.animation=n.scale,p.removeClass(t.target,this.clsActive),this.stack.splice(1,0,this.index))}},{name:"itemshow",handler:function(){p.html(this.caption,this.getItem().caption||"");for(var t=-this.preload;t<=this.preload;t++)this.loadItem(this.index+t)}},{name:"itemshown",handler:function(){this.draggable=this.$props.draggable}},{name:"itemload",handler:function(t,i){var n=this,s=i.source,e=i.type,o=i.alt;void 0===o&&(o="");var r,a,h,l=i.poster,u=i.attrs;void 0===u&&(u={}),this.setItem(i,"<span uk-spinner></span>"),s&&(a={frameborder:"0",allow:"autoplay",allowfullscreen:"",style:"max-width: 100%; box-sizing: border-box;","uk-responsive":"","uk-video":""+this.videoAutoplay},"image"===e||s.match(/\.(avif|jpe?g|a?png|gif|svg|webp)($|\?)/i)?p.getImage(s,u.srcset,u.size).then(function(t){var e=t.width,t=t.height;return n.setItem(i,c("img",p.assign({src:s,width:e,height:t,alt:o},u)))},function(){return n.setError(i)}):"video"===e||s.match(/\.(mp4|webm|ogv)($|\?)/i)?(h=c("video",p.assign({src:s,poster:l,controls:"",playsinline:"","uk-video":""+this.videoAutoplay},u)),p.on(h,"loadedmetadata",function(){p.attr(h,{width:h.videoWidth,height:h.videoHeight}),n.setItem(i,h)}),p.on(h,"error",function(){return n.setError(i)})):"iframe"===e||s.match(/\.(html|php)($|\?)/i)?this.setItem(i,c("iframe",p.assign({src:s,frameborder:"0",allowfullscreen:"",class:"uk-lightbox-iframe"},u))):(r=s.match(/\/\/(?:.*?youtube(-nocookie)?\..*?[?&]v=|youtu\.be\/)([\w-]{11})[&?]?(.*)?/))?this.setItem(i,c("iframe",p.assign({src:"https://www.youtube"+(r[1]||"")+".com/embed/"+r[2]+(r[3]?"?"+r[3]:""),width:1920,height:1080},a,u))):(r=s.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/))&&p.ajax("https://vimeo.com/api/oembed.json?maxwidth=1920&url="+encodeURI(s),{responseType:"json",withCredentials:!1}).then(function(t){var e=t.response,t=e.height,e=e.width;return n.setItem(i,c("iframe",p.assign({src:"https://player.vimeo.com/video/"+r[1]+(r[2]?"?"+r[2]:""),width:e,height:t},a,u)))},function(){return n.setError(i)}))}}],methods:{loadItem:function(t){void 0===t&&(t=this.index);t=this.getItem(t);this.getSlide(t).childElementCount||p.trigger(this.$el,"itemload",[t])},getItem:function(t){return void 0===t&&(t=this.index),this.items[p.getIndex(t,this.slides)]},setItem:function(t,e){p.trigger(this.$el,"itemloaded",[this,p.html(this.getSlide(t),e)])},getSlide:function(t){return this.slides[this.items.indexOf(t)]},setError:function(t){this.setItem(t,'<span uk-icon="icon: bolt; ratio: 2"></span>')},showControls:function(){clearTimeout(this.controlsTimer),this.controlsTimer=setTimeout(this.hideControls,this.delayControls),p.addClass(this.$el,"uk-active","uk-transition-active")},hideControls:function(){p.removeClass(this.$el,"uk-active","uk-transition-active")}}};function c(t,e){t=p.fragment("<"+t+">");return p.attr(t,e),t}t={install:function(t,e){t.lightboxPanel||t.component("lightboxPanel",h);p.assign(e.props,t.component("lightboxPanel").options.props)},props:{toggle:String},data:{toggle:"a"},computed:{toggles:{get:function(t,e){t=t.toggle;return p.$$(t,e)},watch:function(){this.hide()}}},disconnected:function(){this.hide()},events:[{name:"click",delegate:function(){return this.toggle+":not(.uk-disabled)"},handler:function(t){t.preventDefault(),this.show(t.current)}}],methods:{show:function(t){var e,i=this,n=p.uniqueBy(this.toggles.map(l),"source");return p.isElement(t)&&(e=l(t).source,t=p.findIndex(n,function(t){t=t.source;return e===t})),this.panel=this.panel||this.$create("lightboxPanel",p.assign({},this.$props,{items:n})),p.on(this.panel.$el,"hidden",function(){return i.panel=!1}),this.panel.show(t)},hide:function(){return this.panel&&this.panel.hide()}}};function l(e){var i={};return["href","caption","type","poster","alt","attrs"].forEach(function(t){i["href"===t?"source":t]=p.data(e,t)}),i.attrs=p.parseOptions(i.attrs),i}return"undefined"!=typeof window&&window.UIkit&&window.UIkit.component("lightbox",t),t});