(() => { const __PAGEWORKERS_WEBSITE_ID__ = "5PVBRL"; const __PAGEWORKERS_BASE_TAG_URL__ = "https://tags.pw.adn.cloud/5PVBRL"; const __PAGEWORKERS_DELIVERY_API_HOST__ = "deliveryapi-tx4-27161589503.us-central1.run.app"; const __PAGEWORKERS_ENABLE_MODULES_RERUNS__ = true; const __PAGEWORKERS_MAXIMUM_MODULES_RERUNS_COUNT__ = 5; const __PAGEWORKERS_MAXIMUM_MODULES_RERUNS_DURATION__ = 2500; const __PAGEWORKERS_URL_MANAGER_MODULES_RERUN_DELAY__ = 2500; const __PAGEWORKERS_TAG_VERSION__ = "v3.2.2"; (function(){"use strict";var Context,Device,DeviceContextAll,ScopeType,PageEditorActionType,CssInsertStrategy,InjectionWithReplaceStrategy,PageEditorExtractStrategy,TransformationsTypes,ModuleType,Environment;!function(e){e.ALWAYS="always",e.BOTS_ONLY="botsOnly"}(Context||(Context={})),function(e){e.DESKTOP="desktop",e.MOBILE="mobile"}(Device||(Device={})),function(e){e.ALL="all"}(DeviceContextAll||(DeviceContextAll={})),function(e){e.ALL="all",e.MAPPING="mapping",e.PATTERN="pattern"}(ScopeType||(ScopeType={})),function(e){e.TITLE="title",e.H1="h1",e.DESCRIPTION="description",e.CANONICAL="canonical",e.ELEMENT_INNER_HTML="elementInnerHtml"}(PageEditorActionType||(PageEditorActionType={})),function(e){e.PREPEND="prepend",e.APPEND="append",e.INSERT_AFTER="insertAfter",e.INSERT_BEFORE="insertBefore"}(CssInsertStrategy||(CssInsertStrategy={})),function(e){e.PREPEND="prepend",e.APPEND="append",e.INSERT_AFTER="insertAfter",e.INSERT_BEFORE="insertBefore",e.REPLACE="replace",e.REPLACE_ELEMENT="replaceElement"}(InjectionWithReplaceStrategy||(InjectionWithReplaceStrategy={})),function(e){e.GET_ELEMENT_INNER_TEXT="getElementInnerText",e.GET_ELEMENT_INNER_HTML="getElementInnerHtml",e.GET_ELEMENT_ATTRIBUTE="getElementAttribute"}(PageEditorExtractStrategy||(PageEditorExtractStrategy={})),function(e){e.FIELD="field",e.TEMPLATE="template"}(TransformationsTypes||(TransformationsTypes={})),function(e){e.CUSTOM_JS="custom_js",e.PAGE_EDITOR="page_editor",e.REDIRECT="redirect",e.REMOVE_LINKS="remove_links",e.NO_FOLLOW_LINKS="no_follow_links"}(ModuleType||(ModuleType={})),function(e){e.BROWSER="browser",e.DISPATCHER="dispatcher",e.CONTENT_SUBMIT="contentSubmit",e.TEST="test"}(Environment||(Environment={}));var extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},extendStatics(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var __assign=function(){return __assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]":">"},s=/[&"'<>]/g;function a(e,t){return i.hasOwnProperty.call(e,t)}function c(e){return o[e]}function l(e,t,n){var r,i,o;if(e instanceof Error&&(e=(i=e).name+": "+i.message),Object.setPrototypeOf?(r=new Error(e),Object.setPrototypeOf(r,l.prototype)):(r=this,Object.defineProperty(r,"message",{enumerable:!1,writable:!0,value:e})),Object.defineProperty(r,"name",{value:"Template render error"}),Error.captureStackTrace&&Error.captureStackTrace(r,this.constructor),i){var s=Object.getOwnPropertyDescriptor(i,"stack");(o=s&&(s.get||function(){return s.value}))||(o=function(){return i.stack})}else{var a=new Error(e).stack;o=function(){return a}}return Object.defineProperty(r,"stack",{get:function(){return o.call(r)}}),Object.defineProperty(r,"cause",{value:i}),r.lineno=t,r.colno=n,r.firstUpdate=!0,r.Update=function(e){var t="("+(e||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?t+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(t+=" [Line "+this.lineno+"]")),t+="\n ",this.firstUpdate&&(t+=" "),this.message=t+(this.message||""),this.firstUpdate=!1,this},r}function u(e){return"[object Function]"===i.toString.call(e)}function h(e){return"[object Array]"===i.toString.call(e)}function p(e){return"[object String]"===i.toString.call(e)}function d(e){return"[object Object]"===i.toString.call(e)}function f(e){var t,n=(t=e)?"string"==typeof t?t.split("."):[t]:[];return function(e){for(var t=e,r=0;re.length)s=i.slice(0,e.length),i.slice(s.length,l).forEach(function(e,n){n2?i-2:0),s=2;s0||!n)&&process.stdout.write(" ".repeat(t));var o=i===r.length-1?"":"\n";process.stdout.write(""+e+o)})}e.exports={Node:c,Root:h,NodeList:u,Value:l,Literal:p,Symbol:d,Group:f,Array:m,Pair:g,Dict:_,Output:K,Capture:G,TemplateData:W,If:E,IfAsync:y,InlineIf:b,For:A,AsyncEach:T,AsyncAll:k,Macro:M,Caller:w,Import:O,FromImport:L,FunCall:S,Filter:R,FilterAsync:x,KeywordArgs:N,Block:I,Super:C,Extends:D,Include:P,Set:B,Switch:F,Case:U,LookupVal:v,BinOp:H,In:V,Is:$,Or:Y,And:z,Not:X,Add:q,Concat:J,Sub:Q,Mul:Z,Div:ee,FloorDiv:te,Mod:ne,Pow:re,Neg:ie,Pos:oe,Compare:se,CompareOperand:ae,CallExtension:ce,CallExtensionAsync:le,printNodes:function e(t,n){if(n=n||0,ue(t.typename+": ",n),t instanceof u)ue("\n"),t.children.forEach(function(t){e(t,n+2)});else if(t instanceof ce)ue(t.extName+"."+t.prop+"\n"),t.args&&e(t.args,n+2),t.contentArgs&&t.contentArgs.forEach(function(t){e(t,n+2)});else{var r=[],i=null;t.iterFields(function(e,t){e instanceof c?r.push([t,e]):(i=i||{})[t]=e}),i?ue(JSON.stringify(i,null,2)+"\n",null,!0):ue("\n"),r.forEach(function(t){var r=t[0],i=t[1];ue("["+r+"] =>",n+2),e(i,n+4)})}}}},function(e,t){},function(e,t,n){function r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}var i=n(8),o=n(17),s=n(3),a=n(0).TemplateError,c=n(2).Frame,l=n(1).Obj,u={"==":"==","===":"===","!=":"!=","!==":"!==","<":"<",">":">","<=":"<=",">=":">="},h=function(e){var t,n;function i(){return e.apply(this,arguments)||this}n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,r(t,n);var o=i.prototype;return o.init=function(e,t){this.templateName=e,this.codebuf=[],this.lastId=0,this.buffer=null,this.bufferStack=[],this._scopeClosers="",this.inBlock=!1,this.throwOnUndefined=t},o.fail=function(e,t,n){throw void 0!==t&&(t+=1),void 0!==n&&(n+=1),new a(e,t,n)},o._pushBuffer=function(){var e=this._tmpid();return this.bufferStack.push(this.buffer),this.buffer=e,this._emit("var "+this.buffer+' = "";'),e},o._popBuffer=function(){this.buffer=this.bufferStack.pop()},o._emit=function(e){this.codebuf.push(e)},o._emitLine=function(e){this._emit(e+"\n")},o._emitLines=function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r0&&i._emit(","),i.compile(e,t)}),r&&this._emit(r)},o._compileExpression=function(e,t){this.assertType(e,s.Literal,s.Symbol,s.Group,s.Array,s.Dict,s.FunCall,s.Caller,s.Filter,s.LookupVal,s.Compare,s.InlineIf,s.In,s.Is,s.And,s.Or,s.Not,s.Add,s.Concat,s.Sub,s.Mul,s.Div,s.FloorDiv,s.Mod,s.Pow,s.Neg,s.Pos,s.Compare,s.NodeList),this.compile(e,t)},o.assertType=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r0&&r._emit(","),e){r._emitLine("function(cb) {"),r._emitLine("if(!cb) { cb = function(err) { if(err) { throw err; }}}");var i=r._pushBuffer();r._withScopedSyntax(function(){r.compile(e,t),r._emitLine("cb(null, "+i+");")}),r._popBuffer(),r._emitLine("return "+i+";"),r._emitLine("}")}else r._emit("null")}),n){var c=this._tmpid();this._emitLine(", "+this._makeCallback(c)),this._emitLine(this.buffer+" += runtime.suppressValue("+c+", "+a+" && env.opts.autoescape);"),this._addScopeLevel()}else this._emit(")"),this._emit(", "+a+" && env.opts.autoescape);\n")},o.compileCallExtensionAsync=function(e,t){this.compileCallExtension(e,t,!0)},o.compileNodeList=function(e,t){this._compileChildren(e,t)},o.compileLiteral=function(e){if("string"==typeof e.value){var t=e.value.replace(/\\/g,"\\\\");t=(t=(t=(t=(t=t.replace(/"/g,'\\"')).replace(/\n/g,"\\n")).replace(/\r/g,"\\r")).replace(/\t/g,"\\t")).replace(/\u2028/g,"\\u2028"),this._emit('"'+t+'"')}else null===e.value?this._emit("null"):this._emit(e.value.toString())},o.compileSymbol=function(e,t){var n=e.value,r=t.lookup(n);r?this._emit(r):this._emit('runtime.contextOrFrameLookup(context, frame, "'+n+'")')},o.compileGroup=function(e,t){this._compileAggregate(e,t,"(",")")},o.compileArray=function(e,t){this._compileAggregate(e,t,"[","]")},o.compileDict=function(e,t){this._compileAggregate(e,t,"{","}")},o.compilePair=function(e,t){var n=e.key,r=e.value;n instanceof s.Symbol?n=new s.Literal(n.lineno,n.colno,n.value):n instanceof s.Literal&&"string"==typeof n.value||this.fail("compilePair: Dict keys must be strings or names",n.lineno,n.colno),this.compile(n,t),this._emit(": "),this._compileExpression(r,t)},o.compileInlineIf=function(e,t){this._emit("("),this.compile(e.cond,t),this._emit("?"),this.compile(e.body,t),this._emit(":"),null!==e.else_?this.compile(e.else_,t):this._emit('""'),this._emit(")")},o.compileIn=function(e,t){this._emit("runtime.inOperator("),this.compile(e.left,t),this._emit(","),this.compile(e.right,t),this._emit(")")},o.compileIs=function(e,t){var n=e.right.name?e.right.name.value:e.right.value;this._emit('env.getTest("'+n+'").call(context, '),this.compile(e.left,t),e.right.args&&(this._emit(","),this.compile(e.right.args,t)),this._emit(") === true")},o._binOpEmitter=function(e,t,n){this.compile(e.left,t),this._emit(n),this.compile(e.right,t)},o.compileOr=function(e,t){return this._binOpEmitter(e,t," || ")},o.compileAnd=function(e,t){return this._binOpEmitter(e,t," && ")},o.compileAdd=function(e,t){return this._binOpEmitter(e,t," + ")},o.compileConcat=function(e,t){return this._binOpEmitter(e,t,' + "" + ')},o.compileSub=function(e,t){return this._binOpEmitter(e,t," - ")},o.compileMul=function(e,t){return this._binOpEmitter(e,t," * ")},o.compileDiv=function(e,t){return this._binOpEmitter(e,t," / ")},o.compileMod=function(e,t){return this._binOpEmitter(e,t," % ")},o.compileNot=function(e,t){this._emit("!"),this.compile(e.target,t)},o.compileFloorDiv=function(e,t){this._emit("Math.floor("),this.compile(e.left,t),this._emit(" / "),this.compile(e.right,t),this._emit(")")},o.compilePow=function(e,t){this._emit("Math.pow("),this.compile(e.left,t),this._emit(", "),this.compile(e.right,t),this._emit(")")},o.compileNeg=function(e,t){this._emit("-"),this.compile(e.target,t)},o.compilePos=function(e,t){this._emit("+"),this.compile(e.target,t)},o.compileCompare=function(e,t){var n=this;this.compile(e.expr,t),e.ops.forEach(function(e){n._emit(" "+u[e.type]+" "),n.compile(e.expr,t)})},o.compileLookupVal=function(e,t){this._emit("runtime.memberLookup(("),this._compileExpression(e.target,t),this._emit("),"),this._compileExpression(e.val,t),this._emit(")")},o._getNodeName=function(e){switch(e.typename){case"Symbol":return e.value;case"FunCall":return"the return value of ("+this._getNodeName(e.name)+")";case"LookupVal":return this._getNodeName(e.target)+'["'+this._getNodeName(e.val)+'"]';case"Literal":return e.value.toString();default:return"--expression--"}},o.compileFunCall=function(e,t){this._emit("(lineno = "+e.lineno+", colno = "+e.colno+", "),this._emit("runtime.callWrap("),this._compileExpression(e.name,t),this._emit(', "'+this._getNodeName(e.name).replace(/"/g,'\\"')+'", context, '),this._compileAggregate(e.args,t,"[","])"),this._emit(")")},o.compileFilter=function(e,t){var n=e.name;this.assertType(n,s.Symbol),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(e.args,t),this._emit(")")},o.compileFilterAsync=function(e,t){var n=e.name,r=e.symbol.value;this.assertType(n,s.Symbol),t.set(r,r),this._emit('env.getFilter("'+n.value+'").call(context, '),this._compileAggregate(e.args,t),this._emitLine(", "+this._makeCallback(r)),this._addScopeLevel()},o.compileKeywordArgs=function(e,t){this._emit("runtime.makeKeywordArgs("),this.compileDict(e,t),this._emit(")")},o.compileSet=function(e,t){var n=this,r=[];e.targets.forEach(function(e){var i=e.value,o=t.lookup(i);null==o&&(o=n._tmpid(),n._emitLine("var "+o+";")),r.push(o)}),e.value?(this._emit(r.join(" = ")+" = "),this._compileExpression(e.value,t),this._emitLine(";")):(this._emit(r.join(" = ")+" = "),this.compile(e.body,t),this._emitLine(";")),e.targets.forEach(function(e,t){var i=r[t],o=e.value;n._emitLine('frame.set("'+o+'", '+i+", true);"),n._emitLine("if(frame.topLevel) {"),n._emitLine('context.setVariable("'+o+'", '+i+");"),n._emitLine("}"),"_"!==o.charAt(0)&&(n._emitLine("if(frame.topLevel) {"),n._emitLine('context.addExport("'+o+'", '+i+");"),n._emitLine("}"))})},o.compileSwitch=function(e,t){var n=this;this._emit("switch ("),this.compile(e.expr,t),this._emit(") {"),e.cases.forEach(function(e,r){n._emit("case "),n.compile(e.cond,t),n._emit(": "),n.compile(e.body,t),e.body.children.length&&n._emitLine("break;")}),e.default&&(this._emit("default:"),this.compile(e.default,t)),this._emit("}")},o.compileIf=function(e,t,n){var r=this;this._emit("if("),this._compileExpression(e.cond,t),this._emitLine(") {"),this._withScopedSyntax(function(){r.compile(e.body,t),n&&r._emit("cb()")}),e.else_?(this._emitLine("}\nelse {"),this._withScopedSyntax(function(){r.compile(e.else_,t),n&&r._emit("cb()")})):n&&(this._emitLine("}\nelse {"),this._emit("cb()")),this._emitLine("}")},o.compileIfAsync=function(e,t){this._emit("(function(cb) {"),this.compileIf(e,t,!0),this._emit("})("+this._makeCallback()),this._addScopeLevel()},o._emitLoopBindings=function(e,t,n,r){var i=this;[{name:"index",val:n+" + 1"},{name:"index0",val:n},{name:"revindex",val:r+" - "+n},{name:"revindex0",val:r+" - "+n+" - 1"},{name:"first",val:n+" === 0"},{name:"last",val:n+" === "+r+" - 1"},{name:"length",val:r}].forEach(function(e){i._emitLine('frame.set("loop.'+e.name+'", '+e.val+");")})},o.compileFor=function(e,t){var n=this,r=this._tmpid(),i=this._tmpid(),o=this._tmpid();if(t=t.push(),this._emitLine("frame = frame.push();"),this._emit("var "+o+" = "),this._compileExpression(e.arr,t),this._emitLine(";"),this._emit("if("+o+") {"),this._emitLine(o+" = runtime.fromIterator("+o+");"),e.name instanceof s.Array){this._emitLine("var "+r+";"),this._emitLine("if(runtime.isArray("+o+")) {"),this._emitLine("var "+i+" = "+o+".length;"),this._emitLine("for("+r+"=0; "+r+" < "+o+".length; "+r+"++) {"),e.name.children.forEach(function(i,s){var a=n._tmpid();n._emitLine("var "+a+" = "+o+"["+r+"]["+s+"];"),n._emitLine('frame.set("'+i+'", '+o+"["+r+"]["+s+"]);"),t.set(e.name.children[s].value,a)}),this._emitLoopBindings(e,o,r,i),this._withScopedSyntax(function(){n.compile(e.body,t)}),this._emitLine("}"),this._emitLine("} else {");var a=e.name.children,c=a[0],l=a[1],u=this._tmpid(),h=this._tmpid();t.set(c.value,u),t.set(l.value,h),this._emitLine(r+" = -1;"),this._emitLine("var "+i+" = runtime.keys("+o+").length;"),this._emitLine("for(var "+u+" in "+o+") {"),this._emitLine(r+"++;"),this._emitLine("var "+h+" = "+o+"["+u+"];"),this._emitLine('frame.set("'+c.value+'", '+u+");"),this._emitLine('frame.set("'+l.value+'", '+h+");"),this._emitLoopBindings(e,o,r,i),this._withScopedSyntax(function(){n.compile(e.body,t)}),this._emitLine("}"),this._emitLine("}")}else{var p=this._tmpid();t.set(e.name.value,p),this._emitLine("var "+i+" = "+o+".length;"),this._emitLine("for(var "+r+"=0; "+r+" < "+o+".length; "+r+"++) {"),this._emitLine("var "+p+" = "+o+"["+r+"];"),this._emitLine('frame.set("'+e.name.value+'", '+p+");"),this._emitLoopBindings(e,o,r,i),this._withScopedSyntax(function(){n.compile(e.body,t)}),this._emitLine("}")}this._emitLine("}"),e.else_&&(this._emitLine("if (!"+i+") {"),this.compile(e.else_,t),this._emitLine("}")),this._emitLine("frame = frame.pop();")},o._compileAsyncLoop=function(e,t,n){var r=this,i=this._tmpid(),o=this._tmpid(),a=this._tmpid(),c=n?"asyncAll":"asyncEach";if(t=t.push(),this._emitLine("frame = frame.push();"),this._emit("var "+a+" = runtime.fromIterator("),this._compileExpression(e.arr,t),this._emitLine(");"),e.name instanceof s.Array){var l=e.name.children.length;this._emit("runtime."+c+"("+a+", "+l+", function("),e.name.children.forEach(function(e){r._emit(e.value+",")}),this._emit(i+","+o+",next) {"),e.name.children.forEach(function(e){var n=e.value;t.set(n,n),r._emitLine('frame.set("'+n+'", '+n+");")})}else{var u=e.name.value;this._emitLine("runtime."+c+"("+a+", 1, function("+u+", "+i+", "+o+",next) {"),this._emitLine('frame.set("'+u+'", '+u+");"),t.set(u,u)}this._emitLoopBindings(e,a,i,o),this._withScopedSyntax(function(){var o;n&&(o=r._pushBuffer()),r.compile(e.body,t),r._emitLine("next("+i+(o?","+o:"")+");"),n&&r._popBuffer()});var h=this._tmpid();this._emitLine("}, "+this._makeCallback(h)),this._addScopeLevel(),n&&this._emitLine(this.buffer+" += "+h+";"),e.else_&&(this._emitLine("if (!"+a+".length) {"),this.compile(e.else_,t),this._emitLine("}")),this._emitLine("frame = frame.pop();")},o.compileAsyncEach=function(e,t){this._compileAsyncLoop(e,t)},o.compileAsyncAll=function(e,t){this._compileAsyncLoop(e,t,!0)},o._compileMacro=function(e,t){var n=this,r=[],i=null,o="macro_"+this._tmpid(),a=void 0!==t;e.args.children.forEach(function(t,o){o===e.args.children.length-1&&t instanceof s.Dict?i=t:(n.assertType(t,s.Symbol),r.push(t))});var l,u=[].concat(r.map(function(e){return"l_"+e.value}),["kwargs"]),h=r.map(function(e){return'"'+e.value+'"'}),p=(i&&i.children||[]).map(function(e){return'"'+e.key.value+'"'});l=a?t.push(!0):new c,this._emitLines("var "+o+" = runtime.makeMacro(","["+h.join(", ")+"], ","["+p.join(", ")+"], ","function ("+u.join(", ")+") {","var callerFrame = frame;","frame = "+(a?"frame.push(true);":"new runtime.Frame();"),"kwargs = kwargs || {};",'if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {','frame.set("caller", kwargs.caller); }'),r.forEach(function(e){n._emitLine('frame.set("'+e.value+'", l_'+e.value+");"),l.set(e.value,"l_"+e.value)}),i&&i.children.forEach(function(e){var t=e.key.value;n._emit('frame.set("'+t+'", '),n._emit('Object.prototype.hasOwnProperty.call(kwargs, "'+t+'")'),n._emit(' ? kwargs["'+t+'"] : '),n._compileExpression(e.value,l),n._emit(");")});var d=this._pushBuffer();return this._withScopedSyntax(function(){n.compile(e.body,l)}),this._emitLine("frame = "+(a?"frame.pop();":"callerFrame;")),this._emitLine("return new runtime.SafeString("+d+");"),this._emitLine("});"),this._popBuffer(),o},o.compileMacro=function(e,t){var n=this._compileMacro(e),r=e.name.value;t.set(r,n),t.parent?this._emitLine('frame.set("'+r+'", '+n+");"):("_"!==e.name.value.charAt(0)&&this._emitLine('context.addExport("'+r+'");'),this._emitLine('context.setVariable("'+r+'", '+n+");"))},o.compileCaller=function(e,t){this._emit("(function (){");var n=this._compileMacro(e,t);this._emit("return "+n+";})()")},o._compileGetTemplate=function(e,t,n,r){var i=this._tmpid(),o=this._templateName(),s=this._makeCallback(i),a=n?"true":"false",c=r?"true":"false";return this._emit("env.getTemplate("),this._compileExpression(e.template,t),this._emitLine(", "+a+", "+o+", "+c+", "+s),i},o.compileImport=function(e,t){var n=e.target.value,r=this._compileGetTemplate(e,t,!1,!1);this._addScopeLevel(),this._emitLine(r+".getExported("+(e.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(r)),this._addScopeLevel(),t.set(n,r),t.parent?this._emitLine('frame.set("'+n+'", '+r+");"):this._emitLine('context.setVariable("'+n+'", '+r+");")},o.compileFromImport=function(e,t){var n=this,r=this._compileGetTemplate(e,t,!1,!1);this._addScopeLevel(),this._emitLine(r+".getExported("+(e.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(r)),this._addScopeLevel(),e.names.children.forEach(function(e){var i,o,a=n._tmpid();e instanceof s.Pair?(i=e.key.value,o=e.value.value):o=i=e.value,n._emitLine("if(Object.prototype.hasOwnProperty.call("+r+', "'+i+'")) {'),n._emitLine("var "+a+" = "+r+"."+i+";"),n._emitLine("} else {"),n._emitLine("cb(new Error(\"cannot import '"+i+"'\")); return;"),n._emitLine("}"),t.set(o,a),t.parent?n._emitLine('frame.set("'+o+'", '+a+");"):n._emitLine('context.setVariable("'+o+'", '+a+");")})},o.compileBlock=function(e){var t=this._tmpid();this.inBlock||this._emit('(parentTemplate ? function(e, c, f, r, cb) { cb(""); } : '),this._emit('context.getBlock("'+e.name.value+'")'),this.inBlock||this._emit(")"),this._emitLine("(env, context, frame, runtime, "+this._makeCallback(t)),this._emitLine(this.buffer+" += "+t+";"),this._addScopeLevel()},o.compileSuper=function(e,t){var n=e.blockName.value,r=e.symbol.value,i=this._makeCallback(r);this._emitLine('context.getSuper(env, "'+n+'", b_'+n+", frame, runtime, "+i),this._emitLine(r+" = runtime.markSafe("+r+");"),this._addScopeLevel(),t.set(r,r)},o.compileExtends=function(e,t){var n=this._tmpid(),r=this._compileGetTemplate(e,t,!0,!1);this._emitLine("parentTemplate = "+r),this._emitLine("for(var "+n+" in parentTemplate.blocks) {"),this._emitLine("context.addBlock("+n+", parentTemplate.blocks["+n+"]);"),this._emitLine("}"),this._addScopeLevel()},o.compileInclude=function(e,t){this._emitLine("var tasks = [];"),this._emitLine("tasks.push("),this._emitLine("function(callback) {");var n=this._compileGetTemplate(e,t,!1,e.ignoreMissing);this._emitLine("callback(null,"+n+");});"),this._emitLine("});");var r=this._tmpid();this._emitLine("tasks.push("),this._emitLine("function(template, callback){"),this._emitLine("template.render(context.getVariables(), frame, "+this._makeCallback(r)),this._emitLine("callback(null,"+r+");});"),this._emitLine("});"),this._emitLine("tasks.push("),this._emitLine("function(result, callback){"),this._emitLine(this.buffer+" += result;"),this._emitLine("callback(null);"),this._emitLine("});"),this._emitLine("env.waterfall(tasks, function(){"),this._addScopeLevel()},o.compileTemplateData=function(e,t){this.compileLiteral(e,t)},o.compileCapture=function(e,t){var n=this,r=this.buffer;this.buffer="output",this._emitLine("(function() {"),this._emitLine('var output = "";'),this._withScopedSyntax(function(){n.compile(e.body,t)}),this._emitLine("return output;"),this._emitLine("})()"),this.buffer=r},o.compileOutput=function(e,t){var n=this;e.children.forEach(function(r){r instanceof s.TemplateData?r.value&&(n._emit(n.buffer+" += "),n.compileLiteral(r,t),n._emitLine(";")):(n._emit(n.buffer+" += runtime.suppressValue("),n.throwOnUndefined&&n._emit("runtime.ensureDefined("),n.compile(r,t),n.throwOnUndefined&&n._emit(","+e.lineno+","+e.colno+")"),n._emit(", env.opts.autoescape);\n"))})},o.compileRoot=function(e,t){var n=this;t&&this.fail("compileRoot: root node can't have frame"),t=new c,this._emitFuncBegin(e,"root"),this._emitLine("var parentTemplate = null;"),this._compileChildren(e,t),this._emitLine("if(parentTemplate) {"),this._emitLine("parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);"),this._emitLine("} else {"),this._emitLine("cb(null, "+this.buffer+");"),this._emitLine("}"),this._emitFuncEnd(!0),this.inBlock=!0;var r=[],i=e.findAll(s.Block);i.forEach(function(e,t){var i=e.name.value;if(-1!==r.indexOf(i))throw new Error('Block "'+i+'" defined more than once.');r.push(i),n._emitFuncBegin(e,"b_"+i);var o=new c;n._emitLine("var frame = frame.push(true);"),n.compile(e.body,o),n._emitFuncEnd()}),this._emitLine("return {"),i.forEach(function(e,t){var r="b_"+e.name.value;n._emitLine(r+": "+r+",")}),this._emitLine("root: root\n};")},o.compile=function(e,t){var n=this["compile"+e.typename];n?n.call(this,e,t):this.fail("compile: Cannot compile node: "+e.typename,e.lineno,e.colno)},o.getCode=function(){return this.codebuf.join("")},i}(l);e.exports={compile:function(e,t,n,r,s){void 0===s&&(s={});var a=new h(r,s.throwOnUndefined),c=(n||[]).map(function(e){return e.preprocess}).filter(function(e){return!!e}).reduce(function(e,t){return t(e)},e);return a.compile(o.transform(i.parse(c,n,s),t,r)),a.getCode()},Compiler:h}},function(e,t,n){function r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}var i=n(4),o=n(1).EmitterObj;e.exports=function(e){var t,n;function o(){return e.apply(this,arguments)||this}n=e,(t=o).prototype=Object.create(n.prototype),t.prototype.constructor=t,r(t,n);var s=o.prototype;return s.resolve=function(e,t){return i.resolve(i.dirname(e),t)},s.isRelative=function(e){return 0===e.indexOf("./")||0===e.indexOf("../")},o}(o)},function(e,t,n){function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,i(e,t)}function i(e,t){return i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(e,t)}var o=n(12),s=n(15),a=n(0),c=n(5),l=n(18),u=n(10),h=u.FileSystemLoader,p=u.WebLoader,d=u.PrecompiledLoader,f=n(20),m=n(21),g=n(1),_=g.Obj,v=g.EmitterObj,E=n(2),y=E.handleError,b=E.Frame,A=n(22);function T(e,t,n){o(function(){e(t,n)})}var k={type:"code",obj:{root:function(e,t,n,r,i){try{i(null,"")}catch(e){i(y(e,null,null))}}}},M=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.init=function(e,t){var n=this;t=this.opts=t||{},this.opts.dev=!!t.dev,this.opts.autoescape=null==t.autoescape||t.autoescape,this.opts.throwOnUndefined=!!t.throwOnUndefined,this.opts.trimBlocks=!!t.trimBlocks,this.opts.lstripBlocks=!!t.lstripBlocks,this.loaders=[],e?this.loaders=a.isArray(e)?e:[e]:h?this.loaders=[new h("views")]:p&&(this.loaders=[new p("/views")]),"undefined"!=typeof window&&window.nunjucksPrecompiled&&this.loaders.unshift(new d(window.nunjucksPrecompiled)),this._initLoaders(),this.globals=m(),this.filters={},this.tests={},this.asyncFilters=[],this.extensions={},this.extensionsList=[],a._entries(l).forEach(function(e){var t=e[0],r=e[1];return n.addFilter(t,r)}),a._entries(f).forEach(function(e){var t=e[0],r=e[1];return n.addTest(t,r)})},n._initLoaders=function(){var e=this;this.loaders.forEach(function(t){t.cache={},"function"==typeof t.on&&(t.on("update",function(n,r){t.cache[n]=null,e.emit("update",n,r,t)}),t.on("load",function(n,r){e.emit("load",n,r,t)}))})},n.invalidateCache=function(){this.loaders.forEach(function(e){e.cache={}})},n.addExtension=function(e,t){return t.__name=e,this.extensions[e]=t,this.extensionsList.push(t),this},n.removeExtension=function(e){var t=this.getExtension(e);t&&(this.extensionsList=a.without(this.extensionsList,t),delete this.extensions[e])},n.getExtension=function(e){return this.extensions[e]},n.hasExtension=function(e){return!!this.extensions[e]},n.addGlobal=function(e,t){return this.globals[e]=t,this},n.getGlobal=function(e){if(void 0===this.globals[e])throw new Error("global not found: "+e);return this.globals[e]},n.addFilter=function(e,t,n){var r=t;return n&&this.asyncFilters.push(e),this.filters[e]=r,this},n.getFilter=function(e){if(!this.filters[e])throw new Error("filter not found: "+e);return this.filters[e]},n.addTest=function(e,t){return this.tests[e]=t,this},n.getTest=function(e){if(!this.tests[e])throw new Error("test not found: "+e);return this.tests[e]},n.resolveTemplate=function(e,t,n){return e.isRelative&&t&&e.isRelative(n)&&e.resolve?e.resolve(t,n):n},n.getTemplate=function(e,t,n,r,i){var o,s=this,c=this,l=null;if(e&&e.raw&&(e=e.raw),a.isFunction(n)&&(i=n,n=null,t=t||!1),a.isFunction(t)&&(i=t,t=!1),e instanceof O)l=e;else{if("string"!=typeof e)throw new Error("template names must be a string: "+e);for(var u=0;u0&&!this.skip(i.TOKEN_COMMA)&&this.fail("parseFrom: expected comma",e.lineno,e.colno);var a=this.parsePrimary();if("_"===a.value.charAt(0)&&this.fail("parseFrom: names starting with an underscore cannot be imported",a.lineno,a.colno),this.skipSymbol("as")){var c=this.parsePrimary();r.addChild(new o.Pair(a.lineno,a.colno,a,c))}else r.addChild(a);n=this.parseWithContext()}return new o.FromImport(e.lineno,e.colno,t,r,n)},c.parseBlock=function(){var e=this.peekToken();this.skipSymbol("block")||this.fail("parseBlock: expected block",e.lineno,e.colno);var t=new o.Block(e.lineno,e.colno);t.name=this.parsePrimary(),t.name instanceof o.Symbol||this.fail("parseBlock: variable name expected",e.lineno,e.colno),this.advanceAfterBlockEnd(e.value),t.body=this.parseUntilBlocks("endblock"),this.skipSymbol("endblock"),this.skipSymbol(t.name.value);var n=this.peekToken();return n||this.fail("parseBlock: expected endblock, got end of file"),this.advanceAfterBlockEnd(n.value),t},c.parseExtends=function(){var e="extends",t=this.peekToken();this.skipSymbol(e)||this.fail("parseTemplateRef: expected "+e);var n=new o.Extends(t.lineno,t.colno);return n.template=this.parseExpression(),this.advanceAfterBlockEnd(t.value),n},c.parseInclude=function(){var e="include",t=this.peekToken();this.skipSymbol(e)||this.fail("parseInclude: expected "+e);var n=new o.Include(t.lineno,t.colno);return n.template=this.parseExpression(),this.skipSymbol("ignore")&&this.skipSymbol("missing")&&(n.ignoreMissing=!0),this.advanceAfterBlockEnd(t.value),n},c.parseIf=function(){var e,t=this.peekToken();this.skipSymbol("if")||this.skipSymbol("elif")||this.skipSymbol("elseif")?e=new o.If(t.lineno,t.colno):this.skipSymbol("ifAsync")?e=new o.IfAsync(t.lineno,t.colno):this.fail("parseIf: expected if, elif, or elseif",t.lineno,t.colno),e.cond=this.parseExpression(),this.advanceAfterBlockEnd(t.value),e.body=this.parseUntilBlocks("elif","elseif","else","endif");var n=this.peekToken();switch(n&&n.value){case"elseif":case"elif":e.else_=this.parseIf();break;case"else":this.advanceAfterBlockEnd(),e.else_=this.parseUntilBlocks("endif"),this.advanceAfterBlockEnd();break;case"endif":e.else_=null,this.advanceAfterBlockEnd();break;default:this.fail("parseIf: expected elif, else, or endif, got end of file")}return e},c.parseSet=function(){var e=this.peekToken();this.skipSymbol("set")||this.fail("parseSet: expected set",e.lineno,e.colno);for(var t,n=new o.Set(e.lineno,e.colno,[]);(t=this.parsePrimary())&&(n.targets.push(t),this.skip(i.TOKEN_COMMA)););return this.skipValue(i.TOKEN_OPERATOR,"=")?(n.value=this.parseExpression(),this.advanceAfterBlockEnd(e.value)):this.skip(i.TOKEN_BLOCK_END)?(n.body=new o.Capture(e.lineno,e.colno,this.parseUntilBlocks("endset")),n.value=null,this.advanceAfterBlockEnd()):this.fail("parseSet: expected = or block end in set tag",e.lineno,e.colno),n},c.parseSwitch=function(){var e="switch",t="endswitch",n="case",r="default",i=this.peekToken();this.skipSymbol(e)||this.skipSymbol(n)||this.skipSymbol(r)||this.fail('parseSwitch: expected "switch," "case" or "default"',i.lineno,i.colno);var s=this.parseExpression();this.advanceAfterBlockEnd(e),this.parseUntilBlocks(n,r,t);var a,c=this.peekToken(),l=[];do{this.skipSymbol(n);var u=this.parseExpression();this.advanceAfterBlockEnd(e);var h=this.parseUntilBlocks(n,r,t);l.push(new o.Case(c.line,c.col,u,h)),c=this.peekToken()}while(c&&c.value===n);switch(c.value){case r:this.advanceAfterBlockEnd(),a=this.parseUntilBlocks(t),this.advanceAfterBlockEnd();break;case t:this.advanceAfterBlockEnd();break;default:this.fail('parseSwitch: expected "case," "default" or "endswitch," got EOF.')}return new o.Switch(i.lineno,i.colno,s,l,a)},c.parseStatement=function(){var e=this.peekToken();if(e.type!==i.TOKEN_SYMBOL&&this.fail("tag name expected",e.lineno,e.colno),this.breakOnBlocks&&-1!==a.indexOf(this.breakOnBlocks,e.value))return null;switch(e.value){case"raw":return this.parseRaw();case"verbatim":return this.parseRaw("verbatim");case"if":case"ifAsync":return this.parseIf();case"for":case"asyncEach":case"asyncAll":return this.parseFor();case"block":return this.parseBlock();case"extends":return this.parseExtends();case"include":return this.parseInclude();case"set":return this.parseSet();case"macro":return this.parseMacro();case"call":return this.parseCall();case"import":return this.parseImport();case"from":return this.parseFrom();case"filter":return this.parseFilterStatement();case"switch":return this.parseSwitch();default:if(this.extensions.length)for(var t=0;t0;){var c=s[0],l=s[1],u=s[2];u===e?r+=1:u===t&&(r-=1),0===r?(i+=l,this.tokens.backN(c.length-l.length)):i+=c}return new o.Output(a.lineno,a.colno,[new o.TemplateData(a.lineno,a.colno,i)])},c.parsePostfix=function(e){for(var t,n=this.peekToken();n;){if(n.type===i.TOKEN_LEFT_PAREN)e=new o.FunCall(n.lineno,n.colno,e,this.parseSignature());else if(n.type===i.TOKEN_LEFT_BRACKET)(t=this.parseAggregate()).children.length>1&&this.fail("invalid index"),e=new o.LookupVal(n.lineno,n.colno,e,t.children[0]);else{if(n.type!==i.TOKEN_OPERATOR||"."!==n.value)break;this.nextToken();var r=this.nextToken();r.type!==i.TOKEN_SYMBOL&&this.fail("expected name as lookup value, got "+r.value,r.lineno,r.colno),t=new o.Literal(r.lineno,r.colno,r.value),e=new o.LookupVal(n.lineno,n.colno,e,t)}n=this.peekToken()}return e},c.parseExpression=function(){return this.parseInlineIf()},c.parseInlineIf=function(){var e=this.parseOr();if(this.skipSymbol("if")){var t=this.parseOr(),n=e;(e=new o.InlineIf(e.lineno,e.colno)).body=n,e.cond=t,this.skipSymbol("else")?e.else_=this.parseOr():e.else_=null}return e},c.parseOr=function(){for(var e=this.parseAnd();this.skipSymbol("or");){var t=this.parseAnd();e=new o.Or(e.lineno,e.colno,e,t)}return e},c.parseAnd=function(){for(var e=this.parseNot();this.skipSymbol("and");){var t=this.parseNot();e=new o.And(e.lineno,e.colno,e,t)}return e},c.parseNot=function(){var e=this.peekToken();return this.skipSymbol("not")?new o.Not(e.lineno,e.colno,this.parseNot()):this.parseIn()},c.parseIn=function(){for(var e=this.parseIs();;){var t=this.nextToken();if(!t)break;var n=t.type===i.TOKEN_SYMBOL&&"not"===t.value;if(n||this.pushToken(t),!this.skipSymbol("in")){n&&this.pushToken(t);break}var r=this.parseIs();e=new o.In(e.lineno,e.colno,e,r),n&&(e=new o.Not(e.lineno,e.colno,e))}return e},c.parseIs=function(){var e=this.parseCompare();if(this.skipSymbol("is")){var t=this.skipSymbol("not"),n=this.parseCompare();e=new o.Is(e.lineno,e.colno,e,n),t&&(e=new o.Not(e.lineno,e.colno,e))}return e},c.parseCompare=function(){for(var e=["==","===","!=","!==","<",">","<=",">="],t=this.parseConcat(),n=[];;){var r=this.nextToken();if(!r)break;if(-1===e.indexOf(r.value)){this.pushToken(r);break}n.push(new o.CompareOperand(r.lineno,r.colno,this.parseConcat(),r.value))}return n.length?new o.Compare(n[0].lineno,n[0].colno,t,n):t},c.parseConcat=function(){for(var e=this.parseAdd();this.skipValue(i.TOKEN_TILDE,"~");){var t=this.parseAdd();e=new o.Concat(e.lineno,e.colno,e,t)}return e},c.parseAdd=function(){for(var e=this.parseSub();this.skipValue(i.TOKEN_OPERATOR,"+");){var t=this.parseSub();e=new o.Add(e.lineno,e.colno,e,t)}return e},c.parseSub=function(){for(var e=this.parseMul();this.skipValue(i.TOKEN_OPERATOR,"-");){var t=this.parseMul();e=new o.Sub(e.lineno,e.colno,e,t)}return e},c.parseMul=function(){for(var e=this.parseDiv();this.skipValue(i.TOKEN_OPERATOR,"*");){var t=this.parseDiv();e=new o.Mul(e.lineno,e.colno,e,t)}return e},c.parseDiv=function(){for(var e=this.parseFloorDiv();this.skipValue(i.TOKEN_OPERATOR,"/");){var t=this.parseFloorDiv();e=new o.Div(e.lineno,e.colno,e,t)}return e},c.parseFloorDiv=function(){for(var e=this.parseMod();this.skipValue(i.TOKEN_OPERATOR,"//");){var t=this.parseMod();e=new o.FloorDiv(e.lineno,e.colno,e,t)}return e},c.parseMod=function(){for(var e=this.parsePow();this.skipValue(i.TOKEN_OPERATOR,"%");){var t=this.parsePow();e=new o.Mod(e.lineno,e.colno,e,t)}return e},c.parsePow=function(){for(var e=this.parseUnary();this.skipValue(i.TOKEN_OPERATOR,"**");){var t=this.parseUnary();e=new o.Pow(e.lineno,e.colno,e,t)}return e},c.parseUnary=function(e){var t,n=this.peekToken();return t=this.skipValue(i.TOKEN_OPERATOR,"-")?new o.Neg(n.lineno,n.colno,this.parseUnary(!0)):this.skipValue(i.TOKEN_OPERATOR,"+")?new o.Pos(n.lineno,n.colno,this.parseUnary(!0)):this.parsePrimary(),e||(t=this.parseFilter(t)),t},c.parsePrimary=function(e){var t,n=this.nextToken(),r=null;if(n?n.type===i.TOKEN_STRING?t=n.value:n.type===i.TOKEN_INT?t=parseInt(n.value,10):n.type===i.TOKEN_FLOAT?t=parseFloat(n.value):n.type===i.TOKEN_BOOLEAN?"true"===n.value?t=!0:"false"===n.value?t=!1:this.fail("invalid boolean: "+n.value,n.lineno,n.colno):n.type===i.TOKEN_NONE?t=null:n.type===i.TOKEN_REGEX&&(t=new RegExp(n.value.body,n.value.flags)):this.fail("expected expression, got end of file"),void 0!==t?r=new o.Literal(n.lineno,n.colno,t):n.type===i.TOKEN_SYMBOL?r=new o.Symbol(n.lineno,n.colno,n.value):(this.pushToken(n),r=this.parseAggregate()),e||(r=this.parsePostfix(r)),r)return r;throw this.error("unexpected token: "+n.value,n.lineno,n.colno)},c.parseFilterName=function(){for(var e=this.expect(i.TOKEN_SYMBOL),t=e.value;this.skipValue(i.TOKEN_OPERATOR,".");)t+="."+this.expect(i.TOKEN_SYMBOL).value;return new o.Symbol(e.lineno,e.colno,t)},c.parseFilterArgs=function(e){return this.peekToken().type===i.TOKEN_LEFT_PAREN?this.parsePostfix(e).args.children:[]},c.parseFilter=function(e){for(;this.skip(i.TOKEN_PIPE);){var t=this.parseFilterName();e=new o.Filter(t.lineno,t.colno,t,new o.NodeList(t.lineno,t.colno,[e].concat(this.parseFilterArgs(e))))}return e},c.parseFilterStatement=function(){var e=this.peekToken();this.skipSymbol("filter")||this.fail("parseFilterStatement: expected filter");var t=this.parseFilterName(),n=this.parseFilterArgs(t);this.advanceAfterBlockEnd(e.value);var r=new o.Capture(t.lineno,t.colno,this.parseUntilBlocks("endfilter"));this.advanceAfterBlockEnd();var i=new o.Filter(t.lineno,t.colno,t,new o.NodeList(t.lineno,t.colno,[r].concat(n)));return new o.Output(t.lineno,t.colno,[i])},c.parseAggregate=function(){var e,t=this.nextToken();switch(t.type){case i.TOKEN_LEFT_PAREN:e=new o.Group(t.lineno,t.colno);break;case i.TOKEN_LEFT_BRACKET:e=new o.Array(t.lineno,t.colno);break;case i.TOKEN_LEFT_CURLY:e=new o.Dict(t.lineno,t.colno);break;default:return null}for(;;){var n=this.peekToken().type;if(n===i.TOKEN_RIGHT_PAREN||n===i.TOKEN_RIGHT_BRACKET||n===i.TOKEN_RIGHT_CURLY){this.nextToken();break}if(e.children.length>0&&(this.skip(i.TOKEN_COMMA)||this.fail("parseAggregate: expected comma after expression",t.lineno,t.colno)),e instanceof o.Dict){var r=this.parsePrimary();this.skip(i.TOKEN_COLON)||this.fail("parseAggregate: expected colon after dict key",t.lineno,t.colno);var s=this.parseExpression();e.addChild(new o.Pair(r.lineno,r.colno,r,s))}else{var a=this.parseExpression();e.addChild(a)}}return e},c.parseSignature=function(e,t){var n=this.peekToken();if(!t&&n.type!==i.TOKEN_LEFT_PAREN){if(e)return null;this.fail("expected arguments",n.lineno,n.colno)}n.type===i.TOKEN_LEFT_PAREN&&(n=this.nextToken());for(var r=new o.NodeList(n.lineno,n.colno),s=new o.KeywordArgs(n.lineno,n.colno),a=!1;;){if(n=this.peekToken(),!t&&n.type===i.TOKEN_RIGHT_PAREN){this.nextToken();break}if(t&&n.type===i.TOKEN_BLOCK_END)break;if(a&&!this.skip(i.TOKEN_COMMA))this.fail("parseSignature: expected comma after expression",n.lineno,n.colno);else{var c=this.parseExpression();this.skipValue(i.TOKEN_OPERATOR,"=")?s.addChild(new o.Pair(c.lineno,c.colno,c,this.parseExpression())):r.addChild(c)}a=!0}return s.children.length&&r.addChild(s),r},c.parseUntilBlocks=function(){for(var e=this.breakOnBlocks,t=arguments.length,n=new Array(t),r=0;r=","//","**"],B=x+this.current();switch(-1!==r.indexOf(P,B)&&(this.forward(),x=B,-1!==r.indexOf(P,B+this.current())&&(x=B+this.current(),this.forward())),x){case"(":D=f;break;case")":D=m;break;case"[":D=g;break;case"]":D=_;break;case"{":D=v;break;case"}":D=E;break;case",":D=b;break;case":":D=A;break;case"~":D=T;break;case"|":D=k;break;default:D=y}return R(D,x,t,n)}if((e=this._extractUntil(i+o)).match(/^[-+]?[0-9]+$/)){if("."===this.current()){this.forward();var F=this._extract("0123456789");return R(M,e+"."+F,t,n)}return R("int",e,t,n)}if(e.match(/^(true|false)$/))return R(w,e,t,n);if("none"===e)return R(O,e,t,n);if("null"===e)return R(O,e,t,n);if(e)return R(L,e,t,n);throw new Error("Unexpected value while parsing: "+e)}var U,K=this.tags.BLOCK_START.charAt(0)+this.tags.VARIABLE_START.charAt(0)+this.tags.COMMENT_START.charAt(0)+this.tags.COMMENT_END.charAt(0);if(this.isFinished())return null;if((e=this._extractString(this.tags.BLOCK_START+"-"))||(e=this._extractString(this.tags.BLOCK_START)))return this.in_code=!0,R(l,e,t,n);if((e=this._extractString(this.tags.VARIABLE_START+"-"))||(e=this._extractString(this.tags.VARIABLE_START)))return this.in_code=!0,R(h,e,t,n);e="";var G=!1;for(this._matches(this.tags.COMMENT_START)&&(G=!0,e=this._extractString(this.tags.COMMENT_START));null!==(U=this._extractUntil(K));){if(e+=U,(this._matches(this.tags.BLOCK_START)||this._matches(this.tags.VARIABLE_START)||this._matches(this.tags.COMMENT_START))&&!G){if(this.lstripBlocks&&this._matches(this.tags.BLOCK_START)&&this.colno>0&&this.colno<=e.length){var W=e.slice(-this.colno);if(/^\s+$/.test(W)&&!(e=e.slice(0,-this.colno)).length)return this.nextToken()}break}if(this._matches(this.tags.COMMENT_END)){if(!G)throw new Error("unexpected end of comment");e+=this._extractString(this.tags.COMMENT_END);break}e+=this.current(),this.forward()}if(null===U&&G)throw new Error("expected end of comment, got end of file");return R(G?d:c,e,t,n)},t._parseString=function(e){this.forward();for(var t="";!this.isFinished()&&this.current()!==e;){var n=this.current();if("\\"===n){switch(this.forward(),this.current()){case"n":t+="\n";break;case"t":t+="\t";break;case"r":t+="\r";break;default:t+=this.current()}this.forward()}else t+=n,this.forward()}return this.forward(),t},t._matches=function(e){return this.index+e.length>this.len?null:this.str.slice(this.index,this.index+e.length)===e},t._extractString=function(e){return this._matches(e)?(this.forwardN(e.length),e):null},t._extractUntil=function(e){return this._extractMatching(!0,e||"")},t._extract=function(e){return this._extractMatching(!1,e)},t._extractMatching=function(e,t){if(this.isFinished())return null;var n=t.indexOf(this.current());if(e&&-1===n||!e&&-1!==n){var r=this.current();this.forward();for(var i=t.indexOf(this.current());(e&&-1===i||!e&&-1!==i)&&!this.isFinished();)r+=this.current(),this.forward(),i=t.indexOf(this.current());return r}return""},t._extractRegex=function(e){var t=this.currentStr().match(e);return t?(this.forwardN(t[0].length),t):null},t.isFinished=function(){return this.index>=this.len},t.forwardN=function(e){for(var t=0;t1024){for(var t=0,n=i.length-o;t0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=p.bind(r);return i.listener=n,r.wrapFn=i,i}function f(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)o(c,this,t);else{var l=c.length,u=g(c,l);for(n=0;n=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return f(this,e,!0)},a.prototype.rawListeners=function(e){return f(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){var r=n(3),i=n(0),o=0;function s(){return"hole_"+o++}function a(e,t){for(var n=null,r=0;r=t)return e;var n=t-e.length,s=r.repeat(" ",n/2-n%2),a=r.repeat(" ",n/2);return i.copySafeness(e,s+e+a)},t.default=function(e,t,n){return n?e||t:void 0!==e?e:t},t.dictsort=function(e,t,n){if(!r.isObject(e))throw new r.TemplateError("dictsort filter: val must be an object");var i,o=[];for(var s in e)o.push([s,e[s]]);if(void 0===n||"key"===n)i=0;else{if("value"!==n)throw new r.TemplateError("dictsort filter: You can only sort by either key or value");i=1}return o.sort(function(e,n){var o=e[i],s=n[i];return t||(r.isString(o)&&(o=o.toUpperCase()),r.isString(s)&&(s=s.toUpperCase())),o>s?1:o===s?0:-1}),o},t.dump=function(e,t){return JSON.stringify(e,null,t)},t.escape=function(e){return e instanceof i.SafeString?e:(e=null==e?"":e,i.markSafe(r.escape(e.toString())))},t.safe=function(e){return e instanceof i.SafeString?e:(e=null==e?"":e,i.markSafe(e.toString()))},t.first=function(e){return e[0]},t.forceescape=function(e){return e=null==e?"":e,i.markSafe(r.escape(e.toString()))},t.groupby=function(e,t){return r.groupBy(e,t,this.env.opts.throwOnUndefined)},t.indent=function(e,t,n){if(""===(e=o(e,"")))return"";t=t||4;var s=e.split("\n"),a=r.repeat(" ",t),c=s.map(function(e,t){return 0!==t||n?""+a+e:e}).join("\n");return i.copySafeness(e,c)},t.join=function(e,t,n){return t=t||"",n&&(e=r.map(e,function(e){return e[n]})),e.join(t)},t.last=function(e){return e[e.length-1]},t.length=function(e){var t=o(e,"");return void 0!==t?"function"==typeof Map&&t instanceof Map||"function"==typeof Set&&t instanceof Set?t.size:!r.isObject(t)||t instanceof i.SafeString?t.length:r.keys(t).length:0},t.list=c,t.lower=function(e){return(e=o(e,"")).toLowerCase()},t.nl2br=function(e){return null==e?"":i.copySafeness(e,e.replace(/\r\n|\n/g,"
\n"))},t.random=function(e){return e[Math.floor(Math.random()*e.length)]},t.reject=l(!1),t.rejectattr=function(e,t){return e.filter(function(e){return!e[t]})},t.select=l(!0),t.selectattr=function(e,t){return e.filter(function(e){return!!e[t]})},t.replace=function(e,t,n,r){var o=e;if(t instanceof RegExp)return e.replace(t,n);void 0===r&&(r=-1);var s="";if("number"==typeof t)t=""+t;else if("string"!=typeof t)return e;if("number"==typeof e&&(e=""+e),"string"!=typeof e&&!(e instanceof i.SafeString))return e;if(""===t)return s=n+e.split("").join(n)+n,i.copySafeness(e,s);var a=e.indexOf(t);if(0===r||-1===a)return e;for(var c=0,l=0;a>-1&&(-1===r||l=i&&u.push(n),o.push(u)}return o},t.sum=function(e,t,n){return void 0===n&&(n=0),t&&(e=r.map(e,function(e){return e[t]})),n+e.reduce(function(e,t){return e+t},0)},t.sort=i.makeMacro(["value","reverse","case_sensitive","attribute"],[],function(e,t,n,i){var o=this,s=r.map(e,function(e){return e}),a=r.getAttrGetter(i);return s.sort(function(e,s){var c=i?a(e):e,l=i?a(s):s;if(o.env.opts.throwOnUndefined&&i&&(void 0===c||void 0===l))throw new TypeError('sort: attribute "'+i+'" resolved to undefined');return!n&&r.isString(c)&&r.isString(l)&&(c=c.toLowerCase(),l=l.toLowerCase()),cl?t?-1:1:0}),s}),t.string=function(e){return i.copySafeness(e,e)},t.striptags=function(e,t){var n=u((e=o(e,"")).replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>|/gi,"")),r="";return r=t?n.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,"\n").replace(/\n\n\n+/g,"\n\n"):n.replace(/\s+/gi," "),i.copySafeness(e,r)},t.title=function(e){var t=(e=o(e,"")).split(" ").map(function(e){return a(e)});return i.copySafeness(e,t.join(" "))},t.trim=u,t.truncate=function(e,t,n,r){var s=e;if(t=t||255,(e=o(e,"")).length<=t)return e;if(n)e=e.substring(0,t);else{var a=e.lastIndexOf(" ",t);-1===a&&(a=t),e=e.substring(0,a)}return e+=null!=r?r:"...",i.copySafeness(s,e)},t.upper=function(e){return(e=o(e,"")).toUpperCase()},t.urlencode=function(e){var t=encodeURIComponent;return r.isString(e)?t(e):(r.isArray(e)?e:r._entries(e)).map(function(e){var n=e[0],r=e[1];return t(n)+"="+t(r)}).join("&")};var h=/^(?:\(|<|<)?(.*?)(?:\.|,|\)|\n|>)?$/,p=/^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i,d=/^https?:\/\/.*$/,f=/^www\./,m=/\.(?:org|net|com)(?:\:|\/|$)/;t.urlize=function(e,t,n){s(t)&&(t=1/0);var r=!0===n?' rel="nofollow"':"";return e.split(/(\s+)/).filter(function(e){return e&&e.length}).map(function(e){var n=e.match(h),i=n?n[1]:e,o=i.substr(0,t);return d.test(i)?'"+o+"":f.test(i)?'"+o+"":p.test(i)?''+i+"":m.test(i)?'"+o+"":e}).join("")},t.wordcount=function(e){var t=(e=o(e,""))?e.match(/\w+/g):null;return t?t.length:null},t.float=function(e,t){var n=parseFloat(e);return s(n)?t:n};var g=i.makeMacro(["value","default","base"],[],function(e,t,n){void 0===n&&(n=10);var r=parseInt(e,n);return s(r)?t:r});t.int=g,t.d=t.default,t.e=t.escape},function(e,t,n){function r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}var i=function(e){var t,n;function i(t){var n;return(n=e.call(this)||this).precompiled=t||{},n}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,r(t,n),i.prototype.getSource=function(e){return this.precompiled[e]?{src:{type:"code",obj:this.precompiled[e]},path:e}:null},i}(n(6));e.exports={PrecompiledLoader:i}},function(e,t,n){var r=n(2).SafeString;t.callable=function(e){return"function"==typeof e},t.defined=function(e){return void 0!==e},t.divisibleby=function(e,t){return e%t===0},t.escaped=function(e){return e instanceof r},t.equalto=function(e,t){return e===t},t.eq=t.equalto,t.sameas=t.equalto,t.even=function(e){return e%2==0},t.falsy=function(e){return!e},t.ge=function(e,t){return e>=t},t.greaterthan=function(e,t){return e>t},t.gt=t.greaterthan,t.le=function(e,t){return e<=t},t.lessthan=function(e,t){return e0)for(var i=e;it;o+=n)r.push(o);return r},cycler:function(){return e=Array.prototype.slice.call(arguments),t=-1,{current:null,reset:function(){t=-1,this.current=null},next:function(){return++t>=e.length&&(t=0),this.current=e[t],this.current}};var e,t},joiner:function(e){return function(e){e=e||",";var t=!0;return function(){var n=t?"":e;return t=!1,n}}(e)}}}},function(e,t,n){var r=n(4);e.exports=function(e,t){function n(e,t){if(this.name=e,this.path=e,this.defaultEngine=t.defaultEngine,this.ext=r.extname(e),!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");this.ext||(this.name+=this.ext=("."!==this.defaultEngine[0]?".":"")+this.defaultEngine)}return n.prototype.render=function(t,n){e.render(this.name,t,n)},t.set("view",n),t.set("nunjucksEnv",e),e}},function(e,t,n){var r=n(4),i=n(4),o=n(0)._prettifyError,s=n(5),a=n(7).Environment,c=n(24);function l(e,t){return!!Array.isArray(t)&&t.some(function(t){return e.match(t)})}function u(e,t){(t=t||{}).isString=!0;var n=t.env||new a([]),r=t.wrapper||c;if(!t.name)throw new Error('the "name" option is required when compiling a string');return r([h(e,t.name,n)],t)}function h(e,t,n){var r,i=(n=n||new a([])).asyncFilters,c=n.extensionsList;t=t.replace(/\\/g,"/");try{r=s.compile(e,i,c,t,n.opts)}catch(e){throw o(t,!1,e)}return{name:t,template:r}}e.exports={precompile:function(e,t){var n=(t=t||{}).env||new a([]),o=t.wrapper||c;if(t.isString)return u(e,t);var s=r.existsSync(e)&&r.statSync(e),p=[],d=[];if(s.isFile())p.push(h(r.readFileSync(e,"utf-8"),t.name||e,n));else if(s.isDirectory()){!function n(o){r.readdirSync(o).forEach(function(s){var a=i.join(o,s),c=a.substr(i.join(e,"/").length),u=r.statSync(a);u&&u.isDirectory()?l(c+="/",t.exclude)||n(a):l(c,t.include)&&d.push(a)})}(e);for(var f=0;fe.length||i>0&&s>=r||i<0&&s<=r);s+=i)o.push(n.memberLookup(e,s));return o}function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var f={pop:function(e){if(void 0===e)return this.pop();if(e>=this.length||e<0)throw new Error("KeyError");return this.splice(e,1)},append:function(e){return this.push(e)},remove:function(e){for(var t=0;te.maximumModuleRerunsCount)return e.runtime.getDOM().removeModuleMarker(e.getMarkerForAction(t,n)),void e.runtime.debugLog("Action ".concat(t.actionType," not applied - Too many runs for this action"));e.actionsRunCount[n]+=1;var o=r(t.transformationConfig,e.variables);void 0!==o&&i(e.runtime,t.actionConfig,o,e.getMarkerForAction(t,n))}else e.runtime.debugLog("Action ".concat(t.actionType," not applied - No changes"))})},t}(BaseModule),Module$1=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.urlHasChanged=function(){return this.runtime.getURL()!==this.runtime.extractForceParamsFromUrl(window.location.href).url},t.prototype.execute=function(){this.urlHasChanged()&&this.runtime.debugLog("Not running, URL has changed between first and current run"),e.prototype.execute.call(this)},t}(Module$2),RedirectType,Platform,Executors,IgnoredParametersStrategy,Step,UserAgentMatchingPredicate,ContextRequester,GoJsKnownVariables,_a$1,_b,Operation,Action,KvType,StreamingTransformer,QualityControlStatus;!function(e){e.PERMANENT="permanent",e.TEMPORARY="temporary"}(RedirectType||(RedirectType={})),function(e){e.DOM="dom",e.FRONT="front",e.GOJS="gojs"}(Platform||(Platform={})),function(e){e.FRONT="front",e.GOJS="gojs",e.DOM="dom"}(Executors||(Executors={})),function(e){e.SERVE="serve",e.SERVE_AND_ADD_CANONICAL="serve_and_add_canonical",e.SERVE_AND_FORCE_CANONICAL="serve_and_force_canonical",e.PERMANENT_REDIRECT="permanent_redirect",e.TEMPORARY_REDIRECT="temporary_redirect"}(IgnoredParametersStrategy||(IgnoredParametersStrategy={})),function(e){e.RENDERING="rendering",e.PRE_BEAM_RESPONSE="preBeamResponse"}(Step||(Step={})),function(e){e.CONTAINS="contains",e.EQ="eq",e.WILDCARD="wildcard",e.STARTSWITH="startswith"}(UserAgentMatchingPredicate||(UserAgentMatchingPredicate={})),function(e){e.BOT="bot",e.USER="user"}(ContextRequester||(ContextRequester={})),function(e){e.CLEANED_URL="fetchedUrl",e.RAW_URL="url",e.STATS="stats",e.NOT_FOUND="notFound",e.REDIRECT="redirect",e.PAGEWORKERS_LOGS="pageworkersLogs",e.PAGEWORKERS_CONFIGS="pageworkersConfigs",e.PAGEWORKERS_PAGE_LINKS="pageworkersLinks",e.PAGEWORKERS_SESSION_ID="pageworkersRequestId",e.REQUESTER_BOT_ID="botId",e.TIMESTAMP_PAGE_RENDERED_SECONDS="timestampPageRenderedSec",e.DELIVERY_CONTEXT="deliveryContext",e.FORCE_CACHE_MISS="forceCacheMiss",e.LIVE_UPDATE_STATUS="liveUpdateStatus"}(GoJsKnownVariables||(GoJsKnownVariables={})),function(e){e.LINK="link",e.CANONICAL="canonical",e.HREFLANG="hreflang",e.TITLE="title",e.H1="h1",e.DESCRIPTION="description",e.TEMPORARY_REDIRECT="temporaryRedirect",e.PERMANENT_REDIRECT="permanentRedirect",e.ALTERNATE_TO_MOBILE="alternateToMobile",e.OG_DESCRIPTION="ogDescription",e.ELEMENT="element",e.ELEMENT_ATTRIBUTE="elementAttribute",e.PREV="prev",e.NEXT="next",e.HTML_BLOCK="htmlBlock",e.PAGE_NOT_FOUND="pageNotFound",e.PAGE_GONE="pageGone"}(Operation||(Operation={})),function(e){e.ADDED="added",e.CHANGED="changed",e.REMOVED="removed"}(Action||(Action={})),function(e){e.FILE="file",e.STREAMING="streaming"}(KvType||(KvType={})),function(e){e.GOOGLE_MERCHANT_CENTER="google_merchant_center"}(StreamingTransformer||(StreamingTransformer={})),_a$1={},_a$1[Operation.LINK]=0,_a$1[Operation.CANONICAL]=1,_a$1[Operation.HREFLANG]=2,_a$1[Operation.TITLE]=3,_a$1[Operation.H1]=4,_a$1[Operation.DESCRIPTION]=5,_a$1[Operation.TEMPORARY_REDIRECT]=6,_a$1[Operation.PERMANENT_REDIRECT]=7,_a$1[Operation.ALTERNATE_TO_MOBILE]=8,_a$1[Operation.OG_DESCRIPTION]=9,_a$1[Operation.ELEMENT]=10,_a$1[Operation.ELEMENT_ATTRIBUTE]=11,_a$1[Operation.PREV]=12,_a$1[Operation.NEXT]=13,_a$1[Operation.HTML_BLOCK]=14,_a$1[Operation.PAGE_NOT_FOUND]=15,_a$1[Operation.PAGE_GONE]=16,_b={},_b[Action.ADDED]=0,_b[Action.CHANGED]=1,_b[Action.REMOVED]=2,Step.RENDERING,Step.PRE_BEAM_RESPONSE,function(e){e[e.SUCCESS=0]="SUCCESS",e[e.WARNING=1]="WARNING",e[e.FAIL=2]="FAIL",e[e.ERROR=3]="ERROR"}(QualityControlStatus||(QualityControlStatus={})),QualityControlStatus.SUCCESS,QualityControlStatus.WARNING,QualityControlStatus.FAIL,QualityControlStatus.ERROR;var PROPERTY_LOGGING_VALUE_MAX_LENGTH=1e3,RedirectBehavior;!function(e){e.HTTP_301="301",e.HTTP_302="302",e.DO_NOTHING="do_nothing"}(RedirectBehavior||(RedirectBehavior={}));var getActionType=function(e){if("a"===e.getTagName())return Operation.LINK;if("link"===e.getTagName()){if("canonical"===e.getAttribute("rel"))return Operation.CANONICAL;if("prev"===e.getAttribute("rel"))return Operation.PREV;if("next"===e.getAttribute("rel"))return Operation.NEXT}throw new Error("Action Type Not Found")},Module=function(e){function t(t){var n=this,r=t.config.redirectBehavior,i=__rest(t,["config"]);return(n=e.call(this,i)||this).redirectBehavior=r,n}return __extends(t,e),t.prototype.execute=function(){this.runtime.isBot()&&this.redirectToAnotherPageIfNecessary()},t.prototype.redirectToAnotherPageIfNecessary=function(){if(this.redirectBehavior===RedirectBehavior.DO_NOTHING)return!1;var e=this.data[this.runtime.getURL()];if(!e)return!1;switch(this.redirectBehavior){case RedirectBehavior.HTTP_301:this.runtime.setPermanentRedirect(e.destinationUrl);break;case RedirectBehavior.HTTP_302:this.runtime.setTemporaryRedirect(e.destinationUrl);break;default:assertNever(this.redirectBehavior,"Unknown redirect behavior")}return!0},t.prototype.getSelectors=function(){return["a","link"]},t.prototype.executeOnLink=function(e,t,n){var r=n.getTagName();if("a"===r||"link"===r){var i=this.data[e];if(i)if(n.getAttribute("href")!==i.destinationUrl)return n.setAttribute("href",i.destinationUrl),n.setAttribute("data-btfy-pw-id","pw_link_redirect_".concat(this.id)),this.runtime.getLogger().recordAction({element:getActionType(n),action:Action.CHANGED,value:i.destinationUrl,oldValue:e}),{updatedUrl:i.destinationUrl}}},t}(BaseLinksModule),DirectAccessBehavior$1,LinksToRemoveType;!function(e){e.NO_INDEX="no_index",e.DO_NOTHING="do_nothing"}(DirectAccessBehavior$1||(DirectAccessBehavior$1={})),function(e){e.BY_URL="by_url",e.BY_SCOPE="by_scope",e.BY_SITECRAWLER_URLS="by_sitecrawler_urls",e.BY_EXTERNAL_SOURCE="external_source"}(LinksToRemoveType||(LinksToRemoveType={}));var RemoveLinksModule=function(e){function t(t){var n=this,r=t.config,i=r.directAccessBehavior,o=r.linksToRemove,s=__rest(t,["config"]);return(n=e.call(this,s)||this).directAccessBehavior=i,n.linksToRemove=o,n}return __extends(t,e),t.prototype.execute=function(){this.handleDirectAccessIfNecessary()},t.prototype.handleDirectAccessIfNecessary=function(){if(this.directAccessBehavior!==DirectAccessBehavior$1.DO_NOTHING&&this.shouldUrlBeRemoved(this.runtime.getURL(),this.runtime.getParsedURL()))if(this.directAccessBehavior===DirectAccessBehavior$1.NO_INDEX)this.runtime.getDOM().createElement("meta","head",{name:"robots",content:"noindex"});else assertNever(this.directAccessBehavior,"Unknown direct access behavior")},t.prototype.getSelectors=function(){return["a","link"]},t.prototype.executeOnLink=function(e,t,n){var r=n.getTagName();if(("a"===r||"link"===r)&&this.shouldUrlBeRemoved(e,t))return this.removeLink(n),{urlIsRemoved:!0}},t.prototype.removeLink=function(e){var t=e.getTagName();if("link"===t){var n=e.getAttribute("rel"),r=e.getAttribute("hreflang");"canonical"===n||"alternate"===n&&null!==r?e.remove():e.setAttribute("data-btfy-pw-id","pw_link_remove_".concat(this.id))}else"a"===t&&(e.removeAttribute("href"),e.setAttribute("data-btfy-pw-id","pw_link_remove_".concat(this.id)))},t.prototype.shouldUrlBeRemoved=function(e,t){return this.linksToRemove.type===LinksToRemoveType.BY_URL||this.linksToRemove.type===LinksToRemoveType.BY_SITECRAWLER_URLS||this.linksToRemove.type===LinksToRemoveType.BY_EXTERNAL_SOURCE?void 0!==this.data[e]:this.linksToRemove.type===LinksToRemoveType.BY_SCOPE?urlMatchRule(e,null!=t?t:this.runtime.parseURL(e),this.linksToRemove.scope):void assertNever(this.linksToRemove,"Invalid linksToRemove.type")},t}(BaseLinksModule),DirectAccessBehavior,LinksToNoFollowType;!function(e){e.NO_INDEX="no_index",e.DO_NOTHING="do_nothing"}(DirectAccessBehavior||(DirectAccessBehavior={})),function(e){e.BY_URL="by_url",e.BY_SCOPE="by_scope",e.BY_SITECRAWLER_URLS="by_sitecrawler_urls",e.BY_EXTERNAL_SOURCE="external_source"}(LinksToNoFollowType||(LinksToNoFollowType={}));var NoFollowLinksModule=function(e){function t(t){var n=this,r=t.config,i=r.directAccessBehavior,o=r.linksToNoFollow,s=__rest(t,["config"]);return(n=e.call(this,s)||this).directAccessBehavior=i,n.linksToNoFollow=o,n}return __extends(t,e),t.prototype.execute=function(){this.handleDirectAccessIfNecessary()},t.prototype.handleDirectAccessIfNecessary=function(){if(this.directAccessBehavior!==DirectAccessBehavior.DO_NOTHING&&this.shouldUrlBeNoFollow(this.runtime.getURL(),this.runtime.getParsedURL()))if(this.directAccessBehavior===DirectAccessBehavior.NO_INDEX)this.runtime.getDOM().createElement("meta","head",{name:"robots",content:"noindex"});else assertNever(this.directAccessBehavior,"Unknown direct access behavior")},t.prototype.getSelectors=function(){return["a"]},t.prototype.executeOnLink=function(e,t,n){"a"===n.getTagName()&&this.shouldUrlBeNoFollow(e,t)&&this.setNoFollowOnLink(n)},t.prototype.setNoFollowOnLink=function(e){var t="nofollow",n=e.getAttribute("rel");n&&n.includes("nofollow")||(n&&!n.includes("nofollow")&&(t="".concat(n," nofollow")),e.setAttribute("rel",t),e.setAttribute("data-btfy-pw-id","pw_link_nofollow_".concat(this.id)))},t.prototype.shouldUrlBeNoFollow=function(e,t){return this.linksToNoFollow.type===LinksToNoFollowType.BY_URL||this.linksToNoFollow.type===LinksToNoFollowType.BY_SITECRAWLER_URLS||this.linksToNoFollow.type===LinksToNoFollowType.BY_EXTERNAL_SOURCE?void 0!==this.data[e]:this.linksToNoFollow.type===LinksToNoFollowType.BY_SCOPE?urlMatchRule(e,t,this.linksToNoFollow.scope):void assertNever(this.linksToNoFollow,"Invalid linksToNoFollow.type")},t}(BaseLinksModule),_a,BrowserModules=(_a={},_a[ModuleType.CUSTOM_JS]=Module$3,_a[ModuleType.PAGE_EDITOR]=Module$1,_a[ModuleType.REDIRECT]=Module,_a[ModuleType.REMOVE_LINKS]=RemoveLinksModule,_a[ModuleType.NO_FOLLOW_LINKS]=NoFollowLinksModule,_a),LogMessageLevel;!function(e){e[e.debug=0]="debug",e[e.warning=1]="warning",e[e.error=2]="error"}(LogMessageLevel||(LogMessageLevel={}));var Logger=function(){function e(){this.actions=[],this.messages=[],this.properties={},this._context=null,this._currentModule=null}return e.prototype.context=function(e,t){this._context=e,t(),this._context=null},e.prototype.setCurrentModule=function(e){this._currentModule=e},e.prototype.clearCurrentModule=function(){this._currentModule=null},e.prototype.recordAction=function(e){var t=this._context||this._currentModule?__assign({},e):e;this._context&&(t.context=this._context),this._currentModule&&(t.module=this._currentModule),this.actions.push(t)},e.prototype.log=function(e,t){void 0===t&&(t=LogMessageLevel.debug),this.messages.push({message:e,level:t})},e.prototype.setProperty=function(e,t){var n;if(["string","number","boolean"].includes(typeof t)){var r=null!==(n=null==t?void 0:t.toString())&&void 0!==n?n:null;r&&r.length>PROPERTY_LOGGING_VALUE_MAX_LENGTH&&(r=r.substr(0,PROPERTY_LOGGING_VALUE_MAX_LENGTH),this.log("Property ".concat(e," truncated to ").concat(PROPERTY_LOGGING_VALUE_MAX_LENGTH," chars"),LogMessageLevel.warning)),this.properties[e]=r}else this.log("Property type for "+e+" is not supported (found "+typeof t+")",LogMessageLevel.error)},e.prototype.getProperty=function(e){var t;return null!==(t=this.properties[e])&&void 0!==t?t:null},e.prototype.getActionsCounters=function(e){var t={},n=this.actions;return e&&(n=n.filter(function(t){return e(t)})),n.forEach(function(e){var n=[e.module,e.element,e.action].join("\t");t[n]?t[n].count+=1:t[n]={action:e.action,operation:e.element,count:1}}),Object.values(t)},e.prototype.getActionsCountersFromModule=function(e){return this.getActionsCounters(function(t){return t.module===e})},e}(),StatusCodeChangeType;!function(e){e.PERMANENT_REDIRECT="permanent_redirect",e.TEMPORARY_REDIRECT="temporary_redirect",e.PAGE_NOT_FOUND="page_not_found",e.PAGE_GONE="page_gone"}(StatusCodeChangeType||(StatusCodeChangeType={}));var BaseParsedUrl=function(e,t,n,r){this.protocol=e,this.host=t,this.pathname=n,this.search=r},BaseRuntime=function(){function e(){this.statusCodeChangeToApply=null,this.logger=new Logger,this.performanceMeasures={}}return e.prototype.getLogger=function(){return this.logger},e.prototype.debugLog=function(e){for(var t=[],n=1;n=0})?Device.MOBILE:Device.DESKTOP}var BaseDOM=function(){function e(e){this.moduleMarkers=[],this.moduleExtractMarkers=[],this.moduleMarkersToReRun=[],this.moduleMarkerAttribute=void 0,this.runtime=e}return e.prototype.hasElement=function(e){return null!==this.getElement(e)},e.prototype.updateTitle=function(e){var t=this.getElement("head title");if(t){var n=t.getInnerHtml();t.setInnerHtml(e),this.runtime.getLogger().recordAction({element:Operation.TITLE,action:Action.CHANGED,oldValue:"".concat(n),value:"".concat(e)})}else this._createHeadIfNotExists(),this.createElement("title","head",{},e),this.runtime.getLogger().recordAction({element:Operation.TITLE,action:Action.ADDED,value:"".concat(e)})},e.prototype.updateH1=function(e){var t=this.getElement("h1");if(t){var n=null==t?void 0:t.getInnerHtml();t.setInnerHtml(e),this.runtime.getLogger().recordAction({element:Operation.H1,action:Action.CHANGED,oldValue:"".concat(n),value:"".concat(e)})}},e.prototype.createH1=function(e,t,n){var r=null;try{r=this.runtime.getDOM().getElement(t)}catch(e){throw new ModuleRuntimeError(ModuleRuntimeErrorType.INVALID_SELECTOR,"Invalid CSS selector: ".concat(t))}if(!r)throw new ModuleRuntimeError(ModuleRuntimeErrorType.ELEMENT_NOT_FOUND,"Couldn't find element: ".concat(t));var i="

"+e+"

";switch(n){case CssInsertStrategy.PREPEND:r.prepend(i);break;case CssInsertStrategy.APPEND:r.append(i);break;case CssInsertStrategy.INSERT_BEFORE:r.insertBefore(i);break;case CssInsertStrategy.INSERT_AFTER:r.insertAfter(i)}this.runtime.getLogger().recordAction({element:Operation.H1,action:Action.ADDED,value:"".concat(i),selector:t,strategy:n})},e.prototype.updateMetaDescription=function(e){var t=this.getElement("meta[name=description]");if(t){var n=t.getAttribute("content");t.setAttribute("content",e),this.runtime.getLogger().recordAction({element:Operation.DESCRIPTION,action:Action.CHANGED,oldValue:"".concat(n),value:"".concat(e)})}else this._createHeadIfNotExists(),this.createElement("meta","head",{name:"description",content:e}),this.runtime.getLogger().recordAction({element:Operation.DESCRIPTION,action:Action.ADDED,value:"".concat(e)})},e.prototype.updateCanonicalValue=function(e){var t=this.getElement("link[rel=canonical]");if(t){var n=t.getAttribute("href");t.setAttribute("href",e),this.runtime.getLogger().recordAction({element:Operation.CANONICAL,action:Action.CHANGED,oldValue:"".concat(n),value:"".concat(e)})}else this._createHeadIfNotExists(),this.createElement("link","head",{rel:"canonical",href:e}),this.runtime.getLogger().recordAction({element:Operation.CANONICAL,action:Action.ADDED,value:"".concat(e)})},e.prototype._createHeadIfNotExists=function(){this.hasElement("head")||this.createElement("head","html")},e.prototype.appendModuleMarkers=function(e){this.moduleMarkers=Array.from(new Set(this.moduleMarkers.concat(e)))},e.prototype.appendModuleExtractMarkers=function(e){this.moduleExtractMarkers=Array.from(new Set(this.moduleExtractMarkers.concat(e)))},e.prototype.removeModuleMarker=function(e){var t=__spreadArray([],this.moduleMarkers,!0),n=t.indexOf(e);-1!==n&&t.splice(n,1),this.moduleMarkers=t},e.prototype.removeModuleExtractMarker=function(e){var t=__spreadArray([],this.moduleExtractMarkers,!0),n=t.indexOf(e);-1!==n&&t.splice(n,1),this.moduleMarkers=t},e.prototype.setModuleMarkersToReRun=function(e){this.moduleMarkersToReRun=e},e.prototype.getModuleMarkers=function(){return this.moduleMarkers},e.prototype.getModuleExtractMarkers=function(){return this.moduleExtractMarkers},e.prototype.getModuleMarkersToReRun=function(){return this.moduleMarkersToReRun},e.prototype.getModuleMarkerAttribute=function(){return this.moduleMarkerAttribute},e}(),BaseElement=function(){};function collectUrlsOnPage(e,t){void 0===t&&(t=["a","link"]);var n=t.join(", "),r=[];e.getDOM().getAllElements(n).forEach(function(e){var t=e.getAttribute("href");t&&r.push(t)}),r=Array.from(new Set(r));var i=[];return e.parseAllURLs(r).forEach(function(e){e&&i.push(e.toString())}),i}function htmlToElements(e){var t=document.createElement("template");return e=e.trim(),t.innerHTML=e,Array.from(t.content.childNodes)}var EMPTY_TEXT_NODE_REGEX=/^[\s\u00A0]*$/;function setAttributeOnElement(e,t,n,r){if(void 0===r&&(r="span"),e instanceof HTMLElement||e instanceof Element)return e.setAttribute(t,n),e;if(e&&e.nodeType===Node.TEXT_NODE){if(null===e.textContent)return null;if(EMPTY_TEXT_NODE_REGEX.test(e.textContent))return null;var i=document.createElement(r);return i.textContent=e.textContent,i.setAttribute(t,n),i}if(e&&e.nodeType===Node.COMMENT_NODE)return null;throw new ModuleRuntimeError(ModuleRuntimeErrorType.UNKNOWN,"Error when attempting to set attribute on element, element is not HTMLElement or text or a comment")}function htmlToElementsWithMarkers(e,t,n,r){return void 0===r&&(r="span"),t&&n?htmlToElements(e).reduce(function(e,i){var o=setAttributeOnElement(i,n,t,r);return null!==o?__spreadArray(__spreadArray([],e,!0),[o],!1):e},[]):htmlToElements(e)}function getImpactedModuleMarkersFromMutationList(e,t){var n=[];return e.forEach(function(e){var r;if(e.target.nodeType===Node.ELEMENT_NODE){var i=e.target;i.hasAttribute(t)&&n.push(i.getAttribute(t))}if("characterData"===e.type&&(null===(r=e.target)||void 0===r?void 0:r.parentNode)){var o=e.target.parentNode;o.hasAttribute(t)&&n.push(o.getAttribute(t))}}),Array.from(new Set(n))}function getModulesMarkerNoLongerInDom(e,t,n){var r=e.getDOM().getAllElements("[".concat(n,"]")).map(function(e){return e.getAttribute(n)}).filter(function(e){return null!=e});return t.filter(function(e){return!r.includes(e)})}function getModuleExtractMarkersNoLongerInDom(e,t,n){var r=new Set(e.getDOM().getAllElements("[".concat(n,"]")).flatMap(function(e){return e.getAttribute(n)||[]}));return t.filter(function(e){return!r.has(e)})}function diffArrays(e,t){return[t.filter(function(t){return!new Set(e).has(t)}),Array.from(new Set(__spreadArray(__spreadArray([],e,!0),t,!0)))]}var BROWSER_DOM_MODULE_MARKER_ATTRIBUTE="data-btfy-pw-id",BrowserDOM=function(e){function t(t){var n=e.call(this,t)||this;return n.moduleMarkerAttribute=BROWSER_DOM_MODULE_MARKER_ATTRIBUTE,n.document=window.document,n}return __extends(t,e),t.prototype.createElement=function(e,t,n,r){var i=this.document.createElement(e);n&&Object.entries(n).forEach(function(e){var t=e[0],n=e[1];i.setAttribute(t,n)}),r&&(i.innerHTML=r);var o=this.document.querySelector(t);return o?(o.appendChild(i),new BrowserElement(i)):null},t.prototype.getElement=function(e){var t=this.document.querySelector(e);return t?new BrowserElement(t):null},t.prototype.getAllElements=function(e){var t=this.document.querySelectorAll(e);return Array.from(t).map(function(e){return new BrowserElement(e)})},t.prototype.waitForPageLoaded=function(){var e=this;return["complete","loaded","interactive"].includes(this.document.readyState)?Promise.resolve():new Promise(function(t){e.document.addEventListener("DOMContentLoaded",function(){t()})})},t.prototype.setPermanentRedirect=function(e){this.runtime.isBot()&&(window.location.href=e,this.runtime.getLogger().recordAction({element:Operation.PERMANENT_REDIRECT,action:Action.ADDED,value:e}))},t.prototype.setTemporaryRedirect=function(e){this.runtime.isBot()&&(window.location.href=e,this.runtime.getLogger().recordAction({element:Operation.TEMPORARY_REDIRECT,action:Action.ADDED,value:e}))},t.prototype.waitFor=function(e,t){return __awaiter(this,void 0,void 0,function(){var n;return __generator(this,function(r){if(!(n=this.getElement("html")))throw new ModuleRuntimeError(ModuleRuntimeErrorType.UNKNOWN,"No 'html' element in the page, while running waitFor()");return[2,n.waitFor(e,t)]})})},t.prototype.startModulesReRuns=function(e,t,n){var r=this,i=null;try{var o=Date.now();i=new MutationObserver(function(i){if(Date.now()-o>=n)return r.runtime.debugLog("Maximum re-run duration exceeded, stopping modules re-runs"),void s();try{var c=[],l=[];c=getImpactedModuleMarkersFromMutationList(i,r.moduleMarkerAttribute);var u=getModulesMarkerNoLongerInDom(r.runtime,r.getModuleMarkers(),r.moduleMarkerAttribute),h=getModuleExtractMarkersNoLongerInDom(r.runtime,r.getModuleExtractMarkers(),MODULE_EXTRACT_MARKER_ATTRIBUTE);l=getImpactedModuleMarkersFromMutationList(i,MODULE_EXTRACT_MARKER_ATTRIBUTE),c=Array.from(new Set(__spreadArray(__spreadArray([],c,!0),u,!0))),l=Array.from(new Set(__spreadArray(__spreadArray([],l,!0),h,!0)));var p=e.filter(function(e){return __spreadArray(__spreadArray([],c,!0),l,!0).some(function(t){return t.startsWith(e.id)})});p.length>0&&(s(),r.setModuleMarkersToReRun(c),t(p),r.setModuleMarkersToReRun([]),a())}catch(e){r.runtime.errorLog("Error during module re-runs: ".concat(e)),s()}});var s=function(){return i.disconnect()},a=function(){var e=r.document.documentElement;e&&i.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0})};a()}catch(e){this.runtime.errorLog("Error during module re-runs: ".concat(e))}return i?{disconnect:i.disconnect.bind(i)}:null},t.prototype.removeElementsWithMarker=function(e){var t=this;e&&this.getAllElements("[".concat(this.moduleMarkerAttribute,"]")).filter(function(n){var r=n.getAttribute(t.moduleMarkerAttribute);return r&&r.startsWith(e)}).forEach(function(e){return e.remove()})},t}(BaseDOM),BrowserElement=function(e){function t(t){var n=e.call(this)||this;return n.element=t,n}return __extends(t,e),t.prototype.getTagName=function(){return this.element.tagName.toLowerCase()},t.prototype.getInnerText=function(){var e;return null!==(e=this.element.innerText)&&void 0!==e?e:this.element.textContent},t.prototype.getInnerHtml=function(){return this.element.innerHTML},t.prototype.setInnerHtml=function(e){this.element.innerHTML=e},t.prototype.getAttributeNames=function(){return this.element.getAttributeNames()},t.prototype.getAttribute=function(e){return this.element.getAttribute(e)},t.prototype.setAttribute=function(e,t){this.element.setAttribute(e,t)},t.prototype.removeAttribute=function(e){this.element.removeAttribute(e)},t.prototype.remove=function(){this.element.remove()},t.prototype.append=function(e,t,n){var r=this;e&&htmlToElementsWithMarkers(e,t,n).forEach(function(e){r.element.append(e)})},t.prototype.prepend=function(e,t,n){var r=this;e&&htmlToElementsWithMarkers(e,t,n).reverse().forEach(function(e){r.element.prepend(e)})},t.prototype.insertAfter=function(e,t,n){var r=this;if(e){var i=this.element.parentNode;i&&htmlToElementsWithMarkers(e,t,n).reverse().forEach(function(e){i.insertBefore(e,r.element.nextSibling)})}},t.prototype.insertBefore=function(e,t,n){var r=this;if(e){var i=this.element.parentNode;if(i)htmlToElementsWithMarkers(e,t,n).forEach(function(e){i.insertBefore(e,r.element)})}},t.prototype.getElement=function(e){var n=this.element.querySelector(e);return n?new t(n):null},t.prototype.getAllElements=function(e){var n=this.element.querySelectorAll(e);return Array.from(n).map(function(e){return new t(e)})},t.prototype.getNextElementSibling=function(){return this.element.nextElementSibling?new t(this.element.nextElementSibling):null},t.prototype.getPreviousElementSibling=function(){return this.element.previousElementSibling?new t(this.element.previousElementSibling):null},t.prototype.waitFor=function(e,t){return __awaiter(this,void 0,void 0,function(){var n,r,i,o=this;return __generator(this,function(s){return n=null!==(i=null==t?void 0:t.timeout)&&void 0!==i?i:3e3,[2,new Promise(function(t,i){var s=o.getElement(e);if(s)t(s);else{var a=new MutationObserver(function(n,i){var s=o.getElement(e);s&&(i.disconnect(),clearTimeout(r),t(s))});a.observe(o.element,{subtree:!0,childList:!0}),r=setTimeout(function(){a.disconnect(),i(new ModuleRuntimeError(ModuleRuntimeErrorType.SELECTOR_TIMEOUT,"Timed out looking for selector: ".concat(e)))},n)}})]})})},t}(BaseElement),matchWildcard=function(e,t){return new RegExp("^"+t.split("*").map(function(e){return e.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")}).join(".*")+"$","m").test(e)},BOTS_DATA=[{id:1,userAgent:"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",matchMethod:"eq",device:"desktop"},{id:1,userAgent:"Googlebot/2.1 (+http://www.google.com/bot.html)",matchMethod:"eq",device:"desktop"},{id:1,userAgent:"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Chrome/* Safari/537.36",matchMethod:"wildcard",device:"desktop"},{id:2,userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/* Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",matchMethod:"wildcard",device:"mobile"},{id:20,userAgent:"AdsBot-Google (+http://www.google.com/adsbot.html)",matchMethod:"eq",device:"desktop"},{id:21,userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1 (compatible; AdsBot-Google-Mobile; +http://www.google.com/mobile/adsbot.html)",matchMethod:"eq",device:"mobile"},{id:21,userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1 (compatible; AdsBot-Google-Mobile; +http://www.google.com/mobile/adsbot.html)",matchMethod:"eq",device:"mobile"},{id:21,userAgent:"Mozilla/5.0 (Linux; Android 5.0; SM-G920A) AppleWebKit (KHTML, like Gecko) Chrome Mobile Safari (compatible; AdsBot-Google-Mobile; +http://www.google.com/mobile/adsbot.html)",matchMethod:"eq",device:"mobile"},{id:22,userAgent:"Mozilla/5.0 (compatible; Google-InspectionTool/1.0)",matchMethod:"eq",device:"desktop"},{id:23,userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/* Mobile Safari/537.36 (compatible; Google-InspectionTool/1.0)",matchMethod:"wildcard",device:"mobile"},{id:24,userAgent:"GoogleOther",matchMethod:"eq"},{id:24,userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/* Mobile Safari/537.36 (compatible; GoogleOther)",matchMethod:"wildcard"},{id:38,userAgent:"Googlebot-Image/1.0",matchMethod:"eq",device:"desktop"},{id:3,userAgent:"Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)",matchMethod:"eq",device:"desktop"},{id:3,userAgent:"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/* Safari/537.36 Edg/*",matchMethod:"wildcard",device:"desktop"},{id:3,userAgent:"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm) Chrome/* Safari/537.36",matchMethod:"wildcard",device:"desktop"},{id:4,userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)",matchMethod:"eq",device:"mobile"},{id:4,userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/*Mobile Safari/537.36 Edg/* (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)",matchMethod:"wildcard",device:"mobile"},{id:4,userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/* Mobile Safari/537.36 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)",matchMethod:"wildcard",device:"mobile"},{id:11,userAgent:"Mozilla/5.0 (compatible; adidxbot/2.0; +http://www.bing.com/bingbot.htm)",matchMethod:"eq",device:"desktop"},{id:12,userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 (compatible; adidxbot/2.0; +http://www.bing.com/bingbot.htm)",matchMethod:"eq",device:"mobile"},{id:12,userAgent:"Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 530) like Gecko (compatible; adidxbot/2.0; +http://www.bing.com/bingbot.htm)",matchMethod:"eq",device:"mobile"},{id:5,userAgent:"Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)",matchMethod:"eq",device:"desktop"},{id:5,userAgent:"Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/*",matchMethod:"wildcard",device:"desktop"},{id:5,userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B411 Safari/600.1.4 (compatible; YandexBot/3.0; +http://yandex.com/bots)",matchMethod:"eq",device:"desktop"},{id:6,userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B411 Safari/600.1.4 (compatible; YandexMobileBot/3.0; +http://yandex.com/bots)",matchMethod:"eq",device:"mobile"},{id:7,userAgent:"Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)",matchMethod:"eq",device:"desktop"},{id:7,userAgent:"Mozilla/5.0 (compatible; Baiduspider-render/2.0; +http://www.baidu.com/search/spider.html)",matchMethod:"eq",device:"desktop"},{id:18,userAgent:"Mozilla/5.0 (Linux;u;Android 4.2.2;zh-cn;) AppleWebKit/534.46 (KHTML,like Gecko) Version/5.1 Mobile Safari/10600.6.3 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)",matchMethod:"eq",device:"mobile"},{id:8,userAgent:"sw-test-bot",matchMethod:"contains"},{id:8,userAgent:"botify-bot-sw-test",matchMethod:"contains"},{id:16,userAgent:"botify-bot-sw-sitecrawler",matchMethod:"startswith"},{id:17,userAgent:"botify-bot-sw-",matchMethod:"startswith"},{id:13,userAgent:"botify-bot-",matchMethod:"startswith"},{id:9,userAgent:"Mozilla/5.0 (compatible; botify; http://botify.com)",matchMethod:"eq",device:"desktop"},{id:10,userAgent:"Mozilla/5.0 Mobile (compatible; botify; http://botify.com)",matchMethod:"eq",device:"mobile"},{id:15,userAgent:"Mozilla/5.0 (*; *) AppleWebKit/* (KHTML, like Gecko) Version/* Mobile/* Safari/* (Applebot/*)",matchMethod:"wildcard",device:"mobile"},{id:14,userAgent:"Mozilla/5.0 (*; *) AppleWebKit/* (KHTML, like Gecko) Version/* Safari/* (Applebot/*)",matchMethod:"wildcard",device:"desktop"},{id:19,userAgent:"Mozilla/5.0 (compatible; Yeti/*; +http://naver.me/spd)",matchMethod:"wildcard",device:"desktop"},{id:19,userAgent:"Mozilla/5.0 (compatible; Yeti/*; +https://naver.me/spd)",matchMethod:"wildcard",device:"desktop"},{id:19,userAgent:"Mozilla/5.0 (Windows NT *; Win64; x64) Apple*/* (KHTML, like Gecko; compatible; Yeti/*; +http://naver.me/spd) Chrome/* Safari/*",matchMethod:"wildcard",device:"desktop"},{id:19,userAgent:"Mozilla/5.0 (Windows NT *; Win64; x64) Apple*/* (KHTML, like Gecko; compatible; Yeti/*; +https://naver.me/spd) Chrome/* Safari/*",matchMethod:"wildcard",device:"desktop"},{id:19,userAgent:"Mozilla/5.0 (Windows NT *; Win64; x64) Apple*/* (KHTML, like Gecko) Chrome/* Safari/* (compatible; Yeti/*; +https://naver.me/spd)",matchMethod:"wildcard",device:"desktop"},{id:19,userAgent:"Mozilla/5.0 (Windows NT *; Win64; x64) Apple*/* (KHTML, like Gecko) Chrome/* Safari/* (compatible; Yeti/*; +http://naver.me/spd)",matchMethod:"wildcard",device:"desktop"},{id:25,userAgent:"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/*; +https://openai.com/gptbot",matchMethod:"wildcard",device:"desktop"},{id:25,userAgent:"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/*; +https://openai.com/gptbot)",matchMethod:"wildcard",device:"desktop"},{id:26,userAgent:"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/*; +https://openai.com/bot",matchMethod:"wildcard",device:"desktop"},{id:27,userAgent:"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; OAI-SearchBot/*; +https://openai.com/searchbot",matchMethod:"wildcard",device:"desktop"},{id:27,userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X *) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/* Safari/537.36; compatible; OAI-SearchBot/*; +https://openai.com/searchbot",matchMethod:"wildcard",device:"desktop"},{id:28,userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X *) AppleWebKit/* (KHTML, like Gecko) Version/* Safari/* (Amazonbot/*; +https://developer.amazon.com/support/amazonbot)",matchMethod:"wildcard",device:"desktop"},{id:28,userAgent:"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Amazonbot/*; +https://developer.amazon.com/support/amazonbot) Chrome/* Safari/537.36",matchMethod:"wildcard",device:"desktop"},{id:29,userAgent:"anthropic-ai",matchMethod:"contains",device:"desktop"},{id:30,userAgent:"Mozilla/5.0 AppleWebKit/* (KHTML, like Gecko; compatible; ClaudeBot/*; +claudebot@anthropic.com)",matchMethod:"wildcard",device:"desktop"},{id:31,userAgent:"Claude-Web",matchMethod:"contains",device:"desktop"},{id:32,userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/* (KHTML, like Gecko) Chrome/* Mobile Safari/*; Bytespider",matchMethod:"wildcard",device:"mobile"},{id:32,userAgent:"Mozilla/5.0 (Linux; Android *; * Build/*) AppleWebKit/* (KHTML, like Gecko) Chrome/* Mobile Safari/*; Bytespider",matchMethod:"wildcard",device:"mobile"},{id:33,userAgent:"CCBot/* (+https://commoncrawl.org/bot.html)",matchMethod:"wildcard",device:"desktop"},{id:34,userAgent:"Mozilla/5.0 (compatible; FacebookBot/*; +https://developers.facebook.com/docs/sharing/webmasters/facebookbot/)",matchMethod:"wildcard",device:"desktop"},{id:35,userAgent:"meta-externalagent/*",matchMethod:"wildcard",device:"desktop"},{id:36,userAgent:"Mozilla/5.0 AppleWebKit/* (KHTML, like Gecko; compatible; PerplexityBot/*; +https://perplexity.ai/perplexitybot)",matchMethod:"wildcard",device:"desktop"},{id:41,userAgent:"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Perplexity-User/*; +https://perplexity.ai/perplexity-user)",matchMethod:"wildcard",device:"desktop"},{id:37,userAgent:"Mozilla/5.0 (compatible; YouBot/*; +https://about.you.com/youbot/)",matchMethod:"wildcard",device:"desktop"},{id:39,userAgent:"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/* Safari/537.36 Prerender (+https://github.com/prerender/prerender)",matchMethod:"wildcard",device:"desktop"},{id:40,userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/* Mobile Safari/537.36 Prerender (+https://github.com/prerender/prerender)",matchMethod:"wildcard",device:"mobile"}],BotsRegistry=function(){function e(e){this.bots=null!=e?e:BOTS_DATA,this._cache={}}return e.prototype.uaIsBot=function(e,t){return void 0===t&&(t=!1),null!==this.getBotDefinitionFromUA(e,t)},e.prototype.getBotDefinitionFromUA=function(e,t){void 0===t&&(t=!1);var n=t?e.toLowerCase():e;if(this._cache[n])return this.bots[this._cache[n]];for(var r=0;r=0||o==UserAgentMatchingPredicate.WILDCARD&&matchWildcard(n,i))return this._cache[n]=r,this.bots[r]}return null},e.prototype.getDeviceFromUA=function(e,t){var n;void 0===t&&(t=!1);var r=this.getBotDefinitionFromUA(e,t);return null!==(n=null==r?void 0:r.device)&&void 0!==n?n:null},e.prototype.getBotIdFromUA=function(e,t){var n;void 0===t&&(t=!1);var r=this.getBotDefinitionFromUA(e,t);return null!==(n=null==r?void 0:r.id)&&void 0!==n?n:null},e}(),PW_DISABLE_FLAG="pageworkers.disable",PW_ENABLE_DEBUG_MODE_FLAG="pageworkers.enable_debug_mode",PW_INCLUDE_MODULES="pageworkers.include_modules",PW_EXCLUDE_MODULES="pageworkers.exclude_modules",botsRegistry=new BotsRegistry,BrowserRuntime=function(e){function t(){var t,n=e.call(this)||this;n.urlsWithFetchedData=[],n.sessionId="",n.isRandomIdMismatched=!1;var r=n.extractForceParamsFromUrl(window.location.href),i=r.url,o=r.forceDevice,s=r.forceIsBot,a=r.stableIdsOfModulesToPreview;n.dom=new BrowserDOM(n),n.url=i,n.parsedURL=n.parseURL(n.url);var c=navigator.userAgent;return n.device=null!==(t=null!=o?o:botsRegistry.getDeviceFromUA(c))&&void 0!==t?t:getDevice(c),n.botId=s?1:botsRegistry.getBotIdFromUA(c),n._isBot=null!=s?s:botsRegistry.uaIsBot(c),n.stableIdsOfModulesToPreview=a,n}return __extends(t,e),t.prototype.getDOM=function(){return this.dom},t.prototype.getDevice=function(){return this.device},t.prototype.getSessionId=function(){return this.sessionId},t.prototype.setSessionId=function(e){this.sessionId=e},t.prototype.getURL=function(){return this.url},t.prototype.getRawURL=function(){return this.url},t.prototype.getParsedURL=function(){return this.parsedURL},t.prototype.parseURL=function(e){return new BrowserParsedUrl(e,document.baseURI)},t.prototype.parseAllURLs=function(e){var t=this;return e.map(function(e){try{return t.parseURL(e)}catch(e){return null}})},t.prototype.getBotId=function(){return this.botId},t.prototype.isBot=function(){return this._isBot},t.prototype.getEnvironment=function(){return Environment.BROWSER},t.prototype.isPageWorkersDisabled=function(){try{return"true"===localStorage.getItem(PW_DISABLE_FLAG)}catch(e){return!1}},t.prototype.isDebugModeEnabled=function(){try{return"true"===(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(PW_ENABLE_DEBUG_MODE_FLAG))}catch(e){return!1}},t.prototype.isModuleExcluded=function(e){try{if(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(PW_INCLUDE_MODULES))return!JSON.parse(localStorage.getItem(PW_INCLUDE_MODULES)).includes(e);if(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(PW_EXCLUDE_MODULES))return JSON.parse(localStorage.getItem(PW_EXCLUDE_MODULES)).includes(e)}catch(e){}return!1},t.prototype.shouldModuleRun=function(e){return!this.isDebugModeEnabled()||!this.isModuleExcluded(e)},t.prototype.getUrlsWithFetchedData=function(){return this.urlsWithFetchedData},t.prototype.setUrlsWithFetchedData=function(e){this.urlsWithFetchedData=__spreadArray([],e,!0)},t.prototype.getIsRandomIdMismatched=function(){return this.isRandomIdMismatched},t.prototype.setIsRandomIdMismatched=function(e){this.isRandomIdMismatched=e},t.prototype.extractForceParamsFromUrl=function(e){var t,n,r,i,o=e.split("#activation:"),s=o[0],a=o[1],c=null,l=null,u=[];if(a){var h=new URLSearchParams(a),p=null!==(n=null===(t=h.get("forceDevice"))||void 0===t?void 0:t.toLowerCase())&&void 0!==n?n:null;if(p){if(!Object.values(Device).includes(p))throw new Error("forceDevice is not valid");c=p}var d=null!==(i=null===(r=h.get("forceContext"))||void 0===r?void 0:r.toLowerCase())&&void 0!==i?i:null;if(d)if("bot"===d)l=!0;else if("user"!==d)throw new Error("forceContext is not valid");u=h.getAll("forceModuleDraft")}return{url:s,forceDevice:c,forceIsBot:l,stableIdsOfModulesToPreview:u}},t.prototype.applyPermanentRedirect=function(e){window.location.assign(e)},t.prototype.applyTemporaryRedirect=function(e){return this.applyPermanentRedirect(e)},t.prototype.applyForceCacheMiss=function(){},t.prototype.applyPageGone=function(){var e;null===(e=this.getDOM().getElement("body"))||void 0===e||e.setInnerHtml("410 Gone")},t.prototype.applyPageNotFound=function(){var e;null===(e=this.getDOM().getElement("body"))||void 0===e||e.setInnerHtml("404 Not Found")},t}(BaseRuntime),BrowserParsedUrl=function(e){function t(t,n){var r=this,i=new URL(t,n);return(r=e.call(this,i.protocol,i.host,i.pathname,i.search)||this).url=i,r}return __extends(t,e),t.prototype.toString=function(){return this.url.toString()},t}(BaseParsedUrl),PageWorkers=function(){function e(e){var t=e.runtime,n=e.modules,r=e.websiteId,i=e.tagVersion,o=void 0===i?"v0.0.0":i,s=e.getConfigsWithoutLinksData,a=e.getConfigsWithLinksData,c=e.uploadLogs,l=e.enableModulesReruns,u=void 0!==l&&l,h=e.maximumModuleRerunsCount,p=void 0===h?0:h,d=e.maximumModulesRerunsDuration,f=void 0===d?0:d,m=e.ulrManagerModulesRerunDelay;this.instantiatedModules={allModules:[],linksModules:[]},this.runtime=t,this.modules=n,this.websiteId=r,this.tagVersion=o,this.uploadLogs=c,this.logger=this.runtime.getLogger(),this.getConfigsWithoutLinksData=s,this.getConfigsWithLinksData=a,this.enableModulesReruns=u,this.maximumModuleRerunsCount=p,this.maximumModulesRerunsDuration=f,this.ulrManagerModulesRerunDelay=m}return e.prototype.run=function(){return __awaiter(this,void 0,void 0,function(){var e,t,n,r,i,o=this;return __generator(this,function(s){switch(s.label){case 0:if(this.runtime.startPerformanceMeasurement("total"),this.runtime.isPageWorkersDisabled())return this.runtime.debugLog('PageWorkers tag is currently disabled because of the "'.concat(PW_DISABLE_FLAG,'" flag.')),[2];e=[],s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.fetchModulesConfigsWithoutLinksData()];case 2:return t=s.sent(),[3,4];case 3:return n=s.sent(),this.runtime.errorLog("Failed retrieving module configs (without links data)",n),[2];case 4:return[4,this.waitForPageLoaded()];case 5:if(s.sent(),this.instantiateModules(t),this.executeModulesOnPage(this.instantiatedModules.allModules,e),r=this.instantiatedModules.allModules.filter(function(e){return e.type===ModuleType.PAGE_EDITOR}),i=this.enableModulesReruns?this.runtime.getDOM().startModulesReRuns(r,this.executeModulesOnPage.bind(this),this.maximumModulesRerunsDuration):null,!t.some(function(e){return e.shouldResolveDataForAllUrls}))return[3,10];s.label=6;case 6:return s.trys.push([6,8,,9]),[4,this.fetchUrlsDataAndExecuteLinksModules()];case 7:return s.sent(),[3,9];case 8:return s.sent(),[2];case 9:this.ulrManagerModulesRerunDelay&&setTimeout(function(){return __awaiter(o,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return[4,this.fetchUrlsDataAndExecuteLinksModules()];case 1:return e.sent(),this.runtime.debugLog("Finished re-runs of url manager modules after ".concat(this.ulrManagerModulesRerunDelay,"ms.")),[2]}})})},this.ulrManagerModulesRerunDelay),s.label=10;case 10:return this.runtime.logRedirection(),this.runtime.endPerformanceMeasurement("total"),this.logPerformanceMeasures(),[4,this.buildAndUploadLogs(e)];case 11:return s.sent(),this.runtime.applyRedirection(),i&&setTimeout(function(){i.disconnect(),o.runtime.debugLog("Stopping modules re-runs after ".concat(o.maximumModulesRerunsDuration,"ms."))},this.maximumModulesRerunsDuration),[2]}})})},e.prototype.fetchModulesConfigsWithoutLinksData=function(){return __awaiter(this,void 0,void 0,function(){var e;return __generator(this,function(t){switch(t.label){case 0:return this.runtime.startPerformanceMeasurement("getting configs"),[4,this.getConfigsWithoutLinksData(this.runtime)];case 1:return e=t.sent(),this.runtime.endPerformanceMeasurement("getting configs"),[2,e]}})})},e.prototype.waitForPageLoaded=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(e){switch(e.label){case 0:return this.runtime.startPerformanceMeasurement("waiting for page to be loaded"),[4,this.runtime.getDOM().waitForPageLoaded()];case 1:return e.sent(),this.runtime.endPerformanceMeasurement("waiting for page to be loaded"),[2]}})})},e.prototype.instantiateModules=function(e){var t=this,n=[],r=[];e.forEach(function(e){var i=t.modules[e.type];if(i){var o=new i({runtime:t.runtime,id:e.id,type:e.type,version:e.version,context:e.context,scope:e.scope,scopeType:e.scopeType,device:e.device,config:e.config,data:e.data,maximumModuleRerunsCount:t.maximumModuleRerunsCount});o.shouldRun()&&(n.push(o),o instanceof BaseLinksModule&&r.push(o))}else t.runtime.errorLog("No module matching type: ".concat(e.type))}),this.instantiatedModules.allModules=__spreadArray([],n,!0),this.instantiatedModules.linksModules=__spreadArray([],r,!0)},e.prototype.updateLinksModulesData=function(e){var t=this;this.instantiatedModules.linksModules.forEach(function(n){var r=e.find(function(e){return e.id===n.id});r?n.updateData(r.data):t.runtime.errorLog("No data found for module with id ".concat(n.id))})},e.prototype.executeModulesOnPage=function(e,t){var n=this;e.forEach(function(e){var r=null,i=null,o=null;try{n.logger.setCurrentModule(e.id);var s="".concat("executing module"," (id=").concat(e.id," type=").concat(e.type,")");n.runtime.startPerformanceMeasurement(s),e.run(),n.runtime.endPerformanceMeasurement(s);var a=n.runtime.performanceMeasures[s];a.end&&(o=a.end-a.start)}catch(t){t instanceof ModuleRuntimeError?(r=t.type,i=t.details):(r=ModuleRuntimeErrorType.UNKNOWN,i=t.toString()),n.runtime.errorLog("Error while running module ".concat(e.id,": error_type: ").concat(r,"; error_message: ").concat(i))}finally{n.runtime.getLogger().clearCurrentModule()}null==t||t.push({id:e.id,type:e.type,version:e.version,error_type:r,error_message:i,time_execute_ms:o})})},e.prototype.fetchUrlsDataAndExecuteLinksModules=function(){return __awaiter(this,void 0,void 0,function(){var e,t;return __generator(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getConfigsWithLinksData(this.runtime)];case 1:return(e=n.sent()).length>0&&this.updateLinksModulesData(e),this.executeLinksModules(this.instantiatedModules.linksModules),[3,3];case 2:throw t=n.sent(),this.runtime.errorLog("Failed retrieving module configs (with links data)",t),t;case 3:return[2]}})})},e.prototype.executeLinksModules=function(e){var t=this;if(0!==e.length){this.runtime.startPerformanceMeasurement("links modules: total");var n=[],r=[],i=[],o=[];this.runtime.startPerformanceMeasurement("links modules: collecting links"),this.runtime.getDOM().getAllElements(mergeLinksModulesSelectors(e)).forEach(function(e){var t=e.getAttribute("href");t&&(n.push(e),r.push(t))}),this.runtime.endPerformanceMeasurement("links modules: collecting links"),this.runtime.startPerformanceMeasurement("links modules: parsing links"),this.runtime.parseAllURLs(r).forEach(function(e){i.push(e),o.push(null!==e?e.toString():null)}),this.runtime.endPerformanceMeasurement("links modules: parsing links"),this.runtime.startPerformanceMeasurement("links modules: execution"),n.forEach(function(n,s){var a;if(null!==i[s]&&null!==o[s]){var c=r[s],l=i[s],u=o[s];try{for(var h=0,p=e;h { ... })` to test Custom JS code from your devtools"),window.runPageworkersSnippet=function(t){t(e)})}function formatRawModuleConfig(e,t,n){return void 0===n&&(n=[]),t.reduce(function(t,r){var i;try{var o=null!==r.data&&void 0!==r.data?((i={})[e.getURL()]=r.data,i):{},s=__assign(__assign({},r),{data:__assign(__assign({},o),formatDataForUrls(n,r.dataForUrls))});return delete s.dataForUrls,__spreadArray(__spreadArray([],t,!0),[s],!1)}catch(n){return e.debugLog("Error while formatting module:",n),t}},[])}function formatDataForUrls(e,t){return void 0===t&&(t=[]),null===t?{}:e.reduce(function(e,n,r){var i;return t[r]?__assign(__assign({},e),((i={})[n]=t[r],i)):e},{})}function getTagVersion(){return"undefined"==typeof __PAGEWORKERS_TAG_VERSION__?"v0.0.0":__PAGEWORKERS_TAG_VERSION__}var SESSION_HEADER="X-Pw-Session",TIMESTAMP_HEADER="X-Pw-Timestamp",RANDOM_ID_HEADER="X-Pw-Random-Id",DEFAULT_SESSION="NOT_SET";function fetchAndFormatModuleConfigs(e){return __awaiter(this,arguments,void 0,function(e,t){var n,r,i,o,s,a;return void 0===t&&(t=[]),__generator(this,function(c){switch(c.label){case 0:return n=e.getURL(),r=botifyHash(n),i=generateRandomId(100),[4,fetch("https://".concat(__PAGEWORKERS_DELIVERY_API_HOST__,"/").concat(__PAGEWORKERS_WEBSITE_ID__,"/").concat(r,"?id=").concat(i),{method:"POST",headers:(a={"Content-Type":"application/json"},a[SESSION_HEADER]=e.getSessionId(),a[TIMESTAMP_HEADER]=Date.now().toString(),a),body:JSON.stringify({websiteId:__PAGEWORKERS_WEBSITE_ID__,url:n,urls:t,botId:e.getBotId(),device:e.getDevice(),environment:e.getEnvironment(),modulesToPreview:e.stableIdsOfModulesToPreview,randomId:i.toString(),tagVersion:getTagVersion()})})];case 1:if(!(o=c.sent()).ok)throw new Error("Delivery API responded with a non-200 status (status=".concat(o.status,")"));return o.headers.get(RANDOM_ID_HEADER)!==i.toString()&&e.setIsRandomIdMismatched(!0),e.setSessionId(o.headers.get(SESSION_HEADER)||DEFAULT_SESSION),[4,o.json()];case 2:return s=c.sent(),[2,formatRawModuleConfig(e,s,t)]}})})}function getConfigsWithLinksData(e){return __awaiter(this,void 0,void 0,function(){var t,n,r,i,o;return __generator(this,function(s){switch(s.label){case 0:return e.startPerformanceMeasurement("collecting urls"),t=collectUrlsOnPage(e),e.endPerformanceMeasurement("collecting urls"),n=diffArrays(e.getUrlsWithFetchedData(),t),r=n[0],i=n[1],0===r.length?[2,[]]:(e.setUrlsWithFetchedData(i),e.startPerformanceMeasurement("getting data for links modules"),[4,fetchAndFormatModuleConfigs(e,r)]);case 1:return o=s.sent(),e.endPerformanceMeasurement("getting data for links modules"),[2,o]}})})}var runtime=new BrowserRuntime;new PageWorkers({runtime:runtime,modules:BrowserModules,websiteId:__PAGEWORKERS_WEBSITE_ID__,tagVersion:getTagVersion(),getConfigsWithoutLinksData:fetchAndFormatModuleConfigs,enableModulesReruns:__PAGEWORKERS_ENABLE_MODULES_RERUNS__,maximumModulesRerunsDuration:__PAGEWORKERS_MAXIMUM_MODULES_RERUNS_DURATION__,maximumModuleRerunsCount:__PAGEWORKERS_MAXIMUM_MODULES_RERUNS_COUNT__,ulrManagerModulesRerunDelay:__PAGEWORKERS_URL_MANAGER_MODULES_RERUN_DELAY__,getConfigsWithLinksData:getConfigsWithLinksData,uploadLogs:makeBrowserLogUploader(runtime)}).run(),registerDebuggingTools(runtime)})(); })();