"+h(e.defaultattr)+""+n),""+n+"
"}},code:{tags:{code:null},isInline:!1,allowedChildren:["#","#newline"],format:"[code]{0}[/code]",html:"{0}
"},left:{styles:{"text-align":["left","-webkit-left","-moz-left","-khtml-left"]},isInline:!1,format:"[left]{0}[/left]",html:'{0}
'},center:{styles:{"text-align":["center","-webkit-center","-moz-center","-khtml-center"]},isInline:!1,format:"[center]{0}[/center]",html:'{0}
'},right:{styles:{"text-align":["right","-webkit-right","-moz-right","-khtml-right"]},isInline:!1,format:"[right]{0}[/right]",html:'{0}
'},justify:{styles:{"text-align":["justify","-webkit-justify","-moz-justify","-khtml-justify"]},isInline:!1,format:"[justify]{0}[/justify]",html:'{0}
'},youtube:{allowsEmpty:!0,tags:{iframe:{"data-youtube-id":null}},format:function(t,e){return(t=g(t,"data-youtube-id"))?"[youtube]"+t+"[/youtube]":e},html:''},rtl:{styles:{direction:["rtl"]},isInline:!1,format:"[rtl]{0}[/rtl]",html:'{0}
'},ltr:{styles:{direction:["ltr"]},isInline:!1,format:"[ltr]{0}[/ltr]",html:'{0}
'},ignore:{}};function w(t,r){return t.replace(/\{([^}]+)\}/g,function(t,e){var n=!0;return"!"===e.charAt(0)&&(n=!1,e=e.substring(1)),"0"===e&&(n=!1),void 0===r[e]?t:n?h(r[e],!0):r[e]})}function B(t){return"function"==typeof t}function E(t){return t?t.replace(/\\(.)/g,"$1").replace(/^(["'])(.*?)\1$/,"$2"):t}function C(t){var n=arguments;return t.replace(/\{(\d+)\}/g,function(t,e){return void 0!==n[e-0+1]?n[e-0+1]:"{"+e+"}"})}var I="open",T="content",S="newline",L="close";function u(t,e,n,r,i,l){var o=this;o.type=t,o.name=e,o.val=n,o.attrs=r||{},o.children=i||[],o.closing=l||null}function q(t){var m=this;function o(t,e){var n,r,i;return t===I&&(n=e.match(/\[([^\]\s=]+)(?:([^\]]+))?\]/))&&(i=l(n[1]),n[2]&&(n[2]=n[2].trim())&&(r=function(t){var e,n=/([^\s=]+)=(?:(?:(["'])((?:\\\2|[^\2])*?)\2)|((?:.(?!\s\S+=))*.))/g,r={};if("="===t.charAt(0)&&t.indexOf("=",1)<0)r.defaultattr=E(t.substr(1));else for("="===t.charAt(0)&&(t="defaultattr"+t);e=n.exec(t);)r[l(e[1])]=E(e[3])||e[4];return r}(n[2]))),t===L&&(n=e.match(/\[\/([^\[\]]+)\]/))&&(i=l(n[1])),t===S&&(i="#newline"),i&&(t!==I&&t!==L||k[i])||(t=T,i="#"),new u(t,i,e,r)}function d(t,e,n){for(var r=n.length;r--;)if(n[r].type===e&&n[r].name===t)return!0;return!1}function p(t,e){var n=(t?k[t.name]:{}).allowedChildren;return!m.opts.fixInvalidChildren||!n||-1"),B(i.html)?o=i.html.call(m,r,r.attrs,l):(r.attrs[0]=l,o=w(i.html,r.attrs))):o=r.val+l+(r.closing?r.closing.val:"");else{if(r.type===S){if(!n){f.push("
");continue}s||f.push(""),b||f.push("
"),e.length||f.push("
"),f.push("
\n"),s=!1;continue}a=n,o=h(r.val,!0)}a&&!s?(f.push(""),s=!0):!a&&s&&(f.push("
\n"),s=!1),f.push(o)}s&&f.push("\n");return f.join("")}(m.parse(t,e),!0)},m.toBBCode=function(t,e){return function t(e){var n,r,i,l,o,a,s,u,c,f,h=[];for(;0\n/g,""),(i=a.firstChild)&&v(i,"div")&&o(i,!0),(i=a.lastChild)&&v(i,"div")&&o(i),a.innerHTML):s}function e(t,e,n,r){var i,l,o=(n=n||document).createElement("div"),a=n.createElement("div"),s=new q(u.opts.parserOptions);for(a.innerHTML=e,p(o,"visibility","hidden"),o.appendChild(a),n.body.appendChild(o),t&&(o.insertBefore(n.createTextNode("#"),o.firstChild),o.appendChild(n.createTextNode("#"))),r&&p(a,"whiteSpace",p(r,"whiteSpace")),l=a.getElementsByClassName("sceditor-ignore");l.length;)l[0].parentNode.removeChild(l[0]);return m.removeWhiteSpace(o),i=d(a),n.body.removeChild(o),i=s.toBBCode(i,!0),u.opts.bbcodeTrim&&(i=i.trim()),i}u.init=function(){u.opts=this.opts,u.elementToBbcode=d,s(k,function(n){var r,t=k[n].tags,e=k[n].styles;t&&s(t,function(t,e){r=!1===k[n].isInline,o[t]=o[t]||{},o[t][r]=o[t][r]||{},o[t][r][n]=e}),e&&s(e,function(t,e){r=!1===k[n].isInline,a[r]=a[r]||{},a[r][t]=a[r][t]||{},a[r][t][n]=e})}),this.commands=n(!0,{},i,this.commands),this.toBBCode=u.toSource,this.fromBBCode=u.toHtml},u.toHtml=t.bind(null,!1),u.fragmentToHtml=t.bind(null,!0),u.toSource=e.bind(null,!1),u.fragmentToSource=e.bind(null,!0)}u.prototype={clone:function(){var t=this;return new u(t.type,t.name,t.val,n({},t.attrs),[],t.closing?t.closing.clone():null)},splitAt:function(t){var e,n=this.clone(),r=this.children.indexOf(t);return-1