@froomle/frontend-sdk 0.0.18 → 0.0.19

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.
package/dist/index.d.ts CHANGED
@@ -1,190 +1,24 @@
1
- import { R as Recommendations, a as RecommendationItem } from './Recommendations.d-HGeAMYU5.js';
2
- export { b as RecommendationList } from './Recommendations.d-HGeAMYU5.js';
1
+ import { C as Recommendations, S as RecommendationList, a as setContextItem, c as setDeviceId, d as setRequestDomain, f as setSafeRequest, i as setConsent, l as setEnvironment, n as getRecommendations, o as setContextItemType, p as setUserId, r as setChannel, s as setCustomVariable, t as addHistories, u as setPageVisit, v as sendEvent, x as RecommendationItem } from "./js-FtOpub-e.js";
3
2
 
3
+ //#region src/js/generated/internal/data/FroomleTuple.d.ts
4
4
  type FroomleTuple = {
5
- key: string,
6
- value: any
7
- }
8
-
5
+ key: string;
6
+ value: any;
7
+ };
8
+ //#endregion
9
+ //#region src/js/generated/internal/data/RecoRequest.d.ts
9
10
  type RecoRequest = {
10
- filters: {
11
- key: string,
12
- value: string
13
- }[],
14
- list: string,
15
- others?: null | FroomleTuple[]
16
- }
17
-
18
- type HistoryEntry = {
19
- id: string,
20
- item_type: string
21
- }
22
-
23
- type HistoryEntryInput = {
24
- id: string,
25
- itemType?: null | string,
26
- item_type?: null | string
27
- }
28
-
29
- type HistoryInput = string | HistoryEntryInput
30
-
31
- declare class RecoBackendV2 {
32
- constructor()
33
- protected static _environment: string
34
- protected static _device_id: string
35
- protected static _user_id: string
36
- protected static _consent: number
37
- protected static _req_domain: string
38
- protected static _page_visit: string
39
- protected static _channel: string
40
- protected static _safe_request: boolean
41
- protected static _history: HistoryEntry[]
42
- protected static _others: FroomleTuple[]
43
- protected static _requestUri(): string
44
- protected static noConsentBody(): any
45
- protected static buildRequestBody(lists: {
46
- limit: number,
47
- list_name: string,
48
- list_size: number
49
- }[]): any
50
- protected static _buildHistories(): {
51
- pageviews: HistoryEntry[]
52
- }
53
- static requestsToLists(requests: RecoRequest[]): {
54
- limit: number,
55
- list_name: string,
56
- list_size: number
57
- }[]
58
- protected static _requestRecos(lists: {
59
- limit: number,
60
- list_name: string,
61
- list_size: number
62
- }[]): Promise<Recommendations>
63
- static getOrder(list: string, category: string, values: string[]): Promise<string[]>
64
- static getRawRecommendations(lists: {
65
- limit: number,
66
- list_name: string,
67
- list_size: number
68
- }[]): Promise<Recommendations>
69
- static addHistories(hists: HistoryInput[], defaultItemType?: null | string): void
70
- static setOthers(key: string, value: any): void
71
- static setConsent(consent: number): void
72
- static setChannel(channel: string): void
73
- static setPageVisit(page: string): void
74
- static setEnvironment(env: string): void
75
- static setDeviceId(id: string): void
76
- static setUserId(id: string): void
77
- static setRequestDomain(domain: string): void
78
- static setSafeRequest(safe: boolean): void
79
- static setContextItem(id: string): void
80
- static setContextItemType(type: string): void
81
- static getRequestDomain(): string
82
- static getSafeRequest(): boolean
83
- static getEnvironment(): string
84
- static getPageVisit(): string
85
- static getUserId(): string
86
- static getDeviceId(): string
87
- static getConsent(): number
88
- static getChannel(): string
89
- static getOthers(key: string): any
90
- static getContextItem(): string
91
- static getContextItemType(): string
92
- }
93
-
94
- declare class FroomleSdk {
95
- protected static _env_set: boolean
96
- protected static _page_visit_set: boolean
97
- protected static registered: boolean
98
-
99
- /**
100
- Internal registration logic
101
- */
102
- protected static register(): void
103
-
104
- /**
105
- Build <script> tag
106
- */
107
- static buildScriptTag(): string
108
- static setEnvironment(env: string): void
109
- static setDeviceId(id: string): void
110
- static setUserId(id: string): void
111
- static setConsent(consent: number): void
112
- static setPageVisit(page: string): void
113
- static setChannel(channel: string): void
114
- static setRequestDomain(domain: string): void
115
- static setSafeRequest(safe: boolean): void
116
- static setContextItem(id: string): void
117
- static setContextItemType(type: string): void
118
- static setCustomVariable(key: string, value: any): void
119
- static getUserId(): string
120
- static getDeviceId(): string
121
- static getEnvironment(): string
122
- static getSafeRequest(): boolean
123
- static getPageVisit(): string
124
- static getConsent(): number
125
- static getRecommendations(lists: {
126
- limit: number,
127
- list_name: string,
128
- list_size: number
129
- }[]): Promise<Recommendations>
130
- static getChannel(): string
131
- static getVersion(): string
132
- static runFromHtml(input: string): string
133
- }
134
-
135
- declare function sendEvent(action_item: string, action_item_type: string, event_type?: string, extras?: {
136
- [key: string]: string | number | object;
137
- }): void;
138
-
139
- type RecoListRequest = {
140
- limit: number;
141
- list_name: string;
142
- list_size: number;
143
- [key: string]: unknown;
11
+ filters: {
12
+ key: string;
13
+ value: string;
14
+ }[];
15
+ list: string;
16
+ others?: null | FroomleTuple[];
144
17
  };
145
-
146
- declare const setPageVisit: typeof FroomleSdk.setPageVisit;
147
- declare const setEnvironment: typeof FroomleSdk.setEnvironment;
148
- /**
149
- * @param {number} consent
150
- */
151
- declare function setConsent(consent: number): void;
152
- /**
153
- * @param {string} userId
154
- */
155
- declare function setUserId(userId: string): void;
156
- /**
157
- * @param {string} deviceId
158
- */
159
- declare function setDeviceId(deviceId: string): void;
160
- declare const setRequestDomain: typeof FroomleSdk.setRequestDomain;
161
- declare const setSafeRequest: typeof FroomleSdk.setSafeRequest;
162
- declare const setChannel: typeof FroomleSdk.setChannel;
163
- declare const setContextItem: typeof FroomleSdk.setContextItem;
164
- declare const setContextItemType: typeof FroomleSdk.setContextItemType;
165
- /**
166
- * @typedef {{
167
- * limit: number,
168
- * list_name: string,
169
- * list_size: number,
170
- * [key: string]: unknown
171
- * }} RecoListRequest
172
- */
173
- /**
174
- * @param {string} key
175
- * @param {unknown} value
176
- */
177
- declare function setCustomVariable(key: string, value: unknown): void;
178
-
179
- /**
180
- * @param {RecoListRequest[]} lists
181
- * @returns {Promise<Recommendations>}
182
- */
183
- declare function getRecommendations(lists: RecoListRequest[]): Promise<Recommendations>;
184
-
185
- declare const addHistories: typeof RecoBackendV2.addHistories;
18
+ //#endregion
19
+ //#region src/framework/RecoRequest.d.ts
186
20
 
187
21
  declare function fulfillRecommendations(): Promise<void>;
188
22
  declare function proxyReco(req: RecoRequest): RecommendationItem & PromiseLike<RecommendationItem>;
