/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/gifplayer@0.3.7/dist/jquery.gifplayer.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(e){"object"==typeof module&&"object"==typeof module.exports?module.exports=e(require("jquery")):e(jQuery)}((function(e){function t(e,t){this.previewElement=e,this.options=t,this.animationLoaded=!1}return t.scopes=new Array,t.prototype={supportedFormats:["gif","jpeg","jpg","png"],activate:function(){var e=this;0===this.previewElement.width()?setTimeout((function(){e.activate()}),100):(e.mode=e.getOption("mode"),e.wrap(),e.addSpinner(),e.addControl(),e.addEvents())},wrap:function(){this.previewElement.addClass("gifplayer-ready"),this.wrapper=this.previewElement.wrap("<div class='gifplayer-wrapper'></div>").parent(),this.wrapper.css("width",this.previewElement.width()),this.wrapper.css("height",this.previewElement.height()),this.previewElement.css("cursor","pointer")},addSpinner:function(){this.spinnerElement=e("<div class = 'spinner'></div>"),this.wrapper.append(this.spinnerElement),this.spinnerElement.hide()},getOption:function(e){var t=this.previewElement.data(e.toLowerCase());return void 0!==t&&""!==t?t:this.options[e]},addControl:function(){var t=this.getOption("label");this.playElement=e("<ins class='play-gif'></ins>").text(t),this.wrapper.append(this.playElement),this.playElement.css("top",this.previewElement.height()/2-this.playElement.height()/2),this.playElement.css("left",this.previewElement.width()/2-this.playElement.width()/2)},addEvents:function(){var e=this,t=this.getOption("playOn");switch(t){case"click":e.playElement.on("click",(function(t){e.previewElement.trigger("click")})),e.previewElement.on("click",(function(t){e.getOption("onClick").call(e.previewElement,t),e.loadAnimation(),t.preventDefault(),t.stopPropagation()}));break;case"hover":e.previewElement.on("click mouseover",(function(t){e.loadAnimation(),t.preventDefault(),t.stopPropagation()}));break;case"auto":console.log("auto not implemented yet");break;default:console.log(t+" is not accepted as playOn value.")}},processScope:function(){var e=this.getOption("scope");e&&(t.scopes[e]&&t.scopes[e].stopGif(),t.scopes[e]=this)},loadAnimation:function(){this.processScope(),this.spinnerElement.show(),"gif"==this.mode?this.loadGif():"video"==this.mode&&(this.videoLoaded?this.playVideo():this.loadVideo()),this.getOption("onPlay").call(this.previewElement)},stopGif:function(){this.gifElement.hide(),this.previewElement.show(),this.playElement.show(),this.resetEvents(),this.getOption("onStop").call(this.previewElement)},getFile:function(e){var t=this.getOption(e);if(void 0!==t&&""!==t)return t;for(var i=this.sanitizeURL(this.previewElement.attr("src")),n=0;n<this.supportedFormats.length;n++){var s=new RegExp(this.supportedFormats[n]+"$","i");i=i.replace(s,e)}return i},loadGif:function(){var t=this;t.playElement.hide(),this.animationLoaded||this.enableAbort();var i=this.sanitizeURL(this.getFile("gif")),n=this.previewElement.width(),s=this.previewElement.height();this.gifElement=e("<img class='gp-gif-element' width='"+n+"' height=' "+s+" '/>"),this.getOption("wait")?this.gifElement.on({load:function(){t.animationLoaded=!0,t.resetEvents(),t.previewElement.hide(),t.wrapper.append(t.gifElement),t.spinnerElement.hide(),t.getOption("onLoadComplete").call(t.previewElement)}}):(t.animationLoaded=!0,t.resetEvents(),t.previewElement.hide(),t.wrapper.append(t.gifElement),t.spinnerElement.hide()),this.gifElement.css("cursor","pointer"),this.gifElement.css("position","absolute"),this.gifElement.css("top","0"),this.gifElement.css("left","0"),this.gifElement.attr("src",this.sanitizeURL(i)),this.gifElement.click((function(i){t.getOption("onClick").call(t.previewElement,i),e(this).remove(),t.stopGif(),i.preventDefault(),i.stopPropagation()})),t.getOption("onLoad").call(t.previewElement)},loadVideo:function(){this.videoLoaded=!0;var t=this.sanitizeURL(this.getFile("mp4")),i=this.sanitizeURL(this.getFile("webm")),n=this.previewElement.width(),s=this.previewElement.height();this.videoElement=e("<video>",{class:"gp-video-element",width:n+"px",height:s+"px",style:"margin:0 auto;width:"+n+"px;height:"+s+"px;",autoplay:"autoplay",loop:"loop",muted:"muted",poster:this.sanitizeURL(this.previewElement.attr("src"))}).append(e("<source>",{type:"video/mp4",src:this.sanitizeURL(t)}),e("<source>",{type:"video/webm",src:this.sanitizeURL(i)}));var o=this,p=function(){4===o.videoElement[0].readyState?(o.playVideo(),o.animationLoaded=!0):setTimeout(p,100)};this.getOption("wait")?p():this.playVideo(),this.videoElement.on("click",(function(){o.videoPaused?o.resumeVideo():o.pauseVideo()}))},playVideo:function(){this.spinnerElement.hide(),this.previewElement.hide(),this.playElement.hide(),this.gifLoaded=!0,this.previewElement.hide(),this.wrapper.append(this.videoElement),this.videoPaused=!1,this.videoElement[0].play(),this.getOption("onPlay").call(this.previewElement)},pauseVideo:function(){this.videoPaused=!0,this.videoElement[0].pause(),this.playElement.show(),this.mouseoverEnabled=!1,this.getOption("onStop").call(this.previewElement)},resumeVideo:function(){this.videoPaused=!1,this.videoElement[0].play(),this.playElement.hide(),this.getOption("onPlay").call(this.previewElement)},enableAbort:function(){var e=this;this.previewElement.click((function(t){e.abortLoading(t)})),this.spinnerElement.click((function(t){e.abortLoading(t)}))},abortLoading:function(e){this.spinnerElement.hide(),this.playElement.show(),e.preventDefault(),e.stopPropagation(),this.gifElement.off("load").on("load",(function(e){e.preventDefault(),e.stopPropagation()})),this.resetEvents(),this.getOption("onStop").call(this.previewElement)},resetEvents:function(){this.previewElement.off("click"),this.previewElement.off("mouseover"),this.playElement.off("click"),this.spinnerElement.off("click"),this.addEvents()},sanitizeURL:function(e){let t=document.createElement("a");t.href=e;return["http:","https:",":","file:"].includes(t.protocol)?t.href:"about:blank"}},e.fn.gifplayer=function(i){return/^(play|stop)$/i.test(i)?this.each((function(){if(i=i.toLowerCase(),e(this).hasClass("gifplayer-ready")){var n=new t(e(this),null);switch(n.options={},n.options=e.extend({},e.fn.gifplayer.defaults,n.options),n.wrapper=e(this).parent(),n.spinnerElement=n.wrapper.find(".spinner"),n.playElement=n.wrapper.find(".play-gif"),n.gifElement=n.wrapper.find(".gp-gif-element"),n.videoElement=n.wrapper.find(".gp-video-element"),n.mode=n.getOption("mode"),i){case"play":n.playElement.trigger("click");break;case"stop":n.playElement.is(":visible")||("gif"==n.mode?n.stopGif():"video"==n.mode&&n.videoElement.trigger("click"))}}})):this.each((function(){i=e.extend({},e.fn.gifplayer.defaults,i),new t(e(this),i).activate()}))},e.fn.gifplayer.defaults={label:"GIF",playOn:"click",mode:"gif",gif:"",mp4:"",webm:"",wait:!1,scope:!1,onPlay:function(){},onStop:function(){},onClick:function(){},onLoad:function(){},onLoadComplete:function(){}},t}));
//# sourceMappingURL=/sm/a8cbe48e983063b6641537b383b651d0aed5ce384ead678ba238833185fa4dac.map