/* SCEditor v3.1.1 | (C) 2017, Sam Clarke | sceditor.com/license */

!function(a,n){"use strict";var c=n.dom,d=/(^|\s)(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/watch\?v=)([^"&?\/ ]{11})(?:\&[\&_\?0-9a-z\#]+)?(\s|$)/i;function l(e){return'<iframe width="560" height="315" frameborder="0" src="https://www.youtube-nocookie.com/embed/'+e+'" data-youtube-id="'+e+'" allowfullscreen></iframe>'}n.plugins.autoyoutube=function(){this.signalPasteRaw=function(e){var t;c.closest(this.currentNode(),"code")||(e.html||e.text)&&((t=a.createElement("div")).innerHTML=e.html||n.escapeEntities(e.text),function e(t,n){var r,i,o=t.firstChild,s=t.textContent||"",u=(s=n?s.trim():s).match(d);if(s===s.trim()&&u&&u[0].length===s.length)return c.removeAttr(t,"style"),c.removeAttr(t,"class"),void(t.innerHTML=l(u[2]));for(;o;)3===o.nodeType?(r=o.nodeValue,i=o.parentNode,(u=r.match(d))&&(i.insertBefore(a.createTextNode(r.substr(0,u.index)+u[1]),o),i.insertBefore(c.parseHTML(l(u[2])),o),o.nodeValue=u[3]+r.substr(u.index+u[0].length))):c.is(o,"code")||e(o),o=o.nextSibling}(t,!0),e.html=t.innerHTML)}}}(document,sceditor);