vviinn-widgets 2.18.0 → 2.18.3

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.
Files changed (101) hide show
  1. package/dist/cjs/{highlight-box_22.cjs.entry.js → cropper-handler_27.cjs.entry.js} +536 -91
  2. package/dist/cjs/{customized-slots-d218f4ff.js → customized-slots-8a1a9aed.js} +1 -0
  3. package/dist/cjs/{imageSearch.store-8bbadb9d.js → index-8e47383c.js} +14723 -11183
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{vviinn-carousel_3.cjs.entry.js → vviinn-carousel_2.cjs.entry.js} +35 -214
  6. package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +3 -1
  7. package/dist/cjs/vviinn-vpr-button.cjs.entry.js +3 -0
  8. package/dist/cjs/vviinn-vps-button.cjs.entry.js +1 -1
  9. package/dist/cjs/vviinn-widgets.cjs.js +1 -1
  10. package/dist/collection/components/customized-slots.js +1 -0
  11. package/dist/collection/components/vviinn-carousel/vviinn-carousel.js +11 -2
  12. package/dist/collection/components/vviinn-image-view/vviinn-image-view.css +10 -9
  13. package/dist/collection/components/vviinn-modal/vviinn-modal.js +8 -2
  14. package/dist/collection/components/vviinn-slider/vviinn-slider.js +15 -6
  15. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +24 -1
  16. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +24 -0
  17. package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.js +1 -0
  18. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +1 -0
  19. package/dist/esm/{highlight-box_22.entry.js → cropper-handler_27.entry.js} +467 -27
  20. package/dist/esm/{customized-slots-3728bcfa.js → customized-slots-4f7327c6.js} +1 -0
  21. package/dist/esm/{imageSearch.store-d8a17e0c.js → index-8de7d584.js} +14983 -11455
  22. package/dist/esm/{index-34b385a3.js → index-dfe874ac.js} +1 -1
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/vviinn-button.entry.js +1 -1
  25. package/dist/esm/{vviinn-carousel_3.entry.js → vviinn-carousel_2.entry.js} +12 -190
  26. package/dist/esm/vviinn-recommendations-sidebar.entry.js +4 -2
  27. package/dist/esm/vviinn-vpr-button.entry.js +4 -1
  28. package/dist/esm/vviinn-vps-button.entry.js +2 -2
  29. package/dist/esm/vviinn-widgets.js +1 -1
  30. package/dist/types/components/vviinn-carousel/vviinn-carousel.d.ts +2 -0
  31. package/dist/types/components/vviinn-modal/vviinn-modal.d.ts +2 -0
  32. package/dist/types/components/vviinn-slider/vviinn-slider.d.ts +3 -0
  33. package/dist/types/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.d.ts +2 -0
  34. package/dist/types/components/vviinn-vpr-button/vviinn-vpr-button.d.ts +2 -0
  35. package/dist/types/components/vviinn-vps-button/vviinn-vps-button.d.ts +1 -0
  36. package/dist/types/components/vviinn-vps-widget/vviinn-vps-widget.d.ts +1 -0
  37. package/dist/types/components.d.ts +2 -0
  38. package/dist/vviinn-widgets/{p-4a08e066.js → p-24be993d.js} +1 -1
  39. package/dist/vviinn-widgets/p-2ebfde1e.entry.js +1 -0
  40. package/dist/vviinn-widgets/p-7e9f9325.entry.js +1 -0
  41. package/dist/vviinn-widgets/p-7ed1f1b5.js +1 -0
  42. package/dist/vviinn-widgets/{p-394ab2b0.entry.js → p-81c220eb.entry.js} +1 -1
  43. package/dist/vviinn-widgets/p-97243fdc.entry.js +1 -0
  44. package/dist/vviinn-widgets/p-ad1b0872.entry.js +1 -0
  45. package/dist/vviinn-widgets/p-c5b1ff23.entry.js +1 -0
  46. package/dist/vviinn-widgets/p-fa5b5f3e.js +1 -0
  47. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
  48. package/package.json +1 -1
  49. package/www/build/{p-4a08e066.js → p-24be993d.js} +1 -1
  50. package/www/build/p-2ebfde1e.entry.js +1 -0
  51. package/www/build/p-7ddda4b2.js +125 -0
  52. package/www/build/p-7e9f9325.entry.js +1 -0
  53. package/www/build/p-7ed1f1b5.js +1 -0
  54. package/www/build/{p-394ab2b0.entry.js → p-81c220eb.entry.js} +1 -1
  55. package/www/build/p-97243fdc.entry.js +1 -0
  56. package/www/build/p-ad1b0872.entry.js +1 -0
  57. package/www/build/p-c5b1ff23.entry.js +1 -0
  58. package/www/build/p-e0153ae2.css +6 -0
  59. package/www/build/p-fa5b5f3e.js +1 -0
  60. package/www/build/vviinn-widgets.esm.js +1 -1
  61. package/www/index.html +2 -6
  62. package/dist/cjs/Handler-176539c8.js +0 -331
  63. package/dist/cjs/cropper-handler.cjs.entry.js +0 -27
  64. package/dist/cjs/index-1b894f1d.js +0 -3235
  65. package/dist/cjs/vviinn-error.cjs.entry.js +0 -19
  66. package/dist/cjs/vviinn-preloader.cjs.entry.js +0 -26
  67. package/dist/cjs/vviinn-vps-widget.cjs.entry.js +0 -208
  68. package/dist/esm/Handler-f9b8735c.js +0 -309
  69. package/dist/esm/cropper-handler.entry.js +0 -23
  70. package/dist/esm/index-4756a22d.js +0 -3224
  71. package/dist/esm/vviinn-error.entry.js +0 -15
  72. package/dist/esm/vviinn-preloader.entry.js +0 -22
  73. package/dist/esm/vviinn-vps-widget.entry.js +0 -204
  74. package/dist/vviinn-widgets/p-063de1a9.entry.js +0 -1
  75. package/dist/vviinn-widgets/p-0f2899a0.entry.js +0 -1
  76. package/dist/vviinn-widgets/p-11f61564.js +0 -1
  77. package/dist/vviinn-widgets/p-25e93e9d.entry.js +0 -1
  78. package/dist/vviinn-widgets/p-4f9a0ef8.js +0 -1
  79. package/dist/vviinn-widgets/p-612b9079.js +0 -1
  80. package/dist/vviinn-widgets/p-99e1da89.entry.js +0 -1
  81. package/dist/vviinn-widgets/p-a26b9b62.entry.js +0 -1
  82. package/dist/vviinn-widgets/p-ac90148f.entry.js +0 -1
  83. package/dist/vviinn-widgets/p-e277a86e.entry.js +0 -1
  84. package/dist/vviinn-widgets/p-e3c0b214.entry.js +0 -1
  85. package/dist/vviinn-widgets/p-fa245439.entry.js +0 -1
  86. package/dist/vviinn-widgets/p-ffea16fe.js +0 -1
  87. package/www/build/p-063de1a9.entry.js +0 -1
  88. package/www/build/p-0f2899a0.entry.js +0 -1
  89. package/www/build/p-11f61564.js +0 -1
  90. package/www/build/p-25e93e9d.entry.js +0 -1
  91. package/www/build/p-436d3647.js +0 -1
  92. package/www/build/p-4f9a0ef8.js +0 -1
  93. package/www/build/p-612b9079.js +0 -1
  94. package/www/build/p-99e1da89.entry.js +0 -1
  95. package/www/build/p-a26b9b62.entry.js +0 -1
  96. package/www/build/p-a67898be.css +0 -1
  97. package/www/build/p-ac90148f.entry.js +0 -1
  98. package/www/build/p-e277a86e.entry.js +0 -1
  99. package/www/build/p-e3c0b214.entry.js +0 -1
  100. package/www/build/p-fa245439.entry.js +0 -1
  101. package/www/build/p-ffea16fe.js +0 -1
@@ -3,10 +3,43 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-0bda22ec.js');
6
- const imageSearch_store = require('./imageSearch.store-8bbadb9d.js');
7
- const Handler = require('./Handler-176539c8.js');
8
- const index$1 = require('./index-5ce4918b.js');
9
- const customizedSlots = require('./customized-slots-d218f4ff.js');
6
+ const index$1 = require('./index-8e47383c.js');
7
+ const index$2 = require('./index-5ce4918b.js');
8
+ const customizedSlots = require('./customized-slots-8a1a9aed.js');
9
+
10
+ const cropperHandlerCss = ":host{--size:20px;background:transparent;border:4px solid white;box-sizing:content-box;display:block;height:var(--size);touch-action:none;position:absolute;width:var(--size);z-index:4;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host(.disabled){opacity:0.25}:host(.nw-resize){border-bottom:none;border-right:none;top:0;left:0}:host(.ne-resize){border-left:none;border-bottom:none;right:0;top:0}:host(.sw-resize){border-right:none;border-top:none;left:0;bottom:0}:host(.se-resize){border-left:none;border-top:none;bottom:0;right:0}";
11
+
12
+ let CropperHandler = class {
13
+ constructor(hostRef) {
14
+ index.registerInstance(this, hostRef);
15
+ this.disabled = false;
16
+ }
17
+ render() {
18
+ return (index.h(index.Host, { part: `handle ${index$1.getCursorValue(this.handler.direction)}`, class: {
19
+ disabled: this.disabled,
20
+ [index$1.getCursorValue(this.handler.direction)]: true,
21
+ }, style: {
22
+ "--size": "20px",
23
+ cursor: index$1.getCursorValue(this.handler.direction),
24
+ }, draggable: false }));
25
+ }
26
+ };
27
+ CropperHandler.style = cropperHandlerCss;
28
+
29
+ const fromRectangle = (shape, target) => {
30
+ const top = `${shape.y}px`;
31
+ const left = `${shape.x}px`;
32
+ const right = `${target.width - (shape.x + shape.width)}px`;
33
+ const bottom = `${target.height - (shape.y + shape.height)}px`;
34
+ return {
35
+ top,
36
+ right,
37
+ bottom,
38
+ left,
39
+ };
40
+ };
41
+ const printClip = (clip) => `inset(${clip.top} ${clip.right} ${clip.bottom} ${clip.left})`;
42
+ const getClipValue = (shape, target) => printClip(fromRectangle(shape, target));
10
43
 
