'use strict';(function(e,d,m){let h="";const l=[/\x3c!--themify_builder_static--\x3e([\s\S]*?)\x3c!--\/themify_builder_static--\x3e/gi,/&lt;!--themify_builder_static--&gt;([\s\S]*?)&lt;!--\/themify_builder_static--&gt;/gi,/&amp;lt;!--themify_builder_static--&amp;gt;([\s\S]*?)&amp;lt;!--\/themify_builder_static--&amp;gt;/gi],f=themifyBuilder.short_badge?"excerpt":"content";d.mce.views.register("tb_static_badge",{template:d.media.template("tb-static-badge"),bindNode(a,b){e(b).on("click",".tb_mce_view_frontend_btn",
this.goToFront).on("click",".tb_mce_view_backend_btn",this.goToBack)},getContent(){return this.template({})},match(a){if(a=d.mce.views._tb_static_content.isMatch(a))return{index:a.index,content:a[0],options:{}}},View:{className:"tb_static_badge",template:d.media.template("tb-static-badge"),getHtml:function(){return this.template({})}},edit(a){this.goToFront()},goToFront(){e("#tb_switch_frontend").trigger("click")},goToBack(){tb_app._backendBuilderFocus()},contentPlaceholder(a){h=h||a;return"\x3c!--themify_builder_static--\x3e\x3c!--/themify_builder_static--\x3e"+
(59<a.length?" ".repeat(a.length-59):"")}});d.mce.views._tb_static_content={setContent(a,b){b&&=b.trim();"undefined"!==typeof tinyMCE&&tinyMCE.activeEditor&&tinyMCE.activeEditor.id===f?tinyMCE.activeEditor.hidden?b!==e("#"+f).val().trim()&&e("#"+f).val(b):b!==a.getContent().trim()&&a.setContent(b):b!==a.val().trim()&&a.val(b)},isMatch(a){return l[0].exec(a)||l[1].exec(a)||l[2].exec(a)}};e(document).on("tinymce-editor-init",function(a,b){if(b.wp&&b.wp._createToolbar){const c=b.wp._createToolbar(["wp_view_edit"]);
if(c)b.on("wptoolbar",function(g){b.dom.hasClass(g.element,"wpview")&&"tb_static_badge"===b.dom.getAttrib(g.element,"data-wpview-type")&&(g.toolbar=c)})}if(b.id!==f){a=b.getContent();let c=d.mce.views._tb_static_content.isMatch(a);m.isNull(c)||b.setContent(a.replace(c[0],""))}else b.setContent(d.mce.views.setMarkers(b.getContent()));b.on("beforesetcontent",function(c){c.content=d.mce.views.setMarkers(c.content)})});e("body").on("themify_builder_save_data",function(a,b){if(themifyBuilder.is_gutenberg_editor||
!b.data||!b.data.static_content)return!0;let c,g;if("undefined"!==typeof tinyMCE&&tinyMCE.activeEditor&&tinyMCE.activeEditor.id===f)a=tinyMCE.activeEditor,c=!1===tinyMCE.activeEditor.hidden?tinyMCE.activeEditor.getContent():tinymce.DOM.get(f).value;else{a=e("#"+f);if(!a.length)return;c=a.val()}g=d.mce.views._tb_static_content.isMatch(c);m.isNull(g)?d.mce.views._tb_static_content.setContent(a,c+b.data.static_content):d.mce.views._tb_static_content.setContent(a,c.replace(g[0],b.data.static_content))});
const k={timeout:null,init(){e(window).on("YoastSEO:ready",function(){k.load()})},load(){themifyBuilder.is_gutenberg_editor&&(h=d.data.select("core/editor").getCurrentPost().builder_content);YoastSEO.app.registerPlugin("TBuilderReader",{status:"loading"});YoastSEO.app.pluginReady("TBuilderReader");YoastSEO.app.registerModification(f,k.readContent,"TBuilderReader",5);k.update()},readContent(a){h&&(a=themifyBuilder.is_gutenberg_editor?a+(" "+h):a.replace("\x3c!--themify_builder_static--\x3e\x3c!--/themify_builder_static--\x3e",
h).replace(/(\r\n|\n|\r)/gm,""));return a},update(){this.timeout&&clearTimeout(this.timeout);this.timeout=setTimeout(function(){YoastSEO.app.refresh()},250)}};k.init()})(jQuery,wp,_);
