@froomle/frontend-sdk 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- "use strict";var FroomleFrontendSdk=(()=>{var we=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var rt=Object.prototype.hasOwnProperty;var st=(u,e)=>{for(var t in e)we(u,t,{get:e[t],enumerable:!0})},nt=(u,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of tt(e))!rt.call(u,n)&&n!==t&&we(u,n,{get:()=>e[n],enumerable:!(r=et(e,n))||r.enumerable});return u};var it=u=>nt(we({},"__esModule",{value:!0}),u);var ct={};st(ct,{RecommendationItem:()=>W,RecommendationList:()=>Q,Recommendations:()=>z,setConsent:()=>at,setDeviceId:()=>Qe,setEnvironment:()=>Ke,setPageVisit:()=>Xe,setRequestDomain:()=>We,setUserId:()=>ze});var s=class u{static global(e){return u.globals[e]?u.globals[e]:u.globals[e]={}}static createStatic(e,t,r){let n=null;Object.defineProperty(e,t,{enumerable:!0,get:function(){return r!=null&&(n=r(),r=null),n},set:function(i){r!=null&&(n=r(),r=null),n=i}})}static iterator(e){if(Array.isArray(e)){let t=e;return function(){return u.mkIter(t)}}else return typeof e.iterator=="function"?e.iterator.bind(e):e.iterator}static getIterator(e){return Array.isArray(e)?u.mkIter(e):e.iterator()}static mkIter(e){return new xe(e)}static extend(e){function t(){this[u.new].apply(this,arguments)}return Object.setPrototypeOf(t.prototype,e.prototype),t}static inherits(e,t){t==null&&(t=!1);function r(){t&&e&&r[u.init]&&r[u.init](),this[u.new].apply(this,arguments)}return t?r[u.init]=()=>{let n=e();n[u.init]&&n[u.init](),Object.setPrototypeOf(r.prototype,n.prototype),r[u.init]=void 0}:e&&e[u.init]?(t=!0,r[u.init]=()=>{e[u.init]&&e[u.init](),Object.setPrototypeOf(r.prototype,e.prototype),r[u.init]=void 0}):e&&Object.setPrototypeOf(r.prototype,e.prototype),r}static bind(e,t){if(t==null)return null;t.__id__==null&&(t.__id__=u.fid++);let r=null;return e.hx__closures__==null?e.hx__closures__={}:r=e.hx__closures__[t.__id__],r==null&&(r=t.bind(e),e.hx__closures__[t.__id__]=r),r}static get __name__(){return"genes.Register"}get __class__(){return u}};s.$global=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:void 0;s.globals={};s.new=Symbol();s.init=Symbol();s.fid=0;var xe=s.global("$hxClasses")["genes._Register.ArrayIterator"]=class $e extends s.inherits(){[s.new](e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}static get __name__(){return"genes._Register.ArrayIterator"}get __class__(){return $e}};xe.prototype.array=null;xe.prototype.current=null;var pt=s.$global,z=function(){};z.__isInterface__=!0;var Q=function(){};Q.__isInterface__=!0;var W=function(){};W.__isInterface__=!0;var yt=s.$global,me=s.global("$hxClasses")["haxe.ValueException"]=class Ce extends s.inherits(()=>k,!0){[s.new](e,t,r){super[s.new](String(e),t,r),this.value=e}unwrap(){return this.value}static get __name__(){return"haxe.ValueException"}static get __super__(){return k}get __class__(){return Ce}};me.prototype.value=null;var vt=s.$global,k=s.global("$hxClasses")["haxe.Exception"]=class ne extends s.inherits(()=>Error,!0){[s.new](e,t,r){Error.call(this,e),this.message=e,this.__previousException=t,this.__nativeException=r!=null?r:this}unwrap(){return this.__nativeException}get_native(){return this.__nativeException}static caught(e){return e instanceof ne?e:e instanceof Error?new ne(e.message,null,e):new me(e,null,e)}static thrown(e){return e instanceof ne?e.get_native():e instanceof Error?e:new me(e)}static get __name__(){return"haxe.Exception"}static get __super__(){return Error}get __class__(){return ne}};k.prototype.native=null;k.prototype.__skipStack=null;k.prototype.__nativeException=null;k.prototype.__previousException=null;var Dt=s.$global,ve=s.global("$hxClasses")["js.Browser"]=class qe{static get supported(){return this.get_supported()}static get_supported(){return typeof window!="undefined"&&typeof window.location!="undefined"?typeof window.location.protocol=="string":!1}static createXMLHttpRequest(){if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")return new"ActiveXObject"("Microsoft.XMLHTTP");throw k.thrown("Unable to create XMLHttpRequest object.")}static get __name__(){return"js.Browser"}get __class__(){return qe}};var Pt=s.$global,F=s.global("$hxEnums")["haxe.io.Error"]={__ename__:"haxe.io.Error",Blocked:{_hx_name:"Blocked",_hx_index:0,__enum__:"haxe.io.Error"},Overflow:{_hx_name:"Overflow",_hx_index:1,__enum__:"haxe.io.Error"},OutsideBounds:{_hx_name:"OutsideBounds",_hx_index:2,__enum__:"haxe.io.Error"},Custom:Object.assign(u=>({_hx_index:3,__enum__:"haxe.io.Error",e:u}),{_hx_name:"Custom",__params__:["e"]})};F.__constructs__=[F.Blocked,F.Overflow,F.OutsideBounds,F.Custom];F.__empty_constructs__=[F.Blocked,F.Overflow,F.OutsideBounds];var qt=s.$global,H=s.global("$hxEnums")["haxe.io.Encoding"]={__ename__:"haxe.io.Encoding",UTF8:{_hx_name:"UTF8",_hx_index:0,__enum__:"haxe.io.Encoding"},RawNative:{_hx_name:"RawNative",_hx_index:1,__enum__:"haxe.io.Encoding"}};H.__constructs__=[H.UTF8,H.RawNative];H.__empty_constructs__=[H.UTF8,H.RawNative];var Tt=s.$global,G=s.global("$hxClasses")["haxe.io.Bytes"]=class Re extends s.inherits(){[s.new](e){this.length=e.byteLength,this.b=new Uint8Array(e),this.b.bufferValue=e,e.hxBytes=this,e.bytes=this.b}getString(e,t,r){if(e<0||t<0||e+t>this.length)throw k.thrown(F.OutsideBounds);r==null&&(r=H.UTF8);let n="",i=this.b,o=e,a=e+t;switch(r._hx_index){case 0:let f=e>0;for(;o<a;){let h=i[o++];if(h<128){if(h==0)break;n+=String.fromCodePoint(h)}else if(h<224){let c=(h&63)<<6|i[o++]&127;n+=String.fromCodePoint(c)}else if(h<240){let c=i[o++],_=(h&31)<<12|(c&127)<<6|i[o++]&127;n+=String.fromCodePoint(_)}else{let c=i[o++],_=i[o++],m=(h&15)<<18|(c&127)<<12|(_&127)<<6|i[o++]&127;n+=String.fromCodePoint(m)}}break;case 1:for(;o<a;){let h=i[o++]|i[o++]<<8;n+=String.fromCodePoint(h)}break}return n}static ofData(e){let t=e.hxBytes;return t!=null?t:new Re(e)}static get __name__(){return"haxe.io.Bytes"}get __class__(){return Re}};G.prototype.length=null;G.prototype.b=null;var jt=s.$global,T=s.global("$hxClasses")["haxe.http.HttpBase"]=class Be extends s.inherits(){[s.new](e){this.url=e,this.headers=[],this.params=[],this.emptyOnData=s.bind(this,this.onData)}get responseData(){return this.get_responseData()}setHeader(e,t){let r=0,n=this.headers.length;for(;r<n;){let i=r++;if(this.headers[i].name==e){this.headers[i]={name:e,value:t};return}}this.headers.push({name:e,value:t})}setPostData(e){this.postData=e,this.postBytes=null}onData(e){}onBytes(e){}onError(e){}onStatus(e){}hasOnData(){return s.bind(this,this.onData)!=this.emptyOnData}success(e){this.responseBytes=e,this.responseAsString=null,this.hasOnData()&&this.onData(this.get_responseData()),this.onBytes(this.responseBytes)}get_responseData(){return this.responseAsString==null&&this.responseBytes!=null&&(this.responseAsString=this.responseBytes.getString(0,this.responseBytes.length,H.UTF8)),this.responseAsString}static get __name__(){return"haxe.http.HttpBase"}get __class__(){return Be}};T.prototype.url=null;T.prototype.responseBytes=null;T.prototype.responseAsString=null;T.prototype.postData=null;T.prototype.postBytes=null;T.prototype.headers=null;T.prototype.params=null;T.prototype.emptyOnData=null;var Jt=s.$global,pe=s.global("$hxClasses")["haxe.iterators.MapKeyValueIterator"]=class Ve extends s.inherits(){[s.new](e){this.map=e,this.keys=e.keys()}hasNext(){return this.keys.hasNext()}next(){let e=this.keys.next();return{value:this.map.get(e),key:e}}static get __name__(){return"haxe.iterators.MapKeyValueIterator"}get __class__(){return Ve}};pe.prototype.map=null;pe.prototype.keys=null;var zt=s.$global,Ie=function(){};Ie.__isInterface__=!0;var Gt=s.$global,Ee=s.global("$hxClasses")["js.Boot"]=class ie{static __string_rec(e,t){if(e==null)return"null";if(t.length>=5)return"<...>";let r=typeof e;switch(r=="function"&&(e.__name__||e.__ename__)&&(r="object"),r){case"function":return"<function>";case"object":if(e.__enum__){let h=s.global("$hxEnums")[e.__enum__].__constructs__[e._hx_index],c=h._hx_name;return h.__params__?(t=t+" ",c+"("+(function(_){var m;let E=[];{let g=0,p=h.__params__;for(;g<p.length;){let v=p[g];g=g+1,E.push(ie.__string_rec(e[v],t))}}return m=E,m})(this).join(",")+")"):c}if(e instanceof Array){let f="[";t+=" ";let h=0,c=e.length;for(;h<c;){let _=h++;f+=(_>0?",":"")+ie.__string_rec(e[_],t)}return f+="]",f}let n;try{n=e.toString}catch{return"???"}if(n!=null&&n!=Object.toString&&typeof n=="function"){let f=e.toString();if(f!="[object Object]")return f}let i=`{
1
+ "use strict";var FroomleFrontendSdk=(()=>{var we=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var rt=Object.prototype.hasOwnProperty;var st=(u,e)=>{for(var t in e)we(u,t,{get:e[t],enumerable:!0})},nt=(u,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of tt(e))!rt.call(u,n)&&n!==t&&we(u,n,{get:()=>e[n],enumerable:!(r=et(e,n))||r.enumerable});return u};var it=u=>nt(we({},"__esModule",{value:!0}),u);var ct={};st(ct,{RecommendationItem:()=>W,RecommendationList:()=>Q,Recommendations:()=>z,setConsent:()=>at,setDeviceId:()=>Qe,setEnvironment:()=>Ke,setPageVisit:()=>Xe,setRequestDomain:()=>We,setUserId:()=>ze});var s=class u{static global(e){return u.globals[e]?u.globals[e]:u.globals[e]={}}static createStatic(e,t,r){let n=null;Object.defineProperty(e,t,{enumerable:!0,get:function(){return r!=null&&(n=r(),r=null),n},set:function(i){r!=null&&(n=r(),r=null),n=i}})}static iterator(e){if(Array.isArray(e)){let t=e;return function(){return u.mkIter(t)}}else return typeof e.iterator=="function"?e.iterator.bind(e):e.iterator}static getIterator(e){return Array.isArray(e)?u.mkIter(e):e.iterator()}static mkIter(e){return new xe(e)}static extend(e){function t(){this[u.new].apply(this,arguments)}return Object.setPrototypeOf(t.prototype,e.prototype),t}static inherits(e,t){t==null&&(t=!1);function r(){t&&e&&r[u.init]&&r[u.init](),this[u.new].apply(this,arguments)}return t?r[u.init]=()=>{let n=e();n[u.init]&&n[u.init](),Object.setPrototypeOf(r.prototype,n.prototype),r[u.init]=void 0}:e&&e[u.init]?(t=!0,r[u.init]=()=>{e[u.init]&&e[u.init](),Object.setPrototypeOf(r.prototype,e.prototype),r[u.init]=void 0}):e&&Object.setPrototypeOf(r.prototype,e.prototype),r}static bind(e,t){if(t==null)return null;t.__id__==null&&(t.__id__=u.fid++);let r=null;return e.hx__closures__==null?e.hx__closures__={}:r=e.hx__closures__[t.__id__],r==null&&(r=t.bind(e),e.hx__closures__[t.__id__]=r),r}static get __name__(){return"genes.Register"}get __class__(){return u}};s.$global=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:void 0;s.globals={};s.new=Symbol();s.init=Symbol();s.fid=0;var xe=s.global("$hxClasses")["genes._Register.ArrayIterator"]=class Pe extends s.inherits(){[s.new](e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}static get __name__(){return"genes._Register.ArrayIterator"}get __class__(){return Pe}};xe.prototype.array=null;xe.prototype.current=null;var pt=s.$global,z=function(){};z.__isInterface__=!0;var Q=function(){};Q.__isInterface__=!0;var W=function(){};W.__isInterface__=!0;var yt=s.$global,me=s.global("$hxClasses")["haxe.ValueException"]=class Se extends s.inherits(()=>k,!0){[s.new](e,t,r){super[s.new](String(e),t,r),this.value=e}unwrap(){return this.value}static get __name__(){return"haxe.ValueException"}static get __super__(){return k}get __class__(){return Se}};me.prototype.value=null;var vt=s.$global,k=s.global("$hxClasses")["haxe.Exception"]=class ne extends s.inherits(()=>Error,!0){[s.new](e,t,r){Error.call(this,e),this.message=e,this.__previousException=t,this.__nativeException=r!=null?r:this}unwrap(){return this.__nativeException}get_native(){return this.__nativeException}static caught(e){return e instanceof ne?e:e instanceof Error?new ne(e.message,null,e):new me(e,null,e)}static thrown(e){return e instanceof ne?e.get_native():e instanceof Error?e:new me(e)}static get __name__(){return"haxe.Exception"}static get __super__(){return Error}get __class__(){return ne}};k.prototype.native=null;k.prototype.__skipStack=null;k.prototype.__nativeException=null;k.prototype.__previousException=null;var Dt=s.$global,ve=s.global("$hxClasses")["js.Browser"]=class $e{static get supported(){return this.get_supported()}static get_supported(){return typeof window!="undefined"&&typeof window.location!="undefined"?typeof window.location.protocol=="string":!1}static createXMLHttpRequest(){if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")return new"ActiveXObject"("Microsoft.XMLHTTP");throw k.thrown("Unable to create XMLHttpRequest object.")}static get __name__(){return"js.Browser"}get __class__(){return $e}};var Pt=s.$global,F=s.global("$hxEnums")["haxe.io.Error"]={__ename__:"haxe.io.Error",Blocked:{_hx_name:"Blocked",_hx_index:0,__enum__:"haxe.io.Error"},Overflow:{_hx_name:"Overflow",_hx_index:1,__enum__:"haxe.io.Error"},OutsideBounds:{_hx_name:"OutsideBounds",_hx_index:2,__enum__:"haxe.io.Error"},Custom:Object.assign(u=>({_hx_index:3,__enum__:"haxe.io.Error",e:u}),{_hx_name:"Custom",__params__:["e"]})};F.__constructs__=[F.Blocked,F.Overflow,F.OutsideBounds,F.Custom];F.__empty_constructs__=[F.Blocked,F.Overflow,F.OutsideBounds];var qt=s.$global,H=s.global("$hxEnums")["haxe.io.Encoding"]={__ename__:"haxe.io.Encoding",UTF8:{_hx_name:"UTF8",_hx_index:0,__enum__:"haxe.io.Encoding"},RawNative:{_hx_name:"RawNative",_hx_index:1,__enum__:"haxe.io.Encoding"}};H.__constructs__=[H.UTF8,H.RawNative];H.__empty_constructs__=[H.UTF8,H.RawNative];var Tt=s.$global,G=s.global("$hxClasses")["haxe.io.Bytes"]=class Re extends s.inherits(){[s.new](e){this.length=e.byteLength,this.b=new Uint8Array(e),this.b.bufferValue=e,e.hxBytes=this,e.bytes=this.b}getString(e,t,r){if(e<0||t<0||e+t>this.length)throw k.thrown(F.OutsideBounds);r==null&&(r=H.UTF8);let n="",i=this.b,o=e,a=e+t;switch(r._hx_index){case 0:let y=e>0;for(;o<a;){let d=i[o++];if(d<128){if(d==0)break;n+=String.fromCodePoint(d)}else if(d<224){let c=(d&63)<<6|i[o++]&127;n+=String.fromCodePoint(c)}else if(d<240){let c=i[o++],g=(d&31)<<12|(c&127)<<6|i[o++]&127;n+=String.fromCodePoint(g)}else{let c=i[o++],g=i[o++],m=(d&15)<<18|(c&127)<<12|(g&127)<<6|i[o++]&127;n+=String.fromCodePoint(m)}}break;case 1:for(;o<a;){let d=i[o++]|i[o++]<<8;n+=String.fromCodePoint(d)}break}return n}static ofData(e){let t=e.hxBytes;return t!=null?t:new Re(e)}static get __name__(){return"haxe.io.Bytes"}get __class__(){return Re}};G.prototype.length=null;G.prototype.b=null;var jt=s.$global,T=s.global("$hxClasses")["haxe.http.HttpBase"]=class qe extends s.inherits(){[s.new](e){this.url=e,this.headers=[],this.params=[],this.emptyOnData=s.bind(this,this.onData)}get responseData(){return this.get_responseData()}setHeader(e,t){let r=0,n=this.headers.length;for(;r<n;){let i=r++;if(this.headers[i].name==e){this.headers[i]={name:e,value:t};return}}this.headers.push({name:e,value:t})}setPostData(e){this.postData=e,this.postBytes=null}onData(e){}onBytes(e){}onError(e){}onStatus(e){}hasOnData(){return s.bind(this,this.onData)!=this.emptyOnData}success(e){this.responseBytes=e,this.responseAsString=null,this.hasOnData()&&this.onData(this.get_responseData()),this.onBytes(this.responseBytes)}get_responseData(){return this.responseAsString==null&&this.responseBytes!=null&&(this.responseAsString=this.responseBytes.getString(0,this.responseBytes.length,H.UTF8)),this.responseAsString}static get __name__(){return"haxe.http.HttpBase"}get __class__(){return qe}};T.prototype.url=null;T.prototype.responseBytes=null;T.prototype.responseAsString=null;T.prototype.postData=null;T.prototype.postBytes=null;T.prototype.headers=null;T.prototype.params=null;T.prototype.emptyOnData=null;var Jt=s.$global,pe=s.global("$hxClasses")["haxe.iterators.MapKeyValueIterator"]=class Be extends s.inherits(){[s.new](e){this.map=e,this.keys=e.keys()}hasNext(){return this.keys.hasNext()}next(){let e=this.keys.next();return{value:this.map.get(e),key:e}}static get __name__(){return"haxe.iterators.MapKeyValueIterator"}get __class__(){return Be}};pe.prototype.map=null;pe.prototype.keys=null;var zt=s.$global,Ie=function(){};Ie.__isInterface__=!0;var Gt=s.$global,Ee=s.global("$hxClasses")["js.Boot"]=class ie{static __string_rec(e,t){if(e==null)return"null";if(t.length>=5)return"<...>";let r=typeof e;switch(r=="function"&&(e.__name__||e.__ename__)&&(r="object"),r){case"function":return"<function>";case"object":if(e.__enum__){let d=s.global("$hxEnums")[e.__enum__].__constructs__[e._hx_index],c=d._hx_name;return d.__params__?(t=t+" ",c+"("+(function(g){var m;let E=[];{let _=0,p=d.__params__;for(;_<p.length;){let v=p[_];_=_+1,E.push(ie.__string_rec(e[v],t))}}return m=E,m})(this).join(",")+")"):c}if(e instanceof Array){let y="[";t+=" ";let d=0,c=e.length;for(;d<c;){let g=d++;y+=(g>0?",":"")+ie.__string_rec(e[g],t)}return y+="]",y}let n;try{n=e.toString}catch{return"???"}if(n!=null&&n!=Object.toString&&typeof n=="function"){let y=e.toString();if(y!="[object Object]")return y}let i=`{
2
2
  `;t+=" ";let o=e.hasOwnProperty!=null,a=null;for(a in e)o&&!e.hasOwnProperty(a)||a=="prototype"||a=="__class__"||a=="__super__"||a=="__interfaces__"||a=="__properties__"||(i.length!=2&&(i+=`,
3
3
  `),i+=t+a+" : "+ie.__string_rec(e[a],t));return t=t.substring(1),i+=`
4
- `+t+"}",i;break;case"string":return e;default:return String(e)}}static get __name__(){return"js.Boot"}get __class__(){return ie}};Ee.__toStr={}.toString;var tr=s.$global,$=s.global("$hxClasses").Std=class Ae{static string(e){return Ee.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}static get __name__(){return"Std"}get __class__(){return Ae}};String.__name__=!0,Array.__name__=!0;var ir=s.$global,he=s.global("$hxClasses")["genes.util.EsMap"]=class le extends s.inherits(){[s.new](){this.inst=new Map}set(e,t){this.inst.set(e,t)}get(e){return this.inst.get(e)}remove(e){return this.inst.delete(e)}exists(e){return this.inst.has(e)}keys(){return le.adaptIterator(this.inst.keys())}iterator(){return le.adaptIterator(this.inst.values())}toString(){let e=[],t=le.adaptIterator(this.inst.keys());for(;t.hasNext();){let r=t.next();e.push(""+$.string(r)+" => "+$.string(this.inst.get(r)))}return"{"+e.join(", ")+"}"}clear(){this.inst.clear()}static adaptIterator(e){let t,r,n=function(){let i=e.next();t=i.value,r=i.done};return{hasNext:function(){return r==null&&n(),!r},next:function(){r==null&&n();let i=t;return n(),i}}}static get __name__(){return"genes.util.EsMap"}get __class__(){return le}};he.prototype.inst=null;var _r=s.$global,Oe=s.global("$hxClasses")["haxe.ds.StringMap"]=class De extends s.inherits(he){[s.new](){super[s.new]()}copy(){let e=new De;return e.inst=new Map(this.inst),e}keyValueIterator(){return new pe(this)}static get __name__(){return"haxe.ds.StringMap"}static get __interfaces__(){return[Ie]}static get __super__(){return he}get __class__(){return De}};var pr=s.$global,B=s.global("$hxClasses").HxOverrides=class Fe{static cca(e,t){let r=e.charCodeAt(t);if(r==r)return r}static substr(e,t,r){if(r==null)r=e.length;else if(r<0)if(t==0)r=e.length+r;else return"";return e.substr(t,r)}static now(){return Date.now()}static get __name__(){return"HxOverrides"}get __class__(){return Fe}};typeof performance!="undefined"&&typeof performance.now=="function"&&(B.now=performance.now.bind(performance));var yr=s.$global,J=s.global("$hxClasses").StringTools=class de{static isSpace(e,t){let r=B.cca(e,t);return r>8&&r<14?!0:r==32}static ltrim(e){let t=e.length,r=0;for(;r<t&&de.isSpace(e,r);)++r;return r>0?B.substr(e,r,t-r):e}static rtrim(e){let t=e.length,r=0;for(;r<t&&de.isSpace(e,t-r-1);)++r;return r>0?B.substr(e,0,t-r):e}static replace(e,t,r){return e.split(t).join(r)}static get __name__(){return"StringTools"}get __class__(){return de}};var xr=s.$global,Te=s.global("$hxClasses").Lambda=class He{static exists(e,t){let r=s.getIterator(e);for(;r.hasNext();){let n=r.next();if(t(n))return!0}return!1}static get __name__(){return"Lambda"}get __class__(){return He}};var kr=s.$global,oe=s.global("$hxClasses").EReg=class Le extends s.inherits(){[s.new](e,t){this.r=new RegExp(e,t.split("u").join(""))}match(e){return this.r.global&&(this.r.lastIndex=0),this.r.m=this.r.exec(e),this.r.s=e,this.r.m!=null}matched(e){if(this.r.m!=null&&e>=0&&e<this.r.m.length)return this.r.m[e];throw k.thrown("EReg::matched")}matchedPos(){if(this.r.m==null)throw k.thrown("No string matched");return{pos:this.r.m.index,len:this.r.m[0].length}}matchSub(e,t,r){if(r==null&&(r=-1),this.r.global){this.r.lastIndex=t,this.r.m=this.r.exec(r<0?e:B.substr(e,0,t+r));let n=this.r.m!=null;return n&&(this.r.s=e),n}else{let n=this.match(r<0?B.substr(e,t,null):B.substr(e,t,r));return n&&(this.r.s=e,this.r.m.index+=t),n}}map(e,t){let r=0,n="";do{if(r>=e.length)break;if(!this.matchSub(e,r)){n+=$.string(B.substr(e,r,null));break}let i=this.matchedPos();n+=$.string(B.substr(e,r,i.pos-r)),n+=$.string(t(this)),i.len==0?(n+=$.string(B.substr(e,i.pos,1)),r=i.pos+1):r=i.pos+i.len}while(this.r.global);return!this.r.global&&r>0&&r<e.length&&(n+=$.string(B.substr(e,r,null))),n}static get __name__(){return"EReg"}get __class__(){return Le}};oe.prototype.r=null;var Hr=s.$global,Y=s.global("$hxClasses")["haxe.http.HttpJs"]=class Ue extends s.inherits(T){[s.new](e){this.async=!0,this.withCredentials=!1,super[s.new](e)}request(e){this.responseAsString=null,this.responseBytes=null,this.responseHeaders=null;let t=this.req=ve.createXMLHttpRequest(),r=this,n=function(c){if(t.readyState!=4)return;let _;try{_=t.status}catch{_=null}if(_==0&&ve.get_supported()&&s.$global.location!=null){let m=s.$global.location.protocol.toLowerCase();new oe("^(?:about|app|app-storage|.+-extension|file|res|widget):$","").match(m)&&(_=t.response!=null?200:404)}if(_==null&&(_=null),_!=null&&r.onStatus(_),_!=null&&_>=200&&_<400){r.req=null;let m=t.getAllResponseHeaders().split(`\r
5
- `),E=[],g=0,p=m;for(;g<p.length;){let w=p[g];++g,w!=""&&E.push(w)}m=E;let v=new Oe;r.responseHeaders=v;let b=0;for(;b<m.length;){let w=m[b];++b;let C=w.split(": "),O=C.shift(),x=C.length==1?C[0]:C.join(": ");x=J.ltrim(J.rtrim(x)),r.responseHeaders.inst.set(O,x)}r.success(G.ofData(t.response))}else if(_==null||_==0&&t.response==null)r.req=null,r.onError("Failed to connect or resolve host");else if(_==null){r.req=null;let m=t.response!=null?G.ofData(t.response):null;r.responseBytes=m,r.onError("Http Error #"+t.status)}else switch(_){case 12007:r.req=null,r.onError("Unknown host");break;case 12029:r.req=null,r.onError("Failed to connect to host");break;default:r.req=null;let m=t.response!=null?G.ofData(t.response):null;r.responseBytes=m,r.onError("Http Error #"+t.status)}};this.async&&(t.onreadystatechange=n);let i,o=this.postData,a=this.postBytes;if(o==null)if(a==null)i=null;else{let c=a;i=new Blob([c.b.bufferValue])}else a==null?i=o:i=null;if(i!=null)e=!0;else{let c=0,_=this.params;for(;c<_.length;){let m=_[c];++c,i==null?i="":i=(i==null?"null":$.string(i))+"&";let E=m.name,g=(i==null?"null":$.string(i))+encodeURIComponent(E)+"=",p=m.value;i=g+encodeURIComponent(p)}}try{if(e)t.open("POST",this.url,this.async);else if(i!=null){let c=this.url.split("?").length<=1;t.open("GET",this.url+(c?"?":"&")+(i==null?"null":$.string(i)),this.async),i=null}else t.open("GET",this.url,this.async);t.responseType="arraybuffer"}catch(c){let _=k.caught(c).unwrap();this.req=null,this.onError(_.toString());return}t.withCredentials=this.withCredentials,!Te.exists(this.headers,function(c){return c.name=="Content-Type"})&&e&&this.postData==null&&t.setRequestHeader("Content-Type","application/x-www-form-urlencoded");let f=0,h=this.headers;for(;f<h.length;){let c=h[f];++f,t.setRequestHeader(c.name,c.value)}t.send(i),this.async||n(null)}static get __name__(){return"haxe.http.HttpJs"}static get __super__(){return T}get __class__(){return Ue}};Y.prototype.async=null;Y.prototype.withCredentials=null;Y.prototype.responseHeaders=null;Y.prototype.req=null;var jr=s.$global,j=s.global("$hxClasses").SimpleFuture=class je extends s.inherits(){[s.new](){this._isFinished=!1}trigger(e){this._result=e,this._isFinished=!0,this._callback!=null&&this._callback(this._result)}then(e){this._callback=e,this._isFinished&&e(this._result)}static get __name__(){return"SimpleFuture"}get __class__(){return je}};j.prototype._callback=null;j.prototype._result=null;j.prototype._isFinished=null;var Jr=s.$global,I=s.global("$hxClasses").Reflect=class Ne{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let r;if(e==null)return null;{let n;return e.__properties__?(r=e.__properties__["get_"+t],n=r):n=!1,n?e[r]():e[t]}}static setProperty(e,t,r){let n,i;e.__properties__?(n=e.__properties__["set_"+t],i=n):i=!1,i?e[n](r):e[t]=r}static fields(e){let t=[];if(e!=null){let n=Object.prototype.hasOwnProperty;for(var r in e)r!="__id__"&&r!="hx__closures__"&&n.call(e,r)&&t.push(r)}return t}static get __name__(){return"Reflect"}get __class__(){return Ne}};var es=s.$global,l=s.global("$hxClasses")["internal.RecoBackendV2"]=class y extends s.inherits(){[s.new](){}static _requestUri(){return"https://"+y._req_domain+"/api/"+y._environment+"/recommendations/requests"}static noConsentBody(){return{device_id:"no-consent",user_group:"no-consent",version:"no-consent"}}static buildRequestBody(e){let t={lists:e,page_type:y._page_visit!=null?y._page_visit:y._page_view,channel:"www-desktop"};if(y._consent==0){let r=y.noConsentBody(),n=0,i=I.fields(r);for(;n<i.length;){let o=i[n];++n,t[o]=I.field(r,o)}}else y._user_id!=null?t.user_id=y._user_id:t.device_id=y._device_id;return t}static _requestRecos(e){let t=new j,r=null,n=new Y(y._requestUri());n.setHeader("Content-Type","application/json"),n.setPostData(JSON.stringify(y.buildRequestBody(e))),n.onError=function(a){throw k.thrown("HTTP Request Error: "+a)},n.onStatus=function(a){if(a<200||a>=300)throw k.thrown("HTTP Status Error: "+a)};try{n.request(!1)}catch(a){let f=k.caught(a).unwrap();throw k.thrown("Failed to execute synchronous request: "+$.string(f))}let i=function(a){let f=JSON.parse(a),h=Z.fromRequestData(f);t.trigger(h)},o=n.get_responseData();return o!=null?i(o):n.onData=i,t}static getRawRecommendations(e){return y._requestRecos(e)}static setConsent(e){e>2&&(e=2),y._consent=e}static setPageVisit(e){y._page_visit=e}static setEnvironment(e){y._environment=e}static setDeviceId(e){y._device_id=e}static setUserId(e){y._user_id=e}static setRequestDomain(e){y._req_domain=e}static setPageView(e){y._page_view=e}static getRequestDomain(){return y._req_domain}static getEnvironment(){return y._environment}static getPageVisit(){return y._page_visit}static getUserId(){return y._user_id}static getDeviceId(){return y._device_id}static getPageView(){return y._page_view}static get __name__(){return"internal.RecoBackendV2"}get __class__(){return y}};l._environment=null;l._device_id=null;l._user_id=null;l._consent=0;l._req_domain="europe-west1.froomle.com";l._page_visit=null;l._page_view=null;var lt=function(){};lt.__isInterface__=!0;var ot=function(){};ot.__isInterface__=!0;var Z=s.global("$hxClasses")["internal._RecommendationsInternal"]=class ke extends s.inherits(){[s.new](e,t,r,n,i){this.request_id=t,this.user_group=r,this.device_id=e,this.user_id=n,this._lists=i}items(){let e=[],t=0,r=this._lists;for(;t<r.length;){let n=r[t];++t;let i=0,o=n.items;for(;i<o.length;){let a=o[i];++i,e.push(a)}}return e}lists(){return this._lists}getItemsByListName(e){let t=0,r=this._lists;for(;t<r.length;){let n=r[t];if(++t,n.list_name==e)return n}return null}static fromRequestData(e){let t=I.getProperty(e,"lists"),r=[],n=0;for(;n<t.length;){let i=t[n];++n;let o=I.getProperty(i,"items"),a=[],f=0;for(;f<o.length;){let c=o[f];++f,a.push(new ae(c))}let h=new ee({limit:I.getProperty(i,"limit"),list_key:I.getProperty(i,"list_key"),list_name:I.getProperty(i,"list_name"),list_size:I.getProperty(i,"list_size"),items:a});r.push(h)}return new ke(I.getProperty(e,"device_id"),I.getProperty(e,"request_id"),I.getProperty(e,"user_group"),I.getProperty(e,"user_id"),r)}static get __name__(){return"internal._RecommendationsInternal"}static get __interfaces__(){return[z]}get __class__(){return ke}};Z.prototype.request_id=null;Z.prototype.user_group=null;Z.prototype.user_id=null;Z.prototype.device_id=null;Z.prototype._lists=null;var ee=s.global("$hxClasses")["internal._RecommendationsListInternal"]=class Me extends s.inherits(){[s.new](e){this.items=e.items,this.limit=e.limit,this.list_key=e.list_key,this.list_name=e.list_name,this.list_size=e.list_size}static get __name__(){return"internal._RecommendationsListInternal"}static get __interfaces__(){return[Q]}get __class__(){return Me}};ee.prototype.limit=null;ee.prototype.list_key=null;ee.prototype.list_name=null;ee.prototype.list_size=null;ee.prototype.items=null;var ae=s.global("$hxClasses")["internal._RecommendationItemInternal"]=class Je extends s.inherits(){[s.new](e){this._data={},this.Id=I.getProperty(e,"item_id"),this.RequestId=I.getProperty(e,"request_id"),this.UserGroup=I.getProperty(e,"user_group");let t=0,r=I.fields(e);for(;t<r.length;){let n=r[t];++t,this._data[n]=I.field(e,n)}}get(e){return this._data[e]}static get __name__(){return"internal._RecommendationItemInternal"}static get __interfaces__(){return[W]}get __class__(){return Je}};ae.prototype.Id=null;ae.prototype.RequestId=null;ae.prototype.UserGroup=null;ae.prototype._data=null;var q=s.global("$hxClasses")["internal._RecoBackendV2.RecoBackendV2_Fields_"]=class Se{static getRawRecommendations(e){return l.getRawRecommendations(e)}static setConsent(e){l.setConsent(e)}static setPageVisit(e){l.setPageVisit(e)}static setEnvironment(e){l.setEnvironment(e)}static setDeviceId(e){l.setDeviceId(e)}static setUserId(e){l.setUserId(e)}static setRequestDomain(e){l.setRequestDomain(e)}static setPageView(e){l.setPageView(e)}static getConsent(){Se.getConsent()}static getPageVisit(){l.getPageVisit()}static getEnvironment(){l.getEnvironment()}static getDeviceId(){l.getDeviceId()}static getUserId(){l.getUserId()}static getPageView(){l.getPageView()}static get __name__(){return"internal._RecoBackendV2.RecoBackendV2_Fields_"}get __class__(){return Se}},ts=q.getRawRecommendations,rs=q.setConsent,ss=q.setPageVisit,ns=q.setEnvironment,is=q.setDeviceId,ls=q.setUserId,os=q.setRequestDomain,as=q.setPageView,us=q.getConsent,cs=q.getPageVisit,_s=q.getEnvironment,gs=q.getDeviceId,ms=q.getUserId,ps=q.getPageView;var ys=s.$global,A=s.global("$hxClasses").FroomleSdk=class V{static register(){V.registered||V._env_set&&(!V._page_visit_set&&!V._page_view_set||(V.registered=!0))}static setEnvironment(e){l.setEnvironment(e),V._env_set=!0,V.register()}static setDeviceId(e){l.setDeviceId(e)}static setUserId(e){l.setUserId(e)}static setConsent(e){l.setConsent(e)}static setPageView(e){l.setPageView(e),V._page_view_set=!0,V.register()}static setPageVisit(e){l.setPageVisit(e),V._page_visit_set=!0,V.register()}static setRequestDomain(e){l.setRequestDomain(e)}static getRawRecommendations(e){return l.getRawRecommendations(e)}static getVersion(){return"0.0.7"}static get __name__(){return"FroomleSdk"}get __class__(){return V}};A._env_set=!1;A._page_visit_set=!1;A._page_view_set=!1;A.registered=!1;var xs=s.$global,te=s.global("$hxClasses")["internal.domHandler.FroomleDomTree"]=class fe extends s.inherits(){[s.new](){}createElement(e){return window.document.createElement(e)}querySelectorAll(e){let t=this.root,r=[],n=t.querySelectorAll(e),i=0,o=n.length;for(;i<o;){let a=i++;r.push(n.item(a))}return r}getRoot(){return this.root}toString(){return this.root.outerHTML}static run(){}static fromHtml(e){return new fe}static fromDocument(){let e=new fe;return e.root=window.document,e}static get __name__(){return"internal.domHandler.FroomleDomTree"}get __class__(){return fe}};te.prototype.root=null;var Is=s.$global,L=s.global("$hxClasses")["internal._ADomNode.ADomNode"]=class Pe{static _new(e){return e}static fromElement(e){return e}static create(e,t){return window.document.createElement(t)}static replaceChild(e,t,r){e.replaceChild(t,r)}static get attributes(){return this.get_attributes()}static get_attributes(e){let t=e,r=[],n=0,i=t.attributes.length;for(;n<i;){let o=n++,a=t.attributes.item(o);r.push({name:a.name,value:a.value})}return r}static addChild(e,t){e.appendChild(t)}static removeChild(e,t){e.removeChild(t)}static getAttribute(e,t){return e.getAttribute(t)}static setAttribute(e,t,r){e.setAttribute(t,r)}static getText(e){return e.textContent}static setText(e,t){e.textContent=t}static get children(){return this.get_children()}static get_children(e){let t=[],n=e.children,i=0,o=n.length;for(;i<o;){let a=i++;t.push(n[a])}return t}static querySelectorAll(e,t){let r=e,n=[],i=r.querySelectorAll(t),o=0,a=i.length;for(;o<a;){let f=o++;n.push(i.item(f))}return n}static getFilterKeyValue(e){let t=0,r=Pe.get_attributes(e);for(;t<r.length;){let n=r[t];if(++t,n.name.startsWith("data-froomle-reco-filter-"))return{key:n.name.substring(25),value:n.value}}return{key:null,value:null}}static get __name__(){return"internal._ADomNode.ADomNode_Impl_"}get __class__(){return Pe}};var Os=s.$global,ue=s.global("$hxClasses")["internal.domHandler.DomDomDom"]=class K extends s.inherits(){[s.new](){}static _fillRecoTargets(e){let t=new j;if(e==null)return t.trigger(!1),t;let r=[],n=e,i=[],o=n.querySelectorAll("*"),a=0,f=o.length;for(;a<f;){let d=a++;i.push(o.item(d))}let h=i,c=0;for(;c<h.length;){let d=h[c];++c;let D=0,R=L.get_attributes(d);for(;D<R.length;){let M=R[D];++D,M.name=="data-froomle-reco"&&r.push(d)}}let _=[],m=0;for(;m<r.length;){let d=r[m];++m,d.getAttribute("data-froomle-request-id")==null&&(d.getAttribute("data-froomle-id")==null||d.getAttribute("data-froomle-id")=="")&&_.push(d)}if(_.length<1)return new j;let E=[],g=[],p="",v="",b="",w=[],C=function(){let d={list_name:p,list_size:w.length,limit:w.length};v!=null&&I.setProperty(d,v,b),E.push(d),g.push(w)},O=function(d,D,R,M){p=d,v=D,b=R,w=[M]},x=0;for(;x<_.length;){let d=_[x];++x;let D=d.getAttribute("data-froomle-reco"),R=L.getFilterKeyValue(d);if(p==""){O(D,R.key,R.value,d);continue}else if(D==p&&R.key==v&&R.value==b){w.push(d);continue}else{C(),O(D,R.key,R.value,d);continue}}return p!=""&&C(),q.getRawRecommendations(E).then(function(d){let D=0,R=d.lists();for(;D<R.length;){let M=R[D],N=D++,U=M,X=U.items.length!=g[N].length,se=0,ye=U.items;for(;se<ye.length;){let be=ye[se],Ye=se++,Ze=be;K._fillParameters(g[N][Ye],Ze,d.request_id)}}t.trigger(!0)}),t}static _fillParameters(e,t,r){let n=function(m,E,g,p){p==null&&(p="");let v=function(b,w,C){C==null&&(C="fgh");try{w=new oe("\\\\[(\\\\w+)\\\\]","g").map(w,function(R){return"."+R.matched(1)}),w=J.replace(w,"[","."),w=J.replace(w,"]",""),B.cca(w,0)==46&&(w=B.substr(w,1,null));let x=w.split("."),P=b.get(x[0]),d=1,D=x.length;for(;d<D;){let R=d++;if(P==null)return null;P instanceof Array&&$.parseInt(x[R])!=null?P=P[$.parseInt(x[R])]:P=I.field(P,x[R])}return P}catch{return C}};try{let b=v(t,g,p);E=="inner"?m.textContent=b:m.setAttribute(E,b)}catch{}};e.setAttribute("data-froomle-id",t.Id),e.setAttribute("data-froomle-request-id",r);let i=e,o=[],a=i.querySelectorAll("*"),f=0,h=a.length;for(;f<h;){let m=f++;o.push(a.item(m))}let c=o,_=0;for(;_<c.length;){let m=c[_];++_;let E=0,g=L.get_attributes(m);for(;E<g.length;){let p=g[E];if(++E,p.name.startsWith("data-froomle-param-")){let v=J.replace(p.name,"data-froomle-param-",""),b=p.value;n(m,v,b)}}}}static _orderElements(e){let t=function(g,p,v){let b=[],w=L.get_children(g),C=0;for(;C<w.length;){let P=w[C];if(++C,P.getAttribute("data-froomle-ordervalue")!=null){b.push(P);let D=L.create(e,"span");D.setAttribute("data-froomle-tmp-node",""),L.replaceChild(g,D,P)}}let O=[],x=0;for(;x<b.length;){let P=b[x];++x,O.push(P.getAttribute("data-froomle-ordervalue"))}return{el:g,key:p,values:O,orderChildren:b,list_name:v}},r=new j,n=e.getRoot(),i=[],o=n.querySelectorAll("*"),a=0,f=o.length;for(;a<f;){let g=a++;i.push(o.item(g))}let h=i,c=[],_=0;for(;_<h.length;){let g=h[_];++_;let p=0,v=L.get_attributes(g);for(;p<v.length;){let b=v[p];++p,b.name.startsWith("data-froomle-order-")&&c.push(t(g,b.name.substring(19),b.value))}}if(c.length<1)return r.trigger(!1),r;let m=[],E=0;for(;E<c.length;){let g=c[E];++E;let p={list_name:g.list_name,limit:g.values.length,list_size:g.values.length},v={};I.setProperty(v,g.key,g.values),I.setProperty(p,"order",v),m.push(p)}return q.getRawRecommendations(m).then(function(g){let p=0,v=g.lists();for(;p<v.length;){let b=v[p],C=p++,O=b,x=c[C];x.el.setAttribute("data-froomle-request-id",g.request_id);let P=[],d=0,D=O.items;for(;d<D.length;){let ge=D[d];++d;let N=ge.get(x.key),U=0,X=x.values;for(;U<X.length;){let se=X[U],be=U++;if(N==se){P.push(x.orderChildren[be]);break}}}let R=0,M=P.length;for(;R<M;){let ge=R++,N=0,U=L.get_children(x.el);for(;N<U.length;){let X=U[N];if(++N,X.getAttribute("data-froomle-tmp-node")==""){L.replaceChild(x.el,P[ge],X);break}}}}r.trigger(!0)}),r}static domInit(e){K._orderElements(e).then(function(t){K._fillRecoTargets(e.getRoot())})}static fillElementRecos(e){K._fillRecoTargets(e)}static runFromHtml(e){let t=te.fromHtml(e);return K.domInit(t),t.toString()}static get __name__(){return"internal.domHandler.DomDomDom"}get __class__(){return K}};var Hs=s.$global;var S=class S{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e=[];for(let t of S.impressionQueue){let r={event_type:"impression",page_type:l.getPageVisit(),action_item:t.getAttribute("data-froomle-id"),action_item_type:"article",channel:"www-desktop"};l.getUserId()?r.user_id=l.getUserId():r.device_id=l.getDeviceId();let n=t.getAttribute("data-froomle-reco");if(n){r.list_name=n;let i=t.getAttribute("data-froomle-request-id");if(!i)throw console.error("element need reco but doesnt have request id registered yet"),new Error("element need reco but doesnt have request id registered");r.request_id=i}}return S.impressionQueue=[],JSON.stringify({events:e})}static sendImpressions(){S.impressionQueue.length!==0&&fetch(S.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:S.generateBody()})}static getViewPortRect(){let e=window.innerWidth||document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{left:0,top:0,x:0,y:0,toJSON(){},right:e,bottom:t,width:e,height:t}}static intersectsWithViewPortRect(e){let t=e.getBoundingClientRect(),r=S.getViewPortRect();return t.right>r.left&&t.left<r.right&&t.bottom>r.top&&t.top<r.bottom}static addIntersectionImpressionListener(e){S.observer.observe(e)}static processDocument(){if(l.getDeviceId()!="no-consent"){for(let e of document.querySelectorAll("[data-froomle-id]"))S.intersectsWithViewPortRect(e)?S.impressionQueue.push(e):S.addIntersectionImpressionListener(e);S.sendImpressions()}}};S.impressionQueue=[],S.observer=new IntersectionObserver((e,t)=>{e.forEach(r=>{r.isIntersecting&&(S.impressionQueue.push(r.target),S.observer.unobserve(r.target))}),S.impressionQueue.length>0&&S.sendImpressions()});var re=S;var ce=class u{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e={event_type:"page_visit",page_type:l.getPageVisit(),channel:"www-desktop"};return l.getUserId()?e.user_id=l.getUserId():e.device_id=l.getDeviceId(),JSON.stringify(e)}static sendPageVisit(){l.getPageVisit()&&l.getDeviceId()!="no-consent"&&fetch(u.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:u.generateBody()})}};var _e=class u{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e={event_type:"detail_pageview",page_type:"article_detail",action_item:l.getPageView(),action_item_type:"article",channel:"www-desktop"};return l.getUserId()?e.user_id=l.getUserId():e.device_id=l.getDeviceId(),JSON.stringify(e)}static sendPageView(){l.getPageView()&&l.getDeviceId()!="no-consent"&&fetch(u.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:u.generateBody()})}};var Ke=A.setEnvironment,Xe=A.setPageVisit,at=A.setConsent,ze=A.setUserId,Qe=A.setDeviceId,We=A.setRequestDomain,ut=A.setPageView;if(typeof document!="undefined"){let u=document.currentScript;if(u){let e=u.getAttribute("data-froomle-device-id"),t=u.getAttribute("data-froomle-user-id"),r=u.getAttribute("data-froomle-env"),n=u.getAttribute("data-froomle-page-visit"),i=u.getAttribute("data-froomle-request-domain"),o=u.getAttribute("data-froomle-page-view");Ke(r),o&&ut(o),n&&Xe(n),e&&Qe(e),t&&ze(t),i&&We(i)}else console.error("Froomle SDK: could not find the script tag where the sdk is included.");document.addEventListener("DOMContentLoaded",()=>{ue.domInit(te.fromDocument()),re.processDocument(),ce.sendPageVisit(),_e.sendPageView(),new MutationObserver(t=>{for(let r of t)if(r.type==="childList"&&re.processElement(r.target),r.type==="attributes")if(r.attributeName==="data-froomle-reco"){let n=r.target.getAttribute("data-froomle-request-id");(!n||n==="")&&ue.fillElementRecos(r.target)}else r.attributeName==="data-froomle-request-id"&&ue.fillElementRecos(r.target)}).observe(document,{childList:!0,subtree:!0})})}return it(ct);})();
4
+ `+t+"}",i;break;case"string":return e;default:return String(e)}}static get __name__(){return"js.Boot"}get __class__(){return ie}};Ee.__toStr={}.toString;var tr=s.$global,$=s.global("$hxClasses").Std=class Ve{static string(e){return Ee.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}static get __name__(){return"Std"}get __class__(){return Ve}};String.__name__=!0,Array.__name__=!0;var ir=s.$global,de=s.global("$hxClasses")["genes.util.EsMap"]=class le extends s.inherits(){[s.new](){this.inst=new Map}set(e,t){this.inst.set(e,t)}get(e){return this.inst.get(e)}remove(e){return this.inst.delete(e)}exists(e){return this.inst.has(e)}keys(){return le.adaptIterator(this.inst.keys())}iterator(){return le.adaptIterator(this.inst.values())}toString(){let e=[],t=le.adaptIterator(this.inst.keys());for(;t.hasNext();){let r=t.next();e.push(""+$.string(r)+" => "+$.string(this.inst.get(r)))}return"{"+e.join(", ")+"}"}clear(){this.inst.clear()}static adaptIterator(e){let t,r,n=function(){let i=e.next();t=i.value,r=i.done};return{hasNext:function(){return r==null&&n(),!r},next:function(){r==null&&n();let i=t;return n(),i}}}static get __name__(){return"genes.util.EsMap"}get __class__(){return le}};de.prototype.inst=null;var gr=s.$global,Ae=s.global("$hxClasses")["haxe.ds.StringMap"]=class De extends s.inherits(de){[s.new](){super[s.new]()}copy(){let e=new De;return e.inst=new Map(this.inst),e}keyValueIterator(){return new pe(this)}static get __name__(){return"haxe.ds.StringMap"}static get __interfaces__(){return[Ie]}static get __super__(){return de}get __class__(){return De}};var pr=s.$global,B=s.global("$hxClasses").HxOverrides=class Oe{static cca(e,t){let r=e.charCodeAt(t);if(r==r)return r}static substr(e,t,r){if(r==null)r=e.length;else if(r<0)if(t==0)r=e.length+r;else return"";return e.substr(t,r)}static now(){return Date.now()}static get __name__(){return"HxOverrides"}get __class__(){return Oe}};typeof performance!="undefined"&&typeof performance.now=="function"&&(B.now=performance.now.bind(performance));var yr=s.$global,J=s.global("$hxClasses").StringTools=class he{static isSpace(e,t){let r=B.cca(e,t);return r>8&&r<14?!0:r==32}static ltrim(e){let t=e.length,r=0;for(;r<t&&he.isSpace(e,r);)++r;return r>0?B.substr(e,r,t-r):e}static rtrim(e){let t=e.length,r=0;for(;r<t&&he.isSpace(e,t-r-1);)++r;return r>0?B.substr(e,0,t-r):e}static replace(e,t,r){return e.split(t).join(r)}static get __name__(){return"StringTools"}get __class__(){return he}};var xr=s.$global,Fe=s.global("$hxClasses").Lambda=class Te{static exists(e,t){let r=s.getIterator(e);for(;r.hasNext();){let n=r.next();if(t(n))return!0}return!1}static get __name__(){return"Lambda"}get __class__(){return Te}};var kr=s.$global,oe=s.global("$hxClasses").EReg=class He extends s.inherits(){[s.new](e,t){this.r=new RegExp(e,t.split("u").join(""))}match(e){return this.r.global&&(this.r.lastIndex=0),this.r.m=this.r.exec(e),this.r.s=e,this.r.m!=null}matched(e){if(this.r.m!=null&&e>=0&&e<this.r.m.length)return this.r.m[e];throw k.thrown("EReg::matched")}matchedPos(){if(this.r.m==null)throw k.thrown("No string matched");return{pos:this.r.m.index,len:this.r.m[0].length}}matchSub(e,t,r){if(r==null&&(r=-1),this.r.global){this.r.lastIndex=t,this.r.m=this.r.exec(r<0?e:B.substr(e,0,t+r));let n=this.r.m!=null;return n&&(this.r.s=e),n}else{let n=this.match(r<0?B.substr(e,t,null):B.substr(e,t,r));return n&&(this.r.s=e,this.r.m.index+=t),n}}map(e,t){let r=0,n="";do{if(r>=e.length)break;if(!this.matchSub(e,r)){n+=$.string(B.substr(e,r,null));break}let i=this.matchedPos();n+=$.string(B.substr(e,r,i.pos-r)),n+=$.string(t(this)),i.len==0?(n+=$.string(B.substr(e,i.pos,1)),r=i.pos+1):r=i.pos+i.len}while(this.r.global);return!this.r.global&&r>0&&r<e.length&&(n+=$.string(B.substr(e,r,null))),n}static get __name__(){return"EReg"}get __class__(){return He}};oe.prototype.r=null;var Hr=s.$global,Y=s.global("$hxClasses")["haxe.http.HttpJs"]=class Le extends s.inherits(T){[s.new](e){this.async=!0,this.withCredentials=!1,super[s.new](e)}request(e){this.responseAsString=null,this.responseBytes=null,this.responseHeaders=null;let t=this.req=ve.createXMLHttpRequest(),r=this,n=function(c){if(t.readyState!=4)return;let g;try{g=t.status}catch{g=null}if(g==0&&ve.get_supported()&&s.$global.location!=null){let m=s.$global.location.protocol.toLowerCase();new oe("^(?:about|app|app-storage|.+-extension|file|res|widget):$","").match(m)&&(g=t.response!=null?200:404)}if(g==null&&(g=null),g!=null&&r.onStatus(g),g!=null&&g>=200&&g<400){r.req=null;let m=t.getAllResponseHeaders().split(`\r
5
+ `),E=[],_=0,p=m;for(;_<p.length;){let w=p[_];++_,w!=""&&E.push(w)}m=E;let v=new Ae;r.responseHeaders=v;let b=0;for(;b<m.length;){let w=m[b];++b;let q=w.split(": "),O=q.shift(),x=q.length==1?q[0]:q.join(": ");x=J.ltrim(J.rtrim(x)),r.responseHeaders.inst.set(O,x)}r.success(G.ofData(t.response))}else if(g==null||g==0&&t.response==null)r.req=null,r.onError("Failed to connect or resolve host");else if(g==null){r.req=null;let m=t.response!=null?G.ofData(t.response):null;r.responseBytes=m,r.onError("Http Error #"+t.status)}else switch(g){case 12007:r.req=null,r.onError("Unknown host");break;case 12029:r.req=null,r.onError("Failed to connect to host");break;default:r.req=null;let m=t.response!=null?G.ofData(t.response):null;r.responseBytes=m,r.onError("Http Error #"+t.status)}};this.async&&(t.onreadystatechange=n);let i,o=this.postData,a=this.postBytes;if(o==null)if(a==null)i=null;else{let c=a;i=new Blob([c.b.bufferValue])}else a==null?i=o:i=null;if(i!=null)e=!0;else{let c=0,g=this.params;for(;c<g.length;){let m=g[c];++c,i==null?i="":i=(i==null?"null":$.string(i))+"&";let E=m.name,_=(i==null?"null":$.string(i))+encodeURIComponent(E)+"=",p=m.value;i=_+encodeURIComponent(p)}}try{if(e)t.open("POST",this.url,this.async);else if(i!=null){let c=this.url.split("?").length<=1;t.open("GET",this.url+(c?"?":"&")+(i==null?"null":$.string(i)),this.async),i=null}else t.open("GET",this.url,this.async);t.responseType="arraybuffer"}catch(c){let g=k.caught(c).unwrap();this.req=null,this.onError(g.toString());return}t.withCredentials=this.withCredentials,!Fe.exists(this.headers,function(c){return c.name=="Content-Type"})&&e&&this.postData==null&&t.setRequestHeader("Content-Type","application/x-www-form-urlencoded");let y=0,d=this.headers;for(;y<d.length;){let c=d[y];++y,t.setRequestHeader(c.name,c.value)}t.send(i),this.async||n(null)}static get __name__(){return"haxe.http.HttpJs"}static get __super__(){return T}get __class__(){return Le}};Y.prototype.async=null;Y.prototype.withCredentials=null;Y.prototype.responseHeaders=null;Y.prototype.req=null;var jr=s.$global,j=s.global("$hxClasses").SimpleFuture=class Ue extends s.inherits(){[s.new](){this._isFinished=!1}trigger(e){this._result=e,this._isFinished=!0,this._callback!=null&&this._callback(this._result)}then(e){this._callback=e,this._isFinished&&e(this._result)}static get __name__(){return"SimpleFuture"}get __class__(){return Ue}};j.prototype._callback=null;j.prototype._result=null;j.prototype._isFinished=null;var Jr=s.$global,I=s.global("$hxClasses").Reflect=class je{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let r;if(e==null)return null;{let n;return e.__properties__?(r=e.__properties__["get_"+t],n=r):n=!1,n?e[r]():e[t]}}static setProperty(e,t,r){let n,i;e.__properties__?(n=e.__properties__["set_"+t],i=n):i=!1,i?e[n](r):e[t]=r}static fields(e){let t=[];if(e!=null){let n=Object.prototype.hasOwnProperty;for(var r in e)r!="__id__"&&r!="hx__closures__"&&n.call(e,r)&&t.push(r)}return t}static get __name__(){return"Reflect"}get __class__(){return je}};var es=s.$global,l=s.global("$hxClasses")["internal.RecoBackendV2"]=class f extends s.inherits(){[s.new](){}static _requestUri(){return"https://"+f._req_domain+"/api/"+f._environment+"/recommendations/requests"}static noConsentBody(){return{device_id:"no-consent",user_group:"no-consent",version:"no-consent"}}static buildRequestBody(e){let t={lists:e,page_type:f._page_visit!=null?f._page_visit:f._page_view,channel:"www-desktop"};if(f._consent==0){let r=f.noConsentBody(),n=0,i=I.fields(r);for(;n<i.length;){let o=i[n];++n,t[o]=I.field(r,o)}}else f._user_id!=null?t.user_id=f._user_id:t.device_id=f._device_id;return t}static _requestRecos(e){let t=new j,r=null,n=new Y(f._requestUri());n.setHeader("Content-Type","application/json"),n.setPostData(JSON.stringify(f.buildRequestBody(e))),n.onError=function(a){throw k.thrown("HTTP Request Error: "+a)},n.onStatus=function(a){if(a<200||a>=300)throw k.thrown("HTTP Status Error: "+a)};try{n.request(!1)}catch(a){let y=k.caught(a).unwrap();throw k.thrown("Failed to execute synchronous request: "+$.string(y))}let i=function(a){let y=JSON.parse(a),d=Z.fromRequestData(y);t.trigger(d)},o=n.get_responseData();return o!=null?i(o):n.onData=i,t}static getRawRecommendations(e){return f._requestRecos(e)}static setConsent(e){e>2&&(e=2),f._consent=e}static setChannel(e){f._channel=e}static setPageVisit(e){f._page_visit=e}static setEnvironment(e){f._environment=e}static setDeviceId(e){f._device_id=e}static setUserId(e){f._user_id=e}static setRequestDomain(e){f._req_domain=e}static setPageView(e){f._page_view=e}static getRequestDomain(){return f._req_domain}static getEnvironment(){return f._environment}static getPageVisit(){return f._page_visit}static getUserId(){return f._user_id}static getDeviceId(){return f._device_id}static getPageView(){return f._page_view}static getConsent(){return f._consent}static getChannel(){return f._channel}static get __name__(){return"internal.RecoBackendV2"}get __class__(){return f}};l._environment=null;l._device_id="no-consent";l._user_id=null;l._consent=0;l._req_domain="europe-west1.froomle.com";l._page_visit=null;l._page_view=null;l._channel="www-desktop";var lt=function(){};lt.__isInterface__=!0;var ot=function(){};ot.__isInterface__=!0;var Z=s.global("$hxClasses")["internal._RecommendationsInternal"]=class ke extends s.inherits(){[s.new](e,t,r,n,i){this.request_id=t,this.user_group=r,this.device_id=e,this.user_id=n,this._lists=i}items(){let e=[],t=0,r=this._lists;for(;t<r.length;){let n=r[t];++t;let i=0,o=n.items;for(;i<o.length;){let a=o[i];++i,e.push(a)}}return e}lists(){return this._lists}getItemsByListName(e){let t=0,r=this._lists;for(;t<r.length;){let n=r[t];if(++t,n.list_name==e)return n}return null}static fromRequestData(e){let t=I.getProperty(e,"lists"),r=[],n=0;for(;n<t.length;){let i=t[n];++n;let o=I.getProperty(i,"items"),a=[],y=0;for(;y<o.length;){let c=o[y];++y,a.push(new ae(c))}let d=new ee({limit:I.getProperty(i,"limit"),list_key:I.getProperty(i,"list_key"),list_name:I.getProperty(i,"list_name"),list_size:I.getProperty(i,"list_size"),items:a});r.push(d)}return new ke(I.getProperty(e,"device_id"),I.getProperty(e,"request_id"),I.getProperty(e,"user_group"),I.getProperty(e,"user_id"),r)}static get __name__(){return"internal._RecommendationsInternal"}static get __interfaces__(){return[z]}get __class__(){return ke}};Z.prototype.request_id=null;Z.prototype.user_group=null;Z.prototype.user_id=null;Z.prototype.device_id=null;Z.prototype._lists=null;var ee=s.global("$hxClasses")["internal._RecommendationsListInternal"]=class Ne extends s.inherits(){[s.new](e){this.items=e.items,this.limit=e.limit,this.list_key=e.list_key,this.list_name=e.list_name,this.list_size=e.list_size}static get __name__(){return"internal._RecommendationsListInternal"}static get __interfaces__(){return[Q]}get __class__(){return Ne}};ee.prototype.limit=null;ee.prototype.list_key=null;ee.prototype.list_name=null;ee.prototype.list_size=null;ee.prototype.items=null;var ae=s.global("$hxClasses")["internal._RecommendationItemInternal"]=class Me extends s.inherits(){[s.new](e){this._data={},this.Id=I.getProperty(e,"item_id"),this.RequestId=I.getProperty(e,"request_id"),this.UserGroup=I.getProperty(e,"user_group");let t=0,r=I.fields(e);for(;t<r.length;){let n=r[t];++t,this._data[n]=I.field(e,n)}}get(e){return this._data[e]}static get __name__(){return"internal._RecommendationItemInternal"}static get __interfaces__(){return[W]}get __class__(){return Me}};ae.prototype.Id=null;ae.prototype.RequestId=null;ae.prototype.UserGroup=null;ae.prototype._data=null;var C=s.global("$hxClasses")["internal._RecoBackendV2.RecoBackendV2_Fields_"]=class Je{static getRawRecommendations(e){return l.getRawRecommendations(e)}static setConsent(e){l.setConsent(e)}static setPageVisit(e){l.setPageVisit(e)}static setEnvironment(e){l.setEnvironment(e)}static setDeviceId(e){l.setDeviceId(e)}static setUserId(e){l.setUserId(e)}static setRequestDomain(e){l.setRequestDomain(e)}static setPageView(e){l.setPageView(e)}static setChannel(e){l.setChannel(e)}static getRequestDomain(){l.getRequestDomain()}static getConsent(){l.getConsent()}static getPageVisit(){l.getPageVisit()}static getEnvironment(){l.getEnvironment()}static getDeviceId(){l.getDeviceId()}static getUserId(){l.getUserId()}static getPageView(){l.getPageView()}static getChannel(){l.getChannel()}static get __name__(){return"internal._RecoBackendV2.RecoBackendV2_Fields_"}get __class__(){return Je}},ts=C.getRawRecommendations,rs=C.setConsent,ss=C.setPageVisit,ns=C.setEnvironment,is=C.setDeviceId,ls=C.setUserId,os=C.setRequestDomain,as=C.setPageView,us=C.setChannel,cs=C.getRequestDomain,gs=C.getConsent,_s=C.getPageVisit,ms=C.getEnvironment,ps=C.getDeviceId,ds=C.getUserId,hs=C.getPageView,fs=C.getChannel;var xs=s.$global,A=s.global("$hxClasses").FroomleSdk=class V{static register(){V.registered||V._env_set&&(!V._page_visit_set&&!V._page_view_set||(V.registered=!0))}static buildScriptTag(){let e='<script src="https://cdn.froomle.com/reco-backend-v2/0.0.9/reco-backend-v2.min.js" data-froomle-env="'+l.getEnvironment()+'" ';return l.getPageVisit()!=null&&(e+='data-froomle-page-visit="'+l.getPageVisit()+'" '),l.getPageView()!=null&&(e+='data-froomle-page-view="'+l.getPageView()+'" '),l.getDeviceId()!=null&&(e+='data-froomle-device-id="'+l.getDeviceId()+'" '),l.getUserId()!=null&&(e+='data-froomle-user-id="'+l.getUserId()+'" '),l.getConsent()>0&&(e+='data-froomle-consent="'+l.getConsent()+'" '),l.getRequestDomain()!=null&&(e+='data-froomle-request-domain="'+l.getRequestDomain()+'" '),e+="><\/script>",e}static setEnvironment(e){l.setEnvironment(e),V._env_set=!0,V.register()}static setDeviceId(e){l.setDeviceId(e)}static setUserId(e){l.setUserId(e)}static setConsent(e){l.setConsent(e)}static setPageView(e){l.setPageView(e),V._page_view_set=!0,V.register()}static setPageVisit(e){l.setPageVisit(e),V._page_visit_set=!0,V.register()}static setRequestDomain(e){l.setRequestDomain(e)}static getRawRecommendations(e){return l.getRawRecommendations(e)}static getVersion(){return"0.0.9"}static get __name__(){return"FroomleSdk"}get __class__(){return V}};A._env_set=!1;A._page_visit_set=!1;A._page_view_set=!1;A.registered=!1;var Is=s.$global,te=s.global("$hxClasses")["internal.domHandler.FroomleDomTree"]=class fe extends s.inherits(){[s.new](){}createElement(e){return window.document.createElement(e)}querySelectorAll(e){let t=this.root,r=[],n=t.querySelectorAll(e),i=0,o=n.length;for(;i<o;){let a=i++;r.push(n.item(a))}return r}getRoot(){return this.root}toString(){return this.root.outerHTML}static run(){}static fromHtml(e){return new fe}static fromDocument(){let e=new fe;return e.root=window.document,e}static get __name__(){return"internal.domHandler.FroomleDomTree"}get __class__(){return fe}};te.prototype.root=null;var ks=s.$global,L=s.global("$hxClasses")["internal._ADomNode.ADomNode"]=class Ce{static _new(e){return e}static fromElement(e){return e}static create(e,t){return window.document.createElement(t)}static replaceChild(e,t,r){e.replaceChild(t,r)}static get attributes(){return this.get_attributes()}static get_attributes(e){let t=e,r=[],n=0,i=t.attributes.length;for(;n<i;){let o=n++,a=t.attributes.item(o);r.push({name:a.name,value:a.value})}return r}static addChild(e,t){e.appendChild(t)}static removeChild(e,t){e.removeChild(t)}static getAttribute(e,t){return e.getAttribute(t)}static setAttribute(e,t,r){e.setAttribute(t,r)}static getText(e){return e.textContent}static setText(e,t){e.textContent=t}static get children(){return this.get_children()}static get_children(e){let t=[],n=e.children,i=0,o=n.length;for(;i<o;){let a=i++;t.push(n[a])}return t}static querySelectorAll(e,t){let r=e,n=[],i=r.querySelectorAll(t),o=0,a=i.length;for(;o<a;){let y=o++;n.push(i.item(y))}return n}static getFilterKeyValue(e){let t=0,r=Ce.get_attributes(e);for(;t<r.length;){let n=r[t];if(++t,n.name.startsWith("data-froomle-reco-filter-"))return{key:n.name.substring(25),value:n.value}}return{key:null,value:null}}static get __name__(){return"internal._ADomNode.ADomNode_Impl_"}get __class__(){return Ce}};var Hs=s.$global,ue=s.global("$hxClasses")["internal.domHandler.DomDomDom"]=class K extends s.inherits(){[s.new](){}static _fillRecoTargets(e){let t=new j;if(e==null)return t.trigger(!1),t;let r=[],n=e,i=[],o=n.querySelectorAll("*"),a=0,y=o.length;for(;a<y;){let h=a++;i.push(o.item(h))}let d=i,c=0;for(;c<d.length;){let h=d[c];++c;let D=0,R=L.get_attributes(h);for(;D<R.length;){let M=R[D];++D,M.name=="data-froomle-reco"&&r.push(h)}}let g=[],m=0;for(;m<r.length;){let h=r[m];++m,h.getAttribute("data-froomle-request-id")==null&&(h.getAttribute("data-froomle-id")==null||h.getAttribute("data-froomle-id")=="")&&g.push(h)}if(g.length<1)return new j;let E=[],_=[],p="",v="",b="",w=[],q=function(){let h={list_name:p,list_size:w.length,limit:w.length};v!=null&&I.setProperty(h,v,b),E.push(h),_.push(w)},O=function(h,D,R,M){p=h,v=D,b=R,w=[M]},x=0;for(;x<g.length;){let h=g[x];++x;let D=h.getAttribute("data-froomle-reco"),R=L.getFilterKeyValue(h);if(p==""){O(D,R.key,R.value,h);continue}else if(D==p&&R.key==v&&R.value==b){w.push(h);continue}else{q(),O(D,R.key,R.value,h);continue}}return p!=""&&q(),C.getRawRecommendations(E).then(function(h){let D=0,R=h.lists();for(;D<R.length;){let M=R[D],N=D++,U=M,X=U.items.length!=_[N].length,se=0,ye=U.items;for(;se<ye.length;){let be=ye[se],Ye=se++,Ze=be;K._fillParameters(_[N][Ye],Ze,h.request_id)}}t.trigger(!0)}),t}static _fillParameters(e,t,r){let n=function(m,E,_,p){p==null&&(p="");let v=function(b,w,q){q==null&&(q="fgh");try{w=new oe("\\\\[(\\\\w+)\\\\]","g").map(w,function(R){return"."+R.matched(1)}),w=J.replace(w,"[","."),w=J.replace(w,"]",""),B.cca(w,0)==46&&(w=B.substr(w,1,null));let x=w.split("."),S=b.get(x[0]),h=1,D=x.length;for(;h<D;){let R=h++;if(S==null)return null;S instanceof Array&&$.parseInt(x[R])!=null?S=S[$.parseInt(x[R])]:S=I.field(S,x[R])}return S}catch{return q}};try{let b=v(t,_,p);E=="inner"?m.textContent=b:m.setAttribute(E,b)}catch{}};e.setAttribute("data-froomle-id",t.Id),e.setAttribute("data-froomle-request-id",r);let i=e,o=[],a=i.querySelectorAll("*"),y=0,d=a.length;for(;y<d;){let m=y++;o.push(a.item(m))}let c=o,g=0;for(;g<c.length;){let m=c[g];++g;let E=0,_=L.get_attributes(m);for(;E<_.length;){let p=_[E];if(++E,p.name.startsWith("data-froomle-param-")){let v=J.replace(p.name,"data-froomle-param-",""),b=p.value;n(m,v,b)}}}}static _orderElements(e){let t=function(_,p,v){let b=[],w=L.get_children(_),q=0;for(;q<w.length;){let S=w[q];if(++q,S.getAttribute("data-froomle-ordervalue")!=null){b.push(S);let D=L.create(e,"span");D.setAttribute("data-froomle-tmp-node",""),L.replaceChild(_,D,S)}}let O=[],x=0;for(;x<b.length;){let S=b[x];++x,O.push(S.getAttribute("data-froomle-ordervalue"))}return{el:_,key:p,values:O,orderChildren:b,list_name:v}},r=new j,n=e.getRoot(),i=[],o=n.querySelectorAll("*"),a=0,y=o.length;for(;a<y;){let _=a++;i.push(o.item(_))}let d=i,c=[],g=0;for(;g<d.length;){let _=d[g];++g;let p=0,v=L.get_attributes(_);for(;p<v.length;){let b=v[p];++p,b.name.startsWith("data-froomle-order-")&&c.push(t(_,b.name.substring(19),b.value))}}if(c.length<1)return r.trigger(!1),r;let m=[],E=0;for(;E<c.length;){let _=c[E];++E;let p={list_name:_.list_name,limit:_.values.length,list_size:_.values.length},v={};I.setProperty(v,_.key,_.values),I.setProperty(p,"order",v),m.push(p)}return C.getRawRecommendations(m).then(function(_){let p=0,v=_.lists();for(;p<v.length;){let b=v[p],q=p++,O=b,x=c[q];x.el.setAttribute("data-froomle-request-id",_.request_id);let S=[],h=0,D=O.items;for(;h<D.length;){let _e=D[h];++h;let N=_e.get(x.key),U=0,X=x.values;for(;U<X.length;){let se=X[U],be=U++;if(N==se){S.push(x.orderChildren[be]);break}}}let R=0,M=S.length;for(;R<M;){let _e=R++,N=0,U=L.get_children(x.el);for(;N<U.length;){let X=U[N];if(++N,X.getAttribute("data-froomle-tmp-node")==""){L.replaceChild(x.el,S[_e],X);break}}}}r.trigger(!0)}),r}static domInit(e){K._orderElements(e).then(function(t){K._fillRecoTargets(e.getRoot())})}static fillElementRecos(e){K._fillRecoTargets(e)}static runFromHtml(e){if(e=="")return"";let t=te.fromHtml(e);return K.domInit(t),t.toString()}static get __name__(){return"internal.domHandler.DomDomDom"}get __class__(){return K}};var js=s.$global;var P=class P{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e=[];for(let t of P.impressionQueue){let r={event_type:"impression",page_type:l.getPageVisit(),action_item:t.getAttribute("data-froomle-id"),action_item_type:"article",channel:"www-desktop"};l.getUserId()?r.user_id=l.getUserId():r.device_id=l.getDeviceId();let n=t.getAttribute("data-froomle-reco");if(n){r.list_name=n;let i=t.getAttribute("data-froomle-request-id");if(!i)throw console.error("element need reco but doesnt have request id registered yet"),new Error("element need reco but doesnt have request id registered");r.request_id=i}}return P.impressionQueue=[],JSON.stringify({events:e})}static sendImpressions(){P.impressionQueue.length!==0&&fetch(P.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:P.generateBody()})}static getViewPortRect(){let e=window.innerWidth||document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{left:0,top:0,x:0,y:0,toJSON(){},right:e,bottom:t,width:e,height:t}}static intersectsWithViewPortRect(e){let t=e.getBoundingClientRect(),r=P.getViewPortRect();return t.right>r.left&&t.left<r.right&&t.bottom>r.top&&t.top<r.bottom}static addIntersectionImpressionListener(e){P.observer.observe(e)}static processDocument(){if(l.getDeviceId()!="no-consent"){for(let e of document.querySelectorAll("[data-froomle-id]"))P.intersectsWithViewPortRect(e)?P.impressionQueue.push(e):P.addIntersectionImpressionListener(e);P.sendImpressions()}}};P.impressionQueue=[],P.observer=new IntersectionObserver((e,t)=>{e.forEach(r=>{r.isIntersecting&&(P.impressionQueue.push(r.target),P.observer.unobserve(r.target))}),P.impressionQueue.length>0&&P.sendImpressions()});var re=P;var ce=class u{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e={event_type:"page_visit",page_type:l.getPageVisit(),channel:"www-desktop"};return l.getUserId()?e.user_id=l.getUserId():e.device_id=l.getDeviceId(),JSON.stringify(e)}static sendPageVisit(){l.getPageVisit()&&l.getDeviceId()!="no-consent"&&fetch(u.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:u.generateBody()})}};var ge=class u{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e={event_type:"detail_pageview",page_type:"article_detail",action_item:l.getPageView(),action_item_type:"article",channel:"www-desktop"};return l.getUserId()?e.user_id=l.getUserId():e.device_id=l.getDeviceId(),JSON.stringify(e)}static sendPageView(){l.getPageView()&&l.getDeviceId()!="no-consent"&&fetch(u.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:u.generateBody()})}};var Ke=A.setEnvironment,Xe=A.setPageVisit,at=A.setConsent,ze=A.setUserId,Qe=A.setDeviceId,We=A.setRequestDomain,ut=A.setPageView;if(typeof document!="undefined"){let u=document.currentScript;if(u){let e=u.getAttribute("data-froomle-device-id"),t=u.getAttribute("data-froomle-user-id"),r=u.getAttribute("data-froomle-env"),n=u.getAttribute("data-froomle-page-visit"),i=u.getAttribute("data-froomle-request-domain"),o=u.getAttribute("data-froomle-page-view");Ke(r),o&&ut(o),n&&Xe(n),e&&Qe(e),t&&ze(t),i&&We(i)}else console.error("Froomle SDK: could not find the script tag where the sdk is included.");document.addEventListener("DOMContentLoaded",()=>{ue.domInit(te.fromDocument()),re.processDocument(),ce.sendPageVisit(),ge.sendPageView(),new MutationObserver(t=>{for(let r of t)if(r.type==="childList"&&re.processElement(r.target),r.type==="attributes")if(r.attributeName==="data-froomle-reco"){let n=r.target.getAttribute("data-froomle-request-id");(!n||n==="")&&ue.fillElementRecos(r.target)}else r.attributeName==="data-froomle-request-id"&&ue.fillElementRecos(r.target)}).observe(document,{childList:!0,subtree:!0})})}return it(ct);})();
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";var we=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var rt=Object.prototype.hasOwnProperty;var st=(u,e)=>{for(var t in e)we(u,t,{get:e[t],enumerable:!0})},nt=(u,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of tt(e))!rt.call(u,n)&&n!==t&&we(u,n,{get:()=>e[n],enumerable:!(r=et(e,n))||r.enumerable});return u};var it=u=>nt(we({},"__esModule",{value:!0}),u);var ct={};st(ct,{RecommendationItem:()=>W,RecommendationList:()=>Q,Recommendations:()=>z,setConsent:()=>at,setDeviceId:()=>Qe,setEnvironment:()=>Ke,setPageVisit:()=>Xe,setRequestDomain:()=>We,setUserId:()=>ze});module.exports=it(ct);var s=class u{static global(e){return u.globals[e]?u.globals[e]:u.globals[e]={}}static createStatic(e,t,r){let n=null;Object.defineProperty(e,t,{enumerable:!0,get:function(){return r!=null&&(n=r(),r=null),n},set:function(i){r!=null&&(n=r(),r=null),n=i}})}static iterator(e){if(Array.isArray(e)){let t=e;return function(){return u.mkIter(t)}}else return typeof e.iterator=="function"?e.iterator.bind(e):e.iterator}static getIterator(e){return Array.isArray(e)?u.mkIter(e):e.iterator()}static mkIter(e){return new xe(e)}static extend(e){function t(){this[u.new].apply(this,arguments)}return Object.setPrototypeOf(t.prototype,e.prototype),t}static inherits(e,t){t==null&&(t=!1);function r(){t&&e&&r[u.init]&&r[u.init](),this[u.new].apply(this,arguments)}return t?r[u.init]=()=>{let n=e();n[u.init]&&n[u.init](),Object.setPrototypeOf(r.prototype,n.prototype),r[u.init]=void 0}:e&&e[u.init]?(t=!0,r[u.init]=()=>{e[u.init]&&e[u.init](),Object.setPrototypeOf(r.prototype,e.prototype),r[u.init]=void 0}):e&&Object.setPrototypeOf(r.prototype,e.prototype),r}static bind(e,t){if(t==null)return null;t.__id__==null&&(t.__id__=u.fid++);let r=null;return e.hx__closures__==null?e.hx__closures__={}:r=e.hx__closures__[t.__id__],r==null&&(r=t.bind(e),e.hx__closures__[t.__id__]=r),r}static get __name__(){return"genes.Register"}get __class__(){return u}};s.$global=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:void 0;s.globals={};s.new=Symbol();s.init=Symbol();s.fid=0;var xe=s.global("$hxClasses")["genes._Register.ArrayIterator"]=class $e extends s.inherits(){[s.new](e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}static get __name__(){return"genes._Register.ArrayIterator"}get __class__(){return $e}};xe.prototype.array=null;xe.prototype.current=null;var pt=s.$global,z=function(){};z.__isInterface__=!0;var Q=function(){};Q.__isInterface__=!0;var W=function(){};W.__isInterface__=!0;var yt=s.$global,me=s.global("$hxClasses")["haxe.ValueException"]=class Ce extends s.inherits(()=>k,!0){[s.new](e,t,r){super[s.new](String(e),t,r),this.value=e}unwrap(){return this.value}static get __name__(){return"haxe.ValueException"}static get __super__(){return k}get __class__(){return Ce}};me.prototype.value=null;var vt=s.$global,k=s.global("$hxClasses")["haxe.Exception"]=class ne extends s.inherits(()=>Error,!0){[s.new](e,t,r){Error.call(this,e),this.message=e,this.__previousException=t,this.__nativeException=r!=null?r:this}unwrap(){return this.__nativeException}get_native(){return this.__nativeException}static caught(e){return e instanceof ne?e:e instanceof Error?new ne(e.message,null,e):new me(e,null,e)}static thrown(e){return e instanceof ne?e.get_native():e instanceof Error?e:new me(e)}static get __name__(){return"haxe.Exception"}static get __super__(){return Error}get __class__(){return ne}};k.prototype.native=null;k.prototype.__skipStack=null;k.prototype.__nativeException=null;k.prototype.__previousException=null;var Dt=s.$global,ve=s.global("$hxClasses")["js.Browser"]=class qe{static get supported(){return this.get_supported()}static get_supported(){return typeof window!="undefined"&&typeof window.location!="undefined"?typeof window.location.protocol=="string":!1}static createXMLHttpRequest(){if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")return new"ActiveXObject"("Microsoft.XMLHTTP");throw k.thrown("Unable to create XMLHttpRequest object.")}static get __name__(){return"js.Browser"}get __class__(){return qe}};var Pt=s.$global,F=s.global("$hxEnums")["haxe.io.Error"]={__ename__:"haxe.io.Error",Blocked:{_hx_name:"Blocked",_hx_index:0,__enum__:"haxe.io.Error"},Overflow:{_hx_name:"Overflow",_hx_index:1,__enum__:"haxe.io.Error"},OutsideBounds:{_hx_name:"OutsideBounds",_hx_index:2,__enum__:"haxe.io.Error"},Custom:Object.assign(u=>({_hx_index:3,__enum__:"haxe.io.Error",e:u}),{_hx_name:"Custom",__params__:["e"]})};F.__constructs__=[F.Blocked,F.Overflow,F.OutsideBounds,F.Custom];F.__empty_constructs__=[F.Blocked,F.Overflow,F.OutsideBounds];var qt=s.$global,H=s.global("$hxEnums")["haxe.io.Encoding"]={__ename__:"haxe.io.Encoding",UTF8:{_hx_name:"UTF8",_hx_index:0,__enum__:"haxe.io.Encoding"},RawNative:{_hx_name:"RawNative",_hx_index:1,__enum__:"haxe.io.Encoding"}};H.__constructs__=[H.UTF8,H.RawNative];H.__empty_constructs__=[H.UTF8,H.RawNative];var Tt=s.$global,G=s.global("$hxClasses")["haxe.io.Bytes"]=class Re extends s.inherits(){[s.new](e){this.length=e.byteLength,this.b=new Uint8Array(e),this.b.bufferValue=e,e.hxBytes=this,e.bytes=this.b}getString(e,t,r){if(e<0||t<0||e+t>this.length)throw k.thrown(F.OutsideBounds);r==null&&(r=H.UTF8);let n="",i=this.b,o=e,a=e+t;switch(r._hx_index){case 0:let f=e>0;for(;o<a;){let h=i[o++];if(h<128){if(h==0)break;n+=String.fromCodePoint(h)}else if(h<224){let c=(h&63)<<6|i[o++]&127;n+=String.fromCodePoint(c)}else if(h<240){let c=i[o++],_=(h&31)<<12|(c&127)<<6|i[o++]&127;n+=String.fromCodePoint(_)}else{let c=i[o++],_=i[o++],m=(h&15)<<18|(c&127)<<12|(_&127)<<6|i[o++]&127;n+=String.fromCodePoint(m)}}break;case 1:for(;o<a;){let h=i[o++]|i[o++]<<8;n+=String.fromCodePoint(h)}break}return n}static ofData(e){let t=e.hxBytes;return t!=null?t:new Re(e)}static get __name__(){return"haxe.io.Bytes"}get __class__(){return Re}};G.prototype.length=null;G.prototype.b=null;var jt=s.$global,T=s.global("$hxClasses")["haxe.http.HttpBase"]=class Be extends s.inherits(){[s.new](e){this.url=e,this.headers=[],this.params=[],this.emptyOnData=s.bind(this,this.onData)}get responseData(){return this.get_responseData()}setHeader(e,t){let r=0,n=this.headers.length;for(;r<n;){let i=r++;if(this.headers[i].name==e){this.headers[i]={name:e,value:t};return}}this.headers.push({name:e,value:t})}setPostData(e){this.postData=e,this.postBytes=null}onData(e){}onBytes(e){}onError(e){}onStatus(e){}hasOnData(){return s.bind(this,this.onData)!=this.emptyOnData}success(e){this.responseBytes=e,this.responseAsString=null,this.hasOnData()&&this.onData(this.get_responseData()),this.onBytes(this.responseBytes)}get_responseData(){return this.responseAsString==null&&this.responseBytes!=null&&(this.responseAsString=this.responseBytes.getString(0,this.responseBytes.length,H.UTF8)),this.responseAsString}static get __name__(){return"haxe.http.HttpBase"}get __class__(){return Be}};T.prototype.url=null;T.prototype.responseBytes=null;T.prototype.responseAsString=null;T.prototype.postData=null;T.prototype.postBytes=null;T.prototype.headers=null;T.prototype.params=null;T.prototype.emptyOnData=null;var Jt=s.$global,pe=s.global("$hxClasses")["haxe.iterators.MapKeyValueIterator"]=class Ve extends s.inherits(){[s.new](e){this.map=e,this.keys=e.keys()}hasNext(){return this.keys.hasNext()}next(){let e=this.keys.next();return{value:this.map.get(e),key:e}}static get __name__(){return"haxe.iterators.MapKeyValueIterator"}get __class__(){return Ve}};pe.prototype.map=null;pe.prototype.keys=null;var zt=s.$global,Ie=function(){};Ie.__isInterface__=!0;var Gt=s.$global,Ee=s.global("$hxClasses")["js.Boot"]=class ie{static __string_rec(e,t){if(e==null)return"null";if(t.length>=5)return"<...>";let r=typeof e;switch(r=="function"&&(e.__name__||e.__ename__)&&(r="object"),r){case"function":return"<function>";case"object":if(e.__enum__){let h=s.global("$hxEnums")[e.__enum__].__constructs__[e._hx_index],c=h._hx_name;return h.__params__?(t=t+" ",c+"("+(function(_){var m;let E=[];{let g=0,p=h.__params__;for(;g<p.length;){let v=p[g];g=g+1,E.push(ie.__string_rec(e[v],t))}}return m=E,m})(this).join(",")+")"):c}if(e instanceof Array){let f="[";t+=" ";let h=0,c=e.length;for(;h<c;){let _=h++;f+=(_>0?",":"")+ie.__string_rec(e[_],t)}return f+="]",f}let n;try{n=e.toString}catch{return"???"}if(n!=null&&n!=Object.toString&&typeof n=="function"){let f=e.toString();if(f!="[object Object]")return f}let i=`{
1
+ "use strict";var we=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var rt=Object.prototype.hasOwnProperty;var st=(u,e)=>{for(var t in e)we(u,t,{get:e[t],enumerable:!0})},nt=(u,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of tt(e))!rt.call(u,n)&&n!==t&&we(u,n,{get:()=>e[n],enumerable:!(r=et(e,n))||r.enumerable});return u};var it=u=>nt(we({},"__esModule",{value:!0}),u);var ct={};st(ct,{RecommendationItem:()=>W,RecommendationList:()=>Q,Recommendations:()=>z,setConsent:()=>at,setDeviceId:()=>Qe,setEnvironment:()=>Ke,setPageVisit:()=>Xe,setRequestDomain:()=>We,setUserId:()=>ze});module.exports=it(ct);var s=class u{static global(e){return u.globals[e]?u.globals[e]:u.globals[e]={}}static createStatic(e,t,r){let n=null;Object.defineProperty(e,t,{enumerable:!0,get:function(){return r!=null&&(n=r(),r=null),n},set:function(i){r!=null&&(n=r(),r=null),n=i}})}static iterator(e){if(Array.isArray(e)){let t=e;return function(){return u.mkIter(t)}}else return typeof e.iterator=="function"?e.iterator.bind(e):e.iterator}static getIterator(e){return Array.isArray(e)?u.mkIter(e):e.iterator()}static mkIter(e){return new xe(e)}static extend(e){function t(){this[u.new].apply(this,arguments)}return Object.setPrototypeOf(t.prototype,e.prototype),t}static inherits(e,t){t==null&&(t=!1);function r(){t&&e&&r[u.init]&&r[u.init](),this[u.new].apply(this,arguments)}return t?r[u.init]=()=>{let n=e();n[u.init]&&n[u.init](),Object.setPrototypeOf(r.prototype,n.prototype),r[u.init]=void 0}:e&&e[u.init]?(t=!0,r[u.init]=()=>{e[u.init]&&e[u.init](),Object.setPrototypeOf(r.prototype,e.prototype),r[u.init]=void 0}):e&&Object.setPrototypeOf(r.prototype,e.prototype),r}static bind(e,t){if(t==null)return null;t.__id__==null&&(t.__id__=u.fid++);let r=null;return e.hx__closures__==null?e.hx__closures__={}:r=e.hx__closures__[t.__id__],r==null&&(r=t.bind(e),e.hx__closures__[t.__id__]=r),r}static get __name__(){return"genes.Register"}get __class__(){return u}};s.$global=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:void 0;s.globals={};s.new=Symbol();s.init=Symbol();s.fid=0;var xe=s.global("$hxClasses")["genes._Register.ArrayIterator"]=class Pe extends s.inherits(){[s.new](e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}static get __name__(){return"genes._Register.ArrayIterator"}get __class__(){return Pe}};xe.prototype.array=null;xe.prototype.current=null;var pt=s.$global,z=function(){};z.__isInterface__=!0;var Q=function(){};Q.__isInterface__=!0;var W=function(){};W.__isInterface__=!0;var yt=s.$global,me=s.global("$hxClasses")["haxe.ValueException"]=class Se extends s.inherits(()=>k,!0){[s.new](e,t,r){super[s.new](String(e),t,r),this.value=e}unwrap(){return this.value}static get __name__(){return"haxe.ValueException"}static get __super__(){return k}get __class__(){return Se}};me.prototype.value=null;var vt=s.$global,k=s.global("$hxClasses")["haxe.Exception"]=class ne extends s.inherits(()=>Error,!0){[s.new](e,t,r){Error.call(this,e),this.message=e,this.__previousException=t,this.__nativeException=r!=null?r:this}unwrap(){return this.__nativeException}get_native(){return this.__nativeException}static caught(e){return e instanceof ne?e:e instanceof Error?new ne(e.message,null,e):new me(e,null,e)}static thrown(e){return e instanceof ne?e.get_native():e instanceof Error?e:new me(e)}static get __name__(){return"haxe.Exception"}static get __super__(){return Error}get __class__(){return ne}};k.prototype.native=null;k.prototype.__skipStack=null;k.prototype.__nativeException=null;k.prototype.__previousException=null;var Dt=s.$global,ve=s.global("$hxClasses")["js.Browser"]=class $e{static get supported(){return this.get_supported()}static get_supported(){return typeof window!="undefined"&&typeof window.location!="undefined"?typeof window.location.protocol=="string":!1}static createXMLHttpRequest(){if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")return new"ActiveXObject"("Microsoft.XMLHTTP");throw k.thrown("Unable to create XMLHttpRequest object.")}static get __name__(){return"js.Browser"}get __class__(){return $e}};var Pt=s.$global,F=s.global("$hxEnums")["haxe.io.Error"]={__ename__:"haxe.io.Error",Blocked:{_hx_name:"Blocked",_hx_index:0,__enum__:"haxe.io.Error"},Overflow:{_hx_name:"Overflow",_hx_index:1,__enum__:"haxe.io.Error"},OutsideBounds:{_hx_name:"OutsideBounds",_hx_index:2,__enum__:"haxe.io.Error"},Custom:Object.assign(u=>({_hx_index:3,__enum__:"haxe.io.Error",e:u}),{_hx_name:"Custom",__params__:["e"]})};F.__constructs__=[F.Blocked,F.Overflow,F.OutsideBounds,F.Custom];F.__empty_constructs__=[F.Blocked,F.Overflow,F.OutsideBounds];var qt=s.$global,H=s.global("$hxEnums")["haxe.io.Encoding"]={__ename__:"haxe.io.Encoding",UTF8:{_hx_name:"UTF8",_hx_index:0,__enum__:"haxe.io.Encoding"},RawNative:{_hx_name:"RawNative",_hx_index:1,__enum__:"haxe.io.Encoding"}};H.__constructs__=[H.UTF8,H.RawNative];H.__empty_constructs__=[H.UTF8,H.RawNative];var Tt=s.$global,G=s.global("$hxClasses")["haxe.io.Bytes"]=class Re extends s.inherits(){[s.new](e){this.length=e.byteLength,this.b=new Uint8Array(e),this.b.bufferValue=e,e.hxBytes=this,e.bytes=this.b}getString(e,t,r){if(e<0||t<0||e+t>this.length)throw k.thrown(F.OutsideBounds);r==null&&(r=H.UTF8);let n="",i=this.b,o=e,a=e+t;switch(r._hx_index){case 0:let y=e>0;for(;o<a;){let d=i[o++];if(d<128){if(d==0)break;n+=String.fromCodePoint(d)}else if(d<224){let c=(d&63)<<6|i[o++]&127;n+=String.fromCodePoint(c)}else if(d<240){let c=i[o++],g=(d&31)<<12|(c&127)<<6|i[o++]&127;n+=String.fromCodePoint(g)}else{let c=i[o++],g=i[o++],m=(d&15)<<18|(c&127)<<12|(g&127)<<6|i[o++]&127;n+=String.fromCodePoint(m)}}break;case 1:for(;o<a;){let d=i[o++]|i[o++]<<8;n+=String.fromCodePoint(d)}break}return n}static ofData(e){let t=e.hxBytes;return t!=null?t:new Re(e)}static get __name__(){return"haxe.io.Bytes"}get __class__(){return Re}};G.prototype.length=null;G.prototype.b=null;var jt=s.$global,T=s.global("$hxClasses")["haxe.http.HttpBase"]=class qe extends s.inherits(){[s.new](e){this.url=e,this.headers=[],this.params=[],this.emptyOnData=s.bind(this,this.onData)}get responseData(){return this.get_responseData()}setHeader(e,t){let r=0,n=this.headers.length;for(;r<n;){let i=r++;if(this.headers[i].name==e){this.headers[i]={name:e,value:t};return}}this.headers.push({name:e,value:t})}setPostData(e){this.postData=e,this.postBytes=null}onData(e){}onBytes(e){}onError(e){}onStatus(e){}hasOnData(){return s.bind(this,this.onData)!=this.emptyOnData}success(e){this.responseBytes=e,this.responseAsString=null,this.hasOnData()&&this.onData(this.get_responseData()),this.onBytes(this.responseBytes)}get_responseData(){return this.responseAsString==null&&this.responseBytes!=null&&(this.responseAsString=this.responseBytes.getString(0,this.responseBytes.length,H.UTF8)),this.responseAsString}static get __name__(){return"haxe.http.HttpBase"}get __class__(){return qe}};T.prototype.url=null;T.prototype.responseBytes=null;T.prototype.responseAsString=null;T.prototype.postData=null;T.prototype.postBytes=null;T.prototype.headers=null;T.prototype.params=null;T.prototype.emptyOnData=null;var Jt=s.$global,pe=s.global("$hxClasses")["haxe.iterators.MapKeyValueIterator"]=class Be extends s.inherits(){[s.new](e){this.map=e,this.keys=e.keys()}hasNext(){return this.keys.hasNext()}next(){let e=this.keys.next();return{value:this.map.get(e),key:e}}static get __name__(){return"haxe.iterators.MapKeyValueIterator"}get __class__(){return Be}};pe.prototype.map=null;pe.prototype.keys=null;var zt=s.$global,Ie=function(){};Ie.__isInterface__=!0;var Gt=s.$global,Ee=s.global("$hxClasses")["js.Boot"]=class ie{static __string_rec(e,t){if(e==null)return"null";if(t.length>=5)return"<...>";let r=typeof e;switch(r=="function"&&(e.__name__||e.__ename__)&&(r="object"),r){case"function":return"<function>";case"object":if(e.__enum__){let d=s.global("$hxEnums")[e.__enum__].__constructs__[e._hx_index],c=d._hx_name;return d.__params__?(t=t+" ",c+"("+(function(g){var m;let E=[];{let _=0,p=d.__params__;for(;_<p.length;){let v=p[_];_=_+1,E.push(ie.__string_rec(e[v],t))}}return m=E,m})(this).join(",")+")"):c}if(e instanceof Array){let y="[";t+=" ";let d=0,c=e.length;for(;d<c;){let g=d++;y+=(g>0?",":"")+ie.__string_rec(e[g],t)}return y+="]",y}let n;try{n=e.toString}catch{return"???"}if(n!=null&&n!=Object.toString&&typeof n=="function"){let y=e.toString();if(y!="[object Object]")return y}let i=`{
2
2
  `;t+=" ";let o=e.hasOwnProperty!=null,a=null;for(a in e)o&&!e.hasOwnProperty(a)||a=="prototype"||a=="__class__"||a=="__super__"||a=="__interfaces__"||a=="__properties__"||(i.length!=2&&(i+=`,
3
3
  `),i+=t+a+" : "+ie.__string_rec(e[a],t));return t=t.substring(1),i+=`
4
- `+t+"}",i;break;case"string":return e;default:return String(e)}}static get __name__(){return"js.Boot"}get __class__(){return ie}};Ee.__toStr={}.toString;var tr=s.$global,$=s.global("$hxClasses").Std=class Ae{static string(e){return Ee.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}static get __name__(){return"Std"}get __class__(){return Ae}};String.__name__=!0,Array.__name__=!0;var ir=s.$global,he=s.global("$hxClasses")["genes.util.EsMap"]=class le extends s.inherits(){[s.new](){this.inst=new Map}set(e,t){this.inst.set(e,t)}get(e){return this.inst.get(e)}remove(e){return this.inst.delete(e)}exists(e){return this.inst.has(e)}keys(){return le.adaptIterator(this.inst.keys())}iterator(){return le.adaptIterator(this.inst.values())}toString(){let e=[],t=le.adaptIterator(this.inst.keys());for(;t.hasNext();){let r=t.next();e.push(""+$.string(r)+" => "+$.string(this.inst.get(r)))}return"{"+e.join(", ")+"}"}clear(){this.inst.clear()}static adaptIterator(e){let t,r,n=function(){let i=e.next();t=i.value,r=i.done};return{hasNext:function(){return r==null&&n(),!r},next:function(){r==null&&n();let i=t;return n(),i}}}static get __name__(){return"genes.util.EsMap"}get __class__(){return le}};he.prototype.inst=null;var _r=s.$global,Oe=s.global("$hxClasses")["haxe.ds.StringMap"]=class De extends s.inherits(he){[s.new](){super[s.new]()}copy(){let e=new De;return e.inst=new Map(this.inst),e}keyValueIterator(){return new pe(this)}static get __name__(){return"haxe.ds.StringMap"}static get __interfaces__(){return[Ie]}static get __super__(){return he}get __class__(){return De}};var pr=s.$global,B=s.global("$hxClasses").HxOverrides=class Fe{static cca(e,t){let r=e.charCodeAt(t);if(r==r)return r}static substr(e,t,r){if(r==null)r=e.length;else if(r<0)if(t==0)r=e.length+r;else return"";return e.substr(t,r)}static now(){return Date.now()}static get __name__(){return"HxOverrides"}get __class__(){return Fe}};typeof performance!="undefined"&&typeof performance.now=="function"&&(B.now=performance.now.bind(performance));var yr=s.$global,J=s.global("$hxClasses").StringTools=class de{static isSpace(e,t){let r=B.cca(e,t);return r>8&&r<14?!0:r==32}static ltrim(e){let t=e.length,r=0;for(;r<t&&de.isSpace(e,r);)++r;return r>0?B.substr(e,r,t-r):e}static rtrim(e){let t=e.length,r=0;for(;r<t&&de.isSpace(e,t-r-1);)++r;return r>0?B.substr(e,0,t-r):e}static replace(e,t,r){return e.split(t).join(r)}static get __name__(){return"StringTools"}get __class__(){return de}};var xr=s.$global,Te=s.global("$hxClasses").Lambda=class He{static exists(e,t){let r=s.getIterator(e);for(;r.hasNext();){let n=r.next();if(t(n))return!0}return!1}static get __name__(){return"Lambda"}get __class__(){return He}};var kr=s.$global,oe=s.global("$hxClasses").EReg=class Le extends s.inherits(){[s.new](e,t){this.r=new RegExp(e,t.split("u").join(""))}match(e){return this.r.global&&(this.r.lastIndex=0),this.r.m=this.r.exec(e),this.r.s=e,this.r.m!=null}matched(e){if(this.r.m!=null&&e>=0&&e<this.r.m.length)return this.r.m[e];throw k.thrown("EReg::matched")}matchedPos(){if(this.r.m==null)throw k.thrown("No string matched");return{pos:this.r.m.index,len:this.r.m[0].length}}matchSub(e,t,r){if(r==null&&(r=-1),this.r.global){this.r.lastIndex=t,this.r.m=this.r.exec(r<0?e:B.substr(e,0,t+r));let n=this.r.m!=null;return n&&(this.r.s=e),n}else{let n=this.match(r<0?B.substr(e,t,null):B.substr(e,t,r));return n&&(this.r.s=e,this.r.m.index+=t),n}}map(e,t){let r=0,n="";do{if(r>=e.length)break;if(!this.matchSub(e,r)){n+=$.string(B.substr(e,r,null));break}let i=this.matchedPos();n+=$.string(B.substr(e,r,i.pos-r)),n+=$.string(t(this)),i.len==0?(n+=$.string(B.substr(e,i.pos,1)),r=i.pos+1):r=i.pos+i.len}while(this.r.global);return!this.r.global&&r>0&&r<e.length&&(n+=$.string(B.substr(e,r,null))),n}static get __name__(){return"EReg"}get __class__(){return Le}};oe.prototype.r=null;var Hr=s.$global,Y=s.global("$hxClasses")["haxe.http.HttpJs"]=class Ue extends s.inherits(T){[s.new](e){this.async=!0,this.withCredentials=!1,super[s.new](e)}request(e){this.responseAsString=null,this.responseBytes=null,this.responseHeaders=null;let t=this.req=ve.createXMLHttpRequest(),r=this,n=function(c){if(t.readyState!=4)return;let _;try{_=t.status}catch{_=null}if(_==0&&ve.get_supported()&&s.$global.location!=null){let m=s.$global.location.protocol.toLowerCase();new oe("^(?:about|app|app-storage|.+-extension|file|res|widget):$","").match(m)&&(_=t.response!=null?200:404)}if(_==null&&(_=null),_!=null&&r.onStatus(_),_!=null&&_>=200&&_<400){r.req=null;let m=t.getAllResponseHeaders().split(`\r
5
- `),E=[],g=0,p=m;for(;g<p.length;){let w=p[g];++g,w!=""&&E.push(w)}m=E;let v=new Oe;r.responseHeaders=v;let b=0;for(;b<m.length;){let w=m[b];++b;let C=w.split(": "),O=C.shift(),x=C.length==1?C[0]:C.join(": ");x=J.ltrim(J.rtrim(x)),r.responseHeaders.inst.set(O,x)}r.success(G.ofData(t.response))}else if(_==null||_==0&&t.response==null)r.req=null,r.onError("Failed to connect or resolve host");else if(_==null){r.req=null;let m=t.response!=null?G.ofData(t.response):null;r.responseBytes=m,r.onError("Http Error #"+t.status)}else switch(_){case 12007:r.req=null,r.onError("Unknown host");break;case 12029:r.req=null,r.onError("Failed to connect to host");break;default:r.req=null;let m=t.response!=null?G.ofData(t.response):null;r.responseBytes=m,r.onError("Http Error #"+t.status)}};this.async&&(t.onreadystatechange=n);let i,o=this.postData,a=this.postBytes;if(o==null)if(a==null)i=null;else{let c=a;i=new Blob([c.b.bufferValue])}else a==null?i=o:i=null;if(i!=null)e=!0;else{let c=0,_=this.params;for(;c<_.length;){let m=_[c];++c,i==null?i="":i=(i==null?"null":$.string(i))+"&";let E=m.name,g=(i==null?"null":$.string(i))+encodeURIComponent(E)+"=",p=m.value;i=g+encodeURIComponent(p)}}try{if(e)t.open("POST",this.url,this.async);else if(i!=null){let c=this.url.split("?").length<=1;t.open("GET",this.url+(c?"?":"&")+(i==null?"null":$.string(i)),this.async),i=null}else t.open("GET",this.url,this.async);t.responseType="arraybuffer"}catch(c){let _=k.caught(c).unwrap();this.req=null,this.onError(_.toString());return}t.withCredentials=this.withCredentials,!Te.exists(this.headers,function(c){return c.name=="Content-Type"})&&e&&this.postData==null&&t.setRequestHeader("Content-Type","application/x-www-form-urlencoded");let f=0,h=this.headers;for(;f<h.length;){let c=h[f];++f,t.setRequestHeader(c.name,c.value)}t.send(i),this.async||n(null)}static get __name__(){return"haxe.http.HttpJs"}static get __super__(){return T}get __class__(){return Ue}};Y.prototype.async=null;Y.prototype.withCredentials=null;Y.prototype.responseHeaders=null;Y.prototype.req=null;var jr=s.$global,j=s.global("$hxClasses").SimpleFuture=class je extends s.inherits(){[s.new](){this._isFinished=!1}trigger(e){this._result=e,this._isFinished=!0,this._callback!=null&&this._callback(this._result)}then(e){this._callback=e,this._isFinished&&e(this._result)}static get __name__(){return"SimpleFuture"}get __class__(){return je}};j.prototype._callback=null;j.prototype._result=null;j.prototype._isFinished=null;var Jr=s.$global,I=s.global("$hxClasses").Reflect=class Ne{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let r;if(e==null)return null;{let n;return e.__properties__?(r=e.__properties__["get_"+t],n=r):n=!1,n?e[r]():e[t]}}static setProperty(e,t,r){let n,i;e.__properties__?(n=e.__properties__["set_"+t],i=n):i=!1,i?e[n](r):e[t]=r}static fields(e){let t=[];if(e!=null){let n=Object.prototype.hasOwnProperty;for(var r in e)r!="__id__"&&r!="hx__closures__"&&n.call(e,r)&&t.push(r)}return t}static get __name__(){return"Reflect"}get __class__(){return Ne}};var es=s.$global,l=s.global("$hxClasses")["internal.RecoBackendV2"]=class y extends s.inherits(){[s.new](){}static _requestUri(){return"https://"+y._req_domain+"/api/"+y._environment+"/recommendations/requests"}static noConsentBody(){return{device_id:"no-consent",user_group:"no-consent",version:"no-consent"}}static buildRequestBody(e){let t={lists:e,page_type:y._page_visit!=null?y._page_visit:y._page_view,channel:"www-desktop"};if(y._consent==0){let r=y.noConsentBody(),n=0,i=I.fields(r);for(;n<i.length;){let o=i[n];++n,t[o]=I.field(r,o)}}else y._user_id!=null?t.user_id=y._user_id:t.device_id=y._device_id;return t}static _requestRecos(e){let t=new j,r=null,n=new Y(y._requestUri());n.setHeader("Content-Type","application/json"),n.setPostData(JSON.stringify(y.buildRequestBody(e))),n.onError=function(a){throw k.thrown("HTTP Request Error: "+a)},n.onStatus=function(a){if(a<200||a>=300)throw k.thrown("HTTP Status Error: "+a)};try{n.request(!1)}catch(a){let f=k.caught(a).unwrap();throw k.thrown("Failed to execute synchronous request: "+$.string(f))}let i=function(a){let f=JSON.parse(a),h=Z.fromRequestData(f);t.trigger(h)},o=n.get_responseData();return o!=null?i(o):n.onData=i,t}static getRawRecommendations(e){return y._requestRecos(e)}static setConsent(e){e>2&&(e=2),y._consent=e}static setPageVisit(e){y._page_visit=e}static setEnvironment(e){y._environment=e}static setDeviceId(e){y._device_id=e}static setUserId(e){y._user_id=e}static setRequestDomain(e){y._req_domain=e}static setPageView(e){y._page_view=e}static getRequestDomain(){return y._req_domain}static getEnvironment(){return y._environment}static getPageVisit(){return y._page_visit}static getUserId(){return y._user_id}static getDeviceId(){return y._device_id}static getPageView(){return y._page_view}static get __name__(){return"internal.RecoBackendV2"}get __class__(){return y}};l._environment=null;l._device_id=null;l._user_id=null;l._consent=0;l._req_domain="europe-west1.froomle.com";l._page_visit=null;l._page_view=null;var lt=function(){};lt.__isInterface__=!0;var ot=function(){};ot.__isInterface__=!0;var Z=s.global("$hxClasses")["internal._RecommendationsInternal"]=class ke extends s.inherits(){[s.new](e,t,r,n,i){this.request_id=t,this.user_group=r,this.device_id=e,this.user_id=n,this._lists=i}items(){let e=[],t=0,r=this._lists;for(;t<r.length;){let n=r[t];++t;let i=0,o=n.items;for(;i<o.length;){let a=o[i];++i,e.push(a)}}return e}lists(){return this._lists}getItemsByListName(e){let t=0,r=this._lists;for(;t<r.length;){let n=r[t];if(++t,n.list_name==e)return n}return null}static fromRequestData(e){let t=I.getProperty(e,"lists"),r=[],n=0;for(;n<t.length;){let i=t[n];++n;let o=I.getProperty(i,"items"),a=[],f=0;for(;f<o.length;){let c=o[f];++f,a.push(new ae(c))}let h=new ee({limit:I.getProperty(i,"limit"),list_key:I.getProperty(i,"list_key"),list_name:I.getProperty(i,"list_name"),list_size:I.getProperty(i,"list_size"),items:a});r.push(h)}return new ke(I.getProperty(e,"device_id"),I.getProperty(e,"request_id"),I.getProperty(e,"user_group"),I.getProperty(e,"user_id"),r)}static get __name__(){return"internal._RecommendationsInternal"}static get __interfaces__(){return[z]}get __class__(){return ke}};Z.prototype.request_id=null;Z.prototype.user_group=null;Z.prototype.user_id=null;Z.prototype.device_id=null;Z.prototype._lists=null;var ee=s.global("$hxClasses")["internal._RecommendationsListInternal"]=class Me extends s.inherits(){[s.new](e){this.items=e.items,this.limit=e.limit,this.list_key=e.list_key,this.list_name=e.list_name,this.list_size=e.list_size}static get __name__(){return"internal._RecommendationsListInternal"}static get __interfaces__(){return[Q]}get __class__(){return Me}};ee.prototype.limit=null;ee.prototype.list_key=null;ee.prototype.list_name=null;ee.prototype.list_size=null;ee.prototype.items=null;var ae=s.global("$hxClasses")["internal._RecommendationItemInternal"]=class Je extends s.inherits(){[s.new](e){this._data={},this.Id=I.getProperty(e,"item_id"),this.RequestId=I.getProperty(e,"request_id"),this.UserGroup=I.getProperty(e,"user_group");let t=0,r=I.fields(e);for(;t<r.length;){let n=r[t];++t,this._data[n]=I.field(e,n)}}get(e){return this._data[e]}static get __name__(){return"internal._RecommendationItemInternal"}static get __interfaces__(){return[W]}get __class__(){return Je}};ae.prototype.Id=null;ae.prototype.RequestId=null;ae.prototype.UserGroup=null;ae.prototype._data=null;var q=s.global("$hxClasses")["internal._RecoBackendV2.RecoBackendV2_Fields_"]=class Se{static getRawRecommendations(e){return l.getRawRecommendations(e)}static setConsent(e){l.setConsent(e)}static setPageVisit(e){l.setPageVisit(e)}static setEnvironment(e){l.setEnvironment(e)}static setDeviceId(e){l.setDeviceId(e)}static setUserId(e){l.setUserId(e)}static setRequestDomain(e){l.setRequestDomain(e)}static setPageView(e){l.setPageView(e)}static getConsent(){Se.getConsent()}static getPageVisit(){l.getPageVisit()}static getEnvironment(){l.getEnvironment()}static getDeviceId(){l.getDeviceId()}static getUserId(){l.getUserId()}static getPageView(){l.getPageView()}static get __name__(){return"internal._RecoBackendV2.RecoBackendV2_Fields_"}get __class__(){return Se}},ts=q.getRawRecommendations,rs=q.setConsent,ss=q.setPageVisit,ns=q.setEnvironment,is=q.setDeviceId,ls=q.setUserId,os=q.setRequestDomain,as=q.setPageView,us=q.getConsent,cs=q.getPageVisit,_s=q.getEnvironment,gs=q.getDeviceId,ms=q.getUserId,ps=q.getPageView;var ys=s.$global,A=s.global("$hxClasses").FroomleSdk=class V{static register(){V.registered||V._env_set&&(!V._page_visit_set&&!V._page_view_set||(V.registered=!0))}static setEnvironment(e){l.setEnvironment(e),V._env_set=!0,V.register()}static setDeviceId(e){l.setDeviceId(e)}static setUserId(e){l.setUserId(e)}static setConsent(e){l.setConsent(e)}static setPageView(e){l.setPageView(e),V._page_view_set=!0,V.register()}static setPageVisit(e){l.setPageVisit(e),V._page_visit_set=!0,V.register()}static setRequestDomain(e){l.setRequestDomain(e)}static getRawRecommendations(e){return l.getRawRecommendations(e)}static getVersion(){return"0.0.7"}static get __name__(){return"FroomleSdk"}get __class__(){return V}};A._env_set=!1;A._page_visit_set=!1;A._page_view_set=!1;A.registered=!1;var xs=s.$global,te=s.global("$hxClasses")["internal.domHandler.FroomleDomTree"]=class fe extends s.inherits(){[s.new](){}createElement(e){return window.document.createElement(e)}querySelectorAll(e){let t=this.root,r=[],n=t.querySelectorAll(e),i=0,o=n.length;for(;i<o;){let a=i++;r.push(n.item(a))}return r}getRoot(){return this.root}toString(){return this.root.outerHTML}static run(){}static fromHtml(e){return new fe}static fromDocument(){let e=new fe;return e.root=window.document,e}static get __name__(){return"internal.domHandler.FroomleDomTree"}get __class__(){return fe}};te.prototype.root=null;var Is=s.$global,L=s.global("$hxClasses")["internal._ADomNode.ADomNode"]=class Pe{static _new(e){return e}static fromElement(e){return e}static create(e,t){return window.document.createElement(t)}static replaceChild(e,t,r){e.replaceChild(t,r)}static get attributes(){return this.get_attributes()}static get_attributes(e){let t=e,r=[],n=0,i=t.attributes.length;for(;n<i;){let o=n++,a=t.attributes.item(o);r.push({name:a.name,value:a.value})}return r}static addChild(e,t){e.appendChild(t)}static removeChild(e,t){e.removeChild(t)}static getAttribute(e,t){return e.getAttribute(t)}static setAttribute(e,t,r){e.setAttribute(t,r)}static getText(e){return e.textContent}static setText(e,t){e.textContent=t}static get children(){return this.get_children()}static get_children(e){let t=[],n=e.children,i=0,o=n.length;for(;i<o;){let a=i++;t.push(n[a])}return t}static querySelectorAll(e,t){let r=e,n=[],i=r.querySelectorAll(t),o=0,a=i.length;for(;o<a;){let f=o++;n.push(i.item(f))}return n}static getFilterKeyValue(e){let t=0,r=Pe.get_attributes(e);for(;t<r.length;){let n=r[t];if(++t,n.name.startsWith("data-froomle-reco-filter-"))return{key:n.name.substring(25),value:n.value}}return{key:null,value:null}}static get __name__(){return"internal._ADomNode.ADomNode_Impl_"}get __class__(){return Pe}};var Os=s.$global,ue=s.global("$hxClasses")["internal.domHandler.DomDomDom"]=class K extends s.inherits(){[s.new](){}static _fillRecoTargets(e){let t=new j;if(e==null)return t.trigger(!1),t;let r=[],n=e,i=[],o=n.querySelectorAll("*"),a=0,f=o.length;for(;a<f;){let d=a++;i.push(o.item(d))}let h=i,c=0;for(;c<h.length;){let d=h[c];++c;let D=0,R=L.get_attributes(d);for(;D<R.length;){let M=R[D];++D,M.name=="data-froomle-reco"&&r.push(d)}}let _=[],m=0;for(;m<r.length;){let d=r[m];++m,d.getAttribute("data-froomle-request-id")==null&&(d.getAttribute("data-froomle-id")==null||d.getAttribute("data-froomle-id")=="")&&_.push(d)}if(_.length<1)return new j;let E=[],g=[],p="",v="",b="",w=[],C=function(){let d={list_name:p,list_size:w.length,limit:w.length};v!=null&&I.setProperty(d,v,b),E.push(d),g.push(w)},O=function(d,D,R,M){p=d,v=D,b=R,w=[M]},x=0;for(;x<_.length;){let d=_[x];++x;let D=d.getAttribute("data-froomle-reco"),R=L.getFilterKeyValue(d);if(p==""){O(D,R.key,R.value,d);continue}else if(D==p&&R.key==v&&R.value==b){w.push(d);continue}else{C(),O(D,R.key,R.value,d);continue}}return p!=""&&C(),q.getRawRecommendations(E).then(function(d){let D=0,R=d.lists();for(;D<R.length;){let M=R[D],N=D++,U=M,X=U.items.length!=g[N].length,se=0,ye=U.items;for(;se<ye.length;){let be=ye[se],Ye=se++,Ze=be;K._fillParameters(g[N][Ye],Ze,d.request_id)}}t.trigger(!0)}),t}static _fillParameters(e,t,r){let n=function(m,E,g,p){p==null&&(p="");let v=function(b,w,C){C==null&&(C="fgh");try{w=new oe("\\\\[(\\\\w+)\\\\]","g").map(w,function(R){return"."+R.matched(1)}),w=J.replace(w,"[","."),w=J.replace(w,"]",""),B.cca(w,0)==46&&(w=B.substr(w,1,null));let x=w.split("."),P=b.get(x[0]),d=1,D=x.length;for(;d<D;){let R=d++;if(P==null)return null;P instanceof Array&&$.parseInt(x[R])!=null?P=P[$.parseInt(x[R])]:P=I.field(P,x[R])}return P}catch{return C}};try{let b=v(t,g,p);E=="inner"?m.textContent=b:m.setAttribute(E,b)}catch{}};e.setAttribute("data-froomle-id",t.Id),e.setAttribute("data-froomle-request-id",r);let i=e,o=[],a=i.querySelectorAll("*"),f=0,h=a.length;for(;f<h;){let m=f++;o.push(a.item(m))}let c=o,_=0;for(;_<c.length;){let m=c[_];++_;let E=0,g=L.get_attributes(m);for(;E<g.length;){let p=g[E];if(++E,p.name.startsWith("data-froomle-param-")){let v=J.replace(p.name,"data-froomle-param-",""),b=p.value;n(m,v,b)}}}}static _orderElements(e){let t=function(g,p,v){let b=[],w=L.get_children(g),C=0;for(;C<w.length;){let P=w[C];if(++C,P.getAttribute("data-froomle-ordervalue")!=null){b.push(P);let D=L.create(e,"span");D.setAttribute("data-froomle-tmp-node",""),L.replaceChild(g,D,P)}}let O=[],x=0;for(;x<b.length;){let P=b[x];++x,O.push(P.getAttribute("data-froomle-ordervalue"))}return{el:g,key:p,values:O,orderChildren:b,list_name:v}},r=new j,n=e.getRoot(),i=[],o=n.querySelectorAll("*"),a=0,f=o.length;for(;a<f;){let g=a++;i.push(o.item(g))}let h=i,c=[],_=0;for(;_<h.length;){let g=h[_];++_;let p=0,v=L.get_attributes(g);for(;p<v.length;){let b=v[p];++p,b.name.startsWith("data-froomle-order-")&&c.push(t(g,b.name.substring(19),b.value))}}if(c.length<1)return r.trigger(!1),r;let m=[],E=0;for(;E<c.length;){let g=c[E];++E;let p={list_name:g.list_name,limit:g.values.length,list_size:g.values.length},v={};I.setProperty(v,g.key,g.values),I.setProperty(p,"order",v),m.push(p)}return q.getRawRecommendations(m).then(function(g){let p=0,v=g.lists();for(;p<v.length;){let b=v[p],C=p++,O=b,x=c[C];x.el.setAttribute("data-froomle-request-id",g.request_id);let P=[],d=0,D=O.items;for(;d<D.length;){let ge=D[d];++d;let N=ge.get(x.key),U=0,X=x.values;for(;U<X.length;){let se=X[U],be=U++;if(N==se){P.push(x.orderChildren[be]);break}}}let R=0,M=P.length;for(;R<M;){let ge=R++,N=0,U=L.get_children(x.el);for(;N<U.length;){let X=U[N];if(++N,X.getAttribute("data-froomle-tmp-node")==""){L.replaceChild(x.el,P[ge],X);break}}}}r.trigger(!0)}),r}static domInit(e){K._orderElements(e).then(function(t){K._fillRecoTargets(e.getRoot())})}static fillElementRecos(e){K._fillRecoTargets(e)}static runFromHtml(e){let t=te.fromHtml(e);return K.domInit(t),t.toString()}static get __name__(){return"internal.domHandler.DomDomDom"}get __class__(){return K}};var Hs=s.$global;var S=class S{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e=[];for(let t of S.impressionQueue){let r={event_type:"impression",page_type:l.getPageVisit(),action_item:t.getAttribute("data-froomle-id"),action_item_type:"article",channel:"www-desktop"};l.getUserId()?r.user_id=l.getUserId():r.device_id=l.getDeviceId();let n=t.getAttribute("data-froomle-reco");if(n){r.list_name=n;let i=t.getAttribute("data-froomle-request-id");if(!i)throw console.error("element need reco but doesnt have request id registered yet"),new Error("element need reco but doesnt have request id registered");r.request_id=i}}return S.impressionQueue=[],JSON.stringify({events:e})}static sendImpressions(){S.impressionQueue.length!==0&&fetch(S.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:S.generateBody()})}static getViewPortRect(){let e=window.innerWidth||document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{left:0,top:0,x:0,y:0,toJSON(){},right:e,bottom:t,width:e,height:t}}static intersectsWithViewPortRect(e){let t=e.getBoundingClientRect(),r=S.getViewPortRect();return t.right>r.left&&t.left<r.right&&t.bottom>r.top&&t.top<r.bottom}static addIntersectionImpressionListener(e){S.observer.observe(e)}static processDocument(){if(l.getDeviceId()!="no-consent"){for(let e of document.querySelectorAll("[data-froomle-id]"))S.intersectsWithViewPortRect(e)?S.impressionQueue.push(e):S.addIntersectionImpressionListener(e);S.sendImpressions()}}};S.impressionQueue=[],S.observer=new IntersectionObserver((e,t)=>{e.forEach(r=>{r.isIntersecting&&(S.impressionQueue.push(r.target),S.observer.unobserve(r.target))}),S.impressionQueue.length>0&&S.sendImpressions()});var re=S;var ce=class u{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e={event_type:"page_visit",page_type:l.getPageVisit(),channel:"www-desktop"};return l.getUserId()?e.user_id=l.getUserId():e.device_id=l.getDeviceId(),JSON.stringify(e)}static sendPageVisit(){l.getPageVisit()&&l.getDeviceId()!="no-consent"&&fetch(u.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:u.generateBody()})}};var _e=class u{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e={event_type:"detail_pageview",page_type:"article_detail",action_item:l.getPageView(),action_item_type:"article",channel:"www-desktop"};return l.getUserId()?e.user_id=l.getUserId():e.device_id=l.getDeviceId(),JSON.stringify(e)}static sendPageView(){l.getPageView()&&l.getDeviceId()!="no-consent"&&fetch(u.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:u.generateBody()})}};var Ke=A.setEnvironment,Xe=A.setPageVisit,at=A.setConsent,ze=A.setUserId,Qe=A.setDeviceId,We=A.setRequestDomain,ut=A.setPageView;if(typeof document!="undefined"){let u=document.currentScript;if(u){let e=u.getAttribute("data-froomle-device-id"),t=u.getAttribute("data-froomle-user-id"),r=u.getAttribute("data-froomle-env"),n=u.getAttribute("data-froomle-page-visit"),i=u.getAttribute("data-froomle-request-domain"),o=u.getAttribute("data-froomle-page-view");Ke(r),o&&ut(o),n&&Xe(n),e&&Qe(e),t&&ze(t),i&&We(i)}else console.error("Froomle SDK: could not find the script tag where the sdk is included.");document.addEventListener("DOMContentLoaded",()=>{ue.domInit(te.fromDocument()),re.processDocument(),ce.sendPageVisit(),_e.sendPageView(),new MutationObserver(t=>{for(let r of t)if(r.type==="childList"&&re.processElement(r.target),r.type==="attributes")if(r.attributeName==="data-froomle-reco"){let n=r.target.getAttribute("data-froomle-request-id");(!n||n==="")&&ue.fillElementRecos(r.target)}else r.attributeName==="data-froomle-request-id"&&ue.fillElementRecos(r.target)}).observe(document,{childList:!0,subtree:!0})})}
4
+ `+t+"}",i;break;case"string":return e;default:return String(e)}}static get __name__(){return"js.Boot"}get __class__(){return ie}};Ee.__toStr={}.toString;var tr=s.$global,$=s.global("$hxClasses").Std=class Ve{static string(e){return Ee.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}static get __name__(){return"Std"}get __class__(){return Ve}};String.__name__=!0,Array.__name__=!0;var ir=s.$global,de=s.global("$hxClasses")["genes.util.EsMap"]=class le extends s.inherits(){[s.new](){this.inst=new Map}set(e,t){this.inst.set(e,t)}get(e){return this.inst.get(e)}remove(e){return this.inst.delete(e)}exists(e){return this.inst.has(e)}keys(){return le.adaptIterator(this.inst.keys())}iterator(){return le.adaptIterator(this.inst.values())}toString(){let e=[],t=le.adaptIterator(this.inst.keys());for(;t.hasNext();){let r=t.next();e.push(""+$.string(r)+" => "+$.string(this.inst.get(r)))}return"{"+e.join(", ")+"}"}clear(){this.inst.clear()}static adaptIterator(e){let t,r,n=function(){let i=e.next();t=i.value,r=i.done};return{hasNext:function(){return r==null&&n(),!r},next:function(){r==null&&n();let i=t;return n(),i}}}static get __name__(){return"genes.util.EsMap"}get __class__(){return le}};de.prototype.inst=null;var gr=s.$global,Ae=s.global("$hxClasses")["haxe.ds.StringMap"]=class De extends s.inherits(de){[s.new](){super[s.new]()}copy(){let e=new De;return e.inst=new Map(this.inst),e}keyValueIterator(){return new pe(this)}static get __name__(){return"haxe.ds.StringMap"}static get __interfaces__(){return[Ie]}static get __super__(){return de}get __class__(){return De}};var pr=s.$global,B=s.global("$hxClasses").HxOverrides=class Oe{static cca(e,t){let r=e.charCodeAt(t);if(r==r)return r}static substr(e,t,r){if(r==null)r=e.length;else if(r<0)if(t==0)r=e.length+r;else return"";return e.substr(t,r)}static now(){return Date.now()}static get __name__(){return"HxOverrides"}get __class__(){return Oe}};typeof performance!="undefined"&&typeof performance.now=="function"&&(B.now=performance.now.bind(performance));var yr=s.$global,J=s.global("$hxClasses").StringTools=class he{static isSpace(e,t){let r=B.cca(e,t);return r>8&&r<14?!0:r==32}static ltrim(e){let t=e.length,r=0;for(;r<t&&he.isSpace(e,r);)++r;return r>0?B.substr(e,r,t-r):e}static rtrim(e){let t=e.length,r=0;for(;r<t&&he.isSpace(e,t-r-1);)++r;return r>0?B.substr(e,0,t-r):e}static replace(e,t,r){return e.split(t).join(r)}static get __name__(){return"StringTools"}get __class__(){return he}};var xr=s.$global,Fe=s.global("$hxClasses").Lambda=class Te{static exists(e,t){let r=s.getIterator(e);for(;r.hasNext();){let n=r.next();if(t(n))return!0}return!1}static get __name__(){return"Lambda"}get __class__(){return Te}};var kr=s.$global,oe=s.global("$hxClasses").EReg=class He extends s.inherits(){[s.new](e,t){this.r=new RegExp(e,t.split("u").join(""))}match(e){return this.r.global&&(this.r.lastIndex=0),this.r.m=this.r.exec(e),this.r.s=e,this.r.m!=null}matched(e){if(this.r.m!=null&&e>=0&&e<this.r.m.length)return this.r.m[e];throw k.thrown("EReg::matched")}matchedPos(){if(this.r.m==null)throw k.thrown("No string matched");return{pos:this.r.m.index,len:this.r.m[0].length}}matchSub(e,t,r){if(r==null&&(r=-1),this.r.global){this.r.lastIndex=t,this.r.m=this.r.exec(r<0?e:B.substr(e,0,t+r));let n=this.r.m!=null;return n&&(this.r.s=e),n}else{let n=this.match(r<0?B.substr(e,t,null):B.substr(e,t,r));return n&&(this.r.s=e,this.r.m.index+=t),n}}map(e,t){let r=0,n="";do{if(r>=e.length)break;if(!this.matchSub(e,r)){n+=$.string(B.substr(e,r,null));break}let i=this.matchedPos();n+=$.string(B.substr(e,r,i.pos-r)),n+=$.string(t(this)),i.len==0?(n+=$.string(B.substr(e,i.pos,1)),r=i.pos+1):r=i.pos+i.len}while(this.r.global);return!this.r.global&&r>0&&r<e.length&&(n+=$.string(B.substr(e,r,null))),n}static get __name__(){return"EReg"}get __class__(){return He}};oe.prototype.r=null;var Hr=s.$global,Y=s.global("$hxClasses")["haxe.http.HttpJs"]=class Le extends s.inherits(T){[s.new](e){this.async=!0,this.withCredentials=!1,super[s.new](e)}request(e){this.responseAsString=null,this.responseBytes=null,this.responseHeaders=null;let t=this.req=ve.createXMLHttpRequest(),r=this,n=function(c){if(t.readyState!=4)return;let g;try{g=t.status}catch{g=null}if(g==0&&ve.get_supported()&&s.$global.location!=null){let m=s.$global.location.protocol.toLowerCase();new oe("^(?:about|app|app-storage|.+-extension|file|res|widget):$","").match(m)&&(g=t.response!=null?200:404)}if(g==null&&(g=null),g!=null&&r.onStatus(g),g!=null&&g>=200&&g<400){r.req=null;let m=t.getAllResponseHeaders().split(`\r
5
+ `),E=[],_=0,p=m;for(;_<p.length;){let w=p[_];++_,w!=""&&E.push(w)}m=E;let v=new Ae;r.responseHeaders=v;let b=0;for(;b<m.length;){let w=m[b];++b;let q=w.split(": "),O=q.shift(),x=q.length==1?q[0]:q.join(": ");x=J.ltrim(J.rtrim(x)),r.responseHeaders.inst.set(O,x)}r.success(G.ofData(t.response))}else if(g==null||g==0&&t.response==null)r.req=null,r.onError("Failed to connect or resolve host");else if(g==null){r.req=null;let m=t.response!=null?G.ofData(t.response):null;r.responseBytes=m,r.onError("Http Error #"+t.status)}else switch(g){case 12007:r.req=null,r.onError("Unknown host");break;case 12029:r.req=null,r.onError("Failed to connect to host");break;default:r.req=null;let m=t.response!=null?G.ofData(t.response):null;r.responseBytes=m,r.onError("Http Error #"+t.status)}};this.async&&(t.onreadystatechange=n);let i,o=this.postData,a=this.postBytes;if(o==null)if(a==null)i=null;else{let c=a;i=new Blob([c.b.bufferValue])}else a==null?i=o:i=null;if(i!=null)e=!0;else{let c=0,g=this.params;for(;c<g.length;){let m=g[c];++c,i==null?i="":i=(i==null?"null":$.string(i))+"&";let E=m.name,_=(i==null?"null":$.string(i))+encodeURIComponent(E)+"=",p=m.value;i=_+encodeURIComponent(p)}}try{if(e)t.open("POST",this.url,this.async);else if(i!=null){let c=this.url.split("?").length<=1;t.open("GET",this.url+(c?"?":"&")+(i==null?"null":$.string(i)),this.async),i=null}else t.open("GET",this.url,this.async);t.responseType="arraybuffer"}catch(c){let g=k.caught(c).unwrap();this.req=null,this.onError(g.toString());return}t.withCredentials=this.withCredentials,!Fe.exists(this.headers,function(c){return c.name=="Content-Type"})&&e&&this.postData==null&&t.setRequestHeader("Content-Type","application/x-www-form-urlencoded");let y=0,d=this.headers;for(;y<d.length;){let c=d[y];++y,t.setRequestHeader(c.name,c.value)}t.send(i),this.async||n(null)}static get __name__(){return"haxe.http.HttpJs"}static get __super__(){return T}get __class__(){return Le}};Y.prototype.async=null;Y.prototype.withCredentials=null;Y.prototype.responseHeaders=null;Y.prototype.req=null;var jr=s.$global,j=s.global("$hxClasses").SimpleFuture=class Ue extends s.inherits(){[s.new](){this._isFinished=!1}trigger(e){this._result=e,this._isFinished=!0,this._callback!=null&&this._callback(this._result)}then(e){this._callback=e,this._isFinished&&e(this._result)}static get __name__(){return"SimpleFuture"}get __class__(){return Ue}};j.prototype._callback=null;j.prototype._result=null;j.prototype._isFinished=null;var Jr=s.$global,I=s.global("$hxClasses").Reflect=class je{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let r;if(e==null)return null;{let n;return e.__properties__?(r=e.__properties__["get_"+t],n=r):n=!1,n?e[r]():e[t]}}static setProperty(e,t,r){let n,i;e.__properties__?(n=e.__properties__["set_"+t],i=n):i=!1,i?e[n](r):e[t]=r}static fields(e){let t=[];if(e!=null){let n=Object.prototype.hasOwnProperty;for(var r in e)r!="__id__"&&r!="hx__closures__"&&n.call(e,r)&&t.push(r)}return t}static get __name__(){return"Reflect"}get __class__(){return je}};var es=s.$global,l=s.global("$hxClasses")["internal.RecoBackendV2"]=class f extends s.inherits(){[s.new](){}static _requestUri(){return"https://"+f._req_domain+"/api/"+f._environment+"/recommendations/requests"}static noConsentBody(){return{device_id:"no-consent",user_group:"no-consent",version:"no-consent"}}static buildRequestBody(e){let t={lists:e,page_type:f._page_visit!=null?f._page_visit:f._page_view,channel:"www-desktop"};if(f._consent==0){let r=f.noConsentBody(),n=0,i=I.fields(r);for(;n<i.length;){let o=i[n];++n,t[o]=I.field(r,o)}}else f._user_id!=null?t.user_id=f._user_id:t.device_id=f._device_id;return t}static _requestRecos(e){let t=new j,r=null,n=new Y(f._requestUri());n.setHeader("Content-Type","application/json"),n.setPostData(JSON.stringify(f.buildRequestBody(e))),n.onError=function(a){throw k.thrown("HTTP Request Error: "+a)},n.onStatus=function(a){if(a<200||a>=300)throw k.thrown("HTTP Status Error: "+a)};try{n.request(!1)}catch(a){let y=k.caught(a).unwrap();throw k.thrown("Failed to execute synchronous request: "+$.string(y))}let i=function(a){let y=JSON.parse(a),d=Z.fromRequestData(y);t.trigger(d)},o=n.get_responseData();return o!=null?i(o):n.onData=i,t}static getRawRecommendations(e){return f._requestRecos(e)}static setConsent(e){e>2&&(e=2),f._consent=e}static setChannel(e){f._channel=e}static setPageVisit(e){f._page_visit=e}static setEnvironment(e){f._environment=e}static setDeviceId(e){f._device_id=e}static setUserId(e){f._user_id=e}static setRequestDomain(e){f._req_domain=e}static setPageView(e){f._page_view=e}static getRequestDomain(){return f._req_domain}static getEnvironment(){return f._environment}static getPageVisit(){return f._page_visit}static getUserId(){return f._user_id}static getDeviceId(){return f._device_id}static getPageView(){return f._page_view}static getConsent(){return f._consent}static getChannel(){return f._channel}static get __name__(){return"internal.RecoBackendV2"}get __class__(){return f}};l._environment=null;l._device_id="no-consent";l._user_id=null;l._consent=0;l._req_domain="europe-west1.froomle.com";l._page_visit=null;l._page_view=null;l._channel="www-desktop";var lt=function(){};lt.__isInterface__=!0;var ot=function(){};ot.__isInterface__=!0;var Z=s.global("$hxClasses")["internal._RecommendationsInternal"]=class ke extends s.inherits(){[s.new](e,t,r,n,i){this.request_id=t,this.user_group=r,this.device_id=e,this.user_id=n,this._lists=i}items(){let e=[],t=0,r=this._lists;for(;t<r.length;){let n=r[t];++t;let i=0,o=n.items;for(;i<o.length;){let a=o[i];++i,e.push(a)}}return e}lists(){return this._lists}getItemsByListName(e){let t=0,r=this._lists;for(;t<r.length;){let n=r[t];if(++t,n.list_name==e)return n}return null}static fromRequestData(e){let t=I.getProperty(e,"lists"),r=[],n=0;for(;n<t.length;){let i=t[n];++n;let o=I.getProperty(i,"items"),a=[],y=0;for(;y<o.length;){let c=o[y];++y,a.push(new ae(c))}let d=new ee({limit:I.getProperty(i,"limit"),list_key:I.getProperty(i,"list_key"),list_name:I.getProperty(i,"list_name"),list_size:I.getProperty(i,"list_size"),items:a});r.push(d)}return new ke(I.getProperty(e,"device_id"),I.getProperty(e,"request_id"),I.getProperty(e,"user_group"),I.getProperty(e,"user_id"),r)}static get __name__(){return"internal._RecommendationsInternal"}static get __interfaces__(){return[z]}get __class__(){return ke}};Z.prototype.request_id=null;Z.prototype.user_group=null;Z.prototype.user_id=null;Z.prototype.device_id=null;Z.prototype._lists=null;var ee=s.global("$hxClasses")["internal._RecommendationsListInternal"]=class Ne extends s.inherits(){[s.new](e){this.items=e.items,this.limit=e.limit,this.list_key=e.list_key,this.list_name=e.list_name,this.list_size=e.list_size}static get __name__(){return"internal._RecommendationsListInternal"}static get __interfaces__(){return[Q]}get __class__(){return Ne}};ee.prototype.limit=null;ee.prototype.list_key=null;ee.prototype.list_name=null;ee.prototype.list_size=null;ee.prototype.items=null;var ae=s.global("$hxClasses")["internal._RecommendationItemInternal"]=class Me extends s.inherits(){[s.new](e){this._data={},this.Id=I.getProperty(e,"item_id"),this.RequestId=I.getProperty(e,"request_id"),this.UserGroup=I.getProperty(e,"user_group");let t=0,r=I.fields(e);for(;t<r.length;){let n=r[t];++t,this._data[n]=I.field(e,n)}}get(e){return this._data[e]}static get __name__(){return"internal._RecommendationItemInternal"}static get __interfaces__(){return[W]}get __class__(){return Me}};ae.prototype.Id=null;ae.prototype.RequestId=null;ae.prototype.UserGroup=null;ae.prototype._data=null;var C=s.global("$hxClasses")["internal._RecoBackendV2.RecoBackendV2_Fields_"]=class Je{static getRawRecommendations(e){return l.getRawRecommendations(e)}static setConsent(e){l.setConsent(e)}static setPageVisit(e){l.setPageVisit(e)}static setEnvironment(e){l.setEnvironment(e)}static setDeviceId(e){l.setDeviceId(e)}static setUserId(e){l.setUserId(e)}static setRequestDomain(e){l.setRequestDomain(e)}static setPageView(e){l.setPageView(e)}static setChannel(e){l.setChannel(e)}static getRequestDomain(){l.getRequestDomain()}static getConsent(){l.getConsent()}static getPageVisit(){l.getPageVisit()}static getEnvironment(){l.getEnvironment()}static getDeviceId(){l.getDeviceId()}static getUserId(){l.getUserId()}static getPageView(){l.getPageView()}static getChannel(){l.getChannel()}static get __name__(){return"internal._RecoBackendV2.RecoBackendV2_Fields_"}get __class__(){return Je}},ts=C.getRawRecommendations,rs=C.setConsent,ss=C.setPageVisit,ns=C.setEnvironment,is=C.setDeviceId,ls=C.setUserId,os=C.setRequestDomain,as=C.setPageView,us=C.setChannel,cs=C.getRequestDomain,gs=C.getConsent,_s=C.getPageVisit,ms=C.getEnvironment,ps=C.getDeviceId,ds=C.getUserId,hs=C.getPageView,fs=C.getChannel;var xs=s.$global,A=s.global("$hxClasses").FroomleSdk=class V{static register(){V.registered||V._env_set&&(!V._page_visit_set&&!V._page_view_set||(V.registered=!0))}static buildScriptTag(){let e='<script src="https://cdn.froomle.com/reco-backend-v2/0.0.9/reco-backend-v2.min.js" data-froomle-env="'+l.getEnvironment()+'" ';return l.getPageVisit()!=null&&(e+='data-froomle-page-visit="'+l.getPageVisit()+'" '),l.getPageView()!=null&&(e+='data-froomle-page-view="'+l.getPageView()+'" '),l.getDeviceId()!=null&&(e+='data-froomle-device-id="'+l.getDeviceId()+'" '),l.getUserId()!=null&&(e+='data-froomle-user-id="'+l.getUserId()+'" '),l.getConsent()>0&&(e+='data-froomle-consent="'+l.getConsent()+'" '),l.getRequestDomain()!=null&&(e+='data-froomle-request-domain="'+l.getRequestDomain()+'" '),e+="><\/script>",e}static setEnvironment(e){l.setEnvironment(e),V._env_set=!0,V.register()}static setDeviceId(e){l.setDeviceId(e)}static setUserId(e){l.setUserId(e)}static setConsent(e){l.setConsent(e)}static setPageView(e){l.setPageView(e),V._page_view_set=!0,V.register()}static setPageVisit(e){l.setPageVisit(e),V._page_visit_set=!0,V.register()}static setRequestDomain(e){l.setRequestDomain(e)}static getRawRecommendations(e){return l.getRawRecommendations(e)}static getVersion(){return"0.0.9"}static get __name__(){return"FroomleSdk"}get __class__(){return V}};A._env_set=!1;A._page_visit_set=!1;A._page_view_set=!1;A.registered=!1;var Is=s.$global,te=s.global("$hxClasses")["internal.domHandler.FroomleDomTree"]=class fe extends s.inherits(){[s.new](){}createElement(e){return window.document.createElement(e)}querySelectorAll(e){let t=this.root,r=[],n=t.querySelectorAll(e),i=0,o=n.length;for(;i<o;){let a=i++;r.push(n.item(a))}return r}getRoot(){return this.root}toString(){return this.root.outerHTML}static run(){}static fromHtml(e){return new fe}static fromDocument(){let e=new fe;return e.root=window.document,e}static get __name__(){return"internal.domHandler.FroomleDomTree"}get __class__(){return fe}};te.prototype.root=null;var ks=s.$global,L=s.global("$hxClasses")["internal._ADomNode.ADomNode"]=class Ce{static _new(e){return e}static fromElement(e){return e}static create(e,t){return window.document.createElement(t)}static replaceChild(e,t,r){e.replaceChild(t,r)}static get attributes(){return this.get_attributes()}static get_attributes(e){let t=e,r=[],n=0,i=t.attributes.length;for(;n<i;){let o=n++,a=t.attributes.item(o);r.push({name:a.name,value:a.value})}return r}static addChild(e,t){e.appendChild(t)}static removeChild(e,t){e.removeChild(t)}static getAttribute(e,t){return e.getAttribute(t)}static setAttribute(e,t,r){e.setAttribute(t,r)}static getText(e){return e.textContent}static setText(e,t){e.textContent=t}static get children(){return this.get_children()}static get_children(e){let t=[],n=e.children,i=0,o=n.length;for(;i<o;){let a=i++;t.push(n[a])}return t}static querySelectorAll(e,t){let r=e,n=[],i=r.querySelectorAll(t),o=0,a=i.length;for(;o<a;){let y=o++;n.push(i.item(y))}return n}static getFilterKeyValue(e){let t=0,r=Ce.get_attributes(e);for(;t<r.length;){let n=r[t];if(++t,n.name.startsWith("data-froomle-reco-filter-"))return{key:n.name.substring(25),value:n.value}}return{key:null,value:null}}static get __name__(){return"internal._ADomNode.ADomNode_Impl_"}get __class__(){return Ce}};var Hs=s.$global,ue=s.global("$hxClasses")["internal.domHandler.DomDomDom"]=class K extends s.inherits(){[s.new](){}static _fillRecoTargets(e){let t=new j;if(e==null)return t.trigger(!1),t;let r=[],n=e,i=[],o=n.querySelectorAll("*"),a=0,y=o.length;for(;a<y;){let h=a++;i.push(o.item(h))}let d=i,c=0;for(;c<d.length;){let h=d[c];++c;let D=0,R=L.get_attributes(h);for(;D<R.length;){let M=R[D];++D,M.name=="data-froomle-reco"&&r.push(h)}}let g=[],m=0;for(;m<r.length;){let h=r[m];++m,h.getAttribute("data-froomle-request-id")==null&&(h.getAttribute("data-froomle-id")==null||h.getAttribute("data-froomle-id")=="")&&g.push(h)}if(g.length<1)return new j;let E=[],_=[],p="",v="",b="",w=[],q=function(){let h={list_name:p,list_size:w.length,limit:w.length};v!=null&&I.setProperty(h,v,b),E.push(h),_.push(w)},O=function(h,D,R,M){p=h,v=D,b=R,w=[M]},x=0;for(;x<g.length;){let h=g[x];++x;let D=h.getAttribute("data-froomle-reco"),R=L.getFilterKeyValue(h);if(p==""){O(D,R.key,R.value,h);continue}else if(D==p&&R.key==v&&R.value==b){w.push(h);continue}else{q(),O(D,R.key,R.value,h);continue}}return p!=""&&q(),C.getRawRecommendations(E).then(function(h){let D=0,R=h.lists();for(;D<R.length;){let M=R[D],N=D++,U=M,X=U.items.length!=_[N].length,se=0,ye=U.items;for(;se<ye.length;){let be=ye[se],Ye=se++,Ze=be;K._fillParameters(_[N][Ye],Ze,h.request_id)}}t.trigger(!0)}),t}static _fillParameters(e,t,r){let n=function(m,E,_,p){p==null&&(p="");let v=function(b,w,q){q==null&&(q="fgh");try{w=new oe("\\\\[(\\\\w+)\\\\]","g").map(w,function(R){return"."+R.matched(1)}),w=J.replace(w,"[","."),w=J.replace(w,"]",""),B.cca(w,0)==46&&(w=B.substr(w,1,null));let x=w.split("."),S=b.get(x[0]),h=1,D=x.length;for(;h<D;){let R=h++;if(S==null)return null;S instanceof Array&&$.parseInt(x[R])!=null?S=S[$.parseInt(x[R])]:S=I.field(S,x[R])}return S}catch{return q}};try{let b=v(t,_,p);E=="inner"?m.textContent=b:m.setAttribute(E,b)}catch{}};e.setAttribute("data-froomle-id",t.Id),e.setAttribute("data-froomle-request-id",r);let i=e,o=[],a=i.querySelectorAll("*"),y=0,d=a.length;for(;y<d;){let m=y++;o.push(a.item(m))}let c=o,g=0;for(;g<c.length;){let m=c[g];++g;let E=0,_=L.get_attributes(m);for(;E<_.length;){let p=_[E];if(++E,p.name.startsWith("data-froomle-param-")){let v=J.replace(p.name,"data-froomle-param-",""),b=p.value;n(m,v,b)}}}}static _orderElements(e){let t=function(_,p,v){let b=[],w=L.get_children(_),q=0;for(;q<w.length;){let S=w[q];if(++q,S.getAttribute("data-froomle-ordervalue")!=null){b.push(S);let D=L.create(e,"span");D.setAttribute("data-froomle-tmp-node",""),L.replaceChild(_,D,S)}}let O=[],x=0;for(;x<b.length;){let S=b[x];++x,O.push(S.getAttribute("data-froomle-ordervalue"))}return{el:_,key:p,values:O,orderChildren:b,list_name:v}},r=new j,n=e.getRoot(),i=[],o=n.querySelectorAll("*"),a=0,y=o.length;for(;a<y;){let _=a++;i.push(o.item(_))}let d=i,c=[],g=0;for(;g<d.length;){let _=d[g];++g;let p=0,v=L.get_attributes(_);for(;p<v.length;){let b=v[p];++p,b.name.startsWith("data-froomle-order-")&&c.push(t(_,b.name.substring(19),b.value))}}if(c.length<1)return r.trigger(!1),r;let m=[],E=0;for(;E<c.length;){let _=c[E];++E;let p={list_name:_.list_name,limit:_.values.length,list_size:_.values.length},v={};I.setProperty(v,_.key,_.values),I.setProperty(p,"order",v),m.push(p)}return C.getRawRecommendations(m).then(function(_){let p=0,v=_.lists();for(;p<v.length;){let b=v[p],q=p++,O=b,x=c[q];x.el.setAttribute("data-froomle-request-id",_.request_id);let S=[],h=0,D=O.items;for(;h<D.length;){let _e=D[h];++h;let N=_e.get(x.key),U=0,X=x.values;for(;U<X.length;){let se=X[U],be=U++;if(N==se){S.push(x.orderChildren[be]);break}}}let R=0,M=S.length;for(;R<M;){let _e=R++,N=0,U=L.get_children(x.el);for(;N<U.length;){let X=U[N];if(++N,X.getAttribute("data-froomle-tmp-node")==""){L.replaceChild(x.el,S[_e],X);break}}}}r.trigger(!0)}),r}static domInit(e){K._orderElements(e).then(function(t){K._fillRecoTargets(e.getRoot())})}static fillElementRecos(e){K._fillRecoTargets(e)}static runFromHtml(e){if(e=="")return"";let t=te.fromHtml(e);return K.domInit(t),t.toString()}static get __name__(){return"internal.domHandler.DomDomDom"}get __class__(){return K}};var js=s.$global;var P=class P{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e=[];for(let t of P.impressionQueue){let r={event_type:"impression",page_type:l.getPageVisit(),action_item:t.getAttribute("data-froomle-id"),action_item_type:"article",channel:"www-desktop"};l.getUserId()?r.user_id=l.getUserId():r.device_id=l.getDeviceId();let n=t.getAttribute("data-froomle-reco");if(n){r.list_name=n;let i=t.getAttribute("data-froomle-request-id");if(!i)throw console.error("element need reco but doesnt have request id registered yet"),new Error("element need reco but doesnt have request id registered");r.request_id=i}}return P.impressionQueue=[],JSON.stringify({events:e})}static sendImpressions(){P.impressionQueue.length!==0&&fetch(P.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:P.generateBody()})}static getViewPortRect(){let e=window.innerWidth||document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{left:0,top:0,x:0,y:0,toJSON(){},right:e,bottom:t,width:e,height:t}}static intersectsWithViewPortRect(e){let t=e.getBoundingClientRect(),r=P.getViewPortRect();return t.right>r.left&&t.left<r.right&&t.bottom>r.top&&t.top<r.bottom}static addIntersectionImpressionListener(e){P.observer.observe(e)}static processDocument(){if(l.getDeviceId()!="no-consent"){for(let e of document.querySelectorAll("[data-froomle-id]"))P.intersectsWithViewPortRect(e)?P.impressionQueue.push(e):P.addIntersectionImpressionListener(e);P.sendImpressions()}}};P.impressionQueue=[],P.observer=new IntersectionObserver((e,t)=>{e.forEach(r=>{r.isIntersecting&&(P.impressionQueue.push(r.target),P.observer.unobserve(r.target))}),P.impressionQueue.length>0&&P.sendImpressions()});var re=P;var ce=class u{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e={event_type:"page_visit",page_type:l.getPageVisit(),channel:"www-desktop"};return l.getUserId()?e.user_id=l.getUserId():e.device_id=l.getDeviceId(),JSON.stringify(e)}static sendPageVisit(){l.getPageVisit()&&l.getDeviceId()!="no-consent"&&fetch(u.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:u.generateBody()})}};var ge=class u{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e={event_type:"detail_pageview",page_type:"article_detail",action_item:l.getPageView(),action_item_type:"article",channel:"www-desktop"};return l.getUserId()?e.user_id=l.getUserId():e.device_id=l.getDeviceId(),JSON.stringify(e)}static sendPageView(){l.getPageView()&&l.getDeviceId()!="no-consent"&&fetch(u.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:u.generateBody()})}};var Ke=A.setEnvironment,Xe=A.setPageVisit,at=A.setConsent,ze=A.setUserId,Qe=A.setDeviceId,We=A.setRequestDomain,ut=A.setPageView;if(typeof document!="undefined"){let u=document.currentScript;if(u){let e=u.getAttribute("data-froomle-device-id"),t=u.getAttribute("data-froomle-user-id"),r=u.getAttribute("data-froomle-env"),n=u.getAttribute("data-froomle-page-visit"),i=u.getAttribute("data-froomle-request-domain"),o=u.getAttribute("data-froomle-page-view");Ke(r),o&&ut(o),n&&Xe(n),e&&Qe(e),t&&ze(t),i&&We(i)}else console.error("Froomle SDK: could not find the script tag where the sdk is included.");document.addEventListener("DOMContentLoaded",()=>{ue.domInit(te.fromDocument()),re.processDocument(),ce.sendPageVisit(),ge.sendPageView(),new MutationObserver(t=>{for(let r of t)if(r.type==="childList"&&re.processElement(r.target),r.type==="attributes")if(r.attributeName==="data-froomle-reco"){let n=r.target.getAttribute("data-froomle-request-id");(!n||n==="")&&ue.fillElementRecos(r.target)}else r.attributeName==="data-froomle-request-id"&&ue.fillElementRecos(r.target)}).observe(document,{childList:!0,subtree:!0})})}
package/dist/index.d.cts CHANGED
@@ -36,6 +36,7 @@ declare class FroomleSdk {
36
36
  protected static _page_view_set: boolean
37
37
  protected static registered: boolean
38
38
  protected static register(): void
39
+ static buildScriptTag(): string
39
40
  static setEnvironment(env: string): void
40
41
  static setDeviceId(id: string): void
41
42
  static setUserId(id: string): void
package/dist/index.d.ts CHANGED
@@ -36,6 +36,7 @@ declare class FroomleSdk {
36
36
  protected static _page_view_set: boolean
37
37
  protected static registered: boolean
38
38
  protected static register(): void
39
+ static buildScriptTag(): string
39
40
  static setEnvironment(env: string): void
40
41
  static setDeviceId(id: string): void
41
42
  static setUserId(id: string): void
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- var s=class g{static global(e){return g.globals[e]?g.globals[e]:g.globals[e]={}}static createStatic(e,t,r){let n=null;Object.defineProperty(e,t,{enumerable:!0,get:function(){return r!=null&&(n=r(),r=null),n},set:function(i){r!=null&&(n=r(),r=null),n=i}})}static iterator(e){if(Array.isArray(e)){let t=e;return function(){return g.mkIter(t)}}else return typeof e.iterator=="function"?e.iterator.bind(e):e.iterator}static getIterator(e){return Array.isArray(e)?g.mkIter(e):e.iterator()}static mkIter(e){return new we(e)}static extend(e){function t(){this[g.new].apply(this,arguments)}return Object.setPrototypeOf(t.prototype,e.prototype),t}static inherits(e,t){t==null&&(t=!1);function r(){t&&e&&r[g.init]&&r[g.init](),this[g.new].apply(this,arguments)}return t?r[g.init]=()=>{let n=e();n[g.init]&&n[g.init](),Object.setPrototypeOf(r.prototype,n.prototype),r[g.init]=void 0}:e&&e[g.init]?(t=!0,r[g.init]=()=>{e[g.init]&&e[g.init](),Object.setPrototypeOf(r.prototype,e.prototype),r[g.init]=void 0}):e&&Object.setPrototypeOf(r.prototype,e.prototype),r}static bind(e,t){if(t==null)return null;t.__id__==null&&(t.__id__=g.fid++);let r=null;return e.hx__closures__==null?e.hx__closures__={}:r=e.hx__closures__[t.__id__],r==null&&(r=t.bind(e),e.hx__closures__[t.__id__]=r),r}static get __name__(){return"genes.Register"}get __class__(){return g}};s.$global=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:void 0;s.globals={};s.new=Symbol();s.init=Symbol();s.fid=0;var we=s.global("$hxClasses")["genes._Register.ArrayIterator"]=class Pe extends s.inherits(){[s.new](e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}static get __name__(){return"genes._Register.ArrayIterator"}get __class__(){return Pe}};we.prototype.array=null;we.prototype.current=null;var nt=s.$global,te=function(){};te.__isInterface__=!0;var re=function(){};re.__isInterface__=!0;var se=function(){};se.__isInterface__=!0;var at=s.$global,me=s.global("$hxClasses")["haxe.ValueException"]=class $e extends s.inherits(()=>k,!0){[s.new](e,t,r){super[s.new](String(e),t,r),this.value=e}unwrap(){return this.value}static get __name__(){return"haxe.ValueException"}static get __super__(){return k}get __class__(){return $e}};me.prototype.value=null;var gt=s.$global,k=s.global("$hxClasses")["haxe.Exception"]=class ne extends s.inherits(()=>Error,!0){[s.new](e,t,r){Error.call(this,e),this.message=e,this.__previousException=t,this.__nativeException=r!=null?r:this}unwrap(){return this.__nativeException}get_native(){return this.__nativeException}static caught(e){return e instanceof ne?e:e instanceof Error?new ne(e.message,null,e):new me(e,null,e)}static thrown(e){return e instanceof ne?e.get_native():e instanceof Error?e:new me(e)}static get __name__(){return"haxe.Exception"}static get __super__(){return Error}get __class__(){return ne}};k.prototype.native=null;k.prototype.__skipStack=null;k.prototype.__nativeException=null;k.prototype.__previousException=null;var dt=s.$global,xe=s.global("$hxClasses")["js.Browser"]=class Ce{static get supported(){return this.get_supported()}static get_supported(){return typeof window!="undefined"&&typeof window.location!="undefined"?typeof window.location.protocol=="string":!1}static createXMLHttpRequest(){if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")return new"ActiveXObject"("Microsoft.XMLHTTP");throw k.thrown("Unable to create XMLHttpRequest object.")}static get __name__(){return"js.Browser"}get __class__(){return Ce}};var bt=s.$global,F=s.global("$hxEnums")["haxe.io.Error"]={__ename__:"haxe.io.Error",Blocked:{_hx_name:"Blocked",_hx_index:0,__enum__:"haxe.io.Error"},Overflow:{_hx_name:"Overflow",_hx_index:1,__enum__:"haxe.io.Error"},OutsideBounds:{_hx_name:"OutsideBounds",_hx_index:2,__enum__:"haxe.io.Error"},Custom:Object.assign(g=>({_hx_index:3,__enum__:"haxe.io.Error",e:g}),{_hx_name:"Custom",__params__:["e"]})};F.__constructs__=[F.Blocked,F.Overflow,F.OutsideBounds,F.Custom];F.__empty_constructs__=[F.Blocked,F.Overflow,F.OutsideBounds];var vt=s.$global,H=s.global("$hxEnums")["haxe.io.Encoding"]={__ename__:"haxe.io.Encoding",UTF8:{_hx_name:"UTF8",_hx_index:0,__enum__:"haxe.io.Encoding"},RawNative:{_hx_name:"RawNative",_hx_index:1,__enum__:"haxe.io.Encoding"}};H.__constructs__=[H.UTF8,H.RawNative];H.__empty_constructs__=[H.UTF8,H.RawNative];var St=s.$global,z=s.global("$hxClasses")["haxe.io.Bytes"]=class ve extends s.inherits(){[s.new](e){this.length=e.byteLength,this.b=new Uint8Array(e),this.b.bufferValue=e,e.hxBytes=this,e.bytes=this.b}getString(e,t,r){if(e<0||t<0||e+t>this.length)throw k.thrown(F.OutsideBounds);r==null&&(r=H.UTF8);let n="",i=this.b,o=e,a=e+t;switch(r._hx_index){case 0:let f=e>0;for(;o<a;){let h=i[o++];if(h<128){if(h==0)break;n+=String.fromCodePoint(h)}else if(h<224){let u=(h&63)<<6|i[o++]&127;n+=String.fromCodePoint(u)}else if(h<240){let u=i[o++],c=(h&31)<<12|(u&127)<<6|i[o++]&127;n+=String.fromCodePoint(c)}else{let u=i[o++],c=i[o++],m=(h&15)<<18|(u&127)<<12|(c&127)<<6|i[o++]&127;n+=String.fromCodePoint(m)}}break;case 1:for(;o<a;){let h=i[o++]|i[o++]<<8;n+=String.fromCodePoint(h)}break}return n}static ofData(e){let t=e.hxBytes;return t!=null?t:new ve(e)}static get __name__(){return"haxe.io.Bytes"}get __class__(){return ve}};z.prototype.length=null;z.prototype.b=null;var qt=s.$global,T=s.global("$hxClasses")["haxe.http.HttpBase"]=class qe extends s.inherits(){[s.new](e){this.url=e,this.headers=[],this.params=[],this.emptyOnData=s.bind(this,this.onData)}get responseData(){return this.get_responseData()}setHeader(e,t){let r=0,n=this.headers.length;for(;r<n;){let i=r++;if(this.headers[i].name==e){this.headers[i]={name:e,value:t};return}}this.headers.push({name:e,value:t})}setPostData(e){this.postData=e,this.postBytes=null}onData(e){}onBytes(e){}onError(e){}onStatus(e){}hasOnData(){return s.bind(this,this.onData)!=this.emptyOnData}success(e){this.responseBytes=e,this.responseAsString=null,this.hasOnData()&&this.onData(this.get_responseData()),this.onBytes(this.responseBytes)}get_responseData(){return this.responseAsString==null&&this.responseBytes!=null&&(this.responseAsString=this.responseBytes.getString(0,this.responseBytes.length,H.UTF8)),this.responseAsString}static get __name__(){return"haxe.http.HttpBase"}get __class__(){return qe}};T.prototype.url=null;T.prototype.responseBytes=null;T.prototype.responseAsString=null;T.prototype.postData=null;T.prototype.postBytes=null;T.prototype.headers=null;T.prototype.params=null;T.prototype.emptyOnData=null;var At=s.$global,pe=s.global("$hxClasses")["haxe.iterators.MapKeyValueIterator"]=class Be extends s.inherits(){[s.new](e){this.map=e,this.keys=e.keys()}hasNext(){return this.keys.hasNext()}next(){let e=this.keys.next();return{value:this.map.get(e),key:e}}static get __name__(){return"haxe.iterators.MapKeyValueIterator"}get __class__(){return Be}};pe.prototype.map=null;pe.prototype.keys=null;var Tt=s.$global,Re=function(){};Re.__isInterface__=!0;var Ut=s.$global,Ie=s.global("$hxClasses")["js.Boot"]=class ie{static __string_rec(e,t){if(e==null)return"null";if(t.length>=5)return"<...>";let r=typeof e;switch(r=="function"&&(e.__name__||e.__ename__)&&(r="object"),r){case"function":return"<function>";case"object":if(e.__enum__){let h=s.global("$hxEnums")[e.__enum__].__constructs__[e._hx_index],u=h._hx_name;return h.__params__?(t=t+" ",u+"("+(function(c){var m;let E=[];{let _=0,p=h.__params__;for(;_<p.length;){let v=p[_];_=_+1,E.push(ie.__string_rec(e[v],t))}}return m=E,m})(this).join(",")+")"):u}if(e instanceof Array){let f="[";t+=" ";let h=0,u=e.length;for(;h<u;){let c=h++;f+=(c>0?",":"")+ie.__string_rec(e[c],t)}return f+="]",f}let n;try{n=e.toString}catch{return"???"}if(n!=null&&n!=Object.toString&&typeof n=="function"){let f=e.toString();if(f!="[object Object]")return f}let i=`{
1
+ var s=class _{static global(e){return _.globals[e]?_.globals[e]:_.globals[e]={}}static createStatic(e,t,r){let n=null;Object.defineProperty(e,t,{enumerable:!0,get:function(){return r!=null&&(n=r(),r=null),n},set:function(i){r!=null&&(n=r(),r=null),n=i}})}static iterator(e){if(Array.isArray(e)){let t=e;return function(){return _.mkIter(t)}}else return typeof e.iterator=="function"?e.iterator.bind(e):e.iterator}static getIterator(e){return Array.isArray(e)?_.mkIter(e):e.iterator()}static mkIter(e){return new we(e)}static extend(e){function t(){this[_.new].apply(this,arguments)}return Object.setPrototypeOf(t.prototype,e.prototype),t}static inherits(e,t){t==null&&(t=!1);function r(){t&&e&&r[_.init]&&r[_.init](),this[_.new].apply(this,arguments)}return t?r[_.init]=()=>{let n=e();n[_.init]&&n[_.init](),Object.setPrototypeOf(r.prototype,n.prototype),r[_.init]=void 0}:e&&e[_.init]?(t=!0,r[_.init]=()=>{e[_.init]&&e[_.init](),Object.setPrototypeOf(r.prototype,e.prototype),r[_.init]=void 0}):e&&Object.setPrototypeOf(r.prototype,e.prototype),r}static bind(e,t){if(t==null)return null;t.__id__==null&&(t.__id__=_.fid++);let r=null;return e.hx__closures__==null?e.hx__closures__={}:r=e.hx__closures__[t.__id__],r==null&&(r=t.bind(e),e.hx__closures__[t.__id__]=r),r}static get __name__(){return"genes.Register"}get __class__(){return _}};s.$global=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:void 0;s.globals={};s.new=Symbol();s.init=Symbol();s.fid=0;var we=s.global("$hxClasses")["genes._Register.ArrayIterator"]=class Ce extends s.inherits(){[s.new](e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}static get __name__(){return"genes._Register.ArrayIterator"}get __class__(){return Ce}};we.prototype.array=null;we.prototype.current=null;var nt=s.$global,te=function(){};te.__isInterface__=!0;var re=function(){};re.__isInterface__=!0;var se=function(){};se.__isInterface__=!0;var at=s.$global,me=s.global("$hxClasses")["haxe.ValueException"]=class Pe extends s.inherits(()=>k,!0){[s.new](e,t,r){super[s.new](String(e),t,r),this.value=e}unwrap(){return this.value}static get __name__(){return"haxe.ValueException"}static get __super__(){return k}get __class__(){return Pe}};me.prototype.value=null;var _t=s.$global,k=s.global("$hxClasses")["haxe.Exception"]=class ne extends s.inherits(()=>Error,!0){[s.new](e,t,r){Error.call(this,e),this.message=e,this.__previousException=t,this.__nativeException=r!=null?r:this}unwrap(){return this.__nativeException}get_native(){return this.__nativeException}static caught(e){return e instanceof ne?e:e instanceof Error?new ne(e.message,null,e):new me(e,null,e)}static thrown(e){return e instanceof ne?e.get_native():e instanceof Error?e:new me(e)}static get __name__(){return"haxe.Exception"}static get __super__(){return Error}get __class__(){return ne}};k.prototype.native=null;k.prototype.__skipStack=null;k.prototype.__nativeException=null;k.prototype.__previousException=null;var ht=s.$global,xe=s.global("$hxClasses")["js.Browser"]=class Se{static get supported(){return this.get_supported()}static get_supported(){return typeof window!="undefined"&&typeof window.location!="undefined"?typeof window.location.protocol=="string":!1}static createXMLHttpRequest(){if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")return new"ActiveXObject"("Microsoft.XMLHTTP");throw k.thrown("Unable to create XMLHttpRequest object.")}static get __name__(){return"js.Browser"}get __class__(){return Se}};var bt=s.$global,F=s.global("$hxEnums")["haxe.io.Error"]={__ename__:"haxe.io.Error",Blocked:{_hx_name:"Blocked",_hx_index:0,__enum__:"haxe.io.Error"},Overflow:{_hx_name:"Overflow",_hx_index:1,__enum__:"haxe.io.Error"},OutsideBounds:{_hx_name:"OutsideBounds",_hx_index:2,__enum__:"haxe.io.Error"},Custom:Object.assign(_=>({_hx_index:3,__enum__:"haxe.io.Error",e:_}),{_hx_name:"Custom",__params__:["e"]})};F.__constructs__=[F.Blocked,F.Overflow,F.OutsideBounds,F.Custom];F.__empty_constructs__=[F.Blocked,F.Overflow,F.OutsideBounds];var vt=s.$global,H=s.global("$hxEnums")["haxe.io.Encoding"]={__ename__:"haxe.io.Encoding",UTF8:{_hx_name:"UTF8",_hx_index:0,__enum__:"haxe.io.Encoding"},RawNative:{_hx_name:"RawNative",_hx_index:1,__enum__:"haxe.io.Encoding"}};H.__constructs__=[H.UTF8,H.RawNative];H.__empty_constructs__=[H.UTF8,H.RawNative];var Ct=s.$global,z=s.global("$hxClasses")["haxe.io.Bytes"]=class ve extends s.inherits(){[s.new](e){this.length=e.byteLength,this.b=new Uint8Array(e),this.b.bufferValue=e,e.hxBytes=this,e.bytes=this.b}getString(e,t,r){if(e<0||t<0||e+t>this.length)throw k.thrown(F.OutsideBounds);r==null&&(r=H.UTF8);let n="",i=this.b,o=e,a=e+t;switch(r._hx_index){case 0:let y=e>0;for(;o<a;){let d=i[o++];if(d<128){if(d==0)break;n+=String.fromCodePoint(d)}else if(d<224){let u=(d&63)<<6|i[o++]&127;n+=String.fromCodePoint(u)}else if(d<240){let u=i[o++],c=(d&31)<<12|(u&127)<<6|i[o++]&127;n+=String.fromCodePoint(c)}else{let u=i[o++],c=i[o++],m=(d&15)<<18|(u&127)<<12|(c&127)<<6|i[o++]&127;n+=String.fromCodePoint(m)}}break;case 1:for(;o<a;){let d=i[o++]|i[o++]<<8;n+=String.fromCodePoint(d)}break}return n}static ofData(e){let t=e.hxBytes;return t!=null?t:new ve(e)}static get __name__(){return"haxe.io.Bytes"}get __class__(){return ve}};z.prototype.length=null;z.prototype.b=null;var qt=s.$global,T=s.global("$hxClasses")["haxe.http.HttpBase"]=class $e extends s.inherits(){[s.new](e){this.url=e,this.headers=[],this.params=[],this.emptyOnData=s.bind(this,this.onData)}get responseData(){return this.get_responseData()}setHeader(e,t){let r=0,n=this.headers.length;for(;r<n;){let i=r++;if(this.headers[i].name==e){this.headers[i]={name:e,value:t};return}}this.headers.push({name:e,value:t})}setPostData(e){this.postData=e,this.postBytes=null}onData(e){}onBytes(e){}onError(e){}onStatus(e){}hasOnData(){return s.bind(this,this.onData)!=this.emptyOnData}success(e){this.responseBytes=e,this.responseAsString=null,this.hasOnData()&&this.onData(this.get_responseData()),this.onBytes(this.responseBytes)}get_responseData(){return this.responseAsString==null&&this.responseBytes!=null&&(this.responseAsString=this.responseBytes.getString(0,this.responseBytes.length,H.UTF8)),this.responseAsString}static get __name__(){return"haxe.http.HttpBase"}get __class__(){return $e}};T.prototype.url=null;T.prototype.responseBytes=null;T.prototype.responseAsString=null;T.prototype.postData=null;T.prototype.postBytes=null;T.prototype.headers=null;T.prototype.params=null;T.prototype.emptyOnData=null;var At=s.$global,pe=s.global("$hxClasses")["haxe.iterators.MapKeyValueIterator"]=class qe extends s.inherits(){[s.new](e){this.map=e,this.keys=e.keys()}hasNext(){return this.keys.hasNext()}next(){let e=this.keys.next();return{value:this.map.get(e),key:e}}static get __name__(){return"haxe.iterators.MapKeyValueIterator"}get __class__(){return qe}};pe.prototype.map=null;pe.prototype.keys=null;var Tt=s.$global,Re=function(){};Re.__isInterface__=!0;var Ut=s.$global,Ie=s.global("$hxClasses")["js.Boot"]=class ie{static __string_rec(e,t){if(e==null)return"null";if(t.length>=5)return"<...>";let r=typeof e;switch(r=="function"&&(e.__name__||e.__ename__)&&(r="object"),r){case"function":return"<function>";case"object":if(e.__enum__){let d=s.global("$hxEnums")[e.__enum__].__constructs__[e._hx_index],u=d._hx_name;return d.__params__?(t=t+" ",u+"("+(function(c){var m;let E=[];{let g=0,p=d.__params__;for(;g<p.length;){let v=p[g];g=g+1,E.push(ie.__string_rec(e[v],t))}}return m=E,m})(this).join(",")+")"):u}if(e instanceof Array){let y="[";t+=" ";let d=0,u=e.length;for(;d<u;){let c=d++;y+=(c>0?",":"")+ie.__string_rec(e[c],t)}return y+="]",y}let n;try{n=e.toString}catch{return"???"}if(n!=null&&n!=Object.toString&&typeof n=="function"){let y=e.toString();if(y!="[object Object]")return y}let i=`{
2
2
  `;t+=" ";let o=e.hasOwnProperty!=null,a=null;for(a in e)o&&!e.hasOwnProperty(a)||a=="prototype"||a=="__class__"||a=="__super__"||a=="__interfaces__"||a=="__properties__"||(i.length!=2&&(i+=`,
3
3
  `),i+=t+a+" : "+ie.__string_rec(e[a],t));return t=t.substring(1),i+=`
4
- `+t+"}",i;break;case"string":return e;default:return String(e)}}static get __name__(){return"js.Boot"}get __class__(){return ie}};Ie.__toStr={}.toString;var Jt=s.$global,$=s.global("$hxClasses").Std=class Ve{static string(e){return Ie.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}static get __name__(){return"Std"}get __class__(){return Ve}};String.__name__=!0,Array.__name__=!0;var Qt=s.$global,he=s.global("$hxClasses")["genes.util.EsMap"]=class le extends s.inherits(){[s.new](){this.inst=new Map}set(e,t){this.inst.set(e,t)}get(e){return this.inst.get(e)}remove(e){return this.inst.delete(e)}exists(e){return this.inst.has(e)}keys(){return le.adaptIterator(this.inst.keys())}iterator(){return le.adaptIterator(this.inst.values())}toString(){let e=[],t=le.adaptIterator(this.inst.keys());for(;t.hasNext();){let r=t.next();e.push(""+$.string(r)+" => "+$.string(this.inst.get(r)))}return"{"+e.join(", ")+"}"}clear(){this.inst.clear()}static adaptIterator(e){let t,r,n=function(){let i=e.next();t=i.value,r=i.done};return{hasNext:function(){return r==null&&n(),!r},next:function(){r==null&&n();let i=t;return n(),i}}}static get __name__(){return"genes.util.EsMap"}get __class__(){return le}};he.prototype.inst=null;var tr=s.$global,Ae=s.global("$hxClasses")["haxe.ds.StringMap"]=class Ee extends s.inherits(he){[s.new](){super[s.new]()}copy(){let e=new Ee;return e.inst=new Map(this.inst),e}keyValueIterator(){return new pe(this)}static get __name__(){return"haxe.ds.StringMap"}static get __interfaces__(){return[Re]}static get __super__(){return he}get __class__(){return Ee}};var nr=s.$global,B=s.global("$hxClasses").HxOverrides=class Oe{static cca(e,t){let r=e.charCodeAt(t);if(r==r)return r}static substr(e,t,r){if(r==null)r=e.length;else if(r<0)if(t==0)r=e.length+r;else return"";return e.substr(t,r)}static now(){return Date.now()}static get __name__(){return"HxOverrides"}get __class__(){return Oe}};typeof performance!="undefined"&&typeof performance.now=="function"&&(B.now=performance.now.bind(performance));var ar=s.$global,J=s.global("$hxClasses").StringTools=class de{static isSpace(e,t){let r=B.cca(e,t);return r>8&&r<14?!0:r==32}static ltrim(e){let t=e.length,r=0;for(;r<t&&de.isSpace(e,r);)++r;return r>0?B.substr(e,r,t-r):e}static rtrim(e){let t=e.length,r=0;for(;r<t&&de.isSpace(e,t-r-1);)++r;return r>0?B.substr(e,0,t-r):e}static replace(e,t,r){return e.split(t).join(r)}static get __name__(){return"StringTools"}get __class__(){return de}};var _r=s.$global,Fe=s.global("$hxClasses").Lambda=class Te{static exists(e,t){let r=s.getIterator(e);for(;r.hasNext();){let n=r.next();if(t(n))return!0}return!1}static get __name__(){return"Lambda"}get __class__(){return Te}};var fr=s.$global,oe=s.global("$hxClasses").EReg=class He extends s.inherits(){[s.new](e,t){this.r=new RegExp(e,t.split("u").join(""))}match(e){return this.r.global&&(this.r.lastIndex=0),this.r.m=this.r.exec(e),this.r.s=e,this.r.m!=null}matched(e){if(this.r.m!=null&&e>=0&&e<this.r.m.length)return this.r.m[e];throw k.thrown("EReg::matched")}matchedPos(){if(this.r.m==null)throw k.thrown("No string matched");return{pos:this.r.m.index,len:this.r.m[0].length}}matchSub(e,t,r){if(r==null&&(r=-1),this.r.global){this.r.lastIndex=t,this.r.m=this.r.exec(r<0?e:B.substr(e,0,t+r));let n=this.r.m!=null;return n&&(this.r.s=e),n}else{let n=this.match(r<0?B.substr(e,t,null):B.substr(e,t,r));return n&&(this.r.s=e,this.r.m.index+=t),n}}map(e,t){let r=0,n="";do{if(r>=e.length)break;if(!this.matchSub(e,r)){n+=$.string(B.substr(e,r,null));break}let i=this.matchedPos();n+=$.string(B.substr(e,r,i.pos-r)),n+=$.string(t(this)),i.len==0?(n+=$.string(B.substr(e,i.pos,1)),r=i.pos+1):r=i.pos+i.len}while(this.r.global);return!this.r.global&&r>0&&r<e.length&&(n+=$.string(B.substr(e,r,null))),n}static get __name__(){return"EReg"}get __class__(){return He}};oe.prototype.r=null;var Pr=s.$global,Q=s.global("$hxClasses")["haxe.http.HttpJs"]=class Le extends s.inherits(T){[s.new](e){this.async=!0,this.withCredentials=!1,super[s.new](e)}request(e){this.responseAsString=null,this.responseBytes=null,this.responseHeaders=null;let t=this.req=xe.createXMLHttpRequest(),r=this,n=function(u){if(t.readyState!=4)return;let c;try{c=t.status}catch{c=null}if(c==0&&xe.get_supported()&&s.$global.location!=null){let m=s.$global.location.protocol.toLowerCase();new oe("^(?:about|app|app-storage|.+-extension|file|res|widget):$","").match(m)&&(c=t.response!=null?200:404)}if(c==null&&(c=null),c!=null&&r.onStatus(c),c!=null&&c>=200&&c<400){r.req=null;let m=t.getAllResponseHeaders().split(`\r
5
- `),E=[],_=0,p=m;for(;_<p.length;){let w=p[_];++_,w!=""&&E.push(w)}m=E;let v=new Ae;r.responseHeaders=v;let b=0;for(;b<m.length;){let w=m[b];++b;let C=w.split(": "),O=C.shift(),x=C.length==1?C[0]:C.join(": ");x=J.ltrim(J.rtrim(x)),r.responseHeaders.inst.set(O,x)}r.success(z.ofData(t.response))}else if(c==null||c==0&&t.response==null)r.req=null,r.onError("Failed to connect or resolve host");else if(c==null){r.req=null;let m=t.response!=null?z.ofData(t.response):null;r.responseBytes=m,r.onError("Http Error #"+t.status)}else switch(c){case 12007:r.req=null,r.onError("Unknown host");break;case 12029:r.req=null,r.onError("Failed to connect to host");break;default:r.req=null;let m=t.response!=null?z.ofData(t.response):null;r.responseBytes=m,r.onError("Http Error #"+t.status)}};this.async&&(t.onreadystatechange=n);let i,o=this.postData,a=this.postBytes;if(o==null)if(a==null)i=null;else{let u=a;i=new Blob([u.b.bufferValue])}else a==null?i=o:i=null;if(i!=null)e=!0;else{let u=0,c=this.params;for(;u<c.length;){let m=c[u];++u,i==null?i="":i=(i==null?"null":$.string(i))+"&";let E=m.name,_=(i==null?"null":$.string(i))+encodeURIComponent(E)+"=",p=m.value;i=_+encodeURIComponent(p)}}try{if(e)t.open("POST",this.url,this.async);else if(i!=null){let u=this.url.split("?").length<=1;t.open("GET",this.url+(u?"?":"&")+(i==null?"null":$.string(i)),this.async),i=null}else t.open("GET",this.url,this.async);t.responseType="arraybuffer"}catch(u){let c=k.caught(u).unwrap();this.req=null,this.onError(c.toString());return}t.withCredentials=this.withCredentials,!Fe.exists(this.headers,function(u){return u.name=="Content-Type"})&&e&&this.postData==null&&t.setRequestHeader("Content-Type","application/x-www-form-urlencoded");let f=0,h=this.headers;for(;f<h.length;){let u=h[f];++f,t.setRequestHeader(u.name,u.value)}t.send(i),this.async||n(null)}static get __name__(){return"haxe.http.HttpJs"}static get __super__(){return T}get __class__(){return Le}};Q.prototype.async=null;Q.prototype.withCredentials=null;Q.prototype.responseHeaders=null;Q.prototype.req=null;var qr=s.$global,j=s.global("$hxClasses").SimpleFuture=class Ue extends s.inherits(){[s.new](){this._isFinished=!1}trigger(e){this._result=e,this._isFinished=!0,this._callback!=null&&this._callback(this._result)}then(e){this._callback=e,this._isFinished&&e(this._result)}static get __name__(){return"SimpleFuture"}get __class__(){return Ue}};j.prototype._callback=null;j.prototype._result=null;j.prototype._isFinished=null;var Ar=s.$global,I=s.global("$hxClasses").Reflect=class je{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let r;if(e==null)return null;{let n;return e.__properties__?(r=e.__properties__["get_"+t],n=r):n=!1,n?e[r]():e[t]}}static setProperty(e,t,r){let n,i;e.__properties__?(n=e.__properties__["set_"+t],i=n):i=!1,i?e[n](r):e[t]=r}static fields(e){let t=[];if(e!=null){let n=Object.prototype.hasOwnProperty;for(var r in e)r!="__id__"&&r!="hx__closures__"&&n.call(e,r)&&t.push(r)}return t}static get __name__(){return"Reflect"}get __class__(){return je}};var Mr=s.$global,l=s.global("$hxClasses")["internal.RecoBackendV2"]=class y extends s.inherits(){[s.new](){}static _requestUri(){return"https://"+y._req_domain+"/api/"+y._environment+"/recommendations/requests"}static noConsentBody(){return{device_id:"no-consent",user_group:"no-consent",version:"no-consent"}}static buildRequestBody(e){let t={lists:e,page_type:y._page_visit!=null?y._page_visit:y._page_view,channel:"www-desktop"};if(y._consent==0){let r=y.noConsentBody(),n=0,i=I.fields(r);for(;n<i.length;){let o=i[n];++n,t[o]=I.field(r,o)}}else y._user_id!=null?t.user_id=y._user_id:t.device_id=y._device_id;return t}static _requestRecos(e){let t=new j,r=null,n=new Q(y._requestUri());n.setHeader("Content-Type","application/json"),n.setPostData(JSON.stringify(y.buildRequestBody(e))),n.onError=function(a){throw k.thrown("HTTP Request Error: "+a)},n.onStatus=function(a){if(a<200||a>=300)throw k.thrown("HTTP Status Error: "+a)};try{n.request(!1)}catch(a){let f=k.caught(a).unwrap();throw k.thrown("Failed to execute synchronous request: "+$.string(f))}let i=function(a){let f=JSON.parse(a),h=W.fromRequestData(f);t.trigger(h)},o=n.get_responseData();return o!=null?i(o):n.onData=i,t}static getRawRecommendations(e){return y._requestRecos(e)}static setConsent(e){e>2&&(e=2),y._consent=e}static setPageVisit(e){y._page_visit=e}static setEnvironment(e){y._environment=e}static setDeviceId(e){y._device_id=e}static setUserId(e){y._user_id=e}static setRequestDomain(e){y._req_domain=e}static setPageView(e){y._page_view=e}static getRequestDomain(){return y._req_domain}static getEnvironment(){return y._environment}static getPageVisit(){return y._page_visit}static getUserId(){return y._user_id}static getDeviceId(){return y._device_id}static getPageView(){return y._page_view}static get __name__(){return"internal.RecoBackendV2"}get __class__(){return y}};l._environment=null;l._device_id=null;l._user_id=null;l._consent=0;l._req_domain="europe-west1.froomle.com";l._page_visit=null;l._page_view=null;var ze=function(){};ze.__isInterface__=!0;var Qe=function(){};Qe.__isInterface__=!0;var W=s.global("$hxClasses")["internal._RecommendationsInternal"]=class De extends s.inherits(){[s.new](e,t,r,n,i){this.request_id=t,this.user_group=r,this.device_id=e,this.user_id=n,this._lists=i}items(){let e=[],t=0,r=this._lists;for(;t<r.length;){let n=r[t];++t;let i=0,o=n.items;for(;i<o.length;){let a=o[i];++i,e.push(a)}}return e}lists(){return this._lists}getItemsByListName(e){let t=0,r=this._lists;for(;t<r.length;){let n=r[t];if(++t,n.list_name==e)return n}return null}static fromRequestData(e){let t=I.getProperty(e,"lists"),r=[],n=0;for(;n<t.length;){let i=t[n];++n;let o=I.getProperty(i,"items"),a=[],f=0;for(;f<o.length;){let u=o[f];++f,a.push(new ae(u))}let h=new G({limit:I.getProperty(i,"limit"),list_key:I.getProperty(i,"list_key"),list_name:I.getProperty(i,"list_name"),list_size:I.getProperty(i,"list_size"),items:a});r.push(h)}return new De(I.getProperty(e,"device_id"),I.getProperty(e,"request_id"),I.getProperty(e,"user_group"),I.getProperty(e,"user_id"),r)}static get __name__(){return"internal._RecommendationsInternal"}static get __interfaces__(){return[te]}get __class__(){return De}};W.prototype.request_id=null;W.prototype.user_group=null;W.prototype.user_id=null;W.prototype.device_id=null;W.prototype._lists=null;var G=s.global("$hxClasses")["internal._RecommendationsListInternal"]=class Ne extends s.inherits(){[s.new](e){this.items=e.items,this.limit=e.limit,this.list_key=e.list_key,this.list_name=e.list_name,this.list_size=e.list_size}static get __name__(){return"internal._RecommendationsListInternal"}static get __interfaces__(){return[re]}get __class__(){return Ne}};G.prototype.limit=null;G.prototype.list_key=null;G.prototype.list_name=null;G.prototype.list_size=null;G.prototype.items=null;var ae=s.global("$hxClasses")["internal._RecommendationItemInternal"]=class Me extends s.inherits(){[s.new](e){this._data={},this.Id=I.getProperty(e,"item_id"),this.RequestId=I.getProperty(e,"request_id"),this.UserGroup=I.getProperty(e,"user_group");let t=0,r=I.fields(e);for(;t<r.length;){let n=r[t];++t,this._data[n]=I.field(e,n)}}get(e){return this._data[e]}static get __name__(){return"internal._RecommendationItemInternal"}static get __interfaces__(){return[se]}get __class__(){return Me}};ae.prototype.Id=null;ae.prototype.RequestId=null;ae.prototype.UserGroup=null;ae.prototype._data=null;var q=s.global("$hxClasses")["internal._RecoBackendV2.RecoBackendV2_Fields_"]=class ke{static getRawRecommendations(e){return l.getRawRecommendations(e)}static setConsent(e){l.setConsent(e)}static setPageVisit(e){l.setPageVisit(e)}static setEnvironment(e){l.setEnvironment(e)}static setDeviceId(e){l.setDeviceId(e)}static setUserId(e){l.setUserId(e)}static setRequestDomain(e){l.setRequestDomain(e)}static setPageView(e){l.setPageView(e)}static getConsent(){ke.getConsent()}static getPageVisit(){l.getPageVisit()}static getEnvironment(){l.getEnvironment()}static getDeviceId(){l.getDeviceId()}static getUserId(){l.getUserId()}static getPageView(){l.getPageView()}static get __name__(){return"internal._RecoBackendV2.RecoBackendV2_Fields_"}get __class__(){return ke}},Jr=q.getRawRecommendations,Kr=q.setConsent,Xr=q.setPageVisit,zr=q.setEnvironment,Qr=q.setDeviceId,Wr=q.setUserId,Gr=q.setRequestDomain,Yr=q.setPageView,Zr=q.getConsent,es=q.getPageVisit,ts=q.getEnvironment,rs=q.getDeviceId,ss=q.getUserId,ns=q.getPageView;var as=s.$global,A=s.global("$hxClasses").FroomleSdk=class V{static register(){V.registered||V._env_set&&(!V._page_visit_set&&!V._page_view_set||(V.registered=!0))}static setEnvironment(e){l.setEnvironment(e),V._env_set=!0,V.register()}static setDeviceId(e){l.setDeviceId(e)}static setUserId(e){l.setUserId(e)}static setConsent(e){l.setConsent(e)}static setPageView(e){l.setPageView(e),V._page_view_set=!0,V.register()}static setPageVisit(e){l.setPageVisit(e),V._page_visit_set=!0,V.register()}static setRequestDomain(e){l.setRequestDomain(e)}static getRawRecommendations(e){return l.getRawRecommendations(e)}static getVersion(){return"0.0.7"}static get __name__(){return"FroomleSdk"}get __class__(){return V}};A._env_set=!1;A._page_visit_set=!1;A._page_view_set=!1;A.registered=!1;var _s=s.$global,Y=s.global("$hxClasses")["internal.domHandler.FroomleDomTree"]=class fe extends s.inherits(){[s.new](){}createElement(e){return window.document.createElement(e)}querySelectorAll(e){let t=this.root,r=[],n=t.querySelectorAll(e),i=0,o=n.length;for(;i<o;){let a=i++;r.push(n.item(a))}return r}getRoot(){return this.root}toString(){return this.root.outerHTML}static run(){}static fromHtml(e){return new fe}static fromDocument(){let e=new fe;return e.root=window.document,e}static get __name__(){return"internal.domHandler.FroomleDomTree"}get __class__(){return fe}};Y.prototype.root=null;var ps=s.$global,L=s.global("$hxClasses")["internal._ADomNode.ADomNode"]=class Se{static _new(e){return e}static fromElement(e){return e}static create(e,t){return window.document.createElement(t)}static replaceChild(e,t,r){e.replaceChild(t,r)}static get attributes(){return this.get_attributes()}static get_attributes(e){let t=e,r=[],n=0,i=t.attributes.length;for(;n<i;){let o=n++,a=t.attributes.item(o);r.push({name:a.name,value:a.value})}return r}static addChild(e,t){e.appendChild(t)}static removeChild(e,t){e.removeChild(t)}static getAttribute(e,t){return e.getAttribute(t)}static setAttribute(e,t,r){e.setAttribute(t,r)}static getText(e){return e.textContent}static setText(e,t){e.textContent=t}static get children(){return this.get_children()}static get_children(e){let t=[],n=e.children,i=0,o=n.length;for(;i<o;){let a=i++;t.push(n[a])}return t}static querySelectorAll(e,t){let r=e,n=[],i=r.querySelectorAll(t),o=0,a=i.length;for(;o<a;){let f=o++;n.push(i.item(f))}return n}static getFilterKeyValue(e){let t=0,r=Se.get_attributes(e);for(;t<r.length;){let n=r[t];if(++t,n.name.startsWith("data-froomle-reco-filter-"))return{key:n.name.substring(25),value:n.value}}return{key:null,value:null}}static get __name__(){return"internal._ADomNode.ADomNode_Impl_"}get __class__(){return Se}};var Ds=s.$global,ue=s.global("$hxClasses")["internal.domHandler.DomDomDom"]=class K extends s.inherits(){[s.new](){}static _fillRecoTargets(e){let t=new j;if(e==null)return t.trigger(!1),t;let r=[],n=e,i=[],o=n.querySelectorAll("*"),a=0,f=o.length;for(;a<f;){let d=a++;i.push(o.item(d))}let h=i,u=0;for(;u<h.length;){let d=h[u];++u;let D=0,R=L.get_attributes(d);for(;D<R.length;){let M=R[D];++D,M.name=="data-froomle-reco"&&r.push(d)}}let c=[],m=0;for(;m<r.length;){let d=r[m];++m,d.getAttribute("data-froomle-request-id")==null&&(d.getAttribute("data-froomle-id")==null||d.getAttribute("data-froomle-id")=="")&&c.push(d)}if(c.length<1)return new j;let E=[],_=[],p="",v="",b="",w=[],C=function(){let d={list_name:p,list_size:w.length,limit:w.length};v!=null&&I.setProperty(d,v,b),E.push(d),_.push(w)},O=function(d,D,R,M){p=d,v=D,b=R,w=[M]},x=0;for(;x<c.length;){let d=c[x];++x;let D=d.getAttribute("data-froomle-reco"),R=L.getFilterKeyValue(d);if(p==""){O(D,R.key,R.value,d);continue}else if(D==p&&R.key==v&&R.value==b){w.push(d);continue}else{C(),O(D,R.key,R.value,d);continue}}return p!=""&&C(),q.getRawRecommendations(E).then(function(d){let D=0,R=d.lists();for(;D<R.length;){let M=R[D],N=D++,U=M,X=U.items.length!=_[N].length,ee=0,ye=U.items;for(;ee<ye.length;){let be=ye[ee],Ke=ee++,Xe=be;K._fillParameters(_[N][Ke],Xe,d.request_id)}}t.trigger(!0)}),t}static _fillParameters(e,t,r){let n=function(m,E,_,p){p==null&&(p="");let v=function(b,w,C){C==null&&(C="fgh");try{w=new oe("\\\\[(\\\\w+)\\\\]","g").map(w,function(R){return"."+R.matched(1)}),w=J.replace(w,"[","."),w=J.replace(w,"]",""),B.cca(w,0)==46&&(w=B.substr(w,1,null));let x=w.split("."),P=b.get(x[0]),d=1,D=x.length;for(;d<D;){let R=d++;if(P==null)return null;P instanceof Array&&$.parseInt(x[R])!=null?P=P[$.parseInt(x[R])]:P=I.field(P,x[R])}return P}catch{return C}};try{let b=v(t,_,p);E=="inner"?m.textContent=b:m.setAttribute(E,b)}catch{}};e.setAttribute("data-froomle-id",t.Id),e.setAttribute("data-froomle-request-id",r);let i=e,o=[],a=i.querySelectorAll("*"),f=0,h=a.length;for(;f<h;){let m=f++;o.push(a.item(m))}let u=o,c=0;for(;c<u.length;){let m=u[c];++c;let E=0,_=L.get_attributes(m);for(;E<_.length;){let p=_[E];if(++E,p.name.startsWith("data-froomle-param-")){let v=J.replace(p.name,"data-froomle-param-",""),b=p.value;n(m,v,b)}}}}static _orderElements(e){let t=function(_,p,v){let b=[],w=L.get_children(_),C=0;for(;C<w.length;){let P=w[C];if(++C,P.getAttribute("data-froomle-ordervalue")!=null){b.push(P);let D=L.create(e,"span");D.setAttribute("data-froomle-tmp-node",""),L.replaceChild(_,D,P)}}let O=[],x=0;for(;x<b.length;){let P=b[x];++x,O.push(P.getAttribute("data-froomle-ordervalue"))}return{el:_,key:p,values:O,orderChildren:b,list_name:v}},r=new j,n=e.getRoot(),i=[],o=n.querySelectorAll("*"),a=0,f=o.length;for(;a<f;){let _=a++;i.push(o.item(_))}let h=i,u=[],c=0;for(;c<h.length;){let _=h[c];++c;let p=0,v=L.get_attributes(_);for(;p<v.length;){let b=v[p];++p,b.name.startsWith("data-froomle-order-")&&u.push(t(_,b.name.substring(19),b.value))}}if(u.length<1)return r.trigger(!1),r;let m=[],E=0;for(;E<u.length;){let _=u[E];++E;let p={list_name:_.list_name,limit:_.values.length,list_size:_.values.length},v={};I.setProperty(v,_.key,_.values),I.setProperty(p,"order",v),m.push(p)}return q.getRawRecommendations(m).then(function(_){let p=0,v=_.lists();for(;p<v.length;){let b=v[p],C=p++,O=b,x=u[C];x.el.setAttribute("data-froomle-request-id",_.request_id);let P=[],d=0,D=O.items;for(;d<D.length;){let ge=D[d];++d;let N=ge.get(x.key),U=0,X=x.values;for(;U<X.length;){let ee=X[U],be=U++;if(N==ee){P.push(x.orderChildren[be]);break}}}let R=0,M=P.length;for(;R<M;){let ge=R++,N=0,U=L.get_children(x.el);for(;N<U.length;){let X=U[N];if(++N,X.getAttribute("data-froomle-tmp-node")==""){L.replaceChild(x.el,P[ge],X);break}}}}r.trigger(!0)}),r}static domInit(e){K._orderElements(e).then(function(t){K._fillRecoTargets(e.getRoot())})}static fillElementRecos(e){K._fillRecoTargets(e)}static runFromHtml(e){let t=Y.fromHtml(e);return K.domInit(t),t.toString()}static get __name__(){return"internal.domHandler.DomDomDom"}get __class__(){return K}};var Ps=s.$global;var S=class S{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e=[];for(let t of S.impressionQueue){let r={event_type:"impression",page_type:l.getPageVisit(),action_item:t.getAttribute("data-froomle-id"),action_item_type:"article",channel:"www-desktop"};l.getUserId()?r.user_id=l.getUserId():r.device_id=l.getDeviceId();let n=t.getAttribute("data-froomle-reco");if(n){r.list_name=n;let i=t.getAttribute("data-froomle-request-id");if(!i)throw console.error("element need reco but doesnt have request id registered yet"),new Error("element need reco but doesnt have request id registered");r.request_id=i}}return S.impressionQueue=[],JSON.stringify({events:e})}static sendImpressions(){S.impressionQueue.length!==0&&fetch(S.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:S.generateBody()})}static getViewPortRect(){let e=window.innerWidth||document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{left:0,top:0,x:0,y:0,toJSON(){},right:e,bottom:t,width:e,height:t}}static intersectsWithViewPortRect(e){let t=e.getBoundingClientRect(),r=S.getViewPortRect();return t.right>r.left&&t.left<r.right&&t.bottom>r.top&&t.top<r.bottom}static addIntersectionImpressionListener(e){S.observer.observe(e)}static processDocument(){if(l.getDeviceId()!="no-consent"){for(let e of document.querySelectorAll("[data-froomle-id]"))S.intersectsWithViewPortRect(e)?S.impressionQueue.push(e):S.addIntersectionImpressionListener(e);S.sendImpressions()}}};S.impressionQueue=[],S.observer=new IntersectionObserver((e,t)=>{e.forEach(r=>{r.isIntersecting&&(S.impressionQueue.push(r.target),S.observer.unobserve(r.target))}),S.impressionQueue.length>0&&S.sendImpressions()});var Z=S;var ce=class g{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e={event_type:"page_visit",page_type:l.getPageVisit(),channel:"www-desktop"};return l.getUserId()?e.user_id=l.getUserId():e.device_id=l.getDeviceId(),JSON.stringify(e)}static sendPageVisit(){l.getPageVisit()&&l.getDeviceId()!="no-consent"&&fetch(g.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:g.generateBody()})}};var _e=class g{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e={event_type:"detail_pageview",page_type:"article_detail",action_item:l.getPageView(),action_item_type:"article",channel:"www-desktop"};return l.getUserId()?e.user_id=l.getUserId():e.device_id=l.getDeviceId(),JSON.stringify(e)}static sendPageView(){l.getPageView()&&l.getDeviceId()!="no-consent"&&fetch(g.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:g.generateBody()})}};var We=A.setEnvironment,Ge=A.setPageVisit,Ws=A.setConsent,Ye=A.setUserId,Ze=A.setDeviceId,et=A.setRequestDomain,tt=A.setPageView;if(typeof document!="undefined"){let g=document.currentScript;if(g){let e=g.getAttribute("data-froomle-device-id"),t=g.getAttribute("data-froomle-user-id"),r=g.getAttribute("data-froomle-env"),n=g.getAttribute("data-froomle-page-visit"),i=g.getAttribute("data-froomle-request-domain"),o=g.getAttribute("data-froomle-page-view");We(r),o&&tt(o),n&&Ge(n),e&&Ze(e),t&&Ye(t),i&&et(i)}else console.error("Froomle SDK: could not find the script tag where the sdk is included.");document.addEventListener("DOMContentLoaded",()=>{ue.domInit(Y.fromDocument()),Z.processDocument(),ce.sendPageVisit(),_e.sendPageView(),new MutationObserver(t=>{for(let r of t)if(r.type==="childList"&&Z.processElement(r.target),r.type==="attributes")if(r.attributeName==="data-froomle-reco"){let n=r.target.getAttribute("data-froomle-request-id");(!n||n==="")&&ue.fillElementRecos(r.target)}else r.attributeName==="data-froomle-request-id"&&ue.fillElementRecos(r.target)}).observe(document,{childList:!0,subtree:!0})})}export{se as RecommendationItem,re as RecommendationList,te as Recommendations,Ws as setConsent,Ze as setDeviceId,We as setEnvironment,Ge as setPageVisit,et as setRequestDomain,Ye as setUserId};
4
+ `+t+"}",i;break;case"string":return e;default:return String(e)}}static get __name__(){return"js.Boot"}get __class__(){return ie}};Ie.__toStr={}.toString;var Jt=s.$global,$=s.global("$hxClasses").Std=class Be{static string(e){return Ie.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}static get __name__(){return"Std"}get __class__(){return Be}};String.__name__=!0,Array.__name__=!0;var Qt=s.$global,de=s.global("$hxClasses")["genes.util.EsMap"]=class le extends s.inherits(){[s.new](){this.inst=new Map}set(e,t){this.inst.set(e,t)}get(e){return this.inst.get(e)}remove(e){return this.inst.delete(e)}exists(e){return this.inst.has(e)}keys(){return le.adaptIterator(this.inst.keys())}iterator(){return le.adaptIterator(this.inst.values())}toString(){let e=[],t=le.adaptIterator(this.inst.keys());for(;t.hasNext();){let r=t.next();e.push(""+$.string(r)+" => "+$.string(this.inst.get(r)))}return"{"+e.join(", ")+"}"}clear(){this.inst.clear()}static adaptIterator(e){let t,r,n=function(){let i=e.next();t=i.value,r=i.done};return{hasNext:function(){return r==null&&n(),!r},next:function(){r==null&&n();let i=t;return n(),i}}}static get __name__(){return"genes.util.EsMap"}get __class__(){return le}};de.prototype.inst=null;var tr=s.$global,Ve=s.global("$hxClasses")["haxe.ds.StringMap"]=class Ee extends s.inherits(de){[s.new](){super[s.new]()}copy(){let e=new Ee;return e.inst=new Map(this.inst),e}keyValueIterator(){return new pe(this)}static get __name__(){return"haxe.ds.StringMap"}static get __interfaces__(){return[Re]}static get __super__(){return de}get __class__(){return Ee}};var nr=s.$global,B=s.global("$hxClasses").HxOverrides=class Ae{static cca(e,t){let r=e.charCodeAt(t);if(r==r)return r}static substr(e,t,r){if(r==null)r=e.length;else if(r<0)if(t==0)r=e.length+r;else return"";return e.substr(t,r)}static now(){return Date.now()}static get __name__(){return"HxOverrides"}get __class__(){return Ae}};typeof performance!="undefined"&&typeof performance.now=="function"&&(B.now=performance.now.bind(performance));var ar=s.$global,J=s.global("$hxClasses").StringTools=class he{static isSpace(e,t){let r=B.cca(e,t);return r>8&&r<14?!0:r==32}static ltrim(e){let t=e.length,r=0;for(;r<t&&he.isSpace(e,r);)++r;return r>0?B.substr(e,r,t-r):e}static rtrim(e){let t=e.length,r=0;for(;r<t&&he.isSpace(e,t-r-1);)++r;return r>0?B.substr(e,0,t-r):e}static replace(e,t,r){return e.split(t).join(r)}static get __name__(){return"StringTools"}get __class__(){return he}};var gr=s.$global,Oe=s.global("$hxClasses").Lambda=class Fe{static exists(e,t){let r=s.getIterator(e);for(;r.hasNext();){let n=r.next();if(t(n))return!0}return!1}static get __name__(){return"Lambda"}get __class__(){return Fe}};var fr=s.$global,oe=s.global("$hxClasses").EReg=class Te extends s.inherits(){[s.new](e,t){this.r=new RegExp(e,t.split("u").join(""))}match(e){return this.r.global&&(this.r.lastIndex=0),this.r.m=this.r.exec(e),this.r.s=e,this.r.m!=null}matched(e){if(this.r.m!=null&&e>=0&&e<this.r.m.length)return this.r.m[e];throw k.thrown("EReg::matched")}matchedPos(){if(this.r.m==null)throw k.thrown("No string matched");return{pos:this.r.m.index,len:this.r.m[0].length}}matchSub(e,t,r){if(r==null&&(r=-1),this.r.global){this.r.lastIndex=t,this.r.m=this.r.exec(r<0?e:B.substr(e,0,t+r));let n=this.r.m!=null;return n&&(this.r.s=e),n}else{let n=this.match(r<0?B.substr(e,t,null):B.substr(e,t,r));return n&&(this.r.s=e,this.r.m.index+=t),n}}map(e,t){let r=0,n="";do{if(r>=e.length)break;if(!this.matchSub(e,r)){n+=$.string(B.substr(e,r,null));break}let i=this.matchedPos();n+=$.string(B.substr(e,r,i.pos-r)),n+=$.string(t(this)),i.len==0?(n+=$.string(B.substr(e,i.pos,1)),r=i.pos+1):r=i.pos+i.len}while(this.r.global);return!this.r.global&&r>0&&r<e.length&&(n+=$.string(B.substr(e,r,null))),n}static get __name__(){return"EReg"}get __class__(){return Te}};oe.prototype.r=null;var Pr=s.$global,Q=s.global("$hxClasses")["haxe.http.HttpJs"]=class He extends s.inherits(T){[s.new](e){this.async=!0,this.withCredentials=!1,super[s.new](e)}request(e){this.responseAsString=null,this.responseBytes=null,this.responseHeaders=null;let t=this.req=xe.createXMLHttpRequest(),r=this,n=function(u){if(t.readyState!=4)return;let c;try{c=t.status}catch{c=null}if(c==0&&xe.get_supported()&&s.$global.location!=null){let m=s.$global.location.protocol.toLowerCase();new oe("^(?:about|app|app-storage|.+-extension|file|res|widget):$","").match(m)&&(c=t.response!=null?200:404)}if(c==null&&(c=null),c!=null&&r.onStatus(c),c!=null&&c>=200&&c<400){r.req=null;let m=t.getAllResponseHeaders().split(`\r
5
+ `),E=[],g=0,p=m;for(;g<p.length;){let w=p[g];++g,w!=""&&E.push(w)}m=E;let v=new Ve;r.responseHeaders=v;let b=0;for(;b<m.length;){let w=m[b];++b;let q=w.split(": "),O=q.shift(),x=q.length==1?q[0]:q.join(": ");x=J.ltrim(J.rtrim(x)),r.responseHeaders.inst.set(O,x)}r.success(z.ofData(t.response))}else if(c==null||c==0&&t.response==null)r.req=null,r.onError("Failed to connect or resolve host");else if(c==null){r.req=null;let m=t.response!=null?z.ofData(t.response):null;r.responseBytes=m,r.onError("Http Error #"+t.status)}else switch(c){case 12007:r.req=null,r.onError("Unknown host");break;case 12029:r.req=null,r.onError("Failed to connect to host");break;default:r.req=null;let m=t.response!=null?z.ofData(t.response):null;r.responseBytes=m,r.onError("Http Error #"+t.status)}};this.async&&(t.onreadystatechange=n);let i,o=this.postData,a=this.postBytes;if(o==null)if(a==null)i=null;else{let u=a;i=new Blob([u.b.bufferValue])}else a==null?i=o:i=null;if(i!=null)e=!0;else{let u=0,c=this.params;for(;u<c.length;){let m=c[u];++u,i==null?i="":i=(i==null?"null":$.string(i))+"&";let E=m.name,g=(i==null?"null":$.string(i))+encodeURIComponent(E)+"=",p=m.value;i=g+encodeURIComponent(p)}}try{if(e)t.open("POST",this.url,this.async);else if(i!=null){let u=this.url.split("?").length<=1;t.open("GET",this.url+(u?"?":"&")+(i==null?"null":$.string(i)),this.async),i=null}else t.open("GET",this.url,this.async);t.responseType="arraybuffer"}catch(u){let c=k.caught(u).unwrap();this.req=null,this.onError(c.toString());return}t.withCredentials=this.withCredentials,!Oe.exists(this.headers,function(u){return u.name=="Content-Type"})&&e&&this.postData==null&&t.setRequestHeader("Content-Type","application/x-www-form-urlencoded");let y=0,d=this.headers;for(;y<d.length;){let u=d[y];++y,t.setRequestHeader(u.name,u.value)}t.send(i),this.async||n(null)}static get __name__(){return"haxe.http.HttpJs"}static get __super__(){return T}get __class__(){return He}};Q.prototype.async=null;Q.prototype.withCredentials=null;Q.prototype.responseHeaders=null;Q.prototype.req=null;var qr=s.$global,j=s.global("$hxClasses").SimpleFuture=class Le extends s.inherits(){[s.new](){this._isFinished=!1}trigger(e){this._result=e,this._isFinished=!0,this._callback!=null&&this._callback(this._result)}then(e){this._callback=e,this._isFinished&&e(this._result)}static get __name__(){return"SimpleFuture"}get __class__(){return Le}};j.prototype._callback=null;j.prototype._result=null;j.prototype._isFinished=null;var Ar=s.$global,I=s.global("$hxClasses").Reflect=class Ue{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let r;if(e==null)return null;{let n;return e.__properties__?(r=e.__properties__["get_"+t],n=r):n=!1,n?e[r]():e[t]}}static setProperty(e,t,r){let n,i;e.__properties__?(n=e.__properties__["set_"+t],i=n):i=!1,i?e[n](r):e[t]=r}static fields(e){let t=[];if(e!=null){let n=Object.prototype.hasOwnProperty;for(var r in e)r!="__id__"&&r!="hx__closures__"&&n.call(e,r)&&t.push(r)}return t}static get __name__(){return"Reflect"}get __class__(){return Ue}};var Mr=s.$global,l=s.global("$hxClasses")["internal.RecoBackendV2"]=class f extends s.inherits(){[s.new](){}static _requestUri(){return"https://"+f._req_domain+"/api/"+f._environment+"/recommendations/requests"}static noConsentBody(){return{device_id:"no-consent",user_group:"no-consent",version:"no-consent"}}static buildRequestBody(e){let t={lists:e,page_type:f._page_visit!=null?f._page_visit:f._page_view,channel:"www-desktop"};if(f._consent==0){let r=f.noConsentBody(),n=0,i=I.fields(r);for(;n<i.length;){let o=i[n];++n,t[o]=I.field(r,o)}}else f._user_id!=null?t.user_id=f._user_id:t.device_id=f._device_id;return t}static _requestRecos(e){let t=new j,r=null,n=new Q(f._requestUri());n.setHeader("Content-Type","application/json"),n.setPostData(JSON.stringify(f.buildRequestBody(e))),n.onError=function(a){throw k.thrown("HTTP Request Error: "+a)},n.onStatus=function(a){if(a<200||a>=300)throw k.thrown("HTTP Status Error: "+a)};try{n.request(!1)}catch(a){let y=k.caught(a).unwrap();throw k.thrown("Failed to execute synchronous request: "+$.string(y))}let i=function(a){let y=JSON.parse(a),d=W.fromRequestData(y);t.trigger(d)},o=n.get_responseData();return o!=null?i(o):n.onData=i,t}static getRawRecommendations(e){return f._requestRecos(e)}static setConsent(e){e>2&&(e=2),f._consent=e}static setChannel(e){f._channel=e}static setPageVisit(e){f._page_visit=e}static setEnvironment(e){f._environment=e}static setDeviceId(e){f._device_id=e}static setUserId(e){f._user_id=e}static setRequestDomain(e){f._req_domain=e}static setPageView(e){f._page_view=e}static getRequestDomain(){return f._req_domain}static getEnvironment(){return f._environment}static getPageVisit(){return f._page_visit}static getUserId(){return f._user_id}static getDeviceId(){return f._device_id}static getPageView(){return f._page_view}static getConsent(){return f._consent}static getChannel(){return f._channel}static get __name__(){return"internal.RecoBackendV2"}get __class__(){return f}};l._environment=null;l._device_id="no-consent";l._user_id=null;l._consent=0;l._req_domain="europe-west1.froomle.com";l._page_visit=null;l._page_view=null;l._channel="www-desktop";var ze=function(){};ze.__isInterface__=!0;var Qe=function(){};Qe.__isInterface__=!0;var W=s.global("$hxClasses")["internal._RecommendationsInternal"]=class De extends s.inherits(){[s.new](e,t,r,n,i){this.request_id=t,this.user_group=r,this.device_id=e,this.user_id=n,this._lists=i}items(){let e=[],t=0,r=this._lists;for(;t<r.length;){let n=r[t];++t;let i=0,o=n.items;for(;i<o.length;){let a=o[i];++i,e.push(a)}}return e}lists(){return this._lists}getItemsByListName(e){let t=0,r=this._lists;for(;t<r.length;){let n=r[t];if(++t,n.list_name==e)return n}return null}static fromRequestData(e){let t=I.getProperty(e,"lists"),r=[],n=0;for(;n<t.length;){let i=t[n];++n;let o=I.getProperty(i,"items"),a=[],y=0;for(;y<o.length;){let u=o[y];++y,a.push(new ae(u))}let d=new G({limit:I.getProperty(i,"limit"),list_key:I.getProperty(i,"list_key"),list_name:I.getProperty(i,"list_name"),list_size:I.getProperty(i,"list_size"),items:a});r.push(d)}return new De(I.getProperty(e,"device_id"),I.getProperty(e,"request_id"),I.getProperty(e,"user_group"),I.getProperty(e,"user_id"),r)}static get __name__(){return"internal._RecommendationsInternal"}static get __interfaces__(){return[te]}get __class__(){return De}};W.prototype.request_id=null;W.prototype.user_group=null;W.prototype.user_id=null;W.prototype.device_id=null;W.prototype._lists=null;var G=s.global("$hxClasses")["internal._RecommendationsListInternal"]=class je extends s.inherits(){[s.new](e){this.items=e.items,this.limit=e.limit,this.list_key=e.list_key,this.list_name=e.list_name,this.list_size=e.list_size}static get __name__(){return"internal._RecommendationsListInternal"}static get __interfaces__(){return[re]}get __class__(){return je}};G.prototype.limit=null;G.prototype.list_key=null;G.prototype.list_name=null;G.prototype.list_size=null;G.prototype.items=null;var ae=s.global("$hxClasses")["internal._RecommendationItemInternal"]=class Ne extends s.inherits(){[s.new](e){this._data={},this.Id=I.getProperty(e,"item_id"),this.RequestId=I.getProperty(e,"request_id"),this.UserGroup=I.getProperty(e,"user_group");let t=0,r=I.fields(e);for(;t<r.length;){let n=r[t];++t,this._data[n]=I.field(e,n)}}get(e){return this._data[e]}static get __name__(){return"internal._RecommendationItemInternal"}static get __interfaces__(){return[se]}get __class__(){return Ne}};ae.prototype.Id=null;ae.prototype.RequestId=null;ae.prototype.UserGroup=null;ae.prototype._data=null;var C=s.global("$hxClasses")["internal._RecoBackendV2.RecoBackendV2_Fields_"]=class Me{static getRawRecommendations(e){return l.getRawRecommendations(e)}static setConsent(e){l.setConsent(e)}static setPageVisit(e){l.setPageVisit(e)}static setEnvironment(e){l.setEnvironment(e)}static setDeviceId(e){l.setDeviceId(e)}static setUserId(e){l.setUserId(e)}static setRequestDomain(e){l.setRequestDomain(e)}static setPageView(e){l.setPageView(e)}static setChannel(e){l.setChannel(e)}static getRequestDomain(){l.getRequestDomain()}static getConsent(){l.getConsent()}static getPageVisit(){l.getPageVisit()}static getEnvironment(){l.getEnvironment()}static getDeviceId(){l.getDeviceId()}static getUserId(){l.getUserId()}static getPageView(){l.getPageView()}static getChannel(){l.getChannel()}static get __name__(){return"internal._RecoBackendV2.RecoBackendV2_Fields_"}get __class__(){return Me}},Jr=C.getRawRecommendations,Kr=C.setConsent,Xr=C.setPageVisit,zr=C.setEnvironment,Qr=C.setDeviceId,Wr=C.setUserId,Gr=C.setRequestDomain,Yr=C.setPageView,Zr=C.setChannel,es=C.getRequestDomain,ts=C.getConsent,rs=C.getPageVisit,ss=C.getEnvironment,ns=C.getDeviceId,is=C.getUserId,ls=C.getPageView,os=C.getChannel;var gs=s.$global,A=s.global("$hxClasses").FroomleSdk=class V{static register(){V.registered||V._env_set&&(!V._page_visit_set&&!V._page_view_set||(V.registered=!0))}static buildScriptTag(){let e='<script src="https://cdn.froomle.com/reco-backend-v2/0.0.9/reco-backend-v2.min.js" data-froomle-env="'+l.getEnvironment()+'" ';return l.getPageVisit()!=null&&(e+='data-froomle-page-visit="'+l.getPageVisit()+'" '),l.getPageView()!=null&&(e+='data-froomle-page-view="'+l.getPageView()+'" '),l.getDeviceId()!=null&&(e+='data-froomle-device-id="'+l.getDeviceId()+'" '),l.getUserId()!=null&&(e+='data-froomle-user-id="'+l.getUserId()+'" '),l.getConsent()>0&&(e+='data-froomle-consent="'+l.getConsent()+'" '),l.getRequestDomain()!=null&&(e+='data-froomle-request-domain="'+l.getRequestDomain()+'" '),e+="><\/script>",e}static setEnvironment(e){l.setEnvironment(e),V._env_set=!0,V.register()}static setDeviceId(e){l.setDeviceId(e)}static setUserId(e){l.setUserId(e)}static setConsent(e){l.setConsent(e)}static setPageView(e){l.setPageView(e),V._page_view_set=!0,V.register()}static setPageVisit(e){l.setPageVisit(e),V._page_visit_set=!0,V.register()}static setRequestDomain(e){l.setRequestDomain(e)}static getRawRecommendations(e){return l.getRawRecommendations(e)}static getVersion(){return"0.0.9"}static get __name__(){return"FroomleSdk"}get __class__(){return V}};A._env_set=!1;A._page_visit_set=!1;A._page_view_set=!1;A.registered=!1;var ps=s.$global,Y=s.global("$hxClasses")["internal.domHandler.FroomleDomTree"]=class fe extends s.inherits(){[s.new](){}createElement(e){return window.document.createElement(e)}querySelectorAll(e){let t=this.root,r=[],n=t.querySelectorAll(e),i=0,o=n.length;for(;i<o;){let a=i++;r.push(n.item(a))}return r}getRoot(){return this.root}toString(){return this.root.outerHTML}static run(){}static fromHtml(e){return new fe}static fromDocument(){let e=new fe;return e.root=window.document,e}static get __name__(){return"internal.domHandler.FroomleDomTree"}get __class__(){return fe}};Y.prototype.root=null;var fs=s.$global,L=s.global("$hxClasses")["internal._ADomNode.ADomNode"]=class ke{static _new(e){return e}static fromElement(e){return e}static create(e,t){return window.document.createElement(t)}static replaceChild(e,t,r){e.replaceChild(t,r)}static get attributes(){return this.get_attributes()}static get_attributes(e){let t=e,r=[],n=0,i=t.attributes.length;for(;n<i;){let o=n++,a=t.attributes.item(o);r.push({name:a.name,value:a.value})}return r}static addChild(e,t){e.appendChild(t)}static removeChild(e,t){e.removeChild(t)}static getAttribute(e,t){return e.getAttribute(t)}static setAttribute(e,t,r){e.setAttribute(t,r)}static getText(e){return e.textContent}static setText(e,t){e.textContent=t}static get children(){return this.get_children()}static get_children(e){let t=[],n=e.children,i=0,o=n.length;for(;i<o;){let a=i++;t.push(n[a])}return t}static querySelectorAll(e,t){let r=e,n=[],i=r.querySelectorAll(t),o=0,a=i.length;for(;o<a;){let y=o++;n.push(i.item(y))}return n}static getFilterKeyValue(e){let t=0,r=ke.get_attributes(e);for(;t<r.length;){let n=r[t];if(++t,n.name.startsWith("data-froomle-reco-filter-"))return{key:n.name.substring(25),value:n.value}}return{key:null,value:null}}static get __name__(){return"internal._ADomNode.ADomNode_Impl_"}get __class__(){return ke}};var Ps=s.$global,ue=s.global("$hxClasses")["internal.domHandler.DomDomDom"]=class K extends s.inherits(){[s.new](){}static _fillRecoTargets(e){let t=new j;if(e==null)return t.trigger(!1),t;let r=[],n=e,i=[],o=n.querySelectorAll("*"),a=0,y=o.length;for(;a<y;){let h=a++;i.push(o.item(h))}let d=i,u=0;for(;u<d.length;){let h=d[u];++u;let D=0,R=L.get_attributes(h);for(;D<R.length;){let M=R[D];++D,M.name=="data-froomle-reco"&&r.push(h)}}let c=[],m=0;for(;m<r.length;){let h=r[m];++m,h.getAttribute("data-froomle-request-id")==null&&(h.getAttribute("data-froomle-id")==null||h.getAttribute("data-froomle-id")=="")&&c.push(h)}if(c.length<1)return new j;let E=[],g=[],p="",v="",b="",w=[],q=function(){let h={list_name:p,list_size:w.length,limit:w.length};v!=null&&I.setProperty(h,v,b),E.push(h),g.push(w)},O=function(h,D,R,M){p=h,v=D,b=R,w=[M]},x=0;for(;x<c.length;){let h=c[x];++x;let D=h.getAttribute("data-froomle-reco"),R=L.getFilterKeyValue(h);if(p==""){O(D,R.key,R.value,h);continue}else if(D==p&&R.key==v&&R.value==b){w.push(h);continue}else{q(),O(D,R.key,R.value,h);continue}}return p!=""&&q(),C.getRawRecommendations(E).then(function(h){let D=0,R=h.lists();for(;D<R.length;){let M=R[D],N=D++,U=M,X=U.items.length!=g[N].length,ee=0,ye=U.items;for(;ee<ye.length;){let be=ye[ee],Ke=ee++,Xe=be;K._fillParameters(g[N][Ke],Xe,h.request_id)}}t.trigger(!0)}),t}static _fillParameters(e,t,r){let n=function(m,E,g,p){p==null&&(p="");let v=function(b,w,q){q==null&&(q="fgh");try{w=new oe("\\\\[(\\\\w+)\\\\]","g").map(w,function(R){return"."+R.matched(1)}),w=J.replace(w,"[","."),w=J.replace(w,"]",""),B.cca(w,0)==46&&(w=B.substr(w,1,null));let x=w.split("."),S=b.get(x[0]),h=1,D=x.length;for(;h<D;){let R=h++;if(S==null)return null;S instanceof Array&&$.parseInt(x[R])!=null?S=S[$.parseInt(x[R])]:S=I.field(S,x[R])}return S}catch{return q}};try{let b=v(t,g,p);E=="inner"?m.textContent=b:m.setAttribute(E,b)}catch{}};e.setAttribute("data-froomle-id",t.Id),e.setAttribute("data-froomle-request-id",r);let i=e,o=[],a=i.querySelectorAll("*"),y=0,d=a.length;for(;y<d;){let m=y++;o.push(a.item(m))}let u=o,c=0;for(;c<u.length;){let m=u[c];++c;let E=0,g=L.get_attributes(m);for(;E<g.length;){let p=g[E];if(++E,p.name.startsWith("data-froomle-param-")){let v=J.replace(p.name,"data-froomle-param-",""),b=p.value;n(m,v,b)}}}}static _orderElements(e){let t=function(g,p,v){let b=[],w=L.get_children(g),q=0;for(;q<w.length;){let S=w[q];if(++q,S.getAttribute("data-froomle-ordervalue")!=null){b.push(S);let D=L.create(e,"span");D.setAttribute("data-froomle-tmp-node",""),L.replaceChild(g,D,S)}}let O=[],x=0;for(;x<b.length;){let S=b[x];++x,O.push(S.getAttribute("data-froomle-ordervalue"))}return{el:g,key:p,values:O,orderChildren:b,list_name:v}},r=new j,n=e.getRoot(),i=[],o=n.querySelectorAll("*"),a=0,y=o.length;for(;a<y;){let g=a++;i.push(o.item(g))}let d=i,u=[],c=0;for(;c<d.length;){let g=d[c];++c;let p=0,v=L.get_attributes(g);for(;p<v.length;){let b=v[p];++p,b.name.startsWith("data-froomle-order-")&&u.push(t(g,b.name.substring(19),b.value))}}if(u.length<1)return r.trigger(!1),r;let m=[],E=0;for(;E<u.length;){let g=u[E];++E;let p={list_name:g.list_name,limit:g.values.length,list_size:g.values.length},v={};I.setProperty(v,g.key,g.values),I.setProperty(p,"order",v),m.push(p)}return C.getRawRecommendations(m).then(function(g){let p=0,v=g.lists();for(;p<v.length;){let b=v[p],q=p++,O=b,x=u[q];x.el.setAttribute("data-froomle-request-id",g.request_id);let S=[],h=0,D=O.items;for(;h<D.length;){let _e=D[h];++h;let N=_e.get(x.key),U=0,X=x.values;for(;U<X.length;){let ee=X[U],be=U++;if(N==ee){S.push(x.orderChildren[be]);break}}}let R=0,M=S.length;for(;R<M;){let _e=R++,N=0,U=L.get_children(x.el);for(;N<U.length;){let X=U[N];if(++N,X.getAttribute("data-froomle-tmp-node")==""){L.replaceChild(x.el,S[_e],X);break}}}}r.trigger(!0)}),r}static domInit(e){K._orderElements(e).then(function(t){K._fillRecoTargets(e.getRoot())})}static fillElementRecos(e){K._fillRecoTargets(e)}static runFromHtml(e){if(e=="")return"";let t=Y.fromHtml(e);return K.domInit(t),t.toString()}static get __name__(){return"internal.domHandler.DomDomDom"}get __class__(){return K}};var qs=s.$global;var P=class P{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e=[];for(let t of P.impressionQueue){let r={event_type:"impression",page_type:l.getPageVisit(),action_item:t.getAttribute("data-froomle-id"),action_item_type:"article",channel:"www-desktop"};l.getUserId()?r.user_id=l.getUserId():r.device_id=l.getDeviceId();let n=t.getAttribute("data-froomle-reco");if(n){r.list_name=n;let i=t.getAttribute("data-froomle-request-id");if(!i)throw console.error("element need reco but doesnt have request id registered yet"),new Error("element need reco but doesnt have request id registered");r.request_id=i}}return P.impressionQueue=[],JSON.stringify({events:e})}static sendImpressions(){P.impressionQueue.length!==0&&fetch(P.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:P.generateBody()})}static getViewPortRect(){let e=window.innerWidth||document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{left:0,top:0,x:0,y:0,toJSON(){},right:e,bottom:t,width:e,height:t}}static intersectsWithViewPortRect(e){let t=e.getBoundingClientRect(),r=P.getViewPortRect();return t.right>r.left&&t.left<r.right&&t.bottom>r.top&&t.top<r.bottom}static addIntersectionImpressionListener(e){P.observer.observe(e)}static processDocument(){if(l.getDeviceId()!="no-consent"){for(let e of document.querySelectorAll("[data-froomle-id]"))P.intersectsWithViewPortRect(e)?P.impressionQueue.push(e):P.addIntersectionImpressionListener(e);P.sendImpressions()}}};P.impressionQueue=[],P.observer=new IntersectionObserver((e,t)=>{e.forEach(r=>{r.isIntersecting&&(P.impressionQueue.push(r.target),P.observer.unobserve(r.target))}),P.impressionQueue.length>0&&P.sendImpressions()});var Z=P;var ce=class _{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e={event_type:"page_visit",page_type:l.getPageVisit(),channel:"www-desktop"};return l.getUserId()?e.user_id=l.getUserId():e.device_id=l.getDeviceId(),JSON.stringify(e)}static sendPageVisit(){l.getPageVisit()&&l.getDeviceId()!="no-consent"&&fetch(_.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:_.generateBody()})}};var ge=class _{static uri(){return"https://"+l.getRequestDomain()+"/api/"+l.getEnvironment()+"/events"}static generateBody(){let e={event_type:"detail_pageview",page_type:"article_detail",action_item:l.getPageView(),action_item_type:"article",channel:"www-desktop"};return l.getUserId()?e.user_id=l.getUserId():e.device_id=l.getDeviceId(),JSON.stringify(e)}static sendPageView(){l.getPageView()&&l.getDeviceId()!="no-consent"&&fetch(_.uri(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:_.generateBody()})}};var We=A.setEnvironment,Ge=A.setPageVisit,Zs=A.setConsent,Ye=A.setUserId,Ze=A.setDeviceId,et=A.setRequestDomain,tt=A.setPageView;if(typeof document!="undefined"){let _=document.currentScript;if(_){let e=_.getAttribute("data-froomle-device-id"),t=_.getAttribute("data-froomle-user-id"),r=_.getAttribute("data-froomle-env"),n=_.getAttribute("data-froomle-page-visit"),i=_.getAttribute("data-froomle-request-domain"),o=_.getAttribute("data-froomle-page-view");We(r),o&&tt(o),n&&Ge(n),e&&Ze(e),t&&Ye(t),i&&et(i)}else console.error("Froomle SDK: could not find the script tag where the sdk is included.");document.addEventListener("DOMContentLoaded",()=>{ue.domInit(Y.fromDocument()),Z.processDocument(),ce.sendPageVisit(),ge.sendPageView(),new MutationObserver(t=>{for(let r of t)if(r.type==="childList"&&Z.processElement(r.target),r.type==="attributes")if(r.attributeName==="data-froomle-reco"){let n=r.target.getAttribute("data-froomle-request-id");(!n||n==="")&&ue.fillElementRecos(r.target)}else r.attributeName==="data-froomle-request-id"&&ue.fillElementRecos(r.target)}).observe(document,{childList:!0,subtree:!0})})}export{se as RecommendationItem,re as RecommendationList,te as Recommendations,Zs as setConsent,Ze as setDeviceId,We as setEnvironment,Ge as setPageVisit,et as setRequestDomain,Ye as setUserId};