/* * # Fomantic UI - 2.9.2 * https://github.com/fomantic/Fomantic-UI * https://fomantic-ui.com/ * * Copyright 2023 Contributors * Released under the MIT license * https://opensource.org/licenses/MIT * */ !function(E,e){"use strict";e=void 0!==e&&e.Math===Math?e:globalThis,E.fn.embed=function(h){var b,v=E(this),g=v.selector||"",y=Date.now(),w=[],P=h,C="string"==typeof P,D=[].slice.call(arguments,1);return v.each(function(){var t=E.isPlainObject(h)?E.extend(!0,{},E.fn.embed.settings,h):E.extend({},E.fn.embed.settings),e=t.selector,o=t.className,r=t.sources,d=t.error,a=t.metadata,n=t.namespace,i=t.templates,c="."+n,l="module-"+n,u=E(this),s=(u.find(e.placeholder),u.find(e.icon),u.find(e.embed)),m=this,p=u.data(l),f={initialize:function(){f.debug("Initializing embed"),f.determine.autoplay(),f.create(),f.bind.events(),f.instantiate()},instantiate:function(){f.verbose("Storing instance of module",f),p=f,u.data(l,f)},destroy:function(){f.verbose("Destroying previous instance of embed"),f.reset(),u.removeData(l).off(c)},refresh:function(){f.verbose("Refreshing selector cache"),u.find(e.placeholder),u.find(e.icon),s=u.find(e.embed)},bind:{events:function(){f.has.placeholder()&&(f.debug("Adding placeholder events"),u.on("click"+c,e.placeholder,f.createAndShow).on("click"+c,e.icon,f.createAndShow))}},create:function(){f.get.placeholder()?f.createPlaceholder():f.createAndShow()},createPlaceholder:function(e){var o=f.get.icon();e=e||f.get.placeholder(),u.html(i.placeholder(e,o)),f.debug("Creating placeholder for embed",e,o)},createEmbed:function(e){f.refresh(),e=e||f.get.url(),s=E("
").addClass(o.embed).html(f.generate.embed(e)).appendTo(u),t.onCreate.call(m,e),f.debug("Creating embed object",s)},changeEmbed:function(e){s.html(f.generate.embed(e))},createAndShow:function(){f.createEmbed(),f.show()},change:function(e,o,n){f.debug("Changing video to ",e,o,n),u.data(a.source,e).data(a.id,o),n?u.data(a.url,n):u.removeData(a.url),f.has.embed()?f.changeEmbed():f.create()},reset:function(){f.debug("Clearing embed and showing placeholder"),f.remove.data(),f.remove.active(),f.remove.embed(),f.showPlaceholder(),t.onReset.call(m)},show:function(){f.debug("Showing embed"),f.set.active(),t.onDisplay.call(m)},hide:function(){f.debug("Hiding embed"),f.showPlaceholder()},showPlaceholder:function(){f.debug("Showing placeholder image"),f.remove.active(),t.onPlaceholderDisplay.call(m)},get:{id:function(){return t.id||u.data(a.id)},placeholder:function(){return t.placeholder||u.data(a.placeholder)},icon:function(){return t.icon||(void 0!==u.data(a.icon)?u.data(a.icon):f.determine.icon())},source:function(e){return t.source||(void 0!==u.data(a.source)?u.data(a.source):f.determine.source())},type:function(){var e=f.get.source();return void 0!==r[e]&&r[e].type},url:function(){return t.url||(void 0!==u.data(a.url)?u.data(a.url):f.determine.url())}},determine:{autoplay:function(){f.should.autoplay()&&(t.autoplay=!0)},source:function(n){var t=!1;return(n=n||f.get.url())&&E.each(r,function(e,o){if(-1!==n.search(o.domain))return t=e,!1}),t},icon:function(){var e=f.get.source();return void 0!==r[e]&&r[e].icon},url:function(){var e=t.id||u.data(a.id),o=t.source||u.data(a.source),o=void 0!==r[o]&&r[o].url.replace("{id}",e);return o&&u.data(a.url,o),o}},set:{active:function(){u.addClass(o.active)}},remove:{data:function(){u.removeData(a.id).removeData(a.icon).removeData(a.placeholder).removeData(a.source).removeData(a.url)},active:function(){u.removeClass(o.active)},embed:function(){s.empty()}},encode:{parameters:function(e){var o,n=[];for(o in e)n.push(encodeURIComponent(o)+"="+encodeURIComponent(e[o]));return n.join("&")}},generate:{embed:function(e){f.debug("Generating embed html");var o,n=f.get.source();return(e=f.get.url(e))?(n=f.generate.parameters(n),o=i.iframe(e,n)):f.error(d.noURL,u),o},parameters:function(e,o){e=r[e]&&void 0!==r[e].parameters?r[e].parameters(t):{};return(o=o||t.parameters)&&(e=E.extend({},e,o)),e=t.onEmbed(e),f.encode.parameters(e)}},has:{embed:function(){return 0'},placeholder:function(e,o){var n="",t=E.fn.embed.settings.templates.deQuote;return o&&(n+=''),e&&(n+=''),n}},api:!1,onPause:function(){},onPlay:function(){},onStop:function(){}}}(jQuery,window,document);