189
-
190
- export { RecommendationItem, Recommendations, addHistories, fulfillRecommendations, getRecommendations, proxyReco, sendEvent, setChannel, setConsent, setContextItem, setContextItemType, setCustomVariable, setDeviceId, setEnvironment, setPageVisit, setRequestDomain, setSafeRequest, setUserId };
23
+ //#endregion
24
+ export { RecommendationItem, RecommendationList, Recommendations, addHistories, fulfillRecommendations, getRecommendations, proxyReco, sendEvent, setChannel, setConsent, setContextItem, setContextItemType, setCustomVariable, setDeviceId, setEnvironment, setPageVisit, setRequestDomain, setSafeRequest, setUserId };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a,b,c,e as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q,w as r,x as s}from"./chunk-GJPFNIOF.js";export{c as RecommendationItem,b as RecommendationList,a as Recommendations,l as addHistories,r as fulfillRecommendations,q as getRecommendations,s as proxyReco,d as sendEvent,i as setChannel,p as setConsent,j as setContextItem,k as setContextItemType,m as setCustomVariable,o as setDeviceId,e as setEnvironment,f as setPageVisit,g as setRequestDomain,h as setSafeRequest,n as setUserId};
1
+ import{C as e,S as t,a as n,c as r,d as i,f as a,i as o,l as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m,v as h,x as g}from"./js-FtOpub-e.js";import{n as _,t as v}from"./src-6IU8XQgM.js";export{g as RecommendationItem,t as RecommendationList,e as Recommendations,p as addHistories,v as fulfillRecommendations,c as getRecommendations,_ as proxyReco,h as sendEvent,d as setChannel,o as setConsent,n as setContextItem,l as setContextItemType,f as setCustomVariable,r as setDeviceId,s as setEnvironment,m as setPageVisit,i as setRequestDomain,a as setSafeRequest,u as setUserId};
@@ -0,0 +1,5 @@
1
+ var e=class e{static global(t){return e.globals[t]?e.globals[t]:e.globals[t]={}}static createStatic(e,t,n){let r=null;Object.defineProperty(e,t,{enumerable:!0,get:function(){return n!=null&&(r=n(),n=null),r},set:function(e){n!=null&&(r=n(),n=null),r=e}})}static iterator(t){if(Array.isArray(t)){let n=t;return function(){return e.mkIter(n)}}else return typeof t.iterator==`function`?t.iterator.bind(t):t.iterator}static getIterator(t){return Array.isArray(t)?e.mkIter(t):t.iterator()}static mkIter(e){return new t(e)}static extend(t){function n(){this[e.new].apply(this,arguments)}return Object.setPrototypeOf(n.prototype,t.prototype),n}static inherits(t,n){n==null&&(n=!1);function r(){n&&t&&r[e.init]&&r[e.init](),this[e.new].apply(this,arguments)}return n?r[e.init]=()=>{let n=t();n[e.init]&&n[e.init](),Object.setPrototypeOf(r.prototype,n.prototype),r[e.init]=void 0}:t&&t[e.init]?(n=!0,r[e.init]=()=>{t[e.init]&&t[e.init](),Object.setPrototypeOf(r.prototype,t.prototype),r[e.init]=void 0}):t&&Object.setPrototypeOf(r.prototype,t.prototype),r}static bind(t,n){if(n==null)return null;n.__id__==null&&(n.__id__=e.fid++);let r=null;return t.hx__closures__==null?t.hx__closures__={}:r=t.hx__closures__[n.__id__],r==null&&(r=n.bind(t),t.hx__closures__[n.__id__]=r),r}static get __name__(){return`genes.Register`}get __class__(){return e}};e.$global=typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:void 0,e.globals={},e.new=Symbol(),e.init=Symbol(),e.fid=0;const t=e.global(`$hxClasses`)[`genes._Register.ArrayIterator`]=class t extends e.inherits(){[e.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 t}};t.prototype.array=null,t.prototype.current=null,e.$global;const n=e.global(`$hxClasses`)[`haxe.ValueException`]=class t extends e.inherits(()=>r,!0){[e.new](t,n,r){super[e.new](String(t),n,r),this.value=t}unwrap(){return this.value}static get __name__(){return`haxe.ValueException`}static get __super__(){return r}get __class__(){return t}};n.prototype.value=null,e.$global;const r=e.global(`$hxClasses`)[`haxe.Exception`]=class t extends e.inherits(()=>Error,!0){[e.new](e,t,n){Error.call(this,e),this.message=e,this.__previousException=t,this.__nativeException=n==null?this:n}unwrap(){return this.__nativeException}get_native(){return this.__nativeException}static caught(e){return e instanceof t?e:e instanceof Error?new t(e.message,null,e):new n(e,null,e)}static thrown(e){return e instanceof t?e.get_native():e instanceof Error?e:new n(e)}static get __name__(){return`haxe.Exception`}static get __super__(){return Error}get __class__(){return t}};r.prototype.native=null,r.prototype.__skipStack=null,r.prototype.__nativeException=null,r.prototype.__previousException=null,e.$global;const i=e.global(`$hxClasses`).Std=class e{static string(e){return a.__string_rec(e,``)}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}static random(e){return e<=0?0:Math.floor(Math.random()*e)}static get __name__(){return`Std`}get __class__(){return e}};Object.defineProperty(String.prototype,`__class__`,{value:String,enumerable:!1,writable:!0}),String.__name__=!0,Array.__name__=!0,e.$global;const a=e.global(`$hxClasses`)[`js.Boot`]=class t{static getClass(e){if(e==null)return null;if(e instanceof Array)return Array;{let n=e.__class__;if(n!=null)return n;let r=t.__nativeClassName(e);return r==null?null:t.__resolveNativeClass(r)}}static __string_rec(n,r){if(n==null)return`null`;if(r.length>=5)return`<...>`;let i=typeof n;switch(i==`function`&&(n.__name__||n.__ename__)&&(i=`object`),i){case`function`:return`<function>`;case`object`:if(n.__enum__){let i=e.global(`$hxEnums`)[n.__enum__].__constructs__[n._hx_index],a=i._hx_name;return i.__params__?(r+=` `,a+`(`+(function(e){var a;let o=[];{let e=0,a=i.__params__;for(;e<a.length;){let i=a[e];e+=1,o.push(t.__string_rec(n[i],r))}}return a=o,a})(this).join(`,`)+`)`):a}if(n instanceof Array){let e=`[`;r+=` `;let i=0,a=n.length;for(;i<a;){let a=i++;e+=(a>0?`,`:``)+t.__string_rec(n[a],r)}return e+=`]`,e}let i;try{i=n.toString}catch{return`???`}if(i!=null&&i!=Object.toString&&typeof i==`function`){let e=n.toString();if(e!=`[object Object]`)return e}let a=`{
2
+ `;r+=` `;let o=n.hasOwnProperty!=null,s=null;for(s in n)o&&!n.hasOwnProperty(s)||s==`prototype`||s==`__class__`||s==`__super__`||s==`__interfaces__`||s==`__properties__`||(a.length!=2&&(a+=`,
3
+ `),a+=r+s+` : `+t.__string_rec(n[s],r));return r=r.substring(1),a+=`
4
+ `+r+`}`,a;case`string`:return n;default:return String(n)}}static __interfLoop(e,n){if(e==null)return!1;if(e==n)return!0;let r=e.__interfaces__;if(r!=null&&(e.__super__==null||e.__super__.__interfaces__!=r)){let e=0,i=r.length;for(;e<i;){let i=r[e++];if(i==n||t.__interfLoop(i,n))return!0}}return t.__interfLoop(e.__super__,n)}static __instanceof(n,r){if(r==null)return!1;switch(r){case Array:return n instanceof Array;case`$hxCoreType__Bool`:return typeof n==`boolean`;case`$hxCoreType__Dynamic`:return n!=null;case`$hxCoreType__Float`:return typeof n==`number`;case`$hxCoreType__Int`:return typeof n==`number`?(n|0)===n:!1;case String:return typeof n==`string`;default:if(n!=null){if(typeof r==`function`){if(t.__downcastCheck(n,r))return!0}else if(typeof r==`object`&&t.__isNativeObj(r)&&n instanceof r)return!0}else return!1;return r==`$hxCoreType__Class`&&n.__name__!=null||r==`$hxCoreType__Enum`&&n.__ename__!=null?!0:n.__enum__==null?!1:e.global(`$hxEnums`)[n.__enum__]==r}}static __downcastCheck(e,n){return e instanceof n?!0:n.__isInterface__?t.__interfLoop(t.getClass(e),n):!1}static __cast(e,n){if(e==null||t.__instanceof(e,n))return e;throw r.thrown(`Cannot cast `+i.string(e)+` to `+i.string(n))}static __nativeClassName(e){let n=t.__toStr.call(e).slice(8,-1);return n==`Object`||n==`Function`||n==`Math`||n==`JSON`?null:n}static __isNativeObj(e){return t.__nativeClassName(e)!=null}static __resolveNativeClass(t){return e.$global[t]}static get __name__(){return`js.Boot`}get __class__(){return t}};a.__toStr={}.toString,e.$global;const o=e.global(`$hxClasses`)[`js.Browser`]=class e{static get supported(){return this.get_supported()}static get_supported(){return typeof window<`u`&&window.location!==void 0?typeof window.location.protocol==`string`:!1}static createXMLHttpRequest(){if(typeof XMLHttpRequest<`u`)return new XMLHttpRequest;if(typeof ActiveXObject<`u`)return new`ActiveXObject`(`Microsoft.XMLHTTP`);throw r.thrown(`Unable to create XMLHttpRequest object.`)}static get __name__(){return`js.Browser`}get __class__(){return e}};e.$global;const s=e.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(e=>({_hx_index:3,__enum__:`haxe.io.Error`,e}),{_hx_name:`Custom`,__params__:[`e`]})};s.__constructs__=[s.Blocked,s.Overflow,s.OutsideBounds,s.Custom],s.__empty_constructs__=[s.Blocked,s.Overflow,s.OutsideBounds],e.$global;const c=e.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`}};c.__constructs__=[c.UTF8,c.RawNative],c.__empty_constructs__=[c.UTF8,c.RawNative],e.$global;const l=e.global(`$hxClasses`)[`haxe.io.Bytes`]=class t extends e.inherits(){[e.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,n){if(e<0||t<0||e+t>this.length)throw r.thrown(s.OutsideBounds);n==null&&(n=c.UTF8);let i=``,a=this.b,o=e,l=e+t;switch(n._hx_index){case 0:for(;o<l;){let e=a[o++];if(e<128){if(e==0)break;i+=String.fromCodePoint(e)}else if(e<224){let t=(e&63)<<6|a[o++]&127;i+=String.fromCodePoint(t)}else if(e<240){let t=a[o++],n=(e&31)<<12|(t&127)<<6|a[o++]&127;i+=String.fromCodePoint(n)}else{let t=a[o++],n=a[o++],r=(e&15)<<18|(t&127)<<12|(n&127)<<6|a[o++]&127;i+=String.fromCodePoint(r)}}break;case 1:for(;o<l;){let e=a[o++]|a[o++]<<8;i+=String.fromCodePoint(e)}break}return i}static ofData(e){let n=e.hxBytes;return n==null?new t(e):n}static get __name__(){return`haxe.io.Bytes`}get __class__(){return t}};l.prototype.length=null,l.prototype.b=null,e.$global;const u=e.global(`$hxClasses`)[`haxe.http.HttpBase`]=class t extends e.inherits(){[e.new](t){this.url=t,this.headers=[],this.params=[],this.emptyOnData=e.bind(this,this.onData)}get responseData(){return this.get_responseData()}setHeader(e,t){let n=0,r=this.headers.length;for(;n<r;){let r=n++;if(this.headers[r].name==e){this.headers[r]={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 e.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,c.UTF8)),this.responseAsString}static get __name__(){return`haxe.http.HttpBase`}get __class__(){return t}};u.prototype.url=null,u.prototype.responseBytes=null,u.prototype.responseAsString=null,u.prototype.postData=null,u.prototype.postBytes=null,u.prototype.headers=null,u.prototype.params=null,u.prototype.emptyOnData=null,e.$global;const d=e.global(`$hxClasses`)[`haxe.iterators.MapKeyValueIterator`]=class t extends e.inherits(){[e.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 t}};d.prototype.map=null,d.prototype.keys=null,e.$global;const f=function(){};f.__isInterface__=!0,e.$global;const p=e.global(`$hxClasses`)[`genes.util.EsMap`]=class t extends e.inherits(){[e.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 t.adaptIterator(this.inst.keys())}iterator(){return t.adaptIterator(this.inst.values())}toString(){let e=[],n=t.adaptIterator(this.inst.keys());for(;n.hasNext();){let t=n.next();e.push(``+i.string(t)+` => `+i.string(this.inst.get(t)))}return`{`+e.join(`, `)+`}`}clear(){this.inst.clear()}static adaptIterator(e){let t,n,r=function(){let r=e.next();t=r.value,n=r.done};return{hasNext:function(){return n==null&&r(),!n},next:function(){n==null&&r();let e=t;return r(),e}}}static get __name__(){return`genes.util.EsMap`}get __class__(){return t}};p.prototype.inst=null,e.$global;const m=e.global(`$hxClasses`)[`haxe.ds.StringMap`]=class t extends e.inherits(p){[e.new](){super[e.new]()}copy(){let e=new t;return e.inst=new Map(this.inst),e}keyValueIterator(){return new d(this)}static get __name__(){return`haxe.ds.StringMap`}static get __interfaces__(){return[f]}static get __super__(){return p}get __class__(){return t}};e.$global;const h=e.global(`$hxClasses`).HxOverrides=class e{static cca(e,t){let n=e.charCodeAt(t);if(n==n)return n}static substr(e,t,n){if(n==null)n=e.length;else if(n<0)if(t==0)n=e.length+n;else return``;return e.substr(t,n)}static now(){return Date.now()}static get __name__(){return`HxOverrides`}get __class__(){return e}};typeof performance<`u`&&typeof performance.now==`function`&&(h.now=performance.now.bind(performance)),e.$global;const g=e.global(`$hxClasses`).StringTools=class e{static isSpace(e,t){let n=h.cca(e,t);return n>8&&n<14?!0:n==32}static ltrim(t){let n=t.length,r=0;for(;r<n&&e.isSpace(t,r);)++r;return r>0?h.substr(t,r,n-r):t}static rtrim(t){let n=t.length,r=0;for(;r<n&&e.isSpace(t,n-r-1);)++r;return r>0?h.substr(t,0,n-r):t}static replace(e,t,n){return e.split(t).join(n)}static get __name__(){return`StringTools`}get __class__(){return e}};e.$global;const _=e.global(`$hxClasses`).Lambda=class t{static exists(t,n){let r=e.getIterator(t);for(;r.hasNext();)if(n(r.next()))return!0;return!1}static get __name__(){return`Lambda`}get __class__(){return t}};e.$global;const v=e.global(`$hxClasses`).EReg=class t extends e.inherits(){[e.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 r.thrown(`EReg::matched`)}matchedPos(){if(this.r.m==null)throw r.thrown(`No string matched`);return{pos:this.r.m.index,len:this.r.m[0].length}}matchSub(e,t,n){if(n==null&&(n=-1),this.r.global){this.r.lastIndex=t,this.r.m=this.r.exec(n<0?e:h.substr(e,0,t+n));let r=this.r.m!=null;return r&&(this.r.s=e),r}else{let r=this.match(n<0?h.substr(e,t,null):h.substr(e,t,n));return r&&(this.r.s=e,this.r.m.index+=t),r}}map(e,t){let n=0,r=``;do{if(n>=e.length)break;if(!this.matchSub(e,n)){r+=i.string(h.substr(e,n,null));break}let a=this.matchedPos();r+=i.string(h.substr(e,n,a.pos-n)),r+=i.string(t(this)),a.len==0?(r+=i.string(h.substr(e,a.pos,1)),n=a.pos+1):n=a.pos+a.len}while(this.r.global);return!this.r.global&&n>0&&n<e.length&&(r+=i.string(h.substr(e,n,null))),r}static get __name__(){return`EReg`}get __class__(){return t}};v.prototype.r=null,e.$global;const y=e.global(`$hxClasses`)[`haxe.http.HttpJs`]=class t extends e.inherits(u){[e.new](t){this.async=!0,this.withCredentials=!1,super[e.new](t)}request(t){this.responseAsString=null,this.responseBytes=null,this.responseHeaders=null;let n=this.req=o.createXMLHttpRequest(),a=this,s=function(t){if(n.readyState!=4)return;let r;try{r=n.status}catch{r=null}if(r==0&&o.get_supported()&&e.$global.location!=null){let t=e.$global.location.protocol.toLowerCase();new v(`^(?:about|app|app-storage|.+-extension|file|res|widget):$`,``).match(t)&&(r=n.response==null?404:200)}if(r==null&&(r=null),r!=null&&a.onStatus(r),r!=null&&r>=200&&r<400){a.req=null;let e=n.getAllResponseHeaders().split(`\r
5
+ `),t=[],r=0,i=e;for(;r<i.length;){let e=i[r];++r,e!=``&&t.push(e)}e=t,a.responseHeaders=new m;let o=0;for(;o<e.length;){let t=e[o];++o;let n=t.split(`: `),r=n.shift(),i=n.length==1?n[0]:n.join(`: `);i=g.ltrim(g.rtrim(i)),a.responseHeaders.inst.set(r,i)}a.success(l.ofData(n.response))}else if(r==null||r==0&&n.response==null)a.req=null,a.onError(`Failed to connect or resolve host`);else if(r==null)a.req=null,a.responseBytes=n.response==null?null:l.ofData(n.response),a.onError(`Http Error #`+n.status);else switch(r){case 12007:a.req=null,a.onError(`Unknown host`);break;case 12029:a.req=null,a.onError(`Failed to connect to host`);break;default:a.req=null,a.responseBytes=n.response==null?null:l.ofData(n.response),a.onError(`Http Error #`+n.status)}};this.async&&(n.onreadystatechange=s);let c,u=this.postData,d=this.postBytes;if(u==null)if(d==null)c=null;else{let e=d;c=new Blob([e.b.bufferValue])}else c=d==null?u:null;if(c!=null)t=!0;else{let e=0,t=this.params;for(;e<t.length;){let n=t[e];++e,c=c==null?``:(c==null?`null`:i.string(c))+`&`;let r=n.name,a=(c==null?`null`:i.string(c))+encodeURIComponent(r)+`=`,o=n.value;c=a+encodeURIComponent(o)}}try{if(t)n.open(`POST`,this.url,this.async);else if(c!=null){let e=this.url.split(`?`).length<=1;n.open(`GET`,this.url+(e?`?`:`&`)+(c==null?`null`:i.string(c)),this.async),c=null}else n.open(`GET`,this.url,this.async);n.responseType=`arraybuffer`}catch(e){let t=r.caught(e).unwrap();this.req=null,this.onError(t.toString());return}n.withCredentials=this.withCredentials,!_.exists(this.headers,function(e){return e.name==`Content-Type`})&&t&&this.postData==null&&n.setRequestHeader(`Content-Type`,`application/x-www-form-urlencoded`);let f=0,p=this.headers;for(;f<p.length;){let e=p[f];++f,n.setRequestHeader(e.name,e.value)}n.send(c),this.async||s(null)}static get __name__(){return`haxe.http.HttpJs`}static get __super__(){return u}get __class__(){return t}};y.prototype.async=null,y.prototype.withCredentials=null,y.prototype.responseHeaders=null,y.prototype.req=null,e.$global;const b=e.global(`$hxClasses`).Type=class e{static createInstance(e,t){return new(Function.prototype.bind.apply(e,[null].concat(t)))}static get __name__(){return`Type`}get __class__(){return e}};e.$global;const x=e.global(`$hxClasses`).Reflect=class e{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let n;if(e==null)return null;{let r;return e.__properties__?(n=e.__properties__[`get_`+t],r=n):r=!1,r?e[n]():e[t]}}static setProperty(e,t,n){let r,i;e.__properties__?(r=e.__properties__[`set_`+t],i=r):i=!1,i?e[r](n):e[t]=n}static fields(e){let t=[];if(e!=null){let r=Object.prototype.hasOwnProperty;for(var n in e)n!=`__id__`&&n!=`hx__closures__`&&r.call(e,n)&&t.push(n)}return t}static compare(e,t){return e==t?0:e>t?1:-1}static get __name__(){return`Reflect`}get __class__(){return e}};e.$global;const S=e.global(`$hxClasses`)[`internal.http.FetchHttp`]=class t extends e.inherits(y){[e.new](t){this.responseStatus=0,super[e.new](t)}request(t){let n=e.$global,a=n.fetch,o=n.Headers,s=n.URLSearchParams;if(a==null){this.onError(`Fetch API not found.`);return}let c=b.createInstance(o,[]),l=0,u=this.headers;for(;l<u.length;){let e=u[l];++l,c.append(e.name,e.value)}let d=t?`POST`:`GET`,f=null;if(t)if(this.postData!=null)f=this.postData;else{f=b.createInstance(s,[]);let e=0,t=this.params;for(;e<t.length;){let n=t[e];++e,f.append(n.name,n.value)}}let p={method:d,headers:c,body:f},m=this,h=a(this.url,p).then(function(e){if(m.responseStatus=e.status,m.onStatus(e.status),e.ok)return e.text();throw r.thrown(`HTTP Error: `+i.string(e.status))}).then(function(e){m.onData(e)}),g=x.field(h,`catch`);g!=null&&g.apply(h,[function(e){m.onError(i.string(e))}])}static get __name__(){return`internal.http.FetchHttp`}static get __super__(){return y}get __class__(){return t}};S.prototype.responseStatus=null,e.$global;const C=e.global(`$hxClasses`)[`internal.data.UUID`]=class e{static randomHexChar(){return`0123456789abcdef`.charAt(i.random(16))}static v4(){let e=``,t=0;for(;t<36;)switch(t++){case 14:e+=`4`;break;case 19:e+=i.string(`0123456789abcdef`.charAt(8+i.random(4)));break;case 8:case 13:case 18:case 23:e+=`-`;break;default:e+=i.string(`0123456789abcdef`.charAt(i.random(16)))}return e}static get __name__(){return`internal.data.UUID`}get __class__(){return e}};C.HEX=`0123456789abcdef`,e.$global;const w=function(){};w.__isInterface__=!0;const T=function(){};T.__isInterface__=!0;const E=function(){};E.__isInterface__=!0,e.$global;const D=e.global(`$hxClasses`)[`internal.RecoBackendV2`]=class t extends e.inherits(){[e.new](){}static _requestUri(){return(t._safe_request?`https://`:`http://`)+t._req_domain+`/api/`+t._environment+`/recommendations/requests`}static noConsentBody(){return{device_id:`no-consent`,user_group:`no-consent`,version:`no-consent`}}static buildRequestBody(e){let n={lists:e,page_type:t._page_visit,channel:t._channel};if(t._consent>=2&&t._history.length>0&&(n.histories=t._buildHistories()),t._consent<2){let e=t.noConsentBody(),r=0,i=x.fields(e);for(;r<i.length;){let t=i[r];++r,n[t]=x.field(e,t)}}else t._user_id!=null&&(n.user_id=t._user_id),n.device_id=t._device_id;let r=0,a=t._others;for(;r<a.length;){let e=a[r];++r,n[e.key]=e.value}let o=x.field(n,`context_item`),s=x.field(n,`context_item_type`);return o!=null&&i.string(o)!=``&&(s==null||i.string(s)==``)&&(n.context_item_type=`article`),n}static _buildHistories(){return{pageviews:t._history}}static requestsToLists(e){let t=[],n=``,r=[],i=0,a=[],o=function(e,t,o){n=e,r=t,i=0,a=o},s=function(e){let t=[];if(e==null)return t;let n=0;for(;n<e.length;){let r=e[n];++n,!(r==null||r.key==null||r.key==``)&&t.push({key:r.key,value:r.value})}return t},c=function(e,t){if(e==null&&t==null)return!0;if(e==null||t==null||e.length!=t.length)return!1;let n=Array(e.length),r=0,i=e.length;for(;r<i;){let t=r++;n[t]=JSON.stringify(e[t])}let a=n,o=Array(t.length),s=0,c=t.length;for(;s<c;){let e=s++;o[e]=JSON.stringify(t[e])}let l=o;a.sort(x.compare),l.sort(x.compare);let u=0,d=a.length;for(;u<d;){let e=u++;if(a[e]!=l[e])return!1}return!0},l=function(){let e={limit:i,list_name:n,list_size:i},o=0;for(;o<r.length;){let t=r[o];++o;let n=t.value;n instanceof Array||(n=[n]),e[t.key]=n}let s=0;for(;s<a.length;){let t=a[s];++s,e[t.key]=t.value}t.push(e)},u=0;for(;u<e.length;){let t=e[u];++u;let d=s(t.filters),f=t.others==null?[]:t.others;if(n==``){o(t.list,d,f),i+=1;continue}else (n!=t.list||!c(r,d)||!c(a,f))&&(l(),o(t.list,d,f));i+=1}return i!=0&&l(),t}static _requestRecos(e){let n=null,a=null,o=new Promise(function(e,t){n=e,a=t}),s=o;s._resolve=n,s._reject=a,s._isFinished=!1,s._result=null,s._error=null;let c=o,l=!1,u=new S(t._requestUri());u.setHeader(`Content-Type`,`application/json`);let d=t.buildRequestBody(e),f=JSON.stringify(d);u.setPostData(f);let p=function(e){if(l)return;l=!0;let t=c;t._isFinished||(t._error=e,t._isFinished=!0,t._reject(e))};u.onError=function(e){p(`HTTP Request Error: `+e)},u.onStatus=function(e){(e<200||e>=300)&&p(`HTTP Status Error: `+e)};try{u.request(!0)}catch(e){let t=r.caught(e).unwrap();return p(`Failed to execute recommendation request: `+i.string(t)),c}let m=function(e){if(!l)try{let t=JSON.parse(e),n=O.fromRequestData(t);l=!0;let r=c;r._isFinished||(r._result=n,r._error=null,r._isFinished=!0,r._resolve(n))}catch(e){let t=r.caught(e).unwrap();p(`Failed to parse recommendation response: `+i.string(t))}},h=u.get_responseData();return h==null?l||(u.onData=m):m(h),c}static getOrder(e,n,a){let o={list_name:e,limit:a.length,list_size:a.length},s={};x.setProperty(s,n,a),x.setProperty(o,`order`,s);let c=null,l=null,u=new Promise(function(e,t){c=e,l=t}),d=u;d._resolve=c,d._reject=l,d._isFinished=!1,d._result=null,d._error=null;let f=u;return t.getRawRecommendations([o]).then(function(e){try{let t=[],n=e.lists();if(n!=null&&n.length>0){let e=n[0].items;if(e instanceof Array){let n=0,r=e;for(;n<r.length;){let e=r[n];++n;let i=e.get(`categories`);i!=null&&t.push(i)}}}let r=f;r._isFinished||(r._result=t,r._error=null,r._isFinished=!0,r._resolve(t))}catch(e){let t=r.caught(e).unwrap(),n=`Failed to build order response: `+i.string(t),a=f;a._isFinished||(a._error=n,a._isFinished=!0,a._reject(n))}},function(e){let t=f;t._isFinished||(t._error=e,t._isFinished=!0,t._reject(e))}),f}static getRawRecommendations(e){return t._requestRecos(e)}static addHistories(e,n){if(n==null&&(n=`article`),e==null||e.length==0)return;let r=n!=null&&n!=``?n:`article`,a=0;for(;a<e.length;){let n=e[a];if(++a,typeof n==`string`){let e=i.string(n);e!=``&&t._history.push({id:e,item_type:r});continue}let o=n,s=x.field(o,`id`);if(s==null)continue;let c=i.string(s);if(c==``)continue;let l=x.field(o,`item_type`);(l==null||i.string(l)==``)&&(l=x.field(o,`itemType`));let u=l!=null&&i.string(l)!=``?i.string(l):r;t._history.push({id:c,item_type:u})}}static setOthers(e,n){let r=0,i=t._others;for(;r<i.length;){let t=i[r];if(++r,t.key==e){t.value=n;return}}t._others.push({key:e,value:n})}static setConsent(e){e>2&&(e=2),t._consent=e,e==2&&t.getDeviceId()==`no-consent`&&t.setDeviceId(C.v4())}static setChannel(e){t._channel=e}static setPageVisit(e){t._page_visit=e}static setEnvironment(e){t._environment=e}static setDeviceId(e){t._device_id=e}static setUserId(e){t._user_id=e}static setRequestDomain(e){t._req_domain=e}static setSafeRequest(e){t._safe_request=e}static setContextItem(e){t.setOthers(`context_item`,e)}static setContextItemType(e){t.setOthers(`context_item_type`,e)}static getRequestDomain(){return t._req_domain}static getSafeRequest(){return t._safe_request}static getEnvironment(){return t._environment}static getPageVisit(){return t._page_visit}static getUserId(){return t._user_id}static getDeviceId(){return t._device_id}static getConsent(){return t._consent}static getChannel(){return t._channel}static getOthers(e){let n=0,r=t._others;for(;n<r.length;){let t=r[n];if(++n,e==t.key)return t.value}return null}static getContextItem(){return t.getOthers(`context_item`)}static getContextItemType(){return t.getOthers(`context_item_type`)}static get __name__(){return`internal.RecoBackendV2`}get __class__(){return t}};D._environment=null,D._device_id=`no-consent`,D._user_id=null,D._consent=0,D._req_domain=`europe-west1.froomle.com`,D._page_visit=null,D._channel=`www-desktop`,D._safe_request=!0,D._history=[],D._others=[];const O=e.global(`$hxClasses`)[`internal._RecommendationsInternal`]=class t extends e.inherits(){[e.new](e,t,n,r,i){this.request_id=t,this.user_group=n,this.device_id=e,this.user_id=r,this._lists=i}items(){let e=[],t=0,n=this._lists;for(;t<n.length;){let r=n[t];++t;let i=0,a=r.items;for(;i<a.length;){let t=a[i];++i,e.push(t)}}return e}lists(){return this._lists}getItemsByListName(e){let t=0,n=this._lists;for(;t<n.length;){let r=n[t];if(++t,r.list_name==e)return r}return null}toJson(){let e={request_id:this.request_id,user_group:this.user_group,user_id:this.user_id,device_id:this.device_id,lists:[]},t=0,n=this._lists;for(;t<n.length;){let r=n[t];++t;let i={limit:r.limit,list_key:r.list_key,list_name:r.list_name,list_size:r.list_size,items:[]},o=0,s=r.items;for(;o<s.length;){let e=s[o];++o,i.items.push(a.__cast(e,A).getData())}e.lists.push(i)}return JSON.stringify(e)}static fromRequestData(e){let n=x.getProperty(e,`lists`),r=[],i=0;for(;i<n.length;){let t=n[i];++i;let a=x.getProperty(t,`items`),o=[],s=0;for(;s<a.length;){let t=a[s];++s,x.setProperty(t,`request_id`,x.getProperty(e,`request_id`)),x.setProperty(t,`user_group`,x.getProperty(e,`user_group`)),o.push(new A(t))}let c=new k({limit:x.getProperty(t,`limit`),list_key:x.getProperty(t,`list_key`),list_name:x.getProperty(t,`list_name`),list_size:x.getProperty(t,`list_size`),items:o,request_id:x.getProperty(e,`request_id`)});r.push(c)}return new t(x.getProperty(e,`device_id`),x.getProperty(e,`request_id`),x.getProperty(e,`user_group`),x.getProperty(e,`user_id`),r)}static get __name__(){return`internal._RecommendationsInternal`}static get __interfaces__(){return[w]}get __class__(){return t}};O.prototype.request_id=null,O.prototype.user_group=null,O.prototype.user_id=null,O.prototype.device_id=null,O.prototype._lists=null;const k=e.global(`$hxClasses`)[`internal._RecommendationsListInternal`]=class t extends e.inherits(){[e.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,this.request_id=e.request_id}static get __name__(){return`internal._RecommendationsListInternal`}static get __interfaces__(){return[T]}get __class__(){return t}};k.prototype.limit=null,k.prototype.list_key=null,k.prototype.list_name=null,k.prototype.list_size=null,k.prototype.items=null,k.prototype.request_id=null;const A=e.global(`$hxClasses`)[`internal._RecommendationItemInternal`]=class t extends e.inherits(){[e.new](e){this.Id=x.getProperty(e,`item_id`),this.RequestId=x.getProperty(e,`request_id`),this.UserGroup=x.getProperty(e,`user_group`),this._data=e}getData(){return this._data}get(e){return this._data[e]}toJson(){return JSON.stringify(this._data)}static get __name__(){return`internal._RecommendationItemInternal`}static get __interfaces__(){return[E]}get __class__(){return t}};A.prototype.Id=null,A.prototype.RequestId=null,A.prototype.UserGroup=null,A.prototype._data=null,e.$global;const j=function(){};j.__isInterface__=!0,e.$global;const M=e.global(`$hxClasses`)[`internal.js.JSFroomleDomTree`]=class t extends e.inherits(){[e.new](){}getRoot(){return this.root}createElement(e){return this.root.ownerDocument.createElement(e)}toString(){return this.root.ownerDocument.documentElement.outerHTML}static fromHTML(e){let n=new DOMParser().parseFromString(e,`text/html`),r=new t;return r.root=n.documentElement,r}static fromDocument(e){let n=new t;return n.root=e.documentElement,n}static get __name__(){return`internal.js.JSFroomleDomTree`}static get __interfaces__(){return[j]}get __class__(){return t}};M.prototype.root=null,e.$global;const N=e.global(`$hxClasses`)[`internal.domHandler.DomDomDom`]=class t extends e.inherits(){[e.new](){}static _fillRecoTargets(e){let n=null,r=null,i=new Promise(function(e,t){n=e,r=t}),a=i;a._resolve=n,a._reject=r,a._isFinished=!1,a._result=null,a._error=null;let o=i;if(e==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}let s=[],c=[],l=e.querySelectorAll(`*`),u=0,d=l.length;for(;u<d;){let e=u++,t=l.item(e);t instanceof HTMLElement&&c.push(t)}let f=c;f.push(e);let p=0;for(;p<f.length;){let e=f[p];++p;let t=0,n=[],r=0,i=e.attributes;for(;r<i.length;){let e=i[r];++r,n.push({name:e.name,value:e.value})}let a=n;for(;t<a.length;){let n=a[t];++t,n.name==`data-froomle-reco`&&s.push(e)}}let m=[],g=0;for(;g<s.length;){let e=s[g];++g;let t=e.getAttribute(`data-froomle-request-id`),n=e.getAttribute(`data-froomle-id`);!(t!=null&&t!=``)&&!(n!=null&&n!=``)&&m.push(e)}if(m.length<1){let e=null,t=null,n=new Promise(function(n,r){e=n,t=r}),r=n;return r._resolve=e,r._reject=t,r._isFinished=!1,r._result=null,r._error=null,n}let _=[],v=[],y=``,b=[],S=[],C=[],w=function(e,t){if(e.length!=t.length)return!1;let n=Array(e.length),r=0,i=e.length;for(;r<i;){let t=r++;n[t]=JSON.stringify(e[t])}let a=n,o=Array(t.length),s=0,c=t.length;for(;s<c;){let e=s++;o[e]=JSON.stringify(t[e])}let l=o;a.sort(x.compare),l.sort(x.compare);let u=0,d=a.length;for(;u<d;){let e=u++;if(a[e]!=l[e])return!1}return!0},T=function(){let e={list_name:y,list_size:S.length,limit:S.length},t=0;for(;t<b.length;){let n=b[t];if(++t,n!=null&&n.key!=null&&n.key!=``){let t=n.value;t instanceof Array||(t=[t]),x.setProperty(e,n.key,t)}}let n=0;for(;n<C.length;){let t=C[n];++n,x.setProperty(e,t.key,t.value)}_.push(e),v.push(S)},E=function(e,t,n,r){y=e,b=t,S=[r],C=n},O=0;for(;O<m.length;){let e=m[O];++O;let t=function(e){let t=[],n=0,r=[],i=0,a=e.attributes;for(;i<a.length;){let e=a[i];++i,r.push({name:e.name,value:e.value})}let o=r;for(;n<o.length;){let e=o[n];if(++n,e.name.startsWith(`data-froomle-reco-filter-`)){let n=h.substr(e.name,25,null),r=e.value;t.push({key:n,value:r})}}return t},n=function(e){let t=[],n=0,r=[],i=0,a=e.attributes;for(;i<a.length;){let e=a[i];++i,r.push({name:e.name,value:e.value})}let o=r;for(;n<o.length;){let e=o[n];if(++n,e.name.startsWith(`data-froomle-variable-`)){let n=h.substr(e.name,22,null),r=e.value;t.push({key:n,value:r})}}return t},r=e.getAttribute(`data-froomle-reco`),i=t(e),a=n(e);if(y==``){E(r,i,a,e);continue}else if(r==y&&w(b,i)&&w(C,a)){S.push(e);continue}else{T(),E(r,i,a,e);continue}}y!=``&&T();let k;if(D.getPageVisit()==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}else if(D.getEnvironment()==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}else try{k=D.getRawRecommendations(_)}catch{let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}return k.then(function(e){let n=e.lists(),r=n.length,i=0,a=r;for(;i<a;){let r=i++,a=n[r];a.items.length,v[r].length;let o=a.items.length,s=0,c=o;for(;s<c;){let n=s++,i=a.items[n],o=v[r][n];t._fillParameters(o,i,e.request_id)}}let s=o;s._isFinished||(s._result=!0,s._error=null,s._isFinished=!0,s._resolve(!0))}),o}static getAttrByPath(e,t,n){n==null&&(n=`fgh`);try{t=new v(`\\\\[(\\\\w+)\\\\]`,`g`).map(t,function(e){return`.`+e.matched(1)}),t=g.replace(t,`[`,`.`),t=g.replace(t,`]`,``),h.cca(t,0)==46&&(t=h.substr(t,1,null));let n=t.split(`.`),r=e.get(n[0]),a=1,o=n.length;for(;a<o;){let e=a++;if(r==null)return null;r=r instanceof Array&&i.parseInt(n[e])!=null?r[i.parseInt(n[e])]:x.field(r,n[e])}return r}catch{return n}}static _buildHistories(e){let t=[],n=[],r=e.querySelectorAll(`[data-froomle-id]`),i=0,a=r.length;for(;i<a;){let e=i++,t=r.item(e);t instanceof HTMLElement&&n.push(t)}let o=n,s=0;for(;s<o.length;){let e=o[s];++s,t.push(e.getAttribute(`data-froomle-id`))}D.addHistories(t)}static fillParam(e,n,r,i,a){a==null&&(a=``);try{let o=t.getAttrByPath(i,r,a);n==`inner`?(e.textContent=o,e.textContent):e.setAttribute(n,o)}catch{}}static _fillParameters(e,n,r){e.setAttribute(`data-froomle-id`,n.get(`item_id`)),e.setAttribute(`data-froomle-request-id`,r);let a=n.get(`item_type`);a!=null&&i.string(a)!=``&&e.setAttribute(`data-froomle-item-type`,i.string(a)),n.UserGroup!=null&&n.UserGroup!=``&&e.setAttribute(`data-froomle-user-group`,n.UserGroup);let o=[],s=e.querySelectorAll(`*`),c=0,l=s.length;for(;c<l;){let e=c++,t=s.item(e);t instanceof HTMLElement&&o.push(t)}let u=o,d=0;for(;d<u.length;){let e=u[d];++d;let r=0,i=[],a=0,o=e.attributes;for(;a<o.length;){let e=o[a];++a,i.push({name:e.name,value:e.value})}let s=i;for(;r<s.length;){let i=s[r];if(++r,i.name.startsWith(`data-froomle-param-`)){let r=g.replace(i.name,`data-froomle-param-`,``),a=i.value;t.fillParam(e,r,a,n)}}}}static _orderElements(e){let t=function(t,n,r){let i=[],a=[],o=0,s=t.childNodes;for(;o<s.length;){let e=s[o];++o,a.push(e)}let c=a,l=0;for(;l<c.length;){let n=c[l];++l;try{if(n.getAttribute(`data-froomle-ordervalue`)!=null){i.push(n);let r=e.createElement(`span`);r.setAttribute(`data-froomle-tmp-node`,`tmp`),t.replaceChild(r,n)}}catch{}}let u=[],d=0;for(;d<i.length;){let e=i[d];++d,u.push(e.getAttribute(`data-froomle-ordervalue`))}return{el:t,key:n,values:u,orderChildren:i,list_name:r}},n=null,r=null,i=new Promise(function(e,t){n=e,r=t}),a=i;a._resolve=n,a._reject=r,a._isFinished=!1,a._result=null,a._error=null;let o=i,s=e.getRoot(),c=[],l=s.querySelectorAll(`*`),u=0,d=l.length;for(;u<d;){let e=u++,t=l.item(e);t instanceof HTMLElement&&c.push(t)}let f=c,p=[],m=0;for(;m<f.length;){let e=f[m];++m;let n=0,r=[],i=0,a=e.attributes;for(;i<a.length;){let e=a[i];++i,r.push({name:e.name,value:e.value})}let o=r;for(;n<o.length;){let r=o[n];++n,r.name.startsWith(`data-froomle-order-`)&&p.push(t(e,r.name.substring(19),r.value))}}if(p.length<1){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}let h=[],g=0;for(;g<p.length;){let e=p[g];++g;let t={list_name:e.list_name,limit:e.values.length,list_size:e.values.length},n={};x.setProperty(n,e.key,e.values),x.setProperty(t,`order`,n),h.push(t)}if(D.getPageVisit()==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}else if(D.getEnvironment()==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}try{D.getRawRecommendations(h).then(function(e){let t=e.lists(),n=t.length,r=0,i=n;for(;r<i;){let n=r++,i=t[n],a=p[n];a.el.setAttribute(`data-froomle-request-id`,e.request_id);let o=[],s=0,c=i.items;for(;s<c.length;){let e=c[s];++s;let t=e.get(a.key);e.get(a.key);let n=a.values.length,r=0,i=n;for(;r<i;){let e=r++;if(t==a.values[e]){a.orderChildren.length;let t=a.orderChildren[e];o.push(t),a.orderChildren.splice(e,1),a.values.splice(e,1);break}}}o.length;let l=a.el,u=[],d=0,f=l.childNodes;for(;d<f.length;){let e=f[d];++d,u.push(e)}let m=u.length,h=0,g=m;for(;h<g;){let e=h++,t=a.el,n=[],r=0,i=t.childNodes;for(;r<i.length;){let e=i[r];++r,n.push(e)}let s=n[e],c;if(c=s instanceof HTMLElement?s.hasAttribute(`data-froomle-tmp-node`):!1,c&&(a.el.replaceChild(o[0],s),o.splice(0,1),o.length,o.length==0))break}}let a=o;a._isFinished||(a._result=!0,a._error=null,a._isFinished=!0,a._resolve(!0))})}catch{let e=o;e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1))}return o}static domInit(e){let n=null,r=null,i=new Promise(function(e,t){n=e,r=t}),a=i;a._resolve=n,a._reject=r,a._isFinished=!1,a._result=null,a._error=null;let o=i;return t._orderElements(e).then(function(n){t._buildHistories(e.getRoot()),t._fillRecoTargets(e.getRoot()).then(function(e){let t=o;t._isFinished||(t._result=!0,t._error=null,t._isFinished=!0,t._resolve(!0))})}),o}static fillElementRecos(e){t._fillRecoTargets(e)}static runFromHtml(e){if(e==``)return``;let n;try{let t=new DOMParser().parseFromString(e,`text/html`),r=new M;r.root=t.documentElement,n=r}catch{return e}return t.domInit(n),n.toString()}static get __name__(){return`internal.domHandler.DomDomDom`}get __class__(){return t}};e.$global;const P=e.global(`$hxClasses`).FroomleSdk=class e{static register(){e.registered||e._env_set&&e._page_visit_set&&(e.registered=!0)}static buildScriptTag(){let e=`<script src="https://cdn.jsdelivr.net/npm/@froomle/frontend-sdk@0.0.11/dist/froomle.global.js" data-froomle-env="`+D.getEnvironment()+`" `,t=D.getPageVisit();t!=null&&(e+=`data-froomle-page-visit="`+t+`" `);let n=D.getContextItem();if(n!=null){e+=`data-froomle-context-item="`+n+`" `;let t=D.getContextItemType();(t==null||t==``)&&(t=`article`),e+=`data-froomle-context-item-type="`+t+`" `}let r=D.getDeviceId();r!=null&&(e+=`data-froomle-device-id="`+r+`" `);let i=D.getUserId();i!=null&&(e+=`data-froomle-user-id="`+i+`" `);let a=D.getConsent();a>0&&(e+=`data-froomle-consent="`+a+`" `);let o=D.getRequestDomain();o!=null&&(e+=`data-froomle-request-domain="`+o+`" `);let s=D.getChannel();return s!=null&&(e+=`data-froomle-channel="`+s+`" `),e+=`><\/script>`,e}static setEnvironment(t){D.setEnvironment(t),e._env_set=!0,e.register()}static setDeviceId(e){D.setDeviceId(e)}static setUserId(e){D.setUserId(e)}static setConsent(e){D.setConsent(e)}static setPageVisit(t){D.setPageVisit(t),e._page_visit_set=!0,e.register()}static setChannel(e){D.setChannel(e)}static setRequestDomain(e){D.setRequestDomain(e)}static setSafeRequest(e){D.setSafeRequest(e)}static setContextItem(e){D.setContextItem(e)}static setContextItemType(e){D.setContextItemType(e)}static setCustomVariable(e,t){D.setOthers(e,t)}static getUserId(){return D.getUserId()}static getDeviceId(){return D.getDeviceId()}static getEnvironment(){return D.getEnvironment()}static getSafeRequest(){return D.getSafeRequest()}static getPageVisit(){return D.getPageVisit()}static getConsent(){return D.getConsent()}static getRecommendations(e){return D.getRawRecommendations(e)}static getChannel(){return D.getChannel()}static getVersion(){return`0.0.11`}static runFromHtml(e){return N.runFromHtml(e)}static get __name__(){return`FroomleSdk`}get __class__(){return e}};P._env_set=!1,P._page_visit_set=!1,P.registered=!1;function F(){return(D.getSafeRequest()?`https://`:`http://`)+D.getRequestDomain()+`/api/`+D.getEnvironment()+`/events`}function I(){return D.getConsent()>=1}function L(){return D.getConsent()<2?`no-consent`:D.getDeviceId()}function R(){let e=D.getChannel();if(e)return e}function ee(e){let t=(e==null?void 0:e.getAttribute(`data-froomle-id`))||(e==null?void 0:e.getAttribute(`data-froomle-action-item`));if(t)return t}function te(e){let t=(e==null?void 0:e.getAttribute(`data-froomle-item-type`))||(e==null?void 0:e.getAttribute(`data-froomle-action-item-type`));if(t)return t}function ne(e){var t;let n=e==null?void 0:e.getAttribute(`data-froomle-user-group`);if(n)return n;if(!(typeof document>`u`))return((t=document.querySelector(`[data-froomle-user-group]`))==null?void 0:t.getAttribute(`data-froomle-user-group`))||void 0}function re(e,t,n=`impression`,r){if(!I())return;let i=R()||`www-desktop`,a={event_type:n,page_type:D.getPageVisit(),action_item:e,action_item_type:t,channel:i,device_id:L()},o=ne();if(o&&(a.user_group=o),r)for(let e in r)a[e]=r[e];try{fetch(F(),{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({events:[a]})})}catch{}}var z=class e{static queueIfNotPresent(t){e.impressionQueue.includes(t)||e.impressionQueue.push(t)}static generateBody(){let t=[];for(let n of e.impressionQueue){let e=ee(n);if(!e)continue;let r=te(n)||`article`,i=R()||`www-desktop`,a={event_type:`impression`,page_type:D.getPageVisit(),action_item:e,action_item_type:r,channel:i,device_id:L()},o=ne(n);o&&(a.user_group=o),D.getConsent()>=2&&D.getUserId()&&(a.user_id=D.getUserId());let s=n.getAttribute(`data-froomle-reco`),c=n.getAttribute(`data-froomle-request-id`);s&&c&&(a.list_name=s,a.request_id=c),t.push(a)}return e.impressionQueue=[],JSON.stringify({events:t})}static sendImpressions(){console.log(e.impressionQueue),e.impressionQueue.length!==0&&I()&&fetch(F(),{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:e.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(t){let n=t.getBoundingClientRect(),r=e.getViewPortRect();return n.right>r.left&&n.left<r.right&&n.bottom>r.top&&n.top<r.bottom}static addIntersectionImpressionListener(t){e.observer.observe(t)}static processDocument(){if(I()){console.log(`🚀 Processing document for impressions`);for(let t of document.querySelectorAll(`[data-froomle-id]`))e.intersectsWithViewPortRect(t)?e.queueIfNotPresent(t):e.addIntersectionImpressionListener(t);e.sendImpressions()}}static processElement(t){if(!I()||!(t instanceof Element))return;let n=[];t.matches(`[data-froomle-id]`)&&n.push(t);for(let e of t.querySelectorAll(`[data-froomle-id]`))n.push(e);if(n.length!==0){for(let t of n)e.intersectsWithViewPortRect(t)?e.queueIfNotPresent(t):e.addIntersectionImpressionListener(t);e.sendImpressions()}}};z.impressionQueue=[],z.observer=null,typeof document<`u`&&(z.observer=new IntersectionObserver((e,t)=>{e.forEach(e=>{e.isIntersecting&&(z.impressionQueue.push(e.target),z.observer.unobserve(e.target))}),z.impressionQueue.length>0&&z.sendImpressions()}));var B=class e{static canTrackEvents(){return D.getConsent()>=1}static readDeviceId(){return D.getConsent()<2?`no-consent`:D.getDeviceId()}static readChannel(){let e=D.getChannel();if(e)return e}static readUserGroup(){var e;if(!(typeof document>`u`))return((e=document.querySelector(`[data-froomle-user-group]`))==null?void 0:e.getAttribute(`data-froomle-user-group`))||void 0}static uri(){return(D.getSafeRequest()?`https://`:`http://`)+D.getRequestDomain()+`/api/`+D.getEnvironment()+`/events`}static generateBody(){let t=e.readChannel()||`www-desktop`,n={event_type:`page_visit`,page_type:D.getPageVisit(),channel:t,device_id:e.readDeviceId()},r=e.readUserGroup();return r&&(n.user_group=r),D.getConsent()>=2&&D.getUserId()&&(n.user_id=D.getUserId()),JSON.stringify({events:[n]})}static sendPageVisit(){D.getPageVisit()&&(D.getContextItem()||e.canTrackEvents()&&fetch(e.uri(),{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:e.generateBody()}))}},V=class e{static canTrackEvents(){return D.getConsent()>=1}static readDeviceId(){return D.getConsent()<2?`no-consent`:D.getDeviceId()}static readChannel(){let e=D.getChannel();if(e)return e}static readActionItemType(){let e=D.getContextItemType();if(e)return e}static readUserGroup(){var e;if(!(typeof document>`u`))return((e=document.querySelector(`[data-froomle-user-group]`))==null?void 0:e.getAttribute(`data-froomle-user-group`))||void 0}static uri(){return(D.getSafeRequest()?`https://`:`http://`)+D.getRequestDomain()+`/api/`+D.getEnvironment()+`/events`}static generateBody(){let t=e.readActionItemType()||`article`,n=e.readChannel()||`www-desktop`,r={event_type:`detail_pageview`,page_type:D.getPageVisit(),action_item:D.getContextItem(),action_item_type:t,channel:n,device_id:e.readDeviceId()},i=e.readUserGroup();return i&&(r.user_group=i),D.getConsent()>=2&&D.getUserId()&&(r.user_id=D.getUserId()),JSON.stringify({events:[r]})}static sendPageView(){D.getContextItem()&&D.getPageVisit()&&e.canTrackEvents()&&fetch(e.uri(),{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:e.generateBody()})}},H=class e{static readAttributeFromChain(e,t){let n=e;for(;n;){for(let e of t){let t=n.getAttribute(e);if(t)return t}n=n.parentElement}}static canTrackEvents(){return D.getConsent()>=1}static readDeviceId(){return D.getConsent()<2?`no-consent`:D.getDeviceId()}static readChannel(){let e=D.getChannel();if(e)return e}static readActionItem(t){return e.readAttributeFromChain(t,[`data-froomle-id`,`data-froomle-action-item`])}static readActionItemType(t){return e.readAttributeFromChain(t,[`data-froomle-item-type`,`data-froomle-action-item-type`])}static readUserGroup(t){var n;let r=e.readAttributeFromChain(t,[`data-froomle-user-group`]);if(r)return r;if(!(typeof document>`u`))return((n=document.querySelector(`[data-froomle-user-group]`))==null?void 0:n.getAttribute(`data-froomle-user-group`))||void 0}static registerClickables(){e.listenerRegistered||(e.listenerRegistered=!0,document.addEventListener(`click`,t=>{if(!e.canTrackEvents())return;let n=t instanceof MouseEvent?t:null,r=t.target,i=r instanceof Element?r:r instanceof Node?r.parentElement:null;if(!i)return;let a=i.closest(`a`);if(!a)return;let o=a.closest(`[data-froomle-id]`);if(!o)return;let s=a.closest(`[data-froomle-reco]`),c=(s?e.readActionItem(s):void 0)||e.readActionItem(o);if(!c)return;let l=(s?e.readActionItemType(s):void 0)||e.readActionItemType(o)||`article`,u=e.readChannel()||`www-desktop`,d=a instanceof HTMLAnchorElement?a.href:null,f=a.getAttribute(`href`),p=typeof f==`string`&&f.trim().startsWith(`#`),m=!!d&&!p&&t.cancelable&&!t.defaultPrevented&&!a.hasAttribute(`download`)&&(!a.target||a.target===`_self`)&&!!n&&n.button===0&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!n.altKey,h=p&&t.cancelable&&!t.defaultPrevented;(m||h)&&t.preventDefault();let g={event_type:`click_on_recommendation`,page_type:D.getPageVisit(),action_item:c,action_item_type:l,channel:u,device_id:e.readDeviceId()},_=(s?e.readUserGroup(s):void 0)||e.readUserGroup(o);_&&(g.user_group=_);let v=(s?e.readAttributeFromChain(s,[`data-froomle-reco`]):void 0)||e.readAttributeFromChain(o,[`data-froomle-reco`]),y=(s?e.readAttributeFromChain(s,[`data-froomle-request-id`]):void 0)||e.readAttributeFromChain(o,[`data-froomle-request-id`]);v&&y&&(g.list_name=v,g.request_id=y),D.getConsent()>=2&&D.getUserId()&&(g.user_id=D.getUserId());let b=(D.getSafeRequest()?`https://`:`http://`)+D.getRequestDomain()+`/api/`+D.getEnvironment()+`/events`,x=JSON.stringify({events:[g]}),S=new Blob([x],{type:`application/json`}),C=e=>fetch(b,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:x,...e?{keepalive:!0}:{}});if(m&&d){let e=!1,t=()=>{e||(e=!0,window.location.assign(d))},n=window.setTimeout(t,200);C(!0).catch(()=>{typeof navigator<`u`&&typeof navigator.sendBeacon==`function`&&navigator.sendBeacon(b,S)}).finally(()=>{window.clearTimeout(n),t()});return}C(!1).catch(()=>{typeof navigator<`u`&&typeof navigator.sendBeacon==`function`&&navigator.sendBeacon(b,S)})},!0))}};H.listenerRegistered=!1;const ie=M,U=P.setEnvironment,W=P.setPageVisit,G=P.setRequestDomain,K=P.setSafeRequest,q=typeof P.setChannel==`function`?P.setChannel:D.setChannel,J=P.setContextItem,Y=P.setContextItemType,ae=D.addHistories;function oe(e,t){P.setCustomVariable(e,t)}function X(e){P.setUserId(e),document.cookie=`froomle_user_id=${e}; max-age=${3600*24*365*20}; path=/; samesite=lax`}function Z(e){P.setDeviceId(e),document.cookie=`froomle_device_id=${e}; max-age=${3600*24*365*20}; path=/; samesite=lax`}function Q(e){P.setConsent(e),document.cookie=`froomle_consent=${e}; max-age=${3600*24*365*20}; path=/; samesite=lax`,document.cookie=`froomle_device_id=${P.getDeviceId()}; max-age=${3600*24*365*20}; path=/; samesite=lax`}typeof window<`u`&&(window.setFroomleConsent=Q);function $(e){let t=document.cookie.split(`; `);for(let n of t){let[t,r]=n.split(`=`);if(t===e)return decodeURIComponent(r)}return null}function se(e){return P.getRecommendations(e)}if(!globalThis.froomleInitialized&&(globalThis.froomleInitialized=!0,typeof document<`u`)){let e=document.currentScript;if(e){let t=e.getAttribute(`data-froomle-device-id`),n=e.getAttribute(`data-froomle-user-id`),r=e.getAttribute(`data-froomle-env`),i=e.getAttribute(`data-froomle-page-visit`),a=e.getAttribute(`data-froomle-request-domain`),o=e.getAttribute(`data-froomle-context-item`),s=e.getAttribute(`data-froomle-context-item-type`),c=e.getAttribute(`data-froomle-safe-request`),l=e.getAttribute(`data-froomle-channel`);if(U(r),i&&W(i),o&&(J(o),Y(s||`article`)),t)Z(t);else{let e=$(`froomle_device_id`);e&&Z(e)}if(n)X(n);else{let e=$(`froomle_user_id`);e&&X(e)}a&&G(a),c&&K(c!==`false`),l&&q(l)}let t=$(`froomle_consent`);if(t){let e=Number(t);Number.isNaN(e)||Q(e)}document.addEventListener(`DOMContentLoaded`,()=>{console.log(`froomle loads dom`),N.domInit(ie.fromDocument(document)).then(e=>{H.registerClickables(),z.processDocument(),B.sendPageVisit(),V.sendPageView()});function e(e){return e.matches(`[data-froomle-reco]`)||e.querySelector(`[data-froomle-reco]`)!==null}new MutationObserver(t=>{for(let n of t)if(n.type===`childList`&&n.addedNodes.forEach(t=>{t instanceof Element&&(e(t)&&N.fillElementRecos(t),z.processElement(t))}),n.type===`attributes`&&n.target instanceof Element)if(n.attributeName===`data-froomle-reco`){let e=n.target.getAttribute(`data-froomle-request-id`);(!e||e===``)&&N.fillElementRecos(n.target)}else if(n.attributeName===`data-froomle-request-id`){let e=n.target.getAttribute(`data-froomle-request-id`),t=n.target.getAttribute(`data-froomle-id`);n.target.getAttribute(`data-froomle-reco`)&&(!e||e===``)&&(!t||t===``)&&N.fillElementRecos(n.target)}else n.attributeName===`data-froomle-id`&&z.processElement(n.target)}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-froomle-reco`,`data-froomle-request-id`,`data-froomle-id`]})})}export{w as C,T as S,z as _,J as a,A as b,Z as c,G as d,K as f,B as g,V as h,Q as i,U as l,H as m,se as n,Y as o,X as p,q as r,oe as s,ae as t,W as u,re as v,E as x,D as y};
package/dist/react.cjs ADDED
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require(`./src-CAyj-n-g.cjs`);let l=require(`react`);l=s(l);function u({children:e,id:t}){let[n,r]=l.default.useState(!1);return n||(c.x.addHistories([t]),r(!0)),l.default.createElement(l.default.Fragment,null,e)}function d({children:e,value:t}){return l.default.createElement(l.default.Fragment,null,e)}d.displayName=`FroomleOrderItem`;function f({children:e,list:t,category:n}){let[r,i]=l.default.useState(null);return l.default.createElement(l.default.Fragment,null,(()=>{let a=l.default.Children.toArray(e),o=[],s=[],u=[[]];for(let e of a)if(console.log(e.type.displayName),l.default.isValidElement(e)&&e.type===d){let t=e.props.value;o.push(t),s.push(e),u.push([])}else u[u.length-1].push(e);if(r){let e=[];for(let t of r){let n=o.indexOf(t);n!==-1&&(e.push(s[n]),e.push(...u[n+1]))}return e}else return c.x.getOrder(t,n,o).then(e=>{i(e)}),a})())}function p(e){return(0,l.useEffect)(()=>{c.t().catch(()=>{}).finally(()=>{c.g.registerClickables(),c.y.processDocument(),c.v.sendPageVisit(),c._.sendPageView()})},[]),l.default.createElement(l.default.Fragment,null,e.children)}const m=(0,l.createContext)(null);function h(e,...t){for(let n of t){let t=e==null?void 0:e[n];if(t!=null&&t!==``&&t!==`undefined`)return String(t)}if(typeof(e==null?void 0:e.get)==`function`)for(let n of t){let t=e.get(n);if(t!=null&&t!==``&&t!==`undefined`)return String(t)}}function g(){var e;if(typeof document>`u`)return;let t=(e=document.querySelector(`[data-froomle-user-group]`))==null?void 0:e.getAttribute(`data-froomle-user-group`);if(t!=null&&t!==``&&t!==`undefined`)return String(t)}function _({reco:e,children:t,...n}){let r=(0,l.useRef)(null);return l.default.useEffect(()=>{let t=!1,n=e.__froomleList;return r.current&&n&&r.current.setAttribute(`data-froomle-reco`,n),Promise.resolve(e).then(e=>{if(t||!r.current)return;let n=h(e,`Id`,`item_id`),i=h(e,`ItemType`,`item_type`),a=h(e,`RequestId`,`request_id`),o=h(e,`UserGroup`,`user_group`)||g();n&&r.current.setAttribute(`data-froomle-id`,n),i&&r.current.setAttribute(`data-froomle-item-type`,i),a&&r.current.setAttribute(`data-froomle-request-id`,a),o&&r.current.setAttribute(`data-froomle-user-group`,o)}).catch(()=>{}),()=>{t=!0}},[e]),l.default.createElement(m.Provider,{value:e},l.default.createElement(`div`,{ref:r,...n},t))}const v=()=>{let e=(0,l.useContext)(m);if(e===null)throw Error(`useFroomleReco must be used within a FroomleRecoProvider`);return e};function y(e){let t=(0,l.useRef)(null),[n,r]=(0,l.useState)(0);if(!t.current){let{list:n,filters:r,...i}=e;t.current=c.n({list:n,filters:r,others:Object.entries(i).map(([e,t])=>({key:e,value:t}))})}return(0,l.useEffect)(()=>{let e=!0;return Promise.resolve(t.current).then(()=>{e&&r(1)}).catch(()=>{e&&r(1)}),()=>{e=!1}},[]),t.current}exports.FroomleCustomItem=u,exports.FroomleOrder=f,exports.FroomleOrderItem=d,exports.FroomleReco=_,exports.FroomleSdkInit=p,exports.useCreateReco=y,exports.useReco=v;
package/dist/react.d.ts CHANGED
@@ -1,41 +1,59 @@
1
- import React, { ReactNode } from 'react';
2
- import { a as RecommendationItem } from './Recommendations.d-HGeAMYU5.js';
1
+ import { x as RecommendationItem } from "./js-FtOpub-e.js";
2
+ import "./src-6IU8XQgM.js";
3
+ import React, { ReactNode } from "react";
3
4
 
