File: //home/madepabj/www/wp-content/plugins/seo-by-rank-math/assets/admin/js/common.js
!function(){"use strict";var e={n:function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},d:function(t,n){for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=jQuery,n=e.n(t),a=wp.i18n;function r(e,t,a){return n().ajax({url:rankMath.ajaxurl,type:a||"POST",dataType:"json",data:n().extend(!0,{action:"rank_math_"+e,security:rankMath.security},t)})}function o(e,t,a,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",i=arguments.length>5&&void 0!==arguments[5]&&arguments[5];t=t||"error",r=r||!1;var c=n()('<div class="notice notice-'+t+" "+o+' is-dismissible"><p>'+e+"</p></div>").hide();i||a.siblings(".notice").remove(),a.after(c),c.slideDown(),n()(document).trigger("wp-updates-notice-added"),n()("html,body").animate({scrollTop:c.offset().top-50},"slow"),r&&setTimeout(function(){c.fadeOut(function(){c.remove()})},r)}var i=lodash,c=wp.hooks;function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function l(){var e,t,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function o(n,a,r,o){var s=a&&a.prototype instanceof c?a:c,l=Object.create(s.prototype);return p(l,"_invoke",function(n,a,r){var o,c,s,l=0,p=r||[],u=!1,d={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,n){return o=t,c=0,s=e,d.n=n,i}};function h(n,a){for(c=n,s=a,t=0;!u&&l&&!r&&t<p.length;t++){var r,o=p[t],h=d.p,v=o[2];n>3?(r=v===a)&&(s=o[(c=o[4])?5:(c=3,3)],o[4]=o[5]=e):o[0]<=h&&((r=n<2&&h<o[1])?(c=0,d.v=a,d.n=o[1]):h<v&&(r=n<3||o[0]>a||a>v)&&(o[4]=n,o[5]=a,d.n=v,c=0))}if(r||n>1)return i;throw u=!0,a}return function(r,p,v){if(l>1)throw TypeError("Generator is already running");for(u&&1===p&&h(p,v),c=p,s=v;(t=c<2?e:s)||!u;){o||(c?c<3?(c>1&&(d.n=-1),h(c,s)):d.n=s:d.v=s);try{if(l=2,o){if(c||(r="next"),t=o[r]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,c<2&&(c=0)}else 1===c&&(t=o.return)&&t.call(o),c<2&&(s=TypeError("The iterator does not provide a '"+r+"' method"),c=1);o=e}else if((t=(u=d.n<0)?s:n.call(a,d))!==i)break}catch(t){o=e,c=1,s=t}finally{l=1}}return{value:t,done:u}}}(n,r,o),!0),l}var i={};function c(){}function s(){}function u(){}t=Object.getPrototypeOf;var d=[][a]?t(t([][a]())):(p(t={},a,function(){return this}),t),h=u.prototype=c.prototype=Object.create(d);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,p(e,r,"GeneratorFunction")),e.prototype=Object.create(h),e}return s.prototype=u,p(h,"constructor",u),p(u,"constructor",s),s.displayName="GeneratorFunction",p(u,r,"GeneratorFunction"),p(h),p(h,r,"Generator"),p(h,a,function(){return this}),p(h,"toString",function(){return"[object Generator]"}),(l=function(){return{w:o,m:v}})()}function p(e,t,n,a){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}p=function(e,t,n,a){function o(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!a,configurable:!a,writable:!a}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},p(e,t,n,a)}function u(e,t,n,a,r,o,i){try{var c=e[o](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(a,r)}function d(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,h(a.key),a)}}function h(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t||"default");if("object"!=s(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==s(t)?t:t+""}var v,f=function(){return e=function e(){var t,n,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=this,a="",(n=h(n="response"))in t?Object.defineProperty(t,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[n]=a},t=[{key:"checkAll",value:function(){var e=this,t=n()("#setting-panel-analytics .cmb2-id-check-all-services:not(.done), #cmb2-metabox-rank-math-wizard .cmb2-id-check-all-services:not(.done)");t.length>0&&"0"===t.val()&&(t.addClass("done"),r("google_check_all_services").done(function(t){e.response=t,e.fillSelect(),e.accordions.removeClass("locked")}))}},{key:"events",value:function(){var e=this;this.saveChanges=!1,this.accountSelect=n()(".site-analytics-account"),this.profileSelect=n()(".site-console-profile"),this.propertySelect=n()(".site-analytics-property"),this.viewSelect=n()(".site-analytics-view"),this.adsenseSelect=n()(".site-adsense-account"),this.accordions=n()(".rank-math-accordion"),this.countryConsole=n()("#site-console-country"),this.countryAnalytics=n()("#site-analytics-country"),this.testConnectionButton=n()(".rank-math-test-connection-google"),n()(".cmb2_select").on("select2:open",function(){document.querySelector(".select2-search__field").focus()}),this.accountSelect.on("change",function(){var t=parseInt(e.accountSelect.val());0!==t?e.fillPropertySelect(t):e.propertySelect.html('<option value="0">Select Property</option>')}),this.profileSelect.on("change",function(){0!==parseInt(e.profileSelect.val())&&document.getElementById("enable-index-status").removeAttribute("disabled")}),n()([".rank-math-wizard-body--analytics .form-footer.rank-math-ui .button-primary",".rank-math_page_rank-math-options-general .form-footer.rank-math-ui .button-primary"].join(", ")).on("click",function(t){e.submitButtonHandler(t)}),this.testConnectionButton.on("click",function(t){t.preventDefault(),e.testConnections(t)}),this.propertySelect.on("change",function(){"create-ga4-property"!==e.propertySelect.val()?(e.response.type=(0,i.get)(e.response.accounts,[e.accountSelect.val(),"properties",e.propertySelect.val(),"type"],{}),"GA4"!==e.response.type&&(e.response.type="GA3",e.response.views=(0,i.get)(e.response.accounts,[e.accountSelect.val(),"properties",e.propertySelect.val(),"profiles"],{})),"GA4"===e.response.type?e.createNewDataStream():e.fillViewSelect()):e.createNewProperty()}),this.viewSelect.on("change",function(e){var t=n()(e.target).find(":selected");t.data("measurement-id")&&(n()("#rank-math-analytics-measurement-id").val(t.data("measurement-id")),n()("#rank-math-analytics-stream-name").val(t.text()))}),n()(".rank-math-disconnect-google").on("click",function(e){e.preventDefault(),confirm(rankMath.confirmDisconnect)&&r("disconnect_google").done(function(){window.location.reload()})})}},{key:"createNewProperty",value:function(){var e=this;confirm((0,a.__)("Are you sure, you want to create a new GA4 Property?","rank-math"))?r("create_ga4_property",{accountID:this.accountSelect.val()},"post").done(function(t){if(t.error)return e.propertySelect.val(e.propertySelect.find("option:first").val()),void alert(t.error);e.propertySelect.append('<option value="'+t.id+'">'+t.name+"</option>"),e.propertySelect.val(t.id),e.createNewDataStream(),e.response.type="GA4"}):this.propertySelect.val(this.propertySelect.find("option:first").val())}},{key:"createNewDataStream",value:function(){var e=this;this.viewSelect.html(""),this.viewSelect.prop("disabled",!0),r("get_ga4_data_streams",{propertyID:this.propertySelect.val()},"post").done(function(t){t.error?console.error(t.error):(e.response.views=t.streams,e.fillViewSelect(),e.viewSelect.trigger("change"))})}},{key:"submitButtonHandler",value:(s=l().m(function e(t){var r,o,i,c,s,p;return l().w(function(e){for(;;)switch(e.n){case 0:if(r=n()(t.target),t.preventDefault(),!r.hasClass("disabled")){e.n=1;break}return e.a(2);case 1:if(n()("#setting-panel-analytics:visible").length&&!n()("#setting-panel-analytics .connect-wrap").length){e.n=2;break}return r.off("click").trigger("click"),e.a(2);case 2:return r.addClass("disabled").val((0,a.__)("Saving…","rank-math")),e.n=3,this.saveConsole();case 3:return o=e.v,e.n=4,this.saveAnalytics();case 4:return i=e.v,e.n=5,this.saveAdsense();case 5:c=e.v,n()(".rank-math-accordion").find(".rank-math-notice").remove(),s="",p="",o.success?i.success?c.success||(s=n()(".rank-math-connect-adsense .rank-math-accordion-content"),p=c.error):(s=n()(".rank-math-connect-analytics .rank-math-accordion-content"),p=i.error):(s=n()(".rank-math-connect-search-console .rank-math-accordion-content"),p=o.error),o.success&&i.success&&c.success?r.off("click").trigger("click"):(s.append('<div class="rank-math-notice notice notice-error"><p>'+p+"</p></div>"),n()("html, body").animate({scrollTop:s.offset().top},2e3),r.removeClass("disabled").val((0,a.__)("Save Changes","rank-math")));case 6:return e.a(2)}},e,this)}),p=function(){var e=this,t=arguments;return new Promise(function(n,a){var r=s.apply(e,t);function o(e){u(r,n,a,o,i,"next",e)}function i(e){u(r,n,a,o,i,"throw",e)}o(void 0)})},function(e){return p.apply(this,arguments)})},{key:"testConnections",value:function(e){e.preventDefault(),(0,c.applyFilters)("rank_math_test_connections",[{class:".rank-math-connect-search-console",canTest:rankMath.isConsoleConnected,action:"check_console_request"},{class:".rank-math-connect-analytics",canTest:rankMath.isAnalyticsConnected,action:"check_analytics_request"}],this).forEach(function(e){if(e.canTest){var t=n()(e.class),o=t.find(".rank-math-accordion-content"),i=t.find(".rank-math-connection-status-wrap");o.find(".rank-math-notice").remove(),i.html('<svg class="rank-math-spinner" viewBox="0 0 100 100" width="16" height="16" xmlns="http://www.w3.org/2000/svg" role="presentation" focusable="false"><circle cx="50" cy="50" r="50" vector-effect="non-scaling-stroke"></circle><path d="m 50 0 a 50 50 0 0 1 50 50" vector-effect="non-scaling-stroke"></path></svg>'),r(e.action,{},"post").done(function(e){e.success?i.html('<span class="rank-math-connection-status rank-math-connection-status-success" title="'+(0,a.__)("Connected","rank-math")+'"></span>'):(i.html('<span class="rank-math-connection-status rank-math-connection-status-error" title="'+(0,a.__)("Some permissions are missing, please reconnect","rank-math")+'"></span>'),o.append('<div class="rank-math-notice rank-math-notice--error"><p>'+e.error+"</p></div>"))})}})}},{key:"saveConsole",value:function(){if(0===parseInt(this.profileSelect.val()))return{success:!0};var e={profile:this.profileSelect.val(),country:this.countryConsole.val(),enableIndexStatus:n()("#enable-index-status").is(":checked")},t=n()("#console_caching_control");return t.length>0&&(e.days=t.val()),r("save_analytic_profile",e,"post").done(function(e){return e})}},{key:"saveAnalytics",value:function(){var e={accountID:this.accountSelect.val(),propertyID:this.propertySelect.val(),viewID:this.viewSelect.val(),country:this.countryAnalytics.val(),installCode:n()("#install-code").is(":checked"),anonymizeIP:n()("#anonymize-ip").is(":checked"),localGAJS:n()("#local-ga-js").is(":checked"),excludeLoggedin:n()("#exclude-loggedin").is(":checked"),measurementID:n()("#rank-math-analytics-measurement-id").val(),streamName:n()("#rank-math-analytics-stream-name").val()};if(0===parseInt(e.accountID)||0===parseInt(e.propertyID))return{success:!0};var t=n()("#console_caching_control");return t.length>0&&(e.days=t.val()),r("save_analytic_options",e,"post").done(function(e){return e})}},{key:"saveAdsense",value:function(){var e={accountID:this.adsenseSelect.val()};return e.accountID?(0,c.applyFilters)("rank_math_save_adsense_account",e):{success:!0}}},{key:"fillSelect",value:function(){var e=this,t=this.response,n=t.inSearchConsole,a=t.isVerified;this.fillProfileSelect(),this.fillAccountSelect(),(0,c.doAction)("rank_math_fill_select",this),n||r("add_site_console").done(function(t){e.response.sites=t.sites,e.fillProfileSelect()}),n&&!a&&r("verify_site_console"),this.saveChanges=!1}},{key:"fillAccountSelect",value:function(){var e=this,t=this.response.accounts;(0,i.map)(t,function(t,n){e.accountSelect.append('<option value="'+n+'">'+t.name+" ("+n+")</option>")}),this.accountSelect.data("selected")?this.accountSelect.val(this.accountSelect.data("selected")):(this.accountSelect.prop("disabled",!1),this.countryAnalytics.prop("disabled",!1),this.accountSelect.select2(),this.countryAnalytics.select2()),this.accountSelect.trigger("change")}},{key:"fillPropertySelect",value:function(e){var t=this,n=this.response,r=n.accounts,o=n.homeUrl,c=((null==r?void 0:r[e])||{}).properties;this.propertySelect.html('<option value="0">Select Property</option>'),this.propertySelect.append('<option value="create-ga4-property">'+(0,a.__)("Create new GA4 Property","rank-math")+"</option>"),(0,i.map)(c,function(e){var n=e.url===o?' selected="selected"':"";"GA4"===e.type&&t.propertySelect.append("<option ".concat(n,' value="').concat(e.id,'">').concat(e.name," (").concat(e.id,")</option>"))}),this.propertySelect.data("selected")?this.propertySelect.val(this.propertySelect.data("selected")):(this.propertySelect.prop("disabled",!1),this.propertySelect.select2()),this.propertySelect.trigger("change")}},{key:"fillProfileSelect",value:function(){var e=this,t=this.response,n=t.sites,a=t.homeUrl,r=!1;(0,i.map)(n,function(t,n){r=n===a?' selected="selected"':"",e.profileSelect.append("<option"+r+' value="'+n+'">'+t+"</option>")}),this.profileSelect.data("selected")&&this.profileSelect.closest(".rank-math-accordion").addClass("connected"),this.profileSelect.prop("disabled",!1),this.countryConsole.prop("disabled",!1),this.profileSelect.select2(),this.countryConsole.select2()}},{key:"fillViewSelect",value:function(){var e=this,t=this.response,n=t.views,r="GA4"===t.type?(0,a.__)("Data Stream","rank-math"):(0,a.__)("View","rank-math");this.viewSelect.prev("label").text(r),(0,i.map)(n,function(t){var n=(0,i.isUndefined)(t.measurementId)?"":t.measurementId;e.viewSelect.append('<option value="'+t.id+'" data-measurement-id="'+n+'">'+t.name+"</option>")}),this.viewSelect.data("selected")&&this.viewSelect.val(this.viewSelect.data("selected")),this.viewSelect.prop("disabled",!1),this.viewSelect.select2()}}],t&&d(e.prototype,t),o&&d(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,o,s,p}(),m=new f;v=n(),String.prototype.format||(String.prototype.format=function(){var e=arguments;return this.replace(/{(\d+)}/g,function(t,n){return void 0!==e[n]?e[n]:t})}),String.prototype.trimRight=function(e){return void 0===e&&(e="s"),this.replace(new RegExp("["+e+"]+$"),"")},v(function(){window.rankMathAdmin={init:function(){this.misc(),this.tabs(),this.dependencyManager(),-1!==Object.values(window.rankMath.modules).indexOf("analytics")&&(m.events(),m.checkAll())},misc:function(){void 0!==n().fn.select2&&v("[data-s2]").select2(),v(".cmb-group-text-only,.cmb-group-fix-me").each(function(){var e=v(this),t=e.find(".cmb-repeatable-group"),n=t.find("> .cmb-row:eq(0) > .cmb-th");e.prepend('<div class="cmb-th"><label>'+n.find("h2").text()+"</label></div>"),t.find(".cmb-add-row").append('<span class="cmb2-metabox-description">'+n.find("p").text()+"</span>"),n.parent().remove()}),v(".rank-math-collapsible-trigger").on("click",function(e){e.preventDefault();var t=v(this),n=v("#"+t.data("target"));t.toggleClass("open"),n.toggleClass("open")});var e=v("#rank_math_rich_snippet"),t=e.find("option[value=review]"),a=e.val();t&&(t.prop("disabled",!0),"review"===a&&v(".cmb2-id-rank-math-review-schema-notice").removeClass("hidden"),e.on("change",function(){null!==e.val()&&"review"!==e.val()&&v(".cmb2-id-rank-math-review-schema-notice").addClass("hidden")}))},searchConsole1:function(){var e=v(".cmb2-id-console-authorization-code"),t=v("#console_authorization_code"),n=v("#gsc-dp-info"),i=v("#console_profile"),c=i.parent().find(".rank-math-refresh"),s=t.parent(),l=v("body").hasClass("rank-math-wizard-body--analytics")?v("> p:first-of-type",".cmb-form"):v("h1",".rank-math-wrap-settings");s.on("click",".rank-math-deauthorize-account",function(n){n.preventDefault();var s=v(this);if(s.prop("disabled",!0),t.data("authorized"))return r("search_console_deauthentication").always(function(){s.prop("disabled",!1)}).done(function(){t.val(""),t.show(),t.data("authorized",!1),e.removeClass("authorized").addClass("unauthorized"),s.html((0,a.__)("Authorize","rank-math")),i.prop("disabled",!0),c.prop("disabled",!0)}),!1;t.addClass("input-loading"),r("search_console_authentication",{code:t.val()}).always(function(){s.prop("disabled",!1),t.removeClass("input-loading")}).done(function(n){n&&!n.success&&o(n.error,"error",l),n&&n.success&&(t.hide(),t.data("authorized",!0),s.html("De-authorize Account"),c.trigger("click"),i.removeAttr("disabled"),e.removeClass("unauthorized authorizing").addClass("authorized"))})}),i.on("change",function(){null!==i.val()&&0===i.val().indexOf("sc-domain:")?n.removeClass("hidden"):n.addClass("hidden")}).change(),c.on("click",function(e){e.preventDefault(),c.prop("disabled",!0),i.addClass("input-loading"),r("search_console_get_profiles").always(function(){c.prop("disabled",!1),v(".console-cache-update-manually").prop("disabled",!1),i.removeClass("input-loading")}).done(function(e){if(e&&!e.success&&o(e.error,"error",l),e&&e.success){var t=e.selected||i.val();i.html(""),v.each(e.profiles,function(e,t){i.append('<option value="'+e+'">'+t+"</option>")}),i.val(t||Object.keys(e.profiles)[0]),c.removeClass("hidden")}})})},dependencyManager:function(){var e=this,t=v(".cmb-form, .rank-math-metabox-wrap");v(".cmb-repeat-group-wrap",t).each(function(){var e=v(this),t=e.next(".rank-math-cmb-dependency.hidden");t.length&&e.find("> .cmb-td").append(t)}),v(".rank-math-cmb-dependency",t).each(function(){e.loopDependencies(v(this))}),v("input, select",t).on("change",function(){var t=v(this).attr("name");v('span[data-field="'+t+'"]').each(function(){e.loopDependencies(v(this).closest(".rank-math-cmb-dependency"))})})},checkDependency:function(e,t,n){return"string"==typeof t&&t.includes(",")&&"="===n?t.includes(e):"string"==typeof t&&t.includes(",")&&"!="===n?!t.includes(e):"="===n&&e===t||"=="===n&&e===t||">="===n&&e>=t||"<="===n&&e<=t||">"===n&&e>t||"<"===n&&e<t||"!="===n&&e!==t},loopDependencies:function(e){var t=this,n=e.data("relation"),a=null;e.find("span").each(function(){var e=v(this),r=v("[name='"+e.data("field")+"']"),o=r.val();r.is(":radio")&&(o=r.filter(":checked").val()),r.is(":checkbox")&&(o=r.filter(":checked").val());var i=t.checkDependency(o,e.data("value"),e.data("comparison"));if("or"===n&&i)return a=!0,!1;"and"===n&&(a=(null===a||a)&&i)});var r=e.closest(".rank-math-cmb-group");r.length||(r=e.closest(".cmb-row")),a?r.slideDown(300):r.hide()},tabs:function(){var e,t;t=e||".rank-math-box-tabs",n()(t).children().on("click",function(e){e.preventDefault();var t=n()(this),a=t.attr("href").substr(1);t.addClass("active-tab").siblings().removeClass("active-tab"),n()("#"+a).addClass("active-tab").siblings().removeClass("active-tab")});var a=v(".rank-math-tabs-navigation");a.length&&a.each(function(){var e=v(this),t=e.closest(".rank-math-tabs"),n=v(">a",e),r=v(">.rank-math-tabs-content>.rank-math-tab",t),o=e.data("active-class")||"active",i=e.hasClass("before-header");n.on("click",function(){var e=v(this),a=v(e.attr("href"));if(n.removeClass(o),r.hide(),i){var c=a.find(".cmb-type-title.tab-header").clone();c.addClass("before-header-title"),v(".before-header-title").remove(),t.prepend(c)}return e.addClass(o),a.show(),!1});var c=window.location.hash||window.localStorage.getItem(t.attr("id"));null===c?n.eq(0).trigger("click"):(c=v('a[href="'+c+'"]',e)).length?c.trigger("click"):n.eq(0).trigger("click"),a.next().css("min-height",e.outerHeight())})},variableInserter:function(e){var t=v("input[type=text], textarea",".rank-math-supports-variables");if(e=void 0===e||e,t.length){var n,r=this,o=v("body");if(t.attr("autocomplete","off"),t.wrap('<div class="rank-math-variables-wrap"/>'),v(".rank-math-variables-wrap").append('<a href="#" class="rank-math-variables-button button button-secondary"><span class="dashicons dashicons-arrow-down-alt2"></span></a>'),e){var i=rankMath.capitalizeTitle?"capitalize":"";v(".rank-math-variables-wrap").after('<div class="rank-math-variables-preview '+i+'" data-title="'+(0,a.__)("Example","rank-math")+'"/>'),t.on("rank_math_variable_change input",function(e){var t=v(e.currentTarget),n=r.replaceVariables(t.val());60<n.length&&0<=t.attr("name").indexOf("title")?n=n.substring(0,60)+"...":160<n.length&&0<=t.attr("name").indexOf("description")&&(n=n.substring(0,160)+"...");var a=v("<textarea/>").html(n).val();t.parent().next(".rank-math-variables-preview").text(a)}),t.trigger("rank_math_variable_change")}var c=v("<ul/>"),s=v('<div class="rank-math-variables-dropdown"><input type="text" placeholder="'+(0,a.__)("Search …","rank-math")+'"></div>');v.each(rankMath.variables,function(){c.append('<li data-var="%'+this.variable+'%" data-example="'+this.example+'"><strong>'+this.name+"</strong><span>"+this.description+"</span></li>")}),s.append(c),v(".rank-math-variables-wrap:eq(0)").append(s);var l=v(".rank-math-variables-button, .rank-math-variables-button *, .rank-math-variables-dropdown, .rank-math-variables-dropdown *");o.on("click",function(e){v(e.target).is(l)||h()});var p=s.find("input"),u=s.find("li");o.on("click",".rank-math-variables-button",function(e){e.preventDefault();var t=v(this);t.after(s),u.show(),void 0!==(n=t.prev().data("exclude-variables"))&&(n=n.split(","),d()),s.show(),p.val("").focus()}),s.on("click","li",function(e){e.preventDefault();var t=v(this),n=t.closest(".rank-math-variables-wrap").find("input,textarea");n.val(v.trim(n.val())+" "+t.data("var")),n.trigger("rank_math_variable_change").trigger("input"),h()}),s.on("keyup","input",function(e){e.preventDefault();var t=v(this).val().toLowerCase();if(2>t.length)return u.show(),void d();u.hide().each(function(){var e=v(this);-1!==e.text().toLowerCase().indexOf(t)&&e.show()}),d()})}function d(){void 0!==n&&n.forEach(function(e){s.find('[data-var="%'+e+'%"]').hide()})}function h(){n=void 0,s.hide()}},replaceVariables:function(e){return v.each(rankMath.variables,function(t){if(!this.example)return!0;var n=new RegExp("\\([a-z]+\\)","g");t=t.replace(n,"\\(.*?\\)"),e=e.replace(new RegExp("%+"+t+"%+","g"),this.example)}),e}},window.rankMathAdmin.init()})}();