Use object factory interface in annotations adapters
authorThierry Florac <thierry.florac@onf.fr>
Thu, 17 Jan 2019 11:15:20 +0100
changeset 380 f549a5cd4781
parent 379 240417d006df
child 381 1ab0b78f0480
Use object factory interface in annotations adapters
src/pyams_default_theme/component/association/__init__.py
src/pyams_default_theme/component/gallery/__init__.py
src/pyams_default_theme/component/illustration/__init__.py
src/pyams_default_theme/component/paragraph/contact.py
src/pyams_default_theme/component/paragraph/frame.py
src/pyams_default_theme/component/paragraph/html.py
src/pyams_default_theme/component/paragraph/map.py
src/pyams_default_theme/component/paragraph/verbatim.py
src/pyams_default_theme/features/footer/__init__.py
src/pyams_default_theme/features/header/__init__.py
src/pyams_default_theme/resources/js/ext/ekko-lightbox.js
src/pyams_default_theme/resources/js/ext/ekko-lightbox.min.js
--- a/src/pyams_default_theme/component/association/__init__.py	Wed Jan 16 18:56:36 2019 +0100
+++ b/src/pyams_default_theme/component/association/__init__.py	Thu Jan 17 11:15:20 2019 +0100
@@ -15,7 +15,6 @@
 from itertools import islice
 
 from persistent import Persistent
-from zope.interface import implementer
 from zope.location import Location
 from zope.schema.fieldproperty import FieldProperty
 
@@ -25,14 +24,14 @@
 from pyams_content.component.links.interfaces import IBaseLink, IInternalLink
 from pyams_content.component.paragraph.interfaces import IParagraphContainer, IParagraphContainerTarget
 from pyams_content.features.renderer.interfaces import IContentRenderer
+from pyams_default_theme import _
 from pyams_default_theme.component.association.interfaces import IAssociationParagraphRemoteContentRendererSettings, \
     IAssociationParagraphSlicedRemoteContentRendererSettings
 from pyams_default_theme.features.renderer import BaseContentRenderer
 from pyams_skin.layer import IPyAMSLayer
 from pyams_template.template import template_config
 from pyams_utils.adapter import adapter_config, get_annotation_adapter
-
-from pyams_default_theme import _
+from pyams_utils.factory import factory_config
 
 
 #
@@ -76,7 +75,7 @@
 ASSOCIATION_PARAGRAPH_REMOTE_CONTENT_RENDERER_SETTINGS_KEY = 'pyams_content.association.renderer:remote-content'
 
 
-@implementer(IAssociationParagraphSlicedRemoteContentRendererSettings)
+@factory_config(IAssociationParagraphSlicedRemoteContentRendererSettings)
 class AssociationParagraphSlicedRemoteContentRendererSettings(Persistent, Location):
     """Associations paragraph sliced remote content renderer settings"""
 
@@ -89,7 +88,7 @@
 def association_paragraph_sliced_remote_content_renderer_settings_factory(context):
     """Associations paragraph sliced remote content renderer settings factory"""
     return get_annotation_adapter(context, ASSOCIATION_PARAGRAPH_SLICED_REMOTE_CONTENT_RENDERER_SETTINGS_KEY,
-                                  AssociationParagraphSlicedRemoteContentRendererSettings)
+                                  IAssociationParagraphSlicedRemoteContentRendererSettings)
 
 
 @adapter_config(name='reportage', context=(IAssociationParagraph, IPyAMSLayer), provides=IContentRenderer)
@@ -121,7 +120,7 @@
                     yield renderer.render()
 
 
-@implementer(IAssociationParagraphRemoteContentRendererSettings)
+@factory_config(IAssociationParagraphRemoteContentRendererSettings)
 class AssociationParagraphRemoteContentRendererSettings(Persistent, Location):
     """Associations paragraph remote content renderer settings"""
 
@@ -135,7 +134,7 @@
 def association_paragraph_remote_content_renderer_settings_factory(context):
     """Associations paragraph remote content renderer settings factory"""
     return get_annotation_adapter(context, ASSOCIATION_PARAGRAPH_REMOTE_CONTENT_RENDERER_SETTINGS_KEY,
-                                  AssociationParagraphRemoteContentRendererSettings)
+                                  IAssociationParagraphRemoteContentRendererSettings)
 
 
 @adapter_config(name='remote-content', context=(IAssociationParagraph, IPyAMSLayer), provides=IContentRenderer)
--- a/src/pyams_default_theme/component/gallery/__init__.py	Wed Jan 16 18:56:36 2019 +0100
+++ b/src/pyams_default_theme/component/gallery/__init__.py	Thu Jan 17 11:15:20 2019 +0100
@@ -14,18 +14,17 @@
 
 from persistent import Persistent
 from zope.container.contained import Contained
-from zope.interface import implementer
 from zope.schema.fieldproperty import FieldProperty
 
 from pyams_content.component.gallery.interfaces import IBaseGallery
 from pyams_content.features.renderer.interfaces import IContentRenderer
+from pyams_default_theme import _, lightbox
 from pyams_default_theme.component.gallery.interfaces import IGalleryDefaultRendererSettings
 from pyams_default_theme.features.renderer import BaseContentRenderer
 from pyams_skin.layer import IPyAMSLayer
 from pyams_template.template import template_config
 from pyams_utils.adapter import adapter_config, get_annotation_adapter
-
-from pyams_default_theme import _, lightbox
+from pyams_utils.factory import factory_config
 
 
 #
@@ -35,7 +34,7 @@
 DEFAULT_GALLERY_RENDERER_SETTINGS_KEY = 'pyams_content.gallery.renderer:default'
 
 
-@implementer(IGalleryDefaultRendererSettings)
+@factory_config(IGalleryDefaultRendererSettings)
 class GalleryDefaultRendererSettings(Persistent, Contained):
     """Gallery default renderer settings"""
 
@@ -46,7 +45,7 @@
 def default_gallery_renderer_settings_factory(context):
     """Gallery default renderer settings factory"""
     return get_annotation_adapter(context, DEFAULT_GALLERY_RENDERER_SETTINGS_KEY,
-                                  GalleryDefaultRendererSettings)
+                                  IGalleryDefaultRendererSettings)
 
 
 #
--- a/src/pyams_default_theme/component/illustration/__init__.py	Wed Jan 16 18:56:36 2019 +0100
+++ b/src/pyams_default_theme/component/illustration/__init__.py	Thu Jan 17 11:15:20 2019 +0100
@@ -33,6 +33,7 @@
 from pyams_skin.layer import IPyAMSLayer
 from pyams_template.template import template_config
 from pyams_utils.adapter import ContextRequestViewAdapter, adapter_config, get_annotation_adapter
+from pyams_utils.factory import factory_config
 from pyams_utils.interfaces.tales import ITALESExtension
 
 from pyams_default_theme import _
@@ -127,7 +128,7 @@
 ILLUSTRATION_ZOOM_RENDERER_SETTINGS_KEY = 'pyams_content.illustration.renderer:zoom'
 
 
-@implementer(IIllustrationWithZoomSettings)
+@factory_config(IIllustrationWithZoomSettings)
 class IllustrationZoomSettings(Persistent, Location):
     """Illustration zoom renderer settings"""
 