11
44
  // -------------------------------------------------------------------------------------
12
45
  // -------------------------------------------------------------------------------------
@@ -28,21 +61,6 @@ var Ord = {
28
61
  compare: function (first, second) { return (first < second ? -1 : first > second ? 1 : 0); }
29
62
  };
30
63
 
31
- const fromRectangle = (shape, target) => {
32
- const top = `${shape.y}px`;
33
- const left = `${shape.x}px`;
34
- const right = `${target.width - (shape.x + shape.width)}px`;
35
- const bottom = `${target.height - (shape.y + shape.height)}px`;
36
- return {
37
- top,
38
- right,
39
- bottom,
40
- left,
41
- };
42
- };
43
- const printClip = (clip) => `inset(${clip.top} ${clip.right} ${clip.bottom} ${clip.left})`;
44
- const getClipValue = (shape, target) => printClip(fromRectangle(shape, target));
45
-
46
64
  const highlightBoxCss = ":host{display:grid;position:absolute;box-sizing:border-box;border:none;width:100%;height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;--size:10px;--x-position:0;--y-position:0}img{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.pointer{position:absolute;width:var(--size);height:var(--size);background:black;border-radius:50%;z-index:2;cursor:pointer;transform:translate(var(--x-position), var(--y-position)) scale(0);-webkit-animation:0.25s linear fadein;animation:0.25s linear fadein;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.pointer::after{content:\"\";cursor:pointer;border:5px solid black;border-radius:50%;width:var(--size);height:var(--size);display:block;transform:translate(calc(-50% + var(--size) * 0.5), calc(-50% + var(--size) * 0.5));padding:calc(var(--size) * 0.5);opacity:.75}@-webkit-keyframes fadein{from{transform:translate(var(--x-position), var(--y-position)) scale(0)}to{transform:translate(var(--x-position), var(--y-position)) scale(1)}}@keyframes fadein{from{transform:translate(var(--x-position), var(--y-position)) scale(0)}to{transform:translate(var(--x-position), var(--y-position)) scale(1)}}";
47
65
 