4
- declare function FroomleCustomItem({ children, id }: {
5
- children: React.ReactNode;
6
- id: string;
5
+ //#region src/react/Custom.d.ts
6
+ declare function FroomleCustomItem({
7
+ children,
8
+ id
9
+ }: {
10
+ children: React.ReactNode;
11
+ id: string;
7
12
  }): React.ReactNode;
8
-
9
- declare function FroomleOrderItem({ children, value }: {
10
- children: React.ReactNode;
11
- value: string;
13
+ //#endregion
14
+ //#region src/react/order.d.ts
15
+ declare function FroomleOrderItem({
16
+ children,
17
+ value
18
+ }: {
19
+ children: React.ReactNode;
20
+ value: string;
12
21
  }): React.JSX.Element;
13
22
  declare namespace FroomleOrderItem {
14
- var displayName: string;
23
+ var displayName: string;
15
24
  }
16
- declare function FroomleOrder({ children, list, category }: {
17
- children: React.ReactNode;
18
- list: string;
19
- category: string;
25
+ declare function FroomleOrder({
26
+ children,
27
+ list,
28
+ category
29
+ }: {
30
+ children: React.ReactNode;
31
+ list: string;
32
+ category: string;
20
33
  }): React.JSX.Element;
21
-
34
+ //#endregion
35
+ //#region src/react/index.d.ts
22
36
  type RecoRequest = {
23
- filters: {
24
- key: string;
25
- value: string;
26
- }[];
27
- list: string;
28
- [key: string]: any;
37
+ filters: {
38
+ key: string;
39
+ value: string;
40
+ }[];
41
+ list: string;
42
+ [key: string]: any;
29
43
  };
30
44
  declare function FroomleSdkInit(props: {
31
- children: any;
45
+ children: any;
32
46
  }): React.JSX.Element;
33
47
  interface FroomleRecoProps {
34
- reco: RecommendationItem & PromiseLike<RecommendationItem>;
35
- children: ReactNode;
48
+ reco: RecommendationItem & PromiseLike<RecommendationItem>;
49
+ children: ReactNode;
36
50
  }
37
- declare function FroomleReco({ reco, children, ...props }: FroomleRecoProps): React.JSX.Element;
51
+ declare function FroomleReco({
52
+ reco,
53
+ children,
54
+ ...props
55
+ }: FroomleRecoProps): React.JSX.Element;
38
56
  declare const useReco: () => RecommendationItem;
39
57
  declare function useCreateReco(req: RecoRequest): RecommendationItem & PromiseLike<RecommendationItem>;
40
-
41
- export { FroomleCustomItem, FroomleOrder, FroomleOrderItem, FroomleReco, FroomleSdkInit, useCreateReco, useReco };
58
+ //#endregion
59
+ export { FroomleCustomItem, FroomleOrder, FroomleOrderItem, FroomleReco, FroomleSdkInit, useCreateReco, useReco };
package/dist/react.js CHANGED
@@ -1 +1 @@
1
- import{d as a,f as I,g as x,h as F,i as v,w as P,x as C}from"./chunk-GJPFNIOF.js";import f,{createContext as A,useContext as V,useEffect as N,useRef as b,useState as _}from"react";import h from"react";function k({children:e,id:r}){let[n,t]=h.useState(!1);return n||(a.addHistories([r]),t(!0)),h.createElement(h.Fragment,null,e)}import d from"react";function y({children:e,value:r}){return d.createElement(d.Fragment,null,e)}y.displayName="FroomleOrderItem";function S({children:e,list:r,category:n}){let[t,i]=d.useState(null);return d.createElement(d.Fragment,null,(()=>{let u=d.Children.toArray(e),s=[],l=[],m=[[]];for(let o of u)if(console.log(o.type.displayName),d.isValidElement(o)&&o.type===y){let g=o.props.value;s.push(g),l.push(o),m.push([])}else m[m.length-1].push(o);if(t){let o=[];for(let g of t){let R=s.indexOf(g);R!==-1&&(o.push(l[R]),o.push(...m[R+1]))}return o}else return a.getOrder(r,n,s).then(o=>{i(o)}),u})())}function z(e){return N(()=>{P().catch(()=>{}).finally(()=>{v.registerClickables(),I.processDocument(),x.sendPageVisit(),F.sendPageView()})},[]),f.createElement(f.Fragment,null,e.children)}var O=A(null);function p(e,...r){for(let n of r){let t=e==null?void 0:e[n];if(t!=null&&t!==""&&t!=="undefined")return String(t)}if(typeof(e==null?void 0:e.get)=="function")for(let n of r){let t=e.get(n);if(t!=null&&t!==""&&t!=="undefined")return String(t)}}function q(){var r;if(typeof document=="undefined")return;let e=(r=document.querySelector("[data-froomle-user-group]"))==null?void 0:r.getAttribute("data-froomle-user-group");if(e!=null&&e!==""&&e!=="undefined")return String(e)}function J({reco:e,children:r,...n}){let t=b(null);return f.useEffect(()=>{let i=!1,c=e.__froomleList;return t.current&&c&&t.current.setAttribute("data-froomle-reco",c),Promise.resolve(e).then(u=>{if(i||!t.current)return;let s=p(u,"Id","item_id"),l=p(u,"ItemType","item_type"),m=p(u,"RequestId","request_id"),o=p(u,"UserGroup","user_group")||q();s&&t.current.setAttribute("data-froomle-id",s),l&&t.current.setAttribute("data-froomle-item-type",l),m&&t.current.setAttribute("data-froomle-request-id",m),o&&t.current.setAttribute("data-froomle-user-group",o)}).catch(()=>{}),()=>{i=!0}},[e]),f.createElement(O.Provider,{value:e},f.createElement("div",{ref:t,...n},r))}var K=()=>{let e=V(O);if(e===null)throw new Error("useFroomleReco must be used within a FroomleRecoProvider");return e};function Q(e){let r=b(null),[n,t]=_(0);if(!r.current){let{list:i,filters:c,...u}=e;r.current=C({list:i,filters:c,others:Object.entries(u).map(([s,l])=>({key:s,value:l}))})}return N(()=>{let i=!0;return Promise.resolve(r.current).then(()=>{i&&t(1)}).catch(()=>{i&&t(1)}),()=>{i=!1}},[]),r.current}export{k as FroomleCustomItem,S as FroomleOrder,y as FroomleOrderItem,J as FroomleReco,z as FroomleSdkInit,Q as useCreateReco,K as useReco};
1
+ import{_ as e,g as t,h as n,m as r,y as i}from"./js-FtOpub-e.js";import{n as a,t as o}from"./src-6IU8XQgM.js";import s,{createContext as c,useContext as l,useEffect as u,useRef as d,useState as f}from"react";function p({children:e,id:t}){let[n,r]=s.useState(!1);return n||(i.addHistories([t]),r(!0)),s.createElement(s.Fragment,null,e)}function m({children:e,value:t}){return s.createElement(s.Fragment,null,e)}m.displayName=`FroomleOrderItem`;function h({children:e,list:t,category:n}){let[r,a]=s.useState(null);return s.createElement(s.Fragment,null,(()=>{let o=s.Children.toArray(e),c=[],l=[],u=[[]];for(let e of o)if(console.log(e.type.displayName),s.isValidElement(e)&&e.type===m){let t=e.props.value;c.push(t),l.push(e),u.push([])}else u[u.length-1].push(e);if(r){let e=[];for(let t of r){let n=c.indexOf(t);n!==-1&&(e.push(l[n]),e.push(...u[n+1]))}return e}else return i.getOrder(t,n,c).then(e=>{a(e)}),o})())}function g(i){return u(()=>{o().catch(()=>{}).finally(()=>{r.registerClickables(),e.processDocument(),t.sendPageVisit(),n.sendPageView()})},[]),s.createElement(s.Fragment,null,i.children)}const _=c(null);function v(e,...t){for(let n of t){let t=e==null?void 0:e[n];if(t!=null&&t!==``&&t!==`undefined`)return String(t)}if(typeof(e==null?void 0:e.get)==`function`)for(let n of t){let t=e.get(n);if(t!=null&&t!==``&&t!==`undefined`)return String(t)}}function y(){var e;if(typeof document>`u`)return;let t=(e=document.querySelector(`[data-froomle-user-group]`))==null?void 0:e.getAttribute(`data-froomle-user-group`);if(t!=null&&t!==``&&t!==`undefined`)return String(t)}function b({reco:e,children:t,...n}){let r=d(null);return s.useEffect(()=>{let t=!1,n=e.__froomleList;return r.current&&n&&r.current.setAttribute(`data-froomle-reco`,n),Promise.resolve(e).then(e=>{if(t||!r.current)return;let n=v(e,`Id`,`item_id`),i=v(e,`ItemType`,`item_type`),a=v(e,`RequestId`,`request_id`),o=v(e,`UserGroup`,`user_group`)||y();n&&r.current.setAttribute(`data-froomle-id`,n),i&&r.current.setAttribute(`data-froomle-item-type`,i),a&&r.current.setAttribute(`data-froomle-request-id`,a),o&&r.current.setAttribute(`data-froomle-user-group`,o)}).catch(()=>{}),()=>{t=!0}},[e]),s.createElement(_.Provider,{value:e},s.createElement(`div`,{ref:r,...n},t))}const x=()=>{let e=l(_);if(e===null)throw Error(`useFroomleReco must be used within a FroomleRecoProvider`);return e};function S(e){let t=d(null),[n,r]=f(0);if(!t.current){let{list:n,filters:r,...i}=e;t.current=a({list:n,filters:r,others:Object.entries(i).map(([e,t])=>({key:e,value:t}))})}return u(()=>{let e=!0;return Promise.resolve(t.current).then(()=>{e&&r(1)}).catch(()=>{e&&r(1)}),()=>{e=!1}},[]),t.current}export{p as FroomleCustomItem,h as FroomleOrder,m as FroomleOrderItem,b as FroomleReco,g as FroomleSdkInit,S as useCreateReco,x as useReco};
@@ -0,0 +1 @@
1
+ import{b as e,y as t}from"./js-FtOpub-e.js";function n(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}const r=[];function i(){var e;return typeof document>`u`?``:((e=document.querySelector(`[data-froomle-user-group]`))==null?void 0:e.getAttribute(`data-froomle-user-group`))||``}function a(e,t){var n;let r=e,i=((n=r==null?void 0:r.UserGroup)==null?typeof(r==null?void 0:r.get)==`function`?r.get(`user_group`):void 0:n)||t;if(i&&(r.UserGroup=i,typeof(r==null?void 0:r.getData)==`function`)){let e=r.getData();e&&(!e.user_group||e.user_group===``)&&(e.user_group=i)}}async function o(){let e=r.splice(0,r.length);if(e.length!==0)try{let n=e.map(e=>e.req),r=t.requestsToLists(n),i=await t.getRawRecommendations(r),o=i.user_group||``;typeof document<`u`&&o&&document.documentElement.setAttribute(`data-froomle-user-group`,o);let s=i.lists().reduce((e,t)=>[...e,...t.items],[]);s.forEach(e=>a(e,o)),e.forEach((e,t)=>{s[t]?e.deferred.resolve(s[t]):e.deferred.reject(Error(`No recommendation available`))})}catch(t){throw e.forEach(e=>{e.deferred.reject(t)}),t}}function s(e){let t,n,i={promise:new Promise((e,r)=>{t=e,n=r}),resolve:t,reject:n};return r.push({deferred:i,req:e}),i}function c(t){let r=s(t).promise;n();let a=function(e,t){return r.then(t=>(o.completeTarget=t,e?e(t):t),e=>t?t(e):Promise.reject(e))},o=new Proxy(new e({item_id:``,request_id:``,user_group:``}),{get(e,n,r){if(n===`then`)return a;if(n===`__froomleList`)return t.list;if(n===`get`){let t=Reflect.get(e,n,r);return function(...e){return t.apply(this,e)}}if(typeof n!=`string`)return Reflect.get(e,n,r);let i=Reflect.get(e,n,r);if(i!=null&&i!==``)return i;let o=e.get(n);return o!=null&&o!==``?o:``},set(e,t,n,r){if(t===`completeTarget`){if(Object.assign(e,n),!e.UserGroup){let t=i();if(t){e.UserGroup=t;let n=e.getData();n&&!n.user_group&&(n.user_group=t)}}return!0}return Reflect.set(e,t,n,r)},has(e,t){return e.get(t)!==void 0}});return o}export{c as n,o as t};
@@ -0,0 +1,5 @@
1
+ var e=class e{static global(t){return e.globals[t]?e.globals[t]:e.globals[t]={}}static createStatic(e,t,n){let r=null;Object.defineProperty(e,t,{enumerable:!0,get:function(){return n!=null&&(r=n(),n=null),r},set:function(e){n!=null&&(r=n(),n=null),r=e}})}static iterator(t){if(Array.isArray(t)){let n=t;return function(){return e.mkIter(n)}}else return typeof t.iterator==`function`?t.iterator.bind(t):t.iterator}static getIterator(t){return Array.isArray(t)?e.mkIter(t):t.iterator()}static mkIter(e){return new t(e)}static extend(t){function n(){this[e.new].apply(this,arguments)}return Object.setPrototypeOf(n.prototype,t.prototype),n}static inherits(t,n){n==null&&(n=!1);function r(){n&&t&&r[e.init]&&r[e.init](),this[e.new].apply(this,arguments)}return n?r[e.init]=()=>{let n=t();n[e.init]&&n[e.init](),Object.setPrototypeOf(r.prototype,n.prototype),r[e.init]=void 0}:t&&t[e.init]?(n=!0,r[e.init]=()=>{t[e.init]&&t[e.init](),Object.setPrototypeOf(r.prototype,t.prototype),r[e.init]=void 0}):t&&Object.setPrototypeOf(r.prototype,t.prototype),r}static bind(t,n){if(n==null)return null;n.__id__==null&&(n.__id__=e.fid++);let r=null;return t.hx__closures__==null?t.hx__closures__={}:r=t.hx__closures__[n.__id__],r==null&&(r=n.bind(t),t.hx__closures__[n.__id__]=r),r}static get __name__(){return`genes.Register`}get __class__(){return e}};e.$global=typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:void 0,e.globals={},e.new=Symbol(),e.init=Symbol(),e.fid=0;const t=e.global(`$hxClasses`)[`genes._Register.ArrayIterator`]=class t extends e.inherits(){[e.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 t}};t.prototype.array=null,t.prototype.current=null,e.$global;const n=e.global(`$hxClasses`)[`haxe.ValueException`]=class t extends e.inherits(()=>r,!0){[e.new](t,n,r){super[e.new](String(t),n,r),this.value=t}unwrap(){return this.value}static get __name__(){return`haxe.ValueException`}static get __super__(){return r}get __class__(){return t}};n.prototype.value=null,e.$global;const r=e.global(`$hxClasses`)[`haxe.Exception`]=class t extends e.inherits(()=>Error,!0){[e.new](e,t,n){Error.call(this,e),this.message=e,this.__previousException=t,this.__nativeException=n==null?this:n}unwrap(){return this.__nativeException}get_native(){return this.__nativeException}static caught(e){return e instanceof t?e:e instanceof Error?new t(e.message,null,e):new n(e,null,e)}static thrown(e){return e instanceof t?e.get_native():e instanceof Error?e:new n(e)}static get __name__(){return`haxe.Exception`}static get __super__(){return Error}get __class__(){return t}};r.prototype.native=null,r.prototype.__skipStack=null,r.prototype.__nativeException=null,r.prototype.__previousException=null,e.$global;const i=e.global(`$hxClasses`).Std=class e{static string(e){return a.__string_rec(e,``)}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}static random(e){return e<=0?0:Math.floor(Math.random()*e)}static get __name__(){return`Std`}get __class__(){return e}};Object.defineProperty(String.prototype,`__class__`,{value:String,enumerable:!1,writable:!0}),String.__name__=!0,Array.__name__=!0,e.$global;const a=e.global(`$hxClasses`)[`js.Boot`]=class t{static getClass(e){if(e==null)return null;if(e instanceof Array)return Array;{let n=e.__class__;if(n!=null)return n;let r=t.__nativeClassName(e);return r==null?null:t.__resolveNativeClass(r)}}static __string_rec(n,r){if(n==null)return`null`;if(r.length>=5)return`<...>`;let i=typeof n;switch(i==`function`&&(n.__name__||n.__ename__)&&(i=`object`),i){case`function`:return`<function>`;case`object`:if(n.__enum__){let i=e.global(`$hxEnums`)[n.__enum__].__constructs__[n._hx_index],a=i._hx_name;return i.__params__?(r+=` `,a+`(`+(function(e){var a;let o=[];{let e=0,a=i.__params__;for(;e<a.length;){let i=a[e];e+=1,o.push(t.__string_rec(n[i],r))}}return a=o,a})(this).join(`,`)+`)`):a}if(n instanceof Array){let e=`[`;r+=` `;let i=0,a=n.length;for(;i<a;){let a=i++;e+=(a>0?`,`:``)+t.__string_rec(n[a],r)}return e+=`]`,e}let i;try{i=n.toString}catch{return`???`}if(i!=null&&i!=Object.toString&&typeof i==`function`){let e=n.toString();if(e!=`[object Object]`)return e}let a=`{
2
+ `;r+=` `;let o=n.hasOwnProperty!=null,s=null;for(s in n)o&&!n.hasOwnProperty(s)||s==`prototype`||s==`__class__`||s==`__super__`||s==`__interfaces__`||s==`__properties__`||(a.length!=2&&(a+=`,
3
+ `),a+=r+s+` : `+t.__string_rec(n[s],r));return r=r.substring(1),a+=`
4
+ `+r+`}`,a;case`string`:return n;default:return String(n)}}static __interfLoop(e,n){if(e==null)return!1;if(e==n)return!0;let r=e.__interfaces__;if(r!=null&&(e.__super__==null||e.__super__.__interfaces__!=r)){let e=0,i=r.length;for(;e<i;){let i=r[e++];if(i==n||t.__interfLoop(i,n))return!0}}return t.__interfLoop(e.__super__,n)}static __instanceof(n,r){if(r==null)return!1;switch(r){case Array:return n instanceof Array;case`$hxCoreType__Bool`:return typeof n==`boolean`;case`$hxCoreType__Dynamic`:return n!=null;case`$hxCoreType__Float`:return typeof n==`number`;case`$hxCoreType__Int`:return typeof n==`number`?(n|0)===n:!1;case String:return typeof n==`string`;default:if(n!=null){if(typeof r==`function`){if(t.__downcastCheck(n,r))return!0}else if(typeof r==`object`&&t.__isNativeObj(r)&&n instanceof r)return!0}else return!1;return r==`$hxCoreType__Class`&&n.__name__!=null||r==`$hxCoreType__Enum`&&n.__ename__!=null?!0:n.__enum__==null?!1:e.global(`$hxEnums`)[n.__enum__]==r}}static __downcastCheck(e,n){return e instanceof n?!0:n.__isInterface__?t.__interfLoop(t.getClass(e),n):!1}static __cast(e,n){if(e==null||t.__instanceof(e,n))return e;throw r.thrown(`Cannot cast `+i.string(e)+` to `+i.string(n))}static __nativeClassName(e){let n=t.__toStr.call(e).slice(8,-1);return n==`Object`||n==`Function`||n==`Math`||n==`JSON`?null:n}static __isNativeObj(e){return t.__nativeClassName(e)!=null}static __resolveNativeClass(t){return e.$global[t]}static get __name__(){return`js.Boot`}get __class__(){return t}};a.__toStr={}.toString,e.$global;const o=e.global(`$hxClasses`)[`js.Browser`]=class e{static get supported(){return this.get_supported()}static get_supported(){return typeof window<`u`&&window.location!==void 0?typeof window.location.protocol==`string`:!1}static createXMLHttpRequest(){if(typeof XMLHttpRequest<`u`)return new XMLHttpRequest;if(typeof ActiveXObject<`u`)return new`ActiveXObject`(`Microsoft.XMLHTTP`);throw r.thrown(`Unable to create XMLHttpRequest object.`)}static get __name__(){return`js.Browser`}get __class__(){return e}};e.$global;const s=e.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(e=>({_hx_index:3,__enum__:`haxe.io.Error`,e}),{_hx_name:`Custom`,__params__:[`e`]})};s.__constructs__=[s.Blocked,s.Overflow,s.OutsideBounds,s.Custom],s.__empty_constructs__=[s.Blocked,s.Overflow,s.OutsideBounds],e.$global;const c=e.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`}};c.__constructs__=[c.UTF8,c.RawNative],c.__empty_constructs__=[c.UTF8,c.RawNative],e.$global;const l=e.global(`$hxClasses`)[`haxe.io.Bytes`]=class t extends e.inherits(){[e.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,n){if(e<0||t<0||e+t>this.length)throw r.thrown(s.OutsideBounds);n==null&&(n=c.UTF8);let i=``,a=this.b,o=e,l=e+t;switch(n._hx_index){case 0:for(;o<l;){let e=a[o++];if(e<128){if(e==0)break;i+=String.fromCodePoint(e)}else if(e<224){let t=(e&63)<<6|a[o++]&127;i+=String.fromCodePoint(t)}else if(e<240){let t=a[o++],n=(e&31)<<12|(t&127)<<6|a[o++]&127;i+=String.fromCodePoint(n)}else{let t=a[o++],n=a[o++],r=(e&15)<<18|(t&127)<<12|(n&127)<<6|a[o++]&127;i+=String.fromCodePoint(r)}}break;case 1:for(;o<l;){let e=a[o++]|a[o++]<<8;i+=String.fromCodePoint(e)}break}return i}static ofData(e){let n=e.hxBytes;return n==null?new t(e):n}static get __name__(){return`haxe.io.Bytes`}get __class__(){return t}};l.prototype.length=null,l.prototype.b=null,e.$global;const u=e.global(`$hxClasses`)[`haxe.http.HttpBase`]=class t extends e.inherits(){[e.new](t){this.url=t,this.headers=[],this.params=[],this.emptyOnData=e.bind(this,this.onData)}get responseData(){return this.get_responseData()}setHeader(e,t){let n=0,r=this.headers.length;for(;n<r;){let r=n++;if(this.headers[r].name==e){this.headers[r]={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 e.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,c.UTF8)),this.responseAsString}static get __name__(){return`haxe.http.HttpBase`}get __class__(){return t}};u.prototype.url=null,u.prototype.responseBytes=null,u.prototype.responseAsString=null,u.prototype.postData=null,u.prototype.postBytes=null,u.prototype.headers=null,u.prototype.params=null,u.prototype.emptyOnData=null,e.$global;const d=e.global(`$hxClasses`)[`haxe.iterators.MapKeyValueIterator`]=class t extends e.inherits(){[e.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 t}};d.prototype.map=null,d.prototype.keys=null,e.$global;const f=function(){};f.__isInterface__=!0,e.$global;const p=e.global(`$hxClasses`)[`genes.util.EsMap`]=class t extends e.inherits(){[e.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 t.adaptIterator(this.inst.keys())}iterator(){return t.adaptIterator(this.inst.values())}toString(){let e=[],n=t.adaptIterator(this.inst.keys());for(;n.hasNext();){let t=n.next();e.push(``+i.string(t)+` => `+i.string(this.inst.get(t)))}return`{`+e.join(`, `)+`}`}clear(){this.inst.clear()}static adaptIterator(e){let t,n,r=function(){let r=e.next();t=r.value,n=r.done};return{hasNext:function(){return n==null&&r(),!n},next:function(){n==null&&r();let e=t;return r(),e}}}static get __name__(){return`genes.util.EsMap`}get __class__(){return t}};p.prototype.inst=null,e.$global;const m=e.global(`$hxClasses`)[`haxe.ds.StringMap`]=class t extends e.inherits(p){[e.new](){super[e.new]()}copy(){let e=new t;return e.inst=new Map(this.inst),e}keyValueIterator(){return new d(this)}static get __name__(){return`haxe.ds.StringMap`}static get __interfaces__(){return[f]}static get __super__(){return p}get __class__(){return t}};e.$global;const h=e.global(`$hxClasses`).HxOverrides=class e{static cca(e,t){let n=e.charCodeAt(t);if(n==n)return n}static substr(e,t,n){if(n==null)n=e.length;else if(n<0)if(t==0)n=e.length+n;else return``;return e.substr(t,n)}static now(){return Date.now()}static get __name__(){return`HxOverrides`}get __class__(){return e}};typeof performance<`u`&&typeof performance.now==`function`&&(h.now=performance.now.bind(performance)),e.$global;const g=e.global(`$hxClasses`).StringTools=class e{static isSpace(e,t){let n=h.cca(e,t);return n>8&&n<14?!0:n==32}static ltrim(t){let n=t.length,r=0;for(;r<n&&e.isSpace(t,r);)++r;return r>0?h.substr(t,r,n-r):t}static rtrim(t){let n=t.length,r=0;for(;r<n&&e.isSpace(t,n-r-1);)++r;return r>0?h.substr(t,0,n-r):t}static replace(e,t,n){return e.split(t).join(n)}static get __name__(){return`StringTools`}get __class__(){return e}};e.$global;const _=e.global(`$hxClasses`).Lambda=class t{static exists(t,n){let r=e.getIterator(t);for(;r.hasNext();)if(n(r.next()))return!0;return!1}static get __name__(){return`Lambda`}get __class__(){return t}};e.$global;const v=e.global(`$hxClasses`).EReg=class t extends e.inherits(){[e.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 r.thrown(`EReg::matched`)}matchedPos(){if(this.r.m==null)throw r.thrown(`No string matched`);return{pos:this.r.m.index,len:this.r.m[0].length}}matchSub(e,t,n){if(n==null&&(n=-1),this.r.global){this.r.lastIndex=t,this.r.m=this.r.exec(n<0?e:h.substr(e,0,t+n));let r=this.r.m!=null;return r&&(this.r.s=e),r}else{let r=this.match(n<0?h.substr(e,t,null):h.substr(e,t,n));return r&&(this.r.s=e,this.r.m.index+=t),r}}map(e,t){let n=0,r=``;do{if(n>=e.length)break;if(!this.matchSub(e,n)){r+=i.string(h.substr(e,n,null));break}let a=this.matchedPos();r+=i.string(h.substr(e,n,a.pos-n)),r+=i.string(t(this)),a.len==0?(r+=i.string(h.substr(e,a.pos,1)),n=a.pos+1):n=a.pos+a.len}while(this.r.global);return!this.r.global&&n>0&&n<e.length&&(r+=i.string(h.substr(e,n,null))),r}static get __name__(){return`EReg`}get __class__(){return t}};v.prototype.r=null,e.$global;const y=e.global(`$hxClasses`)[`haxe.http.HttpJs`]=class t extends e.inherits(u){[e.new](t){this.async=!0,this.withCredentials=!1,super[e.new](t)}request(t){this.responseAsString=null,this.responseBytes=null,this.responseHeaders=null;let n=this.req=o.createXMLHttpRequest(),a=this,s=function(t){if(n.readyState!=4)return;let r;try{r=n.status}catch{r=null}if(r==0&&o.get_supported()&&e.$global.location!=null){let t=e.$global.location.protocol.toLowerCase();new v(`^(?:about|app|app-storage|.+-extension|file|res|widget):$`,``).match(t)&&(r=n.response==null?404:200)}if(r==null&&(r=null),r!=null&&a.onStatus(r),r!=null&&r>=200&&r<400){a.req=null;let e=n.getAllResponseHeaders().split(`\r
5
+ `),t=[],r=0,i=e;for(;r<i.length;){let e=i[r];++r,e!=``&&t.push(e)}e=t,a.responseHeaders=new m;let o=0;for(;o<e.length;){let t=e[o];++o;let n=t.split(`: `),r=n.shift(),i=n.length==1?n[0]:n.join(`: `);i=g.ltrim(g.rtrim(i)),a.responseHeaders.inst.set(r,i)}a.success(l.ofData(n.response))}else if(r==null||r==0&&n.response==null)a.req=null,a.onError(`Failed to connect or resolve host`);else if(r==null)a.req=null,a.responseBytes=n.response==null?null:l.ofData(n.response),a.onError(`Http Error #`+n.status);else switch(r){case 12007:a.req=null,a.onError(`Unknown host`);break;case 12029:a.req=null,a.onError(`Failed to connect to host`);break;default:a.req=null,a.responseBytes=n.response==null?null:l.ofData(n.response),a.onError(`Http Error #`+n.status)}};this.async&&(n.onreadystatechange=s);let c,u=this.postData,d=this.postBytes;if(u==null)if(d==null)c=null;else{let e=d;c=new Blob([e.b.bufferValue])}else c=d==null?u:null;if(c!=null)t=!0;else{let e=0,t=this.params;for(;e<t.length;){let n=t[e];++e,c=c==null?``:(c==null?`null`:i.string(c))+`&`;let r=n.name,a=(c==null?`null`:i.string(c))+encodeURIComponent(r)+`=`,o=n.value;c=a+encodeURIComponent(o)}}try{if(t)n.open(`POST`,this.url,this.async);else if(c!=null){let e=this.url.split(`?`).length<=1;n.open(`GET`,this.url+(e?`?`:`&`)+(c==null?`null`:i.string(c)),this.async),c=null}else n.open(`GET`,this.url,this.async);n.responseType=`arraybuffer`}catch(e){let t=r.caught(e).unwrap();this.req=null,this.onError(t.toString());return}n.withCredentials=this.withCredentials,!_.exists(this.headers,function(e){return e.name==`Content-Type`})&&t&&this.postData==null&&n.setRequestHeader(`Content-Type`,`application/x-www-form-urlencoded`);let f=0,p=this.headers;for(;f<p.length;){let e=p[f];++f,n.setRequestHeader(e.name,e.value)}n.send(c),this.async||s(null)}static get __name__(){return`haxe.http.HttpJs`}static get __super__(){return u}get __class__(){return t}};y.prototype.async=null,y.prototype.withCredentials=null,y.prototype.responseHeaders=null,y.prototype.req=null,e.$global;const b=e.global(`$hxClasses`).Type=class e{static createInstance(e,t){return new(Function.prototype.bind.apply(e,[null].concat(t)))}static get __name__(){return`Type`}get __class__(){return e}};e.$global;const x=e.global(`$hxClasses`).Reflect=class e{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let n;if(e==null)return null;{let r;return e.__properties__?(n=e.__properties__[`get_`+t],r=n):r=!1,r?e[n]():e[t]}}static setProperty(e,t,n){let r,i;e.__properties__?(r=e.__properties__[`set_`+t],i=r):i=!1,i?e[r](n):e[t]=n}static fields(e){let t=[];if(e!=null){let r=Object.prototype.hasOwnProperty;for(var n in e)n!=`__id__`&&n!=`hx__closures__`&&r.call(e,n)&&t.push(n)}return t}static compare(e,t){return e==t?0:e>t?1:-1}static get __name__(){return`Reflect`}get __class__(){return e}};e.$global;const S=e.global(`$hxClasses`)[`internal.http.FetchHttp`]=class t extends e.inherits(y){[e.new](t){this.responseStatus=0,super[e.new](t)}request(t){let n=e.$global,a=n.fetch,o=n.Headers,s=n.URLSearchParams;if(a==null){this.onError(`Fetch API not found.`);return}let c=b.createInstance(o,[]),l=0,u=this.headers;for(;l<u.length;){let e=u[l];++l,c.append(e.name,e.value)}let d=t?`POST`:`GET`,f=null;if(t)if(this.postData!=null)f=this.postData;else{f=b.createInstance(s,[]);let e=0,t=this.params;for(;e<t.length;){let n=t[e];++e,f.append(n.name,n.value)}}let p={method:d,headers:c,body:f},m=this,h=a(this.url,p).then(function(e){if(m.responseStatus=e.status,m.onStatus(e.status),e.ok)return e.text();throw r.thrown(`HTTP Error: `+i.string(e.status))}).then(function(e){m.onData(e)}),g=x.field(h,`catch`);g!=null&&g.apply(h,[function(e){m.onError(i.string(e))}])}static get __name__(){return`internal.http.FetchHttp`}static get __super__(){return y}get __class__(){return t}};S.prototype.responseStatus=null,e.$global;const C=e.global(`$hxClasses`)[`internal.data.UUID`]=class e{static randomHexChar(){return`0123456789abcdef`.charAt(i.random(16))}static v4(){let e=``,t=0;for(;t<36;)switch(t++){case 14:e+=`4`;break;case 19:e+=i.string(`0123456789abcdef`.charAt(8+i.random(4)));break;case 8:case 13:case 18:case 23:e+=`-`;break;default:e+=i.string(`0123456789abcdef`.charAt(i.random(16)))}return e}static get __name__(){return`internal.data.UUID`}get __class__(){return e}};C.HEX=`0123456789abcdef`,e.$global;const w=function(){};w.__isInterface__=!0;const T=function(){};T.__isInterface__=!0;const E=function(){};E.__isInterface__=!0,e.$global;const D=e.global(`$hxClasses`)[`internal.RecoBackendV2`]=class t extends e.inherits(){[e.new](){}static _requestUri(){return(t._safe_request?`https://`:`http://`)+t._req_domain+`/api/`+t._environment+`/recommendations/requests`}static noConsentBody(){return{device_id:`no-consent`,user_group:`no-consent`,version:`no-consent`}}static buildRequestBody(e){let n={lists:e,page_type:t._page_visit,channel:t._channel};if(t._consent>=2&&t._history.length>0&&(n.histories=t._buildHistories()),t._consent<2){let e=t.noConsentBody(),r=0,i=x.fields(e);for(;r<i.length;){let t=i[r];++r,n[t]=x.field(e,t)}}else t._user_id!=null&&(n.user_id=t._user_id),n.device_id=t._device_id;let r=0,a=t._others;for(;r<a.length;){let e=a[r];++r,n[e.key]=e.value}let o=x.field(n,`context_item`),s=x.field(n,`context_item_type`);return o!=null&&i.string(o)!=``&&(s==null||i.string(s)==``)&&(n.context_item_type=`article`),n}static _buildHistories(){return{pageviews:t._history}}static requestsToLists(e){let t=[],n=``,r=[],i=0,a=[],o=function(e,t,o){n=e,r=t,i=0,a=o},s=function(e){let t=[];if(e==null)return t;let n=0;for(;n<e.length;){let r=e[n];++n,!(r==null||r.key==null||r.key==``)&&t.push({key:r.key,value:r.value})}return t},c=function(e,t){if(e==null&&t==null)return!0;if(e==null||t==null||e.length!=t.length)return!1;let n=Array(e.length),r=0,i=e.length;for(;r<i;){let t=r++;n[t]=JSON.stringify(e[t])}let a=n,o=Array(t.length),s=0,c=t.length;for(;s<c;){let e=s++;o[e]=JSON.stringify(t[e])}let l=o;a.sort(x.compare),l.sort(x.compare);let u=0,d=a.length;for(;u<d;){let e=u++;if(a[e]!=l[e])return!1}return!0},l=function(){let e={limit:i,list_name:n,list_size:i},o=0;for(;o<r.length;){let t=r[o];++o;let n=t.value;n instanceof Array||(n=[n]),e[t.key]=n}let s=0;for(;s<a.length;){let t=a[s];++s,e[t.key]=t.value}t.push(e)},u=0;for(;u<e.length;){let t=e[u];++u;let d=s(t.filters),f=t.others==null?[]:t.others;if(n==``){o(t.list,d,f),i+=1;continue}else (n!=t.list||!c(r,d)||!c(a,f))&&(l(),o(t.list,d,f));i+=1}return i!=0&&l(),t}static _requestRecos(e){let n=null,a=null,o=new Promise(function(e,t){n=e,a=t}),s=o;s._resolve=n,s._reject=a,s._isFinished=!1,s._result=null,s._error=null;let c=o,l=!1,u=new S(t._requestUri());u.setHeader(`Content-Type`,`application/json`);let d=t.buildRequestBody(e),f=JSON.stringify(d);u.setPostData(f);let p=function(e){if(l)return;l=!0;let t=c;t._isFinished||(t._error=e,t._isFinished=!0,t._reject(e))};u.onError=function(e){p(`HTTP Request Error: `+e)},u.onStatus=function(e){(e<200||e>=300)&&p(`HTTP Status Error: `+e)};try{u.request(!0)}catch(e){let t=r.caught(e).unwrap();return p(`Failed to execute recommendation request: `+i.string(t)),c}let m=function(e){if(!l)try{let t=JSON.parse(e),n=O.fromRequestData(t);l=!0;let r=c;r._isFinished||(r._result=n,r._error=null,r._isFinished=!0,r._resolve(n))}catch(e){let t=r.caught(e).unwrap();p(`Failed to parse recommendation response: `+i.string(t))}},h=u.get_responseData();return h==null?l||(u.onData=m):m(h),c}static getOrder(e,n,a){let o={list_name:e,limit:a.length,list_size:a.length},s={};x.setProperty(s,n,a),x.setProperty(o,`order`,s);let c=null,l=null,u=new Promise(function(e,t){c=e,l=t}),d=u;d._resolve=c,d._reject=l,d._isFinished=!1,d._result=null,d._error=null;let f=u;return t.getRawRecommendations([o]).then(function(e){try{let t=[],n=e.lists();if(n!=null&&n.length>0){let e=n[0].items;if(e instanceof Array){let n=0,r=e;for(;n<r.length;){let e=r[n];++n;let i=e.get(`categories`);i!=null&&t.push(i)}}}let r=f;r._isFinished||(r._result=t,r._error=null,r._isFinished=!0,r._resolve(t))}catch(e){let t=r.caught(e).unwrap(),n=`Failed to build order response: `+i.string(t),a=f;a._isFinished||(a._error=n,a._isFinished=!0,a._reject(n))}},function(e){let t=f;t._isFinished||(t._error=e,t._isFinished=!0,t._reject(e))}),f}static getRawRecommendations(e){return t._requestRecos(e)}static addHistories(e,n){if(n==null&&(n=`article`),e==null||e.length==0)return;let r=n!=null&&n!=``?n:`article`,a=0;for(;a<e.length;){let n=e[a];if(++a,typeof n==`string`){let e=i.string(n);e!=``&&t._history.push({id:e,item_type:r});continue}let o=n,s=x.field(o,`id`);if(s==null)continue;let c=i.string(s);if(c==``)continue;let l=x.field(o,`item_type`);(l==null||i.string(l)==``)&&(l=x.field(o,`itemType`));let u=l!=null&&i.string(l)!=``?i.string(l):r;t._history.push({id:c,item_type:u})}}static setOthers(e,n){let r=0,i=t._others;for(;r<i.length;){let t=i[r];if(++r,t.key==e){t.value=n;return}}t._others.push({key:e,value:n})}static setConsent(e){e>2&&(e=2),t._consent=e,e==2&&t.getDeviceId()==`no-consent`&&t.setDeviceId(C.v4())}static setChannel(e){t._channel=e}static setPageVisit(e){t._page_visit=e}static setEnvironment(e){t._environment=e}static setDeviceId(e){t._device_id=e}static setUserId(e){t._user_id=e}static setRequestDomain(e){t._req_domain=e}static setSafeRequest(e){t._safe_request=e}static setContextItem(e){t.setOthers(`context_item`,e)}static setContextItemType(e){t.setOthers(`context_item_type`,e)}static getRequestDomain(){return t._req_domain}static getSafeRequest(){return t._safe_request}static getEnvironment(){return t._environment}static getPageVisit(){return t._page_visit}static getUserId(){return t._user_id}static getDeviceId(){return t._device_id}static getConsent(){return t._consent}static getChannel(){return t._channel}static getOthers(e){let n=0,r=t._others;for(;n<r.length;){let t=r[n];if(++n,e==t.key)return t.value}return null}static getContextItem(){return t.getOthers(`context_item`)}static getContextItemType(){return t.getOthers(`context_item_type`)}static get __name__(){return`internal.RecoBackendV2`}get __class__(){return t}};D._environment=null,D._device_id=`no-consent`,D._user_id=null,D._consent=0,D._req_domain=`europe-west1.froomle.com`,D._page_visit=null,D._channel=`www-desktop`,D._safe_request=!0,D._history=[],D._others=[];const O=e.global(`$hxClasses`)[`internal._RecommendationsInternal`]=class t extends e.inherits(){[e.new](e,t,n,r,i){this.request_id=t,this.user_group=n,this.device_id=e,this.user_id=r,this._lists=i}items(){let e=[],t=0,n=this._lists;for(;t<n.length;){let r=n[t];++t;let i=0,a=r.items;for(;i<a.length;){let t=a[i];++i,e.push(t)}}return e}lists(){return this._lists}getItemsByListName(e){let t=0,n=this._lists;for(;t<n.length;){let r=n[t];if(++t,r.list_name==e)return r}return null}toJson(){let e={request_id:this.request_id,user_group:this.user_group,user_id:this.user_id,device_id:this.device_id,lists:[]},t=0,n=this._lists;for(;t<n.length;){let r=n[t];++t;let i={limit:r.limit,list_key:r.list_key,list_name:r.list_name,list_size:r.list_size,items:[]},o=0,s=r.items;for(;o<s.length;){let e=s[o];++o,i.items.push(a.__cast(e,A).getData())}e.lists.push(i)}return JSON.stringify(e)}static fromRequestData(e){let n=x.getProperty(e,`lists`),r=[],i=0;for(;i<n.length;){let t=n[i];++i;let a=x.getProperty(t,`items`),o=[],s=0;for(;s<a.length;){let t=a[s];++s,x.setProperty(t,`request_id`,x.getProperty(e,`request_id`)),x.setProperty(t,`user_group`,x.getProperty(e,`user_group`)),o.push(new A(t))}let c=new k({limit:x.getProperty(t,`limit`),list_key:x.getProperty(t,`list_key`),list_name:x.getProperty(t,`list_name`),list_size:x.getProperty(t,`list_size`),items:o,request_id:x.getProperty(e,`request_id`)});r.push(c)}return new t(x.getProperty(e,`device_id`),x.getProperty(e,`request_id`),x.getProperty(e,`user_group`),x.getProperty(e,`user_id`),r)}static get __name__(){return`internal._RecommendationsInternal`}static get __interfaces__(){return[w]}get __class__(){return t}};O.prototype.request_id=null,O.prototype.user_group=null,O.prototype.user_id=null,O.prototype.device_id=null,O.prototype._lists=null;const k=e.global(`$hxClasses`)[`internal._RecommendationsListInternal`]=class t extends e.inherits(){[e.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,this.request_id=e.request_id}static get __name__(){return`internal._RecommendationsListInternal`}static get __interfaces__(){return[T]}get __class__(){return t}};k.prototype.limit=null,k.prototype.list_key=null,k.prototype.list_name=null,k.prototype.list_size=null,k.prototype.items=null,k.prototype.request_id=null;const A=e.global(`$hxClasses`)[`internal._RecommendationItemInternal`]=class t extends e.inherits(){[e.new](e){this.Id=x.getProperty(e,`item_id`),this.RequestId=x.getProperty(e,`request_id`),this.UserGroup=x.getProperty(e,`user_group`),this._data=e}getData(){return this._data}get(e){return this._data[e]}toJson(){return JSON.stringify(this._data)}static get __name__(){return`internal._RecommendationItemInternal`}static get __interfaces__(){return[E]}get __class__(){return t}};A.prototype.Id=null,A.prototype.RequestId=null,A.prototype.UserGroup=null,A.prototype._data=null,e.$global;const j=function(){};j.__isInterface__=!0,e.$global;const M=e.global(`$hxClasses`)[`internal.js.JSFroomleDomTree`]=class t extends e.inherits(){[e.new](){}getRoot(){return this.root}createElement(e){return this.root.ownerDocument.createElement(e)}toString(){return this.root.ownerDocument.documentElement.outerHTML}static fromHTML(e){let n=new DOMParser().parseFromString(e,`text/html`),r=new t;return r.root=n.documentElement,r}static fromDocument(e){let n=new t;return n.root=e.documentElement,n}static get __name__(){return`internal.js.JSFroomleDomTree`}static get __interfaces__(){return[j]}get __class__(){return t}};M.prototype.root=null,e.$global;const N=e.global(`$hxClasses`)[`internal.domHandler.DomDomDom`]=class t extends e.inherits(){[e.new](){}static _fillRecoTargets(e){let n=null,r=null,i=new Promise(function(e,t){n=e,r=t}),a=i;a._resolve=n,a._reject=r,a._isFinished=!1,a._result=null,a._error=null;let o=i;if(e==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}let s=[],c=[],l=e.querySelectorAll(`*`),u=0,d=l.length;for(;u<d;){let e=u++,t=l.item(e);t instanceof HTMLElement&&c.push(t)}let f=c;f.push(e);let p=0;for(;p<f.length;){let e=f[p];++p;let t=0,n=[],r=0,i=e.attributes;for(;r<i.length;){let e=i[r];++r,n.push({name:e.name,value:e.value})}let a=n;for(;t<a.length;){let n=a[t];++t,n.name==`data-froomle-reco`&&s.push(e)}}let m=[],g=0;for(;g<s.length;){let e=s[g];++g;let t=e.getAttribute(`data-froomle-request-id`),n=e.getAttribute(`data-froomle-id`);!(t!=null&&t!=``)&&!(n!=null&&n!=``)&&m.push(e)}if(m.length<1){let e=null,t=null,n=new Promise(function(n,r){e=n,t=r}),r=n;return r._resolve=e,r._reject=t,r._isFinished=!1,r._result=null,r._error=null,n}let _=[],v=[],y=``,b=[],S=[],C=[],w=function(e,t){if(e.length!=t.length)return!1;let n=Array(e.length),r=0,i=e.length;for(;r<i;){let t=r++;n[t]=JSON.stringify(e[t])}let a=n,o=Array(t.length),s=0,c=t.length;for(;s<c;){let e=s++;o[e]=JSON.stringify(t[e])}let l=o;a.sort(x.compare),l.sort(x.compare);let u=0,d=a.length;for(;u<d;){let e=u++;if(a[e]!=l[e])return!1}return!0},T=function(){let e={list_name:y,list_size:S.length,limit:S.length},t=0;for(;t<b.length;){let n=b[t];if(++t,n!=null&&n.key!=null&&n.key!=``){let t=n.value;t instanceof Array||(t=[t]),x.setProperty(e,n.key,t)}}let n=0;for(;n<C.length;){let t=C[n];++n,x.setProperty(e,t.key,t.value)}_.push(e),v.push(S)},E=function(e,t,n,r){y=e,b=t,S=[r],C=n},O=0;for(;O<m.length;){let e=m[O];++O;let t=function(e){let t=[],n=0,r=[],i=0,a=e.attributes;for(;i<a.length;){let e=a[i];++i,r.push({name:e.name,value:e.value})}let o=r;for(;n<o.length;){let e=o[n];if(++n,e.name.startsWith(`data-froomle-reco-filter-`)){let n=h.substr(e.name,25,null),r=e.value;t.push({key:n,value:r})}}return t},n=function(e){let t=[],n=0,r=[],i=0,a=e.attributes;for(;i<a.length;){let e=a[i];++i,r.push({name:e.name,value:e.value})}let o=r;for(;n<o.length;){let e=o[n];if(++n,e.name.startsWith(`data-froomle-variable-`)){let n=h.substr(e.name,22,null),r=e.value;t.push({key:n,value:r})}}return t},r=e.getAttribute(`data-froomle-reco`),i=t(e),a=n(e);if(y==``){E(r,i,a,e);continue}else if(r==y&&w(b,i)&&w(C,a)){S.push(e);continue}else{T(),E(r,i,a,e);continue}}y!=``&&T();let k;if(D.getPageVisit()==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}else if(D.getEnvironment()==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}else try{k=D.getRawRecommendations(_)}catch{let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}return k.then(function(e){let n=e.lists(),r=n.length,i=0,a=r;for(;i<a;){let r=i++,a=n[r];a.items.length,v[r].length;let o=a.items.length,s=0,c=o;for(;s<c;){let n=s++,i=a.items[n],o=v[r][n];t._fillParameters(o,i,e.request_id)}}let s=o;s._isFinished||(s._result=!0,s._error=null,s._isFinished=!0,s._resolve(!0))}),o}static getAttrByPath(e,t,n){n==null&&(n=`fgh`);try{t=new v(`\\\\[(\\\\w+)\\\\]`,`g`).map(t,function(e){return`.`+e.matched(1)}),t=g.replace(t,`[`,`.`),t=g.replace(t,`]`,``),h.cca(t,0)==46&&(t=h.substr(t,1,null));let n=t.split(`.`),r=e.get(n[0]),a=1,o=n.length;for(;a<o;){let e=a++;if(r==null)return null;r=r instanceof Array&&i.parseInt(n[e])!=null?r[i.parseInt(n[e])]:x.field(r,n[e])}return r}catch{return n}}static _buildHistories(e){let t=[],n=[],r=e.querySelectorAll(`[data-froomle-id]`),i=0,a=r.length;for(;i<a;){let e=i++,t=r.item(e);t instanceof HTMLElement&&n.push(t)}let o=n,s=0;for(;s<o.length;){let e=o[s];++s,t.push(e.getAttribute(`data-froomle-id`))}D.addHistories(t)}static fillParam(e,n,r,i,a){a==null&&(a=``);try{let o=t.getAttrByPath(i,r,a);n==`inner`?(e.textContent=o,e.textContent):e.setAttribute(n,o)}catch{}}static _fillParameters(e,n,r){e.setAttribute(`data-froomle-id`,n.get(`item_id`)),e.setAttribute(`data-froomle-request-id`,r);let a=n.get(`item_type`);a!=null&&i.string(a)!=``&&e.setAttribute(`data-froomle-item-type`,i.string(a)),n.UserGroup!=null&&n.UserGroup!=``&&e.setAttribute(`data-froomle-user-group`,n.UserGroup);let o=[],s=e.querySelectorAll(`*`),c=0,l=s.length;for(;c<l;){let e=c++,t=s.item(e);t instanceof HTMLElement&&o.push(t)}let u=o,d=0;for(;d<u.length;){let e=u[d];++d;let r=0,i=[],a=0,o=e.attributes;for(;a<o.length;){let e=o[a];++a,i.push({name:e.name,value:e.value})}let s=i;for(;r<s.length;){let i=s[r];if(++r,i.name.startsWith(`data-froomle-param-`)){let r=g.replace(i.name,`data-froomle-param-`,``),a=i.value;t.fillParam(e,r,a,n)}}}}static _orderElements(e){let t=function(t,n,r){let i=[],a=[],o=0,s=t.childNodes;for(;o<s.length;){let e=s[o];++o,a.push(e)}let c=a,l=0;for(;l<c.length;){let n=c[l];++l;try{if(n.getAttribute(`data-froomle-ordervalue`)!=null){i.push(n);let r=e.createElement(`span`);r.setAttribute(`data-froomle-tmp-node`,`tmp`),t.replaceChild(r,n)}}catch{}}let u=[],d=0;for(;d<i.length;){let e=i[d];++d,u.push(e.getAttribute(`data-froomle-ordervalue`))}return{el:t,key:n,values:u,orderChildren:i,list_name:r}},n=null,r=null,i=new Promise(function(e,t){n=e,r=t}),a=i;a._resolve=n,a._reject=r,a._isFinished=!1,a._result=null,a._error=null;let o=i,s=e.getRoot(),c=[],l=s.querySelectorAll(`*`),u=0,d=l.length;for(;u<d;){let e=u++,t=l.item(e);t instanceof HTMLElement&&c.push(t)}let f=c,p=[],m=0;for(;m<f.length;){let e=f[m];++m;let n=0,r=[],i=0,a=e.attributes;for(;i<a.length;){let e=a[i];++i,r.push({name:e.name,value:e.value})}let o=r;for(;n<o.length;){let r=o[n];++n,r.name.startsWith(`data-froomle-order-`)&&p.push(t(e,r.name.substring(19),r.value))}}if(p.length<1){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}let h=[],g=0;for(;g<p.length;){let e=p[g];++g;let t={list_name:e.list_name,limit:e.values.length,list_size:e.values.length},n={};x.setProperty(n,e.key,e.values),x.setProperty(t,`order`,n),h.push(t)}if(D.getPageVisit()==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}else if(D.getEnvironment()==null){let e=o;return e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1)),o}try{D.getRawRecommendations(h).then(function(e){let t=e.lists(),n=t.length,r=0,i=n;for(;r<i;){let n=r++,i=t[n],a=p[n];a.el.setAttribute(`data-froomle-request-id`,e.request_id);let o=[],s=0,c=i.items;for(;s<c.length;){let e=c[s];++s;let t=e.get(a.key);e.get(a.key);let n=a.values.length,r=0,i=n;for(;r<i;){let e=r++;if(t==a.values[e]){a.orderChildren.length;let t=a.orderChildren[e];o.push(t),a.orderChildren.splice(e,1),a.values.splice(e,1);break}}}o.length;let l=a.el,u=[],d=0,f=l.childNodes;for(;d<f.length;){let e=f[d];++d,u.push(e)}let m=u.length,h=0,g=m;for(;h<g;){let e=h++,t=a.el,n=[],r=0,i=t.childNodes;for(;r<i.length;){let e=i[r];++r,n.push(e)}let s=n[e],c;if(c=s instanceof HTMLElement?s.hasAttribute(`data-froomle-tmp-node`):!1,c&&(a.el.replaceChild(o[0],s),o.splice(0,1),o.length,o.length==0))break}}let a=o;a._isFinished||(a._result=!0,a._error=null,a._isFinished=!0,a._resolve(!0))})}catch{let e=o;e._isFinished||(e._result=!1,e._error=null,e._isFinished=!0,e._resolve(!1))}return o}static domInit(e){let n=null,r=null,i=new Promise(function(e,t){n=e,r=t}),a=i;a._resolve=n,a._reject=r,a._isFinished=!1,a._result=null,a._error=null;let o=i;return t._orderElements(e).then(function(n){t._buildHistories(e.getRoot()),t._fillRecoTargets(e.getRoot()).then(function(e){let t=o;t._isFinished||(t._result=!0,t._error=null,t._isFinished=!0,t._resolve(!0))})}),o}static fillElementRecos(e){t._fillRecoTargets(e)}static runFromHtml(e){if(e==``)return``;let n;try{let t=new DOMParser().parseFromString(e,`text/html`),r=new M;r.root=t.documentElement,n=r}catch{return e}return t.domInit(n),n.toString()}static get __name__(){return`internal.domHandler.DomDomDom`}get __class__(){return t}};e.$global;const P=e.global(`$hxClasses`).FroomleSdk=class e{static register(){e.registered||e._env_set&&e._page_visit_set&&(e.registered=!0)}static buildScriptTag(){let e=`<script src="https://cdn.jsdelivr.net/npm/@froomle/frontend-sdk@0.0.11/dist/froomle.global.js" data-froomle-env="`+D.getEnvironment()+`" `,t=D.getPageVisit();t!=null&&(e+=`data-froomle-page-visit="`+t+`" `);let n=D.getContextItem();if(n!=null){e+=`data-froomle-context-item="`+n+`" `;let t=D.getContextItemType();(t==null||t==``)&&(t=`article`),e+=`data-froomle-context-item-type="`+t+`" `}let r=D.getDeviceId();r!=null&&(e+=`data-froomle-device-id="`+r+`" `);let i=D.getUserId();i!=null&&(e+=`data-froomle-user-id="`+i+`" `);let a=D.getConsent();a>0&&(e+=`data-froomle-consent="`+a+`" `);let o=D.getRequestDomain();o!=null&&(e+=`data-froomle-request-domain="`+o+`" `);let s=D.getChannel();return s!=null&&(e+=`data-froomle-channel="`+s+`" `),e+=`><\/script>`,e}static setEnvironment(t){D.setEnvironment(t),e._env_set=!0,e.register()}static setDeviceId(e){D.setDeviceId(e)}static setUserId(e){D.setUserId(e)}static setConsent(e){D.setConsent(e)}static setPageVisit(t){D.setPageVisit(t),e._page_visit_set=!0,e.register()}static setChannel(e){D.setChannel(e)}static setRequestDomain(e){D.setRequestDomain(e)}static setSafeRequest(e){D.setSafeRequest(e)}static setContextItem(e){D.setContextItem(e)}static setContextItemType(e){D.setContextItemType(e)}static setCustomVariable(e,t){D.setOthers(e,t)}static getUserId(){return D.getUserId()}static getDeviceId(){return D.getDeviceId()}static getEnvironment(){return D.getEnvironment()}static getSafeRequest(){return D.getSafeRequest()}static getPageVisit(){return D.getPageVisit()}static getConsent(){return D.getConsent()}static getRecommendations(e){return D.getRawRecommendations(e)}static getChannel(){return D.getChannel()}static getVersion(){return`0.0.11`}static runFromHtml(e){return N.runFromHtml(e)}static get __name__(){return`FroomleSdk`}get __class__(){return e}};P._env_set=!1,P._page_visit_set=!1,P.registered=!1;function ee(){return(D.getSafeRequest()?`https://`:`http://`)+D.getRequestDomain()+`/api/`+D.getEnvironment()+`/events`}function F(){return D.getConsent()>=1}function I(){return D.getConsent()<2?`no-consent`:D.getDeviceId()}function te(){let e=D.getChannel();if(e)return e}function ne(e){let t=(e==null?void 0:e.getAttribute(`data-froomle-id`))||(e==null?void 0:e.getAttribute(`data-froomle-action-item`));if(t)return t}function re(e){let t=(e==null?void 0:e.getAttribute(`data-froomle-item-type`))||(e==null?void 0:e.getAttribute(`data-froomle-action-item-type`));if(t)return t}function L(e){var t;let n=e==null?void 0:e.getAttribute(`data-froomle-user-group`);if(n)return n;if(!(typeof document>`u`))return((t=document.querySelector(`[data-froomle-user-group]`))==null?void 0:t.getAttribute(`data-froomle-user-group`))||void 0}function ie(e,t,n=`impression`,r){if(!F())return;let i=te()||`www-desktop`,a={event_type:n,page_type:D.getPageVisit(),action_item:e,action_item_type:t,channel:i,device_id:I()},o=L();if(o&&(a.user_group=o),r)for(let e in r)a[e]=r[e];try{fetch(ee(),{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify({events:[a]})})}catch{}}var R=class e{static queueIfNotPresent(t){e.impressionQueue.includes(t)||e.impressionQueue.push(t)}static generateBody(){let t=[];for(let n of e.impressionQueue){let e=ne(n);if(!e)continue;let r=re(n)||`article`,i=te()||`www-desktop`,a={event_type:`impression`,page_type:D.getPageVisit(),action_item:e,action_item_type:r,channel:i,device_id:I()},o=L(n);o&&(a.user_group=o),D.getConsent()>=2&&D.getUserId()&&(a.user_id=D.getUserId());let s=n.getAttribute(`data-froomle-reco`),c=n.getAttribute(`data-froomle-request-id`);s&&c&&(a.list_name=s,a.request_id=c),t.push(a)}return e.impressionQueue=[],JSON.stringify({events:t})}static sendImpressions(){console.log(e.impressionQueue),e.impressionQueue.length!==0&&F()&&fetch(ee(),{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:e.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(t){let n=t.getBoundingClientRect(),r=e.getViewPortRect();return n.right>r.left&&n.left<r.right&&n.bottom>r.top&&n.top<r.bottom}static addIntersectionImpressionListener(t){e.observer.observe(t)}static processDocument(){if(F()){console.log(`🚀 Processing document for impressions`);for(let t of document.querySelectorAll(`[data-froomle-id]`))e.intersectsWithViewPortRect(t)?e.queueIfNotPresent(t):e.addIntersectionImpressionListener(t);e.sendImpressions()}}static processElement(t){if(!F()||!(t instanceof Element))return;let n=[];t.matches(`[data-froomle-id]`)&&n.push(t);for(let e of t.querySelectorAll(`[data-froomle-id]`))n.push(e);if(n.length!==0){for(let t of n)e.intersectsWithViewPortRect(t)?e.queueIfNotPresent(t):e.addIntersectionImpressionListener(t);e.sendImpressions()}}};R.impressionQueue=[],R.observer=null,typeof document<`u`&&(R.observer=new IntersectionObserver((e,t)=>{e.forEach(e=>{e.isIntersecting&&(R.impressionQueue.push(e.target),R.observer.unobserve(e.target))}),R.impressionQueue.length>0&&R.sendImpressions()}));var z=class e{static canTrackEvents(){return D.getConsent()>=1}static readDeviceId(){return D.getConsent()<2?`no-consent`:D.getDeviceId()}static readChannel(){let e=D.getChannel();if(e)return e}static readUserGroup(){var e;if(!(typeof document>`u`))return((e=document.querySelector(`[data-froomle-user-group]`))==null?void 0:e.getAttribute(`data-froomle-user-group`))||void 0}static uri(){return(D.getSafeRequest()?`https://`:`http://`)+D.getRequestDomain()+`/api/`+D.getEnvironment()+`/events`}static generateBody(){let t=e.readChannel()||`www-desktop`,n={event_type:`page_visit`,page_type:D.getPageVisit(),channel:t,device_id:e.readDeviceId()},r=e.readUserGroup();return r&&(n.user_group=r),D.getConsent()>=2&&D.getUserId()&&(n.user_id=D.getUserId()),JSON.stringify({events:[n]})}static sendPageVisit(){D.getPageVisit()&&(D.getContextItem()||e.canTrackEvents()&&fetch(e.uri(),{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:e.generateBody()}))}},B=class e{static canTrackEvents(){return D.getConsent()>=1}static readDeviceId(){return D.getConsent()<2?`no-consent`:D.getDeviceId()}static readChannel(){let e=D.getChannel();if(e)return e}static readActionItemType(){let e=D.getContextItemType();if(e)return e}static readUserGroup(){var e;if(!(typeof document>`u`))return((e=document.querySelector(`[data-froomle-user-group]`))==null?void 0:e.getAttribute(`data-froomle-user-group`))||void 0}static uri(){return(D.getSafeRequest()?`https://`:`http://`)+D.getRequestDomain()+`/api/`+D.getEnvironment()+`/events`}static generateBody(){let t=e.readActionItemType()||`article`,n=e.readChannel()||`www-desktop`,r={event_type:`detail_pageview`,page_type:D.getPageVisit(),action_item:D.getContextItem(),action_item_type:t,channel:n,device_id:e.readDeviceId()},i=e.readUserGroup();return i&&(r.user_group=i),D.getConsent()>=2&&D.getUserId()&&(r.user_id=D.getUserId()),JSON.stringify({events:[r]})}static sendPageView(){D.getContextItem()&&D.getPageVisit()&&e.canTrackEvents()&&fetch(e.uri(),{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:e.generateBody()})}},V=class e{static readAttributeFromChain(e,t){let n=e;for(;n;){for(let e of t){let t=n.getAttribute(e);if(t)return t}n=n.parentElement}}static canTrackEvents(){return D.getConsent()>=1}static readDeviceId(){return D.getConsent()<2?`no-consent`:D.getDeviceId()}static readChannel(){let e=D.getChannel();if(e)return e}static readActionItem(t){return e.readAttributeFromChain(t,[`data-froomle-id`,`data-froomle-action-item`])}static readActionItemType(t){return e.readAttributeFromChain(t,[`data-froomle-item-type`,`data-froomle-action-item-type`])}static readUserGroup(t){var n;let r=e.readAttributeFromChain(t,[`data-froomle-user-group`]);if(r)return r;if(!(typeof document>`u`))return((n=document.querySelector(`[data-froomle-user-group]`))==null?void 0:n.getAttribute(`data-froomle-user-group`))||void 0}static registerClickables(){e.listenerRegistered||(e.listenerRegistered=!0,document.addEventListener(`click`,t=>{if(!e.canTrackEvents())return;let n=t instanceof MouseEvent?t:null,r=t.target,i=r instanceof Element?r:r instanceof Node?r.parentElement:null;if(!i)return;let a=i.closest(`a`);if(!a)return;let o=a.closest(`[data-froomle-id]`);if(!o)return;let s=a.closest(`[data-froomle-reco]`),c=(s?e.readActionItem(s):void 0)||e.readActionItem(o);if(!c)return;let l=(s?e.readActionItemType(s):void 0)||e.readActionItemType(o)||`article`,u=e.readChannel()||`www-desktop`,d=a instanceof HTMLAnchorElement?a.href:null,f=a.getAttribute(`href`),p=typeof f==`string`&&f.trim().startsWith(`#`),m=!!d&&!p&&t.cancelable&&!t.defaultPrevented&&!a.hasAttribute(`download`)&&(!a.target||a.target===`_self`)&&!!n&&n.button===0&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!n.altKey,h=p&&t.cancelable&&!t.defaultPrevented;(m||h)&&t.preventDefault();let g={event_type:`click_on_recommendation`,page_type:D.getPageVisit(),action_item:c,action_item_type:l,channel:u,device_id:e.readDeviceId()},_=(s?e.readUserGroup(s):void 0)||e.readUserGroup(o);_&&(g.user_group=_);let v=(s?e.readAttributeFromChain(s,[`data-froomle-reco`]):void 0)||e.readAttributeFromChain(o,[`data-froomle-reco`]),y=(s?e.readAttributeFromChain(s,[`data-froomle-request-id`]):void 0)||e.readAttributeFromChain(o,[`data-froomle-request-id`]);v&&y&&(g.list_name=v,g.request_id=y),D.getConsent()>=2&&D.getUserId()&&(g.user_id=D.getUserId());let b=(D.getSafeRequest()?`https://`:`http://`)+D.getRequestDomain()+`/api/`+D.getEnvironment()+`/events`,x=JSON.stringify({events:[g]}),S=new Blob([x],{type:`application/json`}),C=e=>fetch(b,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:x,...e?{keepalive:!0}:{}});if(m&&d){let e=!1,t=()=>{e||(e=!0,window.location.assign(d))},n=window.setTimeout(t,200);C(!0).catch(()=>{typeof navigator<`u`&&typeof navigator.sendBeacon==`function`&&navigator.sendBeacon(b,S)}).finally(()=>{window.clearTimeout(n),t()});return}C(!1).catch(()=>{typeof navigator<`u`&&typeof navigator.sendBeacon==`function`&&navigator.sendBeacon(b,S)})},!0))}};V.listenerRegistered=!1;const ae=M,H=P.setEnvironment,U=P.setPageVisit,W=P.setRequestDomain,G=P.setSafeRequest,K=typeof P.setChannel==`function`?P.setChannel:D.setChannel,q=P.setContextItem,J=P.setContextItemType,oe=D.addHistories;function se(e,t){P.setCustomVariable(e,t)}function Y(e){P.setUserId(e),document.cookie=`froomle_user_id=${e}; max-age=${3600*24*365*20}; path=/; samesite=lax`}function X(e){P.setDeviceId(e),document.cookie=`froomle_device_id=${e}; max-age=${3600*24*365*20}; path=/; samesite=lax`}function Z(e){P.setConsent(e),document.cookie=`froomle_consent=${e}; max-age=${3600*24*365*20}; path=/; samesite=lax`,document.cookie=`froomle_device_id=${P.getDeviceId()}; max-age=${3600*24*365*20}; path=/; samesite=lax`}typeof window<`u`&&(window.setFroomleConsent=Z);function Q(e){let t=document.cookie.split(`; `);for(let n of t){let[t,r]=n.split(`=`);if(t===e)return decodeURIComponent(r)}return null}function ce(e){return P.getRecommendations(e)}if(!globalThis.froomleInitialized&&(globalThis.froomleInitialized=!0,typeof document<`u`)){let e=document.currentScript;if(e){let t=e.getAttribute(`data-froomle-device-id`),n=e.getAttribute(`data-froomle-user-id`),r=e.getAttribute(`data-froomle-env`),i=e.getAttribute(`data-froomle-page-visit`),a=e.getAttribute(`data-froomle-request-domain`),o=e.getAttribute(`data-froomle-context-item`),s=e.getAttribute(`data-froomle-context-item-type`),c=e.getAttribute(`data-froomle-safe-request`),l=e.getAttribute(`data-froomle-channel`);if(H(r),i&&U(i),o&&(q(o),J(s||`article`)),t)X(t);else{let e=Q(`froomle_device_id`);e&&X(e)}if(n)Y(n);else{let e=Q(`froomle_user_id`);e&&Y(e)}a&&W(a),c&&G(c!==`false`),l&&K(l)}let t=Q(`froomle_consent`);if(t){let e=Number(t);Number.isNaN(e)||Z(e)}document.addEventListener(`DOMContentLoaded`,()=>{console.log(`froomle loads dom`),N.domInit(ae.fromDocument(document)).then(e=>{V.registerClickables(),R.processDocument(),z.sendPageVisit(),B.sendPageView()});function e(e){return e.matches(`[data-froomle-reco]`)||e.querySelector(`[data-froomle-reco]`)!==null}new MutationObserver(t=>{for(let n of t)if(n.type===`childList`&&n.addedNodes.forEach(t=>{t instanceof Element&&(e(t)&&N.fillElementRecos(t),R.processElement(t))}),n.type===`attributes`&&n.target instanceof Element)if(n.attributeName===`data-froomle-reco`){let e=n.target.getAttribute(`data-froomle-request-id`);(!e||e===``)&&N.fillElementRecos(n.target)}else if(n.attributeName===`data-froomle-request-id`){let e=n.target.getAttribute(`data-froomle-request-id`),t=n.target.getAttribute(`data-froomle-id`);n.target.getAttribute(`data-froomle-reco`)&&(!e||e===``)&&(!t||t===``)&&N.fillElementRecos(n.target)}else n.attributeName===`data-froomle-id`&&R.processElement(n.target)}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-froomle-reco`,`data-froomle-request-id`,`data-froomle-id`]})})}function le(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}const $=[];function ue(){var e;return typeof document>`u`?``:((e=document.querySelector(`[data-froomle-user-group]`))==null?void 0:e.getAttribute(`data-froomle-user-group`))||``}function de(e,t){var n;let r=e,i=((n=r==null?void 0:r.UserGroup)==null?typeof(r==null?void 0:r.get)==`function`?r.get(`user_group`):void 0:n)||t;if(i&&(r.UserGroup=i,typeof(r==null?void 0:r.getData)==`function`)){let e=r.getData();e&&(!e.user_group||e.user_group===``)&&(e.user_group=i)}}async function fe(){let e=$.splice(0,$.length);if(e.length!==0)try{let t=e.map(e=>e.req),n=D.requestsToLists(t),r=await D.getRawRecommendations(n),i=r.user_group||``;typeof document<`u`&&i&&document.documentElement.setAttribute(`data-froomle-user-group`,i);let a=r.lists().reduce((e,t)=>[...e,...t.items],[]);a.forEach(e=>de(e,i)),e.forEach((e,t)=>{a[t]?e.deferred.resolve(a[t]):e.deferred.reject(Error(`No recommendation available`))})}catch(t){throw e.forEach(e=>{e.deferred.reject(t)}),t}}function pe(e){let t,n,r={promise:new Promise((e,r)=>{t=e,n=r}),resolve:t,reject:n};return $.push({deferred:r,req:e}),r}function me(e){let t=pe(e).promise;le();let n=function(e,n){return t.then(t=>(r.completeTarget=t,e?e(t):t),e=>n?n(e):Promise.reject(e))},r=new Proxy(new A({item_id:``,request_id:``,user_group:``}),{get(t,r,i){if(r===`then`)return n;if(r===`__froomleList`)return e.list;if(r===`get`){let e=Reflect.get(t,r,i);return function(...t){return e.apply(this,t)}}if(typeof r!=`string`)return Reflect.get(t,r,i);let a=Reflect.get(t,r,i);if(a!=null&&a!==``)return a;let o=t.get(r);return o!=null&&o!==``?o:``},set(e,t,n,r){if(t===`completeTarget`){if(Object.assign(e,n),!e.UserGroup){let t=ue();if(t){e.UserGroup=t;let n=e.getData();n&&!n.user_group&&(n.user_group=t)}}return!0}return Reflect.set(e,t,n,r)},has(e,t){return e.get(t)!==void 0}});return r}Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return R}});