@@ -137,7 +138,7 @@
 @adapter_config(context=IIllustration, provides=IIllustrationWithZoomSettings)
 def illustration_with_zoom_settings_factory(context):
     """Illustration zoom renderer settings factory"""
-    return get_annotation_adapter(context, ILLUSTRATION_ZOOM_RENDERER_SETTINGS_KEY, IllustrationZoomSettings)
+    return get_annotation_adapter(context, ILLUSTRATION_ZOOM_RENDERER_SETTINGS_KEY, IIllustrationWithZoomSettings)
 
 
 #
--- a/src/pyams_default_theme/component/paragraph/contact.py	Wed Jan 16 18:56:36 2019 +0100
+++ b/src/pyams_default_theme/component/paragraph/contact.py	Thu Jan 17 11:15:20 2019 +0100
@@ -13,7 +13,6 @@
 __docformat__ = 'restructuredtext'
 
 from persistent import Persistent
-from zope.interface import implementer
 from zope.location import Location
 from zope.schema.fieldproperty import FieldProperty
 
@@ -25,6 +24,7 @@
 from pyams_skin.layer import IPyAMSLayer
 from pyams_template.template import template_config
 from pyams_utils.adapter import adapter_config, get_annotation_adapter
+from pyams_utils.factory import factory_config
 
 from pyams_default_theme import _
 
@@ -36,7 +36,7 @@
 CONTACT_DEFAULT_RENDERER_SETTINGS_KEY = 'pyams_content.contact.renderer:default'
 
 
-@implementer(IContactParagraphDefaultRendererSettings)
+@factory_config(IContactParagraphDefaultRendererSettings)
 class ContactParagraphDefaultRendererSettings(Persistent, Location):
     """Contact paragraph default renderer settings"""
 
@@ -67,7 +67,7 @@
 def contact_paragraph_default_renderer_settings_factory(context):
     """Contact paragraph default renderer settings factory"""
     return get_annotation_adapter(context, CONTACT_DEFAULT_RENDERER_SETTINGS_KEY,
-                                  ContactParagraphDefaultRendererSettings)
+                                  IContactParagraphDefaultRendererSettings)
 
 
 #
--- a/src/pyams_default_theme/component/paragraph/frame.py	Wed Jan 16 18:56:36 2019 +0100
+++ b/src/pyams_default_theme/component/paragraph/frame.py	Thu Jan 17 11:15:20 2019 +0100
@@ -29,6 +29,7 @@
 from pyams_skin.layer import IPyAMSLayer
 from pyams_template.template import template_config
 from pyams_utils.adapter import adapter_config, get_annotation_adapter
+from pyams_utils.factory import factory_config
 from pyams_utils.registry import query_utility
 from pyams_utils.zodb import volatile_property
 
@@ -75,7 +76,7 @@
             return table.get(self._pictogram_name)
 
 
-@implementer(IDefaultFrameParagraphRendererSettings)
+@factory_config(IDefaultFrameParagraphRendererSettings)
 class DefaultFrameParagraphRendererSettings(BaseFrameParagraphRendererSettings):
     """Framed text paragraph lateral renderer settings"""
 
@@ -87,14 +88,14 @@
     relative_width = FieldProperty(ILateralFrameParagraphRendererSettings['relative_width'])
 
 
-@implementer(ILeftFrameParagraphRendererSettings)
+@factory_config(ILeftFrameParagraphRendererSettings)
 class LeftFrameParagraphRendererSettings(LateralFrameParagraphRendererSettings):
-    """Left Framed text paragraph lateral renderer settings"""
+    """Left framed text paragraph lateral renderer settings"""
 
 
-@implementer(IRightFrameParagraphRendererSettings)
+@factory_config(IRightFrameParagraphRendererSettings)
 class RightFrameParagraphRendererSettings(LateralFrameParagraphRendererSettings):
-    """Right Framed text paragraph lateral renderer settings"""
+    """Right framed text paragraph lateral renderer settings"""
 
 
 #
@@ -105,21 +106,21 @@
 def default_frame_paragraph_renderer_settings_factory(context):
     """Frame paragraph default renderer settings factory"""
     return get_annotation_adapter(context, FRAME_PARAGRAPH_RENDERER_SETTINGS_KEY,
-                                  DefaultFrameParagraphRendererSettings)
+                                  IDefaultFrameParagraphRendererSettings)
 
 
 @adapter_config(context=IFrameParagraph, provides=ILeftFrameParagraphRendererSettings)
 def left_lateral_frame_paragraph_renderer_settings_factory(context):
     """Frame text paragraph lateral renderer settings factory"""
     return get_annotation_adapter(context, LEFT_FRAME_PARAGRAPH_RENDERER_SETTINGS_KEY,
-                                  LeftFrameParagraphRendererSettings)
+                                  ILeftFrameParagraphRendererSettings)
 
 
 @adapter_config(context=IFrameParagraph, provides=IRightFrameParagraphRendererSettings)
 def right_lateral_frame_paragraph_renderer_settings_factory(context):
     """Frame text paragraph lateral renderer settings factory"""
     return get_annotation_adapter(context, RIGHT_FRAME_PARAGRAPH_RENDERER_SETTINGS_KEY,
-                                  RightFrameParagraphRendererSettings)
+                                  IRightFrameParagraphRendererSettings)
 
 
 #
--- a/src/pyams_default_theme/component/paragraph/html.py	Wed Jan 16 18:56:36 2019 +0100
+++ b/src/pyams_default_theme/component/paragraph/html.py	Thu Jan 17 11:15:20 2019 +0100
@@ -17,7 +17,6 @@
 from pyams_content.component.illustration import IIllustration
 from pyams_content.component.paragraph.interfaces.html import IHTMLParagraph, IRawParagraph
 from pyams_content.features.renderer.interfaces import IContentRenderer
-from pyams_default_theme import _
 from pyams_default_theme import library
 from pyams_default_theme.features.renderer import BaseContentRenderer
 from pyams_skin.layer import IPyAMSLayer
@@ -25,7 +24,9 @@
 from pyams_utils.adapter import adapter_config, get_annotation_adapter
 from pyams_utils.fanstatic import ExternalResource
 from pyams_utils.interfaces.text import IHTMLRenderer
-from pyams_utils.pygments import IPygmentsCodeConfiguration, PygmentsCodeRendererSettings, render_source
+from pyams_utils.pygments import IPygmentsCodeConfiguration, render_source
+
+from pyams_default_theme import _
 
 
 #
@@ -54,7 +55,7 @@
 def raw_paragraph_source_code_renderer_settings_factory(context):
     """Raw paragraph source code renderer settings factory"""
     return get_annotation_adapter(context, RAW_PARAGRAPH_SOURCE_CODE_RENDERER_SETTINGS_KEY,
-                                  PygmentsCodeRendererSettings)
+                                  IPygmentsCodeConfiguration)
 
 
 @adapter_config(name='source-code', context=(IRawParagraph, IPyAMSLayer), provides=IContentRenderer)