48
66
  let HighlightBox = class {
@@ -50,10 +68,10 @@ let HighlightBox = class {
50
68
  index.registerInstance(this, hostRef);
51
69
  }
52
70
  getInsetValue() {
53
- return Handler.pipe(imageSearch_store.sequenceToOption(imageSearch_store.imageSearchState.searchArea, imageSearch_store.imageSearchState.imageBounds), imageSearch_store.Option.map(([selection, image]) => getClipValue(selection, image)), imageSearch_store.Option.getOrElse(() => ""));
71
+ return index$1.pipe(index$1.sequenceToOption(index$1.imageSearchState.searchArea, index$1.imageSearchState.imageBounds), index$1.Option.map(([selection, image]) => getClipValue(selection, image)), index$1.Option.getOrElse(() => ""));
54
72
  }
55
73
  renderImage() {
56
- return Handler.pipe(imageSearch_store.sequenceToOption(imageSearch_store.imageSearchState.imageUrl, imageSearch_store.imageSearchState.imageBounds), imageSearch_store.Option.map(([url, bounds]) => (index.h("img", { src: url, width: bounds.width, height: bounds.height, style: { "clip-path": `${this.getInsetValue()}` } }))), imageSearch_store.Option.getOrElse(() => ""));
74
+ return index$1.pipe(index$1.sequenceToOption(index$1.imageSearchState.imageUrl, index$1.imageSearchState.imageBounds), index$1.Option.map(([url, bounds]) => (index.h("img", { src: url, width: bounds.width, height: bounds.height, style: { "clip-path": `${this.getInsetValue()}` } }))), index$1.Option.getOrElse(() => ""));
57
75
  }
58
76
  render() {
59
77
  return index.h(index.Host, null, this.renderImage());
@@ -89,19 +107,19 @@ let ImageCropper = class {
89
107
  handleHandlerMove(event) {
90
108
  event.preventDefault();
91
109
  event.stopPropagation();
92
- const destination = Handler.fromMouseEvent(event);
93
- const distance = Handler.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
110
+ const destination = index$1.fromMouseEvent(event);
111
+ const distance = index$1.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
94
112
  const transformedHandler = {
95
113
  position: distance,
96
114
  direction: this.handlerMoveDirection,
97
115
  };
98
- imageSearch_store._function.pipe(imageSearch_store.imageSearchState.searchArea, imageSearch_store.Option.map((area) => {
99
- const newSearchArea = imageSearch_store.transform(area, transformedHandler);
116
+ index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((area) => {
117
+ const newSearchArea = index$1.transform(area, transformedHandler);
100
118
  if (this.outOfBounds(newSearchArea))
101
119
  return;
102
- imageSearch_store.imageSearchState.searchArea = imageSearch_store.Option.some(newSearchArea);
120
+ index$1.imageSearchState.searchArea = index$1.Option.some(newSearchArea);
103
121
  this.mouseStartPoint = destination;
104
- imageSearch_store.imageSearchState.detectedObject = undefined;
122
+ index$1.imageSearchState.detectedObject = undefined;
105
123
  }));
106
124
  }
107
125
  outOfBounds(area) {
@@ -115,23 +133,23 @@ let ImageCropper = class {
115
133
  handleCropperMove(ev) {
116
134
  ev.preventDefault();
117
135
  ev.stopPropagation();
118
- const destination = Handler.fromMouseEvent(ev);
119
- const distance = Handler.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
120
- imageSearch_store._function.pipe(imageSearch_store.imageSearchState.searchArea, imageSearch_store.Option.map((searchArea) => {
121
- const newSearchArea = imageSearch_store.move(searchArea, distance);
136
+ const destination = index$1.fromMouseEvent(ev);
137
+ const distance = index$1.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
138
+ index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((searchArea) => {
139
+ const newSearchArea = index$1.move(searchArea, distance);
122
140
  if (newSearchArea.x < 0 ||
123
141
  newSearchArea.y < 0 ||
124
142
  this.bounds.height - (newSearchArea.y + newSearchArea.height) < 0 ||
125
143
  this.bounds.width - (newSearchArea.x + newSearchArea.width) < 0)
126
144
  return;
127
- imageSearch_store.imageSearchState.detectedObject = undefined;
128
- imageSearch_store.imageSearchState.searchArea = imageSearch_store.Option.some(newSearchArea);
145
+ index$1.imageSearchState.detectedObject = undefined;
146
+ index$1.imageSearchState.searchArea = index$1.Option.some(newSearchArea);
129
147
  this.mouseStartPoint = destination;
130
148
  }));
131
149
  }
132
150
  handlePointerDown(event) {
133
151
  event.stopPropagation();
134
- this.mouseStartPoint = Handler.fromMouseEvent(event);
152
+ this.mouseStartPoint = index$1.fromMouseEvent(event);
135
153
  // should be htmlelement or handler
136
154
  const target = findTarget(event);
137
155
  if (target.localName === "cropper-handler") {
@@ -151,18 +169,18 @@ let ImageCropper = class {
151
169
  this.el.removeEventListener("pointermove", this.pointerMoveListener);
152
170
  document.removeEventListener("pointerup", this.pointerReleaseListener);
153
171
  this.mouseStartPoint = undefined;
154
- imageSearch_store.makeRectangularSearchRequest();
172
+ index$1.makeRectangularSearchRequest();
155
173
  this.cropperChanged.emit();
156
174
  }
157
175
  getStyleMap() {
158
- return imageSearch_store._function.pipe(imageSearch_store.imageSearchState.searchArea, imageSearch_store.Option.map((rectangle) => {
176
+ return index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((rectangle) => {
159
177
  return {
160
178
  width: `${rectangle.width}px`,
161
179
  height: `${rectangle.height}px`,
162
180
  transform: `translate3d(${rectangle.x}px, ${rectangle.y}px, 0)`,
163
181
  cursor: this.handleMove ? "move" : "default",
164
182
  };
165
- }), imageSearch_store.Option.getOrElse(() => {
183
+ }), index$1.Option.getOrElse(() => {
166
184
  return {};
167
185
  }));
168
186
  }
@@ -171,7 +189,7 @@ let ImageCropper = class {
171
189
  "crop-area": true,
172
190
  active: this.handleMove,
173
191
  disabled: this.disabled,
174
- }, draggable: false, style: this.getStyleMap(), onContextMenu: () => false, onPointerDown: (ev) => this.handlePointerDown(ev) }, imageSearch_store.imageSearchState.cropperHandlers.map((handler) => (index.h("cropper-handler", { disabled: this.disabled, handler: handler, onPointerDown: (ev) => this.handlePointerDown(ev) }))))));
192
+ }, draggable: false, style: this.getStyleMap(), onContextMenu: () => false, onPointerDown: (ev) => this.handlePointerDown(ev) }, index$1.imageSearchState.cropperHandlers.map((handler) => (index.h("cropper-handler", { disabled: this.disabled, handler: handler, onPointerDown: (ev) => this.handlePointerDown(ev) }))))));
175
193
  }
176
194
  get el() { return index.getElement(this); }
177
195
  };
@@ -197,12 +215,12 @@ let SearchFilters = class {
197
215
  }
198
216
  selectFilter(filter) {
199
217
  this.selectedCategoryId = getFilterId(filter);
200
- imageSearch_store.imageSearchState.activeIonLink = filter;
218
+ index$1.imageSearchState.activeIonLink = filter;
201
219
  this.filterSelected.emit("select");
202
220
  }
203
221
  clearSelectedFilter() {
204
222
  this.selectedCategoryId = null;
205
- imageSearch_store.imageSearchState.activeIonLink = undefined;
223
+ index$1.imageSearchState.activeIonLink = undefined;
206
224
  this.findSelectedFilter().blur();
207
225
  this.filterSelected.emit("deselect");
208
226
  }
@@ -229,7 +247,7 @@ let SearchFilters = class {
229
247
  }, style: { "animation-delay": `${n * 10}ms` }, onPointerUp: (ev) => {
230
248
  ev.stopPropagation();
231
249
  this.handleFilterSelection(f);
232
- }, onKeyPress: (ev) => this.handleEnter(ev, f) }, this.isFilterSelected(f) ? index.h(index$1.CheckIcon, null) : null, f.name))), index.h("div", { class: {
250
+ }, onKeyPress: (ev) => this.handleEnter(ev, f) }, this.isFilterSelected(f) ? index.h(index$2.CheckIcon, null) : null, f.name))), index.h("div", { class: {
233
251
  filter: true,
234
252
  "show-more": true,
235
253
  hidden: this.filter.filters.length <= FILTERS_COUNT,
@@ -253,31 +271,31 @@ let VviinnDetectedObject = class {
253
271
  this.position = ["0", "0"];
254
272
  }
255
273
  getObjectPosition() {
256
- return imageSearch_store._function.pipe(imageSearch_store.imageSearchState.imageBounds, imageSearch_store.Option.map((bounds) => {
257
- const objectRectangle = imageSearch_store.fromAlt(imageSearch_store.foldValueObject(this.detectedObject).rectangle);
258
- const { x, y } = imageSearch_store._function.pipe(objectRectangle, imageSearch_store.scaleWithSized(bounds), imageSearch_store.center);
274
+ return index$1._function.pipe(index$1.imageSearchState.imageBounds, index$1.Option.map((bounds) => {
275
+ const objectRectangle = index$1.fromAlt(index$1.foldValueObject(this.detectedObject).rectangle);
276
+ const { x, y } = index$1._function.pipe(objectRectangle, index$1.scaleWithSized(bounds), index$1.center);
259
277
  return [`${x}px`, `${y}px`];
260
- }), imageSearch_store.Option.getOrElse(() => ["0", "0"]));
278
+ }), index$1.Option.getOrElse(() => ["0", "0"]));
261
279
  }
262
280
  selectDetectedObject() {
263
- imageSearch_store._function.pipe(imageSearch_store.imageSearchState.imageBounds, imageSearch_store.Option.map((bounds) => {
264
- const rectangle = imageSearch_store.foldValueObject(this.detectedObject).rectangle;
265
- const transformedRect = imageSearch_store.fromAlt(rectangle);
266
- const scaledRect = imageSearch_store.scaleWithSized(bounds)(transformedRect);
267
- imageSearch_store.imageSearchState.detectedObject = this.detectedObject;
268
- imageSearch_store.imageSearchState.searchArea = imageSearch_store.Option.some(scaledRect);
281
+ index$1._function.pipe(index$1.imageSearchState.imageBounds, index$1.Option.map((bounds) => {
282
+ const rectangle = index$1.foldValueObject(this.detectedObject).rectangle;
283
+ const transformedRect = index$1.fromAlt(rectangle);
284
+ const scaledRect = index$1.scaleWithSized(bounds)(transformedRect);
285
+ index$1.imageSearchState.detectedObject = this.detectedObject;
286
+ index$1.imageSearchState.searchArea = index$1.Option.some(scaledRect);
269
287
  }));
270
- imageSearch_store.makeRectangularSearchRequest();
288
+ index$1.makeRectangularSearchRequest();
271
289
  this.detectedObjectClicked.emit();
272
290
  }
273
291
  isActive() {
274
292
  if (!this.detectedObject)
275
293
  return false;
276
- if (!imageSearch_store.imageSearchState.detectedObject)
294
+ if (!index$1.imageSearchState.detectedObject)
277
295
  return false;
278
- const thisObject = imageSearch_store.foldValueObject(this.detectedObject);
279
- const savedObject = imageSearch_store.foldValueObject(imageSearch_store.imageSearchState.detectedObject);
280
- return imageSearch_store.detectedObjectEq.equals(thisObject, savedObject);
296
+ const thisObject = index$1.foldValueObject(this.detectedObject);
297
+ const savedObject = index$1.foldValueObject(index$1.imageSearchState.detectedObject);
298
+ return index$1.detectedObjectEq.equals(thisObject, savedObject);
281
299
  }
282
300
  render() {
283
301
  return (index.h(index.Host, { class: {
@@ -303,6 +321,18 @@ let VviinnEmptyResults = class {
303
321
  };
304
322
  VviinnEmptyResults.style = vviinnEmptyResultsCss;
305
323
 
324
+ const vviinnErrorCss = ":host{background:#F4F4F4;border-radius:8px;display:grid;grid-gap:20px;padding:24px;text-align:center}::slotted(svg){display:grid;align-self:center}::slotted(h4){margin:unset;font-weight:600;font-size:18px;line-height:24px}::slotted(span){font-size:14px;line-height:20px}::slotted(button){-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;background:transparent;color:var(--color-primary, var(--color-primary-system));font-weight:600;font-size:16px;line-height:20px;cursor:pointer}";
325
+
326
+ let VviinnError = class {
327
+ constructor(hostRef) {
328
+ index.registerInstance(this, hostRef);
329
+ }
330
+ render() {
331
+ return (index.h(index.Host, null, index.h("slot", { name: "icon" }), index.h("slot", { name: "title" }), index.h("slot", { name: "text" }), index.h("slot", { name: "action" })));
332
+ }
333
+ };
334
+ VviinnError.style = vviinnErrorCss;
335
+
306
336
  const vviinnExampleImageCss = ":host{display:block;margin-bottom:8px;position:relative}:host(:focus){border:2px solid var(--color-primary)}img{width:100%;height:auto;cursor:pointer}.image-preloader{background:rgba(0, 0, 0, 0.25);border-radius:4px;bottom:12px;display:none;padding:4px 6px;position:absolute;right:12px;z-index:4}vviinn-preloader{--preloader-size:12px}@media (max-width: 640px){.image-preloader{display:block}}";
307
337
 
308
338
  let VviinnExampleImage = class {
@@ -317,9 +347,9 @@ let VviinnExampleImage = class {
317
347
  }
318
348
  async selectImage() {
319
349
  this.selected = true;
320
- const file = await imageSearch_store.toFile(this.src);
321
- const processResult = await imageSearch_store.processSelectedFile(file);
322
- imageSearch_store._function.pipe(processResult, imageSearch_store.Either.match(() => this.exampleImageError.emit(), () => this.exampleImageSelected.emit()));
350
+ const file = await index$1.toFile(this.src);
351
+ const processResult = await index$1.processSelectedFile(file);
352
+ index$1._function.pipe(processResult, index$1.Either.match(() => this.exampleImageError.emit(), () => this.exampleImageSelected.emit()));
323
353
  this.selected = false;
324
354
  }
325
355
  handleKeyPress({ key }) {
@@ -328,8 +358,8 @@ let VviinnExampleImage = class {
328
358
  this.selectImage();
329
359
  }
330
360
  showPreloader() {
331
- return ((imageSearch_store.imageSearchState.objectDetectionInProgress ||
332
- imageSearch_store.imageSearchState.loading) &&
361
+ return ((index$1.imageSearchState.objectDetectionInProgress ||
362
+ index$1.imageSearchState.loading) &&
333
363
  this.selected);
334
364
  }
335
365
  render() {
@@ -377,12 +407,12 @@ let VviinnImageSelector = class {
377
407
  }
378
408
  async handleInputChange(event) {
379
409
  const input = event.target;
380
- const processingResult = await imageSearch_store.processSelectedFile(input.files[0]);
381
- imageSearch_store._function.pipe(processingResult, imageSearch_store.match$1(() => this.imageSelectedError.emit(), () => this.imageSelected.emit()));
410
+ const processingResult = await index$1.processSelectedFile(input.files[0]);
411
+ index$1._function.pipe(processingResult, index$1.match(() => this.imageSelectedError.emit(), () => this.imageSelected.emit()));
382
412
  input.value = null;
383
413
  }
384
414
  isLoading() {
385
- return imageSearch_store.imageSearchState.loading;
415
+ return index$1.imageSearchState.loading;
386
416
  }
387
417
  render() {
388
418
  return (index.h(index.Host, { exportparts: "button" }, this.isLoading() ? index.h("vviinn-preloader", null) : null, this.isLoading() ? null : (index.h("label", { htmlFor: "fileInput", part: "button" }, index.h("slot", { name: "upload-button-text" }, "Upload image"))), index.h("input", { id: "fileInput", class: "visually-hidden", type: "file", accept: "image/*", onChange: (event) => this.handleInputChange(event) })));
@@ -390,11 +420,11 @@ let VviinnImageSelector = class {
390
420
  };
391
421
  VviinnImageSelector.style = vviinnImageSelectorCss;
392
422
 
393
- const vviinnImageViewCss = ":host{display:grid;position:relative;justify-self:center}img{box-sizing:border-box;filter:brightness(60%);position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:-1}.image-preloader{background:rgba(0, 0, 0, 0.25);border-radius:4px;bottom:18px;padding:4px 6px;pointer-events:none;position:absolute;right:18px;z-index:4}vviinn-preloader{--preloader-size:12px}";
423
+ const vviinnImageViewCss = ":host{display:grid;position:relative;justify-self:center;direction:ltr}img{box-sizing:border-box;filter:brightness(60%);position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:-1}.image-preloader{background:rgba(0, 0, 0, 0.25);border-radius:4px;bottom:18px;padding:4px 6px;pointer-events:none;position:absolute;right:18px;z-index:4}vviinn-preloader{--preloader-size:12px}";
394
424
 
395
425
  const getImageSizes = (i) => {
396
- const dimensions = imageSearch_store.dimensionsFromImage(i);
397
- const resize = imageSearch_store.scaleByLargestSide(288);
426
+ const dimensions = index$1.dimensionsFromImage(i);
427
+ const resize = index$1.scaleByLargestSide(288);
398
428
  const newDimensions = resize(dimensions);
399
429
  const sizes = newDimensions.map((d) => d.size);
400
430
  return [sizes[0], sizes[1]];
@@ -405,34 +435,34 @@ let VviinnImageView = class {
405
435
  }
406
436
  handleInitialImageLoad(ev) {
407
437
  const target = ev.target;
408
- const imageBounds = imageSearch_store.fromImage(target);
438
+ const imageBounds = index$1.fromImage(target);
409
439
  const padding = 12;
410
- const { x, y } = imageSearch_store.move(imageBounds, { x: padding, y: padding });
440
+ const { x, y } = index$1.move(imageBounds, { x: padding, y: padding });
411
441
  const searchArea = {
412
442
  x,
413
443
  y,
414
444
  width: imageBounds.width - padding * 2,
415
445
  height: imageBounds.height - padding * 2,
416
446
  };
417
- imageSearch_store.imageSearchState.imageBounds = imageSearch_store.Option.some(imageBounds);
418
- imageSearch_store.imageSearchState.searchArea = imageSearch_store.Option.some(searchArea);
447
+ index$1.imageSearchState.imageBounds = index$1.Option.some(imageBounds);
448
+ index$1.imageSearchState.searchArea = index$1.Option.some(searchArea);
419
449
  }
420
450
  renderDetectedObject(object) {
421
451
  return index.h("vviinn-detected-object", { detectedObject: object });
422
452
  }
423
453
  renderImage() {
424
- return imageSearch_store._function.pipe(imageSearch_store.sequenceToOption(imageSearch_store.imageSearchState.imageUrl, imageSearch_store.imageSearchState.image), imageSearch_store.Option.map(([url, refImage]) => {
454
+ return index$1._function.pipe(index$1.sequenceToOption(index$1.imageSearchState.imageUrl, index$1.imageSearchState.image), index$1.Option.map(([url, refImage]) => {
425
455
  const [width, height] = getImageSizes(refImage);
426
456
  const image = (index.h("img", { decoding: "async", width: width, height: height, src: url, onLoad: (el) => this.handleInitialImageLoad(el), draggable: false }));
427
457
  return image;
428
- }), imageSearch_store.Option.getOrElse(() => null));
458
+ }), index$1.Option.getOrElse(() => null));
429
459
  }
430
460
  renderCropper() {
431
- return imageSearch_store._function.pipe(imageSearch_store.imageSearchState.imageUrl, imageSearch_store.Option.map(() => index.h("image-cropper", null)), imageSearch_store.Option.getOrElse(() => null));
461
+ return index$1._function.pipe(index$1.imageSearchState.imageUrl, index$1.Option.map(() => index.h("image-cropper", null)), index$1.Option.getOrElse(() => null));
432
462
  }
433
463
  render() {
434
- return (index.h(index.Host, null, imageSearch_store.imageSearchState.loading ||
435
- imageSearch_store.imageSearchState.objectDetectionInProgress ? (index.h("div", { class: "image-preloader" }, index.h("vviinn-preloader", null))) : null, index.h("highlight-box", null), this.renderImage(), this.renderCropper(), imageSearch_store.imageSearchState.detectedObjects.map((o) => this.renderDetectedObject(o))));
464
+ return (index.h(index.Host, null, index$1.imageSearchState.loading ||
465
+ index$1.imageSearchState.objectDetectionInProgress ? (index.h("div", { class: "image-preloader" }, index.h("vviinn-preloader", null))) : null, index.h("highlight-box", null), this.renderImage(), this.renderCropper(), index$1.imageSearchState.detectedObjects.map((o) => this.renderDetectedObject(o))));
436
466
  }
437
467
  };
438
468
  VviinnImageView.style = vviinnImageViewCss;
@@ -447,6 +477,9 @@ let VviinnModal = class {
447
477
  this.active = false;
448
478
  this.slider = false;
449
479
  }
480
+ componentWillLoad() {
481
+ customizedSlots.slotChangeListener(this, this.el);
482
+ }
450
483
  close() {
451
484
  this.active = false;
452
485
  setTimeout(() => {
@@ -459,8 +492,9 @@ let VviinnModal = class {
459
492
  this.slider = true;
460
493
  }
461
494
  render() {
462
- return (index.h(index.Host, { exportparts: "secondary-action, title, close-button", class: { closed: !this.active }, onAnimationEnd: (ev) => this.handleAnimationEnd(ev) }, index.h("div", { class: "head" }, index.h("button", { part: "secondary-action", onClick: () => this.secondaryActionClicked.emit() }, index.h("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M20.25 12H3.75", stroke: "#161616", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), index.h("path", { d: "M10.5 5.25L3.75 12L10.5 18.75", stroke: "#161616", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }))), index.h("div", { class: "title", part: "title" }, "Bildsuche"), index.h("button", { onClick: () => this.close(), class: "close-button", part: "close-button" }, index.h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M16 1.4L14.6 0L8 6.6L1.4 0L0 1.4L6.6 8L0 14.6L1.4 16L8 9.4L14.6 16L16 14.6L9.4 8L16 1.4Z", fill: "#333333" })))), index.h("div", { class: "body" }, index.h("slot", null))));
495
+ return (index.h(index.Host, { exportparts: "secondary-action, title, close-button", class: { closed: !this.active }, onAnimationEnd: (ev) => this.handleAnimationEnd(ev) }, index.h("div", { class: "head" }, index.h("button", { part: "secondary-action", onClick: () => this.secondaryActionClicked.emit() }, index.h("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M20.25 12H3.75", stroke: "#161616", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), index.h("path", { d: "M10.5 5.25L3.75 12L10.5 18.75", stroke: "#161616", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }))), index.h("div", { class: "title", part: "title" }, index.h("slot", { name: "vviinn-image-search-modal-title" }, "Bildsuche")), index.h("button", { onClick: () => this.close(), class: "close-button", part: "close-button" }, index.h("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M16 1.4L14.6 0L8 6.6L1.4 0L0 1.4L6.6 8L0 14.6L1.4 16L8 9.4L14.6 16L16 14.6L9.4 8L16 1.4Z", fill: "#333333" })))), index.h("div", { class: "body" }, index.h("slot", null))));
463
496
  }
497
+ get el() { return index.getElement(this); }
464
498
  };
465
499
  VviinnModal.style = vviinnModalCss;
466
500
 
@@ -490,7 +524,7 @@ let VviinnOnboardingCard1 = class {
490
524
  customizedSlots.slotChangeListener(this, this.el);
491
525
  }
492
526
  render() {
493
- return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-1-icon" }, index.h(index$1.OnboardingCard1Icon, null)), index.h("slot", { name: "onboarding-card-1-text" }, index.h("div", { class: "text" }, index.h("h4", null, "Starte die Bildsuche"), index.h("p", null, "Lade ein Bild aus Deiner Galerie hoch oder fotografiere ein Produkt mit Deiner Kamera.")))));
527
+ return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-1-icon" }, index.h(index$2.OnboardingCard1Icon, null)), index.h("slot", { name: "onboarding-card-1-text" }, index.h("div", { class: "text" }, index.h("h4", null, "Starte die Bildsuche"), index.h("p", null, "Lade ein Bild aus Deiner Galerie hoch oder fotografiere ein Produkt mit Deiner Kamera.")))));
494
528
  }
495
529
  get el() { return index.getElement(this); }
496
530
  };
@@ -506,7 +540,7 @@ let VviinnOnboardingCard2 = class {
506
540
  customizedSlots.slotChangeListener(this, this.el);
507
541
  }
508
542
  render() {
509
- return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-2-icon" }, index.h(index$1.OnboardingCard2Icon, null)), index.h("slot", { name: "onboarding-card-2-text" }, index.h("div", { class: "text" }, index.h("h4", null, "Verfeiner deine Suche"), index.h("p", null, "Du kannst den Bildrahmen selber festlegen und so die Produkte genau ausw\u00E4hlen.")))));
543
+ return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-2-icon" }, index.h(index$2.OnboardingCard2Icon, null)), index.h("slot", { name: "onboarding-card-2-text" }, index.h("div", { class: "text" }, index.h("h4", null, "Verfeiner deine Suche"), index.h("p", null, "Du kannst den Bildrahmen selber festlegen und so die Produkte genau ausw\u00E4hlen.")))));
510
544
  }
511
545
  get el() { return index.getElement(this); }
512
546
  };
@@ -522,7 +556,7 @@ let VviinnOnboardingCard3 = class {
522
556
  customizedSlots.slotChangeListener(this, this.el);
523
557
  }
524
558
  render() {
525
- return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-3-icon" }, index.h(index$1.OnboardingCard3Icon, null)), index.h("slot", { name: "onboarding-card-3-text" }, index.h("div", { class: "text" }, index.h("h4", null, "Ohne Hintergrund"), index.h("p", null, "Die besten Ergebnisse erh\u00E4ltst Du, wenn das gesuchte Objekt mit einfarbigem und hellem Hintergrund zu sehen ist.")))));
559
+ return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-3-icon" }, index.h(index$2.OnboardingCard3Icon, null)), index.h("slot", { name: "onboarding-card-3-text" }, index.h("div", { class: "text" }, index.h("h4", null, "Ohne Hintergrund"), index.h("p", null, "Die besten Ergebnisse erh\u00E4ltst Du, wenn das gesuchte Objekt mit einfarbigem und hellem Hintergrund zu sehen ist.")))));
526
560
  }
527
561
  get el() { return index.getElement(this); }
528
562
  };
@@ -555,6 +589,23 @@ let VviinnOverlayedModal = class {
555
589
  };
556
590
  VviinnOverlayedModal.style = vviinnOverlayedModalCss;
557
591
 
592
+ const vviinnPreloaderCss = ":host{--preloader-size:24px;--preloader-width:calc(var(--preloader-size) / 6);transform-origin:center;-webkit-animation:rotate 3s linear infinite;animation:rotate 3s linear infinite;border:var(--preloader-width) solid white;border-radius:50%;border-top-color:transparent;display:none;outline:0;width:var(--preloader-size);height:var(--preloader-size);box-sizing:border-box}:host(.active){display:flex}@-webkit-keyframes rotate{from{transform:rotate(-360deg)}to{transform:rotate(360deg)}}@keyframes rotate{from{transform:rotate(-360deg)}to{transform:rotate(360deg)}}";
593
+
594
+ let VviinnPreloader = class {
595
+ constructor(hostRef) {
596
+ index.registerInstance(this, hostRef);
597
+ }
598
+ isActive() {
599
+ return (index$1.imageSearchState.loading || index$1.imageSearchState.objectDetectionInProgress);
600
+ }
601
+ render() {
602
+ return (index.h(index.Host, { class: {
603
+ active: this.isActive(),
604
+ } }));
605
+ }
606
+ };
607
+ VviinnPreloader.style = vviinnPreloaderCss;
608
+
558
609
  const vviinnPrivacyBadgeCss = ":host{display:block;background:#F4F4F4;padding:17px}.content{display:grid;grid-template-columns:-webkit-min-content auto;grid-template-columns:min-content auto;grid-gap:9px}.content p{color:#525252;font-size:12px;line-height:16px;margin:unset}";
559
610
 
560
611
  let VviinnPrivacyBadge = class {
@@ -571,6 +622,190 @@ let VviinnPrivacyBadge = class {
571
622
  };
572
623
  VviinnPrivacyBadge.style = vviinnPrivacyBadgeCss;
573
624
 
625
+ class GtagAnalytics {
626
+ sendImpression(product) {
627
+ var _a, _b, _c;
628
+ gtag('event', 'view_item_list', {
629
+ items: [
630
+ {
631
+ id: product.productId,
632
+ name: product.title,
633
+ brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
634
+ category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
635
+ list_name: 'VI VPR View',
636
+ price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
637
+ }
638
+ ]
639
+ });
640
+ return undefined;
641
+ }
642
+ sendClick(product) {
643
+ var _a, _b, _c;
644
+ gtag('event', 'select_content', {
645
+ content_type: 'product',
646
+ items: [
647
+ {
648
+ id: product.productId,
649
+ name: product.title,
650
+ brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
651
+ category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
652
+ list_name: 'VI VPR View',
653
+ price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
654
+ }
655
+ ]
656
+ });
657
+ return undefined;
658
+ }
659
+ }
660
+
661
+ class GAnalytics {
662
+ constructor() {
663
+ ga('require', 'ec');
664
+ }
665
+ convertProduct(product) {
666
+ var _a, _b, _c;
667
+ return {
668
+ id: product.productId,
669
+ name: product.title,
670
+ brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
671
+ category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
672
+ list: 'VI VPR View',
673
+ price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
674
+ };
675
+ }
676
+ sendImpression(product) {
677
+ ga('ec:addImpression', this.convertProduct(product));
678
+ return undefined;
679
+ }
680
+ sendClick(product) {
681
+ var _a, _b, _c;
682
+ ga('ec:addProduct', {
683
+ id: product.productId,
684
+ name: product.title,
685
+ brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
686
+ category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
687
+ price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
688
+ });
689
+ ga('ec:setAction', 'click', { list: 'VI VPR View' });
690
+ return undefined;
691
+ }
692
+ }
693
+
694
+ const getGtagAnalytics = () => index$1._function.pipe(index$1.Option.fromNullable(window.gtag), index$1.Option.map(() => new GtagAnalytics()));
695
+ const getCommonAnalytics = () => index$1._function.pipe(index$1.Option.fromNullable(window.ga), index$1.Option.map(() => new GAnalytics()));
696
+ const analyticsMonoid = index$1.Option.getMonoid(index$1.Semigroup.first());
697
+ const getAnalyticsModule = analyticsMonoid.concat(getGtagAnalytics(), getCommonAnalytics());
698
+
699
+ const FIT_EXPR = /fit\/\d+\//;
700
+ const containsFit = (url) => {
701
+ return index$1._function.pipe(url.match(FIT_EXPR), index$1.Either.fromNullable(url), index$1.Either.map(() => url));
702
+ };
703
+ const processWidth = (url, size) => {
704
+ return index$1._function.pipe(containsFit(url), index$1.Either.map((url) => url.replace(FIT_EXPR, `fit/${size}/`)), index$1.Either.getOrElse(() => url));
705
+ };
706
+ const Linked = (props, child) => props.deeplink ? (index.h("a", { class: props.part, part: props.part, href: props.deeplink }, child)) : (child);
707
+ const FormattedPrice = (props) => {
708
+ const locale = props.locale;
709
+ const priceType = props.priceType;
710
+ const formattedPrice = new Intl.NumberFormat(locale, {
711
+ minimumFractionDigits: 2,
712
+ }).format(props.price);
713
+ const prefixElement = props.prefix ? (index.h("span", { part: "price-prefix" }, props.prefix + " ")) : null;
714
+ const currencyElement = props.currency ? (index.h("span", { part: "currency" }, " " + props.currency)) : null;
715
+ return (index.h("span", { class: "price-amount", part: `price-amount${priceType ? "-" + priceType : ""}` },
716
+ prefixElement,
717
+ formattedPrice,
718
+ currencyElement));
719
+ };
720
+ const Price = (props) => {
721
+ return (index.h("span", { class: "price-container", part: "price-container" }, props.salePrice ? ([
722
+ index.h("span", { class: "price-sale", part: "price-sale" },
723
+ index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.salePrice, locale: props.locale, priceType: "sale" })),
724
+ index.h("span", { class: "price-outdated", part: "price-outdated" },
725
+ index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.price, locale: props.locale, priceType: "outdated" })),
726
+ ]) : (index.h("span", { class: "price-regular", part: "price-regular" },
727
+ index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.price, locale: props.locale, priceType: "regular" })))));
728
+ };
729
+ const Image = (props, onLoadEnd = () => undefined) => (index.h("picture", null,
730
+ index.h("img", { loading: props.lazy ? "lazy" : "eager", part: "image", class: "image", width: props.width, height: props.height, src: processWidth(props.src, props.width), alt: props.title, onLoad: onLoadEnd })));
731
+ const ResponsiveImage = (props, onLoadEnd = () => undefined) => (index.h("picture", null,
732
+ index.h("img", { loading: props.lazy ? "lazy" : "eager", part: "image", class: "image responsive", src: processWidth(props.src, props.width), alt: props.title, onLoad: onLoadEnd })));
733
+
734
+ const vviinnProductCardCss = ":host{align-items:center;display:flex;flex-direction:column;gap:8px;height:100%}.price-container{display:flex;flex-direction:column}.price-sale,.price-regular{font-style:normal;font-weight:normal;font-size:16px;line-height:24px;color:#161616}.price-outdated{font-style:normal;font-weight:normal;font-size:16px;line-height:24px;color:#757575;text-decoration:line-through}.product-type{word-wrap:anywhere}.image{display:grid;align-content:center;-o-object-position:50% 50%;object-position:50% 50%;-o-object-fit:contain;object-fit:contain;text-align:center;box-sizing:border-box}img.responsive{width:100%;height:auto;aspect-ratio:1}.brand,.type{display:none}.title{-webkit-box-orient:vertical;-webkit-line-clamp:2;color:#161616;display:-webkit-box;font-size:16px;font-style:normal;font-weight:500;line-height:24px;margin-bottom:8px;overflow:hidden}.deeplink{text-decoration:none}.image-link{display:contents}picture{position:relative;width:100%}:host(.dimmed) picture::before{content:\"\";width:100%;height:100%;box-sizing:border-box;background:#f7f7f7;display:block;top:0;left:0;position:absolute;mix-blend-mode:multiply}";
735
+
736
+ let VviinnProductCard = class {
737
+ constructor(hostRef) {
738
+ index.registerInstance(this, hostRef);
739
+ this.recommendationLoad = index.createEvent(this, "recommendationLoad", 7);
740
+ this.recommendationView = index.createEvent(this, "recommendationView", 7);
741
+ this.recommendationClick = index.createEvent(this, "recommendationClick", 7);
742
+ this.productImageLoaded = index.createEvent(this, "productImageLoaded", 7);
743
+ this.currency = undefined;
744
+ this.imageRatio = 1;
745
+ this.imageWidth = 200;
746
+ this.locale = undefined;
747
+ this.pricePrefix = undefined;
748
+ this.responsive = false;
749
+ this.dimmedBackground = false;
750
+ /** @internal */
751
+ this.index = 0;
752
+ this.imageLoaded = false;
753
+ this.productData = null;
754
+ this.intersectionObserver = new IntersectionObserver(this.intersectionCallback.bind(this), { threshold: 1.0 });
755
+ }
756
+ connectedCallback() {
757
+ this.productData = this.getProductData();
758
+ }
759
+ getProductData() {
760
+ return {
761
+ product: this.productId,
762
+ rank: this.index,
763
+ };
764
+ }
765
+ intersectionCallback(data) {
766
+ if (data.some((entry) => entry.isIntersecting)) {
767
+ index$1._function.pipe(getAnalyticsModule, index$1.Option.map((analytics) => analytics.sendImpression(this.getProduct())));
768
+ this.recommendationView.emit(this.productData);
769
+ this.intersectionObserver.disconnect();
770
+ }
771
+ }
772
+ componentDidLoad() {
773
+ this.recommendationLoad.emit(this.productData);
774
+ this.intersectionObserver.observe(this.el);
775
+ const links = this.el.shadowRoot.querySelectorAll("a");
776
+ links.forEach((link) => link.addEventListener("click", (event) => {
777
+ event.preventDefault();
778
+ event.stopImmediatePropagation();
779
+ this.recommendationClick.emit(this.getProductData());
780
+ index$1._function.pipe(getAnalyticsModule, index$1.Option.match(() => null, (analytics) => analytics.sendClick(this.getProduct())));
781
+ }));
782
+ }
783
+ getProduct() {
784
+ return index$1.imageSearchState.results.find((r) => r.productId === this.productId);
785
+ }
786
+ renderImage() {
787
+ const props = {
788
+ width: this.imageWidth,
789
+ height: this.imageWidth * this.imageRatio,
790
+ src: this.image,
791
+ title: this.productTitle,
792
+ lazy: false,
793
+ };
794
+ return this.responsive
795
+ ? ResponsiveImage(props, () => this.emitImageLoaded())
796
+ : Image(props, () => this.emitImageLoaded());
797
+ }
798
+ emitImageLoaded() {
799
+ this.productImageLoaded.emit(this.productId);
800
+ }
801
+ render() {
802
+ var _a, _b, _c;
803
+ return (index.h(index.Host, { part: "product-card", class: { dimmed: this.dimmedBackground }, exportparts: "brand, currency, deeplink, image, image-link, price-amount-sale, price-amount-outdated, price-amount-regular, price-container, price-outdated, price-regular, price-sale, price-prefix, title" }, index.h(Linked, { deeplink: this.deeplink, part: "image-link" }, this.renderImage()), index.h(Linked, { deeplink: this.deeplink, part: "deeplink" }, index.h("span", { class: "title", part: "title" }, this.productTitle)), index.h("span", { class: "brand", part: "brand" }, this.brand), index.h("span", { class: "type", part: "type" }, this.productType), index.h(Price, { prefix: (_a = this.pricePrefix) !== null && _a !== void 0 ? _a : index$1.state.pricePrefix, currency: (_b = this.currency) !== null && _b !== void 0 ? _b : index$1.state.currencySign, price: this.price, salePrice: this.salePrice, locale: (_c = this.locale) !== null && _c !== void 0 ? _c : index$1.state.locale })));
804
+ }
805
+ get el() { return index.getElement(this); }
806
+ };
807
+ VviinnProductCard.style = vviinnProductCardCss;
808
+
574
809
  const vviinnServerErrorCss = ":host{display:block}";
575
810
 
576
811
  let VviinnServerError = class {
@@ -604,7 +839,7 @@ const getStyleMap = (data) => {
604
839
  };
605
840
  };
606
841
  const Arrow = ({ kind, tabindex, disabled, onClick, onKeyDown, }) => (index.h("div", { class: getStyleMap({ kind, disabled }), onClick: onClick, tabindex: tabindex, onKeyDown: onKeyDown },
607
- index.h(index$1.ArrowIcon, null)));
842
+ index.h(index$2.ArrowIcon, null)));
608
843
 
609
844
  const vviinnSliderCss = ":host{--color-primary-system:#0F62FE;--color-primary-hover-system:#014CDA;--color-icons-system:#2F8EDF;--spacer:8px}:host{--num-items:0;--position:0;display:grid;grid-gap:20px;justify-items:center;position:relative}.items-wrapper{overflow:hidden;width:100%}.items{box-sizing:border-box;display:grid;grid-auto-flow:column;grid-template-columns:repeat(var(--num-items), 100%);transform:translateX(calc(-100% * var(--position)));transition:transform 0.33s ease-in-out}.controls{display:grid;grid-gap:16px;grid-template-columns:repeat(var(--num-items), -webkit-min-content);grid-template-columns:repeat(var(--num-items), min-content)}.bullet{background:#e0e0e0;border-radius:50%;box-sizing:border-box;cursor:pointer;height:8px;width:8px;transition:background 0.1s ease-in-out}.bullet:hover{background:#c6c6c6}.bullet.active{background:var(--color-primary, var(--color-primary-system))}.bullet:active{background:transparent;border:2px solid var(--color-primary, var(--color-primary-system))}.arrow-wrapper{align-items:center;cursor:pointer;background:white;border:2px solid white;bottom:0;box-sizing:border-box;display:grid;height:calc(var(--spacer) * 6);justify-items:center;margin:auto;position:absolute;top:0;transform:translate3d(0, -50%, 0);transition:border 0.25ms ease-in-out;width:calc(var(--spacer) * 4)}.arrow-wrapper:active{border-color:var(--color-primary, var(--color-primary-system));opacity:0.75}.arrow-wrapper:focus{border-color:var(--color-primary, var(--color-primary-system));opacity:0.5;outline:none}.prev{left:0}.next{right:0}.next>svg{transform:rotate3d(0, 1, 0, 180deg)}.arrow-wrapper>svg{transition:fill 0.25ms ease-in-out;fill:#a8a8a8}.arrow-wrapper:hover>svg{fill:#8d8d8d}";
610
845
 
@@ -613,16 +848,20 @@ let VviinnSlider = class {
613
848
  index.registerInstance(this, hostRef);
614
849
  this.elementsCount = 0;
615
850
  this.internalPosition = 0;
616
- this.swipeStartPosition = imageSearch_store.Option.none;
851
+ this.swipeStartPosition = index$1.Option.none;
852
+ this.isRTL = false;
617
853
  this.showBullets = true;
618
854
  this.position = 0;
619
855
  this.showArrows = false;
620
856
  }
621
857
  positionWatchHandler(newValue) {
622
858
  this.internalPosition = newValue;
623
- this.el.style.setProperty("--position", `${newValue}`);
859
+ this.el.style.setProperty("--position", `${this.calculatePosition(newValue)}`);
624
860
  this.setActiveCssClassToSlide(newValue);
625
861
  }
862
+ componentWillLoad() {
863
+ this.isRTL = document.dir === "rtl";
864
+ }
626
865
  connectedCallback() {
627
866
  this.handleDomContentChanges();
628
867
  }
@@ -643,9 +882,9 @@ let VviinnSlider = class {
643
882
  this.setActiveCssClassToSlide(index);
644
883
  }
645
884
  renderBullets() {
646
- return this.showBullets ? (index.h("div", { class: "controls" }, imageSearch_store.NonEmptyArray.range(0, this.elementsCount - 1).map((i) => (index.h("div", { class: {
885
+ return this.showBullets ? (index.h("div", { class: "controls" }, index$1.NonEmptyArray.range(0, this.elementsCount - 1).map((i) => (index.h("div", { class: {
647
886
  bullet: true,
648
- active: i == this.internalPosition % this.elementsCount,
887
+ active: i == Math.abs(this.internalPosition) % this.elementsCount,
649
888
  }, onClick: () => this.goToSlide(i) }))))) : null;
650
889
  }
651
890
  nextSlide() {
@@ -659,10 +898,14 @@ let VviinnSlider = class {
659
898
  this.renderSlidePosition();
660
899
  }
661
900
  renderSlidePosition() {
901
+ const position = this.internalPosition % this.elementsCount;
662
902
  requestAnimationFrame(() => {
663
- this.el.style.setProperty("--position", `${this.internalPosition % this.elementsCount}`);
903
+ this.el.style.setProperty("--position", `${this.calculatePosition(position)}`);
664
904
  });
665
905
  }
906
+ calculatePosition(position) {
907
+ return this.isRTL ? position * -1 : position;
908
+ }
666
909
  handleKeyDown(event) {
667
910
  if (event.key !== "Space" && event.key !== "Enter")
668
911
  return;
@@ -680,13 +923,13 @@ let VviinnSlider = class {
680
923
  handleTouchStart(event) {
681
924
  if (!this.showBullets)
682
925
  return;
683
- this.swipeStartPosition = imageSearch_store._function.pipe(event.touches[0], imageSearch_store.Option.fromNullable, imageSearch_store.Option.map((t) => t.clientX));
926
+ this.swipeStartPosition = index$1._function.pipe(event.touches[0], index$1.Option.fromNullable, index$1.Option.map((t) => t.clientX));
684
927
  }
685
928
  handleTouchEnd(event) {
686
929
  if (!this.showBullets)
687
930
  return;
688
- const swipeEndPosition = imageSearch_store._function.pipe(event.changedTouches[0], imageSearch_store.Option.fromNullable, imageSearch_store.Option.map((t) => t.clientX));
689
- imageSearch_store._function.pipe(imageSearch_store.sequenceToOption(this.swipeStartPosition, swipeEndPosition), imageSearch_store.Option.map(([start, end]) => Ord.compare(start, end)), imageSearch_store.Option.map((swipeDirection) => {
931
+ const swipeEndPosition = index$1._function.pipe(event.changedTouches[0], index$1.Option.fromNullable, index$1.Option.map((t) => t.clientX));
932
+ index$1._function.pipe(index$1.sequenceToOption(this.swipeStartPosition, swipeEndPosition), index$1.Option.map(([start, end]) => Ord.compare(start, end)), index$1.Option.map((swipeDirection) => {
690
933
  switch (swipeDirection) {
691
934
  case 1:
692
935
  return this.nextSlide();
@@ -698,8 +941,8 @@ let VviinnSlider = class {
698
941
  render() {
699
942
  return (index.h(index.Host, null, index.h("div", { class: "items-wrapper" }, index.h("div", { class: "items", onTouchStart: (e) => this.handleTouchStart(e), onTouchEnd: (e) => this.handleTouchEnd(e) }, index.h("slot", null))), this.showArrows
700
943
  ? [
701
- index.h(Arrow, { kind: "prev", onClick: () => this.prevSlide(), onKeyDown: (ev) => this.handleKeyDown(ev), tabindex: 1, disabled: false }),
702
- index.h(Arrow, { kind: "next", onClick: () => this.nextSlide(), onKeyDown: (ev) => this.handleKeyDown(ev), tabindex: 0, disabled: false }),
944
+ index.h(Arrow, { kind: "prev", onClick: () => this.isRTL ? this.nextSlide() : this.prevSlide(), onKeyDown: (ev) => this.handleKeyDown(ev), tabindex: 1, disabled: false }),
945
+ index.h(Arrow, { kind: "next", onClick: () => this.isRTL ? this.prevSlide() : this.nextSlide(), onKeyDown: (ev) => this.handleKeyDown(ev), tabindex: 0, disabled: false }),
703
946
  ]
704
947
  : null, this.renderBullets()));
705
948
  }
@@ -726,6 +969,203 @@ let VviinnTeaser = class {
726
969
  };
727
970
  VviinnTeaser.style = vviinnTeaserCss;
728
971
 
972
+ const vviinnVpsWidgetCss = ":host{--color-primary-system:#0F62FE;--color-primary-hover-system:#014CDA;--color-icons-system:#2F8EDF;--spacer:8px}:host{display:block}.hidden{visibility:hidden;height:1px}vviinn-overlayed-modal.first-screen::part(title),vviinn-overlayed-modal.first-screen::part(secondary-action){visibility:hidden}.start-page{display:grid;grid-template-columns:repeat(2, 1fr);min-height:580px}.start-page_block{align-content:start;border-right:1px solid #f4f4f4;display:grid;padding:48px}.start-page_block.error{align-content:center}#onboarding-block{border-right:unset;box-sizing:border-box;grid-gap:24px;overflow-y:auto;position:relative;width:100%}vviinn-teaser{margin-bottom:32px;margin-top:-24px}vviinn-image-selector{align-items:center;background:var(--color-primary, var(--color-primary-system));border-color:var(--color-primary, var(--color-primary-system));border-radius:2px;color:white;display:grid;font-size:16px;font-weight:600;height:56px;justify-items:center;margin-bottom:16px;transition:background 0.1s ease-in-out}vviinn-image-selector:hover{background:var(--color-primary-hover, var(--color-primary-hover-system));border-color:var(--color-primary-hover, var(--color-primary-hover-system))}vviinn-image-selector:active{border-color:black}.upload-button-content{display:grid;align-items:center;justify-items:start;justify-content:center;grid-template-columns:-webkit-max-content auto;grid-template-columns:max-content auto;grid-gap:16px}.results-page{display:grid;grid-template-columns:336px auto;box-sizing:border-box}.results-page>*{padding:24px;box-sizing:border-box}.products{align-content:center;align-items:start;box-sizing:border-box;display:grid;grid-gap:32px 16px;grid-template-columns:repeat(auto-fill, minmax(152px, 1fr));justify-items:center;padding:24px;padding-right:0;position:absolute;width:calc(100% - 16px)}.products.hidden{display:none}vviinn-empty-results{width:280px;align-self:center;justify-self:center}.products-wrapper{display:grid;overflow-y:auto;overflow-x:hidden;padding:unset;position:relative;width:100%}.image-wrapper{border-right:1px solid #f4f4f4;display:grid;grid-template-rows:-webkit-min-content 170px;grid-template-rows:min-content 170px;grid-gap:24px;min-width:100%}.onboarding-wrapper{position:absolute;width:100%;padding:48px;box-sizing:border-box;display:grid;grid-gap:64px;padding-bottom:24px}vviinn-product-card{gap:0;width:100%}vviinn-product-card::part(image){border:1px solid #eaeaea;margin-bottom:8px}vviinn-product-card::part(price-container),vviinn-product-card::part(deeplink),vviinn-product-card::part(title){align-self:start}search-filters span{display:none}search-filters::part(filter){background:#f4f4f4;border-radius:4px;border:1px solid #f4f4f4;box-sizing:border-box;color:#161616;font-size:14px;font-weight:600;line-height:20px}search-filters::part(show-more-filters){border:1px solid #f4f4f4;border-radius:4px;box-sizing:border-box;color:#161616;font-size:14px;font-weight:600;line-height:20px;padding:6px 16px}search-filters::part(show-more-filters):hover{background:#eaeaea}search-filters::part(filter):hover{background:#eaeaea}search-filters::part(filter):focus{outline:none;border:1px solid var(--color-primary, var(--color-primary-system))}search-filters::part(filter active){background:rgba(15, 98, 254, 0.15);color:var(--color-primary, var(--color-primary-system))}.filters-wrapper{overflow:auto}.results-page:not(.active){display:none}.nothing-found{display:grid;grid-gap:64px;justify-self:center;padding-top:64px;padding-bottom:16px;position:absolute;width:60%}@media (max-width: 768px){.start-page_block{padding:24px}.onboarding-wrapper{padding:24px}}@media (max-width: 640px){.start-page{grid-template-rows:-webkit-min-content;grid-template-rows:min-content;grid-template-columns:unset;grid-gap:48px;padding:24px 0 48px 0}}@media (max-width: 640px) and (min-width: 415px){.onboarding-wrapper{position:unset}#onboarding-block{overflow:unset}.start-page.active{height:1px;overflow:auto}}@media (max-width: 415px){.results-page>*{box-sizing:border-box;padding:24px}vviinn-slide{padding-bottom:48px}.start-page_block:last-of-type{border-right:unset;overflow-y:unset;position:static;box-sizing:border-box;width:unset}.start-page_block{padding:0 24px}vviinn-teaser{margin-top:24px}.onboarding-wrapper{position:static;width:unset;padding:unset;box-sizing:border-box}.results-page{grid-template-columns:unset;grid-template-rows:-webkit-min-content auto;grid-template-rows:min-content auto}.image{margin-bottom:8px}.image-wrapper{grid-template-rows:-webkit-min-content auto;grid-template-rows:min-content auto;width:100%}.products-wrapper{align-content:start;position:static;overflow-y:unset;width:100%;padding-top:0}.products{position:static;padding:0;width:unset;grid-gap:32px 16px;justify-content:center}.nothing-found{position:static;grid-gap:64px;padding:unset;align-content:start;width:unset}}@media (max-width: 320px){.products{grid-template-columns:unset}}vviinn-wrong-format,vviinn-server-error{width:280px;align-self:center;justify-self:center}";
973
+
974
+ const filterInt = (value) => /^[-+]?(\d+|Infinity)$/.test(value) ? Number(value) : NaN;
975
+ const notEmptyString = (s) => !index$1.isEmpty(s);
976
+ const notNan = (n) => !isNaN(n);
977
+ let VviinnVpsWidget = class {
978
+ constructor(hostRef) {
979
+ index.registerInstance(this, hostRef);
980
+ this.globalSlotsChanged = index.createEvent(this, "globalSlotsChanged", 7);
981
+ /** @internal */
982
+ this.apiPath = "https://api.vviinn.com";
983
+ /** When true modal window with widget will be shown */
984
+ this.active = false;
985
+ /** Currency sign will shown after price */
986
+ this.currencySign = "€";
987
+ /** Locale for currency formatting */
988
+ this.locale = "de-DE";
989
+ /** set true when showing the widget in button */
990
+ this.showingInButton = false;
991
+ this.slidePosition = 0;
992
+ this.width = 0;
993
+ this.wrongImageFormat = false;
994
+ this.trackingDeactivated = false;
995
+ this.imageSource = null;
996
+ this.setTrackingDeactivated = (result) => {
997
+ if (result.status === "rejected") {
998
+ this.trackingDeactivated = true;
999
+ }
1000
+ };
1001
+ }
1002
+ componentDidLoad() {
1003
+ const slots = this.el.querySelectorAll("[slot]");
1004
+ this.globalSlotsChanged.emit(Array.from(slots));
1005
+ }
1006
+ activeWatcher(value) {
1007
+ if (value) {
1008
+ this.overflow = document.body.style.overflow;
1009
+ document.body.style.overflow = "hidden";
1010
+ this.trackOpenEvent();
1011
+ }
1012
+ else {
1013
+ document.body.style.overflow = this.overflow;
1014
+ }
1015
+ }
1016
+ trackRecommendationView({ detail }) {
1017
+ if (this.trackingDeactivated)
1018
+ return;
1019
+ const recommendationViewEvent = index$1.createProductViewVpsEvent(Object.assign({ session_id: this.uiSessionId }, detail));
1020
+ this.trackingApi
1021
+ .trackEvent(recommendationViewEvent)
1022
+ .then(this.setTrackingDeactivated);
1023
+ }
1024
+ async trackRecommendationClick({ detail }) {
1025
+ const recommendationClickEvent = index$1.createProductClickVpsEvent(Object.assign({ session_id: this.uiSessionId }, detail));
1026
+ if (!this.trackingDeactivated) {
1027
+ await this.trackingApi
1028
+ .trackEvent(this.trackingDeactivated ? null : recommendationClickEvent)
1029
+ .then(this.setTrackingDeactivated);
1030
+ }
1031
+ const product = index$1.imageSearchState.results.find((r) => r.productId === detail.product);
1032
+ if (!product || !product.deeplink)
1033
+ return;
1034
+ window.location.href = product.deeplink;
1035
+ }
1036
+ trachSearchAreaChanges() {
1037
+ if (this.trackingDeactivated)
1038
+ return;
1039
+ const searchEvent = index$1.createSearchEvent({
1040
+ session_id: this.uiSessionId,
1041
+ source: this.imageSource,
1042
+ search_area: "manual-selection",
1043
+ });
1044
+ this.trackingApi.trackEvent(searchEvent).then(this.setTrackingDeactivated);
1045
+ }
1046
+ trackDetectedObject() {
1047
+ if (this.trackingDeactivated)
1048
+ return;
1049
+ const searchEvent = index$1.createSearchEvent({
1050
+ session_id: this.uiSessionId,
1051
+ source: this.imageSource,
1052
+ search_area: "attention-point",
1053
+ });
1054
+ this.trackingApi.trackEvent(searchEvent).then(this.setTrackingDeactivated);
1055
+ }
1056
+ trackFilter({ detail }) {
1057
+ if (this.trackingDeactivated)
1058
+ return;
1059
+ const searchEvent = index$1.createFilterEvent({
1060
+ session_id: this.uiSessionId,
1061
+ source: this.imageSource,
1062
+ kind: "category",
1063
+ action: detail,
1064
+ });
1065
+ this.trackingApi.trackEvent(searchEvent).then(this.setTrackingDeactivated);
1066
+ }
1067
+ componentWillLoad() {
1068
+ customizedSlots.slotChangeListener(this, this.el);
1069
+ }
1070
+ connectedCallback() {
1071
+ index$1.state.apiPath = this.apiPath;
1072
+ index$1.state.currencySign = this.currencySign;
1073
+ index$1.state.locale = this.locale;
1074
+ index$1.imageSearchState.token = this.token;
1075
+ index$1.imageSearchState.campaignId = index$1._function.pipe(this.campaignId, index$1.Option.fromNullable, index$1.Option.chain(index$1.Option.fromPredicate(notEmptyString)), index$1.Option.map(filterInt), index$1.Option.chain(index$1.Option.fromPredicate(notNan)), index$1.Option.map((s) => `${s}`));
1076
+ this.uiSessionId = index$1.v4();
1077
+ this.trackingApi = index$1.createTrackingApi(this.apiPath, this.token);
1078
+ }
1079
+ trackOpenEvent() {
1080
+ if (this.trackingDeactivated)
1081
+ return;
1082
+ const widgetOpenEvent = index$1.createWidgetVpsEvent({
1083
+ action: "open",
1084
+ session_id: this.uiSessionId,
1085
+ });
1086
+ this.trackingApi
1087
+ .trackEvent(widgetOpenEvent)
1088
+ .then(this.setTrackingDeactivated);
1089
+ }
1090
+ handleImageSelection(source) {
1091
+ this.imageSource = source;
1092
+ this.slidePosition = 1;
1093
+ const root = this.el.shadowRoot.querySelector("vviinn-overlayed-modal");
1094
+ const overlay = root.shadowRoot.querySelector("vviinn-overlay");
1095
+ const modal = overlay.querySelector("vviinn-modal");
1096
+ const modalBody = modal.shadowRoot.querySelector(".body");
1097
+ modalBody.scrollTop = 0;
1098
+ this.trackInitialSearch();
1099
+ }
1100
+ trackInitialSearch() {
1101
+ if (this.trackingDeactivated)
1102
+ return;
1103
+ const searchEvent = index$1.createSearchEvent({
1104
+ session_id: this.uiSessionId,
1105
+ source: this.imageSource,
1106
+ search_area: "full",
1107
+ });
1108
+ this.trackingApi.trackEvent(searchEvent).then(this.setTrackingDeactivated);
1109
+ }
1110
+ resetState() {
1111
+ this.resetScroll("onboarding-block");
1112
+ this.slidePosition = 0;
1113
+ index$1.imageSearchState.image = index$1.Option.none;
1114
+ index$1.imageSearchState.imageUrl = index$1.Option.none;
1115
+ index$1.imageSearchState.imageBounds = index$1.Option.none;
1116
+ index$1.imageSearchState.searchArea = index$1.Option.none;
1117
+ index$1.imageSearchState.results = [];
1118
+ index$1.imageSearchState.filters = [];
1119
+ index$1.imageSearchState.detectedObjects = [];
1120
+ index$1.imageSearchState.activeIonLink = undefined;
1121
+ index$1.imageSearchState.rectangleSearchForm = undefined;
1122
+ index$1.imageSearchState.loading = false;
1123
+ this.resetScroll("results-block");
1124
+ }
1125
+ haveErrors() {
1126
+ return this.wrongImageFormat || index$1.imageSearchState.serverError;
1127
+ }
1128
+ resetScroll(elementId, behavior = "auto") {
1129
+ const element = this.el.shadowRoot.getElementById(elementId);
1130
+ element.scroll({ top: 0, left: 0, behavior });
1131
+ }
1132
+ handleModalClose() {
1133
+ this.active = false;
1134
+ this.resetState();
1135
+ const elementsToReset = ["onboarding-block", "results-block"];
1136
+ elementsToReset.forEach((name) => this.resetScroll(name));
1137
+ if (this.trackingDeactivated)
1138
+ return;
1139
+ const widgetOpenEvent = index$1.createWidgetVpsEvent({
1140
+ action: "close",
1141
+ session_id: this.uiSessionId,
1142
+ });
1143
+ this.trackingApi
1144
+ .trackEvent(widgetOpenEvent)
1145
+ .then(this.setTrackingDeactivated);
1146
+ }
1147
+ render() {
1148
+ return (index.h(index.Host, null, !this.showingInButton && index.h(customizedSlots.SlotSkeleton, null), index.h("vviinn-overlayed-modal", { class: { "first-screen": this.slidePosition === 0 }, active: this.active, onSecondaryActionClicked: () => this.resetState(), onModalClosed: () => this.handleModalClose(), exportparts: "secondary-action, title, close-button, example-images" }, index.h("vviinn-slider", { showBullets: false, position: this.slidePosition }, index.h("vviinn-slide", { class: { "start-page": true } }, index.h("div", { class: {
1149
+ error: this.haveErrors(),
1150
+ "start-page_block": true,
1151
+ } }, index.h("vviinn-wrong-format", { class: { hidden: !this.wrongImageFormat }, onActionClick: () => (this.wrongImageFormat = false) }), index.h("vviinn-server-error", { class: { hidden: !index$1.imageSearchState.serverError }, onActionClick: () => (index$1.imageSearchState.serverError = false) }), index.h("vviinn-teaser", { class: { hidden: this.haveErrors() } }), index.h("vviinn-image-selector", { class: { hidden: this.haveErrors() }, onImageSelected: () => this.handleImageSelection("upload"), onImageSelectedError: () => (this.wrongImageFormat = true), part: "select-image_button" }, index.h("span", { slot: "upload-button-text", class: "upload-button-content" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "29", height: "28", fill: "none" }, index.h("defs", null), index.h("path", { fill: "#fff", "fill-rule": "evenodd", d: "M10.271 3.89A.875.875 0 0111 3.5h7c.293 0 .566.146.728.39l1.49 2.235h3.033a2.625 2.625 0 012.625 2.625V21a2.625 2.625 0 01-2.625 2.625H5.75A2.625 2.625 0 013.125 21V8.75A2.625 2.625 0 015.75 6.125h3.031l1.49-2.235zm1.197 1.36l-1.49 2.235a.875.875 0 01-.729.39H5.75a.875.875 0 00-.875.875V21a.875.875 0 00.875.875h17.5a.875.875 0 00.875-.875V8.75a.875.875 0 00-.875-.875h-3.5a.875.875 0 01-.729-.39l-1.49-2.235h-6.063z", "clip-rule": "evenodd" }), index.h("path", { fill: "#fff", "fill-rule": "evenodd", d: "M14.5 11.375a3.062 3.062 0 100 6.125 3.062 3.062 0 000-6.125zm-4.813 3.063a4.812 4.812 0 119.625 0 4.812 4.812 0 01-9.625 0z", "clip-rule": "evenodd" })), index.h("slot", { name: "vviinn-image-upload-button-text" }, index.h("span", null, "Kamera oder Bild ausw\u00E4hlen")))), index.h("vviinn-privacy-badge", { class: { hidden: this.haveErrors() } })), index.h("div", { id: "onboarding-block", class: "start-page_block" }, index.h("div", { class: "onboarding-wrapper" }, index.h("vviinn-onboarding", null), index.h("vviinn-example-images", { part: "example-images", onImageSelected: () => this.handleImageSelection("example"), onImageSelectedError: () => this.resetScroll("onboarding-block", "smooth") })))), index.h("vviinn-slide", { class: { "results-page": true, active: this.slidePosition == 1 } }, index.h("div", { class: "image-wrapper" }, index.h("vviinn-image-view", null), index.h("div", { class: "filters-wrapper" }, index.h("div", { class: "filters" }, index$1.imageSearchState.filters.map((filter) => (index.h("search-filters", { filter: filter })))))), index.h("div", { id: "results-block", class: "products-wrapper" }, index.h("div", { class: {
1152
+ "nothing-found": true,
1153
+ hidden: index$1.imageSearchState.results.length > 0,
1154
+ } }, index.h("vviinn-empty-results", null), index.h("vviinn-onboarding", null)), index.h("div", { class: {
1155
+ hidden: index$1.imageSearchState.results.length <= 0,
1156
+ products: true,
1157
+ } }, index$1.imageSearchState.results.map((p, i) => {
1158
+ var _a;
1159
+ return (index.h("vviinn-product-card", { hidden: true, productTitle: p.title, productId: p.productId, brand: p.brand, deeplink: p.deeplink, price: p.price.actual, salePrice: p.price.sale, imageWidth: 160, image: (_a = p.image.thumbnail) !== null && _a !== void 0 ? _a : p.image.original, part: "product-card", index: i }));
1160
+ }))))))));
1161
+ }
1162
+ get el() { return index.getElement(this); }
1163
+ static get watchers() { return {
1164
+ "active": ["activeWatcher"]
1165
+ }; }
1166
+ };
1167
+ VviinnVpsWidget.style = vviinnVpsWidgetCss;
1168
+
729
1169
  const vviinnWrongFormatCss = ":host{display:block}";
730
1170
 
731
1171
  let VviinnWrongFormat = class {
@@ -739,11 +1179,13 @@ let VviinnWrongFormat = class {
739
1179
  };
740
1180
  VviinnWrongFormat.style = vviinnWrongFormatCss;
741
1181
 
1182
+ exports.cropper_handler = CropperHandler;
742
1183
  exports.highlight_box = HighlightBox;
743
1184
  exports.image_cropper = ImageCropper;
744
1185
  exports.search_filters = SearchFilters;
745
1186
  exports.vviinn_detected_object = VviinnDetectedObject;
746
1187
  exports.vviinn_empty_results = VviinnEmptyResults;
1188
+ exports.vviinn_error = VviinnError;
747
1189
  exports.vviinn_example_image = VviinnExampleImage;
748
1190
  exports.vviinn_example_images = VviinnExampleImages;
749
1191
  exports.vviinn_image_selector = VviinnImageSelector;
@@ -755,9 +1197,12 @@ exports.vviinn_onboarding_card_2 = VviinnOnboardingCard2;
755
1197
  exports.vviinn_onboarding_card_3 = VviinnOnboardingCard3;
756
1198
  exports.vviinn_overlay = VviinnOverlay;
757
1199
  exports.vviinn_overlayed_modal = VviinnOverlayedModal;
1200
+ exports.vviinn_preloader = VviinnPreloader;
758
1201
  exports.vviinn_privacy_badge = VviinnPrivacyBadge;
1202
+ exports.vviinn_product_card = VviinnProductCard;
759
1203
  exports.vviinn_server_error = VviinnServerError;
760
1204
  exports.vviinn_slide = VviinnSlide;
761
1205
  exports.vviinn_slider = VviinnSlider;
762
1206
  exports.vviinn_teaser = VviinnTeaser;
1207
+ exports.vviinn_vps_widget = VviinnVpsWidget;
763
1208
  exports.vviinn_wrong_format = VviinnWrongFormat;