(function(){'use strict';var d;function e(a){var c=0;return function(){return c<a.length?{done:!1,value:a[c++]}:{done:!0}}}var f="function"==typeof Object.create?Object.create:function(a){function c(){}c.prototype=a;return new c};function g(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var c=0;c<a.length;++c){var b=a[c];if(b&&b.Math==Math)return b}throw Error("Cannot find global object");}var l=g(this),m;
if("function"==typeof Object.setPrototypeOf)m=Object.setPrototypeOf;else{var p;a:{var q={a:!0},r={};try{r.__proto__=q;p=r.a;break a}catch(a){}p=!1}m=p?function(a,c){a.__proto__=c;if(a.__proto__!==c)throw new TypeError(a+" is not extensible");return a}:null}var t=m;function u(){for(var a=Number(this),c=[],b=a;b<arguments.length;b++)c[b-a]=arguments[b];return c};function w(a,c,b){switch(a.getAttribute(c)){case "true":return!0;case "false":return!1;default:return b}};function x(a){var c=!1,b=null;return function(){c=!0;b||(c&&(a(),c=!1),b=window.setTimeout(function(){b=null;c&&(a(),c=!1)},100))}};var y=["data-gwd-fit-font-size","fit-font-size-for-selector","gwd-fitting-truncate","gwd-min-font-size-px"];function z(){var a=HTMLElement.call(this)||this;a.i=":not(*)";a.l=a.A.bind(a);a.m=a.B.bind(a);a.h=a.u.bind(a);a.o=x(a.s.bind(a));a.j=a.v.bind(a);return a}var A=HTMLElement;z.prototype=f(A.prototype);z.prototype.constructor=z;if(t)t(z,A);else for(var B in A)if("prototype"!=B)if(Object.defineProperties){var C=Object.getOwnPropertyDescriptor(A,B);C&&Object.defineProperty(z,B,C)}else z[B]=A[B];
d=z.prototype;d.connectedCallback=function(){document.body.classList.contains("htmlNoPages")&&window.addEventListener("load",this.j);document.addEventListener("pagetransitionstart",this.m);document.addEventListener("pagepresenting",this.l);document.addEventListener("adinitialized",this.h)};
d.disconnectedCallback=function(){document.removeEventListener("pagetransitionstart",this.m);document.removeEventListener("pagepresenting",this.l);document.removeEventListener("adinitialized",this.h);window.removeEventListener("resize",this.o,!1);window.removeEventListener("load",this.j)};
d.attributeChangedCallback=function(a,c,b){switch(a){case "data-gwd-fit-font-size":a=w(this,a,!0);this.g("textfitting","setFontSizeReductionEnabled",a);break;case "fit-font-size-for-selector":this.i=b||":not(*)";break;case "gwd-min-font-size-px":a=parseInt(this.getAttribute(a),10);isNaN(a)&&(a=10);this.g("textfitting","setMinFontSizePx",a);break;case "gwd-fitting-truncate":a=w(this,a,!1),this.g("textfitting","setTruncationEnabled",a)}};
d.v=function(){this.g("texteffects","initializeEffectsForPage",document.body);this.g("texteffects","playEffectsForPage",document.body)};d.u=function(){document.removeEventListener("adinitialized",this.h);this.refitAll();window.addEventListener("resize",this.o,!1)};d.B=function(a){"gwd-pagedeck"==a.target.tagName.toLowerCase()&&(this.fit(D(this,a.target)),a=a.target.getCurrentPage(),this.g("texteffects","initializeEffectsForPage",a))};d.A=function(a){this.g("texteffects","playEffectsForPage",a.target)};
d.saveInitialText=function(a){this.g("textfitting","saveInitialText",a)};d.applyStylePreservation=function(a){this.g("textfitting","applyStylePreservation",a)};d.saveStyleOverride=function(a,c,b){this.g("textfitting","saveStyleOverride",a,c,b)};d.fit=function(a){this.g("textfitting","fit",a||D(this,document))};function D(a,c){return Array.prototype.slice.call(c.querySelectorAll(a.i)).filter(function(b){return b!==a})}d.s=function(){this.refitAll()};
d.refitAll=function(){this.g("textfitting","unfitAll");this.fit()};d.g=function(a,c){var b=u.apply(2,arguments),h,n;if(null!=(h=window.gwd)&&null!=(n=h[a])){h=n[c];var E=h.apply;if(!(b instanceof Array)){var k="undefined"!=typeof Symbol&&Symbol.iterator&&b[Symbol.iterator];if(k)b=k.call(b);else if("number"==typeof b.length)b={next:e(b)};else throw Error(String(b)+" is not an iterable or ArrayLike");for(var v=[];!(k=b.next()).done;)v.push(k.value);b=v}E.call(h,n,b)}};
l.Object.defineProperties(z,{observedAttributes:{configurable:!0,enumerable:!0,get:function(){return y}}});customElements.define("gwd-text-helper",z);}).call(this);