--- a/src/pyams_default_theme/component/paragraph/map.py	Wed Jan 16 18:56:36 2019 +0100
+++ b/src/pyams_default_theme/component/paragraph/map.py	Thu Jan 17 11:15:20 2019 +0100
@@ -16,19 +16,19 @@
 from pyams_content.component.paragraph.interfaces.map import have_gis
 if have_gis:
 
-    from zope.interface import implementer
     from zope.schema.fieldproperty import FieldProperty
 
     from pyams_content.component.paragraph.interfaces.map import IMapParagraph
     from pyams_content.features.renderer.interfaces import IContentRenderer
     from pyams_default_theme.component.paragraph.interfaces.map import IMapParagraphDefaultRendererSettings
+    from pyams_default_theme.features.renderer import BaseContentRenderer
+    from pyams_gis.configuration import MapConfiguration
     from pyams_gis.interfaces.configuration import IMapConfiguration
     from pyams_gis.interfaces.utility import IMapManager
     from pyams_skin.layer import IPyAMSLayer
-    from pyams_default_theme.features.renderer import BaseContentRenderer
-    from pyams_gis.configuration import MapConfiguration
     from pyams_template.template import template_config
     from pyams_utils.adapter import adapter_config, get_annotation_adapter
+    from pyams_utils.factory import factory_config
     from pyams_utils.registry import get_utility
 
     from pyams_default_theme import _
@@ -41,7 +41,7 @@
     MAP_DEFAULT_RENDERER_SETTINGS_KEY = 'pyams_content.map.renderer:default'
 
 
-    @implementer(IMapParagraphDefaultRendererSettings)
+    @factory_config(IMapParagraphDefaultRendererSettings)
     class MapParagraphDefaultRendererSettings(MapConfiguration):
         """Map paragraph default renderer settings"""
 
@@ -77,7 +77,7 @@
     def map_paragraph_default_renderer_settings_factory(context):
         """Map paragraph default renderer settings factory"""
         return get_annotation_adapter(context, MAP_DEFAULT_RENDERER_SETTINGS_KEY,
-                                      MapParagraphDefaultRendererSettings)
+                                      IMapParagraphDefaultRendererSettings)
 
 
     #
--- a/src/pyams_default_theme/component/paragraph/verbatim.py	Wed Jan 16 18:56:36 2019 +0100
+++ b/src/pyams_default_theme/component/paragraph/verbatim.py	Thu Jan 17 11:15:20 2019 +0100
@@ -13,14 +13,12 @@
 __docformat__ = 'restructuredtext'
 
 from persistent import Persistent
-from zope.interface import implementer
 from zope.location import Location
 from zope.schema.fieldproperty import FieldProperty
 
 from pyams_content.component.illustration.interfaces import IIllustration
 from pyams_content.component.paragraph.interfaces.verbatim import IVerbatimParagraph
 from pyams_content.features.renderer.interfaces import IContentRenderer
-from pyams_default_theme import _
 from pyams_default_theme.component.paragraph.interfaces.verbatim import ILateralVerbatimParagraphRendererSettings, \
     IVerbatimParagraphRendererSettings
 from pyams_default_theme.features.renderer import BaseContentRenderer
@@ -28,6 +26,9 @@
 from pyams_skin.layer import IPyAMSLayer
 from pyams_template.template import template_config
 from pyams_utils.adapter import adapter_config, get_annotation_adapter
+from pyams_utils.factory import factory_config
+
+from pyams_default_theme import _
 
 
 #
@@ -37,7 +38,7 @@
 VERBATIM_PARAGRAPH_RENDERER_SETTINGS_KEY = 'pyams_content.verbatim.renderer'
 
 
-@implementer(IVerbatimParagraphRendererSettings)
+@factory_config(IVerbatimParagraphRendererSettings)
 class VerbatimParagraphRendererSettings(Persistent, Location):
     """Verbatim paragraph renderer settings"""
 
@@ -48,7 +49,7 @@
 def verbatim_paragraph_renderer_settings_factory(context):
     """Frame text paragraph renderer settings factory"""
     return get_annotation_adapter(context, VERBATIM_PARAGRAPH_RENDERER_SETTINGS_KEY,
-                                  VerbatimParagraphRendererSettings)
+                                  IVerbatimParagraphRendererSettings)
 
 
 #
@@ -58,7 +59,7 @@
 LATERAL_VERBATIM_PARAGRAPH_RENDERER_SETTINGS_KEY = 'pyams_content.verbatim.renderer:lateral'
 
 
-@implementer(ILateralVerbatimParagraphRendererSettings)
+@factory_config(ILateralVerbatimParagraphRendererSettings)
 class LateralVerbatimParagraphRendererSettings(VerbatimParagraphRendererSettings):
     """Verbatim paragraph lateral renderer settings"""
 
@@ -69,7 +70,7 @@
 def lateral_verbatim_paragraph_renderer_settings_factory(context):
     """Frame text paragraph lateral renderer settings factory"""
     return get_annotation_adapter(context, LATERAL_VERBATIM_PARAGRAPH_RENDERER_SETTINGS_KEY,
-                                  LateralVerbatimParagraphRendererSettings)
+                                  ILateralVerbatimParagraphRendererSettings)
 
 
 #
--- a/src/pyams_default_theme/features/footer/__init__.py	Wed Jan 16 18:56:36 2019 +0100
+++ b/src/pyams_default_theme/features/footer/__init__.py	Thu Jan 17 11:15:20 2019 +0100
@@ -20,8 +20,7 @@
 
 from pyams_content.component.association.interfaces import ASSOCIATION_CONTAINER_KEY
 from pyams_content.features.footer.interfaces import IFooterSettings, IFooterTarget
-from pyams_content.features.menu import MenusContainer, IMenusContainer
-from pyams_content.features.menu.interfaces import IMenusContainerTarget
+from pyams_content.features.menu.interfaces import IMenusContainer, IMenusContainerTarget
 from pyams_default_theme.features.footer.interfaces import ISimpleFooterMenusContainer, ISimpleFooterRendererSettings
 from pyams_default_theme.layer import IPyAMSDefaultLayer
 from pyams_utils.adapter import ContextAdapter, adapter_config, get_annotation_adapter
@@ -69,7 +68,7 @@
 
     @property
     def menus(self):
