File: /var/www/html/wp-content/plugins/complianz-gdpr/shepherd/tether-shepherd/shepherd.min.js
/*! tether-shepherd 1.8.1 */
(function(a,b){if(typeof define==="function"&&define.amd){define(["tether"],b)}else{if(typeof exports==="object"){module.exports=b(require("tether"))}else{a.Shepherd=b(a.Tether)}}}(this,function(g){var v=(function(){function A(E,C){for(var B=0;B<C.length;B++){var D=C[B];D.enumerable=D.enumerable||false;D.configurable=true;if("value" in D){D.writable=true}Object.defineProperty(E,D.key,D)}}return function(D,B,C){if(B){A(D.prototype,B)}if(C){A(D,C)}return D}})();var a=function y(F,E,C){var G=true;_function:while(G){var B=F,J=E,A=C;G=false;if(B===null){B=Function.prototype}var D=Object.getOwnPropertyDescriptor(B,J);if(D===undefined){var I=Object.getPrototypeOf(B);if(I===null){return undefined}else{F=I;E=J;C=A;G=true;D=I=undefined;continue _function}}else{if("value" in D){return D.value}else{var H=D.get;if(H===undefined){return undefined}return H.call(A)}}}};function f(A,B){if(!(A instanceof B)){throw new TypeError("Cannot call a class as a function")}}function t(B,A){if(typeof A!=="function"&&A!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof A)}B.prototype=Object.create(A&&A.prototype,{constructor:{value:B,enumerable:false,writable:true,configurable:true}});if(A){Object.setPrototypeOf?Object.setPrototypeOf(B,A):B.__proto__=A}}var e=g.Utils;var s=e.Evented;var l=e.addClass;var x=e.extend;var c=e.hasClass;var p=e.removeClass;var j=e.uniqueId;var u=new s();function d(A){return typeof A==="undefined"}function k(A){return A&&A.constructor===Array}function i(A){return A&&A.constructor===Object}function z(A){return typeof A==="object"}var r={"top right":"bottom left","top left":"bottom right","top center":"bottom center","middle right":"middle left","middle left":"middle right","middle center":"middle center","bottom left":"top right","bottom right":"top left","bottom center":"top center",top:"bottom center",left:"middle right",right:"middle left",bottom:"top center",center:"middle center",middle:"middle center"};function w(A){var B=document.createElement("div");B.innerHTML=A;return B.children[0]}function b(A,C){var B=undefined;if(!d(A.matches)){B=A.matches}else{if(!d(A.matchesSelector)){B=A.matchesSelector}else{if(!d(A.msMatchesSelector)){B=A.msMatchesSelector}else{if(!d(A.webkitMatchesSelector)){B=A.webkitMatchesSelector}else{if(!d(A.mozMatchesSelector)){B=A.mozMatchesSelector}else{if(!d(A.oMatchesSelector)){B=A.oMatchesSelector}}}}}}return B.call(A,C)}var o=/^(.+) (top|left|right|bottom|center|\[[a-z ]+\])$/;function q(C){if(z(C)){if(C.hasOwnProperty("element")&&C.hasOwnProperty("on")){return C}return null}var B=o.exec(C);if(!B){return null}var A=B[2];if(A[0]==="["){A=A.substring(1,A.length-1)}return{element:B[1],on:A}}function n(F,D){if(F===null||d(F)){return F}else{if(z(F)){return F}}var E=F.split(" ");var B={};var A=D.length-1;for(var C=E.length-1;C>=0;C--){if(A===0){B[D[A]]=E.slice(0,C+1).join(" ");break}else{B[D[A]]=E[C]}A--}return B}var m=(function(B){t(I,B);function I(U,T){f(this,I);a(Object.getPrototypeOf(I.prototype),"constructor",this).call(this,U,T);this.tour=U;this.bindMethods();this.setOptions(T);return this}v(I,[{key:"bindMethods",value:function O(){var U=this;var T=["_show","show","hide","isOpen","cancel","complete","scrollTo","destroy","render"];T.map(function(V){U[V]=U[V].bind(U)})}},{key:"setOptions",value:function P(){var ab=arguments.length<=0||arguments[0]===undefined?{}:arguments[0];this.options=ab;this.destroy();this.id=this.options.id||this.id||"step-"+j();var Y=this.options.when;if(Y){for(var V in Y){if(({}).hasOwnProperty.call(Y,V)){var aa=Y[V];this.on(V,aa,this)}}}var T=JSON.stringify(this.options.buttons);var W=d(T)||T==="true";var X=T==="{}"||T==="[]"||T==="null"||T==="false";var Z=!W&&k(this.options.buttons);var U=!W&&i(this.options.buttons);if(W){this.options.buttons=[{text:"Next",action:this.tour.next,classes:"btn"}]}else{if(!X&&U){this.options.buttons=[this.options.buttons]}else{if(X||!Z){this.options.buttons=false}}}}},{key:"getTour",value:function N(){return this.tour}},{key:"bindAdvance",value:function F(){var X=this;var W=n(this.options.advanceOn,["selector","event"]);var V=W.event;var T=W.selector;var U=function U(Y){if(!X.isOpen()){return}if(!d(T)){if(b(Y.target,T)){X.tour.next()}}else{if(X.el&&Y.target===X.el){X.tour.next()}}};document.body.addEventListener(V,U);this.on("destroy",function(){return document.body.removeEventListener(V,U)})}},{key:"getAttachTo",value:function H(){var U=q(this.options.attachTo)||{};var T=x({},U);if(typeof U.element==="string"){T.element=document.querySelector(U.element);if(!T.element){console.error("The element for this Shepherd step was not found "+U.element)}}return T}},{key:"setupTether",value:function M(){if(d(g)){throw new Error("Using the attachment feature of Shepherd requires the Tether library")}var U=this.getAttachTo();var V=r[U.on]||r.right;if(d(U.element)){U.element="viewport";V="middle center"}var T={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:true,attachment:"together"}],target:U.element,offset:U.offset||"0 0",attachment:V};if(this.tether){this.tether.destroy()}this.tether=new g(x(T,this.options.tetherOptions))}},{key:"show",value:function Q(){var T=this;if(!d(this.options.beforeShowPromise)){var U=this.options.beforeShowPromise();if(!d(U)){return U.then(function(){return T._show()})}}this._show()}},{key:"_show",value:function J(){var T=this;this.trigger("before-show");if(!this.el){this.render()}l(this.el,"shepherd-open");document.body.setAttribute("data-shepherd-step",this.id);this.setupTether();if(this.options.scrollTo){setTimeout(function(){T.scrollTo()})}this.trigger("show")}},{key:"hide",value:function G(){this.trigger("before-hide");p(this.el,"shepherd-open");document.body.removeAttribute("data-shepherd-step");if(this.tether){this.tether.destroy()}this.tether=null;this.trigger("hide")}},{key:"isOpen",value:function L(){return this.el&&c(this.el,"shepherd-open")}},{key:"cancel",value:function E(){this.tour.cancel();this.trigger("cancel")}},{key:"complete",value:function K(){this.tour.complete();this.trigger("complete")}},{key:"scrollTo",value:function C(){var U=this.getAttachTo();var T=U.element;if(!d(this.options.scrollToHandler)){this.options.scrollToHandler(T)}else{if(!d(T)){T.scrollIntoView()}}}},{key:"destroy",value:function R(){if(!d(this.el)&&this.el.parentNode){this.el.parentNode.removeChild(this.el);delete this.el}if(this.tether){this.tether.destroy()}this.tether=null;this.trigger("destroy")}},{key:"render",value:function S(){var T=this;if(!d(this.el)){this.destroy()}this.el=w("<div class='shepherd-step "+(this.options.classes||"")+"' data-id='"+this.id+"' "+(this.options.idAttribute?'id="'+this.options.idAttribute+'"':"")+"></div>");var V=document.createElement("div");V.className="shepherd-content";this.el.appendChild(V);var W=document.createElement("header");V.appendChild(W);if(this.options.title){W.innerHTML+="<h3 class='shepherd-title'>"+this.options.title+"</h3>";this.el.className+=" shepherd-has-title"}if(this.options.showCancelLink){var U=w("<a href class='shepherd-cancel-link'>✕</a>");W.appendChild(U);this.el.className+=" shepherd-has-cancel-link";this.bindCancelLink(U)}if(!d(this.options.text)){(function(){var Y=w("<div class='shepherd-text'></div>");var X=T.options.text;if(typeof X==="function"){X=X.call(T,Y)}if(X instanceof HTMLElement){Y.appendChild(X)}else{if(typeof X==="string"){X=[X]}X.map(function(Z){Y.innerHTML+="<p>"+Z+"</p>"})}V.appendChild(Y)})()}if(this.options.buttons){(function(){var Y=document.createElement("footer");var X=w("<ul class='shepherd-buttons'></ul>");T.options.buttons.map(function(Z){var aa=w("<li><a class='shepherd-button "+(Z.classes||"")+"'>"+Z.text+"</a>");X.appendChild(aa);T.bindButtonEvents(Z,aa.querySelector("a"))});Y.appendChild(X);V.appendChild(Y)})()}document.body.appendChild(this.el);this.setupTether();if(this.options.advanceOn){this.bindAdvance()}}},{key:"bindCancelLink",value:function D(U){var T=this;U.addEventListener("click",function(V){V.preventDefault();T.cancel()})}},{key:"bindButtonEvents",value:function A(U,W){var T=this;U.events=U.events||{};if(!d(U.action)){U.events.click=U.action}for(var X in U.events){if(({}).hasOwnProperty.call(U.events,X)){var V=U.events[X];if(typeof V==="string"){(function(){var Y=V;V=function(){return T.tour.show(Y)}})()}W.addEventListener(X,V)}}this.on("destroy",function(){for(var Z in U.events){if(({}).hasOwnProperty.call(U.events,Z)){var Y=U.events[Z];W.removeEventListener(Z,Y)}}})}}]);return I})(s);var h=(function(N){t(J,N);function J(){var P=this;var Q=arguments.length<=0||arguments[0]===undefined?{}:arguments[0];f(this,J);a(Object.getPrototypeOf(J.prototype),"constructor",this).call(this,Q);this.bindMethods();this.options=Q;this.steps=this.options.steps||[];var R=["complete","cancel","hide","start","show","active","inactive"];R.map(function(S){(function(T){P.on(T,function(U){U=U||{};U.tour=P;u.trigger(T,U)})})(S)});return this}v(J,[{key:"bindMethods",value:function A(){var Q=this;var P=["next","back","cancel","complete","hide"];P.map(function(R){Q[R]=Q[R].bind(Q)})}},{key:"addStep",value:function D(P,Q){if(d(Q)){Q=P}if(!(Q instanceof m)){if(typeof P==="string"||typeof P==="number"){Q.id=P.toString()}Q=x({},this.options.defaults,Q);Q=new m(this,Q)}else{Q.tour=this}this.steps.push(Q);return this}},{key:"removeStep",value:function E(P){var S=this.getCurrentStep();for(var Q=0;Q<this.steps.length;++Q){var R=this.steps[Q];if(R.id===P){if(R.isOpen()){R.hide()}R.destroy();this.steps.splice(Q,1);break}}if(S&&S.id===P){this.currentStep=undefined;if(this.steps.length){this.show(0)}else{this.hide()}}}},{key:"getById",value:function O(R){for(var P=0;P<this.steps.length;++P){var Q=this.steps[P];if(Q.id===R){return Q}}}},{key:"getCurrentStep",value:function M(){return this.currentStep}},{key:"next",value:function H(){var P=this.steps.indexOf(this.currentStep);if(P===this.steps.length-1){this.hide(P);this.trigger("complete");this.done()}else{this.show(P+1,true)}}},{key:"back",value:function G(){var P=this.steps.indexOf(this.currentStep);this.show(P-1,false)}},{key:"cancel",value:function L(){if(this.currentStep){this.currentStep.hide()}this.trigger("cancel");this.done()}},{key:"complete",value:function C(){if(this.currentStep){this.currentStep.hide()}this.trigger("complete");this.done()}},{key:"hide",value:function I(){if(this.currentStep){this.currentStep.hide()}this.trigger("hide");this.done()}},{key:"done",value:function F(){u.activeTour=null;p(document.body,"shepherd-active");this.trigger("inactive",{tour:this})}},{key:"show",value:function K(){var S=arguments.length<=0||arguments[0]===undefined?0:arguments[0];var R=arguments.length<=1||arguments[1]===undefined?true:arguments[1];if(this.currentStep){this.currentStep.hide()}else{l(document.body,"shepherd-active");this.trigger("active",{tour:this})}u.activeTour=this;var T=undefined;if(typeof S==="string"){T=this.getById(S)}else{T=this.steps[S]}if(T){if(!d(T.options.showOn)&&!T.options.showOn()){var Q=this.steps.indexOf(T);var P=R?Q+1:Q-1;this.show(P,R)}else{this.trigger("show",{step:T,previous:this.currentStep});if(this.currentStep){this.currentStep.hide()}this.currentStep=T;T.show()}}}},{key:"start",value:function B(){this.trigger("start");this.currentStep=null;this.next()}}]);return J})(s);x(u,{Tour:h,Step:m,Evented:s});return u}));