static.alliai.com Open in urlscan Pro
2600:9000:2127:1000:17:a0f4:8900:93a1  Public Scan

URL: http://static.alliai.com/widget/v1.js
Submission: On October 20 via manual from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

!function(t){var e={};function n(a){if(e[a])return e[a].exports;var i=e[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,a){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(a,i,function(e){return t[e]}.bind(null,i));return a},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e,n){var a=function(t){"use strict";var e=Object.prototype,n=e.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",r=a.asyncIterator||"@@asyncIterator",o=a.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function s(t,e,n,a){var i=e&&e.prototype instanceof d?e:d,r=Object.create(i.prototype),o=new E(a||[]);return r._invoke=function(t,e,n){var a="suspendedStart";return function(i,r){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===i)throw r;return S()}for(n.method=i,n.arg=r;;){var o=n.delegate;if(o){var c=w(o,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===a)throw a="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a="executing";var s=u(t,e,n);if("normal"===s.type){if(a=n.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(a="completed",n.method="throw",n.arg=s.arg)}}}(t,n,o),r}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l={};function d(){}function h(){}function f(){}var p={};p[i]=function(){return this};var m=Object.getPrototypeOf,g=m&&m(m(x([])));g&&g!==e&&n.call(g,i)&&(p=g);var b=f.prototype=d.prototype=Object.create(p);function v(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function y(t,e){var a;this._invoke=function(i,r){function o(){return new e((function(a,o){!function a(i,r,o,c){var s=u(t[i],t,r);if("throw"!==s.type){var l=s.arg,d=l.value;return d&&"object"==typeof d&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){a("next",t,o,c)}),(function(t){a("throw",t,o,c)})):e.resolve(d).then((function(t){l.value=t,o(l)}),(function(t){return a("throw",t,o,c)}))}c(s.arg)}(i,r,a,o)}))}return a=a?a.then(o,o):o()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var a=u(n,t.iterator,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,l;var i=a.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function x(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,r=function e(){for(;++a<t.length;)if(n.call(t,a))return e.value=t[a],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:S}}function S(){return{value:void 0,done:!0}}return h.prototype=b.constructor=f,f.constructor=h,h.displayName=c(f,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,c(t,o,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},v(y.prototype),y.prototype[r]=function(){return this},t.AsyncIterator=y,t.async=function(e,n,a,i,r){void 0===r&&(r=Promise);var o=new y(s(e,n,a,i),r);return t.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},v(b),c(b,o,"Generator"),b[i]=function(){return this},b.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var a=e.pop();if(a in t)return n.value=a,n.done=!1,n}return n.done=!0,n}},t.values=x,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function a(n,a){return o.type="throw",o.arg=t,e.next=n,a&&(e.method="next",e.arg=void 0),!!a}for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i],o=r.completion;if("root"===r.tryLoc)return a("end");if(r.tryLoc<=this.prev){var c=n.call(r,"catchLoc"),s=n.call(r,"finallyLoc");if(c&&s){if(this.prev<r.catchLoc)return a(r.catchLoc,!0);if(this.prev<r.finallyLoc)return a(r.finallyLoc)}else if(c){if(this.prev<r.catchLoc)return a(r.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return a(r.finallyLoc)}}}},abrupt:function(t,e){for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var r=i;break}}r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=t,o.arg=e,r?(this.method="next",this.next=r.finallyLoc,l):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),A(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var a=n.completion;if("throw"===a.type){var i=a.arg;A(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=a}catch(t){Function("r","regeneratorRuntime = r")(a)}},function(t,e,n){"use strict";var a=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==a)return a;throw new Error("unable to locate global object")}();t.exports=e=a.fetch,a.fetch&&(e.default=a.fetch.bind(a)),e.Headers=a.Headers,e.Request=a.Request,e.Response=a.Response},function(t){t.exports=JSON.parse('{"name":"alli-widget","version":"0.2.4","description":"JS Widget for AlliAI Intelligent SEO","main":"src/main.js","dependencies":{"core-js":"^3.6.5","node-fetch":"^2.6.0","regenerator-runtime":"^0.13.7"},"devDependencies":{"@babel/core":"^7.10.5","@babel/preset-env":"^7.10.4","babel-loader":"^8.1.0","copy-webpack-plugin":"^5.1.1","css-loader":"^3.6.0","dotenv":"^8.2.0","html-loader":"^0.5.5","style-loader":"^1.2.1","terser-webpack-plugin":"^2.3.7","webpack":"^4.44.0","webpack-bundle-analyzer":"^3.8.0","webpack-cli":"^3.3.12","webpack-dev-server":"^3.11.0","webpack-merge":"^4.2.2","webpack-s3-plugin":"^1.0.3"},"scripts":{"start":"NODE_ENV=development webpack-dev-server --config ./webpack/webpack.base.config.js --open","start:staging":"NODE_ENV=staging webpack-dev-server --config ./webpack/webpack.base.config.js --open","dev":"NODE_ENV=development webpack --config ./webpack/webpack.base.config.js","dev:staging":"NODE_ENV=staging webpack --config ./webpack/webpack.base.config.js","dev:production":"NODE_ENV=production webpack --config ./webpack/webpack.base.config.js","build:staging":"NODE_ENV=staging webpack --config ./webpack/webpack.build.config.js","build:production":"NODE_ENV=production webpack --config ./webpack/webpack.build.config.js"},"author":"Alli AI LLC","license":"MIT"}')},function(t,e,n){"use strict";n.r(e),n.d(e,"highlight",(function(){return Q}));n(0),n(1);function a(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(t,e)}(t)||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 i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,a=new Array(e);n<e;n++)a[n]=t[n];return a}function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=function(t){0},c=function(t,e){return t.filter((function(t){return-1!==e.indexOf(t)}))},s=function(t){return u(t)[0]},u=function(t){var e=document.createElement("div");return e.innerHTML=t.trim(),e.children},l=function(t){t.forEach((function(t){t.parentNode.removeChild(t)}))},d=function(t){return t.replace(/-([a-z])/g,(function(t){return t[1].toUpperCase()}))},h=function(t,e){var n,i=document.createElement(e);return n=i,a(t.attributes).forEach((function(t){n.setAttribute(t.nodeName,t.nodeValue)})),i.innerHTML=t.innerHTML.trim(),function(t,e){var n,a,i=!!t.tagName.match(y)&&!!e.tagName.match(y);i&&(n=Object.assign({},getComputedStyle(t))),function(t,e){t.forEach((function(t){t.insertAdjacentElement("afterend",e)}))}([t],e),l([t]),i&&(a=getComputedStyle(e),null==("undefined"==typeof Foundation?"undefined":r(Foundation))&&null==("undefined"==typeof bootstrap?"undefined":r(bootstrap))||e.classList.add(t.tagName),Array.from(a).forEach((function(t){var i=d(t);n[i]!=a[i]&&e.style.setProperty(t,n[i])})))}(t,i),i},f=function(t){if(t instanceof NodeList||(t=[t]),t.length<1)return!0;t.forEach((function(t){if(document.body.contains(t)){var e=t.getBoundingClientRect();if(!(e.height<1||e.width<1)){var n={top:e.top+window.scrollY-3,left:e.left+window.scrollX-3,height:e.height+6,width:e.width+6},a=document.createElement("div");a.style.cssText="background: rgba(255,0,0,0.5); z-index: 1000; position: absolute",a.style.left="".concat(n.left,"px"),a.style.top="".concat(n.top,"px"),a.style.width="".concat(n.width,"px"),a.style.height="".concat(n.height,"px"),document.body.appendChild(a)}}}))},p=function(t,e,n){var a="";if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),a="; expires="+i.toUTCString()}document.cookie=t+"="+(e||"")+a+"; path=/"},m=function(t,e){document.cookie=t+"="+(e||"")+";expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/"},g=function(t){for(var e=t+"=",n=document.cookie.split(";"),a=0;a<n.length;a++){for(var i=n[a];" "===i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(e))return i.substring(e.length,i.length)}return null},b=/\?q=.*https?:\/\/[^\/]*([^&+]*)/i,v=/(?<=.+)\/(?=$|\?)/m,y=/^h\d$/i,w=[],k={},A=function(t){w.push(t)},E=function(t){k[t]=k[t]+1||1};function x(t,e){t=[t].reduce((function(t,e){return t.concat(e)}),[]);for(var n=0;n<e.length;n++)try{var a=e[n],i=z[a.category];if(i&&c(t,i.scope).length>0){var r=i.optimize(a);Q&&f(r)}}catch(t){o(0)}Q&&function(t,e){if(0!==e.length||0!==!Object.keys(t).length){var n=document.createElement("div");if(n.style.cssText="color: white; background: rgba(255,0,0,0.8);position: fixed; width: 100%; bottom: 0; left: 0; padding: 10px; z-index: 1000;",Object.keys(t).length>0){n.insertAdjacentHTML("beforeend","<p>Alli has made the following changes to your page:</p><ul class='bodyHighlights'></ul>".trim());var a=n.querySelector("ul.bodyHighlights");for(var i in t){var r=document.createElement("li");r.innerHTML="".concat(t[i]," instance(s) of <b>").concat(i,"</b>").trim(),a.appendChild(r)}}if(e.length>0){n.insertAdjacentHTML("beforeend","<p>Alli has also made these invisible changes to your HEAD section:</p><ul class='headHighlights'></ul></div>".trim());var o=n.querySelector("ul.headHighlights");e.forEach((function(t){var e=document.createElement("li");e.textContent=t,o.appendChild(e)}))}document.body.appendChild(n)}}(k,w)}var S={};S["no-social-preview"]={scope:["all","code","meta"],description:"Replace select social META tags",optimize:function(t){var e=u(t.final);return l(document.querySelectorAll('meta[property="og:title"], meta[property="og:description"], meta[property="og:image"], meta[property="og:url"], meta[name="twitter:card"]')),Array.from(e).forEach((function(e){e.setAttribute("data-a11i-preview-id",t.id),document.head.appendChild(e)})),A("Added Twitter & Facebook OG <META> Tags"),e},rollback:function(t){document.querySelectorAll('[data-a11i-preview-id="'.concat(t.id,'"]')).forEach((function(t){t.remove()}))}},S["missing-meta-title"]={scope:["all","code","meta"],description:"Missing META title tag",optimize:function(t){var e=s('<meta name="title" content="'.concat(t.final,'" data-a11i-meta-title-id="').concat(t.id,'" />'));return document.head.appendChild(e),A('Added <META name="title"> tag: '.concat(t.final)),e},rollback:function(t){document.querySelectorAll('[data-a11i-meta-title-id="'.concat(t.id,'"]')).forEach((function(t){t.remove()}))}},S["missing-meta-desc"]={scope:["all","code","meta"],description:"Missing META description tag",optimize:function(t){var e=s('<meta name="description" content="'.concat(t.final,'" data-a11i-meta-desc-id="').concat(t.id,'" />'));return document.head.appendChild(e),A('Added <META name="description"> tag: '.concat(t.final)),e},rollback:function(t){document.querySelectorAll('[data-a11i-meta-desc-id="'.concat(t.id,'"]')).forEach((function(t){t.remove()}))}},S["canonical-links"]={scope:["all","code","meta"],description:"Pages should have Canonical Link",optimize:function(t){var e=s('<link rel="canonical" href="'.concat(t.final,'" data-a11i-canonical-id="').concat(t.id,'" />'));return document.head.appendChild(e),A("Added Canonical <LINK> tag pointing to: ".concat(t.final)),e},rollback:function(t){document.querySelectorAll('[data-a11i-canonical-id="'.concat(t.id,'"]')).forEach((function(t){t.remove()}))}};var O=S,j={};j["no-h1"]={scope:["all","content","headings"],description:"Promote the next heading to H1",optimize:function(t){var e=document.querySelector(t.path);if(e)return e.setAttribute("data-a11i-h-none",e.tagName),e.setAttribute("data-a11i-h-none-id",t.id),E("no-h1"),h(e,"h1")},rollback:function(t){document.querySelectorAll('[data-a11i-h-none-id="'.concat(t.id,'"]')).forEach((function(t){var e=t.getAttribute("data-a11i-h-none");t.removeAttribute("data-a11i-h-none"),t.removeAttribute("data-a11i-h-none-id"),h(t,e)}))}},j["too-many-h1s"]={scope:["all","content","headings"],description:"Demote non-hierarchical H1s",optimize:function(t){var e=document.querySelectorAll(t.path),n=[];return e.forEach((function(e){e.hasAttribute("data-a11i-h-one-id")&&parseInt(e.getAttribute("data-a11i-h-one-id"))!==t.id||(e.setAttribute("data-a11i-h-one-id",t.id),E("too-many-h1s"),n.push(h(e,"h2")))})),n},rollback:function(t){document.querySelectorAll('[data-a11i-h-one-id="'.concat(t.id,'"]')).forEach((function(t){t.removeAttribute("data-a11i-h-one-id"),h(t,"h1")}))}},j["images-have-alt-title"]={scope:["all","content","images"],description:"Images have alt & title tags",optimize:function(t){var e=document.querySelectorAll(t.path);return e.forEach((function(e){e.hasAttribute("data-a11i-alt-title-id")&&parseInt(e.getAttribute("data-a11i-alt-title-id"))!==t.id||(!e.hasAttribute("data-a11i-alt")&&e.getAttribute("alt")&&e.setAttribute("data-a11i-alt",e.getAttribute("alt")),!e.hasAttribute("data-a11i-title")&&e.getAttribute("title")&&e.setAttribute("data-a11i-title",e.getAttribute("title")),e.setAttribute("alt",t.final),e.setAttribute("title",t.final),e.setAttribute("data-a11i-alt-title-id",t.id))})),E("images-have-alt-title"),e},rollback:function(t){document.querySelectorAll(t.path).forEach((function(e){if(parseInt(e.getAttribute("data-a11i-alt-title-id"))===t.id){var n=e.getAttribute("data-a11i-alt"),a=e.getAttribute("data-a11i-title");n?e.setAttribute("alt",n):e.removeAttribute("alt"),a?e.setAttribute("title",a):e.removeAttribute("title"),e.removeAttribute("data-a11i-alt"),e.removeAttribute("data-a11i-title"),e.removeAttribute("data-a11i-alt-title-id")}}))}},j["missing-title-tag"]={scope:["all","code","title"],description:"Missing title tag",optimize:function(t){return document.title=t.final,document.querySelector("title").setAttribute("data-a11i-title-id",t.id),A("Added missing <TITLE> tag"),document.querySelector("title")},rollback:function(t){var e,n=document.querySelector("title");n&&(parseInt(n.getAttribute("data-a11i-title-id"))===t.id&&(null===(e=document.querySelector("title"))||void 0===e||e.remove()))}},j["title-tag-length"]={scope:["all","code","title"],description:"Title tag length",optimize:function(t){var e=document.title;document.title=t.final;var n=document.querySelector("title");return n.setAttribute("data-a11i-title-length-id",t.id),n.setAttribute("data-a11i-title-length",e),A("Changed <TITLE> tag content for length"),document.querySelector("title")},rollback:function(t){var e=document.querySelector("title");e&&(e.hasAttribute("data-a11i-title-id")||e.hasAttribute("data-a11i-title-length-id")&&parseInt(e.getAttribute("data-a11i-title-length-id"))!==t.id||(document.title=e.getAttribute("data-a11i-title-length"),e.removeAttribute("data-a11i-title-length"),e.removeAttribute("data-a11i-title-length-id")))}},j["external-link-target"]={scope:["all","code","links"],description:"External links should open in a new Tab",optimize:function(t){var e=document.querySelectorAll(t.path);return e.forEach((function(e){e.setAttribute("target","_blank"),e.hasAttribute("data-a11i-link-target-id")&&parseInt(e.getAttribute("data-a11i-link-target-id"))!==t.id||(e.hasAttribute("data-a11i-link-target")||e.setAttribute("data-a11i-link-target",e.getAttribute("target")),e.setAttribute("data-a11i-link-target-id",t.id),e.setAttribute("target","_blank"))})),E("external-link-target"),e},rollback:function(t){var e=document.querySelectorAll(t.path);return e.forEach((function(e){if(parseInt(e.getAttribute("data-a11i-link-target-id"))===t.id){var n=e.getAttribute("data-a11i-link-target");e.removeAttribute("data-a11i-link-target"),e.removeAttribute("data-a11i-link-target-id"),n?e.setAttribute("target",n):e.removeAttribute("target")}})),e}},j["links-have-titles"]={scope:["all","code","links"],description:"Ensure all <A> tags have titles",optimize:function(t){var e=document.querySelectorAll(t.path);return e.forEach((function(e){e.hasAttribute("data-a11i-title-id")&&parseInt(e.getAttribute("data-a11i-title-id"))!==t.id||(!e.hasAttribute("data-a11i-title")&&e.getAttribute("title")&&e.setAttribute("data-a11i-title",e.getAttribute("title")),e.setAttribute("data-a11i-title-id",t.id),e.setAttribute("title",t.final))})),E("links-have-titles"),e},rollback:function(t){var e=document.querySelectorAll(t.path);return e.forEach((function(e){if(parseInt(e.getAttribute("data-a11i-title-id"))===t.id){var n=e.getAttribute("data-a11i-title");n?e.setAttribute("title",n):e.removeAttribute("title"),e.removeAttribute("data-a11i-title"),e.removeAttribute("data-a11i-title-id")}})),e}},j["custom-text"]={scope:["all","content","custom"],description:"Cusom text content adjustment",optimize:function(t){var e=document.querySelectorAll(t.path);return e.forEach((function(e){e.hasAttribute("data-a11i-html-id")||e.hasAttribute("data-a11i-text-id")&&parseInt(e.getAttribute("data-a11i-text-id"))!==t.id||(e.hasAttribute("data-a11i-text")||e.setAttribute("data-a11i-text",e.innerText),e.setAttribute("data-a11i-text-id",t.id),e.innerText=t.final)})),E("custom-text"),e},rollback:function(t){var e=document.querySelectorAll(t.path);return e.forEach((function(e){if(parseInt(e.getAttribute("data-a11i-text-id"))===t.id){var n=e.getAttribute("data-a11i-text");e.removeAttribute("data-a11i-text"),e.removeAttribute("data-a11i-text-id"),e.innerHTML=n}})),e}},j["custom-html"]={scope:["all","content","custom"],description:"Cusom HTML content adjustment",optimize:function(t){var e=document.querySelectorAll(t.path);return e.forEach((function(e){e.hasAttribute("data-a11i-text-id")||e.hasAttribute("data-a11i-html-id")&&parseInt(e.getAttribute("data-a11i-html-id"))!==t.id||(e.hasAttribute("data-a11i-html")||e.setAttribute("data-a11i-html",e.innerHTML),e.setAttribute("data-a11i-html-id",t.id),e.innerHTML=t.final)})),E("custom-html"),e},rollback:function(t){var e=document.querySelectorAll(t.path);return e.forEach((function(e){if(parseInt(e.getAttribute("data-a11i-html-id"))===t.id){var n=e.getAttribute("data-a11i-html");e.removeAttribute("data-a11i-html"),e.removeAttribute("data-a11i-html-id"),e.innerHTML=n}})),e}};var T=j;function L(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function I(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?L(Object(n),!0).forEach((function(e){M(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function M(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var z=I(I({},O),T);function P(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function H(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?P(Object(n),!0).forEach((function(e){_(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function _(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function N(t){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function R(t,e,n,a,i,r,o){try{var c=t[r](o),s=c.value}catch(t){return void n(t)}c.done?e(s):Promise.resolve(s).then(a,i)}function q(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function C(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function U(t,e,n){return e&&C(t.prototype,e),n&&C(t,n),t}var D=function(){function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];q(this,t),this.api=new K,this.frame=null,this.recommendations=[],this.endpoint="https://static.alliai.com",this.apiKey=e,this.enabled=n,this.uuid=null,this.optimized=!1,this.authorized=!1,this.subscribed=!1,this.tokenKey="_alli-ext_token",this.UUIDKey="_alli-ext_uuid"}var e,n;return U(t,[{key:"initialize",value:(e=regeneratorRuntime.mark((function t(){var e,n,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(g("alli-disabled")!==this.apiKey){t.next=3;break}throw this.enabled=!1,Error("Your Alli AI account has been suspended or the site was removed from the database. To reduce the number of unnecessary requests please uninstall the widget.");case 3:return e=new URL("api/v3/widget/".concat(this.apiKey,"/recommendations?l=").concat(this.pageLang,"&p=").concat(this.pathAndQuery),this.endpoint),t.next=6,fetch(e,{headers:{Accept:"application/json"}});case 6:if(403!==(null==(n=t.sent)?void 0:n.status)){t.next=10;break}throw p("alli-disabled",this.apiKey,1),Error("Your Alli AI account has been suspended. Please log in at https://www.alliai.com to see more details.");case 10:if(404!==(null==n?void 0:n.status)){t.next=13;break}throw p("alli-disabled",this.apiKey,30),Error("The Site not found in the Alli AI database. To reduce the number of errors please uninstall the widget.");case 13:if(this.enabled=200===(null==n?void 0:n.status),!this.enabled){t.next=23;break}return t.next=17,n.json();case 17:a=t.sent,this.recommendations=a.recommendations,this.optimized=a.optimized,this.uuid=a.uuid,this.enabled=this.optimized&&!!Object.keys(this.recommendations).length,this.authorized=!this.tokenUUID||this.tokenUUID===this.uuid;case 23:return this.subscribe(),t.abrupt("return",this.enabled);case 25:case"end":return t.stop()}}),t,this)})),n=function(){var t=this,n=arguments;return new Promise((function(a,i){var r=e.apply(t,n);function o(t){R(r,a,i,o,c,"next",t)}function c(t){R(r,a,i,o,c,"throw",t)}o(void 0)}))},function(){return n.apply(this,arguments)})},{key:"subscribe",value:function(){var t=this;this.subscribed||(this.subscribed=!0,window.addEventListener("message",(function(e){var n=e.data;"object"!==N(n)||["alliai-ext","alliai-frame"].indexOf(n.source)<0||("alliai-frame"===n.source&&e.source&&(t.frame=e.source),t.processEvent(e))})),this.sendMessage(window,{command:"init",status:this.enabled&&this.authorized}))}},{key:"processEvent",value:function(t){switch(t.data.command){case"ping":this.pong(t);break;case"auth":this.authenticate(t);break;case"authorize":this.authorize(t);break;case"logout":this.logout(t);break;case"version":this.checkUpdates(t);break;case"categories":this.loadCategories(t);break;case"recommendations":this.loadRecommendations(t);break;case"update":this.updateRecommendation(t);break;case"create":this.createRecommendation(t);break;case"delete":this.deleteRecommendation(t);break;case"emphasize":this.emphasize(t);break;case"underemphasize":this.underemphasize(t);break;case"inject":this.injectScript(t);break;case"opimize":this.optimize(t);break;case"rollback":this.rollback(t)}}},{key:"pong",value:function(t){this.sendMessage(t.source,{command:"pong",status:this.optimized,payload:{enabled:this.optimized}})}},{key:"login",value:function(t){t.key&&(p(this.tokenKey,t.key,7),p(this.UUIDKey,t.uuid,7))}},{key:"logout",value:function(t){m(this.tokenKey),m(this.UUIDKey),this.sendMessage(t.source,{command:t.data.command,status:!0})}},{key:"unauthenticated",value:function(t){m(this.tokenKey),m(this.UUIDKey),this.sendMessage(t.source,{command:"unauthenticated",status:!1})}},{key:"authenticate",value:function(t){var e=this;if(t.data.error)this.sendMessage(this.frame,{command:t.data.command,status:!1,error:t.data.error});else if(this.authToken)this.sendMessage(this.frame,{command:t.data.command,status:!0});else{var n;switch(t.data.provider){case"google":n="/api/v2/teams/auth/google";break;case"facebook":n="/api/v2/teams/auth/facebook";break;default:n="/api/v2/teams/auth"}this.api.post(n,null,t.data.payload).then((function(n){n.headers.get("Content-Type").match("application/json")?n.json().then((function(a){var i;n.ok&&e.login(a),e.sendMessage(e.frame,{command:t.data.command,status:n.ok,error:null===(i=a.error)||void 0===i?void 0:i.message})})):e.sendMessage(e.frame,{command:t.data.command,status:!1,error:"Unknown Error"})})).catch((function(n){e.sendMessage(e.frame,{command:t.data.command,status:!1,error:n})}))}}},{key:"authorize",value:function(t){this.sendMessage(this.frame,{command:t.data.command,status:this.authorized})}},{key:"checkUpdates",value:function(t){var e=this;this.api.get("/api/v2/teams/widget/versions?version=".concat(t.data.args.version),this.authToken).then((function(n){e.apiResponseHandler(t,n)})).catch((function(n){e.apiErrorHandler(t,n)}))}},{key:"loadCategories",value:function(t){var e=this;this.api.get("/api/v2/teams/widget/categories",this.authToken).then((function(n){e.apiResponseHandler(t,n)})).catch((function(n){e.apiErrorHandler(t,n)}))}},{key:"loadRecommendations",value:function(t){var e=this,n="/api/v2/teams/sites/".concat(this.apiKey,"/widget/recommendations?l=").concat(this.pageLang,"&p=").concat(this.pathAndQuery,"&category_id=").concat(t.data.args.categoryId);this.api.get(n,this.authToken).then((function(n){e.apiResponseHandler(t,n)})).catch((function(n){e.apiErrorHandler(t,n)}))}},{key:"createRecommendation",value:function(t){var e=this,n="/api/v2/teams/sites/".concat(this.apiKey,"/widget/recommendations?l=").concat(this.pageLang,"&p=").concat(this.pathAndQuery);this.api.post(n,this.authToken,t.data.payload).then((function(n){e.apiResponseHandler(t,n)})).catch((function(n){e.apiErrorHandler(t,n)}))}},{key:"loadRecommendation",value:function(t){var e=this,n="/api/v2/teams/sites/".concat(this.apiKey,"/widget/recommendations/").concat(t.data.args.id);this.api.get(n,this.authToken).then((function(n){e.apiResponseHandler(t,n)})).catch((function(n){e.apiErrorHandler(t,n)}))}},{key:"deleteRecommendation",value:function(t){var e=this,n="/api/v2/teams/sites/".concat(this.apiKey,"/widget/recommendations/").concat(t.data.args.id);this.api.delete(n,this.authToken).then((function(n){e.apiResponseHandler(t,n)})).catch((function(n){e.apiErrorHandler(t,n)}))}},{key:"updateRecommendation",value:function(t){var e=this,n="/api/v2/teams/sites/".concat(this.apiKey,"/widget/recommendations/").concat(t.data.args.id);this.api.patch(n,this.authToken,t.data.payload).then((function(n){401===n.status?e.unauthenticated(t):n.ok?e.loadRecommendation(t):n.json().then((function(a){e.sendMessage(t.source,{command:t.data.command,args:t.data.args,status:n.ok,payload:a})}))})).catch((function(n){e.apiErrorHandler(t,n)}))}},{key:"apiResponseHandler",value:function(t,e){var n=this;401===e.status&&this.unauthenticated(t),204===e.status?this.sendMessage(t.source,{command:t.data.command,args:t.data.args,status:!0}):e.status>=500?this.sendMessage(t.source,{command:t.data.command,args:t.data.args,status:!1}):e.json().then((function(a){n.sendMessage(t.source,{command:t.data.command,args:t.data.args,status:e.ok,payload:a})}))}},{key:"apiErrorHandler",value:function(t,e){this.sendMessage(t.source,{command:t.data.command,args:t.data.args,status:!1})}},{key:"emphasize",value:function(t){if(t.data.payload.path){var e=document.querySelector(t.data.payload.path);e&&e.scrollIntoView({behavior:"smooth",block:"center"})}this.runInspector(t.data.payload)}},{key:"underemphasize",value:function(t){this.stopInspector()}},{key:"sendMessage",value:function(t,e){t.postMessage(H({source:"alliai-widget"},e),"*")}},{key:"injectScript",value:function(t){var e=document.createElement("link"),n=document.createElement("script");e.rel="stylesheet",e.href=t.data.payload.styleUrl,n.src=t.data.payload.scriptUrl,document.head.appendChild(e),document.body.appendChild(n)}},{key:"runInspector",value:function(t){window.selector_gadget&&this.stopInspector(),window.SelectorGadget.toggle(H({analytics:!1},t))}},{key:"stopInspector",value:function(){window.selector_gadget&&(window.SelectorGadget.toggle({analytics:!1}),window.selector_gadget=null)}},{key:"optimize",value:function(t){var e=t.data.payload.recommendation,n=z[e.category];(null==n?void 0:n.optimize)&&n.optimize(e)}},{key:"rollback",value:function(t){var e=t.data.payload.recommendation,n=z[e.category];(null==n?void 0:n.rollback)&&n.rollback(e)}},{key:"pageLang",get:function(){var t,e,n=document.getElementsByTagName("HTML")[0];return(null==n||null===(t=n.attributes)||void 0===t||null===(e=t.lang)||void 0===e?void 0:e.value)||""}},{key:"pathAndQuery",get:function(){return encodeURIComponent(function(){if(!!window.location.host.match(/webcache\.googleusercontent\.com/))return window.location.search.match(b)?unescape(window.location.search.match(b)[1]).replace(v,""):"";var t=new URLSearchParams(window.location.search);t.get("highlight")&&t.delete("highlight");var e=t.toString().length>0?"?"+t.toString():"";return window.location.pathname.replace(v,"")+e}())}},{key:"authToken",get:function(){var t=g(this.tokenKey);return t&&p(this.tokenKey,t,7),t}},{key:"tokenUUID",get:function(){var t=g(this.UUIDKey);return t&&p(this.UUIDKey,t,7),t}}]),t}(),K=function(){function t(){q(this,t),this.endpoint="https://app.alliai.com"}return U(t,[{key:"send",value:function(t,e,n,a){var i=new URL(e,this.endpoint),r={"Content-Type":"application/json"};n&&(r.Authorization="Token ".concat(n));var o={method:t,mode:"cors",headers:r};return a&&(o.body=JSON.stringify(a)),fetch(i,o)}},{key:"get",value:function(t,e){return this.send("GET",t,e)}},{key:"post",value:function(t,e,n){return this.send("POST",t,e,n)}},{key:"patch",value:function(t,e,n){return this.send("PATCH",t,e,n)}},{key:"delete",value:function(t,e){return this.send("DELETE",t,e)}}]),t}();function G(t,e,n,a,i,r,o){try{var c=t[r](o),s=c.value}catch(t){return void n(t)}c.done?e(s):Promise.resolve(s).then(a,i)}var V,F,J=["init","message","optimize","status","version"],W=!0,Y=[],Q=!1,$=function(){var t,e=(t=regeneratorRuntime.mark((function t(e){var n,a,i,r,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(X()){t.next=2;break}return t.abrupt("return",!0);case 2:if(n=e[e["JS-Widget"]],a="".concat(e["JS-Widget"],"-init"),!e[a]&&"apiHandler"!==n.name){t.next=9;break}return console.warn("WARNING: Alli AI widget is embedded more than once on this page."),t.abrupt("return",!1);case 9:e[a]=!0;case 10:if(i=n.q,r=!1,!i){t.next=35;break}c=0;case 14:if(!(c<i.length)){t.next=35;break}if("init"!==i[c][0].toLowerCase()){t.next=31;break}if(!r){t.next=18;break}return t.abrupt("break",35);case 18:return F=i[c][1],o("JS-Widget starting, Auth Key: ".concat(F)),V=new D(F,W),t.next=23,V.initialize();case 23:W=t.sent,o("Widget Enabled is set to: ".concat(W)),Y=V.recommendations,Z(),o("Highlight Mode is set to: ".concat(Q)),r=!0,t.next=32;break;case 31:W&&B(i[c][0],i[c][1]);case 32:c++,t.next=14;break;case 35:e[e["JS-Widget"]]=B;case 36:case"end":return t.stop()}}),t)})),function(){var e=this,n=arguments;return new Promise((function(a,i){var r=t.apply(e,n);function o(t){G(r,a,i,o,c,"next",t)}function c(t){G(r,a,i,o,c,"throw",t)}o(void 0)}))});return function(t){return e.apply(this,arguments)}}(),B=function(t,e){if(!t)throw Error("API method required");if(!W)throw Error("Not enabled or authenticated for this site. Check your API Key.");if(t=t.toLowerCase(),-1===J.indexOf(t))throw Error("Method ".concat(t," is not supported"));switch(o("Handling API call ".concat(t,". ").concat(e)),t){case"message":show(e);break;case"optimize":x(e,Y);break;case"status":console.log("JS-Widget starting, Auth Key: ".concat(F)),console.log("Widget Enabled is set to: ".concat(W)),console.log("Highlight Mode is set to: ".concat(Q)),a=Y,console.log("Matched Recommendations? ".concat(a.length>0)),console.log("page-specific recommendations: ".concat(a.length));break;case"version":try{console.log(n(2).version)}catch(t){console.log("Version Unknown")}break;default:o("No handler defined for ".concat(t))}var a},X=function(){var t=new URLSearchParams(window.location.search);return W="disabled"!==t.get("alli")&&-1===navigator.userAgent.indexOf("AlliAI"),document.body.setAttribute("data-a11i-enabled",W),W},Z=function(){var t=new URLSearchParams(window.location.search);Q=!!t.get("highlight")};$(window)}]);