-        return get_annotation_adapter(self, SIMPLE_FOOTER_MENUS_KEY, MenusContainer,
+        return get_annotation_adapter(self, SIMPLE_FOOTER_MENUS_KEY, IMenusContainer,
                                       markers=ISimpleFooterMenusContainer, name='++ass++menus')
 
 
--- a/src/pyams_default_theme/features/header/__init__.py	Wed Jan 16 18:56:36 2019 +0100
+++ b/src/pyams_default_theme/features/header/__init__.py	Thu Jan 17 11:15:20 2019 +0100
@@ -20,8 +20,7 @@
 
 from pyams_content.component.association.interfaces import ASSOCIATION_CONTAINER_KEY
 from pyams_content.features.header.interfaces import IHeaderSettings, IHeaderTarget
-from pyams_content.features.menu import MenusContainer, IMenusContainer
-from pyams_content.features.menu.interfaces import IMenusContainerTarget
+from pyams_content.features.menu.interfaces import IMenusContainer, IMenusContainerTarget
 from pyams_default_theme.features.header.interfaces import ISimpleHeaderRendererSettings, ISimpleHeaderMenusContainer
 from pyams_default_theme.layer import IPyAMSDefaultLayer
 from pyams_file.property import FileProperty
@@ -74,7 +73,7 @@
 
     @property
     def menus(self):
-        return get_annotation_adapter(self, SIMPLE_HEADER_MENUS_KEY, MenusContainer,
+        return get_annotation_adapter(self, SIMPLE_HEADER_MENUS_KEY, IMenusContainer,
                                       markers=ISimpleHeaderMenusContainer, name='++ass++menus')
 
 
--- a/src/pyams_default_theme/resources/js/ext/ekko-lightbox.js	Wed Jan 16 18:56:36 2019 +0100
+++ b/src/pyams_default_theme/resources/js/ext/ekko-lightbox.js	Thu Jan 17 11:15:20 2019 +0100
@@ -94,7 +94,7 @@
 			this._modalId = 'ekkoLightbox-' + Math.floor(Math.random() * 1000 + 1);
 			this._$element = $element instanceof jQuery ? $element : $($element);
 
-			this._isBootstrap3 = $.fn.modal.Constructor.VERSION[0] == 3;
+			this._isBootstrap3 = $.fn.tooltip.Constructor.VERSION[0] == 3;
 
 			var h4 = '<h4 class="modal-title">' + (this._config.title || "&nbsp;") + '</h4>';
 			var btn = '<button type="button" class="close" data-dismiss="modal" aria-label="' + this._config.strings.close + '"><span aria-hidden="true">&times;</span></button>';
--- a/src/pyams_default_theme/resources/js/ext/ekko-lightbox.min.js	Wed Jan 16 18:56:36 2019 +0100
+++ b/src/pyams_default_theme/resources/js/ext/ekko-lightbox.min.js	Thu Jan 17 11:15:20 2019 +0100
@@ -1,1 +1,1 @@
-+function(t){"use strict";function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}();!function(t){var o="ekkoLightbox",a=t.fn[o],s={title:"",footer:"",maxWidth:9999,maxHeight:9999,showArrows:!0,wrapping:!0,type:null,alwaysShowClose:!1,loadingMessage:'<div class="ekko-lightbox-loader"><div><div></div><div></div></div></div>',leftArrow:"<span>&#10094;</span>",rightArrow:"<span>&#10095;</span>",strings:{close:"Close",fail:"Failed to load image:",type:"Could not detect remote target type. Force the type using data-type"},doc:document,onShow:function(){},onShown:function(){},onHide:function(){},onHidden:function(){},onNavigate:function(){},onContentLoaded:function(){}},n=function(){function o(i,a){var n=this;e(this,o),this._config=t.extend({},s,a),this._$modalArrows=null,this._galleryIndex=0,this._galleryName=null,this._padding=null,this._border=null,this._titleIsShown=!1,this._footerIsShown=!1,this._wantedWidth=0,this._wantedHeight=0,this._touchstartX=0,this._touchendX=0,this._modalId="ekkoLightbox-"+Math.floor(1e3*Math.random()+1),this._$element=i instanceof jQuery?i:t(i),this._isBootstrap3=3==t.fn.modal.Constructor.VERSION[0];var l='<h4 class="modal-title">'+(this._config.title||"&nbsp;")+"</h4>",r='<button type="button" class="close" data-dismiss="modal" aria-label="'+this._config.strings.close+'"><span aria-hidden="true">&times;</span></button>',d='<div class="modal-dialog" role="document"><div class="modal-content">'+('<div class="modal-header'+(this._config.title||this._config.alwaysShowClose?"":" hide")+'">'+(this._isBootstrap3?r+l:l+r)+"</div>")+'<div class="modal-body"><div class="ekko-lightbox-container"><div class="ekko-lightbox-item fade in show"></div><div class="ekko-lightbox-item fade"></div></div></div>'+('<div class="modal-footer'+(this._config.footer?"":" hide")+'">'+(this._config.footer||"&nbsp;")+"</div>")+"</div></div>";t(this._config.doc.body).append('<div id="'+this._modalId+'" class="ekko-lightbox modal fade" tabindex="-1" tabindex="-1" role="dialog" aria-hidden="true">'+d+"</div>"),this._$modal=t("#"+this._modalId,this._config.doc),this._$modalDialog=this._$modal.find(".modal-dialog").first(),this._$modalContent=this._$modal.find(".modal-content").first(),this._$modalBody=this._$modal.find(".modal-body").first(),this._$modalHeader=this._$modal.find(".modal-header").first(),this._$modalFooter=this._$modal.find(".modal-footer").first(),this._$lightboxContainer=this._$modalBody.find(".ekko-lightbox-container").first(),this._$lightboxBodyOne=this._$lightboxContainer.find("> div:first-child").first(),this._$lightboxBodyTwo=this._$lightboxContainer.find("> div:last-child").first(),this._border=this._calculateBorders(),this._padding=this._calculatePadding(),this._galleryName=this._$element.data("gallery"),this._galleryName&&(this._$galleryItems=t(document.body).find('*[data-gallery="'+this._galleryName+'"]'),this._galleryIndex=this._$galleryItems.index(this._$element),t(document).on("keydown.ekkoLightbox",this._navigationalBinder.bind(this)),this._config.showArrows&&this._$galleryItems.length>1&&(this._$lightboxContainer.append('<div class="ekko-lightbox-nav-overlay"><a href="#">'+this._config.leftArrow+'</a><a href="#">'+this._config.rightArrow+"</a></div>"),this._$modalArrows=this._$lightboxContainer.find("div.ekko-lightbox-nav-overlay").first(),this._$lightboxContainer.on("click","a:first-child",function(t){return t.preventDefault(),n.navigateLeft()}),this._$lightboxContainer.on("click","a:last-child",function(t){return t.preventDefault(),n.navigateRight()}),this.updateNavigation())),this._$modal.on("show.bs.modal",this._config.onShow.bind(this)).on("shown.bs.modal",function(){return n._toggleLoading(!0),n._handle(),n._config.onShown.call(n)}).on("hide.bs.modal",this._config.onHide.bind(this)).on("hidden.bs.modal",function(){return n._galleryName&&(t(document).off("keydown.ekkoLightbox"),t(window).off("resize.ekkoLightbox")),n._$modal.remove(),n._config.onHidden.call(n)}).modal(this._config),t(window).on("resize.ekkoLightbox",function(){n._resize(n._wantedWidth,n._wantedHeight)}),this._$lightboxContainer.on("touchstart",function(){n._touchstartX=event.changedTouches[0].screenX}).on("touchend",function(){n._touchendX=event.changedTouches[0].screenX,n._swipeGesure()})}return i(o,null,[{key:"Default",get:function(){return s}}]),i(o,[{key:"element",value:function(){return this._$element}},{key:"modal",value:function(){return this._$modal}},{key:"navigateTo",value:function(e){if(e<0||e>this._$galleryItems.length-1)return this;this._galleryIndex=e,this.updateNavigation(),this._$element=t(this._$galleryItems.get(this._galleryIndex)),this._handle()}},{key:"navigateLeft",value:function(){if(this._$galleryItems&&1!==this._$galleryItems.length){if(0===this._galleryIndex){if(!this._config.wrapping)return;this._galleryIndex=this._$galleryItems.length-1}else this._galleryIndex--;return this._config.onNavigate.call(this,"left",this._galleryIndex),this.navigateTo(this._galleryIndex)}}},{key:"navigateRight",value:function(){if(this._$galleryItems&&1!==this._$galleryItems.length){if(this._galleryIndex===this._$galleryItems.length-1){if(!this._config.wrapping)return;this._galleryIndex=0}else this._galleryIndex++;return this._config.onNavigate.call(this,"right",this._galleryIndex),this.navigateTo(this._galleryIndex)}}},{key:"updateNavigation",value:function(){if(!this._config.wrapping){var t=this._$lightboxContainer.find("div.ekko-lightbox-nav-overlay");0===this._galleryIndex?t.find("a:first-child").addClass("disabled"):t.find("a:first-child").removeClass("disabled"),this._galleryIndex===this._$galleryItems.length-1?t.find("a:last-child").addClass("disabled"):t.find("a:last-child").removeClass("disabled")}}},{key:"close",value:function(){return this._$modal.modal("hide")}},{key:"_navigationalBinder",value:function(t){return 39===(t=t||window.event).keyCode?this.navigateRight():37===t.keyCode?this.navigateLeft():void 0}},{key:"_detectRemoteType",value:function(t,e){return!(e=e||!1)&&this._isImage(t)&&(e="image"),!e&&this._getYoutubeId(t)&&(e="youtube"),!e&&this._getVimeoId(t)&&(e="vimeo"),!e&&this._getInstagramId(t)&&(e="instagram"),("audio"==e||"video"==e||!e&&this._isMedia(t))&&(e="media"),(!e||["image","youtube","vimeo","instagram","media","url"].indexOf(e)<0)&&(e="url"),e}},{key:"_getRemoteContentType",value:function(e){return t.ajax({type:"HEAD",url:e,async:!1}).getResponseHeader("Content-Type")}},{key:"_isImage",value:function(t){return t&&t.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)}},{key:"_isMedia",value:function(t){return t&&t.match(/(\.(mp3|mp4|ogg|webm|wav)((\?|#).*)?$)/i)}},{key:"_containerToUse",value:function(){var t=this,e=this._$lightboxBodyTwo,i=this._$lightboxBodyOne;return this._$lightboxBodyTwo.hasClass("in")&&(e=this._$lightboxBodyOne,i=this._$lightboxBodyTwo),i.removeClass("in show"),setTimeout(function(){t._$lightboxBodyTwo.hasClass("in")||t._$lightboxBodyTwo.empty(),t._$lightboxBodyOne.hasClass("in")||t._$lightboxBodyOne.empty()},500),e.addClass("in show"),e}},{key:"_handle",value:function(){var t=this._containerToUse();this._updateTitleAndFooter();var e=this._$element.attr("data-remote")||this._$element.attr("href"),i=this._detectRemoteType(e,this._$element.attr("data-type")||!1);if(["image","youtube","vimeo","instagram","media","url"].indexOf(i)<0)return this._error(this._config.strings.type);switch(i){case"image":this._preloadImage(e,t),this._preloadImageByIndex(this._galleryIndex,3);break;case"youtube":this._showYoutubeVideo(e,t);break;case"vimeo":this._showVimeoVideo(this._getVimeoId(e),t);break;case"instagram":this._showInstagramVideo(this._getInstagramId(e),t);break;case"media":this._showHtml5Media(e,t);break;default:this._loadRemoteContent(e,t)}return this}},{key:"_getYoutubeId",value:function(t){if(!t)return!1;var e=t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/);return!(!e||11!==e[2].length)&&e[2]}},{key:"_getVimeoId",value:function(t){return!!(t&&t.indexOf("vimeo")>0)&&t}},{key:"_getInstagramId",value:function(t){return!!(t&&t.indexOf("instagram")>0)&&t}},{key:"_toggleLoading",value:function(e){return(e=e||!1)?(this._$modalDialog.css("display","none"),this._$modal.removeClass("in show"),t(".modal-backdrop").append(this._config.loadingMessage)):(this._$modalDialog.css("display","block"),this._$modal.addClass("in show"),t(".modal-backdrop").find(".ekko-lightbox-loader").remove()),this}},{key:"_calculateBorders",value:function(){return{top:this._totalCssByAttribute("border-top-width"),right:this._totalCssByAttribute("border-right-width"),bottom:this._totalCssByAttribute("border-bottom-width"),left:this._totalCssByAttribute("border-left-width")}}},{key:"_calculatePadding",value:function(){return{top:this._totalCssByAttribute("padding-top"),right:this._totalCssByAttribute("padding-right"),bottom:this._totalCssByAttribute("padding-bottom"),left:this._totalCssByAttribute("padding-left")}}},{key:"_totalCssByAttribute",value:function(t){return parseInt(this._$modalDialog.css(t),10)+parseInt(this._$modalContent.css(t),10)+parseInt(this._$modalBody.css(t),10)}},{key:"_updateTitleAndFooter",value:function(){var t=this._$element.data("title")||"",e=this._$element.data("footer")||"";return this._titleIsShown=!1,t||this._config.alwaysShowClose?(this._titleIsShown=!0,this._$modalHeader.css("display","").find(".modal-title").html(t||"&nbsp;")):this._$modalHeader.css("display","none"),this._footerIsShown=!1,e?(this._footerIsShown=!0,this._$modalFooter.css("display","").html(e)):this._$modalFooter.css("display","none"),this}},{key:"_showYoutubeVideo",value:function(t,e){var i=this._getYoutubeId(t),o=t.indexOf("&")>0?t.substr(t.indexOf("&")):"",a=this._$element.data("width")||560,s=this._$element.data("height")||a/(560/315);return this._showVideoIframe("//www.youtube.com/embed/"+i+"?badge=0&autoplay=1&html5=1"+o,a,s,e)}},{key:"_showVimeoVideo",value:function(t,e){var i=this._$element.data("width")||500,o=this._$element.data("height")||i/(560/315);return this._showVideoIframe(t+"?autoplay=1",i,o,e)}},{key:"_showInstagramVideo",value:function(t,e){var i=this._$element.data("width")||612,o=i+80;return t="/"!==t.substr(-1)?t+"/":t,e.html('<iframe width="'+i+'" height="'+o+'" src="'+t+'embed/" frameborder="0" allowfullscreen></iframe>'),this._resize(i,o),this._config.onContentLoaded.call(this),this._$modalArrows&&this._$modalArrows.css("display","none"),this._toggleLoading(!1),this}},{key:"_showVideoIframe",value:function(t,e,i,o){return i=i||e,o.html('<div class="embed-responsive embed-responsive-16by9"><iframe width="'+e+'" height="'+i+'" src="'+t+'" frameborder="0" allowfullscreen class="embed-responsive-item"></iframe></div>'),this._resize(e,i),this._config.onContentLoaded.call(this),this._$modalArrows&&this._$modalArrows.css("display","none"),this._toggleLoading(!1),this}},{key:"_showHtml5Media",value:function(t,e){var i=this._getRemoteContentType(t);if(!i)return this._error(this._config.strings.type);var o="";o=i.indexOf("audio")>0?"audio":"video";var a=this._$element.data("width")||560,s=this._$element.data("height")||a/(560/315);return e.html('<div class="embed-responsive embed-responsive-16by9"><'+o+' width="'+a+'" height="'+s+'" preload="auto" autoplay controls class="embed-responsive-item"><source src="'+t+'" type="'+i+'">'+this._config.strings.type+"</"+o+"></div>"),this._resize(a,s),this._config.onContentLoaded.call(this),this._$modalArrows&&this._$modalArrows.css("display","none"),this._toggleLoading(!1),this}},{key:"_loadRemoteContent",value:function(e,i){var o=this,a=this._$element.data("width")||560,s=this._$element.data("height")||560,n=this._$element.data("disableExternalCheck")||!1;return this._toggleLoading(!1),n||this._isExternal(e)?(i.html('<iframe src="'+e+'" frameborder="0" allowfullscreen></iframe>'),this._config.onContentLoaded.call(this)):i.load(e,t.proxy(function(){return o._$element.trigger("loaded.bs.modal")})),this._$modalArrows&&this._$modalArrows.css("display","none"),this._resize(a,s),this}},{key:"_isExternal",value:function(t){var e=t.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);return"string"==typeof e[1]&&e[1].length>0&&e[1].toLowerCase()!==location.protocol||"string"==typeof e[2]&&e[2].length>0&&e[2].replace(new RegExp(":("+{"http:":80,"https:":443}[location.protocol]+")?$"),"")!==location.host}},{key:"_error",value:function(t){return console.error(t),this._containerToUse().html(t),this._resize(300,300),this}},{key:"_preloadImageByIndex",value:function(e,i){if(this._$galleryItems){var o=t(this._$galleryItems.get(e),!1);if(void 0!==o){var a=o.attr("data-remote")||o.attr("href");return("image"===o.attr("data-type")||this._isImage(a))&&this._preloadImage(a,!1),i>0?this._preloadImageByIndex(e+1,i-1):void 0}}}},{key:"_preloadImage",value:function(e,i){var o=this;i=i||!1;var a=new Image;return i&&function(){var s=setTimeout(function(){i.append(o._config.loadingMessage)},200);a.onload=function(){s&&clearTimeout(s),s=null;var e=t("<img />");return e.attr("src",a.src),e.addClass("img-fluid"),e.css("width","100%"),i.html(e),o._$modalArrows&&o._$modalArrows.css("display",""),o._resize(a.width,a.height),o._toggleLoading(!1),o._config.onContentLoaded.call(o)},a.onerror=function(){return o._toggleLoading(!1),o._error(o._config.strings.fail+"  "+e)}}(),a.src=e,a}},{key:"_swipeGesure",value:function(){return this._touchendX<this._touchstartX?this.navigateRight():this._touchendX>this._touchstartX?this.navigateLeft():void 0}},{key:"_resize",value:function(e,i){i=i||e,this._wantedWidth=e,this._wantedHeight=i;var o=e/i,a=this._padding.left+this._padding.right+this._border.left+this._border.right,s=this._config.doc.body.clientWidth>575?20:0,n=this._config.doc.body.clientWidth>575?0:20,l=Math.min(e+a,this._config.doc.body.clientWidth-s,this._config.maxWidth);e+a>l?(i=(l-a-n)/o,e=l):e+=a;var r=0,d=0;this._footerIsShown&&(d=this._$modalFooter.outerHeight(!0)||55),this._titleIsShown&&(r=this._$modalHeader.outerHeight(!0)||67);var h=this._padding.top+this._padding.bottom+this._border.bottom+this._border.top,g=parseFloat(this._$modalDialog.css("margin-top"))+parseFloat(this._$modalDialog.css("margin-bottom")),_=Math.min(i,t(window).height()-h-g-r-d,this._config.maxHeight-h-r-d);i>_&&(e=Math.ceil(_*o)+a),this._$lightboxContainer.css("height",_),this._$modalDialog.css("flex",1).css("maxWidth",e);var c=this._$modal.data("bs.modal");if(c)try{c._handleUpdate()}catch(t){c.handleUpdate()}return this}}],[{key:"_jQueryInterface",value:function(e){var i=this;return e=e||{},this.each(function(){var a=t(i),s=t.extend({},o.Default,a.data(),"object"==typeof e&&e);new o(i,s)})}}]),o}();t.fn[o]=n._jQueryInterface,t.fn[o].Constructor=n,t.fn[o].noConflict=function(){return t.fn[o]=a,n._jQueryInterface}}(jQuery)}(jQuery);
++function(t){"use strict";function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}();!function(t){var o="ekkoLightbox",a=t.fn[o],s={title:"",footer:"",maxWidth:9999,maxHeight:9999,showArrows:!0,wrapping:!0,type:null,alwaysShowClose:!1,loadingMessage:'<div class="ekko-lightbox-loader"><div><div></div><div></div></div></div>',leftArrow:"<span>&#10094;</span>",rightArrow:"<span>&#10095;</span>",strings:{close:"Close",fail:"Failed to load image:",type:"Could not detect remote target type. Force the type using data-type"},doc:document,onShow:function(){},onShown:function(){},onHide:function(){},onHidden:function(){},onNavigate:function(){},onContentLoaded:function(){}},n=function(){function o(i,a){var n=this;e(this,o),this._config=t.extend({},s,a),this._$modalArrows=null,this._galleryIndex=0,this._galleryName=null,this._padding=null,this._border=null,this._titleIsShown=!1,this._footerIsShown=!1,this._wantedWidth=0,this._wantedHeight=0,this._touchstartX=0,this._touchendX=0,this._modalId="ekkoLightbox-"+Math.floor(1e3*Math.random()+1),this._$element=i instanceof jQuery?i:t(i),this._isBootstrap3=3==t.fn.tooltip.Constructor.VERSION[0];var l='<h4 class="modal-title">'+(this._config.title||"&nbsp;")+"</h4>",r='<button type="button" class="close" data-dismiss="modal" aria-label="'+this._config.strings.close+'"><span aria-hidden="true">&times;</span></button>',d='<div class="modal-dialog" role="document"><div class="modal-content">'+('<div class="modal-header'+(this._config.title||this._config.alwaysShowClose?"":" hide")+'">'+(this._isBootstrap3?r+l:l+r)+"</div>")+'<div class="modal-body"><div class="ekko-lightbox-container"><div class="ekko-lightbox-item fade in show"></div><div class="ekko-lightbox-item fade"></div></div></div>'+('<div class="modal-footer'+(this._config.footer?"":" hide")+'">'+(this._config.footer||"&nbsp;")+"</div>")+"</div></div>";t(this._config.doc.body).append('<div id="'+this._modalId+'" class="ekko-lightbox modal fade" tabindex="-1" tabindex="-1" role="dialog" aria-hidden="true">'+d+"</div>"),this._$modal=t("#"+this._modalId,this._config.doc),this._$modalDialog=this._$modal.find(".modal-dialog").first(),this._$modalContent=this._$modal.find(".modal-content").first(),this._$modalBody=this._$modal.find(".modal-body").first(),this._$modalHeader=this._$modal.find(".modal-header").first(),this._$modalFooter=this._$modal.find(".modal-footer").first(),this._$lightboxContainer=this._$modalBody.find(".ekko-lightbox-container").first(),this._$lightboxBodyOne=this._$lightboxContainer.find("> div:first-child").first(),this._$lightboxBodyTwo=this._$lightboxContainer.find("> div:last-child").first(),this._border=this._calculateBorders(),this._padding=this._calculatePadding(),this._galleryName=this._$element.data("gallery"),this._galleryName&&(this._$galleryItems=t(document.body).find('*[data-gallery="'+this._galleryName+'"]'),this._galleryIndex=this._$galleryItems.index(this._$element),t(document).on("keydown.ekkoLightbox",this._navigationalBinder.bind(this)),this._config.showArrows&&this._$galleryItems.length>1&&(this._$lightboxContainer.append('<div class="ekko-lightbox-nav-overlay"><a href="#">'+this._config.leftArrow+'</a><a href="#">'+this._config.rightArrow+"</a></div>"),this._$modalArrows=this._$lightboxContainer.find("div.ekko-lightbox-nav-overlay").first(),this._$lightboxContainer.on("click","a:first-child",function(t){return t.preventDefault(),n.navigateLeft()}),this._$lightboxContainer.on("click","a:last-child",function(t){return t.preventDefault(),n.navigateRight()}),this.updateNavigation())),this._$modal.on("show.bs.modal",this._config.onShow.bind(this)).on("shown.bs.modal",function(){return n._toggleLoading(!0),n._handle(),n._config.onShown.call(n)}).on("hide.bs.modal",this._config.onHide.bind(this)).on("hidden.bs.modal",function(){return n._galleryName&&(t(document).off("keydown.ekkoLightbox"),t(window).off("resize.ekkoLightbox")),n._$modal.remove(),n._config.onHidden.call(n)}).modal(this._config),t(window).on("resize.ekkoLightbox",function(){n._resize(n._wantedWidth,n._wantedHeight)}),this._$lightboxContainer.on("touchstart",function(){n._touchstartX=event.changedTouches[0].screenX}).on("touchend",function(){n._touchendX=event.changedTouches[0].screenX,n._swipeGesure()})}return i(o,null,[{key:"Default",get:function(){return s}}]),i(o,[{key:"element",value:function(){return this._$element}},{key:"modal",value:function(){return this._$modal}},{key:"navigateTo",value:function(e){if(e<0||e>this._$galleryItems.length-1)return this;this._galleryIndex=e,this.updateNavigation(),this._$element=t(this._$galleryItems.get(this._galleryIndex)),this._handle()}},{key:"navigateLeft",value:function(){if(this._$galleryItems&&1!==this._$galleryItems.length){if(0===this._galleryIndex){if(!this._config.wrapping)return;this._galleryIndex=this._$galleryItems.length-1}else this._galleryIndex--;return this._config.onNavigate.call(this,"left",this._galleryIndex),this.navigateTo(this._galleryIndex)}}},{key:"navigateRight",value:function(){if(this._$galleryItems&&1!==this._$galleryItems.length){if(this._galleryIndex===this._$galleryItems.length-1){if(!this._config.wrapping)return;this._galleryIndex=0}else this._galleryIndex++;return this._config.onNavigate.call(this,"right",this._galleryIndex),this.navigateTo(this._galleryIndex)}}},{key:"updateNavigation",value:function(){if(!this._config.wrapping){var t=this._$lightboxContainer.find("div.ekko-lightbox-nav-overlay");0===this._galleryIndex?t.find("a:first-child").addClass("disabled"):t.find("a:first-child").removeClass("disabled"),this._galleryIndex===this._$galleryItems.length-1?t.find("a:last-child").addClass("disabled"):t.find("a:last-child").removeClass("disabled")}}},{key:"close",value:function(){return this._$modal.modal("hide")}},{key:"_navigationalBinder",value:function(t){return 39===(t=t||window.event).keyCode?this.navigateRight():37===t.keyCode?this.navigateLeft():void 0}},{key:"_detectRemoteType",value:function(t,e){return!(e=e||!1)&&this._isImage(t)&&(e="image"),!e&&this._getYoutubeId(t)&&(e="youtube"),!e&&this._getVimeoId(t)&&(e="vimeo"),!e&&this._getInstagramId(t)&&(e="instagram"),("audio"==e||"video"==e||!e&&this._isMedia(t))&&(e="media"),(!e||["image","youtube","vimeo","instagram","media","url"].indexOf(e)<0)&&(e="url"),e}},{key:"_getRemoteContentType",value:function(e){return t.ajax({type:"HEAD",url:e,async:!1}).getResponseHeader("Content-Type")}},{key:"_isImage",value:function(t){return t&&t.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)}},{key:"_isMedia",value:function(t){return t&&t.match(/(\.(mp3|mp4|ogg|webm|wav)((\?|#).*)?$)/i)}},{key:"_containerToUse",value:function(){var t=this,e=this._$lightboxBodyTwo,i=this._$lightboxBodyOne;return this._$lightboxBodyTwo.hasClass("in")&&(e=this._$lightboxBodyOne,i=this._$lightboxBodyTwo),i.removeClass("in show"),setTimeout(function(){t._$lightboxBodyTwo.hasClass("in")||t._$lightboxBodyTwo.empty(),t._$lightboxBodyOne.hasClass("in")||t._$lightboxBodyOne.empty()},500),e.addClass("in show"),e}},{key:"_handle",value:function(){var t=this._containerToUse();this._updateTitleAndFooter();var e=this._$element.attr("data-remote")||this._$element.attr("href"),i=this._detectRemoteType(e,this._$element.attr("data-type")||!1);if(["image","youtube","vimeo","instagram","media","url"].indexOf(i)<0)return this._error(this._config.strings.type);switch(i){case"image":this._preloadImage(e,t),this._preloadImageByIndex(this._galleryIndex,3);break;case"youtube":this._showYoutubeVideo(e,t);break;case"vimeo":this._showVimeoVideo(this._getVimeoId(e),t);break;case"instagram":this._showInstagramVideo(this._getInstagramId(e),t);break;case"media":this._showHtml5Media(e,t);break;default:this._loadRemoteContent(e,t)}return this}},{key:"_getYoutubeId",value:function(t){if(!t)return!1;var e=t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/);return!(!e||11!==e[2].length)&&e[2]}},{key:"_getVimeoId",value:function(t){return!!(t&&t.indexOf("vimeo")>0)&&t}},{key:"_getInstagramId",value:function(t){return!!(t&&t.indexOf("instagram")>0)&&t}},{key:"_toggleLoading",value:function(e){return(e=e||!1)?(this._$modalDialog.css("display","none"),this._$modal.removeClass("in show"),t(".modal-backdrop").append(this._config.loadingMessage)):(this._$modalDialog.css("display","block"),this._$modal.addClass("in show"),t(".modal-backdrop").find(".ekko-lightbox-loader").remove()),this}},{key:"_calculateBorders",value:function(){return{top:this._totalCssByAttribute("border-top-width"),right:this._totalCssByAttribute("border-right-width"),bottom:this._totalCssByAttribute("border-bottom-width"),left:this._totalCssByAttribute("border-left-width")}}},{key:"_calculatePadding",value:function(){return{top:this._totalCssByAttribute("padding-top"),right:this._totalCssByAttribute("padding-right"),bottom:this._totalCssByAttribute("padding-bottom"),left:this._totalCssByAttribute("padding-left")}}},{key:"_totalCssByAttribute",value:function(t){return parseInt(this._$modalDialog.css(t),10)+parseInt(this._$modalContent.css(t),10)+parseInt(this._$modalBody.css(t),10)}},{key:"_updateTitleAndFooter",value:function(){var t=this._$element.data("title")||"",e=this._$element.data("footer")||"";return this._titleIsShown=!1,t||this._config.alwaysShowClose?(this._titleIsShown=!0,this._$modalHeader.css("display","").find(".modal-title").html(t||"&nbsp;")):this._$modalHeader.css("display","none"),this._footerIsShown=!1,e?(this._footerIsShown=!0,this._$modalFooter.css("display","").html(e)):this._$modalFooter.css("display","none"),this}},{key:"_showYoutubeVideo",value:function(t,e){var i=this._getYoutubeId(t),o=t.indexOf("&")>0?t.substr(t.indexOf("&")):"",a=this._$element.data("width")||560,s=this._$element.data("height")||a/(560/315);return this._showVideoIframe("//www.youtube.com/embed/"+i+"?badge=0&autoplay=1&html5=1"+o,a,s,e)}},{key:"_showVimeoVideo",value:function(t,e){var i=this._$element.data("width")||500,o=this._$element.data("height")||i/(560/315);return this._showVideoIframe(t+"?autoplay=1",i,o,e)}},{key:"_showInstagramVideo",value:function(t,e){var i=this._$element.data("width")||612,o=i+80;return t="/"!==t.substr(-1)?t+"/":t,e.html('<iframe width="'+i+'" height="'+o+'" src="'+t+'embed/" frameborder="0" allowfullscreen></iframe>'),this._resize(i,o),this._config.onContentLoaded.call(this),this._$modalArrows&&this._$modalArrows.css("display","none"),this._toggleLoading(!1),this}},{key:"_showVideoIframe",value:function(t,e,i,o){return i=i||e,o.html('<div class="embed-responsive embed-responsive-16by9"><iframe width="'+e+'" height="'+i+'" src="'+t+'" frameborder="0" allowfullscreen class="embed-responsive-item"></iframe></div>'),this._resize(e,i),this._config.onContentLoaded.call(this),this._$modalArrows&&this._$modalArrows.css("display","none"),this._toggleLoading(!1),this}},{key:"_showHtml5Media",value:function(t,e){var i=this._getRemoteContentType(t);if(!i)return this._error(this._config.strings.type);var o="";o=i.indexOf("audio")>0?"audio":"video";var a=this._$element.data("width")||560,s=this._$element.data("height")||a/(560/315);return e.html('<div class="embed-responsive embed-responsive-16by9"><'+o+' width="'+a+'" height="'+s+'" preload="auto" autoplay controls class="embed-responsive-item"><source src="'+t+'" type="'+i+'">'+this._config.strings.type+"</"+o+"></div>"),this._resize(a,s),this._config.onContentLoaded.call(this),this._$modalArrows&&this._$modalArrows.css("display","none"),this._toggleLoading(!1),this}},{key:"_loadRemoteContent",value:function(e,i){var o=this,a=this._$element.data("width")||560,s=this._$element.data("height")||560,n=this._$element.data("disableExternalCheck")||!1;return this._toggleLoading(!1),n||this._isExternal(e)?(i.html('<iframe src="'+e+'" frameborder="0" allowfullscreen></iframe>'),this._config.onContentLoaded.call(this)):i.load(e,t.proxy(function(){return o._$element.trigger("loaded.bs.modal")})),this._$modalArrows&&this._$modalArrows.css("display","none"),this._resize(a,s),this}},{key:"_isExternal",value:function(t){var e=t.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);return"string"==typeof e[1]&&e[1].length>0&&e[1].toLowerCase()!==location.protocol||"string"==typeof e[2]&&e[2].length>0&&e[2].replace(new RegExp(":("+{"http:":80,"https:":443}[location.protocol]+")?$"),"")!==location.host}},{key:"_error",value:function(t){return console.error(t),this._containerToUse().html(t),this._resize(300,300),this}},{key:"_preloadImageByIndex",value:function(e,i){if(this._$galleryItems){var o=t(this._$galleryItems.get(e),!1);if(void 0!==o){var a=o.attr("data-remote")||o.attr("href");return("image"===o.attr("data-type")||this._isImage(a))&&this._preloadImage(a,!1),i>0?this._preloadImageByIndex(e+1,i-1):void 0}}}},{key:"_preloadImage",value:function(e,i){var o=this;i=i||!1;var a=new Image;return i&&function(){var s=setTimeout(function(){i.append(o._config.loadingMessage)},200);a.onload=function(){s&&clearTimeout(s),s=null;var e=t("<img />");return e.attr("src",a.src),e.addClass("img-fluid"),e.css("width","100%"),i.html(e),o._$modalArrows&&o._$modalArrows.css("display",""),o._resize(a.width,a.height),o._toggleLoading(!1),o._config.onContentLoaded.call(o)},a.onerror=function(){return o._toggleLoading(!1),o._error(o._config.strings.fail+"  "+e)}}(),a.src=e,a}},{key:"_swipeGesure",value:function(){return this._touchendX<this._touchstartX?this.navigateRight():this._touchendX>this._touchstartX?this.navigateLeft():void 0}},{key:"_resize",value:function(e,i){i=i||e,this._wantedWidth=e,this._wantedHeight=i;var o=e/i,a=this._padding.left+this._padding.right+this._border.left+this._border.right,s=this._config.doc.body.clientWidth>575?20:0,n=this._config.doc.body.clientWidth>575?0:20,l=Math.min(e+a,this._config.doc.body.clientWidth-s,this._config.maxWidth);e+a>l?(i=(l-a-n)/o,e=l):e+=a;var r=0,d=0;this._footerIsShown&&(d=this._$modalFooter.outerHeight(!0)||55),this._titleIsShown&&(r=this._$modalHeader.outerHeight(!0)||67);var h=this._padding.top+this._padding.bottom+this._border.bottom+this._border.top,g=parseFloat(this._$modalDialog.css("margin-top"))+parseFloat(this._$modalDialog.css("margin-bottom")),_=Math.min(i,t(window).height()-h-g-r-d,this._config.maxHeight-h-r-d);i>_&&(e=Math.ceil(_*o)+a),this._$lightboxContainer.css("height",_),this._$modalDialog.css("flex",1).css("maxWidth",e);var c=this._$modal.data("bs.modal");if(c)try{c._handleUpdate()}catch(t){c.handleUpdate()}return this}}],[{key:"_jQueryInterface",value:function(e){var i=this;return e=e||{},this.each(function(){var a=t(i),s=t.extend({},o.Default,a.data(),"object"==typeof e&&e);new o(i,s)})}}]),o}();t.fn[o]=n._jQueryInterface,t.fn[o].Constructor=n,t.fn[o].noConflict=function(){return t.fn[o]=a,n._jQueryInterface}}(jQuery)}(jQuery);