var nytroseo=function(e){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function t(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}function g(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||d(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function s(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=d(e))){var t=0,n=function(){};return{s:n,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a,i=!0,r=!1;return{s:function(){o=e[Symbol.iterator]()},n:function(){var e=o.next();return i=e.done,e},e:function(e){r=!0,a=e},f:function(){try{i||null==o.return||o.return()}finally{if(r)throw a}}}}function r(e){null!==e.data.title&&void 0!==e.data.title&&e.document&&e.document.title!==e.data.title&&""!==e.data.title&&e.document.title!=e.data.title&&(e.data.titleUpdatedCount?e.data.titleUpdatedCount+=1:e.data.titleUpdatedCount=1,e.data.titleUpdatedCount<=20&&(e.document.title=e.data.title,console.debug("nytroseo : title optimized : "+e.data.title)))}function l(e){try{if(e.data.descriptionUpdatedCount?e.data.descriptionUpdatedCount+=1:e.data.descriptionUpdatedCount=1,e.data.descriptionUpdatedCount<=20)(function(e){if(null===e.data.description||void 0===e.data.description||""===e.data.description)return!1;var t=!1,n=e.document.getElementsByTagName("meta");if(1<(n=Array.from(n).filter(function(e){return"description"===e.name})).length)for(var o=n.length-1;0<o;o--)n[o].remove(),t=!0;if(n[0])n[0].content!=e.data.description&&(n[0].content=e.data.description,t=!0);else{t=!0;var a=e.document.createElement("meta");a.setAttribute("name","description"),a.content=e.data.description,e.document.getElementsByTagName("head")[0].appendChild(a)}return t})(e)&&console.debug("nytroseo : description optimized : "+e.data.description)}catch(e){console.warn(e,"nytroseo : description optimization failed")}}function u(e,t){if(t&&t.length){var n,o=s(t);try{for(o.s();!(n=o.n()).done;){var a=n.value;if(!e.optimizedLinks.has(a))try{var i=a.getAttribute("title"),r=c(e,a),d=r&&r.length?r:e.aggregateByComma([i,e.data.title]);a.setAttribute("title",d),console.debug("nytroseo : link optimized : "+d),e.optimizedLinks.set(a,void 0)}catch(e){console.warn(e,"nytroseo : link optimization failed")}}}catch(e){o.e(e)}finally{o.f()}}}function c(e,t){if(e&&e.data.titlesPerPageUrl&&t&&t.hostname&&(!e.hostname||t.hostname==e.hostname)){var n=t.pathname?t.pathname:"/";if(n&&n.length){if(t.search){var o=n+(t.search?t.search:""),a=e.data.titlesPerPageUrl[o];if(a)return a}var i=e.data.titlesPerPageUrl[n];return i||void 0}}}function m(r,e){if(e&&e.length){var t=r.data.maxKeywordsInAlts;r.optimizedImages||(r.optimizedImages=new Map);var d=!(!r.data.keywords||!r.data.keywords.length),s=d?function(e,t,n){var o=[];if(!e||!e.length)return o;t<=0&&(t=e.length);return function a(i,r,d,s,l,u,c){if(10<=c)return;if(d.length>=l)return;if(u===s)return void d.push(i);if(r.length<=0)return void d.push(i);r.forEach(function(e,t){var n=g(r);n.splice(t,1);var o=0===i.length?[e]:i.concat(e);a(o,n,d,s,l,u+1,c+1)})}([],e,o,t,n,0,1),o.map(function(e){return e.join(", ")})}(r.data.keywords,t,e.length):[r.data.title];g(e).forEach(function(e,t){if(!r.optimizedImages.has(e))try{var n=e.getAttribute("alt");if(n&&!d)return r.optimizedImages.set(e,void 0),void console.debug("nytroseo : image skip because no keywords and alt exists");var o=s[t%s.length],a=o&&o.length?o:"",i=n?n+", "+a:a;e.setAttribute("alt",i),console.debug("nytroseo : image optimized : "+i),r.optimizedImages.set(e,void 0)}catch(e){console.warn(e,"nytroseo : image optimization failed")}})}else console.debug("nytroseo : no images detected")}function f(e){if(!e.IsNoIndexOptimized){try{!function(e){var t=e.document.getElementsByTagName("meta");if(1<(t=Array.from(t).filter(function(e){return"robots"===e.name})).length)for(var n=t.length-1;0<n;n--)t[n].remove();if(t[0])t[0].content="noindex";else{var o=e.document.createElement("meta");o.setAttribute("name","robots"),o.content="noindex",e.document.getElementsByTagName("head")[0].appendChild(o)}}(e),console.debug("nytroseo : no index added")}catch(e){console.warn(e,"nytroseo : no index failed")}e.IsNoIndexOptimized=!0}}function y(e){if(!e.isFooterOptimized){e.isFooterOptimized=!0;var t=e.data.settings;t&&t.useKeywordsInFooter&&(function(e,t){if(e.IsFooterStylesheetAdded)return;try{var n=e.document.createElement("style");e.document.head.appendChild(n),n.sheet&&n.sheet.insertRule(function(e){var t="12px",n="#736F6E";e&&(e.footerColor&&(n=e.footerColor),e.footerTextSize&&(t=e.footerTextSize+"px"));return".SG_KEYWORDS{\n padding-top:18px;\n font-family:arial;\n text-align:center;\n clear:both;\n font-size:".concat(t,";\n color:").concat(n,";\n }")}(t)),e.IsFooterStylesheetAdded=!0,console.debug("nytroseo : footer stylesheet added")}catch(e){console.warn(e,"nytroseo : footer stylesheet failed")}}(e,t),function(e){if(e.IsFooterElementAdded)return;try{var t=e.document.createElement("div");t.innerHTML=e.getKeywordsSeparatedByComma(),t.setAttribute("class","SG_KEYWORDS"),e.document.body.appendChild(t);var n=e.document.createElement("div");n.setAttribute("style","text-align:center;padding-bottom: 18px;"),n.innerHTML='<a href="https://nytroseo.com" class="SG_KEYWORDS" target="_Blank" title="SEO Automation process is powered by Nytro Systems automated SEO solution">SEO Automation powered by Nytro Systems</a>',e.document.body.appendChild(n),e.IsFooterElementAdded=!0,console.debug("nytroseo : footer element added")}catch(e){console.warn(e,"nytroseo : footer element failed")}}(e)),function(e){if(e.IsFooterTrackingImageAdded)return;try{var t=e.document.createElement("img");t.setAttribute("id","SG_GOT_REQUEST_STATS"),t.setAttribute("sg_keywords",""),t.setAttribute("border","0"),t.setAttribute("alt",""),t.setAttribute("height","1"),t.setAttribute("width","1"),e.document.body.appendChild(t),e.IsFooterTrackingImageAdded=!0,console.debug("nytroseo : footer traking image added")}catch(e){console.warn(e,"nytroseo : footer traking image failed")}}(e)}}var h=function(){function e(){o(this,e)}return t(e,null,[{key:"Version",get:function(){return"v1.1.3"}},{key:"BuildDate",get:function(){return"05-12-2023"}},{key:"PredefinedSiteId",get:function(){return"e0b30f23-b7a8-4aa8-a05a-a6233d731fd4"}},{key:"ContentURL",get:function(){return"https://content.nytroseo.com/submit/r.jpg"}},{key:"DefaultDataEndpoint",get:function(){return"https://plugin.nytsys.com/api/pluginData"}},{key:"LocalStorageKey",get:function(){return"nsPlugin.data"}}]),e}();var n=function(){function n(e){o(this,n);var t=this;console.debug("nytroseo : 1 : constructor"),t.bindFunctions(["run","onDataLoaded","load_nsPluginData_onlyOnce","aggregateTextWithKeywordsByComma","aggregateTextWithTitleByComma","getKeywordsSeparatedByComma","aggregateByComma","getQueryParameterByName","handleMetaDescriptionChange","handleMetaTitleChange","handleNewImages","handleNewLinks"]),t.IsRunAlreadyWithContentLoaded=!1,t.IsRunAlreadyWithoutContentLoaded=!1,t.LoadedDataResponse=void 0,t.isRenderTron=null!=t.getQueryParameterByName("isRenderTron"),t.isNsPluginDisabled=null!=t.getQueryParameterByName("isNsPluginDisabled"),t.dataEndpoint=e.dataEndpoint,t.debugPageId=e.debugPageId,t.siteId=e.siteId,t.document=e.document||window.document,t.fullPageUrl=e.fullPageUrl||(this.document&&this.document.location?this.document.location.href:""),t.data=e.data||null,t.fullPageUrl=t.fullPageUrl.includes("/render/http")?t.fullPageUrl.substring(t.fullPageUrl.indexOf("/render/")+"/render/".length):t.fullPageUrl,t.hostname=this.document&&this.document.location&&this.document.location.hostname?this.document.location.hostname:void 0}return t(n,[{key:"run",value:function(e){var t=this;if(t.isNsPluginDisabled)return console.log("NS plugin disabled"),Promise.resolve();if(!e&&t.IsRunAlreadyWithContentLoaded)return Promise.resolve();if(!e&&t.IsRunAlreadyWithoutContentLoaded)return Promise.resolve();if(e?t.IsRunAlreadyWithContentLoaded=!0:t.IsRunAlreadyWithoutContentLoaded=!0,t.data)return t.onDataLoaded({type:"Success",data:t.data}),Promise.resolve();var n={siteId:t.siteId,fullPageUrl:t.fullPageUrl,dataEndpoint:t.dataEndpoint,pageId:t.debugPageId,isRenderTron:t.isRenderTron};return t.load_nsPluginData_onlyOnce(t,n).then(t.onDataLoaded).catch(t.onDataLoadingError)}},{key:"load_nsPluginData_onlyOnce",value:function(e,t){var n,o,a,i,r,d;return e.loadingPromise||(e.loadingPromise=(o=(n=t).siteId,a=n.fullPageUrl,i=n.pageId,r=n.isRenderTron,d=(d=n.dataEndpoint)||h.DefaultDataEndpoint,d="".concat(d,"?siteId=").concat(o,"&isRenderTron=").concat(r),d+="&pluginVersion=".concat(h.Version),i&&(d+="&pageId=".concat(i)),a&&(d+="&pageUrl=".concat(a)),console.debug("nytroseo : 1 : request plugin data"),new Promise(function(e,t){var n=new XMLHttpRequest;n.responseType="json",n.open("GET",d,!0),n.onload=function(){try{console.debug("nytroseo : 4 : response plugin data"),200===n.status?e(n.response):t("Data endpoint returned "+n.status+" status code.")}catch(e){t("Unexpected error while loading data: ("+e+").")}},n.onerror=function(e){t("Data endpoint failed with status: "+e.target.status+".")},console.debug("nytroseo : 2 : request plugin data"),n.send(),console.debug("nytroseo : 3 : request plugin data")}))),e.loadingPromise}},{key:"onDataLoaded",value:function(e){var t,n,o=this;o.LoadedDataResponse=e,o.data=e.data;try{if(!function(e){if(!e.isInstallationModuleDone&&(e.isInstallationModuleDone=!0,e.siteId))try{var t=e.document.createElement("div");t.setAttribute("class","NYTRO_SITE_ID_".concat(e.siteId," NS_VERSION_").concat(h.Version)),e.document.body.appendChild(t),console.debug("nytroseo : installation element added")}catch(e){console.warn(e,"nytroseo : installation element failed")}}(o),"Success"!==e.type)return void o.onDataLoadingError("Data loading failed: ("+e.type+").");o.data.keywords||(o.data.keywords=[]),(o.data.maxKeywordsInAlts>o.data.keywords.length||o.data.maxKeywordsInAlts<=0)&&(o.data.maxKeywordsInAlts=o.data.keywords.length);var a=o.data.settings;a&&a.useTitleOptimization&&r(o),a&&a.useDescriptionOptimization&&l(o),a&&a.useImagesOptimization&&(n=(t=o).document.getElementsByTagName("img"),m(t,n)),a&&a.useAnchorOptimization&&function(e){e.optimizedLinks||(e.optimizedLinks=new Map);var t=e.document.getElementsByTagName("a");u(e,t)}(o),a&&a.useNoIndexOptimization&&f(o),a&&a.useKeywordsInFooter&&y(o)}catch(e){o.onProcessingError(e)}}},{key:"onDataLoadingError",value:function(e){console.warn(e,"nytroseo : loading data failed")}},{key:"onProcessingError",value:function(e){console.warn(e,"nytroseo : processing failed")}},{key:"handleMetaTitleChange",value:function(){if(this&&this.data){var e=this.data.settings;e&&e.useTitleOptimization&&r(this)}}},{key:"handleMetaDescriptionChange",value:function(){if(this&&this.data){var e=this.data.settings;e&&e.useDescriptionOptimization&&l(this)}}},{key:"handleNewImages",value:function(e){if(this&&this.data){var t=this.data.settings;t&&t.useImagesOptimization&&m(this,e)}}},{key:"handleNewLinks",value:function(e){if(this&&this.data){var t=this.data.settings;t&&t.useAnchorOptimization&&u(this,e)}}},{key:"bindFunctions",value:function(e){var t=this;e.forEach(function(e){t[e]=t[e].bind(t)})}},{key:"getQueryParameterByName",value:function(e){var t=window.location.href;e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null}},{key:"aggregateTextWithKeywordsByComma",value:function(e,t,n){var o=this.data.keywords,a=n*t%o.length,i=o.slice(a,Math.min(a+t,o.length));i.length<t&&(i=i.concat(o.slice(0,t-i.length)));var r=this.aggregateByComma(i,t);return r?e?this.aggregateByComma([e,r],t+1):r:e}},{key:"aggregateTextWithTitleByComma",value:function(e){var t=this.data.title;return t?e?this.aggregateByComma([e,t]):t:e}},{key:"getKeywordsSeparatedByComma",value:function(e){return this.aggregateByComma(this.data.keywords,e)}},{key:"aggregateByComma",value:function(e,t){if(!e||0===e.length)return"";var n=e.filter(function(e){return e&&e.trim()});return t&&n.length>t&&(n.length=t),""+n.join(", ")}}]),n}(),p=h.PredefinedSiteId;function v(){return window.__ns_plugin||(window.__ns_plugin=new n(window.__ns_configs)),window.__ns_plugin}return p&&"PREDEFINED_SITE_ID"!==p&&"00000000-0000-0000-0000-000000000000"!==p&&(console.debug("nytroseo : 0 : predefined site id : "+p),window.__ns_configs={document:document,siteId:p}),window.__ns_plugin=void 0,window.self&&window.self!==window.top?console.warn("nytroseo: disabled inside iframe"):(document.addEventListener("DOMContentLoaded",function(){console.debug("nytroseo : 1 : dom content loaded");try{new MutationObserver(function(e){var t,n,o,a=[],i=[],r=s(e);try{for(r.s();!(t=r.n()).done;){var d=t.value;"childList"===d.type&&d.addedNodes.forEach(function(e){"IMG"===e.tagName?a.push(e):"A"===e.tagName&&i.push(e)})}}catch(e){r.e(e)}finally{r.f()}n=a,window.__ns_plugin&&n&&n.length&&(console.debug("nytroseo : - : new images detected (count: ".concat(n.length,")")),window.__ns_plugin.handleNewImages(n)),o=i,window.__ns_plugin&&o&&o.length&&(console.debug("nytroseo : - : new links detected (count: ".concat(o.length,")")),window.__ns_plugin.handleNewLinks(o))}).observe(document.body,{childList:!0,subtree:!0})}catch(e){console.warn(e)}!function e(t){if(!(10<t))return window.__ns_configs&&!window.__ns_plugin_running?(console.debug("nytroseo : 1 : run plugin after dom content loaded"),v().run(!0).finally(function(){if(!window.__ns_interval){window.__ns_interval=!0;var e=0,t=setInterval(function(){10<++e&&clearInterval(t),v().run(!0)},500)}})):void setTimeout(function(){return e(t+1)},100)}(0)}),window.__ns_configs&&(console.debug("nytroseo : 1 : run plugin direct"),window.__ns_plugin_running=!0,v().run(!1).finally(function(){window.__ns_plugin_running=!1}))),e.SEOgeniePlugin=n,e.nsPlugin=n,e}({});